text
stringlengths 2
1.05M
|
|---|
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module&&"function"==typeof require?n(require("../moment")):"function"==typeof define&&define.amd?define(["../moment"],n):n(e.moment)}(this,function(e){"use strict";var n="ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"),o="ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_");return e.defineLocale("es",{months:"enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),monthsShort:function(e,s){return/-MMM-/.test(s)?o[e.month()]:n[e.month()]},monthsParseExact:!0,weekdays:"domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),weekdaysShort:"dom._lun._mar._mié._jue._vie._sáb.".split("_"),weekdaysMin:"do_lu_ma_mi_ju_vi_sá".split("_"),weekdaysParseExact:!0,longDateFormat:{LT:"H:mm",LTS:"H:mm:ss",L:"DD/MM/YYYY",LL:"D [de] MMMM [de] YYYY",LLL:"D [de] MMMM [de] YYYY H:mm",LLLL:"dddd, D [de] MMMM [de] YYYY H:mm"},calendar:{sameDay:function(){return"[hoy a la"+(1!==this.hours()?"s":"")+"] LT"},nextDay:function(){return"[mañana a la"+(1!==this.hours()?"s":"")+"] LT"},nextWeek:function(){return"dddd [a la"+(1!==this.hours()?"s":"")+"] LT"},lastDay:function(){return"[ayer a la"+(1!==this.hours()?"s":"")+"] LT"},lastWeek:function(){return"[el] dddd [pasado a la"+(1!==this.hours()?"s":"")+"] LT"},sameElse:"L"},relativeTime:{future:"en %s",past:"hace %s",s:"unos segundos",m:"un minuto",mm:"%d minutos",h:"una hora",hh:"%d horas",d:"un día",dd:"%d días",M:"un mes",MM:"%d meses",y:"un año",yy:"%d años"},ordinalParse:/\d{1,2}º/,ordinal:"%dº",week:{dow:1,doy:4}})});
|
/*!
* froala_editor v3.2.3 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2020 Froala Labs
*/
!function(e,c){"object"==typeof exports&&"undefined"!=typeof module?c(require("froala-editor")):"function"==typeof define&&define.amd?define(["froala-editor"],c):c(e.FroalaEditor)}(this,function(S){"use strict";S=S&&S.hasOwnProperty("default")?S["default"]:S,Object.assign(S.POPUP_TEMPLATES,{emoticons:"[_BUTTONS_][_CUSTOM_LAYER_]"}),Object.assign(S.DEFAULTS,{emoticonsSet:[{id:"people",name:"Smileys & People",code:"1f600",emoticons:[{code:"1f600",desc:"Grinning face"},{code:"1f601",desc:"Grinning Face with Smiling Eyes"},{code:"1f602",desc:"Face with Tears of Joy"},{code:"1f603",desc:"Smiling Face with Open Mouth"},{code:"1f604",desc:"Smiling Face with Open Mouth and Smiling Eyes"},{code:"1f605",desc:"Smiling Face with Open Mouth and Cold Sweat"},{code:"1f606",desc:"Smiling Face with Open Mouth and Tightly-Closed Eyes"},{code:"1f609",desc:"Winking Face"},{code:"1f60a",desc:"Smiling Face with Smiling Eyes"},{code:"1f608",desc:"Face Savouring Delicious Food"},{code:"1f60e",desc:"Smiling Face with Sunglasses"},{code:"1f60d",desc:"Smiling Face with Heart-Shaped Eyes"},{code:"1f618",desc:"Face Throwing a Kiss"},{code:"1f617",desc:"Kissing Face"},{code:"1f619",desc:"Kissing Face with Smiling Eyes"},{code:"1f61a",desc:"Kissing Face with Closed Eyes"},{code:"263a",desc:"White Smiling Face"},{code:"1f642",desc:"Slightly Smiling Face"},{code:"1f610",desc:"Neutral Face"},{code:"1f611",desc:"Expressionless Face"},{code:"1f636",desc:"Face Without Mouth"},{code:"1f60f",desc:"Smirking Face"},{code:"1f623",desc:"Persevering Face"},{code:"1f625",desc:"Disappointed but Relieved Face"},{code:"1f62e",desc:"Face with Open Mouth"},{code:"1f62f",desc:"Hushed Face"},{code:"1f62a",desc:"Sleepy Face"},{code:"1f62b",desc:"Tired Face"},{code:"1f634",desc:"Sleeping Face"},{code:"1f60c",desc:"Relieved Face"},{code:"1f61b",desc:"Face with Stuck-out Tongue"},{code:"1f61c",desc:"Face with Stuck-out Tongue and Winking Eye"},{code:"1f61d",desc:"Face with Stuck-out Tongue and Tightly-Closed Eyes"},{code:"1f612",desc:"Unamused Face"},{code:"1f613",desc:"Face with Cold Sweat"},{code:"1f613",desc:"Face with Cold Sweat"},{code:"1f614",desc:"Pensive Face"},{code:"1f615",desc:"Confused Face"},{code:"1f632",desc:"Astonished Face"},{code:"1f616",desc:"Confounded Face"},{code:"1f61e",desc:"Disappointed Face"},{code:"1f61f",desc:"Worried Face"},{code:"1f624",desc:"Face with Look of Triumph"},{code:"1f622",desc:"Crying Face"},{code:"1f62d",desc:"Loudly Crying Face"},{code:"1f626",desc:"Frowning Face with Open Mouth"},{code:"1f627",desc:"Anguished Face"},{code:"1f628",desc:"Fearful Face"},{code:"1f629",desc:"Weary Face"},{code:"1f62c",desc:"Grimacing Face"},{code:"1f630",desc:"Face with Open Mouth and Cold Sweat"},{code:"1f631",desc:"Face Screaming in Fear"},{code:"1f633",desc:"Flushed Face"},{code:"1f635",desc:"Dizzy Face"},{code:"1f621",desc:"Pouting Face"},{code:"1f620",desc:"Angry Face"},{code:"1f637",desc:"Face with Medical Mask"},{code:"1f607",desc:"Smiling Face with Halo"},{code:"1f608",desc:"Smiling Face with Horns"},{code:"1f47f",desc:"Imp"},{code:"1f479",desc:"Japanese Ogre"},{code:"1f47a",desc:"Japanese Goblin"},{code:"1f480",desc:"Skull"},{code:"1f47b",desc:"Ghost"},{code:"1f47d",desc:"Extraterrestrial Alien"},{code:"1f47e",desc:"Alien Monster"},{code:"1f4a9",desc:"Pile of Poo"},{code:"1f63a",desc:"Smiling Cat Face with Open Mouth"},{code:"1f638",desc:"Grinning Cat Face with Smiling Eyes"},{code:"1f639",desc:"Cat Face with Tears of Joy"},{code:"1f63b",desc:"Smiling Cat Face with Heart-Shaped Eyes"},{code:"1f63c",desc:"Cat Face with Wry Smile"},{code:"1f63d",desc:"Kissing Cat Face with Closed Eyes"},{code:"1f640",desc:"Weary Cat Face"},{code:"1f63f",desc:"Crying Cat Face"},{code:"1f63e",desc:"Pouting Cat Face"},{code:"1f648",desc:"See-No-Evil Monkey"},{code:"1f649",desc:"Hear-No-Evil Monkey"},{code:"1f64a",desc:"Speak-No-Evil Monkey"},{code:"1f476",desc:"Baby"},{code:"1f466",desc:"Boy"},{code:"1f467",desc:"Girl"},{code:"1f468",desc:"Man"},{code:"1f469",desc:"Woman"},{code:"1f474",desc:"Older Man"},{code:"1f475",desc:"Older Woman"},{code:"1f46e",desc:"Police Officer"},{code:"1f482",desc:" Guardsman"},{code:"1f477",desc:" Construction Worker"},{code:"1f478",desc:"Princess"},{code:"1f473",desc:"Man with Turban"},{code:"1f472",desc:"Man with Gua Pi Mao"},{code:"1f471",desc:"Person with Blond Hair"},{code:"1f470",desc:"Bride with Veil"},{code:"1f47c",desc:"Baby Angel"},{code:"1f385",desc:"Father Christmas"},{code:"1f64e",desc:"Person with Pouting Face"},{code:"1f645",desc:"Face with No Good Gesture"},{code:"1f646",desc:"Face with Ok Gesture"},{code:"1f481",desc:"Information Desk Person"},{code:"1f64b",desc:"Happy Person Raising One Hand"},{code:"1f647",desc:"Person Bowing Deeply"},{code:"1f486",desc:"Face Massage"},{code:"1f487",desc:"Haircut"},{code:"1f6b6",desc:"Pedestrian"},{code:"1f3c3",desc:"Runner"},{code:"1f483",desc:"Dancer"},{code:"1f46f",desc:"Woman with Bunny Ears"},{code:"1f6c0",desc:"Bath"},{code:"1f464",desc:"Bust in Silhouette"},{code:"1f465",desc:"Busts in Silhouette"},{code:"1f3c7",desc:"Horse Racing"},{code:"1f3c2",desc:" Snowboarder"},{code:"1f3c4",desc:" Surfer"},{code:"1f6a3",desc:" Rowboat"},{code:"1f3ca",desc:" Swimmer"},{code:"1f6b4",desc:" Bicyclist"},{code:"1f6b5",desc:"Mountain Bicyclist"},{code:"1f46b",desc:" Man and Woman Holding Hands"},{code:"1f46c",desc:"Two Men Holding Hands"},{code:"1f46d",desc:"Two Women Holding Hands"},{code:"1f48f",desc:"Kiss"},{code:"1f468-2764-1f48b-1f468",uCode:"\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc8b\u200d\ud83d\udc68",desc:"Man Kiss Man"},{code:"1f469-2764-1f48b-1f469",uCode:"\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc69",desc:"Woman Kiss Woman"},{code:"1f491",desc:"Couple with Heart"},{code:"1f468-2764-1f468",uCode:"\ud83d\udc68\u200d\u2764\ufe0f\u200d\ud83d\udc68",desc:"Man Heart Man"},{code:"1f469-2764-1f469",uCode:"\ud83d\udc69\u200d\u2764\ufe0f\u200d\ud83d\udc69",desc:"Woman Heart Woman"},{code:"1f46a",desc:"Family"},{code:"1f468",desc:"Man Woman Boy"},{code:"1f468-1f469-1f467",desc:"Man Woman Girl"},{code:"1f468-1f469-1f467-1f466",desc:"Man Woman Girl Boy"},{code:"1f468-1f469-1f466-1f466",desc:"Man Woman Boy Boy"},{code:"1f468-1f469-1f467-1f467",desc:"Man Woman Girl Girl"},{code:"1f468-1f468-1f466",desc:"Man Man Boy"},{code:"1f468-1f468-1f467",desc:"Man Man Girl"},{code:"1f468-1f468-1f467-1f466",desc:"Man Man Girl Boy"},{code:"1f468-1f468-1f466-1f466",desc:"Man Man Boy Boy"},{code:"1f469-1f469-1f466",desc:"Woman Woman Boy"},{code:"1f469-1f469-1f467",desc:"Woman Woman Girl"},{code:"1f469-1f469-1f467-1f466",desc:"Woman Woman Girl Boy"},{code:"1f469-1f469-1f467-1f467",desc:"Woman Woman Girl Girl"},{code:"1f4aa",desc:"Flexed Biceps"},{code:"1f448",desc:"White Left Pointing Backhand Index"},{code:"1f449",desc:"White Right Pointing Backhand Index"},{code:"1f446",desc:"White Up Pointing Backhand Index"},{code:"1f447",desc:"White Down Pointing Backhand Index"},{code:"270c",desc:"Victory Hand"},{code:"270b",desc:"Raised Hand"},{code:"1f44c",desc:"Ok Hand Sign"},{code:"1f44d",desc:"Thumbs Up Sign"},{code:"1f44e",desc:"Thumbs Down Sign"},{code:"270a",desc:"Raised Fist"},{code:"1f44a",desc:"Fisted Hand Sign"},{code:"1f44b",desc:"Waving Hand Sign"},{code:"1f44f",desc:"Clapping Hands Sign"},{code:"1f450",desc:"Open Hands Sign"},{code:"1f64c",desc:"Person Raising Both Hands in Celebration"},{code:"1f64f",desc:"Person with Folded Hands"},{code:"1f485",desc:"Nail Polish"},{code:"1f442",desc:"Ear"},{code:"1f443",desc:"Nose"},{code:"1f463",desc:"Footprints"},{code:"1f440",desc:"Eyes"},{code:"1f445",desc:"Tongue"},{code:"1f444",desc:"Mouth"},{code:"1f48b",desc:"Kiss Mark"},{code:"1f498",desc:"Heart with Arrow"},{code:"2764",desc:"Heavy Black Heart"},{code:"1f493",desc:"Heavy Black Heart"},{code:"1f494",desc:"Broken Heart"},{code:"1f495",desc:"Two Hearts"},{code:"1f496",desc:"Sparkling Hearts"},{code:"1f497",desc:"Growing Hearts"},{code:"1f499",desc:"Blue Heart"},{code:"1f49a",desc:"Green Heart"},{code:"1f49b",desc:"Yellow Heart"},{code:"1f49c",desc:"Purple Heart"},{code:"1f49d",desc:"Heart with Ribbon"},{code:"1f49e",desc:"Revolving Hearts"},{code:"1f49f",desc:"Heart Decoration"},{code:"1f48c",desc:"Love Letter"},{code:"1f4a4",desc:"Sleeping Symbol"},{code:"1f4a2",desc:"Anger Symbol"},{code:"1f4a3",desc:"Bomb"},{code:"1f4a5",desc:"Collision Symbol"},{code:"1f4a6",desc:"Splashing Sweat Symbol"},{code:"1f4a8",desc:"Dash Symbol"},{code:"1f4ab",desc:"Dizzy Symbol"},{code:"1f4ab",desc:"Dizzy Symbol"},{code:"1f4ac",desc:"Speech Balloon"},{code:"1f4ad",desc:"Thought Balloon"},{code:"1f453",desc:"Eyeglasses"},{code:"1f454",desc:"Necktie"},{code:"1f455",desc:"T-Shirt"},{code:"1f456",desc:"Jeans"},{code:"1f457",desc:"Dress"},{code:"1f458",desc:"Kimono"},{code:"1f459",desc:"Bikini"},{code:"1f45a",desc:"Womans Clothes"},{code:"1f45b",desc:"Purse"},{code:"1f45c",desc:"Handbag"},{code:"1f45d",desc:"Pouch"},{code:"1f392",desc:"School Satchel"},{code:"1f45e",desc:"Mans Shoe"},{code:"1f45f",desc:"Athletic Shoe"},{code:"1f460",desc:"High-Heeled Shoe"},{code:"1f461",desc:"Womans Sandal"},{code:"1f462",desc:"Womans Boots"},{code:"1f451",desc:"Crown"},{code:"1f452",desc:"Womans Hat"},{code:"1f462",desc:"Top Hat"},{code:"1f393",desc:"Graduation Cap"},{code:"1f484",desc:"Lipstick"},{code:"1f48d",desc:"Ring"},{code:"1f48e",desc:"Gem Stone"}]},{id:"nature",name:"Animals & Nature",code:"1F435",emoticons:[{code:"1F435",desc:"Monkey Face"},{code:"1F412",desc:"Monkey"},{code:"1F436",desc:"Dog Face"},{code:"1F415",desc:"Dog"},{code:"1F429",desc:"Poodle"},{code:"1F43A",desc:"Wolf Face"},{code:"1F431",desc:"Cat Face"},{code:"1F408",desc:"Cat"},{code:"1F42F",desc:"Tiger Face"},{code:"1F405",desc:"Tiger"},{code:"1F406",desc:"Leopard"},{code:"1F434",desc:"Horse Face"},{code:"1F40E",desc:"Horse"},{code:"1F42E",desc:"Cow Face"},{code:"1F402",desc:"Ox"},{code:"1F403",desc:"Water Buffalo"},{code:"1F404",desc:"Cow"},{code:"1F437",desc:"Pig Face"},{code:"1F416",desc:"Pig"},{code:"1F417",desc:"Boar"},{code:"1F43D",desc:"Pig Nose"},{code:"1F40F",desc:"Ram"},{code:"1F411",desc:"Sheep"},{code:"1F410",desc:"Goat"},{code:"1F42A",desc:"Dromedary Camel"},{code:"1F42B",desc:"Bactrian Camel"},{code:"1F418",desc:"Elephant"},{code:"1F42D",desc:"Mouse Face"},{code:"1F401",desc:"Mouse"},{code:"1F400",desc:"Rat"},{code:"1F439",desc:"Hamster Face"},{code:"1F430",desc:"Rabbit Face"},{code:"1F407",desc:"Rabbit"},{code:"1F43B",desc:"Bear Face"},{code:"1F428",desc:"Koala"},{code:"1F43C",desc:"Panda Face"},{code:"1F43E",desc:"Paw Prints"},{code:"1F414",desc:"Chicken"},{code:"1F413",desc:"Rooster"},{code:"1F423",desc:"Hatching Chick"},{code:"1F424",desc:"Baby Chick"},{code:"1F425",desc:"Front-Facing Baby Chick"},{code:"1F426",desc:"Bird"},{code:"1F427",desc:"Penguin"},{code:"1F438",desc:"Frog Face"},{code:"1F40A",desc:"Crocodile"},{code:"1F422",desc:"Turtle"},{code:"1F40D",desc:"Snake"},{code:"1F432",desc:"Dragon Face"},{code:"1F409",desc:"Dragon"},{code:"1F433",desc:"Spouting Whale"},{code:"1F40B",desc:"Whale"},{code:"1F42C",desc:"Dolphin"},{code:"1F41F",desc:"Fish"},{code:"1F420",desc:"Tropical Fish"},{code:"1F421",desc:"Blowfish"},{code:"1F419",desc:"Octopus"},{code:"1F41A",desc:"Spiral Shell"},{code:"1F40C",desc:"Snail"},{code:"1F41B",desc:"Bug"},{code:"1F41C",desc:"Ant"},{code:"1F41D",desc:"Honeybee"},{code:"1F41E",desc:"Lady Beetle"},{code:"1F490",desc:"Bouquet"},{code:"1F338",desc:"Cherry Blossom"},{code:"1F4AE",desc:"White Flower"},{code:"1F339",desc:"Rose"},{code:"1F33A",desc:"Hibiscus"},{code:"1F33B",desc:"Sunflower"},{code:"1F33C",desc:"Blossom"},{code:"1F337",desc:"Tulip"},{code:"1F331",desc:"Seedling"},{code:"1F332",desc:"Evergreen Tree"},{code:"1F333",desc:"Deciduous Tree"},{code:"1F334",desc:"Palm Tree"},{code:"1F335",desc:"Cactus"},{code:"1F33E",desc:"Ear of Rice"},{code:"1F33F",desc:"Herb"},{code:"2618",desc:"Four Leaf Clover"},{code:"1F341",desc:"Maple Leaf"},{code:"1F342",desc:"Fallen Leaf"},{code:"1F343",desc:"Leaf Fluttering in Wind"}]},{id:"foods",name:"Food & Drink",code:"1F347",emoticons:[{code:"1F347",desc:"Grapes"},{code:"1F348",desc:"Melon"},{code:"1F349",desc:"Watermelon"},{code:"1F34A",desc:"Tangerine"},{code:"1F34B",desc:"Lemon"},{code:"1F34C",desc:"Banana"},{code:"1F34D",desc:"Pineapple"},{code:"1F34E",desc:"Red Apple"},{code:"1F34F",desc:"Green Apple"},{code:"1F350",desc:"Pear"},{code:"1F351",desc:"Peach"},{code:"1F352",desc:"Cherries"},{code:"1F353",desc:"Strawberry"},{code:"1F345",desc:"Tomato"},{code:"1F346",desc:"Aubergine"},{code:"1F33D",desc:"Ear of Maize"},{code:"1F344",desc:"Mushroom"},{code:"1F330",desc:"Chestnut"},{code:"1F35E",desc:"Bread"},{code:"1F356",desc:"Meat on Bone"},{code:"1F357",desc:"Poultry Leg"},{code:"1F354",desc:"Hamburger"},{code:"1F35F",desc:"French Fries"},{code:"1F355",desc:"Slice of Pizza"},{code:"1F373",desc:"Cooking"},{code:"1F372",desc:"Pot of Food"},{code:"1F371",desc:"Bento Box"},{code:"1F358",desc:"Rice Cracker"},{code:"1F359",desc:"Rice Ball"},{code:"1F35A",desc:"Cooked Rice"},{code:"1F35B",desc:"Curry and Rice"},{code:"1F35C",desc:"Steaming Bowl"},{code:"1F35D",desc:"Spaghetti"},{code:"1F360",desc:"Roasted Sweet Potato"},{code:"1F362",desc:"Oden"},{code:"1F363",desc:"Sushi"},{code:"1F364",desc:"Fried Shrimp"},{code:"1F365",desc:"Fish Cake with Swirl Design"},{code:"1F361",desc:"Dango"},{code:"1F366",desc:"Soft Ice Cream"},{code:"1F367",desc:"Shaved Ice"},{code:"1F368",desc:"Ice Cream"},{code:"1F369",desc:"Doughnut"},{code:"1F36A",desc:"Cookie"},{code:"1F382",desc:"Birthday Cake"},{code:"1F370",desc:"Shortcake"},{code:"1F36B",desc:"Chocolate Bar"},{code:"1F36C",desc:"Candy"},{code:"1F36D",desc:"Lollipop"},{code:"1F36E",desc:"Custard"},{code:"1F36F",desc:"Honey Pot"},{code:"1F37C",desc:"Baby Bottle"},{code:"2615",desc:"Hot Beverage"},{code:"1F375",desc:"Teacup Without Handle"},{code:"1F376",desc:"Sake Bottle and Cup"},{code:"1F377",desc:"Wine Glass"},{code:"1F378",desc:"Cocktail Glass"},{code:"1F379",desc:"Tropical Drink"},{code:"1F37A",desc:"Beer Mug"},{code:"1F37B",desc:"Clinking Beer Mugs"},{code:"1F374",desc:"Fork and Knife"},{code:"1F52A",desc:"Hocho"}]},{id:"activity",name:"Activities",code:"1f383",emoticons:[{code:"1f383",desc:" Jack-O-Lantern"},{code:"1f384",desc:"Christmas Tree"},{code:"1f386",desc:" Fireworks"},{code:"1f387",desc:"Firework Sparkler"},{code:"2728",desc:" Sparkles"},{code:"1f388",desc:"Balloon"},{code:"1f389",desc:"Party Popper"},{code:"1f38a",desc:"Confetti Ball"},{code:"1f38b",desc:"Tanabata Tree"},{code:"1f38d",desc:"Pine Decoration"},{code:"1f38e",desc:"Japanese Dolls"},{code:"1f38f",desc:"Carp Streamer"},{code:"1f390",desc:"Wind Chime"},{code:"1f391",desc:"Moon Viewing Ceremony"},{code:"1f380",desc:"Ribbon"},{code:"1f381",desc:"Wrapped Present"},{code:"1f3ab",desc:"Ticket"},{code:"1f3c6",desc:"Trophy"},{code:"1f388",desc:"Balloon"},{code:"26bd",desc:"Soccer Ball"},{code:"26be",desc:"Baseball"},{code:"1f3c0",desc:"Basketball and Hoop"},{code:"1f3c8",desc:"American Football"},{code:"1f3c9",desc:"Rugby Football"},{code:"1f3be",desc:"Tennis Racquet and Ball"},{code:"1f3b1",desc:"Billiards"},{code:"1f3b3",desc:"Bowling"},{code:"1f3af",desc:"Direct Hit"},{code:"26f3",desc:"Flag in Hole"},{code:"1f3a3",desc:"Fishing Pole and Fish"},{code:"1f3bd",desc:"Running Shirt with Sash"},{code:"1f3bf",desc:"Ski and Ski Boot"},{code:"1f3ae",desc:"Video Game"},{code:"1f3b2",desc:"Game Die"},{code:"2660",desc:"Black Spade Suit"},{code:"2665",desc:"Black Heart SuiT"},{code:"2666",desc:"Black Diamond Suit"},{code:"2663",desc:"Black Club Suit"},{code:"1f0cf",desc:"Playing Card Black Joker"},{code:"1f004",desc:"Mahjong Tile Red Dragon"},{code:"1f3b4",desc:"Flower Playing Cards"}]},{id:"places",name:"Travel & Places",code:"1f30d",emoticons:[{code:"1f30d",desc:"Earth Globe Europe-Africa"},{code:"1f30e",desc:"Earth Globe Americas"},{code:"1f30f",desc:"Earth Globe Asia-Australia"},{code:"1f310",desc:"Globe with Meridians"},{code:"1f5fe",desc:"Silhouette of Japan"},{code:"1f30b",desc:"Volcano"},{code:"1f5fb",desc:"Mount Fuji"},{code:"1f3e0",desc:"House Building"},{code:"1f3e1",desc:"House with Garden"},{code:"1f3e2",desc:"Office Building"},{code:"1f3e3",desc:"Japanese Post Office"},{code:"1f3e4",desc:"European Post Office"},{code:"1f3e5",desc:"Hospital"},{code:"1f3e6",desc:"Bank"},{code:"1f3e8",desc:"Hotel"},{code:"1f3e9",desc:"Love Hotel"},{code:"1f3ea",desc:"Convenience Store"},{code:"1f3eb",desc:"School"},{code:"1f3ec",desc:"Department Store"},{code:"1f3ed",desc:"Factory"},{code:"1f3ef",desc:"Japanese Castle"},{code:"1f3f0",desc:"European Castle"},{code:"1f492",desc:"Wedding"},{code:"1f5fc",desc:"Tokyo Tower"},{code:"1f5fd",desc:"Statue of Liberty"},{code:"26ea",desc:"Church"},{code:"26f2",desc:"Fountain"},{code:"26fa",desc:"Tent"},{code:"1f301",desc:"Foggy"},{code:"1f303",desc:"Night with Stars"},{code:"1f304",desc:"Sunrise over Mountains"},{code:"1f305",desc:"Sunrise"},{code:"1f306",desc:"Cityscape at Dusk"},{code:"1f307",desc:"Sunset over Buildings"},{code:"1f309",desc:"Bridge at Night"},{code:"2668",desc:"Hot Springs"},{code:"1f30c",desc:"Milky Way"},{code:"1f3a0",desc:"Carousel Horse"},{code:"1f3a1",desc:"Ferris Wheel"},{code:"1f3a2",desc:"Roller Coaster"},{code:"1f488",desc:"Barber Pole"},{code:"1f3aa",desc:"Circus Tent"},{code:"1f3ad",desc:"Performing Arts"},{code:"1f3a8",desc:"Artist Palette"},{code:"1f3b0",desc:"Slot Machine"},{code:"1f682",desc:"Steam Locomotive"},{code:"1f683",desc:"Railway Car"},{code:"1f684",desc:"High-Speed Train"},{code:"1f685",desc:"High-Speed Train with Bullet Nose"},{code:"1f686",desc:"Train"},{code:"1f687",desc:"Metro"},{code:"1f688",desc:"Light Rail"},{code:"1f689",desc:"Station"},{code:"1f68a",desc:"Tram"},{code:"1f69d",desc:"Monorail"},{code:"1f69e",desc:"Mountain Railway"},{code:"1f68b",desc:"Tram Car"},{code:"1f68c",desc:"Bus"},{code:"1f68d",desc:"Oncoming Bus"},{code:"1f68e",desc:"Trolleybus"},{code:"1f690",desc:"Minibus"},{code:"1f691",desc:"Ambulance"},{code:"1f692",desc:"Fire Engine"},{code:"1f693",desc:"Police Car"},{code:"1f694",desc:"Oncoming Police Car"},{code:"1f695",desc:"Taxi"},{code:"1f695",desc:"Oncoming Taxi"},{code:"1f697",desc:"Automobile"},{code:"1f698",desc:"Oncoming Automobile"},{code:"1f699",desc:"Recreational Vehicle"},{code:"1f69a",desc:"Delivery Truck"},{code:"1f69b",desc:"Articulated Lorry"},{code:"1f69c",desc:"Tractor"},{code:"1f6b2",desc:"Bicycle"},{code:"1f68f",desc:"Bus Stop"},{code:"26fd",desc:"Fuel Pump"},{code:"1f6a8",desc:"Police Cars Revolving Light"},{code:"1f6a5",desc:"Horizontal Traffic Light"},{code:"1f6a6",desc:"Vertical Traffic Light"},{code:"1f6a7",desc:"Construction Sign"},{code:"2693",desc:"Anchor"},{code:"26f5",desc:"Sailboat"},{code:"1f6a4",desc:"Speedboat"},{code:"1f6a2",desc:"Ship"},{code:"2708",desc:"Airplane"},{code:"1f4ba",desc:"Seat"},{code:"1f681",desc:"Helicopter"},{code:"1f69f",desc:"Suspension Railway"},{code:"1f6a0",desc:"Mountain Cableway"},{code:"1f6a1",desc:"Aerial Tramway"},{code:"1f680",desc:"Rocket"},{code:"1f6aa",desc:"Door"},{code:"1f6bd",desc:"Toilet"},{code:"1f6bf",desc:"Shower"},{code:"1f6c1",desc:"Bathtub"},{code:"231b",desc:"Hourglass"},{code:"23f3",desc:"Hourglass with Flowing Sand"},{code:"231a",desc:"Watch"},{code:"23f0",desc:"Alarm Clock"},{code:"1f55b",desc:"Clock Face Twelve Oclock"},{code:"1f567",desc:"Clock Face Twelve-Thirty"},{code:"1f550",desc:"Clock Face One Oclock"},{code:"1f55c",desc:"Clock Face One-thirty"},{code:"1f551",desc:"Clock Face Two Oclock"},{code:"1f55d",desc:"Clock Face Two-thirty"},{code:"1f552",desc:"Clock Face Three Oclock"},{code:"1f55e",desc:"Clock Face Three-thirty"},{code:"1f553",desc:"Clock Face Four Oclock"},{code:"1f55f",desc:"Clock Face Four-thirty"},{code:"1f554",desc:"Clock Face Five Oclock"},{code:"1f560",desc:"Clock Face Five-thirty"},{code:"1f555",desc:"Clock Face Six Oclock"},{code:"1f561",desc:"Clock Face Six-thirty"},{code:"1f556",desc:"Clock Face Seven Oclock"},{code:"1f562",desc:"Clock Face Seven-thirty"},{code:"1f557",desc:"Clock Face Eight Oclock"},{code:"1f563",desc:"Clock Face Eight-thirty"},{code:"1f558",desc:"Clock Face Nine Oclock"},{code:"1f564",desc:"Clock Face Nine-thirty"},{code:"1f559",desc:"Clock Face Ten Oclock"},{code:"1f565",desc:"Clock Face Ten-thirty"},{code:"1f55a",desc:"Clock Face Eleven Oclock"},{code:"1f566",desc:"Clock Face Eleven-thirty"},{code:"1f311",desc:"New Moon Symbol"},{code:"1f312",desc:"Waxing Crescent Moon Symbol"},{code:"1f313",desc:"First Quarter Moon Symbol"},{code:"1f314",desc:"Waxing Gibbous Moon Symbol"},{code:"1f315",desc:"Full Moon Symbol"},{code:"1f316",desc:"Waning Gibbous Moon Symbol"},{code:"1f317",desc:"Last Quarter Moon Symbol"},{code:"1f318",desc:"Waning Crescent Moon Symbol"},{code:"1f319",desc:"Crescent Moon"},{code:"1f31a",desc:"New Moon with Face"},{code:"1f31b",desc:"First Quarter Moon with Face"},{code:"1f31c",desc:"Last Quarter Moon with Face"},{code:"2600",desc:"Black Sun with Rays"},{code:"1f31d",desc:"Full Moon with Face"},{code:"1f31e",desc:"Sun with Face"},{code:"2b50",desc:"White Medium Star"},{code:"1f31f",desc:"Glowing Star"},{code:"1f320",desc:"Shooting Star"},{code:"2601",desc:"Cloud"},{code:"26c5",desc:"Sun Behind Cloud"},{code:"1f300",desc:"Cyclone"},{code:"1f308",desc:"Rainbow"},{code:"1f302",desc:"Closed Umbrella"},{code:"2614",desc:"Umbrella with Rain Drops"},{code:"26a1",desc:"High Voltage Sign"},{code:"2744",desc:"Snowflake"},{code:"2603",desc:"Snowman Without Snow"},{code:"1f525",desc:"Fire"},{code:"1f4a7",desc:"Droplet"},{code:"1F30A",desc:"Water Wave"}]},{id:"objects",name:"Objects",code:"1F507",emoticons:[{code:"1F507",desc:"Speaker with Cancellation Stroke"},{code:"1F508",desc:"Speaker"},{code:"1F509",desc:"Speaker with One Sound Wave"},{code:"1F50A",desc:"Speaker with Three Sound Wave"},{code:"1F4E2",desc:"Public Address Loudspeaker"},{code:"1F4E3",desc:"Cheering Megaphone"},{code:"1F4EF",desc:"Postal Horn"},{code:"1F514",desc:"Bell"},{code:"1F515",desc:"Bell with Cancellation Stroke"},{code:"1F3BC",desc:"Musical Score"},{code:"1F3B5",desc:"Musical Note"},{code:"1F3B6",desc:"Multiple Musical Notes"},{code:"1F3A4",desc:"Microphone"},{code:"1F3A7",desc:"Headphone"},{code:"1F4FB",desc:"Radio"},{code:"1F3B7",desc:"Saxophone"},{code:"1F3B8",desc:"Guitar"},{code:"1F3B9",desc:"Musical Keyboard"},{code:"1F3BA",desc:"Trumpet"},{code:"1F3BB",desc:"Violin"},{code:"1F4F1",desc:"Mobile Phone"},{code:"1F4F2",desc:"Mobile Phone with Rightwards Arrow at Left"},{code:"260E",desc:"Black Telephone"},{code:"1F4DE",desc:"Telephone Receiver"},{code:"1F4DF",desc:"Pager"},{code:"1F4E0",desc:"Fax Machine"},{code:"1F50B",desc:"Battery"},{code:"1F50C",desc:"Electric Plug"},{code:"1F4BB",desc:"Personal Computer"},{code:"1F4BD",desc:"Minidisc"},{code:"1F4BE",desc:"Floppy Disk"},{code:"1F4BF",desc:"Optical Disk"},{code:"1F4C0",desc:"Dvd"},{code:"1F3A5",desc:"Movie Camera"},{code:"1F3AC",desc:"Clapper Board"},{code:"1F4FA",desc:"Television"},{code:"1F4F7",desc:"Camera"},{code:"1F4F9",desc:"Video Camera"},{code:"1F4FC",desc:"Videocassette"},{code:"1F50D",desc:"Left-Pointing Magnifying Glass"},{code:"1F50E",desc:"Right-Pointing Magnifying Glass"},{code:"1F52C",desc:"Microscope"},{code:"1F52D",desc:"Telelscope"},{code:"1F4E1",desc:"Satellite Antenna"},{code:"1F4A1",desc:"Electric Light Bulb"},{code:"1F526",desc:"Electric Torch"},{code:"1F3EE",desc:"Izakaya Lantern"},{code:"1F4D4",desc:"Notebook with Decorative Cover"},{code:"1F4D5",desc:"Closed Book"},{code:"1F4D6",desc:"Open Book"},{code:"1F4D7",desc:"Green Book"},{code:"1F4D8",desc:"Blue Book"},{code:"1F4D9",desc:"Orange Book"},{code:"1F4DA",desc:"Books"},{code:"1F4D3",desc:"Notebook"},{code:"1F4D2",desc:"Ledger"},{code:"1F4C3",desc:"Curl"},{code:"1F4DC",desc:"Scroll"},{code:"1F4C4",desc:"Page Facing Up"},{code:"1F4F0",desc:"Newspaper"},{code:"1F4D1",desc:"Bookmark Tabs"},{code:"1F516",desc:"Bookmark"},{code:"1F4B0",desc:"Money Bag"},{code:"1F4B4",desc:"Banknote with Yen Sign"},{code:"1F4B5",desc:"Banknote with Dollar Sign"},{code:"1F4B6",desc:"Banknote with Euro Sign"},{code:"1F4B7",desc:"Banknote with Pound Sign"},{code:"1F4B8",desc:"Money with Wings"},{code:"1F4B3",desc:"Credit Card"},{code:"1F4B9",desc:"Chart with Upwards Trend and Yen Sign"},{code:"1F4B1",desc:"Currency Exchange"},{code:"1F4B2",desc:"Heavy Dollar Sign"},{code:"2709",desc:"Envelope"},{code:"1F4E7",desc:"E-Mail Symbol"},{code:"1F4E8",desc:"Incoming Envelope"},{code:"1F4E9",desc:"Envelope with Downwards Arrow Above"},{code:"1F4E4",desc:"Outbox Tray"},{code:"1F4E5",desc:"Inbox Tray"},{code:"1F4E6",desc:"Package"},{code:"1F4BE",desc:"Closed Mailbox with Raised Flag"},{code:"1F4EA",desc:"Closed Mailbox with Lowered Flag"},{code:"1F4EC",desc:"Open Mailbox with Raised Flag"},{code:"1F4ED",desc:"Open Mailbox with Lowered Flag"},{code:"1F5F3",desc:"Postbox"},{code:"270F",desc:"Pencil"},{code:"2712",desc:"Black Nib"},{code:"1F4DD",desc:"Memo"},{code:"1F4BC",desc:"Briefcase"},{code:"1F4C1",desc:"File Folder"},{code:"1F4C2",desc:"Open File Folder"},{code:"1F4C5",desc:"Calender"},{code:"1F4C6",desc:"Tear-off Calender"},{code:"1F4C7",desc:"Card Index"},{code:"1F4C8",desc:"Chart with Upwards Trend"},{code:"1F4C9",desc:"Chart with Downwards Trend"},{code:"1F4CA",desc:"Bar Chart"},{code:"1F4CB",desc:"Clipboard"},{code:"1F4CC",desc:"Pushpin"},{code:"1F4CD",desc:"Round Pushpin"},{code:"1F4CE",desc:"Paperclip"},{code:"1F4CF",desc:"Straight Ruler"},{code:"1F4D0",desc:"Triangular Ruler"},{code:"2702",desc:"Black Scissors"},{code:"1F512",desc:"Lock"},{code:"1F513",desc:"Open Lock"},{code:"1F50F",desc:"Lock with Ink Pen"},{code:"1F510",desc:"Closed Lock with Key"},{code:"1F511",desc:"Key"},{code:"1F528",desc:"Hammer"},{code:"1F52B",desc:"Pistol"},{code:"1F527",desc:"Wrench"},{code:"1F529",desc:"Nut and Bolt"},{code:"1F517",desc:"Link Symbol"},{code:"1F489",desc:"Syringe"},{code:"1F48A",desc:"Pill"},{code:"1F6AC",desc:"Smoking Symbol"},{code:"1F5FF",desc:"Moyai"},{code:"1F52E",desc:"Crystal Ball"}]},{id:"symbols",name:"Symbols",code:"1F3E7",emoticons:[{code:"1F3E7",desc:"Automated Teller Machine"},{code:"1F6AE",desc:"Put Litter in Its Place Symbol"},{code:"1F6B0",desc:"Potable Water Symbol"},{code:"267F",desc:"Wheelchair Symbol"},{code:"1F6B9",desc:"Mens Symbol"},{code:"1F6BA",desc:"Womens Symbol"},{code:"1F6BB",desc:"Restroom"},{code:"1F6BC",desc:"Baby Symbol"},{code:"1F6BE",desc:"Water Closet"},{code:"1F6C2",desc:"Passport Control"},{code:"1F6C3",desc:"Customs"},{code:"1F6C4",desc:"Baggage Claim"},{code:"1F6C5",desc:"Left Luggage"},{code:"26A0",desc:"Warning Sign"},{code:"1F6B8",desc:"Children Crossing"},{code:"26D4",desc:"No Entry"},{code:"1F6AB",desc:"No Entry Sign"},{code:"1F6B3",desc:"No Bicycles"},{code:"1F6AD",desc:"No Smoking Symbol"},{code:"1F6AF",desc:"Do Not Litter Symbol"},{code:"1F6B1",desc:"Non-Potable Water Symbol"},{code:"1F6B7",desc:"No Pedestrians"},{code:"1F4F5",desc:"No Mobile Phones"},{code:"1F51E",desc:"No One Under Eighteen Symbol"},{code:"2B06",desc:"Upwards Black Arrow"},{code:"2197",desc:"North East Arrow"},{code:"27A1",desc:"Black Rightwards Arrow"},{code:"2198",desc:"South East Arrow"},{code:"2B07",desc:"Downwards Black Arrow"},{code:"2199",desc:"South West Arrow"},{code:"2B05",desc:"Leftwards Black Arrow"},{code:"2196",desc:"North West Arrow"},{code:"2195",desc:"Up Down Arrow"},{code:"2194",desc:"Left Right Arrow"},{code:"21A9",desc:"Leftwards Arrow with Hook"},{code:"21AA",desc:"Rightwards Arrow with Hook"},{code:"2934",desc:"Arrow Pointing Rightwards Then Curving Upwards"},{code:"2935",desc:"Arrow Pointing Rightwards Then Curving Downwards"},{code:"1F503",desc:"Clockwise Downwards and Upwards Open Circle Arrows"},{code:"1F504",desc:"Anticlockwise Downwards and Upwards Open Circle Arrows"},{code:"1F519",desc:"Back with Leftwards Arrow Above"},{code:"1F51A",desc:"End with Leftwards Arrow Above"},{code:"1F51B",desc:"On with Exclamation Mark with Left Right Arrow Above"},{code:"1F51C",desc:"Soon with Rightwards Arrow Above"},{code:"1F51D",desc:"Top with Upwards Arrow Above"},{code:"1F52F",desc:"Six Pointed Star with Middle Dot"},{code:"2648",desc:"Aries"},{code:"2649",desc:"Taurus"},{code:"264A",desc:"Gemini"},{code:"264B",desc:"Cancer"},{code:"264C",desc:"Leo"},{code:"264D",desc:"Virgo"},{code:"264E",desc:"Libra"},{code:"264F",desc:"Scorpius"},{code:"2650",desc:"Sagittarius"},{code:"2651",desc:"Capricorn"},{code:"2652",desc:"Aquarius"},{code:"2653",desc:"Pisces"},{code:"26CE",desc:"Ophiuchus"},{code:"1F500",desc:"Twisted Rightwards Arrows"},{code:"1F501",desc:"Clockwise Rightwards and Leftwards Open Circle Arrows"},{code:"1F502",desc:"Clockwise Rightwards and Leftwards Open Circle Arrows with Circled One Overlay"},{code:"25B6",desc:"Black Right-Pointing Triangle"},{code:"23E9",desc:"Black Right-Pointing Double Triangle"},{code:"25C0",desc:"Black Left-Pointing Triangle"},{code:"23EA",desc:"Black Left-Pointing Double Triangle"},{code:"1F53C",desc:"Up-Pointing Small Red Triangle"},{code:"23EB",desc:"Black Up-Pointing Double Triangle"},{code:"1F53D",desc:"Down-Pointing Small Red Triangle"},{code:"23EC",desc:"Black Down-Pointing Double Triangle"},{code:"1F3A6",desc:"Cinema"},{code:"1F505",desc:"Low Brightness Symbol"},{code:"1F506",desc:"High Brightness Symbol"},{code:"1F4F6",desc:"Antenna with Bars"},{code:"1F4F3",desc:"Vibration Mode"},{code:"1F4F4",desc:"Mobile Phone off"},{code:"267B",desc:"Black Universal Recycling Symbol"},{code:"1F531",desc:"Trident Emblem"},{code:"1F4DB",desc:"Name Badge"},{code:"1F530",desc:"Japanese Symbol for Beginner"},{code:"2B55",desc:"Heavy Large Circle"},{code:"2705",desc:"White Heavy Check Mark"},{code:"2611",desc:"Ballot Box with Check"},{code:"2714",desc:"Heavy Check Mark"},{code:"2716",desc:"Heavy Multiplication X"},{code:"274C",desc:"Cross Mark"},{code:"274E",desc:"Negative Squared Cross Mark"},{code:"2795",desc:"Heavy Plus Sign"},{code:"2796",desc:"Heavy Minus Sign"},{code:"2797",desc:"Heavy Division Sign"},{code:"27B0",desc:"Curly Loop"},{code:"27BF",desc:"Double Curly Loop"},{code:"303D",desc:"Part Alternation Mark"},{code:"2733",desc:"Eight Spoked Asterisk"},{code:"2734",desc:"Eight Pointed Black Star"},{code:"2747",desc:"Sparkle"},{code:"203C",desc:"Double Exclamation Mark"},{code:"2049",desc:"Exclamation Question Mark"},{code:"2753",desc:"Black Question Mark Ornament"},{code:"2754",desc:"White Question Mark Ornament"},{code:"2755",desc:"White Exclamation Mark Ornament"},{code:"2757",desc:"Heavy Exclamation Mark Symbol"},{code:"3030",desc:"Wavy Dash"},{code:"2122",desc:"Trade Mark Sign"},{code:"1F51F",desc:"Keycap Ten"},{code:"1F4AF",desc:"Hundred Points Symbol"},{code:"1F520",desc:"Input Symbol for Latin Capital Letters"},{code:"1F521",desc:"Input Symbol for Latin Small Letters"},{code:"1F522",desc:"Input Symbol for Numbers"},{code:"1F523",desc:"Input Symbol for Symbols"},{code:"1F524",desc:"Input Symbol for Latin Letters"},{code:"1F170",desc:"Negative Squared Latin Capital Letter a"},{code:"1F18E",desc:"Negative Squared Ab"},{code:"1F171",desc:"Negative Squared Latin Capital Letter B"},{code:"1F191",desc:"Squared Cl"},{code:"1F192",desc:"Squared Cool"},{code:"1F193",desc:"Squared Free"},{code:"2139",desc:"Information Source"},{code:"1F194",desc:"Squared Id"},{code:"24C2",desc:"Circled Latin Capital Letter M"},{code:"1F195",desc:"Squared New"},{code:"1F196",desc:"Squared Ng"},{code:"1F17E",desc:"Negative Squared Latin Capital Letter O"},{code:"1F197",desc:"Squared Ok"},{code:"1F17F",desc:"Negative Squared Latin Capital Letter P"},{code:"1F198",desc:"Squared Sos"},{code:"1F199",desc:"Squared Up with Exclamation Mark"},{code:"1F19A",desc:"Squared Vs"},{code:"1F201",desc:"Squared Katakana Koko"},{code:"1F202",desc:"Squared Katakana Sa"},{code:"1F237",desc:"Squared Cjk Unified Ideograph-6708"},{code:"1F236",desc:"Squared Cjk Unified Ideograph-6709"},{code:"1F22F",desc:"Squared Cjk Unified Ideograph-6307"},{code:"1F250",desc:"Circled Ideograph Advantage"},{code:"1F239",desc:"Squared Cjk Unified Ideograph-5272"},{code:"1F21A",desc:"Squared Cjk Unified Ideograph-7121"},{code:"1F232",desc:"Squared Cjk Unified Ideograph-7981"},{code:"1F251",desc:"Circled Ideograph Accept"},{code:"1F238",desc:"Squared Cjk Unified Ideograph-7533"},{code:"1F234",desc:"Squared Cjk Unified Ideograph-5408"},{code:"1F233",desc:"Squared Cjk Unified Ideograph-7a7a"},{code:"3297",desc:"Circled Ideograph Congratulation"},{code:"3299",desc:"Circled Ideograph Secret"},{code:"1F23A",desc:"Squared Cjk Unified Ideograph-55b6"},{code:"1F235",desc:"Squared Cjk Unified Ideograph-6e80"},{code:"25AA",desc:"Black Small Square"},{code:"25AB",desc:"White Small Square"},{code:"25FB",desc:"White Medium Square"},{code:"25FC",desc:"Black Medium Square"},{code:"25FD",desc:"White Medium Small Square"},{code:"25FE",desc:"Black Medium Small Square"},{code:"2B1B",desc:"Black Large Square"},{code:"2B1C",desc:"White Large Square"},{code:"1F536",desc:"Large Orange Diamond"},{code:"1F537",desc:"Large Blue Diamond"},{code:"1F538",desc:"Small Orange Diamond"},{code:"1F539",desc:"Small Blue Diamond"},{code:"1F53A",desc:"Up-Pointing Red Triangle"},{code:"1F53B",desc:"Down-Pointing Red Triangle"},{code:"1F4A0",desc:"Diamond Shape with a Dot Inside"},{code:"1F518",desc:"Radio Button"},{code:"1F532",desc:"Black Square Button"},{code:"1F533",desc:"White Square Button"},{code:"26AA",desc:"Medium White Circle"},{code:"26AB",desc:"Medium Black Circle"},{code:"1F534",desc:"Large Red Circle"},{code:"1F535",desc:"Large Blue Circle"}]},{id:"flags",name:"Flags",code:"1F3C1",emoticons:[{code:"1f3c1",desc:"Chequered Flag"},{code:"1f1e8-1f1f3",desc:"China Flag"},{code:"1f38c",desc:"Crossed Flags"},{code:"1f1e9-1f1ea",desc:"Germany Flag"},{code:"1f1ea-1f1f8",desc:"Spain Flag"},{code:"1f1e6-1f1e8",desc:"Ascension Island Flag"},{code:"1f1e6-1f1e9",desc:"Andorra Flag"},{code:"1f1e6-1f1ea",desc:"United Arab Emirates Flag"},{code:"1f1e6-1f1eb",desc:"Afghanistan Flag"},{code:"1f1e6-1f1ec",desc:"Antigua & Barbuda Flag"},{code:"1f1e6-1f1ee",desc:"Anguilla Flag"},{code:"1f1e6-1f1f1",desc:"Albania Flag"},{code:"1f1e6-1f1f2",desc:"Armenia Flag"},{code:"1f1e6-1f1f4",desc:"Angola Flag"},{code:"1f1e6-1f1f6",desc:"Antarctica Flag"},{code:"1f1e6-1f1f7",desc:"Argentina Flag"},{code:"1f1e6-1f1f8",desc:"American Samoa Flag"},{code:"1f1e6-1f1f9",desc:"Austria Flag"},{code:"1f1e6-1f1fa",desc:"Australia Flag"},{code:"1f1e6-1f1fc",desc:"Aruba Flag"},{code:"1f1e6-1f1fd",desc:"\xc5land Islands Flag"},{code:"1f1e6-1f1ff",desc:"Azerbaijan Flag"},{code:"1f1e7-1f1e7",desc:"Barbados Flag"},{code:"1f1e7-1f1e9",desc:"Bangladesh Flag"},{code:"1f1e7-1f1ea",desc:"Belgium Flag"},{code:"1f1e7-1f1eb",desc:"Burkina Faso Flag"},{code:"1f1e7-1f1ec",desc:"Bulgaria Flag"},{code:"1f1e7-1f1ed",desc:"Bahrain Flag"},{code:"1f1e7-1f1ee",desc:"Burundi Flag"},{code:"1f1e7-1f1ef",desc:"Benin Flag"},{code:"1f1e7-1f1f1",desc:"St. Barth\xe9lemy Flag"},{code:"1f1e7-1f1f2",desc:"Bermuda Flag"},{code:"1f1e7-1f1f4",desc:"Bolivia Flag"},{code:"1f1e7-1f1f6",desc:"Caribbean Netherlands Flag"},{code:"1f1e7-1f1f7",desc:"Brazil Flag"},{code:"1f1e7-1f1f8",desc:"Bahamas Flag"},{code:"1f1e7-1f1f9",desc:"Bhutan Flag"},{code:"1f1e7-1f1fb",desc:"Bouvet Island Flag"},{code:"1f1e7-1f1fc",desc:"Botswana Flag"},{code:"1f1e7-1f1fe",desc:"Belarus Flag"},{code:"1f1e7-1f1ff",desc:"Belize Flag"},{code:"1f1e8-1f1e6",desc:"Canada Flag"},{code:"1f1e8-1f1e8",desc:"Cocos (keeling) Islands Flag"},{code:"1f1e8-1f1e9",desc:"Congo - Kinshasa Flag"},{code:"1f1e8-1f1eb",desc:"Central African Republic Flag"},{code:"1f1e8-1f1ec",desc:"Congo - Brazzaville Flag"},{code:"1f1e8-1f1ed",desc:"Switzerland Flag"},{code:"1f1e8-1f1ee",desc:"C\xf4te D\u2019ivoire Flag"},{code:"1f1e8-1f1f0",desc:"Cook Islands Flag"},{code:"1f1e8-1f1f1",desc:"Chile Flag"},{code:"1f1e8-1f1f2",desc:"Cameroon Flag"},{code:"1f1e8-1f1f4",desc:"Colombia Flag"},{code:"1f1e8-1f1f7",desc:"Costa Rica Flag"},{code:"1f1e8-1f1fa",desc:"Cuba Flag"},{code:"1f1e8-1f1fb",desc:"Cape Verde Flag"},{code:"1f1e8-1f1fc",desc:"Cura\xe7ao Flag"},{code:"1f1e8-1f1fd",desc:"Christmas Island Flag"},{code:"1f1e8-1f1fe",desc:"Cyprus Flag"},{code:"1f1e8-1f1ff",desc:'Czechia Flag"'},{code:"1f1e9-1f1ec",desc:"Diego Garcia Flag"},{code:"1f1e9-1f1ef",desc:"Djibouti Flag"},{code:"1f1e9-1f1f0",desc:"Denmark Flag"},{code:"1f1e9-1f1f2",desc:"Dominica Flag"},{code:"1f1e9-1f1f4",desc:"Dominican Republic Flag"},{code:"1f1e9-1f1ff",desc:"Algeria Flag"},{code:"1f1ea-1f1e6",desc:"Ceuta & Melilla Flag"},{code:"1f1ea-1f1e8",desc:"Ecuador Flag"},{code:"1f1ea-1f1ea",desc:"Estonia Flag"},{code:"1f1ea-1f1ec",desc:"Egypt Flag"},{code:"1f1ea-1f1ed",desc:"Western Sahara Flag"},{code:"1f1ea-1f1f7",desc:"Eritrea Flag"},{code:"1f1ea-1f1f9",desc:"Ethiopia Flag"},{code:"1f1ea-1f1fa",desc:"European Union Flag"},{code:"1f1eb-1f1ee",desc:"Finland Flag"},{code:"1f1eb-1f1ef",desc:"Fiji Flag"},{code:"1f1eb-1f1f0",desc:"Falkland Islands Flag"},{code:"1f1eb-1f1f2",desc:"Micronesia Flag"},{code:"1f1eb-1f1f4",desc:"Faroe Islands Flag"},{code:"1f1ec-1f1e6",desc:"Gabon Flag"},{code:"1f1ec-1f1e9",desc:"Grenada Flag"},{code:"1f1ec-1f1ea",desc:"Georgia Flag"},{code:"1f1ec-1f1eb",desc:"French Guiana Flag"},{code:"1f1ec-1f1ec",desc:"Guernsey Flag"},{code:"1f1ec-1f1ed",desc:"Ghana Flag"},{code:"1f1ec-1f1ee",desc:"Gibraltar Flag"},{code:"1f1ec-1f1f1",desc:"Greenland Flag"},{code:"1f1ec-1f1f2",desc:"Gambia Flag"},{code:"1f1ec-1f1f3",desc:"Guinea Flag"},{code:"1f1ec-1f1f5",desc:"Guadeloupe Flag"},{code:"1f1ec-1f1f6",desc:"Equatorial Guinea Flag"},{code:"1f1ec-1f1f7",desc:"Greece Flag"},{code:"1f1ec-1f1f8",desc:"South Georgia & South Sandwich Islands Flag"},{code:"1f1ec-1f1f9",desc:"Guatemala Flag"},{code:"1f1ec-1f1fa",desc:"Guam Flag"},{code:"1f1ec-1f1fc",desc:"Guinea-Bissau Flag"},{code:"1f1ec-1f1fe",desc:"Guyana Flag"},{code:"1f1ed-1f1f0",desc:"Hong Kong Sar China Flag"},{code:"1f1ed-1f1f2",desc:"Heard & Mcdonald Islands Flag"},{code:"1f1ed-1f1f3",desc:"Honduras Flag"},{code:"1f1ed-1f1f7",desc:"Croatia Flag"},{code:"1f1ed-1f1f9",desc:"Haiti Flag"},{code:"1f1ed-1f1fa",desc:"Hungary Flag"},{code:"1f1ee-1f1e8",desc:"Canary Islands Flag"},{code:"1f1ee-1f1e9",desc:"Indonesia Flag"},{code:"1f1ee-1f1ea",desc:"Ireland Flag"},{code:"1f1ee-1f1f1",desc:"Israel Flag"},{code:"1f1ee-1f1f2",desc:"Isle of Man Flag"},{code:"1f1ee-1f1f3",desc:"India Flag"},{code:"1f1ee-1f1f4",desc:"British Indian Ocean Territory Flag"},{code:"1f1ee-1f1f6",desc:"Iraq Flag"},{code:"1f1ee-1f1f7",desc:"Iran Flag"},{code:"1f1ee-1f1f8",desc:"Iceland Flag"},{code:"1f1ef-1f1ea",desc:"Jersey Flag"},{code:"1f1ef-1f1f2",desc:"Jamaica Flag"},{code:"1f1ef-1f1f4",desc:"Jordan Flag"},{code:"1f1f0-1f1ea",desc:"Kenya Flag"},{code:"1f1f0-1f1ec",desc:"Kyrgyzstan Flag"},{code:"1f1f0-1f1ed",desc:"Cambodia Flag"},{code:"1f1f0-1f1ee",desc:"Kiribati Flag"},{code:"1f1f0-1f1f2",desc:"Comoros Flag"},{code:"1f1f0-1f1f3",desc:"St. Kitts & Nevis Flag"},{code:"1f1f0-1f1f5",desc:"North Korea Flag"},{code:"1f1f0-1f1fc",desc:"Kuwait Flag"},{code:"1f1f0-1f1fe",desc:"Cayman Islands Flag"},{code:"1f1f0-1f1ff",desc:"Kazakhstan Flag"},{code:"1f1f1-1f1e6",desc:"Laos Flag"},{code:"1f1f1-1f1e7",desc:"Lebanon Flag"},{code:"1f1f1-1f1e8",desc:"St. Lucia Flag"},{code:"1f1f1-1f1ee",desc:"Liechtenstein Flag"},{code:"1f1f1-1f1f0",desc:"Sri Lanka Flag"},{code:"1f1f1-1f1f7",desc:"Liberia Flag"},{code:"1f1f1-1f1f8",desc:"Lesotho Flag"},{code:"1f1f1-1f1f9",desc:"Lithuania Flag"},{code:"1f1f1-1f1fa",desc:"Luxembourg Flag"},{code:"1f1f1-1f1fb",desc:"Latvia Flag"},{code:"1f1f1-1f1fe",desc:"Libya Flag"},{code:"1f1f2-1f1e6",desc:"Morocco Flag"},{code:"1f1f2-1f1e8",desc:"Monaco Flag"},{code:"1f1f2-1f1e9",desc:"Moldova Flag"},{code:"1f1f2-1f1ea",desc:"Montenegro Flag"},{code:"1f1f2-1f1eb",desc:"St. Martin Flag"},{code:"1f1f2-1f1ec",desc:"Madagascar Flag"},{code:"1f1f2-1f1ed",desc:"Marshall Islands Flag"},{code:"1f1f2-1f1f0",desc:"Macedonia Flag"},{code:"1f1f2-1f1f1",desc:"Mali Flag"},{code:"1f1f2-1f1f2",desc:"Myanmar (burma) Flag"},{code:"1f1f2-1f1f3",desc:"Mongolia Flag"},{code:"1f1f2-1f1f4",desc:"Macau Sar China Flag"},{code:"1f1f2-1f1f5",desc:"Northern Mariana Islands Flag"},{code:"1f1f2-1f1f6",desc:"Martinique Flag"},{code:"1f1f2-1f1f7",desc:"Mauritania Flag"},{code:"1f1f2-1f1f8",desc:"Montserrat Flag"},{code:"1f1f2-1f1f9",desc:"Malta Flag"},{code:"1f1f2-1f1fa",desc:"Mauritius Flag"},{code:"1f1f2-1f1fb",desc:"Maldives Flag"},{code:"1f1f2-1f1fc",desc:"Malawi Flag"},{code:"1f1f2-1f1fd",desc:"Mexico Flag"},{code:"1f1f2-1f1fe",desc:"Malaysia Flag"},{code:"1f1f2-1f1ff",desc:"Mozambique Flag"},{code:"1f1f3-1f1e6",desc:"Namibia Flag"},{code:"1f1f3-1f1e8",desc:"New Caledonia Flag"},{code:"1f1f3-1f1ea",desc:"Niger Flag"},{code:"1f1f3-1f1eb",desc:"Norfolk Island Flag"},{code:"1f1f3-1f1ec",desc:"Nigeria Flag"},{code:"1f1f3-1f1ee",desc:"Nicaragua Flag"},{code:"1f1f3-1f1f1",desc:"Netherlands Flag"},{code:"1f1f3-1f1f4",desc:"Norway Flag"},{code:"1f1f3-1f1f5",desc:"Nepal Flag"},{code:"1f1f3-1f1f7",desc:"Nauru Flag"},{code:"1f1f3-1f1fa",desc:"Niue Flag"},{code:"1f1f3-1f1ff",desc:"New Zealand Flag"},{code:"1f1f4-1f1f2",desc:"Oman Flag"},{code:"1f1f8-1f1ff",desc:"Swaziland Flag"},{code:"1f1f5-1f1e6",desc:"Panama Flag"},{code:"1f1f5-1f1ea",desc:"Peru Flag"},{code:"1f1f5-1f1eb",desc:"French Polynesia Flag"},{code:"1f1f5-1f1ec",desc:"Papua New Guinea Flag"},{code:"1f1f5-1f1ed",desc:"Philippines Flag"},{code:"1f1f5-1f1f0",desc:"Pakistan Flag"},{code:"1f1f5-1f1f1",desc:"Poland Flag"},{code:"1f1f5-1f1f2",desc:"St. Pierre & Miquelon Flag"},{code:"1f1f5-1f1f3",desc:"Pitcairn Islands Flag"},{code:"1f1f5-1f1f7",desc:"Puerto Rico Flag"},{code:"1f1f5-1f1f8",desc:"Palestinian Territories Flag"},{code:"1f1f5-1f1f9",desc:"Portugal Flag"},{code:"1f1f5-1f1fc",desc:"Palau Flag"},{code:"1f1f5-1f1fe",desc:"Paraguay Flag"},{code:"1f1f6-1f1e6",desc:"Qatar Flag"},{code:"1f1f7-1f1ea",desc:"R\xe9union Flag"},{code:"1f1f7-1f1f4",desc:"Romania Flag"},{code:"1f1f7-1f1f8",desc:"Serbia Flag"},{code:"1f1f7-1f1fc",desc:"Rwanda Flag"},{code:"1f1f8-1f1e6",desc:"Saudi Arabia Flag"},{code:"1f1f8-1f1e7",desc:"Solomon Islands Flag"},{code:"1f1f8-1f1e8",desc:"Seychelles Flag"},{code:"1f1f8-1f1e9",desc:"Sudan Flag"},{code:"1f1f8-1f1ea",desc:"Sweden Flag"},{code:"1f1f8-1f1ec",desc:"Singapore Flag"},{code:"1f1f8-1f1ee",desc:"Slovenia Flag"},{code:"1f1f8-1f1ed",desc:"St. Helena Flag"},{code:"1f1f8-1f1ef",desc:"Svalbard & Jan Mayen Flag"},{code:"1f1f8-1f1f1",desc:"Sierra Leone Flag"},{code:"1f1f8-1f1f2",desc:"San Marino Flag"},{code:"1f1f8-1f1f3",desc:"Senegal Flag"},{code:"1f1f8-1f1f4",desc:"Somalia Flag"},{code:"1f1f8-1f1f7",desc:"Suriname Flag"},{code:"1f1f8-1f1f8",desc:"South Sudan Flag"},{code:"1f1f8-1f1f9",desc:"S\xe3o Tom\xe9 & Pr\xedncipe Flag"},{code:"1f1f8-1f1fb",desc:"El Salvador Flag"},{code:"1f1f8-1f1fd",desc:"Sint Maarten Flag"},{code:"1f1f8-1f1fe",desc:"Syria Flag"},{code:"1f1f9-1f1e6",desc:"Tristan Da Cunha Flag"},{code:"1f1f9-1f1e8",desc:"Turks & Caicos Islands Flag"},{code:"1f1f9-1f1eb",desc:"French Southern Territories Flag"},{code:"1f1f9-1f1ec",desc:"Togo Flag"},{code:"1f1f9-1f1ed",desc:"Thailand Flag"},{code:"1f1f9-1f1ef",desc:"Tajikistan Flag"},{code:"1f1f9-1f1f0",desc:"Tokelau Flag"},{code:"1f1f9-1f1f1",desc:"Timor-Leste Flag"},{code:"1f1f9-1f1f2",desc:"Turkmenistan Flag"},{code:"1f1f9-1f1f3",desc:"Tunisia Flag"},{code:"1f1f9-1f1f4",desc:"Tonga Flag"},{code:"1f1f9-1f1f7",desc:"Turkey Flag"},{code:"1f1f9-1f1f9",desc:"Trinidad & Tobago Flag"},{code:"1f1f9-1f1fb",desc:"Tuvalu Flag"},{code:"1f1f9-1f1fc",desc:"Taiwan Flag"},{code:"1f1f9-1f1ff",desc:"Tanzania Flag"},{code:"1f1fa-1f1e6",desc:"Ukraine City Flag"},{code:"1f1fa-1f1ec",desc:"Uganda Flag"},{code:"1f1fa-1f1f2",desc:"U.s. Outlying Islands Flag"},{code:"1f1fa-1f1fe",desc:"Uruguay Flag"},{code:"1f1fa-1f1ff",desc:"Uzbekistan Flag"},{code:"1f1fb-1f1e6",desc:"Vatican City Flag"},{code:"1f1fb-1f1e8",desc:"St. Vincent & Grenadines Flag"},{code:"1f1fb-1f1ea",desc:"Venezuela Flag"},{code:"1f1fb-1f1ec",desc:"British Virgin Islands Flag"},{code:"1f1fb-1f1ee",desc:"U.s. Virgin Islands Flag"},{code:"1f1fb-1f1f3",desc:"Vietnam Flag"},{code:"1f1fc-1f1f8",desc:"Samoa Flag"},{code:"1f1fb-1f1fa",desc:"Vanuatu Flag"},{code:"1f1fc-1f1eb",desc:'"Wallis & Futuna Flag'},{code:"1f1fd-1f1f0",desc:"Kosovo Flag"},{code:"1f1fe-1f1ea",desc:"Yemen Flag"},{code:"1f1fe-1f1f9",desc:"Mayotte Flag"},{code:"1f1ff-1f1e6",desc:"South Africa Flag"},{code:"1f1ff-1f1f2",desc:"Zambia Flag"},{code:"1f1ff-1f1fc",desc:"Zimbabwe Flag"},{code:"1f1eb-1f1f7",desc:"France Flag"},{code:"1f1ec-1f1e7",desc:"United Kingdom Flag"},{code:"1f1ee-1f1f9",desc:"Italy Flag"},{code:"1f1ef-1f1f5",desc:"Japan Flag"},{code:"1f1f0-1f1f7",desc:"South Korea Flag"},{code:"1f1f7-1f1fa",desc:"Russia Flag"},{code:"1F6A9",desc:"Triangular Flag on Post"},{code:"1f1fa-1f1f8",desc:"United States Flag"}]}],emoticonsButtons:["emoticonsBack","|"],emoticonsUseImage:!0}),S.PLUGINS.emoticons=function(m){var C=m.$,a=m.opts.emoticonsSet,s=a&&a[0],f="";function i(){if(!m.selection.isCollapsed())return!1;var e=m.selection.element(),c=m.selection.endElement();if(e&&m.node.hasClass(e,"fr-emoticon"))return e;if(c&&m.node.hasClass(c,"fr-emoticon"))return c;var d=m.selection.ranges(0),o=d.startContainer;if(o.nodeType==Node.ELEMENT_NODE&&0<o.childNodes.length&&0<d.startOffset){var a=o.childNodes[d.startOffset-1];if(m.node.hasClass(a,"fr-emoticon"))return a}return!1}function n(){return"".concat(function o(e,c){return'<div class="fr-buttons fr-tabs fr-tabs-scroll">\n '.concat(function d(e,o){var a="";return e.forEach(function(e){var c={image:e.code.toLowerCase()},d={elementClass:e.id===o.id?"fr-active fr-active-tab":"",emoticonsUnicodeClass:m.opts.emoticonsUseImage?"":"fr-tabs-unicode",title:m.language.translate(e.name),dataCmd:"setEmoticonCategory",dataParam1:e.id,image:m.opts.emoticonsUseImage?'<img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.0.1/assets/svg/'.concat(c.image,'.svg"/>'):"&#x".concat(c.image,";")};a+='<button class="fr-command fr-btn '.concat(d.elementClass," ").concat(d.emoticonsUnicodeClass,'" \n title="').concat(d.title,'" data-cmd="').concat(d.dataCmd,'" data-param1="').concat(d.dataParam1,'">\n ').concat(d.image," </button>")}),a}(e,c),"\n </div>")}(a,s),"\n ").concat(function d(e){return'\n <div class="fr-icon-container fr-emoticon-container">\n '.concat(function c(e){var a="";return e.emoticons.forEach(function(e){var c=e.code.split("-").reduce(function(e,c){return e?"".concat(e,"‍&#x").concat(c.toLowerCase(),";"):"&#x".concat(c.toLowerCase(),";")},""),d={image:e.code.toLowerCase(),compiledCode:e.uCode?e.uCode:c},o={dataParam1:e.code.toLowerCase(),dataParam2:d.compiledCode,title:m.language.translate(e.desc),image:m.opts.emoticonsUseImage?'<img src="https://cdnjs.cloudflare.com/ajax/libs/emojione/2.0.1/assets/svg/'.concat(d.image,'.svg"/>'):"".concat(d.compiledCode),desc:m.language.translate(e.desc)};a+='<span class="fr-command fr-emoticon fr-icon" role="button" \n data-cmd="insertEmoticon" data-param1="'.concat(o.dataParam1,'" \n data-param2="').concat(o.dataParam2,'" title="').concat(o.title,'" >\n ').concat(o.image,'<span class="fr-sr-only">').concat(o.desc," </span></span>")}),a}(e),"\n </div>\n ")}(s),"\n ").concat(function e(){return m.opts.emoticonsUseImage?'<p style="font-size: 12px; text-align: center; padding: 0 5px;">Emoji free by <a class="fr-link" tabIndex="-1" href="http://emojione.com/" target="_blank" rel="nofollow noopener noreferrer" role="link" aria-label="Open Emoji One website.">Emoji One</a></p>':""}())}return{_init:function e(){var d=function d(){for(var e=m.el.querySelectorAll(".fr-emoticon:not(.fr-deletable)"),c=0;c<e.length;c++)e[c].className+=" fr-deletable"};d(),m.events.on("html.set",d),m.events.on("keydown",function(e){if(m.keys.isCharacter(e.which)&&m.selection.inEditor()){var c=m.selection.ranges(0),d=i();m.node.hasClass(d,"fr-emoticon-img")&&d&&(0===c.startOffset&&m.selection.element()===d?C(d).before(S.MARKERS+S.INVISIBLE_SPACE):C(d).after(S.INVISIBLE_SPACE+S.MARKERS),m.selection.restore())}}),m.events.on("keyup",function(e){for(var c=m.el.querySelectorAll(".fr-emoticon"),d=0;d<c.length;d++)"undefined"!=typeof c[d].textContent&&0===c[d].textContent.replace(/\u200B/gi,"").length&&C(c[d]).remove();if(!(e.which>=S.KEYCODE.ARROW_LEFT&&e.which<=S.KEYCODE.ARROW_DOWN)){var o=i();m.node.hasClass(o,"fr-emoticon-img")&&(C(o).append(S.MARKERS),m.selection.restore())}})},insert:function t(e,c){var d=i(),o=m.selection.ranges(0);d?(0===o.startOffset&&m.selection.element()===d?C(d).before(S.MARKERS+S.INVISIBLE_SPACE):0<o.startOffset&&m.selection.element()===d&&o.commonAncestorContainer.parentNode.classList.contains("fr-emoticon")&&C(d).after(S.INVISIBLE_SPACE+S.MARKERS),m.selection.restore(),m.html.insert('<span class="fr-emoticon fr-deletable'.concat(c?" fr-emoticon-img":"",'"').concat(c?' style="background: url('.concat(c,');"'):"",">").concat(c?" ":e,"</span> ").concat(S.MARKERS),!0)):m.html.insert('<span class="fr-emoticon fr-deletable'.concat(c?" fr-emoticon-img":"",'"').concat(c?' style="background: url('.concat(c,');"'):"",">").concat(c?" ":e,"</span> "),!0)},setEmoticonCategory:function d(c){s=a.filter(function(e){return e.id===c})[0],function e(){m.popups.get("emoticons").html(f+n())}()},showEmoticonsPopup:function l(){var e=m.popups.get("emoticons");if(e||(e=function s(){m.opts.toolbarInline&&0<m.opts.emoticonsButtons.length&&(f='<div class="fr-buttons fr-emoticons-buttons fr-tabs">'.concat(m.button.buildList(m.opts.emoticonsButtons),"</div>"));var e={buttons:f,custom_layer:n()},c=m.popups.create("emoticons",e);return function d(h){m.events.on("popup.tab",function(e){var c=C(e.currentTarget);if(!m.popups.isVisible("emoticons")||!c.is("span, a"))return!0;var d,o,a,s=e.which;if(S.KEYCODE.TAB==s){if(c.is("span.fr-emoticon")&&e.shiftKey||c.is("a")&&!e.shiftKey){var f=h.find(".fr-buttons");d=!m.accessibility.focusToolbar(f,!!e.shiftKey)}if(!1!==d){var i=h.find("span.fr-emoticon:focus").first().concat(h.findVisible(" div.fr-tabs").first().concat(h.find("a")));c.is("span.fr-emoticon")&&(i=i.not("span.fr-emoticon:not(:focus)")),o=i.index(c),o=e.shiftKey?((o-1)%i.length+i.length)%i.length:(o+1)%i.length,a=i.get(o),m.events.disableBlur(),a.focus(),d=!1}}else if(S.KEYCODE.ARROW_UP==s||S.KEYCODE.ARROW_DOWN==s||S.KEYCODE.ARROW_LEFT==s||S.KEYCODE.ARROW_RIGHT==s){if(c.is("span.fr-emoticon")){var n=c.parent().find("span.fr-emoticon");o=n.index(c);var t=m.opts.emoticonsStep,l=Math.floor(n.length/t),r=o%t,F=Math.floor(o/t),g=F*t+r,u=l*t;S.KEYCODE.ARROW_UP==s?g=((g-t)%u+u)%u:S.KEYCODE.ARROW_DOWN==s?g=(g+t)%u:S.KEYCODE.ARROW_LEFT==s?g=((g-1)%u+u)%u:S.KEYCODE.ARROW_RIGHT==s&&(g=(g+1)%u),a=C(n.get(g)),m.events.disableBlur(),a.focus(),d=!1}}else S.KEYCODE.ENTER==s&&(c.is("a")?c[0].click():m.button.exec(c),d=!1);return!1===d&&(e.preventDefault(),e.stopPropagation()),d},!0)}(c),c}()),!e.hasClass("fr-active")){m.popups.refresh("emoticons"),m.popups.setContainer("emoticons",m.$tb);var c=m.$tb.find('.fr-command[data-cmd="emoticons"]'),d=m.button.getPosition(c),o=d.left,a=d.top;m.popups.show("emoticons",o,a,c.outerHeight())}},back:function c(){m.popups.hide("emoticons"),m.toolbar.showInline()}}},S.DefineIcon("emoticons",{NAME:"smile-o",FA5NAME:"smile",SVG_KEY:"smile"}),S.RegisterCommand("emoticons",{title:"Emoticons",undo:!1,focus:!0,refreshAfterCallback:!1,popup:!0,callback:function(){this.popups.isVisible("emoticons")?(this.$el.find(".fr-marker").length&&(this.events.disableBlur(),this.selection.restore()),this.popups.hide("emoticons")):this.emoticons.showEmoticonsPopup()},plugin:"emoticons"}),S.RegisterCommand("insertEmoticon",{callback:function(e,c,d){this.emoticons.insert(d,this.opts.emoticonsUseImage?"https://cdnjs.cloudflare.com/ajax/libs/emojione/2.0.1/assets/svg/".concat(c,".svg"):null),this.popups.hide("emoticons")}}),S.RegisterCommand("setEmoticonCategory",{undo:!1,focus:!1,callback:function(e,c){this.emoticons.setEmoticonCategory(c)}}),S.DefineIcon("emoticonsBack",{NAME:"arrow-left",SVG_KEY:"back"}),S.RegisterCommand("emoticonsBack",{title:"Back",undo:!1,focus:!1,back:!0,refreshAfterCallback:!1,callback:function(){this.emoticons.back()}})});
|
module.exports = {
siteMetadata: {
title: `Enso Digital`,
description: `We are a proud Canadian digital agency. Our mission is to create beautifully designed digital products that generate striking brands.`,
author: `@ensodigital_ca`,
},
plugins: [
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
`gatsby-plugin-less`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#ffffff`,
theme_color: `#000000`,
display: `minimal-ui`,
icon: `src/images/favicon.png`, // This path is relative to the root of the site.
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.app/offline
// 'gatsby-plugin-offline',
],
}
|
import createSvgIcon from './utils/createSvgIcon.js';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M22 10V1h-8v9c0 1.86 1.28 3.41 3 3.86V21h-2v2h6v-2h-2v-7.14c1.72-.45 3-2 3-3.86zm-2-7v3h-4V3h4zm-7.5 8.5c0 1.38-1.12 2.5-2.5 2.5H8v9H6v-9H4c-1.38 0-2.5-1.12-2.5-2.5S2.62 9 4 9h2V8H4C2.62 8 1.5 6.88 1.5 5.5S2.62 3 4 3h2V1h2v2h2c1.38 0 2.5 1.12 2.5 2.5S11.38 8 10 8H8v1h2c1.38 0 2.5 1.12 2.5 2.5z"
}), 'Tapas');
|
const InternalErrors = require('../../../../../shared/errors/InternalErrors');
const Database = require('../../../../../shared/database/sql/create_table');
const { EmployeeRepository } = require('../repositories/EmployeeRepository');
class CreateEmployeeService {
async run(dataEmployee) {
const { name, cpf, phone, money, admission, job } = dataEmployee;
const db = await Database;
if (!db) {
throw new InternalErrors(
'Ocorreu um erro ao criar cadastro do empregado',
503,
);
}
const employeeRepository = new EmployeeRepository();
const findEmployee = await employeeRepository.findByCPF(db, cpf);
if (findEmployee.length) {
throw new InternalErrors('Usuário ja existente no banco de dados', 503);
}
await employeeRepository.create(db, {
name,
cpf,
phone,
money,
admission,
job,
});
}
}
module.exports = { CreateEmployeeService };
|
"use strict";
// Exports a "vector set" (an array of arrays of holodeck vectors).
module.exports = [// Frame latch OPM is used to create a value mailbox that decouples
// the writer of the mailbox from the knowledge of how the value
// written to the mailbox is consumed and for what purposes.
//
// Other OPM's may observe a Frame Latch OPMI by its fully-qualified
// OCD path (or OPMI-relative path) using the transition operator
// @encapsule/holarchy-cm TransitionOperator-opm-at-step.js.
// to determine when it has reached its "updated" step and trigger
// whatever action(s) are required.
//
// Broadly, entire reactive systems can be viewed as chains
// of OPM that use Frame Latches to define their input value(s)
// and/or output value(s) such that they can be observed
// (and consequently processed) by other OPMI's.
require("./vector-set-frame-latch"), require("./vector-set-cml")];
|
"use strict";
/*
* Copyright (c) 2011 Vinay Pulim <vinay@milewise.com>
* MIT Licensed
*
*/
/*jshint proto:true*/
exports.__esModule = true;
var assert_1 = require("assert");
var debugBuilder = require("debug");
var fs = require("fs");
var _ = require("lodash");
var path = require("path");
var sax = require("sax");
var stripBom = require("strip-bom");
var url = require("url");
var http_1 = require("../http");
var nscontext_1 = require("../nscontext");
var utils_1 = require("../utils");
var elements = require("./elements");
var debug = debugBuilder('node-soap');
var XSI_URI = 'http://www.w3.org/2001/XMLSchema-instance';
function xmlEscape (obj) {
if (typeof (obj) === 'string') {
if (obj.substr(0, 9) === '<![CDATA[' && obj.substr(-3) === ']]>') {
return obj;
}
return obj
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
return obj;
}
var trimLeft = /^[\s\xA0]+/;
var trimRight = /[\s\xA0]+$/;
function trim (text) {
return text.replace(trimLeft, '').replace(trimRight, '');
}
function deepMerge (destination, source) {
return _.mergeWith(destination, source, function (a, b) {
return _.isArray(a) ? a.concat(b) : undefined;
});
}
function appendColon (ns) {
return (ns && ns.charAt(ns.length - 1) !== ':') ? ns + ':' : ns;
}
function noColonNameSpace (ns) {
return (ns && ns.charAt(ns.length - 1) === ':') ? ns.substring(0, ns.length - 1) : ns;
}
var WSDL = /** @class */ (function () {
function WSDL (definition, uri, options) {
var _this = this;
this.ignoredNamespaces = ['tns', 'targetNamespace', 'typedNamespace'];
this.ignoreBaseNameSpaces = false;
this.valueKey = '$value';
this.xmlKey = '$xml';
var fromFunc;
this.uri = uri;
this.callback = function () { };
this._includesWsdl = [];
// initialize WSDL cache
this.WSDL_CACHE = {};
if (options && options.WSDL_CACHE) {
this.WSDL_CACHE = options.WSDL_CACHE;
}
this._initializeOptions(options);
if (typeof definition === 'string') {
definition = stripBom(definition);
fromFunc = this._fromXML;
}
else if (typeof definition === 'object') {
fromFunc = this._fromServices;
}
else {
throw new Error('WSDL constructor takes either an XML string or service definition');
}
process.nextTick(function () {
try {
fromFunc.call(_this, definition);
}
catch (e) {
return _this.callback(e);
}
_this.processIncludes(function (err) {
var name;
if (err) {
return _this.callback(err);
}
_this.definitions.deleteFixedAttrs();
var services = _this.services = _this.definitions.services;
if (services) {
for (name in services) {
services[name].postProcess(_this.definitions);
}
}
var complexTypes = _this.definitions.complexTypes;
if (complexTypes) {
for (name in complexTypes) {
complexTypes[name].deleteFixedAttrs();
}
}
// for document style, for every binding, prepare input message element name to (methodName, output message element name) mapping
var bindings = _this.definitions.bindings;
for (var bindingName in bindings) {
var binding = bindings[bindingName];
if (typeof binding.style === 'undefined') {
binding.style = 'document';
}
if (binding.style !== 'document') {
continue;
}
var methods = binding.methods;
var topEls = binding.topElements = {};
for (var methodName in methods) {
if (methods[methodName].input) {
var inputName = methods[methodName].input.$name;
var outputName = '';
if (methods[methodName].output) {
outputName = methods[methodName].output.$name;
}
topEls[inputName] = { methodName: methodName, outputName: outputName };
}
}
}
// prepare soap envelope xmlns definition string
_this.xmlnsInEnvelope = _this._xmlnsMap();
_this.callback(err, _this);
});
});
}
WSDL.prototype.onReady = function (callback) {
if (callback) {
this.callback = callback;
}
};
WSDL.prototype.processIncludes = function (callback) {
var schemas = this.definitions.schemas;
var includes = [];
for (var ns in schemas) {
var schema = schemas[ns];
includes = includes.concat(schema.includes || []);
}
this._processNextInclude(includes, callback);
};
WSDL.prototype.describeServices = function () {
var services = {};
for (var name_1 in this.services) {
var service = this.services[name_1];
services[name_1] = service.description(this.definitions);
}
return services;
};
WSDL.prototype.toXML = function () {
return this.xml || '';
};
WSDL.prototype.xmlToObject = function (xml, callback) {
var _this = this;
var p = typeof callback === 'function' ? {} : sax.parser(true, null);
var objectName = null;
var root = {};
var schema = {
Envelope: {
Header: {
Security: {
UsernameToken: {
Username: 'string',
Password: 'string'
}
}
},
Body: {
Fault: {
faultcode: 'string',
faultstring: 'string',
detail: 'string'
}
}
}
};
var stack = [{ name: null, object: root, schema: schema }];
var xmlns = {};
var refs = {};
var id; // {id:{hrefs:[],obj:}, ...}
p.onopentag = function (node) {
var nsName = node.name;
var attrs = node.attributes;
var name = utils_1.splitQName(nsName).name;
var attributeName;
var top = stack[stack.length - 1];
var topSchema = top.schema;
var elementAttributes = {};
var hasNonXmlnsAttribute = false;
var hasNilAttribute = false;
var obj = {};
var originalName = name;
if (!objectName && top.name === 'Body' && name !== 'Fault') {
var message = _this.definitions.messages[name];
// Support RPC/literal messages where response body contains one element named
// after the operation + 'Response'. See http://www.w3.org/TR/wsdl#_names
if (!message) {
try {
// Determine if this is request or response
var isInput = false;
var isOutput = false;
if ((/Response$/).test(name)) {
isOutput = true;
name = name.replace(/Response$/, '');
}
else if ((/Request$/).test(name)) {
isInput = true;
name = name.replace(/Request$/, '');
}
else if ((/Solicit$/).test(name)) {
isInput = true;
name = name.replace(/Solicit$/, '');
}
// Look up the appropriate message as given in the portType's operations
var portTypes = _this.definitions.portTypes;
var portTypeNames = Object.keys(portTypes);
// Currently this supports only one portType definition.
var portType = portTypes[portTypeNames[0]];
if (isInput) {
name = portType.methods[name].input.$name;
}
else {
name = portType.methods[name].output.$name;
}
message = _this.definitions.messages[name];
// 'cache' this alias to speed future lookups
_this.definitions.messages[originalName] = _this.definitions.messages[name];
}
catch (e) {
if (_this.options.returnFault) {
p.onerror(e);
}
}
}
topSchema = message.description(_this.definitions);
objectName = originalName;
}
if (attrs.href) {
id = attrs.href.substr(1);
if (!refs[id]) {
refs[id] = { hrefs: [], obj: null };
}
refs[id].hrefs.push({ par: top.object, key: name, obj: obj });
}
if (id = attrs.id) {
if (!refs[id]) {
refs[id] = { hrefs: [], obj: null };
}
}
// Handle element attributes
for (attributeName in attrs) {
if (/^xmlns:|^xmlns$/.test(attributeName)) {
xmlns[utils_1.splitQName(attributeName).name] = attrs[attributeName];
continue;
}
hasNonXmlnsAttribute = true;
elementAttributes[attributeName] = attrs[attributeName];
}
for (attributeName in elementAttributes) {
var res = utils_1.splitQName(attributeName);
if (res.name === 'nil' && xmlns[res.prefix] === XSI_URI && elementAttributes[attributeName] &&
(elementAttributes[attributeName].toLowerCase() === 'true' || elementAttributes[attributeName] === '1')) {
hasNilAttribute = true;
break;
}
}
if (hasNonXmlnsAttribute) {
obj[_this.options.attributesKey] = elementAttributes;
}
// Pick up the schema for the type specified in element's xsi:type attribute.
var xsiTypeSchema;
var xsiType;
for (var prefix in xmlns) {
if (xmlns[prefix] === XSI_URI && (prefix + ":type" in elementAttributes)) {
xsiType = elementAttributes[prefix + ":type"];
break;
}
}
if (xsiType) {
var type = utils_1.splitQName(xsiType);
var typeURI = void 0;
if (type.prefix === utils_1.TNS_PREFIX) {
// In case of xsi:type = "MyType"
typeURI = xmlns[type.prefix] || xmlns.xmlns;
}
else {
typeURI = xmlns[type.prefix];
}
var typeDef = _this.findSchemaObject(typeURI, type.name);
if (typeDef) {
xsiTypeSchema = typeDef.description(_this.definitions);
}
}
if (topSchema && topSchema[name + '[]']) {
name = name + '[]';
}
stack.push({ name: originalName, object: obj, schema: (xsiTypeSchema || (topSchema && topSchema[name])), id: attrs.id, nil: hasNilAttribute });
};
p.onclosetag = function (nsName) {
var cur = stack.pop();
var obj = cur.object;
var top = stack[stack.length - 1];
var topObject = top.object;
var topSchema = top.schema;
var name = utils_1.splitQName(nsName).name;
if (typeof cur.schema === 'string' && (cur.schema === 'string' || cur.schema.split(':')[1] === 'string')) {
if (typeof obj === 'object' && Object.keys(obj).length === 0) {
obj = cur.object = '';
}
}
if (cur.nil === true) {
if (_this.options.handleNilAsNull) {
obj = null;
}
else {
return;
}
}
if (_.isPlainObject(obj) && !Object.keys(obj).length) {
obj = null;
}
if (topSchema && topSchema[name + '[]']) {
if (!topObject[name]) {
topObject[name] = [];
}
topObject[name].push(obj);
}
else if (name in topObject) {
if (!Array.isArray(topObject[name])) {
topObject[name] = [topObject[name]];
}
topObject[name].push(obj);
}
else {
topObject[name] = obj;
}
if (cur.id) {
refs[cur.id].obj = obj;
}
};
p.oncdata = function (text) {
var originalText = text;
text = trim(text);
if (!text.length) {
return;
}
if (/<\?xml[\s\S]+\?>/.test(text)) {
var top_1 = stack[stack.length - 1];
var value = _this.xmlToObject(text);
if (top_1.object[_this.options.attributesKey]) {
top_1.object[_this.options.valueKey] = value;
}
else {
top_1.object = value;
}
}
else {
p.ontext(originalText);
}
};
p.onerror = function (e) {
p.resume();
throw {
Fault: {
faultcode: 500,
faultstring: 'Invalid XML',
detail: new Error(e).message,
statusCode: 500
}
};
};
p.ontext = function (text) {
var originalText = text;
text = trim(text);
if (!text.length) {
return;
}
var top = stack[stack.length - 1];
var name = utils_1.splitQName(top.schema).name;
var value;
if (_this.options && _this.options.customDeserializer && _this.options.customDeserializer[name]) {
value = _this.options.customDeserializer[name](text, top);
}
else {
if (name === 'int' || name === 'integer') {
value = parseInt(text, 10);
}
else if (name === 'double' || name === 'float') {
value = Number(text);
}
else if (name === 'bool' || name === 'boolean') {
value = text.toLowerCase() === 'true' || text === '1';
}
else if (name === 'dateTime' || name === 'date') {
value = new Date(text);
}
else {
if (_this.options.preserveWhitespace) {
text = originalText;
}
// handle string or other types
if (typeof top.object !== 'string') {
value = text;
}
else {
value = top.object + text;
}
}
}
if (top.object[_this.options.attributesKey]) {
top.object[_this.options.valueKey] = value;
}
else {
top.object = value;
}
};
if (typeof callback === 'function') {
// we be streaming
var saxStream = sax.createStream(true, null);
saxStream.on('opentag', p.onopentag);
saxStream.on('closetag', p.onclosetag);
saxStream.on('cdata', p.oncdata);
saxStream.on('text', p.ontext);
xml.pipe(saxStream)
.on('error', function (err) {
callback(err);
})
.on('end', function () {
var r;
try {
r = finish();
}
catch (e) {
return callback(e);
}
callback(null, r);
});
return;
}
p.write(xml).close();
return finish();
function finish () {
// MultiRef support: merge objects instead of replacing
for (var n in refs) {
var ref = refs[n];
for (var _i = 0, _a = ref.hrefs; _i < _a.length; _i++) {
var href = _a[_i];
_.assign(href.obj, ref.obj);
}
}
if (root.Envelope) {
var body = root.Envelope.Body;
if (body && body.Fault) {
var code = body.Fault.faultcode && body.Fault.faultcode.$value;
var string = body.Fault.faultstring && body.Fault.faultstring.$value;
var detail = body.Fault.detail && body.Fault.detail.$value;
code = code || body.Fault.faultcode;
string = string || body.Fault.faultstring;
detail = detail || body.Fault.detail;
var error = new Error(code + ': ' + string + (detail ? ': ' + JSON.stringify(detail) : ''));
error.root = root;
throw error;
}
return root.Envelope;
}
return root;
}
};
/**
* Look up a XSD type or element by namespace URI and name
* @param {String} nsURI Namespace URI
* @param {String} qname Local or qualified name
* @returns {*} The XSD type/element definition
*/
WSDL.prototype.findSchemaObject = function (nsURI, qname) {
if (!nsURI || !qname) {
return null;
}
var def = null;
if (this.definitions.schemas) {
var schema = this.definitions.schemas[nsURI];
if (schema) {
if (qname.indexOf(':') !== -1) {
qname = qname.substring(qname.indexOf(':') + 1, qname.length);
}
// if the client passed an input element which has a `$lookupType` property instead of `$type`
// the `def` is found in `schema.elements`.
def = schema.complexTypes[qname] || schema.types[qname] || schema.elements[qname];
}
}
return def;
};
/**
* Create document style xml string from the parameters
* @param {String} name
* @param {*} params
* @param {String} nsPrefix
* @param {String} nsURI
* @param {String} type
*/
WSDL.prototype.objectToDocumentXML = function (name, params, nsPrefix, nsURI, type) {
// If user supplies XML already, just use that. XML Declaration should not be present.
if (params && params._xml) {
return params._xml;
}
var args = {};
args[name] = params;
var parameterTypeObj = type ? this.findSchemaObject(nsURI, type) : null;
return this.objectToXML(args, null, nsPrefix, nsURI, true, null, parameterTypeObj);
};
/**
* Create RPC style xml string from the parameters
* @param {String} name
* @param {*} params
* @param {String} nsPrefix
* @param {String} nsURI
* @returns {string}
*/
WSDL.prototype.objectToRpcXML = function (name, params, nsPrefix, nsURI, isParts) {
var parts = [];
var defs = this.definitions;
var nsAttrName = '_xmlns';
nsPrefix = nsPrefix || utils_1.findPrefix(defs.xmlns, nsURI);
nsURI = nsURI || defs.xmlns[nsPrefix];
nsPrefix = nsPrefix === utils_1.TNS_PREFIX ? '' : (nsPrefix + ':');
parts.push(['<', nsPrefix, name, '>'].join(''));
for (var key in params) {
if (!params.hasOwnProperty(key)) {
continue;
}
if (key !== nsAttrName) {
var value = params[key];
var prefixedKey = (isParts ? '' : nsPrefix) + key;
var attributes = [];
if (typeof value === 'object' && value.hasOwnProperty(this.options.attributesKey)) {
var attrs = value[this.options.attributesKey];
for (var n in attrs) {
attributes.push(' ' + n + '=' + '"' + attrs[n] + '"');
}
}
parts.push(['<', prefixedKey].concat(attributes).concat('>').join(''));
parts.push((typeof value === 'object') ? this.objectToXML(value, key, nsPrefix, nsURI) : xmlEscape(value));
parts.push(['</', prefixedKey, '>'].join(''));
}
}
parts.push(['</', nsPrefix, name, '>'].join(''));
return parts.join('');
};
WSDL.prototype.isIgnoredNameSpace = function (ns) {
return this.options.ignoredNamespaces.indexOf(ns) > -1;
};
WSDL.prototype.filterOutIgnoredNameSpace = function (ns) {
var namespace = noColonNameSpace(ns);
return this.isIgnoredNameSpace(namespace) ? '' : namespace;
};
/**
* Convert an object to XML. This is a recursive method as it calls itself.
*
* @param {Object} obj the object to convert.
* @param {String} name the name of the element (if the object being traversed is
* an element).
* @param {String} nsPrefix the namespace prefix of the object I.E. xsd.
* @param {String} nsURI the full namespace of the object I.E. http://w3.org/schema.
* @param {Boolean} isFirst whether or not this is the first item being traversed.
* @param {?} xmlnsAttr
* @param {?} parameterTypeObject
* @param {NamespaceContext} nsContext Namespace context
*/
WSDL.prototype.objectToXML = function (obj, name, nsPrefix, nsURI, isFirst, xmlnsAttr, schemaObject, nsContext) {
var schema = this.definitions.schemas[nsURI];
var parentNsPrefix = nsPrefix ? nsPrefix.parent : undefined;
if (typeof parentNsPrefix !== 'undefined') {
// we got the parentNsPrefix for our array. setting the namespace-variable back to the current namespace string
nsPrefix = nsPrefix.current;
}
parentNsPrefix = noColonNameSpace(parentNsPrefix);
if (this.isIgnoredNameSpace(parentNsPrefix)) {
parentNsPrefix = '';
}
var soapHeader = !schema;
var qualified = schema && schema.$elementFormDefault === 'qualified';
var parts = [];
var prefixNamespace = (nsPrefix || qualified) && nsPrefix !== utils_1.TNS_PREFIX;
var xmlnsAttrib = '';
if (nsURI && isFirst) {
if (this.options.overrideRootElement && this.options.overrideRootElement.xmlnsAttributes) {
this.options.overrideRootElement.xmlnsAttributes.forEach(function (attribute) {
xmlnsAttrib += ' ' + attribute.name + '="' + attribute.value + '"';
});
}
else {
if (prefixNamespace && !this.isIgnoredNameSpace(nsPrefix)) {
// resolve the prefix namespace
xmlnsAttrib += ' xmlns:' + nsPrefix + '="' + nsURI + '"';
}
// only add default namespace if the schema elementFormDefault is qualified
if (qualified || soapHeader) {
xmlnsAttrib += ' xmlns="' + nsURI + '"';
}
}
}
if (!nsContext) {
nsContext = new nscontext_1.NamespaceContext();
nsContext.declareNamespace(nsPrefix, nsURI);
}
else {
nsContext.pushContext();
}
// explicitly use xmlns attribute if available
if (xmlnsAttr && !(this.options.overrideRootElement && this.options.overrideRootElement.xmlnsAttributes)) {
xmlnsAttrib = xmlnsAttr;
}
var ns = '';
if (this.options.overrideRootElement && isFirst) {
ns = this.options.overrideRootElement.namespace;
}
else if (prefixNamespace && (qualified || isFirst || soapHeader) && !this.isIgnoredNameSpace(nsPrefix)) {
ns = nsPrefix;
}
var i;
var n;
// start building out XML string.
if (Array.isArray(obj)) {
var nonSubNameSpace = '';
var emptyNonSubNameSpaceForArray = false;
var nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
if (nameWithNsRegex) {
nonSubNameSpace = nameWithNsRegex[1];
name = nameWithNsRegex[2];
}
else if (name[0] === ':') {
emptyNonSubNameSpaceForArray = true;
name = name.substr(1);
}
for (i = 0, n = obj.length; i < n; i++) {
var item = obj[i];
var arrayAttr = this.processAttributes(item, nsContext);
var correctOuterNsPrefix = nonSubNameSpace || parentNsPrefix || ns; // using the parent namespace prefix if given
var body = this.objectToXML(item, name, nsPrefix, nsURI, false, null, schemaObject, nsContext);
var openingTagParts = ['<', name, arrayAttr, xmlnsAttrib];
if (!emptyNonSubNameSpaceForArray) {
openingTagParts = ['<', appendColon(correctOuterNsPrefix), name, arrayAttr, xmlnsAttrib];
}
if (body === '' && this.options.useEmptyTag) {
// Use empty (self-closing) tags if no contents
openingTagParts.push(' />');
parts.push(openingTagParts.join(''));
}
else {
openingTagParts.push('>');
if (this.options.namespaceArrayElements || i === 0) {
parts.push(openingTagParts.join(''));
}
parts.push(body);
if (this.options.namespaceArrayElements || i === n - 1) {
if (emptyNonSubNameSpaceForArray) {
parts.push(['</', name, '>'].join(''));
}
else {
parts.push(['</', appendColon(correctOuterNsPrefix), name, '>'].join(''));
}
}
}
}
}
else if (typeof obj === 'object') {
for (name in obj) {
if (!obj.hasOwnProperty(name)) {
continue;
}
// don't process attributes as element
if (name === this.options.attributesKey) {
continue;
}
// Its the value of a xml object. Return it directly.
if (name === this.options.xmlKey) {
nsContext.popContext();
return obj[name];
}
// Its the value of an item. Return it directly.
if (name === this.options.valueKey) {
nsContext.popContext();
return xmlEscape(obj[name]);
}
var child = obj[name];
if (typeof child === 'undefined') {
continue;
}
var attr = this.processAttributes(child, nsContext);
var value = '';
var nonSubNameSpace = '';
var emptyNonSubNameSpace = false;
var nameWithNsRegex = /^([^:]+):([^:]+)$/.exec(name);
if (nameWithNsRegex) {
nonSubNameSpace = nameWithNsRegex[1] + ':';
name = nameWithNsRegex[2];
}
else if (name[0] === ':') {
emptyNonSubNameSpace = true;
name = name.substr(1);
}
if (isFirst) {
value = this.objectToXML(child, name, nsPrefix, nsURI, false, null, schemaObject, nsContext);
}
else {
if (this.definitions.schemas) {
if (schema) {
var childSchemaObject = this.findChildSchemaObject(schemaObject, name);
// find sub namespace if not a primitive
if (childSchemaObject &&
((childSchemaObject.$type && (childSchemaObject.$type.indexOf('xsd:') === -1)) ||
childSchemaObject.$ref || childSchemaObject.$name)) {
/*if the base name space of the children is not in the ingoredSchemaNamspaces we use it.
This is because in some services the child nodes do not need the baseNameSpace.
*/
var childNsPrefix = '';
var childName = '';
var childNsURI = void 0;
var childXmlnsAttrib = '';
var elementQName = childSchemaObject.$ref || childSchemaObject.$name;
if (elementQName) {
elementQName = utils_1.splitQName(elementQName);
childName = elementQName.name;
if (elementQName.prefix === utils_1.TNS_PREFIX) {
// Local element
childNsURI = childSchemaObject.$targetNamespace;
childNsPrefix = nsContext.registerNamespace(childNsURI);
if (this.isIgnoredNameSpace(childNsPrefix)) {
childNsPrefix = nsPrefix;
}
}
else {
childNsPrefix = elementQName.prefix;
if (this.isIgnoredNameSpace(childNsPrefix)) {
childNsPrefix = nsPrefix;
}
childNsURI = schema.xmlns[childNsPrefix] || this.definitions.xmlns[childNsPrefix];
}
var unqualified = false;
// Check qualification form for local elements
if (childSchemaObject.$name && childSchemaObject.targetNamespace === undefined) {
if (childSchemaObject.$form === 'unqualified') {
unqualified = true;
}
else if (childSchemaObject.$form === 'qualified') {
unqualified = false;
}
else {
unqualified = schema.$elementFormDefault !== 'qualified';
}
}
if (unqualified) {
childNsPrefix = '';
}
if (childNsURI && childNsPrefix) {
if (nsContext.declareNamespace(childNsPrefix, childNsURI)) {
childXmlnsAttrib = ' xmlns:' + childNsPrefix + '="' + childNsURI + '"';
xmlnsAttrib += childXmlnsAttrib;
}
}
}
var resolvedChildSchemaObject = void 0;
if (childSchemaObject.$type) {
var typeQName = utils_1.splitQName(childSchemaObject.$type);
var typePrefix = typeQName.prefix;
var typeURI = schema.xmlns[typePrefix] || this.definitions.xmlns[typePrefix];
childNsURI = typeURI;
if (typeURI !== 'http://www.w3.org/2001/XMLSchema' && typePrefix !== utils_1.TNS_PREFIX) {
// Add the prefix/namespace mapping, but not declare it
nsContext.addNamespace(typePrefix, typeURI);
}
resolvedChildSchemaObject =
this.findSchemaType(typeQName.name, typeURI) || childSchemaObject;
}
else {
resolvedChildSchemaObject =
this.findSchemaObject(childNsURI, childName) || childSchemaObject;
}
if (childSchemaObject.$baseNameSpace && this.options.ignoreBaseNameSpaces) {
childNsPrefix = nsPrefix;
childNsURI = nsURI;
}
if (this.options.ignoreBaseNameSpaces) {
childNsPrefix = '';
childNsURI = '';
}
ns = childNsPrefix;
if (Array.isArray(child)) {
// for arrays, we need to remember the current namespace
childNsPrefix = {
current: childNsPrefix,
parent: ns
};
}
else {
// parent (array) already got the namespace
childXmlnsAttrib = null;
}
value = this.objectToXML(child, name, childNsPrefix, childNsURI, false, childXmlnsAttrib, resolvedChildSchemaObject, nsContext);
}
else if (obj[this.options.attributesKey] && obj[this.options.attributesKey].xsi_type) {
// if parent object has complex type defined and child not found in parent
var completeChildParamTypeObject = this.findChildSchemaObject(obj[this.options.attributesKey].xsi_type.type, obj[this.options.attributesKey].xsi_type.xmlns);
nonSubNameSpace = obj[this.options.attributesKey].xsi_type.prefix;
nsContext.addNamespace(obj[this.options.attributesKey].xsi_type.prefix, obj[this.options.attributesKey].xsi_type.xmlns);
value = this.objectToXML(child, name, obj[this.options.attributesKey].xsi_type.prefix, obj[this.options.attributesKey].xsi_type.xmlns, false, null, null, nsContext);
}
else {
if (Array.isArray(child)) {
if (emptyNonSubNameSpace) {
name = ':' + name;
}
else {
name = nonSubNameSpace + name;
}
}
value = this.objectToXML(child, name, nsPrefix, nsURI, false, null, null, nsContext);
}
}
else {
value = this.objectToXML(child, name, nsPrefix, nsURI, false, null, null, nsContext);
}
}
}
ns = noColonNameSpace(ns);
if (prefixNamespace && !qualified && isFirst && !this.options.overrideRootElement) {
ns = nsPrefix;
}
else if (this.isIgnoredNameSpace(ns)) {
ns = '';
}
var useEmptyTag = !value && this.options.useEmptyTag;
if (!Array.isArray(child)) {
// start tag
parts.push(['<', emptyNonSubNameSpace ? '' : appendColon(nonSubNameSpace || ns), name, attr, xmlnsAttrib,
(child === null ? ' xsi:nil="true"' : ''),
useEmptyTag ? ' />' : '>',
].join(''));
}
if (!useEmptyTag) {
parts.push(value);
if (!Array.isArray(child)) {
// end tag
parts.push(['</', emptyNonSubNameSpace ? '' : appendColon(nonSubNameSpace || ns), name, '>'].join(''));
}
}
}
}
else if (obj !== undefined) {
parts.push((this.options.escapeXML) ? xmlEscape(obj) : obj);
}
nsContext.popContext();
return parts.join('');
};
WSDL.prototype.processAttributes = function (child, nsContext) {
var attr = '';
if (child === null) {
child = [];
}
var attrObj = child[this.options.attributesKey];
if (attrObj && attrObj.xsi_type) {
var xsiType = attrObj.xsi_type;
var prefix = xsiType.prefix || xsiType.namespace;
// Generate a new namespace for complex extension if one not provided
if (!prefix) {
prefix = nsContext.registerNamespace(xsiType.xmlns);
}
else {
nsContext.declareNamespace(prefix, xsiType.xmlns);
}
xsiType.prefix = prefix;
}
if (attrObj) {
for (var attrKey in attrObj) {
// handle complex extension separately
if (attrKey === 'xsi_type') {
var attrValue = attrObj[attrKey];
attr += ' xsi:type="' + attrValue.prefix + ':' + attrValue.type + '"';
attr += ' xmlns:' + attrValue.prefix + '="' + attrValue.xmlns + '"';
continue;
}
else {
attr += ' ' + attrKey + '="' + xmlEscape(attrObj[attrKey]) + '"';
}
}
}
return attr;
};
/**
* Look up a schema type definition
* @param name
* @param nsURI
* @returns {*}
*/
WSDL.prototype.findSchemaType = function (name, nsURI) {
if (!this.definitions.schemas || !name || !nsURI) {
return null;
}
var schema = this.definitions.schemas[nsURI];
if (!schema || !schema.complexTypes) {
return null;
}
return schema.complexTypes[name];
};
WSDL.prototype.findChildSchemaObject = function (parameterTypeObj, childName, backtrace) {
if (!parameterTypeObj || !childName) {
return null;
}
if (!backtrace) {
backtrace = [];
}
if (backtrace.indexOf(parameterTypeObj) >= 0) {
// We've recursed back to ourselves; break.
return null;
}
else {
backtrace = backtrace.concat([parameterTypeObj]);
}
var found = null;
var i = 0;
var child;
var ref;
if (Array.isArray(parameterTypeObj.$lookupTypes) && parameterTypeObj.$lookupTypes.length) {
var types = parameterTypeObj.$lookupTypes;
for (i = 0; i < types.length; i++) {
var typeObj = types[i];
if (typeObj.$name === childName) {
found = typeObj;
break;
}
}
}
var object = parameterTypeObj;
if (object.$name === childName && object.name === 'element') {
return object;
}
if (object.$ref) {
ref = utils_1.splitQName(object.$ref);
if (ref.name === childName) {
return object;
}
}
var childNsURI;
// want to avoid unecessary recursion to improve performance
if (object.$type && backtrace.length === 1) {
var typeInfo = utils_1.splitQName(object.$type);
if (typeInfo.prefix === utils_1.TNS_PREFIX) {
childNsURI = parameterTypeObj.$targetNamespace;
}
else {
childNsURI = this.definitions.xmlns[typeInfo.prefix];
}
var typeDef = this.findSchemaType(typeInfo.name, childNsURI);
if (typeDef) {
return this.findChildSchemaObject(typeDef, childName, backtrace);
}
}
if (object.children) {
for (i = 0, child; child = object.children[i]; i++) {
found = this.findChildSchemaObject(child, childName, backtrace);
if (found) {
break;
}
if (child.$base) {
var baseQName = utils_1.splitQName(child.$base);
var childNameSpace = baseQName.prefix === utils_1.TNS_PREFIX ? '' : baseQName.prefix;
childNsURI = child.xmlns[baseQName.prefix] || this.definitions.xmlns[baseQName.prefix];
var foundBase = this.findSchemaType(baseQName.name, childNsURI);
if (foundBase) {
found = this.findChildSchemaObject(foundBase, childName, backtrace);
if (found) {
found.$baseNameSpace = childNameSpace;
found.$type = childNameSpace + ':' + childName;
break;
}
}
}
}
}
if (!found && object.$name === childName) {
return object;
}
return found;
};
WSDL.prototype._initializeOptions = function (options) {
this._originalIgnoredNamespaces = (options || {}).ignoredNamespaces;
this.options = {};
if (options.forceHTTPS) this.options.forceHTTPS = true
var ignoredNamespaces = options ? options.ignoredNamespaces : null;
if (ignoredNamespaces &&
(Array.isArray(ignoredNamespaces.namespaces) || typeof ignoredNamespaces.namespaces === 'string')) {
if (ignoredNamespaces.override) {
this.options.ignoredNamespaces = ignoredNamespaces.namespaces;
}
else {
this.options.ignoredNamespaces = this.ignoredNamespaces.concat(ignoredNamespaces.namespaces);
}
}
else {
this.options.ignoredNamespaces = this.ignoredNamespaces;
}
this.options.valueKey = options.valueKey || this.valueKey;
this.options.xmlKey = options.xmlKey || this.xmlKey;
if (options.escapeXML !== undefined) {
this.options.escapeXML = options.escapeXML;
}
else {
this.options.escapeXML = true;
}
if (options.returnFault !== undefined) {
this.options.returnFault = options.returnFault;
}
else {
this.options.returnFault = false;
}
this.options.handleNilAsNull = !!options.handleNilAsNull;
if (options.namespaceArrayElements !== undefined) {
this.options.namespaceArrayElements = options.namespaceArrayElements;
}
else {
this.options.namespaceArrayElements = true;
}
// Allow any request headers to keep passing through
this.options.wsdl_headers = options.wsdl_headers;
this.options.wsdl_options = options.wsdl_options;
if (options.httpClient) {
this.options.httpClient = options.httpClient;
}
// The supplied request-object should be passed through
if (options.request) {
this.options.request = options.request;
}
var ignoreBaseNameSpaces = options ? options.ignoreBaseNameSpaces : null;
if (ignoreBaseNameSpaces !== null && typeof ignoreBaseNameSpaces !== 'undefined') {
this.options.ignoreBaseNameSpaces = ignoreBaseNameSpaces;
}
else {
this.options.ignoreBaseNameSpaces = this.ignoreBaseNameSpaces;
}
// Works only in client
this.options.forceSoap12Headers = options.forceSoap12Headers;
this.options.customDeserializer = options.customDeserializer;
if (options.overrideRootElement !== undefined) {
this.options.overrideRootElement = options.overrideRootElement;
}
this.options.useEmptyTag = !!options.useEmptyTag;
};
WSDL.prototype._processNextInclude = function (includes, callback) {
var _this = this;
var include = includes.shift();
if (!include) {
return callback();
}
var includePath;
if (!/^https?:/i.test(this.uri) && !/^https?:/i.test(include.location)) {
includePath = path.resolve(path.dirname(this.uri), include.location);
}
else {
includePath = url.resolve(this.uri || '', include.location);
}
var options = _.assign({}, this.options);
// follow supplied ignoredNamespaces option
options.ignoredNamespaces = this._originalIgnoredNamespaces || this.options.ignoredNamespaces;
options.WSDL_CACHE = this.WSDL_CACHE;
open_wsdl_recursive(includePath, options, function (err, wsdl) {
if (err) {
return callback(err);
}
_this._includesWsdl.push(wsdl);
if (wsdl.definitions instanceof elements.DefinitionsElement) {
_.mergeWith(_this.definitions, wsdl.definitions, function (a, b) {
return (a instanceof elements.SchemaElement) ? a.merge(b) : undefined;
});
}
else {
return callback(new Error('wsdl.defintions is not an instance of elements.DefinitionsElement'));
}
_this._processNextInclude(includes, function (err) {
callback(err);
});
});
};
WSDL.prototype._parse = function (xml) {
var _this = this;
var p = sax.parser(true, null);
var stack = [];
var root = null;
var types = null;
var schema = null;
var schemaAttrs = null;
var options = this.options;
p.onopentag = function (node) {
var nsName = node.name;
var attrs = node.attributes;
var top = stack[stack.length - 1];
var name = utils_1.splitQName(nsName).name;
if (name === 'schema') {
schemaAttrs = attrs;
}
if (top) {
try {
top.startElement(stack, nsName, attrs, options, schemaAttrs);
}
catch (e) {
if (_this.options.strict) {
throw e;
}
else {
stack.push(new elements.Element(nsName, attrs, options, schemaAttrs));
}
}
}
else {
if (name === 'definitions') {
root = new elements.DefinitionsElement(nsName, attrs, options);
stack.push(root);
}
else if (name === 'schema') {
// Shim a structure in here to allow the proper objects to be created when merging back.
root = new elements.DefinitionsElement('definitions', {}, {});
types = new elements.TypesElement('types', {}, {});
schema = new elements.SchemaElement(nsName, attrs, options);
types.addChild(schema);
root.addChild(types);
stack.push(schema);
}
else {
throw new Error('Unexpected root element of WSDL or include');
}
}
};
p.onclosetag = function (name) {
var top = stack[stack.length - 1];
assert_1.ok(top, 'Unmatched close tag: ' + name);
top.endElement(stack, name);
};
p.write(xml).close();
return root;
};
WSDL.prototype._fromXML = function (xml) {
this.definitions = this._parse(xml);
this.definitions.descriptions = {
types: {}
};
this.xml = xml;
};
WSDL.prototype._fromServices = function (services) {
};
WSDL.prototype._xmlnsMap = function () {
var xmlns = this.definitions.xmlns;
var str = '';
for (var alias in xmlns) {
if (alias === '' || alias === utils_1.TNS_PREFIX) {
continue;
}
var ns = xmlns[alias];
switch (ns) {
case 'http://xml.apache.org/xml-soap': // apachesoap
case 'http://schemas.xmlsoap.org/wsdl/': // wsdl
case 'http://schemas.xmlsoap.org/wsdl/soap/': // wsdlsoap
case 'http://schemas.xmlsoap.org/wsdl/soap12/': // wsdlsoap12
case 'http://schemas.xmlsoap.org/soap/encoding/': // soapenc
case 'http://www.w3.org/2001/XMLSchema': // xsd
continue;
}
if (~ns.indexOf('http://schemas.xmlsoap.org/')) {
continue;
}
if (~ns.indexOf('http://www.w3.org/')) {
continue;
}
if (~ns.indexOf('http://xml.apache.org/')) {
continue;
}
str += ' xmlns:' + alias + '="' + ns + '"';
}
return str;
};
return WSDL;
}());
exports.WSDL = WSDL;
function open_wsdl_recursive (uri, p2, p3) {
var fromCache;
var WSDL_CACHE;
var options;
var callback;
if (typeof p2 === 'function') {
options = {};
callback = p2;
}
else {
options = p2;
callback = p3;
}
WSDL_CACHE = options.WSDL_CACHE;
if (fromCache = WSDL_CACHE[uri]) {
return callback.call(fromCache, null, fromCache);
}
return open_wsdl(uri, options, callback);
}
function open_wsdl (uri, p2, p3) {
var options;
var callback;
if (typeof p2 === 'function') {
options = {};
callback = p2;
}
else if (typeof p3 === 'function') {
options = p2;
callback = p3;
}
// initialize cache when calling open_wsdl directly
var WSDL_CACHE = options.WSDL_CACHE || {};
var request_headers = options.wsdl_headers;
var request_options = options.wsdl_options;
var wsdl;
if (!/^https?:/i.test(uri)) {
debug('Reading file: %s', uri);
fs.readFile(uri, 'utf8', function (err, definition) {
if (err) {
callback(err);
}
else {
wsdl = new WSDL(definition, uri, options);
WSDL_CACHE[uri] = wsdl;
wsdl.WSDL_CACHE = WSDL_CACHE;
wsdl.onReady(callback);
}
});
}
else {
debug('Reading url: %s', uri);
var httpClient = options.httpClient || new http_1.HttpClient(options);
if (options.forceHTTPS && !uri.includes('https')) uri = uri.replace('http', 'https')
httpClient.request(uri, null /* options */, function (err, response, definition) {
if (err) {
callback(err);
}
else if (response && response.statusCode === 200) {
wsdl = new WSDL(definition, uri, options);
WSDL_CACHE[uri] = wsdl;
wsdl.WSDL_CACHE = WSDL_CACHE;
wsdl.onReady(callback);
}
else {
callback(new Error('Invalid WSDL URL: ' + uri + '\n\n\r Code: ' + response.statusCode + '\n\n\r Response Body: ' + response.body));
}
}, request_headers, request_options);
}
return wsdl;
}
exports.open_wsdl = open_wsdl;
//# sourceMappingURL=index.js.map
|
var server = require('./server');
exports.createServer = function() {
return server.createNew();
};
|
'use strict';
module.exports = {
globals: {
server: true,
},
root: true,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
},
},
plugins: ['ember'],
extends: [
'eslint:recommended',
'plugin:ember/recommended',
'plugin:prettier/recommended',
],
env: {
browser: true,
},
rules: {
'no-unused-vars': ['error', { args: 'none' }],
'no-console': ['error', { allow: ['warn', 'error'] }],
'ember/no-incorrect-calls-with-inline-anonymous-functions': 'off',
'ember/require-return-from-computed': 'off',
'ember/no-jquery': 'error',
// TODO: enable these rules
'ember/classic-decorator-no-classic-methods': 'off',
'ember/no-actions-hash': 'off',
'ember/no-classic-classes': 'off',
'ember/no-classic-components': 'off',
'ember/no-component-lifecycle-hooks': 'off',
'ember/no-computed-properties-in-native-classes': 'off',
'ember/no-get': 'off',
'ember/no-private-routing-service': 'off',
'ember/no-string-prototype-extensions': 'off',
'ember/require-tagless-components': 'off',
},
overrides: [
// node files
{
files: [
'.eslintrc.js',
'.prettierrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'addon/styles/tailwind.js',
'index.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/**/*.js',
'tests/dummy/config/**/*.js',
'tests-node/**/*.js',
],
excludedFiles: [
'addon/**',
'addon-test-support/**',
'app/**',
'tests/dummy/app/**',
],
parserOptions: {
sourceType: 'script',
},
env: {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
},
// node test files
{
globals: {
describe: true,
it: true,
beforeEach: true,
afterEach: true,
},
files: ['tests-node/**/*.js'],
rules: {
'node/no-unpublished-require': 'off',
},
},
],
};
|
'use strict';
/**
* Engagement Lab
* - Learning Games Core Functionality
* Developed by Engagement Lab, 2016-2017
* ==============
* Common functionality game controller for the Lab's socket-based learning games
*
* @author Johnny Richardson, Erica Salling
*
* ==========
*/
class Core {
constructor() {
// Duration to wait for player to refresh client before timing her out (TODO: config value)
this._player_timeout_duration = 10000,
this.Templates,
this.Session = require('./SessionManager'),
this.events = require('events'),
this.eventEmitter = new this.events.EventEmitter(),
this._current_players = {},
this._current_player_index = 0,
this._game_session,
this._game_timeout,
this._game_in_session,
this._config,
this._current_submissions = {},
this._players_submitted = [],
this._countdown,
this._countdown_duration,
this._countdown_paused,
this._event_countdown_done,
this._current_round,
this._showing_results = false,
this._votes = 0,
// Stores last event sent and its data
this._objLastTemplate,
this._strLastEventId,
this._current_player_cap,
// Identifies targets for socket events
this.players_id,
this.group_id,
this._group_socket,
// Flag for if session is being restarted
this._session_restarting;
}
/**
* Initialize this game's session.
*
* @param {Object} gameSession Player socket ID
* @param {Function} callback Function to fire after session initialized
* @class Core
* @name Initialize
*/
Initialize(gameSession, keystone, appRoot, callback) {
this.keystone = keystone;
this.appRoot = appRoot;
this._game_in_session = false;
var GameConfig = this.keystone.list('GameConfig').model;
this._countdown_paused = false;
this._session_restarting = false;
// Init session
this._game_session = gameSession;
// Init template loader with current game type
var TemplateLoader = require('./TemplateLoader');
this.Templates = new TemplateLoader(gameSession.gameType, this.keystone, this.appRoot);
// Identify targets for socket events
this.players_id = gameSession.accessCode,
this.group_id = gameSession.accessCode + '-group';
// Get config for game
var queryConfig = GameConfig.findOne({gameType: new RegExp('^'+gameSession.gameType+'$', "i")}, {}, {});
// If no gametype, get singular config
if(!gameSession.gameType)
queryConfig = GameConfig.findOne({});
queryConfig.exec((err, resultConfig) => {
this._config = resultConfig;
callback(this._config);
});
}
/**
* Gets a player's object given their socket ID
*
* @param {String} Player socket ID
* @class Core
* @name GetPlayerById
* @return {Boolean} Player object, if found
*/
GetPlayerById(id) {
let player = _.findWhere(this._current_players, {socket_id: id});
if(!player) {
console.log('Could not find player with socket id %s', id);
return null;
}
return player;
}
/**
* Gets a player's object given their unique user ID
*
* @param {String} Player unique user ID
* @class Core
* @name GetPlayerByUserId
* @return {Boolean} Player object, if found
*/
GetPlayerByUserId(id) {
let player = _.findWhere(this._current_players, {uid: id});
if(!player) {
console.log('Could not find player with uid %s', id);
return null;
}
return player;
}
/**
* Gets the game's type
*
* @class Core
* @name GetGameType
* @return {String} Game's Type
*/
GetGameType() {
return this._game_session.gameType;
}
/**
* Gets if session is resetting
*
* @class Core
* @name IsRestarting
* @return {Boolean} Is session restarting?
*/
IsRestarting() {
return this._session_restarting;
}
/**
* Gets if game is full of players
*
* @class Core
* @name IsFull
* @return {Boolean} Is game entirely full?
*/
IsFull() {
return (Object.keys(this._current_players).length === 8);
}
/**
* Is username a player entered available?
*
* @param {String} name Username
* @class Core
* @name UsernameAvailable
* @return {Boolean} Is username available?
*/
UsernameAvailable(name) {
return (_.where(this._current_players, {username: name}).length === 0);
}
/**
* Is player whose UID is provided still active?
*
* @param {String} Player UID
* @class Core
* @name PlayerIsActive
* @return {Boolean} Is player active?
*/
PlayerIsActive(uid) {
// If game is not currently in session, no player is marked as active
// if(!this._game_in_session)
// return false;
return this._current_players[uid] !== undefined;
}
/**
* Get if session is currently active.
*
* @class Core
* @name GameInSession
* @return {Boolean} _game_in_session Is session active?
*/
GameInSession() {
return this._game_in_session;
}
/**
* Flag the session as in restarting state
*
* @class Core
* @name SetToRestarting
*/
SetToRestarting() {
this._session_restarting = true;
}
/**
* Reset session's state to default
*
* @class Core
* @name Reset
*/
Reset() {
// Stop countdown
clearInterval(this._countdown);
this._countdown = undefined;
this._countdown_paused = false;
this._current_players = {};
this._current_submissions = {};
this._players_submitted = [];
this._current_player_index = 0;
this._game_in_session = false;
console.info('Game "' + this._game_session.accessCode + '" ended! ');
}
/**
* Begin the game's tutorial.
* @param {Object} Group moderator socket
* @class Core
* @name StartTutorial
*/
StartTutorial(socket) {
// If there are (somehow) more than 8 players when START button is pressed, kick them out!
if (this._current_players.length >= 8) {
// TO DO: Kick out extra players
}
this.Templates.Load('partials/group/tutorial', undefined, (html) => {
socket.to(this.group_id).emit('game:tutorial', html);
});
}
/**
* Begin a cooldown clock for the session
*
* @param {Object} Group moderator socket
* @param {Object} Data object w/ duration, name of countdown
* @param {Boolean} Is countdown for players as well as group?
* @class Core
* @name Countdown
*/
Countdown(socket, data, forPlayers) {
if(this._countdown)
clearInterval(this._countdown);
// Use provided time limit if defined
if(data && data.timeLimit)
this._countdown_duration = data.timeLimit;
else
this._countdown_duration = this._config.timeLimit;
let halfway = this._countdown_duration/2;
let quarterway = halfway/2;
// Dispatch time to group view
let socketInfo = {duration: this._countdown_duration}
if(data && data.countdownName)
socketInfo.name = data.countdownName;
if(forPlayers)
socket.to(this.players_id).emit('game:countdown', socketInfo);
else
socket.to(this.group_id).emit('game:countdown', socketInfo);
// Start countdown
this._countdown = setInterval(() => {
if(this._countdown_paused)
return;
this._countdown_duration--;
if(this._countdown_duration === 0) {
// Tell the players time is up
if(forPlayers)
this._group_socket.to(this.players_id).emit('game:countdown_end', data.countdownName);
else
this._group_socket.to(this.group_id).emit('game:countdown_end', data.countdownName);
// Send the countdownEnded event to the game script
this.eventEmitter.emit('countdownEnded', data, socket);
// Clear the countdown
this.StopCountdown();
}
// TODO: This needs to be its own timeout given use of this method for a lot of game events
else if(this._countdown_duration === 15) {
// Dispatch countdown when running out of time for player
this.Templates.Load('partials/player/timerunningout', undefined, (html) => {
socket.to(this.players_id).emit('game:countdown_ending', {html: html, socket: this.players_id});
});
}
}, 1000);
}
/**
* Pause or resume session's current cooldown clock. For debug purposes only and disabled for production.
*
* @class Core
* @name PauseResumeCooldown
*/
PauseResumeCooldown() {
if(process.env.NODE_ENV === 'production')
return;
this._countdown_paused = !this._countdown_paused;
this._group_socket.to(this.group_id).emit('debug:pause');
}
/**
* Stop session's current cooldown clock.
*
* @class Core
* @name StopCountdown
*/
StopCountdown() {
clearInterval(this._countdown);
this.eventEmitter.removeAllListeners('countdownEnded');
}
/**
* Signaled when group moderator joins/re-joins session, setting up group socket and resuming game (if applicable)
*
* @param {Object} Group moderator's socket
* @class Core
* @name ModeratorJoin
*/
ModeratorJoin(socket) {
clearInterval(this._game_timeout);
// Setup group socket (used for some methods dispatched from emitter)
this._group_socket = socket;
// End restarting state
this._session_restarting = false;
// Inform players of resumed game (if applicable)
socket.to(this.PLAYERS_ID).emit('game:resumed');
}
/**
* Reset and delete this session, and force all players to disconnect. Optionally, wait a bit to end game in case moderator re-connects.
*
* @param {Object} Socket for group
* @param {Boolean} Wait xx seconds before ending game?
* @class Core
* @name End
*/
End(socket, noTimeout) {
if(!noTimeout) {
var timeoutTime = 30;
console.info('Game "' + this._game_session.accessCode + '" is timing out! ');
this._game_timeout = setInterval(() => {
timeoutTime--;
if(timeoutTime === 0) {
clearInterval(this._game_timeout);
this.Reset();
this.Session.Delete(this.players_id);
this.Templates.Load('partials/player/gameended', undefined, (html) => {
socket.to(this.players_id).emit('game:ended', html);
this._objLastTemplate = html;
this._strLastEventId = 'game:ended';
// Force all players to disconnect
for(let player in this._current_players)
socket.sockets.sockets[player.socket_id].disconnect(true);
});
}
else {
// Dispatch countdown for game timeout
this.Templates.Load('partials/player/gameending', {time: timeoutTime}, (html) => {
socket.to(this.players_id).emit('game:ending', html);
this._objLastTemplate = html;
this._strLastEventId = 'game:ending';
});
}
}, 1000);
this._game_in_session = false;
}
else {
this.Reset();
this.Session.Delete(this.players_id);
// Dispatch countdown for game timeout
this.Templates.Load('partials/player/gameended', {time: timeoutTime}, (html) => {
socket.to(this.players_id).emit('game:ended', html);
socket.to(this.group_id).emit('game:ended', html);
this._objLastTemplate = html;
this._strLastEventId = 'game:ended';
// Force all players to disconnect
for(let player in this._current_players)
socket.sockets.sockets[player.socket_id].disconnect(true);
});
}
}
/**
* Join player to session, or re-connect them and sync s/he to session.
*
* @param {Object} The player object
* @param {Object} The player's socket
* @class Core
* @name PlayerReady
*/
PlayerReady(player, socket) {
if (this._current_player_cap >= 8) {
socket.to(player.socket_id).emit('game:error', "Uh oh, looks like this game is full! Removing you from the game...");
return;
}
// If player is re-connecting, set them back to connected, and re-broadcast the last update
if(this._current_players[player.uid]) {
this._current_players[player.uid].connected = true;
this._current_players[player.uid].socket_id = player.socket_id;
console.info(player.username + ' has re-joined the game and has uid ' + player.uid);
socket.emit(this._strLastEventId, {waitForLoad: true, html: this._objLastTemplate});
}
else {
this._current_players[player.uid] = {
username: player.username,
socket_id: player.socket_id,
uid: player.uid,
index: this._current_player_index,
submitted: false,
connected: true
};
console.info(player.username + ' has joined the game and has uid ' + player.uid, '('+this._game_session.accessCode+')');
this._current_player_index++;
socket.to(this.group_id).emit('players:update', {players: _.sortBy(this._current_players, function(player) {return player.index}), state: 'gained_player'});
}
// Get current # of players
this._current_player_cap = Object.keys(this._current_players).length;
}
/**
* Deactivate player for now and start cooldown for them to re-join within, after which they're removed from session.
*
* @param {String} The player's socket ID
* @class Core
* @name PlayerLost
*/
PlayerLost(playerSocketId) {
let thisPlayer = this.GetPlayerById(playerSocketId)
if(!thisPlayer)
return;
thisPlayer.connected = false;
// Decrease current # of players
this._current_player_cap--;
// If game is currently in session, give player 10s to refresh before booting them...
if(this._game_in_session) {
setTimeout(() => {
this.PlayerRemove(thisPlayer);
}, this._player_timeout_duration);
}
// ...otherwise, kick 'em out now
else
this.PlayerRemove(thisPlayer);
}
/**
* Remove the given player from the game and broadcast new player list.
*
* @param {Object} The player
* @class Core
* @name PlayerRemove
*/
PlayerRemove(player) {
// If player has not managed to re-connect...
if (!player.connected) {
delete this._current_players[player.uid];
this._group_socket.to(this.group_id).emit(
'players:update',
{ players: _.sortBy(this._current_players, function(player) {return player.index}),
state: 'lost_player'
}
);
// If only one player left, end the game now
if(Object.keys(this._current_players).length <= 1 && this._game_in_session) {
if (this._showing_results && (this._current_round === this._config.roundNumber -1)){
return;
}
this.End(this._group_socket, true);
}
}
}
/**
* Advance session's round while saving its data to DB.
*
* @class Core
* @name AdvanceRound
*/
AdvanceRound(socket) {
this._showing_results = false;
// Reset players state for next round
_.each(this._current_players, (playerId, index) => {
this._current_players[index] = _.omit(this._current_players[index], 'score');
this._current_players[index].submitted = false;
});
this.SaveSession();
socket.emit('game:advance');
// Advance round
this._current_round++;
}
/**
* Display survey for all players, if one if enabled for this game.
*
* @class Core
* @name DisplaySurvey
*/
DisplaySurvey(socket) {
if(this._config.survey)
socket.to(this.players_id).emit('game:survey');
}
/**
* Calculate/tally player's current round and total score.
*
* @param {Object} The player
* @param {Boolean} Current points value
* @class Core
* @name CalcPlayerScore
*/
CalcPlayerScore(currentPlayer, points) {
if(currentPlayer.socket_id === this.realId)
return;
// Set points for this round
if (!currentPlayer.score)
currentPlayer.score = points;
else
currentPlayer.score += points;
// Set total points
if(!currentPlayer.score_total)
currentPlayer.score_total = points;
else
currentPlayer.score_total += points;
logger.info(currentPlayer.username + ' points this round are ' + currentPlayer.score);
logger.info(currentPlayer.username + ' score is now ' + currentPlayer.score_total);
return points;
}
/**
* Save the current 'state' of all players. When a player re-joins, we retrieve this state for them.
*
* @param {String} Event ID
* @param {Object} The event's rendered template
* @class Core
* @name SaveState
*/
SaveState(strEventId, objTemplate) {
this._strLastEventId = strEventId;
this._objLastTemplate = objTemplate;
// Save debug data?
if(process.env.NODE_ENV !== 'production') {
if(!this._game_session.debugData)
this._game_session.debugData = {};
this._game_session.debugData[strEventId] = objTemplate;
this.SaveSession();
}
}
/**
* Save the session's current data to Mongo
*
* @class Core
* @name SaveSession
*/
SaveSession() {
this.Session.Save(this._game_session);
}
}
module.exports.Core = Core,
module.exports.SessionManager = require('./SessionManager');
module.exports.TemplateLoader = require('./TemplateLoader');
module.exports.ShuffleUtil = require('./ShuffleUtil');
|
System.config({
defaultJSExtensions: true,
transpiler: "babel",
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system"
]
},
paths: {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
},
map: {
"aurelia-pal": "npm:aurelia-pal@1.0.0",
"aurelia-pal-browser": "npm:aurelia-pal-browser@1.0.0",
"babel": "npm:babel-core@5.8.38",
"babel-runtime": "npm:babel-runtime@5.8.38",
"core-js": "npm:core-js@2.4.1",
"github:jspm/nodelibs-assert@0.1.0": {
"assert": "npm:assert@1.4.1"
},
"github:jspm/nodelibs-buffer@0.1.0": {
"buffer": "npm:buffer@3.6.0"
},
"github:jspm/nodelibs-path@0.1.0": {
"path-browserify": "npm:path-browserify@0.0.0"
},
"github:jspm/nodelibs-process@0.1.2": {
"process": "npm:process@0.11.6"
},
"github:jspm/nodelibs-util@0.1.0": {
"util": "npm:util@0.10.3"
},
"github:jspm/nodelibs-vm@0.1.0": {
"vm-browserify": "npm:vm-browserify@0.0.4"
},
"npm:assert@1.4.1": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"buffer": "github:jspm/nodelibs-buffer@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"util": "npm:util@0.10.3"
},
"npm:aurelia-pal-browser@1.0.0": {
"aurelia-pal": "npm:aurelia-pal@1.0.0"
},
"npm:babel-runtime@5.8.38": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:buffer@3.6.0": {
"base64-js": "npm:base64-js@0.0.8",
"child_process": "github:jspm/nodelibs-child_process@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"ieee754": "npm:ieee754@1.1.6",
"isarray": "npm:isarray@1.0.0",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:core-js@2.4.1": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.2",
"systemjs-json": "github:systemjs/plugin-json@0.1.2"
},
"npm:inherits@2.0.1": {
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:path-browserify@0.0.0": {
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:process@0.11.6": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"vm": "github:jspm/nodelibs-vm@0.1.0"
},
"npm:util@0.10.3": {
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.2"
},
"npm:vm-browserify@0.0.4": {
"indexof": "npm:indexof@0.0.1"
}
}
});
|
(function () {
'use strict';
var app = angular.module('myApp.directives', []);
// Alternative of ng-include ..
app.directive('myInclude', function () {
return {
replace: true,
restrict: 'A',
templateUrl: function (iElement, iAttrs) {
if (!iAttrs.myInclude) throw new Error("my-include: template url must be provided");
return iAttrs.myInclude;
}
};
});
})();
|
import Route from '@ember/routing/route';
import EmberObject from '@ember/object';
import {A} from '@ember/array';
export default Route.extend({
setupController(controller/*, model*/) {
let items = A();
for (let index = 0; index < 10; index++) {
items.push(EmberObject.create({
id: `id:${index}`,
header: `header:${index}`,
size: 1,
useCustomMenu: false,
fullSizeContent: false,
canMaximize: true,
canCollapse: true,
overflow: null,
}));
}
controller.set('model', items);
controller.set('formSettings', EmberObject.create({isFullScreen:false, section:false, escape:false, size:2}));
controller.set('overflowOptions', A(['null','left','right','both']));
}
});
|
import { compileWat, WasmRunner } from "@exercism/wasm-lib";
let wasmModule;
let currentInstance;
beforeAll(async () => {
try {
const watPath = new URL("./hello-world.wat", import.meta.url);
const { buffer } = await compileWat(watPath);
wasmModule = await WebAssembly.compile(buffer);
} catch (err) {
console.log(`Error compiling *.wat: ${err}`);
}
});
describe("Hello World", () => {
beforeEach(async () => {
currentInstance = null;
if (!wasmModule) {
return Promise.reject();
}
try {
currentInstance = await new WasmRunner(wasmModule);
return Promise.resolve();
} catch (err) {
console.log(`Error instantiating WebAssembly module: ${err}`);
return Promise.reject();
}
});
test("Say Hi!", () => {
expect(currentInstance).toBeTruthy();
const [offset, length] = currentInstance.exports.hello();
expect(length).toBe(13);
const greeting = currentInstance.get_mem_as_utf8(offset, length);
expect(greeting).toBe("Hello, World!");
});
});
|
/** @license Material-UI v1.0.0-beta.41
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.withWidth = exports.Zoom = undefined;
exports.Collapse = exports.Fade = exports.Grow = exports.Slide = exports.Tooltip = exports.Toolbar = exports.TextField = exports.Typography = exports.Tab = exports.Tabs = exports.TableSortLabel = exports.TableRow = exports.TablePagination = exports.TableHead = exports.TableFooter = exports.TableCell = exports.TableBody = exports.Table = exports.Switch = exports.SwipeableDrawer = exports.SvgIcon = exports.colors = exports.jssPreset = exports.createMuiTheme = exports.withTheme = exports.withStyles = exports.MuiThemeProvider = exports.StepLabel = exports.StepContent = exports.StepIcon = exports.StepButton = exports.Step = exports.Stepper = exports.SnackbarContent = exports.Snackbar = exports.Select = exports.RadioGroup = exports.Radio = exports.LinearProgress = exports.CircularProgress = exports.Portal = exports.Popover = exports.Paper = exports.ModalManager = exports.Backdrop = exports.Modal = exports.MobileStepper = exports.MenuList = exports.MenuItem = exports.Menu = exports.ListSubheader = exports.ListItemText = exports.ListItemSecondaryAction = exports.ListItemIcon = exports.ListItemAvatar = exports.ListItem = exports.List = exports.GridListTileBar = exports.GridListTile = exports.GridList = exports.Grid = exports.InputAdornment = exports.InputLabel = exports.Input = exports.IconButton = exports.Icon = exports.Hidden = exports.FormControlLabel = exports.FormHelperText = exports.FormLabel = exports.FormGroup = exports.FormControl = exports.ExpansionPanelSummary = exports.ExpansionPanelDetails = exports.ExpansionPanelActions = exports.ExpansionPanel = exports.Drawer = exports.Divider = exports.withMobileDialog = exports.DialogTitle = exports.DialogContentText = exports.DialogContent = exports.DialogActions = exports.Dialog = exports.CssBaseline = exports.ClickAwayListener = exports.Chip = exports.Checkbox = exports.CardMedia = exports.CardHeader = exports.CardContent = exports.CardActions = exports.Card = exports.ButtonBase = exports.Button = exports.BottomNavigationAction = exports.BottomNavigation = exports.Badge = exports.Avatar = exports.AppBar = undefined;
var _AppBar = require('./AppBar');
Object.defineProperty(exports, 'AppBar', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_AppBar).default;
}
});
var _Avatar = require('./Avatar');
Object.defineProperty(exports, 'Avatar', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Avatar).default;
}
});
var _Badge = require('./Badge');
Object.defineProperty(exports, 'Badge', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Badge).default;
}
});
var _BottomNavigation = require('./BottomNavigation');
Object.defineProperty(exports, 'BottomNavigation', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_BottomNavigation).default;
}
});
Object.defineProperty(exports, 'BottomNavigationAction', {
enumerable: true,
get: function get() {
return _BottomNavigation.BottomNavigationAction;
}
});
var _Button = require('./Button');
Object.defineProperty(exports, 'Button', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Button).default;
}
});
var _ButtonBase = require('./ButtonBase');
Object.defineProperty(exports, 'ButtonBase', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ButtonBase).default;
}
});
var _Card = require('./Card');
Object.defineProperty(exports, 'Card', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Card).default;
}
});
Object.defineProperty(exports, 'CardActions', {
enumerable: true,
get: function get() {
return _Card.CardActions;
}
});
Object.defineProperty(exports, 'CardContent', {
enumerable: true,
get: function get() {
return _Card.CardContent;
}
});
Object.defineProperty(exports, 'CardHeader', {
enumerable: true,
get: function get() {
return _Card.CardHeader;
}
});
Object.defineProperty(exports, 'CardMedia', {
enumerable: true,
get: function get() {
return _Card.CardMedia;
}
});
var _Checkbox = require('./Checkbox');
Object.defineProperty(exports, 'Checkbox', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Checkbox).default;
}
});
var _Chip = require('./Chip');
Object.defineProperty(exports, 'Chip', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Chip).default;
}
});
var _ClickAwayListener = require('./utils/ClickAwayListener');
Object.defineProperty(exports, 'ClickAwayListener', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ClickAwayListener).default;
}
});
var _CssBaseline = require('./CssBaseline');
Object.defineProperty(exports, 'CssBaseline', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CssBaseline).default;
}
});
var _Dialog = require('./Dialog');
Object.defineProperty(exports, 'Dialog', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Dialog).default;
}
});
Object.defineProperty(exports, 'DialogActions', {
enumerable: true,
get: function get() {
return _Dialog.DialogActions;
}
});
Object.defineProperty(exports, 'DialogContent', {
enumerable: true,
get: function get() {
return _Dialog.DialogContent;
}
});
Object.defineProperty(exports, 'DialogContentText', {
enumerable: true,
get: function get() {
return _Dialog.DialogContentText;
}
});
Object.defineProperty(exports, 'DialogTitle', {
enumerable: true,
get: function get() {
return _Dialog.DialogTitle;
}
});
Object.defineProperty(exports, 'withMobileDialog', {
enumerable: true,
get: function get() {
return _Dialog.withMobileDialog;
}
});
var _Divider = require('./Divider');
Object.defineProperty(exports, 'Divider', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Divider).default;
}
});
var _Drawer = require('./Drawer');
Object.defineProperty(exports, 'Drawer', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Drawer).default;
}
});
var _ExpansionPanel = require('./ExpansionPanel');
Object.defineProperty(exports, 'ExpansionPanel', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ExpansionPanel).default;
}
});
Object.defineProperty(exports, 'ExpansionPanelActions', {
enumerable: true,
get: function get() {
return _ExpansionPanel.ExpansionPanelActions;
}
});
Object.defineProperty(exports, 'ExpansionPanelDetails', {
enumerable: true,
get: function get() {
return _ExpansionPanel.ExpansionPanelDetails;
}
});
Object.defineProperty(exports, 'ExpansionPanelSummary', {
enumerable: true,
get: function get() {
return _ExpansionPanel.ExpansionPanelSummary;
}
});
var _Form = require('./Form');
Object.defineProperty(exports, 'FormControl', {
enumerable: true,
get: function get() {
return _Form.FormControl;
}
});
Object.defineProperty(exports, 'FormGroup', {
enumerable: true,
get: function get() {
return _Form.FormGroup;
}
});
Object.defineProperty(exports, 'FormLabel', {
enumerable: true,
get: function get() {
return _Form.FormLabel;
}
});
Object.defineProperty(exports, 'FormHelperText', {
enumerable: true,
get: function get() {
return _Form.FormHelperText;
}
});
Object.defineProperty(exports, 'FormControlLabel', {
enumerable: true,
get: function get() {
return _Form.FormControlLabel;
}
});
var _Hidden = require('./Hidden');
Object.defineProperty(exports, 'Hidden', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Hidden).default;
}
});
var _Icon = require('./Icon');
Object.defineProperty(exports, 'Icon', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Icon).default;
}
});
var _IconButton = require('./IconButton');
Object.defineProperty(exports, 'IconButton', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_IconButton).default;
}
});
var _Input = require('./Input');
Object.defineProperty(exports, 'Input', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Input).default;
}
});
Object.defineProperty(exports, 'InputLabel', {
enumerable: true,
get: function get() {
return _Input.InputLabel;
}
});
Object.defineProperty(exports, 'InputAdornment', {
enumerable: true,
get: function get() {
return _Input.InputAdornment;
}
});
var _Grid = require('./Grid');
Object.defineProperty(exports, 'Grid', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Grid).default;
}
});
var _GridList = require('./GridList');
Object.defineProperty(exports, 'GridList', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_GridList).default;
}
});
Object.defineProperty(exports, 'GridListTile', {
enumerable: true,
get: function get() {
return _GridList.GridListTile;
}
});
Object.defineProperty(exports, 'GridListTileBar', {
enumerable: true,
get: function get() {
return _GridList.GridListTileBar;
}
});
var _List = require('./List');
Object.defineProperty(exports, 'List', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_List).default;
}
});
Object.defineProperty(exports, 'ListItem', {
enumerable: true,
get: function get() {
return _List.ListItem;
}
});
Object.defineProperty(exports, 'ListItemAvatar', {
enumerable: true,
get: function get() {
return _List.ListItemAvatar;
}
});
Object.defineProperty(exports, 'ListItemIcon', {
enumerable: true,
get: function get() {
return _List.ListItemIcon;
}
});
Object.defineProperty(exports, 'ListItemSecondaryAction', {
enumerable: true,
get: function get() {
return _List.ListItemSecondaryAction;
}
});
Object.defineProperty(exports, 'ListItemText', {
enumerable: true,
get: function get() {
return _List.ListItemText;
}
});
Object.defineProperty(exports, 'ListSubheader', {
enumerable: true,
get: function get() {
return _List.ListSubheader;
}
});
var _Menu = require('./Menu');
Object.defineProperty(exports, 'Menu', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Menu).default;
}
});
Object.defineProperty(exports, 'MenuItem', {
enumerable: true,
get: function get() {
return _Menu.MenuItem;
}
});
Object.defineProperty(exports, 'MenuList', {
enumerable: true,
get: function get() {
return _Menu.MenuList;
}
});
var _MobileStepper = require('./MobileStepper');
Object.defineProperty(exports, 'MobileStepper', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_MobileStepper).default;
}
});
var _Modal = require('./Modal');
Object.defineProperty(exports, 'Modal', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Modal).default;
}
});
Object.defineProperty(exports, 'Backdrop', {
enumerable: true,
get: function get() {
return _Modal.Backdrop;
}
});
Object.defineProperty(exports, 'ModalManager', {
enumerable: true,
get: function get() {
return _Modal.ModalManager;
}
});
var _Paper = require('./Paper');
Object.defineProperty(exports, 'Paper', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Paper).default;
}
});
var _Popover = require('./Popover');
Object.defineProperty(exports, 'Popover', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Popover).default;
}
});
var _Portal = require('./Portal');
Object.defineProperty(exports, 'Portal', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Portal).default;
}
});
var _Progress = require('./Progress');
Object.defineProperty(exports, 'CircularProgress', {
enumerable: true,
get: function get() {
return _Progress.CircularProgress;
}
});
Object.defineProperty(exports, 'LinearProgress', {
enumerable: true,
get: function get() {
return _Progress.LinearProgress;
}
});
var _Radio = require('./Radio');
Object.defineProperty(exports, 'Radio', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Radio).default;
}
});
Object.defineProperty(exports, 'RadioGroup', {
enumerable: true,
get: function get() {
return _Radio.RadioGroup;
}
});
var _Select = require('./Select');
Object.defineProperty(exports, 'Select', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Select).default;
}
});
var _Snackbar = require('./Snackbar');
Object.defineProperty(exports, 'Snackbar', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Snackbar).default;
}
});
Object.defineProperty(exports, 'SnackbarContent', {
enumerable: true,
get: function get() {
return _Snackbar.SnackbarContent;
}
});
var _Stepper = require('./Stepper');
Object.defineProperty(exports, 'Stepper', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Stepper).default;
}
});
Object.defineProperty(exports, 'Step', {
enumerable: true,
get: function get() {
return _Stepper.Step;
}
});
Object.defineProperty(exports, 'StepButton', {
enumerable: true,
get: function get() {
return _Stepper.StepButton;
}
});
Object.defineProperty(exports, 'StepIcon', {
enumerable: true,
get: function get() {
return _Stepper.StepIcon;
}
});
Object.defineProperty(exports, 'StepContent', {
enumerable: true,
get: function get() {
return _Stepper.StepContent;
}
});
Object.defineProperty(exports, 'StepLabel', {
enumerable: true,
get: function get() {
return _Stepper.StepLabel;
}
});
var _styles = require('./styles');
Object.defineProperty(exports, 'MuiThemeProvider', {
enumerable: true,
get: function get() {
return _styles.MuiThemeProvider;
}
});
Object.defineProperty(exports, 'withStyles', {
enumerable: true,
get: function get() {
return _styles.withStyles;
}
});
Object.defineProperty(exports, 'withTheme', {
enumerable: true,
get: function get() {
return _styles.withTheme;
}
});
Object.defineProperty(exports, 'createMuiTheme', {
enumerable: true,
get: function get() {
return _styles.createMuiTheme;
}
});
Object.defineProperty(exports, 'jssPreset', {
enumerable: true,
get: function get() {
return _styles.jssPreset;
}
});
var _SvgIcon = require('./SvgIcon');
Object.defineProperty(exports, 'SvgIcon', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_SvgIcon).default;
}
});
var _SwipeableDrawer = require('./SwipeableDrawer');
Object.defineProperty(exports, 'SwipeableDrawer', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_SwipeableDrawer).default;
}
});
var _Switch = require('./Switch');
Object.defineProperty(exports, 'Switch', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Switch).default;
}
});
var _Table = require('./Table');
Object.defineProperty(exports, 'Table', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Table).default;
}
});
Object.defineProperty(exports, 'TableBody', {
enumerable: true,
get: function get() {
return _Table.TableBody;
}
});
Object.defineProperty(exports, 'TableCell', {
enumerable: true,
get: function get() {
return _Table.TableCell;
}
});
Object.defineProperty(exports, 'TableFooter', {
enumerable: true,
get: function get() {
return _Table.TableFooter;
}
});
Object.defineProperty(exports, 'TableHead', {
enumerable: true,
get: function get() {
return _Table.TableHead;
}
});
Object.defineProperty(exports, 'TablePagination', {
enumerable: true,
get: function get() {
return _Table.TablePagination;
}
});
Object.defineProperty(exports, 'TableRow', {
enumerable: true,
get: function get() {
return _Table.TableRow;
}
});
Object.defineProperty(exports, 'TableSortLabel', {
enumerable: true,
get: function get() {
return _Table.TableSortLabel;
}
});
var _Tabs = require('./Tabs');
Object.defineProperty(exports, 'Tabs', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Tabs).default;
}
});
Object.defineProperty(exports, 'Tab', {
enumerable: true,
get: function get() {
return _Tabs.Tab;
}
});
var _Typography = require('./Typography');
Object.defineProperty(exports, 'Typography', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Typography).default;
}
});
var _TextField = require('./TextField');
Object.defineProperty(exports, 'TextField', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_TextField).default;
}
});
var _Toolbar = require('./Toolbar');
Object.defineProperty(exports, 'Toolbar', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Toolbar).default;
}
});
var _Tooltip = require('./Tooltip');
Object.defineProperty(exports, 'Tooltip', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Tooltip).default;
}
});
var _transitions = require('./transitions');
Object.defineProperty(exports, 'Slide', {
enumerable: true,
get: function get() {
return _transitions.Slide;
}
});
Object.defineProperty(exports, 'Grow', {
enumerable: true,
get: function get() {
return _transitions.Grow;
}
});
Object.defineProperty(exports, 'Fade', {
enumerable: true,
get: function get() {
return _transitions.Fade;
}
});
Object.defineProperty(exports, 'Collapse', {
enumerable: true,
get: function get() {
return _transitions.Collapse;
}
});
Object.defineProperty(exports, 'Zoom', {
enumerable: true,
get: function get() {
return _transitions.Zoom;
}
});
var _withWidth = require('./utils/withWidth');
Object.defineProperty(exports, 'withWidth', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_withWidth).default;
}
});
var _colors = require('./colors');
var colors = _interopRequireWildcard(_colors);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// eslint-disable-next-line import/first
exports.colors = colors;
|
/**
* @fileoverview Description of this file.
*/
/**
* Copyright 2018 The AMP HTML Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as eventHelper from '../../src/event-helper';
import * as mode from '../../src/mode';
import {maybeValidate} from '../../src/validator-integration';
describes.fakeWin('validator-integration', {}, env => {
let loadScriptStub;
let modeStub;
let win;
describe('maybeValidate', () => {
beforeEach(() => {
win = env.win;
loadScriptStub = env.sandbox.stub(eventHelper, 'loadPromise');
modeStub = env.sandbox.stub(mode, 'getMode');
});
it('should not load validator script if not in dev mode', () => {
modeStub.returns({development: false});
maybeValidate(win);
expect(loadScriptStub).not.to.have.been.called;
});
it('should not load validator script if bypassed', () => {
modeStub.returns({development: true, test: true});
win.location = 'https://www.example.com/#development=1&validate=0';
maybeValidate(win);
expect(loadScriptStub).not.to.have.been.called;
});
it('should load validator script if dev mode', () => {
modeStub.returns({development: true});
loadScriptStub.returns(Promise.resolve());
maybeValidate(win);
expect(loadScriptStub).to.have.been.called;
});
});
});
|
function jump() {
const URL = "https://tgftp.nws.noaa.gov/data/observations/metar/stations/";
icao = document.form.textBox1.value;
upper_icao = icao.toUpperCase()
//console.log(icao)
metar_URL = URL + upper_icao + '.TXT';
//metar_URL = "https://tgftp.nws.noaa.gov/data/observations/metar/stations/RJTT.TXT"
window.open(metar_URL, '_blank')
}
function enter() {
if (window.event.keyCode == 13) {
jump();
}
}
|
function login() {
var err = false;
var data = new Object();
var div = document.getElementById("content");
var form = document.getElementById("authentication");
var inputs = div.getElementsByTagName("INPUT");
console.log(inputs);
for (var i = inputs.length - 1; i >= 0; i--) {
var key = inputs[i].name;
var value = inputs[i].value;
if (value.length == 0) {
inputs[i].style.borderColor = "red";
err = true;
}
data[key] = value;
}
if (err == true) {
data = new Object();
return;
}
if (data.hasOwnProperty("confirm")) {
if (data["confirm"] != data["password"]) {
alert("sdafsd");
document.getElementById('password').style.borderColor = "red";
document.getElementById('confirm').style.borderColor = "red";
document.getElementById("err").innerHTML = "{{.account.failed}}";
return;
}
}
console.log(data);
form.submit();
}
|
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { i18n } from '@kbn/i18n';
import { toastNotifications } from 'ui/notify';
import {
deleteJobs as sendDeleteJobsRequest,
createNoticeableDelay,
showApiError,
} from '../../services';
import { getDetailPanelJob } from '../selectors';
import {
UPDATE_JOB_START,
UPDATE_JOB_SUCCESS,
UPDATE_JOB_FAILURE,
} from '../action_types';
import { refreshJobs } from './refresh_jobs';
import { closeDetailPanel } from './detail_panel';
export const deleteJobs = (jobIds) => async (dispatch, getState) => {
dispatch({
type: UPDATE_JOB_START,
});
try {
await createNoticeableDelay(sendDeleteJobsRequest(jobIds));
} catch (error) {
dispatch({
type: UPDATE_JOB_FAILURE,
});
return showApiError(error, i18n.translate('xpack.rollupJobs.deleteAction.errorTitle', {
defaultMessage: 'Error deleting rollup jobs',
}));
}
if (jobIds.length === 1) {
toastNotifications.addSuccess(i18n.translate('xpack.rollupJobs.deleteAction.successSingleNotificationTitle', {
defaultMessage: `Rollup job '{jobId}' was deleted`,
values: { jobId: jobIds[0] },
}));
} else {
toastNotifications.addSuccess(i18n.translate('xpack.rollupJobs.deleteAction.successMultipleNotificationTitle', {
defaultMessage: '{count} rollup jobs were deleted',
values: { count: jobIds.length },
}));
}
// If we've just deleted a job we were looking at, we need to close the panel.
const detailPanelJob = getDetailPanelJob(getState());
if (detailPanelJob && jobIds.includes(detailPanelJob.id)) {
dispatch(closeDetailPanel());
}
dispatch({
type: UPDATE_JOB_SUCCESS,
});
dispatch(refreshJobs());
};
|
// Get the Sidebar
var mySidebar = document.getElementById("mySidebar");
// Get the DIV with overlay effect
var overlayBg = document.getElementById("myOverlay");
// Toggle between showing and hiding the sidebar, and add overlay effect
function w3_open() {
if (mySidebar.style.display === 'block') {
mySidebar.style.display = 'none';
overlayBg.style.display = "none";
} else {
mySidebar.style.display = 'block';
overlayBg.style.display = "block";
}
}
// Close the sidebar with the close button
function w3_close() {
mySidebar.style.display = "none";
overlayBg.style.display = "none";
}
|
'use strict';
describe('Filter: filter', function() {
var filter;
beforeEach(inject(function($filter) {
filter = $filter('filter');
}));
it('should filter by string', function() {
var items = ['MIsKO', {name: 'shyam'}, ['adam'], 1234];
expect(filter(items, '').length).toBe(4);
expect(filter(items, undefined).length).toBe(4);
expect(filter(items, 'iSk').length).toBe(1);
expect(filter(items, 'isk')[0]).toBe('MIsKO');
expect(filter(items, 'yam').length).toBe(1);
expect(filter(items, 'yam')[0]).toEqual(items[1]);
expect(filter(items, 'da').length).toBe(1);
expect(filter(items, 'da')[0]).toEqual(items[2]);
expect(filter(items, '34').length).toBe(1);
expect(filter(items, '34')[0]).toBe(1234);
expect(filter(items, "I don't exist").length).toBe(0);
});
it('should not read $ properties', function() {
expect(''.charAt(0)).toBe(''); // assumption
var items = [{$name: 'misko'}];
expect(filter(items, 'misko').length).toBe(0);
});
it('should filter on specific property', function() {
var items = [{ignore: 'a', name: 'a'}, {ignore: 'a', name: 'abc'}];
expect(filter(items, {}).length).toBe(2);
expect(filter(items, {name: 'a'}).length).toBe(2);
expect(filter(items, {name: 'b'}).length).toBe(1);
expect(filter(items, {name: 'b'})[0].name).toBe('abc');
});
it('should ignore undefined properties of the expression object', function() {
var items = [{name: 'a'}, {name: 'abc'}];
expect(filter(items, {name: undefined})).toEqual([{name: 'a'}, {name: 'abc'}]);
items = [{first: 'misko'}, {deep: {first: 'misko'}}, {deep: {last: 'hevery'}}];
expect(filter(items, {deep: {first: undefined}})).toEqual([{deep: {first: 'misko'}}, {deep: {last: 'hevery'}}]);
});
it('should take function as predicate', function() {
var items = [{name: 'a'}, {name: 'abc', done: true}];
expect(filter(items, function(i) {return i.done;}).length).toBe(1);
});
it('should pass the index to a function predicate', function() {
var items = [0, 1, 2, 3];
var result = filter(items, function(value, index) {
return index % 2 === 0;
});
expect(result).toEqual([0, 2]);
});
it('should match primitive array values against top-level `$` property in object expression',
function() {
var items, expr;
items = ['something', 'something else', 'another thing'];
expr = {$: 'some'};
expect(filter(items, expr).length).toBe(2);
expect(filter(items, expr)).toEqual([items[0], items[1]]);
items = [{val: 'something'}, {val: 'something else'}, {val: 'another thing'}];
expr = {$: 'some'};
expect(filter(items, expr).length).toBe(2);
expect(filter(items, expr)).toEqual([items[0], items[1]]);
items = [123, 456, 789];
expr = {$: 1};
expect(filter(items, expr).length).toBe(1);
expect(filter(items, expr)).toEqual([items[0]]);
items = [true, false, 'true'];
expr = {$: true, ignored: 'false'};
expect(filter(items, expr).length).toBe(2);
expect(filter(items, expr)).toEqual([items[0], items[2]]);
}
);
it('should match items with array properties containing one or more matching items', function() {
var items, expr;
items = [
{tags: ['web', 'html', 'css', 'js']},
{tags: ['hybrid', 'html', 'css', 'js', 'ios', 'android']},
{tags: ['mobile', 'ios', 'android']}
];
expr = {tags: 'html'};
expect(filter(items, expr).length).toBe(2);
expect(filter(items, expr)).toEqual([items[0], items[1]]);
items = [
{nums: [1, 345, 12]},
{nums: [0, 46, 78]},
{nums: [123, 4, 67]}
];
expr = {nums: 12};
expect(filter(items, expr).length).toBe(2);
expect(filter(items, expr)).toEqual([items[0], items[2]]);
items = [
{customers: [{name: 'John'}, {name: 'Elena'}, {name: 'Bill'}]},
{customers: [{name: 'Sam'}, {name: 'Klara'}, {name: 'Bill'}]},
{customers: [{name: 'Molli'}, {name: 'Elena'}, {name: 'Lora'}]}
];
expr = {customers: {name: 'Bill'}};
expect(filter(items, expr).length).toBe(2);
expect(filter(items, expr)).toEqual([items[0], items[1]]);
}
);
it('should take object as predicate', function() {
var items = [{first: 'misko', last: 'hevery'},
{first: 'adam', last: 'abrons'}];
expect(filter(items, {first:'', last:''}).length).toBe(2);
expect(filter(items, {first:'', last:'hevery'}).length).toBe(1);
expect(filter(items, {first:'adam', last:'hevery'}).length).toBe(0);
expect(filter(items, {first:'misko', last:'hevery'}).length).toBe(1);
expect(filter(items, {first:'misko', last:'hevery'})[0]).toEqual(items[0]);
});
it('should support predicate object with dots in the name', function() {
var items = [{'first.name': 'misko', 'last.name': 'hevery'},
{'first.name': 'adam', 'last.name': 'abrons'}];
expect(filter(items, {'first.name':'', 'last.name':''}).length).toBe(2);
expect(filter(items, {'first.name':'misko', 'last.name':''})).toEqual([items[0]]);
});
it('should support deep predicate objects', function() {
var items = [{person: {name: 'John'}},
{person: {name: 'Rita'}},
{person: {name: 'Billy'}},
{person: {name: 'Joan'}}];
expect(filter(items, {person: {name: 'Jo'}}).length).toBe(2);
expect(filter(items, {person: {name: 'Jo'}})).toEqual([
{person: {name: 'John'}}, {person: {name: 'Joan'}}
]);
});
it('should support deep expression objects with multiple properties', function() {
var items = [{person: {name: 'Annet', email: 'annet@example.com'}},
{person: {name: 'Billy', email: 'me@billy.com'}},
{person: {name: 'Joan', email: 'joan@example.net'}},
{person: {name: 'John', email: 'john@example.com'}},
{person: {name: 'Rita', email: 'rita@example.com'}}];
var expr = {person: {name: 'Jo', email: '!example.com'}};
expect(filter(items, expr).length).toBe(1);
expect(filter(items, expr)).toEqual([items[2]]);
});
it('should match any properties for given "$" property', function() {
var items = [{first: 'tom', last: 'hevery'},
{first: 'adam', last: 'hevery', alias: 'tom', done: false},
{first: 'john', last: 'clark', middle: 'tommy'}];
expect(filter(items, {$: 'tom'}).length).toBe(3);
expect(filter(items, {$: 'a'}).length).toBe(2);
expect(filter(items, {$: false}).length).toBe(1);
expect(filter(items, {$: 10}).length).toBe(0);
expect(filter(items, {$: 'hevery'})[0]).toEqual(items[0]);
});
it('should match any properties in the nested object for given deep "$" property', function() {
var items = [{person: {name: 'Annet', email: 'annet@example.com'}},
{person: {name: 'Billy', email: 'me@billy.com'}},
{person: {name: 'Joan', email: 'joan@example.net'}},
{person: {name: 'John', email: 'john@example.com'}},
{person: {name: 'Rita', email: 'rita@example.com'}}];
var expr = {person: {$: 'net'}};
expect(filter(items, expr).length).toBe(2);
expect(filter(items, expr)).toEqual([items[0], items[2]]);
});
it('should match named properties only against named properties on the same level', function() {
var expr = {person: {name: 'John'}};
var items = [{person: 'John'}, // No match (1 level higher)
{person: {name: 'John'}}, // Match (same level)
{person: {name: {first: 'John', last: 'Doe'}}}]; // No match (1 level deeper)
expect(filter(items, expr).length).toBe(1);
expect(filter(items, expr)).toEqual([items[1]]);
});
it('should match any properties on same or deeper level for given "$" property', function() {
var items = [{level1: 'test', foo1: 'bar1'},
{level1: {level2: 'test', foo2:'bar2'}, foo1: 'bar1'},
{level1: {level2: {level3: 'test', foo3: 'bar3'}, foo2: 'bar2'}, foo1: 'bar1'}];
expect(filter(items, {$: 'ES'}).length).toBe(3);
expect(filter(items, {$: 'ES'})).toEqual([items[0], items[1], items[2]]);
expect(filter(items, {level1: {$: 'ES'}}).length).toBe(2);
expect(filter(items, {level1: {$: 'ES'}})).toEqual([items[1], items[2]]);
expect(filter(items, {level1: {level2: {$: 'ES'}}}).length).toBe(1);
expect(filter(items, {level1: {level2: {$: 'ES'}}})).toEqual([items[2]]);
});
it('should respect the nesting level of "$"', function() {
var items = [{supervisor: 'me', person: {name: 'Annet', email: 'annet@example.com'}},
{supervisor: 'me', person: {name: 'Billy', email: 'me@billy.com'}},
{supervisor: 'me', person: {name: 'Joan', email: 'joan@example.net'}},
{supervisor: 'me', person: {name: 'John', email: 'john@example.com'}},
{supervisor: 'me', person: {name: 'Rita', email: 'rita@example.com'}}];
var expr = {$: {$: 'me'}};
expect(filter(items, expr).length).toBe(1);
expect(filter(items, expr)).toEqual([items[1]]);
});
it('should support boolean properties', function() {
var items = [{name: 'tom', current: true},
{name: 'demi', current: false},
{name: 'sofia'}];
expect(filter(items, {current:true}).length).toBe(1);
expect(filter(items, {current:true})[0].name).toBe('tom');
expect(filter(items, {current:false}).length).toBe(1);
expect(filter(items, {current:false})[0].name).toBe('demi');
});
it('should support negation operator', function() {
var items = ['misko', 'adam'];
expect(filter(items, '!isk').length).toBe(1);
expect(filter(items, '!isk')[0]).toEqual(items[1]);
});
it('should ignore function properties in items', function() {
// Own function properties
var items = [
{text: 'hello', func: noop},
{text: 'goodbye'},
{text: 'kittens'},
{text: 'puppies'}
];
var expr = {text: 'hello'};
expect(filter(items, expr).length).toBe(1);
expect(filter(items, expr)[0]).toBe(items[0]);
expect(filter(items, expr, true).length).toBe(1);
expect(filter(items, expr, true)[0]).toBe(items[0]);
// Inherited function properties
function Item(text) {
this.text = text;
}
Item.prototype.func = noop;
items = [
new Item('hello'),
new Item('goodbye'),
new Item('kittens'),
new Item('puppies')
];
expect(filter(items, expr).length).toBe(1);
expect(filter(items, expr)[0]).toBe(items[0]);
expect(filter(items, expr, true).length).toBe(1);
expect(filter(items, expr, true)[0]).toBe(items[0]);
});
it('should ignore function properties in expression', function() {
// Own function properties
var items = [
{text: 'hello'},
{text: 'goodbye'},
{text: 'kittens'},
{text: 'puppies'}
];
var expr = {text: 'hello', func: noop};
expect(filter(items, expr).length).toBe(1);
expect(filter(items, expr)[0]).toBe(items[0]);
expect(filter(items, expr, true).length).toBe(1);
expect(filter(items, expr, true)[0]).toBe(items[0]);
// Inherited function properties
function Expr(text) {
this.text = text;
}
Expr.prototype.func = noop;
expr = new Expr('hello');
expect(filter(items, expr).length).toBe(1);
expect(filter(items, expr)[0]).toBe(items[0]);
expect(filter(items, expr, true).length).toBe(1);
expect(filter(items, expr, true)[0]).toBe(items[0]);
});
it('should consider inherited properties in items', function() {
function Item(text) {
this.text = text;
}
Item.prototype.doubleL = 'maybe';
var items = [
new Item('hello'),
new Item('goodbye'),
new Item('kittens'),
new Item('puppies')
];
var expr = {text: 'hello', doubleL: 'perhaps'};
expect(filter(items, expr).length).toBe(0);
expect(filter(items, expr, true).length).toBe(0);
expr = {text: 'hello', doubleL: 'maybe'};
expect(filter(items, expr).length).toBe(1);
expect(filter(items, expr)[0]).toBe(items[0]);
expect(filter(items, expr, true).length).toBe(1);
expect(filter(items, expr, true)[0]).toBe(items[0]);
});
it('should consider inherited properties in expression', function() {
function Expr(text) {
this.text = text;
}
Expr.prototype.doubleL = true;
var items = [
{text: 'hello', doubleL: true},
{text: 'goodbye'},
{text: 'kittens'},
{text: 'puppies'}
];
var expr = new Expr('e');
expect(filter(items, expr).length).toBe(1);
expect(filter(items, expr)[0]).toBe(items[0]);
expr = new Expr('hello');
expect(filter(items, expr, true).length).toBe(1);
expect(filter(items, expr)[0]).toBe(items[0]);
});
it('should not be affected by `Object.prototype` when using a string expression', function() {
Object.prototype.someProp = 'oo';
var items = [
createMap(),
createMap(),
createMap(),
createMap()
];
items[0].someProp = 'hello';
items[1].someProp = 'goodbye';
items[2].someProp = 'kittens';
items[3].someProp = 'puppies';
// Affected by `Object.prototype`
expect(filter(items, {}).length).toBe(1);
expect(filter(items, {})[0]).toBe(items[1]);
expect(filter(items, {$: 'll'}).length).toBe(0);
// Not affected by `Object.prototype`
expect(filter(items, 'll').length).toBe(1);
expect(filter(items, 'll')[0]).toBe(items[0]);
delete Object.prototype.someProp;
});
it('should throw an error when is not used with an array', function() {
var item = {'not': 'array'};
expect(function() { filter(item, {}); }).
toThrowMinErr('filter', 'notarray', 'Expected array but received: {"not":"array"}');
item = Object.create(null);
expect(function() { filter(item, {}); }).
toThrowMinErr('filter', 'notarray', 'Expected array but received: {}');
item = {
toString: null,
valueOf: null
};
expect(function() { filter(item, {}); }).
toThrowMinErr('filter', 'notarray', 'Expected array but received: {"toString":null,"valueOf":null}');
});
it('should not throw an error if used with an array like object', function() {
function getArguments() {
return arguments;
}
var argsObj = getArguments({name: 'Misko'}, {name: 'Igor'}, {name: 'Brad'});
var nodeList = jqLite("<p><span>Misko</span><span>Igor</span><span>Brad</span></p>")[0].childNodes;
function nodeFilterPredicate(node) {
return node.innerHTML.indexOf("I") !== -1;
}
expect(filter(argsObj, 'i').length).toBe(2);
expect(filter('abc','b').length).toBe(1);
expect(filter(nodeList, nodeFilterPredicate).length).toBe(1);
});
it('should return undefined when the array is undefined', function() {
expect(filter(undefined, {})).toBeUndefined();
});
it('should return null when the value of the array is null', function() {
var item = null;
expect(filter(item, {})).toBe(null);
});
it('should not throw an error if property is null when comparing object', function() {
var items = [
{ office:1, people: {name:'john'}},
{ office:2, people: {name:'jane'}},
{ office:3, people: null}
];
var f = { };
expect(filter(items, f).length).toBe(3);
f = { people:null };
expect(filter(items, f).length).toBe(1);
f = { people: {}};
expect(filter(items, f).length).toBe(2);
f = { people:{ name: '' }};
expect(filter(items, f).length).toBe(2);
f = { people:{ name:'john' }};
expect(filter(items, f).length).toBe(1);
f = { people:{ name:'j' }};
expect(filter(items, f).length).toBe(2);
});
it('should match `null` against `null` only', function() {
var items = [
{value: null},
{value: undefined},
{value: true},
{value: false},
{value: NaN},
{value: 42},
{value: 'null'},
{value: 'test'},
{value: {}},
{value: new Date()}
];
var flt;
flt = null;
expect(filter(items, flt).length).toBe(1);
expect(filter(items, flt)[0]).toBe(items[0]);
flt = {value: null};
expect(filter(items, flt).length).toBe(1);
expect(filter(items, flt)[0]).toBe(items[0]);
flt = {value: undefined};
expect(filter(items, flt).length).toBe(items.length);
flt = {value: NaN};
expect(includes(filter(items, flt), items[0])).toBeFalsy();
flt = {value: false};
expect(includes(filter(items, flt), items[0])).toBeFalsy();
flt = '';
expect(includes(filter(items, flt), items[0])).toBeFalsy();
flt = {value: 'null'};
expect(includes(filter(items, flt), items[0])).toBeFalsy();
});
describe('should support comparator', function() {
it('not convert `null` or `undefined` to string in non-strict comparison', function() {
var items = [
{value: null},
{value: undefined}
];
var flt = {value: 'u'};
expect(filter(items, flt).length).toBe(0);
});
it('not consider objects without a custom `toString` in non-strict comparison', function() {
var items = [{test: {}}];
var expr = '[object';
expect(filter(items, expr).length).toBe(0);
});
it('should consider objects with custom `toString()` in non-strict comparison', function() {
var obj = new Date(1970, 1);
var items = [{test: obj}];
expect(filter(items, '1970').length).toBe(1);
expect(filter(items, 1970).length).toBe(1);
obj = {
toString: function() { return 'custom'; }
};
items = [{test: obj}];
expect(filter(items, 'custom').length).toBe(1);
});
it('should cope with objects that have no `toString()` in non-strict comparison', function() {
var obj = Object.create(null);
var items = [{test: obj}];
expect(function() {
filter(items, 'foo');
}).not.toThrow();
expect(filter(items, 'foo').length).toBe(0);
});
it('should cope with objects where `toString` is not a function in non-strict comparison', function() {
var obj = {
toString: 'moo'
};
var items = [{test: obj}];
expect(function() {
filter(items, 'foo');
}).not.toThrow();
expect(filter(items, 'foo').length).toBe(0);
});
it('as equality when true', function() {
var items = ['misko', 'adam', 'adamson'];
var expr = 'adam';
expect(filter(items, expr, true)).toEqual([items[1]]);
expect(filter(items, expr, false)).toEqual([items[1], items[2]]);
items = [
{key: 'value1', nonkey: 1},
{key: 'value2', nonkey: 2},
{key: 'value12', nonkey: 3},
{key: 'value1', nonkey: 4},
{key: 'Value1', nonkey: 5}
];
expr = {key: 'value1'};
expect(filter(items, expr, true)).toEqual([items[0], items[3]]);
items = [
{key: 1, nonkey: 1},
{key: 2, nonkey: 2},
{key: 12, nonkey: 3},
{key: 1, nonkey: 4}
];
expr = {key: 1};
expect(filter(items, expr, true)).toEqual([items[0], items[3]]);
expr = 12;
expect(filter(items, expr, true)).toEqual([items[2]]);
});
it('and use the function given to compare values', function() {
var items = [
{key: 1, nonkey: 1},
{key: 2, nonkey: 2},
{key: 12, nonkey: 3},
{key: 1, nonkey: 14}
];
var expr = {key: 10};
var comparator = function(obj, value) {
return obj > value;
};
expect(filter(items, expr, comparator)).toEqual([items[2]]);
expr = 10;
expect(filter(items, expr, comparator)).toEqual([items[2], items[3]]);
});
it('and use it correctly with deep expression objects', function() {
var items = [
{id: 0, details: {email: 'admin@example.com', role: 'admin'}},
{id: 1, details: {email: 'user1@example.com', role: 'user'}},
{id: 2, details: {email: 'user2@example.com', role: 'user'}}
];
var expr, comp;
expr = {details: {email: 'user@example.com', role: 'adm'}};
expect(filter(items, expr)).toEqual([]);
expr = {details: {email: 'admin@example.com', role: 'adm'}};
expect(filter(items, expr)).toEqual([items[0]]);
expr = {details: {email: 'admin@example.com', role: 'adm'}};
expect(filter(items, expr, true)).toEqual([]);
expr = {details: {email: 'admin@example.com', role: 'admin'}};
expect(filter(items, expr, true)).toEqual([items[0]]);
expr = {details: {email: 'user', role: 'us'}};
expect(filter(items, expr)).toEqual([items[1], items[2]]);
expr = {id: 0, details: {email: 'user', role: 'us'}};
expect(filter(items, expr)).toEqual([]);
expr = {id: 1, details: {email: 'user', role: 'us'}};
expect(filter(items, expr)).toEqual([items[1]]);
comp = function(actual, expected) {
return isString(actual) && isString(expected) && (actual.indexOf(expected) === 0);
};
expr = {details: {email: 'admin@example.com', role: 'min'}};
expect(filter(items, expr, comp)).toEqual([]);
expr = {details: {email: 'admin@example.com', role: 'adm'}};
expect(filter(items, expr, comp)).toEqual([items[0]]);
});
});
});
|
import React from 'react'
import { Link } from 'react-router-dom';
// import LikeToggle from './LikeToggle'
const Posts = (props) => {
return (
<div className='body'>
{props.posts.map(post => //interating over all posts
<li key={post.id} className='post' id='all-post'>
<Link className='link' to={`/posts/${post.id}`}>
<img className='post-image' src={post.image} alt=''/>
<br/>
{post.title}
</Link>
{/* <LikeToggle/> */}
</li>
//created link for each post using interpolation
)}
</div>
)
}
export default Posts
|
import { Store } from "amaple";
import childIndex from "childIndex.mod.html";
class ChildIndexStore extends Store {
constructor () {
this.state = {
childText: "child text a"
};
this.auth({
childText: [childIndex]
});
}
}
export default new ChildIndexStore();
|
/******************************************************************************
*
* Copyright (c) 2020, the ipyregulartable authors.
*
* This file is part of the ipyregulartable library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
const path = require('path');
const version = require('./package.json').version;
// Custom webpack rules
const rules = [
{ test: /\.ts$/, loader: 'ts-loader' },
{ test: /\.js$/, loader: 'source-map-loader' },
{ test: /\.css$/, use: ['style-loader', 'css-loader']}
];
// Packages that shouldn't be bundled but loaded at runtime
const externals = ['@jupyter-widgets/base'];
const resolve = {
// Add '.ts' and '.tsx' as resolvable extensions.
extensions: [".webpack.js", ".web.js", ".ts", ".js"]
};
module.exports = [
/**
* Notebook extension
*
* This bundle only contains the part of the JavaScript that is run on load of
* the notebook.
*/
{
entry: './src/extension.ts',
output: {
filename: 'index.js',
path: path.resolve(__dirname, '..', 'ipyregulartable', 'nbextension', 'static'),
libraryTarget: 'amd'
},
module: {
rules: rules
},
devtool: 'source-map',
externals,
resolve,
},
{
// Bundle for the notebook containing the custom widget views and models
//
// This bundle contains the implementation for the custom widget views and
// custom widget.
// It must be an amd module
//
entry: './lib/index.js',
devtool: 'source-map',
resolve: resolve,
output: {
filename: 'index.js',
path: path.resolve(__dirname, '..', 'ipyregulartable', 'nbextension', 'static'),
libraryTarget: 'amd'
},
module: {
rules: rules
},
externals: ['@jupyter-widgets/base']
},
/**
* Embeddable ipyregulartable bundle
*
* This bundle is almost identical to the notebook extension bundle. The only
* difference is in the configuration of the webpack public path for the
* static assets.
*
* The target bundle is always `dist/index.js`, which is the path required by
* the custom widget embedder.
*/
{
entry: './src/index.ts',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'amd',
library: "ipyregulartable",
publicPath: 'https://unpkg.com/ipyregulartable@' + version + '/dist/'
},
devtool: 'source-map',
module: {
rules: rules
},
externals,
resolve,
},
/**
* Documentation widget bundle
*
* This bundle is used to embed widgets in the package documentation.
*/
{
entry: './src/index.ts',
output: {
filename: 'embed-bundle.js',
path: path.resolve(__dirname, '..', 'docs', 'source', '_static'),
library: "ipyregulartable",
libraryTarget: 'amd'
},
module: {
rules: rules
},
devtool: 'source-map',
externals,
resolve,
}
];
|
"use strict";
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.latestSpecVersion = exports.latestSdkVersion = void 0;
var got_1 = __importDefault(require("got"));
var semver_1 = __importDefault(require("semver"));
function latestSdkVersion() {
return __awaiter(this, void 0, void 0, function () {
var packageJson, v, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 2, , 3]);
return [4 /*yield*/, got_1.default('https://raw.githubusercontent.com/microsoft/health-cards-validation-SDK/main/package.json').json()];
case 1:
packageJson = _b.sent();
if (!packageJson || !packageJson.version)
return [2 /*return*/];
v = semver_1.default.valid(packageJson.version);
return [2 /*return*/, v ? v : undefined];
case 2:
_a = _b.sent();
return [2 /*return*/];
case 3: return [2 /*return*/];
}
});
});
}
exports.latestSdkVersion = latestSdkVersion;
function latestSpecVersion() {
return __awaiter(this, void 0, void 0, function () {
var SPEC_PREFIX_LENGHT, VERSION_LENGTH, body, v, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
_b.trys.push([0, 3, , 4]);
SPEC_PREFIX_LENGHT = '# Changelog\n\n## '.length;
VERSION_LENGTH = 'v.v.v'.length;
return [4 /*yield*/, got_1.default('https://raw.githubusercontent.com/smart-on-fhir/health-cards/main/docs/changelog.md')];
case 1: return [4 /*yield*/, (_b.sent()).body];
case 2:
body = _b.sent();
if (!body)
return [2 /*return*/];
v = semver_1.default.valid(body.substring(SPEC_PREFIX_LENGHT, SPEC_PREFIX_LENGHT + VERSION_LENGTH));
return [2 /*return*/, v ? v : undefined];
case 3:
_a = _b.sent();
return [2 /*return*/];
case 4: return [2 /*return*/];
}
});
});
}
exports.latestSpecVersion = latestSpecVersion;
//# sourceMappingURL=check-for-update.js.map
|
(function ($) {
"use strict";
// Initiate the wowjs
new WOW().init();
// Back to top button
$(window).scroll(function () {
if ($(this).scrollTop() > 200) {
$('.back-to-top').fadeIn('slow');
} else {
$('.back-to-top').fadeOut('slow');
}
});
$('.back-to-top').click(function () {
$('html, body').animate({scrollTop: 0}, 1500, 'easeInOutExpo');
return false;
});
// Sticky Navbar
$(window).scroll(function () {
if ($(this).scrollTop() > 90) {
$('.nav-bar').addClass('nav-sticky');
$('.carousel, .page-header').css("margin-top", "73px");
} else {
$('.nav-bar').removeClass('nav-sticky');
$('.carousel, .page-header').css("margin-top", "0");
}
});
// Dropdown on mouse hover
$(document).ready(function () {
function toggleNavbarMethod() {
if ($(window).width() > 992) {
$('.navbar .dropdown').on('mouseover', function () {
$('.dropdown-toggle', this).trigger('click');
}).on('mouseout', function () {
$('.dropdown-toggle', this).trigger('click').blur();
});
} else {
$('.navbar .dropdown').off('mouseover').off('mouseout');
}
}
toggleNavbarMethod();
$(window).resize(toggleNavbarMethod);
});
// jQuery counterUp
$('[data-toggle="counter-up"]').counterUp({
delay: 10,
time: 2000
});
// Testimonial Slider
$('.testimonial-slider').slick({
infinite: true,
autoplay: true,
arrows: false,
dots: false,
slidesToShow: 1,
slidesToScroll: 1,
asNavFor: '.testimonial-slider-nav'
});
$('.testimonial-slider-nav').slick({
arrows: false,
dots: false,
focusOnSelect: true,
centerMode: true,
centerPadding: '22px',
slidesToShow: 3,
asNavFor: '.testimonial-slider'
});
$('.testimonial .slider-nav').css({"position": "relative", "height": "160px"});
// Blogs carousel
$(".related-slider").owlCarousel({
autoplay: true,
dots: false,
loop: true,
nav : true,
navText : [
'<i class="fa fa-angle-left" aria-hidden="true"></i>',
'<i class="fa fa-angle-right" aria-hidden="true"></i>'
],
responsive: {
0:{
items:1
},
576:{
items:1
},
768:{
items:2
}
}
});
var modal = document.getElementById("myModal");
// Get the button that opens the modal
var btn = document.getElementById("btn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
// Portfolio isotope and filter
var portfolioIsotope = $('.portfolio-container').isotope({
itemSelector: '.portfolio-item',
layoutMode: 'fitRows'
});
$('#portfolio-flters li').on('click', function () {
$("#portfolio-flters li").removeClass('filter-active');
$(this).addClass('filter-active');
portfolioIsotope.isotope({filter: $(this).data('filter')});
});
})(jQuery);
|
/* ***************************************************************************
* EZ.JWAF/EZ.JCWAP: Easy series Production.
* Including JWAF(Java-based Web Application Framework)
* and JCWAP(Java-based Customized Web Application Platform).
* Copyright (C) 2016-2017 the original author or authors.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of MIT License as published by
* the Free Software Foundation;
*
* This library 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 MIT License for more details.
*
* You should have received a copy of the MIT License along
* with this library; if not, write to the Free Software Foundation.
* ***************************************************************************/
/**
* Description: 上传图片控制器.<br>
* Created by Jimmybly Lee on 2017/7/5.
* @author Jimmybly Lee
*/
angular.module("WebApp").controller("UploadPhotoCtrl", ["$rootScope", "$scope", "$http", "$ajaxCall", function ($rootScope, $scope, $http, $ajaxCall) {
$scope.preview = function() {
$ajaxCall.post({
data: {
controller: "Base64Controller",
method: "formatBase64Img",
x: $scope.c.x,
y: $scope.c.y,
width: $scope.c.w,
height: $scope.c.h,
data: $scope.sourceImage
},
success: function(res) {
$scope.previewImage = res.result;
}
})
};
$scope.init = function() {
$scope.c = {x:0, y:0, w:299, h:300};
$scope.sourceImage = $rootScope.cfg["defaultPhoto"];
$scope.previewImage = $scope.sourceImage;
if (!$scope.latestJcrop) {
var onJcropChange = function(c) {
$scope.c = c;
};
$("#sourceImageDom").Jcrop({
aspectRatio: 400/400,
onChange: onJcropChange,
onSelect: onJcropChange,
drawBorders: true,
boxHeight: 300,
onRelease: function(){$scope.c = undefined}
}, function(){
$scope.latestJcrop = this;
$scope.latestJcrop.setImage("data:image/png;base64,"+$scope.sourceImage);
});
} else {
$scope.latestJcrop.setImage("data:image/png;base64,"+$scope.sourceImage);
}
};
$scope.init();
$scope.upload = function() {
var files = $scope["outSelector"] ? $("input[type='file'][name='photo']", $($scope["outSelector"])) : $("input[type='file'][name='photo']");
if (files.length !== 1 || files[0].files.length !== 1) {
alert("无法找到唯一的文件!");
return;
}
console.log("filesize", []);
if (files[0].files[0].size/(1024*1024) > 2) {
alert("选择图片大小不能大于2兆(M)。");
return;
}
var fd = new FormData();
fd.append("photo", files[0].files[0]);
$http({
method: "POST",
url: "mvc/dispatch?controller=Base64Controller&method=convertImg2Base64",
data: fd,
headers: {
'Content-Type' : undefined
},
transformRequest : angular.identity
}).success(function(success) {
$scope.sourceImage = success.result;
$scope.latestJcrop.setImage("data:image/png;base64,"+$scope.sourceImage);
});
};
$scope.submit = function() {
$scope.$emit("submit", $scope.previewImage);
}
}]);
|
import { buildSchema } from 'graphql'
import { ActivityTypeSchema } from './ActivityType'
import { ContactSchema } from './Contact'
import { UserSchema } from './User'
import { AuthSchema } from './Auth'
import { NoteSchema } from './Note'
import { OpportunitySchema } from './Opportunity'
import { ActivitySchema } from './Activity'
export const typeDefs = buildSchema(`
scalar Date
type Query {
_empty: String
}
type Mutation {
_empty: String
}
${ActivityTypeSchema}
${ContactSchema}
${UserSchema}
${AuthSchema}
${NoteSchema}
${OpportunitySchema}
${ActivitySchema}
`)
|
const crypto = require('crypto')
const base64 = require('./base64')
const { create: createKSUID } = require('./ksuid')
const funcs = {
/**
* Generate a random shared secret.
*
* @param {number} size - The size of the shared secret.
* @returns {Promise<Buffer>} The shared secret.
*/
generateSharedSecret: async (size = 32) => {
return new Promise((resolve, reject) => {
let masterKey
let iv
crypto.randomBytes(size, (err, buf) => {
if (err) {
return reject(err)
}
masterKey = buf
crypto.randomBytes(16, (err, buf) => {
if (err) {
return reject(new Error(`Could not generate an IV: ${err}.`))
}
iv = buf
crypto.scrypt(masterKey, iv, size, (err, secret) => {
if (err) {
return reject(new Error(`Could not generate a secret: ${err}.`))
}
return resolve(secret)
})
})
})
})
},
/**
* Convert a shared secret to a JSON Web Key.
*
* @param {Buffer|string} secret - The shared secret to package in a JWK.
* @param {string} [keyId - The key identifier to assign.
* @returns {Promise<Object>} The JSON Web Key.
*/
convertSharedSecretToJwk: async (secret, keyId = undefined) => {
return new Promise(async resolve => {
const sharedSecret = Buffer.isBuffer(secret) ? secret : Buffer.from(secret)
const kid = keyId !== undefined ? keyId : await createKSUID()
const encoded = await base64.urlEncode(sharedSecret)
const jsonWebKey = {
k: encoded,
kty: 'oct',
kid: kid
}
return resolve(jsonWebKey)
})
},
/**
* Generate a shared secret and return it as a JSON Web Key.
*
* @param {number} size - The size of the key.
* @returns {Promise<Object>} The shared secret.
*/
generateSharedSecretAsJwk: async (size = 32) => {
return new Promise(async (resolve, reject) => {
try {
const sharedSecret = await funcs.generateSharedSecret(size)
const jwk = await funcs.convertSharedSecretToJwk(sharedSecret)
return resolve(jwk)
} catch (e) {
return reject(new Error(`Unable to generate shared secret: ${e}.`))
}
})
}
}
module.exports = funcs
|
import config from './../config.js';
import Base_tools_class from './../core/base-tools.js';
import Base_layers_class from './../core/base-layers.js';
class Pencil_class extends Base_tools_class {
constructor(ctx) {
super();
this.Base_layers = new Base_layers_class();
this.name = 'pencil';
this.layer = {};
this.params_hash = false;
}
dragStart(event) {
var _this = this;
if (config.TOOL.name != _this.name)
return;
_this.mousedown(event);
}
dragMove(event) {
var _this = this;
if (config.TOOL.name != _this.name)
return;
_this.mousemove(event);
//mouse cursor
var mouse = _this.get_mouse_info(event);
var params = _this.getParams();
if (params.antialiasing == true)
_this.show_mouse_cursor(mouse.x, mouse.y, params.size || 1, 'circle');
}
dragEnd(event) {
var _this = this;
if (config.TOOL.name != _this.name)
return;
_this.mouseup(event);
}
load() {
var _this = this;
//mouse events
document.addEventListener('mousedown', function (event) {
_this.dragStart(event);
});
document.addEventListener('mousemove', function (event) {
_this.dragMove(event);
});
document.addEventListener('mouseup', function (event) {
_this.dragEnd(event);
});
// collect touch events
document.addEventListener('touchstart', function (event) {
_this.dragStart(event);
});
document.addEventListener('touchmove', function (event) {
_this.dragMove(event);
});
document.addEventListener('touchend', function (event) {
_this.dragEnd(event);
});
}
mousedown(e) {
var mouse = this.get_mouse_info(e);
if (mouse.valid == false || mouse.click_valid == false)
return;
window.State.save();
var params_hash = this.get_params_hash();
var params = this.getParams();
var opacity = 100;
if (params.antialiasing == false)
opacity = Math.round(config.ALPHA / 255 * 100);
if (config.layer.type != this.name || params_hash != this.params_hash) {
//register new object - current layer is not ours or params changed
this.layer = {
type: this.name,
data: [],
opacity: opacity,
params: this.clone(this.getParams()),
status: 'draft',
render_function: [this.name, 'render'],
width: null,
height: null,
rotate: null,
is_vector: true,
};
this.Base_layers.insert(this.layer);
this.params_hash = params_hash;
}
else {
//continue adding layer data, just register break
config.layer.data.push(null);
}
}
mousemove(e) {
var mouse = this.get_mouse_info(e);
var params = this.getParams();
if (mouse.is_drag == false)
return;
if (mouse.valid == false || mouse.click_valid == false) {
return;
}
//more data
if (params.antialiasing == false)
config.layer.data.push([Math.ceil(mouse.x), Math.ceil(mouse.y)]);
else
config.layer.data.push([mouse.x - config.layer.x, mouse.y - config.layer.y]);
this.Base_layers.render();
}
mouseup(e) {
var mouse = this.get_mouse_info(e);
var params = this.getParams();
if (mouse.valid == false || mouse.click_valid == false) {
config.layer.status = null;
return;
}
//more data
if (params.antialiasing == false)
config.layer.data.push([Math.ceil(mouse.x), Math.ceil(mouse.y)]);
else
config.layer.data.push([mouse.x - config.layer.x, mouse.y - config.layer.y]);
config.layer.status = null;
this.Base_layers.render();
}
on_params_update() {
var params = this.getParams();
var strict_element = document.querySelector('.block .item.size');
if (params.antialiasing == false) {
//hide strict controls
strict_element.style.display = 'none';
}
else {
//show strict controls
strict_element.style.display = 'inline_block';
}
}
render(ctx, layer) {
var params = layer.params;
if (params.antialiasing == true)
this.render_antialiased(ctx, layer);
else
this.render_aliased(ctx, layer);
}
/**
* draw with antialiasing, nice mode
*
* @param {ctx} ctx
* @param {object} layer
*/
render_antialiased(ctx, layer) {
if (layer.data.length == 0)
return;
var params = layer.params;
var data = layer.data;
var n = data.length;
var size = params.size || 1;
//set styles
ctx.fillStyle = layer.color;
ctx.strokeStyle = layer.color;
ctx.lineWidth = size;
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
ctx.translate(layer.x, layer.y);
//draw
ctx.beginPath();
ctx.moveTo(data[0][0], data[0][1]);
for (var i = 1; i < n; i++) {
if (data[i] === null) {
//break
ctx.beginPath();
}
else {
//line
if (data[i - 1] == null) {
//exception - point
ctx.arc(data[i][0], data[i][1], size / 2, 0, 2 * Math.PI, false);
ctx.fill();
}
else {
//lines
ctx.beginPath();
ctx.moveTo(data[i - 1][0], data[i - 1][1]);
ctx.lineTo(data[i][0], data[i][1]);
ctx.stroke();
}
}
}
if (n == 1 || data[1] == null) {
//point
ctx.beginPath();
ctx.arc(data[0][0], data[0][1], size / 2, 0, 2 * Math.PI, false);
ctx.fill();
}
ctx.translate(-layer.x, -layer.y);
}
/**
* draw without antialiasing, sharp, ugly mode.
*
* @param {ctx} ctx
* @param {object} layer
*/
render_aliased(ctx, layer) {
if (layer.data.length == 0)
return;
var params = layer.params;
var data = layer.data;
var n = data.length;
//set styles
ctx.fillStyle = layer.color;
ctx.strokeStyle = layer.color;
ctx.translate(layer.x, layer.y);
//draw
ctx.beginPath();
ctx.moveTo(data[0][0], data[0][1]);
for (var i = 1; i < n; i++) {
if (data[i] === null) {
//break
ctx.beginPath();
}
else {
//line
if (data[i - 1] == null) {
//exception - point
ctx.fillRect(data[i][0] - 1, data[i][1] - 1, 1, 1);
}
else {
//lines
ctx.beginPath();
this.draw_simple_line(ctx, data[i - 1][0], data[i - 1][1], data[i][0], data[i][1]);
}
}
}
if (n == 1 || data[1] == null) {
//point
ctx.beginPath();
ctx.fillRect(data[0][0] - 1, data[0][1] - 1, 1, 1);
}
ctx.translate(-layer.x, -layer.y);
}
/**
* draws line without aliasing
*
* @param {ctx} ctx
* @param {int} from_x
* @param {int} from_y
* @param {int} to_x
* @param {int} to_y
*/
draw_simple_line(ctx, from_x, from_y, to_x, to_y) {
var dist_x = from_x - to_x;
var dist_y = from_y - to_y;
var distance = Math.sqrt((dist_x * dist_x) + (dist_y * dist_y));
var radiance = Math.atan2(dist_y, dist_x);
for (var j = 0; j < distance; j++) {
var x_tmp = Math.round(to_x - 1 + Math.cos(radiance) * j);
var y_tmp = Math.round(to_y - 1 + Math.sin(radiance) * j);
ctx.fillRect(x_tmp, y_tmp, 1, 1);
}
}
};
export default Pencil_class;
|
if ($('#page-movie').length > 0) {
$("button#edit-btn").click(function() {
alert($(this).data("id"));
});
$("button#delete-btn").click(function() {
alert($(this).data("id"));
});
}
|
// COPYRIGHT © 201 Esri
//
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
//
// This material is licensed for use under the Esri Master License
// Agreement (MLA), and is bound by the terms of that agreement.
// You may redistribute and use this code without modification,
// provided you adhere to the terms of the MLA and include this
// copyright notice.
//
// See use restrictions at http://www.esri.com/legal/pdfs/mla_e204_e300/english
//
// For additional information, contact:
// Environmental Systems Research Institute, Inc.
// Attn: Contracts and Legal Services Department
// 380 New York Street
// Redlands, California, USA 92373
// USA
//
// email: contracts@esri.com
//
// See http://js.arcgis.com/3.34/esri/copyright.txt for details.
define({chooseInputLayer:"Zvolte vstupní vrstvu",addAVar:"Přidat proměnnou",distToNearest:"Vzdálenost k nejbližšímu",attrOfInterest:"Atribut nejbližšího",summaryNearby:"Shrnutí nejbližšího",summaryIntersecting:"Shrnutí průniku",distToNearestLabel:"Vzdálenost od středu buňky k nejbližšímu prvku ve vstupní vrstvě",attrOfInterestLabel:"Hodnota určeného pole od nejbližšího prvku ze vstupní vrstvy",summaryNearbyLabel:"Statistické údaje vypočtené ze všech prvků nalezených ve stanovené vzdálenosti od středu buňky",summaryIntersectingLabel:"Statistika vypočtená ze všech prvků, které protínají buňku",maxDistancefromCtr:"Maximální vzdálenost od středu buňky",fieldToIncude:"Pole, které má být zahrnuto",statstoCalculate:"Statistika, která se má vypočítat",summFeatuesWithin:"Souhrn prvků v rozmezí",layerChangeWarnMsg:"Přidané proměnné pro tuto vstupní vrstvu budou odstraněny, pokud se vstupní vrstva změní",validationErrorMsg:"Před přidáním nové proměnné opravte chyby v ověřování",atleastOneVarMsg:"Přidejte k této vybrané vrstvě alespoň jednu proměnnou"});
|
import styles from './styles.module.css'
import cn from 'classnames'
const Title = ({ title, className }) => {
return <h1 className={cn(styles.title, className)}>
{title}
</h1>
}
export default Title
|
const {
ipcRenderer
} = require('electron')
const fs = require('fs-extra');
const path = require('path')
const dayjs = require('dayjs')
const {dialog,app} = require('electron').remote;
const {
loading,
backup,
recover
} = require("../utils")
const CustomerInit = require("./page/customer")
const ExpressInit = require("./page/express")
const SupplierInit = require("./page/supplier")
const nedb = require('nedb');
// 实例化连接对象(不带参数默认为内存数据库)
const dbFile = path.join(app.getPath('userData'), '/db/local/order.db')
console.log(dbFile);
fs.ensureFileSync(dbFile)
let db = new nedb({
filename: dbFile,
autoload: true
});
window.addEventListener('DOMContentLoaded', () => {
console.log('start');
//初始化默认数据
db.find({
dataType: 'customer'
}).sort({
createTime: -1
}).exec((err, ret) => {
if(!err) localStorage.customer = JSON.stringify(ret)
})
db.find({
dataType: 'express'
}).sort({
createTime: -1
}).exec((err, ret) => {
if(!err) localStorage.express = JSON.stringify(ret)
})
db.find({
dataType: 'supplier'
}).sort({
createTime: -1
}).exec((err, ret) => {
if(!err) localStorage.supplier = JSON.stringify(ret)
})
//初始化订单表
require("./page/index").init(db)
//初始化服务器同步
require("./ftp").init(db)
//绑定备份按钮
$("#backupHandle").click(function () {
backup({dialog,app},err=>{
layer.closeAll()
if(err){
layer.alert(err)
}else{
layer.alert("备份成功")
}
})
})
//绑定恢复按钮
$("#recoverHandle").click(function () {
recover(null,{dialog,app},err=>{
layer.closeAll()
if(err){
layer.alert(err)
}else{
loading("请稍候..")
layer.closeAll()
layer.alert('恢复成功,应用将自动重启以生效',()=>{
ipcRenderer.send('relaunch')
})
}
})
})
//生成自動備份列表
const backupPath = path.join(app.getPath('userData'), '/db/backup')
let backupFiles = fs.readdirSync(backupPath).reverse()
backupFiles = backupFiles.filter(el=>/.+\.db$/.test(el))
$("#autoBackupTable tbody").html("")
if (backupFiles && backupFiles.length) {
let html = ""
backupFiles.forEach((el, i) => {
let name =dayjs(Number(el.match(/[0-9]+/g)[0])).format('YYYY-MM-DD HH:mm:ss')
html += `<tr>
<td><b>${name}</b></td>
<td>
<button data-index="${i}" data-file="${el}" data-time="${name}" type="button" class="btn btn-sm btn-outline-primary btn-table-inner btn-table-inner-recover">恢复</button>
</td>
</tr>`
})
$("#autoBackupTable tbody").html(html)
}
$(document).on('click','.btn-table-inner-recover',function () {
const coverFile = $(this).data('file')
const time = $(this).data('time')
layer.confirm(`确认要将数据恢复到 ${time} (建议恢复前先手动备份当前数据)`,(index)=>{
//先自动备份
require('./autoBackup').checkBackup(app)
//再恢复
recover([path.join(app.getPath('userData'), '/db/backup/' + coverFile)],{
app
},err=>{
layer.closeAll()
if(err){
layer.alert(err)
}else{
layer.alert('恢复成功,应用将自动重启以生效',()=>{
ipcRenderer.send('relaunch')
})
}
})
})
})
//主导航
$("#topNav a").on('click',function () {
const index = $(this).index()
const maintain = $("#maintain");
const orderContainer = $("#orderContainer");
$(this).addClass('active').siblings().removeClass('active')
switch (index) {
case 0:
orderContainer.show()
maintain.hide()
break;
case 1:
orderContainer.hide()
maintain.show()
break;
}
});
//侧边导航
$("#siderNav a").on('click', function () {
const index = $(this).index()
const titleBar = $("#tableTitle")
const tableContainer = $("#tableContainer")
const backupContainer = $("#backupContainer");
$(this).addClass('active').siblings().removeClass('active')
titleBar.find("button").hide()
backupContainer.hide()
tableContainer.hide()
switch (index) {
case 0:
backupContainer.show()
break;
case 1:
tableContainer.show()
CustomerInit(db)
break;
case 2:
tableContainer.show()
ExpressInit(db)
break;
case 3:
tableContainer.show()
SupplierInit(db)
break;
default:
break;
}
})
})
|
const Engine = Matter.Engine;
const World = Matter.World;
const Bodies = Matter.Bodies;
const Constraint = Matter.Constraint;
var engine, world;
var canvas;
var player, playerBase, playerArcher;
var baseimage;
function preload() {
backgroundImg = loadImage("./background.png");
baseimage = loadImage("./base.png");
playerimage = loadImage("./player.png");
}
function setup() {
canvas = createCanvas(windowWidth, windowHeight);
engine = Engine.create();
world = engine.world;
angleMode(DEGREES);
var options = {
isStatic:true
}
//create player base body
playerBase = Bodies.rectangle(200,350,180,150,options)
World.add(world,playerBase)
//create player body
player = Bodies.rectangle(250,playerBase.position.y-160,50,180,options)
World.add(world,player)
}
function draw() {
background(backgroundImg);
//show the player image using image() function
image(baseimage,playerBase.position.x,playerBase.position.y,180,150)
//show the playerbase image using image() function
image(playerimage,player.position.x,player.position.y,50,180)
Engine.update(engine);
// Title
fill("#FFFF");
textAlign("center");
textSize(40);
text("EPIC ARCHERY", width / 2, 100);
}
|
/*!
* jQuery Cycle Plugin (with Transition Definitions)
* Examples and documentation at: http://jquery.malsup.com/cycle/
* Copyright (c) 2007-2010 M. Alsup
* Version: 2.9995 (09-AUG-2011)
* Dual licensed under the MIT and GPL licenses.
* http://jquery.malsup.com/license.html
* Requires: jQuery v1.3.2 or later
*/
;(function($) {
var ver = '2.9995';
// if $.support is not defined (pre jQuery 1.3) add what I need
if ($.support == undefined) {
$.support = {
opacity: !($.browser.msie)
};
}
function debug(s) {
$.fn.cycle.debug && log(s);
}
function log() {
window.console && console.log && console.log('[cycle] ' + Array.prototype.join.call(arguments,' '));
}
$.expr[':'].paused = function(el) {
return el.cyclePause;
}
// the options arg can be...
// a number - indicates an immediate transition should occur to the given slide index
// a string - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc)
// an object - properties to control the slideshow
//
// the arg2 arg can be...
// the name of an fx (only used in conjunction with a numeric value for 'options')
// the value true (only used in first arg == 'resume') and indicates
// that the resume should occur immediately (not wait for next timeout)
$.fn.cycle = function(options, arg2) {
var o = { s: this.selector, c: this.context };
// in 1.3+ we can fix mistakes with the ready state
if (this.length === 0 && options != 'stop') {
if (!$.isReady && o.s) {
log('DOM not ready, queuing slideshow');
$(function() {
$(o.s,o.c).cycle(options,arg2);
});
return this;
}
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
return this;
}
// iterate the matched nodeset
return this.each(function() {
var opts = handleArguments(this, options, arg2);
if (opts === false)
return;
opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink;
// stop existing slideshow for this container (if there is one)
if (this.cycleTimeout)
clearTimeout(this.cycleTimeout);
this.cycleTimeout = this.cyclePause = 0;
var $cont = $(this);
var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
var els = $slides.get();
var opts2 = buildOptions($cont, $slides, els, opts, o);
if (opts2 === false)
return;
if (els.length < 2) {
log('terminating; too few slides: ' + els.length);
return;
}
var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards);
// if it's an auto slideshow, kick it off
if (startTime) {
startTime += (opts2.delay || 0);
if (startTime < 10)
startTime = 10;
debug('first timeout: ' + startTime);
this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards)}, startTime);
}
});
};
function triggerPause(cont, byHover, onPager) {
var opts = $(cont).data('cycle.opts');
var paused = !!cont.cyclePause;
if (paused && opts.paused)
opts.paused(cont, opts, byHover, onPager);
else if (!paused && opts.resumed)
opts.resumed(cont, opts, byHover, onPager);
}
// process the args that were passed to the plugin fn
function handleArguments(cont, options, arg2) {
if (cont.cycleStop == undefined)
cont.cycleStop = 0;
if (options === undefined || options === null)
options = {};
if (options.constructor == String) {
switch(options) {
case 'destroy':
case 'stop':
var opts = $(cont).data('cycle.opts');
if (!opts)
return false;
cont.cycleStop++; // callbacks look for change
if (cont.cycleTimeout)
clearTimeout(cont.cycleTimeout);
cont.cycleTimeout = 0;
opts.elements && $(opts.elements).stop();
$(cont).removeData('cycle.opts');
if (options == 'destroy')
destroy(opts);
return false;
case 'toggle':
cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
checkInstantResume(cont.cyclePause, arg2, cont);
triggerPause(cont);
return false;
case 'pause':
cont.cyclePause = 1;
triggerPause(cont);
return false;
case 'resume':
cont.cyclePause = 0;
checkInstantResume(false, arg2, cont);
triggerPause(cont);
return false;
case 'prev':
case 'next':
var opts = $(cont).data('cycle.opts');
if (!opts) {
log('options not found, "prev/next" ignored');
return false;
}
$.fn.cycle[options](opts);
return false;
default:
options = { fx: options };
};
return options;
}
else if (options.constructor == Number) {
// go to the requested slide
var num = options;
options = $(cont).data('cycle.opts');
if (!options) {
log('options not found, can not advance slide');
return false;
}
if (num < 0 || num >= options.elements.length) {
log('invalid slide index: ' + num);
return false;
}
options.nextSlide = num;
if (cont.cycleTimeout) {
clearTimeout(cont.cycleTimeout);
cont.cycleTimeout = 0;
}
if (typeof arg2 == 'string')
options.oneTimeFx = arg2;
go(options.elements, options, 1, num >= options.currSlide);
return false;
}
return options;
function checkInstantResume(isPaused, arg2, cont) {
if (!isPaused && arg2 === true) { // resume now!
var options = $(cont).data('cycle.opts');
if (!options) {
log('options not found, can not resume');
return false;
}
if (cont.cycleTimeout) {
clearTimeout(cont.cycleTimeout);
cont.cycleTimeout = 0;
}
go(options.elements, options, 1, !options.backwards);
}
}
};
function removeFilter(el, opts) {
if (!$.support.opacity && opts.cleartype && el.style.filter) {
try { el.style.removeAttribute('filter'); }
catch(smother) {} // handle old opera versions
}
};
// unbind event handlers
function destroy(opts) {
if (opts.next)
$(opts.next).unbind(opts.prevNextEvent);
if (opts.prev)
$(opts.prev).unbind(opts.prevNextEvent);
if (opts.pager || opts.pagerAnchorBuilder)
$.each(opts.pagerAnchors || [], function() {
this.unbind().remove();
});
opts.pagerAnchors = null;
if (opts.destroy) // callback
opts.destroy(opts);
};
// one-time initialization
function buildOptions($cont, $slides, els, options, o) {
// support metadata plugin (v1.0 and v2.0)
var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null;
if (meta)
opts = $.extend(opts, meta);
if (opts.autostop)
opts.countdown = opts.autostopCount || els.length;
var cont = $cont[0];
$cont.data('cycle.opts', opts);
opts.$cont = $cont;
opts.stopCount = cont.cycleStop;
opts.elements = els;
opts.before = opts.before ? [opts.before] : [];
opts.after = opts.after ? [opts.after] : [];
// push some after callbacks
if (!$.support.opacity && opts.cleartype)
opts.after.push(function() { removeFilter(this, opts); });
if (opts.continuous)
opts.after.push(function() { go(els,opts,0,!opts.backwards); });
saveOriginalOpts(opts);
// clearType corrections
if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
clearTypeFix($slides);
// container requires non-static position so that slides can be position within
if ($cont.css('position') == 'static')
$cont.css('position', 'relative');
if (opts.width)
$cont.width(opts.width);
if (opts.height && opts.height != 'auto')
$cont.height(opts.height);
if (opts.startingSlide)
opts.startingSlide = parseInt(opts.startingSlide,10);
else if (opts.backwards)
opts.startingSlide = els.length - 1;
// if random, mix up the slide array
if (opts.random) {
opts.randomMap = [];
for (var i = 0; i < els.length; i++)
opts.randomMap.push(i);
opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;});
opts.randomIndex = 1;
opts.startingSlide = opts.randomMap[1];
}
else if (opts.startingSlide >= els.length)
opts.startingSlide = 0; // catch bogus input
opts.currSlide = opts.startingSlide || 0;
var first = opts.startingSlide;
// set position and zIndex on all the slides
$slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) {
var z;
if (opts.backwards)
z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i;
else
z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
$(this).css('z-index', z)
});
// make sure first slide is visible
$(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case
removeFilter(els[first], opts);
// stretch slides
if (opts.fit) {
if (!opts.aspect) {
if (opts.width)
$slides.width(opts.width);
if (opts.height && opts.height != 'auto')
$slides.height(opts.height);
} else {
$slides.each(function(){
var $slide = $(this);
var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect;
if( opts.width && $slide.width() != opts.width ) {
$slide.width( opts.width );
$slide.height( opts.width / ratio );
}
if( opts.height && $slide.height() < opts.height ) {
$slide.height( opts.height );
$slide.width( opts.height * ratio );
}
});
}
}
if (opts.center && ((!opts.fit) || opts.aspect)) {
$slides.each(function(){
var $slide = $(this);
$slide.css({
"margin-left": opts.width ?
((opts.width - $slide.width()) / 2) + "px" :
0,
"margin-top": opts.height ?
((opts.height - $slide.height()) / 2) + "px" :
0
});
});
}
if (opts.center && !opts.fit && !opts.slideResize) {
$slides.each(function(){
var $slide = $(this);
$slide.css({
"margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0,
"margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0
});
});
}
// stretch container
var reshape = opts.containerResize && !$cont.innerHeight();
if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9
var maxw = 0, maxh = 0;
for(var j=0; j < els.length; j++) {
var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight();
if (!w) w = e.offsetWidth || e.width || $e.attr('width');
if (!h) h = e.offsetHeight || e.height || $e.attr('height');
maxw = w > maxw ? w : maxw;
maxh = h > maxh ? h : maxh;
}
if (maxw > 0 && maxh > 0)
$cont.css({width:maxw+'px',height:maxh+'px'});
}
var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
if (opts.pause)
$cont.hover(
function(){
pauseFlag = true;
this.cyclePause++;
triggerPause(cont, true);
},
function(){
pauseFlag && this.cyclePause--;
triggerPause(cont, true);
}
);
if (supportMultiTransitions(opts) === false)
return false;
// apparently a lot of people use image slideshows without height/width attributes on the images.
// Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that.
var requeue = false;
options.requeueAttempts = options.requeueAttempts || 0;
$slides.each(function() {
// try to get height/width of each slide
var $el = $(this);
this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0);
this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0);
if ( $el.is('img') ) {
// sigh.. sniffing, hacking, shrugging... this crappy hack tries to account for what browsers do when
// an image is being downloaded and the markup did not include sizing info (height/width attributes);
// there seems to be some "default" sizes used in this situation
var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
var loadingFF = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete);
var loadingOp = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete);
var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete);
// don't requeue for images that are still loading but have a valid size
if (loadingIE || loadingFF || loadingOp || loadingOther) {
if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever
log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH);
setTimeout(function() {$(o.s,o.c).cycle(options)}, opts.requeueTimeout);
requeue = true;
return false; // break each loop
}
else {
log('could not determine size of image: '+this.src, this.cycleW, this.cycleH);
}
}
}
return true;
});
if (requeue)
return false;
opts.cssBefore = opts.cssBefore || {};
opts.cssAfter = opts.cssAfter || {};
opts.cssFirst = opts.cssFirst || {};
opts.animIn = opts.animIn || {};
opts.animOut = opts.animOut || {};
$slides.not(':eq('+first+')').css(opts.cssBefore);
$($slides[first]).css(opts.cssFirst);
if (opts.timeout) {
opts.timeout = parseInt(opts.timeout,10);
// ensure that timeout and speed settings are sane
if (opts.speed.constructor == String)
opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10);
if (!opts.sync)
opts.speed = opts.speed / 2;
var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250;
while((opts.timeout - opts.speed) < buffer) // sanitize timeout
opts.timeout += opts.speed;
}
if (opts.easing)
opts.easeIn = opts.easeOut = opts.easing;
if (!opts.speedIn)
opts.speedIn = opts.speed;
if (!opts.speedOut)
opts.speedOut = opts.speed;
opts.slideCount = els.length;
opts.currSlide = opts.lastSlide = first;
if (opts.random) {
if (++opts.randomIndex == els.length)
opts.randomIndex = 0;
opts.nextSlide = opts.randomMap[opts.randomIndex];
}
else if (opts.backwards)
opts.nextSlide = opts.startingSlide == 0 ? (els.length-1) : opts.startingSlide-1;
else
opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;
// run transition init fn
if (!opts.multiFx) {
var init = $.fn.cycle.transitions[opts.fx];
if ($.isFunction(init))
init($cont, $slides, opts);
else if (opts.fx != 'custom' && !opts.multiFx) {
log('unknown transition: ' + opts.fx,'; slideshow terminating');
return false;
}
}
// fire artificial events
var e0 = $slides[first];
if (!opts.skipInitializationCallbacks) {
if (opts.before.length)
opts.before[0].apply(e0, [e0, e0, opts, true]);
if (opts.after.length)
opts.after[0].apply(e0, [e0, e0, opts, true]);
}
if (opts.next)
$(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1)});
if (opts.prev)
$(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0)});
if (opts.pager || opts.pagerAnchorBuilder)
buildPager(els,opts);
exposeAddSlide(opts, els);
return opts;
};
// save off original opts so we can restore after clearing state
function saveOriginalOpts(opts) {
opts.original = { before: [], after: [] };
opts.original.cssBefore = $.extend({}, opts.cssBefore);
opts.original.cssAfter = $.extend({}, opts.cssAfter);
opts.original.animIn = $.extend({}, opts.animIn);
opts.original.animOut = $.extend({}, opts.animOut);
$.each(opts.before, function() { opts.original.before.push(this); });
$.each(opts.after, function() { opts.original.after.push(this); });
};
function supportMultiTransitions(opts) {
var i, tx, txs = $.fn.cycle.transitions;
// look for multiple effects
if (opts.fx.indexOf(',') > 0) {
opts.multiFx = true;
opts.fxs = opts.fx.replace(/\s*/g,'').split(',');
// discard any bogus effect names
for (i=0; i < opts.fxs.length; i++) {
var fx = opts.fxs[i];
tx = txs[fx];
if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
log('discarding unknown transition: ',fx);
opts.fxs.splice(i,1);
i--;
}
}
// if we have an empty list then we threw everything away!
if (!opts.fxs.length) {
log('No valid transitions named; slideshow terminating.');
return false;
}
}
else if (opts.fx == 'all') { // auto-gen the list of transitions
opts.multiFx = true;
opts.fxs = [];
for (p in txs) {
tx = txs[p];
if (txs.hasOwnProperty(p) && $.isFunction(tx))
opts.fxs.push(p);
}
}
if (opts.multiFx && opts.randomizeEffects) {
// munge the fxs array to make effect selection random
var r1 = Math.floor(Math.random() * 20) + 30;
for (i = 0; i < r1; i++) {
var r2 = Math.floor(Math.random() * opts.fxs.length);
opts.fxs.push(opts.fxs.splice(r2,1)[0]);
}
debug('randomized fx sequence: ',opts.fxs);
}
return true;
};
// provide a mechanism for adding slides after the slideshow has started
function exposeAddSlide(opts, els) {
opts.addSlide = function(newSlide, prepend) {
var $s = $(newSlide), s = $s[0];
if (!opts.autostopCount)
opts.countdown++;
els[prepend?'unshift':'push'](s);
if (opts.els)
opts.els[prepend?'unshift':'push'](s); // shuffle needs this
opts.slideCount = els.length;
$s.css('position','absolute');
$s[prepend?'prependTo':'appendTo'](opts.$cont);
if (prepend) {
opts.currSlide++;
opts.nextSlide++;
}
if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg)
clearTypeFix($s);
if (opts.fit && opts.width)
$s.width(opts.width);
if (opts.fit && opts.height && opts.height != 'auto')
$s.height(opts.height);
s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();
$s.css(opts.cssBefore);
if (opts.pager || opts.pagerAnchorBuilder)
$.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts);
if ($.isFunction(opts.onAddSlide))
opts.onAddSlide($s);
else
$s.hide(); // default behavior
};
}
// reset internal state; we do this on every pass in order to support multiple effects
$.fn.cycle.resetState = function(opts, fx) {
fx = fx || opts.fx;
opts.before = []; opts.after = [];
opts.cssBefore = $.extend({}, opts.original.cssBefore);
opts.cssAfter = $.extend({}, opts.original.cssAfter);
opts.animIn = $.extend({}, opts.original.animIn);
opts.animOut = $.extend({}, opts.original.animOut);
opts.fxFn = null;
$.each(opts.original.before, function() { opts.before.push(this); });
$.each(opts.original.after, function() { opts.after.push(this); });
// re-init
var init = $.fn.cycle.transitions[fx];
if ($.isFunction(init))
init(opts.$cont, $(opts.elements), opts);
};
// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt
function go(els, opts, manual, fwd) {
// opts.busy is true if we're in the middle of an animation
if (manual && opts.busy && opts.manualTrump) {
// let manual transitions requests trump active ones
debug('manualTrump in go(), stopping active transition');
$(els).stop(true,true);
opts.busy = 0;
}
// don't begin another timeout-based transition if there is one active
if (opts.busy) {
debug('transition active, ignoring new tx request');
return;
}
var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide];
// stop cycling if we have an outstanding stop request
if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual)
return;
// check to see if we should stop cycling based on autostop options
if (!manual && !p.cyclePause && !opts.bounce &&
((opts.autostop && (--opts.countdown <= 0)) ||
(opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
if (opts.end)
opts.end(opts);
return;
}
// if slideshow is paused, only transition on a manual trigger
var changed = false;
if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) {
changed = true;
var fx = opts.fx;
// keep trying to get the slide size if we don't have it yet
curr.cycleH = curr.cycleH || $(curr).height();
curr.cycleW = curr.cycleW || $(curr).width();
next.cycleH = next.cycleH || $(next).height();
next.cycleW = next.cycleW || $(next).width();
// support multiple transition types
if (opts.multiFx) {
if (fwd && (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length))
opts.lastFx = 0;
else if (!fwd && (opts.lastFx == undefined || --opts.lastFx < 0))
opts.lastFx = opts.fxs.length - 1;
fx = opts.fxs[opts.lastFx];
}
// one-time fx overrides apply to: $('div').cycle(3,'zoom');
if (opts.oneTimeFx) {
fx = opts.oneTimeFx;
opts.oneTimeFx = null;
}
$.fn.cycle.resetState(opts, fx);
// run the before callbacks
if (opts.before.length)
$.each(opts.before, function(i,o) {
if (p.cycleStop != opts.stopCount) return;
o.apply(next, [curr, next, opts, fwd]);
});
// stage the after callacks
var after = function() {
opts.busy = 0;
$.each(opts.after, function(i,o) {
if (p.cycleStop != opts.stopCount) return;
o.apply(next, [curr, next, opts, fwd]);
});
};
debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide);
// get ready to perform the transition
opts.busy = 1;
if (opts.fxFn) // fx function provided?
opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ?
$.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent);
else
$.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent);
}
if (changed || opts.nextSlide == opts.currSlide) {
// calculate the next slide
opts.lastSlide = opts.currSlide;
if (opts.random) {
opts.currSlide = opts.nextSlide;
if (++opts.randomIndex == els.length)
opts.randomIndex = 0;
opts.nextSlide = opts.randomMap[opts.randomIndex];
if (opts.nextSlide == opts.currSlide)
opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1;
}
else if (opts.backwards) {
var roll = (opts.nextSlide - 1) < 0;
if (roll && opts.bounce) {
opts.backwards = !opts.backwards;
opts.nextSlide = 1;
opts.currSlide = 0;
}
else {
opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1;
opts.currSlide = roll ? 0 : opts.nextSlide+1;
}
}
else { // sequence
var roll = (opts.nextSlide + 1) == els.length;
if (roll && opts.bounce) {
opts.backwards = !opts.backwards;
opts.nextSlide = els.length-2;
opts.currSlide = els.length-1;
}
else {
opts.nextSlide = roll ? 0 : opts.nextSlide+1;
opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
}
}
}
if (changed && opts.pager)
opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass);
// stage the next transition
var ms = 0;
if (opts.timeout && !opts.continuous)
ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd);
else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic
ms = 10;
if (ms > 0)
p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards) }, ms);
};
// invoked after transition
$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) {
$(pager).each(function() {
$(this).children().removeClass(clsName).eq(currSlide).addClass(clsName);
});
};
// calculate timeout value for current transition
function getTimeout(curr, next, opts, fwd) {
if (opts.timeoutFn) {
// call user provided calc fn
var t = opts.timeoutFn.call(curr,curr,next,opts,fwd);
while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout
t += opts.speed;
debug('calculated timeout: ' + t + '; speed: ' + opts.speed);
if (t !== false)
return t;
}
return opts.timeout;
};
// expose next/prev function, caller must pass in state
$.fn.cycle.next = function(opts) { advance(opts,1); };
$.fn.cycle.prev = function(opts) { advance(opts,0);};
// advance slide forward or back
function advance(opts, moveForward) {
var val = moveForward ? 1 : -1;
var els = opts.elements;
var p = opts.$cont[0], timeout = p.cycleTimeout;
if (timeout) {
clearTimeout(timeout);
p.cycleTimeout = 0;
}
if (opts.random && val < 0) {
// move back to the previously display slide
opts.randomIndex--;
if (--opts.randomIndex == -2)
opts.randomIndex = els.length-2;
else if (opts.randomIndex == -1)
opts.randomIndex = els.length-1;
opts.nextSlide = opts.randomMap[opts.randomIndex];
}
else if (opts.random) {
opts.nextSlide = opts.randomMap[opts.randomIndex];
}
else {
opts.nextSlide = opts.currSlide + val;
if (opts.nextSlide < 0) {
if (opts.nowrap) return false;
opts.nextSlide = els.length - 1;
}
else if (opts.nextSlide >= els.length) {
if (opts.nowrap) return false;
opts.nextSlide = 0;
}
}
var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated
if ($.isFunction(cb))
cb(val > 0, opts.nextSlide, els[opts.nextSlide]);
go(els, opts, 1, moveForward);
return false;
};
function buildPager(els, opts) {
var $p = $(opts.pager);
$.each(els, function(i,o) {
$.fn.cycle.createPagerAnchor(i,o,$p,els,opts);
});
opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass);
};
$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) {
var a;
if ($.isFunction(opts.pagerAnchorBuilder)) {
a = opts.pagerAnchorBuilder(i,el);
debug('pagerAnchorBuilder('+i+', el) returned: ' + a);
}
else
a = '<a href="#">'+(i+1)+'</a>';
if (!a)
return;
var $a = $(a);
// don't reparent if anchor is in the dom
if ($a.parents('body').length === 0) {
var arr = [];
if ($p.length > 1) {
$p.each(function() {
var $clone = $a.clone(true);
$(this).append($clone);
arr.push($clone[0]);
});
$a = $(arr);
}
else {
$a.appendTo($p);
}
}
opts.pagerAnchors = opts.pagerAnchors || [];
opts.pagerAnchors.push($a);
var pagerFn = function(e) {
e.preventDefault();
opts.nextSlide = i;
var p = opts.$cont[0], timeout = p.cycleTimeout;
if (timeout) {
clearTimeout(timeout);
p.cycleTimeout = 0;
}
var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated
if ($.isFunction(cb))
cb(opts.nextSlide, els[opts.nextSlide]);
go(els,opts,1,opts.currSlide < i); // trigger the trans
// return false; // <== allow bubble
}
if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) {
$a.hover(pagerFn, function(){/* no-op */} );
}
else {
$a.bind(opts.pagerEvent, pagerFn);
}
if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble)
$a.bind('click.cycle', function(){return false;}); // suppress click
var cont = opts.$cont[0];
var pauseFlag = false; // https://github.com/malsup/cycle/issues/44
if (opts.pauseOnPagerHover) {
$a.hover(
function() {
pauseFlag = true;
cont.cyclePause++;
triggerPause(cont,true,true);
}, function() {
pauseFlag && cont.cyclePause--;
triggerPause(cont,true,true);
}
);
}
};
// helper fn to calculate the number of slides between the current and the next
$.fn.cycle.hopsFromLast = function(opts, fwd) {
var hops, l = opts.lastSlide, c = opts.currSlide;
if (fwd)
hops = c > l ? c - l : opts.slideCount - l;
else
hops = c < l ? l - c : l + opts.slideCount - c;
return hops;
};
// fix clearType problems in ie6 by setting an explicit bg color
// (otherwise text slides look horrible during a fade transition)
function clearTypeFix($slides) {
debug('applying clearType background-color hack');
function hex(s) {
s = parseInt(s,10).toString(16);
return s.length < 2 ? '0'+s : s;
};
function getBg(e) {
for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) {
var v = $.css(e,'background-color');
if (v && v.indexOf('rgb') >= 0 ) {
var rgb = v.match(/\d+/g);
return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
}
if (v && v != 'transparent')
return v;
}
return '#ffffff';
};
$slides.each(function() { $(this).css('background-color', getBg(this)); });
};
// reset common props before the next transition
$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) {
$(opts.elements).not(curr).hide();
if (typeof opts.cssBefore.opacity == 'undefined')
opts.cssBefore.opacity = 1;
opts.cssBefore.display = 'block';
if (opts.slideResize && w !== false && next.cycleW > 0)
opts.cssBefore.width = next.cycleW;
if (opts.slideResize && h !== false && next.cycleH > 0)
opts.cssBefore.height = next.cycleH;
opts.cssAfter = opts.cssAfter || {};
opts.cssAfter.display = 'none';
$(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0));
$(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1));
};
// the actual fn for effecting a transition
$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) {
var $l = $(curr), $n = $(next);
var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut;
$n.css(opts.cssBefore);
if (speedOverride) {
if (typeof speedOverride == 'number')
speedIn = speedOut = speedOverride;
else
speedIn = speedOut = 1;
easeIn = easeOut = null;
}
var fn = function() {
$n.animate(opts.animIn, speedIn, easeIn, function() {
cb();
});
};
$l.animate(opts.animOut, speedOut, easeOut, function() {
$l.css(opts.cssAfter);
if (!opts.sync)
fn();
});
if (opts.sync) fn();
};
// transition definitions - only fade is defined here, transition pack defines the rest
$.fn.cycle.transitions = {
fade: function($cont, $slides, opts) {
$slides.not(':eq('+opts.currSlide+')').css('opacity',0);
opts.before.push(function(curr,next,opts) {
$.fn.cycle.commonReset(curr,next,opts);
opts.cssBefore.opacity = 0;
});
opts.animIn = { opacity: 1 };
opts.animOut = { opacity: 0 };
opts.cssBefore = { top: 0, left: 0 };
}
};
$.fn.cycle.ver = function() { return ver; };
// override these globally if you like (they are all optional)
$.fn.cycle.defaults = {
activePagerClass: 'activeSlide', // class name used for the active pager link
after: null, // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling
animIn: null, // properties that define how the slide animates in
animOut: null, // properties that define how the slide animates out
aspect: false, // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option)
autostop: 0, // true to end slideshow after X transitions (where X == slide count)
autostopCount: 0, // number of transitions (optionally used with autostop to define X)
backwards: false, // true to start slideshow at last slide and move backwards through the stack
before: null, // transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag)
center: null, // set to true to have cycle add top/left margin to each slide (use with width and height options)
cleartype: !$.support.opacity, // true if clearType corrections should be applied (for IE)
cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides)
containerResize: 1, // resize container to fit largest slide
continuous: 0, // true to start next transition immediately after current one completes
cssAfter: null, // properties that defined the state of the slide after transitioning out
cssBefore: null, // properties that define the initial state of the slide before transitioning in
delay: 0, // additional delay (in ms) for first transition (hint: can be negative)
easeIn: null, // easing for "in" transition
easeOut: null, // easing for "out" transition
easing: null, // easing method for both in and out transitions
end: null, // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options)
fastOnEvent: 0, // force fast transitions when triggered manually (via pager or prev/next); value == time in ms
fit: 0, // force slides to fit container
fx: 'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle')
fxFn: null, // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag)
height: 'auto', // container height (if the 'fit' option is true, the slides will be set to this height as well)
manualTrump: true, // causes manual transition to stop an active transition instead of being ignored
metaAttr: 'cycle',// data- attribute that holds the option data for the slideshow
next: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide
nowrap: 0, // true to prevent slideshow from wrapping
onPagerEvent: null, // callback fn for pager events: function(zeroBasedSlideIndex, slideElement)
onPrevNextEvent: null,// callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement)
pager: null, // element, jQuery object, or jQuery selector string for the element to use as pager container
pagerAnchorBuilder: null, // callback fn for building anchor links: function(index, DOMelement)
pagerEvent: 'click.cycle', // name of event which drives the pager navigation
pause: 0, // true to enable "pause on hover"
pauseOnPagerHover: 0, // true to pause when hovering over pager link
prev: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide
prevNextEvent:'click.cycle',// event which drives the manual transition to the previous or next slide
random: 0, // true for random, false for sequence (not applicable to shuffle fx)
randomizeEffects: 1, // valid when multiple effects are used; true to make the effect sequence random
requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded
requeueTimeout: 250, // ms delay for requeue
rev: 0, // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle)
shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 }
skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition
slideExpr: null, // expression for selecting slides (if something other than all children is required)
slideResize: 1, // force slide width/height to fixed size before every transition
speed: 1000, // speed of the transition (any valid fx speed value)
speedIn: null, // speed of the 'in' transition
speedOut: null, // speed of the 'out' transition
startingSlide: 0, // zero-based index of the first slide to be displayed
sync: 1, // true if in/out transitions should occur simultaneously
timeout: 4000, // milliseconds between slide transitions (0 to disable auto advance)
timeoutFn: null, // callback for determining per-slide timeout value: function(currSlideElement, nextSlideElement, options, forwardFlag)
updateActivePagerLink: null, // callback fn invoked to update the active pager link (adds/removes activePagerClass style)
width: null // container width (if the 'fit' option is true, the slides will be set to this width as well)
};
})(jQuery);
/*!
* jQuery Cycle Plugin Transition Definitions
* This script is a plugin for the jQuery Cycle Plugin
* Examples and documentation at: http://malsup.com/jquery/cycle/
* Copyright (c) 2007-2010 M. Alsup
* Version: 2.73
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function($) {
//
// These functions define slide initialization and properties for the named
// transitions. To save file size feel free to remove any of these that you
// don't need.
//
$.fn.cycle.transitions.none = function($cont, $slides, opts) {
opts.fxFn = function(curr,next,opts,after){
$(next).show();
$(curr).hide();
after();
};
};
// not a cross-fade, fadeout only fades out the top slide
$.fn.cycle.transitions.fadeout = function($cont, $slides, opts) {
$slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 });
opts.before.push(function(curr,next,opts,w,h,rev) {
$(curr).css('zIndex',opts.slideCount + (!rev === true ? 1 : 0));
$(next).css('zIndex',opts.slideCount + (!rev === true ? 0 : 1));
});
opts.animIn.opacity = 1;
opts.animOut.opacity = 0;
opts.cssBefore.opacity = 1;
opts.cssBefore.display = 'block';
opts.cssAfter.zIndex = 0;
};
// scrollUp/Down/Left/Right
$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
$cont.css('overflow','hidden');
opts.before.push($.fn.cycle.commonReset);
var h = $cont.height();
opts.cssBefore.top = h;
opts.cssBefore.left = 0;
opts.cssFirst.top = 0;
opts.animIn.top = 0;
opts.animOut.top = -h;
};
$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
$cont.css('overflow','hidden');
opts.before.push($.fn.cycle.commonReset);
var h = $cont.height();
opts.cssFirst.top = 0;
opts.cssBefore.top = -h;
opts.cssBefore.left = 0;
opts.animIn.top = 0;
opts.animOut.top = h;
};
$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
$cont.css('overflow','hidden');
opts.before.push($.fn.cycle.commonReset);
var w = $cont.width();
opts.cssFirst.left = 0;
opts.cssBefore.left = w;
opts.cssBefore.top = 0;
opts.animIn.left = 0;
opts.animOut.left = 0-w;
};
$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
$cont.css('overflow','hidden');
opts.before.push($.fn.cycle.commonReset);
var w = $cont.width();
opts.cssFirst.left = 0;
opts.cssBefore.left = -w;
opts.cssBefore.top = 0;
opts.animIn.left = 0;
opts.animOut.left = w;
};
$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
$cont.css('overflow','hidden').width();
opts.before.push(function(curr, next, opts, fwd) {
if (opts.rev)
fwd = !fwd;
$.fn.cycle.commonReset(curr,next,opts);
opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW);
opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
});
opts.cssFirst.left = 0;
opts.cssBefore.top = 0;
opts.animIn.left = 0;
opts.animOut.top = 0;
};
$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
$cont.css('overflow','hidden');
opts.before.push(function(curr, next, opts, fwd) {
if (opts.rev)
fwd = !fwd;
$.fn.cycle.commonReset(curr,next,opts);
opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1);
opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
});
opts.cssFirst.top = 0;
opts.cssBefore.left = 0;
opts.animIn.top = 0;
opts.animOut.left = 0;
};
// slideX/slideY
$.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$(opts.elements).not(curr).hide();
$.fn.cycle.commonReset(curr,next,opts,false,true);
opts.animIn.width = next.cycleW;
});
opts.cssBefore.left = 0;
opts.cssBefore.top = 0;
opts.cssBefore.width = 0;
opts.animIn.width = 'show';
opts.animOut.width = 0;
};
$.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$(opts.elements).not(curr).hide();
$.fn.cycle.commonReset(curr,next,opts,true,false);
opts.animIn.height = next.cycleH;
});
opts.cssBefore.left = 0;
opts.cssBefore.top = 0;
opts.cssBefore.height = 0;
opts.animIn.height = 'show';
opts.animOut.height = 0;
};
// shuffle
$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
var i, w = $cont.css('overflow', 'visible').width();
$slides.css({left: 0, top: 0});
opts.before.push(function(curr,next,opts) {
$.fn.cycle.commonReset(curr,next,opts,true,true,true);
});
// only adjust speed once!
if (!opts.speedAdjusted) {
opts.speed = opts.speed / 2; // shuffle has 2 transitions
opts.speedAdjusted = true;
}
opts.random = 0;
opts.shuffle = opts.shuffle || {left:-w, top:15};
opts.els = [];
for (i=0; i < $slides.length; i++)
opts.els.push($slides[i]);
for (i=0; i < opts.currSlide; i++)
opts.els.push(opts.els.shift());
// custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
opts.fxFn = function(curr, next, opts, cb, fwd) {
if (opts.rev)
fwd = !fwd;
var $el = fwd ? $(curr) : $(next);
$(next).css(opts.cssBefore);
var count = opts.slideCount;
$el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
var hops = $.fn.cycle.hopsFromLast(opts, fwd);
for (var k=0; k < hops; k++)
fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
if (fwd) {
for (var i=0, len=opts.els.length; i < len; i++)
$(opts.els[i]).css('z-index', len-i+count);
}
else {
var z = $(curr).css('z-index');
$el.css('z-index', parseInt(z,10)+1+count);
}
$el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
$(fwd ? this : curr).hide();
if (cb) cb();
});
});
};
$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
};
// turnUp/Down/Left/Right
$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,true,false);
opts.cssBefore.top = next.cycleH;
opts.animIn.height = next.cycleH;
opts.animOut.width = next.cycleW;
});
opts.cssFirst.top = 0;
opts.cssBefore.left = 0;
opts.cssBefore.height = 0;
opts.animIn.top = 0;
opts.animOut.height = 0;
};
$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,true,false);
opts.animIn.height = next.cycleH;
opts.animOut.top = curr.cycleH;
});
opts.cssFirst.top = 0;
opts.cssBefore.left = 0;
opts.cssBefore.top = 0;
opts.cssBefore.height = 0;
opts.animOut.height = 0;
};
$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,false,true);
opts.cssBefore.left = next.cycleW;
opts.animIn.width = next.cycleW;
});
opts.cssBefore.top = 0;
opts.cssBefore.width = 0;
opts.animIn.left = 0;
opts.animOut.width = 0;
};
$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,false,true);
opts.animIn.width = next.cycleW;
opts.animOut.left = curr.cycleW;
});
$.extend(opts.cssBefore, { top: 0, left: 0, width: 0 });
opts.animIn.left = 0;
opts.animOut.width = 0;
};
// zoom
$.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,false,false,true);
opts.cssBefore.top = next.cycleH/2;
opts.cssBefore.left = next.cycleW/2;
$.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
$.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 });
});
opts.cssFirst.top = 0;
opts.cssFirst.left = 0;
opts.cssBefore.width = 0;
opts.cssBefore.height = 0;
};
// fadeZoom
$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,false,false);
opts.cssBefore.left = next.cycleW/2;
opts.cssBefore.top = next.cycleH/2;
$.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH });
});
opts.cssBefore.width = 0;
opts.cssBefore.height = 0;
opts.animOut.opacity = 0;
};
// blindX
$.fn.cycle.transitions.blindX = function($cont, $slides, opts) {
var w = $cont.css('overflow','hidden').width();
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts);
opts.animIn.width = next.cycleW;
opts.animOut.left = curr.cycleW;
});
opts.cssBefore.left = w;
opts.cssBefore.top = 0;
opts.animIn.left = 0;
opts.animOut.left = w;
};
// blindY
$.fn.cycle.transitions.blindY = function($cont, $slides, opts) {
var h = $cont.css('overflow','hidden').height();
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts);
opts.animIn.height = next.cycleH;
opts.animOut.top = curr.cycleH;
});
opts.cssBefore.top = h;
opts.cssBefore.left = 0;
opts.animIn.top = 0;
opts.animOut.top = h;
};
// blindZ
$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) {
var h = $cont.css('overflow','hidden').height();
var w = $cont.width();
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts);
opts.animIn.height = next.cycleH;
opts.animOut.top = curr.cycleH;
});
opts.cssBefore.top = h;
opts.cssBefore.left = w;
opts.animIn.top = 0;
opts.animIn.left = 0;
opts.animOut.top = h;
opts.animOut.left = w;
};
// growX - grow horizontally from centered 0 width
$.fn.cycle.transitions.growX = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,false,true);
opts.cssBefore.left = this.cycleW/2;
opts.animIn.left = 0;
opts.animIn.width = this.cycleW;
opts.animOut.left = 0;
});
opts.cssBefore.top = 0;
opts.cssBefore.width = 0;
};
// growY - grow vertically from centered 0 height
$.fn.cycle.transitions.growY = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,true,false);
opts.cssBefore.top = this.cycleH/2;
opts.animIn.top = 0;
opts.animIn.height = this.cycleH;
opts.animOut.top = 0;
});
opts.cssBefore.height = 0;
opts.cssBefore.left = 0;
};
// curtainX - squeeze in both edges horizontally
$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,false,true,true);
opts.cssBefore.left = next.cycleW/2;
opts.animIn.left = 0;
opts.animIn.width = this.cycleW;
opts.animOut.left = curr.cycleW/2;
opts.animOut.width = 0;
});
opts.cssBefore.top = 0;
opts.cssBefore.width = 0;
};
// curtainY - squeeze in both edges vertically
$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) {
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,true,false,true);
opts.cssBefore.top = next.cycleH/2;
opts.animIn.top = 0;
opts.animIn.height = next.cycleH;
opts.animOut.top = curr.cycleH/2;
opts.animOut.height = 0;
});
opts.cssBefore.height = 0;
opts.cssBefore.left = 0;
};
// cover - curr slide covered by next slide
$.fn.cycle.transitions.cover = function($cont, $slides, opts) {
var d = opts.direction || 'left';
var w = $cont.css('overflow','hidden').width();
var h = $cont.height();
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts);
if (d == 'right')
opts.cssBefore.left = -w;
else if (d == 'up')
opts.cssBefore.top = h;
else if (d == 'down')
opts.cssBefore.top = -h;
else
opts.cssBefore.left = w;
});
opts.animIn.left = 0;
opts.animIn.top = 0;
opts.cssBefore.top = 0;
opts.cssBefore.left = 0;
};
// uncover - curr slide moves off next slide
$.fn.cycle.transitions.uncover = function($cont, $slides, opts) {
var d = opts.direction || 'left';
var w = $cont.css('overflow','hidden').width();
var h = $cont.height();
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,true,true,true);
if (d == 'right')
opts.animOut.left = w;
else if (d == 'up')
opts.animOut.top = -h;
else if (d == 'down')
opts.animOut.top = h;
else
opts.animOut.left = -w;
});
opts.animIn.left = 0;
opts.animIn.top = 0;
opts.cssBefore.top = 0;
opts.cssBefore.left = 0;
};
// toss - move top slide and fade away
$.fn.cycle.transitions.toss = function($cont, $slides, opts) {
var w = $cont.css('overflow','visible').width();
var h = $cont.height();
opts.before.push(function(curr, next, opts) {
$.fn.cycle.commonReset(curr,next,opts,true,true,true);
// provide default toss settings if animOut not provided
if (!opts.animOut.left && !opts.animOut.top)
$.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 });
else
opts.animOut.opacity = 0;
});
opts.cssBefore.left = 0;
opts.cssBefore.top = 0;
opts.animIn.left = 0;
};
// wipe - clip animation
$.fn.cycle.transitions.wipe = function($cont, $slides, opts) {
var w = $cont.css('overflow','hidden').width();
var h = $cont.height();
opts.cssBefore = opts.cssBefore || {};
var clip;
if (opts.clip) {
if (/l2r/.test(opts.clip))
clip = 'rect(0px 0px '+h+'px 0px)';
else if (/r2l/.test(opts.clip))
clip = 'rect(0px '+w+'px '+h+'px '+w+'px)';
else if (/t2b/.test(opts.clip))
clip = 'rect(0px '+w+'px 0px 0px)';
else if (/b2t/.test(opts.clip))
clip = 'rect('+h+'px '+w+'px '+h+'px 0px)';
else if (/zoom/.test(opts.clip)) {
var top = parseInt(h/2,10);
var left = parseInt(w/2,10);
clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)';
}
}
opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)';
var d = opts.cssBefore.clip.match(/(\d+)/g);
var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10);
opts.before.push(function(curr, next, opts) {
if (curr == next) return;
var $curr = $(curr), $next = $(next);
$.fn.cycle.commonReset(curr,next,opts,true,true,false);
opts.cssAfter.display = 'block';
var step = 1, count = parseInt((opts.speedIn / 13),10) - 1;
(function f() {
var tt = t ? t - parseInt(step * (t/count),10) : 0;
var ll = l ? l - parseInt(step * (l/count),10) : 0;
var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h;
var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w;
$next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' });
(step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none');
})();
});
$.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 });
opts.animIn = { left: 0 };
opts.animOut = { left: 0 };
};
})(jQuery);
|
// Dependencies
const { GiveawaySchema, RankSchema, WarningSchema, ReactionRoleSchema } = require('../../database/models'),
{ MessageEmbed, MessageAttachment } = require('discord.js'),
{ Canvas } = require('canvacord'),
Event = require('../../structures/Event');
/**
* Guild delete event
* @event Egglord#GuildDelete
* @extends {Event}
*/
class GuildDelete extends Event {
constructor(...args) {
super(...args, {
dirname: __dirname,
});
}
/**
* Function for recieving event.
* @param {bot} bot The instantiating client
* @param {Guild} guild The guild that kicked the bot
* @readonly
*/
async run(bot, guild) {
bot.logger.log(`[GUILD LEAVE] ${guild.name} (${guild.id}) removed the bot.`);
await bot.DeleteGuild(guild);
// Send message to channel that bot has left a server
let attachment;
try {
const embed = new MessageEmbed()
.setTitle(`[GUILD LEAVE] ${guild.name}`);
if (guild.icon == null) {
const icon = await Canvas.guildIcon(guild.name ?? 'undefined', 128);
attachment = new MessageAttachment(icon, 'guildicon.png');
embed.setImage('attachment://guildicon.png');
} else {
embed.setImage(guild.iconURL({ dynamic: true, size: 1024 }));
}
embed.setDescription([
`Guild ID: ${guild.id ?? 'undefined'}`,
`Owner: ${bot.users.cache.get(guild.ownerId)?.tag}`,
`MemberCount: ${guild?.memberCount ?? 'undefined'}`,
].join('\n'));
const modChannel = await bot.channels.fetch(bot.config.SupportServer.GuildChannel).catch(() => bot.logger.error(`Error fetching guild: ${guild.id} logging channel`));
if (modChannel) bot.addEmbed(modChannel.id, [embed, attachment]);
} catch (err) {
bot.logger.error(`Event: '${this.conf.name}' has error: ${err.message}.`);
}
// Clean up database (delete all guild data)
// Delete ranks from database
try {
const r = await RankSchema.deleteMany({
guildID: guild.id,
});
if (r.deletedCount >= 1) bot.logger.log(`Deleted ${r.deletedCount} ranks.`);
} catch (err) {
bot.logger.error(`Failed to delete Ranked data, error: ${err.message}`);
}
// Delete giveaways from database
try {
const g = await GiveawaySchema.deleteMany({
guildID: guild.id,
});
if (g.deletedCount >= 1) bot.logger.log(`Deleted ${g.deletedCount} giveaways.`);
} catch (err) {
bot.logger.error(`Failed to delete Giveaway data, error: ${err.message}`);
}
// Delete warnings from database
try {
const w = await WarningSchema.deleteMany({
guildID: guild.id,
});
if (w.deletedCount >= 1) bot.logger.log(`Deleted ${w.deletedCount} warnings.`);
} catch (err) {
bot.logger.error(`Failed to delete Warning data, error: ${err.message}`);
}
// Delete reaction roles from database
try {
const rr = await ReactionRoleSchema.deleteMany({
guildID: guild.id,
});
if (rr.deletedCount >= 1) bot.logger.log(`Deleted ${rr.deletedCount} reaction roles.`);
} catch (err) {
bot.logger.error(`Failed to delete Warning data, error: ${err.message}`);
}
// update bot's activity
bot.SetActivity('WATCHING', [`${bot.guilds.cache.size} servers!`, `${bot.users.cache.size} users!`]);
}
}
module.exports = GuildDelete;
|
/* -*- Mode: js; js-indent-level: 2; indent-tabs-mode: nil -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var icc_events = {
downloadEvent: function icc_events_downloadEvent(eventObject) {
DUMP('icc_events_downloadEvent: Downloading event:', eventObject);
icc._icc.sendStkEventDownload(eventObject);
},
handleLocationStatus: function icc_events_handleLocationStatus(evt) {
if (evt.type != 'voicechange') {
return;
}
// XXX: check bug-926169
// this is used to keep all tests passing while introducing multi-sim APIs
var conn = window.navigator.mozMobileConnection ||
window.navigator.mozMobileConnections &&
window.navigator.mozMobileConnections[0];
DUMP(' STK Location changed to MCC=' + IccHelper.iccInfo.mcc +
' MNC=' + IccHelper.iccInfo.mnc +
' LAC=' + conn.voice.cell.gsmLocationAreaCode +
' CellId=' + conn.voice.cell.gsmCellId +
' Status/Connected=' + conn.voice.connected +
' Status/Emergency=' + conn.voice.emergencyCallsOnly);
var status = icc._iccManager.STK_SERVICE_STATE_UNAVAILABLE;
if (conn.voice.connected) {
status = icc._iccManager.STK_SERVICE_STATE_NORMAL;
} else if (conn.voice.emergencyCallsOnly) {
status = icc._iccManager.STK_SERVICE_STATE_LIMITED;
}
this.downloadEvent({
eventType: icc._iccManager.STK_EVENT_TYPE_LOCATION_STATUS,
locationStatus: status,
locationInfo: {
mcc: IccHelper.iccInfo.mcc,
mnc: IccHelper.iccInfo.mnc,
gsmLocationAreaCode: conn.voice.cell.gsmLocationAreaCode,
gsmCellId: conn.voice.cell.gsmCellId
}
});
},
handleCallsChanged: function icc_events_handleCallsChanged(evt) {
if (evt.type != 'callschanged') {
return;
}
DUMP(' STK Communication changed');
var self = this;
window.navigator.mozTelephony.calls.forEach(function callIterator(call) {
DUMP(' STK:CALLS State change: ' + call.state);
var outgoing = call.state == 'incoming';
if (call.state == 'incoming') {
self.downloadEvent({
eventType: icc._iccManager.STK_EVENT_TYPE_MT_CALL,
number: call.number,
isIssuedByRemote: outgoing,
error: null
});
}
call.addEventListener('error', function callError(err) {
self.downloadEvent({
eventType: icc._iccManager.STK_EVENT_TYPE_CALL_DISCONNECTED,
number: call.number,
error: err
});
});
call.addEventListener('statechange', function callStateChange() {
DUMP(' STK:CALL State Change: ' + call.state);
switch (call.state) {
case 'connected':
self.downloadEvent({
eventType: icc._iccManager.STK_EVENT_TYPE_CALL_CONNECTED,
number: call.number,
isIssuedByRemote: outgoing
});
break;
case 'disconnected':
call.removeEventListener('statechange', callStateChange);
self.downloadEvent({
eventType: icc._iccManager.STK_EVENT_TYPE_CALL_DISCONNECTED,
number: call.number,
isIssuedByRemote: outgoing,
error: null
});
break;
}
});
});
},
handleLanguageSelectionEvent:
function icc_events_handleLanguageSelectionEvent(evt) {
DUMP(' STK Language selection = ' + evt.settingValue);
this.downloadEvent({
eventType: icc._iccManager.STK_EVENT_TYPE_LANGUAGE_SELECTION,
language: evt.settingValue.substring(0, 2)
});
},
handleBrowserTerminationEvent:
function icc_events_handleBrowserTerminationEvent(evt) {
DUMP(' STK Browser termination');
this.downloadEvent({
eventType: icc._iccManager.STK_EVENT_TYPE_BROWSER_TERMINATION
});
},
handleUserActivityEvent:
function icc_events_handleUserActivity(idleObserverObject) {
DUMP(' STK User Activity');
this.downloadEvent({
eventType: icc._iccManager.STK_EVENT_TYPE_USER_ACTIVITY
});
navigator.removeIdleObserver(idleObserverObject);
},
handleIdleScreenAvailableEvent:
function icc_events_handleIdleScreenAvailableEvent() {
DUMP(' STK IDLE screen available');
this.downloadEvent({
eventType: icc._iccManager.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE
});
},
register: function icc_events_register(eventList) {
DUMP('icc_events_register - Events list:', eventList);
for (var evt in eventList) {
DUMP('icc_events_register - Registering event:', eventList[evt]);
switch (eventList[evt]) {
case icc._iccManager.STK_EVENT_TYPE_MT_CALL:
case icc._iccManager.STK_EVENT_TYPE_CALL_CONNECTED:
case icc._iccManager.STK_EVENT_TYPE_CALL_DISCONNECTED:
DUMP('icc_events_register - Communications changes event');
var comm = window.navigator.mozTelephony;
comm.addEventListener('callschanged',
function register_icc_event_callscahanged(evt) {
icc_events.handleCallsChanged(evt);
});
break;
case icc._iccManager.STK_EVENT_TYPE_LOCATION_STATUS:
DUMP('icc_events_register - Location changes event');
// XXX: check bug-926169
// this is used to keep all tests passing while introducing
// multi-sim APIs
var conn = window.navigator.mozMobileConnection ||
window.navigator.mozMobileConnections &&
window.navigator.mozMobileConnections[0];
conn.addEventListener('voicechange',
function register_icc_event_voicechange(evt) {
icc_events.handleLocationStatus(evt);
});
break;
case icc._iccManager.STK_EVENT_TYPE_USER_ACTIVITY:
DUMP('icc_events_register - User activity event');
var stkUserActivity = {
time: 5,
onidle: function() {
DUMP('STK Event - User activity - Going to idle');
},
onactive: function() {
DUMP('STK Event - User activity - Going to active');
icc_events.handleUserActivityEvent(stkUserActivity);
}
};
navigator.addIdleObserver(stkUserActivity);
break;
case icc._iccManager.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE:
DUMP('icc_events_register - Idle screen available event');
window.addEventListener('lock',
function register_icc_event_idlescreen() {
icc_events.handleIdleScreenAvailableEvent();
window.removeEventListener('lock', register_icc_event_idlescreen);
});
break;
case icc._iccManager.STK_EVENT_TYPE_CARD_READER_STATUS:
DUMP('icc_events_register - TODO event: ', eventList[evt]);
break;
case icc._iccManager.STK_EVENT_TYPE_LANGUAGE_SELECTION:
DUMP('icc_events_register - Language selection event');
var self = this;
window.navigator.mozSettings.addObserver('language.current',
function icc_events_languageChanged(e) {
self.handleLanguageSelectionEvent(e);
});
break;
case icc._iccManager.STK_EVENT_TYPE_BROWSER_TERMINATION:
DUMP('icc_events_register - Browser termination event');
window.addEventListener('appterminated',
function icc_events_browsertermination(e) {
var app = Applications.getByManifestURL(e.detail.origin +
'/manifest.webapp');
if (!app) {
return;
}
if (app.manifest.permissions.browser) {
self.handleBrowserTerminationEvent(e);
}
});
break;
case icc._iccManager.STK_EVENT_TYPE_DATA_AVAILABLE:
case icc._iccManager.STK_EVENT_TYPE_CHANNEL_STATUS:
case icc._iccManager.STK_EVENT_TYPE_SINGLE_ACCESS_TECHNOLOGY_CHANGED:
case icc._iccManager.STK_EVENT_TYPE_DISPLAY_PARAMETER_CHANGED:
case icc._iccManager.STK_EVENT_TYPE_LOCAL_CONNECTION:
case icc._iccManager.STK_EVENT_TYPE_NETWORK_SEARCH_MODE_CHANGED:
case icc._iccManager.STK_EVENT_TYPE_BROWSING_STATUS:
case icc._iccManager.STK_EVENT_TYPE_FRAMES_INFORMATION_CHANGED:
DUMP('icc_events_register - TODO event: ', eventList[evt]);
break;
}
}
}
};
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-70cff199"],{"08bb":function(e,t,n){},"19ab":function(e,t,n){!function(t,n){e.exports=n()}(0,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/dist/",t(t.s=19)}([function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},i=0;i<this.length;i++){var s=this[i][0];"number"==typeof s&&(r[s]=!0)}for(i=0;i<t.length;i++){var a=t[i];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(e,t){e.exports=function(e,t,n,r){var i,s=e=e||{},a=typeof e.default;"object"!==a&&"function"!==a||(i=e,s=e.default);var o="function"==typeof s?s.options:s;if(t&&(o.render=t.render,o.staticRenderFns=t.staticRenderFns),n&&(o._scopeId=n),r){var l=Object.create(o.computed||null);Object.keys(r).forEach(function(e){var t=r[e];l[e]=function(){return t}}),o.computed=l}return{esModule:i,exports:s,options:o}}},function(e,t,n){function r(e){for(var t=0;t<e.length;t++){var n=e[t],r=u[n.id];if(r){r.refs++;for(var i=0;i<r.parts.length;i++)r.parts[i](n.parts[i]);for(;i<n.parts.length;i++)r.parts.push(a(n.parts[i]));r.parts.length>n.parts.length&&(r.parts.length=n.parts.length)}else{var s=[];for(i=0;i<n.parts.length;i++)s.push(a(n.parts[i]));u[n.id]={id:n.id,refs:1,parts:s}}}}function i(e,t){for(var n=[],r={},i=0;i<t.length;i++){var s=t[i],a=s[0],o=s[1],l=s[2],c=s[3],u={css:o,media:l,sourceMap:c};r[a]?(u.id=e+":"+r[a].parts.length,r[a].parts.push(u)):(u.id=e+":0",n.push(r[a]={id:a,parts:[u]}))}return n}function s(){var e=document.createElement("style");return e.type="text/css",p.appendChild(e),e}function a(e){var t,n,r=document.querySelector('style[data-vue-ssr-id~="'+e.id+'"]'),i=null!=r;if(i&&h)return v;if(m){var a=d++;r=f||(f=s()),t=o.bind(null,r,a,!1),n=o.bind(null,r,a,!0)}else r=r||s(),t=l.bind(null,r),n=function(){r.parentNode.removeChild(r)};return i||t(e),function(r){if(r){if(r.css===e.css&&r.media===e.media&&r.sourceMap===e.sourceMap)return;t(e=r)}else n()}}function o(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=g(t,i);else{var s=document.createTextNode(i),a=e.childNodes;a[t]&&e.removeChild(a[t]),a.length?e.insertBefore(s,a[t]):e.appendChild(s)}}function l(e,t){var n=t.css,r=t.media,i=t.sourceMap;if(r&&e.setAttribute("media",r),i&&(n+="\n/*# sourceURL="+i.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */"),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}var c="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!c)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var i=n(18),u={},p=c&&(document.head||document.getElementsByTagName("head")[0]),f=null,d=0,h=!1,v=function(){},m="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());e.exports=function(e,t,n){h=n;var s=i(e,t);return r(s),function(t){for(var n=[],a=0;a<s.length;a++){var o=s[a],l=u[o.id];l.refs--,n.push(l)}t?(s=i(e,t),r(s)):s=[];for(a=0;a<n.length;a++){l=n[a];if(0===l.refs){for(var c=0;c<l.parts.length;c++)l.parts[c]();delete u[l.id]}}}};var g=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()},function(e,t,n){n(16);var r=n(1)(n(4),n(13),"data-v-566a42b8",null);e.exports=r.exports},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(11),s=r(i),a=n(10),o=r(a);t.default={name:"splitPane",components:{Resizer:s.default,Pane:o.default},props:{minPercent:{type:Number,default:10},defaultPercent:{type:Number,default:50},split:{validator:function(e){return["vertical","horizontal"].indexOf(e)>=0},required:!0},className:String},computed:{userSelect:function(){return this.active?"none":""},cursor:function(){return this.active?"col-resize":""}},watch:{defaultPercent:function(e,t){this.percent=e}},data:function(){return{active:!1,hasMoved:!1,height:null,percent:this.defaultPercent,type:"vertical"===this.split?"width":"height",resizeType:"vertical"===this.split?"left":"top"}},methods:{onClick:function(){this.hasMoved||(this.percent=50,this.$emit("resize"))},onMouseDown:function(){this.active=!0,this.hasMoved=!1},onMouseUp:function(){this.active=!1},onMouseMove:function(e){if(0!==e.buttons&&0!==e.which||(this.active=!1),this.active){var t=0,n=e.currentTarget;if("vertical"===this.split)for(;n;)t+=n.offsetLeft,n=n.offsetParent;else for(;n;)t+=n.offsetTop,n=n.offsetParent;var r="vertical"===this.split?e.pageX:e.pageY,i="vertical"===this.split?e.currentTarget.offsetWidth:e.currentTarget.offsetHeight,s=Math.floor((r-t)/i*1e4)/100;s>this.minPercent&&s<100-this.minPercent&&(this.percent=s),this.$emit("resize"),this.hasMoved=!0}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={name:"Pane",props:{className:String},data:function(){return{classes:[this.$parent.split,this.className].join(" "),percent:50}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={props:{split:{validator:function(e){return["vertical","horizontal"].indexOf(e)>=0},required:!0},className:String},computed:{classes:function(){return["splitter-pane-resizer",this.split,this.className].join(" ")}}}},function(e,t,n){t=e.exports=n(0)(),t.push([e.i,".splitter-pane-resizer[data-v-212fa2a4]{box-sizing:border-box;background:#000;position:absolute;opacity:.2;z-index:1;background-clip:padding-box}.splitter-pane-resizer.horizontal[data-v-212fa2a4]{height:11px;margin:-5px 0;border-top:5px solid hsla(0,0%,100%,0);border-bottom:5px solid hsla(0,0%,100%,0);cursor:row-resize;width:100%}.splitter-pane-resizer.vertical[data-v-212fa2a4]{width:11px;height:100%;margin-left:-5px;border-left:5px solid hsla(0,0%,100%,0);border-right:5px solid hsla(0,0%,100%,0);cursor:col-resize}",""])},function(e,t,n){t=e.exports=n(0)(),t.push([e.i,'.clearfix[data-v-566a42b8]:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0}.vue-splitter-container[data-v-566a42b8]{height:100%;position:relative}.vue-splitter-container-mask[data-v-566a42b8]{z-index:9999;width:100%;height:100%;position:absolute;top:0;left:0}',""])},function(e,t,n){t=e.exports=n(0)(),t.push([e.i,".splitter-pane.vertical.splitter-paneL[data-v-815c801c]{position:absolute;left:0;height:100%;padding-right:3px}.splitter-pane.vertical.splitter-paneR[data-v-815c801c]{position:absolute;right:0;height:100%;padding-left:3px}.splitter-pane.horizontal.splitter-paneL[data-v-815c801c]{position:absolute;top:0;width:100%}.splitter-pane.horizontal.splitter-paneR[data-v-815c801c]{position:absolute;bottom:0;width:100%;padding-top:3px}",""])},function(e,t,n){n(17);var r=n(1)(n(5),n(14),"data-v-815c801c",null);e.exports=r.exports},function(e,t,n){n(15);var r=n(1)(n(6),n(12),"data-v-212fa2a4",null);e.exports=r.exports},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{class:e.classes})},staticRenderFns:[]}},function(e,t){e.exports={render:function(){var e,t,n,r=this,i=r.$createElement,s=r._self._c||i;return s("div",{staticClass:"vue-splitter-container clearfix",style:{cursor:r.cursor,userSelect:r.userSelect},on:{mouseup:r.onMouseUp,mousemove:r.onMouseMove}},[s("pane",{staticClass:"splitter-pane splitter-paneL",style:(e={},e[r.type]=r.percent+"%",e),attrs:{split:r.split}},[r._t("paneL")],2),r._v(" "),s("resizer",{style:(t={},t[r.resizeType]=r.percent+"%",t),attrs:{className:r.className,split:r.split},nativeOn:{mousedown:function(e){r.onMouseDown(e)},click:function(e){r.onClick(e)}}}),r._v(" "),s("pane",{staticClass:"splitter-pane splitter-paneR",style:(n={},n[r.type]=100-r.percent+"%",n),attrs:{split:r.split}},[r._t("paneR")],2),r._v(" "),r.active?s("div",{staticClass:"vue-splitter-container-mask"}):r._e()],1)},staticRenderFns:[]}},function(e,t){e.exports={render:function(){var e=this,t=e.$createElement;return(e._self._c||t)("div",{class:e.classes},[e._t("default")],2)},staticRenderFns:[]}},function(e,t,n){var r=n(7);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals),n(2)("93b24118",r,!0)},function(e,t,n){var r=n(8);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals),n(2)("084fcb29",r,!0)},function(e,t,n){var r=n(9);"string"==typeof r&&(r=[[e.i,r,""]]),r.locals&&(e.exports=r.locals),n(2)("2e723840",r,!0)},function(e,t){e.exports=function(e,t){for(var n=[],r={},i=0;i<t.length;i++){var s=t[i],a=s[0],o=s[1],l=s[2],c=s[3],u={id:e+":"+i,css:o,media:l,sourceMap:c};r[a]?r[a].parts.push(u):n.push(r[a]={id:a,parts:[u]})}return n}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),s=r(i);t.default=s.default,"undefined"!=typeof window&&window.Vue&&window.Vue.component("split-pane",s.default)}])})},a6b8:function(e,t,n){"use strict";n.r(t);var r=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"components-container"},[e._m(0),e._v(" "),n("split-pane",{attrs:{split:"vertical"},on:{resize:e.resize}},[n("template",{slot:"paneL"},[n("div",{staticClass:"left-container"})]),e._v(" "),n("template",{slot:"paneR"},[n("split-pane",{attrs:{split:"horizontal"}},[n("template",{slot:"paneL"},[n("div",{staticClass:"top-container"})]),e._v(" "),n("template",{slot:"paneR"},[n("div",{staticClass:"bottom-container"})])],2)],1)],2)],1)},i=[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("aside",[n("strong",[e._v("SplitPane")]),e._v(" If you've used\n "),n("a",{attrs:{href:"https://codepen.io/",target:"_blank"}},[e._v(" codepen")]),e._v(",\n "),n("a",{attrs:{href:"https://jsfiddle.net/",target:"_blank"}},[e._v(" jsfiddle ")]),e._v("will not be unfamiliar.\n "),n("a",{attrs:{href:"https://github.com/PanJiaChen/vue-split-pane",target:"_blank"}},[e._v(" Github repository")])])}],s=n("19ab"),a=n.n(s),o={name:"SplitpaneDemo",components:{splitPane:a.a},methods:{resize:function(){console.log("resize")}}},l=o,c=(n("ea4a"),n("2877")),u=Object(c["a"])(l,r,i,!1,null,"457e2c0a",null);t["default"]=u.exports},ea4a:function(e,t,n){"use strict";var r=n("08bb"),i=n.n(r);i.a}}]);
|
const Sequelize = require('sequelize')
const db = require('../db')
const PmtProfile = db.define('pmtProfile', {
firstName: {
type: Sequelize.STRING,
allowNull: false,
validate: {
notEmpty: true
}
},
lastName: {
type: Sequelize.STRING,
allowNull: false,
validate: {
notEmpty: true
}
},
ccNumber: {
type: Sequelize.STRING,
allowNull: false,
validate: {
notEmpty: true
}
},
address1: {
type: Sequelize.STRING,
allowNull: false,
validate: {
notEmpty: true
}
},
aptNumber: {
type: Sequelize.STRING
},
city: {
type: Sequelize.STRING,
allowNull: false,
validate: {
notEmpty: true
}
},
state: {
type: Sequelize.ENUM(
'AL',
'AK',
'AZ',
'AR',
'CA',
'CO',
'CT',
'DE',
'FL',
'GA',
'HI',
'ID',
'IL',
'IN',
'IA',
'KS',
'KY',
'LA',
'ME',
'MD',
'MA',
'MI',
'MN',
'MS',
'MO',
'NE',
'NV',
'NJ',
'NH',
'NM',
'NY',
'NC',
'OH',
'OK',
'OR',
'PA',
'RI',
'SC',
'SD',
'TN',
'TX',
'UT',
'VT',
'VA',
'WA',
'WV',
'WI',
'WY'
),
allowNull: false
},
zip: {
type: Sequelize.INTEGER,
allowNull: false,
validate: {
notEmpty: true
}
},
country: {
type: Sequelize.STRING,
allowNull: false,
validate: {
notEmpty: true
}
},
phoneNumber: {
type: Sequelize.INTEGER
}
})
module.exports = PmtProfile
|
'use strict'
/*
* Create a `sub` function that takes 2 numbers as arguments and substract them
*
* @notions Primitive and Operators, Functions
*/
// Your code :
function sub(a, b){ return a - b ; }
//* Begin of tests
const assert = require('assert')
const rand = Math.random()
assert.strictEqual(typeof sub, 'function')
assert.strictEqual(sub.length, 2)
assert.strictEqual(sub(2, 2), 0)
assert.strictEqual(sub(-2, 2), -4)
assert.strictEqual(sub(rand, rand), rand - rand)
// End of tests */
|
//--------------------------------------------------------------------------
// Proyecto Icasus <https://gestionproyectos.us.es/projects/r2h2-icasus/>
// Archivo: public/js/medicion.js
// Desarrolladores: Juanan Ruiz (juanan@us.es), Jesus Martin Corredera (jjmc@us.es),
// Joaquín Valonero Zaera (tecnibus1@us.es)
//--------------------------------------------------------------------------
// Funciones de la plantilla medicion.tpl
// -------------------------------------------------------
//Estimación del indicador/dato
var inverso = $("#med_datos").data("inverso");
var limite = $("#limite").data("limite");
var meta = $("#meta").data("meta");
//Variables: Valor mínimo y máximo permitido
var valor_min = $("#valors").data("valor_min");
var valor_max = $("#valors").data("valor_max");
//Fechas de inicio y fin de grabación
var grabacion_inicio = $("#gi").data("grabacion_inicio");
var grabacion_fin = $("#gf").data("grabacion_fin");
actualizaGrafica();
function actualizaGrafica() {
//Panel de tarta
$("#container").each(function () {
var contenedor = $(this).attr('id');
var nomIndicador = $(this).data("nombre_indicador");
var id_indicador = $(this).data("id_indicador");
var id_medicion = $(this).data("id_medicion");
//Variables para guardar el nombre y total de la medición solicitada
var medicion, total = 0;
var urlApi = "api_publica.php?metodo=get_valores_con_timestamp&id=" + id_indicador;
// contenedor para los datos del gráfico
var chartSerie = new HighchartSerie();
$.ajax({
url: urlApi,
type: "GET",
dataType: "json",
success: onDataReceived
});
function onDataReceived(datos) {
//Buscamos la medición para luego obtener su total
while (!medicion) {
datos.forEach(function (dato) {
if (dato.id_medicion == id_medicion) {
medicion = dato.medicion;
}
});
}
datos.forEach(function (dato) {
if (dato.etiqueta_mini && dato.id_medicion == id_medicion) {
chartSerie.add(dato);
}
//Guardamos el total
if (medicion == dato.medicion && dato.id_unidad == 0) {
total = parseFloat(dato.valor);
}
});
//Redondeamos el total
total = Highcharts.numberFormat(total, 2);
//Pide las series de datos a chartSerie
var dataseries = chartSerie.getPieSerie();
//Gráfico de tarta
pintaGrafico({
chart: {
renderTo: contenedor,
events: {}
},
credits: {
enabled: false
},
title: {
text: nomIndicador,
style: {"fontSize": "14px"}
},
subtitle: {
text: 'Medición: ' + medicion + ' Total: ' + total
},
exporting: {
filename: nomIndicador
},
xAxis: {
type: 'category'
},
yAxis: {
title: {
text: 'Valores'
},
labels: {
format: '{value:,.2f}'
}
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
format: '{y:,.2f} ({percentage:,.2f} %)'
}
}
},
tooltip: {
pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.y:,.2f} ({point.percentage:,.2f} %)</b><br/>'
},
series: dataseries
});
}
});
}
//Edición de la medición
function fila_editar(medicion, id_valor)
{
$('#valors').load("index.php?page=medicion_ajax&modulo=editarfila&ajax=true&id_medicion=" + medicion + "&id_valor=" + id_valor);
}
function fila_grabar(id_valor, medicion)
{
var value = $('[name=v_' + id_valor + ']').val();
var fecha_actual = new Date();
var fecha_inicio = new Date(grabacion_inicio);
var fecha_fin = new Date(grabacion_fin);
value = value.replace(',', '.');
$('#intervalo').text('[' + valor_min + ', ' + valor_max + '].');
$('#periodo').text('(' + fecha_inicio.toLocaleDateString() + ' al ' + fecha_fin.toLocaleDateString() + ').');
//Comprobamos que estemos dentro del periodo de grabación
if ((fecha_actual >= fecha_inicio) && (fecha_actual <= fecha_fin)) {
if (value !== '')
{
if (isNaN(value) === false)
{
//Si hay un intervalo [min,max]
if ($.isNumeric(valor_min) && $.isNumeric(valor_max)) {
if (value < valor_min || value > valor_max) {
$('#dialogo_valor_intervalo').modal('show');
}
else {
$.ajax({
type: "POST",
url: "index.php?page=medicion_ajax&modulo=grabarfila&ajax=true",
data: {"id_valor": id_valor, "valor": value},
success: function (response) {
$('#valors').load("index.php?page=medicion_ajax&modulo=cancelarfila&ajax=true&id_medicion=" + medicion);
$('#grafica').load("index.php?page=medicion_ajax&modulo=grafica&ajax=true&id_medicion=" + medicion);
}
});
}
}
//Si hay un valor mínimo
else if ($.isNumeric(valor_min) && !$.isNumeric(valor_max)) {
if (value < valor_min) {
$('#dialogo_valor_intervalo').modal('show');
}
else {
$.ajax({
type: "POST",
url: "index.php?page=medicion_ajax&modulo=grabarfila&ajax=true",
data: {"id_valor": id_valor, "valor": value},
success: function (response) {
$('#valors').load("index.php?page=medicion_ajax&modulo=cancelarfila&ajax=true&id_medicion=" + medicion);
$('#grafica').load("index.php?page=medicion_ajax&modulo=grafica&ajax=true&id_medicion=" + medicion);
}
});
}
}
//Si hay un valor máximo
else if ($.isNumeric(valor_max) && !$.isNumeric(valor_min)) {
if (value > valor_max) {
$('#dialogo_valor_intervalo').modal('show');
}
else {
$.ajax({
type: "POST",
url: "index.php?page=medicion_ajax&modulo=grabarfila&ajax=true",
data: {"id_valor": id_valor, "valor": value},
success: function (response) {
$('#valors').load("index.php?page=medicion_ajax&modulo=cancelarfila&ajax=true&id_medicion=" + medicion);
$('#grafica').load("index.php?page=medicion_ajax&modulo=grafica&ajax=true&id_medicion=" + medicion);
}
});
}
}
//Si no hay definida ninguna restricción en cuanto a los valores
else {
$.ajax({
type: "POST",
url: "index.php?page=medicion_ajax&modulo=grabarfila&ajax=true",
data: {"id_valor": id_valor, "valor": value},
success: function (response) {
$('#valors').load("index.php?page=medicion_ajax&modulo=cancelarfila&ajax=true&id_medicion=" + medicion);
$('#grafica').load("index.php?page=medicion_ajax&modulo=grafica&ajax=true&id_medicion=" + medicion);
}
});
}
}
else if (value === "---")
{
$.post("index.php?page=medicion_ajax&modulo=anularvalor&ajax=true", {id_valor: id_valor}, function () {
$('#valors').load("index.php?page=medicion_ajax&modulo=cancelarfila&ajax=true&id_medicion=" + medicion);
$('#grafica').load("index.php?page=medicion_ajax&modulo=grafica&ajax=true&id_medicion=" + medicion);
});
}
else
{
$('#dialogo_valor_num').modal('show');
}
}
else
{
$('#dialogo_valor_nulo').modal('show');
}
}
else {
$('#dialogo_valor_periodo').modal('show');
}
}
function fila_cancelar(medicion)
{
$('#valors').load("index.php?page=medicion_ajax&modulo=cancelarfila&ajax=true&id_medicion=" + medicion);
}
function etiqueta_editar(medicion, content)
{
$('#' + content).load("index.php?page=medicion_ajax&modulo=editaretiqueta&ajax=true&id_medicion=" + medicion + "&contenedor=" + content);
}
function observaciones_editar(medicion, content)
{
$('#' + content).load("index.php?page=medicion_ajax&modulo=editarobservaciones&ajax=true&id_medicion=" + medicion + "&contenedor=" + content);
}
function etiqueta_editar_grabar(content, medicion, tag)
{
var value = $("[name=" + tag + "]").val();
if (value === '') {
$('#dialogo_etiqueta_nula').modal('show');
}
else {
$.post("index.php?page=medicion_ajax&modulo=grabaretiqueta&ajax=true", {id_medicion: medicion, contenedor: content, valor: value}, function () {
// $('#' + content).load("index.php?page=medicion_ajax&modulo=cancelaretiqueta&ajax=true&id_medicion=" + medicion + "&contenedor=" + content);
location.reload();
});
}
}
function observaciones_editar_grabar(content, medicion, tag)
{
var value = $("[name=" + tag + "]").val();
$.post("index.php?page=medicion_ajax&modulo=grabarobservaciones&ajax=true", {id_medicion: medicion, contenedor: content, valor: value}, function () {
$('#' + content).load("index.php?page=medicion_ajax&modulo=cancelarobservaciones&ajax=true&id_medicion=" + medicion + "&contenedor=" + content);
});
}
function etiqueta_editar_cancelar(content, medicion)
{
$('#' + content).load("index.php?page=medicion_ajax&modulo=cancelaretiqueta&ajax=true&id_medicion=" + medicion + "&contenedor=" + content);
}
function observaciones_editar_cancelar(content, medicion)
{
$('#' + content).load("index.php?page=medicion_ajax&modulo=cancelarobservaciones&ajax=true&id_medicion=" + medicion + "&contenedor=" + content);
}
function fecha_editar(medicion, content)
{
$('#' + content).load("index.php?page=medicion_ajax&modulo=editaretiqueta&ajax=true&id_medicion=" + medicion + "&contenedor=" + content);
}
function fecha_grabar(medicion, content)
{
var dia = $("[name=" + content + "Day]").val();
var mes = $("[name=" + content + "Month]").val();
var year = $("[name=" + content + "Year]").val();
var value = year + "-" + mes + "-" + dia;
$.post("index.php?page=medicion_ajax&modulo=grabaretiqueta&ajax=true", {id_medicion: medicion, contenedor: content, valor: value}, function () {
$('#' + content).load("index.php?page=medicion_ajax&modulo=cancelaretiqueta&ajax=true&id_medicion=" + medicion + "&contenedor=" + content);
//Si cambiamos periodos de grabación actualizamos valores globales
if (content === 'gi') {
grabacion_inicio = value;
}
if (content === 'gf') {
grabacion_fin = value;
}
});
}
function fecha_cancelar(content, medicion)
{
$('#' + content).load("index.php?page=medicion_ajax&modulo=cancelaretiqueta&ajax=true&id_medicion=" + medicion + "&contenedor=" + content);
}
function referencia_editar(id, medicion)
{
$('#referencia_' + id).load("index.php?page=medicion_ajax&modulo=editarvalorreferencia&ajax=true&id_referencia=" + id + "&id_medicion=" + medicion);
}
function referencia_grabar(id, medicion, nombre_ref)
{
var value = $("[name=input_referencia_" + id + "]").val();
value = value.replace(',', '.');
$('#intervalo').text('[' + valor_min + ', ' + valor_max + '].');
if (value !== '')
{
if (isNaN(value) === false)
{
//Validamos y grabamos
if (validar_referencia(nombre_ref, value))
{
//Si hay un intervalo [min,max]
if ($.isNumeric(valor_min) && $.isNumeric(valor_max)) {
if (value < valor_min || value > valor_max) {
$('#dialogo_valor_intervalo').modal('show');
}
else {
$.post("index.php?page=medicion_ajax&modulo=grabarvalorreferencia&ajax=true", {id_referencia: id, valor: value}, function () {
//Si es limite o meta actualizamos
actualizar_estimacion(nombre_ref, value);
$('#referencia_' + id).load("index.php?page=medicion_ajax&modulo=cancelarvalorreferencia&ajax=true&id=" + id + "&id_medicion=" + medicion);
$('#valors').load("index.php?page=medicion_ajax&modulo=cancelarfila&ajax=true&id_medicion=" + medicion);
});
}
}
// Si no hay intervalo [min, max]
else {
$.post("index.php?page=medicion_ajax&modulo=grabarvalorreferencia&ajax=true", {id_referencia: id, valor: value}, function () {
//Si es limite o meta actualizamos
actualizar_estimacion(nombre_ref, value);
$('#referencia_' + id).load("index.php?page=medicion_ajax&modulo=cancelarvalorreferencia&ajax=true&id=" + id + "&id_medicion=" + medicion);
$('#valors').load("index.php?page=medicion_ajax&modulo=cancelarfila&ajax=true&id_medicion=" + medicion);
});
}
}
else {
$('#dialogo_valor_referencia').modal('show');
}
}
else if (value === "---")
{
$.post("index.php?page=medicion_ajax&modulo=anularvalorreferencia&ajax=true", {id_referencia: id}, function () {
//Si es limite o meta actualizamos
actualizar_estimacion(nombre_ref, null);
$('#referencia_' + id).load("index.php?page=medicion_ajax&modulo=cancelarvalorreferencia&ajax=true&id=" + id + "&id_medicion=" + medicion);
$('#valors').load("index.php?page=medicion_ajax&modulo=cancelarfila&ajax=true&id_medicion=" + medicion);
});
}
else
{
$('#dialogo_valor_num').modal('show');
}
}
else
{
$('#dialogo_valor_nulo').modal('show');
}
}
//Valida que el valor de una referencia sea correcto si es una meta o límite
function validar_referencia(nombre_ref, value) {
var validado = true;
//El indicador/dato tiene estimación descendente
if (inverso) {
//Estamos grabando el límite
if (nombre_ref.indexOf('mite') !== -1) {
if (value <= meta && meta !== null) {
validado = false;
}
}
//Estamos grabando la meta
if (nombre_ref.indexOf('eta') !== -1) {
if (value >= limite && limite !== null) {
validado = false;
}
}
}
//El indicador/dato tiene estimación ascendente
else {
//Estamos grabando el límite
if (nombre_ref.indexOf('mite') !== -1) {
if (value >= meta && meta !== null) {
validado = false;
}
}
//Estamos grabando la meta
if (nombre_ref.indexOf('eta') !== -1) {
if (value <= limite && limite !== null) {
validado = false;
}
}
}
return validado;
}
//Actualiza los valores globales de la meta y el límite después de ser grabados
function actualizar_estimacion(nombre_ref, value) {
//Hemos grabado el límite
if (nombre_ref.indexOf('mite') !== -1) {
limite = value;
}
//Hemos grabado la meta
if (nombre_ref.indexOf('eta') !== -1) {
meta = value;
}
}
function referencia_cancelar(id, medicion)
{
$('#referencia_' + id).load("index.php?page=medicion_ajax&modulo=cancelarvalorreferencia&ajax=true&id=" + id + "&id_medicion=" + medicion);
}
//Función que pinta nuestra gráfica
function pintaGrafico(chartOptions) {
$(document).ready(function () {
// Añadimos evento al hacer click en el gráfico
chartOptions.chart.events.click = function () {
hs.htmlExpand(document.getElementById(chartOptions.chart.renderTo), {
width: 9999,
height: 9999,
allowWidthReduction: true
}, {
chartOptions: chartOptions
});
};
var chart = new Highcharts.Chart(chartOptions);
});
}
// Crea un nuevo gráfico con un popup de Highslide
var i = 0; //Contador de popups
hs.zIndexCounter = 2000; //z-index del popup
hs.Expander.prototype.onAfterExpand = function () {
if (this.custom.chartOptions) {
var chartOptions = this.custom.chartOptions;
chartOptions.chart.height = 600;
chartOptions.chart.renderTo = $('.highslide-body')[i];
chartOptions.chart.events.click = function () {
};
var hsChart = new Highcharts.Chart(chartOptions);
i++;
}
};
//Actualización del gráfico
$('#tab_med_datos').click(function () {
actualizaGrafica();
});
//Tablas de valores
tablas_valores = $('#tabla_valores').DataTable({
"bPaginate": false,
"bSort": false,
fixedHeader: true,
dom: "<'row'<'col-sm-12'tr>>"
});
//Reajustamos las cabeceras de las datatables al cambiar de pestaña
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
tablas_valores.fixedHeader.adjust();
});
//Reajustamos las cabeceras de las datatables al hacer scroll
$('.table-responsive').on('scroll', function () {
tablas_valores.fixedHeader.adjust();
});
//Validaciones
$('#page-wrapper').on('keyup', '.actualizar_dato', function () {
var actualizar_dato = $(this);
var valor = $(this).val();
valor = valor.replace(',', '.');
if ($.isNumeric(valor) || valor === '---') {
actualizar_dato.css("border-color", "green");
}
else {
actualizar_dato.css("border-color", "red");
}
});
$('#page-wrapper').on('keyup', '.actualizar_etiqueta', function () {
var actualizar_etiqueta = $(this);
var valor = $(this).val();
if (valor.length === 0) {
actualizar_etiqueta.css("border-color", "red");
}
else {
actualizar_etiqueta.css("border-color", "green");
}
});
|
const Query = require('./read');
Query.getRespuestas('862ea389-8344-49a5-b101-6d3376f7f05e')
.then( data => {
console.log(data)
})
|
module.exports.cache = require('./cache')
|
require('dotenv').config();
const compress = require('compression');
const helmet = require('helmet');
const cors = require('cors');
const history = require('connect-history-api-fallback');
const feathers = require('@feathersjs/feathers');
const configuration = require('@feathersjs/configuration');
const express = require('@feathersjs/express');
const socketio = require('@feathersjs/socketio');
const logger = require('./logger');
const middleware = require('./middleware');
const services = require('./services');
const appHooks = require('./app.hooks');
const channels = require('./channels');
const authentication = require('./authentication');
const mongoose = require('./mongoose');
const app = express(feathers());
// Load app configuration
app.configure(configuration());
// Enable security, CORS, compression, history mode for SPA and body parsing
app.use(helmet());
app.use(cors());
app.use(compress());
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
if (process.env.NODE_ENV === 'production') {
app.use(history());
}
// Host the public folder
app.use('/', express.static(app.get('public')));
// Set up Plugins and providers
app.configure(express.rest());
app.configure(socketio());
app.configure(mongoose);
// Configure other middleware (see `middleware/index.js`)
app.configure(middleware);
app.configure(authentication);
// Set up our services (see `services/index.js`)
app.configure(services);
// Set up event channels (see channels.js)
app.configure(channels);
// Configure a middleware for 404s and the error handler
app.use(express.notFound());
app.use(express.errorHandler({ logger }));
app.hooks(appHooks);
module.exports = app;
|
/*
* Copyright 2020 - Transmute Industries Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const walletMnemonic = require('./wallet-mnemonic.json');
const walletKeyPair = require('./wallet-keypair.json');
const walletOperation = require('./wallet-operation.json');
const walletSvipOperation = require('./wallet-svip-operation.json');
module.exports = {
walletMnemonic,
walletKeyPair,
walletOperation,
walletSvipOperation,
};
|
import React from 'react';
import withIconEnhancer from '../HOCs/withIconEnhancer';
export default withIconEnhancer('Circle1', 'circle-1', (props) => (
<svg {...props} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M12 16v-8l-2 2" />
<circle cx="12" cy="12" r="9" />
</svg>
));
|
module.exports = {
twilio: {
accountSid: process.env.TWILIO_ACCOUNT_SID,
apiKey: process.env.TWILIO_API_KEY,
apiSecret: process.env.TWILIO_API_SECRET,
chatService: process.env.TWILIO_CHAT_SERVICE_SID,
outgoingApplicationSid: process.env.TWILIO_TWIML_APP_SID,
incomingAllow: process.env.TWILIO_ALLOW_INCOMING_CALLS === 'true',
},
};
|
function negativePositiveNumbers(arr) {
let newArr = [];
for (let i = 0; i < arr.length; i++) {
if (arr[i] >= 0) {
newArr.push(arr[i]);
} else if (arr[i] < 0) {
newArr.unshift(arr[i]);
}
}
console.log(newArr.join('\n'));
}
negativePositiveNumbers([3, -2, 0, -1]);
|
// Packages
const fs = require('fs');
const Metalsmith = require('metalsmith');
const markdown = require('metalsmith-markdownit');
const layouts = require('metalsmith-layouts');
const permalinks = require('metalsmith-permalinks');
const assets = require('metalsmith-assets');
const dataLoader = require('metalsmith-data-loader');
const watch = require('metalsmith-watch');
const branch = require('metalsmith-branch')
const serve = require('metalsmith-serve');
const redirect = require('metalsmith-redirect');
const webpack = require('metalsmith-webpack2');
const anchor = require('markdown-it-anchor');
const attrs = require('markdown-it-attrs');
const timer = require('metalsmith-timer');
const ignore = require('metalsmith-ignore');
const copy = require('metalsmith-copy');
// Local Plugins
const reduce = require('./plugins/metalsmith-revision').reduce;
const restore = require('./plugins/metalsmith-revision').restore;
const hierarchy = require('./plugins/metalsmith-hierarchy');
const hierarchyRss = require('./plugins/metalsmith-hierarchy-rss');
const headings = require('./plugins/metalsmith-headings');
const algolia = require('./plugins/metalsmith-algolia');
const inPlace = require('./plugins/metalsmith-in-place-dcos');
const includeContent = require('./plugins/metalsmith-include-content-dcos');
const shortcodes = require('./plugins/metalsmith-shortcodes');
const wkhtmltopdfLinkResolver = require('./plugins/metalsmith-wkhtmltopdf-link-resolver');
// Configs
const configData = fs.readFileSync('config.json');
const config = JSON.parse(configData);
const shortcodesConfig = require('./shortcodes');
function splitCommasOrEmptyArray(val) {
return (val && val.length > 0) ? val.split(',') : [];
}
// Environment Variables
const GIT_BRANCH = process.env.GIT_BRANCH;
const ALGOLIA_UPDATE = process.env.ALGOLIA_UPDATE;
const ALGOLIA_PROJECT_ID = process.env.ALGOLIA_PROJECT_ID;
const ALGOLIA_PUBLIC_KEY = process.env.ALGOLIA_PUBLIC_KEY;
const ALGOLIA_PRIVATE_KEY = process.env.ALGOLIA_PRIVATE_KEY;
const ALGOLIA_INDEX = process.env.ALGOLIA_INDEX;
const RENDER_PATH_PATTERN = process.env.RENDER_PATH_PATTERN || process.env.RPP;
const branchDoNotIndex = config[GIT_BRANCH] ? (
config[GIT_BRANCH].DO_NOT_INDEX
) : (
[]
);
const ALGOLIA_SKIP_SECTIONS = branchDoNotIndex ? (
config.always.DO_NOT_INDEX.concat(branchDoNotIndex)
) : (
config.always.DO_NOT_INDEX
);
const branchDoNotBuild = config[GIT_BRANCH] ? (
config[GIT_BRANCH].DO_NOT_BUILD
) : (
config.local.DO_NOT_BUILD
);
const METALSMITH_SKIP_SECTIONS = config.always.DO_NOT_BUILD.concat(branchDoNotBuild);
//
// Errors
//
if (!GIT_BRANCH && process.env.NODE_ENV !== 'development') {
throw new Error('Env var GIT_BRANCH has not been set.');
}
if (ALGOLIA_UPDATE === 'true') {
if (process.env.NODE_ENV === 'pdf') {
throw new Error('Algolia env vars set while build env is pdf');
}
if (!ALGOLIA_PROJECT_ID) {
throw new Error('Env var ALGOLIA_PROJECT_ID has not been set.');
}
if (!ALGOLIA_PUBLIC_KEY) {
throw new Error('Env var ALGOLIA_PUBLIC_KEY has not been set.');
}
if (!ALGOLIA_PRIVATE_KEY) {
throw new Error('Env var ALGOLIA_PRIVATE_KEY has not been set.');
}
if (!ALGOLIA_INDEX) {
throw new Error('Env var ALGOLIA_INDEX has not been set.');
}
}
//
// Metalsmith
//
const MS = Metalsmith(__dirname);
const currentYear = (new Date()).getFullYear();
// Metadata
// These are available in the layouts as js variables
MS.metadata({
url: 'https://docs.mesosphere.com',
siteTitle: 'Mesosphere DC/OS Documentation',
siteDescription: 'Welcome to the DC/OS documentation. The DC/OS documentation ' +
'can help you set up, learn about the system, and get your applications and' +
' workloads running on DC/OS.',
copyright: `© ${currentYear} Mesosphere, Inc. All rights reserved.`,
env: process.env.NODE_ENV,
gitBranch: GIT_BRANCH,
dcosDocsLatest: '1.13',
});
// Source
// Where metalsmith looks for all files
MS.source('./pages');
// Destination
// Where metalsmith will put the output code
MS.destination('./build');
// Don't Clean
// Cleaning removes the destination directory before writing to it
// I imagine cleaning makes watching take a long time, but untested for now
MS.clean(false);
//
// Content Branch Pipeline
//
const CB = branch();
// Start timer
CB.use(timer('CB: Init'));
CB.use(ignore(METALSMITH_SKIP_SECTIONS));
CB.use(timer('CB: Ignore'));
CB.use(copy({
pattern: '**/README.md',
transform: file => file.replace(/README/, 'index'),
move: true,
}));
CB.use(timer('CB: Copy'));
// Load model data from external .json/.yaml files
// For example (in your Front Matter):
// model: path/to/my.yml (access content in my.yml as model.foo.bar)
// Can also specify multiple named models:
// model:
// data1: path/to/my.json (access content in my.json as model.data1.foo.bar)
// data2: path/to/my.yml (access content in my.yml as model.data2.foo.bar)
CB.use(dataLoader({
dataProperty: 'model',
match: '**/*.md',
}));
CB.use(timer('CB: Dataloader'));
// Load raw content via '#include' directives before rendering any mustache or markdown.
// For example (in your content):
// #include path/to/file.tmpl
CB.use(includeContent({
// Style as a C-like include statement. Must be on its own line.
pattern: '^#include ([^ \n]+)$',
match: '**/*.md*',
}));
CB.use(timer('CB: IncludeContent'));
// Process any mustache templating in files.
// For example (in your Front Matter):
// render: mustache
CB.use(inPlace({
renderProperty: 'render',
match: '**/*.md',
}));
CB.use(timer('CB: Mustache'));
// Folder Hierarchy
CB.use(hierarchy({
files: ['.md'],
excerpt: true,
}));
CB.use(timer('CB: Hierarchy'));
// RSS Feed
CB.use(hierarchyRss({
itemOptionsMap: {
title: 'title',
description: 'excerpt',
},
}));
CB.use(timer('CB: Hierarchy RSS'));
// Filter unmodified files
if (process.env.NODE_ENV === 'development') {
CB.use(reduce());
CB.use(timer('CB: Reduce'));
}
//
// Slow Plugins
//
// Shortcodes
CB.use(shortcodes({
files: ['.md'],
shortcodes: shortcodesConfig,
}));
CB.use(timer('CB: Shortcodes'));
// Markdown
CB.use(markdown(
{
smartList: false,
typographer: true,
html: true,
})
.use(anchor, {
permalink: true,
renderPermalink: (slug, opts, state, idx) => {
const linkTokens = [
Object.assign(new state.Token('link_open', 'a', 1), {
attrs: [
['class', opts.permalinkClass],
['href', opts.permalinkHref(slug, state)],
['aria-hidden', 'true'],
],
}),
Object.assign(new state.Token('html_block', '', 0), { content: opts.permalinkSymbol }),
new state.Token('link_close', 'a', -1),
];
state.tokens[idx + 1].children.unshift(...linkTokens);
},
permalinkClass: 'content__anchor',
permalinkSymbol: '<i data-feather="bookmark"></i>',
permalinkBefore: true,
})
.use(attrs),
);
CB.use(timer('CB: Markdown'));
// Headings
CB.use(headings());
CB.use(timer('CB: Headings'));
CB.use(redirect({
'/support': 'https://support.mesosphere.com',
}));
CB.use(timer('CB: Redirects'));
// Permalinks
CB.use(permalinks());
CB.use(timer('CB: Permalinks'));
// Layouts
if (!RENDER_PATH_PATTERN) {
// Default: Render all pages.
CB.use(layouts({
engine: 'pug',
cache: true,
}));
} else {
// Dev optimization: Only render within a specific path (much faster turnaround)
// For example, 'services/beta-cassandra/latest/**'
CB.use(layouts({
engine: 'pug',
pattern: RENDER_PATH_PATTERN,
cache: true,
}));
}
CB.use(timer('CB: Layouts'));
//
// Slow Plugins End
//
// Restore unmodified files
if (process.env.NODE_ENV === 'development') {
CB.use(restore());
CB.use(timer('CB: Reduce'));
}
// The expected pattern format doesn't work with regex
let pathPatternRegex;
if (RENDER_PATH_PATTERN) {
pathPatternRegex = RENDER_PATH_PATTERN.split('/').slice(0, -1).join("\/");
}
// Search Indexing
if (ALGOLIA_UPDATE === 'true') {
CB.use(algolia({
projectId: ALGOLIA_PROJECT_ID,
privateKey: ALGOLIA_PRIVATE_KEY,
index: ALGOLIA_INDEX,
skipSections: ALGOLIA_SKIP_SECTIONS,
renderPathPattern: pathPatternRegex,
}));
CB.use(timer('CB: Algolia'));
}
// Enable watching
// The keys represent the files to watch, the values are the files that will
// be updated. ONLY the files that are being updated will be accessible to
// during the rebuild. We must include everything at this point or the
// templates will not be accessible. Need changes to fix this.
// Can only watch with a RENDER_PATH_PATTERN because there are too many
// files without it.
if (process.env.NODE_ENV === 'development' && RENDER_PATH_PATTERN) {
CB.use(watch({
paths: {
[`pages/${RENDER_PATH_PATTERN}/*`]: '**/*.{md,tmpl}',
'layouts/**/*': '**/*.pug',
},
}));
CB.use(timer('CB: Watch'));
}
// WkhtmltopdfLinkResolver
if (process.env.NODE_ENV === 'pdf') {
CB.use(wkhtmltopdfLinkResolver({
prefix: '/tmp/pdf/build',
}));
CB.use(timer('CB: WkhtmltopdfLinkResolver'));
}
// Serve
if (process.env.NODE_ENV === 'development') {
CB.use(serve({
port: 3000,
}));
CB.use(timer('CB: Webserver'));
}
//
// Assets Branch
//
const AB = branch();
// Start timer
AB.use(timer('AB: Init'));
// Watch
// Can only watch with a RENDER_PATH_PATTERN because there are too many
// files without it.
if (process.env.NODE_ENV === 'development' && RENDER_PATH_PATTERN) {
AB.use(watch({
paths: {
'js/**/*': '**/*.js',
'scss/**/*': '**/*.scss',
},
}));
AB.use(timer('AB: Watch'));
}
// Assets
AB.use(assets({
source: 'assets',
destination: 'assets',
}));
AB.use(timer('AB: Assets'));
// Webpack
AB.use(webpack('./webpack.config.js'));
AB.use(timer('AB: Webpack'));
//
// Metalsmith
//
MS.use(CB);
MS.use(AB);
// Build
MS.build((err, files) => {
if (err) throw err;
});
|
/**
* copy文件和文件夹逻辑
*
* @author bian
* @createDate 2016.8.28
*/
var path = require("path");
var mockPaths = require("./mock-paths");
var chalk = require("chalk");
module.exports = function (Generator) {
Generator.prototype.createProject = function () {
var join = path.join;
this.sourceRoot(join(__dirname,"../templates"));
var template = function (src,dest,data) { // 使用ejs模板创建文件和文件夹
this.log(`copy ${dest} from ${src}`);
this.template(this.templatePath(src),join(process.cwd(),dest),data);
}.bind(this);
var answers = this.props.answers;
var sql = answers.sql;
var version = answers.version;
var author = answers.name;
var project = answers.project;
var date = new Date();
date = `${date.getFullYear()}.${date.getUTCMonth()}.${date.getUTCDay()}`;
var paths = mockPaths.paths;
try{
Object.keys(paths).forEach((name) => {
template(name,paths[name],{
author : author,
version : version,
sql : sql,
project : project,
date : date
});
});
}catch(err){
this.log(err);
}
this.log("file template copy is over");
};
};
|
import { appendForwardSlash } from "../../Source/Cesium.js";
import { Cartesian2 } from "../../Source/Cesium.js";
import { Cartesian3 } from "../../Source/Cesium.js";
import { Cartographic } from "../../Source/Cesium.js";
import { defined } from "../../Source/Cesium.js";
import { GeographicTilingScheme } from "../../Source/Cesium.js";
import { getAbsoluteUri } from "../../Source/Cesium.js";
import { objectToQuery } from "../../Source/Cesium.js";
import { queryToObject } from "../../Source/Cesium.js";
import { Rectangle } from "../../Source/Cesium.js";
import { Request } from "../../Source/Cesium.js";
import { RequestScheduler } from "../../Source/Cesium.js";
import { Resource } from "../../Source/Cesium.js";
import { WebMercatorProjection } from "../../Source/Cesium.js";
import { WebMercatorTilingScheme } from "../../Source/Cesium.js";
import { ArcGisMapServerImageryProvider } from "../../Source/Cesium.js";
import { DiscardMissingTileImagePolicy } from "../../Source/Cesium.js";
import { Imagery } from "../../Source/Cesium.js";
import { ImageryLayer } from "../../Source/Cesium.js";
import { ImageryLayerFeatureInfo } from "../../Source/Cesium.js";
import { ImageryProvider } from "../../Source/Cesium.js";
import { ImageryState } from "../../Source/Cesium.js";
import pollToPromise from "../pollToPromise.js";
import { Uri } from "../../Source/Cesium.js";
describe("Scene/ArcGisMapServerImageryProvider", function () {
var supportsImageBitmapOptions;
beforeAll(function () {
// This suite spies on requests. Resource.supportsImageBitmapOptions needs to make a request to a data URI.
// We run it here to avoid interfering with the tests.
return Resource.supportsImageBitmapOptions().then(function (result) {
supportsImageBitmapOptions = result;
});
});
beforeEach(function () {
RequestScheduler.clearForSpecs();
});
afterEach(function () {
Resource._Implementations.loadAndExecuteScript =
Resource._DefaultImplementations.loadAndExecuteScript;
Resource._Implementations.createImage =
Resource._DefaultImplementations.createImage;
Resource._Implementations.loadWithXhr =
Resource._DefaultImplementations.loadWithXhr;
});
function expectCorrectUrl(
expectedBaseUrl,
actualUrl,
functionName,
withProxy,
token
) {
var uri = new Uri(actualUrl);
if (withProxy) {
uri = new Uri(decodeURIComponent(uri.query));
}
var params = queryToObject(uri.query);
var uriWithoutQuery = new Uri(uri);
uriWithoutQuery.query = "";
expect(uriWithoutQuery.toString()).toEqual(
appendForwardSlash(expectedBaseUrl)
);
var expectedParams = {
callback: functionName,
f: "json",
};
if (defined(token)) {
expectedParams.token = token;
}
expect(params).toEqual(expectedParams);
}
function stubJSONPCall(baseUrl, result, withProxy, token) {
Resource._Implementations.loadAndExecuteScript = function (
url,
functionName
) {
expectCorrectUrl(baseUrl, url, functionName, withProxy, token);
setTimeout(function () {
window[functionName](result);
}, 1);
};
}
it("conforms to ImageryProvider interface", function () {
expect(ArcGisMapServerImageryProvider).toConformToInterface(
ImageryProvider
);
});
it("constructor throws if url is not specified", function () {
expect(function () {
return new ArcGisMapServerImageryProvider({});
}).toThrowDeveloperError();
});
var webMercatorResult = {
currentVersion: 10.01,
copyrightText: "Test copyright text",
tileInfo: {
rows: 128,
cols: 256,
origin: {
x: -20037508.342787,
y: 20037508.342787,
},
spatialReference: {
wkid: 102100,
},
lods: [
{
level: 0,
resolution: 156543.033928,
scale: 591657527.591555,
},
{
level: 1,
resolution: 78271.5169639999,
scale: 295828763.795777,
},
{
level: 2,
resolution: 39135.7584820001,
scale: 147914381.897889,
},
],
},
};
it("resolves readyPromise", function () {
var baseUrl = "//tiledArcGisMapServer.invalid";
stubJSONPCall(baseUrl, webMercatorResult);
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
return provider.readyPromise.then(function (result) {
expect(result).toBe(true);
expect(provider.ready).toBe(true);
});
});
it("resolves readyPromise with Resource", function () {
var baseUrl = "//tiledArcGisMapServer.invalid";
stubJSONPCall(baseUrl, webMercatorResult);
var resource = new Resource({
url: baseUrl,
});
var provider = new ArcGisMapServerImageryProvider({
url: resource,
});
return provider.readyPromise.then(function (result) {
expect(result).toBe(true);
expect(provider.ready).toBe(true);
});
});
it("rejects readyPromise on error", function () {
var baseUrl = "//tiledArcGisMapServer.invalid";
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
return provider.readyPromise
.then(function () {
fail("should not resolve");
})
.otherwise(function (e) {
expect(e.message).toContain(baseUrl);
expect(provider.ready).toBe(false);
});
});
it("supports tiled servers in web mercator projection", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
stubJSONPCall(baseUrl, webMercatorResult);
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
expect(provider.url).toEqual(baseUrl);
return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider.tileWidth).toEqual(128);
expect(provider.tileHeight).toEqual(256);
expect(provider.maximumLevel).toEqual(2);
expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme);
expect(provider.credit).toBeDefined();
expect(provider.tileDiscardPolicy).toBeInstanceOf(
DiscardMissingTileImagePolicy
);
expect(provider.rectangle).toEqual(
new WebMercatorTilingScheme().rectangle
);
expect(provider.usingPrecachedTiles).toEqual(true);
expect(provider.hasAlphaChannel).toBeDefined();
Resource._Implementations.createImage = function (
request,
crossOrigin,
deferred
) {
var url = request.url;
if (/^blob:/.test(url)) {
Resource._DefaultImplementations.createImage(
request,
crossOrigin,
deferred
);
} else {
expect(url).toEqual(getAbsoluteUri(baseUrl + "tile/0/0/0"));
// Just return any old image.
Resource._DefaultImplementations.createImage(
new Request({ url: "Data/Images/Red16x16.png" }),
crossOrigin,
deferred
);
}
};
Resource._Implementations.loadWithXhr = function (
url,
responseType,
method,
data,
headers,
deferred,
overrideMimeType
) {
expect(url).toEqual(getAbsoluteUri(baseUrl + "tile/0/0/0"));
// Just return any old image.
Resource._DefaultImplementations.loadWithXhr(
"Data/Images/Red16x16.png",
responseType,
method,
data,
headers,
deferred
);
};
return provider.requestImage(0, 0, 0).then(function (image) {
expect(image).toBeImageOrImageBitmap();
});
});
});
var geographicResult = {
currentVersion: 10.01,
copyrightText: "Test copyright text",
tileInfo: {
rows: 128,
cols: 256,
origin: {
x: -180,
y: 90,
},
spatialReference: {
wkid: 4326,
},
lods: [
{
level: 0,
resolution: 0.3515625,
scale: 147748799.285417,
},
{
level: 1,
resolution: 0.17578125,
scale: 73874399.6427087,
},
{
level: 2,
resolution: 0.087890625,
scale: 36937199.8213544,
},
],
},
};
it("supports tiled servers in geographic projection", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
stubJSONPCall(baseUrl, geographicResult);
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
expect(provider.url).toEqual(baseUrl);
return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider.tileWidth).toEqual(128);
expect(provider.tileHeight).toEqual(256);
expect(provider.maximumLevel).toEqual(2);
expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme);
expect(provider.credit).toBeDefined();
expect(provider.tileDiscardPolicy).toBeInstanceOf(
DiscardMissingTileImagePolicy
);
expect(provider.rectangle).toEqual(
new GeographicTilingScheme().rectangle
);
expect(provider.usingPrecachedTiles).toEqual(true);
Resource._Implementations.createImage = function (
request,
crossOrigin,
deferred
) {
var url = request.url;
if (/^blob:/.test(url) || supportsImageBitmapOptions) {
// If ImageBitmap is supported, we expect a loadWithXhr request to fetch it as a blob.
Resource._DefaultImplementations.createImage(
request,
crossOrigin,
deferred,
true,
false,
true
);
} else {
expect(url).toEqual(getAbsoluteUri(baseUrl + "tile/0/0/0"));
// Just return any old image.
Resource._DefaultImplementations.createImage(
new Request({ url: "Data/Images/Red16x16.png" }),
crossOrigin,
deferred
);
}
};
Resource._Implementations.loadWithXhr = function (
url,
responseType,
method,
data,
headers,
deferred,
overrideMimeType
) {
expect(url).toEqual(getAbsoluteUri(baseUrl + "tile/0/0/0"));
// Just return any old image.
Resource._DefaultImplementations.loadWithXhr(
"Data/Images/Red16x16.png",
responseType,
method,
data,
headers,
deferred
);
};
return provider.requestImage(0, 0, 0).then(function (image) {
expect(image).toBeImageOrImageBitmap();
});
});
});
it("supports non-tiled servers", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
stubJSONPCall(baseUrl, {
currentVersion: 10.01,
copyrightText: "Test copyright text",
});
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
expect(provider.url).toEqual(baseUrl);
return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider.tileWidth).toEqual(256);
expect(provider.tileHeight).toEqual(256);
expect(provider.maximumLevel).toBeUndefined();
expect(provider.tilingScheme).toBeInstanceOf(GeographicTilingScheme);
expect(provider.credit).toBeDefined();
expect(provider.tileDiscardPolicy).toBeUndefined();
expect(provider.rectangle).toEqual(
new GeographicTilingScheme().rectangle
);
expect(provider.usingPrecachedTiles).toEqual(false);
expect(provider.enablePickFeatures).toBe(true);
Resource._Implementations.createImage = function (
request,
crossOrigin,
deferred
) {
var uri = new Uri(request.url);
var params = queryToObject(uri.query);
var uriWithoutQuery = new Uri(uri);
uriWithoutQuery.query = "";
expect(uriWithoutQuery.toString()).toEqual(
getAbsoluteUri(baseUrl + "export")
);
expect(params.f).toEqual("image");
expect(params.bboxSR).toEqual("4326");
expect(params.imageSR).toEqual("4326");
expect(params.format).toEqual("png32");
expect(params.transparent).toEqual("true");
expect(params.size).toEqual("256,256");
// Just return any old image.
Resource._DefaultImplementations.createImage(
new Request({ url: "Data/Images/Red16x16.png" }),
crossOrigin,
deferred
);
};
return provider.requestImage(0, 0, 0).then(function (image) {
expect(image).toBeImageOrImageBitmap();
});
});
});
it("supports non-tiled servers with various constructor parameters", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
var token = "5e(u|2!7Y";
stubJSONPCall(
baseUrl,
{
currentVersion: 10.01,
copyrightText: "Test copyright text",
},
undefined,
token
);
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
token: token,
tileWidth: 128,
tileHeight: 512,
tilingScheme: new WebMercatorTilingScheme(),
rectangle: Rectangle.fromDegrees(1.0, 2.0, 3.0, 4.0),
layers: "foo,bar",
enablePickFeatures: false,
});
expect(provider.url).toEqual(baseUrl);
return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider.tileWidth).toEqual(128);
expect(provider.tileHeight).toEqual(512);
expect(provider.maximumLevel).toBeUndefined();
expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme);
expect(provider.credit).toBeDefined();
expect(provider.tileDiscardPolicy).toBeUndefined();
expect(provider.rectangle).toEqual(
Rectangle.fromDegrees(1.0, 2.0, 3.0, 4.0)
);
expect(provider.usingPrecachedTiles).toBe(false);
expect(provider.enablePickFeatures).toBe(false);
expect(provider.layers).toEqual("foo,bar");
Resource._Implementations.createImage = function (
request,
crossOrigin,
deferred
) {
var uri = new Uri(request.url);
var params = queryToObject(uri.query);
var uriWithoutQuery = new Uri(uri);
uriWithoutQuery.query = "";
expect(uriWithoutQuery.toString()).toEqual(
getAbsoluteUri(baseUrl + "export")
);
expect(params.f).toEqual("image");
expect(params.bboxSR).toEqual("3857");
expect(params.imageSR).toEqual("3857");
expect(params.format).toEqual("png32");
expect(params.transparent).toEqual("true");
expect(params.size).toEqual("128,512");
expect(params.layers).toEqual("show:foo,bar");
expect(params.token).toEqual(token);
// Just return any old image.
Resource._DefaultImplementations.createImage(
new Request({ url: "Data/Images/Red16x16.png" }),
crossOrigin,
deferred
);
};
return provider.requestImage(0, 0, 0).then(function (image) {
expect(image).toBeImageOrImageBitmap();
});
});
});
it("includes security token in requests if one is specified", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/",
token = "5e(u|2!7Y";
stubJSONPCall(baseUrl, webMercatorResult, false, token);
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
token: token,
});
var expectedTileUrl = getAbsoluteUri(
baseUrl +
"tile/0/0/0?" +
objectToQuery({
token: token,
})
);
expect(provider.url).toEqual(baseUrl);
expect(provider.token).toEqual(token);
return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider.tileWidth).toEqual(128);
expect(provider.tileHeight).toEqual(256);
expect(provider.maximumLevel).toEqual(2);
expect(provider.tilingScheme).toBeInstanceOf(WebMercatorTilingScheme);
expect(provider.credit).toBeDefined();
expect(provider.tileDiscardPolicy).toBeInstanceOf(
DiscardMissingTileImagePolicy
);
expect(provider.rectangle).toEqual(
new WebMercatorTilingScheme().rectangle
);
expect(provider.usingPrecachedTiles).toEqual(true);
expect(provider.hasAlphaChannel).toBeDefined();
Resource._Implementations.createImage = function (
request,
crossOrigin,
deferred
) {
var url = request.url;
if (/^blob:/.test(url) || supportsImageBitmapOptions) {
// If ImageBitmap is supported, we expect a loadWithXhr request to fetch it as a blob.
Resource._DefaultImplementations.createImage(
request,
crossOrigin,
deferred,
true,
false,
true
);
} else {
expect(url).toEqual(expectedTileUrl);
// Just return any old image.
Resource._DefaultImplementations.createImage(
new Request({ url: "Data/Images/Red16x16.png" }),
crossOrigin,
deferred
);
}
};
Resource._Implementations.loadWithXhr = function (
url,
responseType,
method,
data,
headers,
deferred,
overrideMimeType
) {
expect(url).toEqual(expectedTileUrl);
// Just return any old image.
Resource._DefaultImplementations.loadWithXhr(
"Data/Images/Red16x16.png",
responseType,
method,
data,
headers,
deferred
);
};
return provider.requestImage(0, 0, 0).then(function (image) {
expect(image).toBeImageOrImageBitmap();
});
});
});
it("raises error on unsupported WKID", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
var unsupportedWKIDResult = {
currentVersion: 10.01,
copyrightText: "Test copyright text",
tileInfo: {
rows: 128,
cols: 256,
origin: {
x: -180,
y: 90,
},
spatialReference: {
wkid: 1234,
},
lods: [
{
level: 0,
resolution: 0.3515625,
scale: 147748799.285417,
},
{
level: 1,
resolution: 0.17578125,
scale: 73874399.6427087,
},
{
level: 2,
resolution: 0.087890625,
scale: 36937199.8213544,
},
],
},
};
stubJSONPCall(baseUrl, unsupportedWKIDResult);
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
expect(provider.url).toEqual(baseUrl);
var tries = 0;
provider.errorEvent.addEventListener(function (error) {
expect(error.message.indexOf("WKID") >= 0).toEqual(true);
++tries;
if (tries < 3) {
error.retry = true;
}
});
return pollToPromise(function () {
return provider.ready || tries >= 3;
}).then(function () {
expect(provider.ready).toEqual(false);
expect(tries).toEqual(3);
});
});
it("raises error on invalid URL", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
expect(provider.url).toEqual(baseUrl);
var errorEventRaised = false;
provider.errorEvent.addEventListener(function (error) {
expect(error.message.indexOf(baseUrl) >= 0).toEqual(true);
errorEventRaised = true;
});
return pollToPromise(function () {
return provider.ready || errorEventRaised;
}).then(function () {
expect(provider.ready).toEqual(false);
expect(errorEventRaised).toEqual(true);
});
});
it("raises error event when image cannot be loaded", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
stubJSONPCall(baseUrl, {
currentVersion: 10.01,
copyrightText: "Test copyright text",
});
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
var layer = new ImageryLayer(provider);
var tries = 0;
provider.errorEvent.addEventListener(function (error) {
expect(error.timesRetried).toEqual(tries);
++tries;
if (tries < 3) {
error.retry = true;
}
setTimeout(function () {
RequestScheduler.update();
}, 1);
});
Resource._Implementations.createImage = function (
request,
crossOrigin,
deferred
) {
if (tries === 2) {
// Succeed after 2 tries
Resource._DefaultImplementations.createImage(
new Request({ url: "Data/Images/Red16x16.png" }),
crossOrigin,
deferred
);
} else {
// fail
setTimeout(function () {
deferred.reject();
}, 1);
}
};
return pollToPromise(function () {
return provider.ready;
}).then(function () {
var imagery = new Imagery(layer, 0, 0, 0);
imagery.addReference();
layer._requestImagery(imagery);
RequestScheduler.update();
return pollToPromise(function () {
return imagery.state === ImageryState.RECEIVED;
}).then(function () {
expect(imagery.image).toBeImageOrImageBitmap();
expect(tries).toEqual(2);
imagery.releaseReference();
});
});
});
it("honors fullExtent of tiled server with web mercator projection", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
var webMercatorFullExtentResult = {
currentVersion: 10.01,
copyrightText: "Test copyright text",
tileInfo: {
rows: 128,
cols: 256,
origin: {
x: -20037508.342787,
y: 20037508.342787,
},
spatialReference: {
wkid: 102100,
},
lods: [
{
level: 0,
resolution: 156543.033928,
scale: 591657527.591555,
},
{
level: 1,
resolution: 78271.5169639999,
scale: 295828763.795777,
},
{
level: 2,
resolution: 39135.7584820001,
scale: 147914381.897889,
},
],
},
fullExtent: {
xmin: 1.1148026611962173e7,
ymin: -6443518.758206591,
xmax: 1.8830976498143446e7,
ymax: -265936.19697360107,
spatialReference: {
wkid: 102100,
},
},
};
stubJSONPCall(baseUrl, webMercatorFullExtentResult);
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
expect(provider.url).toEqual(baseUrl);
return pollToPromise(function () {
return provider.ready;
}).then(function () {
var projection = new WebMercatorProjection();
var sw = projection.unproject(
new Cartesian2(1.1148026611962173e7, -6443518.758206591)
);
var ne = projection.unproject(
new Cartesian2(1.8830976498143446e7, -265936.19697360107)
);
var rectangle = new Rectangle(
sw.longitude,
sw.latitude,
ne.longitude,
ne.latitude
);
expect(provider.rectangle).toEqual(rectangle);
});
});
it("constrains extent to the tiling scheme's rectangle", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
var webMercatorOutsideBoundsResult = {
currentVersion: 10.01,
copyrightText: "Test copyright text",
tileInfo: {
rows: 128,
cols: 256,
origin: {
x: -20037508.342787,
y: 20037508.342787,
},
spatialReference: {
wkid: 102100,
},
lods: [
{
level: 0,
resolution: 156543.033928,
scale: 591657527.591555,
},
{
level: 1,
resolution: 78271.5169639999,
scale: 295828763.795777,
},
{
level: 2,
resolution: 39135.7584820001,
scale: 147914381.897889,
},
],
},
fullExtent: {
xmin: -2.0037507067161843e7,
ymin: -1.4745615008589065e7,
xmax: 2.0037507067161843e7,
ymax: 3.0240971958386205e7,
spatialReference: {
wkid: 102100,
},
},
};
stubJSONPCall(baseUrl, webMercatorOutsideBoundsResult);
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
expect(provider.url).toEqual(baseUrl);
return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider.rectangle.west).toBeGreaterThanOrEqualTo(-Math.PI);
expect(provider.rectangle.east).toBeLessThanOrEqualTo(Math.PI);
expect(provider.rectangle.south).toBeGreaterThanOrEqualTo(
-WebMercatorProjection.MaximumLatitude
);
expect(provider.rectangle.north).toBeLessThanOrEqualTo(
WebMercatorProjection.MaximumLatitude
);
});
});
it("honors fullExtent of tiled server with geographic projection", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
var geographicFullExtentResult = {
currentVersion: 10.01,
copyrightText: "Test copyright text",
tileInfo: {
rows: 128,
cols: 256,
origin: {
x: -20037508.342787,
y: 20037508.342787,
},
spatialReference: {
wkid: 102100,
},
lods: [
{
level: 0,
resolution: 156543.033928,
scale: 591657527.591555,
},
{
level: 1,
resolution: 78271.5169639999,
scale: 295828763.795777,
},
{
level: 2,
resolution: 39135.7584820001,
scale: 147914381.897889,
},
],
},
fullExtent: {
xmin: -123.4,
ymin: -23.2,
xmax: 100.7,
ymax: 45.2,
spatialReference: {
wkid: 4326,
},
},
};
stubJSONPCall(baseUrl, geographicFullExtentResult);
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
expect(provider.url).toEqual(baseUrl);
return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider.rectangle).toEqual(
Rectangle.fromDegrees(-123.4, -23.2, 100.7, 45.2)
);
});
});
it("raises error if the spatialReference of the fullExtent is unknown", function () {
var baseUrl = "//tiledArcGisMapServer.invalid/";
var unknownSpatialReferenceResult = {
currentVersion: 10.01,
copyrightText: "Test copyright text",
tileInfo: {
rows: 128,
cols: 256,
origin: {
x: -180,
y: 90,
},
spatialReference: {
wkid: 1234,
},
lods: [
{
level: 0,
resolution: 0.3515625,
scale: 147748799.285417,
},
{
level: 1,
resolution: 0.17578125,
scale: 73874399.6427087,
},
{
level: 2,
resolution: 0.087890625,
scale: 36937199.8213544,
},
],
},
fullExtent: {
xmin: -123.4,
ymin: -23.2,
xmax: 100.7,
ymax: 45.2,
spatialReference: {
wkid: 1234,
},
},
};
stubJSONPCall(baseUrl, unknownSpatialReferenceResult);
var provider = new ArcGisMapServerImageryProvider({
url: baseUrl,
});
expect(provider.url).toEqual(baseUrl);
var tries = 0;
provider.errorEvent.addEventListener(function (error) {
expect(error.message.indexOf("WKID") >= 0).toEqual(true);
++tries;
if (tries < 3) {
error.retry = true;
}
});
return pollToPromise(function () {
return provider.ready || tries >= 3;
}).then(function () {
expect(provider.ready).toEqual(false);
expect(tries).toEqual(3);
});
});
describe("pickFeatures", function () {
it("works with WebMercator geometry", function () {
var provider = new ArcGisMapServerImageryProvider({
url: "made/up/map/server",
usePreCachedTilesIfAvailable: false,
});
Resource._Implementations.loadWithXhr = function (
url,
responseType,
method,
data,
headers,
deferred,
overrideMimeType
) {
expect(url).toContain("identify");
Resource._DefaultImplementations.loadWithXhr(
"Data/ArcGIS/identify-WebMercator.json",
responseType,
method,
data,
headers,
deferred,
overrideMimeType
);
};
return pollToPromise(function () {
return provider.ready;
}).then(function () {
return provider
.pickFeatures(0, 0, 0, 0.5, 0.5)
.then(function (pickResult) {
expect(pickResult.length).toBe(1);
var firstResult = pickResult[0];
expect(firstResult).toBeInstanceOf(ImageryLayerFeatureInfo);
expect(firstResult.description).toContain("Hummock Grasses");
expect(firstResult.position).toEqual(
new WebMercatorProjection().unproject(
new Cartesian3(1.481682457042425e7, -2710890.117898505)
)
);
});
});
});
it("works with Geographic geometry", function () {
var provider = new ArcGisMapServerImageryProvider({
url: "made/up/map/server",
usePreCachedTilesIfAvailable: false,
});
Resource._Implementations.loadWithXhr = function (
url,
responseType,
method,
data,
headers,
deferred,
overrideMimeType
) {
expect(url).toContain("identify");
Resource._DefaultImplementations.loadWithXhr(
"Data/ArcGIS/identify-Geographic.json",
responseType,
method,
data,
headers,
deferred,
overrideMimeType
);
};
return pollToPromise(function () {
return provider.ready;
}).then(function () {
return provider
.pickFeatures(0, 0, 0, 0.5, 0.5)
.then(function (pickResult) {
expect(pickResult.length).toBe(1);
var firstResult = pickResult[0];
expect(firstResult).toBeInstanceOf(ImageryLayerFeatureInfo);
expect(firstResult.description).toContain("Hummock Grasses");
expect(firstResult.position).toEqual(
Cartographic.fromDegrees(123.45, -34.2)
);
});
});
});
it("returns undefined if enablePickFeatures is false", function () {
var provider = new ArcGisMapServerImageryProvider({
url: "made/up/map/server",
usePreCachedTilesIfAvailable: false,
enablePickFeatures: false,
});
return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider.pickFeatures(0, 0, 0, 0.5, 0.5)).toBeUndefined();
});
});
it("returns undefined if enablePickFeatures is dynamically set to false", function () {
var provider = new ArcGisMapServerImageryProvider({
url: "made/up/map/server",
usePreCachedTilesIfAvailable: false,
enablePickFeatures: true,
});
provider.enablePickFeatures = false;
return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider.pickFeatures(0, 0, 0, 0.5, 0.5)).toBeUndefined();
});
});
it("does not return undefined if enablePickFeatures is dynamically set to true", function () {
var provider = new ArcGisMapServerImageryProvider({
url: "made/up/map/server",
usePreCachedTilesIfAvailable: false,
enablePickFeatures: false,
});
provider.enablePickFeatures = true;
return pollToPromise(function () {
return provider.ready;
}).then(function () {
expect(provider.pickFeatures(0, 0, 0, 0.5, 0.5)).not.toBeUndefined();
});
});
it("picks from individual layers", function () {
var provider = new ArcGisMapServerImageryProvider({
url: "made/up/map/server",
usePreCachedTilesIfAvailable: false,
layers: "someLayer,anotherLayerYay",
});
Resource._Implementations.loadWithXhr = function (
url,
responseType,
method,
data,
headers,
deferred,
overrideMimeType
) {
var uri = new Uri(url);
var query = queryToObject(uri.getQuery());
expect(query.layers).toContain("visible:someLayer,anotherLayerYay");
Resource._DefaultImplementations.loadWithXhr(
"Data/ArcGIS/identify-WebMercator.json",
responseType,
method,
data,
headers,
deferred,
overrideMimeType
);
};
return pollToPromise(function () {
return provider.ready;
}).then(function () {
return provider
.pickFeatures(0, 0, 0, 0.5, 0.5)
.then(function (pickResult) {
expect(pickResult.length).toBe(1);
});
});
});
});
});
|
import { mustBeInteger } from '../checks/mustBeInteger';
/**
* Computes the number of elements represented by the attribute values.
* @hidden
*/
export function computeCount(attribs, aNames) {
var aNamesLen = aNames.length;
// TODO: We currently return after computing the count for the first aName, but we should
// perform a consistency check.
for (var a = 0; a < aNamesLen; a++) {
var aName = aNames[a];
var attrib = attribs[aName];
var vLength = attrib.values.length;
var size = mustBeInteger('size', attrib.size);
return vLength / size;
}
return 0;
}
|
'use strict';
var _curry3 = require('./internal/_curry3');
var is = require('./is');
/**
* Returns `true` if the specified object property is of the given type;
* `false` otherwise.
*
* @func
* @memberOf R
* @since v0.16.0
* @category Type
* @sig Type -> String -> Object -> Boolean
* @param {Function} type
* @param {String} name
* @param {*} obj
* @return {Boolean}
* @see R.is, R.propSatisfies
* @example
*
* R.propIs(Number, 'x', {x: 1, y: 2}); //=> true
* R.propIs(Number, 'x', {x: 'foo'}); //=> false
* R.propIs(Number, 'x', {}); //=> false
*/
var propIs = _curry3(function propIs(type, name, obj) {
return is(type, obj[name]);
});
module.exports = propIs;
|
// @flow
import * as Types from '../../../../constants/types/chat2'
import TextMessage from '.'
import {mapProps} from '../../../../util/container'
type Props = {|
isEditing: boolean,
message: Types.MessageText,
|}
export default mapProps((props: Props) => ({
isEditing: props.isEditing,
mentionsAt: props.message.mentionsAt,
mentionsChannel: props.message.mentionsChannel,
mentionsChannelName: props.message.mentionsChannelName,
text: props.message.text.stringValue() /* + ' ordinal:' + Types.ordinalToNumber(props.message.ordinal) + ' id: ' + props.message.id */,
type: props.message.errorReason ? 'error' : props.message.submitState === null ? 'sent' : 'pending',
}))(TextMessage)
|
import React, { useContext } from 'react';
import Navbar from 'react-bootstrap/Navbar';
import Nav from 'react-bootstrap/Nav';
import Image from 'react-bootstrap/Image';
import { Link, useLocation } from 'react-router-dom';
import UserContext from '../../../context/UserContext';
import './public.css';
import Logo from '../../../assets/Logoheader.png';
/** Public layout's header */
const Header = () => {
const { user } = useContext(UserContext);
const location = useLocation();
const isActive = (path) => (location.pathname === path ? 'activeLink' : '');
return (
<Navbar sticky='top' className='publicHeader' collapseOnSelect expand='lg'>
<Navbar.Toggle aria-controls="responsive-navbar-nav" />
<Navbar.Brand as={Link} to='/'><Image src={Logo} alt='Daily Recipe Logo' /></Navbar.Brand>
<Navbar.Collapse id="navbar">
<Nav>
{user && <Nav.Link as={Link} eventKey='1' to='/user/thisWeek' className={isActive('/user/thisWeek')}>This Week</Nav.Link>}
{user && <Nav.Link as={Link} eventKey='2' to='/user/upcoming' className={isActive('/user/upcoming')}>Upcoming</Nav.Link>}
<Nav.Link as={Link} eventKey='3' to='/menu' className={isActive('/menu')}>Explore Menu</Nav.Link>
<Nav.Link as={Link} eventKey='4' to='/pricing' className={isActive('/pricing')}>Pricing</Nav.Link>
{user ? (
<div className='d-md-flex ml-md-auto'>
<Nav.Link as={Link} eventKey='5' to='/user/profile' className={isActive('/user/profile')}>My Profile</Nav.Link>
<Nav.Link as={Link} eventKey='6' to='/logout' className={isActive('/logout')}>Logout</Nav.Link>
</div>
) : (
<div className='d-md-flex ml-md-auto'>
<Nav.Link as={Link} eventKey='7' to='/signin' className={isActive('/signin')}>Sign Up</Nav.Link>
<Nav.Link as={Link} eventKey='8' to='/login' className={isActive('/login')}>Choose Your Meal Kit</Nav.Link>
</div>
)}
</Nav>
</Navbar.Collapse>
</Navbar>
);
};
export default Header;
|
import {AmbientLight,
Box3,
BoxGeometry,
Clock,
Color,
DirectionalLight,
DoubleSide,
FlatShading,
Fog,
FogExp2,
FontLoader,
GridHelper,
HemisphereLight,
IcosahedronBufferGeometry,
IcosahedronGeometry,
LinearFilter,
LoadingManager,
Math as ThreeMath,
Mesh,
MeshBasicMaterial,
MeshDepthMaterial,
MeshLambertMaterial,
MeshStandardMaterial,
MeshPhongMaterial,
Object3D,
OrthographicCamera,
OctahedronBufferGeometry,
OctahedronGeometry,
PCFSoftShadowMap,
PerspectiveCamera,
PlaneBufferGeometry,
PlaneGeometry,
PointLight,
RepeatWrapping,
RGBFormat,
RGBAFormat,
Scene,
ShaderMaterial,
SmoothShading,
SphereBufferGeometry,
SphereGeometry,
Spherical,
SpotLight,
TextGeometry,
TextureLoader,
UniformsUtils,
Vector2,
Vector3,
WebGLRenderer,
WebGLRenderTarget } from 'three'
import {BloomPass,
ClearPass,
DepthPass,
DotScreenPass,
EffectComposer,
FilmPass,
GlitchPass,
GodRaysPass,
PixelationPass,
RenderPass,
SavePass,
ShaderPass,
SMAAPass,
TexturePass} from 'postprocessing'
import {scaleLinear} from 'd3-scale'
import fontLoader from './lib/font-loader'
import objLoader from './lib/obj-loader'
import ShaderExtras from './lib/shader-extras'
import OrbitControls from './lib/orbit-controls'
import TextSprite from './lib/text-sprite'
import BirdGeometry from './lib/bird-geometry'
import GPUComputationRenderer from './lib/gpu-computation-renderer'
import SkyΣ from './shader/sky'
import BirdΣ from './shader/birds'
import initGui from './drei/gui'
let defaultConfig = {particles: { exponent: 3,
bounds: 1200 },
camera: { lookAtSun: false,
radius: 800,
fov: 75 },
sky: { turbidity: [10, 1, 20, 0.1],
rayleigh: [1, 0, 4, 0.001],
mieCoefficient: [0.02, 0, 0.1, 0.001],
mieDirectionalG: [0.8, 0, 1, 0.001],
luminance: [1, 0, 2, 0.001],
// 0.5127441406250001 is where ths sun disk appears for the first time
// inclination: [0.5127, 0.2, 0.515, 0.0001], // elevation / inclination
inclination: [0.47, 0.2, 0.515, 0.0001], // elevation / inclination
azimuth: [0.25, 0, 1, 0.0001, false], // Facing front,
distance: [2000, false],
sun: [true, false] },
birds: { seperation: [20.0, 0, 100, 1],
alignment: [20.0, 0, 100, 0.001],
cohesion: [20.0, 0, 100, 0.025],
freedom: [0.75, false] } }
// todo: put these somewhere sensible
let DEBUG = true,
dimensions = { width: window.innerWidth,
height: window.innerHeight},
resolution = { width: 1024,
height: 1024},
renderTargetParameters = { minFilter: LinearFilter,
magFilter: LinearFilter,
format: RGBAFormat,
stencilBufer: true },
lightIntensity = 1.0,
mouseX = 0,
mouseY = 0,
windowHalfX = dimensions.width / 2,
windowHalfY = dimensions.height / 2
function _degrees(δ) {return ThreeMath.DEG2RAD * δ}
function _rad(δ) {return ThreeMath.RAD2DEG * δ}
function _sphericalToCartesian(spherical) {
let x = spherical.radius * Math.sin(spherical.theta) * Math.cos(-spherical.phi),
y = spherical.radius * Math.sin(spherical.theta) * Math.sin(-spherical.phi),
z = spherical.radius * Math.cos(spherical.theta)
return new Vector3(x, y, z) }
function _fillPositionTexture( texture, bounds ) {
function _random() {
let o = (Math.random() < 0.5) ? 0 : bounds,
p = Math.random() * bounds
if(o === 0) return o - p
else return o + p }
let theArray = texture.image.data
for ( var k = 0; k < theArray.length; k += 4 ) {
let x = _random(),
y = _random(),
// birds appear from the distance
z = -bounds - Math.random() * bounds
theArray[ k + 0 ] = x
theArray[ k + 1 ] = y
theArray[ k + 2 ] = z
theArray[ k + 3 ] = 1 }}
function _fillVelocityTexture( texture ) {
var theArray = texture.image.data;
for ( var k = 0, kl = theArray.length; k < kl; k += 4 ) {
var x = Math.random() - 0.5
var y = Math.random() - 0.5
var z = Math.random() - 0.5
theArray[ k + 0 ] = x * 10
theArray[ k + 1 ] = y * 10
theArray[ k + 2 ] = z * 10
theArray[ k + 3 ] = 1 }}
function _initComputeRenderer(renderer, computeTextureSize, bounds) {
let gpuCompute = new GPUComputationRenderer(
computeTextureSize,
computeTextureSize,
renderer ),
dtPosition = gpuCompute.createTexture(),
dtVelocity = gpuCompute.createTexture()
_fillPositionTexture( dtPosition, bounds )
_fillVelocityTexture( dtVelocity )
let velocityVariable = gpuCompute.addVariable( 'textureVelocity',
BirdΣ.velocity, dtVelocity ),
positionVariable = gpuCompute.addVariable( 'texturePosition',
BirdΣ.position, dtPosition )
gpuCompute.setVariableDependencies( velocityVariable, [ positionVariable, velocityVariable ] )
gpuCompute.setVariableDependencies( positionVariable, [ positionVariable, velocityVariable ] )
let positionUniforms = positionVariable.material.uniforms,
velocityUniforms = velocityVariable.material.uniforms
positionUniforms.time = { value: 0.0 }
positionUniforms.delta = { value: 0.0 }
velocityUniforms.time = { value: 1.0 }
velocityUniforms.delta = { value: 0.0 }
velocityUniforms.testing = { value: 1.0 }
velocityUniforms.seperationDistance = { value: 1.0 }
velocityUniforms.alignmentDistance = { value: 1.0 }
velocityUniforms.cohesionDistance = { value: 1.0 }
velocityUniforms.freedomFactor = { value: 1.0 }
velocityUniforms.predator = { value: new Vector3() }
velocityVariable.material.defines.BOUNDS = bounds.toFixed( 2 )
velocityVariable.wrapS = RepeatWrapping
velocityVariable.wrapT = RepeatWrapping
positionVariable.wrapS = RepeatWrapping
positionVariable.wrapT = RepeatWrapping
var error = gpuCompute.init()
if ( !_.isNil(error) ) { console.error( error ) }
return {gpuCompute, positionUniforms, velocityUniforms, positionVariable, velocityVariable} }
function _intitBirds(computeTextureSize) {
var geometry = new BirdGeometry(computeTextureSize),
shader = { uniforms: UniformsUtils.clone( BirdΣ.bird.uniforms ),
vertexShader: BirdΣ.bird.vertexShader,
fragmentShader: BirdΣ.bird.fragmentShader,
side: DoubleSide,
lights: true,
fog: true},
material = new ShaderMaterial( shader ),
mesh = new Mesh( geometry, material )
shader.uniforms.diffuse.value = new Color(0xffffff)
shader.uniforms.specular.value = new Color(0xffffff)
shader.uniforms.shininess.value = 100
return {shader, mesh} }
function _updateSky(state, skyShader, sun) {
let theta = Math.PI * ( state.sky.inclination - 0.5 ),
phi = 2 * Math.PI * ( state.sky.azimuth - 0.5 )
skyShader.uniforms.turbidity.value = state.sky.turbidity
skyShader.uniforms.rayleigh.value = state.sky.rayleigh
skyShader.uniforms.luminance.value = state.sky.luminance
skyShader.uniforms.mieCoefficient.value = state.sky.mieCoefficient
skyShader.uniforms.mieDirectionalG.value = state.sky.mieDirectionalG
sun.position.x = state.sky.distance * Math.cos( phi )
sun.position.y = state.sky.distance * Math.sin( phi ) * Math.sin( theta )
sun.position.z = state.sky.distance * Math.sin( phi ) * Math.cos( theta )
sun.lookAt(new Vector3())
skyShader.uniforms.sunPosition.value.copy( sun.position )
state.camera.hasChanged = true
state.camera.spherical.phi = phi
state.camera.spherical.theta = theta
}
function _updateBirdConfig(state, velocityUniforms) {
velocityUniforms.seperationDistance.value = state.birds.seperation
velocityUniforms.alignmentDistance.value = state.birds.alignment
velocityUniforms.cohesionDistance.value = state.birds.cohesion
velocityUniforms.freedomFactor.value = state.birds.freedom }
function drei(domId, customConfig) {
console.log('initializing drei')
let config = _.merge(defaultConfig, customConfig)
// console.log('config', JSON.stringify(config, null, 2))
// return fontLoader('/fonts/HelveticaNeue-Medium.otf', {reverseTypeface: true})
// .then((font) => {
// State
// ————————————————————————————
// gets inititalized by gui
let state
// Scene
// ————————————————————————————
let ratio = dimensions.width / dimensions.height,
scene = new Scene(),
camera = new PerspectiveCamera(config.camera.fov, ratio, 2, 2000000),
ambientLight = new AmbientLight( 0xffffff),
helper = new GridHelper( 10000, 2, 0x000000, 0x000000 ),
controls
scene.fog = new Fog( 0xffffff, config.camera.radius * 1.1, config.camera.radius * 2 )
camera.position.set(0, 0, config.camera.radius)
scene.add(ambientLight)
// scene.add( helper )
// Renderer
// ————————————————————————————
let renderer = new WebGLRenderer()
document.getElementById(domId).appendChild(renderer.domElement)
renderer.setPixelRatio( window.devicePixelRatio )
renderer.setSize( dimensions.width, dimensions.height )
renderer.setClearColor( scene.fog.color )
if(config.enable.controls) {
controls = new OrbitControls( camera )
controls.target.set( 0, 0, 0 )
controls.rotateSpeed = 1.0
controls.enableZoom = false
controls.enablePan = false
controls.enableDamping = true
// controls.keys = [ 65, 83, 68 ]
}
// Sky
// ————————————————————————————
let sunLight = new DirectionalLight(0xffffff ),
skyShader = new SkyΣ(),
skyMesh = new Mesh( skyShader.geometry, skyShader.material )
if(config.enable.sky) {
scene.add(sunLight)
scene.add(skyMesh) }
// Birds
// ————————————————————————————
let computeTextureSize = Math.pow(2, config.particles.exponent),
{ gpuCompute,
positionUniforms,
velocityUniforms,
velocityVariable,
positionVariable} = _initComputeRenderer(renderer,
computeTextureSize,
config.particles.bounds),
bird = _intitBirds(computeTextureSize)
if(config.enable.birds) scene.add(bird.mesh)
// Bunny
// ————————————————————————————
let manager = new LoadingManager(),
onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
let percentComplete = xhr.loaded / xhr.total * 100
console.log( Math.round(percentComplete, 2) + '% downloaded' )}},
onError = function ( xhr ) { console.log('error', xhr) },
loader = new objLoader( manager ),
scale = 1024
manager.onProgress = function ( item, loaded, total ) { console.log( item, loaded, total ) }
loader.load( 'obj/bunny.obj', function ( bunny ) {
console.log('bunny', bunny)
// bunny.position.y = -100
// bunny.position.z = 400
bunny.scale.set( scale, scale, scale )
// bunny.position.set( 0 )
scene.add( bunny )
let bbox = new Box3().setFromObject(bunny)
console.log('bbox', bbox)
}, onProgress, onError )
// Event handlers
// ————————————————————————————————
document.addEventListener( 'mousemove', (event) => {
mouseX = event.clientX - windowHalfX
mouseY = event.clientY - windowHalfY }, false )
document.addEventListener( 'touchstart', (event) => {
if ( event.touches.length === 1 ) {
event.preventDefault()
mouseX = event.touches[ 0 ].pageX - windowHalfX
mouseY = event.touches[ 0 ].pageY - windowHalfY }}, false)
document.addEventListener( 'touchmove', (event) => {
if ( event.touches.length === 1 ) {
event.preventDefault()
mouseX = event.touches[ 0 ].pageX - windowHalfX
mouseY = event.touches[ 0 ].pageY - windowHalfY }}, false )
document.addEventListener( 'keydown', (event) => {
if(event.key === 'Alt')
document.getElementById('rotate-indicator')
.classList.add('active') }, false )
document.addEventListener( 'keyup', (event) => {
if(event.key === 'Alt')
document.getElementById('rotate-indicator')
.classList.remove('active') }, false )
window.addEventListener( 'resize', (event) => {
dimensions.width = window.innerWidth
dimensions.height = window.innerHeight
renderer.setSize( dimensions.width, dimensions.height )
camera.aspect = dimensions.width / dimensions.height
camera.updateProjectionMatrix() }, false )
// Compose
// ————————————————————————————————
let renderTarget = new WebGLRenderTarget( dimensions.width, dimensions.height ),
composition = new EffectComposer( renderer, renderTarget ),
scenePass = new RenderPass( scene, camera ),
pixelationPass = new PixelationPass(12),
dotScreenPass = new DotScreenPass({}),
filmPass = new FilmPass({greyscale: false,
sepia: false,
vignette: false,
eskil: false,
screenMode: true,
scanlines: true,
noise: true,
noiseIntensity: 0.5,
scanlineIntensity: 0.5,
scanlineDensity: 1.0,
greyscaleIntensity: 1.0,
sepiaIntensity: 1.0,
vignetteOffset: 1.0,
vignetteDarkness: 1.0 }),
bloomPass = new BloomPass( 0.6 ),
bleachShader = { uniforms: UniformsUtils.clone( ShaderExtras[ 'bleachbypass' ].uniforms ),
vertexShader: ShaderExtras[ 'bleachbypass' ].vertexShader,
fragmentShader: ShaderExtras[ 'bleachbypass' ].fragmentShader},
bleachMaterial = new ShaderMaterial(bleachShader),
bleachPass = new ShaderPass( bleachMaterial ),
hBlurShader = { uniforms: UniformsUtils.clone( ShaderExtras[ 'horizontalTiltShift' ].uniforms ),
vertexShader: ShaderExtras[ 'horizontalTiltShift' ].vertexShader,
fragmentShader: ShaderExtras[ 'horizontalTiltShift' ].fragmentShader},
hBlurMaterial = new ShaderMaterial(hBlurShader),
hblurPass = new ShaderPass( hBlurMaterial ),
vBlurShader = { uniforms: UniformsUtils.clone( ShaderExtras[ 'verticalTiltShift' ].uniforms ),
vertexShader: ShaderExtras[ 'verticalTiltShift' ].vertexShader,
fragmentShader: ShaderExtras[ 'verticalTiltShift' ].fragmentShader},
vBlurMaterial = new ShaderMaterial(vBlurShader),
vblurPass = new ShaderPass( vBlurMaterial ),
smaaPass = new SMAAPass(window.Image),
bluriness = 4
hBlurShader.uniforms.h.value = bluriness / dimensions.width
hBlurShader.uniforms.r.value = 0.5
vBlurShader.uniforms.v.value = bluriness / dimensions.height
vBlurShader.uniforms.r.value = 0.5
composition.addPass( scenePass )
composition.addPass( hblurPass )
composition.addPass( vblurPass )
// composition.addPass( smaaPass )
// scenePass.renderToScreen = true
vblurPass.renderToScreen = true
// GUI
// ————————————————————————————
let guiConfig = {}
if(config.enable.birds)
guiConfig.birds = { items: config.birds,
onChange: () => {_updateBirdConfig(state, velocityUniforms)},
open: false}
if(config.enable.sky)
guiConfig.sky = { items: config.sky,
onChange: () => {_updateSky(state, skyShader, sunLight)},
open: false}
state = initGui( guiConfig, config.enable.gui )
state.camera = {spherical: new Spherical(config.cameraRadius, 0, 0),
hasChanged: true }
if(config.enable.birds) _updateBirdConfig(state, velocityUniforms)
if(config.enable.sky) _updateSky(state, skyShader, sunLight)
// run…
// ————————————————————————————
let clock = new Clock(), δ,
last = performance.now(),
now
console.log('here we go —→')
function _render() {
// reschedule
requestAnimationFrame(_render)
// update controls
// if( controls ) controls.update()
// timing
now = performance.now();
δ = (now - last) / 1000
if (δ > 1) δ = 1 // safety cap on large deltas
last = now
if(config.enable.birds){
// update uniforms
// position
positionUniforms.time.value = now
positionUniforms.delta.value = δ
// velocity
velocityUniforms.time.value = now
velocityUniforms.delta.value = δ
// bird
bird.shader.uniforms.time.value = now
bird.shader.uniforms.delta.value = δ
velocityUniforms.predator.value.set( 0.5 * mouseX / windowHalfX, - 0.5 * mouseY / windowHalfY, 0 )
mouseX = 10000
mouseY = 10000
gpuCompute.compute()
bird.shader.uniforms.texturePosition.value = gpuCompute.getCurrentRenderTarget( positionVariable ).texture
bird.shader.uniforms.textureVelocity.value = gpuCompute.getCurrentRenderTarget( velocityVariable ).texture }
composition.render(δ)
}
// composition.render(0)
_render()
// _ _
// _ _ _ __ __| |__ _| |_ ___
// | || | '_ \/ _` / _` | _/ -_)
// \_,_| .__/\__,_\__,_|\__\___|
// |_|
let sunΣ = scaleLinear()
.domain([0, 1])
.range([config.sky.inclination[0], config.sky.inclination[1]])
.clamp(true),
rayleighΣ = scaleLinear()
.domain([0, 1])
.range([config.sky.rayleigh[0], config.sky.inclination[2]])
.clamp(true),
mieCoefficientΣ = scaleLinear()
.domain([0, 1])
.range([config.sky.mieCoefficient[0], config.sky.mieCoefficient[2]])
.clamp(true),
mieDirectionalGΣ = scaleLinear()
.domain([0, 1])
.range([config.sky.mieDirectionalG[0], config.sky.mieDirectionalG[1]])
.clamp(true)
function update({top, left}) {
if(!_.isNil(top)) {
state.sky.inclination = sunΣ(top)
state.sky.rayleigh = rayleighΣ(top)
state.sky.mieCoefficient = mieCoefficientΣ(top)
state.sky.mieDirectionalG = mieDirectionalGΣ(top)
_updateSky(state, skyShader, sunLight)
// camera.updateProjectionMatrix()
}
if(!_.isNil(left)) {
camera.rotation.y = -2 * Math.PI * left
camera.updateProjectionMatrix()
// state.sky.inclination = sunΣ(left)
// state.sky.rayleigh = rayleighΣ(left)
// state.sky.mieCoefficient = mieCoefficientΣ(left)
// state.sky.mieDirectionalG = mieDirectionalGΣ(left)
// _updateSky(state, skyShader, sunLight)
}
}
return update }
// )} // font loader is disabled. and so is its promise
export default drei
|
var resolve = require('./index')
// Resolve a single promise
resolve(ask('Some question'), function (err, val) {
err ? console.error(err) : console.log(val)
})
// Or wrap a promise generator and resolve later
var deferred = resolve(ask)
deferred('Some question', function (err, val) {
err ? console.error(err) : console.log(val)
})
function ask (q) {
return new Promise(function (resolve, reject) {
// Do some async stuff
setTimeout(function () {
Math.round(Math.random()) ?
resolve('Q: ' + q + '\nA: Blah blah blah') :
reject('Q: ' + q + '\nA: Psych!')
})
})
}
|
'use strict';
/**
* @param {*} value
* @return {number}
*/
function toDecibel(value) {
return 20 * Math.log10(value);
}
export default toDecibel;
|
let version = '2.6.0-beta.0';
export default version;
|
import React from 'react';
import { mount } from 'enzyme';
import renderer from 'react-test-renderer';
import Header from '../../components/Header';
import 'jest-styled-components';
describe('<Header />', () => {
let nagIndex, nagNew;
beforeEach(() => {
nagIndex = jest.fn();
nagNew = jest.fn();
});
it('should match snapshot', () => {
const tree = renderer
.create(<Header nagIndex={nagIndex} nagNew={nagNew} />)
.toJSON();
expect(tree).toMatchSnapshot();
});
it('should have correct elements and children', () => {
const header = mount(<Header nagIndex={nagIndex} nagNew={nagNew} />);
expect(header.find('header').length).toBe(1);
expect(header.find('a[href="https://www.gauti.info/nag-me"]').length).toBe(
1
);
expect(header.find('button[title="Nags Index"]').length).toBe(1);
expect(header.find('button[title="Create a nag"]').length).toBe(1);
});
it('should call nagIndex', () => {
const header = mount(<Header nagIndex={nagIndex} nagNew={nagNew} />);
header.find('button[title="Nags Index"]').simulate('click');
expect(nagIndex.mock.calls.length).toBe(1);
});
it('should call nagNew', () => {
const header = mount(<Header nagIndex={nagIndex} nagNew={nagNew} />);
header.find('button[title="Create a nag"]').simulate('click');
expect(nagNew.mock.calls.length).toBe(1);
});
});
|
declare type Collection = {
id: string,
items: Array<?string>,
name: string,
type: string,
updatedAt: number,
totalItems?: number,
sourceId?: string, // if copied, claimId of original collection
};
declare type CollectionState = {
unpublished: CollectionGroup,
resolved: CollectionGroup,
pending: CollectionGroup,
edited: CollectionGroup,
builtin: CollectionGroup,
saved: Array<string>,
isResolvingCollectionById: { [string]: boolean },
error?: string | null,
};
declare type CollectionGroup = {
[string]: Collection,
}
declare type CollectionEditParams = {
claims?: Array<Claim>,
remove?: boolean,
claimIds?: Array<string>,
replace?: boolean,
order?: { from: number, to: number },
type?: string,
name?: string,
}
|
'use strict'
var assert = require('assert')
var should = require('should')
var archivesUtils = require('../lib/utils.js')
var collectionJson = {
'abstract': [
{
'value': 'Alexander Hamilton (1754-1804) was a Founding Father, soldier, lawyer and statesman. He served as the first United States Secretary of the Treasury from 1789 to 1795. The Alexander Hamilton papers, dated 1775-1804, primarily consist of letters and documents either written or signed by Alexander Hamilton, and pertain to his career as a soldier, lawyer, statesman and United States Secretary of the Treasury. Autograph letters, drafts and copies of letters sent by Hamilton concern his Revolutionary War service, chiefly as an aide-de-camp to General George Washington; his legal practice in New York; and financial and political matters. Notable items include Hamilton’s letters to President Washington, dated 1796, concerning the writing of Washington’s Farewell Address to the nation, with a draft of the Address written by Hamilton for Washington’s consideration. Documents include his 1782 appointment as Receiver of Continental Taxes in New York, legal documents relating to his law practice and personal estate, and legal notes and other items in his hand. Treasury Department letters are chiefly manuscript or printed circular letters which are not in Hamilton’s handwriting but bear his autograph signature.'
}
],
'acqinfo': [
{
'value': '<p>Various gifts and purchases, 1896-1948</p>'
}
],
'active': true,
'bioghist': [
{
'value': '<p>Alexander Hamilton (1754-1804) was a Founding Father, soldier, lawyer and statesman. He served as the first United States Secretary of the Treasury from 1789 to 1795. Born in the West Indies, Hamilton came to the American colonies to attend school, graduating from King’s College (Columbia University) in 1774. He fought as an American military officer during the Revolutionary War and was General George Washington’s aide-de-camp prior to his resignation from the Army in 1782. In that same year he established his law practice in New York City and was appointed Receiver of Continental Taxes for the State of New York. Hamilton represented the State at the Constitutional Convention of 1787, and played a key role in supporting the adoption of the United States Constitution as co-author of The Federalist Papers with John Jay and James Madison. Hamilton was also instrumental in shaping the country’s financial system. In 1789, President Washington appointed Hamilton as the first United States Secretary of the Treasury. He resigned in 1795, returning to his law practice in New York. In 1780 he married Elizabeth Schuyler (1757-1854), daughter of General Philip Schuyler. Hamilton was mortally wounded in a duel with Aaron Burr on July 11, 1804.</p>'
}
],
'bnumber': 'b12361313',
'call_number': 'MssCol 1297',
'component_layout_id': 2,
'controlaccess': {
'genreform': [
{
'controlaccess': true,
'id': 4318,
'questionable': false,
'source': 'aat',
'term': 'Legal documents',
'type': 'genreform',
'value_uri': 'http://vocab.getty.edu/aat/300027590'
}
],
'geogname': [
{
'controlaccess': true,
'id': 157810,
'questionable': false,
'source': 'naf',
'term': 'United States -- History -- Revolution, 1775-1783',
'type': 'geogname'
},
{
'controlaccess': true,
'id': 164908,
'questionable': false,
'source': 'naf',
'term': 'United States -- Politics and government -- 1789-1815',
'type': 'geogname'
}
],
'name': [
{
'controlaccess': true,
'id': 375,
'questionable': false,
'role': 'subject',
'source': 'naf',
'term': 'Hamilton, Alexander, 1757-1804',
'type': 'persname',
'value_uri': 'http://id.loc.gov/authorities/names/n79021633'
},
{
'controlaccess': true,
'id': 164903,
'questionable': false,
'source': 'naf',
'term': 'Hamilton, Elizabeth Schuyler, 1757-1854',
'type': 'persname',
'value_uri': 'http://viaf.org/viaf/26348195'
},
{
'controlaccess': true,
'id': 157809,
'questionable': false,
'source': 'naf',
'term': 'Huntington, Jedediah, 1743-1818 -- recipient',
'type': 'persname'
},
{
'controlaccess': true,
'id': 164904,
'questionable': false,
'source': 'naf',
'term': 'Jay, John, 1745-1829 -- recipient',
'type': 'persname'
},
{
'controlaccess': true,
'id': 164902,
'questionable': false,
'role': 'subject',
'source': 'naf',
'term': 'Washington, George, 1732-1799 -- Farewell address',
'type': 'persname'
},
{
'controlaccess': true,
'id': 164906,
'questionable': false,
'source': 'naf',
'term': 'Washington, George, 1732-1799 -- recipient',
'type': 'persname'
},
{
'controlaccess': true,
'id': 164901,
'questionable': false,
'role': 'subject',
'source': 'naf',
'term': 'United States. Department of the Treasury. Office of the Secretary',
'type': 'corpname',
'value_uri': 'http://viaf.org/viaf/123695270'
}
],
'occupation': [
{
'controlaccess': true,
'function': 'occupation',
'id': 20255,
'questionable': false,
'source': 'lcsh',
'term': 'Lawyers',
'type': 'topic'
},
{
'controlaccess': true,
'function': 'occupation',
'id': 147303,
'questionable': false,
'source': 'lcsh',
'term': 'Soldiers',
'type': 'topic'
},
{
'controlaccess': true,
'function': 'occupation',
'id': 32967,
'questionable': false,
'source': 'lcsh',
'term': 'Statesmen',
'type': 'topic'
}
],
'subject': [
{
'controlaccess': true,
'id': 164907,
'questionable': false,
'source': 'lcsh',
'term': 'Customs administration -- United States',
'type': 'topic'
},
{
'controlaccess': true,
'id': 161736,
'questionable': false,
'source': 'lcsh',
'term': 'Finance, public -- United States',
'type': 'topic'
}
]
},
'created_at': '2013-04-01T14:58:51Z',
'custodhist': [
{
'value': "<p>The bulk of the Alexander Hamilton papers are comprised of documents transferred from the Ford collection and the Thomas Addis Emmet collection. The Ford Collection was compiled by Gordon L. Ford, business manager of the New York Tribune from 1873 to 1881 and collector of documents pertaining to early American history. Ford's collection was later purchased by J. Pierpont Morgan and portions of it were donated to The New York Public Library in 1899. The Emmet Collection was collected by Dr. Thomas Addis Emmet, a collector of early American history manuscripts. His collection was later purchased by John S. Kennedy and donated to The New York Public Library in 1896. Various other gifts and purchases are also included.</p>"
}
],
'date_end': '1804',
'date_inclusive_end': 1804,
'date_inclusive_start': 1775,
'date_processed': 2015,
'date_start': '1775',
'date_statement': '1775-1804',
'dates_index': [
1775,
1776,
1777,
1778,
1779,
1780,
1781,
1782,
1783,
1784,
1785,
1786,
1787,
1788,
1789,
1790,
1791,
1792,
1793,
1794,
1795,
1796,
1797,
1798,
1799,
1800,
1801,
1802,
1803,
1804
],
'digital_assets': true,
'dsc_type': [
'combined'
],
'extent_statement': '.25 linear feet (1 box)',
'featured_seq': 4,
'fully_digitized': 1,
'has_digital': 1,
'id': 206,
'identifier_type': 'local_mss',
'identifier_value': '1297',
'keydate': '1775',
'linear_feet': 0.25,
'max_depth': 3,
'note': [
{
'type': 'sponsor',
'value': 'Digitization was made possible by a lead gift from The Polonsky Foundation.'
}
],
'org_unit_code': 'MSS',
'org_unit_id': 1,
'org_unit_name': 'Manuscripts and Archives Division',
'org_unit_name_short': 'Manuscripts and Archives Division',
'origination': [
{
'controlaccess': false,
'function': 'origination',
'id': 375,
'questionable': false,
'role': 'creator',
'source': 'naf',
'term': 'Hamilton, Alexander, 1757-1804',
'type': 'persname',
'value': 'Hamilton, Alexander, 1757-1804',
'value_uri': 'http://id.loc.gov/authorities/names/n79021633'
}
],
'origination_term': [
{
'controlaccess': false,
'function': 'origination',
'id': 375,
'questionable': false,
'role': 'creator',
'source': 'naf',
'term': 'Hamilton, Alexander, 1757-1804',
'type': 'persname',
'value_uri': 'http://id.loc.gov/authorities/names/n79021633'
}
],
'physdesc': [
{
'format': 'structured',
'physdesc_components': [
{
'name': 'extent',
'unit': 'linear feet',
'value': '.25 linear feet'
},
{
'name': 'extent',
'unit': 'containers',
'value': '1 box'
}
],
'supress_display': true
}
],
'prefercite': [
{
'value': '<p>Alexander Hamilton papers, Manuscripts and Archives Division, The New York Public Library</p>'
}
],
'processinfo': [
{
'type': 'processing',
'value': '<p>Compiled by <span class="name">Casey Babcock</span>, <span class="date">2015</span></p>'
}
],
'repository': [
{
'id': 'MSS',
'value': 'Manuscripts and Archives Division'
}
],
'scopecontent': [
{
'value': '<p>The Alexander Hamilton papers, dated 1775-1804, primarily consist of letters and documents either written or signed by Alexander Hamilton, and pertain to his career as a soldier, lawyer, statesman and United States Secretary of the Treasury. It is a synthetic collection of largely autograph material, combining gifts and purchases from various sources.</p> <p>Autograph letters, drafts and copies of letters sent by Hamilton concern his Revolutionary War service, chiefly as an aide-de-camp to General George Washington; his law practice in New York; and financial and political matters. Notable items include Hamilton’s letters to President Washington, dated 1796, concerning the writing of Washington’s Farewell Address to the nation. His letter of 1796 August 10 encloses a draft of the Address, written by Hamilton for Washington’s consideration. One personal letter to his wife Elizabeth Hamilton dated 1803 gives instructions for property improvements at their home, The Grange. Documents include his 1782 appointment as Receiver of Continental Taxes in New York, legal documents relating to his law practice and personal estate, and legal notes and other items in his hand.</p> <p>Treasury Department letters are chiefly manuscript or printed circular letters which are not in Hamilton’s handwriting but bear his autograph signature. Most are addressed to Collectors of Customs and concern customs and shipping regulations, the apportionment or collection of federal monies, and banking matters. Many are addressed to Jedediah Huntington, Collector of Customs at New London, Connecticut. Also included are a few signed receipts for drafts from Customs officers, a signed decision on a Customs case, and a clipped signature.</p>'
}
],
'series_count': 0,
'show_generated_pdf': false,
'sponsor': [
{
'value': 'Digitization was made possible by a lead gift from The Polonsky Foundation.'
}
],
'standard_access_note': 'Advance notice required.',
'title': 'Alexander Hamilton papers',
'total_children': 3,
'total_components': 44,
'type': 'Collection',
'unitdate': [
{
'normal': '1775/1804',
'type': 'inclusive',
'value': '1775-1804'
}
],
'unitid': [
{
'type': 'local_mss',
'value': '1297'
},
{
'type': 'local_b',
'value': 'b12361313'
},
{
'type': 'local_barcode',
'value': '33433087858829'
},
{
'type': 'local_call',
'value': 'MssCol 1297'
}
],
'langmaterial_code': ['ger'],
'unittitle': [
{
'value': 'Alexander Hamilton papers'
}
],
'updated_at': '2016-02-12T19:44:26Z'
}
describe('archivesUtils', function () {
it('should parse a archive record into identfiers used to match', function () {
var r = archivesUtils.extractIds(collectionJson)
r.title.should.equal('Alexander Hamilton papers')
r.mssDb.should.equal(206)
r.mss.should.equal(1297)
r.bNumber.should.equal('b12361313')
r.callNumber.should.equal('MssCol 1297')
r.barcode.should.equal(33433087858829)
})
it('should parse a archive record into agents', function () {
var r = archivesUtils.extractAgents(collectionJson)
r[0].id.should.equal(375)
r[0].namePart.should.equal('Hamilton, Alexander, 1757-1804')
r[0].type.should.equal('persname')
r[0].authority.should.equal('naf')
r[0].role.should.equal('creator')
r[0].valueURI.should.equal('http://id.loc.gov/authorities/names/n79021633')
r[2].id.should.equal(157809)
r[2].namePart.should.equal('Huntington, Jedediah, 1743-1818')
r[2].type.should.equal('persname')
r[2].authority.should.equal('naf')
r[2].role.should.equal('contributor')
r[2].valueURI.should.equal(false)
})
it('should parse a archive record subjects', function () {
var r = archivesUtils.extractSubjects(collectionJson)
r[0].id.should.equal(4318)
r[0].text.should.equal('Legal documents')
r[0].type.should.equal('genreform')
r[0].nameType.should.equal('genreform')
r[0].authority.should.equal('aat')
r[0].valueURI.should.equal(false)
})
it('should parse a archive record notes', function () {
var r = archivesUtils.extractNotes(collectionJson)
r[0].type.should.equal('bioghist')
r[0].text.should.equal('<p>Alexander Hamilton (1754-1804) was a Founding Father, soldier, lawyer and statesman. He served as the first United States Secretary of the Treasury from 1789 to 1795. Born in the West Indies, Hamilton came to the American colonies to attend school, graduating from King’s College (Columbia University) in 1774. He fought as an American military officer during the Revolutionary War and was General George Washington’s aide-de-camp prior to his resignation from the Army in 1782. In that same year he established his law practice in New York City and was appointed Receiver of Continental Taxes for the State of New York. Hamilton represented the State at the Constitutional Convention of 1787, and played a key role in supporting the adoption of the United States Constitution as co-author of The Federalist Papers with John Jay and James Madison. Hamilton was also instrumental in shaping the country’s financial system. In 1789, President Washington appointed Hamilton as the first United States Secretary of the Treasury. He resigned in 1795, returning to his law practice in New York. In 1780 he married Elizabeth Schuyler (1757-1854), daughter of General Philip Schuyler. Hamilton was mortally wounded in a duel with Aaron Burr on July 11, 1804.</p>')
})
it('should parse a archive lang', function () {
var r = archivesUtils.extractLanguage(collectionJson)
r[0].should.equal('ger')
})
it('should parse a archive dates', function () {
var r = archivesUtils.extractDates(collectionJson)
r[0].point.should.equal('start')
r[0].value.should.equal(1775)
})
it('should parse a archive abstract', function () {
var r = archivesUtils.extractAbstracts(collectionJson)
r[0].should.equal('Alexander Hamilton (1754-1804) was a Founding Father, soldier, lawyer and statesman. He served as the first United States Secretary of the Treasury from 1789 to 1795. The Alexander Hamilton papers, dated 1775-1804, primarily consist of letters and documents either written or signed by Alexander Hamilton, and pertain to his career as a soldier, lawyer, statesman and United States Secretary of the Treasury. Autograph letters, drafts and copies of letters sent by Hamilton concern his Revolutionary War service, chiefly as an aide-de-camp to General George Washington; his legal practice in New York; and financial and political matters. Notable items include Hamilton’s letters to President Washington, dated 1796, concerning the writing of Washington’s Farewell Address to the nation, with a draft of the Address written by Hamilton for Washington’s consideration. Documents include his 1782 appointment as Receiver of Continental Taxes in New York, legal documents relating to his law practice and personal estate, and legal notes and other items in his hand. Treasury Department letters are chiefly manuscript or printed circular letters which are not in Hamilton’s handwriting but bear his autograph signature.')
})
})
|
/**
* Module exports.
*/
exports.EventEmitter = EventEmitter;
/**
* Check if `obj` is an array.
*/
function isArray(obj) {
return '[object Array]' == {}.toString.call(obj);
}
/**
* Event emitter constructor.
*
* @api public
*/
function EventEmitter(){};
/**
* Adds a listener.
*
* @api public
*/
EventEmitter.prototype.on = function (name, fn) {
if (!this.$events) {
this.$events = {};
}
if (!this.$events[name]) {
this.$events[name] = fn;
} else if (isArray(this.$events[name])) {
this.$events[name].push(fn);
} else {
this.$events[name] = [this.$events[name], fn];
}
return this;
};
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
/**
* Adds a volatile listener.
*
* @api public
*/
EventEmitter.prototype.once = function (name, fn) {
var self = this;
function on () {
self.removeListener(name, on);
fn.apply(this, arguments);
};
on.listener = fn;
this.on(name, on);
return this;
};
/**
* Removes a listener.
*
* @api public
*/
EventEmitter.prototype.removeListener = function (name, fn) {
if (this.$events && this.$events[name]) {
var list = this.$events[name];
if (isArray(list)) {
var pos = -1;
for (var i = 0, l = list.length; i < l; i++) {
if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {
pos = i;
break;
}
}
if (pos < 0) {
return this;
}
list.splice(pos, 1);
if (!list.length) {
delete this.$events[name];
}
} else if (list === fn || (list.listener && list.listener === fn)) {
delete this.$events[name];
}
}
return this;
};
/**
* Removes all listeners for an event.
*
* @api public
*/
EventEmitter.prototype.removeAllListeners = function (name) {
if (name === undefined) {
this.$events = {};
return this;
}
if (this.$events && this.$events[name]) {
this.$events[name] = null;
}
return this;
};
/**
* Gets all listeners for a certain event.
*
* @api public
*/
EventEmitter.prototype.listeners = function (name) {
if (!this.$events) {
this.$events = {};
}
if (!this.$events[name]) {
this.$events[name] = [];
}
if (!isArray(this.$events[name])) {
this.$events[name] = [this.$events[name]];
}
return this.$events[name];
};
/**
* Emits an event.
*
* @api public
*/
EventEmitter.prototype.emit = function (name) {
if (!this.$events) {
return false;
}
var handler = this.$events[name];
if (!handler) {
return false;
}
var args = [].slice.call(arguments, 1);
if ('function' == typeof handler) {
handler.apply(this, args);
} else if (isArray(handler)) {
var listeners = handler.slice();
for (var i = 0, l = listeners.length; i < l; i++) {
listeners[i].apply(this, args);
}
} else {
return false;
}
return true;
};
|
"use strict";
import { flushIframes, makeRSDoc, makeStandardOps } from "../SpecHelper.js";
describe("Core - exporter", () => {
afterAll(flushIframes);
async function getExportedDoc(ops) {
const doc = await makeRSDoc(ops);
const dataURL = await new Promise(resolve => {
doc.defaultView.require(["core/exporter"], ({ rsDocToDataURL }) =>
resolve(rsDocToDataURL("text/html", doc))
);
});
const docString = decodeURIComponent(dataURL).replace(
"data:text/html;charset=utf-8,",
""
);
return new DOMParser().parseFromString(docString, "text/html");
}
it("removes .removeOnSave elements", async () => {
const ops = makeStandardOps();
ops.body = `<div class="removeOnSave" id="this-should-be-removed">this should be removed</div>`;
const doc = await getExportedDoc(ops);
expect(doc.getElementById("this-should-be-removed")).toBeFalsy();
expect(doc.querySelectorAll(".removeOnSave")).toHaveSize(0);
});
it("removes all comments", async () => {
const ops = makeStandardOps();
ops.body = `<div><!-- remove -->PASS <span><!-- remove --></span></div>`;
const doc = await getExportedDoc(ops);
const walker = document.createTreeWalker(doc.body, NodeFilter.SHOW_COMMENT);
const comments = [];
while (walker.nextNode()) {
comments.push(walker.currentNode);
}
expect(comments).toHaveSize(0);
});
it("removes temporary element attributes", async () => {
const body = `
<a
id="ANCHOR"
data-keep-me="FOO"
data-cite="rfc6454#section-3.2"
data-xref-type="dfn"
>origin</a
>
<dfn
id="DFN"
data-keep-me="BAR"
data-cite="?rfc6454"
data-cite-frag="section-3.2"
>origin</dfn
>
`;
const ops = makeStandardOps(null, body);
const doc = await getExportedDoc(ops);
const anchor = doc.getElementById("ANCHOR");
expect(anchor.hasAttribute("data-cite")).toBeFalse();
expect(anchor.hasAttribute("data-cite-frag")).toBeFalse();
expect(anchor.hasAttribute("data-cite-path")).toBeFalse();
expect(anchor.hasAttribute("data-xref-type")).toBeFalse();
expect(anchor.hasAttribute("data-keep-me")).toBeTrue();
const dfn = doc.getElementById("DFN");
expect(dfn.hasAttribute("data-cite")).toBeFalse();
expect(dfn.hasAttribute("data-cite-frag")).toBeFalse();
expect(dfn.hasAttribute("data-cite-path")).toBeFalse();
expect(dfn.hasAttribute("data-keep-me")).toBeTrue();
});
it("moves the W3C style sheet to be last thing in documents head", async () => {
const ops = makeStandardOps();
ops.body = `
<!-- add WebIDL style -->
<pre class="idl">
interface Foo {};
</pre>
<!-- add examples and hljs styles -->
<pre class="example js">
function Foo(){};
</pre>`;
const doc = await getExportedDoc(ops);
const { lastElementChild } = doc.head;
expect(lastElementChild.href).toBe(
"https://www.w3.org/StyleSheets/TR/2016/W3C-ED"
);
});
});
|
'use strict';
var React = require('react');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function createCommonjsModule(fn, basedir, module) {
return module = {
path: basedir,
exports: {},
require: function (path, base) {
return commonjsRequire(path, (base === undefined || base === null) ? module.path : base);
}
}, fn(module, module.exports), module.exports;
}
function commonjsRequire () {
throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
}
var check = function (it) {
return it && it.Math == Math && it;
};
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global_1 =
// eslint-disable-next-line no-undef
check(typeof globalThis == 'object' && globalThis) ||
check(typeof window == 'object' && window) ||
check(typeof self == 'object' && self) ||
check(typeof commonjsGlobal == 'object' && commonjsGlobal) ||
// eslint-disable-next-line no-new-func
(function () { return this; })() || Function('return this')();
var fails = function (exec) {
try {
return !!exec();
} catch (error) {
return true;
}
};
// Detect IE8's incomplete defineProperty implementation
var descriptors = !fails(function () {
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
});
var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// Nashorn ~ JDK8 bug
var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
// `Object.prototype.propertyIsEnumerable` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
var descriptor = getOwnPropertyDescriptor(this, V);
return !!descriptor && descriptor.enumerable;
} : nativePropertyIsEnumerable;
var objectPropertyIsEnumerable = {
f: f
};
var createPropertyDescriptor = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
var toString = {}.toString;
var classofRaw = function (it) {
return toString.call(it).slice(8, -1);
};
var split = ''.split;
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var indexedObject = fails(function () {
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
// eslint-disable-next-line no-prototype-builtins
return !Object('z').propertyIsEnumerable(0);
}) ? function (it) {
return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
} : Object;
// `RequireObjectCoercible` abstract operation
// https://tc39.es/ecma262/#sec-requireobjectcoercible
var requireObjectCoercible = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
// toObject with fallback for non-array-like ES3 strings
var toIndexedObject = function (it) {
return indexedObject(requireObjectCoercible(it));
};
var isObject = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
// `ToPrimitive` abstract operation
// https://tc39.es/ecma262/#sec-toprimitive
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
var toPrimitive = function (input, PREFERRED_STRING) {
if (!isObject(input)) return input;
var fn, val;
if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
throw TypeError("Can't convert object to primitive value");
};
var hasOwnProperty = {}.hasOwnProperty;
var has = function (it, key) {
return hasOwnProperty.call(it, key);
};
var document$1 = global_1.document;
// typeof document.createElement is 'object' in old IE
var EXISTS = isObject(document$1) && isObject(document$1.createElement);
var documentCreateElement = function (it) {
return EXISTS ? document$1.createElement(it) : {};
};
// Thank's IE8 for his funny defineProperty
var ie8DomDefine = !descriptors && !fails(function () {
return Object.defineProperty(documentCreateElement('div'), 'a', {
get: function () { return 7; }
}).a != 7;
});
var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
// `Object.getOwnPropertyDescriptor` method
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
O = toIndexedObject(O);
P = toPrimitive(P, true);
if (ie8DomDefine) try {
return nativeGetOwnPropertyDescriptor(O, P);
} catch (error) { /* empty */ }
if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
};
var objectGetOwnPropertyDescriptor = {
f: f$1
};
var replacement = /#|\.prototype\./;
var isForced = function (feature, detection) {
var value = data[normalize(feature)];
return value == POLYFILL ? true
: value == NATIVE ? false
: typeof detection == 'function' ? fails(detection)
: !!detection;
};
var normalize = isForced.normalize = function (string) {
return String(string).replace(replacement, '.').toLowerCase();
};
var data = isForced.data = {};
var NATIVE = isForced.NATIVE = 'N';
var POLYFILL = isForced.POLYFILL = 'P';
var isForced_1 = isForced;
var path = {};
var aFunction = function (it) {
if (typeof it != 'function') {
throw TypeError(String(it) + ' is not a function');
} return it;
};
// optional / simple context binding
var functionBindContext = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 0: return function () {
return fn.call(that);
};
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);
};
};
var anObject = function (it) {
if (!isObject(it)) {
throw TypeError(String(it) + ' is not an object');
} return it;
};
var nativeDefineProperty = Object.defineProperty;
// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (ie8DomDefine) try {
return nativeDefineProperty(O, P, Attributes);
} catch (error) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
var objectDefineProperty = {
f: f$2
};
var createNonEnumerableProperty = descriptors ? function (object, key, value) {
return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
var wrapConstructor = function (NativeConstructor) {
var Wrapper = function (a, b, c) {
if (this instanceof NativeConstructor) {
switch (arguments.length) {
case 0: return new NativeConstructor();
case 1: return new NativeConstructor(a);
case 2: return new NativeConstructor(a, b);
} return new NativeConstructor(a, b, c);
} return NativeConstructor.apply(this, arguments);
};
Wrapper.prototype = NativeConstructor.prototype;
return Wrapper;
};
/*
options.target - name of the target object
options.global - target is the global object
options.stat - export as static methods of target
options.proto - export as prototype methods of target
options.real - real prototype method for the `pure` version
options.forced - export even if the native feature is available
options.bind - bind methods to the target, required for the `pure` version
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
options.unsafe - use the simple assignment of property instead of delete + defineProperty
options.sham - add a flag to not completely full polyfills
options.enumerable - export as enumerable property
options.noTargetGet - prevent calling a getter on target
*/
var _export = function (options, source) {
var TARGET = options.target;
var GLOBAL = options.global;
var STATIC = options.stat;
var PROTO = options.proto;
var nativeSource = GLOBAL ? global_1 : STATIC ? global_1[TARGET] : (global_1[TARGET] || {}).prototype;
var target = GLOBAL ? path : path[TARGET] || (path[TARGET] = {});
var targetPrototype = target.prototype;
var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE;
var key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor;
for (key in source) {
FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
// contains in native
USE_NATIVE = !FORCED && nativeSource && has(nativeSource, key);
targetProperty = target[key];
if (USE_NATIVE) if (options.noTargetGet) {
descriptor = getOwnPropertyDescriptor$1(nativeSource, key);
nativeProperty = descriptor && descriptor.value;
} else nativeProperty = nativeSource[key];
// export native or implementation
sourceProperty = (USE_NATIVE && nativeProperty) ? nativeProperty : source[key];
if (USE_NATIVE && typeof targetProperty === typeof sourceProperty) continue;
// bind timers to global for call from export context
if (options.bind && USE_NATIVE) resultProperty = functionBindContext(sourceProperty, global_1);
// wrap global constructors for prevent changs in this version
else if (options.wrap && USE_NATIVE) resultProperty = wrapConstructor(sourceProperty);
// make static versions for prototype methods
else if (PROTO && typeof sourceProperty == 'function') resultProperty = functionBindContext(Function.call, sourceProperty);
// default case
else resultProperty = sourceProperty;
// add a flag to not completely full polyfills
if (options.sham || (sourceProperty && sourceProperty.sham) || (targetProperty && targetProperty.sham)) {
createNonEnumerableProperty(resultProperty, 'sham', true);
}
target[key] = resultProperty;
if (PROTO) {
VIRTUAL_PROTOTYPE = TARGET + 'Prototype';
if (!has(path, VIRTUAL_PROTOTYPE)) {
createNonEnumerableProperty(path, VIRTUAL_PROTOTYPE, {});
}
// export virtual prototype methods
path[VIRTUAL_PROTOTYPE][key] = sourceProperty;
// export real prototype methods
if (options.real && targetPrototype && !targetPrototype[key]) {
createNonEnumerableProperty(targetPrototype, key, sourceProperty);
}
}
}
};
// `ToObject` abstract operation
// https://tc39.es/ecma262/#sec-toobject
var toObject = function (argument) {
return Object(requireObjectCoercible(argument));
};
var ceil = Math.ceil;
var floor = Math.floor;
// `ToInteger` abstract operation
// https://tc39.es/ecma262/#sec-tointeger
var toInteger = function (argument) {
return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
};
var min = Math.min;
// `ToLength` abstract operation
// https://tc39.es/ecma262/#sec-tolength
var toLength = function (argument) {
return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
};
// `IsArray` abstract operation
// https://tc39.es/ecma262/#sec-isarray
var isArray = Array.isArray || function isArray(arg) {
return classofRaw(arg) == 'Array';
};
var setGlobal = function (key, value) {
try {
createNonEnumerableProperty(global_1, key, value);
} catch (error) {
global_1[key] = value;
} return value;
};
var SHARED = '__core-js_shared__';
var store = global_1[SHARED] || setGlobal(SHARED, {});
var sharedStore = store;
var shared = createCommonjsModule(function (module) {
(module.exports = function (key, value) {
return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
})('versions', []).push({
version: '3.8.2',
mode: 'pure' ,
copyright: '© 2021 Denis Pushkarev (zloirock.ru)'
});
});
var id = 0;
var postfix = Math.random();
var uid = function (key) {
return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
};
var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () {
// Chrome 38 Symbol has incorrect toString conversion
// eslint-disable-next-line no-undef
return !String(Symbol());
});
var useSymbolAsUid = nativeSymbol
// eslint-disable-next-line no-undef
&& !Symbol.sham
// eslint-disable-next-line no-undef
&& typeof Symbol.iterator == 'symbol';
var WellKnownSymbolsStore = shared('wks');
var Symbol$1 = global_1.Symbol;
var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
var wellKnownSymbol = function (name) {
if (!has(WellKnownSymbolsStore, name)) {
if (nativeSymbol && has(Symbol$1, name)) WellKnownSymbolsStore[name] = Symbol$1[name];
else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
} return WellKnownSymbolsStore[name];
};
var SPECIES = wellKnownSymbol('species');
// `ArraySpeciesCreate` abstract operation
// https://tc39.es/ecma262/#sec-arrayspeciescreate
var arraySpeciesCreate = function (originalArray, length) {
var C;
if (isArray(originalArray)) {
C = originalArray.constructor;
// cross-realm fallback
if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
else if (isObject(C)) {
C = C[SPECIES];
if (C === null) C = undefined;
}
} return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
};
var push = [].push;
// `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterOut }` methods implementation
var createMethod = function (TYPE) {
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 IS_FILTER_OUT = TYPE == 7;
var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
return function ($this, callbackfn, that, specificCreate) {
var O = toObject($this);
var self = indexedObject(O);
var boundFunction = functionBindContext(callbackfn, that, 3);
var length = toLength(self.length);
var index = 0;
var create = specificCreate || arraySpeciesCreate;
var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_OUT ? create($this, 0) : undefined;
var value, result;
for (;length > index; index++) if (NO_HOLES || index in self) {
value = self[index];
result = boundFunction(value, index, O);
if (TYPE) {
if (IS_MAP) target[index] = result; // map
else if (result) switch (TYPE) {
case 3: return true; // some
case 5: return value; // find
case 6: return index; // findIndex
case 2: push.call(target, value); // filter
} else switch (TYPE) {
case 4: return false; // every
case 7: push.call(target, value); // filterOut
}
}
}
return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
};
};
var arrayIteration = {
// `Array.prototype.forEach` method
// https://tc39.es/ecma262/#sec-array.prototype.foreach
forEach: createMethod(0),
// `Array.prototype.map` method
// https://tc39.es/ecma262/#sec-array.prototype.map
map: createMethod(1),
// `Array.prototype.filter` method
// https://tc39.es/ecma262/#sec-array.prototype.filter
filter: createMethod(2),
// `Array.prototype.some` method
// https://tc39.es/ecma262/#sec-array.prototype.some
some: createMethod(3),
// `Array.prototype.every` method
// https://tc39.es/ecma262/#sec-array.prototype.every
every: createMethod(4),
// `Array.prototype.find` method
// https://tc39.es/ecma262/#sec-array.prototype.find
find: createMethod(5),
// `Array.prototype.findIndex` method
// https://tc39.es/ecma262/#sec-array.prototype.findIndex
findIndex: createMethod(6),
// `Array.prototype.filterOut` method
// https://github.com/tc39/proposal-array-filtering
filterOut: createMethod(7)
};
var aFunction$1 = function (variable) {
return typeof variable == 'function' ? variable : undefined;
};
var getBuiltIn = function (namespace, method) {
return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global_1[namespace])
: path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method];
};
var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
var process = global_1.process;
var versions = process && process.versions;
var v8 = versions && versions.v8;
var match, version;
if (v8) {
match = v8.split('.');
version = match[0] + match[1];
} else if (engineUserAgent) {
match = engineUserAgent.match(/Edge\/(\d+)/);
if (!match || match[1] >= 74) {
match = engineUserAgent.match(/Chrome\/(\d+)/);
if (match) version = match[1];
}
}
var engineV8Version = version && +version;
var SPECIES$1 = wellKnownSymbol('species');
var arrayMethodHasSpeciesSupport = function (METHOD_NAME) {
// We can't use this feature detection in V8 since it causes
// deoptimization and serious performance degradation
// https://github.com/zloirock/core-js/issues/677
return engineV8Version >= 51 || !fails(function () {
var array = [];
var constructor = array.constructor = {};
constructor[SPECIES$1] = function () {
return { foo: 1 };
};
return array[METHOD_NAME](Boolean).foo !== 1;
});
};
var defineProperty = Object.defineProperty;
var cache = {};
var thrower = function (it) { throw it; };
var arrayMethodUsesToLength = function (METHOD_NAME, options) {
if (has(cache, METHOD_NAME)) return cache[METHOD_NAME];
if (!options) options = {};
var method = [][METHOD_NAME];
var ACCESSORS = has(options, 'ACCESSORS') ? options.ACCESSORS : false;
var argument0 = has(options, 0) ? options[0] : thrower;
var argument1 = has(options, 1) ? options[1] : undefined;
return cache[METHOD_NAME] = !!method && !fails(function () {
if (ACCESSORS && !descriptors) return true;
var O = { length: -1 };
if (ACCESSORS) defineProperty(O, 1, { enumerable: true, get: thrower });
else O[1] = 1;
method.call(O, argument0, argument1);
});
};
var $filter = arrayIteration.filter;
var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter');
// Edge 14- issue
var USES_TO_LENGTH = arrayMethodUsesToLength('filter');
// `Array.prototype.filter` method
// https://tc39.es/ecma262/#sec-array.prototype.filter
// with adding support of @@species
_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT || !USES_TO_LENGTH }, {
filter: function filter(callbackfn /* , thisArg */) {
return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
});
var entryVirtual = function (CONSTRUCTOR) {
return path[CONSTRUCTOR + 'Prototype'];
};
var filter = entryVirtual('Array').filter;
var ArrayPrototype = Array.prototype;
var filter_1 = function (it) {
var own = it.filter;
return it === ArrayPrototype || (it instanceof Array && own === ArrayPrototype.filter) ? filter : own;
};
var filter$1 = filter_1;
var filter$2 = filter$1;
var nativeReverse = [].reverse;
var test = [1, 2];
// `Array.prototype.reverse` method
// https://tc39.es/ecma262/#sec-array.prototype.reverse
// fix for Safari 12.0 bug
// https://bugs.webkit.org/show_bug.cgi?id=188794
_export({ target: 'Array', proto: true, forced: String(test) === String(test.reverse()) }, {
reverse: function reverse() {
// eslint-disable-next-line no-self-assign
if (isArray(this)) this.length = this.length;
return nativeReverse.call(this);
}
});
var reverse = entryVirtual('Array').reverse;
var ArrayPrototype$1 = Array.prototype;
var reverse_1 = function (it) {
var own = it.reverse;
return it === ArrayPrototype$1 || (it instanceof Array && own === ArrayPrototype$1.reverse) ? reverse : own;
};
var reverse$1 = reverse_1;
var reverse$2 = reverse$1;
var $map = arrayIteration.map;
var HAS_SPECIES_SUPPORT$1 = arrayMethodHasSpeciesSupport('map');
// FF49- issue
var USES_TO_LENGTH$1 = arrayMethodUsesToLength('map');
// `Array.prototype.map` method
// https://tc39.es/ecma262/#sec-array.prototype.map
// with adding support of @@species
_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 || !USES_TO_LENGTH$1 }, {
map: function map(callbackfn /* , thisArg */) {
return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
}
});
var map = entryVirtual('Array').map;
var ArrayPrototype$2 = Array.prototype;
var map_1 = function (it) {
var own = it.map;
return it === ArrayPrototype$2 || (it instanceof Array && own === ArrayPrototype$2.map) ? map : own;
};
var map$1 = map_1;
var map$2 = map$1;
var max = Math.max;
var min$1 = Math.min;
// Helper for a popular repeating case of the spec:
// Let integer be ? ToInteger(index).
// If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
var toAbsoluteIndex = function (index, length) {
var integer = toInteger(index);
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
};
var createProperty = function (object, key, value) {
var propertyKey = toPrimitive(key);
if (propertyKey in object) objectDefineProperty.f(object, propertyKey, createPropertyDescriptor(0, value));
else object[propertyKey] = value;
};
var HAS_SPECIES_SUPPORT$2 = arrayMethodHasSpeciesSupport('slice');
var USES_TO_LENGTH$2 = arrayMethodUsesToLength('slice', { ACCESSORS: true, 0: 0, 1: 2 });
var SPECIES$2 = wellKnownSymbol('species');
var nativeSlice = [].slice;
var max$1 = Math.max;
// `Array.prototype.slice` method
// https://tc39.es/ecma262/#sec-array.prototype.slice
// fallback for not array-like ES3 strings and DOM objects
_export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$2 || !USES_TO_LENGTH$2 }, {
slice: function slice(start, end) {
var O = toIndexedObject(this);
var length = toLength(O.length);
var k = toAbsoluteIndex(start, length);
var fin = toAbsoluteIndex(end === undefined ? length : end, length);
// inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible
var Constructor, result, n;
if (isArray(O)) {
Constructor = O.constructor;
// cross-realm fallback
if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) {
Constructor = undefined;
} else if (isObject(Constructor)) {
Constructor = Constructor[SPECIES$2];
if (Constructor === null) Constructor = undefined;
}
if (Constructor === Array || Constructor === undefined) {
return nativeSlice.call(O, k, fin);
}
}
result = new (Constructor === undefined ? Array : Constructor)(max$1(fin - k, 0));
for (n = 0; k < fin; k++, n++) if (k in O) createProperty(result, n, O[k]);
result.length = n;
return result;
}
});
var slice = entryVirtual('Array').slice;
var ArrayPrototype$3 = Array.prototype;
var slice_1 = function (it) {
var own = it.slice;
return it === ArrayPrototype$3 || (it instanceof Array && own === ArrayPrototype$3.slice) ? slice : own;
};
var slice$1 = slice_1;
var slice$2 = slice$1;
// `Array.prototype.{ indexOf, includes }` methods implementation
var createMethod$1 = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = toIndexedObject($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) && O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
var arrayIncludes = {
// `Array.prototype.includes` method
// https://tc39.es/ecma262/#sec-array.prototype.includes
includes: createMethod$1(true),
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
indexOf: createMethod$1(false)
};
var arrayMethodIsStrict = function (METHOD_NAME, argument) {
var method = [][METHOD_NAME];
return !!method && fails(function () {
// eslint-disable-next-line no-useless-call,no-throw-literal
method.call(null, argument || function () { throw 1; }, 1);
});
};
var $indexOf = arrayIncludes.indexOf;
var nativeIndexOf = [].indexOf;
var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0;
var STRICT_METHOD = arrayMethodIsStrict('indexOf');
var USES_TO_LENGTH$3 = arrayMethodUsesToLength('indexOf', { ACCESSORS: true, 1: 0 });
// `Array.prototype.indexOf` method
// https://tc39.es/ecma262/#sec-array.prototype.indexof
_export({ target: 'Array', proto: true, forced: NEGATIVE_ZERO || !STRICT_METHOD || !USES_TO_LENGTH$3 }, {
indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
return NEGATIVE_ZERO
// convert -0 to +0
? nativeIndexOf.apply(this, arguments) || 0
: $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined);
}
});
var indexOf = entryVirtual('Array').indexOf;
var ArrayPrototype$4 = Array.prototype;
var indexOf_1 = function (it) {
var own = it.indexOf;
return it === ArrayPrototype$4 || (it instanceof Array && own === ArrayPrototype$4.indexOf) ? indexOf : own;
};
var indexOf$1 = indexOf_1;
var indexOf$2 = indexOf$1;
var hiddenKeys = {};
var freezing = !fails(function () {
return Object.isExtensible(Object.preventExtensions({}));
});
var internalMetadata = createCommonjsModule(function (module) {
var defineProperty = objectDefineProperty.f;
var METADATA = uid('meta');
var id = 0;
var isExtensible = Object.isExtensible || function () {
return true;
};
var setMetadata = function (it) {
defineProperty(it, METADATA, { value: {
objectID: 'O' + ++id, // object ID
weakData: {} // weak collections IDs
} });
};
var fastKey = function (it, create) {
// return a primitive with prefix
if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if (!has(it, METADATA)) {
// 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
setMetadata(it);
// return object ID
} return it[METADATA].objectID;
};
var getWeakData = function (it, create) {
if (!has(it, METADATA)) {
// 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
setMetadata(it);
// return the store of weak collections IDs
} return it[METADATA].weakData;
};
// add metadata on freeze-family methods calling
var onFreeze = function (it) {
if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);
return it;
};
var meta = module.exports = {
REQUIRED: false,
fastKey: fastKey,
getWeakData: getWeakData,
onFreeze: onFreeze
};
hiddenKeys[METADATA] = true;
});
var iterators = {};
var ITERATOR = wellKnownSymbol('iterator');
var ArrayPrototype$5 = Array.prototype;
// check on default Array iterator
var isArrayIteratorMethod = function (it) {
return it !== undefined && (iterators.Array === it || ArrayPrototype$5[ITERATOR] === it);
};
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
var test$1 = {};
test$1[TO_STRING_TAG] = 'z';
var toStringTagSupport = String(test$1) === '[object z]';
var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
// ES3 wrong here
var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
try {
return it[key];
} catch (error) { /* empty */ }
};
// getting tag from ES6+ `Object.prototype.toString`
var classof = toStringTagSupport ? classofRaw : function (it) {
var O, tag, result;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag
// builtinTag case
: CORRECT_ARGUMENTS ? classofRaw(O)
// ES3 arguments fallback
: (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
};
var ITERATOR$1 = wellKnownSymbol('iterator');
var getIteratorMethod = function (it) {
if (it != undefined) return it[ITERATOR$1]
|| it['@@iterator']
|| iterators[classof(it)];
};
var iteratorClose = function (iterator) {
var returnMethod = iterator['return'];
if (returnMethod !== undefined) {
return anObject(returnMethod.call(iterator)).value;
}
};
var Result = function (stopped, result) {
this.stopped = stopped;
this.result = result;
};
var iterate = function (iterable, unboundFunction, options) {
var that = options && options.that;
var AS_ENTRIES = !!(options && options.AS_ENTRIES);
var IS_ITERATOR = !!(options && options.IS_ITERATOR);
var INTERRUPTED = !!(options && options.INTERRUPTED);
var fn = functionBindContext(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED);
var iterator, iterFn, index, length, result, next, step;
var stop = function (condition) {
if (iterator) iteratorClose(iterator);
return new Result(true, condition);
};
var callFn = function (value) {
if (AS_ENTRIES) {
anObject(value);
return INTERRUPTED ? fn(value[0], value[1], stop) : fn(value[0], value[1]);
} return INTERRUPTED ? fn(value, stop) : fn(value);
};
if (IS_ITERATOR) {
iterator = iterable;
} else {
iterFn = getIteratorMethod(iterable);
if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
// optimisation for array iterators
if (isArrayIteratorMethod(iterFn)) {
for (index = 0, length = toLength(iterable.length); length > index; index++) {
result = callFn(iterable[index]);
if (result && result instanceof Result) return result;
} return new Result(false);
}
iterator = iterFn.call(iterable);
}
next = iterator.next;
while (!(step = next.call(iterator)).done) {
try {
result = callFn(step.value);
} catch (error) {
iteratorClose(iterator);
throw error;
}
if (typeof result == 'object' && result && result instanceof Result) return result;
} return new Result(false);
};
var anInstance = function (it, Constructor, name) {
if (!(it instanceof Constructor)) {
throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
} return it;
};
// `Object.prototype.toString` method implementation
// https://tc39.es/ecma262/#sec-object.prototype.tostring
var objectToString = toStringTagSupport ? {}.toString : function toString() {
return '[object ' + classof(this) + ']';
};
var defineProperty$1 = objectDefineProperty.f;
var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag');
var setToStringTag = function (it, TAG, STATIC, SET_METHOD) {
if (it) {
var target = STATIC ? it : it.prototype;
if (!has(target, TO_STRING_TAG$2)) {
defineProperty$1(target, TO_STRING_TAG$2, { configurable: true, value: TAG });
}
if (SET_METHOD && !toStringTagSupport) {
createNonEnumerableProperty(target, 'toString', objectToString);
}
}
};
var functionToString = Function.toString;
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
if (typeof sharedStore.inspectSource != 'function') {
sharedStore.inspectSource = function (it) {
return functionToString.call(it);
};
}
var inspectSource = sharedStore.inspectSource;
var WeakMap = global_1.WeakMap;
var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
var keys = shared('keys');
var sharedKey = function (key) {
return keys[key] || (keys[key] = uid(key));
};
var WeakMap$1 = global_1.WeakMap;
var set, get, has$1;
var enforce = function (it) {
return has$1(it) ? get(it) : set(it, {});
};
var getterFor = function (TYPE) {
return function (it) {
var state;
if (!isObject(it) || (state = get(it)).type !== TYPE) {
throw TypeError('Incompatible receiver, ' + TYPE + ' required');
} return state;
};
};
if (nativeWeakMap) {
var store$1 = sharedStore.state || (sharedStore.state = new WeakMap$1());
var wmget = store$1.get;
var wmhas = store$1.has;
var wmset = store$1.set;
set = function (it, metadata) {
metadata.facade = it;
wmset.call(store$1, it, metadata);
return metadata;
};
get = function (it) {
return wmget.call(store$1, it) || {};
};
has$1 = function (it) {
return wmhas.call(store$1, it);
};
} else {
var STATE = sharedKey('state');
hiddenKeys[STATE] = true;
set = function (it, metadata) {
metadata.facade = it;
createNonEnumerableProperty(it, STATE, metadata);
return metadata;
};
get = function (it) {
return has(it, STATE) ? it[STATE] : {};
};
has$1 = function (it) {
return has(it, STATE);
};
}
var internalState = {
set: set,
get: get,
has: has$1,
enforce: enforce,
getterFor: getterFor
};
var defineProperty$2 = objectDefineProperty.f;
var forEach = arrayIteration.forEach;
var setInternalState = internalState.set;
var internalStateGetterFor = internalState.getterFor;
var collection = function (CONSTRUCTOR_NAME, wrapper, common) {
var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;
var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;
var ADDER = IS_MAP ? 'set' : 'add';
var NativeConstructor = global_1[CONSTRUCTOR_NAME];
var NativePrototype = NativeConstructor && NativeConstructor.prototype;
var exported = {};
var Constructor;
if (!descriptors || typeof NativeConstructor != 'function'
|| !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))
) {
// create collection constructor
Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);
internalMetadata.REQUIRED = true;
} else {
Constructor = wrapper(function (target, iterable) {
setInternalState(anInstance(target, Constructor, CONSTRUCTOR_NAME), {
type: CONSTRUCTOR_NAME,
collection: new NativeConstructor()
});
if (iterable != undefined) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });
});
var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);
forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {
var IS_ADDER = KEY == 'add' || KEY == 'set';
if (KEY in NativePrototype && !(IS_WEAK && KEY == 'clear')) {
createNonEnumerableProperty(Constructor.prototype, KEY, function (a, b) {
var collection = getInternalState(this).collection;
if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
var result = collection[KEY](a === 0 ? 0 : a, b);
return IS_ADDER ? this : result;
});
}
});
IS_WEAK || defineProperty$2(Constructor.prototype, 'size', {
configurable: true,
get: function () {
return getInternalState(this).collection.size;
}
});
}
setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);
exported[CONSTRUCTOR_NAME] = Constructor;
_export({ global: true, forced: true }, exported);
if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);
return Constructor;
};
var indexOf$3 = arrayIncludes.indexOf;
var objectKeysInternal = function (object, names) {
var O = toIndexedObject(object);
var i = 0;
var result = [];
var key;
for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i) if (has(O, key = names[i++])) {
~indexOf$3(result, key) || result.push(key);
}
return result;
};
// IE8- don't enum bug keys
var enumBugKeys = [
'constructor',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'toLocaleString',
'toString',
'valueOf'
];
// `Object.keys` method
// https://tc39.es/ecma262/#sec-object.keys
var objectKeys = Object.keys || function keys(O) {
return objectKeysInternal(O, enumBugKeys);
};
// `Object.defineProperties` method
// https://tc39.es/ecma262/#sec-object.defineproperties
var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var keys = objectKeys(Properties);
var length = keys.length;
var index = 0;
var key;
while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]);
return O;
};
var html = getBuiltIn('document', 'documentElement');
var GT = '>';
var LT = '<';
var PROTOTYPE = 'prototype';
var SCRIPT = 'script';
var IE_PROTO = sharedKey('IE_PROTO');
var EmptyConstructor = function () { /* empty */ };
var scriptTag = function (content) {
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
};
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
var NullProtoObjectViaActiveX = function (activeXDocument) {
activeXDocument.write(scriptTag(''));
activeXDocument.close();
var temp = activeXDocument.parentWindow.Object;
activeXDocument = null; // avoid memory leak
return temp;
};
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var NullProtoObjectViaIFrame = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = documentCreateElement('iframe');
var JS = 'java' + SCRIPT + ':';
var iframeDocument;
iframe.style.display = 'none';
html.appendChild(iframe);
// https://github.com/zloirock/core-js/issues/475
iframe.src = String(JS);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(scriptTag('document.F=Object'));
iframeDocument.close();
return iframeDocument.F;
};
// Check for document.domain and active x support
// No need to use active x approach when document.domain is not set
// see https://github.com/es-shims/es5-shim/issues/150
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
// avoid IE GC bug
var activeXDocument;
var NullProtoObject = function () {
try {
/* global ActiveXObject */
activeXDocument = document.domain && new ActiveXObject('htmlfile');
} catch (error) { /* ignore */ }
NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
var length = enumBugKeys.length;
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
return NullProtoObject();
};
hiddenKeys[IE_PROTO] = true;
// `Object.create` method
// https://tc39.es/ecma262/#sec-object.create
var objectCreate = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
EmptyConstructor[PROTOTYPE] = anObject(O);
result = new EmptyConstructor();
EmptyConstructor[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = NullProtoObject();
return Properties === undefined ? result : objectDefineProperties(result, Properties);
};
var redefine = function (target, key, value, options) {
if (options && options.enumerable) target[key] = value;
else createNonEnumerableProperty(target, key, value);
};
var redefineAll = function (target, src, options) {
for (var key in src) {
if (options && options.unsafe && target[key]) target[key] = src[key];
else redefine(target, key, src[key], options);
} return target;
};
var correctPrototypeGetter = !fails(function () {
function F() { /* empty */ }
F.prototype.constructor = null;
return Object.getPrototypeOf(new F()) !== F.prototype;
});
var IE_PROTO$1 = sharedKey('IE_PROTO');
var ObjectPrototype = Object.prototype;
// `Object.getPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.getprototypeof
var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
O = toObject(O);
if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
if (typeof O.constructor == 'function' && O instanceof O.constructor) {
return O.constructor.prototype;
} return O instanceof Object ? ObjectPrototype : null;
};
var ITERATOR$2 = wellKnownSymbol('iterator');
var BUGGY_SAFARI_ITERATORS = false;
// `%IteratorPrototype%` object
// https://tc39.es/ecma262/#sec-%iteratorprototype%-object
var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
if ([].keys) {
arrayIterator = [].keys();
// Safari 8 has buggy iterators w/o `next`
if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
else {
PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
}
}
if (IteratorPrototype == undefined) IteratorPrototype = {};
var iteratorsCore = {
IteratorPrototype: IteratorPrototype,
BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
};
var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
var returnThis = function () { return this; };
var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
var TO_STRING_TAG = NAME + ' Iterator';
IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
iterators[TO_STRING_TAG] = returnThis;
return IteratorConstructor;
};
var aPossiblePrototype = function (it) {
if (!isObject(it) && it !== null) {
throw TypeError("Can't set " + String(it) + ' as a prototype');
} return it;
};
// `Object.setPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.setprototypeof
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
var CORRECT_SETTER = false;
var test = {};
var setter;
try {
setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
setter.call(test, []);
CORRECT_SETTER = test instanceof Array;
} catch (error) { /* empty */ }
return function setPrototypeOf(O, proto) {
anObject(O);
aPossiblePrototype(proto);
if (CORRECT_SETTER) setter.call(O, proto);
else O.__proto__ = proto;
return O;
};
}() : undefined);
var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
var ITERATOR$3 = wellKnownSymbol('iterator');
var KEYS = 'keys';
var VALUES = 'values';
var ENTRIES = 'entries';
var returnThis$1 = function () { return this; };
var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
createIteratorConstructor(IteratorConstructor, NAME, next);
var getIterationMethod = function (KIND) {
if (KIND === DEFAULT && defaultIterator) return defaultIterator;
if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
switch (KIND) {
case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
} return function () { return new IteratorConstructor(this); };
};
var TO_STRING_TAG = NAME + ' Iterator';
var INCORRECT_VALUES_NAME = false;
var IterablePrototype = Iterable.prototype;
var nativeIterator = IterablePrototype[ITERATOR$3]
|| IterablePrototype['@@iterator']
|| DEFAULT && IterablePrototype[DEFAULT];
var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
var CurrentIteratorPrototype, methods, KEY;
// fix native
if (anyNativeIterator) {
CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
// Set @@toStringTag to native iterators
setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
iterators[TO_STRING_TAG] = returnThis$1;
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
INCORRECT_VALUES_NAME = true;
defaultIterator = function values() { return nativeIterator.call(this); };
}
// define iterator
if (( FORCED) && IterablePrototype[ITERATOR$3] !== defaultIterator) {
createNonEnumerableProperty(IterablePrototype, ITERATOR$3, defaultIterator);
}
iterators[NAME] = defaultIterator;
// export additional methods
if (DEFAULT) {
methods = {
values: getIterationMethod(VALUES),
keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
entries: getIterationMethod(ENTRIES)
};
if (FORCED) for (KEY in methods) {
if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
redefine(IterablePrototype, KEY, methods[KEY]);
}
} else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);
}
return methods;
};
var SPECIES$3 = wellKnownSymbol('species');
var setSpecies = function (CONSTRUCTOR_NAME) {
var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
var defineProperty = objectDefineProperty.f;
if (descriptors && Constructor && !Constructor[SPECIES$3]) {
defineProperty(Constructor, SPECIES$3, {
configurable: true,
get: function () { return this; }
});
}
};
var defineProperty$3 = objectDefineProperty.f;
var fastKey = internalMetadata.fastKey;
var setInternalState$1 = internalState.set;
var internalStateGetterFor$1 = internalState.getterFor;
var collectionStrong = {
getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {
var C = wrapper(function (that, iterable) {
anInstance(that, C, CONSTRUCTOR_NAME);
setInternalState$1(that, {
type: CONSTRUCTOR_NAME,
index: objectCreate(null),
first: undefined,
last: undefined,
size: 0
});
if (!descriptors) that.size = 0;
if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });
});
var getInternalState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
var define = function (that, key, value) {
var state = getInternalState(that);
var entry = getEntry(that, key);
var previous, index;
// change existing entry
if (entry) {
entry.value = value;
// create new entry
} else {
state.last = entry = {
index: index = fastKey(key, true),
key: key,
value: value,
previous: previous = state.last,
next: undefined,
removed: false
};
if (!state.first) state.first = entry;
if (previous) previous.next = entry;
if (descriptors) state.size++;
else that.size++;
// add to index
if (index !== 'F') state.index[index] = entry;
} return that;
};
var getEntry = function (that, key) {
var state = getInternalState(that);
// fast case
var index = fastKey(key);
var entry;
if (index !== 'F') return state.index[index];
// frozen object case
for (entry = state.first; entry; entry = entry.next) {
if (entry.key == key) return entry;
}
};
redefineAll(C.prototype, {
// 23.1.3.1 Map.prototype.clear()
// 23.2.3.2 Set.prototype.clear()
clear: function clear() {
var that = this;
var state = getInternalState(that);
var data = state.index;
var entry = state.first;
while (entry) {
entry.removed = true;
if (entry.previous) entry.previous = entry.previous.next = undefined;
delete data[entry.index];
entry = entry.next;
}
state.first = state.last = undefined;
if (descriptors) state.size = 0;
else that.size = 0;
},
// 23.1.3.3 Map.prototype.delete(key)
// 23.2.3.4 Set.prototype.delete(value)
'delete': function (key) {
var that = this;
var state = getInternalState(that);
var entry = getEntry(that, key);
if (entry) {
var next = entry.next;
var prev = entry.previous;
delete state.index[entry.index];
entry.removed = true;
if (prev) prev.next = next;
if (next) next.previous = prev;
if (state.first == entry) state.first = next;
if (state.last == entry) state.last = prev;
if (descriptors) state.size--;
else 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 */) {
var state = getInternalState(this);
var boundFunction = functionBindContext(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
var entry;
while (entry = entry ? entry.next : state.first) {
boundFunction(entry.value, entry.key, this);
// revert to the last existing entry
while (entry && entry.removed) entry = entry.previous;
}
},
// 23.1.3.7 Map.prototype.has(key)
// 23.2.3.7 Set.prototype.has(value)
has: function has(key) {
return !!getEntry(this, key);
}
});
redefineAll(C.prototype, IS_MAP ? {
// 23.1.3.6 Map.prototype.get(key)
get: function get(key) {
var entry = getEntry(this, key);
return entry && entry.value;
},
// 23.1.3.9 Map.prototype.set(key, value)
set: function set(key, value) {
return define(this, key === 0 ? 0 : key, value);
}
} : {
// 23.2.3.1 Set.prototype.add(value)
add: function add(value) {
return define(this, value = value === 0 ? 0 : value, value);
}
});
if (descriptors) defineProperty$3(C.prototype, 'size', {
get: function () {
return getInternalState(this).size;
}
});
return C;
},
setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) {
var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
var getInternalCollectionState = internalStateGetterFor$1(CONSTRUCTOR_NAME);
var getInternalIteratorState = internalStateGetterFor$1(ITERATOR_NAME);
// 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
defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
setInternalState$1(this, {
type: ITERATOR_NAME,
target: iterated,
state: getInternalCollectionState(iterated),
kind: kind,
last: undefined
});
}, function () {
var state = getInternalIteratorState(this);
var kind = state.kind;
var entry = state.last;
// revert to the last existing entry
while (entry && entry.removed) entry = entry.previous;
// get next entry
if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {
// or finish the iteration
state.target = undefined;
return { value: undefined, done: true };
}
// return step by kind
if (kind == 'keys') return { value: entry.key, done: false };
if (kind == 'values') return { value: entry.value, done: false };
return { value: [entry.key, entry.value], done: false };
}, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
// add [@@species], 23.1.2.2, 23.2.2.2
setSpecies(CONSTRUCTOR_NAME);
}
};
// `Set` constructor
// https://tc39.es/ecma262/#sec-set-objects
var es_set = collection('Set', function (init) {
return function Set() { return init(this, arguments.length ? arguments[0] : undefined); };
}, collectionStrong);
// `String.prototype.{ codePointAt, at }` methods implementation
var createMethod$2 = function (CONVERT_TO_STRING) {
return function ($this, pos) {
var S = String(requireObjectCoercible($this));
var position = toInteger(pos);
var size = S.length;
var first, second;
if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined;
first = S.charCodeAt(position);
return first < 0xD800 || first > 0xDBFF || position + 1 === size
|| (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF
? CONVERT_TO_STRING ? S.charAt(position) : first
: CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000;
};
};
var stringMultibyte = {
// `String.prototype.codePointAt` method
// https://tc39.es/ecma262/#sec-string.prototype.codepointat
codeAt: createMethod$2(false),
// `String.prototype.at` method
// https://github.com/mathiasbynens/String.prototype.at
charAt: createMethod$2(true)
};
var charAt = stringMultibyte.charAt;
var STRING_ITERATOR = 'String Iterator';
var setInternalState$2 = internalState.set;
var getInternalState = internalState.getterFor(STRING_ITERATOR);
// `String.prototype[@@iterator]` method
// https://tc39.es/ecma262/#sec-string.prototype-@@iterator
defineIterator(String, 'String', function (iterated) {
setInternalState$2(this, {
type: STRING_ITERATOR,
string: String(iterated),
index: 0
});
// `%StringIteratorPrototype%.next` method
// https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
}, function next() {
var state = getInternalState(this);
var string = state.string;
var index = state.index;
var point;
if (index >= string.length) return { value: undefined, done: true };
point = charAt(string, index);
state.index += point.length;
return { value: point, done: false };
});
var ARRAY_ITERATOR = 'Array Iterator';
var setInternalState$3 = internalState.set;
var getInternalState$1 = internalState.getterFor(ARRAY_ITERATOR);
// `Array.prototype.entries` method
// https://tc39.es/ecma262/#sec-array.prototype.entries
// `Array.prototype.keys` method
// https://tc39.es/ecma262/#sec-array.prototype.keys
// `Array.prototype.values` method
// https://tc39.es/ecma262/#sec-array.prototype.values
// `Array.prototype[@@iterator]` method
// https://tc39.es/ecma262/#sec-array.prototype-@@iterator
// `CreateArrayIterator` internal method
// https://tc39.es/ecma262/#sec-createarrayiterator
var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
setInternalState$3(this, {
type: ARRAY_ITERATOR,
target: toIndexedObject(iterated), // target
index: 0, // next index
kind: kind // kind
});
// `%ArrayIteratorPrototype%.next` method
// https://tc39.es/ecma262/#sec-%arrayiteratorprototype%.next
}, function () {
var state = getInternalState$1(this);
var target = state.target;
var kind = state.kind;
var index = state.index++;
if (!target || index >= target.length) {
state.target = undefined;
return { value: undefined, done: true };
}
if (kind == 'keys') return { value: index, done: false };
if (kind == 'values') return { value: target[index], done: false };
return { value: [index, target[index]], done: false };
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values%
// https://tc39.es/ecma262/#sec-createunmappedargumentsobject
// https://tc39.es/ecma262/#sec-createmappedargumentsobject
iterators.Arguments = iterators.Array;
// iterable DOM collections
// flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods
var domIterables = {
CSSRuleList: 0,
CSSStyleDeclaration: 0,
CSSValueList: 0,
ClientRectList: 0,
DOMRectList: 0,
DOMStringList: 0,
DOMTokenList: 1,
DataTransferItemList: 0,
FileList: 0,
HTMLAllCollection: 0,
HTMLCollection: 0,
HTMLFormElement: 0,
HTMLSelectElement: 0,
MediaList: 0,
MimeTypeArray: 0,
NamedNodeMap: 0,
NodeList: 1,
PaintRequestList: 0,
Plugin: 0,
PluginArray: 0,
SVGLengthList: 0,
SVGNumberList: 0,
SVGPathSegList: 0,
SVGPointList: 0,
SVGStringList: 0,
SVGTransformList: 0,
SourceBufferList: 0,
StyleSheetList: 0,
TextTrackCueList: 0,
TextTrackList: 0,
TouchList: 0
};
var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag');
for (var COLLECTION_NAME in domIterables) {
var Collection = global_1[COLLECTION_NAME];
var CollectionPrototype = Collection && Collection.prototype;
if (CollectionPrototype && classof(CollectionPrototype) !== TO_STRING_TAG$3) {
createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG$3, COLLECTION_NAME);
}
iterators[COLLECTION_NAME] = iterators.Array;
}
var set$1 = path.Set;
var set$2 = set$1;
var set$3 = set$2;
// `Array.prototype.{ reduce, reduceRight }` methods implementation
var createMethod$3 = function (IS_RIGHT) {
return function (that, callbackfn, argumentsLength, memo) {
aFunction(callbackfn);
var O = toObject(that);
var self = indexedObject(O);
var length = toLength(O.length);
var index = IS_RIGHT ? length - 1 : 0;
var i = IS_RIGHT ? -1 : 1;
if (argumentsLength < 2) while (true) {
if (index in self) {
memo = self[index];
index += i;
break;
}
index += i;
if (IS_RIGHT ? index < 0 : length <= index) {
throw TypeError('Reduce of empty array with no initial value');
}
}
for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
memo = callbackfn(memo, self[index], index, O);
}
return memo;
};
};
var arrayReduce = {
// `Array.prototype.reduce` method
// https://tc39.es/ecma262/#sec-array.prototype.reduce
left: createMethod$3(false),
// `Array.prototype.reduceRight` method
// https://tc39.es/ecma262/#sec-array.prototype.reduceright
right: createMethod$3(true)
};
var engineIsNode = classofRaw(global_1.process) == 'process';
var $reduce = arrayReduce.left;
var STRICT_METHOD$1 = arrayMethodIsStrict('reduce');
var USES_TO_LENGTH$4 = arrayMethodUsesToLength('reduce', { 1: 0 });
// Chrome 80-82 has a critical bug
// https://bugs.chromium.org/p/chromium/issues/detail?id=1049982
var CHROME_BUG = !engineIsNode && engineV8Version > 79 && engineV8Version < 83;
// `Array.prototype.reduce` method
// https://tc39.es/ecma262/#sec-array.prototype.reduce
_export({ target: 'Array', proto: true, forced: !STRICT_METHOD$1 || !USES_TO_LENGTH$4 || CHROME_BUG }, {
reduce: function reduce(callbackfn /* , initialValue */) {
return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined);
}
});
var reduce = entryVirtual('Array').reduce;
var ArrayPrototype$6 = Array.prototype;
var reduce_1 = function (it) {
var own = it.reduce;
return it === ArrayPrototype$6 || (it instanceof Array && own === ArrayPrototype$6.reduce) ? reduce : own;
};
var reduce$1 = reduce_1;
var reduce$2 = reduce$1;
var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
// We can't use this feature detection in V8 since it causes
// deoptimization and serious performance degradation
// https://github.com/zloirock/core-js/issues/679
var IS_CONCAT_SPREADABLE_SUPPORT = engineV8Version >= 51 || !fails(function () {
var array = [];
array[IS_CONCAT_SPREADABLE] = false;
return array.concat()[0] !== array;
});
var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
var isConcatSpreadable = function (O) {
if (!isObject(O)) return false;
var spreadable = O[IS_CONCAT_SPREADABLE];
return spreadable !== undefined ? !!spreadable : isArray(O);
};
var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
// `Array.prototype.concat` method
// https://tc39.es/ecma262/#sec-array.prototype.concat
// with adding support of @@isConcatSpreadable and @@species
_export({ target: 'Array', proto: true, forced: FORCED }, {
concat: function concat(arg) { // eslint-disable-line no-unused-vars
var O = toObject(this);
var A = arraySpeciesCreate(O, 0);
var n = 0;
var i, k, length, len, E;
for (i = -1, length = arguments.length; i < length; i++) {
E = i === -1 ? O : arguments[i];
if (isConcatSpreadable(E)) {
len = toLength(E.length);
if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
} else {
if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
createProperty(A, n++, E);
}
}
A.length = n;
return A;
}
});
var concat = entryVirtual('Array').concat;
var ArrayPrototype$7 = Array.prototype;
var concat_1 = function (it) {
var own = it.concat;
return it === ArrayPrototype$7 || (it instanceof Array && own === ArrayPrototype$7.concat) ? concat : own;
};
var concat$1 = concat_1;
var concat$2 = concat$1;
var slice$3 = [].slice;
var factories = {};
var construct = function (C, argsLength, args) {
if (!(argsLength in factories)) {
for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';
// eslint-disable-next-line no-new-func
factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')');
} return factories[argsLength](C, args);
};
// `Function.prototype.bind` method implementation
// https://tc39.es/ecma262/#sec-function.prototype.bind
var functionBind = Function.bind || function bind(that /* , ...args */) {
var fn = aFunction(this);
var partArgs = slice$3.call(arguments, 1);
var boundFunction = function bound(/* args... */) {
var args = partArgs.concat(slice$3.call(arguments));
return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args);
};
if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype;
return boundFunction;
};
var nativeConstruct = getBuiltIn('Reflect', 'construct');
// `Reflect.construct` method
// https://tc39.es/ecma262/#sec-reflect.construct
// MS Edge supports only 2 arguments and argumentsList argument is optional
// FF Nightly sets third argument as `new.target`, but does not create `this` from it
var NEW_TARGET_BUG = fails(function () {
function F() { /* empty */ }
return !(nativeConstruct(function () { /* empty */ }, [], F) instanceof F);
});
var ARGS_BUG = !fails(function () {
nativeConstruct(function () { /* empty */ });
});
var FORCED$1 = NEW_TARGET_BUG || ARGS_BUG;
_export({ target: 'Reflect', stat: true, forced: FORCED$1, sham: FORCED$1 }, {
construct: function construct(Target, args /* , newTarget */) {
aFunction(Target);
anObject(args);
var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget);
if (Target == newTarget) {
// w/o altered newTarget, optimization for 0-4 arguments
switch (args.length) {
case 0: return new Target();
case 1: return new Target(args[0]);
case 2: return new Target(args[0], args[1]);
case 3: return new Target(args[0], args[1], args[2]);
case 4: return new Target(args[0], args[1], args[2], args[3]);
}
// w/o altered newTarget, lot of arguments case
var $args = [null];
$args.push.apply($args, args);
return new (functionBind.apply(Target, $args))();
}
// with altered newTarget, not support built-in constructors
var proto = newTarget.prototype;
var instance = objectCreate(isObject(proto) ? proto : Object.prototype);
var result = Function.apply.call(Target, instance, args);
return isObject(result) ? result : instance;
}
});
var construct$1 = path.Reflect.construct;
var construct$2 = construct$1;
var construct$3 = construct$2;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
var classCallCheck = _classCallCheck;
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
var assertThisInitialized = _assertThisInitialized;
// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
_export({ target: 'Object', stat: true, forced: !descriptors, sham: !descriptors }, {
defineProperty: objectDefineProperty.f
});
var defineProperty_1 = createCommonjsModule(function (module) {
var Object = path.Object;
var defineProperty = module.exports = function defineProperty(it, key, desc) {
return Object.defineProperty(it, key, desc);
};
if (Object.defineProperty.sham) defineProperty.sham = true;
});
var defineProperty$4 = defineProperty_1;
var defineProperty$5 = defineProperty$4;
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
defineProperty$5(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
var createClass = _createClass;
// `Object.create` method
// https://tc39.es/ecma262/#sec-object.create
_export({ target: 'Object', stat: true, sham: !descriptors }, {
create: objectCreate
});
var Object$1 = path.Object;
var create = function create(P, D) {
return Object$1.create(P, D);
};
var create$1 = create;
var create$2 = create$1;
// `Object.setPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.setprototypeof
_export({ target: 'Object', stat: true }, {
setPrototypeOf: objectSetPrototypeOf
});
var setPrototypeOf = path.Object.setPrototypeOf;
var setPrototypeOf$1 = setPrototypeOf;
var setPrototypeOf$2 = setPrototypeOf$1;
var setPrototypeOf$3 = createCommonjsModule(function (module) {
function _setPrototypeOf(o, p) {
module.exports = _setPrototypeOf = setPrototypeOf$2 || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
module.exports = _setPrototypeOf;
});
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = create$2(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) setPrototypeOf$3(subClass, superClass);
}
var inherits = _inherits;
var f$3 = wellKnownSymbol;
var wellKnownSymbolWrapped = {
f: f$3
};
var defineProperty$6 = objectDefineProperty.f;
var defineWellKnownSymbol = function (NAME) {
var Symbol = path.Symbol || (path.Symbol = {});
if (!has(Symbol, NAME)) defineProperty$6(Symbol, NAME, {
value: wellKnownSymbolWrapped.f(NAME)
});
};
// `Symbol.iterator` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.iterator
defineWellKnownSymbol('iterator');
var iterator = wellKnownSymbolWrapped.f('iterator');
var iterator$1 = iterator;
var iterator$2 = iterator$1;
var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
// `Object.getOwnPropertyNames` method
// https://tc39.es/ecma262/#sec-object.getownpropertynames
var f$4 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return objectKeysInternal(O, hiddenKeys$1);
};
var objectGetOwnPropertyNames = {
f: f$4
};
var nativeGetOwnPropertyNames = objectGetOwnPropertyNames.f;
var toString$1 = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function (it) {
try {
return nativeGetOwnPropertyNames(it);
} catch (error) {
return windowNames.slice();
}
};
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var f$5 = function getOwnPropertyNames(it) {
return windowNames && toString$1.call(it) == '[object Window]'
? getWindowNames(it)
: nativeGetOwnPropertyNames(toIndexedObject(it));
};
var objectGetOwnPropertyNamesExternal = {
f: f$5
};
var f$6 = Object.getOwnPropertySymbols;
var objectGetOwnPropertySymbols = {
f: f$6
};
var $forEach = arrayIteration.forEach;
var HIDDEN = sharedKey('hidden');
var SYMBOL = 'Symbol';
var PROTOTYPE$1 = 'prototype';
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
var setInternalState$4 = internalState.set;
var getInternalState$2 = internalState.getterFor(SYMBOL);
var ObjectPrototype$1 = Object[PROTOTYPE$1];
var $Symbol = global_1.Symbol;
var $stringify = getBuiltIn('JSON', 'stringify');
var nativeGetOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
var nativeDefineProperty$1 = objectDefineProperty.f;
var nativeGetOwnPropertyNames$1 = objectGetOwnPropertyNamesExternal.f;
var nativePropertyIsEnumerable$1 = objectPropertyIsEnumerable.f;
var AllSymbols = shared('symbols');
var ObjectPrototypeSymbols = shared('op-symbols');
var StringToSymbolRegistry = shared('string-to-symbol-registry');
var SymbolToStringRegistry = shared('symbol-to-string-registry');
var WellKnownSymbolsStore$1 = shared('wks');
var QObject = global_1.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var USE_SETTER = !QObject || !QObject[PROTOTYPE$1] || !QObject[PROTOTYPE$1].findChild;
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDescriptor = descriptors && fails(function () {
return objectCreate(nativeDefineProperty$1({}, 'a', {
get: function () { return nativeDefineProperty$1(this, 'a', { value: 7 }).a; }
})).a != 7;
}) ? function (O, P, Attributes) {
var ObjectPrototypeDescriptor = nativeGetOwnPropertyDescriptor$1(ObjectPrototype$1, P);
if (ObjectPrototypeDescriptor) delete ObjectPrototype$1[P];
nativeDefineProperty$1(O, P, Attributes);
if (ObjectPrototypeDescriptor && O !== ObjectPrototype$1) {
nativeDefineProperty$1(ObjectPrototype$1, P, ObjectPrototypeDescriptor);
}
} : nativeDefineProperty$1;
var wrap = function (tag, description) {
var symbol = AllSymbols[tag] = objectCreate($Symbol[PROTOTYPE$1]);
setInternalState$4(symbol, {
type: SYMBOL,
tag: tag,
description: description
});
if (!descriptors) symbol.description = description;
return symbol;
};
var isSymbol = useSymbolAsUid ? function (it) {
return typeof it == 'symbol';
} : function (it) {
return Object(it) instanceof $Symbol;
};
var $defineProperty = function defineProperty(O, P, Attributes) {
if (O === ObjectPrototype$1) $defineProperty(ObjectPrototypeSymbols, P, Attributes);
anObject(O);
var key = toPrimitive(P, true);
anObject(Attributes);
if (has(AllSymbols, key)) {
if (!Attributes.enumerable) {
if (!has(O, HIDDEN)) nativeDefineProperty$1(O, HIDDEN, createPropertyDescriptor(1, {}));
O[HIDDEN][key] = true;
} else {
if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false;
Attributes = objectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) });
} return setSymbolDescriptor(O, key, Attributes);
} return nativeDefineProperty$1(O, key, Attributes);
};
var $defineProperties = function defineProperties(O, Properties) {
anObject(O);
var properties = toIndexedObject(Properties);
var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties));
$forEach(keys, function (key) {
if (!descriptors || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]);
});
return O;
};
var $create = function create(O, Properties) {
return Properties === undefined ? objectCreate(O) : $defineProperties(objectCreate(O), Properties);
};
var $propertyIsEnumerable = function propertyIsEnumerable(V) {
var P = toPrimitive(V, true);
var enumerable = nativePropertyIsEnumerable$1.call(this, P);
if (this === ObjectPrototype$1 && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false;
return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) {
var it = toIndexedObject(O);
var key = toPrimitive(P, true);
if (it === ObjectPrototype$1 && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return;
var descriptor = nativeGetOwnPropertyDescriptor$1(it, key);
if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) {
descriptor.enumerable = true;
}
return descriptor;
};
var $getOwnPropertyNames = function getOwnPropertyNames(O) {
var names = nativeGetOwnPropertyNames$1(toIndexedObject(O));
var result = [];
$forEach(names, function (key) {
if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key);
});
return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(O) {
var IS_OBJECT_PROTOTYPE = O === ObjectPrototype$1;
var names = nativeGetOwnPropertyNames$1(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O));
var result = [];
$forEach(names, function (key) {
if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype$1, key))) {
result.push(AllSymbols[key]);
}
});
return result;
};
// `Symbol` constructor
// https://tc39.es/ecma262/#sec-symbol-constructor
if (!nativeSymbol) {
$Symbol = function Symbol() {
if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor');
var description = !arguments.length || arguments[0] === undefined ? undefined : String(arguments[0]);
var tag = uid(description);
var setter = function (value) {
if (this === ObjectPrototype$1) setter.call(ObjectPrototypeSymbols, value);
if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value));
};
if (descriptors && USE_SETTER) setSymbolDescriptor(ObjectPrototype$1, tag, { configurable: true, set: setter });
return wrap(tag, description);
};
redefine($Symbol[PROTOTYPE$1], 'toString', function toString() {
return getInternalState$2(this).tag;
});
redefine($Symbol, 'withoutSetter', function (description) {
return wrap(uid(description), description);
});
objectPropertyIsEnumerable.f = $propertyIsEnumerable;
objectDefineProperty.f = $defineProperty;
objectGetOwnPropertyDescriptor.f = $getOwnPropertyDescriptor;
objectGetOwnPropertyNames.f = objectGetOwnPropertyNamesExternal.f = $getOwnPropertyNames;
objectGetOwnPropertySymbols.f = $getOwnPropertySymbols;
wellKnownSymbolWrapped.f = function (name) {
return wrap(wellKnownSymbol(name), name);
};
if (descriptors) {
// https://github.com/tc39/proposal-Symbol-description
nativeDefineProperty$1($Symbol[PROTOTYPE$1], 'description', {
configurable: true,
get: function description() {
return getInternalState$2(this).description;
}
});
}
}
_export({ global: true, wrap: true, forced: !nativeSymbol, sham: !nativeSymbol }, {
Symbol: $Symbol
});
$forEach(objectKeys(WellKnownSymbolsStore$1), function (name) {
defineWellKnownSymbol(name);
});
_export({ target: SYMBOL, stat: true, forced: !nativeSymbol }, {
// `Symbol.for` method
// https://tc39.es/ecma262/#sec-symbol.for
'for': function (key) {
var string = String(key);
if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string];
var symbol = $Symbol(string);
StringToSymbolRegistry[string] = symbol;
SymbolToStringRegistry[symbol] = string;
return symbol;
},
// `Symbol.keyFor` method
// https://tc39.es/ecma262/#sec-symbol.keyfor
keyFor: function keyFor(sym) {
if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol');
if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym];
},
useSetter: function () { USE_SETTER = true; },
useSimple: function () { USE_SETTER = false; }
});
_export({ target: 'Object', stat: true, forced: !nativeSymbol, sham: !descriptors }, {
// `Object.create` method
// https://tc39.es/ecma262/#sec-object.create
create: $create,
// `Object.defineProperty` method
// https://tc39.es/ecma262/#sec-object.defineproperty
defineProperty: $defineProperty,
// `Object.defineProperties` method
// https://tc39.es/ecma262/#sec-object.defineproperties
defineProperties: $defineProperties,
// `Object.getOwnPropertyDescriptor` method
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptors
getOwnPropertyDescriptor: $getOwnPropertyDescriptor
});
_export({ target: 'Object', stat: true, forced: !nativeSymbol }, {
// `Object.getOwnPropertyNames` method
// https://tc39.es/ecma262/#sec-object.getownpropertynames
getOwnPropertyNames: $getOwnPropertyNames,
// `Object.getOwnPropertySymbols` method
// https://tc39.es/ecma262/#sec-object.getownpropertysymbols
getOwnPropertySymbols: $getOwnPropertySymbols
});
// Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
// https://bugs.chromium.org/p/v8/issues/detail?id=3443
_export({ target: 'Object', stat: true, forced: fails(function () { objectGetOwnPropertySymbols.f(1); }) }, {
getOwnPropertySymbols: function getOwnPropertySymbols(it) {
return objectGetOwnPropertySymbols.f(toObject(it));
}
});
// `JSON.stringify` method behavior with symbols
// https://tc39.es/ecma262/#sec-json.stringify
if ($stringify) {
var FORCED_JSON_STRINGIFY = !nativeSymbol || fails(function () {
var symbol = $Symbol();
// MS Edge converts symbol values to JSON as {}
return $stringify([symbol]) != '[null]'
// WebKit converts symbol values to JSON as null
|| $stringify({ a: symbol }) != '{}'
// V8 throws on boxed symbols
|| $stringify(Object(symbol)) != '{}';
});
_export({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
// eslint-disable-next-line no-unused-vars
stringify: function stringify(it, replacer, space) {
var args = [it];
var index = 1;
var $replacer;
while (arguments.length > index) args.push(arguments[index++]);
$replacer = replacer;
if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
if (!isArray(replacer)) replacer = function (key, value) {
if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
if (!isSymbol(value)) return value;
};
args[1] = replacer;
return $stringify.apply(null, args);
}
});
}
// `Symbol.prototype[@@toPrimitive]` method
// https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive
if (!$Symbol[PROTOTYPE$1][TO_PRIMITIVE]) {
createNonEnumerableProperty($Symbol[PROTOTYPE$1], TO_PRIMITIVE, $Symbol[PROTOTYPE$1].valueOf);
}
// `Symbol.prototype[@@toStringTag]` property
// https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag
setToStringTag($Symbol, SYMBOL);
hiddenKeys[HIDDEN] = true;
// `Symbol.asyncIterator` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.asynciterator
defineWellKnownSymbol('asyncIterator');
// `Symbol.hasInstance` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.hasinstance
defineWellKnownSymbol('hasInstance');
// `Symbol.isConcatSpreadable` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.isconcatspreadable
defineWellKnownSymbol('isConcatSpreadable');
// `Symbol.match` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.match
defineWellKnownSymbol('match');
// `Symbol.matchAll` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.matchall
defineWellKnownSymbol('matchAll');
// `Symbol.replace` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.replace
defineWellKnownSymbol('replace');
// `Symbol.search` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.search
defineWellKnownSymbol('search');
// `Symbol.species` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.species
defineWellKnownSymbol('species');
// `Symbol.split` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.split
defineWellKnownSymbol('split');
// `Symbol.toPrimitive` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.toprimitive
defineWellKnownSymbol('toPrimitive');
// `Symbol.toStringTag` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.tostringtag
defineWellKnownSymbol('toStringTag');
// `Symbol.unscopables` well-known symbol
// https://tc39.es/ecma262/#sec-symbol.unscopables
defineWellKnownSymbol('unscopables');
// JSON[@@toStringTag] property
// https://tc39.es/ecma262/#sec-json-@@tostringtag
setToStringTag(global_1.JSON, 'JSON', true);
var symbol = path.Symbol;
// `Symbol.asyncDispose` well-known symbol
// https://github.com/tc39/proposal-using-statement
defineWellKnownSymbol('asyncDispose');
// `Symbol.dispose` well-known symbol
// https://github.com/tc39/proposal-using-statement
defineWellKnownSymbol('dispose');
// `Symbol.observable` well-known symbol
// https://github.com/tc39/proposal-observable
defineWellKnownSymbol('observable');
// `Symbol.patternMatch` well-known symbol
// https://github.com/tc39/proposal-pattern-matching
defineWellKnownSymbol('patternMatch');
// TODO: remove from `core-js@4`
defineWellKnownSymbol('replaceAll');
// TODO: Remove from `core-js@4`
var symbol$1 = symbol;
var symbol$2 = symbol$1;
var _typeof_1 = createCommonjsModule(function (module) {
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof symbol$2 === "function" && typeof iterator$2 === "symbol") {
module.exports = _typeof = function _typeof(obj) {
return typeof obj;
};
} else {
module.exports = _typeof = function _typeof(obj) {
return obj && typeof symbol$2 === "function" && obj.constructor === symbol$2 && obj !== symbol$2.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
module.exports = _typeof;
});
function _possibleConstructorReturn(self, call) {
if (call && (_typeof_1(call) === "object" || typeof call === "function")) {
return call;
}
return assertThisInitialized(self);
}
var possibleConstructorReturn = _possibleConstructorReturn;
var FAILS_ON_PRIMITIVES = fails(function () { objectGetPrototypeOf(1); });
// `Object.getPrototypeOf` method
// https://tc39.es/ecma262/#sec-object.getprototypeof
_export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !correctPrototypeGetter }, {
getPrototypeOf: function getPrototypeOf(it) {
return objectGetPrototypeOf(toObject(it));
}
});
var getPrototypeOf = path.Object.getPrototypeOf;
var getPrototypeOf$1 = getPrototypeOf;
var getPrototypeOf$2 = getPrototypeOf$1;
var getPrototypeOf$3 = createCommonjsModule(function (module) {
function _getPrototypeOf(o) {
module.exports = _getPrototypeOf = setPrototypeOf$2 ? getPrototypeOf$2 : function _getPrototypeOf(o) {
return o.__proto__ || getPrototypeOf$2(o);
};
return _getPrototypeOf(o);
}
module.exports = _getPrototypeOf;
});
// `Array.isArray` method
// https://tc39.es/ecma262/#sec-array.isarray
_export({ target: 'Array', stat: true }, {
isArray: isArray
});
var isArray$1 = path.Array.isArray;
var isArray$2 = isArray$1;
var isArray$3 = isArray$2;
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) {
arr2[i] = arr[i];
}
return arr2;
}
var arrayLikeToArray = _arrayLikeToArray;
function _arrayWithoutHoles(arr) {
if (isArray$3(arr)) return arrayLikeToArray(arr);
}
var arrayWithoutHoles = _arrayWithoutHoles;
// call something on iterator step with safe closing on error
var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
try {
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch (error) {
iteratorClose(iterator);
throw error;
}
};
// `Array.from` method implementation
// https://tc39.es/ecma262/#sec-array.from
var arrayFrom = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
var O = toObject(arrayLike);
var C = typeof this == 'function' ? this : Array;
var argumentsLength = arguments.length;
var mapfn = argumentsLength > 1 ? arguments[1] : undefined;
var mapping = mapfn !== undefined;
var iteratorMethod = getIteratorMethod(O);
var index = 0;
var length, result, step, iterator, next, value;
if (mapping) mapfn = functionBindContext(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2);
// if the target is not iterable or it's an array with the default iterator - use a simple case
if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) {
iterator = iteratorMethod.call(O);
next = iterator.next;
result = new C();
for (;!(step = next.call(iterator)).done; index++) {
value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value;
createProperty(result, index, value);
}
} else {
length = toLength(O.length);
result = new C(length);
for (;length > index; index++) {
value = mapping ? mapfn(O[index], index) : O[index];
createProperty(result, index, value);
}
}
result.length = index;
return result;
};
var ITERATOR$4 = wellKnownSymbol('iterator');
var SAFE_CLOSING = false;
try {
var called = 0;
var iteratorWithReturn = {
next: function () {
return { done: !!called++ };
},
'return': function () {
SAFE_CLOSING = true;
}
};
iteratorWithReturn[ITERATOR$4] = function () {
return this;
};
// eslint-disable-next-line no-throw-literal
Array.from(iteratorWithReturn, function () { throw 2; });
} catch (error) { /* empty */ }
var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
var ITERATION_SUPPORT = false;
try {
var object = {};
object[ITERATOR$4] = function () {
return {
next: function () {
return { done: ITERATION_SUPPORT = true };
}
};
};
exec(object);
} catch (error) { /* empty */ }
return ITERATION_SUPPORT;
};
var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
Array.from(iterable);
});
// `Array.from` method
// https://tc39.es/ecma262/#sec-array.from
_export({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
from: arrayFrom
});
var from_1 = path.Array.from;
var from_1$1 = from_1;
var from_1$2 = from_1$1;
var ITERATOR$5 = wellKnownSymbol('iterator');
var isIterable = function (it) {
var O = Object(it);
return O[ITERATOR$5] !== undefined
|| '@@iterator' in O
// eslint-disable-next-line no-prototype-builtins
|| iterators.hasOwnProperty(classof(O));
};
var isIterable_1 = isIterable;
var isIterable$1 = isIterable_1;
function _iterableToArray(iter) {
if (typeof symbol$2 !== "undefined" && isIterable$1(Object(iter))) return from_1$2(iter);
}
var iterableToArray = _iterableToArray;
var slice$4 = slice_1;
var slice$5 = slice$4;
function _unsupportedIterableToArray(o, minLen) {
var _context;
if (!o) return;
if (typeof o === "string") return arrayLikeToArray(o, minLen);
var n = slice$5(_context = Object.prototype.toString.call(o)).call(_context, 8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return from_1$2(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);
}
var unsupportedIterableToArray = _unsupportedIterableToArray;
function _nonIterableSpread() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var nonIterableSpread = _nonIterableSpread;
function _toConsumableArray(arr) {
return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
}
var toConsumableArray = _toConsumableArray;
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf$3(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf$3(this).constructor; result = construct$3(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !construct$3) return false; if (construct$3.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(construct$3(Date, [], function () {})); return true; } catch (e) { return false; } }
var isServer = typeof window === 'undefined';
var withSideEffect = (function () {
var mountedInstances = new set$3();
var state;
function emitChange(component) {
state = component.props.reduceComponentsToState(toConsumableArray(mountedInstances), component.props);
}
return /*#__PURE__*/function (_React$Component) {
inherits(_class, _React$Component);
var _super = _createSuper(_class);
createClass(_class, null, [{
key: "rewind",
value: function rewind() {
var recordedState = state;
state = undefined;
mountedInstances.clear();
return recordedState;
}
}]);
function _class(props) {
var _this;
classCallCheck(this, _class);
_this = _super.call(this, props);
if (isServer) {
mountedInstances.add(assertThisInitialized(_this));
emitChange(assertThisInitialized(_this));
}
return _this;
}
createClass(_class, [{
key: "componentDidMount",
value: function componentDidMount() {
mountedInstances.add(this);
emitChange(this);
}
}, {
key: "componentDidUpdate",
value: function componentDidUpdate() {
emitChange(this);
}
}, {
key: "componentWillUnmount",
value: function componentWillUnmount() {
mountedInstances["delete"](this);
emitChange(this);
}
}, {
key: "render",
value: function render() {
return null;
}
}]);
return _class;
}(React__default['default'].Component);
});
var defaultHead = [/*#__PURE__*/React__default['default'].createElement("meta", {
charSet: "utf-8"
}), /*#__PURE__*/React__default['default'].createElement("meta", {
name: "viewport",
content: "width=device-width"
})];
function onlyReactElement(list, child) {
if (typeof child === 'string' || typeof child === 'number') {
return list;
}
if (child.type === React__default['default'].Fragment) {
var _context;
return concat$2(list).call(list, reduce$2(_context = React__default['default'].Children.toArray(child.props.children)).call(_context, function (fragmentList, fragmentChild) {
if (typeof fragmentChild === 'string' || typeof fragmentChild === 'number') {
return fragmentList;
}
return concat$2(fragmentList).call(fragmentList, fragmentChild);
}, []));
}
return concat$2(list).call(list, child);
}
var METATYPES = ['name', 'httpEquiv', 'charSet', 'itemProp'];
function unique() {
var keys = new set$3();
var tags = new set$3();
var metaTypes = new set$3();
var metaCategories = {};
return function (h) {
var _context2;
var unique = true;
if (h.key && typeof h.key !== 'number' && indexOf$2(_context2 = h.key).call(_context2, '$') > 0) {
var _context3, _context4;
var key = slice$2(_context3 = h.key).call(_context3, indexOf$2(_context4 = h.key).call(_context4, '$') + 1);
if (keys.has(key)) {
unique = false;
} else {
keys.add(key);
}
}
switch (h.type) {
case 'title':
case 'base':
if (tags.has(h.type)) {
unique = false;
} else {
tags.add(h.type);
}
break;
case 'meta':
for (var i = 0, len = METATYPES.length; i < len; i++) {
var _metatype = METATYPES[i];
if (!h.props.hasOwnProperty(_metatype)) continue;
if (_metatype === 'charSet') {
if (metaTypes.has(_metatype)) {
unique = false;
} else {
metaTypes.add(_metatype);
}
} else {
var category = h.props[_metatype];
var categories = metaCategories[_metatype] || new set$3();
if (categories.has(category)) {
unique = false;
} else {
categories.add(category);
metaCategories[_metatype] = categories;
}
}
}
break;
}
return unique;
};
}
function reduceComponents(headElements) {
var _context5, _context6, _context7, _context8, _context9, _context10;
return map$2(_context5 = reverse$2(_context6 = filter$2(_context7 = concat$2(_context8 = reverse$2(_context9 = reduce$2(_context10 = reduce$2(headElements).call(headElements, function (list, headElement) {
var headElementChildren = React__default['default'].Children.toArray(headElement.props.children);
return concat$2(list).call(list, headElementChildren);
}, [])).call(_context10, onlyReactElement, [])).call(_context9)).call(_context8, defaultHead)).call(_context7, unique())).call(_context6)).call(_context5, function (c, i) {
var key = c.key || i;
return /*#__PURE__*/React__default['default'].cloneElement(c, {
key: key
});
});
}
var Effect = withSideEffect();
function Head(_ref) {
var children = _ref.children;
return /*#__PURE__*/React__default['default'].createElement(Effect, {
reduceComponentsToState: reduceComponents
}, children);
}
Head.rewind = Effect.rewind;
module.exports = Head;
|
/* */
"format cjs";
/*!
* AngularJS Material Design
* https://github.com/angular/material
* @license MIT
* v1.1.4-master-e1345ae
*/
(function( window, angular, undefined ){
"use strict";
/**
* @ngdoc module
* @name material.components.whiteframe
*/
MdWhiteframeDirective['$inject'] = ["$log"];
angular
.module('material.components.whiteframe', ['material.core'])
.directive('mdWhiteframe', MdWhiteframeDirective);
/**
* @ngdoc directive
* @module material.components.whiteframe
* @name mdWhiteframe
*
* @description
* The md-whiteframe directive allows you to apply an elevation shadow to an element.
*
* The attribute values needs to be a number between 1 and 24 or -1.
* When set to -1 no style is applied.
*
* ### Notes
* - If there is no value specified it defaults to 4dp.
* - If the value is not valid it defaults to 4dp.
* @usage
* <hljs lang="html">
* <div md-whiteframe="3">
* <span>Elevation of 3dp</span>
* </div>
* </hljs>
*
* <hljs lang="html">
* <div md-whiteframe="-1">
* <span>No elevation shadow applied</span>
* </div>
* </hljs>
*
* <hljs lang="html">
* <div ng-init="elevation = 5" md-whiteframe="{{elevation}}">
* <span>Elevation of 5dp with an interpolated value</span>
* </div>
* </hljs>
*/
function MdWhiteframeDirective($log) {
var DISABLE_DP = -1;
var MIN_DP = 1;
var MAX_DP = 24;
var DEFAULT_DP = 4;
return {
link: postLink
};
function postLink(scope, element, attr) {
var oldClass = '';
attr.$observe('mdWhiteframe', function(elevation) {
elevation = parseInt(elevation, 10) || DEFAULT_DP;
if (elevation != DISABLE_DP && (elevation > MAX_DP || elevation < MIN_DP)) {
$log.warn('md-whiteframe attribute value is invalid. It should be a number between ' + MIN_DP + ' and ' + MAX_DP, element[0]);
elevation = DEFAULT_DP;
}
var newClass = elevation == DISABLE_DP ? '' : 'md-whiteframe-' + elevation + 'dp';
attr.$updateClass(newClass, oldClass);
oldClass = newClass;
});
}
}
})(window, window.angular);
|
/* Separando meu código em modulos */
/* importando classses para o meu modulo principal */
import {Cliente} from "./cliente.js"
import {Conta} from "./conta.js"
const cliente1 = new Cliente();
cliente1.nome = "Leonardo";
cliente1.idade = 24;
cliente1.cpf = 938483;
const contaLeonardo = new Conta();
contaLeonardo.saldo = 3000;
console.log(cliente1, contaLeonardo)
|
/* global __dirname */
const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const webpack = require('webpack')
const pkg = require('../package.json')
module.exports = {
entry: {
nova: path.resolve(__dirname, '../src/index.js')
},
output: {
publicPath: '',
path: path.resolve(__dirname, '../libs/'),
filename: '[name].js',
chunkFilename: '[name].js',
library: 'Nova',
libraryExport: 'default',
libraryTarget: 'umd',
},
devtool: false,
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'postcss-loader',
'sass-loader',
]
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: 'fonts/[name].[ext]'
}
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: 'nova.css',
chunkFilename: 'nova.css'
}),
new OptimizeCSSPlugin({ safe: true, map: false, discardComments: { removeAll: true } }),
new webpack.BannerPlugin(`nova.vue.js v${pkg.version}\nAuthor: smohan (mengxw@novastar.tech)\nCopyright 2018, NovaStar Tech Co., Ltd`)
]
}
|
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react = _interopRequireWildcard(require("react"));
var _classnames3 = _interopRequireDefault(require("classnames"));
var _iconsReact = require("@carbon/icons-react");
var _carbonComponents = require("carbon-components");
var _Select = _interopRequireDefault(require("../Select"));
var _SelectItem = _interopRequireDefault(require("../SelectItem"));
var _array = require("../../tools/array");
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var prefix = _carbonComponents.settings.prefix;
var instanceId = 0;
var Pagination =
/*#__PURE__*/
function (_Component) {
_inherits(Pagination, _Component);
function Pagination(props) {
var _this;
_classCallCheck(this, Pagination);
_this = _possibleConstructorReturn(this, _getPrototypeOf(Pagination).call(this, props));
_defineProperty(_assertThisInitialized(_this), "handleSizeChange", function (evt) {
var pageSize = Number(evt.target.value);
_this.setState({
pageSize: pageSize,
page: 1
});
_this.props.onChange({
page: 1,
pageSize: pageSize
});
});
_defineProperty(_assertThisInitialized(_this), "handlePageChange", function (evt) {
_this.setState({
page: evt.target.value
});
});
_defineProperty(_assertThisInitialized(_this), "handlePageInputChange", function (evt) {
var page = Number(evt.target.value);
if (page > 0 && page <= Math.max(Math.ceil(_this.props.totalItems / _this.state.pageSize), 1)) {
_this.setState({
page: page
});
_this.props.onChange({
page: page,
pageSize: _this.state.pageSize
});
}
});
_defineProperty(_assertThisInitialized(_this), "incrementPage", function () {
var page = _this.state.page + 1;
_this.setState({
page: page
});
_this.props.onChange({
page: page,
pageSize: _this.state.pageSize
});
});
_defineProperty(_assertThisInitialized(_this), "decrementPage", function () {
var page = _this.state.page - 1;
_this.setState({
page: page
});
_this.props.onChange({
page: page,
pageSize: _this.state.pageSize
});
});
_defineProperty(_assertThisInitialized(_this), "renderSelectItems", function (total) {
var counter = 1;
var itemArr = [];
while (counter <= total) {
itemArr.push(_react.default.createElement(_SelectItem.default, {
key: counter,
value: counter,
text: String(counter)
}));
counter++;
}
return itemArr;
});
var _this$props = _this.props,
pageSizes = _this$props.pageSizes,
_page = _this$props.page,
_pageSize = _this$props.pageSize;
_this.state = {
page: _page,
pageSize: _pageSize && pageSizes.includes(_pageSize) ? _pageSize : pageSizes[0],
prevPageSizes: pageSizes,
prevPage: _page,
prevPageSize: _pageSize
};
_this.uniqueId = ++instanceId;
return _this;
}
_createClass(Pagination, [{
key: "render",
value: function render() {
var _this$props2 = this.props,
backwardText = _this$props2.backwardText,
className = _this$props2.className,
forwardText = _this$props2.forwardText,
id = _this$props2.id,
itemsPerPageText = _this$props2.itemsPerPageText,
itemRangeText = _this$props2.itemRangeText,
pageRangeText = _this$props2.pageRangeText,
pageSize = _this$props2.pageSize,
pageSizes = _this$props2.pageSizes,
itemText = _this$props2.itemText,
pageText = _this$props2.pageText,
pageNumberText = _this$props2.pageNumberText,
pagesUnknown = _this$props2.pagesUnknown,
isLastPage = _this$props2.isLastPage,
pageInputDisabled = _this$props2.pageInputDisabled,
totalItems = _this$props2.totalItems,
onChange = _this$props2.onChange,
pageNumber = _this$props2.page,
other = _objectWithoutProperties(_this$props2, ["backwardText", "className", "forwardText", "id", "itemsPerPageText", "itemRangeText", "pageRangeText", "pageSize", "pageSizes", "itemText", "pageText", "pageNumberText", "pagesUnknown", "isLastPage", "pageInputDisabled", "totalItems", "onChange", "page"]);
var classNames = (0, _classnames3.default)("".concat(prefix, "--pagination"), className);
var inputId = id || this.uniqueId;
var _this$state = this.state,
statePage = _this$state.page,
statePageSize = _this$state.pageSize;
var totalPages = Math.max(Math.ceil(totalItems / statePageSize), 1);
var backButtonDisabled = this.props.disabled || statePage === 1;
var backButtonClasses = (0, _classnames3.default)("".concat(prefix, "--pagination__button"), "".concat(prefix, "--pagination__button--backward"), _defineProperty({}, "".concat(prefix, "--pagination__button--no-index"), backButtonDisabled));
var forwardButtonDisabled = this.props.disabled || statePage === totalPages;
var forwardButtonClasses = (0, _classnames3.default)("".concat(prefix, "--pagination__button"), "".concat(prefix, "--pagination__button--forward"), _defineProperty({}, "".concat(prefix, "--pagination__button--no-index"), forwardButtonDisabled));
var selectItems = this.renderSelectItems(totalPages);
var pageRange = function () {
if (pageInputDisabled) {
return null;
}
return _react.default.createElement("span", {
className: "".concat(prefix, "--pagination__text")
}, pagesUnknown ? pageText(statePage) : pageRangeText(statePage, totalPages));
}();
return _react.default.createElement("div", _extends({
className: classNames
}, other), _react.default.createElement("div", {
className: "".concat(prefix, "--pagination__left")
}, _react.default.createElement("label", {
id: "".concat(prefix, "-pagination-select-").concat(inputId, "-count-label"),
className: "".concat(prefix, "--pagination__text"),
htmlFor: "".concat(prefix, "-pagination-select-").concat(inputId)
}, itemsPerPageText), _react.default.createElement(_Select.default, {
id: "".concat(prefix, "-pagination-select-").concat(inputId),
className: "".concat(prefix, "--select__item-count"),
labelText: "",
hideLabel: true,
noLabel: true,
inline: true,
onChange: this.handleSizeChange,
value: statePageSize
}, pageSizes.map(function (size) {
return _react.default.createElement(_SelectItem.default, {
key: size,
value: size,
text: String(size)
});
})), _react.default.createElement("span", {
className: "".concat(prefix, "--pagination__text")
}, pagesUnknown ? itemText(statePageSize * (statePage - 1) + 1, statePage * statePageSize) : itemRangeText(Math.min(statePageSize * (statePage - 1) + 1, totalItems), Math.min(statePage * statePageSize, totalItems), totalItems))), _react.default.createElement("div", {
className: "".concat(prefix, "--pagination__right")
}, pageInputDisabled ? null : _react.default.createElement(_Select.default, {
id: "".concat(prefix, "-pagination-select-").concat(inputId, "-right"),
className: "".concat(prefix, "--select__page-number"),
labelText: "Page number, of ".concat(totalPages, " pages"),
inline: true,
hideLabel: true,
onChange: this.handlePageInputChange,
value: statePage
}, selectItems), pageRange, _react.default.createElement("button", {
type: "button",
className: backButtonClasses,
onClick: this.decrementPage,
"aria-label": backwardText,
disabled: backButtonDisabled
}, _react.default.createElement(_iconsReact.CaretLeft24, null)), _react.default.createElement("button", {
type: "button",
className: forwardButtonClasses,
"aria-label": forwardText,
onClick: this.incrementPage,
disabled: forwardButtonDisabled || isLastPage
}, _react.default.createElement(_iconsReact.CaretRight24, null))));
}
}], [{
key: "getDerivedStateFromProps",
value: function getDerivedStateFromProps(_ref, state) {
var pageSizes = _ref.pageSizes,
page = _ref.page,
pageSize = _ref.pageSize;
var prevPageSizes = state.prevPageSizes,
prevPage = state.prevPage,
prevPageSize = state.prevPageSize,
currentPage = state.page,
currentPageSize = state.pageSize;
var pageSizesChanged = !(0, _array.equals)(pageSizes, prevPageSizes);
if (pageSizesChanged && !pageSizes.includes(pageSize)) {
pageSize = pageSizes[0];
}
var pageChanged = page !== prevPage;
var pageSizeChanged = pageSize !== prevPageSize;
return !pageSizesChanged && !pageChanged && !pageSizeChanged ? null : {
page: pageSizeChanged && 1 || pageChanged && page || currentPage,
pageSize: pageSizeChanged ? pageSize : currentPageSize,
prevPageSizes: pageSizes,
prevPage: page,
prevPageSize: pageSize
};
}
}]);
return Pagination;
}(_react.Component);
exports.default = Pagination;
_defineProperty(Pagination, "propTypes", {
/**
* The description for the backward icon.
*/
backwardText: _propTypes.default.string,
/**
* The CSS class names.
*/
className: _propTypes.default.string,
/**
* The function returning a translatable text showing where the current page is,
* in a manner of the range of items.
*/
itemRangeText: _propTypes.default.func,
/**
* The description for the forward icon.
*/
forwardText: _propTypes.default.string,
/**
* The unique ID of this component instance.
*/
id: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
/**
* The translatable text indicating the number of items per page.
*/
itemsPerPageText: _propTypes.default.string,
/**
* A variant of `itemRangeText`, used if the total number of items is unknown.
*/
itemText: _propTypes.default.func,
/**
* The callback function called when the current page changes.
*/
onChange: _propTypes.default.func,
pageNumberText: _propTypes.default.string,
/**
* A function returning PII showing where the current page is.
*/
pageRangeText: _propTypes.default.func,
/**
* The translatable text showing the current page.
*/
pageText: _propTypes.default.func,
/**
* The choices for `pageSize`.
*/
pageSizes: _propTypes.default.arrayOf(_propTypes.default.number).isRequired,
/**
* The total number of items.
*/
totalItems: _propTypes.default.number,
/**
* `true` if the backward/forward buttons should be disabled.
*/
disabled: _propTypes.default.bool,
/**
* The current page.
*/
page: _propTypes.default.number,
/**
* The number dictating how many items a page contains.
*/
pageSize: _propTypes.default.number,
/**
* `true` if the total number of items is unknown.
*/
pagesUnknown: _propTypes.default.bool,
// TODO: remove when v9 is deprecated
/**
* `true` if the current page should be the last page.
*/
isLastPage: _propTypes.default.bool,
/**
* `true` if the select box to change the page should be disabled.
*/
pageInputDisabled: _propTypes.default.bool
});
_defineProperty(Pagination, "defaultProps", {
backwardText: 'Previous page',
itemRangeText: function itemRangeText(min, max, total) {
return "".concat(min, "\u2013").concat(max, " of ").concat(total, " items");
},
forwardText: 'Next page',
itemsPerPageText: 'Items per page:',
pageNumberText: 'Page Number',
pageRangeText: function pageRangeText(current, total) {
return "of ".concat(total, " pages");
},
disabled: false,
page: 1,
pagesUnknown: false,
isLastPage: false,
pageInputDisabled: false,
itemText: function itemText(min, max) {
return "".concat(min, "\u2013").concat(max, " items");
},
pageText: function pageText(page) {
return "page ".concat(page);
}
});
|
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
// The file contents for the current environment will overwrite these during build.
export var environment = {
production: false
};
//# sourceMappingURL=D:/Work/GitRepos/Angular4References/CourseProject/prj-observables-final/src/environments/environment.js.map
|
'use strict'; /*jslint mocha:true, expr:true */
var crypto = require('crypto');
var node = require('./../node.js');
var account = node.randomAccount();
var account2 = node.randomAccount();
var account3 = node.randomAccount();
function postTransaction (transaction, done) {
node.post('/peer/transactions', {
transactions: [transaction]
}, function (err, res) {
done(err, res);
});
}
function sendBpl (params, done) {
var transaction = node.bpl.transaction.createTransaction(params.recipientId, params.amount, null, params.secret);
postTransaction(transaction, function (err, res) {
node.expect(res.body).to.have.property('success').to.be.ok;
node.onNewBlock(function (err) {
done(err, res);
});
});
}
describe('POST /peer/transactions', function () {
describe('enabling second signature', function () {
it('using undefined transaction', function (done) {
postTransaction(undefined, function (err, res) {
node.expect(res.body).to.have.property('success').to.be.not.ok;
node.expect(res.body).to.have.property('error').to.equal("TypeError: Cannot read property 'type' of null");
done();
});
});
it('using undefined transaction.asset', function (done) {
var transaction = node.bpl.signature.createSignature(node.randomPassword(), node.randomPassword());
delete transaction.asset;
postTransaction(transaction, function (err, res) {
node.expect(res.body).to.have.property('success').to.be.not.ok;
node.expect(res.body).to.have.property('error').to.equal("TypeError: Cannot read property 'signature' of undefined");
done();
});
});
describe('when account has no funds', function () {
it('should fail', function (done) {
var transaction = node.bpl.signature.createSignature(node.randomPassword(), node.randomPassword());
postTransaction(transaction, function (err, res) {
node.expect(res.body).to.have.property('success').to.be.not.ok;
node.expect(res.body).to.have.property('error').to.match(/Account does not have enough BPL: [a-zA-Z0-9]+ balance: 0/);
done();
});
});
});
describe('when account has funds', function () {
before(function (done) {
sendBpl({
secret: node.gAccount.password,
amount: node.fees.secondPasswordFee + 100000000,
recipientId: account.address
}, done);
});
it('should be ok', function (done) {
var transaction = node.bpl.signature.createSignature(account.password, account.secondPassword);
transaction.fee = node.fees.secondPasswordFee;
postTransaction(transaction, function (err, res) {
node.expect(res.body).to.have.property('success').to.be.ok;
node.expect(res.body).to.have.property('transactionIds');
node.expect(res.body.transactionIds[0]).to.equal(transaction.id);
done();
});
});
});
});
describe('using second signature', function () {
var testaccount = node.randomAccount();
before(function (done) {
node.onNewBlock(function (err) {
done();
});
});
it('when account does not have one should fail', function (done) {
var transaction = node.bpl.transaction.createTransaction(testaccount.address, 1, null, node.gAccount.password, account.secondPassword);
postTransaction(transaction, function (err, res) {
node.expect(res.body).to.have.property('success').to.be.not.ok;
done();
});
});
it('using blank second passphrase should fail', function (done) {
var transaction = node.bpl.transaction.createTransaction(testaccount.address, 1, null, account.password, '');
postTransaction(transaction, function (err, res) {
node.expect(res.body).to.have.property('success').to.be.not.ok;
done();
});
});
it('using fake second passphrase should fail', function (done) {
var transaction = node.bpl.transaction.createTransaction(testaccount.address, 1, null, account.password, account2.secondPassword);
transaction.signSignature = crypto.randomBytes(64).toString('hex');
transaction.id = node.bpl.crypto.getId(transaction);
postTransaction(transaction, function (err, res) {
node.expect(res.body).to.have.property('success').to.be.not.ok;
done();
});
});
it('using valid second passphrase should be ok', function (done) {
var transaction = node.bpl.transaction.createTransaction(testaccount.address, 1, null, account.password, account.secondPassword);
postTransaction(transaction, function (err, res) {
node.expect(res.body).to.have.property('success').to.be.ok;
node.expect(res.body).to.have.property('transactionIds');
node.expect(res.body.transactionIds[0]).to.equal(transaction.id);
done();
});
});
});
});
|
// @flow
import without from 'lodash/without'
import uniq from 'lodash/uniq'
import difference from 'lodash/difference'
import {globalColors} from '../styles'
import {proveMessage} from '../util/platforms.js'
import {PlatformsExpanded} from '../constants/types/more'
import type {MissingProof} from '../common-adapters/user-proofs'
import type {Proof} from '../constants/tracker'
import type {PlatformsExpandedType} from '../constants/types/more'
import type {Folder} from '../constants/folders'
export function folderIconProps(folder: Folder, style: ?Object = {}) {
const type = folder.isPublic
? folder.hasData ? 'iconfont-folder-public-has-files' : 'iconfont-folder-public'
: folder.hasData ? 'iconfont-folder-private-has-files' : 'iconfont-folder-private'
const color = folder.isPublic ? globalColors.yellowGreen : globalColors.darkBlue2
return {
type,
style: {...style, color},
}
}
export function missingProofs(
userProofs: Array<Proof>,
onClick: (missingProof: MissingProof) => void
): Array<MissingProof> {
let availableProofTypes = without(PlatformsExpanded, 'http', 'https', 'dnsOrGenericWebSite', 'dns')
const userProofTypes = uniq((userProofs || []).map(p => p.type))
// $FlowIssue thinks its just a string
const missingRegular = difference(availableProofTypes, userProofTypes).map((type: PlatformsExpanded) => ({
type,
message: proveMessage(type),
onClick,
}))
// always ensure you can add a web site
return missingRegular.concat({
type: 'dnsOrGenericWebSite',
message: proveMessage('dnsOrGenericWebSite'),
onClick,
})
}
export function revokeProofLanguage(platform: PlatformsExpandedType) {
let msg
switch (platform) {
case 'pgp':
msg = 'Drop key'
break
default:
msg = 'Revoke'
}
return msg
}
|
import axios from "axios";
export const IP_ADDRESS = "http://127.0.0.1:8000/";
export const GET_QUESTION = "api/get_all_question/";
export const GET_INTIAL_MOVIE = "api/get_popular_movies/";
export const POST_ANSWER = "api/post_answer/";
export const RESET_SERVER = "api/reset_server/";
export const MOVIE_REC = "api/get_recommendation_for_movie/?movie_id=";
export const MOVIE_PROFILE = "api/movie/?movie_id=";
export const MOVIE_TRAILER_LINK = "api/get_movie_trailer_link/?movie_id=";
export const GET_USER = "api/get_user_info/";
export const UPDATE_USER = "api/update_user_info/?";
export const CREATE_SESSION = "api/create_guest_session/?";
export const GET_FAVO_LIST = "api/get_current_favorite_list/";
export const ADD_FAVO_LIST = "api/add_a_favorite_movie/?";
export const REMOVE_FAVO_LIST = "api/remove_a_favorite_movie/?";
export const USER_LOGIN = "api/user_login/?username=";
export const USER_LOGOUT = "api/user_logout/";
export const SEARCH = "api/search_movie_by_keyword/";
//export const GET_LATEST_MOVIE ="api/get_latest_movie/?top_n=10";
export const get = (url) => {
return axios({
method: "GET",
url,
headers: {
Accept: "*/*",
},
})
.then(function (response) {
return response.data;
})
.catch(handleError);
};
export const post = (url, data) => {
return axios({
method: "POST",
url,
headers: {
Accept: "*/*",
"Access-Control-Allow-Origin": "*",
},
data,
})
.then(function (response) {
return response.data;
})
.catch(handleError);
};
const handleError = (error) => {
if (error.response) {
// The request was made and the server responded with a status code
// that falls out of the range of 2xx
if (error.response.status === 500) {
console.log("server down.");
}
const { data } = error.response;
throw data;
} else if (error.request) {
console.log("server down.");
} else {
// Something happened in setting up the request that triggered an Error
console.log("Error", error.message);
}
};
|
import { Meteor } from 'meteor/meteor';
import { hasPermission } from 'meteor/rocketchat:authorization';
import { settings as rcSettings } from 'meteor/rocketchat:settings';
Meteor.methods({
'livechat:saveAppearance'(settings) {
if (!Meteor.userId() || !hasPermission(Meteor.userId(), 'view-livechat-manager')) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'livechat:saveAppearance' });
}
const validSettings = [
'Livechat_title',
'Livechat_title_color',
'Livechat_show_agent_email',
'Livechat_display_offline_form',
'Livechat_offline_form_unavailable',
'Livechat_offline_message',
'Livechat_offline_success_message',
'Livechat_offline_title',
'Livechat_offline_title_color',
'Livechat_offline_email',
'Livechat_conversation_finished_message',
'Livechat_registration_form',
'Livechat_name_field_registration_form',
'Livechat_email_field_registration_form',
'Livechat_registration_form_message',
];
const valid = settings.every((setting) => validSettings.indexOf(setting._id) !== -1);
if (!valid) {
throw new Meteor.Error('invalid-setting');
}
settings.forEach((setting) => {
rcSettings.updateById(setting._id, setting.value);
});
return;
},
});
|
import * as Config from './Config';
import program from 'commander';
describe('Config file path', () => {
test('Returns config file on current path', () => {
const configPath = Config.configFilePath('foobar/');
expect(configPath).toBe('foobar/changelog.config.js');
});
test('Return cli config file path', () => {
program.config = '/custom/path/bar.config.js';
const configPath = Config.configFilePath('foobar/');
expect(configPath).toBe(program.config);
});
});
describe('Default values', () => {
test('only add default values', () => {
const obj1 = { foo: 'bar' };
const defaults = {
foo: 'baz',
hello: 'world',
};
const merged = Config.defaultValues(obj1, defaults);
expect(merged).toEqual({ foo: 'bar', hello: 'world' });
})
test('merges nested objects', () => {
const obj1 = {
nested: {
foo: 'bar',
},
};
const defaults = {
nested: {
foo: 'baz',
hello: 'world',
}
};
const merged = Config.defaultValues(obj1, defaults);
expect(merged).toEqual({
nested: { foo: 'bar', hello: 'world' },
});
});
test('does not merge arrays', () => {
const obj1 = {
arr1: [2,4,6],
};
const defaults = {
arr1: [1,3,5],
arr2: [6,7,8],
};
const merged = Config.defaultValues(obj1, defaults);
expect(merged).toEqual({
arr1: [2,4,6],
arr2: [6,7,8],
});
});
})
|
/**
* DaData.ru Suggestions jQuery plugin, version 16.6.3
*
* DaData.ru Suggestions jQuery plugin is freely distributable under the terms of MIT-style license
* Built on DevBridge Autocomplete for jQuery (https://github.com/devbridge/jQuery-Autocomplete)
* For details, see https://github.com/hflabs/suggestions-jquery
*/
!function(a){"use strict";"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){"use strict";function b(b,c){var d=this;d.element=b,d.el=a(b),d.suggestions=[],d.badQueries=[],d.selectedIndex=-1,d.currentValue=d.element.value,d.intervalId=0,d.cachedResponse={},d.enrichmentCache={},d.currentRequest=null,d.inputPhase=a.Deferred(),d.fetchPhase=a.Deferred(),d.enrichPhase=a.Deferred(),d.onChangeTimeout=null,d.triggering={},d.$wrapper=null,d.options=a.extend({},k,c),d.classes={hint:"suggestions-hint",mobile:"suggestions-mobile",nowrap:"suggestions-nowrap",selected:"suggestions-selected",suggestion:"suggestions-suggestion",subtext:"suggestions-subtext",subtext_inline:"suggestions-subtext suggestions-subtext_inline",subtext_delimiter:"suggestions-subtext-delimiter",subtext_label:"suggestions-subtext suggestions-subtext_label",removeConstraint:"suggestions-remove",value:"suggestions-value"},d.disabled=!1,d.selection=null,d.$viewport=a(window),d.$body=a(document.body),d.type=null,d.status={},d.setupElement(),d.initializer=a.Deferred(),d.el.is(":visible")?d.initializer.resolve():d.deferInitialization(),d.initializer.done(a.proxy(d.initialize,d))}var c={ENTER:13,ESC:27,TAB:9,SPACE:32,UP:38,DOWN:40},d={},e=".suggestions",f="suggestions",g="\\s\"'~\\*\\.,:\\|\\[\\]\\(\\)\\{\\}<>№",h=new RegExp("["+g+"]+","g"),i="\\-\\+\\/\\\\\\?!@#$%^&",j=new RegExp("["+i+"]+","g"),k={autoSelectFirst:!1,serviceUrl:null,onSearchStart:a.noop,onSearchComplete:a.noop,onSearchError:a.noop,onSuggestionsFetch:null,onSelect:null,onSelectNothing:null,onInvalidateSelection:null,minChars:1,deferRequestBy:100,params:{},paramName:"query",timeout:3e3,formatResult:null,formatSelected:null,noCache:!1,containerClass:"suggestions-suggestions",tabDisabled:!1,triggerSelectOnSpace:!1,triggerSelectOnEnter:!0,triggerSelectOnBlur:!0,preventBadQueries:!1,hint:"Выберите вариант или продолжите ввод",type:null,requestMode:"suggest",count:5,$helpers:null,headers:null,scrollOnFocus:!0,mobileWidth:980,initializeInterval:100},l={chains:{},on:function(a,b){return this.get(a).push(b),this},get:function(a){var b=this.chains;return b[a]||(b[a]=[])}},m=function(){var b=0;return{escapeRegExChars:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},escapeHtml:function(b){var c={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return b&&a.each(c,function(a,c){b=b.replace(new RegExp(a,"g"),c)}),b},getDefaultType:function(){return a.support.cors?"POST":"GET"},getDefaultContentType:function(){return a.support.cors?"application/json":"application/x-www-form-urlencoded"},fixURLProtocol:function(b){return a.support.cors?b:b.replace(/^https?:/,location.protocol)},addUrlParams:function(b,c){return b+(/\?/.test(b)?"&":"?")+a.param(c)},serialize:function(b){return a.support.cors?JSON.stringify(b,function(a,b){return null===b?void 0:b}):a.param(b,!0)},compact:function(b){return a.grep(b,function(a){return!!a})},delay:function(a,b){return setTimeout(a,b||0)},uniqueId:function(a){return(a||"")+ ++b},slice:function(a,b){return Array.prototype.slice.call(a,b)},areSame:function c(b,d){var e=!0;return typeof b!=typeof d?!1:"object"==typeof b&&null!=b&&null!=d?(a.each(b,function(a,b){return e=c(b,d[a])}),e):b===d},arrayMinus:function(b,c){return c?a.grep(b,function(b,d){return-1===a.inArray(b,c)}):b},arrayMinusWithPartialMatching:function(b,c){return c?a.grep(b,function(a,b){return!c.some(function(b){return 0===b.indexOf(a)})}):b},getWords:function(a,b){a=a.replace(/(\d+)([а-яА-ЯёЁ]{2,})/g,"$1 $2").replace(/([а-яА-ЯёЁ]+)(\d+)/g,"$1 $2");var c=this.compact(a.split(h)),d=c.pop(),e=this.arrayMinus(c,b);return e.push(d),e},normalize:function(a,b){var c=this;return c.getWords(a,b).join(" ")},stringEncloses:function(a,b){return a.length>b.length&&-1!==a.indexOf(b)},fieldsNotEmpty:function(b,c){if(!a.isPlainObject(b))return!1;var d=!0;return a.each(c,function(a,c){return d=!!b[c]}),d},getDeepValue:function d(a,b){var c=b.split("."),e=c.shift();return a&&(c.length?d(a[e],c.join(".")):a[e])},reWordExtractor:function(){return new RegExp("([^"+g+"]*)(["+g+"]*)","g")},formatToken:function(a){return a&&a.toLowerCase().replace(/[ёЁ]/g,"е")},withSubTokens:function(b){var c=[];return a.each(b,function(a,b){var d=b.split(j);c.push(b),d.length>1&&(c=c.concat(m.compact(d)))}),c}}}(),n=function(){function b(b){return function(c){if(0===c.length)return!1;if(1===c.length)return!0;var d=b(c[0].value),e=a.grep(c,function(a){return 0===b(a.value).indexOf(d)},!0);return 0===e.length}}var c=b(function(a){return a}),d=b(function(a){return a.replace(/, (?:д|вл|двлд|к) .+$/,"")});return{matchByNormalizedQuery:function(b,c){var d=b.toLowerCase(),e=this&&this.stopwords,f=m.normalize(d,e),g=[];return a.each(c,function(a,b){var c=b.value.toLowerCase();return m.stringEncloses(d,c)?!1:c.indexOf(f)>0?!1:void(f===m.normalize(c,e)&&g.push(a))}),1===g.length?g[0]:-1},matchByWords:function(b,d){var e,f=this&&this.stopwords,g=b.toLowerCase(),h=[];return c(d)&&(e=m.withSubTokens(m.getWords(g,f)),a.each(d,function(a,b){var c=b.value.toLowerCase();if(m.stringEncloses(g,c))return!1;var d=m.withSubTokens(m.getWords(c,f));0===m.arrayMinus(e,d).length&&h.push(a)})),1===h.length?h[0]:-1},matchByWordsAddress:function(b,c){var e,f=this&&this.stopwords,g=b.toLowerCase(),h=-1;return d(c)&&(e=m.withSubTokens(m.getWords(g,f)),a.each(c,function(a,b){var c=b.value.toLowerCase();if(m.stringEncloses(g,c))return!1;var d=m.withSubTokens(m.getWords(c,f));return 0===m.arrayMinus(e,d).length?(h=a,!1):void 0})),h},matchByFields:function(b,c){var d=this&&this.stopwords,e=this&&this.fieldsStopwords,f=m.withSubTokens(m.getWords(b.toLowerCase(),d)),g=[];return 1===c.length&&(e&&a.each(e,function(a,b){var d=m.getDeepValue(c[0],a),e=d&&m.withSubTokens(m.getWords(d.toLowerCase(),b));e&&e.length&&(g=g.concat(e))}),0===m.arrayMinusWithPartialMatching(f,g).length)?0:-1}}}();!function(){function b(a,b){var c=a.data&&a.data[b];return c&&new RegExp("^"+m.escapeRegExChars(c)+"(["+g+"]|$)","i").test(a.value)}function c(a,b){return h.test(b)&&!h.test(a)?b:a}function e(a,b,d,e,f){var g=this,h=g.highlightMatches(a,d,e,f),i=g.highlightMatches(b,d,e,f);return c(h,i)}var f=["ао","аобл","дом","респ","а/я","аал","автодорога","аллея","арбан","аул","б-р","берег","бугор","вал","вл","волость","въезд","высел","г","городок","гск","д","двлд","днп","дор","дп","ж/д_будка","ж/д_казарм","ж/д_оп","ж/д_платф","ж/д_пост","ж/д_рзд","ж/д_ст","жилзона","жилрайон","жт","заезд","заимка","зона","к","казарма","канал","кв","кв-л","км","кольцо","комн","кордон","коса","кп","край","линия","лпх","м","массив","местность","мкр","мост","н/п","наб","нп","обл","округ","остров","оф","п","п/о","п/р","п/ст","парк","пгт","пер","переезд","пл","пл-ка","платф","погост","полустанок","починок","пр-кт","проезд","промзона","просек","просека","проселок","проток","протока","проулок","р-н","рзд","россия","рп","ряды","с","с/а","с/мо","с/о","с/п","с/с","сад","сквер","сл","снт","спуск","ст","ст-ца","стр","тер","тракт","туп","у","ул","уч-к","ф/х","ферма","х","ш","бульвар","владение","выселки","гаражно-строительный","город","деревня","домовладение","дорога","квартал","километр","комната","корпус","литер","леспромхоз","местечко","микрорайон","набережная","область","переулок","платформа","площадка","площадь","поселение","поселок","проспект","разъезд","район","республика","село","сельсовет","слобода","сооружение","станица","станция","строение","территория","тупик","улица","улус","участок","хутор","шоссе"],h=/<strong>/,i={LEGAL:[2,2,5,1],INDIVIDUAL:[2,2,6,2]};d.NAME={urlSuffix:"fio",matchers:[n.matchByNormalizedQuery,n.matchByWords],fieldNames:{surname:"фамилия",name:"имя",patronymic:"отчество"},alwaysContinueSelecting:!0,isDataComplete:function(c){var d,e=this,f=e.options.params,g=c.data;return a.isFunction(f)&&(f=f.call(e.element,c.value)),f&&f.parts?d=a.map(f.parts,function(a){return a.toLowerCase()}):(d=["surname","name"],b(c,"surname")&&d.push("patronymic")),m.fieldsNotEmpty(g,d)},composeValue:function(a){return m.compact([a.surname,a.name,a.patronymic]).join(" ")}},d.ADDRESS={urlSuffix:"address",matchers:[a.proxy(n.matchByNormalizedQuery,{stopwords:f}),a.proxy(n.matchByWordsAddress,{stopwords:f})],dataComponents:[{id:"kladr_id",fields:["kladr_id"],forBounds:!1,forLocations:!0},{id:"postal_code",fields:["postal_code"],forBounds:!1,forLocations:!0},{id:"country",fields:["country"],forBounds:!1,forLocations:!0},{id:"region",fields:["region","region_type","region_type_full","region_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:2,zeros:11}},{id:"area",fields:["area","area_type","area_type_full","area_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:5,zeros:8}},{id:"city",fields:["city","city_type","city_type_full","city_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:8,zeros:5}},{id:"settlement",fields:["settlement","settlement_type","settlement_type_full","settlement_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:11,zeros:2}},{id:"street",fields:["street","street_type","street_type_full","street_with_type"],forBounds:!0,forLocations:!0,kladrFormat:{digits:15,zeros:2}},{id:"house",fields:["house","house_type","house_type_full","block","block_type"],forBounds:!0,forLocations:!1,kladrFormat:{digits:19}}],unformattableTokens:f,enrichmentEnabled:!0,geoEnabled:!0,isDataComplete:function(b){var c=[this.bounds.to||"flat"],d=b.data;return!a.isPlainObject(d)||m.fieldsNotEmpty(d,c)},composeValue:function(a){return m.compact([a.region_with_type||m.compact([a.region,a.region_type]).join(" "),a.area_with_type||m.compact([a.area_type,a.area]).join(" "),a.city_with_type||m.compact([a.city_type,a.city]).join(" "),a.settlement_with_type||m.compact([a.settlement_type,a.settlement]).join(" "),a.street_with_type||m.compact([a.street_type,a.street]).join(" "),m.compact([a.house_type,a.house,a.block_type,a.block]).join(" "),m.compact([a.flat_type,a.flat]).join(" "),a.postal_box?"а/я "+a.postal_box:null]).join(", ")}},d.PARTY={urlSuffix:"party",matchers:[a.proxy(n.matchByFields,{fieldsStopwords:{value:null,"data.address.value":f,"data.inn":null,"data.ogrn":null}})],geoEnabled:!0,formatResult:function(a,b,d,h){var i=this,j=i.type.formatResultInn.call(i,d,b),k=i.highlightMatches(m.getDeepValue(d.data,"ogrn"),b,d),l=c(j,k),n=i.highlightMatches(m.getDeepValue(d.data,"management.name"),b,d),o=m.getDeepValue(d.data,"address.value")||"";return i.isMobile&&((h||(h={})).maxLength=50),a=e.call(i,a,m.getDeepValue(d.data,"name.latin"),b,d,h),a=i.wrapFormattedValue(a,d),o&&(o=o.replace(/^(\d{6}?\s+|Россия,\s+)/i,""),o=i.isMobile?o.replace(new RegExp("^([^"+g+"]+["+g+"]+[^"+g+"]+).*"),"$1"):i.highlightMatches(o,b,d,{unformattableTokens:f})),(l||o||n)&&(a+='<div class="'+i.classes.subtext+'"><span class="'+i.classes.subtext_inline+'">'+(l||"")+"</span>"+(c(o,n)||"")+"</div>"),a},formatResultInn:function(b,c){var d,e,f=this,g=b.data&&b.data.inn,h=i[b.data&&b.data.type],j=/\d/;return g?(e=f.highlightMatches(g,c,b),h&&(e=e.split(""),d=a.map(h,function(a){for(var b,c="";a&&(b=e.shift());)c+=b,j.test(b)&&a--;return c}),e=d.join('<span class="'+f.classes.subtext_delimiter+'"></span>')+e.join("")),e):void 0}},d.EMAIL={urlSuffix:"email",matchers:[n.matchByNormalizedQuery],isQueryRequestable:function(a){return this.options.suggest_local||a.indexOf("@")>=0}},d.BANK={urlSuffix:"bank",matchers:[a.proxy(n.matchByFields,{fieldsStopwords:{value:null,"data.bic":null}})],formatResult:function(a,b,c,d){var e=this,h=e.highlightMatches(m.getDeepValue(c.data,"bic"),b,c),i=m.getDeepValue(c.data,"address.value")||"";return a=e.highlightMatches(a,b,c,d),a=e.wrapFormattedValue(a,c),i&&(i=i.replace(/^\d{6}( РОССИЯ)?, /i,""),i=e.isMobile?i.replace(new RegExp("^([^"+g+"]+["+g+"]+[^"+g+"]+).*"),"$1"):e.highlightMatches(i,b,c,{unformattableTokens:f})),(h||i)&&(a+='<div class="'+e.classes.subtext+'"><span class="'+e.classes.subtext_inline+'">'+h+"</span>"+i+"</div>"),a},formatSelected:function(a){return m.getDeepValue(a,"data.name.payment")}},a.extend(k,{suggest_local:!0})}();var o={suggest:{defaultParams:{type:m.getDefaultType(),dataType:"json",contentType:m.getDefaultContentType()},addTypeInUrl:!0},detectAddressByIp:{defaultParams:{type:"GET",dataType:"json"},addTypeInUrl:!1},status:{defaultParams:{type:"GET",dataType:"json"},addTypeInUrl:!0},findById:{defaultParams:{type:m.getDefaultType(),dataType:"json",contentType:m.getDefaultContentType()},addTypeInUrl:!0}},p={suggest:{method:"suggest",userSelect:!0,updateValue:!0,enrichmentEnabled:!0},findById:{method:"findById",userSelect:!1,updateValue:!1,enrichmentEnabled:!1}};b.utils=m,b.defaultOptions=k,b.version="16.6.3",a.Suggestions=b,b.prototype={initialize:function(){var a=this;a.uniqueId=m.uniqueId("i"),a.createWrapper(),a.notify("initialize"),a.bindWindowEvents(),a.setOptions(),a.fixPosition()},deferInitialization:function(){var a,b=this,c="mouseover focus keydown",d=function(){b.initializer.resolve(),b.enable()};b.initializer.always(function(){b.el.off(c,d),clearInterval(a)}),b.disabled=!0,b.el.on(c,d),a=setInterval(function(){b.el.is(":visible")&&d()},b.options.initializeInterval)},isInitialized:function(){return"resolved"===this.initializer.state()},dispose:function(){var a=this;a.initializer.reject(),a.notify("dispose"),a.el.removeData(f).removeClass("suggestions-input"),a.unbindWindowEvents(),a.removeWrapper(),a.el.trigger("suggestions-dispose")},notify:function(b){var c=this,d=m.slice(arguments,1);return a.map(l.get(b),function(a){return a.apply(c,d)})},createWrapper:function(){var b=this;b.$wrapper=a('<div class="suggestions-wrapper"/>'),b.el.after(b.$wrapper),b.$wrapper.on("mousedown"+e,a.proxy(b.onMousedown,b))},removeWrapper:function(){var b=this;b.$wrapper&&b.$wrapper.remove(),a(b.options.$helpers).off(e)},onMousedown:function(b){var c=this;b.preventDefault(),c.cancelBlur=!0,m.delay(function(){delete c.cancelBlur}),0==a(b.target).closest(".ui-menu-item").length&&m.delay(function(){a(document).one("mousedown",function(b){var d=c.el.add(c.$wrapper).add(c.options.$helpers);c.options.floating&&(d=d.add(c.$container)),d=d.filter(function(){return this===b.target||a.contains(this,b.target)}),d.length||c.hide()})})},bindWindowEvents:function(){var b=this,c=a.proxy(b.fixPosition,b);b.$viewport.on("resize"+e+b.uniqueId,c).on("scroll"+e+b.uniqueId,c)},unbindWindowEvents:function(){this.$viewport.off("resize"+e+this.uniqueId).off("scroll"+e+this.uniqueId)},scrollToTop:function(){var b=this,c=b.options.scrollOnFocus;c===!0&&(c=b.el),c instanceof a&&c.length>0&&a("body,html").animate({scrollTop:c.offset().top},"fast")},setOptions:function(b){var c=this;a.extend(c.options,b),a.each({type:d,requestMode:p},function(b,d){if(c[b]=d[c.options[b]],!c[b])throw c.disable(),"`"+b+"` option is incorrect! Must be one of: "+a.map(d,function(a,b){return'"'+b+'"'}).join(", ")}),a(c.options.$helpers).off(e).on("mousedown"+e,a.proxy(c.onMousedown,c)),c.isInitialized()&&c.notify("setOptions")},fixPosition:function(b){var c,d,e=this,f={};e.isMobile=e.$viewport.width()<=e.options.mobileWidth,e.isInitialized()&&(!b||"scroll"!=b.type||e.options.floating||e.isMobile)&&(e.$container.appendTo(e.options.floating?e.$body:e.$wrapper),e.notify("resetPosition"),e.el.css("paddingLeft",""),e.el.css("paddingRight",""),f.paddingLeft=parseFloat(e.el.css("paddingLeft")),f.paddingRight=parseFloat(e.el.css("paddingRight")),a.extend(f,e.el.offset()),f.borderTop="none"==e.el.css("border-top-style")?0:parseFloat(e.el.css("border-top-width")),f.borderLeft="none"==e.el.css("border-left-style")?0:parseFloat(e.el.css("border-left-width")),f.innerHeight=e.el.innerHeight(),f.innerWidth=e.el.innerWidth(),f.outerHeight=e.el.outerHeight(),f.componentsLeft=0,f.componentsRight=0,c=e.$wrapper.offset(),d={top:f.top-c.top,left:f.left-c.left},e.notify("fixPosition",d,f),f.componentsLeft>f.paddingLeft&&e.el.css("paddingLeft",f.componentsLeft+"px"),f.componentsRight>f.paddingRight&&e.el.css("paddingRight",f.componentsRight+"px"))},clearCache:function(){this.cachedResponse={},this.enrichmentCache={},this.badQueries=[]},clear:function(){var a=this;a.isInitialized()&&(a.clearCache(),a.currentValue="",a.selection=null,a.hide(),a.suggestions=[],a.el.val(""),a.el.trigger("suggestions-clear"),a.notify("clear"))},disable:function(){var a=this;a.disabled=!0,a.abortRequest(),a.visible&&a.hide()},enable:function(){this.disabled=!1},isUnavailable:function(){return this.disabled},update:function(){var a=this,b=a.el.val();a.isInitialized()&&(a.currentValue=b,a.isQueryRequestable(b)?a.updateSuggestions(b):a.hide())},setSuggestion:function(b){var c,d,e=this;a.isPlainObject(b)&&a.isPlainObject(b.data)&&(b=a.extend(!0,{},b),e.bounds.own.length&&(e.checkValueBounds(b),c=e.copyBoundedData(b.data,e.bounds.all),b.data.kladr_id&&(c.kladr_id=e.getBoundedKladrId(b.data.kladr_id,e.bounds.all)),b.data=c),d=e.getSuggestionValue(b)||"",e.currentValue=d,e.el.val(d),e.selection=b,e.suggestions=[b],e.abortRequest(),e.el.trigger("suggestions-set"))},fixData:function(){var b=this,c=b.extendedCurrentValue(),d=b.el.val(),e=a.Deferred();e.done(function(a){b.selectSuggestion(a,0,d,{hasBeenEnriched:!0}),b.el.trigger("suggestions-fixdata",a)}).fail(function(){b.selection=null,b.currentValue="",b.el.val(b.currentValue),b.el.trigger("suggestions-fixdata")}),b.isQueryRequestable(c)?(b.currentValue=c,b.getSuggestions(c,{count:1,from_bound:null,to_bound:null}).done(function(a){var b=a[0];b?e.resolve(b):e.reject()}).fail(function(){e.reject()})):e.reject()},extendedCurrentValue:function(){var b=this,c=b.getParentInstance(),d=c&&c.extendedCurrentValue(),e=a.trim(b.el.val());return m.compact([d,e]).join(" ")},getAjaxParams:function(c,d){var e=this,f=a.trim(e.options.token),g=a.trim(e.options.partner),h=e.options.serviceUrl,i=o[c],j=a.extend({timeout:e.options.timeout},i.defaultParams),k={};return/\/$/.test(h)||(h+="/"),h+=c,i.addTypeInUrl&&(h+="/"+e.type.urlSuffix),h=m.fixURLProtocol(h),a.support.cors?(f&&(k.Authorization="Token "+f),g&&(k["X-Partner"]=g),k["X-Version"]=b.version,j.headers||(j.headers={}),a.extend(j.headers,e.options.headers,k)):(f&&(k.token=f),g&&(k.partner=g),k.version=b.version,h=m.addUrlParams(h,k)),j.url=h,a.extend(j,d)},isQueryRequestable:function(a){var b,c=this;return b=a.length>=c.options.minChars,b&&c.type.isQueryRequestable&&(b=c.type.isQueryRequestable.call(c,a)),b},constructRequestParams:function(b,c){var d=this,e=d.options,f=a.isFunction(e.params)?e.params.call(d.element,b):a.extend({},e.params);return d.type.constructRequestParams&&a.extend(f,d.type.constructRequestParams.call(d)),a.each(d.notify("requestParams"),function(b,c){a.extend(f,c)}),f[e.paramName]=b,a.isNumeric(e.count)&&e.count>0&&(f.count=e.count),a.extend(f,c)},updateSuggestions:function(a){var b=this;b.fetchPhase=b.getSuggestions(a).done(function(c){b.assignSuggestions(c,a)})},getSuggestions:function(b,c,d){var e,f=this,g=f.options,h=d&&d.noCallbacks,i=d&&d.useEnrichmentCache,j=f.constructRequestParams(b,c),k=a.param(j||{}),l=a.Deferred();return e=f.cachedResponse[k],e&&a.isArray(e.suggestions)?l.resolve(e.suggestions):f.isBadQuery(b)?l.reject():h||g.onSearchStart.call(f.element,j)!==!1?f.doGetSuggestions(j).done(function(a){f.processResponse(a)&&b==f.currentValue?(g.noCache||(i?f.enrichmentCache[b]=a.suggestions[0]:(f.enrichResponse(a,b),f.cachedResponse[k]=a,g.preventBadQueries&&0===a.suggestions.length&&f.badQueries.push(b))),l.resolve(a.suggestions)):l.reject(),h||g.onSearchComplete.call(f.element,b,a.suggestions)}).fail(function(a,c,d){l.reject(),h||"abort"===c||g.onSearchError.call(f.element,b,a,c,d)}):l.reject(),l},doGetSuggestions:function(b){var c=this,d=a.ajax(c.getAjaxParams(c.requestMode.method,{data:m.serialize(b)}));return c.abortRequest(),c.currentRequest=d,c.notify("request"),d.always(function(){c.currentRequest=null,c.notify("request")}),d},isBadQuery:function(b){if(!this.options.preventBadQueries)return!1;var c=!1;return a.each(this.badQueries,function(a,d){return!(c=0===b.indexOf(d))}),c},abortRequest:function(){var a=this;a.currentRequest&&a.currentRequest.abort()},processResponse:function(b){var c,d=this;return b&&a.isArray(b.suggestions)?(d.verifySuggestionsFormat(b.suggestions),d.setUnrestrictedValues(b.suggestions),a.isFunction(d.options.onSuggestionsFetch)&&(c=d.options.onSuggestionsFetch.call(d.element,b.suggestions),a.isArray(c)&&(b.suggestions=c)),!0):!1},verifySuggestionsFormat:function(b){"string"==typeof b[0]&&a.each(b,function(a,c){b[a]={value:c,data:null}})},getSuggestionValue:function(b,c){var d,e=this,f=e.options.formatSelected||e.type.formatSelected;return a.isFunction(f)&&(d=f.call(e,b)),("string"!=typeof d||0==d.length)&&(d=c&&e.options.restrict_value&&e.type.composeValue?e.type.composeValue(e.getUnrestrictedData(b.data)):b.value),d},assignSuggestions:function(a,b){var c=this;c.suggestions=a,c.notify("assignSuggestions",b)},shouldRestrictValues:function(){var a=this;return a.options.restrict_value&&a.constraints&&1==Object.keys(a.constraints).length},setUnrestrictedValues:function(b){var c=this,d=c.shouldRestrictValues(),e=c.getFirstConstraintLabel();a.each(b,function(a,b){b.unrestricted_value||(b.unrestricted_value=d?e+", "+b.value:b.value)})},areSuggestionsSame:function(a,b){return a&&b&&a.value===b.value&&m.areSame(a.data,b.data)}},function(){var d={setupElement:function(){this.el.attr("autocomplete","off").addClass("suggestions-input").css("box-sizing","border-box")},bindElementEvents:function(){var b=this;b.el.on("keydown"+e,a.proxy(b.onElementKeyDown,b)),b.el.on(["keyup"+e,"cut"+e,"paste"+e,"input"+e].join(" "),a.proxy(b.onElementKeyUp,b)),b.el.on("blur"+e,a.proxy(b.onElementBlur,b)),b.el.on("focus"+e,a.proxy(b.onElementFocus,b))},unbindElementEvents:function(){this.el.off(e)},onElementBlur:function(){var a=this;return a.cancelBlur?void(a.cancelBlur=!1):(a.options.triggerSelectOnBlur?a.isUnavailable()||a.selectCurrentValue({noSpace:!0}).always(function(){a.hide()}):a.hide(),void(a.fetchPhase.abort&&a.fetchPhase.abort()))},onElementFocus:function(){var b=this;b.cancelFocus||m.delay(a.proxy(b.completeOnFocus,b)),b.cancelFocus=!1},onElementKeyDown:function(a){var b=this;if(!b.isUnavailable())if(b.visible){switch(a.which){case c.ESC:b.el.val(b.currentValue),b.hide(),b.abortRequest();break;case c.TAB:if(b.options.tabDisabled===!1)return;break;case c.ENTER:b.options.triggerSelectOnEnter&&b.selectCurrentValue();break;case c.SPACE:return void(b.options.triggerSelectOnSpace&&b.isCursorAtEnd()&&(a.preventDefault(),b.selectCurrentValue({continueSelecting:!0,dontEnrich:!0}).fail(function(){b.currentValue+=" ",b.el.val(b.currentValue),b.proceedChangedValue()})));case c.UP:b.moveUp();break;case c.DOWN:b.moveDown();break;default:return}a.stopImmediatePropagation(),a.preventDefault()}else switch(a.which){case c.DOWN:b.suggest();break;case c.ENTER:b.options.triggerSelectOnEnter&&b.triggerOnSelectNothing()}},onElementKeyUp:function(a){var b=this;if(!b.isUnavailable()){switch(a.which){case c.UP:case c.DOWN:case c.ENTER:return}clearTimeout(b.onChangeTimeout),b.inputPhase.reject(),b.currentValue!==b.el.val()&&b.proceedChangedValue()}},proceedChangedValue:function(){var b=this;b.abortRequest(),b.inputPhase=a.Deferred().done(a.proxy(b.onValueChange,b)),b.options.deferRequestBy>0?b.onChangeTimeout=m.delay(function(){b.inputPhase.resolve()},b.options.deferRequestBy):b.inputPhase.resolve()},onValueChange:function(){var a,b=this;b.selection&&(a=b.selection,b.selection=null,b.trigger("InvalidateSelection",a)),b.selectedIndex=-1,b.update(),b.notify("valueChange")},completeOnFocus:function(){var a=this;a.isUnavailable()||a.isElementFocused()&&(a.fixPosition(),a.update(),a.isMobile&&(a.setCursorAtEnd(),a.scrollToTop()))},isElementFocused:function(){return document.activeElement===this.element},isCursorAtEnd:function(){var a,b,c=this,d=c.el.val().length;try{if(a=c.element.selectionStart,"number"==typeof a)return a===d}catch(e){}return document.selection?(b=document.selection.createRange(),b.moveStart("character",-d),d===b.text.length):!0},setCursorAtEnd:function(){var a=this.element;try{a.selectionEnd=a.selectionStart=a.value.length,a.scrollLeft=a.scrollWidth}catch(b){a.value=a.value}}};a.extend(b.prototype,d),l.on("initialize",d.bindElementEvents).on("dispose",d.unbindElementEvents)}(),function(){function c(){a.each(d,function(){this.abort()}),d={}}var d={};c();var e={checkStatus:function(){function b(b){a.isFunction(c.options.onSearchError)&&c.options.onSearchError.call(c.element,null,g,"error",b)}var c=this,e=a.trim(c.options.token),f=c.options.type+e,g=d[f];g||(g=d[f]=a.ajax(c.getAjaxParams("status"))),g.done(function(d){d.search?a.extend(c.status,d):b("Service Unavailable")}).fail(function(){b(g.statusText)})}};b.resetTokens=c,a.extend(b.prototype,e),l.on("setOptions",e.checkStatus)}(),function(){function c(){d=null,b.defaultOptions.geoLocation=e}if("GET"!=m.getDefaultType()){var d,e=!0,f={checkLocation:function(){var b=this,c=b.options.geoLocation;b.type.geoEnabled&&c&&(b.geoLocation=a.Deferred(),a.isPlainObject(c)||a.isArray(c)?b.geoLocation.resolve(c):(d||(d=a.ajax(b.getAjaxParams("detectAddressByIp"))),d.done(function(a){var c=a&&a.location&&a.location.data;c&&c.kladr_id?b.geoLocation.resolve(c):b.geoLocation.reject()}).fail(function(){b.geoLocation.reject()})))},getGeoLocation:function(){return this.geoLocation},constructParams:function(){var b=this,c={};return b.geoLocation&&a.isFunction(b.geoLocation.promise)&&"resolved"==b.geoLocation.state()&&b.geoLocation.done(function(b){c.locations_boost=a.makeArray(b)}),c}};a.extend(k,{geoLocation:e}),a.extend(b,{resetLocation:c}),a.extend(b.prototype,{getGeoLocation:f.getGeoLocation}),l.on("setOptions",f.checkLocation).on("requestParams",f.constructParams)}}(),function(){var c={enrichSuggestion:function(b,c){var d=this,e=a.Deferred();return!d.status.enrich||!d.type.enrichmentEnabled||!d.requestMode.enrichmentEnabled||c&&c.dontEnrich?e.resolve(b):b.data&&null!=b.data.qc?e.resolve(b):(d.disableDropdown(),d.currentValue=b.unrestricted_value,d.enrichPhase=d.getSuggestions(b.unrestricted_value,{count:1,locations:null,locations_boost:null,from_bound:null,to_bound:null},{noCallbacks:!0,useEnrichmentCache:!0}).always(function(){d.enableDropdown()}).done(function(a){var c=a&&a[0];e.resolve(c||b,!!c)}).fail(function(){e.resolve(b)}),e)},enrichResponse:function(b,c){var d=this,e=d.enrichmentCache[c];e&&a.each(b.suggestions,function(a,d){return d.value===c?(b.suggestions[a]=e,!1):void 0})}};a.extend(b.prototype,c)}(),function(){function c(b){return a.map(b,function(a){var b=m.escapeHtml(a.text);return b&&a.matched&&(b="<strong>"+b+"</strong>"),b}).join("")}function d(b,c){var d=b.split(", ");return 1===d.length?b:a.map(d,function(a){return'<span class="'+c+'">'+a+"</span>"}).join(", ")}function f(b,c){var d=!1;return a.each(b,function(a,b){return d=b.value==c.value&&b!=c,d?!1:void 0}),d}var g={width:"auto",floating:!1},j={createContainer:function(){var b=this,c="."+b.classes.suggestion,d=b.options,f=a("<div/>").addClass(d.containerClass).css({position:"absolute",display:"none"});b.$container=f,f.on("click"+e,c,a.proxy(b.onSuggestionClick,b))},removeContainer:function(){var a=this;a.options.floating&&a.$container.remove()},setContainerOptions:function(){var b=this,c="mousedown"+e;b.$container.off(c),b.options.floating&&b.$container.on(c,a.proxy(b.onMousedown,b))},onSuggestionClick:function(b){var c,d=this,e=a(b.target);if(!d.dropdownDisabled){for(d.cancelFocus=!0,d.el.focus();e.length&&!(c=e.attr("data-index"));)e=e.closest("."+d.classes.suggestion);c&&!isNaN(c)&&d.select(+c)}},setDropdownPosition:function(a,b){var c,d=this,e=d.$viewport.scrollLeft();d.isMobile?(c=d.options.floating?{left:e+"px",top:b.top+b.outerHeight+"px"}:{left:a.left-b.left+e+"px",top:a.top+b.outerHeight+"px"},c.width=d.$viewport.width()+"px"):(c=d.options.floating?{left:b.left+"px",top:b.top+b.borderTop+b.innerHeight+"px"}:{left:a.left+"px",top:a.top+b.borderTop+b.innerHeight+"px"},m.delay(function(){var a=d.options.width;"auto"===a&&(a=d.el.outerWidth()),d.$container.outerWidth(a)})),d.$container.toggleClass(d.classes.mobile,d.isMobile).css(c),d.containerItemsPadding=b.left+b.borderLeft+b.paddingLeft-e},setItemsPositions:function(){var a=this,b=a.getSuggestionsItems();b.css("paddingLeft",a.isMobile?a.containerItemsPadding+"px":"")},getSuggestionsItems:function(){return this.$container.children("."+this.classes.suggestion)},toggleDropdownEnabling:function(a){this.dropdownDisabled=!a,this.$container.attr("disabled",!a)},disableDropdown:function(){this.toggleDropdownEnabling(!1)},enableDropdown:function(){this.toggleDropdownEnabling(!0)},hasSuggestionsToChoose:function(){var b=this;return b.suggestions.length>1||1===b.suggestions.length&&(!b.selection||a.trim(b.suggestions[0].value)!==a.trim(b.selection.value))},suggest:function(){var b,c,d=this,e=d.options;if(d.requestMode.userSelect){if(!d.hasSuggestionsToChoose())return void d.hide();b=e.formatResult||d.type.formatResult||d.formatResult,c=[],!d.isMobile&&e.hint&&d.suggestions.length&&c.push('<div class="'+d.classes.hint+'">'+e.hint+"</div>"),d.selectedIndex=-1,a.each(d.suggestions,function(a,e){var f=d.makeSuggestionLabel(d.suggestions,e);e==d.selection&&(d.selectedIndex=a),c.push('<div class="'+d.classes.suggestion+'" data-index="'+a+'">'),c.push(b.call(d,e.value,d.currentValue,e,{unformattableTokens:d.type.unformattableTokens})),f&&c.push('<span class="'+d.classes.subtext_label+'">'+m.escapeHtml(f)+"</span>"),c.push("</div>")}),d.$container.html(c.join("")),e.autoSelectFirst&&-1===d.selectedIndex&&(d.selectedIndex=0),-1!==d.selectedIndex&&d.getSuggestionsItems().eq(d.selectedIndex).addClass(d.classes.selected),a.isFunction(e.beforeRender)&&e.beforeRender.call(d.element,d.$container),d.$container.show(),d.visible=!0,d.fixPosition(),d.setItemsPositions()}},wrapFormattedValue:function(a,b){var c=this,d=m.getDeepValue(b.data,"state.status");return'<span class="'+c.classes.value+'"'+(d?' data-suggestion-status="'+d+'"':"")+">"+a+"</span>"},formatResult:function(a,b,c,d){var e=this;return a=e.highlightMatches(a,b,c,d),e.wrapFormattedValue(a,c)},highlightMatches:function(b,e,f,g){var j,k,l,n,o,p,q,r=this,s=[],t=g&&g.unformattableTokens,u=g&&g.maxLength,v=m.reWordExtractor();if(!b)return"";for(j=m.formatToken(e).split(h),j=m.withSubTokens(j),k=a.map(j,function(a){return new RegExp("^((.*)(["+i+"]+))?("+m.escapeRegExChars(a)+")([^"+i+"]*["+i+"]*)","i")});(l=v.exec(b))&&l[0];)n=l[1],s.push({text:n,inUpperCase:n.toLowerCase()!==n,formatted:m.formatToken(n),matchable:!0}),l[2]&&s.push({text:l[2]});for(o=0;o<s.length;o++)p=s[o],!p.matchable||p.matched||-1!==a.inArray(p.formatted,t)&&!p.inUpperCase||a.each(k,function(a,b){var c,d=b.exec(p.formatted),e=o+1;return d?(d={before:d[1]||"",beforeText:d[2]||"",beforeDelimiter:d[3]||"",text:d[4]||"",after:d[5]||""},d.before&&(s.splice(o,0,{text:p.text.substr(0,d.beforeText.length),formatted:d.beforeText,matchable:!0},{text:d.beforeDelimiter}),e+=2,c=d.before.length,p.text=p.text.substr(c),p.formatted=p.formatted.substr(c),o--),c=d.text.length+d.after.length,p.formatted.length>c&&(s.splice(e,0,{text:p.text.substr(c),formatted:p.formatted.substr(c),matchable:!0}),p.text=p.text.substr(0,c),p.formatted=p.formatted.substr(0,c)),d.after&&(c=d.text.length,s.splice(e,0,{text:p.text.substr(c),formatted:p.formatted.substr(c)}),p.text=p.text.substr(0,c),p.formatted=p.formatted.substr(0,c)),p.matched=!0,!1):void 0});if(u){for(o=0;o<s.length&&u>=0;o++)p=s[o],u-=p.text.length,0>u&&(p.text=p.text.substr(0,p.text.length+u)+"...");s.length=o}return q=c(s),d(q,r.classes.nowrap)},makeSuggestionLabel:function(b,c){var d,e,g=this,h=g.type.fieldNames,i={},j=m.reWordExtractor(),k=[];if(h&&f(b,c)&&c.data&&(a.each(h,function(a){var b=c.data[a];b&&(i[a]=m.formatToken(b))}),!a.isEmptyObject(i))){for(;(d=j.exec(m.formatToken(c.value)))&&(e=d[1]);)a.each(i,function(a,b){return b==e?(k.push(h[a]),delete i[a],!1):void 0});if(k.length)return k.join(", ")}},hide:function(){var a=this;a.visible=!1,a.selectedIndex=-1,a.$container.hide().empty();
},activate:function(a){var b,c,d=this,e=d.classes.selected;return!d.dropdownDisabled&&(c=d.getSuggestionsItems(),c.removeClass(e),d.selectedIndex=a,-1!==d.selectedIndex&&c.length>d.selectedIndex)?(b=c.eq(d.selectedIndex),b.addClass(e),b):null},deactivate:function(a){var b=this;b.dropdownDisabled||(b.selectedIndex=-1,b.getSuggestionsItems().removeClass(b.classes.selected),a&&b.el.val(b.currentValue))},moveUp:function(){var a=this;if(!a.dropdownDisabled)return-1===a.selectedIndex?void(a.suggestions.length&&a.adjustScroll(a.suggestions.length-1)):0===a.selectedIndex?void a.deactivate(!0):void a.adjustScroll(a.selectedIndex-1)},moveDown:function(){var a=this;if(!a.dropdownDisabled)return a.selectedIndex===a.suggestions.length-1?void a.deactivate(!0):void a.adjustScroll(a.selectedIndex+1)},adjustScroll:function(a){var b,c,d,e=this,f=e.activate(a),g=e.$container.scrollTop();f&&f.length&&(b=f.position().top,0>b?e.$container.scrollTop(g+b):(c=b+f.outerHeight(),d=e.$container.innerHeight(),c>d&&e.$container.scrollTop(g-d+c)),e.el.val(e.suggestions[a].value))}};a.extend(k,g),a.extend(b.prototype,j),l.on("initialize",j.createContainer).on("dispose",j.removeContainer).on("setOptions",j.setContainerOptions).on("fixPosition",j.setDropdownPosition).on("fixPosition",j.setItemsPositions).on("assignSuggestions",j.suggest)}(),function(){var b="addon",c=50,d=1e3,e={addon:null},f={NONE:"none",SPINNER:"spinner",CLEAR:"clear"},g=function(b){var c=this,d=a('<span class="suggestions-addon"/>');c.owner=b,c.$el=d,c.type=f.NONE,c.visible=!1,c.initialPadding=null,d.on("click",a.proxy(c,"onClick"))};g.prototype={checkType:function(){var b=this,c=b.owner.options.addon,d=!1;a.each(f,function(a,b){return d=b==c,d?!1:void 0}),d||(c=b.owner.isMobile?f.CLEAR:f.SPINNER),c!=b.type&&(b.type=c,b.$el.attr("data-addon-type",c),b.toggle(!0))},toggle:function(a){var b,c=this;switch(c.type){case f.CLEAR:b=!!c.owner.currentValue;break;case f.SPINNER:b=!!c.owner.currentRequest;break;default:b=!1}b!=c.visible&&(c.visible=b,b?c.show(a):c.hide(a))},show:function(a){var b=this,d={opacity:1};a?(b.$el.show().css(d),b.showBackground(!0)):b.$el.stop(!0,!0).delay(c).queue(function(){b.$el.show(),b.showBackground(),b.$el.dequeue()}).animate(d,"fast")},hide:function(a){var b=this,c={opacity:0};a&&b.$el.hide().css(c),b.$el.stop(!0).animate(c,{duration:"fast",complete:function(){b.$el.hide(),b.hideBackground()}})},fixPosition:function(a,b){var c=this,d=b.innerHeight;c.checkType(),c.$el.css({left:a.left+b.borderLeft+b.innerWidth-d+"px",top:a.top+b.borderTop+"px",height:d,width:d}),c.initialPadding=b.paddingRight,c.width=d,c.visible&&(b.componentsRight+=d)},showBackground:function(a){var c=this,d=c.owner.el,e={paddingRight:c.width};c.width>c.initialPadding&&(c.stopBackground(),a?d.css(e):d.animate(e,{duration:"fast",queue:b}).dequeue(b))},hideBackground:function(a){var c=this,e=c.owner.el,f={paddingRight:c.initialPadding};c.width>c.initialPadding&&(c.stopBackground(!0),a?e.css(f):e.delay(d,b).animate(f,{duration:"fast",queue:b}).dequeue(b))},stopBackground:function(a){this.owner.el.stop(b,!0,a)},onClick:function(a){var b=this;b.type==f.CLEAR&&b.owner.clear()}};var h={createAddon:function(){var a=this,b=new g(a);a.$wrapper.append(b.$el),a.addon=b},fixAddonPosition:function(a,b){this.addon.fixPosition(a,b)},checkAddonType:function(){this.addon.checkType()},checkAddonVisibility:function(){this.addon.toggle()},stopBackground:function(){this.addon.stopBackground()}};a.extend(k,e),l.on("initialize",h.createAddon).on("setOptions",h.checkAddonType).on("fixPosition",h.fixAddonPosition).on("clear",h.checkAddonVisibility).on("valueChange",h.checkAddonVisibility).on("request",h.checkAddonVisibility).on("resetPosition",h.stopBackground)}(),function(){function c(b,c){var d=c.selection,e=d&&d.data&&c.bounds;return e&&a.each(c.bounds.all,function(a,c){return e=d.data[c]===b.data[c]}),e}var d={constraints:null,restrict_value:!1},e=function(b,c){var d=this;d.instance=c,d.fields={},d.specificity=-1,a.isPlainObject(b)&&c.type.dataComponents&&a.each(c.type.dataComponents,function(a,c){var e=c.id;c.forLocations&&b[e]&&(d.fields[e]=b[e],d.specificity=a)}),d.fields.kladr_id&&(d.fields={kladr_id:d.fields.kladr_id},d.specificity=d.getKladrSpecificity(d.fields.kladr_id))};a.extend(e.prototype,{getLabel:function(){return this.instance.type.composeValue(this.fields)},getFields:function(){return this.fields},isValid:function(){return!a.isEmptyObject(this.fields)},getKladrSpecificity:function(b){var c,d=-1;return this.significantKladr=b.replace(/^(\d{2})(\d*?)(0+)$/g,"$1$2"),c=this.significantKladr.length,a.each(this.instance.type.dataComponents,function(a,b){b.kladrFormat&&c===b.kladrFormat.digits&&(d=a)}),d},containsData:function(b){var c=!0;return this.fields.kladr_id?!!b.kladr_id&&0===b.kladr_id.indexOf(this.significantKladr):(a.each(this.fields,function(a,d){return c=!!b[a]&&b[a].toLowerCase()===d.toLowerCase()}),c)}}),b.ConstraintLocation=e;var f=function(b,c){this.id=m.uniqueId("c"),this.deletable=!!b.deletable,this.instance=c,this.locations=a.map(a.makeArray(b&&(b.locations||b.restrictions)),function(a){return new e(a,c)}),this.locations=a.grep(this.locations,function(a){return a.isValid()}),this.label=b.label,null==this.label&&c.type.composeValue&&(this.label=a.map(this.locations,function(a){return a.getLabel()}).join(", ")),this.label&&this.isValid()&&(this.$el=a(document.createElement("li")).append(a(document.createElement("span")).text(this.label)).attr("data-constraint-id",this.id),this.deletable&&this.$el.append(a(document.createElement("span")).addClass(c.classes.removeConstraint)))};a.extend(f.prototype,{isValid:function(){return this.locations.length>0},getFields:function(){return a.map(this.locations,function(a){return a.getFields()})}});var g={createConstraints:function(){var b=this;b.constraints={},b.$constraints=a('<ul class="suggestions-constraints"/>'),b.$wrapper.append(b.$constraints),b.$constraints.on("click","."+b.classes.removeConstraint,a.proxy(b.onConstraintRemoveClick,b))},setConstraintsPosition:function(a,b){var c=this;c.$constraints.css({left:a.left+b.borderLeft+b.paddingLeft+"px",top:a.top+b.borderTop+Math.round((b.innerHeight-c.$constraints.height())/2)+"px"}),b.componentsLeft+=c.$constraints.outerWidth(!0)+b.paddingLeft},onConstraintRemoveClick:function(b){var c=this,d=a(b.target).closest("li"),e=d.attr("data-constraint-id");delete c.constraints[e],c.update(),d.fadeOut("fast",function(){c.removeConstraint(e)})},setupConstraints:function(){var b,c=this,d=c.options.constraints;return d?void(d instanceof a||"string"==typeof d||"number"==typeof d.nodeType?(b=a(d),b.is(c.constraints)||(c.unbindFromParent(),b.is(c.el)||(c.constraints=b,c.bindToParent()))):(c._constraintsUpdating=!0,a.each(c.constraints,a.proxy(c.removeConstraint,c)),a.each(a.makeArray(d),function(a,b){c.addConstraint(b)}),c._constraintsUpdating=!1,c.fixPosition())):void c.unbindFromParent()},filteredLocation:function(b){var c=[],d={};return a.each(this.type.dataComponents,function(){this.forLocations&&c.push(this.id)}),a.isPlainObject(b)&&a.each(b,function(a,b){b&&c.indexOf(a)>=0&&(d[a]=b)}),a.isEmptyObject(d)?void 0:d.kladr_id?{kladr_id:d.kladr_id}:d},addConstraint:function(a){var b=this;a=new f(a,b),a.isValid()&&(b.constraints[a.id]=a,a.$el&&(b.$constraints.append(a.$el),b._constraintsUpdating||b.fixPosition()))},removeConstraint:function(a){var b=this;delete b.constraints[a],b.$constraints.children('[data-constraint-id="'+a+'"]').remove(),b._constraintsUpdating||b.fixPosition()},constructConstraintsParams:function(){for(var b,c,d=this,f=[],g=d.constraints,h={};g instanceof a&&(b=g.suggestions())&&!(c=m.getDeepValue(b,"selection.data"));)g=b.constraints;return g instanceof a?(c=new e(c,b).getFields(),c&&(h.locations=[c],h.restrict_value=!0)):g&&(a.each(g,function(a,b){f=f.concat(b.getFields())}),f.length&&(h.locations=f,h.restrict_value=d.options.restrict_value)),h},getFirstConstraintLabel:function(){var b=this,c=a.isPlainObject(b.constraints)&&Object.keys(b.constraints)[0];return c?b.constraints[c].label:""},bindToParent:function(){var b=this;b.constraints.on(["suggestions-select."+b.uniqueId,"suggestions-invalidateselection."+b.uniqueId,"suggestions-clear."+b.uniqueId].join(" "),a.proxy(b.onParentSelectionChanged,b)).on("suggestions-dispose."+b.uniqueId,a.proxy(b.onParentDispose,b))},unbindFromParent:function(){var b=this,c=b.constraints;c instanceof a&&c.off("."+b.uniqueId)},onParentSelectionChanged:function(a,b,c){("suggestions-select"!==a.type||c)&&this.clear()},onParentDispose:function(a){this.unbindFromParent()},getParentInstance:function(){return this.constraints instanceof a&&this.constraints.suggestions()},shareWithParent:function(a){var b=this.getParentInstance();b&&b.type===this.type&&!c(a,b)&&(b.shareWithParent(a),b.setSuggestion(a))},getUnrestrictedData:function(b){var c=this,d=[],e={},f=-1;return a.each(c.constraints,function(c,d){a.each(d.locations,function(a,c){c.containsData(b)&&c.specificity>f&&(f=c.specificity)})}),f>=0?(b.region_kladr_id&&b.region_kladr_id===b.city_kladr_id&&a.each(c.type.dataComponents,function(a,b){return"city"===b.id?(d.push.apply(d,b.fields),!1):void 0}),a.each(c.type.dataComponents.slice(0,f+1),function(a,b){d.push.apply(d,b.fields)}),a.each(b,function(a,b){-1===d.indexOf(a)&&(e[a]=b)})):e=b,e}};a.extend(k,d),a.extend(b.prototype,g),"GET"!=m.getDefaultType()&&l.on("initialize",g.createConstraints).on("setOptions",g.setupConstraints).on("fixPosition",g.setConstraintsPosition).on("requestParams",g.constructConstraintsParams).on("dispose",g.unbindFromParent)}(),function(){var c={proceedQuery:function(a){var b=this;a.length>=b.options.minChars?b.updateSuggestions(a):b.hide()},selectCurrentValue:function(b){var c=this,d=a.Deferred();return c.inputPhase.resolve(),c.fetchPhase.done(function(){var a;c.selection&&!c.visible?d.reject():(a=c.findSuggestionIndex(),c.select(a,b),-1===a?d.reject():d.resolve(a))}).fail(function(){d.reject()}),d},selectFoundSuggestion:function(){var a=this;a.requestMode.userSelect||a.select(0)},findSuggestionIndex:function(){var b,c=this,d=c.selectedIndex;return-1===d&&(b=a.trim(c.el.val()),b&&a.each(c.type.matchers,function(a,e){return d=e(b,c.suggestions),-1===d})),d},select:function(b,c){var d=this,e=d.suggestions[b],f=c&&c.continueSelecting,g=d.currentValue;if(!d.triggering.Select)return e?void d.enrichSuggestion(e,c).done(function(e,f){d.selectSuggestion(e,b,g,a.extend({hasBeenEnriched:f},c))}):(f||d.selection||d.triggerOnSelectNothing(),void d.onSelectComplete(f))},selectSuggestion:function(a,b,c,d){var e=this,f=d.continueSelecting,g=!e.type.isDataComplete||e.type.isDataComplete.call(e,a),h=e.selection;e.triggering.Select||(e.type.alwaysContinueSelecting&&(f=!0),g&&(f=!1),d.hasBeenEnriched&&e.suggestions[b]&&(e.suggestions[b].data=a.data),e.requestMode.updateValue&&(e.checkValueBounds(a),e.currentValue=e.getSuggestionValue(a,d.hasBeenEnriched),!e.currentValue||d.noSpace||g||(e.currentValue+=" "),e.el.val(e.currentValue)),e.currentValue?(e.selection=a,e.areSuggestionsSame(a,h)||e.trigger("Select",a,e.currentValue!=c),e.requestMode.userSelect&&e.onSelectComplete(f)):(e.selection=null,e.triggerOnSelectNothing()),e.shareWithParent(a))},onSelectComplete:function(a){var b=this;a?(b.selectedIndex=-1,b.updateSuggestions(b.currentValue)):b.hide()},triggerOnSelectNothing:function(){var a=this;a.triggering.SelectNothing||a.trigger("SelectNothing",a.currentValue)},trigger:function(b){var c=this,d=m.slice(arguments,1),e=c.options["on"+b];c.triggering[b]=!0,a.isFunction(e)&&e.apply(c.element,d),c.el.trigger.call(c.el,"suggestions-"+b.toLowerCase(),d),c.triggering[b]=!1}};a.extend(b.prototype,c),l.on("assignSuggestions",c.selectFoundSuggestion)}(),function(){var b={bounds:null},c={setupBounds:function(){this.bounds={from:null,to:null}},setBoundsOptions:function(){var b,c,d=this,e=[],f=a.trim(d.options.bounds).split("-"),g=f[0],h=f[f.length-1],i=[],j=[];d.type.dataComponents&&a.each(d.type.dataComponents,function(){this.forBounds&&e.push(this.id)}),-1===a.inArray(g,e)&&(g=null),c=a.inArray(h,e),(-1===c||c===e.length-1)&&(h=null),(g||h)&&(b=!g,a.each(e,function(a,c){return c==g&&(b=!0),j.push(c),b&&i.push(c),c==h?!1:void 0})),d.bounds.from=g,d.bounds.to=h,d.bounds.all=j,d.bounds.own=i},constructBoundsParams:function(){var a=this,b={};return a.bounds.from&&(b.from_bound={value:a.bounds.from}),a.bounds.to&&(b.to_bound={value:a.bounds.to}),b},checkValueBounds:function(a){var b,c=this;c.bounds.own.length&&c.type.composeValue&&(b=c.copyBoundedData(a.data,c.bounds.own),a.value=c.type.composeValue(b))},copyBoundedData:function(b,c){var d={},e=this.type.dataComponents;return e&&a.each(c,function(c,f){a.each(e,function(){this.id===f&&a.each(this.fields,function(a,c){null!=b[c]&&(d[c]=b[c])})})}),d},getBoundedKladrId:function(b,c){var d,e=c[c.length-1];return a.each(this.type.dataComponents,function(a,b){return b.id===e?(d=b.kladrFormat,!1):void 0}),b.substr(0,d.digits)+new Array((d.zeros||0)+1).join("0")}};a.extend(k,b),a.extend(a.Suggestions.prototype,c),l.on("initialize",c.setupBounds).on("setOptions",c.setBoundsOptions).on("requestParams",c.constructBoundsParams)}(),a.fn.suggestions=function(c,d){return 0===arguments.length?this.first().data(f):this.each(function(){var e=a(this),g=e.data(f);"string"==typeof c?g&&"function"==typeof g[c]&&g[c](d):(g&&g.dispose&&g.dispose(),g=new b(this,c),e.data(f,g))})}});
|
var helpers = require('../utils/helpers');
var _ = require('underscore');
const RESOURCEID_URL_PARAM_NAME = '$resourceId';
function ParameterMapper() {
this.RESOURCE_URL_PARAM_MAP = {};
this.URL_PARAMETER_DATE_FORMAT = helpers.defaultDateFormat;
}
ParameterMapper.prototype.isQueryById = function (resourceName, urlParametersObject) {
var resourceUrlParamMap = this.RESOURCE_URL_PARAM_MAP[resourceName];
if (resourceUrlParamMap && urlParametersObject[RESOURCEID_URL_PARAM_NAME]) {
return true;
} else {
return false;
}
};
ParameterMapper.prototype.extractKeyParameterMap = function (resourceName) {
var resourceUrlParamMap = this.RESOURCE_URL_PARAM_MAP[resourceName];
if (!resourceUrlParamMap) {
throw 'No url parameter mapping was found for the resource ' + resourceName;
}
var keyAttributes = _.pick(resourceUrlParamMap, function (value, key, object) {
return value.key
});
var keyAttributesObjectKeys = Object.keys(keyAttributes);
if (keyAttributesObjectKeys.length > 1) {
throw `${resourceName}: When url is used to query for resource we do not support composite keys for resources.`;
}
else if (keyAttributesObjectKeys.length === 0) {
throw `${resourceName}: When url parameter is used to query for resource using id the url object mapping file should have specified a resource attribute to be key by setting mapping attribute key to true`;
}
else {
return keyAttributes[keyAttributesObjectKeys[0]];
}
};
ParameterMapper.prototype.toResourceDaoQueryObject = function (resourceName, urlParametersObject) {
var resourceDaoQueryObject = {};
var resourceUrlParamMap = this.RESOURCE_URL_PARAM_MAP[resourceName];
if (!resourceUrlParamMap) {
return;
}
for (var queryParam in urlParametersObject) {
var mappedResourceAttributeMap = undefined;
if (queryParam === RESOURCEID_URL_PARAM_NAME) {
mappedResourceAttributeMap = this.extractKeyParameterMap(resourceName);
}
mappedResourceAttributeMap = !mappedResourceAttributeMap ? resourceUrlParamMap[queryParam] : mappedResourceAttributeMap;
if (!mappedResourceAttributeMap) {
continue;
}
var attributeSelector = mappedResourceAttributeMap.attribute;
var resourceAttributeUrlParameterValueType = mappedResourceAttributeMap.type;
if (attributeSelector) {
var queryValue = helpers.castToParamValue(urlParametersObject[queryParam], resourceAttributeUrlParameterValueType, this.URL_PARAMETER_DATE_FORMAT);
resourceDaoQueryObject[attributeSelector] = queryValue;
}
}
return resourceDaoQueryObject;
};
ParameterMapper.prototype.loadDirectory = function (dir, extension) {
_.assign(this.RESOURCE_URL_PARAM_MAP, helpers.readFilesToMap(dir, extension || '.url.param.map.json'));
};
module.exports = function (urlParameterDateFormat, urlParamMapFilePath, urlParamFileExtension) {
const parameterMapper = new ParameterMapper();
if (urlParamMapFilePath)
parameterMapper.loadDirectory(urlParamMapFilePath, urlParamFileExtension);
if (urlParameterDateFormat)
parameterMapper.URL_PARAMETER_DATE_FORMAT = urlParameterDateFormat;
return parameterMapper;
};
|
export default class BookController {
constructor(client) {
this.client = client;
this.create = this.create.bind(this);
this.delete = this.delete.bind(this);
this.getAll = this.getAll.bind(this);
this.getById = this.getById.bind(this);
this.update = this.update.bind(this);
}
async create(req, res) {
const { author, genre, title } = req.body;
if (!author || !title || !genre) {
return res.status(400).json({
message: 'Author, genre and title are required!'
});
}
await this.client.index({
index: 'my-books',
body: {
author: author,
genre: genre,
title: title
}
}, (err, response) => {
if (err) {
console.warn(err);
return res.status(500).json(err);
}
return res.status(201).json(response);
});
}
async delete(req, res) {
await this.client.delete({
index: 'my-books',
id: req.params.bookId
}, (err, response) => {
if (err) {
return res.status(500).json(err);
}
return res.status(200).json(response);
});
}
async getAll(req, res) {
await this.client.search({
index: 'my-books',
q: req.query.q
}, (err, response) => {
if (err) {
return res.status(500).json(err);
}
return res.status(200).json(response.hits.hits);
});
}
async getById(req, res) {
const { bookId } = req.params;
if (!bookId) {
return res.status(400).json({
message: 'BookId invalid!'
});
}
await this.client.get({
index: 'my-books',
id: bookId
}, (err, response) => {
if (err) {
return res.status(500).json(err);
}
return res.status(200).json(response);
});
}
async update(req, res) {
if (!req.body) {
return res.status(400).json({
message: 'Body invalid!'
});
}
await this.client.update({
index: 'my-books',
id: req.params.bookId,
body: {
doc: req.body
}
}, (err, response) => {
if (err) {
return res.status(500).json(err);
}
return res.status(200).json(response);
});
}
}
|
function main() {
const v3 = [13.37,13.37,13.37,13.37,13.37];
const v5 = [13.37];
function v6(v7,v8,v9,v10) {
function v11(v12,v13) {
}
const v15 = v11(...arguments);
const v17 = arguments instanceof BigInt;
let v19 = 0;
do {
let v22 = 0;
do {
for (const v23 of v3) {
}
const v24 = v22 + 1;
v22 = v24;
} while (v22 < 10);
const v25 = v19 + 1;
v19 = v25;
} while (v19 < 4);
}
const v31 = [536870912];
const v32 = v6(10,Function,127,v31,Function);
const v33 = v6(127,v5);
}
%NeverOptimizeFunction(main);
main();
|
(function ($) {
$(document).ready(function () {
initPage(document);
});
$(document).on("opencontent.change", function (event, element) {
initPage(element);
});
/*
function initPage(element) {
$(".jplist", element).each(function () {
$(this).jplist({
itemsBox: '.list'
, itemPath: '.list-item'
, panelPath: '.jplist-panel'
,deepLinking: true
});
});
}
*/
var template = '';
function initPage(element) {
$(".jplist", element).each(function () {
var moduleid = $(this).attr('data-moduleid');
var moduleScope = $(this),
self = moduleScope,
sf = $.ServicesFramework(moduleid);
var $list = $('#demo .list')
, template = Handlebars.compile($('#jplist-template').html());
$(this).jplist({
itemsBox: ".list"
, itemPath: ".list-item"
, panelPath: ".jplist-panel"
, deepLinking: false
, dataSource: {
type: 'server'
, server: {
ajax: {
data: {}
, url: sf.getServiceRoot('OpenContent') + "JplistAPI/List"
, dataType: 'json'
, type: 'POST'
, beforeSend: sf.setModuleHeaders
}
}
, render: function (dataItem, statuses) {
$list.html(template(dataItem.content));
var logs = dataItem.content.Logs;
$.fn.openContent.printLogs('Module ' + moduleid + ' - jplist webapi', logs);
}
}
});
var isTyping = false;
var typingHandler = null;
var $textfilter = $(".textfilter", this);
$textfilter.on('input', function(context){
if (isTyping) {
window.clearTimeout(typingHandler);
}
else {
isTyping = true;
}
typingHandler = window.setTimeout(function () {
isTyping = false;
$textfilter.trigger("keydelay");
}, 1000);
});
});
$(".flexslider.flex-carousel", element).each(function () {
$(this).flexslider({
'animationLoop': $(this).attr("data-animationloop") ? $(this).data("animationloop") : false,
'slideshow': $(this).attr("data-slideshow") ? $(this).data("slideshow") : false,
'animation': "slide",
'touch': $(this).attr("data-touch") ? $(this).data("touch") : false,
'controlNav': $(this).attr("data-controlnav") ? $(this).data("controlnav") : false,
'directionNav': $(this).attr("data-directionnav") ? $(this).data("directionnav") : false,
'itemWidth': $(this).attr("data-itemwidth") ? $(this).data("itemwidth") : 210,
'itemMargin': $(this).attr("data-itemmargin") ? $(this).data("itemmargin") : 5,
'minItems': $(this).attr("data-minitems") ? $(this).data("minitems") : 0,
'maxItems': $(this).attr("data-maxitems") ? $(this).data("maxitems") : 0,
'move': $(this).attr("data-move") ? $(this).data("move") : 0,
'asNavFor': $(this).attr("data-asnavfor") ? $(this).data("asnavfor") : ""
});
});
$(".flexslider.flex-slider", element).each(function () {
$(this).flexslider({
'animationLoop': $(this).attr("data-animationloop") ? $(this).data("animationloop") : false,
'slideshow': $(this).attr("data-slideshow") ? $(this).data("slideshow") : false,
'animation': $(this).attr("data-animation") ? $(this).data("animation") : "slide",
'touch': $(this).attr("data-touch") ? $(this).data("touch") : false,
'controlNav': $(this).attr("data-controlnav") ? $(this).data("controlnav") : false,
'directionNav': $(this).attr("data-directionnav") ? $(this).data("directionnav") : false,
'sync': $(this).attr("data-sync") ? $(this).data("sync") : ""
});
});
if ($.fn.oembed) {
$(".jplist-detail .description a").oembed(null, {'maxWidth':300});
}
}
if (typeof Handlebars != 'undefined') {
Handlebars.registerHelper('formatDateTime', function (context, format) {
if (window.moment && context && moment(context).isValid()) {
var f = format || "DD/MM/YYYY";
return moment(context).format(f);
} else {
return context; // moment plugin is not available, context does not have a truthy value, or context is not a valid date
}
});
Handlebars.registerHelper('lookup', function (context, field, value, options) {
if (context) {
for (var i = 0; i < context.length; i++) {
if (context[i][field] == value) {
return options.fn(context[i]);
}
}
}
return context;
});
}
}(jQuery));
|
import { Container, Input, Title, Main, Form, Button } from '../../components'
import styles from './styles.module.css'
import { useFormWithValidation } from '../../utils'
import { AuthContext } from '../../contexts'
import { Redirect } from 'react-router-dom'
import { useContext } from 'react'
import MetaTags from 'react-meta-tags'
const SignIn = ({ onSignIn }) => {
const { values, handleChange, errors, isValid, resetForm } = useFormWithValidation()
const authContext = useContext(AuthContext)
return <Main>
{authContext && <Redirect to='/recipes' />}
<Container>
<MetaTags>
<title>Войти на сайт</title>
<meta name="description" content="Продуктовый помощник - Войти на сайт" />
<meta property="og:title" content="Войти на сайт" />
</MetaTags>
<Title title='Войти на сайт' />
<Form
className={styles.form}
onSubmit={e => {
e.preventDefault()
onSignIn(values)
}}
>
<Input
required
label='Электронная почта'
name='email'
onChange={handleChange}
/>
<Input
required
label='Пароль'
type='password'
name='password'
onChange={handleChange}
/>
<Button
modifier='style_dark-blue'
disabled={!isValid}
type='submit'
className={styles.button}
>
Войти
</Button>
</Form>
</Container>
</Main>
}
export default SignIn
|
import React from 'react'
export default function Pagination({goToPrevPage,goToNextPage}) {
return (
<div>
{goToPrevPage && <button onClick={goToPrevPage}>Prev</button>}
<button onClick={goToNextPage}>Next</button>
</div>
)
}
|
// Random HexCode Generator
const randomHexColorCode = () => {
let n = (Math.random() * 0xfffff * 1000000).toString(16)
return '#' + n.slice(0, 6)
}
|
import "../styles/globals.css";
import "katex/dist/katex.min.css";
import "mathquill/build/mathquill.css";
import "mathquill4quill/mathquill4quill.css";
import "react-quill/dist/quill.snow.css";
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />;
}
export default MyApp;
|
self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "a8549bb241e5315be858c25678e7b38b",
"url": "./index.html"
},
{
"revision": "47d1e3cd70ddee00b074",
"url": "./static/css/2.2ea8cd81.chunk.css"
},
{
"revision": "81e06e24d66cbb18f114",
"url": "./static/css/main.36c7fb58.chunk.css"
},
{
"revision": "47d1e3cd70ddee00b074",
"url": "./static/js/2.1e0995d4.chunk.js"
},
{
"revision": "29eb69a08ea4198f7b46e1db8a3d5045",
"url": "./static/js/2.1e0995d4.chunk.js.LICENSE.txt"
},
{
"revision": "81e06e24d66cbb18f114",
"url": "./static/js/main.3ac0168f.chunk.js"
},
{
"revision": "0567e8041d10217307f2",
"url": "./static/js/runtime-main.6420492a.js"
}
]);
|
import React from 'react';
//import ScrollView, {RAFParticle} from '../dist/scrollview';
import ScrollView, {RAFParticle} from '../src/index';
const Sphere = (props) => {
return <div style={{borderRadius: '50%', backgroundColor: 'white', width: '30px', height: '30px'}} {...props} />;
};
export default class ParticleDemo extends React.Component {
constructor() {
super();
this.state = {
x: 500
};
console.log(ScrollView);
this._particle = new RAFParticle({
value: 0,
endValue: this.state.x
});
this._particle.onUpdate = (value) => this.setState({x: value});
//this._particle.onSettle = (value) => console.log('onSettle: ', value);
setInterval(() => this._particle.set(this._particle.endValue ? 0 : 500), 1000);
}
render() {
return <div style={{
position: 'absolute',
transform: 'translate3d(' + this.state.x + 'px, 100px, 0)'
}}><Sphere onClick={() => {
this._particle.enabled = !this._particle.enabled;
}}/></div>;
}
}
|
import Column from './column';
export default Column;
|
import React from 'react';
import { Navbar } from 'react-bootstrap'
export const Footer = () =>
<Navbar fixedBottom >
<Navbar.Text pullRight>
Created By: <Navbar.Link href="https://github.com/wolnewitz">Cory Wolnewitz</Navbar.Link>
</Navbar.Text>
</Navbar>
|
import React from "react";
import PropTypes from "prop-types";
import { useCubeQuery } from "@cubejs-client/react";
import CircularProgress from "@material-ui/core/CircularProgress";
import * as d3 from "d3";
import Typography from "@material-ui/core/Typography";
import Table from "@material-ui/core/Table";
import TableBody from "@material-ui/core/TableBody";
import TableCell from "@material-ui/core/TableCell";
import TableHead from "@material-ui/core/TableHead";
import TableRow from "@material-ui/core/TableRow";
const COLORS_SERIES = ["#7A77FF", "#141446", "#FF6492", "#727290", "#43436B", "#BEF3BE", "#68B68C", "#FFE7AA", "#B2A58D", "#64C8E0"];
const CHART_HEIGHT = 300;
const drawPieChart = (node, resultSet, options) => {
const data = resultSet.series()[0].series.map(s => s.value);
const data_ready = d3.pie()(data);
d3.select(node).html(""); // The radius of the pieplot is half the width or half the height (smallest one).
const radius = CHART_HEIGHT / 2 - 40; // Seprate container to center align pie chart
const svg = d3
.select(node)
.append("svg")
.attr("width", node.clientWidth)
.attr("height", CHART_HEIGHT)
.append("g")
.attr(
"transform",
"translate(" + node.clientWidth / 2 + "," + CHART_HEIGHT / 2 + ")"
);
svg
.selectAll("pieArcs")
.data(data_ready)
.enter()
.append("path")
.attr(
"d",
d3
.arc()
.innerRadius(0)
.outerRadius(radius)
)
.attr("fill", d => COLORS_SERIES[d.index]);
const size = 12;
const labels = resultSet.series()[0].series.map(s => s.x);
svg.selectAll("myrect")
.data(labels)
.enter()
.append("rect")
.attr("x", 150)
.attr("y", function(d,i){ return -50 + i*(size+5)})
.attr("width", size)
.attr("height", size)
.style("fill", (d,i) => COLORS_SERIES[i])
svg.selectAll("mylabels")
.data(labels)
.enter()
.append("text")
.attr("x", 150 + size*1.2)
.attr("y", function(d,i){ return -50 + i*(size+5) + (size/2)})
.text(function(d){ return d})
.attr("text-anchor", "left")
.attr("font-size", "12px")
.style("alignment-baseline", "middle")
};
const drawChart = (node, resultSet, chartType, options = {}) => {
if (chartType === "pie") {
return drawPieChart(node, resultSet, options);
}
const margin = {
top: 10,
right: 30,
bottom: 30,
left: 60
},
width = node.clientWidth - margin.left - margin.right,
height = CHART_HEIGHT - margin.top - margin.bottom;
d3.select(node).html("");
const svg = d3
.select(node)
.append("svg")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
const keys = resultSet.seriesNames(options.pivotConfig).map(s => s.key);
let data, maxData;
if (chartType === "line") {
data = resultSet.series(options.pivotConfig).map(series => ({
key: series.key,
values: series.series
}));
maxData = d3.max(data.map(s => d3.max(s.values, i => i.value)));
} else {
data = d3.stack().keys(keys)(resultSet.chartPivot(options.pivotConfig));
maxData = d3.max(data.map(s => d3.max(s, i => i[1])));
}
const color = d3
.scaleOrdinal()
.domain(keys)
.range(COLORS_SERIES);
let x;
if (chartType === "bar") {
x = d3
.scaleBand()
.range([0, width])
.domain(resultSet.chartPivot(options.pivotConfig).map(c => c.x))
.padding(0.3);
} else {
x = d3
.scaleTime()
.domain(d3.extent(resultSet.chartPivot(options.pivotConfig), c => d3.isoParse(c.x))).nice()
.range([0, width]);
}
svg
.append("g")
.attr("transform", "translate(0," + height + ")")
.call(d3.axisBottom(x));
const y = d3
.scaleLinear()
.domain([0, maxData])
.range([height, 0]);
svg.append("g").call(d3.axisLeft(y));
if (chartType === "line") {
svg
.selectAll(".line")
.data(data)
.enter()
.append("path")
.attr("fill", "none")
.attr("stroke", d => color(d.key))
.attr("stroke-width", 1.5)
.attr("d", d => {
return d3
.line()
.x(d => x(d3.isoParse(d.x)))
.y(d => y(+d.value))(d.values);
});
} else if (chartType === "area") {
svg
.selectAll("mylayers")
.data(data)
.enter()
.append("path")
.style("fill", d => color(d.key))
.attr(
"d",
d3
.area()
.x(d => x(d3.isoParse(d.data.x)))
.y0(d => y(d[0]))
.y1(d => y(d[1]))
);
} else {
svg
.append("g")
.selectAll("g") // Enter in the stack data = loop key per key = group per group
.data(data)
.enter()
.append("g")
.attr("fill", d => color(d.key))
.selectAll("rect") // enter a second time = loop subgroup per subgroup to add all rectangles
.data(d => d)
.enter()
.append("rect")
.attr("x", d => x(d.data.x))
.attr("y", d => y(d[1]))
.attr("height", d => y(d[0]) - y(d[1]))
.attr("width", x.bandwidth());
}
};
const D3Chart = ({ resultSet, type, ...props }) => (
<div ref={el => el && drawChart(el, resultSet, type, props)} />
);
const TypeToChartComponent = {
line: (props) => <D3Chart type="line" {...props} />,
bar: (props) => <D3Chart type="bar" {...props} />,
area: (props) => <D3Chart type="area" {...props} />,
pie: (props) => <D3Chart type="pie" {...props} />,
number: ({ resultSet }) => (
<Typography
variant="h4"
style={{
textAlign: "center"
}}
>
{resultSet.seriesNames().map(s => resultSet.totalRow()[s.key])}
</Typography>
),
table: ({ resultSet }) => (
<Table aria-label="simple table">
<TableHead>
<TableRow>
{resultSet.tableColumns().map(c => (
<TableCell key={c.key}>{c.title}</TableCell>
))}
</TableRow>
</TableHead>
<TableBody>
{resultSet.tablePivot().map((row, index) => (
<TableRow key={index}>
{resultSet.tableColumns().map(c => (
<TableCell key={c.key}>{row[c.key]}</TableCell>
))}
</TableRow>
))}
</TableBody>
</Table>
)
};
const TypeToMemoChartComponent = Object.keys(TypeToChartComponent)
.map(key => ({
[key]: React.memo(TypeToChartComponent[key])
}))
.reduce((a, b) => ({ ...a, ...b }));
const renderChart = Component => ({ resultSet, error, ...props }) =>
(resultSet && <Component resultSet={resultSet} {...props} />) ||
(error && error.toString()) || <CircularProgress />;
const ChartRenderer = ({ vizState }) => {
const { query, chartType, pivotConfig = null } = vizState;
const component = TypeToMemoChartComponent[chartType];
const renderProps = useCubeQuery(query);
return component && renderChart(component)({ pivotConfig, ...renderProps });
};
ChartRenderer.propTypes = {
vizState: PropTypes.object,
cubejsApi: PropTypes.object
};
ChartRenderer.defaultProps = {
vizState: {},
cubejsApi: null
};
export default ChartRenderer;
|
'use strict';
module.exports = {
valid: [
'require(\'foo\')',
'exports.foo = foo;',
'module.exports = foo;'
],
invalid: [
{ code: 'import \'foo\';', errors: [{ message: 'Unexpected import statement. Use require() instead.' }] },
{ code: 'import foo from \'foo\';', errors: [{ message: 'Unexpected import statement. Use require() instead.' }] },
{ code: 'export { foo };', errors: [{ message: 'Unexpected export statement. Use exports instead.' }] },
{ code: 'export default foo;', errors: [{ message: 'Unexpected default export statement. Use module.exports instead.' }] }
]
};
|
(function () {
"use strict";
const mainMenuToggle = document.getElementById("main-menu-toggle");
const mainMenu = document.getElementById("main-menu");
if (mainMenuToggle) {
mainMenuToggle.addEventListener("click", () => {
const isExpanded = mainMenuToggle.getAttribute("aria-expanded");
mainMenu.classList.toggle("show");
mainMenuToggle.setAttribute(
"aria-expanede",
isExpanded === "false" ? true : false
);
});
}
if (mainMenu) {
mainMenu.addEventListener("click", () => {
const isExpanded = mainMenuToggle.getAttribute("aria-expanded");
mainMenu.classList.toggle("show");
mainMenuToggle.setAttribute(
"aria-expanede",
isExpanded === "false" ? true : false
);
});
}
})();
|
import React from "react";
import { Pagination } from "../../components/pagination";
import { TagList } from "../../components/tag-list";
import { Title } from "../../components/title";
import { useProducts } from "../../hooks/useProducts";
import { useDispatch, useSelector } from "react-redux";
import {
changeFilterItemType,
changePage,
selectPageCount,
} from "./productSlice";
import { useItemsQuery } from "../../app/services/api";
import { Grid } from "@mui/material";
import { ProductCard } from "./product-card";
export const ProductPane = () => {
const { isLoading: productIsLoading } = useItemsQuery();
const { products } = useProducts();
const dispatch = useDispatch();
const pageCount = useSelector(selectPageCount);
const onPageChange = (page) => {
dispatch(changePage(page));
};
const onItemTypeChange = (itemType) => {
dispatch(changeFilterItemType(itemType));
};
return (
<>
<Title label="Products" />
<TagList tags={["mug", "shirt"]} onChange={onItemTypeChange} />
<Grid
container
sx={{
marginTop: 1,
backgroundColor: "white",
padding: 3,
justifyContent: "center",
}}
>
{!productIsLoading &&
products.map((item) => (
<Grid
item
md={3}
xs={6}
sx={{ padding: 1 }}
key={`grid-item-${item.slug}`}
>
<ProductCard product={item} />
</Grid>
))}
<Pagination onChange={onPageChange} pageCount={pageCount} />
</Grid>
</>
);
};
|
!function(e){e.ui=e.ui||{};e.ui.version="1.12.1";var t=0,n=Array.prototype.slice;e.cleanData=function(t){return function(n){var i,r,o;for(o=0;null!=(r=n[o]);o++)try{(i=e._data(r,"events"))&&i.remove&&e(r).triggerHandler("remove")}catch(e){}t(n)}}(e.cleanData),e.widget=function(t,n,i){var r,o,s,a={},l=t.split(".")[0],d=l+"-"+(t=t.split(".")[1]);return i||(i=n,n=e.Widget),e.isArray(i)&&(i=e.extend.apply(null,[{}].concat(i))),e.expr[":"][d.toLowerCase()]=function(t){return!!e.data(t,d)},e[l]=e[l]||{},r=e[l][t],o=e[l][t]=function(e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)},e.extend(o,r,{version:i.version,_proto:e.extend({},i),_childConstructors:[]}),s=new n,s.options=e.widget.extend({},s.options),e.each(i,function(t,i){e.isFunction(i)?a[t]=function(){function e(){return n.prototype[t].apply(this,arguments)}function r(e){return n.prototype[t].apply(this,e)}return function(){var t,n=this._super,o=this._superApply;return this._super=e,this._superApply=r,t=i.apply(this,arguments),this._super=n,this._superApply=o,t}}():a[t]=i}),o.prototype=e.widget.extend(s,{widgetEventPrefix:r?s.widgetEventPrefix||t:t},a,{constructor:o,namespace:l,widgetName:t,widgetFullName:d}),r?(e.each(r._childConstructors,function(t,n){var i=n.prototype;e.widget(i.namespace+"."+i.widgetName,o,n._proto)}),delete r._childConstructors):n._childConstructors.push(o),e.widget.bridge(t,o),o},e.widget.extend=function(t){for(var i,r,o=n.call(arguments,1),s=0,a=o.length;s<a;s++)for(i in o[s])r=o[s][i],o[s].hasOwnProperty(i)&&void 0!==r&&(e.isPlainObject(r)?t[i]=e.isPlainObject(t[i])?e.widget.extend({},t[i],r):e.widget.extend({},r):t[i]=r);return t},e.widget.bridge=function(t,i){var r=i.prototype.widgetFullName||t;e.fn[t]=function(o){var s="string"==typeof o,a=n.call(arguments,1),l=this;return s?this.length||"instance"!==o?this.each(function(){var n,i=e.data(this,r);return"instance"===o?(l=i,!1):i?e.isFunction(i[o])&&"_"!==o.charAt(0)?(n=i[o].apply(i,a))!==i&&void 0!==n?(l=n&&n.jquery?l.pushStack(n.get()):n,!1):void 0:e.error("no such method '"+o+"' for "+t+" widget instance"):e.error("cannot call methods on "+t+" prior to initialization; attempted to call method '"+o+"'")}):l=void 0:(a.length&&(o=e.widget.extend.apply(null,[o].concat(a))),this.each(function(){var t=e.data(this,r);t?(t.option(o||{}),t._init&&t._init()):e.data(this,r,new i(o,this))})),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(n,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=t++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=e(),this.hoverable=e(),this.focusable=e(),this.classesElementLookup={},i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this.options=e.widget.extend({},this.options,this._getCreateOptions(),n),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){var t=this;this._destroy(),e.each(this.classesElementLookup,function(e,n){t._removeClass(n,e)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:e.noop,widget:function(){return this.element},option:function(t,n){var i,r,o,s=t;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof t)if(s={},i=t.split("."),t=i.shift(),i.length){for(r=s[t]=e.widget.extend({},this.options[t]),o=0;o<i.length-1;o++)r[i[o]]=r[i[o]]||{},r=r[i[o]];if(t=i.pop(),1===arguments.length)return void 0===r[t]?null:r[t];r[t]=n}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];s[t]=n}return this._setOptions(s),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return"classes"===e&&this._setOptionClasses(t),this.options[e]=t,"disabled"===e&&this._setOptionDisabled(t),this},_setOptionClasses:function(t){var n,i,r;for(n in t)r=this.classesElementLookup[n],t[n]!==this.options.classes[n]&&r&&r.length&&(i=e(r.get()),this._removeClass(r,n),i.addClass(this._classes({element:i,keys:n,classes:t,add:!0})))},_setOptionDisabled:function(e){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!e),e&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(t){function n(n,o){var s,a;for(a=0;a<n.length;a++)s=r.classesElementLookup[n[a]]||e(),s=t.add?e(e.unique(s.get().concat(t.element.get()))):e(s.not(t.element).get()),r.classesElementLookup[n[a]]=s,i.push(n[a]),o&&t.classes[n[a]]&&i.push(t.classes[n[a]])}var i=[],r=this;return t=e.extend({element:this.element,classes:this.options.classes||{}},t),this._on(t.element,{remove:"_untrackClassesElement"}),t.keys&&n(t.keys.match(/\S+/g)||[],!0),t.extra&&n(t.extra.match(/\S+/g)||[]),i.join(" ")},_untrackClassesElement:function(t){var n=this;e.each(n.classesElementLookup,function(i,r){-1!==e.inArray(t.target,r)&&(n.classesElementLookup[i]=e(r.not(t.target).get()))})},_removeClass:function(e,t,n){return this._toggleClass(e,t,n,!1)},_addClass:function(e,t,n){return this._toggleClass(e,t,n,!0)},_toggleClass:function(e,t,n,i){i="boolean"==typeof i?i:n;var r="string"==typeof e||null===e,o={extra:r?t:n,keys:r?e:t,element:r?this.element:e,add:i};return o.element.toggleClass(this._classes(o),i),this},_on:function(t,n,i){var r,o=this;"boolean"!=typeof t&&(i=n,n=t,t=!1),i?(n=r=e(n),this.bindings=this.bindings.add(n)):(i=n,n=this.element,r=this.widget()),e.each(i,function(i,s){function a(){if(t||!0!==o.options.disabled&&!e(this).hasClass("ui-state-disabled"))return("string"==typeof s?o[s]:s).apply(o,arguments)}"string"!=typeof s&&(a.guid=s.guid=s.guid||a.guid||e.guid++);var l=i.match(/^([\w:-]*)\s*(.*)$/),d=l[1]+o.eventNamespace,c=l[2];c?r.on(d,c,a):n.on(d,a)})},_off:function(t,n){n=(n||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(n).off(n),this.bindings=e(this.bindings.not(t).get()),this.focusable=e(this.focusable.not(t).get()),this.hoverable=e(this.hoverable.not(t).get())},_delay:function(e,t){var n=this;return setTimeout(function(){return("string"==typeof e?n[e]:e).apply(n,arguments)},t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(e(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(e(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(e(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(e(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,n,i){var r,o,s=this.options[t];if(i=i||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],o=n.originalEvent)for(r in o)r in n||(n[r]=o[r]);return this.element.trigger(n,i),!(e.isFunction(s)&&!1===s.apply(this.element[0],[n].concat(i))||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(i,r,o){"string"==typeof r&&(r={effect:r});var s,a=r?!0===r||"number"==typeof r?n:r.effect||n:t;"number"==typeof(r=r||{})&&(r={duration:r}),s=!e.isEmptyObject(r),r.complete=o,r.delay&&i.delay(r.delay),s&&e.effects&&e.effects.effect[a]?i[t](r):a!==t&&i[a]?i[a](r.duration,r.easing,o):i.queue(function(n){e(this)[t](),o&&o.call(i[0]),n()})}});e.widget;!function(){function t(e,t,n){return[parseFloat(e[0])*(c.test(e[0])?t/100:1),parseFloat(e[1])*(c.test(e[1])?n/100:1)]}function n(t,n){return parseInt(e.css(t,n),10)||0}var i,r=Math.max,o=Math.abs,s=/left|center|right/,a=/top|center|bottom/,l=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,c=/%$/,u=e.fn.position;e.position={scrollbarWidth:function(){if(void 0!==i)return i;var t,n,r=e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),o=r.children()[0];return e("body").append(r),t=o.offsetWidth,r.css("overflow","scroll"),n=o.offsetWidth,t===n&&(n=r[0].clientWidth),r.remove(),i=t-n},getScrollInfo:function(t){var n=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),r="scroll"===n||"auto"===n&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?e.position.scrollbarWidth():0,height:r?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var n=e(t||window),i=e.isWindow(n[0]),r=!!n[0]&&9===n[0].nodeType;return{element:n,isWindow:i,isDocument:r,offset:!i&&!r?e(t).offset():{left:0,top:0},scrollLeft:n.scrollLeft(),scrollTop:n.scrollTop(),width:n.outerWidth(),height:n.outerHeight()}}},e.fn.position=function(i){if(!i||!i.of)return u.apply(this,arguments);i=e.extend({},i);var c,h,f,p,g,y,v=e(i.of),m=e.position.getWithinInfo(i.within),x=e.position.getScrollInfo(m),b=(i.collision||"flip").split(" "),C={};return y=function(t){var n=t[0];return 9===n.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(n)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:n.preventDefault?{width:0,height:0,offset:{top:n.pageY,left:n.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}(v),v[0].preventDefault&&(i.at="left top"),h=y.width,f=y.height,p=y.offset,g=e.extend({},p),e.each(["my","at"],function(){var e,t,n=(i[this]||"").split(" ");1===n.length&&(n=s.test(n[0])?n.concat(["center"]):a.test(n[0])?["center"].concat(n):["center","center"]),n[0]=s.test(n[0])?n[0]:"center",n[1]=a.test(n[1])?n[1]:"center",e=l.exec(n[0]),t=l.exec(n[1]),C[this]=[e?e[0]:0,t?t[0]:0],i[this]=[d.exec(n[0])[0],d.exec(n[1])[0]]}),1===b.length&&(b[1]=b[0]),"right"===i.at[0]?g.left+=h:"center"===i.at[0]&&(g.left+=h/2),"bottom"===i.at[1]?g.top+=f:"center"===i.at[1]&&(g.top+=f/2),c=t(C.at,h,f),g.left+=c[0],g.top+=c[1],this.each(function(){var s,a,l=e(this),d=l.outerWidth(),u=l.outerHeight(),y=n(this,"marginLeft"),_=n(this,"marginTop"),k=d+y+n(this,"marginRight")+x.width,N=u+_+n(this,"marginBottom")+x.height,w=e.extend({},g),S=t(C.my,l.outerWidth(),l.outerHeight());"right"===i.my[0]?w.left-=d:"center"===i.my[0]&&(w.left-=d/2),"bottom"===i.my[1]?w.top-=u:"center"===i.my[1]&&(w.top-=u/2),w.left+=S[0],w.top+=S[1],s={marginLeft:y,marginTop:_},e.each(["left","top"],function(t,n){e.ui.position[b[t]]&&e.ui.position[b[t]][n](w,{targetWidth:h,targetHeight:f,elemWidth:d,elemHeight:u,collisionPosition:s,collisionWidth:k,collisionHeight:N,offset:[c[0]+S[0],c[1]+S[1]],my:i.my,at:i.at,within:m,elem:l})}),i.using&&(a=function(e){var t=p.left-w.left,n=t+h-d,s=p.top-w.top,a=s+f-u,c={target:{element:v,left:p.left,top:p.top,width:h,height:f},element:{element:l,left:w.left,top:w.top,width:d,height:u},horizontal:n<0?"left":t>0?"right":"center",vertical:a<0?"top":s>0?"bottom":"middle"};h<d&&o(t+n)<h&&(c.horizontal="center"),f<u&&o(s+a)<f&&(c.vertical="middle"),r(o(t),o(n))>r(o(s),o(a))?c.important="horizontal":c.important="vertical",i.using.call(this,e,c)}),l.offset(e.extend(w,{using:a}))})},e.ui.position={fit:{left:function(e,t){var n,i=t.within,o=i.isWindow?i.scrollLeft:i.offset.left,s=i.width,a=e.left-t.collisionPosition.marginLeft,l=o-a,d=a+t.collisionWidth-s-o;t.collisionWidth>s?l>0&&d<=0?(n=e.left+l+t.collisionWidth-s-o,e.left+=l-n):e.left=d>0&&l<=0?o:l>d?o+s-t.collisionWidth:o:l>0?e.left+=l:d>0?e.left-=d:e.left=r(e.left-a,e.left)},top:function(e,t){var n,i=t.within,o=i.isWindow?i.scrollTop:i.offset.top,s=t.within.height,a=e.top-t.collisionPosition.marginTop,l=o-a,d=a+t.collisionHeight-s-o;t.collisionHeight>s?l>0&&d<=0?(n=e.top+l+t.collisionHeight-s-o,e.top+=l-n):e.top=d>0&&l<=0?o:l>d?o+s-t.collisionHeight:o:l>0?e.top+=l:d>0?e.top-=d:e.top=r(e.top-a,e.top)}},flip:{left:function(e,t){var n,i,r=t.within,s=r.offset.left+r.scrollLeft,a=r.width,l=r.isWindow?r.scrollLeft:r.offset.left,d=e.left-t.collisionPosition.marginLeft,c=d-l,u=d+t.collisionWidth-a-l,h="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,f="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,p=-2*t.offset[0];c<0?((n=e.left+h+f+p+t.collisionWidth-a-s)<0||n<o(c))&&(e.left+=h+f+p):u>0&&((i=e.left-t.collisionPosition.marginLeft+h+f+p-l)>0||o(i)<u)&&(e.left+=h+f+p)},top:function(e,t){var n,i,r=t.within,s=r.offset.top+r.scrollTop,a=r.height,l=r.isWindow?r.scrollTop:r.offset.top,d=e.top-t.collisionPosition.marginTop,c=d-l,u=d+t.collisionHeight-a-l,h="top"===t.my[1]?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,p=-2*t.offset[1];c<0?((i=e.top+h+f+p+t.collisionHeight-a-s)<0||i<o(c))&&(e.top+=h+f+p):u>0&&((n=e.top-t.collisionPosition.marginTop+h+f+p-l)>0||o(n)<u)&&(e.top+=h+f+p)}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}}}();e.ui.position,e.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},e.fn.scrollParent=function(t){var n=this.css("position"),i="absolute"===n,r=t?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var t=e(this);return(!i||"static"!==t.css("position"))&&r.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==n&&o.length?o:e(this[0].ownerDocument||document)},e.fn.extend({uniqueId:function(){var e=0;return function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++e)})}}(),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&e(this).removeAttr("id")})}})}(jQuery),function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof module&&module.exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){return function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree.ui-deps"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree.ui-deps"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";function t(t,n){t||(n=n?": "+n:"",e.error("Fancytree assertion failed"+n))}function n(e,t){var n,i,r=window.console?window.console[e]:null;if(r)try{r.apply(window.console,t)}catch(e){for(i="",n=0;n<t.length;n++)i+=t[n];r(i)}}function i(e,t,n,i,r){return function(){var n=t[e],o=i[e],s=t.ext[r],a=function(){return n.apply(t,arguments)},l=function(e){return n.apply(t,e)};return function(){var e=t._local,n=t._super,i=t._superApply;try{return t._local=s,t._super=a,t._superApply=l,o.apply(t,arguments)}finally{t._local=e,t._super=n,t._superApply=i}}}()}function r(t,n,r,o){for(var s in r)"function"==typeof r[s]?"function"==typeof t[s]?t[s]=i(s,t,0,r,o):"_"===s.charAt(0)?t.ext[o][s]=i(s,t,0,r,o):e.error("Could not override tree."+s+". Use prefix '_' to create tree."+o+"._"+s):"options"!==s&&(t.ext[o][s]=r[s])}function o(t,n){return void 0===t?e.Deferred(function(){this.resolve()}).promise():e.Deferred(function(){this.resolveWith(t,n)}).promise()}function s(t,n){return void 0===t?e.Deferred(function(){this.reject()}).promise():e.Deferred(function(){this.rejectWith(t,n)}).promise()}function a(e,t){return function(){e.resolveWith(t)}}function l(t){var n=e.extend({},t.data()),i=n.json;return delete n.fancytree,delete n.uiFancytree,i&&(delete n.json,n=e.extend(n,i)),n}function d(e){return(""+e).replace(m,function(e){return b[e]})}function c(e){return e=e.toLowerCase(),function(t){return t.title.toLowerCase().indexOf(e)>=0}}function u(n,i){var r,o,s,a;for(this.parent=n,this.tree=n.tree,this.ul=null,this.li=null,this.statusNodeType=null,this._isLoading=!1,this._error=null,this.data={},r=0,o=E.length;r<o;r++)this[s=E[r]]=i[s];null==this.unselectableIgnore&&null==this.unselectableStatus||(this.unselectable=!0),i.hideCheckbox&&e.error("'hideCheckbox' node option was removed in v2.23.0: use 'checkbox: false'"),i.data&&e.extend(this.data,i.data);for(s in i)T[s]||e.isFunction(i[s])||O[s]||(this.data[s]=i[s]);null==this.key?this.tree.options.defaultKey?(this.key=this.tree.options.defaultKey(this),t(this.key,"defaultKey() must return a unique key")):this.key="_"+g._nextNodeKey++:this.key=""+this.key,i.active&&(t(null===this.tree.activeNode,"only one active node allowed"),this.tree.activeNode=this),i.selected&&(this.tree.lastSelectedNode=this),(a=i.children)?a.length?this._setChildren(a):this.children=this.lazy?[]:null:this.children=null,this.tree._callHook("treeRegisterNode",this.tree,!0,this)}function h(t){this.widget=t,this.$div=t.element,this.options=t.options,this.options&&(e.isFunction(this.options.lazyload)&&!e.isFunction(this.options.lazyLoad)&&(this.options.lazyLoad=function(){return g.warn("The 'lazyload' event is deprecated since 2014-02-25. Use 'lazyLoad' (with uppercase L) instead."),t.options.lazyload.apply(this,arguments)}),e.isFunction(this.options.loaderror)&&e.error("The 'loaderror' event was renamed since 2014-07-03. Use 'loadError' (with uppercase E) instead."),void 0!==this.options.fx&&g.warn("The 'fx' option was replaced by 'toggleEffect' since 2014-11-30."),void 0!==this.options.removeNode&&e.error("The 'removeNode' event was replaced by 'modifyChild' since 2.20 (2016-09-10).")),this.ext={},this.types={},this.columns={},this.data=l(this.$div),this._id=e.ui.fancytree._nextId++,this._ns=".fancytree-"+this._id,this.activeNode=null,this.focusNode=null,this._hasFocus=null,this._tempCache={},this._lastMousedownNode=null,this._enableUpdate=!0,this.lastSelectedNode=null,this.systemFocusElement=null,this.lastQuicksearchTerm="",this.lastQuicksearchTime=0,this.statusClassPropName="span",this.ariaPropName="li",this.nodeContainerAttrName="li",this.$div.find(">ul.fancytree-container").remove();var n,i={tree:this};this.rootNode=new u(i,{title:"root",key:"root_"+this._id,children:null,expanded:!0}),this.rootNode.parent=null,n=e("<ul>",{class:"ui-fancytree fancytree-container fancytree-plain"}).appendTo(this.$div),this.$container=n,this.rootNode.ul=n[0],null==this.options.debugLevel&&(this.options.debugLevel=g.debugLevel)}{if(!e.ui||!e.ui.fancytree){var f,p,g=null,y=new RegExp(/\.|\//),v=/[&<>"'\/]/g,m=/[<>"'\/]/g,x="$recursive_request",b={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},C={16:!0,17:!0,18:!0},_={8:"backspace",9:"tab",10:"return",13:"return",19:"pause",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"del",59:";",61:"=",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scroll",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},k={0:"",1:"left",2:"middle",3:"right"},N="active expanded focus folder lazy radiogroup selected unselectable unselectableIgnore".split(" "),w={},S="columns types".split(" "),E="checkbox expanded extraClasses folder icon iconTooltip key lazy partsel radiogroup refKey selected statusNodeType title tooltip type unselectable unselectableIgnore unselectableStatus".split(" "),T={},A={},O={active:!0,children:!0,data:!0,focus:!0};for(f=0;f<N.length;f++)w[N[f]]=!0;for(f=0;f<E.length;f++)p=E[f],T[p]=!0,p!==p.toLowerCase()&&(A[p.toLowerCase()]=p);return t(e.ui,"Fancytree requires jQuery UI (http://jqueryui.com)"),Date.now||(Date.now=function(){return(new Date).getTime()}),u.prototype={_findDirectChild:function(e){var t,n,i=this.children;if(i)if("string"==typeof e){for(t=0,n=i.length;t<n;t++)if(i[t].key===e)return i[t]}else{if("number"==typeof e)return this.children[e];if(e.parent===this)return e}return null},_setChildren:function(e){t(e&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var n=0,i=e.length;n<i;n++)this.children.push(new u(this,e[n]))},addChildren:function(n,i){var r,o,s,a=this.getFirstChild(),l=this.getLastChild(),d=null,c=[];for(e.isPlainObject(n)&&(n=[n]),this.children||(this.children=[]),r=0,o=n.length;r<o;r++)c.push(new u(this,n[r]));if(d=c[0],null==i?this.children=this.children.concat(c):(i=this._findDirectChild(i),t((s=e.inArray(i,this.children))>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[s,0].concat(c))),a&&!i){for(r=0,o=c.length;r<o;r++)c[r].render();a!==this.getFirstChild()&&a.renderStatus(),l!==this.getLastChild()&&l.renderStatus()}else(!this.parent||this.parent.ul||this.tr)&&this.render();return 3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),this.triggerModifyChild("add",1===c.length?c[0]:null),d},addClass:function(e){return this.toggleClass(e,!0)},addNode:function(e,n){switch(void 0!==n&&"over"!==n||(n="child"),n){case"after":return this.getParent().addChildren(e,this.getNextSibling());case"before":return this.getParent().addChildren(e,this);case"firstChild":var i=this.children?this.children[0]:null;return this.addChildren(e,i);case"child":case"over":return this.addChildren(e)}t(!1,"Invalid mode: "+n)},addPagingNode:function(t,n){var i,r;n=n||"child";{if(!1!==t)return t=e.extend({title:this.tree.options.strings.moreData,statusNodeType:"paging",icon:!1},t),this.partload=!0,this.addNode(t,n);for(i=this.children.length-1;i>=0;i--)"paging"===(r=this.children[i]).statusNodeType&&this.removeChild(r);this.partload=!1}},appendSibling:function(e){return this.addNode(e,"after")},applyPatch:function(t){if(null===t)return this.remove(),o(this);var n,i,r={children:!0,expanded:!0,parent:!0};for(n in t)i=t[n],r[n]||e.isFunction(i)||(T[n]?this[n]=i:this.data[n]=i);return t.hasOwnProperty("children")&&(this.removeChildren(),t.children&&this._setChildren(t.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),t.hasOwnProperty("expanded")?this.setExpanded(t.expanded):o(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(e,t,n){return e.addNode(this.toDict(!0,n),t)},countChildren:function(e){var t,n,i,r=this.children;if(!r)return 0;if(i=r.length,!1!==e)for(t=0,n=i;t<n;t++)i+=r[t].countChildren();return i},debug:function(e){this.tree.options.debugLevel>=4&&(Array.prototype.unshift.call(arguments,this.toString()),n("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},discardMarkup:function(e){var t=e?"nodeRemoveMarkup":"nodeRemoveChildMarkup";this.tree._callHook(t,this)},error:function(e){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),n("error",arguments))},findAll:function(t){t=e.isFunction(t)?t:c(t);var n=[];return this.visit(function(e){t(e)&&n.push(e)}),n},findFirst:function(t){t=e.isFunction(t)?t:c(t);var n=null;return this.visit(function(e){if(t(e))return n=e,!1}),n},_changeSelectStatusAttrs:function(e){var n=!1,i=this.tree.options,r=g.evalOption("unselectable",this,this,i,!1),o=g.evalOption("unselectableStatus",this,this,i,void 0);switch(r&&null!=o&&(e=o),e){case!1:n=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:n=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case void 0:n=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:t(!1,"invalid state: "+e)}return n&&this.renderStatus(),n},fixSelection3AfterClick:function(e){var t=this.isSelected();this.visit(function(e){e._changeSelectStatusAttrs(t)}),this.fixSelection3FromEndNodes(e)},fixSelection3FromEndNodes:function(e){function n(e){var t,r,o,s,a,l,d,c,u=e.children;if(u&&u.length){for(l=!0,d=!1,t=0,r=u.length;t<r;t++)s=n(o=u[t]),g.evalOption("unselectableIgnore",o,o,i,!1)||(!1!==s&&(d=!0),!0!==s&&(l=!1));a=!!l||!!d&&void 0}else a=null==(c=g.evalOption("unselectableStatus",e,e,i,void 0))?!!e.selected:!!c;return e._changeSelectStatusAttrs(a),a}var i=this.tree.options;t(3===i.selectMode,"expected selectMode 3"),n(this),this.visitParents(function(e){var t,n,r,o,s,a=e.children,l=!0,d=!1;for(t=0,n=a.length;t<n;t++)r=a[t],g.evalOption("unselectableIgnore",r,r,i,!1)||(((o=null==(s=g.evalOption("unselectableStatus",r,r,i,void 0))?!!r.selected:!!s)||r.partsel)&&(d=!0),o||(l=!1));o=!!l||!!d&&void 0,e._changeSelectStatusAttrs(o)})},fromDict:function(t){for(var n in t)T[n]?this[n]=t[n]:"data"===n?e.extend(this.data,t.data):e.isFunction(t[n])||O[n]||(this.data[n]=t[n]);t.children&&(this.removeChildren(),this.addChildren(t.children)),this.renderTitle()},getChildren:function(){if(void 0!==this.hasChildren())return this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return e.inArray(this,this.parent.children)},getIndexHier:function(t,n){t=t||".";var i,r=[];return e.each(this.getParentList(!1,!0),function(e,t){i=""+(t.getIndex()+1),n&&(i=("0000000"+i).substr(-n)),r.push(i)}),r.join(t)},getKeyPath:function(e){var t=[],n=this.tree.options.keyPathSeparator;return this.visitParents(function(e){e.parent&&t.unshift(e.key)},!e),n+t.join(n)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var e=0,t=this.parent;t;)e++,t=t.parent;return e},getNextSibling:function(){if(this.parent){var e,t,n=this.parent.children;for(e=0,t=n.length-1;e<t;e++)if(n[e]===this)return n[e+1]}return null},getParent:function(){return this.parent},getParentList:function(e,t){for(var n=[],i=t?this:this.parent;i;)(e||i.parent)&&n.unshift(i),i=i.parent;return n},getPrevSibling:function(){if(this.parent){var e,t,n=this.parent.children;for(e=1,t=n.length;e<t;e++)if(n[e]===this)return n[e-1]}return null},getSelectedNodes:function(e){var t=[];return this.visit(function(n){if(n.selected&&(t.push(n),!0===e))return"skip"}),t},hasChildren:function(){if(this.lazy){if(null==this.children)return;if(0===this.children.length)return!1;if(1===this.children.length&&this.children[0].isStatusNode())return;return!0}return!(!this.children||!this.children.length)},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(e){this.tree.options.debugLevel>=3&&(Array.prototype.unshift.call(arguments,this.toString()),n("info",arguments))},isActive:function(){return this.tree.activeNode===this},isBelowOf:function(e){return this.getIndexHier(".",5)>e.getIndexHier(".",5)},isChildOf:function(e){return this.parent&&this.parent===e},isDescendantOf:function(t){if(!t||t.tree!==this.tree)return!1;for(var n=this.parent;n;){if(n===t)return!0;n===n.parent&&e.error("Recursive parent link: "+n),n=n.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var e=this.parent;return!e||e.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var e=this.parent;return!e||e.children[e.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||void 0!==this.hasChildren()},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isPartsel:function(){return!this.selected&&!!this.partsel},isPartload:function(){return!!this.partload},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isPagingNode:function(){return"paging"===this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return void 0===this.hasChildren()},isVisible:function(){var e,t,n=this.getParentList(!1,!1);for(e=0,t=n.length;e<t;e++)if(!n[e].expanded)return!1;return!0},lazyLoad:function(e){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(e)},load:function(e){var n,i,r=this,s=this.isExpanded();return t(this.isLazy(),"load() requires a lazy node"),e||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),!1===(i=this.tree._triggerNodeEvent("lazyLoad",this))?o(this):(t("boolean"!=typeof i,"lazyLoad event must return source in data.result"),n=this.tree._callHook("nodeLoadChildren",this,i),s?(this.expanded=!0,n.always(function(){r.render()})):n.always(function(){r.renderStatus()}),n)):o(this)},makeVisible:function(t){var n,i=this,r=[],o=new e.Deferred,s=this.getParentList(!1,!1),a=s.length,l=!(t&&!0===t.noAnimation),d=!(t&&!1===t.scrollIntoView);for(n=a-1;n>=0;n--)r.push(s[n].setExpanded(!0,t));return e.when.apply(e,r).done(function(){d?i.scrollIntoView(l).done(function(){o.resolve()}):o.resolve()}),o.promise()},moveTo:function(n,i,r){void 0===i||"over"===i?i="child":"firstChild"===i&&(n.children&&n.children.length?(i="before",n=n.children[0]):i="child");var o,s=this.parent,a="child"===i?n:n.parent;if(this!==n){if(this.parent?a.isDescendantOf(this)&&e.error("Cannot move a node to its own descendant"):e.error("Cannot move system root"),a!==s&&s.triggerModifyChild("remove",this),1===this.parent.children.length){if(this.parent===a)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else t((o=e.inArray(this,this.parent.children))>=0,"invalid source parent"),this.parent.children.splice(o,1);if(this.parent=a,a.hasChildren())switch(i){case"child":a.children.push(this);break;case"before":t((o=e.inArray(n,a.children))>=0,"invalid target parent"),a.children.splice(o,0,this);break;case"after":t((o=e.inArray(n,a.children))>=0,"invalid target parent"),a.children.splice(o+1,0,this);break;default:e.error("Invalid mode "+i)}else a.children=[this];r&&n.visit(r,!0),a===s?a.triggerModifyChild("move",this):a.triggerModifyChild("add",this),this.tree!==n.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(e){e.tree=n.tree},!0)),s.isDescendantOf(a)||s.render(),a.isDescendantOf(s)||a===s||a.render()}},navigate:function(t,n){function i(i){if(i){try{i.makeVisible({scrollIntoView:!1})}catch(e){}return e(i.span).is(":visible")?!1===n?i.setFocus():i.setActive():(i.debug("Navigate: skipping hidden node"),void i.navigate(t,n))}}var r,s,a,l=e.ui.keyCode,d=null;switch(t){case l.BACKSPACE:this.parent&&this.parent.parent&&(a=i(this.parent));break;case l.HOME:this.tree.visit(function(t){if(e(t.span).is(":visible"))return a=i(t),!1});break;case l.END:this.tree.visit(function(t){e(t.span).is(":visible")&&(a=t)}),a&&(a=i(a));break;case l.LEFT:this.expanded?(this.setExpanded(!1),a=i(this)):this.parent&&this.parent.parent&&(a=i(this.parent));break;case l.RIGHT:this.expanded||!this.children&&!this.lazy?this.children&&this.children.length&&(a=i(this.children[0])):(this.setExpanded(),a=i(this));break;case l.UP:for(d=this.getPrevSibling();d&&!e(d.span).is(":visible");)d=d.getPrevSibling();for(;d&&d.expanded&&d.children&&d.children.length;)d=d.children[d.children.length-1];!d&&this.parent&&this.parent.parent&&(d=this.parent),a=i(d);break;case l.DOWN:if(this.expanded&&this.children&&this.children.length)d=this.children[0];else for(r=(s=this.getParentList(!1,!0)).length-1;r>=0;r--){for(d=s[r].getNextSibling();d&&!e(d.span).is(":visible");)d=d.getNextSibling();if(d)break}a=i(d);break;default:!1}return a||o()},remove:function(){return this.parent.removeChild(this)},removeChild:function(e){return this.tree._callHook("nodeRemoveChild",this,e)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},removeClass:function(e){return this.toggleClass(e,!1)},render:function(e,t){return this.tree._callHook("nodeRender",this,e,t)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},replaceWith:function(n){var i,r=this.parent,o=e.inArray(this,r.children),s=this;return t(this.isPagingNode(),"replaceWith() currently requires a paging status node"),(i=this.tree._callHook("nodeLoadChildren",this,n)).done(function(e){var t=s.children;for(f=0;f<t.length;f++)t[f].parent=r;r.children.splice.apply(r.children,[o+1,0].concat(t)),s.children=null,s.remove(),r.render()}).fail(function(){s.setExpanded()}),i},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=void 0,this.renderStatus()},scheduleAction:function(t,n){this.tree.timer&&clearTimeout(this.tree.timer),this.tree.timer=null;var i=this;switch(t){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){i.tree.debug("setTimeout: trigger expand"),i.setExpanded(!0)},n);break;case"activate":this.tree.timer=setTimeout(function(){i.tree.debug("setTimeout: trigger activate"),i.setActive(!0)},n);break;default:e.error("Invalid mode "+t)}},scrollIntoView:function(n,i){void 0!==i&&function(e){return!(!e.tree||void 0===e.statusNodeType)}(i)&&(this.warn("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead."),i={topNode:i});var r,s,a,l=e.extend({effects:!0===n?{duration:200,queue:!1}:n,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent||this.tree.$container,topNode:null},i),d=new e.Deferred,c=this,u=e(this.span).height(),h=e(l.scrollParent),f=l.scrollOfs.top||0,p=l.scrollOfs.bottom||0,g=h.height(),y=h.scrollTop(),v=h,m=h[0]===window,x=l.topNode||null,b=null;return e(this.span).is(":visible")?(m?(s=e(this.span).offset().top,r=x&&x.span?e(x.span).offset().top:0,v=e("html,body")):(t(h[0]!==document&&h[0]!==document.body,"scrollParent should be a simple element or `window`, not document or body."),a=h.offset().top,s=e(this.span).offset().top-a+y,r=x?e(x.span).offset().top-a+y:0,g-=Math.max(0,h.innerHeight()-h[0].clientHeight)),s<y+f?b=s-f:s+u>y+g-p&&(b=s+u-g+p,x&&(t(x.isRootNode()||e(x.span).is(":visible"),"topNode must be visible"),r<b&&(b=r-f))),null!==b?l.effects?(l.effects.complete=function(){d.resolveWith(c)},v.stop(!0).animate({scrollTop:b},l.effects)):(v[0].scrollTop=b,d.resolveWith(this)):d.resolveWith(this),d.promise()):(this.warn("scrollIntoView(): node is invisible."),o())},setActive:function(e,t){return this.tree._callHook("nodeSetActive",this,e,t)},setExpanded:function(e,t){return this.tree._callHook("nodeSetExpanded",this,e,t)},setFocus:function(e){return this.tree._callHook("nodeSetFocus",this,e)},setSelected:function(e,t){return this.tree._callHook("nodeSetSelected",this,e,t)},setStatus:function(e,t,n){return this.tree._callHook("nodeSetStatus",this,e,t,n)},setTitle:function(e){this.title=e,this.renderTitle(),this.triggerModify("rename")},sortChildren:function(e,t){var n,i,r=this.children;if(r){if(e=e||function(e,t){var n=e.title.toLowerCase(),i=t.title.toLowerCase();return n===i?0:n>i?1:-1},r.sort(e),t)for(n=0,i=r.length;n<i;n++)r[n].children&&r[n].sortChildren(e,"$norender$");"$norender$"!==t&&this.render(),this.triggerModifyChild("sort")}},toDict:function(t,n){var i,r,o,s={},a=this;if(e.each(E,function(e,t){(a[t]||!1===a[t])&&(s[t]=a[t])}),e.isEmptyObject(this.data)||(s.data=e.extend({},this.data),e.isEmptyObject(s.data)&&delete s.data),n&&n(s,a),t&&this.hasChildren())for(s.children=[],i=0,r=this.children.length;i<r;i++)(o=this.children[i]).isStatusNode()||s.children.push(o.toDict(!0,n));return s},toggleClass:function(t,n){var i,r,o=t.match(/\S+/g)||[],s=0,a=!1,l=this[this.tree.statusClassPropName],d=" "+(this.extraClasses||"")+" ";for(l&&e(l).toggleClass(t,n);i=o[s++];)if(r=d.indexOf(" "+i+" ")>=0,n=void 0===n?!r:!!n)r||(d+=i+" ",a=!0);else for(;d.indexOf(" "+i+" ")>-1;)d=d.replace(" "+i+" "," ");return this.extraClasses=e.trim(d),a},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return"FancytreeNode@"+this.key+"[title='"+this.title+"']"},triggerModifyChild:function(t,n,i){var r,o=this.tree.options.modifyChild;o&&(n&&n.parent!==this&&e.error("childNode "+n+" is not a child of "+this),r={node:this,tree:this.tree,operation:t,childNode:n||null},i&&e.extend(r,i),o({type:"modifyChild"},r))},triggerModify:function(e,t){this.parent.triggerModifyChild(e,this,t)},visit:function(e,t){var n,i,r=!0,o=this.children;if(!0===t&&(!1===(r=e(this))||"skip"===r))return r;if(o)for(n=0,i=o.length;n<i&&!1!==(r=o[n].visit(e,!0));n++);return r},visitAndLoad:function(t,n,i){var r,s,a,l=this;return!t||!0!==n||!1!==(s=t(l))&&"skip"!==s?l.children||l.lazy?(r=new e.Deferred,a=[],l.load().done(function(){for(var n=0,i=l.children.length;n<i;n++){if(!1===(s=l.children[n].visitAndLoad(t,!0,!0))){r.reject();break}"skip"!==s&&a.push(s)}e.when.apply(this,a).then(function(){r.resolve()})}),r.promise()):o():i?s:o()},visitParents:function(e,t){if(t&&!1===e(this))return!1;for(var n=this.parent;n;){if(!1===e(n))return!1;n=n.parent}return!0},visitSiblings:function(e,t){var n,i,r,o=this.parent.children;for(n=0,i=o.length;n<i;n++)if(r=o[n],(t||r!==this)&&!1===e(r))return!1;return!0},warn:function(e){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),n("warn",arguments))}},h.prototype={_makeHookContext:function(t,n,i){var r,o;return void 0!==t.node?(n&&t.originalEvent!==n&&e.error("invalid args"),r=t):t.tree?r={node:t,tree:o=t.tree,widget:o.widget,options:o.widget.options,originalEvent:n,typeInfo:o.types[t.type]||{}}:t.widget?r={node:null,tree:t,widget:t.widget,options:t.widget.options,originalEvent:n}:e.error("invalid args"),i&&e.extend(r,i),r},_callHook:function(t,n,i){var r=this._makeHookContext(n),o=this[t],s=Array.prototype.slice.call(arguments,2);return e.isFunction(o)||e.error("_callHook('"+t+"') is not a function"),s.unshift(r),o.apply(this,s)},_setExpiringValue:function(e,t,n){this._tempCache[e]={value:t,expire:Date.now()+(+n||50)}},_getExpiringValue:function(e){var t=this._tempCache[e];return t&&t.expire>Date.now()?t.value:(delete this._tempCache[e],null)},_requireExtension:function(n,i,r,o){r=!!r;var s=this._local.name,a=this.options.extensions,l=e.inArray(n,a)<e.inArray(s,a),d=i&&null==this.ext[n],c=!d&&null!=r&&r!==l;return t(s&&s!==n,"invalid or same name"),!d&&!c||(o||(d||i?(o="'"+s+"' extension requires '"+n+"'",c&&(o+=" to be registered "+(r?"before":"after")+" itself")):o="If used together, `"+n+"` must be registered "+(r?"before":"after")+" `"+s+"`"),e.error(o),!1)},activateKey:function(e){var t=this.getNodeByKey(e);return t?t.setActive():this.activeNode&&this.activeNode.setActive(!1),t},addPagingNode:function(e,t){return this.rootNode.addPagingNode(e,t)},applyPatch:function(n){var i,r,o,s,l,d,c=n.length,u=[];for(r=0;r<c;r++)t(2===(o=n[r]).length,"patchList must be an array of length-2-arrays"),s=o[0],l=o[1],(d=null===s?this.rootNode:this.getNodeByKey(s))?(i=new e.Deferred,u.push(i),d.applyPatch(l).always(a(i,d))):this.warn("could not find node with key '"+s+"'");return e.when.apply(e,u).promise()},clear:function(e){this._callHook("treeClear",this)},count:function(){return this.rootNode.countChildren()},debug:function(e){this.options.debugLevel>=4&&(Array.prototype.unshift.call(arguments,this.toString()),n("log",arguments))},enableUpdate:function(e){return e=!1!==e,!!this._enableUpdate==!!e?e:(this._enableUpdate=e,e?(this.debug("enableUpdate(true): redraw "),this.render()):this.debug("enableUpdate(false)..."),!e)},findAll:function(e){return this.rootNode.findAll(e)},findFirst:function(e){return this.rootNode.findFirst(e)},findNextNode:function(t,n,i){t="string"==typeof t?function(e){var t=new RegExp("^"+e,"i");return function(e){return t.test(e.title)}}(t):t;var r=null,o=(n=n||this.getFirstChild()).parent.children,s=null,a=function(e,t,n){var i,r,o=e.children,s=o.length,l=o[t];if(l&&!1===n(l))return!1;if(l&&l.children&&l.expanded&&!1===a(l,0,n))return!1;for(i=t+1;i<s;i++)if(!1===a(e,i,n))return!1;return(r=e.parent)?a(r,r.children.indexOf(e)+1,n):a(e,0,n)};return a(n.parent,o.indexOf(n),function(i){if(i===r)return!1;r=r||i;{if(e(i.span).is(":visible"))return(!t(i)||(s=i)===n)&&void 0;i.debug("quicksearch: skipping hidden node")}}),s},generateFormElements:function(t,n,i){function r(t){d.append(e("<input>",{type:"checkbox",name:s,value:t.key,checked:!0}))}i=i||{};var o,s="string"==typeof t?t:"ft_"+this._id+"[]",a="string"==typeof n?n:"ft_"+this._id+"_active",l="fancytree_result_"+this._id,d=e("#"+l),c=3===this.options.selectMode&&!1!==i.stopOnParents;d.length?d.empty():d=e("<div>",{id:l}).hide().insertAfter(this.$container),!1!==n&&this.activeNode&&d.append(e("<input>",{type:"radio",name:a,value:this.activeNode.key,checked:!0})),i.filter?this.visit(function(e){var t=i.filter(e);if("skip"===t)return t;!1!==t&&r(e)}):!1!==t&&(o=this.getSelectedNodes(c),e.each(o,function(e,t){r(t)}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(e,t){var n,i;return!t&&(n=document.getElementById(this.options.idPrefix+e))?n.ftnode?n.ftnode:null:(t=t||this.rootNode,i=null,t.visit(function(t){if(t.key===e)return i=t,!1},!0),i)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(e){return this.rootNode.getSelectedNodes(e)},hasFocus:function(){return!!this._hasFocus},info:function(e){this.options.debugLevel>=3&&(Array.prototype.unshift.call(arguments,this.toString()),n("info",arguments))},loadKeyPath:function(t,n){var i,r,o,s=this,a=new e.Deferred,l=this.getRootNode(),d=this.options.keyPathSeparator,c=[],u=e.extend({},n);for("function"==typeof n?i=n:n&&n.callback&&(i=n.callback),u.callback=function(e,t,n){i&&i.call(e,t,n),a.notifyWith(e,[{node:t,status:n}])},null==u.matchKey&&(u.matchKey=function(e,t){return e.key===t}),e.isArray(t)||(t=[t]),r=0;r<t.length;r++)(o=t[r]).charAt(0)===d&&(o=o.substr(1)),c.push(o.split(d));return setTimeout(function(){s._loadKeyPathImpl(a,u,l,c).done(function(){a.resolve()})},0),a.promise()},_loadKeyPathImpl:function(t,n,i,r){function o(e,t){var i,r,o=e.children;if(o)for(i=0,r=o.length;i<r;i++)if(n.matchKey(o[i],t))return o[i];return null}function s(e,t,i){n.callback(y,t,"loading"),t.load().done(function(){y._loadKeyPathImpl.call(y,e,n,t,i).always(a(e,y))}).fail(function(i){y.warn("loadKeyPath: error loading lazy "+t),n.callback(y,u,"error"),e.rejectWith(y)})}var l,d,c,u,h,f,p,g,y=this;for(h={},d=0;d<r.length;d++)for(p=r[d],f=i;p.length;){if(c=p.shift(),!(u=o(f,c))){this.warn("loadKeyPath: key not found: "+c+" (parent: "+f+")"),n.callback(this,c,"error");break}if(0===p.length){n.callback(this,u,"ok");break}if(u.lazy&&void 0===u.hasChildren()){n.callback(this,u,"loaded"),h[c=u.key]?h[c].pathSegList.push(p):h[c]={parent:u,pathSegList:[p]};break}n.callback(this,u,"loaded"),f=u}l=[];for(var v in h){var m=h[v];g=new e.Deferred,l.push(g),s(g,m.parent,m.pathSegList)}return e.when.apply(e,l).promise()},reactivate:function(e){var t,n=this.activeNode;return n?(this.activeNode=null,t=n.setActive(!0,{noFocus:!0}),e&&n.setFocus(),t):o()},reload:function(e){return this._callHook("treeClear",this),this._callHook("treeLoad",this,e)},render:function(e,t){return this.rootNode.render(e,t)},selectAll:function(e){this.visit(function(t){t.setSelected(e)})},setFocus:function(e){return this._callHook("treeSetFocus",this,e)},toDict:function(e,t){var n=this.rootNode.toDict(!0,t);return e?n:n.children},toString:function(){return"Fancytree@"+this._id},_triggerNodeEvent:function(e,t,n,i){var r=this._makeHookContext(t,n,i),o=this.widget._trigger(e,n,r);return!1!==o&&void 0!==r.result?r.result:o},_triggerTreeEvent:function(e,t,n){var i=this._makeHookContext(this,t,n),r=this.widget._trigger(e,t,i);return!1!==r&&void 0!==i.result?i.result:r},visit:function(e){return this.rootNode.visit(e,!1)},visitRows:function(e,t){if(t&&t.reverse)return delete t.reverse,this._visitRowsUp(e,t);var n,i,r,o=0,s=!1===t.includeSelf,a=!!t.includeHidden,l=t.start||this.rootNode.children[0];for(i=l.parent;i;){for(n=(r=i.children).indexOf(l)+o;n<r.length;n++){if(l=r[n],!s&&!1===e(l))return!1;if(s=!1,l.children&&l.children.length&&(a||l.expanded)&&!1===l.visit(function(t){return!1!==e(t)&&(a||!t.children||t.expanded?void 0:"skip")},!1))return!1}l=i,i=i.parent,o=1}return!0},_visitRowsUp:function(t,n){for(var i,r,o=!!n.includeHidden,s=n.start||this.rootNode.children[0];;){if(r=s.parent,(i=r.children)[0]===s)s=r,i=r.children;else for(s=i[i.indexOf(s)-1];(o||s.expanded)&&s.children&&s.children.length;)r=s,s=(i=s.children)[i.length-1];if((o||e(s.span).is(":visible"))&&!1===t(s))return!1}},warn:function(e){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),n("warn",arguments))}},e.extend(h.prototype,{nodeClick:function(e){var t,n,i=e.targetType,r=e.node;if("expander"===i){if(r.isLoading())return void r.debug("Got 2nd click while loading: ignored");this._callHook("nodeToggleExpanded",e)}else if("checkbox"===i)this._callHook("nodeToggleSelected",e),e.options.focusOnSelect&&this._callHook("nodeSetFocus",e,!0);else{if(n=!1,t=!0,r.folder)switch(e.options.clickFolderMode){case 2:n=!0,t=!1;break;case 3:t=!0,n=!0}t&&(this.nodeSetFocus(e),this._callHook("nodeSetActive",e,!0)),n&&this._callHook("nodeToggleExpanded",e)}},nodeCollapseSiblings:function(e,t){var n,i,r,o=e.node;if(o.parent)for(i=0,r=(n=o.parent.children).length;i<r;i++)n[i]!==o&&n[i].expanded&&this._callHook("nodeSetExpanded",n[i],!1,t)},nodeDblclick:function(e){"title"===e.targetType&&4===e.options.clickFolderMode&&this._callHook("nodeToggleExpanded",e),"title"===e.targetType&&e.originalEvent.preventDefault()},nodeKeydown:function(t){var n,i,r,o=t.originalEvent,s=t.node,a=t.tree,l=t.options,d=o.which,c=String.fromCharCode(d),u=!(o.altKey||o.ctrlKey||o.metaKey||o.shiftKey),h=e(o.target),f=!0,p=!(o.ctrlKey||!l.autoActivate);if(s||(r=this.getActiveNode()||this.getFirstChild())&&(r.setFocus(),(s=t.node=this.focusNode).debug("Keydown force focus on active node")),l.quicksearch&&u&&/\w/.test(c)&&!_[d]&&!h.is(":input:enabled"))return(i=Date.now())-a.lastQuicksearchTime>500&&(a.lastQuicksearchTerm=""),a.lastQuicksearchTime=i,a.lastQuicksearchTerm+=c,(n=a.findNextNode(a.lastQuicksearchTerm,a.getActiveNode()))&&n.setActive(),void o.preventDefault();switch(g.eventToString(o)){case"+":case"=":a.nodeSetExpanded(t,!0);break;case"-":a.nodeSetExpanded(t,!1);break;case"space":s.isPagingNode()?a._triggerNodeEvent("clickPaging",t,o):g.evalOption("checkbox",s,s,l,!1)?a.nodeToggleSelected(t):a.nodeSetActive(t,!0);break;case"return":a.nodeSetActive(t,!0);break;case"home":case"end":case"backspace":case"left":case"right":case"up":case"down":s.navigate(o.which,p);break;default:f=!1}f&&o.preventDefault()},nodeLoadChildren:function(n,i){var r,o,s,a=n.tree,l=n.node,d=Date.now();if(e.isFunction(i)&&(i=i.call(a,{type:"source"},n),t(!e.isFunction(i),"source callback must not return another function")),i.url&&(l._requestId&&l.warn("Recursive load request #"+d+" while #"+l._requestId+" is pending."),r=e.extend({},n.options.ajax,i),l._requestId=d,r.debugDelay?(o=r.debugDelay,e.isArray(o)&&(o=o[0]+Math.random()*(o[1]-o[0])),l.warn("nodeLoadChildren waiting debugDelay "+Math.round(o)+" ms ..."),r.debugDelay=!1,s=e.Deferred(function(t){setTimeout(function(){e.ajax(r).done(function(){t.resolveWith(this,arguments)}).fail(function(){t.rejectWith(this,arguments)})},o)})):s=e.ajax(r),i=new e.Deferred,s.done(function(t,r,o){var s,c;if("json"!==this.dataType&&"jsonp"!==this.dataType||"string"!=typeof t||e.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),l._requestId&&l._requestId>d)i.rejectWith(this,[x]);else{if(n.options.postProcess){try{c=a._triggerNodeEvent("postProcess",n,n.originalEvent,{response:t,error:null,dataType:this.dataType})}catch(e){c={error:e,message:""+e,details:"postProcess failed"}}if(c.error)return s=e.isPlainObject(c.error)?c.error:{message:c.error},s=a._makeHookContext(l,null,s),void i.rejectWith(this,[s]);t=e.isArray(c)?c:t}else t&&t.hasOwnProperty("d")&&n.options.enableAspx&&(t="string"==typeof t.d?e.parseJSON(t.d):t.d);i.resolveWith(this,[t])}}).fail(function(e,t,n){var r=a._makeHookContext(l,null,{error:e,args:Array.prototype.slice.call(arguments),message:n,details:e.status+": "+n});i.rejectWith(this,[r])})),e.isFunction(i.then)&&e.isFunction(i.catch)&&(s=i,i=new e.Deferred,s.then(function(e){i.resolve(e)},function(e){i.reject(e)})),e.isFunction(i.promise))a.nodeSetStatus(n,"loading"),i.done(function(e){a.nodeSetStatus(n,"ok"),l._requestId=null}).fail(function(e){var t;e!==x?(e.node&&e.error&&e.message?t=e:"[object Object]"===(t=a._makeHookContext(l,null,{error:e,args:Array.prototype.slice.call(arguments),message:e?e.message||e.toString():""})).message&&(t.message=""),l.warn("Load children failed ("+t.message+")",t),!1!==a._triggerNodeEvent("loadError",t,null)&&a.nodeSetStatus(n,"error",t.message,t.details)):l.warn("Ignored response for obsolete load request #"+d+" (expected #"+l._requestId+")")});else if(n.options.postProcess){var c=a._triggerNodeEvent("postProcess",n,n.originalEvent,{response:i,error:null,dataType:typeof i});i=e.isArray(c)?c:i}return e.when(i).done(function(n){var i;e.isPlainObject(n)&&(t(l.isRootNode(),"source may only be an object for root nodes (expecting an array of child objects otherwise)"),t(e.isArray(n.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),i=n,n=n.children,delete i.children,e.each(S,function(e,t){void 0!==i[t]&&(a[t]=i[t],delete i[t])}),e.extend(a.data,i)),t(e.isArray(n),"expected array of children"),l._setChildren(n),a._triggerNodeEvent("loadChildren",l)})},nodeLoadKeyPath:function(e,t){},nodeRemoveChild:function(n,i){var r,o=n.node,s=e.extend({},n,{node:i}),a=o.children;if(1===a.length)return t(i===a[0],"invalid single child"),this.nodeRemoveChildren(n);this.activeNode&&(i===this.activeNode||this.activeNode.isDescendantOf(i))&&this.activeNode.setActive(!1),this.focusNode&&(i===this.focusNode||this.focusNode.isDescendantOf(i))&&(this.focusNode=null),this.nodeRemoveMarkup(s),this.nodeRemoveChildren(s),t((r=e.inArray(i,a))>=0,"invalid child"),o.triggerModifyChild("remove",i),i.visit(function(e){e.parent=null},!0),this._callHook("treeRegisterNode",this,!1,i),a.splice(r,1)},nodeRemoveChildMarkup:function(t){var n=t.node;n.ul&&(n.isRootNode()?e(n.ul).empty():(e(n.ul).remove(),n.ul=null),n.visit(function(e){e.li=e.ul=null}))},nodeRemoveChildren:function(t){var n=t.tree,i=t.node;i.children&&(this.activeNode&&this.activeNode.isDescendantOf(i)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(i)&&(this.focusNode=null),this.nodeRemoveChildMarkup(t),e.extend({},t),i.triggerModifyChild("remove",null),i.visit(function(e){e.parent=null,n._callHook("treeRegisterNode",n,!1,e)}),i.lazy?i.children=[]:i.children=null,i.isRootNode()||(i.expanded=!1),this.nodeRenderStatus(t))},nodeRemoveMarkup:function(t){var n=t.node;n.li&&(e(n.li).remove(),n.li=null),this.nodeRemoveChildMarkup(t)},nodeRender:function(n,i,r,o,s){var a,l,d,c,u,h,f,p=n.node,g=n.tree,y=n.options,v=y.aria,m=!1,x=p.parent,b=!x,C=p.children,_=null;if(!1!==g._enableUpdate&&(b||x.ul)){if(t(b||x.ul,"parent UL must exist"),b||(p.li&&(i||p.li.parentNode!==p.parent.ul)&&(p.li.parentNode===p.parent.ul?_=p.li.nextSibling:this.debug("Unlinking "+p+" (must be child of "+p.parent+")"),this.nodeRemoveMarkup(n)),p.li?this.nodeRenderStatus(n):(m=!0,p.li=document.createElement("li"),p.li.ftnode=p,p.key&&y.generateIds&&(p.li.id=y.idPrefix+p.key),p.span=document.createElement("span"),p.span.className="fancytree-node",v&&!p.tr&&e(p.li).attr("role","treeitem"),p.li.appendChild(p.span),this.nodeRenderTitle(n),y.createNode&&y.createNode.call(g,{type:"createNode"},n)),y.renderNode&&y.renderNode.call(g,{type:"renderNode"},n)),C){if(b||p.expanded||!0===r){for(p.ul||(p.ul=document.createElement("ul"),(!0!==o||s)&&p.expanded||(p.ul.style.display="none"),v&&e(p.ul).attr("role","group"),p.li?p.li.appendChild(p.ul):p.tree.$div.append(p.ul)),c=0,u=C.length;c<u;c++)f=e.extend({},n,{node:C[c]}),this.nodeRender(f,i,r,!1,!0);for(a=p.ul.firstChild;a;)(d=a.ftnode)&&d.parent!==p?(p.debug("_fixParent: remove missing "+d,a),h=a.nextSibling,a.parentNode.removeChild(a),a=h):a=a.nextSibling;for(a=p.ul.firstChild,c=0,u=C.length-1;c<u;c++)(l=C[c])!==(d=a.ftnode)?p.ul.insertBefore(l.li,d.li):a=a.nextSibling}}else p.ul&&(this.warn("remove child markup for "+p),this.nodeRemoveChildMarkup(n));b||m&&x.ul.insertBefore(p.li,_)}},nodeRenderTitle:function(t,n){var i,r,o,s,a,l,c,u=t.node,h=t.tree,f=t.options,p=f.aria,v=u.getLevel(),m=[];void 0!==n&&(u.title=n),u.span&&!1!==h._enableUpdate&&(a=p&&!1!==u.hasChildren()?" role='button'":"",v<f.minExpandLevel?(u.lazy||(u.expanded=!0),v>1&&m.push("<span "+a+" class='fancytree-expander fancytree-expander-fixed'></span>")):m.push("<span "+a+" class='fancytree-expander'></span>"),(i=g.evalOption("checkbox",u,u,f,!1))&&!u.isStatusNode()&&(a=p?" role='checkbox'":"",r="fancytree-checkbox",("radio"===i||u.parent&&u.parent.radiogroup)&&(r+=" fancytree-radio"),m.push("<span "+a+" class='"+r+"'></span>")),void 0!==u.data.iconClass&&(u.icon?e.error("'iconClass' node option is deprecated since v2.14.0: use 'icon' only instead"):(u.warn("'iconClass' node option is deprecated since v2.14.0: use 'icon' instead"),u.icon=u.data.iconClass)),!1!==(o=g.evalOption("icon",u,u,f,!0))&&(a=p?" role='presentation'":"",c=(c=g.evalOption("iconTooltip",u,u,f,null))?" title='"+d(c)+"'":"","string"==typeof o?y.test(o)?(o="/"===o.charAt(0)?o:(f.imagePath||"")+o,m.push("<img src='"+o+"' class='fancytree-icon'"+c+" alt='' />")):m.push("<span "+a+" class='fancytree-custom-icon "+o+"'"+c+"></span>"):o.text?m.push("<span "+a+" class='fancytree-custom-icon "+(o.addClass||"")+"'"+c+">"+g.escapeHtml(o.text)+"</span>"):o.html?m.push("<span "+a+" class='fancytree-custom-icon "+(o.addClass||"")+"'"+c+">"+o.html+"</span>"):m.push("<span "+a+" class='fancytree-icon'"+c+"></span>")),s="",f.renderTitle&&(s=f.renderTitle.call(h,{type:"renderTitle"},t)||""),s||(!0===(l=g.evalOption("tooltip",u,u,f,null))&&(l=u.title),s="<span class='fancytree-title'"+(l=l?" title='"+d(l)+"'":"")+(f.titlesTabbable?" tabindex='0'":"")+">"+(f.escapeTitles?g.escapeHtml(u.title):u.title)+"</span>"),m.push(s),u.span.innerHTML=m.join(""),this.nodeRenderStatus(t),f.enhanceTitle&&(t.$title=e(">span.fancytree-title",u.span),s=f.enhanceTitle.call(h,{type:"enhanceTitle"},t)||""))},nodeRenderStatus:function(t){var n,i=t.node,r=t.tree,o=t.options,s=i.hasChildren(),a=i.isLastSibling(),l=o.aria,d=o._classNames,c=[],u=i[r.statusClassPropName];u&&!1!==r._enableUpdate&&(l&&(n=e(i.tr||i.li)),c.push(d.node),r.activeNode===i&&c.push(d.active),r.focusNode===i&&c.push(d.focused),i.expanded&&c.push(d.expanded),l&&(!1!==s?n.attr("aria-expanded",Boolean(i.expanded)):n.removeAttr("aria-expanded")),i.folder&&c.push(d.folder),!1!==s&&c.push(d.hasChildren),a&&c.push(d.lastsib),i.lazy&&null==i.children&&c.push(d.lazy),i.partload&&c.push(d.partload),i.partsel&&c.push(d.partsel),g.evalOption("unselectable",i,i,o,!1)&&c.push(d.unselectable),i._isLoading&&c.push(d.loading),i._error&&c.push(d.error),i.statusNodeType&&c.push(d.statusNodePrefix+i.statusNodeType),i.selected?(c.push(d.selected),l&&n.attr("aria-selected",!0)):l&&n.attr("aria-selected",!1),i.extraClasses&&c.push(i.extraClasses),!1===s?c.push(d.combinedExpanderPrefix+"n"+(a?"l":"")):c.push(d.combinedExpanderPrefix+(i.expanded?"e":"c")+(i.lazy&&null==i.children?"d":"")+(a?"l":"")),c.push(d.combinedIconPrefix+(i.expanded?"e":"c")+(i.folder?"f":"")),u.className=c.join(" "),i.li&&e(i.li).toggleClass(d.lastsib,a))},nodeSetActive:function(n,i,r){r=r||{};var a,l=n.node,d=n.tree,c=n.options,u=!0===r.noEvents,h=!0===r.noFocus;return i=!1!==i,l===d.activeNode===i?o(l):i&&!u&&!1===this._triggerNodeEvent("beforeActivate",l,n.originalEvent)?s(l,["rejected"]):(i?(d.activeNode&&(t(d.activeNode!==l,"node was active (inconsistency)"),a=e.extend({},n,{node:d.activeNode}),d.nodeSetActive(a,!1),t(null===d.activeNode,"deactivate was out of sync?")),c.activeVisible&&l.makeVisible({scrollIntoView:h&&null==d.focusNode}),d.activeNode=l,d.nodeRenderStatus(n),h||d.nodeSetFocus(n),u||d._triggerNodeEvent("activate",l,n.originalEvent)):(t(d.activeNode===l,"node was not active (inconsistency)"),d.activeNode=null,this.nodeRenderStatus(n),u||n.tree._triggerNodeEvent("deactivate",l,n.originalEvent)),o(l))},nodeSetExpanded:function(t,n,i){i=i||{};var r,a,l,d,c,u,h=t.node,f=t.tree,p=t.options,g=!0===i.noAnimation,y=!0===i.noEvents;if(n=!1!==n,h.expanded&&n||!h.expanded&&!n)return o(h);if(n&&!h.lazy&&!h.hasChildren())return o(h);if(!n&&h.getLevel()<p.minExpandLevel)return s(h,["locked"]);if(!y&&!1===this._triggerNodeEvent("beforeExpand",h,t.originalEvent))return s(h,["rejected"]);if(g||h.isVisible()||(g=i.noAnimation=!0),a=new e.Deferred,n&&!h.expanded&&p.autoCollapse){c=h.getParentList(!1,!0),u=p.autoCollapse;try{for(p.autoCollapse=!1,l=0,d=c.length;l<d;l++)this._callHook("nodeCollapseSiblings",c[l],i)}finally{p.autoCollapse=u}}return a.done(function(){var e=h.getLastChild();n&&p.autoScroll&&!g&&e?e.scrollIntoView(!0,{topNode:h}).always(function(){y||t.tree._triggerNodeEvent(n?"expand":"collapse",t)}):y||t.tree._triggerNodeEvent(n?"expand":"collapse",t)}),r=function(i){var r,o,s=p._classNames,a=p.toggleEffect;if(h.expanded=n,f._callHook("nodeRender",t,!1,!1,!0),h.ul)if(r="none"!==h.ul.style.display,o=!!h.expanded,r===o)h.warn("nodeSetExpanded: UL.style.display already set");else{if(a&&!g)return e(h.li).addClass(s.animating),void(e.isFunction(e(h.ul)[a.effect])?(f.debug("use jquery."+a.effect+" method"),e(h.ul)[a.effect]({duration:a.duration,always:function(){h.info("fancytree-animating end: "+h.li.className),e(this).removeClass(s.animating),e(h.li).removeClass(s.animating),i()}})):(f.debug("use specified effect ("+a.effect+") with the jqueryui.toggle method"),e(h.ul).stop(!0,!0),e(h.ul).parent().find(".ui-effects-placeholder").remove(),e(h.ul).toggle(a.effect,a.options,a.duration,function(){h.info("fancytree-animating end: "+h.li.className),e(this).removeClass(s.animating),e(h.li).removeClass(s.animating),i()})));h.ul.style.display=h.expanded||!parent?"":"none"}i()},n&&h.lazy&&void 0===h.hasChildren()?h.load().done(function(){a.notifyWith&&a.notifyWith(h,["loaded"]),r(function(){a.resolveWith(h)})}).fail(function(e){r(function(){a.rejectWith(h,["load failed ("+e+")"])})}):r(function(){a.resolveWith(h)}),a.promise()},nodeSetFocus:function(t,n){var i,r=t.tree,o=t.node,s=r.options,a=!!t.originalEvent&&e(t.originalEvent.target).is(":input");if(n=!1!==n,r.focusNode){if(r.focusNode===o&&n)return;i=e.extend({},t,{node:r.focusNode}),r.focusNode=null,this._triggerNodeEvent("blur",i),this._callHook("nodeRenderStatus",i)}n&&(this.hasFocus()||(o.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",t,!0,{calledByNode:!0})),o.makeVisible({scrollIntoView:!1}),r.focusNode=o,s.titlesTabbable?a||e(o.span).find(".fancytree-title").focus():0===e(document.activeElement).closest(".fancytree-container").length&&e(r.$container).focus(),s.aria&&e(r.$container).attr("aria-activedescendant",e(o.tr||o.li).uniqueId().attr("id")),this._triggerNodeEvent("focus",t),s.autoScroll&&o.scrollIntoView(),this._callHook("nodeRenderStatus",t))},nodeSetSelected:function(e,t,n){n=n||{};var i=e.node,r=e.tree,o=e.options,s=!0===n.noEvents,a=i.parent;if(t=!1!==t,!g.evalOption("unselectable",i,i,o,!1)){if(i._lastSelectIntent=t,!!i.selected===t&&(3!==o.selectMode||!i.partsel||t))return t;if(!s&&!1===this._triggerNodeEvent("beforeSelect",i,e.originalEvent))return!!i.selected;t&&1===o.selectMode?(r.lastSelectedNode&&r.lastSelectedNode.setSelected(!1),i.selected=t):3!==o.selectMode||!a||a.radiogroup||i.radiogroup?a&&a.radiogroup?i.visitSiblings(function(e){e._changeSelectStatusAttrs(t&&e===i)},!0):i.selected=t:(i.selected=t,i.fixSelection3AfterClick(n)),this.nodeRenderStatus(e),r.lastSelectedNode=t?i:null,s||r._triggerNodeEvent("select",e)}},nodeSetStatus:function(t,n,i,r){function o(t,n){var i=s.children?s.children[0]:null;return i&&i.isStatusNode()?(e.extend(i,t),i.statusNodeType=n,a._callHook("nodeRenderTitle",i)):(s._setChildren([t]),s.children[0].statusNodeType=n,a.render()),s.children[0]}var s=t.node,a=t.tree;switch(n){case"ok":!function(){var e=s.children?s.children[0]:null;if(e&&e.isStatusNode()){try{s.ul&&(s.ul.removeChild(e.li),e.li=null)}catch(e){}1===s.children.length?s.children=[]:s.children.shift()}}(),s._isLoading=!1,s._error=null,s.renderStatus();break;case"loading":s.parent||o({title:a.options.strings.loading+(i?" ("+i+")":""),checkbox:!1,tooltip:r},n),s._isLoading=!0,s._error=null,s.renderStatus();break;case"error":o({title:a.options.strings.loadError+(i?" ("+i+")":""),checkbox:!1,tooltip:r},n),s._isLoading=!1,s._error={message:i,details:r},s.renderStatus();break;case"nodata":o({title:a.options.strings.noData,checkbox:!1,tooltip:r},n),s._isLoading=!1,s._error=null,s.renderStatus();break;default:e.error("invalid node status "+n)}},nodeToggleExpanded:function(e){return this.nodeSetExpanded(e,!e.node.expanded)},nodeToggleSelected:function(e){var t=e.node,n=!t.selected;return t.partsel&&!t.selected&&!0===t._lastSelectIntent&&(n=!1,t.selected=!0),t._lastSelectIntent=n,this.nodeSetSelected(e,n)},treeClear:function(e){var t=e.tree;t.activeNode=null,t.focusNode=null,t.$div.find(">ul.fancytree-container").empty(),t.rootNode.children=null},treeCreate:function(e){},treeDestroy:function(e){this.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("fancytree-helper-hidden")},treeInit:function(t){var n=t.tree,i=n.options;n.$container.attr("tabindex",i.tabindex),e.each(S,function(e,t){void 0!==i[t]&&(n.info("Move option "+t+" to tree"),n[t]=i[t],delete i[t])}),i.rtl?n.$container.attr("DIR","RTL").addClass("fancytree-rtl"):n.$container.removeAttr("DIR").removeClass("fancytree-rtl"),i.aria&&(n.$container.attr("role","tree"),1!==i.selectMode&&n.$container.attr("aria-multiselectable",!0)),this.treeLoad(t)},treeLoad:function(n,i){var r,o,s,a=n.tree,d=n.widget.element,c=e.extend({},n,{node:this.rootNode});if(a.rootNode.children&&this.treeClear(n),i=i||this.options.source)"string"==typeof i&&e.error("Not implemented");else switch(o=d.data("type")||"html"){case"html":(s=d.find(">ul:first")).addClass("ui-fancytree-source fancytree-helper-hidden"),i=e.ui.fancytree.parseHtml(s),this.data=e.extend(this.data,l(s));break;case"json":i=e.parseJSON(d.text()),d.contents().filter(function(){return 3===this.nodeType}).remove(),e.isPlainObject(i)&&(t(e.isArray(i.children),"if an object is passed as source, it must contain a 'children' array (all other properties are added to 'tree.data')"),r=i,i=i.children,delete r.children,e.each(S,function(e,t){void 0!==r[t]&&(a[t]=r[t],delete r[t])}),e.extend(a.data,r));break;default:e.error("Invalid data-type: "+o)}return this.nodeLoadChildren(c,i).done(function(){a.render(),3===n.options.selectMode&&a.rootNode.fixSelection3FromEndNodes(),a.activeNode&&a.options.activeVisible&&a.activeNode.makeVisible(),a._triggerTreeEvent("init",null,{status:!0})}).fail(function(){a.render(),a._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(e,t,n){},treeSetFocus:function(t,n,i){var r;(n=!1!==n)!==this.hasFocus()&&(this._hasFocus=n,!n&&this.focusNode?this.focusNode.setFocus(!1):!n||i&&i.calledByNode||e(this.$container).focus(),this.$container.toggleClass("fancytree-treefocus",n),this._triggerTreeEvent(n?"focusTree":"blurTree"),n&&!this.activeNode&&(r=this._lastMousedownNode||this.getFirstChild())&&r.setFocus())},treeSetOption:function(t,n,i){var r=t.tree,o=!0,s=!1,a=!1;switch(n){case"aria":case"checkbox":case"icon":case"minExpandLevel":case"tabindex":s=!0,a=!0;break;case"escapeTitles":case"tooltip":a=!0;break;case"rtl":!1===i?r.$container.removeAttr("DIR").removeClass("fancytree-rtl"):r.$container.attr("DIR","RTL").addClass("fancytree-rtl"),a=!0;break;case"source":o=!1,r._callHook("treeLoad",r,i),a=!0}r.debug("set option "+n+"="+i+" <"+typeof i+">"),o&&(this.widget._super?this.widget._super.call(this.widget,n,i):e.Widget.prototype._setOption.call(this.widget,n,i)),s&&r._callHook("treeCreate",r),a&&r.render(!0,!1)}}),e.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!0,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,escapeTitles:!1,extensions:[],toggleEffect:{effect:"slideToggle",duration:200},generateIds:!1,icon:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,quicksearch:!1,rtl:!1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading...",loadError:"Load error!",moreData:"More...",noData:"No data."},tabindex:"0",titlesTabbable:!1,tooltip:!1,_classNames:{node:"fancytree-node",folder:"fancytree-folder",animating:"fancytree-animating",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partload:"fancytree-partload",partsel:"fancytree-partsel",radio:"fancytree-radio",unselectable:"fancytree-unselectable",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error",statusNodePrefix:"fancytree-statusnode-"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new h(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul:first");var n,i,o,s=this.options,a=s.extensions;this.tree;for(o=0;o<a.length;o++)i=a[o],(n=e.ui.fancytree._extensions[i])||e.error("Could not apply extension '"+i+"' (it is not registered, did you forget to include it?)"),this.tree.options[i]=e.extend(!0,{},n.options,this.tree.options[i]),t(void 0===this.tree.ext[i],"Extension name must not exist as Fancytree.ext attribute: '"+i+"'"),this.tree.ext[i]={},r(this.tree,0,n,i),n;void 0!==s.icons&&(!0!==s.icon?e.error("'icons' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'icons' tree option is deprecated since v2.14.0: use 'icon' instead"),s.icon=s.icons)),void 0!==s.iconClass&&(s.icon?e.error("'iconClass' tree option is deprecated since v2.14.0: use 'icon' only instead"):(this.tree.warn("'iconClass' tree option is deprecated since v2.14.0: use 'icon' instead"),s.icon=s.iconClass)),void 0!==s.tabbable&&(s.tabindex=s.tabbable?"0":"-1",this.tree.warn("'tabbable' tree option is deprecated since v2.17.0: use 'tabindex='"+s.tabindex+"' instead")),this.tree._callHook("treeCreate",this.tree)},_init:function(){this.tree._callHook("treeInit",this.tree),this._bind()},_setOption:function(e,t){return this.tree._callHook("treeSetOption",this.tree,e,t)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),e.Widget.prototype.destroy.call(this)},_unbind:function(){var t=this.tree._ns;this.element.off(t),this.tree.$container.off(t),e(document).off(t)},_bind:function(){var t=this,n=this.options,i=this.tree,r=i._ns;this._unbind(),i.$container.on("focusin"+r+" focusout"+r,function(t){var n=g.getNode(t),r="focusin"===t.type;if(!r&&n&&e(t.target).is("a"))n.debug("Ignored focusout on embedded <a> element.");else{if(r){if(i._getExpiringValue("focusin"))return void i.debug("Ignored double focusin.");i._setExpiringValue("focusin",!0,50),n||(n=i._getExpiringValue("mouseDownNode"))&&i.debug("Reconstruct mouse target for focusin from recent event.")}n?i._callHook("nodeSetFocus",i._makeHookContext(n,t),r):i.tbody&&e(t.target).parents("table.fancytree-container > thead").length?i.debug("Ignore focus event outside table body.",t):i._callHook("treeSetFocus",i,r)}}).on("selectstart"+r,"span.fancytree-title",function(e){e.preventDefault()}).on("keydown"+r,function(e){if(n.disabled||!1===n.keyboard)return!0;var t,r=i.focusNode,o=i._makeHookContext(r||i,e),s=i.phase;try{return i.phase="userEvent","preventNav"===(t=r?i._triggerNodeEvent("keydown",r,e):i._triggerTreeEvent("keydown",e))?t=!0:!1!==t&&(t=i._callHook("nodeKeydown",o)),t}finally{i.phase=s}}).on("mousedown"+r,function(e){var t=g.getEventTarget(e);i._lastMousedownNode=t?t.node:null,i._setExpiringValue("mouseDownNode",i._lastMousedownNode)}).on("click"+r+" dblclick"+r,function(e){if(n.disabled)return!0;var i,r=g.getEventTarget(e),o=r.node,s=t.tree,a=s.phase;if(!o)return!0;i=s._makeHookContext(o,e);try{switch(s.phase="userEvent",e.type){case"click":return i.targetType=r.type,o.isPagingNode()?!0===s._triggerNodeEvent("clickPaging",i,e):!1!==s._triggerNodeEvent("click",i,e)&&s._callHook("nodeClick",i);case"dblclick":return i.targetType=r.type,!1!==s._triggerNodeEvent("dblclick",i,e)&&s._callHook("nodeDblclick",i)}}finally{s.phase=a}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(e){return this.tree.getNodeByKey(e)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),g=e.ui.fancytree,e.extend(e.ui.fancytree,{version:"2.29.0",buildType: "production",debugLevel: 3,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:h,_FancytreeNodeClass:u,jquerySupports:{positionMyOfs:function(t,n,i,r){var o,s,a,l=e.map(e.trim(t).split("."),function(e){return parseInt(e,10)}),d=e.map(Array.prototype.slice.call(arguments,1),function(e){return parseInt(e,10)});for(o=0;o<d.length;o++)if(s=l[o]||0,a=d[o]||0,s!==a)return s>a;return!0}(e.ui.version,1,9)},assert:function(e,n){return t(e,n)},createTree:function(t,n){return e(t).fancytree(n).fancytree("getTree")},debounce:function(e,t,n,i){var r;return 3===arguments.length&&"boolean"!=typeof n&&(i=n,n=!1),function(){var o=arguments;i=i||this,n&&!r&&t.apply(i,o),clearTimeout(r),r=setTimeout(function(){n||t.apply(i,o),r=null},e)}},debug:function(t){e.ui.fancytree.debugLevel>=4&&n("log",arguments)},error:function(t){e.ui.fancytree.debugLevel>=1&&n("error",arguments)},escapeHtml:function(e){return(""+e).replace(v,function(e){return b[e]})},fixPositionOptions:function(t){if((t.offset||(""+t.my+t.at).indexOf("%")>=0)&&e.error("expected new position syntax (but '%' is not supported)"),!e.ui.fancytree.jquerySupports.positionMyOfs){var n=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(t.my),i=/(\w+)([+-]?\d+)?\s+(\w+)([+-]?\d+)?/.exec(t.at),r=(n[2]?+n[2]:0)+(i[2]?+i[2]:0),o=(n[4]?+n[4]:0)+(i[4]?+i[4]:0);t=e.extend({},t,{my:n[1]+" "+n[3],at:i[1]+" "+i[3]}),(r||o)&&(t.offset=r+" "+o)}return t},getEventTarget:function(t){var n,i=t&&t.target?t.target.className:"",r={node:this.getNode(t.target),type:void 0};return/\bfancytree-title\b/.test(i)?r.type="title":/\bfancytree-expander\b/.test(i)?r.type=!1===r.node.hasChildren()?"prefix":"expander":/\bfancytree-checkbox\b/.test(i)?r.type="checkbox":/\bfancytree(-custom)?-icon\b/.test(i)?r.type="icon":/\bfancytree-node\b/.test(i)?r.type="title":t&&t.target&&((n=e(t.target)).is("ul[role=group]")?((r.node&&r.node.tree||g).debug("Ignoring click on outer UL."),r.node=null):n.closest(".fancytree-title").length?r.type="title":n.closest(".fancytree-checkbox").length?r.type="checkbox":n.closest(".fancytree-expander").length&&(r.type="expander")),r},getEventTargetType:function(e){return this.getEventTarget(e).type},getNode:function(t){if(t instanceof u)return t;for(t instanceof e?t=t[0]:void 0!==t.originalEvent&&(t=t.target);t;){if(t.ftnode)return t.ftnode;t=t.parentNode}return null},getTree:function(t){var n;return t instanceof h?t:(void 0===t&&(t=0),"number"==typeof t?t=e(".fancytree-container").eq(t):"string"==typeof t?t=e(t).eq(0):void 0!==t.selector?t=t.eq(0):void 0!==t.originalEvent&&(t=e(t.target)),t=t.closest(":ui-fancytree"),(n=t.data("ui-fancytree")||t.data("fancytree"))?n.tree:null)},evalOption:function(t,n,i,r,o){var s,a,l=n.tree,d=r[t],c=i[t];return e.isFunction(d)?(s={node:n,tree:l,widget:l.widget,options:l.widget.options,typeInfo:l.types[n.type]||{}},null==(a=d.call(l,{type:t},s))&&(a=c)):a=null!=c?c:d,null==a&&(a=o),a},setSpanIcon:function(t,n,i){var r=e(t);"string"==typeof i?r.attr("class",n+" "+i):(i.text?r.text(""+i.text):i.html&&(t.innerHTML=i.html),r.attr("class",n+" "+(i.addClass||"")))},eventToString:function(e){var t=e.which,n=e.type,i=[];return e.altKey&&i.push("alt"),e.ctrlKey&&i.push("ctrl"),e.metaKey&&i.push("meta"),e.shiftKey&&i.push("shift"),"click"===n||"dblclick"===n?i.push(k[e.button]+n):C[t]||i.push(_[t]||String.fromCharCode(t).toLowerCase()),i.join("+")},info:function(t){e.ui.fancytree.debugLevel>=3&&n("info",arguments)},keyEventToString:function(e){return this.warn("keyEventToString() is deprecated: use eventToString()"),this.eventToString(e)},overrideMethod:function(t,n,i){var r,o=t[n]||e.noop;t[n]=function(){try{return r=this._super,this._super=o,i.apply(this,arguments)}finally{this._super=r}}},parseHtml:function(t){var n,i,r,o,s,a,d,c,u=[];return t.find(">li").each(function(){var h,f,p=e(this),g=p.find(">span:first",this),y=g.length?null:p.find(">a:first"),v={tooltip:null,data:{}};for(g.length?v.title=g.html():y&&y.length?(v.title=y.html(),v.data.href=y.attr("href"),v.data.target=y.attr("target"),v.tooltip=y.attr("title")):(v.title=p.html(),(s=v.title.search(/<ul/i))>=0&&(v.title=v.title.substring(0,s))),v.title=e.trim(v.title),o=0,a=N.length;o<a;o++)v[N[o]]=void 0;for(n=this.className.split(" "),r=[],o=0,a=n.length;o<a;o++)i=n[o],w[i]?v[i]=!0:r.push(i);if(v.extraClasses=r.join(" "),(d=p.attr("title"))&&(v.tooltip=d),(d=p.attr("id"))&&(v.key=d),p.attr("hideCheckbox")&&(v.checkbox=!1),(h=l(p))&&!e.isEmptyObject(h)){for(f in A)h.hasOwnProperty(f)&&(h[A[f]]=h[f],delete h[f]);for(o=0,a=E.length;o<a;o++)d=E[o],null!=(c=h[d])&&(delete h[d],v[d]=c);e.extend(v.data,h)}(t=p.find(">ul:first")).length?v.children=e.ui.fancytree.parseHtml(t):v.children=v.lazy?void 0:null,u.push(v)}),u},registerExtension:function(n){t(null!=n.name,"extensions must have a `name` property."),t(null!=n.version,"extensions must have a `version` property."),e.ui.fancytree._extensions[n.name]=n},unescapeHtml:function(e){var t=document.createElement("div");return t.innerHTML=e,0===t.childNodes.length?"":t.childNodes[0].nodeValue},warn:function(t){e.ui.fancytree.debugLevel>=2&&n("warn",arguments)}}),e.ui.fancytree}e.ui.fancytree.warn("Fancytree: ignored duplicate include")}}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";return e.ui.fancytree._FancytreeClass.prototype.countSelected=function(e){this.options;return this.getSelectedNodes(e).length},e.ui.fancytree._FancytreeNodeClass.prototype.updateCounters=function(){var t=e("span.fancytree-childcounter",this.span),n=this.tree.options.childcounter,i=this.countChildren(n.deep);this.data.childCounter=i,!i&&n.hideZeros||this.isExpanded()&&n.hideExpanded?t.remove():(t.length||(t=e("<span class='fancytree-childcounter'/>").appendTo(e("span.fancytree-icon,span.fancytree-custom-icon",this.span))),t.text(i)),!n.deep||this.isTopLevel()||this.isRoot()||this.parent.updateCounters()},e.ui.fancytree.prototype.widgetMethod1=function(e){this.tree;return e},e.ui.fancytree.registerExtension({name:"childcounter",version:"2.29.0",options:{deep:!0,hideZeros:!0,hideExpanded:!1},foo:42,_appendCounter:function(e){},treeInit:function(e){e.options,e.options.childcounter;this._superApply(arguments),this.$container.addClass("fancytree-ext-childcounter")},treeDestroy:function(e){this._superApply(arguments)},nodeRenderTitle:function(t,n){var i=t.node,r=t.options.childcounter,o=null==i.data.childCounter?i.countChildren(r.deep):+i.data.childCounter;this._super(t,n),!o&&r.hideZeros||i.isExpanded()&&r.hideExpanded||e("span.fancytree-icon,span.fancytree-custom-icon",i.span).append(e("<span class='fancytree-childcounter'/>").text(o))},nodeSetExpanded:function(e,t,n){var i=e.tree;e.node;return this._superApply(arguments).always(function(){i.nodeRenderTitle(e)})}}),e.ui.fancytree}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";function t(t,n){t||(n=n?": "+n:"",e.error("Assertion failed"+n))}return e.ui.fancytree._FancytreeNodeClass.prototype.getCloneList=function(t){var n,i=this.tree,r=i.refMap[this.refKey]||null,o=i.keyMap;return r&&(n=this.key,t?r=e.map(r,function(e){return o[e]}):(r=e.map(r,function(e){return e===n?null:o[e]})).length<1&&(r=null)),r},e.ui.fancytree._FancytreeNodeClass.prototype.isClone=function(){var e=this.refKey||null,t=e&&this.tree.refMap[e]||null;return!!(t&&t.length>1)},e.ui.fancytree._FancytreeNodeClass.prototype.reRegister=function(t,n){t=null==t?null:""+t,n=null==n?null:""+n;var i=this.tree,r=this.key,o=this.refKey,s=i.keyMap,a=i.refMap,l=a[o]||null,d=!1;return null!=t&&t!==this.key&&(s[t]&&e.error("[ext-clones] reRegister("+t+"): already exists: "+this),delete s[r],s[t]=this,l&&(a[o]=e.map(l,function(e){return e===r?t:e})),this.key=t,d=!0),null!=n&&n!==this.refKey&&(l&&(1===l.length?delete a[o]:a[o]=e.map(l,function(e){return e===r?null:e})),a[n]?a[n].append(t):a[n]=[this.key],this.refKey=n,d=!0),d},e.ui.fancytree._FancytreeNodeClass.prototype.setRefKey=function(e){return this.reRegister(null,e)},e.ui.fancytree._FancytreeClass.prototype.getNodesByRef=function(t,n){var i=this.keyMap,r=this.refMap[t]||null;return r&&(r=n?e.map(r,function(e){var t=i[e];return t.isDescendantOf(n)?t:null}):e.map(r,function(e){return i[e]})).length<1&&(r=null),r},e.ui.fancytree._FancytreeClass.prototype.changeRefKey=function(e,t){var n,i=this.keyMap,r=this.refMap[e]||null;if(r){for(n=0;n<r.length;n++)i[r[n]].refKey=t;delete this.refMap[e],this.refMap[t]=r}},e.ui.fancytree.registerExtension({name:"clones",version:"2.29.0",options:{highlightActiveClones:!0,highlightClones:!1},treeCreate:function(e){this._superApply(arguments),e.tree.refMap={},e.tree.keyMap={}},treeInit:function(n){this.$container.addClass("fancytree-ext-clones"),t(null==n.options.defaultKey),n.options.defaultKey=function(t){return function(t){var n=e.map(t.getParentList(!1,!0),function(e){return e.refKey||e.key});return n=n.join("/"),"id_"+function(e,t,n){for(var i,r,o=3&e.length,s=e.length-o,a=n,l=0;l<s;)r=255&e.charCodeAt(l)|(255&e.charCodeAt(++l))<<8|(255&e.charCodeAt(++l))<<16|(255&e.charCodeAt(++l))<<24,++l,a=27492+(65535&(i=5*(65535&(a=(a^=r=461845907*(65535&(r=(r=3432918353*(65535&r)+((3432918353*(r>>>16)&65535)<<16)&4294967295)<<15|r>>>17))+((461845907*(r>>>16)&65535)<<16)&4294967295)<<13|a>>>19))+((5*(a>>>16)&65535)<<16)&4294967295))+((58964+(i>>>16)&65535)<<16);switch(r=0,o){case 3:r^=(255&e.charCodeAt(l+2))<<16;case 2:r^=(255&e.charCodeAt(l+1))<<8;case 1:a^=r=461845907*(65535&(r=(r=3432918353*(65535&(r^=255&e.charCodeAt(l)))+((3432918353*(r>>>16)&65535)<<16)&4294967295)<<15|r>>>17))+((461845907*(r>>>16)&65535)<<16)&4294967295}return a^=e.length,a^=a>>>16,a=2246822507*(65535&a)+((2246822507*(a>>>16)&65535)<<16)&4294967295,a^=a>>>13,a=3266489909*(65535&a)+((3266489909*(a>>>16)&65535)<<16)&4294967295,a^=a>>>16,t?("0000000"+(a>>>0).toString(16)).substr(-8):a>>>0}(n,!0)}(t)},this._superApply(arguments)},treeClear:function(e){return e.tree.refMap={},e.tree.keyMap={},this._superApply(arguments)},treeRegisterNode:function(n,i,r){var o,s,a=n.tree,l=a.keyMap,d=a.refMap,c=r.key,u=r&&null!=r.refKey?""+r.refKey:null;return r.isStatusNode()?this._super(n,i,r):(i?(null!=l[r.key]&&e.error("clones.treeRegisterNode: node.key already exists: "+r),l[c]=r,u&&((o=d[u])?(o.push(c),2===o.length&&n.options.clones.highlightClones&&l[o[0]].renderStatus()):d[u]=[c])):(null==l[c]&&e.error("clones.treeRegisterNode: node.key not registered: "+r.key),delete l[c],u&&(o=d[u])&&((s=o.length)<=1?(t(1===s),t(o[0]===c),delete d[u]):(!function(e,t){var n;for(n=e.length-1;n>=0;n--)if(e[n]===t)return e.splice(n,1),!0}(o,c),2===s&&n.options.clones.highlightClones&&l[o[0]].renderStatus()))),this._super(n,i,r))},nodeRenderStatus:function(t){var n,i,r=t.node;return i=this._super(t),t.options.clones.highlightClones&&(n=e(r[t.tree.statusClassPropName])).length&&r.isClone()&&n.addClass("fancytree-clone"),i},nodeSetActive:function(t,n,i){var r,o=t.tree.statusClassPropName,s=t.node;return r=this._superApply(arguments),t.options.clones.highlightActiveClones&&s.isClone()&&e.each(s.getCloneList(!0),function(t,i){e(i[o]).toggleClass("fancytree-active-clone",!1!==n)}),r}}),e.ui.fancytree}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";function t(){y=null,v=null,m=null,x=null}function n(e){return 0===e?"":e>0?"+"+e:""+e}function i(t,i){if(i.options.dnd5.scroll&&function(t,n){var i,r,o=t.options.dnd5,s=t.$scrollParent[0],a=o.scrollSensitivity,l=o.scrollSpeed,d=0;s!==document&&"HTML"!==s.tagName?(i=t.$scrollParent.offset(),r=s.scrollTop,i.top+s.offsetHeight-n.pageY<a?s.scrollHeight-t.$scrollParent.innerHeight()-r>0&&(s.scrollTop=d=r+l):r>0&&n.pageY-i.top<a&&(s.scrollTop=d=r-l)):(r=e(document).scrollTop())>0&&n.pageY-r<a?(d=r-l,e(document).scrollTop(d)):e(window).height()-(n.pageY-r)<a&&(d=r+l,e(document).scrollTop(d)),d&&t.debug("autoScroll: "+d+"px")}(i.tree,t),!i.node)return i.tree.warn("Ignore dragover for non-node"),b;var o,s,a,p,y=null,v=i.tree,m=v.options,C=m.dnd5,_=i.node,k=i.otherNode,N="center",w=e(_.span),S=w.find("span.fancytree-title");if(!1===x)return v.info("Ignore dragover, since dragenter returned false"),!1;if("string"==typeof x?e.error("assert failed: dragenter returned string"):(s=w.offset(),p=(t.pageY-s.top)/w.height(),x.after&&p>.75?y="after":!x.over&&x.after&&p>.5?y="after":x.before&&p<=.25?y="before":!x.over&&x.before&&p<=.5?y="before":x.over&&(y="over"),C.preventVoidMoves&&(_===k?(_.debug("Drop over source node prevented."),y=null):"before"===y&&k&&_===k.getNextSibling()?(_.debug("Drop after source node prevented."),y=null):"after"===y&&k&&_===k.getPrevSibling()?(_.debug("Drop before source node prevented."),y=null):"over"===y&&k&&k.parent===_&&k.isLastSibling()&&(_.debug("Drop last child over own parent prevented."),y=null))),i.hitMode=y,y&&C.dragOver&&(C.dragOver(_,i),y=i.hitMode),b=y,"after"===y||"before"===y||"over"===y){switch(o=C.dropMarkerOffsetX||0,y){case"before":N="top",o+=C.dropMarkerInsertOffsetX||0;break;case"after":N="bottom",o+=C.dropMarkerInsertOffsetX||0}a={my:"left"+n(o)+" center",at:"left "+N,of:S},m.rtl&&(a.my="right"+n(-o)+" center",a.at="right "+N),g.toggleClass(d,"after"===y).toggleClass(u,"over"===y).toggleClass(c,"before"===y).show().position(r.fixPositionOptions(a))}else g.hide();return e(_.span).toggleClass(f,"after"===y||"before"===y||"over"===y).toggleClass(d,"after"===y).toggleClass(c,"before"===y).toggleClass(l,"over"===y).toggleClass(h,!1===y),y}var r=e.ui.fancytree,o=/Mac/.test(navigator.platform),s="fancytree-drag-source",a="fancytree-drag-remove",l="fancytree-drop-accept",d="fancytree-drop-after",c="fancytree-drop-before",u="fancytree-drop-over",h="fancytree-drop-reject",f="fancytree-drop-target",p="application/x-fancytree-node",g=null,y=null,v=null,m=null,x=null,b=null;return e.ui.fancytree.registerExtension({name:"dnd5",version:"2.29.0",options:{autoExpandMS:1500,dropMarkerInsertOffsetX:-16,dropMarkerOffsetX:-24,multiSource:!1,dragImage:null,dropEffect:null,dropEffectDefault:"move",preventForeignNodes:!1,preventNonNodes:!1,preventRecursiveMoves:!0,preventVoidMoves:!0,scroll:!0,scrollSensitivity:20,scrollSpeed:5,setTextTypeJson:!1,dragStart:null,dragDrag:e.noop,dragEnd:e.noop,dragEnter:null,dragOver:e.noop,dragExpand:e.noop,dragDrop:e.noop,dragLeave:e.noop},treeInit:function(n){var d,c,f,C=n.tree,_=n.options,k=_.glyph||null,N=_.dnd5,w=r.getNode;e.inArray("dnd",_.extensions)>=0&&e.error("Extensions 'dnd' and 'dnd5' are mutually exclusive."),N.dragStop&&e.error("dragStop is not used by ext-dnd5. Use dragEnd instead."),N.dragStart&&r.overrideMethod(n.options,"createNode",function(e,t){this._super.apply(this,arguments),t.node.span.draggable=!0}),this._superApply(arguments),this.$container.addClass("fancytree-ext-dnd5"),f=e("<span>").appendTo(this.$container),this.$scrollParent=f.scrollParent(),f.remove(),(g=e("#fancytree-drop-marker")).length||(g=e("<div id='fancytree-drop-marker'></div>").hide().css({"z-index":1e3,"pointer-events":"none"}).prependTo("body"),k&&r.setSpanIcon(g[0],k.map._addClass,k.map.dropMarker)),g.toggleClass("fancytree-rtl",!!_.rtl),N.dragStart&&C.$container.on("dragstart drag dragend",function(n){var i,r=w(n),l=n.dataTransfer||n.originalEvent.dataTransfer,u={node:r,tree:C,options:C.options,originalEvent:n,dataTransfer:l,isCancelled:void 0},h=function(e,t){var n=t.options.dnd5,i=n.dropEffectDefault;if(n.dropEffect)return n.dropEffect(e,t);if(o){if(e.metaKey&&e.altKey)return"link";if(e.metaKey)return"move";if(e.altKey)return"copy"}else{if(e.ctrlKey)return"copy";if(e.shiftKey)return"move";if(e.altKey)return"link"}return i}(n,u),f="move"===h;switch(n.type){case"dragstart":y=r,!1===N.multiSource?v=[r]:!0===N.multiSource?(v=C.getSelectedNodes(),r.isSelected()||v.unshift(r)):v=N.multiSource(r,u),(m=e(e.map(v,function(e){return e.span}))).addClass(s),i=JSON.stringify(r.toDict());try{l.setData(p,i),l.setData("text/html",e(r.span).html()),l.setData("text/plain",r.title)}catch(e){C.warn("Could not set data (IE only accepts 'text') - "+e)}return N.setTextTypeJson?l.setData("text",i):l.setData("text",r.title),l.effectAllowed="all",c=null,N.dragImage?N.dragImage(r,u):(d=e(r.span).find(".fancytree-title"),v&&v.length>1&&(c=e("<span class='fancytree-childcounter'/>").text("+"+(v.length-1)).appendTo(d)),l.setDragImage&&l.setDragImage(d[0],-10,-10)),!1!==N.dragStart(r,u);case"drag":m.toggleClass(a,f),N.dragDrag(r,u);break;case"dragend":m&&m.removeClass(s+" "+a),t(),u.isCancelled="none"===h,g.hide(),c&&(c.remove(),c=null),N.dragEnd(r,u)}}),N.dragEnter&&C.$container.on("dragenter dragover dragleave drop",function(n){var r,o,s,a=null,d=w(n),c=n.dataTransfer||n.originalEvent.dataTransfer,f={node:d,tree:C,options:C.options,hitMode:x,originalEvent:n,dataTransfer:c,otherNode:y||null,otherNodeList:v||null,otherNodeData:null,dropEffect:void 0,isCancelled:void 0};switch(n.type){case"dragenter":if(!d){C.debug("Ignore non-node "+n.type+": "+n.target.tagName+"."+n.target.className),x=!1;break}if(e(d.span).addClass(u).removeClass(l+" "+h),N.preventNonNodes&&!o){d.debug("Reject dropping a non-node."),x=!1;break}if(N.preventForeignNodes&&(!y||y.tree!==d.tree)){d.debug("Reject dropping a foreign node."),x=!1;break}setTimeout(function(){!N.autoExpandMS||!1===d.hasChildren()||d.expanded||N.dragExpand&&!1===N.dragExpand(d,f)||d.scheduleAction("expand",N.autoExpandMS)},0),g.show(),N.preventRecursiveMoves&&d.isDescendantOf(f.otherNode)?(d.debug("Reject dropping below own ancestor."),s=!1):s=function(t){var n;return!!t&&(n=e.isPlainObject(t)?{over:!!t.over,before:!!t.before,after:!!t.after}:e.isArray(t)?{over:e.inArray("over",t)>=0,before:e.inArray("before",t)>=0,after:e.inArray("after",t)>=0}:{over:!0===t||"over"===t,before:!0===t||"before"===t,after:!0===t||"after"===t},0!==Object.keys(n).length&&n)}(N.dragEnter(d,f)),x=s,a=s&&(s.over||s.before||s.after);break;case"dragover":a=!!(b=i(n,f));break;case"dragleave":if(!d){C.debug("Ignore non-node "+n.type+": "+n.target.tagName+"."+n.target.className);break}if(!e(d.span).hasClass(u)){d.debug("Ignore dragleave (multi)");break}e(d.span).removeClass(u+" "+l+" "+h),d.scheduleAction("cancel"),N.dragLeave(d,f),g.hide();break;case"drop":if(e.inArray(p,c.types)>=0&&(o=c.getData(p),C.info(n.type+": getData('application/x-fancytree-node'): '"+o+"'")),o||(o=c.getData("text"),C.info(n.type+": getData('text'): '"+o+"'")),o)try{void 0!==(r=JSON.parse(o)).title&&(f.otherNodeData=r)}catch(e){}C.debug(n.type+": nodeData: '"+o+"', otherNodeData: ",f.otherNodeData),e(d.span).removeClass(u+" "+l+" "+h),g.hide(),f.hitMode=b,f.dropEffect=c.dropEffect,f.isCancelled="none"===f.dropEffect,N.dragDrop(d,f),n.preventDefault(),t()}if(a)return n.preventDefault(),!1})}}),e.ui.fancytree}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";var t=/Mac/.test(navigator.platform),n=e.ui.fancytree.escapeHtml,i=e.ui.fancytree.unescapeHtml;return e.ui.fancytree._FancytreeNodeClass.prototype.editStart=function(){var t,n=this,r=this.tree,o=r.ext.edit,s=r.options.edit,a=e(".fancytree-title",n.span),l={node:n,tree:r,options:r.options,isNew:e(n[r.statusClassPropName]).hasClass("fancytree-edit-new"),orgTitle:n.title,input:null,dirty:!1};if(!1===s.beforeEdit.call(n,{type:"beforeEdit"},l))return!1;e.ui.fancytree.assert(!o.currentNode,"recursive edit"),o.currentNode=this,o.eventData=l,r.widget._unbind(),e(document).on("mousedown.fancytree-edit",function(t){e(t.target).hasClass("fancytree-edit-input")||n.editEnd(!0,t)}),t=e("<input />",{class:"fancytree-edit-input",type:"text",value:r.options.escapeTitles?l.orgTitle:i(l.orgTitle)}),o.eventData.input=t,null!=s.adjustWidthOfs&&t.width(a.width()+s.adjustWidthOfs),null!=s.inputCss&&t.css(s.inputCss),a.html(t),t.focus().change(function(e){t.addClass("fancytree-edit-dirty")}).keydown(function(t){switch(t.which){case e.ui.keyCode.ESCAPE:n.editEnd(!1,t);break;case e.ui.keyCode.ENTER:return n.editEnd(!0,t),!1}t.stopPropagation()}).blur(function(e){return n.editEnd(!0,e)}),s.edit.call(n,{type:"edit"},l)},e.ui.fancytree._FancytreeNodeClass.prototype.editEnd=function(t,i){var r,o=this,s=this.tree,a=s.ext.edit,l=a.eventData,d=s.options.edit,c=e(".fancytree-title",o.span).find("input.fancytree-edit-input");return d.trim&&c.val(e.trim(c.val())),r=c.val(),l.dirty=r!==o.title,l.originalEvent=i,!1===t?l.save=!1:l.isNew?l.save=""!==r:l.save=l.dirty&&""!==r,!1!==d.beforeClose.call(o,{type:"beforeClose"},l)&&((!l.save||!1!==d.save.call(o,{type:"save"},l))&&(c.removeClass("fancytree-edit-dirty").off(),e(document).off(".fancytree-edit"),l.save?(o.setTitle(s.options.escapeTitles?r:n(r)),o.setFocus()):l.isNew?(o.remove(),o=l.node=null,a.relatedNode.setFocus()):(o.renderTitle(),o.setFocus()),a.eventData=null,a.currentNode=null,a.relatedNode=null,s.widget._bind(),e(s.$container).focus(),l.input=null,d.close.call(o,{type:"close"},l),!0))},e.ui.fancytree._FancytreeNodeClass.prototype.editCreateNode=function(t,n){var i,r=this.tree,o=this;t=t||"child",null==n?n={title:""}:"string"==typeof n?n={title:n}:e.ui.fancytree.assert(e.isPlainObject(n)),"child"!==t||this.isExpanded()||!1===this.hasChildren()?((i=this.addNode(n,t)).match=!0,e(i[r.statusClassPropName]).removeClass("fancytree-hide").addClass("fancytree-match"),i.makeVisible().done(function(){e(i[r.statusClassPropName]).addClass("fancytree-edit-new"),o.tree.ext.edit.relatedNode=o,i.editStart()})):this.setExpanded().done(function(){o.editCreateNode(t,n)})},e.ui.fancytree._FancytreeClass.prototype.isEditing=function(){return this.ext.edit?this.ext.edit.currentNode:null},e.ui.fancytree._FancytreeNodeClass.prototype.isEditing=function(){return!!this.tree.ext.edit&&this.tree.ext.edit.currentNode===this},e.ui.fancytree.registerExtension({name:"edit",version:"2.29.0",options:{adjustWidthOfs:4,allowEmpty:!1,inputCss:{minWidth:"3em"},triggerStart:["f2","mac+enter","shift+click"],trim:!0,beforeClose:e.noop,beforeEdit:e.noop,close:e.noop,edit:e.noop,save:e.noop},currentNode:null,treeInit:function(e){this._superApply(arguments),this.$container.addClass("fancytree-ext-edit")},nodeClick:function(t){return e.inArray("shift+click",t.options.edit.triggerStart)>=0&&t.originalEvent.shiftKey?(t.node.editStart(),!1):e.inArray("clickActive",t.options.edit.triggerStart)>=0&&t.node.isActive()&&!t.node.isEditing()&&e(t.originalEvent.target).hasClass("fancytree-title")?(t.node.editStart(),!1):this._superApply(arguments)},nodeDblclick:function(t){return e.inArray("dblclick",t.options.edit.triggerStart)>=0?(t.node.editStart(),!1):this._superApply(arguments)},nodeKeydown:function(n){switch(n.originalEvent.which){case 113:if(e.inArray("f2",n.options.edit.triggerStart)>=0)return n.node.editStart(),!1;break;case e.ui.keyCode.ENTER:if(e.inArray("mac+enter",n.options.edit.triggerStart)>=0&&t)return n.node.editStart(),!1}return this._superApply(arguments)}}),e.ui.fancytree}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";function t(e){return(e+"").replace(/([.?*+\^\$\[\]\\(){}|-])/g,"\\$1")}var n="__not_found__",i=e.ui.fancytree.escapeHtml;return e.ui.fancytree._FancytreeClass.prototype._applyFilterImpl=function(r,o,s){var a,l,d,c,u,h=0,f=this.options,p=f.escapeTitles,g=f.autoCollapse,y=e.extend({},f.filter,s),v="hide"===y.mode,m=!!y.leavesOnly&&!o;if("string"==typeof r){if(""===r)return this.warn("Fancytree passing an empty string as a filter is handled as clearFilter()."),void this.clearFilter();a=y.fuzzy?r.split("").reduce(function(e,t){return e+"[^"+t+"]*"+t}):t(r),d=new RegExp(".*"+a+".*","i"),c=new RegExp(t(r),"gi"),r=function(t){if(!t.title)return!1;var n=p?t.title:function(t){return t.indexOf(">")>=0?e("<div/>").html(t).text():t}(t.title),r=!!d.test(n);return r&&y.highlight&&(p?(u=n.replace(c,function(e){return"\ufff7"+e+"\ufff8"}),t.titleWithHighlight=i(u).replace(/\uFFF7/g,"<mark>").replace(/\uFFF8/g,"</mark>")):t.titleWithHighlight=n.replace(c,function(e){return"<mark>"+e+"</mark>"})),r}}return this.enableFilter=!0,this.lastFilterArgs=arguments,this.$div.addClass("fancytree-ext-filter"),v?this.$div.addClass("fancytree-ext-filter-hide"):this.$div.addClass("fancytree-ext-filter-dimm"),this.$div.toggleClass("fancytree-ext-filter-hide-expanders",!!y.hideExpanders),this.visit(function(e){delete e.match,delete e.titleWithHighlight,e.subMatchCount=0}),(l=this.getRootNode()._findDirectChild(n))&&l.remove(),f.autoCollapse=!1,this.visit(function(e){if(!m||null==e.children){var t=r(e),n=!1;if("skip"===t)return e.visit(function(e){e.match=!1},!0),"skip";t||!o&&"branch"!==t||!e.parent.match||(t=!0,n=!0),t&&(h++,e.match=!0,e.visitParents(function(e){e.subMatchCount+=1,!y.autoExpand||n||e.expanded||(e.setExpanded(!0,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),e._filterAutoExpanded=!0)}))}}),f.autoCollapse=g,0===h&&y.nodata&&v&&(l=y.nodata,e.isFunction(l)&&(l=l()),!0===l?l={}:"string"==typeof l&&(l={title:l}),l=e.extend({statusNodeType:"nodata",key:n,title:this.options.strings.noData},l),this.getRootNode().addNode(l).match=!0),this.render(),h},e.ui.fancytree._FancytreeClass.prototype.filterNodes=function(e,t){return"boolean"==typeof t&&(t={leavesOnly:t},this.warn("Fancytree.filterNodes() leavesOnly option is deprecated since 2.9.0 / 2015-04-19. Use opts.leavesOnly instead.")),this._applyFilterImpl(e,!1,t)},e.ui.fancytree._FancytreeClass.prototype.applyFilter=function(e){return this.warn("Fancytree.applyFilter() is deprecated since 2.1.0 / 2014-05-29. Use .filterNodes() instead."),this.filterNodes.apply(this,arguments)},e.ui.fancytree._FancytreeClass.prototype.filterBranches=function(e,t){return this._applyFilterImpl(e,!0,t)},e.ui.fancytree._FancytreeClass.prototype.clearFilter=function(){var t,i=this.getRootNode()._findDirectChild(n),r=this.options.escapeTitles,o=this.options.enhanceTitle;i&&i.remove(),this.visit(function(n){n.match&&n.span&&(t=e(n.span).find(">span.fancytree-title"),r?t.text(n.title):t.html(n.title),o&&o({type:"enhanceTitle"},{node:n,$title:t})),delete n.match,delete n.subMatchCount,delete n.titleWithHighlight,n.$subMatchBadge&&(n.$subMatchBadge.remove(),delete n.$subMatchBadge),n._filterAutoExpanded&&n.expanded&&n.setExpanded(!1,{noAnimation:!0,noEvents:!0,scrollIntoView:!1}),delete n._filterAutoExpanded}),this.enableFilter=!1,this.lastFilterArgs=null,this.$div.removeClass("fancytree-ext-filter fancytree-ext-filter-dimm fancytree-ext-filter-hide"),this.render()},e.ui.fancytree._FancytreeClass.prototype.isFilterActive=function(){return!!this.enableFilter},e.ui.fancytree._FancytreeNodeClass.prototype.isMatched=function(){return!(this.tree.enableFilter&&!this.match)},e.ui.fancytree.registerExtension({name:"filter",version:"2.29.0",options:{autoApply:!0,autoExpand:!1,counter:!0,fuzzy:!1,hideExpandedCounter:!0,hideExpanders:!1,highlight:!0,leavesOnly:!1,nodata:!0,mode:"dimm"},nodeLoadChildren:function(e,t){return this._superApply(arguments).done(function(){e.tree.enableFilter&&e.tree.lastFilterArgs&&e.options.filter.autoApply&&e.tree._applyFilterImpl.apply(e.tree,e.tree.lastFilterArgs)})},nodeSetExpanded:function(e,t,n){return delete e.node._filterAutoExpanded,!t&&e.options.filter.hideExpandedCounter&&e.node.$subMatchBadge&&e.node.$subMatchBadge.show(),this._superApply(arguments)},nodeRenderStatus:function(t){var n,i=t.node,r=t.tree,o=t.options.filter,s=e(i.span).find("span.fancytree-title"),a=e(i[r.statusClassPropName]),l=t.options.enhanceTitle,d=t.options.escapeTitles;return n=this._super(t),a.length&&r.enableFilter?(a.toggleClass("fancytree-match",!!i.match).toggleClass("fancytree-submatch",!!i.subMatchCount).toggleClass("fancytree-hide",!(i.match||i.subMatchCount)),!o.counter||!i.subMatchCount||i.isExpanded()&&o.hideExpandedCounter?i.$subMatchBadge&&i.$subMatchBadge.hide():(i.$subMatchBadge||(i.$subMatchBadge=e("<span class='fancytree-childcounter'/>"),e("span.fancytree-icon, span.fancytree-custom-icon",i.span).append(i.$subMatchBadge)),i.$subMatchBadge.show().text(i.subMatchCount)),!i.span||i.isEditing&&i.isEditing.call(i)||(i.titleWithHighlight?s.html(i.titleWithHighlight):d?s.text(i.title):s.html(i.title),l&&l({type:"enhanceTitle"},{node:i,$title:s})),n):n}}),e.ui.fancytree}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";function t(t,n,i,r){var o=i.map,s=o[r],a=e(t),l=n+" "+(o._addClass||"");"string"==typeof s?a.attr("class",l+" "+s):s&&(s.text?t.textContent=""+s.text:s.html&&(t.innerHTML=s.html),a.attr("class",l+" "+(s.addClass||"")))}var n=e.ui.fancytree,i={awesome3:{_addClass:"",checkbox:"icon-check-empty",checkboxSelected:"icon-check",checkboxUnknown:"icon-check icon-muted",dragHelper:"icon-caret-right",dropMarker:"icon-caret-right",error:"icon-exclamation-sign",expanderClosed:"icon-caret-right",expanderLazy:"icon-angle-right",expanderOpen:"icon-caret-down",loading:"icon-refresh icon-spin",nodata:"icon-meh",noExpander:"",radio:"icon-circle-blank",radioSelected:"icon-circle",doc:"icon-file-alt",docOpen:"icon-file-alt",folder:"icon-folder-close-alt",folderOpen:"icon-folder-open-alt"},awesome4:{_addClass:"fa",checkbox:"fa-square-o",checkboxSelected:"fa-check-square-o",checkboxUnknown:"fa-square fancytree-helper-indeterminate-cb",dragHelper:"fa-arrow-right",dropMarker:"fa-long-arrow-right",error:"fa-warning",expanderClosed:"fa-caret-right",expanderLazy:"fa-angle-right",expanderOpen:"fa-caret-down",loading:{html:"<span class='fa fa-spinner fa-pulse' />"},nodata:"fa-meh-o",noExpander:"",radio:"fa-circle-thin",radioSelected:"fa-circle",doc:"fa-file-o",docOpen:"fa-file-o",folder:"fa-folder-o",folderOpen:"fa-folder-open-o"},awesome5:{_addClass:"",checkbox:"far fa-square",checkboxSelected:"far fa-check-square",checkboxUnknown:"fas fa-square fancytree-helper-indeterminate-cb",radio:"far fa-circle",radioSelected:"fas fa-circle",radioUnknown:"far fa-dot-circle",dragHelper:"fas fa-arrow-right",dropMarker:"fas fa-long-arrow-right",error:"fas fa-exclamation-triangle",expanderClosed:"fas fa-caret-right",expanderLazy:"fas fa-angle-right",expanderOpen:"fas fa-caret-down",loading:"fas fa-spinner fa-pulse",nodata:"far fa-meh",noExpander:"",doc:"far fa-file",docOpen:"far fa-file",folder:"far fa-folder",folderOpen:"far fa-folder-open"},bootstrap3:{_addClass:"glyphicon",checkbox:"glyphicon-unchecked",checkboxSelected:"glyphicon-check",checkboxUnknown:"glyphicon-expand fancytree-helper-indeterminate-cb",dragHelper:"glyphicon-play",dropMarker:"glyphicon-arrow-right",error:"glyphicon-warning-sign",expanderClosed:"glyphicon-menu-right",expanderLazy:"glyphicon-menu-right",expanderOpen:"glyphicon-menu-down",loading:"glyphicon-refresh fancytree-helper-spin",nodata:"glyphicon-info-sign",noExpander:"",radio:"glyphicon-remove-circle",radioSelected:"glyphicon-ok-circle",doc:"glyphicon-file",docOpen:"glyphicon-file",folder:"glyphicon-folder-close",folderOpen:"glyphicon-folder-open"},material:{_addClass:"material-icons",checkbox:{text:"check_box_outline_blank"},checkboxSelected:{text:"check_box"},checkboxUnknown:{text:"indeterminate_check_box"},dragHelper:{text:"play_arrow"},dropMarker:{text:"arrow-forward"},error:{text:"warning"},expanderClosed:{text:"chevron_right"},expanderLazy:{text:"last_page"},expanderOpen:{text:"expand_more"},loading:{text:"autorenew",addClass:"fancytree-helper-spin"},nodata:{text:"info"},noExpander:{text:""},radio:{text:"radio_button_unchecked"},radioSelected:{text:"radio_button_checked"},doc:{text:"insert_drive_file"},docOpen:{text:"insert_drive_file"},folder:{text:"folder"},folderOpen:{text:"folder_open"}}};return e.ui.fancytree.registerExtension({name:"glyph",version:"2.29.0",options:{preset:null,map:{}},treeInit:function(t){var r=t.tree,o=t.options.glyph;o.preset?(n.assert(!!i[o.preset],"Invalid value for `options.glyph.preset`: "+o.preset),o.map=e.extend({},i[o.preset],o.map)):r.warn("ext-glyph: missing `preset` option."),this._superApply(arguments),r.$container.addClass("fancytree-ext-glyph")},nodeRenderStatus:function(i){var r,o,s,a=i.node,l=e(a.span),d=i.options.glyph;return o=this._super(i),a.isRoot()?o:((s=l.children("span.fancytree-expander").get(0))&&t(s,"fancytree-expander",d,a.expanded&&a.hasChildren()?"expanderOpen":a.isUndefined()?"expanderLazy":a.hasChildren()?"expanderClosed":"noExpander"),(s=a.tr?e("td",a.tr).find("span.fancytree-checkbox").get(0):l.children("span.fancytree-checkbox").get(0))&&(r=n.evalOption("checkbox",a,a,d,!1),a.parent&&a.parent.radiogroup||"radio"===r?t(s,"fancytree-checkbox fancytree-radio",d,a.selected?"radioSelected":"radio"):t(s,"fancytree-checkbox",d,a.selected?"checkboxSelected":a.partsel?"checkboxUnknown":"checkbox")),(s=l.children("span.fancytree-icon").get(0))&&t(s,"fancytree-icon",d,a.statusNodeType?a.statusNodeType:a.folder?a.expanded&&a.hasChildren()?"folderOpen":"folder":a.expanded?"docOpen":"doc"),o)},nodeSetStatus:function(n,i,r,o){var s,a,l=n.options.glyph,d=n.node;return s=this._superApply(arguments),"error"!==i&&"loading"!==i&&"nodata"!==i||(d.parent?(a=e("span.fancytree-expander",d.span).get(0))&&t(a,"fancytree-expander",l,i):(a=e(".fancytree-statusnode-"+i,d[this.nodeContainerAttrName]).find("span.fancytree-icon").get(0))&&t(a,"fancytree-icon",l,i)),s}}),e.ui.fancytree}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree","./jquery.fancytree.table"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree.table"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";function t(t,n){var i,r=null,o=0;return t.children().each(function(){if(o>=n)return r=e(this),!1;i=e(this).prop("colspan"),o+=i||1}),r}function n(n,r){var o,s,a=n.closest("td"),l=null;switch(r){case i.LEFT:l=a.prev();break;case i.RIGHT:l=a.next();break;case i.UP:case i.DOWN:for(s=function(t,n){var i,r=n.get(0),o=0;return t.children().each(function(){if(this===r)return!1;i=e(this).prop("colspan"),o+=i||1}),o}(o=a.parent(),a);(o=r===i.UP?o.prev():o.next()).length&&(o.is(":hidden")||!(l=t(o,s))||!l.find(":input,a").length););}return l}var i=e.ui.keyCode,r={text:[i.UP,i.DOWN],checkbox:[i.UP,i.DOWN,i.LEFT,i.RIGHT],link:[i.UP,i.DOWN,i.LEFT,i.RIGHT],radiobutton:[i.UP,i.DOWN,i.LEFT,i.RIGHT],"select-one":[i.LEFT,i.RIGHT],"select-multiple":[i.LEFT,i.RIGHT]};return e.ui.fancytree.registerExtension({name:"gridnav",version:"2.29.0",options:{autofocusInput:!1,handleCursorKeys:!0},treeInit:function(t){this._requireExtension("table",!0,!0),this._superApply(arguments),this.$container.addClass("fancytree-ext-gridnav"),this.$container.on("focusin",function(n){var i,r=e.ui.fancytree.getNode(n.target);r&&!r.isActive()&&(i=t.tree._makeHookContext(r,n),t.tree._callHook("nodeSetActive",i,!0))})},nodeSetActive:function(t,n,i){var r=t.options.gridnav,o=t.node,s=t.originalEvent||{},a=e(s.target).is(":input");n=!1!==n,this._superApply(arguments),n&&(t.options.titlesTabbable?(a||(e(o.span).find("span.fancytree-title").focus(),o.setFocus()),t.tree.$container.attr("tabindex","-1")):r.autofocusInput&&!a&&e(o.tr||o.span).find(":input:enabled:first").focus())},nodeKeydown:function(t){var i,o,s,a=t.options.gridnav,l=t.originalEvent,d=e(l.target);return d.is(":input:enabled")?i=d.prop("type"):d.is("a")&&(i="link"),i&&a.handleCursorKeys?!((o=r[i])&&e.inArray(l.which,o)>=0&&(s=n(d,l.which))&&s.length&&(s.find(":input:enabled,a").focus(),1)):this._superApply(arguments)}}),e.ui.fancytree}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";function t(n,i,r,o,a){var l,d,c,u,h=!1,f=n.options.persist.expandOpts,p=[],g=[];for(r=r||[],a=a||e.Deferred(),l=0,c=r.length;l<c;l++)d=r[l],(u=n.getNodeByKey(d))?o&&u.isUndefined()?(h=!0,n.debug("_loadLazyNodes: "+u+" is lazy: loading..."),"expand"===o?p.push(u.setExpanded(!0,f)):p.push(u.load())):(n.debug("_loadLazyNodes: "+u+" already loaded."),u.setExpanded(!0,f)):(g.push(d),n.debug("_loadLazyNodes: "+u+" was not yet found."));return e.when.apply(e,p).always(function(){if(h&&g.length>0)t(n,i,g,o,a);else{if(g.length)for(n.warn("_loadLazyNodes: could not load those keys: ",g),l=0,c=g.length;l<c;l++)d=r[l],i._appendKey(s,r[l],!1);a.resolve()}}),a}var n=null,i=window.localStorage?{get:function(e){return window.localStorage.getItem(e)},set:function(e,t){window.localStorage.setItem(e,t)},remove:function(e){window.localStorage.removeItem(e)}}:null,r=window.sessionStorage?{get:function(e){return window.sessionStorage.getItem(e)},set:function(e,t){window.sessionStorage.setItem(e,t)},remove:function(e){window.sessionStorage.removeItem(e)}}:null,o=e.ui.fancytree.assert,s="expanded",a="selected";return"function"==typeof Cookies?n={get:Cookies.get,set:function(e,t){Cookies.set(e,t,this.options.persist.cookie)},remove:Cookies.remove}:e&&"function"==typeof e.cookie&&(n={get:e.cookie,set:function(t,n){e.cookie.set(t,n,this.options.persist.cookie)},remove:e.removeCookie}),e.ui.fancytree._FancytreeClass.prototype.clearPersistData=function(e){var t=this.ext.persist,n=t.cookiePrefix;(e=e||"active expanded focus selected").indexOf("active")>=0&&t._data(n+"active",null),e.indexOf(s)>=0&&t._data(n+s,null),e.indexOf("focus")>=0&&t._data(n+"focus",null),e.indexOf(a)>=0&&t._data(n+a,null)},e.ui.fancytree._FancytreeClass.prototype.clearCookies=function(e){return this.warn("'tree.clearCookies()' is deprecated since v2.27.0: use 'clearPersistData()' instead."),this.clearPersistData(e)},e.ui.fancytree._FancytreeClass.prototype.getPersistData=function(){var e=this.ext.persist,t=e.cookiePrefix,n=e.cookieDelimiter,i={};return i.active=e._data(t+"active"),i[s]=(e._data(t+s)||"").split(n),i[a]=(e._data(t+a)||"").split(n),i.focus=e._data(t+"focus"),i},e.ui.fancytree.registerExtension({name:"persist",version:"2.29.0",options:{cookieDelimiter:"~",cookiePrefix:void 0,cookie:{raw:!1,expires:"",path:"",domain:"",secure:!1},expandLazy:!1,expandOpts:void 0,fireActivate:!0,overrideSource:!0,store:"auto",types:"active expanded focus selected"},_data:function(e,t){var n=this._local.store;if(void 0===t)return n.get.call(this,e);null===t?n.remove.call(this,e):n.set.call(this,e,t)},_appendKey:function(t,n,i){n=""+n;var r=this._local,o=this.options.persist.cookieDelimiter,s=r.cookiePrefix+t,a=r._data(s),l=a?a.split(o):[],d=e.inArray(n,l);d>=0&&l.splice(d,1),i&&l.push(n),r._data(s,l.join(o))},treeInit:function(l){var d=l.tree,c=l.options,u=this._local,h=this.options.persist;return u.cookiePrefix=h.cookiePrefix||"fancytree-"+d._id+"-",u.storeActive=h.types.indexOf("active")>=0,u.storeExpanded=h.types.indexOf(s)>=0,u.storeSelected=h.types.indexOf(a)>=0,u.storeFocus=h.types.indexOf("focus")>=0,u.store=null,"auto"===h.store&&(h.store=i?"local":"cookie"),e.isPlainObject(h.store)?u.store=h.store:"cookie"===h.store?u.store=n:"local"===h.store?u.store="local"===h.store?i:r:"session"===h.store&&(u.store="local"===h.store?i:r),o(u.store,"Need a valid store."),d.$div.on("fancytreeinit",function(n){if(!1!==d._triggerTreeEvent("beforeRestore",null,{})){var i,r,o,l,f=u._data(u.cookiePrefix+"focus"),p=!1===h.fireActivate;i=u._data(u.cookiePrefix+s),o=i&&i.split(h.cookieDelimiter),(u.storeExpanded?t(d,u,o,!!h.expandLazy&&"expand",null):(new e.Deferred).resolve()).done(function(){if(u.storeSelected){if(i=u._data(u.cookiePrefix+a))for(o=i.split(h.cookieDelimiter),r=0;r<o.length;r++)(l=d.getNodeByKey(o[r]))?(void 0===l.selected||h.overrideSource&&!1===l.selected)&&(l.selected=!0,l.renderStatus()):u._appendKey(a,o[r],!1);3===d.options.selectMode&&d.visit(function(e){if(e.selected)return e.fixSelection3AfterClick(),"skip"})}u.storeActive&&(!(i=u._data(u.cookiePrefix+"active"))||!c.persist.overrideSource&&d.activeNode||(l=d.getNodeByKey(i))&&(l.debug("persist: set active",i),l.setActive(!0,{noFocus:!0,noEvents:p}))),u.storeFocus&&f&&(l=d.getNodeByKey(f))&&(d.options.titlesTabbable?e(l.span).find(".fancytree-title").focus():e(d.$container).focus()),d._triggerTreeEvent("restore",null,{})})}}),this._superApply(arguments)},nodeSetActive:function(e,t,n){var i,r=this._local;return t=!1!==t,i=this._superApply(arguments),r.storeActive&&r._data(r.cookiePrefix+"active",this.activeNode?this.activeNode.key:null),i},nodeSetExpanded:function(e,t,n){var i,r=e.node,o=this._local;return t=!1!==t,i=this._superApply(arguments),o.storeExpanded&&o._appendKey(s,r.key,t),i},nodeSetFocus:function(e,t){var n,i=this._local;return t=!1!==t,n=this._superApply(arguments),i.storeFocus&&i._data(i.cookiePrefix+"focus",this.focusNode?this.focusNode.key:null),n},nodeSetSelected:function(t,n,i){var r,o,s=t.tree,l=t.node,d=this._local;return n=!1!==n,r=this._superApply(arguments),d.storeSelected&&(3===s.options.selectMode?(o=(o=e.map(s.getSelectedNodes(!0),function(e){return e.key})).join(t.options.persist.cookieDelimiter),d._data(d.cookiePrefix+a,o)):d._appendKey(a,l.key,l.selected)),r}}),e.ui.fancytree}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";function t(t,n){n=n||"",t||e.error("Assertion failed "+n)}function n(e,t){e.visit(function(e){var n=e.tr;if(n&&(n.style.display=e.hide||!t?"none":""),!e.expanded)return"skip"})}return e.ui.fancytree.registerExtension({name:"table",version:"2.29.0",options:{checkboxColumnIdx:null,indentation:16,nodeColumnIdx:0},treeInit:function(n){var i,r,o,s,a,l=n.tree,d=n.options,c=d.table,u=l.widget.element;if(null!=c.customStatus&&(null!=d.renderStatusColumns?e.error("The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' only instead."):(l.warn("The 'customStatus' option is deprecated since v2.15.0. Use 'renderStatusColumns' instead."),d.renderStatusColumns=c.customStatus)),d.renderStatusColumns&&!0===d.renderStatusColumns&&(d.renderStatusColumns=d.renderColumns),u.addClass("fancytree-container fancytree-ext-table"),(a=u.find(">tbody")).length||(u.find(">tr").length&&e.error("Expected table > tbody > tr. If you see this please open an issue."),a=e("<tbody>").appendTo(u)),l.tbody=a[0],r=e("thead >tr:last >th",u).length,(s=a.children("tr:first")).length)o=s.children("td").length,r&&o!==r&&(l.warn("Column count mismatch between thead ("+r+") and tbody ("+o+"): using tbody."),r=o),s=s.clone();else for(t(r>=1,"Need either <thead> or <tbody> with <td> elements to determine column count."),s=e("<tr />"),i=0;i<r;i++)s.append("<td />");s.find(">td").eq(c.nodeColumnIdx).html("<span class='fancytree-node' />"),d.aria&&(s.attr("role","row"),s.find("td").attr("role","gridcell")),l.rowFragment=document.createDocumentFragment(),l.rowFragment.appendChild(s.get(0)),a.empty(),l.statusClassPropName="tr",l.ariaPropName="tr",this.nodeContainerAttrName="tr",l.$container=u,this._superApply(arguments),e(l.rootNode.ul).remove(),l.rootNode.ul=null,this.$container.attr("tabindex",d.tabindex),d.aria&&l.$container.attr("role","treegrid").attr("aria-readonly",!0)},nodeRemoveChildMarkup:function(t){t.node.visit(function(t){t.tr&&(e(t.tr).remove(),t.tr=null)})},nodeRemoveMarkup:function(t){var n=t.node;n.tr&&(e(n.tr).remove(),n.tr=null),this.nodeRemoveChildMarkup(t)},nodeRender:function(i,r,o,s,a){var l,d,c,u,h,f,p,g,y=i.tree,v=i.node,m=i.options,x=!v.parent;if(!1!==y._enableUpdate){if(a||(i.hasCollapsedParents=v.parent&&!v.parent.expanded),!x)if(v.tr&&r&&this.nodeRemoveMarkup(i),v.tr)r?this.nodeRenderTitle(i):this.nodeRenderStatus(i);else{if(i.hasCollapsedParents&&!o)return;h=y.rowFragment.firstChild.cloneNode(!0),t(f=function(n){var i,r,o=n.parent,s=o?o.children:null;if(s&&s.length>1&&s[0]!==n)for(t((r=s[e.inArray(n,s)-1]).tr);r.children&&r.children.length&&(i=r.children[r.children.length-1]).tr;)r=i;else r=o;return r}(v)),!0===s&&a?h.style.display="none":o&&i.hasCollapsedParents&&(h.style.display="none"),f.tr?function(e,t){e.parentNode.insertBefore(t,e.nextSibling)}(f.tr,h):(t(!f.parent,"prev. row must have a tr, or be system root"),function(e,t){e.insertBefore(t,e.firstChild)}(y.tbody,h)),v.tr=h,v.key&&m.generateIds&&(v.tr.id=m.idPrefix+v.key),v.tr.ftnode=v,v.span=e("span.fancytree-node",v.tr).get(0),this.nodeRenderTitle(i),m.createNode&&m.createNode.call(y,{type:"createNode"},i)}if(m.renderNode&&m.renderNode.call(y,{type:"renderNode"},i),(l=v.children)&&(x||o||v.expanded))for(c=0,u=l.length;c<u;c++)(g=e.extend({},i,{node:l[c]})).hasCollapsedParents=g.hasCollapsedParents||!v.expanded,this.nodeRender(g,r,o,s,!0);l&&!a&&(p=v.tr||null,d=y.tbody.firstChild,v.visit(function(e){if(e.tr){if(e.parent.expanded||"none"===e.tr.style.display||(e.tr.style.display="none",n(e,!1)),e.tr.previousSibling!==p){v.debug("_fixOrder: mismatch at node: "+e);var t=p?p.nextSibling:d;y.tbody.insertBefore(e.tr,t)}p=e.tr}}))}},nodeRenderTitle:function(t,n){var i,r,o=t.node,s=t.options,a=o.isStatusNode();return r=this._super(t,n),o.isRootNode()?r:(s.checkbox&&!a&&null!=s.table.checkboxColumnIdx&&(i=e("span.fancytree-checkbox",o.span),e(o.tr).find("td").eq(+s.table.checkboxColumnIdx).html(i)),this.nodeRenderStatus(t),a?s.renderStatusColumns&&s.renderStatusColumns.call(t.tree,{type:"renderStatusColumns"},t):s.renderColumns&&s.renderColumns.call(t.tree,{type:"renderColumns"},t),r)},nodeRenderStatus:function(t){var n,i=t.node,r=t.options;this._super(t),e(i.tr).removeClass("fancytree-node"),n=(i.getLevel()-1)*r.table.indentation,r.rtl?e(i.span).css({paddingRight:n+"px"}):e(i.span).css({paddingLeft:n+"px"})},nodeSetExpanded:function(t,i,r){function o(e){n(t.node,i),e?i&&t.options.autoScroll&&!r.noAnimation&&t.node.hasChildren()?t.node.getLastChild().scrollIntoView(!0,{topNode:t.node}).always(function(){r.noEvents||t.tree._triggerNodeEvent(i?"expand":"collapse",t),s.resolveWith(t.node)}):(r.noEvents||t.tree._triggerNodeEvent(i?"expand":"collapse",t),s.resolveWith(t.node)):(r.noEvents||t.tree._triggerNodeEvent(i?"expand":"collapse",t),s.rejectWith(t.node))}if(i=!1!==i,t.node.expanded&&i||!t.node.expanded&&!i)return this._superApply(arguments);var s=new e.Deferred,a=e.extend({},r,{noEvents:!0,noAnimation:!0});return r=r||{},this._super(t,i,a).done(function(){o(!0)}).fail(function(){o(!1)}),s.promise()},nodeSetStatus:function(t,n,i,r){if("ok"===n){var o=t.node,s=o.children?o.children[0]:null;s&&s.isStatusNode()&&e(s.tr).remove()}return this._superApply(arguments)},treeClear:function(e){return this.nodeRemoveChildMarkup(this._makeHookContext(this.rootNode)),this._superApply(arguments)},treeDestroy:function(e){return this.$container.find("tbody").empty(),this.$source&&this.$source.removeClass("fancytree-helper-hidden"),this._superApply(arguments)}}),e.ui.fancytree}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";return e.ui.fancytree.registerExtension({name:"themeroller",version:"2.29.0",options:{activeClass:"ui-state-active",addClass:"ui-corner-all",focusClass:"ui-state-focus",hoverClass:"ui-state-hover",selectedClass:"ui-state-highlight"},treeInit:function(t){var n=t.widget.element,i=t.options.themeroller;this._superApply(arguments),"TABLE"===n[0].nodeName?(n.addClass("ui-widget ui-corner-all"),n.find(">thead tr").addClass("ui-widget-header"),n.find(">tbody").addClass("ui-widget-conent")):n.addClass("ui-widget ui-widget-content ui-corner-all"),n.delegate(".fancytree-node","mouseenter mouseleave",function(t){var n=e.ui.fancytree.getNode(t.target),r="mouseenter"===t.type;e(n.tr?n.tr:n.span).toggleClass(i.hoverClass+" "+i.addClass,r)})},treeDestroy:function(e){this._superApply(arguments),e.widget.element.removeClass("ui-widget ui-widget-content ui-corner-all")},nodeRenderStatus:function(t){var n={},i=t.node,r=e(i.tr?i.tr:i.span),o=t.options.themeroller;this._super(t),n[o.activeClass]=!1,n[o.focusClass]=!1,n[o.selectedClass]=!1,i.isActive()&&(n[o.activeClass]=!0),i.hasFocus()&&(n[o.focusClass]=!0),i.isSelected()&&!i.isActive()&&(n[o.selectedClass]=!0),r.toggleClass(o.activeClass,n[o.activeClass]),r.toggleClass(o.focusClass,n[o.focusClass]),r.toggleClass(o.selectedClass,n[o.selectedClass]),r.addClass(o.addClass)}}),e.ui.fancytree}),function(e){"function"==typeof define&&define.amd?define(["jquery","./jquery.fancytree"],e):"object"==typeof module&&module.exports?(require("./jquery.fancytree"),module.exports=e(require("jquery"))):e(jQuery)}(function(e){"use strict";function t(t,n){var i=e("#"+(t="fancytree-style-"+t));if(!n)return i.remove(),null;i.length||(i=e("<style />").attr("id",t).addClass("fancytree-style").prop("type","text/css").appendTo("head"));try{i.html(n)}catch(e){i[0].styleSheet.cssText=n}return i}function n(e,t,n,i,r,o){var s,a="#"+e+" span.fancytree-level-",l=[];for(s=0;s<t;s++)l.push(a+(s+1)+" span.fancytree-title { padding-left: "+(s*n+i)+o+"; }");return l.push("#"+e+" div.ui-effects-wrapper ul li span.fancytree-title, #"+e+" li.fancytree-animating span.fancytree-title { padding-left: "+r+o+"; position: static; width: auto; }"),l.join("\n")}var i=/^([+-]?(?:\d+|\d*\.\d+))([a-z]*|%)$/;return e.ui.fancytree.registerExtension({name:"wide",version:"2.29.0",options:{iconWidth:null,iconSpacing:null,labelSpacing:null,levelOfs:null},treeCreate:function(r){this._superApply(arguments),this.$container.addClass("fancytree-ext-wide");var o,s,a,l,d,c=r.options.wide,u=e("<li id='fancytreeTemp'><span class='fancytree-node'><span class='fancytree-icon' /><span class='fancytree-title' /></span><ul />").appendTo(r.tree.$container),h=u.find(".fancytree-icon"),f=u.find("ul"),p=c.iconSpacing||h.css("margin-left"),g=c.iconWidth||h.css("width"),y=c.labelSpacing||"3px",v=c.levelOfs||f.css("padding-left");u.remove(),s=p.match(i)[2],p=parseFloat(p,10),a=y.match(i)[2],y=parseFloat(y,10),l=g.match(i)[2],g=parseFloat(g,10),d=v.match(i)[2],s===l&&d===l&&a===l||e.error("iconWidth, iconSpacing, and levelOfs must have the same css measure unit"),this._local.measureUnit=l,this._local.levelOfs=parseFloat(v),this._local.lineOfs=(1+(r.options.checkbox?1:0)+(!1===r.options.icon?0:1))*(g+p)+p,this._local.labelOfs=y,this._local.maxDepth=10,t(o=this.$container.uniqueId().attr("id"),n(o,this._local.maxDepth,this._local.levelOfs,this._local.lineOfs,this._local.labelOfs,this._local.measureUnit))},treeDestroy:function(e){return t(this.$container.attr("id"),null),this._superApply(arguments)},nodeRenderStatus:function(i){var r,o,s=i.node,a=s.getLevel();return o=this._super(i),a>this._local.maxDepth&&(r=this.$container.attr("id"),this._local.maxDepth*=2,s.debug("Define global ext-wide css up to level "+this._local.maxDepth),t(r,n(r,this._local.maxDepth,this._local.levelOfs,this._local.lineOfs,this._local.labelSpacing,this._local.measureUnit))),e(s.span).addClass("fancytree-level-"+a),o}}),e.ui.fancytree}),e.ui.fancytree});
//# sourceMappingURL=jquery.fancytree-all-deps.min.js.map
|
import request, { api } from '@/utils/request';
export function getCompaniesUser(params) {
return request({
url: '/users/',
method: 'get',
params
});
}
export function putCompanyUserInfo(data) {
return request({
url: '/users/' + data.id + '/',
method: 'put',
data
});
}
export function postCompanyUser(data) {
return request({
url: '/users/',
method: 'post',
data
});
}
//缺少删除
export function deleteCompanyUser(data) {
return request({
url: '/users/' + data.id + '/',
method: 'delete'
});
}
//不可用
export function putUserPwd(data) {
return request({
url: `/users/${data.id}/passwords/`,
method: 'put',
data
});
}
export function getCategories(params) {
return request({
url: '/categories/',
method: 'get',
params
});
}
export function postCategories(data) {
return request({
url: '/categories/',
method: 'post',
data
});
}
export function putCateById(data) {
return request({
url: `/categories/${data.id}/`,
method: 'put',
data
});
}
export function getNewsListByCateId(id, page) {
return request({
url: `/categories/${id}/news/`,
method: 'get',
params: { page }
});
}
export function getVideoToken() {
return api.instance({
url: `/qiniu/tokens/`,
method: 'get'
});
}
export function postCategoriesNews(cateId, data) {
return request({
url: `/categories/${cateId}/news/`,
method: 'post',
data
});
}
export function deleteNews(cateId, newId) {
return request({
url: `/categories/${cateId}/news/${newId}/`,
method: 'delete'
});
}
export function deleteCate(cateId) {
return request({
url: `/categories/${cateId}/`,
method: 'delete'
});
}
export function modifyNews(cateId, data) {
return request({
url: `/categories/${cateId}/news/${data.id}/`,
method: 'put',
data
});
}
export function getActivities({ page }) {
return request({
url: '/activities/',
method: 'get',
params: { page }
});
}
export function postActivities(data) {
return request({
url: '/activities/',
method: 'post',
data
});
}
export function putActivities(data) {
return request({
url: `/activities/${data.id}/`,
method: 'put',
data
});
}
export function deleteActivities(id) {
return request({
url: `/activities/${id}/`,
method: 'delete'
});
}
export function getQuestions(actId, page) {
return request({
url: `/activities/${actId}/questions/`,
method: 'get',
params: { page }
});
}
export function postQuestion(actId, data) {
return request({
url: `/activities/${actId}/questions/`,
method: 'post',
data
});
}
export function putQuestion(actId, data) {
return request({
url: `/activities/${actId}/questions/${data.id}/`,
method: 'put',
data
});
}
export function deleteQuestion(actId, id) {
return request({
url: `/activities/${actId}/questions/${id}/`,
method: 'delete'
});
}
export function getAds(page) {
return request({
url: `/content_categories/`,
method: 'get',
params: { page }
});
}
export function postAd(data) {
return request({
url: `/content_categories/`,
method: 'post',
data
});
}
export function deleteAd(id) {
return request({
url: `/content_categories/${id}/`,
method: 'delete'
});
}
export function putAd(data) {
return request({
url: `/content_categories/${data.id}/`,
method: 'put',
data
});
}
export function getCateAds(id, page) {
return request({
url: `/categories/${id}/contents/`,
method: 'get',
params: { page }
});
}
export function postCateAds(id, data) {
return request({
url: `/categories/${id}/contents/`,
method: 'post',
data
});
}
export function deleteCateAds(id, cid) {
return request({
url: `/categories/${id}/contents/${cid}/`,
method: 'delete'
});
}
export function putCateAds(id, data) {
return request({
url: `/categories/${id}/contents/${data.id}/`,
method: 'put',
data
});
}
export function getGoods(page) {
return request({
url: `/goods/`,
method: 'get',
params: { page }
});
}
export function postGoods(data) {
return request({
url: `/goods/`,
method: 'post',
data
});
}
export function putGoods(data) {
return request({
url: `/goods/${data.id}/`,
method: 'put',
data
});
}
export function deleteGoods(id) {
return request({
url: `/goods/${id}/`,
method: 'delete'
});
}
export function getGoodsImg(id, page) {
return request({
url: `/goods/${id}/images/`,
method: 'get',
params: { page }
});
}
export function deleteGoodsImg(id, imgId) {
return request({
url: `/goods/${id}/images/${imgId}/`,
method: 'delete'
});
}
export function postGoodsImg(id, data) {
return request({
url: `/goods/${id}/images/`,
method: 'post',
data
});
}
export function getOrders(params) {
return request({
url: `/orders/`,
method: 'get',
params
});
}
export function putOrders(data) {
return request({
url: `/orders/${data.id}/`,
method: 'put',
data
});
}
export function postLives(data) {
return request({
url: `/lives/`,
method: 'post',
data
});
}
export function getLives(params) {
return request({
url: `/lives/`,
method: 'get',
params
});
}
export function putLives(data) {
return request({
url: `/lives/${data.id}/`,
method: 'put',
data
});
}
export function deleteLives(id) {
return request({
url: `/lives/${id}/`,
method: 'delete'
});
}
|
/**
* Copyright 2009 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS-IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import("sqlbase.sqlobj");
function run() {
sqlobj.createTable('pro_beta_signups', {
id: sqlobj.getIdColspec(),
email: 'VARCHAR(256)',
activationCode: 'VARCHAR(128)',
isActivated: sqlobj.getBoolColspec(),
signupDate: sqlobj.getDateColspec(),
activationDate: sqlobj.getDateColspec()
});
}
|
'use strict';
angular.module('myApp.books.detail', ['ui.router', 'ngResource'])
.config(['$stateProvider', function($stateProvider) {
$stateProvider.state('book', {
url: '/books/detail/:bookId',
templateUrl: 'books/detail.html',
controller: 'booksDetailCtrl'
});
}])
.controller('booksDetailCtrl', [ '$scope', '$stateParams', 'Book', function($scope, $stateParams, Book) {
$scope.book = Book.get({bookId: $stateParams.bookId}, function(book) {
});
$scope.ensureImageLink = function(src) {
var default_src = '/resource/book.jpg';
if (src == "") {
src = default_src;
}
return src;
};
$scope.getSummary = function(text) {
return text.trunc(120);
};
String.prototype.trunc = String.prototype.trunc ||
function(n){
return (this.length > n) ? this.substr(0,n-1)+'...' : this;
};
}])
.factory('Book', ['$resource',
function($resource){
return $resource('/resource/:bookId.json', {}, {
query: {method:'GET', params:{bookId:'books'}, isArray:true}
});
}]);
|
import _ from 'lodash';
import { format as formatUrl, parse as parseUrl } from 'url';
import modules from 'ui/modules';
import Notifier from 'ui/notify/notifier';
import { UrlOverflowServiceProvider } from '../../error_url_overflow';
const URL_LIMIT_WARN_WITHIN = 1000;
module.exports = function (chrome, internals) {
chrome.getFirstPathSegment = _.noop;
chrome.getBreadcrumbs = _.noop;
chrome.setupAngular = function () {
let kibana = modules.get('kibana');
_.forOwn(chrome.getInjected(), function (val, name) {
kibana.value(name, val);
});
kibana
.value('kbnVersion', internals.version)
.value('buildNum', internals.buildNum)
.value('buildSha', internals.buildSha)
.value('serverName', internals.serverName)
.value('uiSettings', internals.uiSettings)
.value('sessionId', Date.now())
.value('chrome', chrome)
.value('esUrl', (function () {
let a = document.createElement('a');
a.href = chrome.addBasePath('/elasticsearch');
return a.href;
}()))
.config(chrome.$setupXsrfRequestInterceptor)
.run(($location, $rootScope, Private) => {
chrome.getFirstPathSegment = () => {
return $location.path().split('/')[1];
};
chrome.getBreadcrumbs = () => {
let path = $location.path();
let length = path.length - 1;
// trim trailing slash
if (path.charAt(length) === '/') {
length--;
}
return path.substr(1, length)
.replace(/_/g, ' ') // Present snake-cased breadcrumb names as individual words
.split('/');
};
const notify = new Notifier();
const urlOverflow = Private(UrlOverflowServiceProvider);
const check = (event) => {
if ($location.path() === '/error/url-overflow') return;
try {
if (urlOverflow.check($location.absUrl()) <= URL_LIMIT_WARN_WITHIN) {
notify.directive({
template: `
<p>
The URL has gotten big and may cause Kibana
to stop working. Please either enable the
<code>state:storeInSessionStorage</code>
option in the <a href="#/management/kibana/settings">advanced
settings</a> or simplify the onscreen visuals.
</p>
`
}, {
type: 'error',
actions: [{ text: 'close' }]
});
}
} catch (e) {
const { host, path, search, protocol } = parseUrl(window.location.href);
// rewrite the entire url to force the browser to reload and
// discard any potentially unstable state from before
window.location.href = formatUrl({ host, path, search, protocol, hash: '#/error/url-overflow' });
}
};
$rootScope.$on('$routeUpdate', check);
$rootScope.$on('$routeChangeStart', check);
});
require('../directives')(chrome, internals);
modules.link(kibana);
};
};
|
import { test } from 'mapbox-gl-js-test';
import { extend } from '../../../src/util/util';
import window from '../../../src/util/window';
import Map from '../../../src/ui/map';
import { createMap } from '../../util';
import LngLat from '../../../src/geo/lng_lat';
import Tile from '../../../src/source/tile';
import { OverscaledTileID } from '../../../src/source/tile_id';
import { Event, ErrorEvent } from '../../../src/util/evented';
import simulate from 'mapbox-gl-js-test/simulate_interaction';
import fixed from 'mapbox-gl-js-test/fixed';
const fixedNum = fixed.Num;
const fixedLngLat = fixed.LngLat;
function createStyleSource() {
return {
type: "geojson",
data: {
type: "FeatureCollection",
features: []
}
};
}
test('Map', (t) => {
t.beforeEach((callback) => {
window.useFakeXMLHttpRequest();
callback();
});
t.afterEach((callback) => {
window.restore();
callback();
});
t.test('constructor', (t) => {
const map = createMap(t, {interactive: true, style: null});
t.ok(map.getContainer());
t.equal(map.getStyle(), undefined);
t.ok(map.boxZoom.isEnabled());
t.ok(map.doubleClickZoom.isEnabled());
t.ok(map.dragPan.isEnabled());
t.ok(map.dragRotate.isEnabled());
t.ok(map.keyboard.isEnabled());
t.ok(map.scrollZoom.isEnabled());
t.ok(map.touchZoomRotate.isEnabled());
t.throws(() => {
new Map({
container: 'anElementIdWhichDoesNotExistInTheDocument'
});
}, new Error("Container 'anElementIdWhichDoesNotExistInTheDocument' not found"), 'throws on invalid map container id');
t.end();
});
t.test('disables handlers', (t) => {
t.test('disables all handlers', (t) => {
const map = createMap(t, {interactive: false});
t.notOk(map.boxZoom.isEnabled());
t.notOk(map.doubleClickZoom.isEnabled());
t.notOk(map.dragPan.isEnabled());
t.notOk(map.dragRotate.isEnabled());
t.notOk(map.keyboard.isEnabled());
t.notOk(map.scrollZoom.isEnabled());
t.notOk(map.touchZoomRotate.isEnabled());
t.end();
});
const handlerNames = [
'scrollZoom',
'boxZoom',
'dragRotate',
'dragPan',
'keyboard',
'doubleClickZoom',
'touchZoomRotate'
];
handlerNames.forEach((handlerName) => {
t.test(`disables "${handlerName}" handler`, (t) => {
const options = {};
options[handlerName] = false;
const map = createMap(t, options);
t.notOk(map[handlerName].isEnabled());
t.end();
});
});
t.end();
});
t.test('emits load event after a style is set', (t) => {
t.stub(Map.prototype, '_detectMissingCSS');
const map = new Map({ container: window.document.createElement('div') });
map.on('load', fail);
setTimeout(() => {
map.off('load', fail);
map.on('load', pass);
map.setStyle(createStyle());
}, 1);
function fail() { t.ok(false); }
function pass() { t.end(); }
});
t.test('#setStyle', (t) => {
t.test('returns self', (t) => {
t.stub(Map.prototype, '_detectMissingCSS');
const map = new Map({ container: window.document.createElement('div') });
t.equal(map.setStyle({
version: 8,
sources: {},
layers: []
}), map);
t.end();
});
t.test('sets up event forwarding', (t) => {
createMap(t, {}, (error, map) => {
t.error(error);
const events = [];
function recordEvent(event) { events.push(event.type); }
map.on('error', recordEvent);
map.on('data', recordEvent);
map.on('dataloading', recordEvent);
map.style.fire(new Event('error'));
map.style.fire(new Event('data'));
map.style.fire(new Event('dataloading'));
t.deepEqual(events, [
'error',
'data',
'dataloading',
]);
t.end();
});
});
t.test('fires *data and *dataloading events', (t) => {
createMap(t, {}, (error, map) => {
t.error(error);
const events = [];
function recordEvent(event) { events.push(event.type); }
map.on('styledata', recordEvent);
map.on('styledataloading', recordEvent);
map.on('sourcedata', recordEvent);
map.on('sourcedataloading', recordEvent);
map.on('tiledata', recordEvent);
map.on('tiledataloading', recordEvent);
map.style.fire(new Event('data', {dataType: 'style'}));
map.style.fire(new Event('dataloading', {dataType: 'style'}));
map.style.fire(new Event('data', {dataType: 'source'}));
map.style.fire(new Event('dataloading', {dataType: 'source'}));
map.style.fire(new Event('data', {dataType: 'tile'}));
map.style.fire(new Event('dataloading', {dataType: 'tile'}));
t.deepEqual(events, [
'styledata',
'styledataloading',
'sourcedata',
'sourcedataloading',
'tiledata',
'tiledataloading'
]);
t.end();
});
});
t.test('can be called more than once', (t) => {
const map = createMap(t);
map.setStyle({version: 8, sources: {}, layers: []}, {diff: false});
map.setStyle({version: 8, sources: {}, layers: []}, {diff: false});
t.end();
});
t.test('style transform overrides unmodified map transform', (t) => {
t.stub(Map.prototype, '_detectMissingCSS');
const map = new Map({container: window.document.createElement('div')});
map.transform.lngRange = [-120, 140];
map.transform.latRange = [-60, 80];
map.transform.resize(600, 400);
t.equal(map.transform.zoom, 0.6983039737971012, 'map transform is constrained');
t.ok(map.transform.unmodified, 'map transform is not modified');
map.setStyle(createStyle());
map.on('style.load', () => {
t.deepEqual(fixedLngLat(map.transform.center), fixedLngLat({ lng: -73.9749, lat: 40.7736 }));
t.equal(fixedNum(map.transform.zoom), 12.5);
t.equal(fixedNum(map.transform.bearing), 29);
t.equal(fixedNum(map.transform.pitch), 50);
t.end();
});
});
t.test('style transform does not override map transform modified via options', (t) => {
t.stub(Map.prototype, '_detectMissingCSS');
const map = new Map({container: window.document.createElement('div'), zoom: 10, center: [-77.0186, 38.8888]});
t.notOk(map.transform.unmodified, 'map transform is modified by options');
map.setStyle(createStyle());
map.on('style.load', () => {
t.deepEqual(fixedLngLat(map.transform.center), fixedLngLat({ lng: -77.0186, lat: 38.8888 }));
t.equal(fixedNum(map.transform.zoom), 10);
t.equal(fixedNum(map.transform.bearing), 0);
t.equal(fixedNum(map.transform.pitch), 0);
t.end();
});
});
t.test('style transform does not override map transform modified via setters', (t) => {
t.stub(Map.prototype, '_detectMissingCSS');
const map = new Map({container: window.document.createElement('div')});
t.ok(map.transform.unmodified);
map.setZoom(10);
map.setCenter([-77.0186, 38.8888]);
t.notOk(map.transform.unmodified, 'map transform is modified via setters');
map.setStyle(createStyle());
map.on('style.load', () => {
t.deepEqual(fixedLngLat(map.transform.center), fixedLngLat({ lng: -77.0186, lat: 38.8888 }));
t.equal(fixedNum(map.transform.zoom), 10);
t.equal(fixedNum(map.transform.bearing), 0);
t.equal(fixedNum(map.transform.pitch), 0);
t.end();
});
});
t.test('passing null removes style', (t) => {
const map = createMap(t);
const style = map.style;
t.ok(style);
t.spy(style, '_remove');
map.setStyle(null);
t.equal(style._remove.callCount, 1);
t.end();
});
t.end();
});
t.test('#is_Loaded', (t)=>{
t.test('Map#isSourceLoaded', (t) => {
const style = createStyle();
const map = createMap(t, {style: style});
map.on('load', () => {
map.on('data', (e) => {
if (e.dataType === 'source' && e.sourceDataType === 'metadata') {
t.equal(map.isSourceLoaded('geojson'), true, 'true when loaded');
t.end();
}
});
map.addSource('geojson', createStyleSource());
t.equal(map.isSourceLoaded('geojson'), false, 'false before loaded');
});
});
t.test('Map#isStyleLoaded', (t) => {
const style = createStyle();
const map = createMap(t, {style: style});
t.equal(map.isStyleLoaded(), false, 'false before style has loaded');
map.on('load', () => {
t.equal(map.isStyleLoaded(), true, 'true when style is loaded');
t.end();
});
});
t.test('Map#areTilesLoaded', (t) => {
const style = createStyle();
const map = createMap(t, {style: style});
t.equal(map.areTilesLoaded(), true, 'returns true if there are no sources on the map');
map.on('load', ()=>{
map.addSource('geojson', createStyleSource());
map.style.sourceCaches.geojson._tiles.fakeTile = new Tile(new OverscaledTileID(0, 0, 0, 0, 0));
t.equal(map.areTilesLoaded(), false, 'returns false if tiles are loading');
map.style.sourceCaches.geojson._tiles.fakeTile.state = 'loaded';
t.equal(map.areTilesLoaded(), true, 'returns true if tiles are loaded');
t.end();
});
});
t.end();
});
t.test('#getStyle', (t) => {
t.test('returns the style', (t) => {
const style = createStyle();
const map = createMap(t, {style: style});
map.on('load', () => {
t.deepEqual(map.getStyle(), style);
t.end();
});
});
t.test('returns the style with added sources', (t) => {
const style = createStyle();
const map = createMap(t, {style: style});
map.on('load', () => {
map.addSource('geojson', createStyleSource());
t.deepEqual(map.getStyle(), extend(createStyle(), {
sources: {geojson: createStyleSource()}
}));
t.end();
});
});
t.test('fires an error on checking if non-existant source is loaded', (t) => {
const style = createStyle();
const map = createMap(t, {style: style});
map.on('load', () => {
map.on('error', ({ error }) => {
t.match(error.message, /There is no source with ID/);
t.end();
});
map.isSourceLoaded('geojson');
});
});
t.test('returns the style with added layers', (t) => {
const style = createStyle();
const map = createMap(t, {style: style});
const layer = {
id: 'background',
type: 'background'
};
map.on('load', () => {
map.addLayer(layer);
t.deepEqual(map.getStyle(), extend(createStyle(), {
layers: [layer]
}));
t.end();
});
});
t.test('returns the style with added source and layer', (t) => {
const style = createStyle();
const map = createMap(t, {style: style});
const source = createStyleSource();
const layer = {
id: 'fill',
type: 'fill',
source: 'fill'
};
map.on('load', () => {
map.addSource('fill', source);
map.addLayer(layer);
t.deepEqual(map.getStyle(), extend(createStyle(), {
sources: { fill: source },
layers: [layer]
}));
t.end();
});
});
t.test('creates a new Style if diff fails', (t) => {
const style = createStyle();
const map = createMap(t, { style: style });
t.stub(map.style, 'setState').callsFake(() => {
throw new Error('Dummy error');
});
t.stub(console, 'warn');
const previousStyle = map.style;
map.setStyle(style);
t.ok(map.style && map.style !== previousStyle);
t.end();
});
t.test('creates a new Style if diff option is false', (t) => {
const style = createStyle();
const map = createMap(t, { style: style });
t.stub(map.style, 'setState').callsFake(() => {
t.fail();
});
const previousStyle = map.style;
map.setStyle(style, {diff: false});
t.ok(map.style && map.style !== previousStyle);
t.end();
});
t.end();
});
t.test('#moveLayer', (t) => {
const map = createMap(t, {
style: extend(createStyle(), {
sources: {
mapbox: {
type: 'vector',
minzoom: 1,
maxzoom: 10,
tiles: ['http://example.com/{z}/{x}/{y}.png']
}
},
layers: [{
id: 'layerId1',
type: 'circle',
source: 'mapbox',
'source-layer': 'sourceLayer'
}, {
id: 'layerId2',
type: 'circle',
source: 'mapbox',
'source-layer': 'sourceLayer'
}]
})
});
map.once('render', () => {
map.moveLayer('layerId1', 'layerId2');
t.equal(map.getLayer('layerId1').id, 'layerId1');
t.equal(map.getLayer('layerId2').id, 'layerId2');
t.end();
});
});
t.test('#getLayer', (t) => {
const layer = {
id: 'layerId',
type: 'circle',
source: 'mapbox',
'source-layer': 'sourceLayer'
};
const map = createMap(t, {
style: extend(createStyle(), {
sources: {
mapbox: {
type: 'vector',
minzoom: 1,
maxzoom: 10,
tiles: ['http://example.com/{z}/{x}/{y}.png']
}
},
layers: [layer]
})
});
map.once('render', () => {
const mapLayer = map.getLayer('layerId');
t.equal(mapLayer.id, layer.id);
t.equal(mapLayer.type, layer.type);
t.equal(mapLayer.source, layer.source);
t.end();
});
});
t.test('#resize', (t) => {
t.test('sets width and height from container offsets', (t) => {
const map = createMap(t),
container = map.getContainer();
Object.defineProperty(container, 'offsetWidth', {value: 250});
Object.defineProperty(container, 'offsetHeight', {value: 250});
map.resize();
t.equal(map.transform.width, 250);
t.equal(map.transform.height, 250);
t.end();
});
t.test('fires movestart, move, resize, and moveend events', (t) => {
const map = createMap(t),
events = [];
['movestart', 'move', 'resize', 'moveend'].forEach((event) => {
map.on(event, (e) => {
events.push(e.type);
});
});
map.resize();
t.deepEqual(events, ['movestart', 'move', 'resize', 'moveend']);
t.end();
});
t.test('listen to window resize event', (t) => {
window.addEventListener = function(type) {
if (type === 'resize') {
//restore empty function not to mess with other tests
window.addEventListener = function() {};
t.end();
}
};
createMap(t);
});
t.test('do not resize if trackResize is false', (t) => {
const map = createMap(t, {trackResize: false});
t.spy(map, 'stop');
t.spy(map, '_update');
t.spy(map, 'resize');
map._onWindowResize();
t.notOk(map.stop.called);
t.notOk(map._update.called);
t.notOk(map.resize.called);
t.end();
});
t.test('do resize if trackResize is true (default)', (t) => {
const map = createMap(t);
t.spy(map, '_update');
t.spy(map, 'resize');
map._onWindowResize();
t.ok(map._update.called);
t.ok(map.resize.called);
t.end();
});
t.end();
});
t.test('#getBounds', (t) => {
const map = createMap(t, { zoom: 0 });
t.deepEqual(parseFloat(map.getBounds().getCenter().lng.toFixed(10)), 0, 'getBounds');
t.deepEqual(parseFloat(map.getBounds().getCenter().lat.toFixed(10)), 0, 'getBounds');
t.deepEqual(toFixed(map.getBounds().toArray()), toFixed([
[ -70.31249999999976, -57.326521225216965 ],
[ 70.31249999999977, 57.32652122521695 ] ]));
t.test('rotated bounds', (t) => {
const map = createMap(t, { zoom: 1, bearing: 45, skipCSSStub: true });
t.deepEqual(
toFixed([[-49.718445552178764, -44.44541580601936], [49.7184455522, 44.445415806019355]]),
toFixed(map.getBounds().toArray())
);
map.setBearing(135);
t.deepEqual(
toFixed([[-49.718445552178764, -44.44541580601936], [49.7184455522, 44.445415806019355]]),
toFixed(map.getBounds().toArray())
);
t.end();
});
t.end();
function toFixed(bounds) {
const n = 10;
return [
[normalizeFixed(bounds[0][0], n), normalizeFixed(bounds[0][1], n)],
[normalizeFixed(bounds[1][0], n), normalizeFixed(bounds[1][1], n)]
];
}
function normalizeFixed(num, n) {
// workaround for "-0.0000000000" ≠ "0.0000000000"
return parseFloat(num.toFixed(n)).toFixed(n);
}
});
t.test('#setMaxBounds', (t) => {
t.test('constrains map bounds', (t) => {
const map = createMap(t, {zoom:0});
map.setMaxBounds([[-130.4297, 50.0642], [-61.52344, 24.20688]]);
t.deepEqual(
toFixed([[-130.4297000000, 7.0136641176], [-61.5234400000, 60.2398142283]]),
toFixed(map.getBounds().toArray())
);
t.end();
});
t.test('when no argument is passed, map bounds constraints are removed', (t) => {
const map = createMap(t, {zoom:0});
map.setMaxBounds([[-130.4297, 50.0642], [-61.52344, 24.20688]]);
t.deepEqual(
toFixed([[-166.28906999999964, -27.6835270554], [-25.664070000000066, 73.8248206697]]),
toFixed(map.setMaxBounds(null).setZoom(0).getBounds().toArray())
);
t.end();
});
t.test('should not zoom out farther than bounds', (t) => {
const map = createMap(t);
map.setMaxBounds([[-130.4297, 50.0642], [-61.52344, 24.20688]]);
t.notEqual(map.setZoom(0).getZoom(), 0);
t.end();
});
t.test('throws on invalid bounds', (t) => {
const map = createMap(t, {zoom:0});
t.throws(() => {
map.setMaxBounds([-130.4297, 50.0642], [-61.52344, 24.20688]);
}, Error, 'throws on two decoupled array coordinate arguments');
t.throws(() => {
map.setMaxBounds(-130.4297, 50.0642, -61.52344, 24.20688);
}, Error, 'throws on individual coordinate arguments');
t.end();
});
function toFixed(bounds) {
const n = 9;
return [
[bounds[0][0].toFixed(n), bounds[0][1].toFixed(n)],
[bounds[1][0].toFixed(n), bounds[1][1].toFixed(n)]
];
}
t.end();
});
t.test('#getMaxBounds', (t) => {
t.test('returns null when no bounds set', (t) => {
const map = createMap(t, {zoom:0});
t.equal(map.getMaxBounds(), null);
t.end();
});
t.test('returns bounds', (t) => {
const map = createMap(t, {zoom:0});
const bounds = [[-130.4297, 50.0642], [-61.52344, 24.20688]];
map.setMaxBounds(bounds);
t.deepEqual(map.getMaxBounds().toArray(), bounds);
t.end();
});
t.end();
});
t.test('#getRenderWorldCopies', (t) => {
t.test('initially false', (t) => {
const map = createMap(t, {renderWorldCopies: false});
t.equal(map.getRenderWorldCopies(), false);
t.end();
});
t.test('initially true', (t) => {
const map = createMap(t, {renderWorldCopies: true});
t.equal(map.getRenderWorldCopies(), true);
t.end();
});
t.end();
});
t.test('#setRenderWorldCopies', (t) => {
t.test('initially false', (t) => {
const map = createMap(t, {renderWorldCopies: false});
map.setRenderWorldCopies(true);
t.equal(map.getRenderWorldCopies(), true);
t.end();
});
t.test('initially true', (t) => {
const map = createMap(t, {renderWorldCopies: true});
map.setRenderWorldCopies(false);
t.equal(map.getRenderWorldCopies(), false);
t.end();
});
t.test('undefined', (t) => {
const map = createMap(t, {renderWorldCopies: false});
map.setRenderWorldCopies(undefined);
t.equal(map.getRenderWorldCopies(), true);
t.end();
});
t.test('null', (t) => {
const map = createMap(t, {renderWorldCopies: true});
map.setRenderWorldCopies(null);
t.equal(map.getRenderWorldCopies(), false);
t.end();
});
t.end();
});
t.test('#setMinZoom', (t) => {
const map = createMap(t, {zoom:5});
map.setMinZoom(3.5);
map.setZoom(1);
t.equal(map.getZoom(), 3.5);
t.end();
});
t.test('unset minZoom', (t) => {
const map = createMap(t, {minZoom:5});
map.setMinZoom(null);
map.setZoom(1);
t.equal(map.getZoom(), 1);
t.end();
});
t.test('#getMinZoom', (t) => {
const map = createMap(t, {zoom: 0});
t.equal(map.getMinZoom(), 0, 'returns default value');
map.setMinZoom(10);
t.equal(map.getMinZoom(), 10, 'returns custom value');
t.end();
});
t.test('ignore minZooms over maxZoom', (t) => {
const map = createMap(t, {zoom:2, maxZoom:5});
t.throws(() => {
map.setMinZoom(6);
});
map.setZoom(0);
t.equal(map.getZoom(), 0);
t.end();
});
t.test('#setMaxZoom', (t) => {
const map = createMap(t, {zoom:0});
map.setMaxZoom(3.5);
map.setZoom(4);
t.equal(map.getZoom(), 3.5);
t.end();
});
t.test('unset maxZoom', (t) => {
const map = createMap(t, {maxZoom:5});
map.setMaxZoom(null);
map.setZoom(6);
t.equal(map.getZoom(), 6);
t.end();
});
t.test('#getMaxZoom', (t) => {
const map = createMap(t, {zoom: 0});
t.equal(map.getMaxZoom(), 22, 'returns default value');
map.setMaxZoom(10);
t.equal(map.getMaxZoom(), 10, 'returns custom value');
t.end();
});
t.test('ignore maxZooms over minZoom', (t) => {
const map = createMap(t, {minZoom:5});
t.throws(() => {
map.setMaxZoom(4);
});
map.setZoom(5);
t.equal(map.getZoom(), 5);
t.end();
});
t.test('throw on maxZoom smaller than minZoom at init', (t) => {
t.throws(() => {
createMap(t, {minZoom:10, maxZoom:5});
}, new Error(`maxZoom must be greater than minZoom`));
t.end();
});
t.test('throw on maxZoom smaller than minZoom at init with falsey maxZoom', (t) => {
t.throws(() => {
createMap(t, {minZoom:1, maxZoom:0});
}, new Error(`maxZoom must be greater than minZoom`));
t.end();
});
t.test('#remove', (t) => {
const map = createMap(t);
t.equal(map.getContainer().childNodes.length, 3);
map.remove();
t.equal(map.getContainer().childNodes.length, 0);
t.end();
});
t.test('#remove calls onRemove on added controls', (t) => {
const map = createMap(t);
const control = {
onRemove: t.spy(),
onAdd: function (_) {
return window.document.createElement('div');
}
};
map.addControl(control);
map.remove();
t.ok(control.onRemove.calledOnce);
t.end();
});
t.test('#addControl', (t) => {
const map = createMap(t);
const control = {
onAdd: function(_) {
t.equal(map, _, 'addTo() called with map');
return window.document.createElement('div');
}
};
map.addControl(control);
t.equal(map._controls[1], control, "saves reference to added controls");
t.end();
});
t.test('#removeControl errors on invalid arguments', (t) => {
const map = createMap(t);
const control = {};
const stub = t.stub(console, 'error');
map.addControl(control);
map.removeControl(control);
t.ok(stub.calledTwice);
t.end();
});
t.test('#removeControl', (t) => {
const map = createMap(t);
const control = {
onAdd: function() {
return window.document.createElement('div');
},
onRemove: function(_) {
t.equal(map, _, 'onRemove() called with map');
}
};
map.addControl(control);
map.removeControl(control);
t.equal(map._controls.length, 1, "removes removed controls from map's control array");
t.end();
});
t.test('#project', (t) => {
const map = createMap(t);
t.deepEqual(map.project([0, 0]), { x: 100, y: 100 });
t.end();
});
t.test('#unproject', (t) => {
const map = createMap(t);
t.deepEqual(fixedLngLat(map.unproject([100, 100])), { lng: 0, lat: 0 });
t.end();
});
t.test('#listImages', (t) => {
const map = createMap(t);
map.on('load', () => {
t.equals(map.listImages().length, 0);
map.addImage('img', {width: 1, height: 1, data: new Uint8Array(4)});
const images = map.listImages();
t.equals(images.length, 1);
t.equals(images[0], 'img');
t.end();
});
});
t.test('#listImages throws an error if called before "load"', (t) => {
const map = createMap(t);
t.throws(() => {
map.listImages();
}, Error);
t.end();
});
t.test('#queryRenderedFeatures', (t) => {
t.test('if no arguments provided', (t) => {
createMap(t, {}, (err, map) => {
t.error(err);
t.spy(map.style, 'queryRenderedFeatures');
const output = map.queryRenderedFeatures();
const args = map.style.queryRenderedFeatures.getCall(0).args;
t.ok(args[0]);
t.deepEqual(args[1], {});
t.deepEqual(output, []);
t.end();
});
});
t.test('if only "geometry" provided', (t) => {
createMap(t, {}, (err, map) => {
t.error(err);
t.spy(map.style, 'queryRenderedFeatures');
const output = map.queryRenderedFeatures(map.project(new LngLat(0, 0)));
const args = map.style.queryRenderedFeatures.getCall(0).args;
t.deepEqual(args[0], [{ x: 100, y: 100 }]); // query geometry
t.deepEqual(args[1], {}); // params
t.deepEqual(args[2], map.transform); // transform
t.deepEqual(output, []);
t.end();
});
});
t.test('if only "params" provided', (t) => {
createMap(t, {}, (err, map) => {
t.error(err);
t.spy(map.style, 'queryRenderedFeatures');
const output = map.queryRenderedFeatures({filter: ['all']});
const args = map.style.queryRenderedFeatures.getCall(0).args;
t.ok(args[0]);
t.deepEqual(args[1], {filter: ['all']});
t.deepEqual(output, []);
t.end();
});
});
t.test('if both "geometry" and "params" provided', (t) => {
createMap(t, {}, (err, map) => {
t.error(err);
t.spy(map.style, 'queryRenderedFeatures');
const output = map.queryRenderedFeatures({filter: ['all']});
const args = map.style.queryRenderedFeatures.getCall(0).args;
t.ok(args[0]);
t.deepEqual(args[1], {filter: ['all']});
t.deepEqual(output, []);
t.end();
});
});
t.test('if "geometry" with unwrapped coords provided', (t) => {
createMap(t, {}, (err, map) => {
t.error(err);
t.spy(map.style, 'queryRenderedFeatures');
map.queryRenderedFeatures(map.project(new LngLat(360, 0)));
t.deepEqual(map.style.queryRenderedFeatures.getCall(0).args[0], [{x: 612, y: 100}]);
t.end();
});
});
t.test('returns an empty array when no style is loaded', (t) => {
const map = createMap(t, {style: undefined});
t.deepEqual(map.queryRenderedFeatures(), []);
t.end();
});
t.end();
});
t.test('#setLayoutProperty', (t) => {
t.test('sets property', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": []
}
}
},
"layers": [{
"id": "symbol",
"type": "symbol",
"source": "geojson",
"layout": {
"text-transform": "uppercase"
}
}]
}
});
map.on('style.load', () => {
map.style.dispatcher.broadcast = function(key, value) {
t.equal(key, 'updateLayers');
t.deepEqual(value.layers.map((layer) => { return layer.id; }), ['symbol']);
};
map.setLayoutProperty('symbol', 'text-transform', 'lowercase');
map.style.update({});
t.deepEqual(map.getLayoutProperty('symbol', 'text-transform'), 'lowercase');
t.end();
});
});
t.test('throw before loaded', (t) => {
const map = createMap(t, {
style: {
version: 8,
sources: {},
layers: []
}
});
t.throws(() => {
map.setLayoutProperty('symbol', 'text-transform', 'lowercase');
}, Error, /load/i);
t.end();
});
t.test('fires an error if layer not found', (t) => {
const map = createMap(t, {
style: {
version: 8,
sources: {},
layers: []
}
});
map.on('style.load', () => {
map.on('error', ({ error }) => {
t.match(error.message, /does not exist in the map\'s style and cannot be styled/);
t.end();
});
map.setLayoutProperty('non-existant', 'text-transform', 'lowercase');
});
});
t.test('fires a data event', (t) => {
// background layers do not have a source
const map = createMap(t, {
style: {
"version": 8,
"sources": {},
"layers": [{
"id": "background",
"type": "background",
"layout": {
"visibility": "none"
}
}]
}
});
map.once('style.load', () => {
map.once('data', (e) => {
if (e.dataType === 'style') {
t.end();
}
});
map.setLayoutProperty('background', 'visibility', 'visible');
});
});
t.test('sets visibility on background layer', (t) => {
// background layers do not have a source
const map = createMap(t, {
style: {
"version": 8,
"sources": {},
"layers": [{
"id": "background",
"type": "background",
"layout": {
"visibility": "none"
}
}]
}
});
map.on('style.load', () => {
map.setLayoutProperty('background', 'visibility', 'visible');
t.deepEqual(map.getLayoutProperty('background', 'visibility'), 'visible');
t.end();
});
});
t.test('sets visibility on raster layer', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {
"mapbox://mapbox.satellite": {
"type": "raster",
"tiles": ["http://example.com/{z}/{x}/{y}.png"]
}
},
"layers": [{
"id": "satellite",
"type": "raster",
"source": "mapbox://mapbox.satellite",
"layout": {
"visibility": "none"
}
}]
}
});
// Suppress errors because we're not loading tiles from a real URL.
map.on('error', () => {});
map.on('style.load', () => {
map.setLayoutProperty('satellite', 'visibility', 'visible');
t.deepEqual(map.getLayoutProperty('satellite', 'visibility'), 'visible');
t.end();
});
});
t.test('sets visibility on video layer', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {
"drone": {
"type": "video",
"urls": [],
"coordinates": [
[-122.51596391201019, 37.56238816766053],
[-122.51467645168304, 37.56410183312965],
[-122.51309394836426, 37.563391708549425],
[-122.51423120498657, 37.56161849366671]
]
}
},
"layers": [{
"id": "shore",
"type": "raster",
"source": "drone",
"layout": {
"visibility": "none"
}
}]
}
});
map.on('style.load', () => {
map.setLayoutProperty('shore', 'visibility', 'visible');
t.deepEqual(map.getLayoutProperty('shore', 'visibility'), 'visible');
t.end();
});
});
t.test('sets visibility on image layer', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {
"image": {
"type": "image",
"url": "",
"coordinates": [
[-122.51596391201019, 37.56238816766053],
[-122.51467645168304, 37.56410183312965],
[-122.51309394836426, 37.563391708549425],
[-122.51423120498657, 37.56161849366671]
]
}
},
"layers": [{
"id": "image",
"type": "raster",
"source": "image",
"layout": {
"visibility": "none"
}
}]
}
});
map.on('style.load', () => {
map.setLayoutProperty('image', 'visibility', 'visible');
t.deepEqual(map.getLayoutProperty('image', 'visibility'), 'visible');
t.end();
});
});
t.end();
});
t.test('#setPaintProperty', (t) => {
t.test('sets property', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {},
"layers": [{
"id": "background",
"type": "background"
}]
}
});
map.on('style.load', () => {
map.setPaintProperty('background', 'background-color', 'red');
t.deepEqual(map.getPaintProperty('background', 'background-color'), 'red');
t.end();
});
});
t.test('throw before loaded', (t) => {
const map = createMap(t, {
style: {
version: 8,
sources: {},
layers: []
}
});
t.throws(() => {
map.setPaintProperty('background', 'background-color', 'red');
}, Error, /load/i);
t.end();
});
t.test('fires an error if layer not found', (t) => {
const map = createMap(t, {
style: {
version: 8,
sources: {},
layers: []
}
});
map.on('style.load', () => {
map.on('error', ({ error }) => {
t.match(error.message, /does not exist in the map\'s style and cannot be styled/);
t.end();
});
map.setPaintProperty('non-existant', 'background-color', 'red');
});
});
t.end();
});
t.test('#setFeatureState', (t) => {
t.test('sets state', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {
"geojson": createStyleSource()
},
"layers": []
}
});
map.on('load', () => {
map.setFeatureState({ source: 'geojson', id: '12345'}, {'hover': true});
const fState = map.getFeatureState({ source: 'geojson', id: '12345'});
t.equal(fState.hover, true);
t.end();
});
});
t.test('throw before loaded', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {
"geojson": createStyleSource()
},
"layers": []
}
});
t.throws(() => {
map.setFeatureState({ source: 'geojson', id: '12345'}, {'hover': true});
}, Error, /load/i);
t.end();
});
t.test('fires an error if source not found', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {
"geojson": createStyleSource()
},
"layers": []
}
});
map.on('load', () => {
map.on('error', ({ error }) => {
t.match(error.message, /source/);
t.end();
});
map.setFeatureState({ source: 'vector', id: '12345'}, {'hover': true});
});
});
t.test('fires an error if sourceLayer not provided for a vector source', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {
"vector": {
"type": "vector",
"tiles": ["http://example.com/{z}/{x}/{y}.png"]
}
},
"layers": []
}
});
map.on('load', () => {
map.on('error', ({ error }) => {
t.match(error.message, /sourceLayer/);
t.end();
});
map.setFeatureState({ source: 'vector', sourceLayer: 0, id: '12345'}, {'hover': true});
});
});
t.test('fires an error if id not provided', (t) => {
const map = createMap(t, {
style: {
"version": 8,
"sources": {
"vector": {
"type": "vector",
"tiles": ["http://example.com/{z}/{x}/{y}.png"]
}
},
"layers": []
}
});
map.on('load', () => {
map.on('error', ({ error }) => {
t.match(error.message, /id/);
t.end();
});
map.setFeatureState({ source: 'vector', sourceLayer: "1"}, {'hover': true});
});
});
t.end();
});
t.test('error event', (t) => {
t.test('logs errors to console when it has NO listeners', (t) => {
const map = createMap(t);
const stub = t.stub(console, 'error');
const error = new Error('test');
map.fire(new ErrorEvent(error));
t.ok(stub.calledOnce);
t.equal(stub.getCall(0).args[0], error);
t.end();
});
t.test('calls listeners', (t) => {
const map = createMap(t);
const error = new Error('test');
map.on('error', (event) => {
t.equal(event.error, error);
t.end();
});
map.fire(new ErrorEvent(error));
});
t.end();
});
t.test('render stabilizes', (t) => {
const style = createStyle();
style.sources.mapbox = {
type: 'vector',
minzoom: 1,
maxzoom: 10,
tiles: ['http://example.com/{z}/{x}/{y}.png']
};
style.layers.push({
id: 'layerId',
type: 'circle',
source: 'mapbox',
'source-layer': 'sourceLayer'
});
let timer;
const map = createMap(t, { style: style });
map.on('render', () => {
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
map.off('render');
map.on('render', t.fail);
t.notOk(map._frameId, 'no rerender scheduled');
t.end();
}, 100);
});
});
t.test('#removeLayer restores Map#loaded() to true', (t) => {
const map = createMap(t, {
style: extend(createStyle(), {
sources: {
mapbox: {
type: 'vector',
minzoom: 1,
maxzoom: 10,
tiles: ['http://example.com/{z}/{x}/{y}.png']
}
},
layers: [{
id: 'layerId',
type: 'circle',
source: 'mapbox',
'source-layer': 'sourceLayer'
}]
})
});
map.once('render', () => {
map.removeLayer('layerId');
map.on('render', () => {
if (map.loaded()) {
map.remove();
t.end();
}
});
});
});
t.test('stops camera animation on mousedown when interactive', (t) => {
const map = createMap(t, {interactive: true});
map.flyTo({ center: [200, 0], duration: 100 });
simulate.mousedown(map.getCanvasContainer());
t.equal(map.isEasing(), false);
map.remove();
t.end();
});
t.test('continues camera animation on mousedown when non-interactive', (t) => {
const map = createMap(t, {interactive: false});
map.flyTo({ center: [200, 0], duration: 100 });
simulate.mousedown(map.getCanvasContainer());
t.equal(map.isEasing(), true);
map.remove();
t.end();
});
t.test('stops camera animation on touchstart when interactive', (t) => {
const map = createMap(t, {interactive: true});
map.flyTo({ center: [200, 0], duration: 100 });
simulate.touchstart(map.getCanvasContainer());
t.equal(map.isEasing(), false);
map.remove();
t.end();
});
t.test('continues camera animation on touchstart when non-interactive', (t) => {
const map = createMap(t, {interactive: false});
map.flyTo({ center: [200, 0], duration: 100 });
simulate.touchstart(map.getCanvasContainer());
t.equal(map.isEasing(), true);
map.remove();
t.end();
});
t.test('should not warn when CSS is present', (t) => {
const stub = t.stub(console, 'warn');
const styleSheet = new window.CSSStyleSheet();
styleSheet.insertRule('.mapboxgl-canary { background-color: rgb(250, 128, 114); }', 0);
window.document.styleSheets[0] = styleSheet;
window.document.styleSheets.length = 1;
new Map({ container: window.document.createElement('div') });
t.notok(stub.calledOnce);
t.end();
});
t.test('should warn when CSS is missing', (t) => {
const stub = t.stub(console, 'warn');
new Map({ container: window.document.createElement('div') });
t.ok(stub.calledOnce);
t.end();
});
t.test('continues camera animation on resize', (t) => {
const map = createMap(t),
container = map.getContainer();
map.flyTo({ center: [200, 0], duration: 100 });
Object.defineProperty(container, 'offsetWidth', {value: 250});
Object.defineProperty(container, 'offsetHeight', {value: 250});
map.resize();
t.ok(map.isMoving(), 'map is still moving after resize due to camera animation');
t.end();
});
t.end();
});
function createStyle() {
return {
version: 8,
center: [-73.9749, 40.7736],
zoom: 12.5,
bearing: 29,
pitch: 50,
sources: {},
layers: []
};
}
|
var console = require('console');
var config = require('config');
var http = require('http');
const buildUrl = (type)=>{
return '/images/types/'+type+'.png';
}
const buildMultiplierUrl = (multiplier)=>{
console.log(multiplier);
if(multiplier === 0){
return '/images/multiplier/0.png';
}
else if(multiplier === .25){
return '/images/multiplier/25.png';
}
else if(multiplier === .5){
return '/images/multiplier/5.png';
}
else if(multiplier === 1){
return '/images/multiplier/1.png';
}
else if(multiplier === 2){
return '/images/multiplier/2.png';
}
else if(multiplier === 4){
return '/images/multiplier/4.png';
}
}
module.exports.function = function GetEvolutions (pokemon, $vivContext) {
var rand = Math.floor(Math.random()*10000000000000)
var typeChart = http.getUrl(config.get('remote.newPokemonUrl') + '/pokemon/types/'+pokemon.name+'?userId='+$vivContext.userId+'+&rand='+rand+'', { format: 'json'});
typeChart.resistances.forEach(type=>{
type.type = buildUrl(type.type);
type.multiplier = buildMultiplierUrl(type.multiplier);
})
typeChart.neutral.forEach(type=>{
type.type = buildUrl(type.type);
type.multiplier = buildMultiplierUrl(type.multiplier);
})
typeChart.weaknesses.forEach(type=>{
type.type = buildUrl(type.type);
type.multiplier = buildMultiplierUrl(type.multiplier);
})
console.log(typeChart)
return typeChart;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.