target
stringlengths 5
300
| feat_repo_name
stringlengths 6
76
| text
stringlengths 26
1.05M
|
---|---|---|
ajax/libs/yui/3.10.1/event-custom-base/event-custom-base-coverage.js | a8m/cdnjs | if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
if (!__coverage__['build/event-custom-base/event-custom-base.js']) {
__coverage__['build/event-custom-base/event-custom-base.js'] = {"path":"build/event-custom-base/event-custom-base.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":0,"133":0,"134":0,"135":0,"136":0,"137":0,"138":0,"139":0,"140":0,"141":0,"142":0,"143":0,"144":0,"145":0,"146":0,"147":0,"148":0,"149":0,"150":0,"151":0,"152":0,"153":0,"154":0,"155":0,"156":0,"157":0,"158":0,"159":0,"160":0,"161":0,"162":0,"163":0,"164":0,"165":0,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":0,"173":0,"174":0,"175":0,"176":0,"177":0,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":0,"185":0,"186":0,"187":0,"188":0,"189":0,"190":0,"191":0,"192":0,"193":0,"194":0,"195":0,"196":0,"197":0,"198":0,"199":0,"200":0,"201":0,"202":0,"203":0,"204":0,"205":0,"206":0,"207":0,"208":0,"209":0,"210":0,"211":0,"212":0,"213":0,"214":0,"215":0,"216":0,"217":0,"218":0,"219":0,"220":0,"221":0,"222":0,"223":0,"224":0,"225":0,"226":0,"227":0,"228":0,"229":0,"230":0,"231":0,"232":0,"233":0,"234":0,"235":0,"236":0,"237":0,"238":0,"239":0,"240":0,"241":0,"242":0,"243":0,"244":0,"245":0,"246":0,"247":0,"248":0,"249":0,"250":0,"251":0,"252":0,"253":0,"254":0,"255":0,"256":0,"257":0,"258":0,"259":0,"260":0,"261":0,"262":0,"263":0,"264":0,"265":0,"266":0,"267":0,"268":0,"269":0,"270":0,"271":0,"272":0,"273":0,"274":0,"275":0,"276":0,"277":0,"278":0,"279":0,"280":0,"281":0,"282":0,"283":0,"284":0,"285":0,"286":0,"287":0,"288":0,"289":0,"290":0,"291":0,"292":0,"293":0,"294":0,"295":0,"296":0,"297":0,"298":0,"299":0,"300":0,"301":0,"302":0,"303":0,"304":0,"305":0,"306":0,"307":0,"308":0,"309":0,"310":0,"311":0,"312":0,"313":0,"314":0,"315":0,"316":0,"317":0,"318":0,"319":0,"320":0,"321":0,"322":0,"323":0,"324":0,"325":0,"326":0,"327":0,"328":0,"329":0,"330":0,"331":0,"332":0,"333":0,"334":0,"335":0,"336":0,"337":0,"338":0,"339":0,"340":0,"341":0,"342":0,"343":0,"344":0,"345":0,"346":0,"347":0,"348":0,"349":0,"350":0,"351":0,"352":0,"353":0,"354":0,"355":0,"356":0,"357":0,"358":0,"359":0,"360":0,"361":0,"362":0,"363":0,"364":0,"365":0,"366":0,"367":0,"368":0,"369":0,"370":0,"371":0,"372":0,"373":0,"374":0,"375":0,"376":0,"377":0,"378":0,"379":0,"380":0,"381":0,"382":0,"383":0,"384":0,"385":0,"386":0,"387":0,"388":0,"389":0,"390":0,"391":0,"392":0,"393":0,"394":0,"395":0,"396":0,"397":0,"398":0,"399":0,"400":0,"401":0,"402":0,"403":0,"404":0,"405":0,"406":0,"407":0,"408":0,"409":0,"410":0,"411":0,"412":0,"413":0,"414":0,"415":0,"416":0,"417":0,"418":0,"419":0,"420":0,"421":0,"422":0,"423":0,"424":0,"425":0,"426":0,"427":0,"428":0,"429":0,"430":0,"431":0,"432":0,"433":0,"434":0,"435":0,"436":0,"437":0,"438":0,"439":0,"440":0,"441":0,"442":0,"443":0,"444":0,"445":0,"446":0,"447":0,"448":0,"449":0,"450":0,"451":0,"452":0,"453":0,"454":0,"455":0,"456":0,"457":0,"458":0,"459":0,"460":0,"461":0,"462":0,"463":0,"464":0,"465":0,"466":0,"467":0,"468":0,"469":0,"470":0,"471":0,"472":0,"473":0,"474":0,"475":0,"476":0,"477":0,"478":0,"479":0,"480":0,"481":0,"482":0,"483":0,"484":0,"485":0,"486":0,"487":0,"488":0,"489":0,"490":0,"491":0,"492":0,"493":0,"494":0,"495":0,"496":0,"497":0,"498":0,"499":0,"500":0,"501":0,"502":0,"503":0,"504":0,"505":0,"506":0,"507":0,"508":0,"509":0,"510":0,"511":0,"512":0,"513":0,"514":0,"515":0,"516":0,"517":0,"518":0,"519":0,"520":0,"521":0,"522":0,"523":0,"524":0,"525":0,"526":0,"527":0,"528":0,"529":0,"530":0,"531":0,"532":0,"533":0,"534":0,"535":0,"536":0,"537":0,"538":0,"539":0,"540":0,"541":0,"542":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0,0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0],"37":[0,0],"38":[0,0],"39":[0,0],"40":[0,0],"41":[0,0],"42":[0,0],"43":[0,0],"44":[0,0],"45":[0,0],"46":[0,0],"47":[0,0],"48":[0,0],"49":[0,0],"50":[0,0],"51":[0,0,0],"52":[0,0],"53":[0,0],"54":[0,0,0],"55":[0,0],"56":[0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0],"62":[0,0],"63":[0,0],"64":[0,0],"65":[0,0],"66":[0,0],"67":[0,0],"68":[0,0],"69":[0,0],"70":[0,0],"71":[0,0],"72":[0,0],"73":[0,0],"74":[0,0],"75":[0,0],"76":[0,0],"77":[0,0],"78":[0,0],"79":[0,0],"80":[0,0],"81":[0,0],"82":[0,0],"83":[0,0],"84":[0,0],"85":[0,0],"86":[0,0],"87":[0,0],"88":[0,0,0],"89":[0,0],"90":[0,0],"91":[0,0],"92":[0,0],"93":[0,0],"94":[0,0],"95":[0,0],"96":[0,0],"97":[0,0],"98":[0,0],"99":[0,0],"100":[0,0],"101":[0,0],"102":[0,0],"103":[0,0],"104":[0,0],"105":[0,0],"106":[0,0],"107":[0,0],"108":[0,0],"109":[0,0],"110":[0,0],"111":[0,0],"112":[0,0],"113":[0,0],"114":[0,0],"115":[0,0],"116":[0,0],"117":[0,0],"118":[0,0],"119":[0,0],"120":[0,0],"121":[0,0],"122":[0,0],"123":[0,0],"124":[0,0],"125":[0,0],"126":[0,0],"127":[0,0],"128":[0,0],"129":[0,0],"130":[0,0],"131":[0,0,0],"132":[0,0],"133":[0,0],"134":[0,0],"135":[0,0],"136":[0,0],"137":[0,0],"138":[0,0],"139":[0,0],"140":[0,0],"141":[0,0],"142":[0,0],"143":[0,0],"144":[0,0],"145":[0,0],"146":[0,0],"147":[0,0],"148":[0,0],"149":[0,0],"150":[0,0],"151":[0,0],"152":[0,0],"153":[0,0],"154":[0,0],"155":[0,0],"156":[0,0],"157":[0,0],"158":[0,0],"159":[0,0],"160":[0,0],"161":[0,0],"162":[0,0],"163":[0,0],"164":[0,0],"165":[0,0],"166":[0,0],"167":[0,0,0],"168":[0,0],"169":[0,0],"170":[0,0],"171":[0,0],"172":[0,0,0,0],"173":[0,0],"174":[0,0],"175":[0,0],"176":[0,0],"177":[0,0],"178":[0,0],"179":[0,0],"180":[0,0,0,0],"181":[0,0],"182":[0,0],"183":[0,0],"184":[0,0],"185":[0,0],"186":[0,0],"187":[0,0,0,0,0],"188":[0,0],"189":[0,0],"190":[0,0],"191":[0,0],"192":[0,0],"193":[0,0],"194":[0,0],"195":[0,0],"196":[0,0],"197":[0,0],"198":[0,0],"199":[0,0,0,0,0],"200":[0,0],"201":[0,0],"202":[0,0],"203":[0,0],"204":[0,0],"205":[0,0],"206":[0,0],"207":[0,0],"208":[0,0],"209":[0,0],"210":[0,0,0,0],"211":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":48}}},"2":{"name":"(anonymous_2)","line":75,"loc":{"start":{"line":75,"column":12},"end":{"line":75,"column":38}}},"3":{"name":"(anonymous_3)","line":112,"loc":{"start":{"line":112,"column":11},"end":{"line":112,"column":37}}},"4":{"name":"(anonymous_4)","line":136,"loc":{"start":{"line":136,"column":13},"end":{"line":136,"column":42}}},"5":{"name":"(anonymous_5)","line":152,"loc":{"start":{"line":152,"column":23},"end":{"line":152,"column":34}}},"6":{"name":"(anonymous_6)","line":173,"loc":{"start":{"line":173,"column":12},"end":{"line":173,"column":29}}},"7":{"name":"(anonymous_7)","line":212,"loc":{"start":{"line":212,"column":12},"end":{"line":212,"column":31}}},"8":{"name":"(anonymous_8)","line":227,"loc":{"start":{"line":227,"column":31},"end":{"line":227,"column":56}}},"9":{"name":"(anonymous_9)","line":242,"loc":{"start":{"line":242,"column":30},"end":{"line":242,"column":45}}},"10":{"name":"(anonymous_10)","line":261,"loc":{"start":{"line":261,"column":27},"end":{"line":261,"column":39}}},"11":{"name":"(anonymous_11)","line":329,"loc":{"start":{"line":329,"column":15},"end":{"line":329,"column":38}}},"12":{"name":"(anonymous_12)","line":343,"loc":{"start":{"line":343,"column":17},"end":{"line":343,"column":42}}},"13":{"name":"(anonymous_13)","line":358,"loc":{"start":{"line":358,"column":10},"end":{"line":358,"column":32}}},"14":{"name":"(anonymous_14)","line":371,"loc":{"start":{"line":371,"column":13},"end":{"line":371,"column":27}}},"15":{"name":"(anonymous_15)","line":432,"loc":{"start":{"line":432,"column":17},"end":{"line":432,"column":36}}},"16":{"name":"(anonymous_16)","line":468,"loc":{"start":{"line":468,"column":16},"end":{"line":468,"column":41}}},"17":{"name":"(anonymous_17)","line":701,"loc":{"start":{"line":701,"column":13},"end":{"line":701,"column":28}}},"18":{"name":"(anonymous_18)","line":744,"loc":{"start":{"line":744,"column":13},"end":{"line":744,"column":28}}},"19":{"name":"(anonymous_19)","line":757,"loc":{"start":{"line":757,"column":13},"end":{"line":757,"column":24}}},"20":{"name":"(anonymous_20)","line":808,"loc":{"start":{"line":808,"column":17},"end":{"line":808,"column":36}}},"21":{"name":"(anonymous_21)","line":825,"loc":{"start":{"line":825,"column":9},"end":{"line":825,"column":43}}},"22":{"name":"(anonymous_22)","line":870,"loc":{"start":{"line":870,"column":15},"end":{"line":870,"column":37}}},"23":{"name":"(anonymous_23)","line":884,"loc":{"start":{"line":884,"column":8},"end":{"line":884,"column":30}}},"24":{"name":"(anonymous_24)","line":906,"loc":{"start":{"line":906,"column":11},"end":{"line":906,"column":33}}},"25":{"name":"(anonymous_25)","line":919,"loc":{"start":{"line":919,"column":12},"end":{"line":919,"column":34}}},"26":{"name":"(anonymous_26)","line":962,"loc":{"start":{"line":962,"column":17},"end":{"line":962,"column":28}}},"27":{"name":"(anonymous_27)","line":973,"loc":{"start":{"line":973,"column":13},"end":{"line":973,"column":35}}},"28":{"name":"(anonymous_28)","line":993,"loc":{"start":{"line":993,"column":9},"end":{"line":993,"column":28}}},"29":{"name":"(anonymous_29)","line":1013,"loc":{"start":{"line":1013,"column":10},"end":{"line":1013,"column":21}}},"30":{"name":"(anonymous_30)","line":1035,"loc":{"start":{"line":1035,"column":11},"end":{"line":1035,"column":26}}},"31":{"name":"(anonymous_31)","line":1066,"loc":{"start":{"line":1066,"column":16},"end":{"line":1066,"column":31}}},"32":{"name":"(anonymous_32)","line":1081,"loc":{"start":{"line":1081,"column":17},"end":{"line":1081,"column":32}}},"33":{"name":"(anonymous_33)","line":1098,"loc":{"start":{"line":1098,"column":15},"end":{"line":1098,"column":40}}},"34":{"name":"(anonymous_34)","line":1124,"loc":{"start":{"line":1124,"column":16},"end":{"line":1124,"column":31}}},"35":{"name":"(anonymous_35)","line":1146,"loc":{"start":{"line":1146,"column":20},"end":{"line":1146,"column":31}}},"36":{"name":"(anonymous_36)","line":1155,"loc":{"start":{"line":1155,"column":15},"end":{"line":1155,"column":26}}},"37":{"name":"(anonymous_37)","line":1169,"loc":{"start":{"line":1169,"column":13},"end":{"line":1169,"column":34}}},"38":{"name":"(anonymous_38)","line":1220,"loc":{"start":{"line":1220,"column":15},"end":{"line":1220,"column":49}}},"39":{"name":"(anonymous_39)","line":1271,"loc":{"start":{"line":1271,"column":13},"end":{"line":1271,"column":35}}},"40":{"name":"(anonymous_40)","line":1312,"loc":{"start":{"line":1312,"column":12},"end":{"line":1312,"column":31}}},"41":{"name":"(anonymous_41)","line":1344,"loc":{"start":{"line":1344,"column":14},"end":{"line":1344,"column":36}}},"42":{"name":"(anonymous_42)","line":1352,"loc":{"start":{"line":1352,"column":14},"end":{"line":1352,"column":25}}},"43":{"name":"(anonymous_43)","line":1364,"loc":{"start":{"line":1364,"column":16},"end":{"line":1364,"column":35}}},"44":{"name":"(anonymous_44)","line":1384,"loc":{"start":{"line":1384,"column":11},"end":{"line":1384,"column":26}}},"45":{"name":"(anonymous_45)","line":1387,"loc":{"start":{"line":1387,"column":35},"end":{"line":1387,"column":47}}},"46":{"name":"(anonymous_46)","line":1398,"loc":{"start":{"line":1398,"column":12},"end":{"line":1398,"column":23}}},"47":{"name":"(anonymous_47)","line":1423,"loc":{"start":{"line":1423,"column":13},"end":{"line":1423,"column":28}}},"48":{"name":"(anonymous_48)","line":1458,"loc":{"start":{"line":1458,"column":25},"end":{"line":1458,"column":40}}},"49":{"name":"(anonymous_49)","line":1469,"loc":{"start":{"line":1469,"column":15},"end":{"line":1469,"column":35}}},"50":{"name":"(anonymous_50)","line":1485,"loc":{"start":{"line":1485,"column":26},"end":{"line":1485,"column":46}}},"51":{"name":"(anonymous_51)","line":1514,"loc":{"start":{"line":1514,"column":9},"end":{"line":1514,"column":24}}},"52":{"name":"(anonymous_52)","line":1562,"loc":{"start":{"line":1562,"column":10},"end":{"line":1562,"column":21}}},"53":{"name":"(anonymous_53)","line":1564,"loc":{"start":{"line":1564,"column":21},"end":{"line":1564,"column":36}}},"54":{"name":"(anonymous_54)","line":1584,"loc":{"start":{"line":1584,"column":15},"end":{"line":1584,"column":26}}},"55":{"name":"(anonymous_55)","line":1586,"loc":{"start":{"line":1586,"column":21},"end":{"line":1586,"column":36}}},"56":{"name":"(anonymous_56)","line":1610,"loc":{"start":{"line":1610,"column":15},"end":{"line":1610,"column":35}}},"57":{"name":"(anonymous_57)","line":1643,"loc":{"start":{"line":1643,"column":8},"end":{"line":1643,"column":36}}},"58":{"name":"(anonymous_58)","line":1675,"loc":{"start":{"line":1675,"column":25},"end":{"line":1675,"column":40}}},"59":{"name":"(anonymous_59)","line":1765,"loc":{"start":{"line":1765,"column":15},"end":{"line":1765,"column":26}}},"60":{"name":"(anonymous_60)","line":1785,"loc":{"start":{"line":1785,"column":12},"end":{"line":1785,"column":40}}},"61":{"name":"(anonymous_61)","line":1812,"loc":{"start":{"line":1812,"column":22},"end":{"line":1812,"column":50}}},"62":{"name":"(anonymous_62)","line":1887,"loc":{"start":{"line":1887,"column":17},"end":{"line":1887,"column":28}}},"63":{"name":"(anonymous_63)","line":1898,"loc":{"start":{"line":1898,"column":15},"end":{"line":1898,"column":30}}},"64":{"name":"(anonymous_64)","line":1910,"loc":{"start":{"line":1910,"column":20},"end":{"line":1910,"column":31}}},"65":{"name":"(anonymous_65)","line":1980,"loc":{"start":{"line":1980,"column":13},"end":{"line":1980,"column":34}}},"66":{"name":"(anonymous_66)","line":1995,"loc":{"start":{"line":1995,"column":25},"end":{"line":1995,"column":40}}},"67":{"name":"(anonymous_67)","line":2020,"loc":{"start":{"line":2020,"column":19},"end":{"line":2020,"column":34}}},"68":{"name":"(anonymous_68)","line":2044,"loc":{"start":{"line":2044,"column":15},"end":{"line":2044,"column":50}}},"69":{"name":"(anonymous_69)","line":2096,"loc":{"start":{"line":2096,"column":14},"end":{"line":2096,"column":43}}},"70":{"name":"(anonymous_70)","line":2143,"loc":{"start":{"line":2143,"column":10},"end":{"line":2143,"column":25}}},"71":{"name":"(anonymous_71)","line":2215,"loc":{"start":{"line":2215,"column":16},"end":{"line":2215,"column":35}}},"72":{"name":"(anonymous_72)","line":2240,"loc":{"start":{"line":2240,"column":14},"end":{"line":2240,"column":39}}},"73":{"name":"(anonymous_73)","line":2265,"loc":{"start":{"line":2265,"column":11},"end":{"line":2265,"column":30}}},"74":{"name":"(anonymous_74)","line":2303,"loc":{"start":{"line":2303,"column":12},"end":{"line":2303,"column":23}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":2454,"column":39}},"2":{"start":{"line":9,"column":0},"end":{"line":12,"column":2}},"3":{"start":{"line":29,"column":0},"end":{"line":178,"column":2}},"4":{"start":{"line":76,"column":8},"end":{"line":76,"column":22}},"5":{"start":{"line":77,"column":8},"end":{"line":80,"column":9}},"6":{"start":{"line":78,"column":12},"end":{"line":78,"column":60}},"7":{"start":{"line":79,"column":12},"end":{"line":79,"column":36}},"8":{"start":{"line":82,"column":8},"end":{"line":82,"column":52}},"9":{"start":{"line":113,"column":8},"end":{"line":113,"column":22}},"10":{"start":{"line":114,"column":8},"end":{"line":117,"column":9}},"11":{"start":{"line":115,"column":12},"end":{"line":115,"column":60}},"12":{"start":{"line":116,"column":12},"end":{"line":116,"column":36}},"13":{"start":{"line":119,"column":8},"end":{"line":119,"column":51}},"14":{"start":{"line":138,"column":8},"end":{"line":138,"column":38}},"15":{"start":{"line":140,"column":8},"end":{"line":143,"column":9}},"16":{"start":{"line":142,"column":12},"end":{"line":142,"column":29}},"17":{"start":{"line":145,"column":8},"end":{"line":145,"column":24}},"18":{"start":{"line":147,"column":8},"end":{"line":155,"column":9}},"19":{"start":{"line":149,"column":12},"end":{"line":149,"column":47}},"20":{"start":{"line":152,"column":12},"end":{"line":154,"column":14}},"21":{"start":{"line":153,"column":16},"end":{"line":153,"column":60}},"22":{"start":{"line":158,"column":8},"end":{"line":158,"column":37}},"23":{"start":{"line":161,"column":8},"end":{"line":161,"column":39}},"24":{"start":{"line":163,"column":8},"end":{"line":163,"column":46}},"25":{"start":{"line":174,"column":8},"end":{"line":176,"column":9}},"26":{"start":{"line":175,"column":12},"end":{"line":175,"column":28}},"27":{"start":{"line":180,"column":0},"end":{"line":180,"column":10}},"28":{"start":{"line":212,"column":0},"end":{"line":218,"column":2}},"29":{"start":{"line":213,"column":4},"end":{"line":213,"column":19}},"30":{"start":{"line":214,"column":4},"end":{"line":214,"column":26}},"31":{"start":{"line":215,"column":4},"end":{"line":215,"column":27}},"32":{"start":{"line":216,"column":4},"end":{"line":216,"column":21}},"33":{"start":{"line":217,"column":4},"end":{"line":217,"column":20}},"34":{"start":{"line":227,"column":0},"end":{"line":233,"column":2}},"35":{"start":{"line":228,"column":4},"end":{"line":232,"column":5}},"36":{"start":{"line":229,"column":8},"end":{"line":229,"column":29}},"37":{"start":{"line":231,"column":8},"end":{"line":231,"column":30}},"38":{"start":{"line":242,"column":0},"end":{"line":245,"column":2}},"39":{"start":{"line":243,"column":4},"end":{"line":243,"column":28}},"40":{"start":{"line":244,"column":4},"end":{"line":244,"column":27}},"41":{"start":{"line":261,"column":0},"end":{"line":314,"column":2}},"42":{"start":{"line":263,"column":4},"end":{"line":267,"column":26}},"43":{"start":{"line":270,"column":4},"end":{"line":287,"column":5}},"44":{"start":{"line":271,"column":8},"end":{"line":286,"column":9}},"45":{"start":{"line":272,"column":12},"end":{"line":272,"column":46}},"46":{"start":{"line":273,"column":12},"end":{"line":285,"column":13}},"47":{"start":{"line":274,"column":16},"end":{"line":284,"column":17}},"48":{"start":{"line":276,"column":24},"end":{"line":276,"column":42}},"49":{"start":{"line":278,"column":24},"end":{"line":278,"column":43}},"50":{"start":{"line":279,"column":24},"end":{"line":279,"column":30}},"51":{"start":{"line":281,"column":24},"end":{"line":281,"column":41}},"52":{"start":{"line":282,"column":24},"end":{"line":282,"column":30}},"53":{"start":{"line":290,"column":4},"end":{"line":292,"column":5}},"54":{"start":{"line":291,"column":8},"end":{"line":291,"column":48}},"55":{"start":{"line":294,"column":4},"end":{"line":294,"column":28}},"56":{"start":{"line":295,"column":4},"end":{"line":295,"column":27}},"57":{"start":{"line":298,"column":4},"end":{"line":311,"column":5}},"58":{"start":{"line":299,"column":8},"end":{"line":310,"column":9}},"59":{"start":{"line":300,"column":12},"end":{"line":300,"column":49}},"60":{"start":{"line":302,"column":12},"end":{"line":309,"column":13}},"61":{"start":{"line":303,"column":16},"end":{"line":303,"column":37}},"62":{"start":{"line":305,"column":19},"end":{"line":309,"column":13}},"63":{"start":{"line":306,"column":16},"end":{"line":306,"column":39}},"64":{"start":{"line":308,"column":16},"end":{"line":308,"column":39}},"65":{"start":{"line":313,"column":4},"end":{"line":313,"column":15}},"66":{"start":{"line":329,"column":0},"end":{"line":332,"column":2}},"67":{"start":{"line":330,"column":4},"end":{"line":330,"column":19}},"68":{"start":{"line":331,"column":4},"end":{"line":331,"column":27}},"69":{"start":{"line":343,"column":0},"end":{"line":346,"column":2}},"70":{"start":{"line":344,"column":4},"end":{"line":344,"column":19}},"71":{"start":{"line":345,"column":4},"end":{"line":345,"column":31}},"72":{"start":{"line":358,"column":0},"end":{"line":361,"column":2}},"73":{"start":{"line":359,"column":4},"end":{"line":359,"column":19}},"74":{"start":{"line":360,"column":4},"end":{"line":360,"column":25}},"75":{"start":{"line":371,"column":0},"end":{"line":373,"column":2}},"76":{"start":{"line":372,"column":4},"end":{"line":372,"column":19}},"77":{"start":{"line":385,"column":0},"end":{"line":385,"column":19}},"78":{"start":{"line":399,"column":0},"end":{"line":442,"column":6}},"79":{"start":{"line":433,"column":8},"end":{"line":433,"column":14}},"80":{"start":{"line":435,"column":8},"end":{"line":439,"column":9}},"81":{"start":{"line":436,"column":12},"end":{"line":438,"column":13}},"82":{"start":{"line":437,"column":16},"end":{"line":437,"column":28}},"83":{"start":{"line":441,"column":8},"end":{"line":441,"column":17}},"84":{"start":{"line":468,"column":0},"end":{"line":498,"column":2}},"85":{"start":{"line":470,"column":4},"end":{"line":470,"column":49}},"86":{"start":{"line":472,"column":4},"end":{"line":472,"column":23}},"87":{"start":{"line":474,"column":4},"end":{"line":474,"column":21}},"88":{"start":{"line":475,"column":4},"end":{"line":475,"column":54}},"89":{"start":{"line":477,"column":4},"end":{"line":493,"column":5}},"90":{"start":{"line":491,"column":8},"end":{"line":491,"column":30}},"91":{"start":{"line":492,"column":8},"end":{"line":492,"column":25}},"92":{"start":{"line":495,"column":4},"end":{"line":497,"column":5}},"93":{"start":{"line":496,"column":8},"end":{"line":496,"column":41}},"94":{"start":{"line":523,"column":0},"end":{"line":523,"column":41}},"95":{"start":{"line":525,"column":0},"end":{"line":525,"column":38}},"96":{"start":{"line":527,"column":0},"end":{"line":1210,"column":2}},"97":{"start":{"line":702,"column":8},"end":{"line":706,"column":31}},"98":{"start":{"line":708,"column":8},"end":{"line":710,"column":9}},"99":{"start":{"line":709,"column":12},"end":{"line":709,"column":28}},"100":{"start":{"line":712,"column":8},"end":{"line":714,"column":9}},"101":{"start":{"line":713,"column":12},"end":{"line":713,"column":30}},"102":{"start":{"line":716,"column":8},"end":{"line":727,"column":9}},"103":{"start":{"line":717,"column":12},"end":{"line":717,"column":36}},"104":{"start":{"line":718,"column":12},"end":{"line":718,"column":33}},"105":{"start":{"line":720,"column":12},"end":{"line":722,"column":13}},"106":{"start":{"line":721,"column":16},"end":{"line":721,"column":33}},"107":{"start":{"line":724,"column":12},"end":{"line":726,"column":13}},"108":{"start":{"line":725,"column":16},"end":{"line":725,"column":35}},"109":{"start":{"line":729,"column":8},"end":{"line":731,"column":9}},"110":{"start":{"line":730,"column":12},"end":{"line":730,"column":46}},"111":{"start":{"line":733,"column":8},"end":{"line":733,"column":23}},"112":{"start":{"line":745,"column":8},"end":{"line":745,"column":30}},"113":{"start":{"line":746,"column":8},"end":{"line":747,"column":50}},"114":{"start":{"line":748,"column":8},"end":{"line":748,"column":23}},"115":{"start":{"line":749,"column":8},"end":{"line":749,"column":51}},"116":{"start":{"line":759,"column":8},"end":{"line":763,"column":26}},"117":{"start":{"line":765,"column":8},"end":{"line":768,"column":9}},"118":{"start":{"line":766,"column":12},"end":{"line":766,"column":47}},"119":{"start":{"line":767,"column":12},"end":{"line":767,"column":44}},"120":{"start":{"line":770,"column":8},"end":{"line":782,"column":9}},"121":{"start":{"line":771,"column":12},"end":{"line":775,"column":13}},"122":{"start":{"line":772,"column":16},"end":{"line":772,"column":48}},"123":{"start":{"line":774,"column":16},"end":{"line":774,"column":44}},"124":{"start":{"line":777,"column":12},"end":{"line":781,"column":13}},"125":{"start":{"line":778,"column":16},"end":{"line":778,"column":37}},"126":{"start":{"line":780,"column":16},"end":{"line":780,"column":26}},"127":{"start":{"line":784,"column":8},"end":{"line":796,"column":9}},"128":{"start":{"line":785,"column":12},"end":{"line":789,"column":13}},"129":{"start":{"line":786,"column":16},"end":{"line":786,"column":54}},"130":{"start":{"line":788,"column":16},"end":{"line":788,"column":48}},"131":{"start":{"line":791,"column":12},"end":{"line":795,"column":13}},"132":{"start":{"line":792,"column":16},"end":{"line":792,"column":41}},"133":{"start":{"line":794,"column":16},"end":{"line":794,"column":28}},"134":{"start":{"line":798,"column":8},"end":{"line":798,"column":30}},"135":{"start":{"line":809,"column":8},"end":{"line":809,"column":35}},"136":{"start":{"line":828,"column":8},"end":{"line":828,"column":58}},"137":{"start":{"line":830,"column":8},"end":{"line":836,"column":9}},"138":{"start":{"line":831,"column":12},"end":{"line":835,"column":13}},"139":{"start":{"line":832,"column":16},"end":{"line":832,"column":77}},"140":{"start":{"line":834,"column":16},"end":{"line":834,"column":48}},"141":{"start":{"line":838,"column":8},"end":{"line":850,"column":9}},"142":{"start":{"line":839,"column":12},"end":{"line":842,"column":13}},"143":{"start":{"line":840,"column":16},"end":{"line":840,"column":34}},"144":{"start":{"line":841,"column":16},"end":{"line":841,"column":39}},"145":{"start":{"line":843,"column":12},"end":{"line":843,"column":33}},"146":{"start":{"line":845,"column":12},"end":{"line":848,"column":13}},"147":{"start":{"line":846,"column":16},"end":{"line":846,"column":39}},"148":{"start":{"line":847,"column":16},"end":{"line":847,"column":37}},"149":{"start":{"line":849,"column":12},"end":{"line":849,"column":38}},"150":{"start":{"line":852,"column":8},"end":{"line":858,"column":9}},"151":{"start":{"line":853,"column":12},"end":{"line":857,"column":13}},"152":{"start":{"line":854,"column":16},"end":{"line":854,"column":38}},"153":{"start":{"line":856,"column":16},"end":{"line":856,"column":43}},"154":{"start":{"line":860,"column":8},"end":{"line":860,"column":42}},"155":{"start":{"line":871,"column":8},"end":{"line":871,"column":79}},"156":{"start":{"line":872,"column":8},"end":{"line":872,"column":46}},"157":{"start":{"line":885,"column":8},"end":{"line":885,"column":79}},"158":{"start":{"line":887,"column":8},"end":{"line":891,"column":9}},"159":{"start":{"line":888,"column":12},"end":{"line":890,"column":15}},"160":{"start":{"line":892,"column":8},"end":{"line":892,"column":46}},"161":{"start":{"line":907,"column":8},"end":{"line":907,"column":79}},"162":{"start":{"line":908,"column":8},"end":{"line":908,"column":47}},"163":{"start":{"line":921,"column":8},"end":{"line":923,"column":9}},"164":{"start":{"line":922,"column":12},"end":{"line":922,"column":31}},"165":{"start":{"line":925,"column":8},"end":{"line":928,"column":34}},"166":{"start":{"line":930,"column":8},"end":{"line":938,"column":9}},"167":{"start":{"line":931,"column":12},"end":{"line":937,"column":13}},"168":{"start":{"line":932,"column":16},"end":{"line":932,"column":28}},"169":{"start":{"line":933,"column":16},"end":{"line":936,"column":17}},"170":{"start":{"line":934,"column":20},"end":{"line":934,"column":45}},"171":{"start":{"line":935,"column":20},"end":{"line":935,"column":28}},"172":{"start":{"line":940,"column":8},"end":{"line":948,"column":9}},"173":{"start":{"line":941,"column":12},"end":{"line":947,"column":13}},"174":{"start":{"line":942,"column":16},"end":{"line":942,"column":30}},"175":{"start":{"line":943,"column":16},"end":{"line":946,"column":17}},"176":{"start":{"line":944,"column":20},"end":{"line":944,"column":47}},"177":{"start":{"line":945,"column":20},"end":{"line":945,"column":28}},"178":{"start":{"line":950,"column":8},"end":{"line":950,"column":21}},"179":{"start":{"line":963,"column":8},"end":{"line":963,"column":50}},"180":{"start":{"line":976,"column":8},"end":{"line":976,"column":16}},"181":{"start":{"line":978,"column":8},"end":{"line":978,"column":35}},"182":{"start":{"line":980,"column":8},"end":{"line":982,"column":9}},"183":{"start":{"line":981,"column":12},"end":{"line":981,"column":25}},"184":{"start":{"line":984,"column":8},"end":{"line":984,"column":20}},"185":{"start":{"line":1019,"column":8},"end":{"line":1019,"column":22}},"186":{"start":{"line":1020,"column":8},"end":{"line":1020,"column":41}},"187":{"start":{"line":1022,"column":8},"end":{"line":1022,"column":32}},"188":{"start":{"line":1037,"column":8},"end":{"line":1055,"column":9}},"189":{"start":{"line":1038,"column":12},"end":{"line":1038,"column":24}},"190":{"start":{"line":1044,"column":12},"end":{"line":1044,"column":30}},"191":{"start":{"line":1046,"column":12},"end":{"line":1048,"column":13}},"192":{"start":{"line":1047,"column":16},"end":{"line":1047,"column":38}},"193":{"start":{"line":1050,"column":12},"end":{"line":1054,"column":13}},"194":{"start":{"line":1051,"column":16},"end":{"line":1051,"column":46}},"195":{"start":{"line":1053,"column":16},"end":{"line":1053,"column":45}},"196":{"start":{"line":1067,"column":8},"end":{"line":1067,"column":25}},"197":{"start":{"line":1068,"column":8},"end":{"line":1068,"column":27}},"198":{"start":{"line":1069,"column":8},"end":{"line":1073,"column":9}},"199":{"start":{"line":1070,"column":12},"end":{"line":1070,"column":38}},"200":{"start":{"line":1071,"column":12},"end":{"line":1071,"column":42}},"201":{"start":{"line":1072,"column":12},"end":{"line":1072,"column":42}},"202":{"start":{"line":1074,"column":8},"end":{"line":1076,"column":9}},"203":{"start":{"line":1075,"column":12},"end":{"line":1075,"column":34}},"204":{"start":{"line":1077,"column":8},"end":{"line":1077,"column":43}},"205":{"start":{"line":1082,"column":8},"end":{"line":1082,"column":32}},"206":{"start":{"line":1083,"column":8},"end":{"line":1083,"column":37}},"207":{"start":{"line":1099,"column":8},"end":{"line":1099,"column":20}},"208":{"start":{"line":1101,"column":8},"end":{"line":1111,"column":9}},"209":{"start":{"line":1102,"column":12},"end":{"line":1102,"column":24}},"210":{"start":{"line":1103,"column":12},"end":{"line":1110,"column":13}},"211":{"start":{"line":1104,"column":16},"end":{"line":1106,"column":17}},"212":{"start":{"line":1105,"column":20},"end":{"line":1105,"column":37}},"213":{"start":{"line":1107,"column":16},"end":{"line":1109,"column":17}},"214":{"start":{"line":1108,"column":20},"end":{"line":1108,"column":33}},"215":{"start":{"line":1113,"column":8},"end":{"line":1113,"column":20}},"216":{"start":{"line":1125,"column":8},"end":{"line":1137,"column":9}},"217":{"start":{"line":1127,"column":12},"end":{"line":1127,"column":34}},"218":{"start":{"line":1128,"column":12},"end":{"line":1128,"column":33}},"219":{"start":{"line":1130,"column":12},"end":{"line":1132,"column":13}},"220":{"start":{"line":1131,"column":16},"end":{"line":1131,"column":35}},"221":{"start":{"line":1134,"column":12},"end":{"line":1136,"column":13}},"222":{"start":{"line":1135,"column":16},"end":{"line":1135,"column":49}},"223":{"start":{"line":1147,"column":8},"end":{"line":1147,"column":53}},"224":{"start":{"line":1156,"column":8},"end":{"line":1156,"column":29}},"225":{"start":{"line":1170,"column":8},"end":{"line":1170,"column":27}},"226":{"start":{"line":1172,"column":8},"end":{"line":1175,"column":9}},"227":{"start":{"line":1173,"column":12},"end":{"line":1173,"column":71}},"228":{"start":{"line":1174,"column":12},"end":{"line":1174,"column":43}},"229":{"start":{"line":1177,"column":8},"end":{"line":1189,"column":9}},"230":{"start":{"line":1178,"column":12},"end":{"line":1188,"column":13}},"231":{"start":{"line":1179,"column":16},"end":{"line":1179,"column":34}},"232":{"start":{"line":1181,"column":16},"end":{"line":1187,"column":17}},"233":{"start":{"line":1182,"column":20},"end":{"line":1186,"column":21}},"234":{"start":{"line":1183,"column":24},"end":{"line":1183,"column":48}},"235":{"start":{"line":1185,"column":24},"end":{"line":1185,"column":46}},"236":{"start":{"line":1191,"column":8},"end":{"line":1197,"column":9}},"237":{"start":{"line":1192,"column":12},"end":{"line":1196,"column":13}},"238":{"start":{"line":1193,"column":16},"end":{"line":1193,"column":41}},"239":{"start":{"line":1195,"column":16},"end":{"line":1195,"column":46}},"240":{"start":{"line":1199,"column":8},"end":{"line":1204,"column":9}},"241":{"start":{"line":1200,"column":12},"end":{"line":1203,"column":15}},"242":{"start":{"line":1206,"column":8},"end":{"line":1208,"column":9}},"243":{"start":{"line":1207,"column":12},"end":{"line":1207,"column":29}},"244":{"start":{"line":1220,"column":0},"end":{"line":1266,"column":2}},"245":{"start":{"line":1228,"column":4},"end":{"line":1228,"column":17}},"246":{"start":{"line":1235,"column":4},"end":{"line":1235,"column":27}},"247":{"start":{"line":1242,"column":4},"end":{"line":1242,"column":23}},"248":{"start":{"line":1249,"column":4},"end":{"line":1249,"column":21}},"249":{"start":{"line":1251,"column":4},"end":{"line":1251,"column":22}},"250":{"start":{"line":1268,"column":0},"end":{"line":1356,"column":2}},"251":{"start":{"line":1272,"column":8},"end":{"line":1280,"column":9}},"252":{"start":{"line":1273,"column":12},"end":{"line":1279,"column":13}},"253":{"start":{"line":1274,"column":16},"end":{"line":1274,"column":31}},"254":{"start":{"line":1275,"column":16},"end":{"line":1275,"column":36}},"255":{"start":{"line":1277,"column":16},"end":{"line":1277,"column":38}},"256":{"start":{"line":1278,"column":16},"end":{"line":1278,"column":28}},"257":{"start":{"line":1281,"column":8},"end":{"line":1281,"column":31}},"258":{"start":{"line":1282,"column":8},"end":{"line":1297,"column":9}},"259":{"start":{"line":1284,"column":16},"end":{"line":1284,"column":56}},"260":{"start":{"line":1285,"column":16},"end":{"line":1285,"column":22}},"261":{"start":{"line":1287,"column":16},"end":{"line":1287,"column":58}},"262":{"start":{"line":1288,"column":16},"end":{"line":1288,"column":22}},"263":{"start":{"line":1290,"column":16},"end":{"line":1296,"column":17}},"264":{"start":{"line":1291,"column":20},"end":{"line":1291,"column":38}},"265":{"start":{"line":1292,"column":20},"end":{"line":1292,"column":52}},"266":{"start":{"line":1293,"column":20},"end":{"line":1293,"column":46}},"267":{"start":{"line":1295,"column":20},"end":{"line":1295,"column":42}},"268":{"start":{"line":1299,"column":8},"end":{"line":1301,"column":9}},"269":{"start":{"line":1300,"column":12},"end":{"line":1300,"column":29}},"270":{"start":{"line":1303,"column":8},"end":{"line":1303,"column":19}},"271":{"start":{"line":1313,"column":8},"end":{"line":1314,"column":23}},"272":{"start":{"line":1316,"column":8},"end":{"line":1318,"column":9}},"273":{"start":{"line":1317,"column":12},"end":{"line":1317,"column":61}},"274":{"start":{"line":1321,"column":8},"end":{"line":1329,"column":9}},"275":{"start":{"line":1322,"column":12},"end":{"line":1322,"column":44}},"276":{"start":{"line":1324,"column":12},"end":{"line":1328,"column":13}},"277":{"start":{"line":1325,"column":16},"end":{"line":1325,"column":48}},"278":{"start":{"line":1327,"column":16},"end":{"line":1327,"column":59}},"279":{"start":{"line":1331,"column":8},"end":{"line":1331,"column":19}},"280":{"start":{"line":1345,"column":8},"end":{"line":1349,"column":9}},"281":{"start":{"line":1346,"column":12},"end":{"line":1346,"column":66}},"282":{"start":{"line":1348,"column":12},"end":{"line":1348,"column":36}},"283":{"start":{"line":1353,"column":8},"end":{"line":1353,"column":23}},"284":{"start":{"line":1364,"column":0},"end":{"line":1381,"column":2}},"285":{"start":{"line":1372,"column":4},"end":{"line":1372,"column":19}},"286":{"start":{"line":1380,"column":4},"end":{"line":1380,"column":19}},"287":{"start":{"line":1383,"column":0},"end":{"line":1426,"column":2}},"288":{"start":{"line":1385,"column":8},"end":{"line":1385,"column":32}},"289":{"start":{"line":1386,"column":8},"end":{"line":1390,"column":9}},"290":{"start":{"line":1387,"column":12},"end":{"line":1389,"column":15}},"291":{"start":{"line":1388,"column":16},"end":{"line":1388,"column":40}},"292":{"start":{"line":1399,"column":8},"end":{"line":1399,"column":44}},"293":{"start":{"line":1400,"column":8},"end":{"line":1410,"column":9}},"294":{"start":{"line":1401,"column":12},"end":{"line":1408,"column":13}},"295":{"start":{"line":1402,"column":16},"end":{"line":1404,"column":17}},"296":{"start":{"line":1403,"column":20},"end":{"line":1403,"column":48}},"297":{"start":{"line":1406,"column":16},"end":{"line":1406,"column":38}},"298":{"start":{"line":1407,"column":16},"end":{"line":1407,"column":29}},"299":{"start":{"line":1412,"column":8},"end":{"line":1412,"column":24}},"300":{"start":{"line":1424,"column":8},"end":{"line":1424,"column":59}},"301":{"start":{"line":1452,"column":0},"end":{"line":1544,"column":6}},"302":{"start":{"line":1459,"column":8},"end":{"line":1459,"column":51}},"303":{"start":{"line":1471,"column":8},"end":{"line":1473,"column":9}},"304":{"start":{"line":1472,"column":12},"end":{"line":1472,"column":24}},"305":{"start":{"line":1475,"column":8},"end":{"line":1475,"column":45}},"306":{"start":{"line":1487,"column":8},"end":{"line":1487,"column":47}},"307":{"start":{"line":1489,"column":8},"end":{"line":1491,"column":9}},"308":{"start":{"line":1490,"column":12},"end":{"line":1490,"column":21}},"309":{"start":{"line":1493,"column":8},"end":{"line":1493,"column":36}},"310":{"start":{"line":1495,"column":8},"end":{"line":1498,"column":9}},"311":{"start":{"line":1496,"column":12},"end":{"line":1496,"column":25}},"312":{"start":{"line":1497,"column":12},"end":{"line":1497,"column":46}},"313":{"start":{"line":1500,"column":8},"end":{"line":1500,"column":42}},"314":{"start":{"line":1502,"column":8},"end":{"line":1508,"column":9}},"315":{"start":{"line":1503,"column":12},"end":{"line":1503,"column":46}},"316":{"start":{"line":1504,"column":12},"end":{"line":1504,"column":30}},"317":{"start":{"line":1505,"column":12},"end":{"line":1507,"column":13}},"318":{"start":{"line":1506,"column":16},"end":{"line":1506,"column":25}},"319":{"start":{"line":1511,"column":8},"end":{"line":1511,"column":72}},"320":{"start":{"line":1516,"column":8},"end":{"line":1517,"column":21}},"321":{"start":{"line":1519,"column":8},"end":{"line":1529,"column":9}},"322":{"start":{"line":1520,"column":12},"end":{"line":1528,"column":14}},"323":{"start":{"line":1531,"column":8},"end":{"line":1531,"column":34}},"324":{"start":{"line":1533,"column":8},"end":{"line":1543,"column":9}},"325":{"start":{"line":1534,"column":12},"end":{"line":1534,"column":45}},"326":{"start":{"line":1536,"column":12},"end":{"line":1538,"column":13}},"327":{"start":{"line":1537,"column":16},"end":{"line":1537,"column":43}},"328":{"start":{"line":1540,"column":12},"end":{"line":1542,"column":13}},"329":{"start":{"line":1541,"column":16},"end":{"line":1541,"column":46}},"330":{"start":{"line":1546,"column":0},"end":{"line":2307,"column":2}},"331":{"start":{"line":1563,"column":8},"end":{"line":1563,"column":52}},"332":{"start":{"line":1564,"column":8},"end":{"line":1568,"column":11}},"333":{"start":{"line":1565,"column":12},"end":{"line":1567,"column":13}},"334":{"start":{"line":1566,"column":16},"end":{"line":1566,"column":37}},"335":{"start":{"line":1569,"column":8},"end":{"line":1569,"column":22}},"336":{"start":{"line":1585,"column":8},"end":{"line":1585,"column":55}},"337":{"start":{"line":1586,"column":8},"end":{"line":1590,"column":11}},"338":{"start":{"line":1587,"column":12},"end":{"line":1589,"column":13}},"339":{"start":{"line":1588,"column":16},"end":{"line":1588,"column":37}},"340":{"start":{"line":1591,"column":8},"end":{"line":1591,"column":22}},"341":{"start":{"line":1611,"column":8},"end":{"line":1611,"column":67}},"342":{"start":{"line":1645,"column":8},"end":{"line":1648,"column":46}},"343":{"start":{"line":1651,"column":8},"end":{"line":1655,"column":11}},"344":{"start":{"line":1657,"column":8},"end":{"line":1693,"column":9}},"345":{"start":{"line":1659,"column":12},"end":{"line":1661,"column":13}},"346":{"start":{"line":1660,"column":16},"end":{"line":1660,"column":58}},"347":{"start":{"line":1663,"column":12},"end":{"line":1663,"column":19}},"348":{"start":{"line":1664,"column":12},"end":{"line":1664,"column":24}},"349":{"start":{"line":1665,"column":12},"end":{"line":1665,"column":50}},"350":{"start":{"line":1666,"column":12},"end":{"line":1666,"column":21}},"351":{"start":{"line":1668,"column":12},"end":{"line":1670,"column":13}},"352":{"start":{"line":1669,"column":16},"end":{"line":1669,"column":29}},"353":{"start":{"line":1672,"column":12},"end":{"line":1672,"column":32}},"354":{"start":{"line":1673,"column":12},"end":{"line":1673,"column":31}},"355":{"start":{"line":1675,"column":12},"end":{"line":1690,"column":21}},"356":{"start":{"line":1677,"column":16},"end":{"line":1680,"column":17}},"357":{"start":{"line":1678,"column":20},"end":{"line":1678,"column":60}},"358":{"start":{"line":1679,"column":20},"end":{"line":1679,"column":39}},"359":{"start":{"line":1682,"column":16},"end":{"line":1682,"column":53}},"360":{"start":{"line":1684,"column":16},"end":{"line":1684,"column":49}},"361":{"start":{"line":1685,"column":16},"end":{"line":1685,"column":28}},"362":{"start":{"line":1686,"column":16},"end":{"line":1686,"column":28}},"363":{"start":{"line":1688,"column":16},"end":{"line":1688,"column":52}},"364":{"start":{"line":1692,"column":12},"end":{"line":1692,"column":66}},"365":{"start":{"line":1695,"column":8},"end":{"line":1695,"column":34}},"366":{"start":{"line":1696,"column":8},"end":{"line":1696,"column":25}},"367":{"start":{"line":1697,"column":8},"end":{"line":1697,"column":29}},"368":{"start":{"line":1700,"column":8},"end":{"line":1704,"column":9}},"369":{"start":{"line":1701,"column":12},"end":{"line":1701,"column":50}},"370":{"start":{"line":1702,"column":12},"end":{"line":1702,"column":53}},"371":{"start":{"line":1703,"column":12},"end":{"line":1703,"column":39}},"372":{"start":{"line":1706,"column":8},"end":{"line":1706,"column":24}},"373":{"start":{"line":1708,"column":8},"end":{"line":1738,"column":9}},"374":{"start":{"line":1710,"column":12},"end":{"line":1710,"column":44}},"375":{"start":{"line":1711,"column":12},"end":{"line":1711,"column":51}},"376":{"start":{"line":1712,"column":12},"end":{"line":1712,"column":32}},"377":{"start":{"line":1714,"column":12},"end":{"line":1729,"column":13}},"378":{"start":{"line":1715,"column":16},"end":{"line":1715,"column":28}},"379":{"start":{"line":1717,"column":16},"end":{"line":1721,"column":17}},"380":{"start":{"line":1718,"column":20},"end":{"line":1718,"column":50}},"381":{"start":{"line":1719,"column":23},"end":{"line":1721,"column":17}},"382":{"start":{"line":1720,"column":20},"end":{"line":1720,"column":43}},"383":{"start":{"line":1723,"column":16},"end":{"line":1723,"column":58}},"384":{"start":{"line":1726,"column":16},"end":{"line":1728,"column":17}},"385":{"start":{"line":1727,"column":20},"end":{"line":1727,"column":32}},"386":{"start":{"line":1732,"column":12},"end":{"line":1736,"column":13}},"387":{"start":{"line":1733,"column":16},"end":{"line":1733,"column":49}},"388":{"start":{"line":1734,"column":19},"end":{"line":1736,"column":13}},"389":{"start":{"line":1735,"column":16},"end":{"line":1735,"column":47}},"390":{"start":{"line":1740,"column":8},"end":{"line":1748,"column":9}},"391":{"start":{"line":1741,"column":12},"end":{"line":1741,"column":59}},"392":{"start":{"line":1742,"column":12},"end":{"line":1742,"column":131}},"393":{"start":{"line":1745,"column":12},"end":{"line":1747,"column":13}},"394":{"start":{"line":1746,"column":16},"end":{"line":1746,"column":41}},"395":{"start":{"line":1750,"column":8},"end":{"line":1754,"column":9}},"396":{"start":{"line":1751,"column":12},"end":{"line":1751,"column":64}},"397":{"start":{"line":1752,"column":12},"end":{"line":1752,"column":76}},"398":{"start":{"line":1753,"column":12},"end":{"line":1753,"column":53}},"399":{"start":{"line":1756,"column":8},"end":{"line":1756,"column":46}},"400":{"start":{"line":1766,"column":8},"end":{"line":1766,"column":46}},"401":{"start":{"line":1787,"column":8},"end":{"line":1790,"column":56}},"402":{"start":{"line":1793,"column":8},"end":{"line":1804,"column":9}},"403":{"start":{"line":1794,"column":12},"end":{"line":1798,"column":13}},"404":{"start":{"line":1795,"column":16},"end":{"line":1797,"column":17}},"405":{"start":{"line":1796,"column":20},"end":{"line":1796,"column":48}},"406":{"start":{"line":1799,"column":12},"end":{"line":1801,"column":13}},"407":{"start":{"line":1800,"column":16},"end":{"line":1800,"column":60}},"408":{"start":{"line":1803,"column":12},"end":{"line":1803,"column":24}},"409":{"start":{"line":1806,"column":8},"end":{"line":1822,"column":10}},"410":{"start":{"line":1813,"column":12},"end":{"line":1813,"column":45}},"411":{"start":{"line":1814,"column":12},"end":{"line":1821,"column":13}},"412":{"start":{"line":1815,"column":16},"end":{"line":1820,"column":17}},"413":{"start":{"line":1816,"column":20},"end":{"line":1816,"column":40}},"414":{"start":{"line":1817,"column":20},"end":{"line":1819,"column":21}},"415":{"start":{"line":1818,"column":24},"end":{"line":1818,"column":44}},"416":{"start":{"line":1824,"column":8},"end":{"line":1854,"column":9}},"417":{"start":{"line":1826,"column":12},"end":{"line":1826,"column":40}},"418":{"start":{"line":1827,"column":12},"end":{"line":1827,"column":28}},"419":{"start":{"line":1828,"column":12},"end":{"line":1828,"column":67}},"420":{"start":{"line":1830,"column":12},"end":{"line":1842,"column":13}},"421":{"start":{"line":1831,"column":16},"end":{"line":1839,"column":17}},"422":{"start":{"line":1832,"column":20},"end":{"line":1832,"column":55}},"423":{"start":{"line":1834,"column":20},"end":{"line":1838,"column":21}},"424":{"start":{"line":1835,"column":24},"end":{"line":1837,"column":25}},"425":{"start":{"line":1836,"column":28},"end":{"line":1836,"column":60}},"426":{"start":{"line":1841,"column":16},"end":{"line":1841,"column":28}},"427":{"start":{"line":1845,"column":15},"end":{"line":1854,"column":9}},"428":{"start":{"line":1846,"column":12},"end":{"line":1846,"column":26}},"429":{"start":{"line":1847,"column":12},"end":{"line":1847,"column":24}},"430":{"start":{"line":1849,"column":15},"end":{"line":1854,"column":9}},"431":{"start":{"line":1850,"column":12},"end":{"line":1850,"column":50}},"432":{"start":{"line":1851,"column":12},"end":{"line":1851,"column":44}},"433":{"start":{"line":1852,"column":12},"end":{"line":1852,"column":36}},"434":{"start":{"line":1853,"column":12},"end":{"line":1853,"column":24}},"435":{"start":{"line":1856,"column":8},"end":{"line":1856,"column":45}},"436":{"start":{"line":1859,"column":8},"end":{"line":1871,"column":9}},"437":{"start":{"line":1860,"column":12},"end":{"line":1860,"column":50}},"438":{"start":{"line":1862,"column":12},"end":{"line":1870,"column":13}},"439":{"start":{"line":1863,"column":16},"end":{"line":1863,"column":44}},"440":{"start":{"line":1864,"column":16},"end":{"line":1864,"column":28}},"441":{"start":{"line":1866,"column":19},"end":{"line":1870,"column":13}},"442":{"start":{"line":1867,"column":16},"end":{"line":1867,"column":31}},"443":{"start":{"line":1868,"column":16},"end":{"line":1868,"column":52}},"444":{"start":{"line":1869,"column":16},"end":{"line":1869,"column":28}},"445":{"start":{"line":1874,"column":8},"end":{"line":1874,"column":28}},"446":{"start":{"line":1875,"column":8},"end":{"line":1877,"column":9}},"447":{"start":{"line":1876,"column":12},"end":{"line":1876,"column":35}},"448":{"start":{"line":1879,"column":8},"end":{"line":1879,"column":20}},"449":{"start":{"line":1888,"column":8},"end":{"line":1888,"column":50}},"450":{"start":{"line":1899,"column":8},"end":{"line":1899,"column":33}},"451":{"start":{"line":1911,"column":8},"end":{"line":1911,"column":53}},"452":{"start":{"line":1982,"column":8},"end":{"line":1985,"column":34}},"453":{"start":{"line":1987,"column":8},"end":{"line":2002,"column":9}},"454":{"start":{"line":1988,"column":12},"end":{"line":1990,"column":13}},"455":{"start":{"line":1989,"column":16},"end":{"line":1989,"column":43}},"456":{"start":{"line":1991,"column":12},"end":{"line":1991,"column":54}},"457":{"start":{"line":1993,"column":12},"end":{"line":1993,"column":21}},"458":{"start":{"line":1995,"column":12},"end":{"line":2000,"column":21}},"459":{"start":{"line":1996,"column":16},"end":{"line":1998,"column":17}},"460":{"start":{"line":1997,"column":20},"end":{"line":1997,"column":41}},"461":{"start":{"line":1999,"column":16},"end":{"line":1999,"column":63}},"462":{"start":{"line":2004,"column":8},"end":{"line":2004,"column":19}},"463":{"start":{"line":2022,"column":8},"end":{"line":2022,"column":45}},"464":{"start":{"line":2024,"column":8},"end":{"line":2028,"column":9}},"465":{"start":{"line":2025,"column":12},"end":{"line":2025,"column":49}},"466":{"start":{"line":2027,"column":12},"end":{"line":2027,"column":24}},"467":{"start":{"line":2046,"column":8},"end":{"line":2051,"column":36}},"468":{"start":{"line":2053,"column":8},"end":{"line":2053,"column":30}},"469":{"start":{"line":2056,"column":8},"end":{"line":2060,"column":9}},"470":{"start":{"line":2057,"column":12},"end":{"line":2059,"column":15}},"471":{"start":{"line":2062,"column":8},"end":{"line":2070,"column":9}},"472":{"start":{"line":2064,"column":12},"end":{"line":2064,"column":72}},"473":{"start":{"line":2066,"column":12},"end":{"line":2069,"column":13}},"474":{"start":{"line":2067,"column":16},"end":{"line":2067,"column":31}},"475":{"start":{"line":2068,"column":16},"end":{"line":2068,"column":37}},"476":{"start":{"line":2072,"column":8},"end":{"line":2074,"column":9}},"477":{"start":{"line":2073,"column":12},"end":{"line":2073,"column":41}},"478":{"start":{"line":2076,"column":8},"end":{"line":2076,"column":18}},"479":{"start":{"line":2097,"column":8},"end":{"line":2097,"column":33}},"480":{"start":{"line":2099,"column":8},"end":{"line":2113,"column":9}},"481":{"start":{"line":2100,"column":12},"end":{"line":2106,"column":13}},"482":{"start":{"line":2101,"column":16},"end":{"line":2101,"column":33}},"483":{"start":{"line":2102,"column":16},"end":{"line":2102,"column":52}},"484":{"start":{"line":2104,"column":16},"end":{"line":2104,"column":31}},"485":{"start":{"line":2105,"column":16},"end":{"line":2105,"column":38}},"486":{"start":{"line":2108,"column":12},"end":{"line":2112,"column":13}},"487":{"start":{"line":2109,"column":16},"end":{"line":2109,"column":47}},"488":{"start":{"line":2110,"column":16},"end":{"line":2110,"column":35}},"489":{"start":{"line":2111,"column":16},"end":{"line":2111,"column":52}},"490":{"start":{"line":2145,"column":8},"end":{"line":2154,"column":17}},"491":{"start":{"line":2156,"column":8},"end":{"line":2168,"column":9}},"492":{"start":{"line":2160,"column":12},"end":{"line":2164,"column":13}},"493":{"start":{"line":2161,"column":16},"end":{"line":2161,"column":38}},"494":{"start":{"line":2163,"column":16},"end":{"line":2163,"column":26}},"495":{"start":{"line":2167,"column":12},"end":{"line":2167,"column":73}},"496":{"start":{"line":2170,"column":8},"end":{"line":2172,"column":9}},"497":{"start":{"line":2171,"column":12},"end":{"line":2171,"column":36}},"498":{"start":{"line":2174,"column":8},"end":{"line":2176,"column":9}},"499":{"start":{"line":2175,"column":12},"end":{"line":2175,"column":33}},"500":{"start":{"line":2178,"column":8},"end":{"line":2178,"column":30}},"501":{"start":{"line":2180,"column":8},"end":{"line":2186,"column":9}},"502":{"start":{"line":2181,"column":12},"end":{"line":2181,"column":41}},"503":{"start":{"line":2183,"column":12},"end":{"line":2185,"column":13}},"504":{"start":{"line":2184,"column":16},"end":{"line":2184,"column":37}},"505":{"start":{"line":2189,"column":8},"end":{"line":2193,"column":9}},"506":{"start":{"line":2190,"column":12},"end":{"line":2192,"column":15}},"507":{"start":{"line":2196,"column":8},"end":{"line":2210,"column":9}},"508":{"start":{"line":2197,"column":12},"end":{"line":2199,"column":13}},"509":{"start":{"line":2198,"column":16},"end":{"line":2198,"column":60}},"510":{"start":{"line":2202,"column":12},"end":{"line":2202,"column":23}},"511":{"start":{"line":2205,"column":12},"end":{"line":2207,"column":13}},"512":{"start":{"line":2206,"column":16},"end":{"line":2206,"column":33}},"513":{"start":{"line":2209,"column":12},"end":{"line":2209,"column":33}},"514":{"start":{"line":2212,"column":8},"end":{"line":2212,"column":43}},"515":{"start":{"line":2216,"column":8},"end":{"line":2216,"column":16}},"516":{"start":{"line":2219,"column":8},"end":{"line":2227,"column":9}},"517":{"start":{"line":2220,"column":12},"end":{"line":2220,"column":35}},"518":{"start":{"line":2221,"column":12},"end":{"line":2221,"column":44}},"519":{"start":{"line":2222,"column":12},"end":{"line":2226,"column":13}},"520":{"start":{"line":2223,"column":16},"end":{"line":2223,"column":36}},"521":{"start":{"line":2224,"column":16},"end":{"line":2224,"column":36}},"522":{"start":{"line":2225,"column":16},"end":{"line":2225,"column":34}},"523":{"start":{"line":2229,"column":8},"end":{"line":2229,"column":19}},"524":{"start":{"line":2241,"column":8},"end":{"line":2241,"column":19}},"525":{"start":{"line":2243,"column":8},"end":{"line":2246,"column":9}},"526":{"start":{"line":2244,"column":12},"end":{"line":2244,"column":45}},"527":{"start":{"line":2245,"column":12},"end":{"line":2245,"column":54}},"528":{"start":{"line":2247,"column":8},"end":{"line":2247,"column":32}},"529":{"start":{"line":2248,"column":8},"end":{"line":2248,"column":31}},"530":{"start":{"line":2267,"column":8},"end":{"line":2267,"column":47}},"531":{"start":{"line":2269,"column":8},"end":{"line":2282,"column":9}},"532":{"start":{"line":2271,"column":16},"end":{"line":2271,"column":57}},"533":{"start":{"line":2278,"column":16},"end":{"line":2278,"column":35}},"534":{"start":{"line":2279,"column":16},"end":{"line":2279,"column":22}},"535":{"start":{"line":2281,"column":16},"end":{"line":2281,"column":43}},"536":{"start":{"line":2284,"column":8},"end":{"line":2284,"column":38}},"537":{"start":{"line":2304,"column":8},"end":{"line":2304,"column":46}},"538":{"start":{"line":2309,"column":0},"end":{"line":2309,"column":19}},"539":{"start":{"line":2312,"column":0},"end":{"line":2312,"column":23}},"540":{"start":{"line":2313,"column":0},"end":{"line":2313,"column":31}},"541":{"start":{"line":2315,"column":0},"end":{"line":2315,"column":56}},"542":{"start":{"line":2325,"column":0},"end":{"line":2325,"column":32}}},"branchMap":{"1":{"line":77,"type":"if","locations":[{"start":{"line":77,"column":8},"end":{"line":77,"column":8}},{"start":{"line":77,"column":8},"end":{"line":77,"column":8}}]},"2":{"line":114,"type":"if","locations":[{"start":{"line":114,"column":8},"end":{"line":114,"column":8}},{"start":{"line":114,"column":8},"end":{"line":114,"column":8}}]},"3":{"line":140,"type":"if","locations":[{"start":{"line":140,"column":8},"end":{"line":140,"column":8}},{"start":{"line":140,"column":8},"end":{"line":140,"column":8}}]},"4":{"line":147,"type":"if","locations":[{"start":{"line":147,"column":8},"end":{"line":147,"column":8}},{"start":{"line":147,"column":8},"end":{"line":147,"column":8}}]},"5":{"line":174,"type":"if","locations":[{"start":{"line":174,"column":8},"end":{"line":174,"column":8}},{"start":{"line":174,"column":8},"end":{"line":174,"column":8}}]},"6":{"line":228,"type":"if","locations":[{"start":{"line":228,"column":4},"end":{"line":228,"column":4}},{"start":{"line":228,"column":4},"end":{"line":228,"column":4}}]},"7":{"line":271,"type":"if","locations":[{"start":{"line":271,"column":8},"end":{"line":271,"column":8}},{"start":{"line":271,"column":8},"end":{"line":271,"column":8}}]},"8":{"line":273,"type":"if","locations":[{"start":{"line":273,"column":12},"end":{"line":273,"column":12}},{"start":{"line":273,"column":12},"end":{"line":273,"column":12}}]},"9":{"line":274,"type":"switch","locations":[{"start":{"line":275,"column":20},"end":{"line":276,"column":42}},{"start":{"line":277,"column":20},"end":{"line":279,"column":30}},{"start":{"line":280,"column":20},"end":{"line":282,"column":30}},{"start":{"line":283,"column":20},"end":{"line":283,"column":28}}]},"10":{"line":290,"type":"if","locations":[{"start":{"line":290,"column":4},"end":{"line":290,"column":4}},{"start":{"line":290,"column":4},"end":{"line":290,"column":4}}]},"11":{"line":299,"type":"if","locations":[{"start":{"line":299,"column":8},"end":{"line":299,"column":8}},{"start":{"line":299,"column":8},"end":{"line":299,"column":8}}]},"12":{"line":302,"type":"if","locations":[{"start":{"line":302,"column":12},"end":{"line":302,"column":12}},{"start":{"line":302,"column":12},"end":{"line":302,"column":12}}]},"13":{"line":302,"type":"binary-expr","locations":[{"start":{"line":302,"column":16},"end":{"line":302,"column":22}},{"start":{"line":302,"column":26},"end":{"line":302,"column":56}}]},"14":{"line":305,"type":"if","locations":[{"start":{"line":305,"column":19},"end":{"line":305,"column":19}},{"start":{"line":305,"column":19},"end":{"line":305,"column":19}}]},"15":{"line":305,"type":"binary-expr","locations":[{"start":{"line":305,"column":23},"end":{"line":305,"column":29}},{"start":{"line":305,"column":33},"end":{"line":305,"column":70}}]},"16":{"line":436,"type":"if","locations":[{"start":{"line":436,"column":12},"end":{"line":436,"column":12}},{"start":{"line":436,"column":12},"end":{"line":436,"column":12}}]},"17":{"line":436,"type":"binary-expr","locations":[{"start":{"line":436,"column":16},"end":{"line":436,"column":31}},{"start":{"line":436,"column":36},"end":{"line":436,"column":38}},{"start":{"line":436,"column":42},"end":{"line":436,"column":51}}]},"18":{"line":477,"type":"if","locations":[{"start":{"line":477,"column":4},"end":{"line":477,"column":4}},{"start":{"line":477,"column":4},"end":{"line":477,"column":4}}]},"19":{"line":495,"type":"if","locations":[{"start":{"line":495,"column":4},"end":{"line":495,"column":4}},{"start":{"line":495,"column":4},"end":{"line":495,"column":4}}]},"20":{"line":708,"type":"if","locations":[{"start":{"line":708,"column":8},"end":{"line":708,"column":8}},{"start":{"line":708,"column":8},"end":{"line":708,"column":8}}]},"21":{"line":712,"type":"if","locations":[{"start":{"line":712,"column":8},"end":{"line":712,"column":8}},{"start":{"line":712,"column":8},"end":{"line":712,"column":8}}]},"22":{"line":716,"type":"if","locations":[{"start":{"line":716,"column":8},"end":{"line":716,"column":8}},{"start":{"line":716,"column":8},"end":{"line":716,"column":8}}]},"23":{"line":720,"type":"if","locations":[{"start":{"line":720,"column":12},"end":{"line":720,"column":12}},{"start":{"line":720,"column":12},"end":{"line":720,"column":12}}]},"24":{"line":724,"type":"if","locations":[{"start":{"line":724,"column":12},"end":{"line":724,"column":12}},{"start":{"line":724,"column":12},"end":{"line":724,"column":12}}]},"25":{"line":729,"type":"if","locations":[{"start":{"line":729,"column":8},"end":{"line":729,"column":8}},{"start":{"line":729,"column":8},"end":{"line":729,"column":8}}]},"26":{"line":730,"type":"cond-expr","locations":[{"start":{"line":730,"column":40},"end":{"line":730,"column":41}},{"start":{"line":730,"column":44},"end":{"line":730,"column":45}}]},"27":{"line":765,"type":"if","locations":[{"start":{"line":765,"column":8},"end":{"line":765,"column":8}},{"start":{"line":765,"column":8},"end":{"line":765,"column":8}}]},"28":{"line":770,"type":"if","locations":[{"start":{"line":770,"column":8},"end":{"line":770,"column":8}},{"start":{"line":770,"column":8},"end":{"line":770,"column":8}}]},"29":{"line":771,"type":"if","locations":[{"start":{"line":771,"column":12},"end":{"line":771,"column":12}},{"start":{"line":771,"column":12},"end":{"line":771,"column":12}}]},"30":{"line":777,"type":"if","locations":[{"start":{"line":777,"column":12},"end":{"line":777,"column":12}},{"start":{"line":777,"column":12},"end":{"line":777,"column":12}}]},"31":{"line":784,"type":"if","locations":[{"start":{"line":784,"column":8},"end":{"line":784,"column":8}},{"start":{"line":784,"column":8},"end":{"line":784,"column":8}}]},"32":{"line":785,"type":"if","locations":[{"start":{"line":785,"column":12},"end":{"line":785,"column":12}},{"start":{"line":785,"column":12},"end":{"line":785,"column":12}}]},"33":{"line":791,"type":"if","locations":[{"start":{"line":791,"column":12},"end":{"line":791,"column":12}},{"start":{"line":791,"column":12},"end":{"line":791,"column":12}}]},"34":{"line":830,"type":"if","locations":[{"start":{"line":830,"column":8},"end":{"line":830,"column":8}},{"start":{"line":830,"column":8},"end":{"line":830,"column":8}}]},"35":{"line":830,"type":"binary-expr","locations":[{"start":{"line":830,"column":12},"end":{"line":830,"column":25}},{"start":{"line":830,"column":29},"end":{"line":830,"column":39}}]},"36":{"line":831,"type":"if","locations":[{"start":{"line":831,"column":12},"end":{"line":831,"column":12}},{"start":{"line":831,"column":12},"end":{"line":831,"column":12}}]},"37":{"line":838,"type":"if","locations":[{"start":{"line":838,"column":8},"end":{"line":838,"column":8}},{"start":{"line":838,"column":8},"end":{"line":838,"column":8}}]},"38":{"line":839,"type":"if","locations":[{"start":{"line":839,"column":12},"end":{"line":839,"column":12}},{"start":{"line":839,"column":12},"end":{"line":839,"column":12}}]},"39":{"line":845,"type":"if","locations":[{"start":{"line":845,"column":12},"end":{"line":845,"column":12}},{"start":{"line":845,"column":12},"end":{"line":845,"column":12}}]},"40":{"line":852,"type":"if","locations":[{"start":{"line":852,"column":8},"end":{"line":852,"column":8}},{"start":{"line":852,"column":8},"end":{"line":852,"column":8}}]},"41":{"line":853,"type":"if","locations":[{"start":{"line":853,"column":12},"end":{"line":853,"column":12}},{"start":{"line":853,"column":12},"end":{"line":853,"column":12}}]},"42":{"line":871,"type":"cond-expr","locations":[{"start":{"line":871,"column":41},"end":{"line":871,"column":71}},{"start":{"line":871,"column":74},"end":{"line":871,"column":78}}]},"43":{"line":885,"type":"cond-expr","locations":[{"start":{"line":885,"column":41},"end":{"line":885,"column":71}},{"start":{"line":885,"column":74},"end":{"line":885,"column":78}}]},"44":{"line":887,"type":"if","locations":[{"start":{"line":887,"column":8},"end":{"line":887,"column":8}},{"start":{"line":887,"column":8},"end":{"line":887,"column":8}}]},"45":{"line":887,"type":"binary-expr","locations":[{"start":{"line":887,"column":12},"end":{"line":887,"column":26}},{"start":{"line":887,"column":30},"end":{"line":887,"column":39}}]},"46":{"line":907,"type":"cond-expr","locations":[{"start":{"line":907,"column":41},"end":{"line":907,"column":71}},{"start":{"line":907,"column":74},"end":{"line":907,"column":78}}]},"47":{"line":921,"type":"if","locations":[{"start":{"line":921,"column":8},"end":{"line":921,"column":8}},{"start":{"line":921,"column":8},"end":{"line":921,"column":8}}]},"48":{"line":921,"type":"binary-expr","locations":[{"start":{"line":921,"column":12},"end":{"line":921,"column":14}},{"start":{"line":921,"column":18},"end":{"line":921,"column":27}}]},"49":{"line":930,"type":"if","locations":[{"start":{"line":930,"column":8},"end":{"line":930,"column":8}},{"start":{"line":930,"column":8},"end":{"line":930,"column":8}}]},"50":{"line":933,"type":"if","locations":[{"start":{"line":933,"column":16},"end":{"line":933,"column":16}},{"start":{"line":933,"column":16},"end":{"line":933,"column":16}}]},"51":{"line":933,"type":"binary-expr","locations":[{"start":{"line":933,"column":20},"end":{"line":933,"column":21}},{"start":{"line":933,"column":26},"end":{"line":933,"column":29}},{"start":{"line":933,"column":33},"end":{"line":933,"column":44}}]},"52":{"line":940,"type":"if","locations":[{"start":{"line":940,"column":8},"end":{"line":940,"column":8}},{"start":{"line":940,"column":8},"end":{"line":940,"column":8}}]},"53":{"line":943,"type":"if","locations":[{"start":{"line":943,"column":16},"end":{"line":943,"column":16}},{"start":{"line":943,"column":16},"end":{"line":943,"column":16}}]},"54":{"line":943,"type":"binary-expr","locations":[{"start":{"line":943,"column":20},"end":{"line":943,"column":21}},{"start":{"line":943,"column":26},"end":{"line":943,"column":29}},{"start":{"line":943,"column":33},"end":{"line":943,"column":44}}]},"55":{"line":980,"type":"if","locations":[{"start":{"line":980,"column":8},"end":{"line":980,"column":8}},{"start":{"line":980,"column":8},"end":{"line":980,"column":8}}]},"56":{"line":980,"type":"binary-expr","locations":[{"start":{"line":980,"column":12},"end":{"line":980,"column":25}},{"start":{"line":980,"column":29},"end":{"line":980,"column":45}}]},"57":{"line":1037,"type":"if","locations":[{"start":{"line":1037,"column":8},"end":{"line":1037,"column":8}},{"start":{"line":1037,"column":8},"end":{"line":1037,"column":8}}]},"58":{"line":1037,"type":"binary-expr","locations":[{"start":{"line":1037,"column":12},"end":{"line":1037,"column":25}},{"start":{"line":1037,"column":29},"end":{"line":1037,"column":39}}]},"59":{"line":1046,"type":"if","locations":[{"start":{"line":1046,"column":12},"end":{"line":1046,"column":12}},{"start":{"line":1046,"column":12},"end":{"line":1046,"column":12}}]},"60":{"line":1050,"type":"if","locations":[{"start":{"line":1050,"column":12},"end":{"line":1050,"column":12}},{"start":{"line":1050,"column":12},"end":{"line":1050,"column":12}}]},"61":{"line":1069,"type":"if","locations":[{"start":{"line":1069,"column":8},"end":{"line":1069,"column":8}},{"start":{"line":1069,"column":8},"end":{"line":1069,"column":8}}]},"62":{"line":1074,"type":"if","locations":[{"start":{"line":1074,"column":8},"end":{"line":1074,"column":8}},{"start":{"line":1074,"column":8},"end":{"line":1074,"column":8}}]},"63":{"line":1077,"type":"cond-expr","locations":[{"start":{"line":1077,"column":30},"end":{"line":1077,"column":35}},{"start":{"line":1077,"column":38},"end":{"line":1077,"column":42}}]},"64":{"line":1082,"type":"binary-expr","locations":[{"start":{"line":1082,"column":18},"end":{"line":1082,"column":25}},{"start":{"line":1082,"column":29},"end":{"line":1082,"column":31}}]},"65":{"line":1103,"type":"if","locations":[{"start":{"line":1103,"column":12},"end":{"line":1103,"column":12}},{"start":{"line":1103,"column":12},"end":{"line":1103,"column":12}}]},"66":{"line":1103,"type":"binary-expr","locations":[{"start":{"line":1103,"column":16},"end":{"line":1103,"column":17}},{"start":{"line":1103,"column":21},"end":{"line":1103,"column":25}}]},"67":{"line":1104,"type":"if","locations":[{"start":{"line":1104,"column":16},"end":{"line":1104,"column":16}},{"start":{"line":1104,"column":16},"end":{"line":1104,"column":16}}]},"68":{"line":1107,"type":"if","locations":[{"start":{"line":1107,"column":16},"end":{"line":1107,"column":16}},{"start":{"line":1107,"column":16},"end":{"line":1107,"column":16}}]},"69":{"line":1125,"type":"if","locations":[{"start":{"line":1125,"column":8},"end":{"line":1125,"column":8}},{"start":{"line":1125,"column":8},"end":{"line":1125,"column":8}}]},"70":{"line":1125,"type":"binary-expr","locations":[{"start":{"line":1125,"column":12},"end":{"line":1125,"column":25}},{"start":{"line":1125,"column":29},"end":{"line":1125,"column":43}}]},"71":{"line":1130,"type":"if","locations":[{"start":{"line":1130,"column":12},"end":{"line":1130,"column":12}},{"start":{"line":1130,"column":12},"end":{"line":1130,"column":12}}]},"72":{"line":1134,"type":"if","locations":[{"start":{"line":1134,"column":12},"end":{"line":1134,"column":12}},{"start":{"line":1134,"column":12},"end":{"line":1134,"column":12}}]},"73":{"line":1172,"type":"if","locations":[{"start":{"line":1172,"column":8},"end":{"line":1172,"column":8}},{"start":{"line":1172,"column":8},"end":{"line":1172,"column":8}}]},"74":{"line":1173,"type":"cond-expr","locations":[{"start":{"line":1173,"column":38},"end":{"line":1173,"column":50}},{"start":{"line":1173,"column":53},"end":{"line":1173,"column":70}}]},"75":{"line":1177,"type":"if","locations":[{"start":{"line":1177,"column":8},"end":{"line":1177,"column":8}},{"start":{"line":1177,"column":8},"end":{"line":1177,"column":8}}]},"76":{"line":1178,"type":"if","locations":[{"start":{"line":1178,"column":12},"end":{"line":1178,"column":12}},{"start":{"line":1178,"column":12},"end":{"line":1178,"column":12}}]},"77":{"line":1178,"type":"binary-expr","locations":[{"start":{"line":1178,"column":16},"end":{"line":1178,"column":17}},{"start":{"line":1178,"column":21},"end":{"line":1178,"column":34}}]},"78":{"line":1181,"type":"if","locations":[{"start":{"line":1181,"column":16},"end":{"line":1181,"column":16}},{"start":{"line":1181,"column":16},"end":{"line":1181,"column":16}}]},"79":{"line":1182,"type":"if","locations":[{"start":{"line":1182,"column":20},"end":{"line":1182,"column":20}},{"start":{"line":1182,"column":20},"end":{"line":1182,"column":20}}]},"80":{"line":1191,"type":"if","locations":[{"start":{"line":1191,"column":8},"end":{"line":1191,"column":8}},{"start":{"line":1191,"column":8},"end":{"line":1191,"column":8}}]},"81":{"line":1192,"type":"if","locations":[{"start":{"line":1192,"column":12},"end":{"line":1192,"column":12}},{"start":{"line":1192,"column":12},"end":{"line":1192,"column":12}}]},"82":{"line":1199,"type":"if","locations":[{"start":{"line":1199,"column":8},"end":{"line":1199,"column":8}},{"start":{"line":1199,"column":8},"end":{"line":1199,"column":8}}]},"83":{"line":1199,"type":"binary-expr","locations":[{"start":{"line":1199,"column":12},"end":{"line":1199,"column":26}},{"start":{"line":1199,"column":30},"end":{"line":1199,"column":39}}]},"84":{"line":1206,"type":"if","locations":[{"start":{"line":1206,"column":8},"end":{"line":1206,"column":8}},{"start":{"line":1206,"column":8},"end":{"line":1206,"column":8}}]},"85":{"line":1272,"type":"if","locations":[{"start":{"line":1272,"column":8},"end":{"line":1272,"column":8}},{"start":{"line":1272,"column":8},"end":{"line":1272,"column":8}}]},"86":{"line":1272,"type":"binary-expr","locations":[{"start":{"line":1272,"column":12},"end":{"line":1272,"column":24}},{"start":{"line":1272,"column":28},"end":{"line":1272,"column":43}}]},"87":{"line":1273,"type":"if","locations":[{"start":{"line":1273,"column":12},"end":{"line":1273,"column":12}},{"start":{"line":1273,"column":12},"end":{"line":1273,"column":12}}]},"88":{"line":1282,"type":"switch","locations":[{"start":{"line":1283,"column":12},"end":{"line":1285,"column":22}},{"start":{"line":1286,"column":12},"end":{"line":1288,"column":22}},{"start":{"line":1289,"column":12},"end":{"line":1296,"column":17}}]},"89":{"line":1287,"type":"binary-expr","locations":[{"start":{"line":1287,"column":38},"end":{"line":1287,"column":45}},{"start":{"line":1287,"column":49},"end":{"line":1287,"column":53}}]},"90":{"line":1290,"type":"if","locations":[{"start":{"line":1290,"column":16},"end":{"line":1290,"column":16}},{"start":{"line":1290,"column":16},"end":{"line":1290,"column":16}}]},"91":{"line":1290,"type":"binary-expr","locations":[{"start":{"line":1290,"column":20},"end":{"line":1290,"column":21}},{"start":{"line":1290,"column":25},"end":{"line":1290,"column":29}}]},"92":{"line":1291,"type":"binary-expr","locations":[{"start":{"line":1291,"column":27},"end":{"line":1291,"column":31}},{"start":{"line":1291,"column":35},"end":{"line":1291,"column":37}}]},"93":{"line":1292,"type":"cond-expr","locations":[{"start":{"line":1292,"column":30},"end":{"line":1292,"column":44}},{"start":{"line":1292,"column":47},"end":{"line":1292,"column":51}}]},"94":{"line":1299,"type":"if","locations":[{"start":{"line":1299,"column":8},"end":{"line":1299,"column":8}},{"start":{"line":1299,"column":8},"end":{"line":1299,"column":8}}]},"95":{"line":1316,"type":"if","locations":[{"start":{"line":1316,"column":8},"end":{"line":1316,"column":8}},{"start":{"line":1316,"column":8},"end":{"line":1316,"column":8}}]},"96":{"line":1317,"type":"cond-expr","locations":[{"start":{"line":1317,"column":33},"end":{"line":1317,"column":47}},{"start":{"line":1317,"column":50},"end":{"line":1317,"column":60}}]},"97":{"line":1321,"type":"if","locations":[{"start":{"line":1321,"column":8},"end":{"line":1321,"column":8}},{"start":{"line":1321,"column":8},"end":{"line":1321,"column":8}}]},"98":{"line":1321,"type":"binary-expr","locations":[{"start":{"line":1321,"column":12},"end":{"line":1321,"column":20}},{"start":{"line":1321,"column":24},"end":{"line":1321,"column":42}}]},"99":{"line":1345,"type":"if","locations":[{"start":{"line":1345,"column":8},"end":{"line":1345,"column":8}},{"start":{"line":1345,"column":8},"end":{"line":1345,"column":8}}]},"100":{"line":1346,"type":"binary-expr","locations":[{"start":{"line":1346,"column":21},"end":{"line":1346,"column":35}},{"start":{"line":1346,"column":40},"end":{"line":1346,"column":64}}]},"101":{"line":1385,"type":"binary-expr","locations":[{"start":{"line":1385,"column":15},"end":{"line":1385,"column":16}},{"start":{"line":1385,"column":20},"end":{"line":1385,"column":24}}]},"102":{"line":1386,"type":"if","locations":[{"start":{"line":1386,"column":8},"end":{"line":1386,"column":8}},{"start":{"line":1386,"column":8},"end":{"line":1386,"column":8}}]},"103":{"line":1388,"type":"binary-expr","locations":[{"start":{"line":1388,"column":29},"end":{"line":1388,"column":30}},{"start":{"line":1388,"column":34},"end":{"line":1388,"column":35}}]},"104":{"line":1400,"type":"if","locations":[{"start":{"line":1400,"column":8},"end":{"line":1400,"column":8}},{"start":{"line":1400,"column":8},"end":{"line":1400,"column":8}}]},"105":{"line":1401,"type":"if","locations":[{"start":{"line":1401,"column":12},"end":{"line":1401,"column":12}},{"start":{"line":1401,"column":12},"end":{"line":1401,"column":12}}]},"106":{"line":1471,"type":"if","locations":[{"start":{"line":1471,"column":8},"end":{"line":1471,"column":8}},{"start":{"line":1471,"column":8},"end":{"line":1471,"column":8}}]},"107":{"line":1471,"type":"binary-expr","locations":[{"start":{"line":1471,"column":12},"end":{"line":1471,"column":16}},{"start":{"line":1471,"column":20},"end":{"line":1471,"column":55}}]},"108":{"line":1489,"type":"if","locations":[{"start":{"line":1489,"column":8},"end":{"line":1489,"column":8}},{"start":{"line":1489,"column":8},"end":{"line":1489,"column":8}}]},"109":{"line":1495,"type":"if","locations":[{"start":{"line":1495,"column":8},"end":{"line":1495,"column":8}},{"start":{"line":1495,"column":8},"end":{"line":1495,"column":8}}]},"110":{"line":1502,"type":"if","locations":[{"start":{"line":1502,"column":8},"end":{"line":1502,"column":8}},{"start":{"line":1502,"column":8},"end":{"line":1502,"column":8}}]},"111":{"line":1505,"type":"if","locations":[{"start":{"line":1505,"column":12},"end":{"line":1505,"column":12}},{"start":{"line":1505,"column":12},"end":{"line":1505,"column":12}}]},"112":{"line":1511,"type":"cond-expr","locations":[{"start":{"line":1511,"column":40},"end":{"line":1511,"column":56}},{"start":{"line":1511,"column":59},"end":{"line":1511,"column":60}}]},"113":{"line":1519,"type":"if","locations":[{"start":{"line":1519,"column":8},"end":{"line":1519,"column":8}},{"start":{"line":1519,"column":8},"end":{"line":1519,"column":8}}]},"114":{"line":1533,"type":"if","locations":[{"start":{"line":1533,"column":8},"end":{"line":1533,"column":8}},{"start":{"line":1533,"column":8},"end":{"line":1533,"column":8}}]},"115":{"line":1536,"type":"if","locations":[{"start":{"line":1536,"column":12},"end":{"line":1536,"column":12}},{"start":{"line":1536,"column":12},"end":{"line":1536,"column":12}}]},"116":{"line":1540,"type":"if","locations":[{"start":{"line":1540,"column":12},"end":{"line":1540,"column":12}},{"start":{"line":1540,"column":12},"end":{"line":1540,"column":12}}]},"117":{"line":1565,"type":"if","locations":[{"start":{"line":1565,"column":12},"end":{"line":1565,"column":12}},{"start":{"line":1565,"column":12},"end":{"line":1565,"column":12}}]},"118":{"line":1587,"type":"if","locations":[{"start":{"line":1587,"column":12},"end":{"line":1587,"column":12}},{"start":{"line":1587,"column":12},"end":{"line":1587,"column":12}}]},"119":{"line":1611,"type":"binary-expr","locations":[{"start":{"line":1611,"column":32},"end":{"line":1611,"column":35}},{"start":{"line":1611,"column":39},"end":{"line":1611,"column":65}}]},"120":{"line":1657,"type":"if","locations":[{"start":{"line":1657,"column":8},"end":{"line":1657,"column":8}},{"start":{"line":1657,"column":8},"end":{"line":1657,"column":8}}]},"121":{"line":1659,"type":"if","locations":[{"start":{"line":1659,"column":12},"end":{"line":1659,"column":12}},{"start":{"line":1659,"column":12},"end":{"line":1659,"column":12}}]},"122":{"line":1668,"type":"if","locations":[{"start":{"line":1668,"column":12},"end":{"line":1668,"column":12}},{"start":{"line":1668,"column":12},"end":{"line":1668,"column":12}}]},"123":{"line":1677,"type":"if","locations":[{"start":{"line":1677,"column":16},"end":{"line":1677,"column":16}},{"start":{"line":1677,"column":16},"end":{"line":1677,"column":16}}]},"124":{"line":1678,"type":"binary-expr","locations":[{"start":{"line":1678,"column":24},"end":{"line":1678,"column":28}},{"start":{"line":1678,"column":33},"end":{"line":1678,"column":58}}]},"125":{"line":1678,"type":"cond-expr","locations":[{"start":{"line":1678,"column":53},"end":{"line":1678,"column":54}},{"start":{"line":1678,"column":57},"end":{"line":1678,"column":58}}]},"126":{"line":1679,"type":"binary-expr","locations":[{"start":{"line":1679,"column":24},"end":{"line":1679,"column":33}},{"start":{"line":1679,"column":37},"end":{"line":1679,"column":38}}]},"127":{"line":1682,"type":"cond-expr","locations":[{"start":{"line":1682,"column":35},"end":{"line":1682,"column":47}},{"start":{"line":1682,"column":50},"end":{"line":1682,"column":52}}]},"128":{"line":1684,"type":"cond-expr","locations":[{"start":{"line":1684,"column":42},"end":{"line":1684,"column":43}},{"start":{"line":1684,"column":46},"end":{"line":1684,"column":47}}]},"129":{"line":1692,"type":"cond-expr","locations":[{"start":{"line":1692,"column":36},"end":{"line":1692,"column":40}},{"start":{"line":1692,"column":43},"end":{"line":1692,"column":65}}]},"130":{"line":1700,"type":"if","locations":[{"start":{"line":1700,"column":8},"end":{"line":1700,"column":8}},{"start":{"line":1700,"column":8},"end":{"line":1700,"column":8}}]},"131":{"line":1700,"type":"binary-expr","locations":[{"start":{"line":1700,"column":12},"end":{"line":1700,"column":16}},{"start":{"line":1700,"column":20},"end":{"line":1700,"column":44}},{"start":{"line":1700,"column":49},"end":{"line":1700,"column":77}}]},"132":{"line":1708,"type":"if","locations":[{"start":{"line":1708,"column":8},"end":{"line":1708,"column":8}},{"start":{"line":1708,"column":8},"end":{"line":1708,"column":8}}]},"133":{"line":1714,"type":"if","locations":[{"start":{"line":1714,"column":12},"end":{"line":1714,"column":12}},{"start":{"line":1714,"column":12},"end":{"line":1714,"column":12}}]},"134":{"line":1717,"type":"if","locations":[{"start":{"line":1717,"column":16},"end":{"line":1717,"column":16}},{"start":{"line":1717,"column":16},"end":{"line":1717,"column":16}}]},"135":{"line":1719,"type":"if","locations":[{"start":{"line":1719,"column":23},"end":{"line":1719,"column":23}},{"start":{"line":1719,"column":23},"end":{"line":1719,"column":23}}]},"136":{"line":1726,"type":"if","locations":[{"start":{"line":1726,"column":16},"end":{"line":1726,"column":16}},{"start":{"line":1726,"column":16},"end":{"line":1726,"column":16}}]},"137":{"line":1732,"type":"if","locations":[{"start":{"line":1732,"column":12},"end":{"line":1732,"column":12}},{"start":{"line":1732,"column":12},"end":{"line":1732,"column":12}}]},"138":{"line":1734,"type":"if","locations":[{"start":{"line":1734,"column":19},"end":{"line":1734,"column":19}},{"start":{"line":1734,"column":19},"end":{"line":1734,"column":19}}]},"139":{"line":1734,"type":"binary-expr","locations":[{"start":{"line":1734,"column":24},"end":{"line":1734,"column":29}},{"start":{"line":1734,"column":34},"end":{"line":1734,"column":42}}]},"140":{"line":1740,"type":"if","locations":[{"start":{"line":1740,"column":8},"end":{"line":1740,"column":8}},{"start":{"line":1740,"column":8},"end":{"line":1740,"column":8}}]},"141":{"line":1741,"type":"binary-expr","locations":[{"start":{"line":1741,"column":17},"end":{"line":1741,"column":36}},{"start":{"line":1741,"column":40},"end":{"line":1741,"column":58}}]},"142":{"line":1742,"type":"cond-expr","locations":[{"start":{"line":1742,"column":66},"end":{"line":1742,"column":96}},{"start":{"line":1742,"column":99},"end":{"line":1742,"column":103}}]},"143":{"line":1742,"type":"cond-expr","locations":[{"start":{"line":1742,"column":115},"end":{"line":1742,"column":122}},{"start":{"line":1742,"column":125},"end":{"line":1742,"column":129}}]},"144":{"line":1745,"type":"if","locations":[{"start":{"line":1745,"column":12},"end":{"line":1745,"column":12}},{"start":{"line":1745,"column":12},"end":{"line":1745,"column":12}}]},"145":{"line":1750,"type":"if","locations":[{"start":{"line":1750,"column":8},"end":{"line":1750,"column":8}},{"start":{"line":1750,"column":8},"end":{"line":1750,"column":8}}]},"146":{"line":1751,"type":"binary-expr","locations":[{"start":{"line":1751,"column":36},"end":{"line":1751,"column":57}},{"start":{"line":1751,"column":61},"end":{"line":1751,"column":63}}]},"147":{"line":1752,"type":"binary-expr","locations":[{"start":{"line":1752,"column":42},"end":{"line":1752,"column":69}},{"start":{"line":1752,"column":73},"end":{"line":1752,"column":75}}]},"148":{"line":1756,"type":"cond-expr","locations":[{"start":{"line":1756,"column":32},"end":{"line":1756,"column":36}},{"start":{"line":1756,"column":39},"end":{"line":1756,"column":45}}]},"149":{"line":1790,"type":"binary-expr","locations":[{"start":{"line":1790,"column":21},"end":{"line":1790,"column":25}},{"start":{"line":1790,"column":30},"end":{"line":1790,"column":54}}]},"150":{"line":1793,"type":"if","locations":[{"start":{"line":1793,"column":8},"end":{"line":1793,"column":8}},{"start":{"line":1793,"column":8},"end":{"line":1793,"column":8}}]},"151":{"line":1793,"type":"binary-expr","locations":[{"start":{"line":1793,"column":12},"end":{"line":1793,"column":17}},{"start":{"line":1793,"column":22},"end":{"line":1793,"column":32}}]},"152":{"line":1795,"type":"if","locations":[{"start":{"line":1795,"column":16},"end":{"line":1795,"column":16}},{"start":{"line":1795,"column":16},"end":{"line":1795,"column":16}}]},"153":{"line":1799,"type":"if","locations":[{"start":{"line":1799,"column":12},"end":{"line":1799,"column":12}},{"start":{"line":1799,"column":12},"end":{"line":1799,"column":12}}]},"154":{"line":1807,"type":"cond-expr","locations":[{"start":{"line":1807,"column":44},"end":{"line":1807,"column":52}},{"start":{"line":1807,"column":55},"end":{"line":1807,"column":59}}]},"155":{"line":1808,"type":"cond-expr","locations":[{"start":{"line":1808,"column":30},"end":{"line":1808,"column":38}},{"start":{"line":1808,"column":41},"end":{"line":1808,"column":45}}]},"156":{"line":1814,"type":"if","locations":[{"start":{"line":1814,"column":12},"end":{"line":1814,"column":12}},{"start":{"line":1814,"column":12},"end":{"line":1814,"column":12}}]},"157":{"line":1817,"type":"if","locations":[{"start":{"line":1817,"column":20},"end":{"line":1817,"column":20}},{"start":{"line":1817,"column":20},"end":{"line":1817,"column":20}}]},"158":{"line":1817,"type":"binary-expr","locations":[{"start":{"line":1817,"column":24},"end":{"line":1817,"column":40}},{"start":{"line":1817,"column":44},"end":{"line":1817,"column":58}}]},"159":{"line":1824,"type":"if","locations":[{"start":{"line":1824,"column":8},"end":{"line":1824,"column":8}},{"start":{"line":1824,"column":8},"end":{"line":1824,"column":8}}]},"160":{"line":1828,"type":"cond-expr","locations":[{"start":{"line":1828,"column":36},"end":{"line":1828,"column":59}},{"start":{"line":1828,"column":62},"end":{"line":1828,"column":66}}]},"161":{"line":1830,"type":"if","locations":[{"start":{"line":1830,"column":12},"end":{"line":1830,"column":12}},{"start":{"line":1830,"column":12},"end":{"line":1830,"column":12}}]},"162":{"line":1831,"type":"if","locations":[{"start":{"line":1831,"column":16},"end":{"line":1831,"column":16}},{"start":{"line":1831,"column":16},"end":{"line":1831,"column":16}}]},"163":{"line":1835,"type":"if","locations":[{"start":{"line":1835,"column":24},"end":{"line":1835,"column":24}},{"start":{"line":1835,"column":24},"end":{"line":1835,"column":24}}]},"164":{"line":1845,"type":"if","locations":[{"start":{"line":1845,"column":15},"end":{"line":1845,"column":15}},{"start":{"line":1845,"column":15},"end":{"line":1845,"column":15}}]},"165":{"line":1845,"type":"binary-expr","locations":[{"start":{"line":1845,"column":19},"end":{"line":1845,"column":35}},{"start":{"line":1845,"column":39},"end":{"line":1845,"column":50}}]},"166":{"line":1849,"type":"if","locations":[{"start":{"line":1849,"column":15},"end":{"line":1849,"column":15}},{"start":{"line":1849,"column":15},"end":{"line":1849,"column":15}}]},"167":{"line":1849,"type":"binary-expr","locations":[{"start":{"line":1849,"column":19},"end":{"line":1849,"column":25}},{"start":{"line":1849,"column":31},"end":{"line":1849,"column":41}},{"start":{"line":1849,"column":47},"end":{"line":1849,"column":75}}]},"168":{"line":1859,"type":"if","locations":[{"start":{"line":1859,"column":8},"end":{"line":1859,"column":8}},{"start":{"line":1859,"column":8},"end":{"line":1859,"column":8}}]},"169":{"line":1862,"type":"if","locations":[{"start":{"line":1862,"column":12},"end":{"line":1862,"column":12}},{"start":{"line":1862,"column":12},"end":{"line":1862,"column":12}}]},"170":{"line":1862,"type":"binary-expr","locations":[{"start":{"line":1862,"column":16},"end":{"line":1862,"column":21}},{"start":{"line":1862,"column":25},"end":{"line":1862,"column":37}}]},"171":{"line":1866,"type":"if","locations":[{"start":{"line":1866,"column":19},"end":{"line":1866,"column":19}},{"start":{"line":1866,"column":19},"end":{"line":1866,"column":19}}]},"172":{"line":1866,"type":"binary-expr","locations":[{"start":{"line":1866,"column":23},"end":{"line":1866,"column":28}},{"start":{"line":1866,"column":33},"end":{"line":1866,"column":39}},{"start":{"line":1866,"column":43},"end":{"line":1866,"column":47}},{"start":{"line":1866,"column":52},"end":{"line":1866,"column":75}}]},"173":{"line":1875,"type":"if","locations":[{"start":{"line":1875,"column":8},"end":{"line":1875,"column":8}},{"start":{"line":1875,"column":8},"end":{"line":1875,"column":8}}]},"174":{"line":1987,"type":"if","locations":[{"start":{"line":1987,"column":8},"end":{"line":1987,"column":8}},{"start":{"line":1987,"column":8},"end":{"line":1987,"column":8}}]},"175":{"line":1988,"type":"if","locations":[{"start":{"line":1988,"column":12},"end":{"line":1988,"column":12}},{"start":{"line":1988,"column":12},"end":{"line":1988,"column":12}}]},"176":{"line":1996,"type":"if","locations":[{"start":{"line":1996,"column":16},"end":{"line":1996,"column":16}},{"start":{"line":1996,"column":16},"end":{"line":1996,"column":16}}]},"177":{"line":1999,"type":"binary-expr","locations":[{"start":{"line":1999,"column":52},"end":{"line":1999,"column":53}},{"start":{"line":1999,"column":57},"end":{"line":1999,"column":61}}]},"178":{"line":2024,"type":"if","locations":[{"start":{"line":2024,"column":8},"end":{"line":2024,"column":8}},{"start":{"line":2024,"column":8},"end":{"line":2024,"column":8}}]},"179":{"line":2056,"type":"if","locations":[{"start":{"line":2056,"column":8},"end":{"line":2056,"column":8}},{"start":{"line":2056,"column":8},"end":{"line":2056,"column":8}}]},"180":{"line":2056,"type":"binary-expr","locations":[{"start":{"line":2056,"column":13},"end":{"line":2056,"column":31}},{"start":{"line":2056,"column":35},"end":{"line":2056,"column":38}},{"start":{"line":2056,"column":44},"end":{"line":2056,"column":46}},{"start":{"line":2056,"column":50},"end":{"line":2056,"column":62}}]},"181":{"line":2062,"type":"if","locations":[{"start":{"line":2062,"column":8},"end":{"line":2062,"column":8}},{"start":{"line":2062,"column":8},"end":{"line":2062,"column":8}}]},"182":{"line":2066,"type":"if","locations":[{"start":{"line":2066,"column":12},"end":{"line":2066,"column":12}},{"start":{"line":2066,"column":12},"end":{"line":2066,"column":12}}]},"183":{"line":2072,"type":"if","locations":[{"start":{"line":2072,"column":8},"end":{"line":2072,"column":8}},{"start":{"line":2072,"column":8},"end":{"line":2072,"column":8}}]},"184":{"line":2099,"type":"if","locations":[{"start":{"line":2099,"column":8},"end":{"line":2099,"column":8}},{"start":{"line":2099,"column":8},"end":{"line":2099,"column":8}}]},"185":{"line":2100,"type":"if","locations":[{"start":{"line":2100,"column":12},"end":{"line":2100,"column":12}},{"start":{"line":2100,"column":12},"end":{"line":2100,"column":12}}]},"186":{"line":2108,"type":"if","locations":[{"start":{"line":2108,"column":12},"end":{"line":2108,"column":12}},{"start":{"line":2108,"column":12},"end":{"line":2108,"column":12}}]},"187":{"line":2108,"type":"binary-expr","locations":[{"start":{"line":2108,"column":17},"end":{"line":2108,"column":46}},{"start":{"line":2108,"column":51},"end":{"line":2108,"column":54}},{"start":{"line":2108,"column":58},"end":{"line":2108,"column":70}},{"start":{"line":2108,"column":77},"end":{"line":2108,"column":79}},{"start":{"line":2108,"column":83},"end":{"line":2108,"column":95}}]},"188":{"line":2156,"type":"if","locations":[{"start":{"line":2156,"column":8},"end":{"line":2156,"column":8}},{"start":{"line":2156,"column":8},"end":{"line":2156,"column":8}}]},"189":{"line":2156,"type":"binary-expr","locations":[{"start":{"line":2156,"column":12},"end":{"line":2156,"column":24}},{"start":{"line":2156,"column":28},"end":{"line":2156,"column":41}}]},"190":{"line":2160,"type":"if","locations":[{"start":{"line":2160,"column":12},"end":{"line":2160,"column":12}},{"start":{"line":2160,"column":12},"end":{"line":2160,"column":12}}]},"191":{"line":2167,"type":"cond-expr","locations":[{"start":{"line":2167,"column":65},"end":{"line":2167,"column":66}},{"start":{"line":2167,"column":69},"end":{"line":2167,"column":70}}]},"192":{"line":2170,"type":"if","locations":[{"start":{"line":2170,"column":8},"end":{"line":2170,"column":8}},{"start":{"line":2170,"column":8},"end":{"line":2170,"column":8}}]},"193":{"line":2171,"type":"binary-expr","locations":[{"start":{"line":2171,"column":17},"end":{"line":2171,"column":21}},{"start":{"line":2171,"column":25},"end":{"line":2171,"column":34}}]},"194":{"line":2174,"type":"if","locations":[{"start":{"line":2174,"column":8},"end":{"line":2174,"column":8}},{"start":{"line":2174,"column":8},"end":{"line":2174,"column":8}}]},"195":{"line":2180,"type":"if","locations":[{"start":{"line":2180,"column":8},"end":{"line":2180,"column":8}},{"start":{"line":2180,"column":8},"end":{"line":2180,"column":8}}]},"196":{"line":2183,"type":"if","locations":[{"start":{"line":2183,"column":12},"end":{"line":2183,"column":12}},{"start":{"line":2183,"column":12},"end":{"line":2183,"column":12}}]},"197":{"line":2183,"type":"binary-expr","locations":[{"start":{"line":2183,"column":16},"end":{"line":2183,"column":19}},{"start":{"line":2183,"column":23},"end":{"line":2183,"column":26}}]},"198":{"line":2189,"type":"if","locations":[{"start":{"line":2189,"column":8},"end":{"line":2189,"column":8}},{"start":{"line":2189,"column":8},"end":{"line":2189,"column":8}}]},"199":{"line":2189,"type":"binary-expr","locations":[{"start":{"line":2189,"column":13},"end":{"line":2189,"column":31}},{"start":{"line":2189,"column":36},"end":{"line":2189,"column":39}},{"start":{"line":2189,"column":43},"end":{"line":2189,"column":55}},{"start":{"line":2189,"column":62},"end":{"line":2189,"column":64}},{"start":{"line":2189,"column":68},"end":{"line":2189,"column":80}}]},"200":{"line":2190,"type":"binary-expr","locations":[{"start":{"line":2190,"column":35},"end":{"line":2190,"column":37}},{"start":{"line":2190,"column":41},"end":{"line":2190,"column":42}}]},"201":{"line":2196,"type":"if","locations":[{"start":{"line":2196,"column":8},"end":{"line":2196,"column":8}},{"start":{"line":2196,"column":8},"end":{"line":2196,"column":8}}]},"202":{"line":2197,"type":"if","locations":[{"start":{"line":2197,"column":12},"end":{"line":2197,"column":12}},{"start":{"line":2197,"column":12},"end":{"line":2197,"column":12}}]},"203":{"line":2205,"type":"if","locations":[{"start":{"line":2205,"column":12},"end":{"line":2205,"column":12}},{"start":{"line":2205,"column":12},"end":{"line":2205,"column":12}}]},"204":{"line":2212,"type":"cond-expr","locations":[{"start":{"line":2212,"column":32},"end":{"line":2212,"column":36}},{"start":{"line":2212,"column":39},"end":{"line":2212,"column":42}}]},"205":{"line":2219,"type":"if","locations":[{"start":{"line":2219,"column":8},"end":{"line":2219,"column":8}},{"start":{"line":2219,"column":8},"end":{"line":2219,"column":8}}]},"206":{"line":2222,"type":"if","locations":[{"start":{"line":2222,"column":12},"end":{"line":2222,"column":12}},{"start":{"line":2222,"column":12},"end":{"line":2222,"column":12}}]},"207":{"line":2243,"type":"if","locations":[{"start":{"line":2243,"column":8},"end":{"line":2243,"column":8}},{"start":{"line":2243,"column":8},"end":{"line":2243,"column":8}}]},"208":{"line":2245,"type":"cond-expr","locations":[{"start":{"line":2245,"column":27},"end":{"line":2245,"column":46}},{"start":{"line":2245,"column":49},"end":{"line":2245,"column":53}}]},"209":{"line":2248,"type":"binary-expr","locations":[{"start":{"line":2248,"column":15},"end":{"line":2248,"column":22}},{"start":{"line":2248,"column":26},"end":{"line":2248,"column":30}}]},"210":{"line":2269,"type":"switch","locations":[{"start":{"line":2270,"column":12},"end":{"line":2271,"column":57}},{"start":{"line":2272,"column":12},"end":{"line":2272,"column":25}},{"start":{"line":2277,"column":12},"end":{"line":2279,"column":22}},{"start":{"line":2280,"column":12},"end":{"line":2281,"column":43}}]},"211":{"line":2315,"type":"binary-expr","locations":[{"start":{"line":2315,"column":23},"end":{"line":2315,"column":43}},{"start":{"line":2315,"column":47},"end":{"line":2315,"column":55}}]}},"code":["(function () { YUI.add('event-custom-base', function (Y, NAME) {","","/**"," * Custom event engine, DOM event listener abstraction layer, synthetic DOM"," * events."," * @module event-custom"," */","","Y.Env.evt = {"," handles: {},"," plugins: {}","};","","","/**"," * Custom event engine, DOM event listener abstraction layer, synthetic DOM"," * events."," * @module event-custom"," * @submodule event-custom-base"," */","","/**"," * Allows for the insertion of methods that are executed before or after"," * a specified method"," * @class Do"," * @static"," */","","var DO_BEFORE = 0,"," DO_AFTER = 1,","","DO = {",""," /**"," * Cache of objects touched by the utility"," * @property objs"," * @static"," * @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object"," * replaces the role of this property, but is considered to be private, and"," * is only mentioned to provide a migration path."," *"," * If you have a use case which warrants migration to the _yuiaop property,"," * please file a ticket to let us know what it's used for and we can see if"," * we need to expose hooks for that functionality more formally."," */"," objs: null,",""," /**"," * <p>Execute the supplied method before the specified function. Wrapping"," * function may optionally return an instance of the following classes to"," * further alter runtime behavior:</p>"," * <dl>"," * <dt></code>Y.Do.Halt(message, returnValue)</code></dt>"," * <dd>Immediatly stop execution and return"," * <code>returnValue</code>. No other wrapping functions will be"," * executed.</dd>"," * <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt>"," * <dd>Replace the arguments that the original function will be"," * called with.</dd>"," * <dt></code>Y.Do.Prevent(message)</code></dt>"," * <dd>Don't execute the wrapped function. Other before phase"," * wrappers will be executed.</dd>"," * </dl>"," *"," * @method before"," * @param fn {Function} the function to execute"," * @param obj the object hosting the method to displace"," * @param sFn {string} the name of the method to displace"," * @param c The execution context for fn"," * @param arg* {mixed} 0..n additional arguments to supply to the subscriber"," * when the event fires."," * @return {string} handle for the subscription"," * @static"," */"," before: function(fn, obj, sFn, c) {"," var f = fn, a;"," if (c) {"," a = [fn, c].concat(Y.Array(arguments, 4, true));"," f = Y.rbind.apply(Y, a);"," }",""," return this._inject(DO_BEFORE, f, obj, sFn);"," },",""," /**"," * <p>Execute the supplied method after the specified function. Wrapping"," * function may optionally return an instance of the following classes to"," * further alter runtime behavior:</p>"," * <dl>"," * <dt></code>Y.Do.Halt(message, returnValue)</code></dt>"," * <dd>Immediatly stop execution and return"," * <code>returnValue</code>. No other wrapping functions will be"," * executed.</dd>"," * <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt>"," * <dd>Return <code>returnValue</code> instead of the wrapped"," * method's original return value. This can be further altered by"," * other after phase wrappers.</dd>"," * </dl>"," *"," * <p>The static properties <code>Y.Do.originalRetVal</code> and"," * <code>Y.Do.currentRetVal</code> will be populated for reference.</p>"," *"," * @method after"," * @param fn {Function} the function to execute"," * @param obj the object hosting the method to displace"," * @param sFn {string} the name of the method to displace"," * @param c The execution context for fn"," * @param arg* {mixed} 0..n additional arguments to supply to the subscriber"," * @return {string} handle for the subscription"," * @static"," */"," after: function(fn, obj, sFn, c) {"," var f = fn, a;"," if (c) {"," a = [fn, c].concat(Y.Array(arguments, 4, true));"," f = Y.rbind.apply(Y, a);"," }",""," return this._inject(DO_AFTER, f, obj, sFn);"," },",""," /**"," * Execute the supplied method before or after the specified function."," * Used by <code>before</code> and <code>after</code>."," *"," * @method _inject"," * @param when {string} before or after"," * @param fn {Function} the function to execute"," * @param obj the object hosting the method to displace"," * @param sFn {string} the name of the method to displace"," * @param c The execution context for fn"," * @return {string} handle for the subscription"," * @private"," * @static"," */"," _inject: function(when, fn, obj, sFn) {"," // object id"," var id = Y.stamp(obj), o, sid;",""," if (!obj._yuiaop) {"," // create a map entry for the obj if it doesn't exist, to hold overridden methods"," obj._yuiaop = {};"," }",""," o = obj._yuiaop;",""," if (!o[sFn]) {"," // create a map entry for the method if it doesn't exist"," o[sFn] = new Y.Do.Method(obj, sFn);",""," // re-route the method to our wrapper"," obj[sFn] = function() {"," return o[sFn].exec.apply(o[sFn], arguments);"," };"," }",""," // subscriber id"," sid = id + Y.stamp(fn) + sFn;",""," // register the callback"," o[sFn].register(sid, fn, when);",""," return new Y.EventHandle(o[sFn], sid);"," },",""," /**"," * Detach a before or after subscription."," *"," * @method detach"," * @param handle {string} the subscription handle"," * @static"," */"," detach: function(handle) {"," if (handle.detach) {"," handle.detach();"," }"," }","};","","Y.Do = DO;","","//////////////////////////////////////////////////////////////////////////","","/**"," * Contains the return value from the wrapped method, accessible"," * by 'after' event listeners."," *"," * @property originalRetVal"," * @static"," * @since 3.2.0"," */","","/**"," * Contains the current state of the return value, consumable by"," * 'after' event listeners, and updated if an after subscriber"," * changes the return value generated by the wrapped function."," *"," * @property currentRetVal"," * @static"," * @since 3.2.0"," */","","//////////////////////////////////////////////////////////////////////////","","/**"," * Wrapper for a displaced method with aop enabled"," * @class Do.Method"," * @constructor"," * @param obj The object to operate on"," * @param sFn The name of the method to displace"," */","DO.Method = function(obj, sFn) {"," this.obj = obj;"," this.methodName = sFn;"," this.method = obj[sFn];"," this.before = {};"," this.after = {};","};","","/**"," * Register a aop subscriber"," * @method register"," * @param sid {string} the subscriber id"," * @param fn {Function} the function to execute"," * @param when {string} when to execute the function"," */","DO.Method.prototype.register = function (sid, fn, when) {"," if (when) {"," this.after[sid] = fn;"," } else {"," this.before[sid] = fn;"," }","};","","/**"," * Unregister a aop subscriber"," * @method delete"," * @param sid {string} the subscriber id"," * @param fn {Function} the function to execute"," * @param when {string} when to execute the function"," */","DO.Method.prototype._delete = function (sid) {"," delete this.before[sid];"," delete this.after[sid];","};","","/**"," * <p>Execute the wrapped method. All arguments are passed into the wrapping"," * functions. If any of the before wrappers return an instance of"," * <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped"," * function nor any after phase subscribers will be executed.</p>"," *"," * <p>The return value will be the return value of the wrapped function or one"," * provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or"," * <code>Y.Do.AlterReturn</code>."," *"," * @method exec"," * @param arg* {any} Arguments are passed to the wrapping and wrapped functions"," * @return {any} Return value of wrapped function unless overwritten (see above)"," */","DO.Method.prototype.exec = function () {",""," var args = Y.Array(arguments, 0, true),"," i, ret, newRet,"," bf = this.before,"," af = this.after,"," prevented = false;",""," // execute before"," for (i in bf) {"," if (bf.hasOwnProperty(i)) {"," ret = bf[i].apply(this.obj, args);"," if (ret) {"," switch (ret.constructor) {"," case DO.Halt:"," return ret.retVal;"," case DO.AlterArgs:"," args = ret.newArgs;"," break;"," case DO.Prevent:"," prevented = true;"," break;"," default:"," }"," }"," }"," }",""," // execute method"," if (!prevented) {"," ret = this.method.apply(this.obj, args);"," }",""," DO.originalRetVal = ret;"," DO.currentRetVal = ret;",""," // execute after methods."," for (i in af) {"," if (af.hasOwnProperty(i)) {"," newRet = af[i].apply(this.obj, args);"," // Stop processing if a Halt object is returned"," if (newRet && newRet.constructor === DO.Halt) {"," return newRet.retVal;"," // Check for a new return value"," } else if (newRet && newRet.constructor === DO.AlterReturn) {"," ret = newRet.newRetVal;"," // Update the static retval state"," DO.currentRetVal = ret;"," }"," }"," }",""," return ret;","};","","//////////////////////////////////////////////////////////////////////////","","/**"," * Return an AlterArgs object when you want to change the arguments that"," * were passed into the function. Useful for Do.before subscribers. An"," * example would be a service that scrubs out illegal characters prior to"," * executing the core business logic."," * @class Do.AlterArgs"," * @constructor"," * @param msg {String} (optional) Explanation of the altered return value"," * @param newArgs {Array} Call parameters to be used for the original method"," * instead of the arguments originally passed in."," */","DO.AlterArgs = function(msg, newArgs) {"," this.msg = msg;"," this.newArgs = newArgs;","};","","/**"," * Return an AlterReturn object when you want to change the result returned"," * from the core method to the caller. Useful for Do.after subscribers."," * @class Do.AlterReturn"," * @constructor"," * @param msg {String} (optional) Explanation of the altered return value"," * @param newRetVal {any} Return value passed to code that invoked the wrapped"," * function."," */","DO.AlterReturn = function(msg, newRetVal) {"," this.msg = msg;"," this.newRetVal = newRetVal;","};","","/**"," * Return a Halt object when you want to terminate the execution"," * of all subsequent subscribers as well as the wrapped method"," * if it has not exectued yet. Useful for Do.before subscribers."," * @class Do.Halt"," * @constructor"," * @param msg {String} (optional) Explanation of why the termination was done"," * @param retVal {any} Return value passed to code that invoked the wrapped"," * function."," */","DO.Halt = function(msg, retVal) {"," this.msg = msg;"," this.retVal = retVal;","};","","/**"," * Return a Prevent object when you want to prevent the wrapped function"," * from executing, but want the remaining listeners to execute. Useful"," * for Do.before subscribers."," * @class Do.Prevent"," * @constructor"," * @param msg {String} (optional) Explanation of why the termination was done"," */","DO.Prevent = function(msg) {"," this.msg = msg;","};","","/**"," * Return an Error object when you want to terminate the execution"," * of all subsequent method calls."," * @class Do.Error"," * @constructor"," * @param msg {String} (optional) Explanation of the altered return value"," * @param retVal {any} Return value passed to code that invoked the wrapped"," * function."," * @deprecated use Y.Do.Halt or Y.Do.Prevent"," */","DO.Error = DO.Halt;","","","//////////////////////////////////////////////////////////////////////////","","/**"," * Custom event engine, DOM event listener abstraction layer, synthetic DOM"," * events."," * @module event-custom"," * @submodule event-custom-base"," */","","","// var onsubscribeType = \"_event:onsub\",","var YArray = Y.Array,",""," AFTER = 'after',"," CONFIGS = ["," 'broadcast',"," 'monitored',"," 'bubbles',"," 'context',"," 'contextFn',"," 'currentTarget',"," 'defaultFn',"," 'defaultTargetOnly',"," 'details',"," 'emitFacade',"," 'fireOnce',"," 'async',"," 'host',"," 'preventable',"," 'preventedFn',"," 'queuable',"," 'silent',"," 'stoppedFn',"," 'target',"," 'type'"," ],",""," CONFIGS_HASH = YArray.hash(CONFIGS),",""," nativeSlice = Array.prototype.slice,",""," YUI3_SIGNATURE = 9,"," YUI_LOG = 'yui:log',",""," mixConfigs = function(r, s, ov) {"," var p;",""," for (p in s) {"," if (CONFIGS_HASH[p] && (ov || !(p in r))) {"," r[p] = s[p];"," }"," }",""," return r;"," };","","/**"," * The CustomEvent class lets you define events for your application"," * that can be subscribed to by one or more independent component."," *"," * @param {String} type The type of event, which is passed to the callback"," * when the event fires."," * @param {object} defaults configuration object."," * @class CustomEvent"," * @constructor"," */",""," /**"," * The type of event, returned to subscribers when the event fires"," * @property type"," * @type string"," */","","/**"," * By default all custom events are logged in the debug build, set silent"," * to true to disable debug outpu for this event."," * @property silent"," * @type boolean"," */","","Y.CustomEvent = function(type, defaults) {",""," this._kds = Y.CustomEvent.keepDeprecatedSubs;",""," this.id = Y.guid();",""," this.type = type;"," this.silent = this.logSystem = (type === YUI_LOG);",""," if (this._kds) {"," /**"," * The subscribers to this event"," * @property subscribers"," * @type Subscriber {}"," * @deprecated"," */",""," /**"," * 'After' subscribers"," * @property afters"," * @type Subscriber {}"," * @deprecated"," */"," this.subscribers = {};"," this.afters = {};"," }",""," if (defaults) {"," mixConfigs(this, defaults, true);"," }","};","","/**"," * Static flag to enable population of the <a href=\"#property_subscribers\">`subscribers`</a>"," * and <a href=\"#property_subscribers\">`afters`</a> properties held on a `CustomEvent` instance."," *"," * These properties were changed to private properties (`_subscribers` and `_afters`), and"," * converted from objects to arrays for performance reasons."," *"," * Setting this property to true will populate the deprecated `subscribers` and `afters`"," * properties for people who may be using them (which is expected to be rare). There will"," * be a performance hit, compared to the new array based implementation."," *"," * If you are using these deprecated properties for a use case which the public API"," * does not support, please file an enhancement request, and we can provide an alternate"," * public implementation which doesn't have the performance cost required to maintiain the"," * properties as objects."," *"," * @property keepDeprecatedSubs"," * @static"," * @for CustomEvent"," * @type boolean"," * @default false"," * @deprecated"," */","Y.CustomEvent.keepDeprecatedSubs = false;","","Y.CustomEvent.mixConfigs = mixConfigs;","","Y.CustomEvent.prototype = {",""," constructor: Y.CustomEvent,",""," /**"," * Monitor when an event is attached or detached."," *"," * @property monitored"," * @type boolean"," */",""," /**"," * If 0, this event does not broadcast. If 1, the YUI instance is notified"," * every time this event fires. If 2, the YUI instance and the YUI global"," * (if event is enabled on the global) are notified every time this event"," * fires."," * @property broadcast"," * @type int"," */",""," /**"," * Specifies whether this event should be queued when the host is actively"," * processing an event. This will effect exectution order of the callbacks"," * for the various events."," * @property queuable"," * @type boolean"," * @default false"," */",""," /**"," * This event has fired if true"," *"," * @property fired"," * @type boolean"," * @default false;"," */",""," /**"," * An array containing the arguments the custom event"," * was last fired with."," * @property firedWith"," * @type Array"," */",""," /**"," * This event should only fire one time if true, and if"," * it has fired, any new subscribers should be notified"," * immediately."," *"," * @property fireOnce"," * @type boolean"," * @default false;"," */",""," /**"," * fireOnce listeners will fire syncronously unless async"," * is set to true"," * @property async"," * @type boolean"," * @default false"," */",""," /**"," * Flag for stopPropagation that is modified during fire()"," * 1 means to stop propagation to bubble targets. 2 means"," * to also stop additional subscribers on this target."," * @property stopped"," * @type int"," */",""," /**"," * Flag for preventDefault that is modified during fire()."," * if it is not 0, the default behavior for this event"," * @property prevented"," * @type int"," */",""," /**"," * Specifies the host for this custom event. This is used"," * to enable event bubbling"," * @property host"," * @type EventTarget"," */",""," /**"," * The default function to execute after event listeners"," * have fire, but only if the default action was not"," * prevented."," * @property defaultFn"," * @type Function"," */",""," /**"," * The function to execute if a subscriber calls"," * stopPropagation or stopImmediatePropagation"," * @property stoppedFn"," * @type Function"," */",""," /**"," * The function to execute if a subscriber calls"," * preventDefault"," * @property preventedFn"," * @type Function"," */",""," /**"," * The subscribers to this event"," * @property _subscribers"," * @type Subscriber []"," * @private"," */",""," /**"," * 'After' subscribers"," * @property _afters"," * @type Subscriber []"," * @private"," */",""," /**"," * If set to true, the custom event will deliver an EventFacade object"," * that is similar to a DOM event object."," * @property emitFacade"," * @type boolean"," * @default false"," */",""," /**"," * Supports multiple options for listener signatures in order to"," * port YUI 2 apps."," * @property signature"," * @type int"," * @default 9"," */"," signature : YUI3_SIGNATURE,",""," /**"," * The context the the event will fire from by default. Defaults to the YUI"," * instance."," * @property context"," * @type object"," */"," context : Y,",""," /**"," * Specifies whether or not this event's default function"," * can be cancelled by a subscriber by executing preventDefault()"," * on the event facade"," * @property preventable"," * @type boolean"," * @default true"," */"," preventable : true,",""," /**"," * Specifies whether or not a subscriber can stop the event propagation"," * via stopPropagation(), stopImmediatePropagation(), or halt()"," *"," * Events can only bubble if emitFacade is true."," *"," * @property bubbles"," * @type boolean"," * @default true"," */"," bubbles : true,",""," /**"," * Returns the number of subscribers for this event as the sum of the on()"," * subscribers and after() subscribers."," *"," * @method hasSubs"," * @return Number"," */"," hasSubs: function(when) {"," var s = 0,"," a = 0,"," subs = this._subscribers,"," afters = this._afters,"," sib = this.sibling;",""," if (subs) {"," s = subs.length;"," }",""," if (afters) {"," a = afters.length;"," }",""," if (sib) {"," subs = sib._subscribers;"," afters = sib._afters;",""," if (subs) {"," s += subs.length;"," }",""," if (afters) {"," a += afters.length;"," }"," }",""," if (when) {"," return (when === 'after') ? a : s;"," }",""," return (s + a);"," },",""," /**"," * Monitor the event state for the subscribed event. The first parameter"," * is what should be monitored, the rest are the normal parameters when"," * subscribing to an event."," * @method monitor"," * @param what {string} what to monitor ('detach', 'attach', 'publish')."," * @return {EventHandle} return value from the monitor event subscription."," */"," monitor: function(what) {"," this.monitored = true;"," var type = this.id + '|' + this.type + '_' + what,"," args = nativeSlice.call(arguments, 0);"," args[0] = type;"," return this.host.on.apply(this.host, args);"," },",""," /**"," * Get all of the subscribers to this event and any sibling event"," * @method getSubs"," * @return {Array} first item is the on subscribers, second the after."," */"," getSubs: function() {",""," var sibling = this.sibling,"," subs = this._subscribers,"," afters = this._afters,"," siblingSubs,"," siblingAfters;",""," if (sibling) {"," siblingSubs = sibling._subscribers;"," siblingAfters = sibling._afters;"," }",""," if (siblingSubs) {"," if (subs) {"," subs = subs.concat(siblingSubs);"," } else {"," subs = siblingSubs.concat();"," }"," } else {"," if (subs) {"," subs = subs.concat();"," } else {"," subs = [];"," }"," }",""," if (siblingAfters) {"," if (afters) {"," afters = afters.concat(siblingAfters);"," } else {"," afters = siblingAfters.concat();"," }"," } else {"," if (afters) {"," afters = afters.concat();"," } else {"," afters = [];"," }"," }",""," return [subs, afters];"," },",""," /**"," * Apply configuration properties. Only applies the CONFIG whitelist"," * @method applyConfig"," * @param o hash of properties to apply."," * @param force {boolean} if true, properties that exist on the event"," * will be overwritten."," */"," applyConfig: function(o, force) {"," mixConfigs(this, o, force);"," },",""," /**"," * Create the Subscription for subscribing function, context, and bound"," * arguments. If this is a fireOnce event, the subscriber is immediately"," * notified."," *"," * @method _on"," * @param fn {Function} Subscription callback"," * @param [context] {Object} Override `this` in the callback"," * @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire()"," * @param [when] {String} \"after\" to slot into after subscribers"," * @return {EventHandle}"," * @protected"," */"," _on: function(fn, context, args, when) {","",""," var s = new Y.Subscriber(fn, context, args, when);",""," if (this.fireOnce && this.fired) {"," if (this.async) {"," setTimeout(Y.bind(this._notify, this, s, this.firedWith), 0);"," } else {"," this._notify(s, this.firedWith);"," }"," }",""," if (when === AFTER) {"," if (!this._afters) {"," this._afters = [];"," this._hasAfters = true;"," }"," this._afters.push(s);"," } else {"," if (!this._subscribers) {"," this._subscribers = [];"," this._hasSubs = true;"," }"," this._subscribers.push(s);"," }",""," if (this._kds) {"," if (when === AFTER) {"," this.afters[s.id] = s;"," } else {"," this.subscribers[s.id] = s;"," }"," }",""," return new Y.EventHandle(this, s);"," },",""," /**"," * Listen for this event"," * @method subscribe"," * @param {Function} fn The function to execute."," * @return {EventHandle} Unsubscribe handle."," * @deprecated use on."," */"," subscribe: function(fn, context) {"," var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;"," return this._on(fn, context, a, true);"," },",""," /**"," * Listen for this event"," * @method on"," * @param {Function} fn The function to execute."," * @param {object} context optional execution context."," * @param {mixed} arg* 0..n additional arguments to supply to the subscriber"," * when the event fires."," * @return {EventHandle} An object with a detach method to detch the handler(s)."," */"," on: function(fn, context) {"," var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;",""," if (this.monitored && this.host) {"," this.host._monitor('attach', this, {"," args: arguments"," });"," }"," return this._on(fn, context, a, true);"," },",""," /**"," * Listen for this event after the normal subscribers have been notified and"," * the default behavior has been applied. If a normal subscriber prevents the"," * default behavior, it also prevents after listeners from firing."," * @method after"," * @param {Function} fn The function to execute."," * @param {object} context optional execution context."," * @param {mixed} arg* 0..n additional arguments to supply to the subscriber"," * when the event fires."," * @return {EventHandle} handle Unsubscribe handle."," */"," after: function(fn, context) {"," var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;"," return this._on(fn, context, a, AFTER);"," },",""," /**"," * Detach listeners."," * @method detach"," * @param {Function} fn The subscribed function to remove, if not supplied"," * all will be removed."," * @param {Object} context The context object passed to subscribe."," * @return {int} returns the number of subscribers unsubscribed."," */"," detach: function(fn, context) {"," // unsubscribe handle"," if (fn && fn.detach) {"," return fn.detach();"," }",""," var i, s,"," found = 0,"," subs = this._subscribers,"," afters = this._afters;",""," if (subs) {"," for (i = subs.length; i >= 0; i--) {"," s = subs[i];"," if (s && (!fn || fn === s.fn)) {"," this._delete(s, subs, i);"," found++;"," }"," }"," }",""," if (afters) {"," for (i = afters.length; i >= 0; i--) {"," s = afters[i];"," if (s && (!fn || fn === s.fn)) {"," this._delete(s, afters, i);"," found++;"," }"," }"," }",""," return found;"," },",""," /**"," * Detach listeners."," * @method unsubscribe"," * @param {Function} fn The subscribed function to remove, if not supplied"," * all will be removed."," * @param {Object} context The context object passed to subscribe."," * @return {int|undefined} returns the number of subscribers unsubscribed."," * @deprecated use detach."," */"," unsubscribe: function() {"," return this.detach.apply(this, arguments);"," },",""," /**"," * Notify a single subscriber"," * @method _notify"," * @param {Subscriber} s the subscriber."," * @param {Array} args the arguments array to apply to the listener."," * @protected"," */"," _notify: function(s, args, ef) {","",""," var ret;",""," ret = s.notify(args, this);",""," if (false === ret || this.stopped > 1) {"," return false;"," }",""," return true;"," },",""," /**"," * Logger abstraction to centralize the application of the silent flag"," * @method log"," * @param {string} msg message to log."," * @param {string} cat log category."," */"," log: function(msg, cat) {"," },",""," /**"," * Notifies the subscribers. The callback functions will be executed"," * from the context specified when the event was created, and with the"," * following parameters:"," * <ul>"," * <li>The type of event</li>"," * <li>All of the arguments fire() was executed with as an array</li>"," * <li>The custom object (if any) that was passed into the subscribe()"," * method</li>"," * </ul>"," * @method fire"," * @param {Object*} arguments an arbitrary set of parameters to pass to"," * the handler."," * @return {boolean} false if one of the subscribers returned false,"," * true otherwise."," *"," */"," fire: function() {",""," // push is the fastest way to go from arguments to arrays"," // for most browsers currently"," // http://jsperf.com/push-vs-concat-vs-slice/2",""," var args = [];"," args.push.apply(args, arguments);",""," return this._fire(args);"," },",""," /**"," * Private internal implementation for `fire`, which is can be used directly by"," * `EventTarget` and other event module classes which have already converted from"," * an `arguments` list to an array, to avoid the repeated overhead."," *"," * @method _fire"," * @private"," * @param {Array} args The array of arguments passed to be passed to handlers."," * @return {boolean} false if one of the subscribers returned false, true otherwise."," */"," _fire: function(args) {",""," if (this.fireOnce && this.fired) {"," return true;"," } else {",""," // this doesn't happen if the event isn't published"," // this.host._monitor('fire', this.type, args);",""," this.fired = true;",""," if (this.fireOnce) {"," this.firedWith = args;"," }",""," if (this.emitFacade) {"," return this.fireComplex(args);"," } else {"," return this.fireSimple(args);"," }"," }"," },",""," /**"," * Set up for notifying subscribers of non-emitFacade events."," *"," * @method fireSimple"," * @param args {Array} Arguments passed to fire()"," * @return Boolean false if a subscriber returned false"," * @protected"," */"," fireSimple: function(args) {"," this.stopped = 0;"," this.prevented = 0;"," if (this.hasSubs()) {"," var subs = this.getSubs();"," this._procSubs(subs[0], args);"," this._procSubs(subs[1], args);"," }"," if (this.broadcast) {"," this._broadcast(args);"," }"," return this.stopped ? false : true;"," },",""," // Requires the event-custom-complex module for full funcitonality."," fireComplex: function(args) {"," args[0] = args[0] || {};"," return this.fireSimple(args);"," },",""," /**"," * Notifies a list of subscribers."," *"," * @method _procSubs"," * @param subs {Array} List of subscribers"," * @param args {Array} Arguments passed to fire()"," * @param ef {}"," * @return Boolean false if a subscriber returns false or stops the event"," * propagation via e.stopPropagation(),"," * e.stopImmediatePropagation(), or e.halt()"," * @private"," */"," _procSubs: function(subs, args, ef) {"," var s, i, l;",""," for (i = 0, l = subs.length; i < l; i++) {"," s = subs[i];"," if (s && s.fn) {"," if (false === this._notify(s, args, ef)) {"," this.stopped = 2;"," }"," if (this.stopped === 2) {"," return false;"," }"," }"," }",""," return true;"," },",""," /**"," * Notifies the YUI instance if the event is configured with broadcast = 1,"," * and both the YUI instance and Y.Global if configured with broadcast = 2."," *"," * @method _broadcast"," * @param args {Array} Arguments sent to fire()"," * @private"," */"," _broadcast: function(args) {"," if (!this.stopped && this.broadcast) {",""," var a = args.concat();"," a.unshift(this.type);",""," if (this.host !== Y) {"," Y.fire.apply(Y, a);"," }",""," if (this.broadcast === 2) {"," Y.Global.fire.apply(Y.Global, a);"," }"," }"," },",""," /**"," * Removes all listeners"," * @method unsubscribeAll"," * @return {int} The number of listeners unsubscribed."," * @deprecated use detachAll."," */"," unsubscribeAll: function() {"," return this.detachAll.apply(this, arguments);"," },",""," /**"," * Removes all listeners"," * @method detachAll"," * @return {int} The number of listeners unsubscribed."," */"," detachAll: function() {"," return this.detach();"," },",""," /**"," * Deletes the subscriber from the internal store of on() and after()"," * subscribers."," *"," * @method _delete"," * @param s subscriber object."," * @param subs (optional) on or after subscriber array"," * @param index (optional) The index found."," * @private"," */"," _delete: function(s, subs, i) {"," var when = s._when;",""," if (!subs) {"," subs = (when === AFTER) ? this._afters : this._subscribers;"," i = YArray.indexOf(subs, s, 0);"," }",""," if (subs) {"," if (s && subs[i] === s) {"," subs.splice(i, 1);",""," if (subs.length === 0) {"," if (when === AFTER) {"," this._hasAfters = false;"," } else {"," this._hasSubs = false;"," }"," }"," }"," }",""," if (this._kds) {"," if (when === AFTER) {"," delete this.afters[s.id];"," } else {"," delete this.subscribers[s.id];"," }"," }",""," if (this.monitored && this.host) {"," this.host._monitor('detach', this, {"," ce: this,"," sub: s"," });"," }",""," if (s) {"," s.deleted = true;"," }"," }","};","/**"," * Stores the subscriber information to be used when the event fires."," * @param {Function} fn The wrapped function to execute."," * @param {Object} context The value of the keyword 'this' in the listener."," * @param {Array} args* 0..n additional arguments to supply the listener."," *"," * @class Subscriber"," * @constructor"," */","Y.Subscriber = function(fn, context, args, when) {",""," /**"," * The callback that will be execute when the event fires"," * This is wrapped by Y.rbind if obj was supplied."," * @property fn"," * @type Function"," */"," this.fn = fn;",""," /**"," * Optional 'this' keyword for the listener"," * @property context"," * @type Object"," */"," this.context = context;",""," /**"," * Unique subscriber id"," * @property id"," * @type String"," */"," this.id = Y.guid();",""," /**"," * Additional arguments to propagate to the subscriber"," * @property args"," * @type Array"," */"," this.args = args;",""," this._when = when;",""," /**"," * Custom events for a given fire transaction."," * @property events"," * @type {EventTarget}"," */"," // this.events = null;",""," /**"," * This listener only reacts to the event once"," * @property once"," */"," // this.once = false;","","};","","Y.Subscriber.prototype = {"," constructor: Y.Subscriber,",""," _notify: function(c, args, ce) {"," if (this.deleted && !this.postponed) {"," if (this.postponed) {"," delete this.fn;"," delete this.context;"," } else {"," delete this.postponed;"," return null;"," }"," }"," var a = this.args, ret;"," switch (ce.signature) {"," case 0:"," ret = this.fn.call(c, ce.type, args, c);"," break;"," case 1:"," ret = this.fn.call(c, args[0] || null, c);"," break;"," default:"," if (a || args) {"," args = args || [];"," a = (a) ? args.concat(a) : args;"," ret = this.fn.apply(c, a);"," } else {"," ret = this.fn.call(c);"," }"," }",""," if (this.once) {"," ce._delete(this);"," }",""," return ret;"," },",""," /**"," * Executes the subscriber."," * @method notify"," * @param args {Array} Arguments array for the subscriber."," * @param ce {CustomEvent} The custom event that sent the notification."," */"," notify: function(args, ce) {"," var c = this.context,"," ret = true;",""," if (!c) {"," c = (ce.contextFn) ? ce.contextFn() : ce.context;"," }",""," // only catch errors if we will not re-throw them."," if (Y.config && Y.config.throwFail) {"," ret = this._notify(c, args, ce);"," } else {"," try {"," ret = this._notify(c, args, ce);"," } catch (e) {"," Y.error(this + ' failed: ' + e.message, e);"," }"," }",""," return ret;"," },",""," /**"," * Returns true if the fn and obj match this objects properties."," * Used by the unsubscribe method to match the right subscriber."," *"," * @method contains"," * @param {Function} fn the function to execute."," * @param {Object} context optional 'this' keyword for the listener."," * @return {boolean} true if the supplied arguments match this"," * subscriber's signature."," */"," contains: function(fn, context) {"," if (context) {"," return ((this.fn === fn) && this.context === context);"," } else {"," return (this.fn === fn);"," }"," },",""," valueOf : function() {"," return this.id;"," }","","};","/**"," * Return value from all subscribe operations"," * @class EventHandle"," * @constructor"," * @param {CustomEvent} evt the custom event."," * @param {Subscriber} sub the subscriber."," */","Y.EventHandle = function(evt, sub) {",""," /**"," * The custom event"," *"," * @property evt"," * @type CustomEvent"," */"," this.evt = evt;",""," /**"," * The subscriber object"," *"," * @property sub"," * @type Subscriber"," */"," this.sub = sub;","};","","Y.EventHandle.prototype = {"," batch: function(f, c) {"," f.call(c || this, this);"," if (Y.Lang.isArray(this.evt)) {"," Y.Array.each(this.evt, function(h) {"," h.batch.call(c || h, f);"," });"," }"," },",""," /**"," * Detaches this subscriber"," * @method detach"," * @return {int} the number of detached listeners"," */"," detach: function() {"," var evt = this.evt, detached = 0, i;"," if (evt) {"," if (Y.Lang.isArray(evt)) {"," for (i = 0; i < evt.length; i++) {"," detached += evt[i].detach();"," }"," } else {"," evt._delete(this.sub);"," detached = 1;"," }",""," }",""," return detached;"," },",""," /**"," * Monitor the event state for the subscribed event. The first parameter"," * is what should be monitored, the rest are the normal parameters when"," * subscribing to an event."," * @method monitor"," * @param what {string} what to monitor ('attach', 'detach', 'publish')."," * @return {EventHandle} return value from the monitor event subscription."," */"," monitor: function(what) {"," return this.evt.monitor.apply(this.evt, arguments);"," }","};","","/**"," * Custom event engine, DOM event listener abstraction layer, synthetic DOM"," * events."," * @module event-custom"," * @submodule event-custom-base"," */","","/**"," * EventTarget provides the implementation for any object to"," * publish, subscribe and fire to custom events, and also"," * alows other EventTargets to target the object with events"," * sourced from the other object."," * EventTarget is designed to be used with Y.augment to wrap"," * EventCustom in an interface that allows events to be listened to"," * and fired by name. This makes it possible for implementing code to"," * subscribe to an event that either has not been created yet, or will"," * not be created at all."," * @class EventTarget"," * @param opts a configuration object"," * @config emitFacade {boolean} if true, all events will emit event"," * facade payloads by default (default false)"," * @config prefix {String} the prefix to apply to non-prefixed event names"," */","","var L = Y.Lang,"," PREFIX_DELIMITER = ':',"," CATEGORY_DELIMITER = '|',"," AFTER_PREFIX = '~AFTER~',"," WILD_TYPE_RE = /(.*?)(:)(.*?)/,",""," _wildType = Y.cached(function(type) {"," return type.replace(WILD_TYPE_RE, \"*$2$3\");"," }),",""," /**"," * If the instance has a prefix attribute and the"," * event type is not prefixed, the instance prefix is"," * applied to the supplied type."," * @method _getType"," * @private"," */"," _getType = function(type, pre) {",""," if (!pre || type.indexOf(PREFIX_DELIMITER) > -1) {"," return type;"," }",""," return pre + PREFIX_DELIMITER + type;"," },",""," /**"," * Returns an array with the detach key (if provided),"," * and the prefixed event name from _getType"," * Y.on('detachcategory| menu:click', fn)"," * @method _parseType"," * @private"," */"," _parseType = Y.cached(function(type, pre) {",""," var t = type, detachcategory, after, i;",""," if (!L.isString(t)) {"," return t;"," }",""," i = t.indexOf(AFTER_PREFIX);",""," if (i > -1) {"," after = true;"," t = t.substr(AFTER_PREFIX.length);"," }",""," i = t.indexOf(CATEGORY_DELIMITER);",""," if (i > -1) {"," detachcategory = t.substr(0, (i));"," t = t.substr(i+1);"," if (t === '*') {"," t = null;"," }"," }",""," // detach category, full type with instance prefix, is this an after listener, short type"," return [detachcategory, (pre) ? _getType(t, pre) : t, after, t];"," }),",""," ET = function(opts) {",""," var etState = this._yuievt,"," etConfig;",""," if (!etState) {"," etState = this._yuievt = {"," events: {}, // PERF: Not much point instantiating lazily. We're bound to have events"," targets: null, // PERF: Instantiate lazily, if user actually adds target,"," config: {"," host: this,"," context: this"," },"," chain: Y.config.chain"," };"," }",""," etConfig = etState.config;",""," if (opts) {"," mixConfigs(etConfig, opts, true);",""," if (opts.chain !== undefined) {"," etState.chain = opts.chain;"," }",""," if (opts.prefix) {"," etConfig.prefix = opts.prefix;"," }"," }"," };","","ET.prototype = {",""," constructor: ET,",""," /**"," * Listen to a custom event hosted by this object one time."," * This is the equivalent to <code>on</code> except the"," * listener is immediatelly detached when it is executed."," * @method once"," * @param {String} type The name of the event"," * @param {Function} fn The callback to execute in response to the event"," * @param {Object} [context] Override `this` object in callback"," * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber"," * @return {EventHandle} A subscription handle capable of detaching the"," * subscription"," */"," once: function() {"," var handle = this.on.apply(this, arguments);"," handle.batch(function(hand) {"," if (hand.sub) {"," hand.sub.once = true;"," }"," });"," return handle;"," },",""," /**"," * Listen to a custom event hosted by this object one time."," * This is the equivalent to <code>after</code> except the"," * listener is immediatelly detached when it is executed."," * @method onceAfter"," * @param {String} type The name of the event"," * @param {Function} fn The callback to execute in response to the event"," * @param {Object} [context] Override `this` object in callback"," * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber"," * @return {EventHandle} A subscription handle capable of detaching that"," * subscription"," */"," onceAfter: function() {"," var handle = this.after.apply(this, arguments);"," handle.batch(function(hand) {"," if (hand.sub) {"," hand.sub.once = true;"," }"," });"," return handle;"," },",""," /**"," * Takes the type parameter passed to 'on' and parses out the"," * various pieces that could be included in the type. If the"," * event type is passed without a prefix, it will be expanded"," * to include the prefix one is supplied or the event target"," * is configured with a default prefix."," * @method parseType"," * @param {String} type the type"," * @param {String} [pre=this._yuievt.config.prefix] the prefix"," * @since 3.3.0"," * @return {Array} an array containing:"," * * the detach category, if supplied,"," * * the prefixed event type,"," * * whether or not this is an after listener,"," * * the supplied event type"," */"," parseType: function(type, pre) {"," return _parseType(type, pre || this._yuievt.config.prefix);"," },",""," /**"," * Subscribe a callback function to a custom event fired by this object or"," * from an object that bubbles its events to this object."," *"," * Callback functions for events published with `emitFacade = true` will"," * receive an `EventFacade` as the first argument (typically named \"e\")."," * These callbacks can then call `e.preventDefault()` to disable the"," * behavior published to that event's `defaultFn`. See the `EventFacade`"," * API for all available properties and methods. Subscribers to"," * non-`emitFacade` events will receive the arguments passed to `fire()`"," * after the event name."," *"," * To subscribe to multiple events at once, pass an object as the first"," * argument, where the key:value pairs correspond to the eventName:callback,"," * or pass an array of event names as the first argument to subscribe to"," * all listed events with the same callback."," *"," * Returning `false` from a callback is supported as an alternative to"," * calling `e.preventDefault(); e.stopPropagation();`. However, it is"," * recommended to use the event methods whenever possible."," *"," * @method on"," * @param {String} type The name of the event"," * @param {Function} fn The callback to execute in response to the event"," * @param {Object} [context] Override `this` object in callback"," * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber"," * @return {EventHandle} A subscription handle capable of detaching that"," * subscription"," */"," on: function(type, fn, context) {",""," var yuievt = this._yuievt,"," parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce,"," detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype,"," Node = Y.Node, n, domevent, isArr;",""," // full name, args, detachcategory, after"," this._monitor('attach', parts[1], {"," args: arguments,"," category: parts[0],"," after: parts[2]"," });",""," if (L.isObject(type)) {",""," if (L.isFunction(type)) {"," return Y.Do.before.apply(Y.Do, arguments);"," }",""," f = fn;"," c = context;"," args = nativeSlice.call(arguments, 0);"," ret = [];",""," if (L.isArray(type)) {"," isArr = true;"," }",""," after = type._after;"," delete type._after;",""," Y.each(type, function(v, k) {",""," if (L.isObject(v)) {"," f = v.fn || ((L.isFunction(v)) ? v : f);"," c = v.context || c;"," }",""," var nv = (after) ? AFTER_PREFIX : '';",""," args[0] = nv + ((isArr) ? v : k);"," args[1] = f;"," args[2] = c;",""," ret.push(this.on.apply(this, args));",""," }, this);",""," return (yuievt.chain) ? this : new Y.EventHandle(ret);"," }",""," detachcategory = parts[0];"," after = parts[2];"," shorttype = parts[3];",""," // extra redirection so we catch adaptor events too. take a look at this."," if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) {"," args = nativeSlice.call(arguments, 0);"," args.splice(2, 0, Node.getDOMNode(this));"," return Y.on.apply(Y, args);"," }",""," type = parts[1];",""," if (Y.instanceOf(this, YUI)) {",""," adapt = Y.Env.evt.plugins[type];"," args = nativeSlice.call(arguments, 0);"," args[0] = shorttype;",""," if (Node) {"," n = args[2];",""," if (Y.instanceOf(n, Y.NodeList)) {"," n = Y.NodeList.getDOMNodes(n);"," } else if (Y.instanceOf(n, Node)) {"," n = Node.getDOMNode(n);"," }",""," domevent = (shorttype in Node.DOM_EVENTS);",""," // Captures both DOM events and event plugins."," if (domevent) {"," args[2] = n;"," }"," }",""," // check for the existance of an event adaptor"," if (adapt) {"," handle = adapt.on.apply(Y, args);"," } else if ((!type) || domevent) {"," handle = Y.Event._attach(args);"," }",""," }",""," if (!handle) {"," ce = yuievt.events[type] || this.publish(type);"," handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true);",""," // TODO: More robust regex, accounting for category"," if (type.indexOf(\"*:\") !== -1) {"," this._hasSiblings = true;"," }"," }",""," if (detachcategory) {"," store[detachcategory] = store[detachcategory] || {};"," store[detachcategory][type] = store[detachcategory][type] || [];"," store[detachcategory][type].push(handle);"," }",""," return (yuievt.chain) ? this : handle;",""," },",""," /**"," * subscribe to an event"," * @method subscribe"," * @deprecated use on"," */"," subscribe: function() {"," return this.on.apply(this, arguments);"," },",""," /**"," * Detach one or more listeners the from the specified event"," * @method detach"," * @param type {string|Object} Either the handle to the subscriber or the"," * type of event. If the type"," * is not specified, it will attempt to remove"," * the listener from all hosted events."," * @param fn {Function} The subscribed function to unsubscribe, if not"," * supplied, all subscribers will be removed."," * @param context {Object} The custom object passed to subscribe. This is"," * optional, but if supplied will be used to"," * disambiguate multiple listeners that are the same"," * (e.g., you subscribe many object using a function"," * that lives on the prototype)"," * @return {EventTarget} the host"," */"," detach: function(type, fn, context) {",""," var evts = this._yuievt.events,"," i,"," Node = Y.Node,"," isNode = Node && (Y.instanceOf(this, Node));",""," // detachAll disabled on the Y instance."," if (!type && (this !== Y)) {"," for (i in evts) {"," if (evts.hasOwnProperty(i)) {"," evts[i].detach(fn, context);"," }"," }"," if (isNode) {"," Y.Event.purgeElement(Node.getDOMNode(this));"," }",""," return this;"," }",""," var parts = _parseType(type, this._yuievt.config.prefix),"," detachcategory = L.isArray(parts) ? parts[0] : null,"," shorttype = (parts) ? parts[3] : null,"," adapt, store = Y.Env.evt.handles, detachhost, cat, args,"," ce,",""," keyDetacher = function(lcat, ltype, host) {"," var handles = lcat[ltype], ce, i;"," if (handles) {"," for (i = handles.length - 1; i >= 0; --i) {"," ce = handles[i].evt;"," if (ce.host === host || ce.el === host) {"," handles[i].detach();"," }"," }"," }"," };",""," if (detachcategory) {",""," cat = store[detachcategory];"," type = parts[1];"," detachhost = (isNode) ? Y.Node.getDOMNode(this) : this;",""," if (cat) {"," if (type) {"," keyDetacher(cat, type, detachhost);"," } else {"," for (i in cat) {"," if (cat.hasOwnProperty(i)) {"," keyDetacher(cat, i, detachhost);"," }"," }"," }",""," return this;"," }",""," // If this is an event handle, use it to detach"," } else if (L.isObject(type) && type.detach) {"," type.detach();"," return this;"," // extra redirection so we catch adaptor events too. take a look at this."," } else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) {"," args = nativeSlice.call(arguments, 0);"," args[2] = Node.getDOMNode(this);"," Y.detach.apply(Y, args);"," return this;"," }",""," adapt = Y.Env.evt.plugins[shorttype];",""," // The YUI instance handles DOM events and adaptors"," if (Y.instanceOf(this, YUI)) {"," args = nativeSlice.call(arguments, 0);"," // use the adaptor specific detach code if"," if (adapt && adapt.detach) {"," adapt.detach.apply(Y, args);"," return this;"," // DOM event fork"," } else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) {"," args[0] = type;"," Y.Event.detach.apply(Y.Event, args);"," return this;"," }"," }",""," // ce = evts[type];"," ce = evts[parts[1]];"," if (ce) {"," ce.detach(fn, context);"," }",""," return this;"," },",""," /**"," * detach a listener"," * @method unsubscribe"," * @deprecated use detach"," */"," unsubscribe: function() {"," return this.detach.apply(this, arguments);"," },",""," /**"," * Removes all listeners from the specified event. If the event type"," * is not specified, all listeners from all hosted custom events will"," * be removed."," * @method detachAll"," * @param type {String} The type, or name of the event"," */"," detachAll: function(type) {"," return this.detach(type);"," },",""," /**"," * Removes all listeners from the specified event. If the event type"," * is not specified, all listeners from all hosted custom events will"," * be removed."," * @method unsubscribeAll"," * @param type {String} The type, or name of the event"," * @deprecated use detachAll"," */"," unsubscribeAll: function() {"," return this.detachAll.apply(this, arguments);"," },",""," /**"," * Creates a new custom event of the specified type. If a custom event"," * by that name already exists, it will not be re-created. In either"," * case the custom event is returned."," *"," * @method publish"," *"," * @param type {String} the type, or name of the event"," * @param opts {object} optional config params. Valid properties are:"," *"," * <ul>"," * <li>"," * 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false)"," * </li>"," * <li>"," * 'bubbles': whether or not this event bubbles (true)"," * Events can only bubble if emitFacade is true."," * </li>"," * <li>"," * 'context': the default execution context for the listeners (this)"," * </li>"," * <li>"," * 'defaultFn': the default function to execute when this event fires if preventDefault was not called"," * </li>"," * <li>"," * 'emitFacade': whether or not this event emits a facade (false)"," * </li>"," * <li>"," * 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click'"," * </li>"," * <li>"," * 'fireOnce': if an event is configured to fire once, new subscribers after"," * the fire will be notified immediately."," * </li>"," * <li>"," * 'async': fireOnce event listeners will fire synchronously if the event has already"," * fired unless async is true."," * </li>"," * <li>"," * 'preventable': whether or not preventDefault() has an effect (true)"," * </li>"," * <li>"," * 'preventedFn': a function that is executed when preventDefault is called"," * </li>"," * <li>"," * 'queuable': whether or not this event can be queued during bubbling (false)"," * </li>"," * <li>"," * 'silent': if silent is true, debug messages are not provided for this event."," * </li>"," * <li>"," * 'stoppedFn': a function that is executed when stopPropagation is called"," * </li>"," *"," * <li>"," * 'monitored': specifies whether or not this event should send notifications about"," * when the event has been attached, detached, or published."," * </li>"," * <li>"," * 'type': the event type (valid option if not provided as the first parameter to publish)"," * </li>"," * </ul>"," *"," * @return {CustomEvent} the custom event"," *"," */"," publish: function(type, opts) {",""," var ret,"," etState = this._yuievt,"," etConfig = etState.config,"," pre = etConfig.prefix;",""," if (typeof type === \"string\") {"," if (pre) {"," type = _getType(type, pre);"," }"," ret = this._publish(type, etConfig, opts);"," } else {"," ret = {};",""," Y.each(type, function(v, k) {"," if (pre) {"," k = _getType(k, pre);"," }"," ret[k] = this._publish(k, etConfig, v || opts);"," }, this);",""," }",""," return ret;"," },",""," /**"," * Returns the fully qualified type, given a short type string."," * That is, returns \"foo:bar\" when given \"bar\" if \"foo\" is the configured prefix."," *"," * NOTE: This method, unlike _getType, does no checking of the value passed in, and"," * is designed to be used with the low level _publish() method, for critical path"," * implementations which need to fast-track publish for performance reasons."," *"," * @method _getFullType"," * @private"," * @param {String} type The short type to prefix"," * @return {String} The prefixed type, if a prefix is set, otherwise the type passed in"," */"," _getFullType : function(type) {",""," var pre = this._yuievt.config.prefix;",""," if (pre) {"," return pre + PREFIX_DELIMITER + type;"," } else {"," return type;"," }"," },",""," /**"," * The low level event publish implementation. It expects all the massaging to have been done"," * outside of this method. e.g. the `type` to `fullType` conversion. It's designed to be a fast"," * path publish, which can be used by critical code paths to improve performance."," *"," * @method _publish"," * @private"," * @param {String} fullType The prefixed type of the event to publish."," * @param {Object} etOpts The EventTarget specific configuration to mix into the published event."," * @param {Object} ceOpts The publish specific configuration to mix into the published event."," * @return {CustomEvent} The published event. If called without `etOpts` or `ceOpts`, this will"," * be the default `CustomEvent` instance, and can be configured independently."," */"," _publish : function(fullType, etOpts, ceOpts) {",""," var ce,"," etState = this._yuievt,"," etConfig = etState.config,"," host = etConfig.host,"," context = etConfig.context,"," events = etState.events;",""," ce = events[fullType];",""," // PERF: Hate to pull the check out of monitor, but trying to keep critical path tight."," if ((etConfig.monitored && !ce) || (ce && ce.monitored)) {"," this._monitor('publish', fullType, {"," args: arguments"," });"," }",""," if (!ce) {"," // Publish event"," ce = events[fullType] = new Y.CustomEvent(fullType, etOpts);",""," if (!etOpts) {"," ce.host = host;"," ce.context = context;"," }"," }",""," if (ceOpts) {"," mixConfigs(ce, ceOpts, true);"," }",""," return ce;"," },",""," /**"," * This is the entry point for the event monitoring system."," * You can monitor 'attach', 'detach', 'fire', and 'publish'."," * When configured, these events generate an event. click ->"," * click_attach, click_detach, click_publish -- these can"," * be subscribed to like other events to monitor the event"," * system. Inividual published events can have monitoring"," * turned on or off (publish can't be turned off before it"," * it published) by setting the events 'monitor' config."," *"," * @method _monitor"," * @param what {String} 'attach', 'detach', 'fire', or 'publish'"," * @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object."," * @param o {Object} Information about the event interaction, such as"," * fire() args, subscription category, publish config"," * @private"," */"," _monitor: function(what, eventType, o) {"," var monitorevt, ce, type;",""," if (eventType) {"," if (typeof eventType === \"string\") {"," type = eventType;"," ce = this.getEvent(eventType, true);"," } else {"," ce = eventType;"," type = eventType.type;"," }",""," if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {"," monitorevt = type + '_' + what;"," o.monitored = what;"," this.fire.call(this, monitorevt, o);"," }"," }"," },",""," /**"," * Fire a custom event by name. The callback functions will be executed"," * from the context specified when the event was created, and with the"," * following parameters."," *"," * If the custom event object hasn't been created, then the event hasn't"," * been published and it has no subscribers. For performance sake, we"," * immediate exit in this case. This means the event won't bubble, so"," * if the intention is that a bubble target be notified, the event must"," * be published on this object first."," *"," * The first argument is the event type, and any additional arguments are"," * passed to the listeners as parameters. If the first of these is an"," * object literal, and the event is configured to emit an event facade,"," * that object is mixed into the event facade and the facade is provided"," * in place of the original object."," *"," * @method fire"," * @param type {String|Object} The type of the event, or an object that contains"," * a 'type' property."," * @param arguments {Object*} an arbitrary set of parameters to pass to"," * the handler. If the first of these is an object literal and the event is"," * configured to emit an event facade, the event facade will replace that"," * parameter after the properties the object literal contains are copied to"," * the event facade."," * @return {EventTarget} the event host"," */"," fire: function(type) {",""," var typeIncluded = (typeof type === \"string\"),"," argCount = arguments.length,"," t = type,"," yuievt = this._yuievt,"," etConfig = yuievt.config,"," pre = etConfig.prefix,"," ret,"," ce,"," ce2,"," args;",""," if (typeIncluded && argCount <= 2) {",""," // PERF: Try to avoid slice/iteration for the common signatures",""," if (argCount === 2) {"," args = [arguments[1]]; // fire(\"foo\", {})"," } else {"," args = []; // fire(\"foo\")"," }",""," } else {"," args = nativeSlice.call(arguments, ((typeIncluded) ? 1 : 0));"," }",""," if (!typeIncluded) {"," t = (type && type.type);"," }",""," if (pre) {"," t = _getType(t, pre);"," }",""," ce = yuievt.events[t];",""," if (this._hasSiblings) {"," ce2 = this.getSibling(t, ce);",""," if (ce2 && !ce) {"," ce = this.publish(t);"," }"," }",""," // PERF: trying to avoid function call, since this is a critical path"," if ((etConfig.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {"," this._monitor('fire', (ce || t), {"," args: args"," });"," }",""," // this event has not been published or subscribed to"," if (!ce) {"," if (yuievt.hasTargets) {"," return this.bubble({ type: t }, args, this);"," }",""," // otherwise there is nothing to be done"," ret = true;"," } else {",""," if (ce2) {"," ce.sibling = ce2;"," }",""," ret = ce._fire(args);"," }",""," return (yuievt.chain) ? this : ret;"," },",""," getSibling: function(type, ce) {"," var ce2;",""," // delegate to *:type events if there are subscribers"," if (type.indexOf(PREFIX_DELIMITER) > -1) {"," type = _wildType(type);"," ce2 = this.getEvent(type, true);"," if (ce2) {"," ce2.applyConfig(ce);"," ce2.bubbles = false;"," ce2.broadcast = 0;"," }"," }",""," return ce2;"," },",""," /**"," * Returns the custom event of the provided type has been created, a"," * falsy value otherwise"," * @method getEvent"," * @param type {String} the type, or name of the event"," * @param prefixed {String} if true, the type is prefixed already"," * @return {CustomEvent} the custom event or null"," */"," getEvent: function(type, prefixed) {"," var pre, e;",""," if (!prefixed) {"," pre = this._yuievt.config.prefix;"," type = (pre) ? _getType(type, pre) : type;"," }"," e = this._yuievt.events;"," return e[type] || null;"," },",""," /**"," * Subscribe to a custom event hosted by this object. The"," * supplied callback will execute after any listeners add"," * via the subscribe method, and after the default function,"," * if configured for the event, has executed."," *"," * @method after"," * @param {String} type The name of the event"," * @param {Function} fn The callback to execute in response to the event"," * @param {Object} [context] Override `this` object in callback"," * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber"," * @return {EventHandle} A subscription handle capable of detaching the"," * subscription"," */"," after: function(type, fn) {",""," var a = nativeSlice.call(arguments, 0);",""," switch (L.type(type)) {"," case 'function':"," return Y.Do.after.apply(Y.Do, arguments);"," case 'array':"," // YArray.each(a[0], function(v) {"," // v = AFTER_PREFIX + v;"," // });"," // break;"," case 'object':"," a[0]._after = true;"," break;"," default:"," a[0] = AFTER_PREFIX + type;"," }",""," return this.on.apply(this, a);",""," },",""," /**"," * Executes the callback before a DOM event, custom event"," * or method. If the first argument is a function, it"," * is assumed the target is a method. For DOM and custom"," * events, this is an alias for Y.on."," *"," * For DOM and custom events:"," * type, callback, context, 0-n arguments"," *"," * For methods:"," * callback, object (method host), methodName, context, 0-n arguments"," *"," * @method before"," * @return detach handle"," */"," before: function() {"," return this.on.apply(this, arguments);"," }","","};","","Y.EventTarget = ET;","","// make Y an event target","Y.mix(Y, ET.prototype);","ET.call(Y, { bubbles: false });","","YUI.Env.globalEvents = YUI.Env.globalEvents || new ET();","","/**"," * Hosts YUI page level events. This is where events bubble to"," * when the broadcast config is set to 2. This property is"," * only available if the custom event module is loaded."," * @property Global"," * @type EventTarget"," * @for YUI"," */","Y.Global = YUI.Env.globalEvents;","","// @TODO implement a global namespace function on Y.Global?","","/**","`Y.on()` can do many things:","","<ul>"," <li>Subscribe to custom events `publish`ed and `fire`d from Y</li>"," <li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and"," `fire`d from any object in the YUI instance sandbox</li>"," <li>Subscribe to DOM events</li>"," <li>Subscribe to the execution of a method on any object, effectively"," treating that method as an event</li>","</ul>","","For custom event subscriptions, pass the custom event name as the first argument","and callback as the second. The `this` object in the callback will be `Y` unless","an override is passed as the third argument.",""," Y.on('io:complete', function () {"," Y.MyApp.updateStatus('Transaction complete');"," });","","To subscribe to DOM events, pass the name of a DOM event as the first argument","and a CSS selector string as the third argument after the callback function.","Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`,","array, or simply omitted (the default is the `window` object).",""," Y.on('click', function (e) {"," e.preventDefault();",""," // proceed with ajax form submission"," var url = this.get('action');"," ..."," }, '#my-form');","","The `this` object in DOM event callbacks will be the `Node` targeted by the CSS","selector or other identifier.","","`on()` subscribers for DOM events or custom events `publish`ed with a","`defaultFn` can prevent the default behavior with `e.preventDefault()` from the","event object passed as the first parameter to the subscription callback.","","To subscribe to the execution of an object method, pass arguments corresponding to the call signature for","<a href=\"../classes/Do.html#methods_before\">`Y.Do.before(...)`</a>.","","NOTE: The formal parameter list below is for events, not for function","injection. See `Y.Do.before` for that signature.","","@method on","@param {String} type DOM or custom event name","@param {Function} fn The callback to execute in response to the event","@param {Object} [context] Override `this` object in callback","@param {Any} [arg*] 0..n additional arguments to supply to the subscriber","@return {EventHandle} A subscription handle capable of detaching the"," subscription","@see Do.before","@for YUI","**/","","/**","Listen for an event one time. Equivalent to `on()`, except that","the listener is immediately detached when executed.","","See the <a href=\"#methods_on\">`on()` method</a> for additional subscription","options.","","@see on","@method once","@param {String} type DOM or custom event name","@param {Function} fn The callback to execute in response to the event","@param {Object} [context] Override `this` object in callback","@param {Any} [arg*] 0..n additional arguments to supply to the subscriber","@return {EventHandle} A subscription handle capable of detaching the"," subscription","@for YUI","**/","","/**","Listen for an event one time. Equivalent to `once()`, except, like `after()`,","the subscription callback executes after all `on()` subscribers and the event's","`defaultFn` (if configured) have executed. Like `after()` if any `on()` phase","subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()`","subscribers will execute.","","The listener is immediately detached when executed.","","See the <a href=\"#methods_on\">`on()` method</a> for additional subscription","options.","","@see once","@method onceAfter","@param {String} type The custom event name","@param {Function} fn The callback to execute in response to the event","@param {Object} [context] Override `this` object in callback","@param {Any} [arg*] 0..n additional arguments to supply to the subscriber","@return {EventHandle} A subscription handle capable of detaching the"," subscription","@for YUI","**/","","/**","Like `on()`, this method creates a subscription to a custom event or to the","execution of a method on an object.","","For events, `after()` subscribers are executed after the event's","`defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber.","","See the <a href=\"#methods_on\">`on()` method</a> for additional subscription","options.","","NOTE: The subscription signature shown is for events, not for function","injection. See <a href=\"../classes/Do.html#methods_after\">`Y.Do.after`</a>","for that signature.","","@see on","@see Do.after","@method after","@param {String} type The custom event name","@param {Function} fn The callback to execute in response to the event","@param {Object} [context] Override `this` object in callback","@param {Any} [args*] 0..n additional arguments to supply to the subscriber","@return {EventHandle} A subscription handle capable of detaching the"," subscription","@for YUI","**/","","","}, '@VERSION@', {\"requires\": [\"oop\"]});","","}());"]};
}
var __cov_0ShtDtxkEapLmfzOgrY8Kw = __coverage__['build/event-custom-base/event-custom-base.js'];
__cov_0ShtDtxkEapLmfzOgrY8Kw.s['1']++;YUI.add('event-custom-base',function(Y,NAME){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['1']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['2']++;Y.Env.evt={handles:{},plugins:{}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['3']++;var DO_BEFORE=0,DO_AFTER=1,DO={objs:null,before:function(fn,obj,sFn,c){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['2']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['4']++;var f=fn,a;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['5']++;if(c){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['1'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['6']++;a=[fn,c].concat(Y.Array(arguments,4,true));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['7']++;f=Y.rbind.apply(Y,a);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['1'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['8']++;return this._inject(DO_BEFORE,f,obj,sFn);},after:function(fn,obj,sFn,c){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['3']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['9']++;var f=fn,a;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['10']++;if(c){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['2'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['11']++;a=[fn,c].concat(Y.Array(arguments,4,true));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['12']++;f=Y.rbind.apply(Y,a);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['2'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['13']++;return this._inject(DO_AFTER,f,obj,sFn);},_inject:function(when,fn,obj,sFn){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['4']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['14']++;var id=Y.stamp(obj),o,sid;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['15']++;if(!obj._yuiaop){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['3'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['16']++;obj._yuiaop={};}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['3'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['17']++;o=obj._yuiaop;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['18']++;if(!o[sFn]){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['4'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['19']++;o[sFn]=new Y.Do.Method(obj,sFn);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['20']++;obj[sFn]=function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['5']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['21']++;return o[sFn].exec.apply(o[sFn],arguments);};}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['4'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['22']++;sid=id+Y.stamp(fn)+sFn;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['23']++;o[sFn].register(sid,fn,when);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['24']++;return new Y.EventHandle(o[sFn],sid);},detach:function(handle){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['6']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['25']++;if(handle.detach){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['5'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['26']++;handle.detach();}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['5'][1]++;}}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['27']++;Y.Do=DO;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['28']++;DO.Method=function(obj,sFn){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['7']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['29']++;this.obj=obj;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['30']++;this.methodName=sFn;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['31']++;this.method=obj[sFn];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['32']++;this.before={};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['33']++;this.after={};};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['34']++;DO.Method.prototype.register=function(sid,fn,when){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['8']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['35']++;if(when){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['6'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['36']++;this.after[sid]=fn;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['6'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['37']++;this.before[sid]=fn;}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['38']++;DO.Method.prototype._delete=function(sid){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['9']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['39']++;delete this.before[sid];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['40']++;delete this.after[sid];};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['41']++;DO.Method.prototype.exec=function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['10']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['42']++;var args=Y.Array(arguments,0,true),i,ret,newRet,bf=this.before,af=this.after,prevented=false;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['43']++;for(i in bf){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['44']++;if(bf.hasOwnProperty(i)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['7'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['45']++;ret=bf[i].apply(this.obj,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['46']++;if(ret){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['8'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['47']++;switch(ret.constructor){case DO.Halt:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['9'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['48']++;return ret.retVal;case DO.AlterArgs:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['9'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['49']++;args=ret.newArgs;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['50']++;break;case DO.Prevent:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['9'][2]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['51']++;prevented=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['52']++;break;default:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['9'][3]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['8'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['7'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['53']++;if(!prevented){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['10'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['54']++;ret=this.method.apply(this.obj,args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['10'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['55']++;DO.originalRetVal=ret;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['56']++;DO.currentRetVal=ret;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['57']++;for(i in af){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['58']++;if(af.hasOwnProperty(i)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['11'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['59']++;newRet=af[i].apply(this.obj,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['60']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['13'][0]++,newRet)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['13'][1]++,newRet.constructor===DO.Halt)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['12'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['61']++;return newRet.retVal;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['12'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['62']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['15'][0]++,newRet)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['15'][1]++,newRet.constructor===DO.AlterReturn)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['14'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['63']++;ret=newRet.newRetVal;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['64']++;DO.currentRetVal=ret;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['14'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['11'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['65']++;return ret;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['66']++;DO.AlterArgs=function(msg,newArgs){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['11']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['67']++;this.msg=msg;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['68']++;this.newArgs=newArgs;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['69']++;DO.AlterReturn=function(msg,newRetVal){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['12']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['70']++;this.msg=msg;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['71']++;this.newRetVal=newRetVal;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['72']++;DO.Halt=function(msg,retVal){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['13']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['73']++;this.msg=msg;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['74']++;this.retVal=retVal;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['75']++;DO.Prevent=function(msg){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['14']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['76']++;this.msg=msg;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['77']++;DO.Error=DO.Halt;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['78']++;var YArray=Y.Array,AFTER='after',CONFIGS=['broadcast','monitored','bubbles','context','contextFn','currentTarget','defaultFn','defaultTargetOnly','details','emitFacade','fireOnce','async','host','preventable','preventedFn','queuable','silent','stoppedFn','target','type'],CONFIGS_HASH=YArray.hash(CONFIGS),nativeSlice=Array.prototype.slice,YUI3_SIGNATURE=9,YUI_LOG='yui:log',mixConfigs=function(r,s,ov){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['15']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['79']++;var p;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['80']++;for(p in s){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['81']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['17'][0]++,CONFIGS_HASH[p])&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['17'][1]++,ov)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['17'][2]++,!(p in r)))){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['16'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['82']++;r[p]=s[p];}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['16'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['83']++;return r;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['84']++;Y.CustomEvent=function(type,defaults){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['16']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['85']++;this._kds=Y.CustomEvent.keepDeprecatedSubs;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['86']++;this.id=Y.guid();__cov_0ShtDtxkEapLmfzOgrY8Kw.s['87']++;this.type=type;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['88']++;this.silent=this.logSystem=type===YUI_LOG;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['89']++;if(this._kds){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['18'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['90']++;this.subscribers={};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['91']++;this.afters={};}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['18'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['92']++;if(defaults){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['19'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['93']++;mixConfigs(this,defaults,true);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['19'][1]++;}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['94']++;Y.CustomEvent.keepDeprecatedSubs=false;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['95']++;Y.CustomEvent.mixConfigs=mixConfigs;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['96']++;Y.CustomEvent.prototype={constructor:Y.CustomEvent,signature:YUI3_SIGNATURE,context:Y,preventable:true,bubbles:true,hasSubs:function(when){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['17']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['97']++;var s=0,a=0,subs=this._subscribers,afters=this._afters,sib=this.sibling;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['98']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['20'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['99']++;s=subs.length;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['20'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['100']++;if(afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['21'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['101']++;a=afters.length;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['21'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['102']++;if(sib){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['22'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['103']++;subs=sib._subscribers;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['104']++;afters=sib._afters;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['105']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['23'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['106']++;s+=subs.length;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['23'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['107']++;if(afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['24'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['108']++;a+=afters.length;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['24'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['22'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['109']++;if(when){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['25'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['110']++;return when==='after'?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['26'][0]++,a):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['26'][1]++,s);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['25'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['111']++;return s+a;},monitor:function(what){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['18']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['112']++;this.monitored=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['113']++;var type=this.id+'|'+this.type+'_'+what,args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['114']++;args[0]=type;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['115']++;return this.host.on.apply(this.host,args);},getSubs:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['19']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['116']++;var sibling=this.sibling,subs=this._subscribers,afters=this._afters,siblingSubs,siblingAfters;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['117']++;if(sibling){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['27'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['118']++;siblingSubs=sibling._subscribers;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['119']++;siblingAfters=sibling._afters;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['27'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['120']++;if(siblingSubs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['28'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['121']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['29'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['122']++;subs=subs.concat(siblingSubs);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['29'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['123']++;subs=siblingSubs.concat();}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['28'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['124']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['30'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['125']++;subs=subs.concat();}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['30'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['126']++;subs=[];}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['127']++;if(siblingAfters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['31'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['128']++;if(afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['32'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['129']++;afters=afters.concat(siblingAfters);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['32'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['130']++;afters=siblingAfters.concat();}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['31'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['131']++;if(afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['33'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['132']++;afters=afters.concat();}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['33'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['133']++;afters=[];}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['134']++;return[subs,afters];},applyConfig:function(o,force){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['20']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['135']++;mixConfigs(this,o,force);},_on:function(fn,context,args,when){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['21']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['136']++;var s=new Y.Subscriber(fn,context,args,when);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['137']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['35'][0]++,this.fireOnce)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['35'][1]++,this.fired)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['34'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['138']++;if(this.async){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['36'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['139']++;setTimeout(Y.bind(this._notify,this,s,this.firedWith),0);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['36'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['140']++;this._notify(s,this.firedWith);}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['34'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['141']++;if(when===AFTER){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['37'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['142']++;if(!this._afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['38'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['143']++;this._afters=[];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['144']++;this._hasAfters=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['38'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['145']++;this._afters.push(s);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['37'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['146']++;if(!this._subscribers){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['39'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['147']++;this._subscribers=[];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['148']++;this._hasSubs=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['39'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['149']++;this._subscribers.push(s);}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['150']++;if(this._kds){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['40'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['151']++;if(when===AFTER){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['41'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['152']++;this.afters[s.id]=s;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['41'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['153']++;this.subscribers[s.id]=s;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['40'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['154']++;return new Y.EventHandle(this,s);},subscribe:function(fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['22']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['155']++;var a=arguments.length>2?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['42'][0]++,nativeSlice.call(arguments,2)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['42'][1]++,null);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['156']++;return this._on(fn,context,a,true);},on:function(fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['23']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['157']++;var a=arguments.length>2?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['43'][0]++,nativeSlice.call(arguments,2)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['43'][1]++,null);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['158']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['45'][0]++,this.monitored)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['45'][1]++,this.host)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['44'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['159']++;this.host._monitor('attach',this,{args:arguments});}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['44'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['160']++;return this._on(fn,context,a,true);},after:function(fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['24']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['161']++;var a=arguments.length>2?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['46'][0]++,nativeSlice.call(arguments,2)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['46'][1]++,null);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['162']++;return this._on(fn,context,a,AFTER);},detach:function(fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['25']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['163']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['48'][0]++,fn)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['48'][1]++,fn.detach)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['47'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['164']++;return fn.detach();}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['47'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['165']++;var i,s,found=0,subs=this._subscribers,afters=this._afters;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['166']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['49'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['167']++;for(i=subs.length;i>=0;i--){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['168']++;s=subs[i];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['169']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['51'][0]++,s)&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['51'][1]++,!fn)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['51'][2]++,fn===s.fn))){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['50'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['170']++;this._delete(s,subs,i);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['171']++;found++;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['50'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['49'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['172']++;if(afters){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['52'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['173']++;for(i=afters.length;i>=0;i--){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['174']++;s=afters[i];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['175']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['54'][0]++,s)&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['54'][1]++,!fn)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['54'][2]++,fn===s.fn))){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['53'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['176']++;this._delete(s,afters,i);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['177']++;found++;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['53'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['52'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['178']++;return found;},unsubscribe:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['26']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['179']++;return this.detach.apply(this,arguments);},_notify:function(s,args,ef){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['27']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['180']++;var ret;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['181']++;ret=s.notify(args,this);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['182']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['56'][0]++,false===ret)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['56'][1]++,this.stopped>1)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['55'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['183']++;return false;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['55'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['184']++;return true;},log:function(msg,cat){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['28']++;},fire:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['29']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['185']++;var args=[];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['186']++;args.push.apply(args,arguments);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['187']++;return this._fire(args);},_fire:function(args){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['30']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['188']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['58'][0]++,this.fireOnce)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['58'][1]++,this.fired)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['57'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['189']++;return true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['57'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['190']++;this.fired=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['191']++;if(this.fireOnce){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['59'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['192']++;this.firedWith=args;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['59'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['193']++;if(this.emitFacade){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['60'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['194']++;return this.fireComplex(args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['60'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['195']++;return this.fireSimple(args);}}},fireSimple:function(args){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['31']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['196']++;this.stopped=0;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['197']++;this.prevented=0;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['198']++;if(this.hasSubs()){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['61'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['199']++;var subs=this.getSubs();__cov_0ShtDtxkEapLmfzOgrY8Kw.s['200']++;this._procSubs(subs[0],args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['201']++;this._procSubs(subs[1],args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['61'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['202']++;if(this.broadcast){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['62'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['203']++;this._broadcast(args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['62'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['204']++;return this.stopped?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['63'][0]++,false):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['63'][1]++,true);},fireComplex:function(args){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['32']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['205']++;args[0]=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['64'][0]++,args[0])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['64'][1]++,{});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['206']++;return this.fireSimple(args);},_procSubs:function(subs,args,ef){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['33']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['207']++;var s,i,l;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['208']++;for(i=0,l=subs.length;i<l;i++){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['209']++;s=subs[i];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['210']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['66'][0]++,s)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['66'][1]++,s.fn)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['65'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['211']++;if(false===this._notify(s,args,ef)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['67'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['212']++;this.stopped=2;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['67'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['213']++;if(this.stopped===2){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['68'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['214']++;return false;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['68'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['65'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['215']++;return true;},_broadcast:function(args){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['34']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['216']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['70'][0]++,!this.stopped)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['70'][1]++,this.broadcast)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['69'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['217']++;var a=args.concat();__cov_0ShtDtxkEapLmfzOgrY8Kw.s['218']++;a.unshift(this.type);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['219']++;if(this.host!==Y){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['71'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['220']++;Y.fire.apply(Y,a);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['71'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['221']++;if(this.broadcast===2){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['72'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['222']++;Y.Global.fire.apply(Y.Global,a);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['72'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['69'][1]++;}},unsubscribeAll:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['35']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['223']++;return this.detachAll.apply(this,arguments);},detachAll:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['36']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['224']++;return this.detach();},_delete:function(s,subs,i){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['37']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['225']++;var when=s._when;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['226']++;if(!subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['73'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['227']++;subs=when===AFTER?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['74'][0]++,this._afters):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['74'][1]++,this._subscribers);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['228']++;i=YArray.indexOf(subs,s,0);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['73'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['229']++;if(subs){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['75'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['230']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['77'][0]++,s)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['77'][1]++,subs[i]===s)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['76'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['231']++;subs.splice(i,1);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['232']++;if(subs.length===0){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['78'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['233']++;if(when===AFTER){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['79'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['234']++;this._hasAfters=false;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['79'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['235']++;this._hasSubs=false;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['78'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['76'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['75'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['236']++;if(this._kds){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['80'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['237']++;if(when===AFTER){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['81'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['238']++;delete this.afters[s.id];}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['81'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['239']++;delete this.subscribers[s.id];}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['80'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['240']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['83'][0]++,this.monitored)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['83'][1]++,this.host)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['82'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['241']++;this.host._monitor('detach',this,{ce:this,sub:s});}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['82'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['242']++;if(s){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['84'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['243']++;s.deleted=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['84'][1]++;}}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['244']++;Y.Subscriber=function(fn,context,args,when){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['38']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['245']++;this.fn=fn;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['246']++;this.context=context;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['247']++;this.id=Y.guid();__cov_0ShtDtxkEapLmfzOgrY8Kw.s['248']++;this.args=args;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['249']++;this._when=when;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['250']++;Y.Subscriber.prototype={constructor:Y.Subscriber,_notify:function(c,args,ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['39']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['251']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['86'][0]++,this.deleted)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['86'][1]++,!this.postponed)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['85'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['252']++;if(this.postponed){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['87'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['253']++;delete this.fn;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['254']++;delete this.context;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['87'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['255']++;delete this.postponed;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['256']++;return null;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['85'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['257']++;var a=this.args,ret;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['258']++;switch(ce.signature){case 0:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['88'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['259']++;ret=this.fn.call(c,ce.type,args,c);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['260']++;break;case 1:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['88'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['261']++;ret=this.fn.call(c,(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['89'][0]++,args[0])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['89'][1]++,null),c);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['262']++;break;default:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['88'][2]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['263']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['91'][0]++,a)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['91'][1]++,args)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['90'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['264']++;args=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['92'][0]++,args)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['92'][1]++,[]);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['265']++;a=a?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['93'][0]++,args.concat(a)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['93'][1]++,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['266']++;ret=this.fn.apply(c,a);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['90'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['267']++;ret=this.fn.call(c);}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['268']++;if(this.once){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['94'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['269']++;ce._delete(this);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['94'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['270']++;return ret;},notify:function(args,ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['40']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['271']++;var c=this.context,ret=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['272']++;if(!c){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['95'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['273']++;c=ce.contextFn?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['96'][0]++,ce.contextFn()):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['96'][1]++,ce.context);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['95'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['274']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['98'][0]++,Y.config)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['98'][1]++,Y.config.throwFail)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['97'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['275']++;ret=this._notify(c,args,ce);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['97'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['276']++;try{__cov_0ShtDtxkEapLmfzOgrY8Kw.s['277']++;ret=this._notify(c,args,ce);}catch(e){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['278']++;Y.error(this+' failed: '+e.message,e);}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['279']++;return ret;},contains:function(fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['41']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['280']++;if(context){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['99'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['281']++;return(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['100'][0]++,this.fn===fn)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['100'][1]++,this.context===context);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['99'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['282']++;return this.fn===fn;}},valueOf:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['42']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['283']++;return this.id;}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['284']++;Y.EventHandle=function(evt,sub){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['43']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['285']++;this.evt=evt;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['286']++;this.sub=sub;};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['287']++;Y.EventHandle.prototype={batch:function(f,c){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['44']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['288']++;f.call((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['101'][0]++,c)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['101'][1]++,this),this);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['289']++;if(Y.Lang.isArray(this.evt)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['102'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['290']++;Y.Array.each(this.evt,function(h){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['45']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['291']++;h.batch.call((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['103'][0]++,c)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['103'][1]++,h),f);});}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['102'][1]++;}},detach:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['46']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['292']++;var evt=this.evt,detached=0,i;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['293']++;if(evt){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['104'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['294']++;if(Y.Lang.isArray(evt)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['105'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['295']++;for(i=0;i<evt.length;i++){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['296']++;detached+=evt[i].detach();}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['105'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['297']++;evt._delete(this.sub);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['298']++;detached=1;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['104'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['299']++;return detached;},monitor:function(what){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['47']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['300']++;return this.evt.monitor.apply(this.evt,arguments);}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['301']++;var L=Y.Lang,PREFIX_DELIMITER=':',CATEGORY_DELIMITER='|',AFTER_PREFIX='~AFTER~',WILD_TYPE_RE=/(.*?)(:)(.*?)/,_wildType=Y.cached(function(type){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['48']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['302']++;return type.replace(WILD_TYPE_RE,'*$2$3');}),_getType=function(type,pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['49']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['303']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['107'][0]++,!pre)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['107'][1]++,type.indexOf(PREFIX_DELIMITER)>-1)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['106'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['304']++;return type;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['106'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['305']++;return pre+PREFIX_DELIMITER+type;},_parseType=Y.cached(function(type,pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['50']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['306']++;var t=type,detachcategory,after,i;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['307']++;if(!L.isString(t)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['108'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['308']++;return t;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['108'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['309']++;i=t.indexOf(AFTER_PREFIX);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['310']++;if(i>-1){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['109'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['311']++;after=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['312']++;t=t.substr(AFTER_PREFIX.length);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['109'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['313']++;i=t.indexOf(CATEGORY_DELIMITER);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['314']++;if(i>-1){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['110'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['315']++;detachcategory=t.substr(0,i);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['316']++;t=t.substr(i+1);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['317']++;if(t==='*'){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['111'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['318']++;t=null;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['111'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['110'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['319']++;return[detachcategory,pre?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['112'][0]++,_getType(t,pre)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['112'][1]++,t),after,t];}),ET=function(opts){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['51']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['320']++;var etState=this._yuievt,etConfig;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['321']++;if(!etState){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['113'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['322']++;etState=this._yuievt={events:{},targets:null,config:{host:this,context:this},chain:Y.config.chain};}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['113'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['323']++;etConfig=etState.config;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['324']++;if(opts){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['114'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['325']++;mixConfigs(etConfig,opts,true);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['326']++;if(opts.chain!==undefined){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['115'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['327']++;etState.chain=opts.chain;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['115'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['328']++;if(opts.prefix){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['116'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['329']++;etConfig.prefix=opts.prefix;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['116'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['114'][1]++;}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['330']++;ET.prototype={constructor:ET,once:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['52']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['331']++;var handle=this.on.apply(this,arguments);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['332']++;handle.batch(function(hand){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['53']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['333']++;if(hand.sub){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['117'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['334']++;hand.sub.once=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['117'][1]++;}});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['335']++;return handle;},onceAfter:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['54']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['336']++;var handle=this.after.apply(this,arguments);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['337']++;handle.batch(function(hand){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['55']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['338']++;if(hand.sub){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['118'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['339']++;hand.sub.once=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['118'][1]++;}});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['340']++;return handle;},parseType:function(type,pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['56']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['341']++;return _parseType(type,(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['119'][0]++,pre)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['119'][1]++,this._yuievt.config.prefix));},on:function(type,fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['57']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['342']++;var yuievt=this._yuievt,parts=_parseType(type,yuievt.config.prefix),f,c,args,ret,ce,detachcategory,handle,store=Y.Env.evt.handles,after,adapt,shorttype,Node=Y.Node,n,domevent,isArr;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['343']++;this._monitor('attach',parts[1],{args:arguments,category:parts[0],after:parts[2]});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['344']++;if(L.isObject(type)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['120'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['345']++;if(L.isFunction(type)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['121'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['346']++;return Y.Do.before.apply(Y.Do,arguments);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['121'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['347']++;f=fn;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['348']++;c=context;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['349']++;args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['350']++;ret=[];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['351']++;if(L.isArray(type)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['122'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['352']++;isArr=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['122'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['353']++;after=type._after;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['354']++;delete type._after;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['355']++;Y.each(type,function(v,k){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['58']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['356']++;if(L.isObject(v)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['123'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['357']++;f=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['124'][0]++,v.fn)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['124'][1]++,L.isFunction(v)?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['125'][0]++,v):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['125'][1]++,f));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['358']++;c=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['126'][0]++,v.context)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['126'][1]++,c);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['123'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['359']++;var nv=after?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['127'][0]++,AFTER_PREFIX):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['127'][1]++,'');__cov_0ShtDtxkEapLmfzOgrY8Kw.s['360']++;args[0]=nv+(isArr?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['128'][0]++,v):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['128'][1]++,k));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['361']++;args[1]=f;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['362']++;args[2]=c;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['363']++;ret.push(this.on.apply(this,args));},this);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['364']++;return yuievt.chain?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['129'][0]++,this):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['129'][1]++,new Y.EventHandle(ret));}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['120'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['365']++;detachcategory=parts[0];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['366']++;after=parts[2];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['367']++;shorttype=parts[3];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['368']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['131'][0]++,Node)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['131'][1]++,Y.instanceOf(this,Node))&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['131'][2]++,shorttype in Node.DOM_EVENTS)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['130'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['369']++;args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['370']++;args.splice(2,0,Node.getDOMNode(this));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['371']++;return Y.on.apply(Y,args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['130'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['372']++;type=parts[1];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['373']++;if(Y.instanceOf(this,YUI)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['132'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['374']++;adapt=Y.Env.evt.plugins[type];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['375']++;args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['376']++;args[0]=shorttype;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['377']++;if(Node){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['133'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['378']++;n=args[2];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['379']++;if(Y.instanceOf(n,Y.NodeList)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['134'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['380']++;n=Y.NodeList.getDOMNodes(n);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['134'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['381']++;if(Y.instanceOf(n,Node)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['135'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['382']++;n=Node.getDOMNode(n);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['135'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['383']++;domevent=shorttype in Node.DOM_EVENTS;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['384']++;if(domevent){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['136'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['385']++;args[2]=n;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['136'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['133'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['386']++;if(adapt){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['137'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['387']++;handle=adapt.on.apply(Y,args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['137'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['388']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['139'][0]++,!type)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['139'][1]++,domevent)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['138'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['389']++;handle=Y.Event._attach(args);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['138'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['132'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['390']++;if(!handle){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['140'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['391']++;ce=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['141'][0]++,yuievt.events[type])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['141'][1]++,this.publish(type));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['392']++;handle=ce._on(fn,context,arguments.length>3?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['142'][0]++,nativeSlice.call(arguments,3)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['142'][1]++,null),after?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['143'][0]++,'after'):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['143'][1]++,true));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['393']++;if(type.indexOf('*:')!==-1){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['144'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['394']++;this._hasSiblings=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['144'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['140'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['395']++;if(detachcategory){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['145'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['396']++;store[detachcategory]=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['146'][0]++,store[detachcategory])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['146'][1]++,{});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['397']++;store[detachcategory][type]=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['147'][0]++,store[detachcategory][type])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['147'][1]++,[]);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['398']++;store[detachcategory][type].push(handle);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['145'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['399']++;return yuievt.chain?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['148'][0]++,this):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['148'][1]++,handle);},subscribe:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['59']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['400']++;return this.on.apply(this,arguments);},detach:function(type,fn,context){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['60']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['401']++;var evts=this._yuievt.events,i,Node=Y.Node,isNode=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['149'][0]++,Node)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['149'][1]++,Y.instanceOf(this,Node));__cov_0ShtDtxkEapLmfzOgrY8Kw.s['402']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['151'][0]++,!type)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['151'][1]++,this!==Y)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['150'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['403']++;for(i in evts){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['404']++;if(evts.hasOwnProperty(i)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['152'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['405']++;evts[i].detach(fn,context);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['152'][1]++;}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['406']++;if(isNode){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['153'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['407']++;Y.Event.purgeElement(Node.getDOMNode(this));}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['153'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['408']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['150'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['409']++;var parts=_parseType(type,this._yuievt.config.prefix),detachcategory=L.isArray(parts)?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['154'][0]++,parts[0]):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['154'][1]++,null),shorttype=parts?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['155'][0]++,parts[3]):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['155'][1]++,null),adapt,store=Y.Env.evt.handles,detachhost,cat,args,ce,keyDetacher=function(lcat,ltype,host){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['61']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['410']++;var handles=lcat[ltype],ce,i;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['411']++;if(handles){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['156'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['412']++;for(i=handles.length-1;i>=0;--i){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['413']++;ce=handles[i].evt;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['414']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['158'][0]++,ce.host===host)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['158'][1]++,ce.el===host)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['157'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['415']++;handles[i].detach();}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['157'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['156'][1]++;}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['416']++;if(detachcategory){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['159'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['417']++;cat=store[detachcategory];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['418']++;type=parts[1];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['419']++;detachhost=isNode?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['160'][0]++,Y.Node.getDOMNode(this)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['160'][1]++,this);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['420']++;if(cat){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['161'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['421']++;if(type){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['162'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['422']++;keyDetacher(cat,type,detachhost);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['162'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['423']++;for(i in cat){__cov_0ShtDtxkEapLmfzOgrY8Kw.s['424']++;if(cat.hasOwnProperty(i)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['163'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['425']++;keyDetacher(cat,i,detachhost);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['163'][1]++;}}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['426']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['161'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['159'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['427']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['165'][0]++,L.isObject(type))&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['165'][1]++,type.detach)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['164'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['428']++;type.detach();__cov_0ShtDtxkEapLmfzOgrY8Kw.s['429']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['164'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['430']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['167'][0]++,isNode)&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['167'][1]++,!shorttype)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['167'][2]++,shorttype in Node.DOM_EVENTS))){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['166'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['431']++;args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['432']++;args[2]=Node.getDOMNode(this);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['433']++;Y.detach.apply(Y,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['434']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['166'][1]++;}}}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['435']++;adapt=Y.Env.evt.plugins[shorttype];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['436']++;if(Y.instanceOf(this,YUI)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['168'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['437']++;args=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['438']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['170'][0]++,adapt)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['170'][1]++,adapt.detach)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['169'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['439']++;adapt.detach.apply(Y,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['440']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['169'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['441']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['172'][0]++,!type)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['172'][1]++,!adapt)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['172'][2]++,Node)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['172'][3]++,type in Node.DOM_EVENTS)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['171'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['442']++;args[0]=type;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['443']++;Y.Event.detach.apply(Y.Event,args);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['444']++;return this;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['171'][1]++;}}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['168'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['445']++;ce=evts[parts[1]];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['446']++;if(ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['173'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['447']++;ce.detach(fn,context);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['173'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['448']++;return this;},unsubscribe:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['62']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['449']++;return this.detach.apply(this,arguments);},detachAll:function(type){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['63']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['450']++;return this.detach(type);},unsubscribeAll:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['64']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['451']++;return this.detachAll.apply(this,arguments);},publish:function(type,opts){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['65']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['452']++;var ret,etState=this._yuievt,etConfig=etState.config,pre=etConfig.prefix;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['453']++;if(typeof type==='string'){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['174'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['454']++;if(pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['175'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['455']++;type=_getType(type,pre);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['175'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['456']++;ret=this._publish(type,etConfig,opts);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['174'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['457']++;ret={};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['458']++;Y.each(type,function(v,k){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['66']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['459']++;if(pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['176'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['460']++;k=_getType(k,pre);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['176'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['461']++;ret[k]=this._publish(k,etConfig,(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['177'][0]++,v)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['177'][1]++,opts));},this);}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['462']++;return ret;},_getFullType:function(type){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['67']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['463']++;var pre=this._yuievt.config.prefix;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['464']++;if(pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['178'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['465']++;return pre+PREFIX_DELIMITER+type;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['178'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['466']++;return type;}},_publish:function(fullType,etOpts,ceOpts){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['68']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['467']++;var ce,etState=this._yuievt,etConfig=etState.config,host=etConfig.host,context=etConfig.context,events=etState.events;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['468']++;ce=events[fullType];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['469']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['180'][0]++,etConfig.monitored)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['180'][1]++,!ce)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['180'][2]++,ce)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['180'][3]++,ce.monitored)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['179'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['470']++;this._monitor('publish',fullType,{args:arguments});}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['179'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['471']++;if(!ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['181'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['472']++;ce=events[fullType]=new Y.CustomEvent(fullType,etOpts);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['473']++;if(!etOpts){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['182'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['474']++;ce.host=host;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['475']++;ce.context=context;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['182'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['181'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['476']++;if(ceOpts){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['183'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['477']++;mixConfigs(ce,ceOpts,true);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['183'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['478']++;return ce;},_monitor:function(what,eventType,o){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['69']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['479']++;var monitorevt,ce,type;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['480']++;if(eventType){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['184'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['481']++;if(typeof eventType==='string'){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['185'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['482']++;type=eventType;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['483']++;ce=this.getEvent(eventType,true);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['185'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['484']++;ce=eventType;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['485']++;type=eventType.type;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['486']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['187'][0]++,this._yuievt.config.monitored)&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['187'][1]++,!ce)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['187'][2]++,ce.monitored))||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['187'][3]++,ce)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['187'][4]++,ce.monitored)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['186'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['487']++;monitorevt=type+'_'+what;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['488']++;o.monitored=what;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['489']++;this.fire.call(this,monitorevt,o);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['186'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['184'][1]++;}},fire:function(type){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['70']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['490']++;var typeIncluded=typeof type==='string',argCount=arguments.length,t=type,yuievt=this._yuievt,etConfig=yuievt.config,pre=etConfig.prefix,ret,ce,ce2,args;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['491']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['189'][0]++,typeIncluded)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['189'][1]++,argCount<=2)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['188'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['492']++;if(argCount===2){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['190'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['493']++;args=[arguments[1]];}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['190'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['494']++;args=[];}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['188'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['495']++;args=nativeSlice.call(arguments,typeIncluded?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['191'][0]++,1):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['191'][1]++,0));}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['496']++;if(!typeIncluded){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['192'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['497']++;t=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['193'][0]++,type)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['193'][1]++,type.type);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['192'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['498']++;if(pre){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['194'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['499']++;t=_getType(t,pre);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['194'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['500']++;ce=yuievt.events[t];__cov_0ShtDtxkEapLmfzOgrY8Kw.s['501']++;if(this._hasSiblings){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['195'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['502']++;ce2=this.getSibling(t,ce);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['503']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['197'][0]++,ce2)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['197'][1]++,!ce)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['196'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['504']++;ce=this.publish(t);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['196'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['195'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['505']++;if((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['199'][0]++,etConfig.monitored)&&((__cov_0ShtDtxkEapLmfzOgrY8Kw.b['199'][1]++,!ce)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['199'][2]++,ce.monitored))||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['199'][3]++,ce)&&(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['199'][4]++,ce.monitored)){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['198'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['506']++;this._monitor('fire',(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['200'][0]++,ce)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['200'][1]++,t),{args:args});}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['198'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['507']++;if(!ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['201'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['508']++;if(yuievt.hasTargets){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['202'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['509']++;return this.bubble({type:t},args,this);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['202'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['510']++;ret=true;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['201'][1]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['511']++;if(ce2){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['203'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['512']++;ce.sibling=ce2;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['203'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['513']++;ret=ce._fire(args);}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['514']++;return yuievt.chain?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['204'][0]++,this):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['204'][1]++,ret);},getSibling:function(type,ce){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['71']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['515']++;var ce2;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['516']++;if(type.indexOf(PREFIX_DELIMITER)>-1){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['205'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['517']++;type=_wildType(type);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['518']++;ce2=this.getEvent(type,true);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['519']++;if(ce2){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['206'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['520']++;ce2.applyConfig(ce);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['521']++;ce2.bubbles=false;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['522']++;ce2.broadcast=0;}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['206'][1]++;}}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['205'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['523']++;return ce2;},getEvent:function(type,prefixed){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['72']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['524']++;var pre,e;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['525']++;if(!prefixed){__cov_0ShtDtxkEapLmfzOgrY8Kw.b['207'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['526']++;pre=this._yuievt.config.prefix;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['527']++;type=pre?(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['208'][0]++,_getType(type,pre)):(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['208'][1]++,type);}else{__cov_0ShtDtxkEapLmfzOgrY8Kw.b['207'][1]++;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['528']++;e=this._yuievt.events;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['529']++;return(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['209'][0]++,e[type])||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['209'][1]++,null);},after:function(type,fn){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['73']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['530']++;var a=nativeSlice.call(arguments,0);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['531']++;switch(L.type(type)){case'function':__cov_0ShtDtxkEapLmfzOgrY8Kw.b['210'][0]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['532']++;return Y.Do.after.apply(Y.Do,arguments);case'array':__cov_0ShtDtxkEapLmfzOgrY8Kw.b['210'][1]++;case'object':__cov_0ShtDtxkEapLmfzOgrY8Kw.b['210'][2]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['533']++;a[0]._after=true;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['534']++;break;default:__cov_0ShtDtxkEapLmfzOgrY8Kw.b['210'][3]++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['535']++;a[0]=AFTER_PREFIX+type;}__cov_0ShtDtxkEapLmfzOgrY8Kw.s['536']++;return this.on.apply(this,a);},before:function(){__cov_0ShtDtxkEapLmfzOgrY8Kw.f['74']++;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['537']++;return this.on.apply(this,arguments);}};__cov_0ShtDtxkEapLmfzOgrY8Kw.s['538']++;Y.EventTarget=ET;__cov_0ShtDtxkEapLmfzOgrY8Kw.s['539']++;Y.mix(Y,ET.prototype);__cov_0ShtDtxkEapLmfzOgrY8Kw.s['540']++;ET.call(Y,{bubbles:false});__cov_0ShtDtxkEapLmfzOgrY8Kw.s['541']++;YUI.Env.globalEvents=(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['211'][0]++,YUI.Env.globalEvents)||(__cov_0ShtDtxkEapLmfzOgrY8Kw.b['211'][1]++,new ET());__cov_0ShtDtxkEapLmfzOgrY8Kw.s['542']++;Y.Global=YUI.Env.globalEvents;},'@VERSION@',{'requires':['oop']});
|
docs/src/app/components/pages/components/Stepper/VerticalNonLinearStepper.js | kasra-co/material-ui | import React from 'react';
import {
Step,
Stepper,
StepButton,
StepContent,
} from 'material-ui/Stepper';
import RaisedButton from 'material-ui/RaisedButton';
import FlatButton from 'material-ui/FlatButton';
/**
* A basic vertical non-linear implementation
*/
class VerticalNonLinear extends React.Component {
state = {
stepIndex: 0,
};
handleNext = () => {
const {stepIndex} = this.state;
if (stepIndex < 2) {
this.setState({stepIndex: stepIndex + 1});
}
};
handlePrev = () => {
const {stepIndex} = this.state;
if (stepIndex > 0) {
this.setState({stepIndex: stepIndex - 1});
}
};
renderStepActions(step) {
return (
<div style={{margin: '12px 0'}}>
<RaisedButton
label="Next"
disableTouchRipple={true}
disableFocusRipple={true}
primary={true}
onTouchTap={this.handleNext}
style={{marginRight: 12}}
/>
{step > 0 && (
<FlatButton
label="Back"
disableTouchRipple={true}
disableFocusRipple={true}
onTouchTap={this.handlePrev}
/>
)}
</div>
);
}
render() {
const {stepIndex} = this.state;
return (
<div style={{maxWidth: 380, maxHeight: 400, margin: 'auto'}}>
<Stepper
activeStep={stepIndex}
linear={false}
orientation="vertical"
>
<Step>
<StepButton onTouchTap={() => this.setState({stepIndex: 0})}>
Select campaign settings
</StepButton>
<StepContent>
<p>
For each ad campaign that you create, you can control how much
you're willing to spend on clicks and conversions, which networks
and geographical locations you want your ads to show on, and more.
</p>
{this.renderStepActions(0)}
</StepContent>
</Step>
<Step>
<StepButton onTouchTap={() => this.setState({stepIndex: 1})}>
Create an ad group
</StepButton>
<StepContent>
<p>An ad group contains one or more ads which target a shared set of keywords.</p>
{this.renderStepActions(1)}
</StepContent>
</Step>
<Step>
<StepButton onTouchTap={() => this.setState({stepIndex: 2})}>
Create an ad
</StepButton>
<StepContent>
<p>
Try out different ad text to see what brings in the most customers,
and learn how to enhance your ads using features like ad extensions.
If you run into any problems with your ads, find out how to tell if
they're running and how to resolve approval issues.
</p>
{this.renderStepActions(2)}
</StepContent>
</Step>
</Stepper>
</div>
);
}
}
export default VerticalNonLinear;
|
node_modules/material-ui/svg-icons/editor/space-bar.js | millerman86/CouponProject | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _pure = require('recompose/pure');
var _pure2 = _interopRequireDefault(_pure);
var _SvgIcon = require('../../SvgIcon');
var _SvgIcon2 = _interopRequireDefault(_SvgIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var EditorSpaceBar = function EditorSpaceBar(props) {
return _react2.default.createElement(
_SvgIcon2.default,
props,
_react2.default.createElement('path', { d: 'M18 9v4H6V9H4v6h16V9z' })
);
};
EditorSpaceBar = (0, _pure2.default)(EditorSpaceBar);
EditorSpaceBar.displayName = 'EditorSpaceBar';
EditorSpaceBar.muiName = 'SvgIcon';
exports.default = EditorSpaceBar; |
packages/node_modules/@webex/react-component-activity-post-action/src/index.js | adamweeks/react-ciscospark-1 | import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Button from '@webex/react-component-button';
import styles from './styles.css';
const propTypes = {
iconColor: PropTypes.string,
iconType: PropTypes.string.isRequired,
onClick: PropTypes.func.isRequired,
title: PropTypes.string
};
const defaultProps = {
iconColor: 'black',
title: ''
};
function ActivityPostAction(props) {
return (
<div className={classNames('webex-post-action-item', styles.postActionItem)}>
<Button iconColor={props.iconColor} iconType={props.iconType} onClick={props.onClick} title={props.title} />
</div>
);
}
ActivityPostAction.propTypes = propTypes;
ActivityPostAction.defaultProps = defaultProps;
export default ActivityPostAction;
|
tutorials08/src/app.js | Ivanwangcy/webpack-tutorials | import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App';
// 可以使用箭头函数创建无状态组件
// let App = () => {
// return (
// <div>
// <h1>Hello hjs-webpack!!!!!!!</h1>
// hot load...aaaaaaa
// <p>sdfasdfasdfasdf</p>
// </div>
// );
// };
ReactDOM.render(
<App />,
document.querySelector('#root')
)
|
tests/form.js | goto-bus-stop/bulmare | import React from 'react'
import test from 'tape'
import { render, shallow } from 'enzyme'
import {
Control,
ControlGroup,
HorizontalGroup,
ControlLabel,
Label,
Input,
Textarea,
Checkbox,
Radio,
Icon
} from '../src'
test('Control should have class "control"', (t) => {
t.ok(render(<Control />).hasClass('control'))
t.end()
})
test('Controls should render an icon if the "icon" prop is given', (t) => {
t.equal(shallow(
<Control icon={<Icon name='email' />}>
<Input type='email' />
</Control>
).html(), shallow(
<div className='control has-icon'>
<Icon name='email' />
<Input type='email' />
</div>
).html())
// And on the right…
t.equal(shallow(
<Control iconRight={<Icon name='check' />}>
<Input />
</Control>
).html(), shallow(
<div className='control has-icon has-icon-right'>
<Icon name='check' />
<Input />
</div>
).html())
t.end()
})
test('Controls can be grouped', (t) => {
t.equal(shallow(
<ControlGroup>
<Control />
<Control expanded />
</ControlGroup>
).html(), shallow(
<div className='control is-grouped'>
<Control />
<Control expanded />
</div>
).html())
t.end()
})
test('Horizontal form controls render a Control with class "is-horizontal"', (t) => {
t.ok(render(<HorizontalGroup />).is('.control.is-horizontal'))
t.end()
})
test('Labels should have class "label"', (t) => {
t.ok(render(<Label>Username</Label>).is('label.label'))
t.end()
})
test('Control Labels should render a Label inside a div with class "control-label"', (t) => {
t.ok(render(<ControlLabel>Username</ControlLabel>).hasClass('control-label'))
const contents = shallow(<ControlLabel>Username</ControlLabel>).childAt(0)
t.equal(
contents.html(),
shallow(<Label>Username</Label>).html()
)
t.end()
})
test('HTML Inputs should have class "input"', (t) => {
t.ok(render(<Input name='name' />).hasClass('input'))
t.end()
})
test('HTML Inputs support color modifiers', (t) => {
t.ok(render(<Input warning />).hasClass('is-warning'))
t.end()
})
test('Textareas should have class "textarea"', (t) => {
t.ok(render(<Textarea />).is('textarea.textarea'))
t.end()
})
test('Checkboxes should have type "checkbox" and class "checkbox"', (t) => {
t.ok(render(<Checkbox checked />).is('input[type="checkbox"].checkbox:checked'))
t.end()
})
test('Radio buttons should have type "radio" and class "radio"', (t) => {
t.ok(render(<Radio />).is('input[type="radio"].radio'))
t.end()
})
|
public/js/sliderTop/jquery-1.9.1.min.js | adrianicn/IguanaTrip |
/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/
(function (e, t) {
var n, r, i = typeof t, o = e.document, a = e.location, s = e.jQuery, u = e.$, l = {}, c = [], p = "1.9.1", f = c.concat, d = c.push, h = c.slice, g = c.indexOf, m = l.toString, y = l.hasOwnProperty, v = p.trim, b = function (e, t) { return new b.fn.init(e, t, r) }, x = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, w = /\S+/g, T = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, N = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, C = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, k = /^[\],:{}\s]*$/, E = /(?:^|:|,)(?:\s*\[)+/g, S = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, A = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, j = /^-ms-/, D = /-([\da-z])/gi, L = function (e, t) { return t.toUpperCase() }, H = function (e) { (o.addEventListener || "load" === e.type || "complete" === o.readyState) && (q(), b.ready()) }, q = function () { o.addEventListener ? (o.removeEventListener("DOMContentLoaded", H, !1), e.removeEventListener("load", H, !1)) : (o.detachEvent("onreadystatechange", H), e.detachEvent("onload", H)) }; b.fn = b.prototype = { jquery: p, constructor: b, init: function (e, n, r) { var i, a; if (!e) return this; if ("string" == typeof e) { if (i = "<" === e.charAt(0) && ">" === e.charAt(e.length - 1) && e.length >= 3 ? [null, e, null] : N.exec(e), !i || !i[1] && n) return !n || n.jquery ? (n || r).find(e) : this.constructor(n).find(e); if (i[1]) { if (n = n instanceof b ? n[0] : n, b.merge(this, b.parseHTML(i[1], n && n.nodeType ? n.ownerDocument || n : o, !0)), C.test(i[1]) && b.isPlainObject(n)) for (i in n) b.isFunction(this[i]) ? this[i](n[i]) : this.attr(i, n[i]); return this } if (a = o.getElementById(i[2]), a && a.parentNode) { if (a.id !== i[2]) return r.find(e); this.length = 1, this[0] = a } return this.context = o, this.selector = e, this } return e.nodeType ? (this.context = this[0] = e, this.length = 1, this) : b.isFunction(e) ? r.ready(e) : (e.selector !== t && (this.selector = e.selector, this.context = e.context), b.makeArray(e, this)) }, selector: "", length: 0, size: function () { return this.length }, toArray: function () { return h.call(this) }, get: function (e) { return null == e ? this.toArray() : 0 > e ? this[this.length + e] : this[e] }, pushStack: function (e) { var t = b.merge(this.constructor(), e); return t.prevObject = this, t.context = this.context, t }, each: function (e, t) { return b.each(this, e, t) }, ready: function (e) { return b.ready.promise().done(e), this }, slice: function () { return this.pushStack(h.apply(this, arguments)) }, first: function () { return this.eq(0) }, last: function () { return this.eq(-1) }, eq: function (e) { var t = this.length, n = +e + (0 > e ? t : 0); return this.pushStack(n >= 0 && t > n ? [this[n]] : []) }, map: function (e) { return this.pushStack(b.map(this, function (t, n) { return e.call(t, n, t) })) }, end: function () { return this.prevObject || this.constructor(null) }, push: d, sort: [].sort, splice: [].splice }, b.fn.init.prototype = b.fn, b.extend = b.fn.extend = function () { var e, n, r, i, o, a, s = arguments[0] || {}, u = 1, l = arguments.length, c = !1; for ("boolean" == typeof s && (c = s, s = arguments[1] || {}, u = 2), "object" == typeof s || b.isFunction(s) || (s = {}), l === u && (s = this, --u); l > u; u++) if (null != (o = arguments[u])) for (i in o) e = s[i], r = o[i], s !== r && (c && r && (b.isPlainObject(r) || (n = b.isArray(r))) ? (n ? (n = !1, a = e && b.isArray(e) ? e : []) : a = e && b.isPlainObject(e) ? e : {}, s[i] = b.extend(c, a, r)) : r !== t && (s[i] = r)); return s }, b.extend({ noConflict: function (t) { return e.$ === b && (e.$ = u), t && e.jQuery === b && (e.jQuery = s), b }, isReady: !1, readyWait: 1, holdReady: function (e) { e ? b.readyWait++ : b.ready(!0) }, ready: function (e) { if (e === !0 ? ! --b.readyWait : !b.isReady) { if (!o.body) return setTimeout(b.ready); b.isReady = !0, e !== !0 && --b.readyWait > 0 || (n.resolveWith(o, [b]), b.fn.trigger && b(o).trigger("ready").off("ready")) } }, isFunction: function (e) { return "function" === b.type(e) }, isArray: Array.isArray || function (e) { return "array" === b.type(e) }, isWindow: function (e) { return null != e && e == e.window }, isNumeric: function (e) { return !isNaN(parseFloat(e)) && isFinite(e) }, type: function (e) { return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? l[m.call(e)] || "object" : typeof e }, isPlainObject: function (e) { if (!e || "object" !== b.type(e) || e.nodeType || b.isWindow(e)) return !1; try { if (e.constructor && !y.call(e, "constructor") && !y.call(e.constructor.prototype, "isPrototypeOf")) return !1 } catch (n) { return !1 } var r; for (r in e); return r === t || y.call(e, r) }, isEmptyObject: function (e) { var t; for (t in e) return !1; return !0 }, error: function (e) { throw Error(e) }, parseHTML: function (e, t, n) { if (!e || "string" != typeof e) return null; "boolean" == typeof t && (n = t, t = !1), t = t || o; var r = C.exec(e), i = !n && []; return r ? [t.createElement(r[1])] : (r = b.buildFragment([e], t, i), i && b(i).remove(), b.merge([], r.childNodes)) }, parseJSON: function (n) { return e.JSON && e.JSON.parse ? e.JSON.parse(n) : null === n ? n : "string" == typeof n && (n = b.trim(n), n && k.test(n.replace(S, "@").replace(A, "]").replace(E, ""))) ? Function("return " + n)() : (b.error("Invalid JSON: " + n), t) }, parseXML: function (n) { var r, i; if (!n || "string" != typeof n) return null; try { e.DOMParser ? (i = new DOMParser, r = i.parseFromString(n, "text/xml")) : (r = new ActiveXObject("Microsoft.XMLDOM"), r.async = "false", r.loadXML(n)) } catch (o) { r = t } return r && r.documentElement && !r.getElementsByTagName("parsererror").length || b.error("Invalid XML: " + n), r }, noop: function () { }, globalEval: function (t) { t && b.trim(t) && (e.execScript || function (t) { e.eval.call(e, t) })(t) }, camelCase: function (e) { return e.replace(j, "ms-").replace(D, L) }, nodeName: function (e, t) { return e.nodeName && e.nodeName.toLowerCase() === t.toLowerCase() }, each: function (e, t, n) { var r, i = 0, o = e.length, a = M(e); if (n) { if (a) { for (; o > i; i++) if (r = t.apply(e[i], n), r === !1) break } else for (i in e) if (r = t.apply(e[i], n), r === !1) break } else if (a) { for (; o > i; i++) if (r = t.call(e[i], i, e[i]), r === !1) break } else for (i in e) if (r = t.call(e[i], i, e[i]), r === !1) break; return e }, trim: v && !v.call("\ufeff\u00a0") ? function (e) { return null == e ? "" : v.call(e) } : function (e) { return null == e ? "" : (e + "").replace(T, "") }, makeArray: function (e, t) { var n = t || []; return null != e && (M(Object(e)) ? b.merge(n, "string" == typeof e ? [e] : e) : d.call(n, e)), n }, inArray: function (e, t, n) { var r; if (t) { if (g) return g.call(t, e, n); for (r = t.length, n = n ? 0 > n ? Math.max(0, r + n) : n : 0; r > n; n++) if (n in t && t[n] === e) return n } return -1 }, merge: function (e, n) { var r = n.length, i = e.length, o = 0; if ("number" == typeof r) for (; r > o; o++) e[i++] = n[o]; else while (n[o] !== t) e[i++] = n[o++]; return e.length = i, e }, grep: function (e, t, n) { var r, i = [], o = 0, a = e.length; for (n = !!n; a > o; o++) r = !!t(e[o], o), n !== r && i.push(e[o]); return i }, map: function (e, t, n) { var r, i = 0, o = e.length, a = M(e), s = []; if (a) for (; o > i; i++) r = t(e[i], i, n), null != r && (s[s.length] = r); else for (i in e) r = t(e[i], i, n), null != r && (s[s.length] = r); return f.apply([], s) }, guid: 1, proxy: function (e, n) { var r, i, o; return "string" == typeof n && (o = e[n], n = e, e = o), b.isFunction(e) ? (r = h.call(arguments, 2), i = function () { return e.apply(n || this, r.concat(h.call(arguments))) }, i.guid = e.guid = e.guid || b.guid++, i) : t }, access: function (e, n, r, i, o, a, s) { var u = 0, l = e.length, c = null == r; if ("object" === b.type(r)) { o = !0; for (u in r) b.access(e, n, u, r[u], !0, a, s) } else if (i !== t && (o = !0, b.isFunction(i) || (s = !0), c && (s ? (n.call(e, i), n = null) : (c = n, n = function (e, t, n) { return c.call(b(e), n) })), n)) for (; l > u; u++) n(e[u], r, s ? i : i.call(e[u], u, n(e[u], r))); return o ? e : c ? n.call(e) : l ? n(e[0], r) : a }, now: function () { return (new Date).getTime() } }), b.ready.promise = function (t) { if (!n) if (n = b.Deferred(), "complete" === o.readyState) setTimeout(b.ready); else if (o.addEventListener) o.addEventListener("DOMContentLoaded", H, !1), e.addEventListener("load", H, !1); else { o.attachEvent("onreadystatechange", H), e.attachEvent("onload", H); var r = !1; try { r = null == e.frameElement && o.documentElement } catch (i) { } r && r.doScroll && function a() { if (!b.isReady) { try { r.doScroll("left") } catch (e) { return setTimeout(a, 50) } q(), b.ready() } } () } return n.promise(t) }, b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (e, t) { l["[object " + t + "]"] = t.toLowerCase() }); function M(e) { var t = e.length, n = b.type(e); return b.isWindow(e) ? !1 : 1 === e.nodeType && t ? !0 : "array" === n || "function" !== n && (0 === t || "number" == typeof t && t > 0 && t - 1 in e) } r = b(o); var _ = {}; function F(e) { var t = _[e] = {}; return b.each(e.match(w) || [], function (e, n) { t[n] = !0 }), t } b.Callbacks = function (e) { e = "string" == typeof e ? _[e] || F(e) : b.extend({}, e); var n, r, i, o, a, s, u = [], l = !e.once && [], c = function (t) { for (r = e.memory && t, i = !0, a = s || 0, s = 0, o = u.length, n = !0; u && o > a; a++) if (u[a].apply(t[0], t[1]) === !1 && e.stopOnFalse) { r = !1; break } n = !1, u && (l ? l.length && c(l.shift()) : r ? u = [] : p.disable()) }, p = { add: function () { if (u) { var t = u.length; (function i(t) { b.each(t, function (t, n) { var r = b.type(n); "function" === r ? e.unique && p.has(n) || u.push(n) : n && n.length && "string" !== r && i(n) }) })(arguments), n ? o = u.length : r && (s = t, c(r)) } return this }, remove: function () { return u && b.each(arguments, function (e, t) { var r; while ((r = b.inArray(t, u, r)) > -1) u.splice(r, 1), n && (o >= r && o--, a >= r && a--) }), this }, has: function (e) { return e ? b.inArray(e, u) > -1 : !(!u || !u.length) }, empty: function () { return u = [], this }, disable: function () { return u = l = r = t, this }, disabled: function () { return !u }, lock: function () { return l = t, r || p.disable(), this }, locked: function () { return !l }, fireWith: function (e, t) { return t = t || [], t = [e, t.slice ? t.slice() : t], !u || i && !l || (n ? l.push(t) : c(t)), this }, fire: function () { return p.fireWith(this, arguments), this }, fired: function () { return !!i } }; return p }, b.extend({ Deferred: function (e) { var t = [["resolve", "done", b.Callbacks("once memory"), "resolved"], ["reject", "fail", b.Callbacks("once memory"), "rejected"], ["notify", "progress", b.Callbacks("memory")]], n = "pending", r = { state: function () { return n }, always: function () { return i.done(arguments).fail(arguments), this }, then: function () { var e = arguments; return b.Deferred(function (n) { b.each(t, function (t, o) { var a = o[0], s = b.isFunction(e[t]) && e[t]; i[o[1]](function () { var e = s && s.apply(this, arguments); e && b.isFunction(e.promise) ? e.promise().done(n.resolve).fail(n.reject).progress(n.notify) : n[a + "With"](this === r ? n.promise() : this, s ? [e] : arguments) }) }), e = null }).promise() }, promise: function (e) { return null != e ? b.extend(e, r) : r } }, i = {}; return r.pipe = r.then, b.each(t, function (e, o) { var a = o[2], s = o[3]; r[o[1]] = a.add, s && a.add(function () { n = s }, t[1 ^ e][2].disable, t[2][2].lock), i[o[0]] = function () { return i[o[0] + "With"](this === i ? r : this, arguments), this }, i[o[0] + "With"] = a.fireWith }), r.promise(i), e && e.call(i, i), i }, when: function (e) { var t = 0, n = h.call(arguments), r = n.length, i = 1 !== r || e && b.isFunction(e.promise) ? r : 0, o = 1 === i ? e : b.Deferred(), a = function (e, t, n) { return function (r) { t[e] = this, n[e] = arguments.length > 1 ? h.call(arguments) : r, n === s ? o.notifyWith(t, n) : --i || o.resolveWith(t, n) } }, s, u, l; if (r > 1) for (s = Array(r), u = Array(r), l = Array(r); r > t; t++) n[t] && b.isFunction(n[t].promise) ? n[t].promise().done(a(t, l, n)).fail(o.reject).progress(a(t, u, s)) : --i; return i || o.resolveWith(l, n), o.promise() } }), b.support = function () { var t, n, r, a, s, u, l, c, p, f, d = o.createElement("div"); if (d.setAttribute("className", "t"), d.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>", n = d.getElementsByTagName("*"), r = d.getElementsByTagName("a")[0], !n || !r || !n.length) return {}; s = o.createElement("select"), l = s.appendChild(o.createElement("option")), a = d.getElementsByTagName("input")[0], r.style.cssText = "top:1px;float:left;opacity:.5", t = { getSetAttribute: "t" !== d.className, leadingWhitespace: 3 === d.firstChild.nodeType, tbody: !d.getElementsByTagName("tbody").length, htmlSerialize: !!d.getElementsByTagName("link").length, style: /top/.test(r.getAttribute("style")), hrefNormalized: "/a" === r.getAttribute("href"), opacity: /^0.5/.test(r.style.opacity), cssFloat: !!r.style.cssFloat, checkOn: !!a.value, optSelected: l.selected, enctype: !!o.createElement("form").enctype, html5Clone: "<:nav></:nav>" !== o.createElement("nav").cloneNode(!0).outerHTML, boxModel: "CSS1Compat" === o.compatMode, deleteExpando: !0, noCloneEvent: !0, inlineBlockNeedsLayout: !1, shrinkWrapBlocks: !1, reliableMarginRight: !0, boxSizingReliable: !0, pixelPosition: !1 }, a.checked = !0, t.noCloneChecked = a.cloneNode(!0).checked, s.disabled = !0, t.optDisabled = !l.disabled; try { delete d.test } catch (h) { t.deleteExpando = !1 } a = o.createElement("input"), a.setAttribute("value", ""), t.input = "" === a.getAttribute("value"), a.value = "t", a.setAttribute("type", "radio"), t.radioValue = "t" === a.value, a.setAttribute("checked", "t"), a.setAttribute("name", "t"), u = o.createDocumentFragment(), u.appendChild(a), t.appendChecked = a.checked, t.checkClone = u.cloneNode(!0).cloneNode(!0).lastChild.checked, d.attachEvent && (d.attachEvent("onclick", function () { t.noCloneEvent = !1 }), d.cloneNode(!0).click()); for (f in { submit: !0, change: !0, focusin: !0 }) d.setAttribute(c = "on" + f, "t"), t[f + "Bubbles"] = c in e || d.attributes[c].expando === !1; return d.style.backgroundClip = "content-box", d.cloneNode(!0).style.backgroundClip = "", t.clearCloneStyle = "content-box" === d.style.backgroundClip, b(function () { var n, r, a, s = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", u = o.getElementsByTagName("body")[0]; u && (n = o.createElement("div"), n.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px", u.appendChild(n).appendChild(d), d.innerHTML = "<table><tr><td></td><td>t</td></tr></table>", a = d.getElementsByTagName("td"), a[0].style.cssText = "padding:0;margin:0;border:0;display:none", p = 0 === a[0].offsetHeight, a[0].style.display = "", a[1].style.display = "none", t.reliableHiddenOffsets = p && 0 === a[0].offsetHeight, d.innerHTML = "", d.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;", t.boxSizing = 4 === d.offsetWidth, t.doesNotIncludeMarginInBodyOffset = 1 !== u.offsetTop, e.getComputedStyle && (t.pixelPosition = "1%" !== (e.getComputedStyle(d, null) || {}).top, t.boxSizingReliable = "4px" === (e.getComputedStyle(d, null) || { width: "4px" }).width, r = d.appendChild(o.createElement("div")), r.style.cssText = d.style.cssText = s, r.style.marginRight = r.style.width = "0", d.style.width = "1px", t.reliableMarginRight = !parseFloat((e.getComputedStyle(r, null) || {}).marginRight)), typeof d.style.zoom !== i && (d.innerHTML = "", d.style.cssText = s + "width:1px;padding:1px;display:inline;zoom:1", t.inlineBlockNeedsLayout = 3 === d.offsetWidth, d.style.display = "block", d.innerHTML = "<div></div>", d.firstChild.style.width = "5px", t.shrinkWrapBlocks = 3 !== d.offsetWidth, t.inlineBlockNeedsLayout && (u.style.zoom = 1)), u.removeChild(n), n = d = a = r = null) }), n = s = u = l = r = a = null, t } (); var O = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, B = /([A-Z])/g; function P(e, n, r, i) { if (b.acceptData(e)) { var o, a, s = b.expando, u = "string" == typeof n, l = e.nodeType, p = l ? b.cache : e, f = l ? e[s] : e[s] && s; if (f && p[f] && (i || p[f].data) || !u || r !== t) return f || (l ? e[s] = f = c.pop() || b.guid++ : f = s), p[f] || (p[f] = {}, l || (p[f].toJSON = b.noop)), ("object" == typeof n || "function" == typeof n) && (i ? p[f] = b.extend(p[f], n) : p[f].data = b.extend(p[f].data, n)), o = p[f], i || (o.data || (o.data = {}), o = o.data), r !== t && (o[b.camelCase(n)] = r), u ? (a = o[n], null == a && (a = o[b.camelCase(n)])) : a = o, a } } function R(e, t, n) { if (b.acceptData(e)) { var r, i, o, a = e.nodeType, s = a ? b.cache : e, u = a ? e[b.expando] : b.expando; if (s[u]) { if (t && (o = n ? s[u] : s[u].data)) { b.isArray(t) ? t = t.concat(b.map(t, b.camelCase)) : t in o ? t = [t] : (t = b.camelCase(t), t = t in o ? [t] : t.split(" ")); for (r = 0, i = t.length; i > r; r++) delete o[t[r]]; if (!(n ? $ : b.isEmptyObject)(o)) return } (n || (delete s[u].data, $(s[u]))) && (a ? b.cleanData([e], !0) : b.support.deleteExpando || s != s.window ? delete s[u] : s[u] = null) } } } b.extend({ cache: {}, expando: "jQuery" + (p + Math.random()).replace(/\D/g, ""), noData: { embed: !0, object: "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", applet: !0 }, hasData: function (e) { return e = e.nodeType ? b.cache[e[b.expando]] : e[b.expando], !!e && !$(e) }, data: function (e, t, n) { return P(e, t, n) }, removeData: function (e, t) { return R(e, t) }, _data: function (e, t, n) { return P(e, t, n, !0) }, _removeData: function (e, t) { return R(e, t, !0) }, acceptData: function (e) { if (e.nodeType && 1 !== e.nodeType && 9 !== e.nodeType) return !1; var t = e.nodeName && b.noData[e.nodeName.toLowerCase()]; return !t || t !== !0 && e.getAttribute("classid") === t } }), b.fn.extend({ data: function (e, n) { var r, i, o = this[0], a = 0, s = null; if (e === t) { if (this.length && (s = b.data(o), 1 === o.nodeType && !b._data(o, "parsedAttrs"))) { for (r = o.attributes; r.length > a; a++) i = r[a].name, i.indexOf("data-") || (i = b.camelCase(i.slice(5)), W(o, i, s[i])); b._data(o, "parsedAttrs", !0) } return s } return "object" == typeof e ? this.each(function () { b.data(this, e) }) : b.access(this, function (n) { return n === t ? o ? W(o, e, b.data(o, e)) : null : (this.each(function () { b.data(this, e, n) }), t) }, null, n, arguments.length > 1, null, !0) }, removeData: function (e) { return this.each(function () { b.removeData(this, e) }) } }); function W(e, n, r) { if (r === t && 1 === e.nodeType) { var i = "data-" + n.replace(B, "-$1").toLowerCase(); if (r = e.getAttribute(i), "string" == typeof r) { try { r = "true" === r ? !0 : "false" === r ? !1 : "null" === r ? null : +r + "" === r ? +r : O.test(r) ? b.parseJSON(r) : r } catch (o) { } b.data(e, n, r) } else r = t } return r } function $(e) { var t; for (t in e) if (("data" !== t || !b.isEmptyObject(e[t])) && "toJSON" !== t) return !1; return !0 } b.extend({ queue: function (e, n, r) { var i; return e ? (n = (n || "fx") + "queue", i = b._data(e, n), r && (!i || b.isArray(r) ? i = b._data(e, n, b.makeArray(r)) : i.push(r)), i || []) : t }, dequeue: function (e, t) { t = t || "fx"; var n = b.queue(e, t), r = n.length, i = n.shift(), o = b._queueHooks(e, t), a = function () { b.dequeue(e, t) }; "inprogress" === i && (i = n.shift(), r--), o.cur = i, i && ("fx" === t && n.unshift("inprogress"), delete o.stop, i.call(e, a, o)), !r && o && o.empty.fire() }, _queueHooks: function (e, t) { var n = t + "queueHooks"; return b._data(e, n) || b._data(e, n, { empty: b.Callbacks("once memory").add(function () { b._removeData(e, t + "queue"), b._removeData(e, n) }) }) } }), b.fn.extend({ queue: function (e, n) { var r = 2; return "string" != typeof e && (n = e, e = "fx", r--), r > arguments.length ? b.queue(this[0], e) : n === t ? this : this.each(function () { var t = b.queue(this, e, n); b._queueHooks(this, e), "fx" === e && "inprogress" !== t[0] && b.dequeue(this, e) }) }, dequeue: function (e) { return this.each(function () { b.dequeue(this, e) }) }, delay: function (e, t) { return e = b.fx ? b.fx.speeds[e] || e : e, t = t || "fx", this.queue(t, function (t, n) { var r = setTimeout(t, e); n.stop = function () { clearTimeout(r) } }) }, clearQueue: function (e) { return this.queue(e || "fx", []) }, promise: function (e, n) { var r, i = 1, o = b.Deferred(), a = this, s = this.length, u = function () { --i || o.resolveWith(a, [a]) }; "string" != typeof e && (n = e, e = t), e = e || "fx"; while (s--) r = b._data(a[s], e + "queueHooks"), r && r.empty && (i++, r.empty.add(u)); return u(), o.promise(n) } }); var I, z, X = /[\t\r\n]/g, U = /\r/g, V = /^(?:input|select|textarea|button|object)$/i, Y = /^(?:a|area)$/i, J = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, G = /^(?:checked|selected)$/i, Q = b.support.getSetAttribute, K = b.support.input; b.fn.extend({ attr: function (e, t) { return b.access(this, b.attr, e, t, arguments.length > 1) }, removeAttr: function (e) { return this.each(function () { b.removeAttr(this, e) }) }, prop: function (e, t) { return b.access(this, b.prop, e, t, arguments.length > 1) }, removeProp: function (e) { return e = b.propFix[e] || e, this.each(function () { try { this[e] = t, delete this[e] } catch (n) { } }) }, addClass: function (e) { var t, n, r, i, o, a = 0, s = this.length, u = "string" == typeof e && e; if (b.isFunction(e)) return this.each(function (t) { b(this).addClass(e.call(this, t, this.className)) }); if (u) for (t = (e || "").match(w) || []; s > a; a++) if (n = this[a], r = 1 === n.nodeType && (n.className ? (" " + n.className + " ").replace(X, " ") : " ")) { o = 0; while (i = t[o++]) 0 > r.indexOf(" " + i + " ") && (r += i + " "); n.className = b.trim(r) } return this }, removeClass: function (e) { var t, n, r, i, o, a = 0, s = this.length, u = 0 === arguments.length || "string" == typeof e && e; if (b.isFunction(e)) return this.each(function (t) { b(this).removeClass(e.call(this, t, this.className)) }); if (u) for (t = (e || "").match(w) || []; s > a; a++) if (n = this[a], r = 1 === n.nodeType && (n.className ? (" " + n.className + " ").replace(X, " ") : "")) { o = 0; while (i = t[o++]) while (r.indexOf(" " + i + " ") >= 0) r = r.replace(" " + i + " ", " "); n.className = e ? b.trim(r) : "" } return this }, toggleClass: function (e, t) { var n = typeof e, r = "boolean" == typeof t; return b.isFunction(e) ? this.each(function (n) { b(this).toggleClass(e.call(this, n, this.className, t), t) }) : this.each(function () { if ("string" === n) { var o, a = 0, s = b(this), u = t, l = e.match(w) || []; while (o = l[a++]) u = r ? u : !s.hasClass(o), s[u ? "addClass" : "removeClass"](o) } else (n === i || "boolean" === n) && (this.className && b._data(this, "__className__", this.className), this.className = this.className || e === !1 ? "" : b._data(this, "__className__") || "") }) }, hasClass: function (e) { var t = " " + e + " ", n = 0, r = this.length; for (; r > n; n++) if (1 === this[n].nodeType && (" " + this[n].className + " ").replace(X, " ").indexOf(t) >= 0) return !0; return !1 }, val: function (e) { var n, r, i, o = this[0]; { if (arguments.length) return i = b.isFunction(e), this.each(function (n) { var o, a = b(this); 1 === this.nodeType && (o = i ? e.call(this, n, a.val()) : e, null == o ? o = "" : "number" == typeof o ? o += "" : b.isArray(o) && (o = b.map(o, function (e) { return null == e ? "" : e + "" })), r = b.valHooks[this.type] || b.valHooks[this.nodeName.toLowerCase()], r && "set" in r && r.set(this, o, "value") !== t || (this.value = o)) }); if (o) return r = b.valHooks[o.type] || b.valHooks[o.nodeName.toLowerCase()], r && "get" in r && (n = r.get(o, "value")) !== t ? n : (n = o.value, "string" == typeof n ? n.replace(U, "") : null == n ? "" : n) } } }), b.extend({ valHooks: { option: { get: function (e) { var t = e.attributes.value; return !t || t.specified ? e.value : e.text } }, select: { get: function (e) { var t, n, r = e.options, i = e.selectedIndex, o = "select-one" === e.type || 0 > i, a = o ? null : [], s = o ? i + 1 : r.length, u = 0 > i ? s : o ? i : 0; for (; s > u; u++) if (n = r[u], !(!n.selected && u !== i || (b.support.optDisabled ? n.disabled : null !== n.getAttribute("disabled")) || n.parentNode.disabled && b.nodeName(n.parentNode, "optgroup"))) { if (t = b(n).val(), o) return t; a.push(t) } return a }, set: function (e, t) { var n = b.makeArray(t); return b(e).find("option").each(function () { this.selected = b.inArray(b(this).val(), n) >= 0 }), n.length || (e.selectedIndex = -1), n } } }, attr: function (e, n, r) { var o, a, s, u = e.nodeType; if (e && 3 !== u && 8 !== u && 2 !== u) return typeof e.getAttribute === i ? b.prop(e, n, r) : (a = 1 !== u || !b.isXMLDoc(e), a && (n = n.toLowerCase(), o = b.attrHooks[n] || (J.test(n) ? z : I)), r === t ? o && a && "get" in o && null !== (s = o.get(e, n)) ? s : (typeof e.getAttribute !== i && (s = e.getAttribute(n)), null == s ? t : s) : null !== r ? o && a && "set" in o && (s = o.set(e, r, n)) !== t ? s : (e.setAttribute(n, r + ""), r) : (b.removeAttr(e, n), t)) }, removeAttr: function (e, t) { var n, r, i = 0, o = t && t.match(w); if (o && 1 === e.nodeType) while (n = o[i++]) r = b.propFix[n] || n, J.test(n) ? !Q && G.test(n) ? e[b.camelCase("default-" + n)] = e[r] = !1 : e[r] = !1 : b.attr(e, n, ""), e.removeAttribute(Q ? n : r) }, attrHooks: { type: { set: function (e, t) { if (!b.support.radioValue && "radio" === t && b.nodeName(e, "input")) { var n = e.value; return e.setAttribute("type", t), n && (e.value = n), t } } } }, propFix: { tabindex: "tabIndex", readonly: "readOnly", "for": "htmlFor", "class": "className", maxlength: "maxLength", cellspacing: "cellSpacing", cellpadding: "cellPadding", rowspan: "rowSpan", colspan: "colSpan", usemap: "useMap", frameborder: "frameBorder", contenteditable: "contentEditable" }, prop: function (e, n, r) { var i, o, a, s = e.nodeType; if (e && 3 !== s && 8 !== s && 2 !== s) return a = 1 !== s || !b.isXMLDoc(e), a && (n = b.propFix[n] || n, o = b.propHooks[n]), r !== t ? o && "set" in o && (i = o.set(e, r, n)) !== t ? i : e[n] = r : o && "get" in o && null !== (i = o.get(e, n)) ? i : e[n] }, propHooks: { tabIndex: { get: function (e) { var n = e.getAttributeNode("tabindex"); return n && n.specified ? parseInt(n.value, 10) : V.test(e.nodeName) || Y.test(e.nodeName) && e.href ? 0 : t } }} }), z = { get: function (e, n) { var r = b.prop(e, n), i = "boolean" == typeof r && e.getAttribute(n), o = "boolean" == typeof r ? K && Q ? null != i : G.test(n) ? e[b.camelCase("default-" + n)] : !!i : e.getAttributeNode(n); return o && o.value !== !1 ? n.toLowerCase() : t }, set: function (e, t, n) { return t === !1 ? b.removeAttr(e, n) : K && Q || !G.test(n) ? e.setAttribute(!Q && b.propFix[n] || n, n) : e[b.camelCase("default-" + n)] = e[n] = !0, n } }, K && Q || (b.attrHooks.value = { get: function (e, n) { var r = e.getAttributeNode(n); return b.nodeName(e, "input") ? e.defaultValue : r && r.specified ? r.value : t }, set: function (e, n, r) { return b.nodeName(e, "input") ? (e.defaultValue = n, t) : I && I.set(e, n, r) } }), Q || (I = b.valHooks.button = { get: function (e, n) { var r = e.getAttributeNode(n); return r && ("id" === n || "name" === n || "coords" === n ? "" !== r.value : r.specified) ? r.value : t }, set: function (e, n, r) { var i = e.getAttributeNode(r); return i || e.setAttributeNode(i = e.ownerDocument.createAttribute(r)), i.value = n += "", "value" === r || n === e.getAttribute(r) ? n : t } }, b.attrHooks.contenteditable = { get: I.get, set: function (e, t, n) { I.set(e, "" === t ? !1 : t, n) } }, b.each(["width", "height"], function (e, n) { b.attrHooks[n] = b.extend(b.attrHooks[n], { set: function (e, r) { return "" === r ? (e.setAttribute(n, "auto"), r) : t } }) })), b.support.hrefNormalized || (b.each(["href", "src", "width", "height"], function (e, n) { b.attrHooks[n] = b.extend(b.attrHooks[n], { get: function (e) { var r = e.getAttribute(n, 2); return null == r ? t : r } }) }), b.each(["href", "src"], function (e, t) { b.propHooks[t] = { get: function (e) { return e.getAttribute(t, 4) } } })), b.support.style || (b.attrHooks.style = { get: function (e) { return e.style.cssText || t }, set: function (e, t) { return e.style.cssText = t + "" } }), b.support.optSelected || (b.propHooks.selected = b.extend(b.propHooks.selected, { get: function (e) { var t = e.parentNode; return t && (t.selectedIndex, t.parentNode && t.parentNode.selectedIndex), null } })), b.support.enctype || (b.propFix.enctype = "encoding"), b.support.checkOn || b.each(["radio", "checkbox"], function () { b.valHooks[this] = { get: function (e) { return null === e.getAttribute("value") ? "on" : e.value } } }), b.each(["radio", "checkbox"], function () { b.valHooks[this] = b.extend(b.valHooks[this], { set: function (e, n) { return b.isArray(n) ? e.checked = b.inArray(b(e).val(), n) >= 0 : t } }) }); var Z = /^(?:input|select|textarea)$/i, et = /^key/, tt = /^(?:mouse|contextmenu)|click/, nt = /^(?:focusinfocus|focusoutblur)$/, rt = /^([^.]*)(?:\.(.+)|)$/; function it() { return !0 } function ot() { return !1 } b.event = { global: {}, add: function (e, n, r, o, a) { var s, u, l, c, p, f, d, h, g, m, y, v = b._data(e); if (v) { r.handler && (c = r, r = c.handler, a = c.selector), r.guid || (r.guid = b.guid++), (u = v.events) || (u = v.events = {}), (f = v.handle) || (f = v.handle = function (e) { return typeof b === i || e && b.event.triggered === e.type ? t : b.event.dispatch.apply(f.elem, arguments) }, f.elem = e), n = (n || "").match(w) || [""], l = n.length; while (l--) s = rt.exec(n[l]) || [], g = y = s[1], m = (s[2] || "").split(".").sort(), p = b.event.special[g] || {}, g = (a ? p.delegateType : p.bindType) || g, p = b.event.special[g] || {}, d = b.extend({ type: g, origType: y, data: o, handler: r, guid: r.guid, selector: a, needsContext: a && b.expr.match.needsContext.test(a), namespace: m.join(".") }, c), (h = u[g]) || (h = u[g] = [], h.delegateCount = 0, p.setup && p.setup.call(e, o, m, f) !== !1 || (e.addEventListener ? e.addEventListener(g, f, !1) : e.attachEvent && e.attachEvent("on" + g, f))), p.add && (p.add.call(e, d), d.handler.guid || (d.handler.guid = r.guid)), a ? h.splice(h.delegateCount++, 0, d) : h.push(d), b.event.global[g] = !0; e = null } }, remove: function (e, t, n, r, i) { var o, a, s, u, l, c, p, f, d, h, g, m = b.hasData(e) && b._data(e); if (m && (c = m.events)) { t = (t || "").match(w) || [""], l = t.length; while (l--) if (s = rt.exec(t[l]) || [], d = g = s[1], h = (s[2] || "").split(".").sort(), d) { p = b.event.special[d] || {}, d = (r ? p.delegateType : p.bindType) || d, f = c[d] || [], s = s[2] && RegExp("(^|\\.)" + h.join("\\.(?:.*\\.|)") + "(\\.|$)"), u = o = f.length; while (o--) a = f[o], !i && g !== a.origType || n && n.guid !== a.guid || s && !s.test(a.namespace) || r && r !== a.selector && ("**" !== r || !a.selector) || (f.splice(o, 1), a.selector && f.delegateCount--, p.remove && p.remove.call(e, a)); u && !f.length && (p.teardown && p.teardown.call(e, h, m.handle) !== !1 || b.removeEvent(e, d, m.handle), delete c[d]) } else for (d in c) b.event.remove(e, d + t[l], n, r, !0); b.isEmptyObject(c) && (delete m.handle, b._removeData(e, "events")) } }, trigger: function (n, r, i, a) { var s, u, l, c, p, f, d, h = [i || o], g = y.call(n, "type") ? n.type : n, m = y.call(n, "namespace") ? n.namespace.split(".") : []; if (l = f = i = i || o, 3 !== i.nodeType && 8 !== i.nodeType && !nt.test(g + b.event.triggered) && (g.indexOf(".") >= 0 && (m = g.split("."), g = m.shift(), m.sort()), u = 0 > g.indexOf(":") && "on" + g, n = n[b.expando] ? n : new b.Event(g, "object" == typeof n && n), n.isTrigger = !0, n.namespace = m.join("."), n.namespace_re = n.namespace ? RegExp("(^|\\.)" + m.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, n.result = t, n.target || (n.target = i), r = null == r ? [n] : b.makeArray(r, [n]), p = b.event.special[g] || {}, a || !p.trigger || p.trigger.apply(i, r) !== !1)) { if (!a && !p.noBubble && !b.isWindow(i)) { for (c = p.delegateType || g, nt.test(c + g) || (l = l.parentNode); l; l = l.parentNode) h.push(l), f = l; f === (i.ownerDocument || o) && h.push(f.defaultView || f.parentWindow || e) } d = 0; while ((l = h[d++]) && !n.isPropagationStopped()) n.type = d > 1 ? c : p.bindType || g, s = (b._data(l, "events") || {})[n.type] && b._data(l, "handle"), s && s.apply(l, r), s = u && l[u], s && b.acceptData(l) && s.apply && s.apply(l, r) === !1 && n.preventDefault(); if (n.type = g, !(a || n.isDefaultPrevented() || p._default && p._default.apply(i.ownerDocument, r) !== !1 || "click" === g && b.nodeName(i, "a") || !b.acceptData(i) || !u || !i[g] || b.isWindow(i))) { f = i[u], f && (i[u] = null), b.event.triggered = g; try { i[g]() } catch (v) { } b.event.triggered = t, f && (i[u] = f) } return n.result } }, dispatch: function (e) { e = b.event.fix(e); var n, r, i, o, a, s = [], u = h.call(arguments), l = (b._data(this, "events") || {})[e.type] || [], c = b.event.special[e.type] || {}; if (u[0] = e, e.delegateTarget = this, !c.preDispatch || c.preDispatch.call(this, e) !== !1) { s = b.event.handlers.call(this, e, l), n = 0; while ((o = s[n++]) && !e.isPropagationStopped()) { e.currentTarget = o.elem, a = 0; while ((i = o.handlers[a++]) && !e.isImmediatePropagationStopped()) (!e.namespace_re || e.namespace_re.test(i.namespace)) && (e.handleObj = i, e.data = i.data, r = ((b.event.special[i.origType] || {}).handle || i.handler).apply(o.elem, u), r !== t && (e.result = r) === !1 && (e.preventDefault(), e.stopPropagation())) } return c.postDispatch && c.postDispatch.call(this, e), e.result } }, handlers: function (e, n) { var r, i, o, a, s = [], u = n.delegateCount, l = e.target; if (u && l.nodeType && (!e.button || "click" !== e.type)) for (; l != this; l = l.parentNode || this) if (1 === l.nodeType && (l.disabled !== !0 || "click" !== e.type)) { for (o = [], a = 0; u > a; a++) i = n[a], r = i.selector + " ", o[r] === t && (o[r] = i.needsContext ? b(r, this).index(l) >= 0 : b.find(r, this, null, [l]).length), o[r] && o.push(i); o.length && s.push({ elem: l, handlers: o }) } return n.length > u && s.push({ elem: this, handlers: n.slice(u) }), s }, fix: function (e) { if (e[b.expando]) return e; var t, n, r, i = e.type, a = e, s = this.fixHooks[i]; s || (this.fixHooks[i] = s = tt.test(i) ? this.mouseHooks : et.test(i) ? this.keyHooks : {}), r = s.props ? this.props.concat(s.props) : this.props, e = new b.Event(a), t = r.length; while (t--) n = r[t], e[n] = a[n]; return e.target || (e.target = a.srcElement || o), 3 === e.target.nodeType && (e.target = e.target.parentNode), e.metaKey = !!e.metaKey, s.filter ? s.filter(e, a) : e }, props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), fixHooks: {}, keyHooks: { props: "char charCode key keyCode".split(" "), filter: function (e, t) { return null == e.which && (e.which = null != t.charCode ? t.charCode : t.keyCode), e } }, mouseHooks: { props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), filter: function (e, n) { var r, i, a, s = n.button, u = n.fromElement; return null == e.pageX && null != n.clientX && (i = e.target.ownerDocument || o, a = i.documentElement, r = i.body, e.pageX = n.clientX + (a && a.scrollLeft || r && r.scrollLeft || 0) - (a && a.clientLeft || r && r.clientLeft || 0), e.pageY = n.clientY + (a && a.scrollTop || r && r.scrollTop || 0) - (a && a.clientTop || r && r.clientTop || 0)), !e.relatedTarget && u && (e.relatedTarget = u === e.target ? n.toElement : u), e.which || s === t || (e.which = 1 & s ? 1 : 2 & s ? 3 : 4 & s ? 2 : 0), e } }, special: { load: { noBubble: !0 }, click: { trigger: function () { return b.nodeName(this, "input") && "checkbox" === this.type && this.click ? (this.click(), !1) : t } }, focus: { trigger: function () { if (this !== o.activeElement && this.focus) try { return this.focus(), !1 } catch (e) { } }, delegateType: "focusin" }, blur: { trigger: function () { return this === o.activeElement && this.blur ? (this.blur(), !1) : t }, delegateType: "focusout" }, beforeunload: { postDispatch: function (e) { e.result !== t && (e.originalEvent.returnValue = e.result) } } }, simulate: function (e, t, n, r) { var i = b.extend(new b.Event, n, { type: e, isSimulated: !0, originalEvent: {} }); r ? b.event.trigger(i, null, t) : b.event.dispatch.call(t, i), i.isDefaultPrevented() && n.preventDefault() } }, b.removeEvent = o.removeEventListener ? function (e, t, n) { e.removeEventListener && e.removeEventListener(t, n, !1) } : function (e, t, n) { var r = "on" + t; e.detachEvent && (typeof e[r] === i && (e[r] = null), e.detachEvent(r, n)) }, b.Event = function (e, n) { return this instanceof b.Event ? (e && e.type ? (this.originalEvent = e, this.type = e.type, this.isDefaultPrevented = e.defaultPrevented || e.returnValue === !1 || e.getPreventDefault && e.getPreventDefault() ? it : ot) : this.type = e, n && b.extend(this, n), this.timeStamp = e && e.timeStamp || b.now(), this[b.expando] = !0, t) : new b.Event(e, n) }, b.Event.prototype = { isDefaultPrevented: ot, isPropagationStopped: ot, isImmediatePropagationStopped: ot, preventDefault: function () { var e = this.originalEvent; this.isDefaultPrevented = it, e && (e.preventDefault ? e.preventDefault() : e.returnValue = !1) }, stopPropagation: function () { var e = this.originalEvent; this.isPropagationStopped = it, e && (e.stopPropagation && e.stopPropagation(), e.cancelBubble = !0) }, stopImmediatePropagation: function () { this.isImmediatePropagationStopped = it, this.stopPropagation() } }, b.each({ mouseenter: "mouseover", mouseleave: "mouseout" }, function (e, t) {
b.event.special[e] = { delegateType: t, bindType: t, handle: function (e) {
var n, r = this, i = e.relatedTarget, o = e.handleObj;
return (!i || i !== r && !b.contains(r, i)) && (e.type = o.origType, n = o.handler.apply(this, arguments), e.type = t), n
}
}
}), b.support.submitBubbles || (b.event.special.submit = { setup: function () { return b.nodeName(this, "form") ? !1 : (b.event.add(this, "click._submit keypress._submit", function (e) { var n = e.target, r = b.nodeName(n, "input") || b.nodeName(n, "button") ? n.form : t; r && !b._data(r, "submitBubbles") && (b.event.add(r, "submit._submit", function (e) { e._submit_bubble = !0 }), b._data(r, "submitBubbles", !0)) }), t) }, postDispatch: function (e) { e._submit_bubble && (delete e._submit_bubble, this.parentNode && !e.isTrigger && b.event.simulate("submit", this.parentNode, e, !0)) }, teardown: function () { return b.nodeName(this, "form") ? !1 : (b.event.remove(this, "._submit"), t) } }), b.support.changeBubbles || (b.event.special.change = { setup: function () { return Z.test(this.nodeName) ? (("checkbox" === this.type || "radio" === this.type) && (b.event.add(this, "propertychange._change", function (e) { "checked" === e.originalEvent.propertyName && (this._just_changed = !0) }), b.event.add(this, "click._change", function (e) { this._just_changed && !e.isTrigger && (this._just_changed = !1), b.event.simulate("change", this, e, !0) })), !1) : (b.event.add(this, "beforeactivate._change", function (e) { var t = e.target; Z.test(t.nodeName) && !b._data(t, "changeBubbles") && (b.event.add(t, "change._change", function (e) { !this.parentNode || e.isSimulated || e.isTrigger || b.event.simulate("change", this.parentNode, e, !0) }), b._data(t, "changeBubbles", !0)) }), t) }, handle: function (e) { var n = e.target; return this !== n || e.isSimulated || e.isTrigger || "radio" !== n.type && "checkbox" !== n.type ? e.handleObj.handler.apply(this, arguments) : t }, teardown: function () { return b.event.remove(this, "._change"), !Z.test(this.nodeName) } }), b.support.focusinBubbles || b.each({ focus: "focusin", blur: "focusout" }, function (e, t) { var n = 0, r = function (e) { b.event.simulate(t, e.target, b.event.fix(e), !0) }; b.event.special[t] = { setup: function () { 0 === n++ && o.addEventListener(e, r, !0) }, teardown: function () { 0 === --n && o.removeEventListener(e, r, !0) } } }), b.fn.extend({ on: function (e, n, r, i, o) { var a, s; if ("object" == typeof e) { "string" != typeof n && (r = r || n, n = t); for (a in e) this.on(a, n, r, e[a], o); return this } if (null == r && null == i ? (i = n, r = n = t) : null == i && ("string" == typeof n ? (i = r, r = t) : (i = r, r = n, n = t)), i === !1) i = ot; else if (!i) return this; return 1 === o && (s = i, i = function (e) { return b().off(e), s.apply(this, arguments) }, i.guid = s.guid || (s.guid = b.guid++)), this.each(function () { b.event.add(this, e, i, r, n) }) }, one: function (e, t, n, r) { return this.on(e, t, n, r, 1) }, off: function (e, n, r) { var i, o; if (e && e.preventDefault && e.handleObj) return i = e.handleObj, b(e.delegateTarget).off(i.namespace ? i.origType + "." + i.namespace : i.origType, i.selector, i.handler), this; if ("object" == typeof e) { for (o in e) this.off(o, n, e[o]); return this } return (n === !1 || "function" == typeof n) && (r = n, n = t), r === !1 && (r = ot), this.each(function () { b.event.remove(this, e, r, n) }) }, bind: function (e, t, n) { return this.on(e, null, t, n) }, unbind: function (e, t) { return this.off(e, null, t) }, delegate: function (e, t, n, r) { return this.on(t, e, n, r) }, undelegate: function (e, t, n) { return 1 === arguments.length ? this.off(e, "**") : this.off(t, e || "**", n) }, trigger: function (e, t) { return this.each(function () { b.event.trigger(e, t, this) }) }, triggerHandler: function (e, n) { var r = this[0]; return r ? b.event.trigger(e, n, r, !0) : t } }), function (e, t) { var n, r, i, o, a, s, u, l, c, p, f, d, h, g, m, y, v, x = "sizzle" + -new Date, w = e.document, T = {}, N = 0, C = 0, k = it(), E = it(), S = it(), A = typeof t, j = 1 << 31, D = [], L = D.pop, H = D.push, q = D.slice, M = D.indexOf || function (e) { var t = 0, n = this.length; for (; n > t; t++) if (this[t] === e) return t; return -1 }, _ = "[\\x20\\t\\r\\n\\f]", F = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", O = F.replace("w", "w#"), B = "([*^$|!~]?=)", P = "\\[" + _ + "*(" + F + ")" + _ + "*(?:" + B + _ + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + O + ")|)|)" + _ + "*\\]", R = ":(" + F + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + P.replace(3, 8) + ")*)|.*)\\)|)", W = RegExp("^" + _ + "+|((?:^|[^\\\\])(?:\\\\.)*)" + _ + "+$", "g"), $ = RegExp("^" + _ + "*," + _ + "*"), I = RegExp("^" + _ + "*([\\x20\\t\\r\\n\\f>+~])" + _ + "*"), z = RegExp(R), X = RegExp("^" + O + "$"), U = { ID: RegExp("^#(" + F + ")"), CLASS: RegExp("^\\.(" + F + ")"), NAME: RegExp("^\\[name=['\"]?(" + F + ")['\"]?\\]"), TAG: RegExp("^(" + F.replace("w", "w*") + ")"), ATTR: RegExp("^" + P), PSEUDO: RegExp("^" + R), CHILD: RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + _ + "*(even|odd|(([+-]|)(\\d*)n|)" + _ + "*(?:([+-]|)" + _ + "*(\\d+)|))" + _ + "*\\)|)", "i"), needsContext: RegExp("^" + _ + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + _ + "*((?:-\\d)?\\d*)" + _ + "*\\)|)(?=[^-]|$)", "i") }, V = /[\x20\t\r\n\f]*[+~]/, Y = /^[^{]+\{\s*\[native code/, J = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, G = /^(?:input|select|textarea|button)$/i, Q = /^h\d$/i, K = /'|\\/g, Z = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, et = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, tt = function (e, t) { var n = "0x" + t - 65536; return n !== n ? t : 0 > n ? String.fromCharCode(n + 65536) : String.fromCharCode(55296 | n >> 10, 56320 | 1023 & n) }; try { q.call(w.documentElement.childNodes, 0)[0].nodeType } catch (nt) { q = function (e) { var t, n = []; while (t = this[e++]) n.push(t); return n } } function rt(e) { return Y.test(e + "") } function it() { var e, t = []; return e = function (n, r) { return t.push(n += " ") > i.cacheLength && delete e[t.shift()], e[n] = r } } function ot(e) { return e[x] = !0, e } function at(e) { var t = p.createElement("div"); try { return e(t) } catch (n) { return !1 } finally { t = null } } function st(e, t, n, r) { var i, o, a, s, u, l, f, g, m, v; if ((t ? t.ownerDocument || t : w) !== p && c(t), t = t || p, n = n || [], !e || "string" != typeof e) return n; if (1 !== (s = t.nodeType) && 9 !== s) return []; if (!d && !r) { if (i = J.exec(e)) if (a = i[1]) { if (9 === s) { if (o = t.getElementById(a), !o || !o.parentNode) return n; if (o.id === a) return n.push(o), n } else if (t.ownerDocument && (o = t.ownerDocument.getElementById(a)) && y(t, o) && o.id === a) return n.push(o), n } else { if (i[2]) return H.apply(n, q.call(t.getElementsByTagName(e), 0)), n; if ((a = i[3]) && T.getByClassName && t.getElementsByClassName) return H.apply(n, q.call(t.getElementsByClassName(a), 0)), n } if (T.qsa && !h.test(e)) { if (f = !0, g = x, m = t, v = 9 === s && e, 1 === s && "object" !== t.nodeName.toLowerCase()) { l = ft(e), (f = t.getAttribute("id")) ? g = f.replace(K, "\\$&") : t.setAttribute("id", g), g = "[id='" + g + "'] ", u = l.length; while (u--) l[u] = g + dt(l[u]); m = V.test(e) && t.parentNode || t, v = l.join(",") } if (v) try { return H.apply(n, q.call(m.querySelectorAll(v), 0)), n } catch (b) { } finally { f || t.removeAttribute("id") } } } return wt(e.replace(W, "$1"), t, n, r) } a = st.isXML = function (e) { var t = e && (e.ownerDocument || e).documentElement; return t ? "HTML" !== t.nodeName : !1 }, c = st.setDocument = function (e) { var n = e ? e.ownerDocument || e : w; return n !== p && 9 === n.nodeType && n.documentElement ? (p = n, f = n.documentElement, d = a(n), T.tagNameNoComments = at(function (e) { return e.appendChild(n.createComment("")), !e.getElementsByTagName("*").length }), T.attributes = at(function (e) { e.innerHTML = "<select></select>"; var t = typeof e.lastChild.getAttribute("multiple"); return "boolean" !== t && "string" !== t }), T.getByClassName = at(function (e) { return e.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>", e.getElementsByClassName && e.getElementsByClassName("e").length ? (e.lastChild.className = "e", 2 === e.getElementsByClassName("e").length) : !1 }), T.getByName = at(function (e) { e.id = x + 0, e.innerHTML = "<a name='" + x + "'></a><div name='" + x + "'></div>", f.insertBefore(e, f.firstChild); var t = n.getElementsByName && n.getElementsByName(x).length === 2 + n.getElementsByName(x + 0).length; return T.getIdNotName = !n.getElementById(x), f.removeChild(e), t }), i.attrHandle = at(function (e) { return e.innerHTML = "<a href='#'></a>", e.firstChild && typeof e.firstChild.getAttribute !== A && "#" === e.firstChild.getAttribute("href") }) ? {} : { href: function (e) { return e.getAttribute("href", 2) }, type: function (e) { return e.getAttribute("type") } }, T.getIdNotName ? (i.find.ID = function (e, t) { if (typeof t.getElementById !== A && !d) { var n = t.getElementById(e); return n && n.parentNode ? [n] : [] } }, i.filter.ID = function (e) { var t = e.replace(et, tt); return function (e) { return e.getAttribute("id") === t } }) : (i.find.ID = function (e, n) { if (typeof n.getElementById !== A && !d) { var r = n.getElementById(e); return r ? r.id === e || typeof r.getAttributeNode !== A && r.getAttributeNode("id").value === e ? [r] : t : [] } }, i.filter.ID = function (e) { var t = e.replace(et, tt); return function (e) { var n = typeof e.getAttributeNode !== A && e.getAttributeNode("id"); return n && n.value === t } }), i.find.TAG = T.tagNameNoComments ? function (e, n) { return typeof n.getElementsByTagName !== A ? n.getElementsByTagName(e) : t } : function (e, t) { var n, r = [], i = 0, o = t.getElementsByTagName(e); if ("*" === e) { while (n = o[i++]) 1 === n.nodeType && r.push(n); return r } return o }, i.find.NAME = T.getByName && function (e, n) { return typeof n.getElementsByName !== A ? n.getElementsByName(name) : t }, i.find.CLASS = T.getByClassName && function (e, n) { return typeof n.getElementsByClassName === A || d ? t : n.getElementsByClassName(e) }, g = [], h = [":focus"], (T.qsa = rt(n.querySelectorAll)) && (at(function (e) { e.innerHTML = "<select><option selected=''></option></select>", e.querySelectorAll("[selected]").length || h.push("\\[" + _ + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)"), e.querySelectorAll(":checked").length || h.push(":checked") }), at(function (e) { e.innerHTML = "<input type='hidden' i=''/>", e.querySelectorAll("[i^='']").length && h.push("[*^$]=" + _ + "*(?:\"\"|'')"), e.querySelectorAll(":enabled").length || h.push(":enabled", ":disabled"), e.querySelectorAll("*,:x"), h.push(",.*:") })), (T.matchesSelector = rt(m = f.matchesSelector || f.mozMatchesSelector || f.webkitMatchesSelector || f.oMatchesSelector || f.msMatchesSelector)) && at(function (e) { T.disconnectedMatch = m.call(e, "div"), m.call(e, "[s!='']:x"), g.push("!=", R) }), h = RegExp(h.join("|")), g = RegExp(g.join("|")), y = rt(f.contains) || f.compareDocumentPosition ? function (e, t) { var n = 9 === e.nodeType ? e.documentElement : e, r = t && t.parentNode; return e === r || !(!r || 1 !== r.nodeType || !(n.contains ? n.contains(r) : e.compareDocumentPosition && 16 & e.compareDocumentPosition(r))) } : function (e, t) { if (t) while (t = t.parentNode) if (t === e) return !0; return !1 }, v = f.compareDocumentPosition ? function (e, t) { var r; return e === t ? (u = !0, 0) : (r = t.compareDocumentPosition && e.compareDocumentPosition && e.compareDocumentPosition(t)) ? 1 & r || e.parentNode && 11 === e.parentNode.nodeType ? e === n || y(w, e) ? -1 : t === n || y(w, t) ? 1 : 0 : 4 & r ? -1 : 1 : e.compareDocumentPosition ? -1 : 1 } : function (e, t) { var r, i = 0, o = e.parentNode, a = t.parentNode, s = [e], l = [t]; if (e === t) return u = !0, 0; if (!o || !a) return e === n ? -1 : t === n ? 1 : o ? -1 : a ? 1 : 0; if (o === a) return ut(e, t); r = e; while (r = r.parentNode) s.unshift(r); r = t; while (r = r.parentNode) l.unshift(r); while (s[i] === l[i]) i++; return i ? ut(s[i], l[i]) : s[i] === w ? -1 : l[i] === w ? 1 : 0 }, u = !1, [0, 0].sort(v), T.detectDuplicates = u, p) : p }, st.matches = function (e, t) { return st(e, null, null, t) }, st.matchesSelector = function (e, t) { if ((e.ownerDocument || e) !== p && c(e), t = t.replace(Z, "='$1']"), !(!T.matchesSelector || d || g && g.test(t) || h.test(t))) try { var n = m.call(e, t); if (n || T.disconnectedMatch || e.document && 11 !== e.document.nodeType) return n } catch (r) { } return st(t, p, null, [e]).length > 0 }, st.contains = function (e, t) { return (e.ownerDocument || e) !== p && c(e), y(e, t) }, st.attr = function (e, t) { var n; return (e.ownerDocument || e) !== p && c(e), d || (t = t.toLowerCase()), (n = i.attrHandle[t]) ? n(e) : d || T.attributes ? e.getAttribute(t) : ((n = e.getAttributeNode(t)) || e.getAttribute(t)) && e[t] === !0 ? t : n && n.specified ? n.value : null }, st.error = function (e) { throw Error("Syntax error, unrecognized expression: " + e) }, st.uniqueSort = function (e) { var t, n = [], r = 1, i = 0; if (u = !T.detectDuplicates, e.sort(v), u) { for (; t = e[r]; r++) t === e[r - 1] && (i = n.push(r)); while (i--) e.splice(n[i], 1) } return e }; function ut(e, t) { var n = t && e, r = n && (~t.sourceIndex || j) - (~e.sourceIndex || j); if (r) return r; if (n) while (n = n.nextSibling) if (n === t) return -1; return e ? 1 : -1 } function lt(e) { return function (t) { var n = t.nodeName.toLowerCase(); return "input" === n && t.type === e } } function ct(e) { return function (t) { var n = t.nodeName.toLowerCase(); return ("input" === n || "button" === n) && t.type === e } } function pt(e) { return ot(function (t) { return t = +t, ot(function (n, r) { var i, o = e([], n.length, t), a = o.length; while (a--) n[i = o[a]] && (n[i] = !(r[i] = n[i])) }) }) } o = st.getText = function (e) { var t, n = "", r = 0, i = e.nodeType; if (i) { if (1 === i || 9 === i || 11 === i) { if ("string" == typeof e.textContent) return e.textContent; for (e = e.firstChild; e; e = e.nextSibling) n += o(e) } else if (3 === i || 4 === i) return e.nodeValue } else for (; t = e[r]; r++) n += o(t); return n }, i = st.selectors = { cacheLength: 50, createPseudo: ot, match: U, find: {}, relative: { ">": { dir: "parentNode", first: !0 }, " ": { dir: "parentNode" }, "+": { dir: "previousSibling", first: !0 }, "~": { dir: "previousSibling"} }, preFilter: { ATTR: function (e) { return e[1] = e[1].replace(et, tt), e[3] = (e[4] || e[5] || "").replace(et, tt), "~=" === e[2] && (e[3] = " " + e[3] + " "), e.slice(0, 4) }, CHILD: function (e) { return e[1] = e[1].toLowerCase(), "nth" === e[1].slice(0, 3) ? (e[3] || st.error(e[0]), e[4] = +(e[4] ? e[5] + (e[6] || 1) : 2 * ("even" === e[3] || "odd" === e[3])), e[5] = +(e[7] + e[8] || "odd" === e[3])) : e[3] && st.error(e[0]), e }, PSEUDO: function (e) { var t, n = !e[5] && e[2]; return U.CHILD.test(e[0]) ? null : (e[4] ? e[2] = e[4] : n && z.test(n) && (t = ft(n, !0)) && (t = n.indexOf(")", n.length - t) - n.length) && (e[0] = e[0].slice(0, t), e[2] = n.slice(0, t)), e.slice(0, 3)) } }, filter: { TAG: function (e) { return "*" === e ? function () { return !0 } : (e = e.replace(et, tt).toLowerCase(), function (t) { return t.nodeName && t.nodeName.toLowerCase() === e }) }, CLASS: function (e) { var t = k[e + " "]; return t || (t = RegExp("(^|" + _ + ")" + e + "(" + _ + "|$)")) && k(e, function (e) { return t.test(e.className || typeof e.getAttribute !== A && e.getAttribute("class") || "") }) }, ATTR: function (e, t, n) { return function (r) { var i = st.attr(r, e); return null == i ? "!=" === t : t ? (i += "", "=" === t ? i === n : "!=" === t ? i !== n : "^=" === t ? n && 0 === i.indexOf(n) : "*=" === t ? n && i.indexOf(n) > -1 : "$=" === t ? n && i.slice(-n.length) === n : "~=" === t ? (" " + i + " ").indexOf(n) > -1 : "|=" === t ? i === n || i.slice(0, n.length + 1) === n + "-" : !1) : !0 } }, CHILD: function (e, t, n, r, i) { var o = "nth" !== e.slice(0, 3), a = "last" !== e.slice(-4), s = "of-type" === t; return 1 === r && 0 === i ? function (e) { return !!e.parentNode } : function (t, n, u) { var l, c, p, f, d, h, g = o !== a ? "nextSibling" : "previousSibling", m = t.parentNode, y = s && t.nodeName.toLowerCase(), v = !u && !s; if (m) { if (o) { while (g) { p = t; while (p = p[g]) if (s ? p.nodeName.toLowerCase() === y : 1 === p.nodeType) return !1; h = g = "only" === e && !h && "nextSibling" } return !0 } if (h = [a ? m.firstChild : m.lastChild], a && v) { c = m[x] || (m[x] = {}), l = c[e] || [], d = l[0] === N && l[1], f = l[0] === N && l[2], p = d && m.childNodes[d]; while (p = ++d && p && p[g] || (f = d = 0) || h.pop()) if (1 === p.nodeType && ++f && p === t) { c[e] = [N, d, f]; break } } else if (v && (l = (t[x] || (t[x] = {}))[e]) && l[0] === N) f = l[1]; else while (p = ++d && p && p[g] || (f = d = 0) || h.pop()) if ((s ? p.nodeName.toLowerCase() === y : 1 === p.nodeType) && ++f && (v && ((p[x] || (p[x] = {}))[e] = [N, f]), p === t)) break; return f -= i, f === r || 0 === f % r && f / r >= 0 } } }, PSEUDO: function (e, t) { var n, r = i.pseudos[e] || i.setFilters[e.toLowerCase()] || st.error("unsupported pseudo: " + e); return r[x] ? r(t) : r.length > 1 ? (n = [e, e, "", t], i.setFilters.hasOwnProperty(e.toLowerCase()) ? ot(function (e, n) { var i, o = r(e, t), a = o.length; while (a--) i = M.call(e, o[a]), e[i] = !(n[i] = o[a]) }) : function (e) { return r(e, 0, n) }) : r } }, pseudos: { not: ot(function (e) { var t = [], n = [], r = s(e.replace(W, "$1")); return r[x] ? ot(function (e, t, n, i) { var o, a = r(e, null, i, []), s = e.length; while (s--) (o = a[s]) && (e[s] = !(t[s] = o)) }) : function (e, i, o) { return t[0] = e, r(t, null, o, n), !n.pop() } }), has: ot(function (e) { return function (t) { return st(e, t).length > 0 } }), contains: ot(function (e) { return function (t) { return (t.textContent || t.innerText || o(t)).indexOf(e) > -1 } }), lang: ot(function (e) { return X.test(e || "") || st.error("unsupported lang: " + e), e = e.replace(et, tt).toLowerCase(), function (t) { var n; do if (n = d ? t.getAttribute("xml:lang") || t.getAttribute("lang") : t.lang) return n = n.toLowerCase(), n === e || 0 === n.indexOf(e + "-"); while ((t = t.parentNode) && 1 === t.nodeType); return !1 } }), target: function (t) { var n = e.location && e.location.hash; return n && n.slice(1) === t.id }, root: function (e) { return e === f }, focus: function (e) { return e === p.activeElement && (!p.hasFocus || p.hasFocus()) && !!(e.type || e.href || ~e.tabIndex) }, enabled: function (e) { return e.disabled === !1 }, disabled: function (e) { return e.disabled === !0 }, checked: function (e) { var t = e.nodeName.toLowerCase(); return "input" === t && !!e.checked || "option" === t && !!e.selected }, selected: function (e) { return e.parentNode && e.parentNode.selectedIndex, e.selected === !0 }, empty: function (e) { for (e = e.firstChild; e; e = e.nextSibling) if (e.nodeName > "@" || 3 === e.nodeType || 4 === e.nodeType) return !1; return !0 }, parent: function (e) { return !i.pseudos.empty(e) }, header: function (e) { return Q.test(e.nodeName) }, input: function (e) { return G.test(e.nodeName) }, button: function (e) { var t = e.nodeName.toLowerCase(); return "input" === t && "button" === e.type || "button" === t }, text: function (e) { var t; return "input" === e.nodeName.toLowerCase() && "text" === e.type && (null == (t = e.getAttribute("type")) || t.toLowerCase() === e.type) }, first: pt(function () { return [0] }), last: pt(function (e, t) { return [t - 1] }), eq: pt(function (e, t, n) { return [0 > n ? n + t : n] }), even: pt(function (e, t) { var n = 0; for (; t > n; n += 2) e.push(n); return e }), odd: pt(function (e, t) { var n = 1; for (; t > n; n += 2) e.push(n); return e }), lt: pt(function (e, t, n) { var r = 0 > n ? n + t : n; for (; --r >= 0; ) e.push(r); return e }), gt: pt(function (e, t, n) { var r = 0 > n ? n + t : n; for (; t > ++r; ) e.push(r); return e })} }; for (n in { radio: !0, checkbox: !0, file: !0, password: !0, image: !0 }) i.pseudos[n] = lt(n); for (n in { submit: !0, reset: !0 }) i.pseudos[n] = ct(n); function ft(e, t) { var n, r, o, a, s, u, l, c = E[e + " "]; if (c) return t ? 0 : c.slice(0); s = e, u = [], l = i.preFilter; while (s) { (!n || (r = $.exec(s))) && (r && (s = s.slice(r[0].length) || s), u.push(o = [])), n = !1, (r = I.exec(s)) && (n = r.shift(), o.push({ value: n, type: r[0].replace(W, " ") }), s = s.slice(n.length)); for (a in i.filter) !(r = U[a].exec(s)) || l[a] && !(r = l[a](r)) || (n = r.shift(), o.push({ value: n, type: a, matches: r }), s = s.slice(n.length)); if (!n) break } return t ? s.length : s ? st.error(e) : E(e, u).slice(0) } function dt(e) { var t = 0, n = e.length, r = ""; for (; n > t; t++) r += e[t].value; return r } function ht(e, t, n) { var i = t.dir, o = n && "parentNode" === i, a = C++; return t.first ? function (t, n, r) { while (t = t[i]) if (1 === t.nodeType || o) return e(t, n, r) } : function (t, n, s) { var u, l, c, p = N + " " + a; if (s) { while (t = t[i]) if ((1 === t.nodeType || o) && e(t, n, s)) return !0 } else while (t = t[i]) if (1 === t.nodeType || o) if (c = t[x] || (t[x] = {}), (l = c[i]) && l[0] === p) { if ((u = l[1]) === !0 || u === r) return u === !0 } else if (l = c[i] = [p], l[1] = e(t, n, s) || r, l[1] === !0) return !0 } } function gt(e) { return e.length > 1 ? function (t, n, r) { var i = e.length; while (i--) if (!e[i](t, n, r)) return !1; return !0 } : e[0] } function mt(e, t, n, r, i) { var o, a = [], s = 0, u = e.length, l = null != t; for (; u > s; s++) (o = e[s]) && (!n || n(o, r, i)) && (a.push(o), l && t.push(s)); return a } function yt(e, t, n, r, i, o) { return r && !r[x] && (r = yt(r)), i && !i[x] && (i = yt(i, o)), ot(function (o, a, s, u) { var l, c, p, f = [], d = [], h = a.length, g = o || xt(t || "*", s.nodeType ? [s] : s, []), m = !e || !o && t ? g : mt(g, f, e, s, u), y = n ? i || (o ? e : h || r) ? [] : a : m; if (n && n(m, y, s, u), r) { l = mt(y, d), r(l, [], s, u), c = l.length; while (c--) (p = l[c]) && (y[d[c]] = !(m[d[c]] = p)) } if (o) { if (i || e) { if (i) { l = [], c = y.length; while (c--) (p = y[c]) && l.push(m[c] = p); i(null, y = [], l, u) } c = y.length; while (c--) (p = y[c]) && (l = i ? M.call(o, p) : f[c]) > -1 && (o[l] = !(a[l] = p)) } } else y = mt(y === a ? y.splice(h, y.length) : y), i ? i(null, a, y, u) : H.apply(a, y) }) } function vt(e) { var t, n, r, o = e.length, a = i.relative[e[0].type], s = a || i.relative[" "], u = a ? 1 : 0, c = ht(function (e) { return e === t }, s, !0), p = ht(function (e) { return M.call(t, e) > -1 }, s, !0), f = [function (e, n, r) { return !a && (r || n !== l) || ((t = n).nodeType ? c(e, n, r) : p(e, n, r)) } ]; for (; o > u; u++) if (n = i.relative[e[u].type]) f = [ht(gt(f), n)]; else { if (n = i.filter[e[u].type].apply(null, e[u].matches), n[x]) { for (r = ++u; o > r; r++) if (i.relative[e[r].type]) break; return yt(u > 1 && gt(f), u > 1 && dt(e.slice(0, u - 1)).replace(W, "$1"), n, r > u && vt(e.slice(u, r)), o > r && vt(e = e.slice(r)), o > r && dt(e)) } f.push(n) } return gt(f) } function bt(e, t) { var n = 0, o = t.length > 0, a = e.length > 0, s = function (s, u, c, f, d) { var h, g, m, y = [], v = 0, b = "0", x = s && [], w = null != d, T = l, C = s || a && i.find.TAG("*", d && u.parentNode || u), k = N += null == T ? 1 : Math.random() || .1; for (w && (l = u !== p && u, r = n); null != (h = C[b]); b++) { if (a && h) { g = 0; while (m = e[g++]) if (m(h, u, c)) { f.push(h); break } w && (N = k, r = ++n) } o && ((h = !m && h) && v--, s && x.push(h)) } if (v += b, o && b !== v) { g = 0; while (m = t[g++]) m(x, y, u, c); if (s) { if (v > 0) while (b--) x[b] || y[b] || (y[b] = L.call(f)); y = mt(y) } H.apply(f, y), w && !s && y.length > 0 && v + t.length > 1 && st.uniqueSort(f) } return w && (N = k, l = T), x }; return o ? ot(s) : s } s = st.compile = function (e, t) { var n, r = [], i = [], o = S[e + " "]; if (!o) { t || (t = ft(e)), n = t.length; while (n--) o = vt(t[n]), o[x] ? r.push(o) : i.push(o); o = S(e, bt(i, r)) } return o }; function xt(e, t, n) { var r = 0, i = t.length; for (; i > r; r++) st(e, t[r], n); return n } function wt(e, t, n, r) { var o, a, u, l, c, p = ft(e); if (!r && 1 === p.length) { if (a = p[0] = p[0].slice(0), a.length > 2 && "ID" === (u = a[0]).type && 9 === t.nodeType && !d && i.relative[a[1].type]) { if (t = i.find.ID(u.matches[0].replace(et, tt), t)[0], !t) return n; e = e.slice(a.shift().value.length) } o = U.needsContext.test(e) ? 0 : a.length; while (o--) { if (u = a[o], i.relative[l = u.type]) break; if ((c = i.find[l]) && (r = c(u.matches[0].replace(et, tt), V.test(a[0].type) && t.parentNode || t))) { if (a.splice(o, 1), e = r.length && dt(a), !e) return H.apply(n, q.call(r, 0)), n; break } } } return s(e, p)(r, t, d, n, V.test(e)), n } i.pseudos.nth = i.pseudos.eq; function Tt() { } i.filters = Tt.prototype = i.pseudos, i.setFilters = new Tt, c(), st.attr = b.attr, b.find = st, b.expr = st.selectors, b.expr[":"] = b.expr.pseudos, b.unique = st.uniqueSort, b.text = st.getText, b.isXMLDoc = st.isXML, b.contains = st.contains } (e); var at = /Until$/, st = /^(?:parents|prev(?:Until|All))/, ut = /^.[^:#\[\.,]*$/, lt = b.expr.match.needsContext, ct = { children: !0, contents: !0, next: !0, prev: !0 }; b.fn.extend({ find: function (e) { var t, n, r, i = this.length; if ("string" != typeof e) return r = this, this.pushStack(b(e).filter(function () { for (t = 0; i > t; t++) if (b.contains(r[t], this)) return !0 })); for (n = [], t = 0; i > t; t++) b.find(e, this[t], n); return n = this.pushStack(i > 1 ? b.unique(n) : n), n.selector = (this.selector ? this.selector + " " : "") + e, n }, has: function (e) { var t, n = b(e, this), r = n.length; return this.filter(function () { for (t = 0; r > t; t++) if (b.contains(this, n[t])) return !0 }) }, not: function (e) { return this.pushStack(ft(this, e, !1)) }, filter: function (e) { return this.pushStack(ft(this, e, !0)) }, is: function (e) { return !!e && ("string" == typeof e ? lt.test(e) ? b(e, this.context).index(this[0]) >= 0 : b.filter(e, this).length > 0 : this.filter(e).length > 0) }, closest: function (e, t) { var n, r = 0, i = this.length, o = [], a = lt.test(e) || "string" != typeof e ? b(e, t || this.context) : 0; for (; i > r; r++) { n = this[r]; while (n && n.ownerDocument && n !== t && 11 !== n.nodeType) { if (a ? a.index(n) > -1 : b.find.matchesSelector(n, e)) { o.push(n); break } n = n.parentNode } } return this.pushStack(o.length > 1 ? b.unique(o) : o) }, index: function (e) { return e ? "string" == typeof e ? b.inArray(this[0], b(e)) : b.inArray(e.jquery ? e[0] : e, this) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1 }, add: function (e, t) { var n = "string" == typeof e ? b(e, t) : b.makeArray(e && e.nodeType ? [e] : e), r = b.merge(this.get(), n); return this.pushStack(b.unique(r)) }, addBack: function (e) { return this.add(null == e ? this.prevObject : this.prevObject.filter(e)) } }), b.fn.andSelf = b.fn.addBack; function pt(e, t) { do e = e[t]; while (e && 1 !== e.nodeType); return e } b.each({ parent: function (e) { var t = e.parentNode; return t && 11 !== t.nodeType ? t : null }, parents: function (e) { return b.dir(e, "parentNode") }, parentsUntil: function (e, t, n) { return b.dir(e, "parentNode", n) }, next: function (e) { return pt(e, "nextSibling") }, prev: function (e) { return pt(e, "previousSibling") }, nextAll: function (e) { return b.dir(e, "nextSibling") }, prevAll: function (e) { return b.dir(e, "previousSibling") }, nextUntil: function (e, t, n) { return b.dir(e, "nextSibling", n) }, prevUntil: function (e, t, n) { return b.dir(e, "previousSibling", n) }, siblings: function (e) { return b.sibling((e.parentNode || {}).firstChild, e) }, children: function (e) { return b.sibling(e.firstChild) }, contents: function (e) { return b.nodeName(e, "iframe") ? e.contentDocument || e.contentWindow.document : b.merge([], e.childNodes) } }, function (e, t) { b.fn[e] = function (n, r) { var i = b.map(this, t, n); return at.test(e) || (r = n), r && "string" == typeof r && (i = b.filter(r, i)), i = this.length > 1 && !ct[e] ? b.unique(i) : i, this.length > 1 && st.test(e) && (i = i.reverse()), this.pushStack(i) } }), b.extend({ filter: function (e, t, n) { return n && (e = ":not(" + e + ")"), 1 === t.length ? b.find.matchesSelector(t[0], e) ? [t[0]] : [] : b.find.matches(e, t) }, dir: function (e, n, r) { var i = [], o = e[n]; while (o && 9 !== o.nodeType && (r === t || 1 !== o.nodeType || !b(o).is(r))) 1 === o.nodeType && i.push(o), o = o[n]; return i }, sibling: function (e, t) { var n = []; for (; e; e = e.nextSibling) 1 === e.nodeType && e !== t && n.push(e); return n } }); function ft(e, t, n) { if (t = t || 0, b.isFunction(t)) return b.grep(e, function (e, r) { var i = !!t.call(e, r, e); return i === n }); if (t.nodeType) return b.grep(e, function (e) { return e === t === n }); if ("string" == typeof t) { var r = b.grep(e, function (e) { return 1 === e.nodeType }); if (ut.test(t)) return b.filter(t, r, !n); t = b.filter(t, r) } return b.grep(e, function (e) { return b.inArray(e, t) >= 0 === n }) } function dt(e) { var t = ht.split("|"), n = e.createDocumentFragment(); if (n.createElement) while (t.length) n.createElement(t.pop()); return n } var ht = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", gt = / jQuery\d+="(?:null|\d+)"/g, mt = RegExp("<(?:" + ht + ")[\\s/>]", "i"), yt = /^\s+/, vt = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, bt = /<([\w:]+)/, xt = /<tbody/i, wt = /<|&#?\w+;/, Tt = /<(?:script|style|link)/i, Nt = /^(?:checkbox|radio)$/i, Ct = /checked\s*(?:[^=]|=\s*.checked.)/i, kt = /^$|\/(?:java|ecma)script/i, Et = /^true\/(.*)/, St = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, At = { option: [1, "<select multiple='multiple'>", "</select>"], legend: [1, "<fieldset>", "</fieldset>"], area: [1, "<map>", "</map>"], param: [1, "<object>", "</object>"], thead: [1, "<table>", "</table>"], tr: [2, "<table><tbody>", "</tbody></table>"], col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"], td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], _default: b.support.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"] }, jt = dt(o), Dt = jt.appendChild(o.createElement("div")); At.optgroup = At.option, At.tbody = At.tfoot = At.colgroup = At.caption = At.thead, At.th = At.td, b.fn.extend({ text: function (e) { return b.access(this, function (e) { return e === t ? b.text(this) : this.empty().append((this[0] && this[0].ownerDocument || o).createTextNode(e)) }, null, e, arguments.length) }, wrapAll: function (e) { if (b.isFunction(e)) return this.each(function (t) { b(this).wrapAll(e.call(this, t)) }); if (this[0]) { var t = b(e, this[0].ownerDocument).eq(0).clone(!0); this[0].parentNode && t.insertBefore(this[0]), t.map(function () { var e = this; while (e.firstChild && 1 === e.firstChild.nodeType) e = e.firstChild; return e }).append(this) } return this }, wrapInner: function (e) { return b.isFunction(e) ? this.each(function (t) { b(this).wrapInner(e.call(this, t)) }) : this.each(function () { var t = b(this), n = t.contents(); n.length ? n.wrapAll(e) : t.append(e) }) }, wrap: function (e) { var t = b.isFunction(e); return this.each(function (n) { b(this).wrapAll(t ? e.call(this, n) : e) }) }, unwrap: function () { return this.parent().each(function () { b.nodeName(this, "body") || b(this).replaceWith(this.childNodes) }).end() }, append: function () { return this.domManip(arguments, !0, function (e) { (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) && this.appendChild(e) }) }, prepend: function () { return this.domManip(arguments, !0, function (e) { (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) && this.insertBefore(e, this.firstChild) }) }, before: function () { return this.domManip(arguments, !1, function (e) { this.parentNode && this.parentNode.insertBefore(e, this) }) }, after: function () { return this.domManip(arguments, !1, function (e) { this.parentNode && this.parentNode.insertBefore(e, this.nextSibling) }) }, remove: function (e, t) { var n, r = 0; for (; null != (n = this[r]); r++) (!e || b.filter(e, [n]).length > 0) && (t || 1 !== n.nodeType || b.cleanData(Ot(n)), n.parentNode && (t && b.contains(n.ownerDocument, n) && Mt(Ot(n, "script")), n.parentNode.removeChild(n))); return this }, empty: function () { var e, t = 0; for (; null != (e = this[t]); t++) { 1 === e.nodeType && b.cleanData(Ot(e, !1)); while (e.firstChild) e.removeChild(e.firstChild); e.options && b.nodeName(e, "select") && (e.options.length = 0) } return this }, clone: function (e, t) { return e = null == e ? !1 : e, t = null == t ? e : t, this.map(function () { return b.clone(this, e, t) }) }, html: function (e) { return b.access(this, function (e) { var n = this[0] || {}, r = 0, i = this.length; if (e === t) return 1 === n.nodeType ? n.innerHTML.replace(gt, "") : t; if (!("string" != typeof e || Tt.test(e) || !b.support.htmlSerialize && mt.test(e) || !b.support.leadingWhitespace && yt.test(e) || At[(bt.exec(e) || ["", ""])[1].toLowerCase()])) { e = e.replace(vt, "<$1></$2>"); try { for (; i > r; r++) n = this[r] || {}, 1 === n.nodeType && (b.cleanData(Ot(n, !1)), n.innerHTML = e); n = 0 } catch (o) { } } n && this.empty().append(e) }, null, e, arguments.length) }, replaceWith: function (e) { var t = b.isFunction(e); return t || "string" == typeof e || (e = b(e).not(this).detach()), this.domManip([e], !0, function (e) { var t = this.nextSibling, n = this.parentNode; n && (b(this).remove(), n.insertBefore(e, t)) }) }, detach: function (e) { return this.remove(e, !0) }, domManip: function (e, n, r) { e = f.apply([], e); var i, o, a, s, u, l, c = 0, p = this.length, d = this, h = p - 1, g = e[0], m = b.isFunction(g); if (m || !(1 >= p || "string" != typeof g || b.support.checkClone) && Ct.test(g)) return this.each(function (i) { var o = d.eq(i); m && (e[0] = g.call(this, i, n ? o.html() : t)), o.domManip(e, n, r) }); if (p && (l = b.buildFragment(e, this[0].ownerDocument, !1, this), i = l.firstChild, 1 === l.childNodes.length && (l = i), i)) { for (n = n && b.nodeName(i, "tr"), s = b.map(Ot(l, "script"), Ht), a = s.length; p > c; c++) o = l, c !== h && (o = b.clone(o, !0, !0), a && b.merge(s, Ot(o, "script"))), r.call(n && b.nodeName(this[c], "table") ? Lt(this[c], "tbody") : this[c], o, c); if (a) for (u = s[s.length - 1].ownerDocument, b.map(s, qt), c = 0; a > c; c++) o = s[c], kt.test(o.type || "") && !b._data(o, "globalEval") && b.contains(u, o) && (o.src ? b.ajax({ url: o.src, type: "GET", dataType: "script", async: !1, global: !1, "throws": !0 }) : b.globalEval((o.text || o.textContent || o.innerHTML || "").replace(St, ""))); l = i = null } return this } }); function Lt(e, t) { return e.getElementsByTagName(t)[0] || e.appendChild(e.ownerDocument.createElement(t)) } function Ht(e) { var t = e.getAttributeNode("type"); return e.type = (t && t.specified) + "/" + e.type, e } function qt(e) { var t = Et.exec(e.type); return t ? e.type = t[1] : e.removeAttribute("type"), e } function Mt(e, t) { var n, r = 0; for (; null != (n = e[r]); r++) b._data(n, "globalEval", !t || b._data(t[r], "globalEval")) } function _t(e, t) { if (1 === t.nodeType && b.hasData(e)) { var n, r, i, o = b._data(e), a = b._data(t, o), s = o.events; if (s) { delete a.handle, a.events = {}; for (n in s) for (r = 0, i = s[n].length; i > r; r++) b.event.add(t, n, s[n][r]) } a.data && (a.data = b.extend({}, a.data)) } } function Ft(e, t) { var n, r, i; if (1 === t.nodeType) { if (n = t.nodeName.toLowerCase(), !b.support.noCloneEvent && t[b.expando]) { i = b._data(t); for (r in i.events) b.removeEvent(t, r, i.handle); t.removeAttribute(b.expando) } "script" === n && t.text !== e.text ? (Ht(t).text = e.text, qt(t)) : "object" === n ? (t.parentNode && (t.outerHTML = e.outerHTML), b.support.html5Clone && e.innerHTML && !b.trim(t.innerHTML) && (t.innerHTML = e.innerHTML)) : "input" === n && Nt.test(e.type) ? (t.defaultChecked = t.checked = e.checked, t.value !== e.value && (t.value = e.value)) : "option" === n ? t.defaultSelected = t.selected = e.defaultSelected : ("input" === n || "textarea" === n) && (t.defaultValue = e.defaultValue) } } b.each({ appendTo: "append", prependTo: "prepend", insertBefore: "before", insertAfter: "after", replaceAll: "replaceWith" }, function (e, t) { b.fn[e] = function (e) { var n, r = 0, i = [], o = b(e), a = o.length - 1; for (; a >= r; r++) n = r === a ? this : this.clone(!0), b(o[r])[t](n), d.apply(i, n.get()); return this.pushStack(i) } }); function Ot(e, n) { var r, o, a = 0, s = typeof e.getElementsByTagName !== i ? e.getElementsByTagName(n || "*") : typeof e.querySelectorAll !== i ? e.querySelectorAll(n || "*") : t; if (!s) for (s = [], r = e.childNodes || e; null != (o = r[a]); a++) !n || b.nodeName(o, n) ? s.push(o) : b.merge(s, Ot(o, n)); return n === t || n && b.nodeName(e, n) ? b.merge([e], s) : s } function Bt(e) { Nt.test(e.type) && (e.defaultChecked = e.checked) } b.extend({ clone: function (e, t, n) { var r, i, o, a, s, u = b.contains(e.ownerDocument, e); if (b.support.html5Clone || b.isXMLDoc(e) || !mt.test("<" + e.nodeName + ">") ? o = e.cloneNode(!0) : (Dt.innerHTML = e.outerHTML, Dt.removeChild(o = Dt.firstChild)), !(b.support.noCloneEvent && b.support.noCloneChecked || 1 !== e.nodeType && 11 !== e.nodeType || b.isXMLDoc(e))) for (r = Ot(o), s = Ot(e), a = 0; null != (i = s[a]); ++a) r[a] && Ft(i, r[a]); if (t) if (n) for (s = s || Ot(e), r = r || Ot(o), a = 0; null != (i = s[a]); a++) _t(i, r[a]); else _t(e, o); return r = Ot(o, "script"), r.length > 0 && Mt(r, !u && Ot(e, "script")), r = s = i = null, o }, buildFragment: function (e, t, n, r) {
var i, o, a, s, u, l, c, p = e.length, f = dt(t), d = [], h = 0; for (; p > h; h++) if (o = e[h], o || 0 === o) if ("object" === b.type(o)) b.merge(d, o.nodeType ? [o] : o); else if (wt.test(o)) {
s = s || f.appendChild(t.createElement("div")), u = (bt.exec(o) || ["", ""])[1].toLowerCase(), c = At[u] || At._default, s.innerHTML = c[1] + o.replace(vt, "<$1></$2>") + c[2], i = c[0]; while (i--) s = s.lastChild; if (!b.support.leadingWhitespace && yt.test(o) && d.push(t.createTextNode(yt.exec(o)[0])), !b.support.tbody) {
o = "table" !== u || xt.test(o) ? "<table>" !== c[1] || xt.test(o) ? 0 : s : s.firstChild, i = o && o.childNodes.length; while (i--) b.nodeName(l = o.childNodes[i], "tbody") && !l.childNodes.length && o.removeChild(l)
} b.merge(d, s.childNodes), s.textContent = ""; while (s.firstChild) s.removeChild(s.firstChild); s = f.lastChild
} else d.push(t.createTextNode(o)); s && f.removeChild(s), b.support.appendChecked || b.grep(Ot(d, "input"), Bt), h = 0; while (o = d[h++]) if ((!r || -1 === b.inArray(o, r)) && (a = b.contains(o.ownerDocument, o), s = Ot(f.appendChild(o), "script"), a && Mt(s), n)) { i = 0; while (o = s[i++]) kt.test(o.type || "") && n.push(o) } return s = null, f
}, cleanData: function (e, t) { var n, r, o, a, s = 0, u = b.expando, l = b.cache, p = b.support.deleteExpando, f = b.event.special; for (; null != (n = e[s]); s++) if ((t || b.acceptData(n)) && (o = n[u], a = o && l[o])) { if (a.events) for (r in a.events) f[r] ? b.event.remove(n, r) : b.removeEvent(n, r, a.handle); l[o] && (delete l[o], p ? delete n[u] : typeof n.removeAttribute !== i ? n.removeAttribute(u) : n[u] = null, c.push(o)) } }
}); var Pt, Rt, Wt, $t = /alpha\([^)]*\)/i, It = /opacity\s*=\s*([^)]*)/, zt = /^(top|right|bottom|left)$/, Xt = /^(none|table(?!-c[ea]).+)/, Ut = /^margin/, Vt = RegExp("^(" + x + ")(.*)$", "i"), Yt = RegExp("^(" + x + ")(?!px)[a-z%]+$", "i"), Jt = RegExp("^([+-])=(" + x + ")", "i"), Gt = { BODY: "block" }, Qt = { position: "absolute", visibility: "hidden", display: "block" }, Kt = { letterSpacing: 0, fontWeight: 400 }, Zt = ["Top", "Right", "Bottom", "Left"], en = ["Webkit", "O", "Moz", "ms"]; function tn(e, t) { if (t in e) return t; var n = t.charAt(0).toUpperCase() + t.slice(1), r = t, i = en.length; while (i--) if (t = en[i] + n, t in e) return t; return r } function nn(e, t) { return e = t || e, "none" === b.css(e, "display") || !b.contains(e.ownerDocument, e) } function rn(e, t) { var n, r, i, o = [], a = 0, s = e.length; for (; s > a; a++) r = e[a], r.style && (o[a] = b._data(r, "olddisplay"), n = r.style.display, t ? (o[a] || "none" !== n || (r.style.display = ""), "" === r.style.display && nn(r) && (o[a] = b._data(r, "olddisplay", un(r.nodeName)))) : o[a] || (i = nn(r), (n && "none" !== n || !i) && b._data(r, "olddisplay", i ? n : b.css(r, "display")))); for (a = 0; s > a; a++) r = e[a], r.style && (t && "none" !== r.style.display && "" !== r.style.display || (r.style.display = t ? o[a] || "" : "none")); return e } b.fn.extend({ css: function (e, n) { return b.access(this, function (e, n, r) { var i, o, a = {}, s = 0; if (b.isArray(n)) { for (o = Rt(e), i = n.length; i > s; s++) a[n[s]] = b.css(e, n[s], !1, o); return a } return r !== t ? b.style(e, n, r) : b.css(e, n) }, e, n, arguments.length > 1) }, show: function () { return rn(this, !0) }, hide: function () { return rn(this) }, toggle: function (e) { var t = "boolean" == typeof e; return this.each(function () { (t ? e : nn(this)) ? b(this).show() : b(this).hide() }) } }), b.extend({ cssHooks: { opacity: { get: function (e, t) { if (t) { var n = Wt(e, "opacity"); return "" === n ? "1" : n } } } }, cssNumber: { columnCount: !0, fillOpacity: !0, fontWeight: !0, lineHeight: !0, opacity: !0, orphans: !0, widows: !0, zIndex: !0, zoom: !0 }, cssProps: { "float": b.support.cssFloat ? "cssFloat" : "styleFloat" }, style: function (e, n, r, i) { if (e && 3 !== e.nodeType && 8 !== e.nodeType && e.style) { var o, a, s, u = b.camelCase(n), l = e.style; if (n = b.cssProps[u] || (b.cssProps[u] = tn(l, u)), s = b.cssHooks[n] || b.cssHooks[u], r === t) return s && "get" in s && (o = s.get(e, !1, i)) !== t ? o : l[n]; if (a = typeof r, "string" === a && (o = Jt.exec(r)) && (r = (o[1] + 1) * o[2] + parseFloat(b.css(e, n)), a = "number"), !(null == r || "number" === a && isNaN(r) || ("number" !== a || b.cssNumber[u] || (r += "px"), b.support.clearCloneStyle || "" !== r || 0 !== n.indexOf("background") || (l[n] = "inherit"), s && "set" in s && (r = s.set(e, r, i)) === t))) try { l[n] = r } catch (c) { } } }, css: function (e, n, r, i) { var o, a, s, u = b.camelCase(n); return n = b.cssProps[u] || (b.cssProps[u] = tn(e.style, u)), s = b.cssHooks[n] || b.cssHooks[u], s && "get" in s && (a = s.get(e, !0, r)), a === t && (a = Wt(e, n, i)), "normal" === a && n in Kt && (a = Kt[n]), "" === r || r ? (o = parseFloat(a), r === !0 || b.isNumeric(o) ? o || 0 : a) : a }, swap: function (e, t, n, r) { var i, o, a = {}; for (o in t) a[o] = e.style[o], e.style[o] = t[o]; i = n.apply(e, r || []); for (o in t) e.style[o] = a[o]; return i } }), e.getComputedStyle ? (Rt = function (t) { return e.getComputedStyle(t, null) }, Wt = function (e, n, r) { var i, o, a, s = r || Rt(e), u = s ? s.getPropertyValue(n) || s[n] : t, l = e.style; return s && ("" !== u || b.contains(e.ownerDocument, e) || (u = b.style(e, n)), Yt.test(u) && Ut.test(n) && (i = l.width, o = l.minWidth, a = l.maxWidth, l.minWidth = l.maxWidth = l.width = u, u = s.width, l.width = i, l.minWidth = o, l.maxWidth = a)), u }) : o.documentElement.currentStyle && (Rt = function (e) { return e.currentStyle }, Wt = function (e, n, r) { var i, o, a, s = r || Rt(e), u = s ? s[n] : t, l = e.style; return null == u && l && l[n] && (u = l[n]), Yt.test(u) && !zt.test(n) && (i = l.left, o = e.runtimeStyle, a = o && o.left, a && (o.left = e.currentStyle.left), l.left = "fontSize" === n ? "1em" : u, u = l.pixelLeft + "px", l.left = i, a && (o.left = a)), "" === u ? "auto" : u }); function on(e, t, n) { var r = Vt.exec(t); return r ? Math.max(0, r[1] - (n || 0)) + (r[2] || "px") : t } function an(e, t, n, r, i) { var o = n === (r ? "border" : "content") ? 4 : "width" === t ? 1 : 0, a = 0; for (; 4 > o; o += 2) "margin" === n && (a += b.css(e, n + Zt[o], !0, i)), r ? ("content" === n && (a -= b.css(e, "padding" + Zt[o], !0, i)), "margin" !== n && (a -= b.css(e, "border" + Zt[o] + "Width", !0, i))) : (a += b.css(e, "padding" + Zt[o], !0, i), "padding" !== n && (a += b.css(e, "border" + Zt[o] + "Width", !0, i))); return a } function sn(e, t, n) { var r = !0, i = "width" === t ? e.offsetWidth : e.offsetHeight, o = Rt(e), a = b.support.boxSizing && "border-box" === b.css(e, "boxSizing", !1, o); if (0 >= i || null == i) { if (i = Wt(e, t, o), (0 > i || null == i) && (i = e.style[t]), Yt.test(i)) return i; r = a && (b.support.boxSizingReliable || i === e.style[t]), i = parseFloat(i) || 0 } return i + an(e, t, n || (a ? "border" : "content"), r, o) + "px" } function un(e) { var t = o, n = Gt[e]; return n || (n = ln(e, t), "none" !== n && n || (Pt = (Pt || b("<iframe frameborder='0' width='0' height='0'/>").css("cssText", "display:block !important")).appendTo(t.documentElement), t = (Pt[0].contentWindow || Pt[0].contentDocument).document, t.write("<!doctype html><html><body>"), t.close(), n = ln(e, t), Pt.detach()), Gt[e] = n), n } function ln(e, t) { var n = b(t.createElement(e)).appendTo(t.body), r = b.css(n[0], "display"); return n.remove(), r } b.each(["height", "width"], function (e, n) { b.cssHooks[n] = { get: function (e, r, i) { return r ? 0 === e.offsetWidth && Xt.test(b.css(e, "display")) ? b.swap(e, Qt, function () { return sn(e, n, i) }) : sn(e, n, i) : t }, set: function (e, t, r) { var i = r && Rt(e); return on(e, t, r ? an(e, n, r, b.support.boxSizing && "border-box" === b.css(e, "boxSizing", !1, i), i) : 0) } } }), b.support.opacity || (b.cssHooks.opacity = { get: function (e, t) { return It.test((t && e.currentStyle ? e.currentStyle.filter : e.style.filter) || "") ? .01 * parseFloat(RegExp.$1) + "" : t ? "1" : "" }, set: function (e, t) { var n = e.style, r = e.currentStyle, i = b.isNumeric(t) ? "alpha(opacity=" + 100 * t + ")" : "", o = r && r.filter || n.filter || ""; n.zoom = 1, (t >= 1 || "" === t) && "" === b.trim(o.replace($t, "")) && n.removeAttribute && (n.removeAttribute("filter"), "" === t || r && !r.filter) || (n.filter = $t.test(o) ? o.replace($t, i) : o + " " + i) } }), b(function () { b.support.reliableMarginRight || (b.cssHooks.marginRight = { get: function (e, n) { return n ? b.swap(e, { display: "inline-block" }, Wt, [e, "marginRight"]) : t } }), !b.support.pixelPosition && b.fn.position && b.each(["top", "left"], function (e, n) { b.cssHooks[n] = { get: function (e, r) { return r ? (r = Wt(e, n), Yt.test(r) ? b(e).position()[n] + "px" : r) : t } } }) }), b.expr && b.expr.filters && (b.expr.filters.hidden = function (e) { return 0 >= e.offsetWidth && 0 >= e.offsetHeight || !b.support.reliableHiddenOffsets && "none" === (e.style && e.style.display || b.css(e, "display")) }, b.expr.filters.visible = function (e) { return !b.expr.filters.hidden(e) }), b.each({ margin: "", padding: "", border: "Width" }, function (e, t) { b.cssHooks[e + t] = { expand: function (n) { var r = 0, i = {}, o = "string" == typeof n ? n.split(" ") : [n]; for (; 4 > r; r++) i[e + Zt[r] + t] = o[r] || o[r - 2] || o[0]; return i } }, Ut.test(e) || (b.cssHooks[e + t].set = on) }); var cn = /%20/g, pn = /\[\]$/, fn = /\r?\n/g, dn = /^(?:submit|button|image|reset|file)$/i, hn = /^(?:input|select|textarea|keygen)/i; b.fn.extend({ serialize: function () { return b.param(this.serializeArray()) }, serializeArray: function () { return this.map(function () { var e = b.prop(this, "elements"); return e ? b.makeArray(e) : this }).filter(function () { var e = this.type; return this.name && !b(this).is(":disabled") && hn.test(this.nodeName) && !dn.test(e) && (this.checked || !Nt.test(e)) }).map(function (e, t) { var n = b(this).val(); return null == n ? null : b.isArray(n) ? b.map(n, function (e) { return { name: t.name, value: e.replace(fn, "\r\n")} }) : { name: t.name, value: n.replace(fn, "\r\n")} }).get() } }), b.param = function (e, n) { var r, i = [], o = function (e, t) { t = b.isFunction(t) ? t() : null == t ? "" : t, i[i.length] = encodeURIComponent(e) + "=" + encodeURIComponent(t) }; if (n === t && (n = b.ajaxSettings && b.ajaxSettings.traditional), b.isArray(e) || e.jquery && !b.isPlainObject(e)) b.each(e, function () { o(this.name, this.value) }); else for (r in e) gn(r, e[r], n, o); return i.join("&").replace(cn, "+") }; function gn(e, t, n, r) { var i; if (b.isArray(t)) b.each(t, function (t, i) { n || pn.test(e) ? r(e, i) : gn(e + "[" + ("object" == typeof i ? t : "") + "]", i, n, r) }); else if (n || "object" !== b.type(t)) r(e, t); else for (i in t) gn(e + "[" + i + "]", t[i], n, r) } b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "), function (e, t) { b.fn[t] = function (e, n) { return arguments.length > 0 ? this.on(t, null, e, n) : this.trigger(t) } }), b.fn.hover = function (e, t) { return this.mouseenter(e).mouseleave(t || e) }; var mn, yn, vn = b.now(), bn = /\?/, xn = /#.*$/, wn = /([?&])_=[^&]*/, Tn = /^(.*?):[ \t]*([^\r\n]*)\r?$/gm, Nn = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, Cn = /^(?:GET|HEAD)$/, kn = /^\/\//, En = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, Sn = b.fn.load, An = {}, jn = {}, Dn = "*/".concat("*"); try { yn = a.href } catch (Ln) { yn = o.createElement("a"), yn.href = "", yn = yn.href } mn = En.exec(yn.toLowerCase()) || []; function Hn(e) { return function (t, n) { "string" != typeof t && (n = t, t = "*"); var r, i = 0, o = t.toLowerCase().match(w) || []; if (b.isFunction(n)) while (r = o[i++]) "+" === r[0] ? (r = r.slice(1) || "*", (e[r] = e[r] || []).unshift(n)) : (e[r] = e[r] || []).push(n) } } function qn(e, n, r, i) { var o = {}, a = e === jn; function s(u) { var l; return o[u] = !0, b.each(e[u] || [], function (e, u) { var c = u(n, r, i); return "string" != typeof c || a || o[c] ? a ? !(l = c) : t : (n.dataTypes.unshift(c), s(c), !1) }), l } return s(n.dataTypes[0]) || !o["*"] && s("*") } function Mn(e, n) { var r, i, o = b.ajaxSettings.flatOptions || {}; for (i in n) n[i] !== t && ((o[i] ? e : r || (r = {}))[i] = n[i]); return r && b.extend(!0, e, r), e } b.fn.load = function (e, n, r) { if ("string" != typeof e && Sn) return Sn.apply(this, arguments); var i, o, a, s = this, u = e.indexOf(" "); return u >= 0 && (i = e.slice(u, e.length), e = e.slice(0, u)), b.isFunction(n) ? (r = n, n = t) : n && "object" == typeof n && (a = "POST"), s.length > 0 && b.ajax({ url: e, type: a, dataType: "html", data: n }).done(function (e) { o = arguments, s.html(i ? b("<div>").append(b.parseHTML(e)).find(i) : e) }).complete(r && function (e, t) { s.each(r, o || [e.responseText, t, e]) }), this }, b.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (e, t) { b.fn[t] = function (e) { return this.on(t, e) } }), b.each(["get", "post"], function (e, n) { b[n] = function (e, r, i, o) { return b.isFunction(r) && (o = o || i, i = r, r = t), b.ajax({ url: e, type: n, dataType: o, data: r, success: i }) } }), b.extend({ active: 0, lastModified: {}, etag: {}, ajaxSettings: { url: yn, type: "GET", isLocal: Nn.test(mn[1]), global: !0, processData: !0, async: !0, contentType: "application/x-www-form-urlencoded; charset=UTF-8", accepts: { "*": Dn, text: "text/plain", html: "text/html", xml: "application/xml, text/xml", json: "application/json, text/javascript" }, contents: { xml: /xml/, html: /html/, json: /json/ }, responseFields: { xml: "responseXML", text: "responseText" }, converters: { "* text": e.String, "text html": !0, "text json": b.parseJSON, "text xml": b.parseXML }, flatOptions: { url: !0, context: !0} }, ajaxSetup: function (e, t) { return t ? Mn(Mn(e, b.ajaxSettings), t) : Mn(b.ajaxSettings, e) }, ajaxPrefilter: Hn(An), ajaxTransport: Hn(jn), ajax: function (e, n) { "object" == typeof e && (n = e, e = t), n = n || {}; var r, i, o, a, s, u, l, c, p = b.ajaxSetup({}, n), f = p.context || p, d = p.context && (f.nodeType || f.jquery) ? b(f) : b.event, h = b.Deferred(), g = b.Callbacks("once memory"), m = p.statusCode || {}, y = {}, v = {}, x = 0, T = "canceled", N = { readyState: 0, getResponseHeader: function (e) { var t; if (2 === x) { if (!c) { c = {}; while (t = Tn.exec(a)) c[t[1].toLowerCase()] = t[2] } t = c[e.toLowerCase()] } return null == t ? null : t }, getAllResponseHeaders: function () { return 2 === x ? a : null }, setRequestHeader: function (e, t) { var n = e.toLowerCase(); return x || (e = v[n] = v[n] || e, y[e] = t), this }, overrideMimeType: function (e) { return x || (p.mimeType = e), this }, statusCode: function (e) { var t; if (e) if (2 > x) for (t in e) m[t] = [m[t], e[t]]; else N.always(e[N.status]); return this }, abort: function (e) { var t = e || T; return l && l.abort(t), k(0, t), this } }; if (h.promise(N).complete = g.add, N.success = N.done, N.error = N.fail, p.url = ((e || p.url || yn) + "").replace(xn, "").replace(kn, mn[1] + "//"), p.type = n.method || n.type || p.method || p.type, p.dataTypes = b.trim(p.dataType || "*").toLowerCase().match(w) || [""], null == p.crossDomain && (r = En.exec(p.url.toLowerCase()), p.crossDomain = !(!r || r[1] === mn[1] && r[2] === mn[2] && (r[3] || ("http:" === r[1] ? 80 : 443)) == (mn[3] || ("http:" === mn[1] ? 80 : 443)))), p.data && p.processData && "string" != typeof p.data && (p.data = b.param(p.data, p.traditional)), qn(An, p, n, N), 2 === x) return N; u = p.global, u && 0 === b.active++ && b.event.trigger("ajaxStart"), p.type = p.type.toUpperCase(), p.hasContent = !Cn.test(p.type), o = p.url, p.hasContent || (p.data && (o = p.url += (bn.test(o) ? "&" : "?") + p.data, delete p.data), p.cache === !1 && (p.url = wn.test(o) ? o.replace(wn, "$1_=" + vn++) : o + (bn.test(o) ? "&" : "?") + "_=" + vn++)), p.ifModified && (b.lastModified[o] && N.setRequestHeader("If-Modified-Since", b.lastModified[o]), b.etag[o] && N.setRequestHeader("If-None-Match", b.etag[o])), (p.data && p.hasContent && p.contentType !== !1 || n.contentType) && N.setRequestHeader("Content-Type", p.contentType), N.setRequestHeader("Accept", p.dataTypes[0] && p.accepts[p.dataTypes[0]] ? p.accepts[p.dataTypes[0]] + ("*" !== p.dataTypes[0] ? ", " + Dn + "; q=0.01" : "") : p.accepts["*"]); for (i in p.headers) N.setRequestHeader(i, p.headers[i]); if (p.beforeSend && (p.beforeSend.call(f, N, p) === !1 || 2 === x)) return N.abort(); T = "abort"; for (i in { success: 1, error: 1, complete: 1 }) N[i](p[i]); if (l = qn(jn, p, n, N)) { N.readyState = 1, u && d.trigger("ajaxSend", [N, p]), p.async && p.timeout > 0 && (s = setTimeout(function () { N.abort("timeout") }, p.timeout)); try { x = 1, l.send(y, k) } catch (C) { if (!(2 > x)) throw C; k(-1, C) } } else k(-1, "No Transport"); function k(e, n, r, i) { var c, y, v, w, T, C = n; 2 !== x && (x = 2, s && clearTimeout(s), l = t, a = i || "", N.readyState = e > 0 ? 4 : 0, r && (w = _n(p, N, r)), e >= 200 && 300 > e || 304 === e ? (p.ifModified && (T = N.getResponseHeader("Last-Modified"), T && (b.lastModified[o] = T), T = N.getResponseHeader("etag"), T && (b.etag[o] = T)), 204 === e ? (c = !0, C = "nocontent") : 304 === e ? (c = !0, C = "notmodified") : (c = Fn(p, w), C = c.state, y = c.data, v = c.error, c = !v)) : (v = C, (e || !C) && (C = "error", 0 > e && (e = 0))), N.status = e, N.statusText = (n || C) + "", c ? h.resolveWith(f, [y, C, N]) : h.rejectWith(f, [N, C, v]), N.statusCode(m), m = t, u && d.trigger(c ? "ajaxSuccess" : "ajaxError", [N, p, c ? y : v]), g.fireWith(f, [N, C]), u && (d.trigger("ajaxComplete", [N, p]), --b.active || b.event.trigger("ajaxStop"))) } return N }, getScript: function (e, n) { return b.get(e, t, n, "script") }, getJSON: function (e, t, n) { return b.get(e, t, n, "json") } }); function _n(e, n, r) { var i, o, a, s, u = e.contents, l = e.dataTypes, c = e.responseFields; for (s in c) s in r && (n[c[s]] = r[s]); while ("*" === l[0]) l.shift(), o === t && (o = e.mimeType || n.getResponseHeader("Content-Type")); if (o) for (s in u) if (u[s] && u[s].test(o)) { l.unshift(s); break } if (l[0] in r) a = l[0]; else { for (s in r) { if (!l[0] || e.converters[s + " " + l[0]]) { a = s; break } i || (i = s) } a = a || i } return a ? (a !== l[0] && l.unshift(a), r[a]) : t } function Fn(e, t) { var n, r, i, o, a = {}, s = 0, u = e.dataTypes.slice(), l = u[0]; if (e.dataFilter && (t = e.dataFilter(t, e.dataType)), u[1]) for (i in e.converters) a[i.toLowerCase()] = e.converters[i]; for (; r = u[++s]; ) if ("*" !== r) { if ("*" !== l && l !== r) { if (i = a[l + " " + r] || a["* " + r], !i) for (n in a) if (o = n.split(" "), o[1] === r && (i = a[l + " " + o[0]] || a["* " + o[0]])) { i === !0 ? i = a[n] : a[n] !== !0 && (r = o[0], u.splice(s--, 0, r)); break } if (i !== !0) if (i && e["throws"]) t = i(t); else try { t = i(t) } catch (c) { return { state: "parsererror", error: i ? c : "No conversion from " + l + " to " + r} } } l = r } return { state: "success", data: t} } b.ajaxSetup({ accepts: { script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" }, contents: { script: /(?:java|ecma)script/ }, converters: { "text script": function (e) { return b.globalEval(e), e } } }), b.ajaxPrefilter("script", function (e) { e.cache === t && (e.cache = !1), e.crossDomain && (e.type = "GET", e.global = !1) }), b.ajaxTransport("script", function (e) { if (e.crossDomain) { var n, r = o.head || b("head")[0] || o.documentElement; return { send: function (t, i) { n = o.createElement("script"), n.async = !0, e.scriptCharset && (n.charset = e.scriptCharset), n.src = e.url, n.onload = n.onreadystatechange = function (e, t) { (t || !n.readyState || /loaded|complete/.test(n.readyState)) && (n.onload = n.onreadystatechange = null, n.parentNode && n.parentNode.removeChild(n), n = null, t || i(200, "success")) }, r.insertBefore(n, r.firstChild) }, abort: function () { n && n.onload(t, !0) } } } }); var On = [], Bn = /(=)\?(?=&|$)|\?\?/; b.ajaxSetup({ jsonp: "callback", jsonpCallback: function () { var e = On.pop() || b.expando + "_" + vn++; return this[e] = !0, e } }), b.ajaxPrefilter("json jsonp", function (n, r, i) { var o, a, s, u = n.jsonp !== !1 && (Bn.test(n.url) ? "url" : "string" == typeof n.data && !(n.contentType || "").indexOf("application/x-www-form-urlencoded") && Bn.test(n.data) && "data"); return u || "jsonp" === n.dataTypes[0] ? (o = n.jsonpCallback = b.isFunction(n.jsonpCallback) ? n.jsonpCallback() : n.jsonpCallback, u ? n[u] = n[u].replace(Bn, "$1" + o) : n.jsonp !== !1 && (n.url += (bn.test(n.url) ? "&" : "?") + n.jsonp + "=" + o), n.converters["script json"] = function () { return s || b.error(o + " was not called"), s[0] }, n.dataTypes[0] = "json", a = e[o], e[o] = function () { s = arguments }, i.always(function () { e[o] = a, n[o] && (n.jsonpCallback = r.jsonpCallback, On.push(o)), s && b.isFunction(a) && a(s[0]), s = a = t }), "script") : t }); var Pn, Rn, Wn = 0, $n = e.ActiveXObject && function () { var e; for (e in Pn) Pn[e](t, !0) }; function In() { try { return new e.XMLHttpRequest } catch (t) { } } function zn() { try { return new e.ActiveXObject("Microsoft.XMLHTTP") } catch (t) { } } b.ajaxSettings.xhr = e.ActiveXObject ? function () { return !this.isLocal && In() || zn() } : In, Rn = b.ajaxSettings.xhr(), b.support.cors = !!Rn && "withCredentials" in Rn, Rn = b.support.ajax = !!Rn, Rn && b.ajaxTransport(function (n) { if (!n.crossDomain || b.support.cors) { var r; return { send: function (i, o) { var a, s, u = n.xhr(); if (n.username ? u.open(n.type, n.url, n.async, n.username, n.password) : u.open(n.type, n.url, n.async), n.xhrFields) for (s in n.xhrFields) u[s] = n.xhrFields[s]; n.mimeType && u.overrideMimeType && u.overrideMimeType(n.mimeType), n.crossDomain || i["X-Requested-With"] || (i["X-Requested-With"] = "XMLHttpRequest"); try { for (s in i) u.setRequestHeader(s, i[s]) } catch (l) { } u.send(n.hasContent && n.data || null), r = function (e, i) { var s, l, c, p; try { if (r && (i || 4 === u.readyState)) if (r = t, a && (u.onreadystatechange = b.noop, $n && delete Pn[a]), i) 4 !== u.readyState && u.abort(); else { p = {}, s = u.status, l = u.getAllResponseHeaders(), "string" == typeof u.responseText && (p.text = u.responseText); try { c = u.statusText } catch (f) { c = "" } s || !n.isLocal || n.crossDomain ? 1223 === s && (s = 204) : s = p.text ? 200 : 404 } } catch (d) { i || o(-1, d) } p && o(s, c, p, l) }, n.async ? 4 === u.readyState ? setTimeout(r) : (a = ++Wn, $n && (Pn || (Pn = {}, b(e).unload($n)), Pn[a] = r), u.onreadystatechange = r) : r() }, abort: function () { r && r(t, !0) } } } }); var Xn, Un, Vn = /^(?:toggle|show|hide)$/, Yn = RegExp("^(?:([+-])=|)(" + x + ")([a-z%]*)$", "i"), Jn = /queueHooks$/, Gn = [nr], Qn = { "*": [function (e, t) { var n, r, i = this.createTween(e, t), o = Yn.exec(t), a = i.cur(), s = +a || 0, u = 1, l = 20; if (o) { if (n = +o[2], r = o[3] || (b.cssNumber[e] ? "" : "px"), "px" !== r && s) { s = b.css(i.elem, e, !0) || n || 1; do u = u || ".5", s /= u, b.style(i.elem, e, s + r); while (u !== (u = i.cur() / a) && 1 !== u && --l) } i.unit = r, i.start = s, i.end = o[1] ? s + (o[1] + 1) * n : n } return i } ] }; function Kn() { return setTimeout(function () { Xn = t }), Xn = b.now() } function Zn(e, t) { b.each(t, function (t, n) { var r = (Qn[t] || []).concat(Qn["*"]), i = 0, o = r.length; for (; o > i; i++) if (r[i].call(e, t, n)) return }) } function er(e, t, n) { var r, i, o = 0, a = Gn.length, s = b.Deferred().always(function () { delete u.elem }), u = function () { if (i) return !1; var t = Xn || Kn(), n = Math.max(0, l.startTime + l.duration - t), r = n / l.duration || 0, o = 1 - r, a = 0, u = l.tweens.length; for (; u > a; a++) l.tweens[a].run(o); return s.notifyWith(e, [l, o, n]), 1 > o && u ? n : (s.resolveWith(e, [l]), !1) }, l = s.promise({ elem: e, props: b.extend({}, t), opts: b.extend(!0, { specialEasing: {} }, n), originalProperties: t, originalOptions: n, startTime: Xn || Kn(), duration: n.duration, tweens: [], createTween: function (t, n) { var r = b.Tween(e, l.opts, t, n, l.opts.specialEasing[t] || l.opts.easing); return l.tweens.push(r), r }, stop: function (t) { var n = 0, r = t ? l.tweens.length : 0; if (i) return this; for (i = !0; r > n; n++) l.tweens[n].run(1); return t ? s.resolveWith(e, [l, t]) : s.rejectWith(e, [l, t]), this } }), c = l.props; for (tr(c, l.opts.specialEasing); a > o; o++) if (r = Gn[o].call(l, e, c, l.opts)) return r; return Zn(l, c), b.isFunction(l.opts.start) && l.opts.start.call(e, l), b.fx.timer(b.extend(u, { elem: e, anim: l, queue: l.opts.queue })), l.progress(l.opts.progress).done(l.opts.done, l.opts.complete).fail(l.opts.fail).always(l.opts.always) } function tr(e, t) { var n, r, i, o, a; for (i in e) if (r = b.camelCase(i), o = t[r], n = e[i], b.isArray(n) && (o = n[1], n = e[i] = n[0]), i !== r && (e[r] = n, delete e[i]), a = b.cssHooks[r], a && "expand" in a) { n = a.expand(n), delete e[r]; for (i in n) i in e || (e[i] = n[i], t[i] = o) } else t[r] = o } b.Animation = b.extend(er, { tweener: function (e, t) { b.isFunction(e) ? (t = e, e = ["*"]) : e = e.split(" "); var n, r = 0, i = e.length; for (; i > r; r++) n = e[r], Qn[n] = Qn[n] || [], Qn[n].unshift(t) }, prefilter: function (e, t) { t ? Gn.unshift(e) : Gn.push(e) } }); function nr(e, t, n) { var r, i, o, a, s, u, l, c, p, f = this, d = e.style, h = {}, g = [], m = e.nodeType && nn(e); n.queue || (c = b._queueHooks(e, "fx"), null == c.unqueued && (c.unqueued = 0, p = c.empty.fire, c.empty.fire = function () { c.unqueued || p() }), c.unqueued++, f.always(function () { f.always(function () { c.unqueued--, b.queue(e, "fx").length || c.empty.fire() }) })), 1 === e.nodeType && ("height" in t || "width" in t) && (n.overflow = [d.overflow, d.overflowX, d.overflowY], "inline" === b.css(e, "display") && "none" === b.css(e, "float") && (b.support.inlineBlockNeedsLayout && "inline" !== un(e.nodeName) ? d.zoom = 1 : d.display = "inline-block")), n.overflow && (d.overflow = "hidden", b.support.shrinkWrapBlocks || f.always(function () { d.overflow = n.overflow[0], d.overflowX = n.overflow[1], d.overflowY = n.overflow[2] })); for (i in t) if (a = t[i], Vn.exec(a)) { if (delete t[i], u = u || "toggle" === a, a === (m ? "hide" : "show")) continue; g.push(i) } if (o = g.length) { s = b._data(e, "fxshow") || b._data(e, "fxshow", {}), "hidden" in s && (m = s.hidden), u && (s.hidden = !m), m ? b(e).show() : f.done(function () { b(e).hide() }), f.done(function () { var t; b._removeData(e, "fxshow"); for (t in h) b.style(e, t, h[t]) }); for (i = 0; o > i; i++) r = g[i], l = f.createTween(r, m ? s[r] : 0), h[r] = s[r] || b.style(e, r), r in s || (s[r] = l.start, m && (l.end = l.start, l.start = "width" === r || "height" === r ? 1 : 0)) } } function rr(e, t, n, r, i) { return new rr.prototype.init(e, t, n, r, i) } b.Tween = rr, rr.prototype = { constructor: rr, init: function (e, t, n, r, i, o) { this.elem = e, this.prop = n, this.easing = i || "swing", this.options = t, this.start = this.now = this.cur(), this.end = r, this.unit = o || (b.cssNumber[n] ? "" : "px") }, cur: function () { var e = rr.propHooks[this.prop]; return e && e.get ? e.get(this) : rr.propHooks._default.get(this) }, run: function (e) { var t, n = rr.propHooks[this.prop]; return this.pos = t = this.options.duration ? b.easing[this.easing](e, this.options.duration * e, 0, 1, this.options.duration) : e, this.now = (this.end - this.start) * t + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), n && n.set ? n.set(this) : rr.propHooks._default.set(this), this } }, rr.prototype.init.prototype = rr.prototype, rr.propHooks = { _default: { get: function (e) { var t; return null == e.elem[e.prop] || e.elem.style && null != e.elem.style[e.prop] ? (t = b.css(e.elem, e.prop, ""), t && "auto" !== t ? t : 0) : e.elem[e.prop] }, set: function (e) { b.fx.step[e.prop] ? b.fx.step[e.prop](e) : e.elem.style && (null != e.elem.style[b.cssProps[e.prop]] || b.cssHooks[e.prop]) ? b.style(e.elem, e.prop, e.now + e.unit) : e.elem[e.prop] = e.now } } }, rr.propHooks.scrollTop = rr.propHooks.scrollLeft = { set: function (e) { e.elem.nodeType && e.elem.parentNode && (e.elem[e.prop] = e.now) } }, b.each(["toggle", "show", "hide"], function (e, t) { var n = b.fn[t]; b.fn[t] = function (e, r, i) { return null == e || "boolean" == typeof e ? n.apply(this, arguments) : this.animate(ir(t, !0), e, r, i) } }), b.fn.extend({ fadeTo: function (e, t, n, r) { return this.filter(nn).css("opacity", 0).show().end().animate({ opacity: t }, e, n, r) }, animate: function (e, t, n, r) { var i = b.isEmptyObject(e), o = b.speed(t, n, r), a = function () { var t = er(this, b.extend({}, e), o); a.finish = function () { t.stop(!0) }, (i || b._data(this, "finish")) && t.stop(!0) }; return a.finish = a, i || o.queue === !1 ? this.each(a) : this.queue(o.queue, a) }, stop: function (e, n, r) { var i = function (e) { var t = e.stop; delete e.stop, t(r) }; return "string" != typeof e && (r = n, n = e, e = t), n && e !== !1 && this.queue(e || "fx", []), this.each(function () { var t = !0, n = null != e && e + "queueHooks", o = b.timers, a = b._data(this); if (n) a[n] && a[n].stop && i(a[n]); else for (n in a) a[n] && a[n].stop && Jn.test(n) && i(a[n]); for (n = o.length; n--; ) o[n].elem !== this || null != e && o[n].queue !== e || (o[n].anim.stop(r), t = !1, o.splice(n, 1)); (t || !r) && b.dequeue(this, e) }) }, finish: function (e) { return e !== !1 && (e = e || "fx"), this.each(function () { var t, n = b._data(this), r = n[e + "queue"], i = n[e + "queueHooks"], o = b.timers, a = r ? r.length : 0; for (n.finish = !0, b.queue(this, e, []), i && i.cur && i.cur.finish && i.cur.finish.call(this), t = o.length; t--; ) o[t].elem === this && o[t].queue === e && (o[t].anim.stop(!0), o.splice(t, 1)); for (t = 0; a > t; t++) r[t] && r[t].finish && r[t].finish.call(this); delete n.finish }) } }); function ir(e, t) { var n, r = { height: e }, i = 0; for (t = t ? 1 : 0; 4 > i; i += 2 - t) n = Zt[i], r["margin" + n] = r["padding" + n] = e; return t && (r.opacity = r.width = e), r } b.each({ slideDown: ir("show"), slideUp: ir("hide"), slideToggle: ir("toggle"), fadeIn: { opacity: "show" }, fadeOut: { opacity: "hide" }, fadeToggle: { opacity: "toggle"} }, function (e, t) { b.fn[e] = function (e, n, r) { return this.animate(t, e, n, r) } }), b.speed = function (e, t, n) { var r = e && "object" == typeof e ? b.extend({}, e) : { complete: n || !n && t || b.isFunction(e) && e, duration: e, easing: n && t || t && !b.isFunction(t) && t }; return r.duration = b.fx.off ? 0 : "number" == typeof r.duration ? r.duration : r.duration in b.fx.speeds ? b.fx.speeds[r.duration] : b.fx.speeds._default, (null == r.queue || r.queue === !0) && (r.queue = "fx"), r.old = r.complete, r.complete = function () { b.isFunction(r.old) && r.old.call(this), r.queue && b.dequeue(this, r.queue) }, r }, b.easing = { linear: function (e) { return e }, swing: function (e) { return .5 - Math.cos(e * Math.PI) / 2 } }, b.timers = [], b.fx = rr.prototype.init, b.fx.tick = function () { var e, n = b.timers, r = 0; for (Xn = b.now(); n.length > r; r++) e = n[r], e() || n[r] !== e || n.splice(r--, 1); n.length || b.fx.stop(), Xn = t }, b.fx.timer = function (e) { e() && b.timers.push(e) && b.fx.start() }, b.fx.interval = 13, b.fx.start = function () { Un || (Un = setInterval(b.fx.tick, b.fx.interval)) }, b.fx.stop = function () { clearInterval(Un), Un = null }, b.fx.speeds = { slow: 600, fast: 200, _default: 400 }, b.fx.step = {}, b.expr && b.expr.filters && (b.expr.filters.animated = function (e) { return b.grep(b.timers, function (t) { return e === t.elem }).length }), b.fn.offset = function (e) { if (arguments.length) return e === t ? this : this.each(function (t) { b.offset.setOffset(this, e, t) }); var n, r, o = { top: 0, left: 0 }, a = this[0], s = a && a.ownerDocument; if (s) return n = s.documentElement, b.contains(n, a) ? (typeof a.getBoundingClientRect !== i && (o = a.getBoundingClientRect()), r = or(s), { top: o.top + (r.pageYOffset || n.scrollTop) - (n.clientTop || 0), left: o.left + (r.pageXOffset || n.scrollLeft) - (n.clientLeft || 0) }) : o }, b.offset = { setOffset: function (e, t, n) { var r = b.css(e, "position"); "static" === r && (e.style.position = "relative"); var i = b(e), o = i.offset(), a = b.css(e, "top"), s = b.css(e, "left"), u = ("absolute" === r || "fixed" === r) && b.inArray("auto", [a, s]) > -1, l = {}, c = {}, p, f; u ? (c = i.position(), p = c.top, f = c.left) : (p = parseFloat(a) || 0, f = parseFloat(s) || 0), b.isFunction(t) && (t = t.call(e, n, o)), null != t.top && (l.top = t.top - o.top + p), null != t.left && (l.left = t.left - o.left + f), "using" in t ? t.using.call(e, l) : i.css(l) } }, b.fn.extend({ position: function () { if (this[0]) { var e, t, n = { top: 0, left: 0 }, r = this[0]; return "fixed" === b.css(r, "position") ? t = r.getBoundingClientRect() : (e = this.offsetParent(), t = this.offset(), b.nodeName(e[0], "html") || (n = e.offset()), n.top += b.css(e[0], "borderTopWidth", !0), n.left += b.css(e[0], "borderLeftWidth", !0)), { top: t.top - n.top - b.css(r, "marginTop", !0), left: t.left - n.left - b.css(r, "marginLeft", !0)} } }, offsetParent: function () { return this.map(function () { var e = this.offsetParent || o.documentElement; while (e && !b.nodeName(e, "html") && "static" === b.css(e, "position")) e = e.offsetParent; return e || o.documentElement }) } }), b.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (e, n) { var r = /Y/.test(n); b.fn[e] = function (i) { return b.access(this, function (e, i, o) { var a = or(e); return o === t ? a ? n in a ? a[n] : a.document.documentElement[i] : e[i] : (a ? a.scrollTo(r ? b(a).scrollLeft() : o, r ? o : b(a).scrollTop()) : e[i] = o, t) }, e, i, arguments.length, null) } }); function or(e) { return b.isWindow(e) ? e : 9 === e.nodeType ? e.defaultView || e.parentWindow : !1 } b.each({ Height: "height", Width: "width" }, function (e, n) { b.each({ padding: "inner" + e, content: n, "": "outer" + e }, function (r, i) { b.fn[i] = function (i, o) { var a = arguments.length && (r || "boolean" != typeof i), s = r || (i === !0 || o === !0 ? "margin" : "border"); return b.access(this, function (n, r, i) { var o; return b.isWindow(n) ? n.document.documentElement["client" + e] : 9 === n.nodeType ? (o = n.documentElement, Math.max(n.body["scroll" + e], o["scroll" + e], n.body["offset" + e], o["offset" + e], o["client" + e])) : i === t ? b.css(n, r, s) : b.style(n, r, i, s) }, n, a ? i : t, a, null) } }) }), e.jQuery = e.$ = b, "function" == typeof define && define.amd && define.amd.jQuery && define("jquery", [], function () { return b })
})(window); |
app/src/js/component/side-navigation/sidenav-quickaccess.js | enoa7/chart-account | import React from 'react';
export default class SideNavQuickAccess extends React.Component{
render() {
return (
<div className="sidenav-quickaccess">
<ul className="nodots">
<li className="">Quick Access</li>
<li className="">Financial Settings</li>
<li className="">Sales Tax</li>
<li className="">Charts of Account</li>
<li className="">Payments</li>
</ul>
</div>
)
}
} |
src/icons/IosComposeOutline.js | fbfeix/react-icons | import React from 'react';
import IconBase from './../components/IconBase/IconBase';
export default class IosComposeOutline extends React.Component {
render() {
if(this.props.bare) {
return <g>
<g>
<polygon points="368,416 80,416 80,144 304.117,144 320.117,128 64,128 64,432 384,432 384,191.883 368,207.883 "></polygon>
<polygon points="237.623,284.084 227.917,274.377 399.24,103.054 387.927,91.74 208,271.651 208,304 240.216,304 420.261,124.016
408.947,112.73 "></polygon>
<path d="M444.213,80.312l-12.465-12.466C429.084,65.467,425.556,64,421.746,64c-3.812,0-7.304,1.468-9.929,3.85L399.666,80
l0.08,0.08l11.293,11.293l21.02,21.02l12.15-12.15c2.383-2.625,3.791-6.117,3.791-9.929C448,86.504,446.592,82.975,444.213,80.312z
"></path>
</g>
</g>;
} return <IconBase>
<g>
<polygon points="368,416 80,416 80,144 304.117,144 320.117,128 64,128 64,432 384,432 384,191.883 368,207.883 "></polygon>
<polygon points="237.623,284.084 227.917,274.377 399.24,103.054 387.927,91.74 208,271.651 208,304 240.216,304 420.261,124.016
408.947,112.73 "></polygon>
<path d="M444.213,80.312l-12.465-12.466C429.084,65.467,425.556,64,421.746,64c-3.812,0-7.304,1.468-9.929,3.85L399.666,80
l0.08,0.08l11.293,11.293l21.02,21.02l12.15-12.15c2.383-2.625,3.791-6.117,3.791-9.929C448,86.504,446.592,82.975,444.213,80.312z
"></path>
</g>
</IconBase>;
}
};IosComposeOutline.defaultProps = {bare: false} |
components/LocationOutput.js | Hardyng/weatherforecast-nextjs-redux-ssr | import React from 'react';
import { connect } from 'react-redux';
import styled from 'styled-components';
const Container = styled.div`
display:flex;
align-items:center;
justify-content: center;
`
const Title = styled.h4`
`
const Text = styled.p`
margin: 4px 0;
line-height:16px;
`
class LocationOutput extends React.Component {
render() {
const { city, region, country } = this.props.localisation;
return (
<Container className="mdl-card mdl-cell mdl-cell--4-col mdl-cell--8-col-tablet mdl-shadow--2dp">
<Title>{city}</Title>
<Text>{region}</Text>
<Text>{country}</Text>
</Container>
);
}
}
export default connect(({localisation}) => ({ localisation}), null)(
LocationOutput
);
|
index.android.js | rjvani/agent | /**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
export default class agent extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('agent', () => agent);
|
jenkins-design-language/src/js/components/material-ui/svg-icons/av/add-to-queue.js | alvarolobato/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const AvAddToQueue = (props) => (
<SvgIcon {...props}>
<path d="M21 3H3c-1.11 0-2 .89-2 2v12c0 1.1.89 2 2 2h5v2h8v-2h5c1.1 0 1.99-.9 1.99-2L23 5c0-1.11-.9-2-2-2zm0 14H3V5h18v12zm-5-7v2h-3v3h-2v-3H8v-2h3V7h2v3h3z"/>
</SvgIcon>
);
AvAddToQueue.displayName = 'AvAddToQueue';
AvAddToQueue.muiName = 'SvgIcon';
export default AvAddToQueue;
|
ajax/libs/angular-data/0.10.3/angular-data.js | JohnKim/cdnjs | /**
* @author Jason Dobry <jason.dobry@gmail.com>
* @file angular-data.js
* @version 0.10.3 - Homepage <http://angular-data.pseudobry.com/>
* @copyright (c) 2014 Jason Dobry <https://github.com/jmdobry/>
* @license MIT <https://github.com/jmdobry/angular-data/blob/master/LICENSE>
*
* @overview Data store for Angular.js.
*/
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
// Copyright 2012 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.
// Modifications
// Copyright 2014 Jason Dobry
//
// Summary of modifications:
// Removed all code related to:
// - ArrayObserver
// - ArraySplice
// - PathObserver
// - CompoundObserver
// - Path
// - ObserverTransform
(function(global) {
'use strict';
// Detect and do basic sanity checking on Object/Array.observe.
function detectObjectObserve() {
if (typeof Object.observe !== 'function' ||
typeof Array.observe !== 'function') {
return false;
}
var records = [];
function callback(recs) {
records = recs;
}
var test = {};
var arr = [];
Object.observe(test, callback);
Array.observe(arr, callback);
test.id = 1;
test.id = 2;
delete test.id;
arr.push(1, 2);
arr.length = 0;
Object.deliverChangeRecords(callback);
if (records.length !== 5)
return false;
if (records[0].type != 'add' ||
records[1].type != 'update' ||
records[2].type != 'delete' ||
records[3].type != 'splice' ||
records[4].type != 'splice') {
return false;
}
Object.unobserve(test, callback);
Array.unobserve(arr, callback);
return true;
}
var hasObserve = detectObjectObserve();
function detectEval() {
// Don't test for eval if we're running in a Chrome App environment.
// We check for APIs set that only exist in a Chrome App context.
if (typeof chrome !== 'undefined' && chrome.app && chrome.app.runtime) {
return false;
}
try {
var f = new Function('', 'return true;');
return f();
} catch (ex) {
return false;
}
}
var hasEval = detectEval();
var createObject = ('__proto__' in {}) ?
function(obj) { return obj; } :
function(obj) {
var proto = obj.__proto__;
if (!proto)
return obj;
var newObject = Object.create(proto);
Object.getOwnPropertyNames(obj).forEach(function(name) {
Object.defineProperty(newObject, name,
Object.getOwnPropertyDescriptor(obj, name));
});
return newObject;
};
var MAX_DIRTY_CHECK_CYCLES = 1000;
function dirtyCheck(observer) {
var cycles = 0;
while (cycles < MAX_DIRTY_CHECK_CYCLES && observer.check_()) {
cycles++;
}
if (global.testingExposeCycleCount)
global.dirtyCheckCycleCount = cycles;
return cycles > 0;
}
function objectIsEmpty(object) {
for (var prop in object)
return false;
return true;
}
function diffIsEmpty(diff) {
return objectIsEmpty(diff.added) &&
objectIsEmpty(diff.removed) &&
objectIsEmpty(diff.changed);
}
function diffObjectFromOldObject(object, oldObject) {
var added = {};
var removed = {};
var changed = {};
for (var prop in oldObject) {
var newValue = object[prop];
if (newValue !== undefined && newValue === oldObject[prop])
continue;
if (!(prop in object)) {
removed[prop] = undefined;
continue;
}
if (newValue !== oldObject[prop])
changed[prop] = newValue;
}
for (var prop in object) {
if (prop in oldObject)
continue;
added[prop] = object[prop];
}
if (Array.isArray(object) && object.length !== oldObject.length)
changed.length = object.length;
return {
added: added,
removed: removed,
changed: changed
};
}
var eomTasks = [];
function runEOMTasks() {
if (!eomTasks.length)
return false;
for (var i = 0; i < eomTasks.length; i++) {
eomTasks[i]();
}
eomTasks.length = 0;
return true;
}
var runEOM = hasObserve ? (function(){
var eomObj = { pingPong: true };
var eomRunScheduled = false;
Object.observe(eomObj, function() {
runEOMTasks();
eomRunScheduled = false;
});
return function(fn) {
eomTasks.push(fn);
if (!eomRunScheduled) {
eomRunScheduled = true;
eomObj.pingPong = !eomObj.pingPong;
}
};
})() :
(function() {
return function(fn) {
eomTasks.push(fn);
};
})();
var observedObjectCache = [];
function newObservedObject() {
var observer;
var object;
var discardRecords = false;
var first = true;
function callback(records) {
if (observer && observer.state_ === OPENED && !discardRecords)
observer.check_(records);
}
return {
open: function(obs) {
if (observer)
throw Error('ObservedObject in use');
if (!first)
Object.deliverChangeRecords(callback);
observer = obs;
first = false;
},
observe: function(obj, arrayObserve) {
object = obj;
if (arrayObserve)
Array.observe(object, callback);
else
Object.observe(object, callback);
},
deliver: function(discard) {
discardRecords = discard;
Object.deliverChangeRecords(callback);
discardRecords = false;
},
close: function() {
observer = undefined;
Object.unobserve(object, callback);
observedObjectCache.push(this);
}
};
}
/*
* The observedSet abstraction is a perf optimization which reduces the total
* number of Object.observe observations of a set of objects. The idea is that
* groups of Observers will have some object dependencies in common and this
* observed set ensures that each object in the transitive closure of
* dependencies is only observed once. The observedSet acts as a write barrier
* such that whenever any change comes through, all Observers are checked for
* changed values.
*
* Note that this optimization is explicitly moving work from setup-time to
* change-time.
*
* TODO(rafaelw): Implement "garbage collection". In order to move work off
* the critical path, when Observers are closed, their observed objects are
* not Object.unobserve(d). As a result, it's possible that if the observedSet
* is kept open, but some Observers have been closed, it could cause "leaks"
* (prevent otherwise collectable objects from being collected). At some
* point, we should implement incremental "gc" which keeps a list of
* observedSets which may need clean-up and does small amounts of cleanup on a
* timeout until all is clean.
*/
function getObservedObject(observer, object, arrayObserve) {
var dir = observedObjectCache.pop() || newObservedObject();
dir.open(observer);
dir.observe(object, arrayObserve);
return dir;
}
var UNOPENED = 0;
var OPENED = 1;
var CLOSED = 2;
var nextObserverId = 1;
function Observer() {
this.state_ = UNOPENED;
this.callback_ = undefined;
this.target_ = undefined; // TODO(rafaelw): Should be WeakRef
this.directObserver_ = undefined;
this.value_ = undefined;
this.id_ = nextObserverId++;
}
Observer.prototype = {
open: function(callback, target) {
if (this.state_ != UNOPENED)
throw Error('Observer has already been opened.');
addToAll(this);
this.callback_ = callback;
this.target_ = target;
this.connect_();
this.state_ = OPENED;
return this.value_;
},
close: function() {
if (this.state_ != OPENED)
return;
removeFromAll(this);
this.disconnect_();
this.value_ = undefined;
this.callback_ = undefined;
this.target_ = undefined;
this.state_ = CLOSED;
},
deliver: function() {
if (this.state_ != OPENED)
return;
dirtyCheck(this);
},
report_: function(changes) {
try {
this.callback_.apply(this.target_, changes);
} catch (ex) {
Observer._errorThrownDuringCallback = true;
console.error('Exception caught during observer callback: ' +
(ex.stack || ex));
}
},
discardChanges: function() {
this.check_(undefined, true);
return this.value_;
}
}
var collectObservers = !hasObserve;
var allObservers;
Observer._allObserversCount = 0;
if (collectObservers) {
allObservers = [];
}
function addToAll(observer) {
Observer._allObserversCount++;
if (!collectObservers)
return;
allObservers.push(observer);
}
function removeFromAll(observer) {
Observer._allObserversCount--;
}
var runningMicrotaskCheckpoint = false;
var hasDebugForceFullDelivery = hasObserve && hasEval && (function() {
try {
eval('%RunMicrotasks()');
return true;
} catch (ex) {
return false;
}
})();
global.Platform = global.Platform || {};
global.Platform.performMicrotaskCheckpoint = function() {
if (runningMicrotaskCheckpoint)
return;
if (hasDebugForceFullDelivery) {
eval('%RunMicrotasks()');
return;
}
if (!collectObservers)
return;
runningMicrotaskCheckpoint = true;
var cycles = 0;
var anyChanged, toCheck;
do {
cycles++;
toCheck = allObservers;
allObservers = [];
anyChanged = false;
for (var i = 0; i < toCheck.length; i++) {
var observer = toCheck[i];
if (observer.state_ != OPENED)
continue;
if (observer.check_())
anyChanged = true;
allObservers.push(observer);
}
if (runEOMTasks())
anyChanged = true;
} while (cycles < MAX_DIRTY_CHECK_CYCLES && anyChanged);
if (global.testingExposeCycleCount)
global.dirtyCheckCycleCount = cycles;
runningMicrotaskCheckpoint = false;
};
if (collectObservers) {
global.Platform.clearObservers = function() {
allObservers = [];
};
}
function ObjectObserver(object) {
Observer.call(this);
this.value_ = object;
this.oldObject_ = undefined;
}
ObjectObserver.prototype = createObject({
__proto__: Observer.prototype,
arrayObserve: false,
connect_: function(callback, target) {
if (hasObserve) {
this.directObserver_ = getObservedObject(this, this.value_,
this.arrayObserve);
} else {
this.oldObject_ = this.copyObject(this.value_);
}
},
copyObject: function(object) {
var copy = Array.isArray(object) ? [] : {};
for (var prop in object) {
copy[prop] = object[prop];
};
if (Array.isArray(object))
copy.length = object.length;
return copy;
},
check_: function(changeRecords, skipChanges) {
var diff;
var oldValues;
if (hasObserve) {
if (!changeRecords)
return false;
oldValues = {};
diff = diffObjectFromChangeRecords(this.value_, changeRecords,
oldValues);
} else {
oldValues = this.oldObject_;
diff = diffObjectFromOldObject(this.value_, this.oldObject_);
}
if (diffIsEmpty(diff))
return false;
if (!hasObserve)
this.oldObject_ = this.copyObject(this.value_);
this.report_([
diff.added || {},
diff.removed || {},
diff.changed || {},
function(property) {
return oldValues[property];
}
]);
return true;
},
disconnect_: function() {
if (hasObserve) {
this.directObserver_.close();
this.directObserver_ = undefined;
} else {
this.oldObject_ = undefined;
}
},
deliver: function() {
if (this.state_ != OPENED)
return;
if (hasObserve)
this.directObserver_.deliver(false);
else
dirtyCheck(this);
},
discardChanges: function() {
if (this.directObserver_)
this.directObserver_.deliver(true);
else
this.oldObject_ = this.copyObject(this.value_);
return this.value_;
}
});
var observerSentinel = {};
var expectedRecordTypes = {
add: true,
update: true,
delete: true
};
function diffObjectFromChangeRecords(object, changeRecords, oldValues) {
var added = {};
var removed = {};
for (var i = 0; i < changeRecords.length; i++) {
var record = changeRecords[i];
if (!expectedRecordTypes[record.type]) {
console.error('Unknown changeRecord type: ' + record.type);
console.error(record);
continue;
}
if (!(record.name in oldValues))
oldValues[record.name] = record.oldValue;
if (record.type == 'update')
continue;
if (record.type == 'add') {
if (record.name in removed)
delete removed[record.name];
else
added[record.name] = true;
continue;
}
// type = 'delete'
if (record.name in added) {
delete added[record.name];
delete oldValues[record.name];
} else {
removed[record.name] = true;
}
}
for (var prop in added)
added[prop] = object[prop];
for (var prop in removed)
removed[prop] = undefined;
var changed = {};
for (var prop in oldValues) {
if (prop in added || prop in removed)
continue;
var newValue = object[prop];
if (oldValues[prop] !== newValue)
changed[prop] = newValue;
}
return {
added: added,
removed: removed,
changed: changed
};
}
global.Observer = Observer;
global.Observer.runEOM_ = runEOM;
global.Observer.observerSentinel_ = observerSentinel; // for testing.
global.Observer.hasObjectObserve = hasObserve;
global.ObjectObserver = ObjectObserver;
})((exports.Number = { isNaN: window.isNaN }) ? exports : exports);
},{}],2:[function(require,module,exports){
var indexOf = require('./indexOf');
/**
* If array contains values.
*/
function contains(arr, val) {
return indexOf(arr, val) !== -1;
}
module.exports = contains;
},{"./indexOf":5}],3:[function(require,module,exports){
var makeIterator = require('../function/makeIterator_');
/**
* Array filter
*/
function filter(arr, callback, thisObj) {
callback = makeIterator(callback, thisObj);
var results = [];
if (arr == null) {
return results;
}
var i = -1, len = arr.length, value;
while (++i < len) {
value = arr[i];
if (callback(value, i, arr)) {
results.push(value);
}
}
return results;
}
module.exports = filter;
},{"../function/makeIterator_":11}],4:[function(require,module,exports){
/**
* Array forEach
*/
function forEach(arr, callback, thisObj) {
if (arr == null) {
return;
}
var i = -1,
len = arr.length;
while (++i < len) {
// we iterate over sparse items since there is no way to make it
// work properly on IE 7-8. see #64
if ( callback.call(thisObj, arr[i], i, arr) === false ) {
break;
}
}
}
module.exports = forEach;
},{}],5:[function(require,module,exports){
/**
* Array.indexOf
*/
function indexOf(arr, item, fromIndex) {
fromIndex = fromIndex || 0;
if (arr == null) {
return -1;
}
var len = arr.length,
i = fromIndex < 0 ? len + fromIndex : fromIndex;
while (i < len) {
// we iterate over sparse items since there is no way to make it
// work properly on IE 7-8. see #64
if (arr[i] === item) {
return i;
}
i++;
}
return -1;
}
module.exports = indexOf;
},{}],6:[function(require,module,exports){
var filter = require('./filter');
function isValidString(val) {
return (val != null && val !== '');
}
/**
* Joins strings with the specified separator inserted between each value.
* Null values and empty strings will be excluded.
*/
function join(items, separator) {
separator = separator || '';
return filter(items, isValidString).join(separator);
}
module.exports = join;
},{"./filter":3}],7:[function(require,module,exports){
/**
* Create slice of source array or array-like object
*/
function slice(arr, start, end){
var len = arr.length;
if (start == null) {
start = 0;
} else if (start < 0) {
start = Math.max(len + start, 0);
} else {
start = Math.min(start, len);
}
if (end == null) {
end = len;
} else if (end < 0) {
end = Math.max(len + end, 0);
} else {
end = Math.min(end, len);
}
var result = [];
while (start < end) {
result.push(arr[start++]);
}
return result;
}
module.exports = slice;
},{}],8:[function(require,module,exports){
/**
* Merge sort (http://en.wikipedia.org/wiki/Merge_sort)
*/
function mergeSort(arr, compareFn) {
if (arr == null) {
return [];
} else if (arr.length < 2) {
return arr;
}
if (compareFn == null) {
compareFn = defaultCompare;
}
var mid, left, right;
mid = ~~(arr.length / 2);
left = mergeSort( arr.slice(0, mid), compareFn );
right = mergeSort( arr.slice(mid, arr.length), compareFn );
return merge(left, right, compareFn);
}
function defaultCompare(a, b) {
return a < b ? -1 : (a > b? 1 : 0);
}
function merge(left, right, compareFn) {
var result = [];
while (left.length && right.length) {
if (compareFn(left[0], right[0]) <= 0) {
// if 0 it should preserve same order (stable)
result.push(left.shift());
} else {
result.push(right.shift());
}
}
if (left.length) {
result.push.apply(result, left);
}
if (right.length) {
result.push.apply(result, right);
}
return result;
}
module.exports = mergeSort;
},{}],9:[function(require,module,exports){
var isFunction = require('../lang/isFunction');
/**
* Creates an object that holds a lookup for the objects in the array.
*/
function toLookup(arr, key) {
var result = {};
if (arr == null) {
return result;
}
var i = -1, len = arr.length, value;
if (isFunction(key)) {
while (++i < len) {
value = arr[i];
result[key(value)] = value;
}
} else {
while (++i < len) {
value = arr[i];
result[value[key]] = value;
}
}
return result;
}
module.exports = toLookup;
},{"../lang/isFunction":16}],10:[function(require,module,exports){
/**
* Returns the first argument provided to it.
*/
function identity(val){
return val;
}
module.exports = identity;
},{}],11:[function(require,module,exports){
var identity = require('./identity');
var prop = require('./prop');
var deepMatches = require('../object/deepMatches');
/**
* Converts argument into a valid iterator.
* Used internally on most array/object/collection methods that receives a
* callback/iterator providing a shortcut syntax.
*/
function makeIterator(src, thisObj){
if (src == null) {
return identity;
}
switch(typeof src) {
case 'function':
// function is the first to improve perf (most common case)
// also avoid using `Function#call` if not needed, which boosts
// perf a lot in some cases
return (typeof thisObj !== 'undefined')? function(val, i, arr){
return src.call(thisObj, val, i, arr);
} : src;
case 'object':
return function(val){
return deepMatches(val, src);
};
case 'string':
case 'number':
return prop(src);
}
}
module.exports = makeIterator;
},{"../object/deepMatches":21,"./identity":10,"./prop":12}],12:[function(require,module,exports){
/**
* Returns a function that gets a property of the passed object
*/
function prop(name){
return function(obj){
return obj[name];
};
}
module.exports = prop;
},{}],13:[function(require,module,exports){
var isKind = require('./isKind');
/**
*/
var isArray = Array.isArray || function (val) {
return isKind(val, 'Array');
};
module.exports = isArray;
},{"./isKind":17}],14:[function(require,module,exports){
var isKind = require('./isKind');
/**
*/
function isBoolean(val) {
return isKind(val, 'Boolean');
}
module.exports = isBoolean;
},{"./isKind":17}],15:[function(require,module,exports){
var forOwn = require('../object/forOwn');
var isArray = require('./isArray');
function isEmpty(val){
if (val == null) {
// typeof null == 'object' so we check it first
return false;
} else if ( typeof val === 'string' || isArray(val) ) {
return !val.length;
} else if ( typeof val === 'object' || typeof val === 'function' ) {
var result = true;
forOwn(val, function(){
result = false;
return false; // break loop
});
return result;
} else {
return false;
}
}
module.exports = isEmpty;
},{"../object/forOwn":24,"./isArray":13}],16:[function(require,module,exports){
var isKind = require('./isKind');
/**
*/
function isFunction(val) {
return isKind(val, 'Function');
}
module.exports = isFunction;
},{"./isKind":17}],17:[function(require,module,exports){
var kindOf = require('./kindOf');
/**
* Check if value is from a specific "kind".
*/
function isKind(val, kind){
return kindOf(val) === kind;
}
module.exports = isKind;
},{"./kindOf":19}],18:[function(require,module,exports){
/**
* Checks if the value is created by the `Object` constructor.
*/
function isPlainObject(value) {
return (!!value && typeof value === 'object' &&
value.constructor === Object);
}
module.exports = isPlainObject;
},{}],19:[function(require,module,exports){
var _rKind = /^\[object (.*)\]$/,
_toString = Object.prototype.toString,
UNDEF;
/**
* Gets the "kind" of value. (e.g. "String", "Number", etc)
*/
function kindOf(val) {
if (val === null) {
return 'Null';
} else if (val === UNDEF) {
return 'Undefined';
} else {
return _rKind.exec( _toString.call(val) )[1];
}
}
module.exports = kindOf;
},{}],20:[function(require,module,exports){
/**
* Typecast a value to a String, using an empty string value for null or
* undefined.
*/
function toString(val){
return val == null ? '' : val.toString();
}
module.exports = toString;
},{}],21:[function(require,module,exports){
var forOwn = require('./forOwn');
var isArray = require('../lang/isArray');
function containsMatch(array, pattern) {
var i = -1, length = array.length;
while (++i < length) {
if (deepMatches(array[i], pattern)) {
return true;
}
}
return false;
}
function matchArray(target, pattern) {
var i = -1, patternLength = pattern.length;
while (++i < patternLength) {
if (!containsMatch(target, pattern[i])) {
return false;
}
}
return true;
}
function matchObject(target, pattern) {
var result = true;
forOwn(pattern, function(val, key) {
if (!deepMatches(target[key], val)) {
// Return false to break out of forOwn early
return (result = false);
}
});
return result;
}
/**
* Recursively check if the objects match.
*/
function deepMatches(target, pattern){
if (target && typeof target === 'object') {
if (isArray(target) && isArray(pattern)) {
return matchArray(target, pattern);
} else {
return matchObject(target, pattern);
}
} else {
return target === pattern;
}
}
module.exports = deepMatches;
},{"../lang/isArray":13,"./forOwn":24}],22:[function(require,module,exports){
var forOwn = require('./forOwn');
var isPlainObject = require('../lang/isPlainObject');
/**
* Mixes objects into the target object, recursively mixing existing child
* objects.
*/
function deepMixIn(target, objects) {
var i = 0,
n = arguments.length,
obj;
while(++i < n){
obj = arguments[i];
if (obj) {
forOwn(obj, copyProp, target);
}
}
return target;
}
function copyProp(val, key) {
var existing = this[key];
if (isPlainObject(val) && isPlainObject(existing)) {
deepMixIn(existing, val);
} else {
this[key] = val;
}
}
module.exports = deepMixIn;
},{"../lang/isPlainObject":18,"./forOwn":24}],23:[function(require,module,exports){
var hasOwn = require('./hasOwn');
var _hasDontEnumBug,
_dontEnums;
function checkDontEnum(){
_dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
];
_hasDontEnumBug = true;
for (var key in {'toString': null}) {
_hasDontEnumBug = false;
}
}
/**
* Similar to Array/forEach but works over object properties and fixes Don't
* Enum bug on IE.
* based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
*/
function forIn(obj, fn, thisObj){
var key, i = 0;
// no need to check if argument is a real object that way we can use
// it for arrays, functions, date, etc.
//post-pone check till needed
if (_hasDontEnumBug == null) checkDontEnum();
for (key in obj) {
if (exec(fn, obj, key, thisObj) === false) {
break;
}
}
if (_hasDontEnumBug) {
var ctor = obj.constructor,
isProto = !!ctor && obj === ctor.prototype;
while (key = _dontEnums[i++]) {
// For constructor, if it is a prototype object the constructor
// is always non-enumerable unless defined otherwise (and
// enumerated above). For non-prototype objects, it will have
// to be defined on this object, since it cannot be defined on
// any prototype objects.
//
// For other [[DontEnum]] properties, check if the value is
// different than Object prototype value.
if (
(key !== 'constructor' ||
(!isProto && hasOwn(obj, key))) &&
obj[key] !== Object.prototype[key]
) {
if (exec(fn, obj, key, thisObj) === false) {
break;
}
}
}
}
}
function exec(fn, obj, key, thisObj){
return fn.call(thisObj, obj[key], key, obj);
}
module.exports = forIn;
},{"./hasOwn":25}],24:[function(require,module,exports){
var hasOwn = require('./hasOwn');
var forIn = require('./forIn');
/**
* Similar to Array/forEach but works over object properties and fixes Don't
* Enum bug on IE.
* based on: http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
*/
function forOwn(obj, fn, thisObj){
forIn(obj, function(val, key){
if (hasOwn(obj, key)) {
return fn.call(thisObj, obj[key], key, obj);
}
});
}
module.exports = forOwn;
},{"./forIn":23,"./hasOwn":25}],25:[function(require,module,exports){
/**
* Safer Object.hasOwnProperty
*/
function hasOwn(obj, prop){
return Object.prototype.hasOwnProperty.call(obj, prop);
}
module.exports = hasOwn;
},{}],26:[function(require,module,exports){
var forEach = require('../array/forEach');
/**
* Create nested object if non-existent
*/
function namespace(obj, path){
if (!path) return obj;
forEach(path.split('.'), function(key){
if (!obj[key]) {
obj[key] = {};
}
obj = obj[key];
});
return obj;
}
module.exports = namespace;
},{"../array/forEach":4}],27:[function(require,module,exports){
var slice = require('../array/slice');
/**
* Return a copy of the object, filtered to only have values for the whitelisted keys.
*/
function pick(obj, var_keys){
var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1),
out = {},
i = 0, key;
while (key = keys[i++]) {
out[key] = obj[key];
}
return out;
}
module.exports = pick;
},{"../array/slice":7}],28:[function(require,module,exports){
var namespace = require('./namespace');
/**
* set "nested" object property
*/
function set(obj, prop, val){
var parts = (/^(.+)\.(.+)$/).exec(prop);
if (parts){
namespace(obj, parts[1])[parts[2]] = val;
} else {
obj[prop] = val;
}
}
module.exports = set;
},{"./namespace":26}],29:[function(require,module,exports){
var toString = require('../lang/toString');
var replaceAccents = require('./replaceAccents');
var removeNonWord = require('./removeNonWord');
var upperCase = require('./upperCase');
var lowerCase = require('./lowerCase');
/**
* Convert string to camelCase text.
*/
function camelCase(str){
str = toString(str);
str = replaceAccents(str);
str = removeNonWord(str)
.replace(/[\-_]/g, ' ') //convert all hyphens and underscores to spaces
.replace(/\s[a-z]/g, upperCase) //convert first char of each word to UPPERCASE
.replace(/\s+/g, '') //remove spaces
.replace(/^[A-Z]/g, lowerCase); //convert first char to lowercase
return str;
}
module.exports = camelCase;
},{"../lang/toString":20,"./lowerCase":30,"./removeNonWord":33,"./replaceAccents":34,"./upperCase":35}],30:[function(require,module,exports){
var toString = require('../lang/toString');
/**
* "Safer" String.toLowerCase()
*/
function lowerCase(str){
str = toString(str);
return str.toLowerCase();
}
module.exports = lowerCase;
},{"../lang/toString":20}],31:[function(require,module,exports){
var join = require('../array/join');
var slice = require('../array/slice');
/**
* Group arguments as path segments, if any of the args is `null` or an
* empty string it will be ignored from resulting path.
*/
function makePath(var_args){
var result = join(slice(arguments), '/');
// need to disconsider duplicate '/' after protocol (eg: 'http://')
return result.replace(/([^:\/]|^)\/{2,}/g, '$1/');
}
module.exports = makePath;
},{"../array/join":6,"../array/slice":7}],32:[function(require,module,exports){
var toString = require('../lang/toString');
var camelCase = require('./camelCase');
var upperCase = require('./upperCase');
/**
* camelCase + UPPERCASE first char
*/
function pascalCase(str){
str = toString(str);
return camelCase(str).replace(/^[a-z]/, upperCase);
}
module.exports = pascalCase;
},{"../lang/toString":20,"./camelCase":29,"./upperCase":35}],33:[function(require,module,exports){
var toString = require('../lang/toString');
// This pattern is generated by the _build/pattern-removeNonWord.js script
var PATTERN = /[^\x20\x2D0-9A-Z\x5Fa-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]/g;
/**
* Remove non-word chars.
*/
function removeNonWord(str){
str = toString(str);
return str.replace(PATTERN, '');
}
module.exports = removeNonWord;
},{"../lang/toString":20}],34:[function(require,module,exports){
var toString = require('../lang/toString');
/**
* Replaces all accented chars with regular ones
*/
function replaceAccents(str){
str = toString(str);
// verifies if the String has accents and replace them
if (str.search(/[\xC0-\xFF]/g) > -1) {
str = str
.replace(/[\xC0-\xC5]/g, "A")
.replace(/[\xC6]/g, "AE")
.replace(/[\xC7]/g, "C")
.replace(/[\xC8-\xCB]/g, "E")
.replace(/[\xCC-\xCF]/g, "I")
.replace(/[\xD0]/g, "D")
.replace(/[\xD1]/g, "N")
.replace(/[\xD2-\xD6\xD8]/g, "O")
.replace(/[\xD9-\xDC]/g, "U")
.replace(/[\xDD]/g, "Y")
.replace(/[\xDE]/g, "P")
.replace(/[\xE0-\xE5]/g, "a")
.replace(/[\xE6]/g, "ae")
.replace(/[\xE7]/g, "c")
.replace(/[\xE8-\xEB]/g, "e")
.replace(/[\xEC-\xEF]/g, "i")
.replace(/[\xF1]/g, "n")
.replace(/[\xF2-\xF6\xF8]/g, "o")
.replace(/[\xF9-\xFC]/g, "u")
.replace(/[\xFE]/g, "p")
.replace(/[\xFD\xFF]/g, "y");
}
return str;
}
module.exports = replaceAccents;
},{"../lang/toString":20}],35:[function(require,module,exports){
var toString = require('../lang/toString');
/**
* "Safer" String.toUpperCase()
*/
function upperCase(str){
str = toString(str);
return str.toUpperCase();
}
module.exports = upperCase;
},{"../lang/toString":20}],36:[function(require,module,exports){
/**
* @doc function
* @id DSHttpAdapterProvider
* @name DSHttpAdapterProvider
*/
function DSHttpAdapterProvider() {
/**
* @doc property
* @id DSHttpAdapterProvider.properties:defaults
* @name defaults
* @description
* Default configuration for this adapter.
*
* Properties:
*
* - `{function}` - `queryTransform` - See [the guide](/documentation/guide/adapters/index). Default: No-op.
*/
var defaults = this.defaults = {
/**
* @doc property
* @id DSHttpAdapterProvider.properties:defaults.queryTransform
* @name defaults.queryTransform
* @description
* Transform the angular-data query to something your server understands. You might just do this on the server instead.
*
* @param {string} resourceName The name of the resource.
* @param {object} params Params sent through from `$http()`.
* @returns {*} Returns `params` as-is.
*/
queryTransform: function (resourceName, params) {
return params;
}
};
this.$get = ['$http', '$log', 'DSUtils', function ($http, $log, DSUtils) {
/**
* @doc interface
* @id DSHttpAdapter
* @name DSHttpAdapter
* @description
* Default adapter used by angular-data. This adapter uses AJAX and JSON to send/retrieve data to/from a server.
* Developers may provide custom adapters that implement the adapter interface.
*/
return {
/**
* @doc property
* @id DSHttpAdapter.properties:defaults
* @name defaults
* @description
* Reference to [DSHttpAdapterProvider.defaults](/documentation/api/api/DSHttpAdapterProvider.properties:defaults).
*/
defaults: defaults,
/**
* @doc method
* @id DSHttpAdapter.methods:HTTP
* @name HTTP
* @description
* Wrapper for `$http()`.
*
* ## Signature:
* ```js
* DS.HTTP(config)
* ```
*
* ## Example:
*
* ```js
* works the same as $http()
* ```
*
* @param {object} config Configuration for the request.
* @returns {Promise} Promise produced by the `$q` service.
*/
HTTP: HTTP,
/**
* @doc method
* @id DSHttpAdapter.methods:GET
* @name GET
* @description
* Wrapper for `$http.get()`.
*
* ## Signature:
* ```js
* DS.GET(url[, config])
* ```
*
* ## Example:
*
* ```js
* Works the same as $http.get()
* ```
*
* @param {string} url The url of the request.
* @param {object=} config Configuration for the request.
* @returns {Promise} Promise produced by the `$q` service.
*/
GET: GET,
/**
* @doc method
* @id DSHttpAdapter.methods:POST
* @name POST
* @description
* Wrapper for `$http.post()`.
*
* ## Signature:
* ```js
* DS.POST(url[, attrs][, config])
* ```
*
* ## Example:
*
* ```js
* Works the same as $http.post()
* ```
*
* @param {string} url The url of the request.
* @param {object=} attrs Request payload.
* @param {object=} config Configuration for the request.
* @returns {Promise} Promise produced by the `$q` service.
*/
POST: POST,
/**
* @doc method
* @id DSHttpAdapter.methods:PUT
* @name PUT
* @description
* Wrapper for `$http.put()`.
*
* ## Signature:
* ```js
* DS.PUT(url[, attrs][, config])
* ```
*
* ## Example:
*
* ```js
* Works the same as $http.put()
* ```
*
* @param {string} url The url of the request.
* @param {object=} attrs Request payload.
* @param {object=} config Configuration for the request.
* @returns {Promise} Promise produced by the `$q` service.
*/
PUT: PUT,
/**
* @doc method
* @id DSHttpAdapter.methods:DEL
* @name DEL
* @description
* Wrapper for `$http.delete()`.
*
* ## Signature:
* ```js
* DS.DEL(url[, config])
* ```
*
* ## Example:
*
* ```js
* Works the same as $http.delete
* ```
*
* @param {string} url The url of the request.
* @param {object} config Configuration for the request.
* @returns {Promise} Promise produced by the `$q` service.
*/
DEL: DEL,
/**
* @doc method
* @id DSHttpAdapter.methods:find
* @name find
* @description
* Retrieve a single entity from the server.
*
* Sends a `GET` request to `:baseUrl/:endpoint/:id`.
*
* @param {object} resourceConfig Properties:
* - `{string}` - `baseUrl` - Base url.
* - `{string=}` - `endpoint` - Endpoint path for the resource.
* @param {string|number} id The primary key of the entity to retrieve.
* @param {object=} options Optional configuration. Refer to the documentation for `$http.get`.
* @returns {Promise} Promise.
*/
find: find,
/**
* @doc method
* @id DSHttpAdapter.methods:findAll
* @name findAll
* @description
* Retrieve a collection of entities from the server.
*
* Sends a `GET` request to `:baseUrl/:endpoint`.
*
*
* @param {object} resourceConfig Properties:
* - `{string}` - `baseUrl` - Base url.
* - `{string=}` - `endpoint` - Endpoint path for the resource.
* @param {object=} params Search query parameters. See the [query guide](/documentation/guide/queries/index).
* @param {object=} options Optional configuration. Refer to the documentation for `$http.get`.
* @returns {Promise} Promise.
*/
findAll: findAll,
/**
* @doc method
* @id DSHttpAdapter.methods:findAll
* @name find
* @description
* Create a new entity on the server.
*
* Sends a `POST` request to `:baseUrl/:endpoint`.
*
* @param {object} resourceConfig Properties:
* - `{string}` - `baseUrl` - Base url.
* - `{string=}` - `endpoint` - Endpoint path for the resource.
* @param {object=} params Search query parameters. See the [query guide](/documentation/guide/queries/index).
* @param {object=} options Optional configuration. Refer to the documentation for `$http.post`.
* @returns {Promise} Promise.
*/
create: create,
/**
* @doc method
* @id DSHttpAdapter.methods:update
* @name update
* @description
* Update an entity on the server.
*
* Sends a `PUT` request to `:baseUrl/:endpoint/:id`.
*
* @param {object} resourceConfig Properties:
* - `{string}` - `baseUrl` - Base url.
* - `{string=}` - `endpoint` - Endpoint path for the resource.
* @param {string|number} id The primary key of the entity to update.
* @param {object} attrs The attributes with which to update the entity. See the [query guide](/documentation/guide/queries/index).
* @param {object=} options Optional configuration. Refer to the documentation for `$http.put`.
* @returns {Promise} Promise.
*/
update: update,
/**
* @doc method
* @id DSHttpAdapter.methods:updateAll
* @name updateAll
* @description
* Update a collection of entities on the server.
*
* Sends a `PUT` request to `:baseUrl/:endpoint`.
*
*
* @param {object} resourceConfig Properties:
* - `{string}` - `baseUrl` - Base url.
* - `{string=}` - `endpoint` - Endpoint path for the resource.
* @param {object=} params Search query parameters. See the [query guide](/documentation/guide/queries/index).
* @param {object=} options Optional configuration. Refer to the documentation for `$http.put`.
* @returns {Promise} Promise.
*/
updateAll: updateAll,
/**
* @doc method
* @id DSHttpAdapter.methods:destroy
* @name destroy
* @description
* destroy an entity on the server.
*
* Sends a `PUT` request to `:baseUrl/:endpoint/:id`.
*
* @param {object} resourceConfig Properties:
* - `{string}` - `baseUrl` - Base url.
* - `{string=}` - `endpoint` - Endpoint path for the resource.
* @param {string|number} id The primary key of the entity to destroy.
* @param {object=} options Optional configuration. Refer to the documentation for `$http.delete`.
* @returns {Promise} Promise.
*/
destroy: destroy,
/**
* @doc method
* @id DSHttpAdapter.methods:destroyAll
* @name destroyAll
* @description
* Retrieve a collection of entities from the server.
*
* Sends a `DELETE` request to `:baseUrl/:endpoint`.
*
*
* @param {object} resourceConfig Properties:
* - `{string}` - `baseUrl` - Base url.
* - `{string=}` - `endpoint` - Endpoint path for the resource.
* @param {object=} params Search query parameters. See the [query guide](/documentation/guide/queries/index).
* @param {object=} options Optional configuration. Refer to the documentation for `$http.delete`.
* @returns {Promise} Promise.
*/
destroyAll: destroyAll
};
function HTTP(config) {
var start = new Date().getTime();
return $http(config).then(function (data) {
$log.debug(data.config.method + ' request:' + data.config.url + ' Time taken: ' + (new Date().getTime() - start) + 'ms', arguments);
return data;
});
}
function GET(url, config) {
config = config || {};
return HTTP(DSUtils.deepMixIn(config, {
url: url,
method: 'GET'
}));
}
function POST(url, attrs, config) {
config = config || {};
return HTTP(DSUtils.deepMixIn(config, {
url: url,
data: attrs,
method: 'POST'
}));
}
function PUT(url, attrs, config) {
config = config || {};
return HTTP(DSUtils.deepMixIn(config, {
url: url,
data: attrs,
method: 'PUT'
}));
}
function DEL(url, config) {
config = config || {};
return this.HTTP(DSUtils.deepMixIn(config, {
url: url,
method: 'DELETE'
}));
}
function create(resourceConfig, attrs, options) {
options = options || {};
return this.POST(
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
attrs,
options
);
}
function destroy(resourceConfig, id, options) {
options = options || {};
return this.DEL(
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
options
);
}
function destroyAll(resourceConfig, params, options) {
options = options || {};
options.params = options.params || {};
if (params) {
params = defaults.queryTransform(resourceConfig.name, params);
DSUtils.deepMixIn(options.params, params);
}
return this.DEL(
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
options
);
}
function find(resourceConfig, id, options) {
options = options || {};
return this.GET(
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
options
);
}
function findAll(resourceConfig, params, options) {
options = options || {};
options.params = options.params || {};
if (params) {
params = defaults.queryTransform(resourceConfig.name, params);
DSUtils.deepMixIn(options.params, params);
}
return this.GET(
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
options
);
}
function update(resourceConfig, id, attrs, options) {
options = options || {};
return this.PUT(
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
attrs,
options
);
}
function updateAll(resourceConfig, attrs, params, options) {
options = options || {};
options.params = options.params || {};
if (params) {
params = defaults.queryTransform(resourceConfig.name, params);
DSUtils.deepMixIn(options.params, params);
}
return this.PUT(
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint),
attrs,
options
);
}
}];
}
module.exports = DSHttpAdapterProvider;
},{}],37:[function(require,module,exports){
/**
* @doc function
* @id DSLocalStorageProvider
* @name DSLocalStorageProvider
*/
function DSLocalStorageProvider() {
this.$get = ['$q', 'DSUtils', function ($q, DSUtils) {
/**
* @doc interface
* @id DSLocalStorage
* @name DSLocalStorage
* @description
* Default adapter used by angular-data. This adapter uses AJAX and JSON to send/retrieve data to/from a server.
* Developers may provide custom adapters that implement the adapter interface.
*/
return {
/**
* @doc method
* @id DSLocalStorage.methods:find
* @name find
* @description
* Retrieve a single entity from localStorage.
*
* Calls `localStorage.getItem(key)`.
*
* @param {object} resourceConfig Properties:
* - `{string}` - `baseUrl` - Base url.
* - `{string=}` - `namespace` - Namespace path for the resource.
* @param {string|number} id The primary key of the entity to retrieve.
* @returns {Promise} Promise.
*/
find: find,
/**
* @doc method
* @id DSLocalStorage.methods:findAll
* @name findAll
* @description
* Not supported.
*/
findAll: function () {
throw new Error('Not supported!');
},
/**
* @doc method
* @id DSLocalStorage.methods:findAll
* @name find
* @description
* Not supported.
*/
create: function () {
throw new Error('Not supported!');
},
/**
* @doc method
* @id DSLocalStorage.methods:update
* @name update
* @description
* Update an entity in localStorage.
*
* Calls `localStorage.setItem(key, value)`.
*
* @param {object} resourceConfig Properties:
* - `{string}` - `baseUrl` - Base url.
* - `{string=}` - `namespace` - Namespace path for the resource.
* @param {string|number} id The primary key of the entity to update.
* @param {object} attrs The attributes with which to update the entity.
* @returns {Promise} Promise.
*/
update: update,
/**
* @doc method
* @id DSLocalStorage.methods:updateAll
* @name updateAll
* @description
* Not supported.
*/
updateAll: function () {
throw new Error('Not supported!');
},
/**
* @doc method
* @id DSLocalStorage.methods:destroy
* @name destroy
* @description
* Destroy an entity from localStorage.
*
* Calls `localStorage.removeItem(key)`.
*
* @param {object} resourceConfig Properties:
* - `{string}` - `baseUrl` - Base url.
* - `{string=}` - `endpoint` - Endpoint path for the resource.
* @param {string|number} id The primary key of the entity to destroy.
* @returns {Promise} Promise.
*/
destroy: destroy,
/**
* @doc method
* @id DSLocalStorage.methods:destroyAll
* @name destroyAll
* @description
* Not supported.
*/
destroyAll: function () {
throw new Error('Not supported!');
}
};
function GET(key) {
var deferred = $q.defer();
try {
var item = localStorage.getItem(key);
deferred.resolve(item ? angular.fromJson(item) : undefined);
} catch (err) {
deferred.reject(err);
}
return deferred.promise;
}
function PUT(key, value) {
var deferred = $q.defer();
try {
var item = localStorage.getItem(key);
if (item) {
item = angular.fromJson(item);
DSUtils.deepMixIn(item, value);
deferred.resolve(localStorage.setItem(key, angular.toJson(item)));
} else {
deferred.resolve(localStorage.setItem(key, angular.toJson(value)));
}
} catch (err) {
deferred.reject(err);
}
return deferred.promise;
}
function DEL(key) {
var deferred = $q.defer();
try {
deferred.resolve(localStorage.removeItem(key));
} catch (err) {
deferred.reject(err);
}
return deferred.promise;
}
function destroy(resourceConfig, id, options) {
options = options || {};
return DEL(
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
options
);
}
function find(resourceConfig, id, options) {
options = options || {};
return GET(
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
options
);
}
function update(resourceConfig, id, attrs, options) {
options = options || {};
return PUT(
DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id),
attrs,
options
).then(function () {
return GET(DSUtils.makePath(options.baseUrl || resourceConfig.baseUrl, resourceConfig.endpoint, id));
});
}
}];
}
module.exports = DSLocalStorageProvider;
},{}],38:[function(require,module,exports){
var errorPrefix = 'DS.create(resourceName, attrs[, options]): ';
/**
* @doc method
* @id DS.async_methods:create
* @name create
* @description
* Create a new resource and save it to the server.
*
* ## Signature:
* ```js
* DS.create(resourceName, attrs[, options])
* ```
*
* ## Example:
*
* ```js
* DS.create('document', { author: 'John Anderson' })
* .then(function (document) {
* document; // { id: 'aab7ff66-e21e-46e2-8be8-264d82aee535', author: 'John Anderson' }
*
* // The new document is already in the data store
* DS.get('document', document.id); // { id: 'aab7ff66-e21e-46e2-8be8-264d82aee535', author: 'John Anderson' }
* }, function (err) {
* // handle error
* });
* ```
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {object} attrs The attributes with which to update the item of the type specified by `resourceName` that has
* the primary key specified by `id`.
* @param {object=} options Configuration options. Properties:
*
* - `{boolean=}` - `cacheResponse` - Inject the data returned by the server into the data store. Default: `true`.
*
* @returns {Promise} Promise produced by the `$q` service.
*
* ## Resolves with:
*
* - `{object}` - `item` - A reference to the newly created item.
*
* ## Rejects with:
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*/
function create(resourceName, attrs, options) {
var deferred = this.$q.defer();
var promise = deferred.promise;
try {
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isObject(attrs)) {
throw new this.errors.IA(errorPrefix + 'attrs: Must be an object!');
}
var definition = this.definitions[resourceName];
var resource = this.store[resourceName];
var _this = this;
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
promise = promise
.then(function (attrs) {
return _this.$q.promisify(definition.beforeValidate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.validate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.afterValidate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.beforeCreate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.adapters[options.adapter || definition.defaultAdapter].create(definition, definition.serialize(resourceName, attrs), options);
})
.then(function (res) {
return _this.$q.promisify(definition.afterCreate)(resourceName, definition.deserialize(resourceName, res));
})
.then(function (data) {
if (options.cacheResponse) {
var created = _this.inject(definition.name, data);
var id = created[definition.idAttribute];
resource.completedQueries[id] = new Date().getTime();
resource.previousAttributes[id] = _this.utils.deepMixIn({}, created);
resource.saved[id] = _this.utils.updateTimestamp(resource.saved[id]);
return _this.get(definition.name, id);
} else {
return data;
}
});
deferred.resolve(attrs);
} catch (err) {
deferred.reject(err);
}
return promise;
}
module.exports = create;
},{}],39:[function(require,module,exports){
var errorPrefix = 'DS.destroy(resourceName, id): ';
/**
* @doc method
* @id DS.async_methods:destroy
* @name destroy
* @description
* Delete the item of the type specified by `resourceName` with the primary key specified by `id` from the data store
* and the server.
*
* ## Signature:
* ```js
* DS.destroy(resourceName, id);
* ```
*
* ## Example:
*
* ```js
* DS.destroy('document', 'aab7ff66-e21e-46e2-8be8-264d82aee535')
* .then(function (id) {
* id; // 'aab7ff66-e21e-46e2-8be8-264d82aee535'
*
* // The document is gone
* DS.get('document', 'aab7ff66-e21e-46e2-8be8-264d82aee535'); // undefined
* }, function (err) {
* // Handle error
* });
* ```
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item to remove.
* @param {object=} options Configuration options.
* @returns {Promise} Promise produced by the `$q` service.
*
* ## Resolves with:
*
* - `{string|number}` - `id` - The primary key of the destroyed item.
*
* ## Rejects with:
*
* - `{IllegalArgumentError}`
* - `{RuntimeError}`
* - `{NonexistentResourceError}`
*/
function destroy(resourceName, id, options) {
var deferred = this.$q.defer();
var promise = deferred.promise;
try {
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new this.errors.IA(errorPrefix + 'id: Must be a string or a number!');
}
var item = this.get(resourceName, id);
if (!item) {
throw new this.errors.R(errorPrefix + 'id: "' + id + '" not found!');
}
var definition = this.definitions[resourceName];
var _this = this;
promise = promise
.then(function (attrs) {
return _this.$q.promisify(definition.beforeDestroy)(resourceName, attrs);
})
.then(function () {
return _this.adapters[options.adapter || definition.defaultAdapter].destroy(definition, id, options);
})
.then(function () {
return _this.$q.promisify(definition.afterDestroy)(resourceName, item);
})
.then(function () {
_this.eject(resourceName, id);
return id;
});
deferred.resolve(item);
} catch (err) {
deferred.reject(err);
}
return promise;
}
module.exports = destroy;
},{}],40:[function(require,module,exports){
var errorPrefix = 'DS.destroyAll(resourceName, params[, options]): ';
/**
* @doc method
* @id DS.async_methods:destroyAll
* @name destroyAll
* @description
* Asynchronously return the resource from the server filtered by the query. The results will be added to the data
* store when it returns from the server.
*
* ## Signature:
* ```js
* DS.destroyAll(resourceName, params[, options])
* ```
*
* ## Example:
*
* ```js
* var params = {
* where: {
* author: {
* '==': 'John Anderson'
* }
* }
* };
*
* DS.destroyAll('document', params).then(function (documents) {
* // The documents are gone from the data store
* DS.filter('document', params); // []
*
* }, function (err) {
* // handle error
* });
* ```
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {object} params Parameter object that is serialized into the query string. Properties:
*
* - `{object=}` - `where` - Where clause.
* - `{number=}` - `limit` - Limit clause.
* - `{number=}` - `skip` - Skip clause.
* - `{number=}` - `offset` - Same as skip.
* - `{string|array=}` - `orderBy` - OrderBy clause.
*
* @param {object=} options Optional configuration. Properties:
* - `{boolean=}` - `bypassCache` - Bypass the cache. Default: `false`.
*
* @returns {Promise} Promise produced by the `$q` service.
*
* ## Rejects with:
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*/
function destroyAll(resourceName, params, options) {
var deferred = this.$q.defer();
var promise = deferred.promise;
try {
var _this = this;
var IA = this.errors.IA;
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isObject(params)) {
throw new IA(errorPrefix + 'params: Must be an object!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
var definition = this.definitions[resourceName];
promise = promise
.then(function () {
return _this.adapters[options.adapter || definition.defaultAdapter].destroyAll(definition, params, options);
})
.then(function () {
return _this.ejectAll(resourceName, params);
});
deferred.resolve();
} catch (err) {
deferred.reject(err);
}
return promise;
}
module.exports = destroyAll;
},{}],41:[function(require,module,exports){
var errorPrefix = 'DS.find(resourceName, id[, options]): ';
/**
* @doc method
* @id DS.async_methods:find
* @name find
* @description
* Asynchronously return the resource with the given id from the server. The result will be added to the data
* store when it returns from the server.
*
* ## Signature:
* ```js
* DS.find(resourceName, id[, options])
* ```
*
* ## Example:
*
* ```js
* DS.get('document', 5); // undefined
* DS.find('document', 5).then(function (document) {
* document; // { id: 5, author: 'John Anderson' }
*
* DS.get('document', 5); // { id: 5, author: 'John Anderson' }
* }, function (err) {
* // Handled errors
* });
* ```
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item to retrieve.
* @param {object=} options Optional configuration. Properties:
*
* - `{boolean=}` - `bypassCache` - Bypass the cache. Default: `false`.
* - `{boolean=}` - `cacheResponse` - Inject the data returned by the server into the data store. Default: `true`.
*
* @returns {Promise} Promise produced by the `$q` service.
*
* ## Resolves with:
*
* - `{object}` - `item` - The item with the primary key specified by `id`.
*
* ## Rejects with:
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*/
function find(resourceName, id, options) {
var deferred = this.$q.defer();
var promise = deferred.promise;
try {
var IA = this.errors.IA;
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new IA(errorPrefix + 'id: Must be a string or a number!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
var definition = this.definitions[resourceName];
var resource = this.store[resourceName];
var _this = this;
if (options.bypassCache) {
delete resource.completedQueries[id];
}
if (!(id in resource.completedQueries)) {
if (!(id in resource.pendingQueries)) {
promise = resource.pendingQueries[id] = _this.adapters[options.adapter || definition.defaultAdapter].find(definition, id, options)
.then(function (res) {
var data = definition.deserialize(resourceName, res);
if (options.cacheResponse) {
// Query is no longer pending
delete resource.pendingQueries[id];
resource.completedQueries[id] = new Date().getTime();
return _this.inject(resourceName, data);
} else {
return data;
}
}, function (err) {
delete resource.pendingQueries[id];
return _this.$q.reject(err);
});
}
return resource.pendingQueries[id];
} else {
deferred.resolve(_this.get(resourceName, id));
}
} catch (err) {
deferred.reject(err);
}
return promise;
}
module.exports = find;
},{}],42:[function(require,module,exports){
var errorPrefix = 'DS.findAll(resourceName, params[, options]): ';
function processResults(utils, data, resourceName, queryHash) {
var resource = this.store[resourceName],
idAttribute = this.definitions[resourceName].idAttribute,
date = new Date().getTime();
data = data || [];
// Query is no longer pending
delete resource.pendingQueries[queryHash];
resource.completedQueries[queryHash] = date;
// Update modified timestamp of collection
resource.collectionModified = utils.updateTimestamp(resource.collectionModified);
// Merge the new values into the cache
var injected = this.inject(resourceName, data);
// Make sure each object is added to completedQueries
angular.forEach(injected, function (item) {
resource.completedQueries[item[idAttribute]] = date;
});
return injected;
}
function _findAll(utils, resourceName, params, options) {
var definition = this.definitions[resourceName],
resource = this.store[resourceName],
_this = this,
queryHash = utils.toJson(params);
if (options.bypassCache) {
delete resource.completedQueries[queryHash];
}
if (!(queryHash in resource.completedQueries)) {
// This particular query has never been completed
if (!(queryHash in resource.pendingQueries)) {
// This particular query has never even been made
resource.pendingQueries[queryHash] = _this.adapters[options.adapter || definition.defaultAdapter].findAll(definition, params, options)
.then(function (res) {
var data = definition.deserialize(resourceName, res);
if (options.cacheResponse) {
try {
return processResults.apply(_this, [utils, data, resourceName, queryHash]);
} catch (err) {
return _this.$q.reject(err);
}
} else {
return data;
}
}, function (err) {
delete resource.pendingQueries[queryHash];
return _this.$q.reject(err);
});
}
return resource.pendingQueries[queryHash];
} else {
return this.filter(resourceName, params, options);
}
}
/**
* @doc method
* @id DS.async_methods:findAll
* @name findAll
* @description
* Asynchronously return the resource from the server filtered by the query. The results will be added to the data
* store when it returns from the server.
*
* ## Signature:
* ```js
* DS.findAll(resourceName, params[, options])
* ```
*
* ## Example:
*
* ```js
* var params = {
* where: {
* author: {
* '==': 'John Anderson'
* }
* }
* };
*
* DS.findAll('document', params).then(function (documents) {
* documents; // [{ id: '1', author: 'John Anderson', title: 'How to cook' },
* // { id: '2', author: 'John Anderson', title: 'How NOT to cook' }]
*
* // The documents are now in the data store
* DS.filter('document', params); // [{ id: '1', author: 'John Anderson', title: 'How to cook' },
* // { id: '2', author: 'John Anderson', title: 'How NOT to cook' }]
*
* }, function (err) {
* // handle error
* });
* ```
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {object=} params Parameter object that is serialized into the query string. Properties:
*
* - `{object=}` - `where` - Where clause.
* - `{number=}` - `limit` - Limit clause.
* - `{number=}` - `skip` - Skip clause.
* - `{number=}` - `offset` - Same as skip.
* - `{string|array=}` - `orderBy` - OrderBy clause.
*
* @param {object=} options Optional configuration. Properties:
*
* - `{boolean=}` - `bypassCache` - Bypass the cache. Default: `false`.
* - `{boolean=}` - `cacheResponse` - Inject the data returned by the server into the data store. Default: `true`.
*
* @returns {Promise} Promise produced by the `$q` service.
*
* ## Resolves with:
*
* - `{array}` - `items` - The collection of items returned by the server.
*
* ## Rejects with:
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*/
function findAll(resourceName, params, options) {
var deferred = this.$q.defer();
var promise = deferred.promise;
try {
var IA = this.errors.IA;
var _this = this;
options = options || {};
params = params || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isObject(params)) {
throw new IA(errorPrefix + 'params: Must be an object!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
promise = promise.then(function () {
return _findAll.apply(_this, [_this.utils, resourceName, params, options]);
});
deferred.resolve();
} catch (err) {
deferred.reject(err);
}
return promise;
}
module.exports = findAll;
},{}],43:[function(require,module,exports){
module.exports = {
/**
* @doc method
* @id DS.async_methods:create
* @name create
* @methodOf DS
* @description
* See [DS.create](/documentation/api/api/DS.async_methods:create).
*/
create: require('./create'),
/**
* @doc method
* @id DS.async_methods:destroy
* @name destroy
* @methodOf DS
* @description
* See [DS.destroy](/documentation/api/api/DS.async_methods:destroy).
*/
destroy: require('./destroy'),
/**
* @doc method
* @id DS.async_methods:destroyAll
* @name destroyAll
* @methodOf DS
* @description
* See [DS.destroyAll](/documentation/api/api/DS.async_methods:destroyAll).
*/
destroyAll: require('./destroyAll'),
/**
* @doc method
* @id DS.async_methods:find
* @name find
* @methodOf DS
* @description
* See [DS.find](/documentation/api/api/DS.async_methods:find).
*/
find: require('./find'),
/**
* @doc method
* @id DS.async_methods:findAll
* @name findAll
* @methodOf DS
* @description
* See [DS.findAll](/documentation/api/api/DS.async_methods:findAll).
*/
findAll: require('./findAll'),
/**
* @doc method
* @id DS.async_methods:loadRelations
* @name loadRelations
* @methodOf DS
* @description
* See [DS.loadRelations](/documentation/api/api/DS.async_methods:loadRelations).
*/
loadRelations: require('./loadRelations'),
/**
* @doc method
* @id DS.async_methods:refresh
* @name refresh
* @methodOf DS
* @description
* See [DS.refresh](/documentation/api/api/DS.async_methods:refresh).
*/
refresh: require('./refresh'),
/**
* @doc method
* @id DS.async_methods:save
* @name save
* @methodOf DS
* @description
* See [DS.save](/documentation/api/api/DS.async_methods:save).
*/
save: require('./save'),
/**
* @doc method
* @id DS.async_methods:update
* @name update
* @methodOf DS
* @description
* See [DS.update](/documentation/api/api/DS.async_methods:update).
*/
update: require('./update'),
/**
* @doc method
* @id DS.async_methods:updateAll
* @name updateAll
* @methodOf DS
* @description
* See [DS.updateAll](/documentation/api/api/DS.async_methods:updateAll).
*/
updateAll: require('./updateAll')
};
},{"./create":38,"./destroy":39,"./destroyAll":40,"./find":41,"./findAll":42,"./loadRelations":44,"./refresh":45,"./save":46,"./update":47,"./updateAll":48}],44:[function(require,module,exports){
var errorPrefix = 'DS.loadRelations(resourceName, instance(Id), relations[, options]): ';
/**
* @doc method
* @id DS.async_methods:loadRelations
* @name loadRelations
* @description
* Asynchronously load the indicated relations of the given instance.
*
* ## Signature:
* ```js
* DS.loadRelations(resourceName, instance(Id), relations[, options])
* ```
*
* ## Examples:
*
* ```js
* DS.loadRelations('user', 10, ['profile']).then(function (user) {
* user.profile; // object
* assert.deepEqual(user.profile, DS.filter('profile', { userId: 10 })[0]);
* });
* ```
*
* ```js
* var user = DS.get('user', 10);
*
* DS.loadRelations('user', user, ['profile']).then(function (user) {
* user.profile; // object
* assert.deepEqual(user.profile, DS.filter('profile', { userId: 10 })[0]);
* });
* ```
*
* ```js
* DS.loadRelations('user', 10, ['profile'], { cacheResponse: false }).then(function (user) {
* user.profile; // object
* assert.equal(DS.filter('profile', { userId: 10 }).length, 0);
* });
* ```
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number|object} instance The instance or the id of the instance for which relations are to be loaded.
* @param {string|array=} relations The relation(s) to load.
* @param {object=} options Optional configuration that is passed to the `find` and `findAll` methods that may be called.
*
* @returns {Promise} Promise produced by the `$q` service.
*
* ## Resolves with:
*
* - `{object}` - `item` - The instance with its loaded relations.
*
* ## Rejects with:
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*/
function loadRelations(resourceName, instance, relations, options) {
var deferred = this.$q.defer();
var promise = deferred.promise;
try {
var IA = this.errors.IA;
options = options || {};
if (angular.isString(instance) || angular.isNumber(instance)) {
instance = this.get(resourceName, instance);
}
if (angular.isString(relations)) {
relations = [relations];
}
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isObject(instance)) {
throw new IA(errorPrefix + 'instance(Id): Must be a string, number or object!');
} else if (!this.utils.isArray(relations)) {
throw new IA(errorPrefix + 'relations: Must be a string or an array!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
var definition = this.definitions[resourceName];
var _this = this;
var tasks = [];
var fields = [];
_this.utils.forOwn(definition.relations, function (relation, type) {
_this.utils.forOwn(relation, function (def, relationName) {
if (_this.utils.contains(relations, relationName)) {
var task;
var params = {};
params[def.foreignKey] = instance[definition.idAttribute];
if (type === 'hasMany') {
task = _this.findAll(relationName, params, options);
} else if (type === 'hasOne') {
if (def.localKey && instance[def.localKey]) {
task = _this.find(relationName, instance[def.localKey], options);
} else if (def.foreignKey) {
task = _this.findAll(relationName, params, options);
}
} else {
task = _this.find(relationName, instance[def.localKey], options);
}
if (task) {
tasks.push(task);
fields.push(def.localField);
}
}
});
});
promise = promise
.then(function () {
return _this.$q.all(tasks);
})
.then(function (loadedRelations) {
angular.forEach(fields, function (field, index) {
instance[field] = loadedRelations[index];
});
return instance;
});
deferred.resolve();
} catch (err) {
deferred.reject(err);
}
return promise;
}
module.exports = loadRelations;
},{}],45:[function(require,module,exports){
var errorPrefix = 'DS.refresh(resourceName, id[, options]): ';
/**
* @doc method
* @id DS.async_methods:refresh
* @name refresh
* @description
* Like find(), except the resource is only refreshed from the server if it already exists in the data store.
*
* ## Signature:
* ```js
* DS.refresh(resourceName, id)
* ```
* ## Example:
*
* ```js
* // Exists in the data store, but we want a fresh copy
* DS.get('document', 'ee7f3f4d-98d5-4934-9e5a-6a559b08479f');
*
* DS.refresh('document', 'ee7f3f4d-98d5-4934-9e5a-6a559b08479f')
* .then(function (document) {
* document; // The fresh copy
* });
*
* // Does not exist in the data store
* DS.get('document', 'aab7ff66-e21e-46e2-8be8-264d82aee535');
*
* DS.refresh('document', 'aab7ff66-e21e-46e2-8be8-264d82aee535'); // false
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item to refresh from the server.
* @param {object=} options Optional configuration passed through to `DS.find` if it is called.
* @returns {false|Promise} `false` if the item doesn't already exist in the data store. A `Promise` if the item does
* exist in the data store and is being refreshed.
*
* ## Resolves with:
*
* - `{object}` - `item` - A reference to the refreshed item.
*
* ## Rejects with:
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*/
function refresh(resourceName, id, options) {
var IA = this.errors.IA;
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new IA(errorPrefix + 'id: Must be a string or a number!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
} else {
options.bypassCache = true;
if (this.get(resourceName, id)) {
return this.find(resourceName, id, options);
} else {
return false;
}
}
}
module.exports = refresh;
},{}],46:[function(require,module,exports){
var errorPrefix = 'DS.save(resourceName, id[, options]): ';
/**
* @doc method
* @id DS.async_methods:save
* @name save
* @description
* Save the item of the type specified by `resourceName` that has the primary key specified by `id`.
*
* ## Signature:
* ```js
* DS.save(resourceName, id[, options])
* ```
*
* ## Example:
*
* ```js
* var document = DS.get('document', 'ee7f3f4d-98d5-4934-9e5a-6a559b08479f');
*
* document.title = 'How to cook in style';
*
* DS.save('document', 'ee7f3f4d-98d5-4934-9e5a-6a559b08479f')
* .then(function (document) {
* document; // A reference to the document that's been saved to the server
* });
* ```
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item to retrieve.
* @param {object=} options Optional configuration. Properties::
*
* - `{boolean=}` - `cacheResponse` - Inject the data returned by the server into the data store. Default: `true`.
* - `{boolean=}` - `changesOnly` - Only send changed and added values back to the server.
*
* @returns {Promise} Promise produced by the `$q` service.
*
* ## Resolves with:
*
* - `{object}` - `item` - A reference to the newly saved item.
*
* ## Rejects with:
*
* - `{IllegalArgumentError}`
* - `{RuntimeError}`
* - `{NonexistentResourceError}`
*/
function save(resourceName, id, options) {
var deferred = this.$q.defer();
var promise = deferred.promise;
try {
var IA = this.errors.IA;
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new IA(errorPrefix + 'id: Must be a string or a number!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
var item = this.get(resourceName, id);
if (!item) {
throw new this.errors.R(errorPrefix + 'id: "' + id + '" not found!');
}
var definition = this.definitions[resourceName];
var resource = this.store[resourceName];
var _this = this;
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
promise = promise
.then(function (attrs) {
return _this.$q.promisify(definition.beforeValidate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.validate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.afterValidate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.beforeUpdate)(resourceName, attrs);
})
.then(function (attrs) {
if (options.changesOnly) {
resource.observers[id].deliver();
var toKeep = [],
changes = _this.changes(resourceName, id);
for (var key in changes.added) {
toKeep.push(key);
}
for (key in changes.changed) {
toKeep.push(key);
}
changes = _this.utils.pick(attrs, toKeep);
if (_this.utils.isEmpty(changes)) {
// no changes, return
return attrs;
} else {
attrs = changes;
}
}
return _this.adapters[options.adapter || definition.defaultAdapter].update(definition, id, definition.serialize(resourceName, attrs), options);
})
.then(function (res) {
return _this.$q.promisify(definition.afterUpdate)(resourceName, definition.deserialize(resourceName, res));
})
.then(function (data) {
if (options.cacheResponse) {
var saved = _this.inject(definition.name, data, options);
resource.previousAttributes[id] = _this.utils.deepMixIn({}, saved);
resource.saved[id] = _this.utils.updateTimestamp(resource.saved[id]);
return _this.get(resourceName, id);
} else {
return data;
}
});
deferred.resolve(item);
} catch (err) {
deferred.reject(err);
}
return promise;
}
module.exports = save;
},{}],47:[function(require,module,exports){
var errorPrefix = 'DS.update(resourceName, id, attrs[, options]): ';
/**
* @doc method
* @id DS.async_methods:update
* @name update
* @description
* Update the item of type `resourceName` and primary key `id` with `attrs`. This is useful when you want to update an
* item that isn't already in the data store, or you don't want to update the item that's in the data store until the
* server-side operation succeeds. This differs from `DS.save` which simply saves items in their current form that
* already reside in the data store.
*
* ## Signature:
* ```js
* DS.update(resourceName, id, attrs[, options])
* ```
*
* ## Example:
*
* ```js
* DS.get('document', 5); // undefined
*
* DS.update('document', 5, { title: 'How to cook in style' })
* .then(function (document) {
* document; // A reference to the document that's been saved to the server
* // and now resides in the data store
* });
* ```
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item to update.
* @param {object} attrs The attributes with which to update the item.
* @param {object=} options Optional configuration. Properties:
*
* - `{boolean=}` - `cacheResponse` - Inject the data returned by the server into the data store. Default: `true`.
*
* @returns {Promise} Promise produced by the `$q` service.
*
* ## Resolves with:
*
* - `{object}` - `item` - A reference to the newly saved item.
*
* ## Rejects with:
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*/
function update(resourceName, id, attrs, options) {
var deferred = this.$q.defer();
var promise = deferred.promise;
try {
var IA = this.errors.IA;
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new IA(errorPrefix + 'id: Must be a string or a number!');
} else if (!this.utils.isObject(attrs)) {
throw new IA(errorPrefix + 'attrs: Must be an object!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
var definition = this.definitions[resourceName];
var resource = this.store[resourceName];
var _this = this;
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
promise = promise
.then(function (attrs) {
return _this.$q.promisify(definition.beforeValidate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.validate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.afterValidate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.beforeUpdate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.adapters[options.adapter || definition.defaultAdapter].update(definition, id, definition.serialize(resourceName, attrs), options);
})
.then(function (res) {
return _this.$q.promisify(definition.afterUpdate)(resourceName, definition.deserialize(resourceName, res));
})
.then(function (data) {
if (options.cacheResponse) {
var updated = _this.inject(definition.name, data, options);
var id = updated[definition.idAttribute];
resource.previousAttributes[id] = _this.utils.deepMixIn({}, updated);
resource.saved[id] = _this.utils.updateTimestamp(resource.saved[id]);
return _this.get(definition.name, id);
} else {
return data;
}
});
deferred.resolve(attrs);
} catch (err) {
deferred.reject(err);
}
return promise;
}
module.exports = update;
},{}],48:[function(require,module,exports){
var errorPrefix = 'DS.updateAll(resourceName, attrs, params[, options]): ';
/**
* @doc method
* @id DS.async_methods:updateAll
* @name updateAll
* @description
* Update items of type `resourceName` with `attrs` according to the criteria specified by `params`. This is useful when
* you want to update multiple items with the same attributes that aren't already in the data store, or you don't want
* to update the items that are in the data store until the server-side operation succeeds.
*
* ## Signature:
* ```js
* DS.updateAll(resourceName, attrs, params[, options])
* ```
*
* ## Example:
*
* ```js
* DS.filter('document'); // []
*
* DS.updateAll('document', 5, { author: 'Sally' }, {
* where: {
* author: {
* '==': 'John Anderson'
* }
* }
* })
* .then(function (documents) {
* documents; // The documents that were updated on the server
* // and now reside in the data store
*
* documents[0].author; // "Sally"
* });
* ```
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {object} attrs The attributes with which to update the items.
* @param {object} params Parameter object that is serialized into the query string. Properties:
*
* - `{object=}` - `where` - Where clause.
* - `{number=}` - `limit` - Limit clause.
* - `{number=}` - `skip` - Skip clause.
* - `{number=}` - `offset` - Same as skip.
* - `{string|array=}` - `orderBy` - OrderBy clause.
*
* @param {object=} options Optional configuration. Properties:
*
* - `{boolean=}` - `cacheResponse` - Inject the data returned by the server into the data store. Default: `true`.
*
* @returns {Promise} Promise produced by the `$q` service.
*
* ## Resolves with:
*
* - `{object}` - `item` - A reference to the newly saved item.
*
* ## Rejects with:
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*/
function updateAll(resourceName, attrs, params, options) {
var deferred = this.$q.defer();
var promise = deferred.promise;
try {
var IA = this.errors.IA;
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isObject(attrs)) {
throw new IA(errorPrefix + 'attrs: Must be an object!');
} else if (!this.utils.isObject(params)) {
throw new IA(errorPrefix + 'params: Must be an object!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
var definition = this.definitions[resourceName];
var _this = this;
if (!('cacheResponse' in options)) {
options.cacheResponse = true;
}
promise = promise
.then(function (attrs) {
return _this.$q.promisify(definition.beforeValidate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.validate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.afterValidate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.$q.promisify(definition.beforeUpdate)(resourceName, attrs);
})
.then(function (attrs) {
return _this.adapters[options.adapter || definition.defaultAdapter].updateAll(definition, definition.serialize(resourceName, attrs), params, options);
})
.then(function (res) {
return _this.$q.promisify(definition.afterUpdate)(resourceName, definition.deserialize(resourceName, res));
})
.then(function (data) {
if (options.cacheResponse) {
return _this.inject(definition.name, data, options);
} else {
return data;
}
});
deferred.resolve(attrs);
} catch (err) {
deferred.reject(err);
}
return promise;
}
module.exports = updateAll;
},{}],49:[function(require,module,exports){
var utils = require('../utils')[0]();
function lifecycleNoop(resourceName, attrs, cb) {
cb(null, attrs);
}
function Defaults() {
}
Defaults.prototype.idAttribute = 'id';
Defaults.prototype.defaultAdapter = 'DSHttpAdapter';
Defaults.prototype.defaultFilter = function (collection, resourceName, params, options) {
var _this = this;
var filtered = collection;
var where = null;
var reserved = {
skip: '',
offset: '',
where: '',
limit: '',
orderBy: '',
sort: ''
};
if (this.utils.isObject(params.where)) {
where = params.where;
} else {
where = {};
}
if (options.allowSimpleWhere) {
this.utils.forOwn(params, function (value, key) {
if (!(key in reserved) && !(key in where)) {
where[key] = {
'==': value
};
}
});
}
if (this.utils.isEmpty(where)) {
where = null;
}
if (where) {
filtered = this.utils.filter(filtered, function (attrs) {
var first = true;
var keep = true;
_this.utils.forOwn(where, function (clause, field) {
if (_this.utils.isString(clause)) {
clause = {
'===': clause
};
} else if (_this.utils.isNumber(clause) || _this.utils.isBoolean(clause)) {
clause = {
'==': clause
};
}
if (_this.utils.isObject(clause)) {
_this.utils.forOwn(clause, function (val, op) {
if (op === '==') {
keep = first ? (attrs[field] == val) : keep && (attrs[field] == val);
} else if (op === '===') {
keep = first ? (attrs[field] === val) : keep && (attrs[field] === val);
} else if (op === '!=') {
keep = first ? (attrs[field] != val) : keep && (attrs[field] != val);
} else if (op === '!==') {
keep = first ? (attrs[field] !== val) : keep && (attrs[field] !== val);
} else if (op === '>') {
keep = first ? (attrs[field] > val) : keep && (attrs[field] > val);
} else if (op === '>=') {
keep = first ? (attrs[field] >= val) : keep && (attrs[field] >= val);
} else if (op === '<') {
keep = first ? (attrs[field] < val) : keep && (attrs[field] < val);
} else if (op === '<=') {
keep = first ? (attrs[field] <= val) : keep && (attrs[field] <= val);
} else if (op === 'in') {
keep = first ? _this.utils.contains(val, attrs[field]) : keep && _this.utils.contains(val, attrs[field]);
} else if (op === '|==') {
keep = first ? (attrs[field] == val) : keep || (attrs[field] == val);
} else if (op === '|===') {
keep = first ? (attrs[field] === val) : keep || (attrs[field] === val);
} else if (op === '|!=') {
keep = first ? (attrs[field] != val) : keep || (attrs[field] != val);
} else if (op === '|!==') {
keep = first ? (attrs[field] !== val) : keep || (attrs[field] !== val);
} else if (op === '|>') {
keep = first ? (attrs[field] > val) : keep || (attrs[field] > val);
} else if (op === '|>=') {
keep = first ? (attrs[field] >= val) : keep || (attrs[field] >= val);
} else if (op === '|<') {
keep = first ? (attrs[field] < val) : keep || (attrs[field] < val);
} else if (op === '|<=') {
keep = first ? (attrs[field] <= val) : keep || (attrs[field] <= val);
} else if (op === '|in') {
keep = first ? _this.utils.contains(val, attrs[field]) : keep || _this.utils.contains(val, attrs[field]);
}
first = false;
});
}
});
return keep;
});
}
var orderBy = null;
if (this.utils.isString(params.orderBy)) {
orderBy = [
[params.orderBy, 'ASC']
];
} else if (this.utils.isArray(params.orderBy)) {
orderBy = params.orderBy;
}
if (!orderBy && this.utils.isString(params.sort)) {
orderBy = [
[params.sort, 'ASC']
];
} else if (!orderBy && this.utils.isArray(params.sort)) {
orderBy = params.sort;
}
// Apply 'orderBy'
if (orderBy) {
angular.forEach(orderBy, function (def) {
if (_this.utils.isString(def)) {
def = [def, 'ASC'];
} else if (!_this.utils.isArray(def)) {
throw new _this.errors.IllegalArgumentError('DS.filter(resourceName[, params][, options]): ' + angular.toJson(def) + ': Must be a string or an array!', { params: { 'orderBy[i]': { actual: typeof def, expected: 'string|array' } } });
}
filtered = _this.utils.sort(filtered, function (a, b) {
var cA = a[def[0]], cB = b[def[0]];
if (_this.utils.isString(cA)) {
cA = _this.utils.upperCase(cA);
}
if (_this.utils.isString(cB)) {
cB = _this.utils.upperCase(cB);
}
if (def[1] === 'DESC') {
if (cB < cA) {
return -1;
} else if (cB > cA) {
return 1;
} else {
return 0;
}
} else {
if (cA < cB) {
return -1;
} else if (cA > cB) {
return 1;
} else {
return 0;
}
}
});
});
}
var limit = angular.isNumber(params.limit) ? params.limit : null;
var skip = null;
if (angular.isNumber(params.skip)) {
skip = params.skip;
} else if (angular.isNumber(params.offset)) {
skip = params.offset;
}
// Apply 'limit' and 'skip'
if (limit && skip) {
filtered = this.utils.slice(filtered, skip, Math.min(filtered.length, skip + limit));
} else if (this.utils.isNumber(limit)) {
filtered = this.utils.slice(filtered, 0, Math.min(filtered.length, limit));
} else if (this.utils.isNumber(skip)) {
if (skip < filtered.length) {
filtered = this.utils.slice(filtered, skip);
} else {
filtered = [];
}
}
return filtered;
};
Defaults.prototype.baseUrl = '';
Defaults.prototype.endpoint = '';
Defaults.prototype.useClass = false;
/**
* @doc property
* @id DSProvider.properties:defaults.beforeValidate
* @name defaults.beforeValidate
* @description
* Called before the `validate` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* beforeValidate(resourceName, attrs, cb)
* ```
*
* ## Callback signature:
* ```js
* cb(err, attrs)
* ```
* Remember to pass the attributes along to the next step. Passing a first argument to the callback will abort the
* lifecycle and reject the promise.
*
* ## Example:
* ```js
* DSProvider.defaults.beforeValidate = function (resourceName, attrs, cb) {
* // do somthing/inspect attrs
* cb(null, attrs);
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.beforeValidate = lifecycleNoop;
/**
* @doc property
* @id DSProvider.properties:defaults.validate
* @name defaults.validate
* @description
* Called before the `afterValidate` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* validate(resourceName, attrs, cb)
* ```
*
* ## Callback signature:
* ```js
* cb(err, attrs)
* ```
* Remember to pass the attributes along to the next step. Passing a first argument to the callback will abort the
* lifecycle and reject the promise.
*
* ## Example:
* ```js
* DSProvider.defaults.validate = function (resourceName, attrs, cb) {
* // do somthing/inspect attrs
* cb(null, attrs);
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.validate = lifecycleNoop;
/**
* @doc property
* @id DSProvider.properties:defaults.afterValidate
* @name defaults.afterValidate
* @description
* Called before the `beforeCreate` or `beforeUpdate` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* afterValidate(resourceName, attrs, cb)
* ```
*
* ## Callback signature:
* ```js
* cb(err, attrs)
* ```
* Remember to pass the attributes along to the next step. Passing a first argument to the callback will abort the
* lifecycle and reject the promise.
*
* ## Example:
* ```js
* DSProvider.defaults.afterValidate = function (resourceName, attrs, cb) {
* // do somthing/inspect attrs
* cb(null, attrs);
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.afterValidate = lifecycleNoop;
/**
* @doc property
* @id DSProvider.properties:defaults.beforeCreate
* @name defaults.beforeCreate
* @description
* Called before the `create` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* beforeCreate(resourceName, attrs, cb)
* ```
*
* ## Callback signature:
* ```js
* cb(err, attrs)
* ```
* Remember to pass the attributes along to the next step. Passing a first argument to the callback will abort the
* lifecycle and reject the promise.
*
* ## Example:
* ```js
* DSProvider.defaults.beforeCreate = function (resourceName, attrs, cb) {
* // do somthing/inspect attrs
* cb(null, attrs);
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.beforeCreate = lifecycleNoop;
/**
* @doc property
* @id DSProvider.properties:defaults.afterCreate
* @name defaults.afterCreate
* @description
* Called after the `create` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* afterCreate(resourceName, attrs, cb)
* ```
*
* ## Callback signature:
* ```js
* cb(err, attrs)
* ```
* Remember to pass the attributes along to the next step. Passing a first argument to the callback will abort the
* lifecycle and reject the promise.
*
* ## Example:
* ```js
* DSProvider.defaults.afterCreate = function (resourceName, attrs, cb) {
* // do somthing/inspect attrs
* cb(null, attrs);
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.afterCreate = lifecycleNoop;
/**
* @doc property
* @id DSProvider.properties:defaults.beforeUpdate
* @name defaults.beforeUpdate
* @description
* Called before the `update` or `save` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* beforeUpdate(resourceName, attrs, cb)
* ```
*
* ## Callback signature:
* ```js
* cb(err, attrs)
* ```
* Remember to pass the attributes along to the next step. Passing a first argument to the callback will abort the
* lifecycle and reject the promise.
*
* ## Example:
* ```js
* DSProvider.defaults.beforeUpdate = function (resourceName, attrs, cb) {
* // do somthing/inspect attrs
* cb(null, attrs);
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.beforeUpdate = lifecycleNoop;
/**
* @doc property
* @id DSProvider.properties:defaults.afterUpdate
* @name defaults.afterUpdate
* @description
* Called after the `update` or `save` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* afterUpdate(resourceName, attrs, cb)
* ```
*
* ## Callback signature:
* ```js
* cb(err, attrs)
* ```
* Remember to pass the attributes along to the next step. Passing a first argument to the callback will abort the
* lifecycle and reject the promise.
*
* ## Example:
* ```js
* DSProvider.defaults.afterUpdate = function (resourceName, attrs, cb) {
* // do somthing/inspect attrs
* cb(null, attrs);
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.afterUpdate = lifecycleNoop;
/**
* @doc property
* @id DSProvider.properties:defaults.beforeDestroy
* @name defaults.beforeDestroy
* @description
* Called before the `destroy` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* beforeDestroy(resourceName, attrs, cb)
* ```
*
* ## Callback signature:
* ```js
* cb(err, attrs)
* ```
* Remember to pass the attributes along to the next step. Passing a first argument to the callback will abort the
* lifecycle and reject the promise.
*
* ## Example:
* ```js
* DSProvider.defaults.beforeDestroy = function (resourceName, attrs, cb) {
* // do somthing/inspect attrs
* cb(null, attrs);
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.beforeDestroy = lifecycleNoop;
/**
* @doc property
* @id DSProvider.properties:defaults.afterDestroy
* @name defaults.afterDestroy
* @description
* Called after the `destroy` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* afterDestroy(resourceName, attrs, cb)
* ```
*
* ## Callback signature:
* ```js
* cb(err, attrs)
* ```
* Remember to pass the attributes along to the next step. Passing a first argument to the callback will abort the
* lifecycle and reject the promise.
*
* ## Example:
* ```js
* DSProvider.defaults.afterDestroy = function (resourceName, attrs, cb) {
* // do somthing/inspect attrs
* cb(null, attrs);
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.afterDestroy = lifecycleNoop;
/**
* @doc property
* @id DSProvider.properties:defaults.beforeInject
* @name defaults.beforeInject
* @description
* Called before the `inject` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* beforeInject(resourceName, attrs)
* ```
*
* Throwing an error inside this step will cancel the injection.
*
* ## Example:
* ```js
* DSProvider.defaults.beforeInject = function (resourceName, attrs) {
* // do somthing/inspect/modify attrs
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.beforeInject = function (resourceName, attrs) {
return attrs;
};
/**
* @doc property
* @id DSProvider.properties:defaults.afterInject
* @name defaults.afterInject
* @description
* Called after the `inject` lifecycle step. Can be overridden per resource as well.
*
* ## Signature:
* ```js
* afterInject(resourceName, attrs)
* ```
*
* Throwing an error inside this step will cancel the injection.
*
* ## Example:
* ```js
* DSProvider.defaults.afterInject = function (resourceName, attrs) {
* // do somthing/inspect/modify attrs
* };
* ```
*
* @param {string} resourceName The name of the resource moving through the lifecycle.
* @param {object} attrs Attributes of the item moving through the lifecycle.
*/
Defaults.prototype.afterInject = function (resourceName, attrs) {
return attrs;
};
/**
* @doc property
* @id DSProvider.properties:defaults.serialize
* @name defaults.serialize
* @description
* Your server might expect a custom request object rather than the plain POJO payload. Use `serialize` to
* create your custom request object.
*
* ## Example:
* ```js
* DSProvider.defaults.serialize = function (resourceName, data) {
* return {
* payload: data
* };
* };
* ```
*
* @param {string} resourceName The name of the resource to serialize.
* @param {object} data Data to be sent to the server.
* @returns {*} By default returns `data` as-is.
*/
Defaults.prototype.serialize = function (resourceName, data) {
return data;
};
/**
* @doc property
* @id DSProvider.properties:defaults.deserialize
* @name DSProvider.properties:defaults.deserialize
* @description
* Your server might return a custom response object instead of the plain POJO payload. Use `deserialize` to
* pull the payload out of your response object so angular-data can use it.
*
* ## Example:
* ```js
* DSProvider.defaults.deserialize = function (resourceName, data) {
* return data ? data.payload : data;
* };
* ```
*
* @param {string} resourceName The name of the resource to deserialize.
* @param {object} data Response object from `$http()`.
* @returns {*} By default returns `data.data`.
*/
Defaults.prototype.deserialize = function (resourceName, data) {
return data.data;
};
/**
* @doc function
* @id DSProvider
* @name DSProvider
*/
function DSProvider() {
/**
* @doc property
* @id DSProvider.properties:defaults
* @name defaults
* @description
* See the [configuration guide](/documentation/guide/configure/global).
*
* Properties:
*
* - `{string}` - `baseUrl` - The url relative to which all AJAX requests will be made.
* - `{string}` - `idAttribute` - Default: `"id"` - The attribute that specifies the primary key for resources.
* - `{string}` - `defaultAdapter` - Default: `"DSHttpAdapter"`
* - `{function}` - `filter` - Default: See [angular-data query language](/documentation/guide/queries/custom).
* - `{function}` - `beforeValidate` - See [DSProvider.defaults.beforeValidate](/documentation/api/angular-data/DSProvider.properties:defaults.beforeValidate). Default: No-op
* - `{function}` - `validate` - See [DSProvider.defaults.validate](/documentation/api/angular-data/DSProvider.properties:defaults.validate). Default: No-op
* - `{function}` - `afterValidate` - See [DSProvider.defaults.afterValidate](/documentation/api/angular-data/DSProvider.properties:defaults.afterValidate). Default: No-op
* - `{function}` - `beforeCreate` - See [DSProvider.defaults.beforeCreate](/documentation/api/angular-data/DSProvider.properties:defaults.beforeCreate). Default: No-op
* - `{function}` - `afterCreate` - See [DSProvider.defaults.afterCreate](/documentation/api/angular-data/DSProvider.properties:defaults.afterCreate). Default: No-op
* - `{function}` - `beforeUpdate` - See [DSProvider.defaults.beforeUpdate](/documentation/api/angular-data/DSProvider.properties:defaults.beforeUpdate). Default: No-op
* - `{function}` - `afterUpdate` - See [DSProvider.defaults.afterUpdate](/documentation/api/angular-data/DSProvider.properties:defaults.afterUpdate). Default: No-op
* - `{function}` - `beforeDestroy` - See [DSProvider.defaults.beforeDestroy](/documentation/api/angular-data/DSProvider.properties:defaults.beforeDestroy). Default: No-op
* - `{function}` - `afterDestroy` - See [DSProvider.defaults.afterDestroy](/documentation/api/angular-data/DSProvider.properties:defaults.afterDestroy). Default: No-op
* - `{function}` - `afterInject` - See [DSProvider.defaults.afterInject](/documentation/api/angular-data/DSProvider.properties:defaults.afterInject). Default: No-op
* - `{function}` - `beforeInject` - See [DSProvider.defaults.beforeInject](/documentation/api/angular-data/DSProvider.properties:defaults.beforeInject). Default: No-op
* - `{function}` - `serialize` - See [DSProvider.defaults.serialize](/documentation/api/angular-data/DSProvider.properties:defaults.serialize). Default: No-op
* - `{function}` - `deserialize` - See [DSProvider.defaults.deserialize](/documentation/api/angular-data/DSProvider.properties:defaults.deserialize). Default: No-op
*/
var defaults = this.defaults = new Defaults();
this.$get = [
'$rootScope', '$log', '$q', 'DSHttpAdapter', 'DSLocalStorageAdapter', 'DSUtils', 'DSErrors',
function ($rootScope, $log, $q, DSHttpAdapter, DSLocalStorageAdapter, DSUtils, DSErrors) {
var syncMethods = require('./sync_methods'),
asyncMethods = require('./async_methods'),
cache;
try {
cache = angular.injector(['angular-data.DSCacheFactory']).get('DSCacheFactory');
} catch (err) {
$log.warn(err);
$log.warn('DSCacheFactory is unavailable. Resorting to the lesser capabilities of $cacheFactory.');
cache = angular.injector(['ng']).get('$cacheFactory');
}
/**
* @doc interface
* @id DS
* @name DS
* @description
* Public data store interface. Consists of several properties and a number of methods. Injectable as `DS`.
*
* See the [guide](/documentation/guide/overview/index).
*/
var DS = {
$rootScope: $rootScope,
$log: $log,
$q: $q,
cacheFactory: cache,
/**
* @doc property
* @id DS.properties:defaults
* @name defaults
* @description
* Reference to [DSProvider.defaults](/documentation/api/api/DSProvider.properties:defaults).
*/
defaults: defaults,
/*!
* @doc property
* @id DS.properties:store
* @name store
* @description
* Meta data for each registered resource.
*/
store: {},
/*!
* @doc property
* @id DS.properties:definitions
* @name definitions
* @description
* Registered resource definitions available to the data store.
*/
definitions: {},
/**
* @doc property
* @id DS.properties:adapters
* @name adapters
* @description
* Registered adapters available to the data store. Object consists of key-values pairs where the key is
* the name of the adapter and the value is the adapter itself.
*/
adapters: {
DSHttpAdapter: DSHttpAdapter,
DSLocalStorageAdapter: DSLocalStorageAdapter
},
/**
* @doc property
* @id DS.properties:errors
* @name errors
* @description
* References to the various [error types](/documentation/api/api/errors) used by angular-data.
*/
errors: DSErrors,
/*!
* @doc property
* @id DS.properties:utils
* @name utils
* @description
* Utility functions used internally by angular-data.
*/
utils: DSUtils
};
DSUtils.deepFreeze(syncMethods);
DSUtils.deepFreeze(asyncMethods);
DSUtils.deepMixIn(DS, syncMethods);
DSUtils.deepMixIn(DS, asyncMethods);
DSUtils.deepFreeze(DS.errors);
DSUtils.deepFreeze(DS.utils);
$rootScope.$watch(function () {
// Throttle angular-data's digest loop to tenths of a second
return new Date().getTime() / 100 | 0;
}, function () {
DS.digest();
});
return DS;
}
];
}
module.exports = DSProvider;
},{"../utils":68,"./async_methods":43,"./sync_methods":61}],50:[function(require,module,exports){
var errorPrefix = 'DS.bindAll(scope, expr, resourceName, params[, cb]): ';
/**
* @doc method
* @id DS.sync_methods:bindAll
* @name bindAll
* @description
* Bind a collection of items in the data store to `scope` under the property specified by `expr` filtered by `params`.
*
* ## Signature:
* ```js
* DS.bindAll(scope, expr, resourceName, params[, cb])
* ```
*
* ## Example:
*
* ```js
* // bind the documents with ownerId of 5 to the 'docs' property of the $scope
* var deregisterFunc = DS.bindAll($scope, 'docs', 'document', {
* where: {
* ownerId: 5
* }
* });
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {object} scope The scope to bind to.
* @param {string} expr An expression used to bind to the scope. Can be used to set nested keys, i.e. `"user.comments"`.
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {object} params Parameter object that is used in filtering the collection. Properties:
*
* - `{object=}` - `where` - Where clause.
* - `{number=}` - `limit` - Limit clause.
* - `{number=}` - `skip` - Skip clause.
* - `{number=}` - `offset` - Same as skip.
* - `{string|array=}` - `orderBy` - OrderBy clause.
*
* @param {function=} cb Optional callback executed on change. Signature: `cb(err, items)`.
*
* @returns {function} Scope $watch deregistration function.
*/
function bindOne(scope, expr, resourceName, params, cb) {
var IA = this.errors.IA;
if (!this.utils.isObject(scope)) {
throw new IA(errorPrefix + 'scope: Must be an object!');
} else if (!this.utils.isString(expr)) {
throw new IA(errorPrefix + 'expr: Must be a string!');
} else if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isObject(params)) {
throw new IA(errorPrefix + 'params: Must be an object!');
}
var _this = this;
try {
return scope.$watch(function () {
return _this.lastModified(resourceName);
}, function () {
var items = _this.filter(resourceName, params);
_this.utils.set(scope, expr, items);
if (cb) {
cb(null, items);
}
});
} catch (err) {
if (cb) {
cb(err);
} else {
throw err;
}
}
}
module.exports = bindOne;
},{}],51:[function(require,module,exports){
var errorPrefix = 'DS.bindOne(scope, expr, resourceName, id[, cb]): ';
/**
* @doc method
* @id DS.sync_methods:bindOne
* @name bindOne
* @description
* Bind an item in the data store to `scope` under the property specified by `expr`.
*
* ## Signature:
* ```js
* DS.bindOne(scope, expr, resourceName, id[, cb])
* ```
*
* ## Example:
*
* ```js
* // bind the document with id 5 to the 'doc' property of the $scope
* var deregisterFunc = DS.bindOne($scope, 'doc', 'document', 5);
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {object} scope The scope to bind to.
* @param {string} expr An expression used to bind to the scope. Can be used to set nested keys, i.e. `"user.profile"`.
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item to bind.
* @param {function=} cb Optional callback executed on change. Signature: `cb(err, item)`.
* @returns {function} Scope $watch deregistration function.
*/
function bindOne(scope, expr, resourceName, id, cb) {
var IA = this.errors.IA;
if (!this.utils.isObject(scope)) {
throw new IA(errorPrefix + 'scope: Must be an object!');
} else if (!this.utils.isString(expr)) {
throw new IA(errorPrefix + 'expr: Must be a string!');
} else if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new IA(errorPrefix + 'id: Must be a string or a number!');
}
var _this = this;
try {
return scope.$watch(function () {
return _this.lastModified(resourceName, id);
}, function () {
var item = _this.get(resourceName, id);
_this.utils.set(scope, expr, item);
if (cb) {
cb(null, item);
}
});
} catch (err) {
if (cb) {
cb(err);
} else {
throw err;
}
}
}
module.exports = bindOne;
},{}],52:[function(require,module,exports){
var errorPrefix = 'DS.changes(resourceName, id): ';
/**
* @doc method
* @id DS.sync_methods:changes
* @name changes
* @description
* Synchronously return the changes object of the item of the type specified by `resourceName` that has the primary key
* specified by `id`. This object represents the diff between the item in its current state and the state of the item
* the last time it was saved via an async adapter.
*
* ## Signature:
* ```js
* DS.changes(resourceName, id)
* ```
*
* ## Example:
*
* ```js
* var d = DS.get('document', 5); // { author: 'John Anderson', id: 5 }
*
* d.author = 'Sally';
*
* DS.changes('document', 5); // {...} Object describing changes
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item of the changes to retrieve.
* @returns {object} The changes of the item of the type specified by `resourceName` with the primary key specified by `id`.
*/
function changes(resourceName, id) {
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new this.errors.IA(errorPrefix + 'id: Must be a string or a number!');
}
var item = this.get(resourceName, id);
if (item) {
this.store[resourceName].observers[id].deliver();
return this.utils.diffObjectFromOldObject(item, this.store[resourceName].previousAttributes[id]);
}
}
module.exports = changes;
},{}],53:[function(require,module,exports){
var errorPrefix = 'DS.createInstance(resourceName[, attrs][, options]): ';
/**
* @doc method
* @id DS.sync_methods:createInstance
* @name createInstance
* @description
* Return a new instance of the specified resource.
*
* ## Signature:
* ```js
* DS.createInstance(resourceName[, attrs][, options])
* ```
*
* ## Example:
*
* ```js
* // Thanks to createInstance, you don't have to do this anymore
* var User = DS.definitions.user[DS.definitions.user.class];
*
* var user = DS.createInstance('user');
*
* user instanceof User; // true
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {object=} attrs Optional attributes to mix in to the new instance.
* @param {object=} options Optional configuration. Properties:
*
* - `{boolean=}` - `useClass` - Whether to use the resource's wrapper class. Default: `true`.
*
* @returns {object} The new instance
*/
function createInstance(resourceName, attrs, options) {
var IA = this.errors.IA;
attrs = attrs || {};
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (attrs && !this.utils.isObject(attrs)) {
throw new IA(errorPrefix + 'attrs: Must be an object!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
if (!('useClass' in options)) {
options.useClass = true;
}
var item;
if (options.useClass) {
var Func = this.definitions[resourceName][this.definitions[resourceName].class];
item = new Func();
} else {
item = {};
}
return this.utils.deepMixIn(item, attrs);
}
module.exports = createInstance;
},{}],54:[function(require,module,exports){
/*jshint evil:true*/
var errorPrefix = 'DS.defineResource(definition): ';
function Resource(utils, options) {
utils.deepMixIn(this, options);
if ('endpoint' in options) {
this.endpoint = options.endpoint;
} else {
this.endpoint = this.name;
}
}
var methodsToProxy = [
'bindAll',
'bindOne',
'changes',
'create',
'createInstance',
'destroy',
'destroyAll',
'eject',
'ejectAll',
'filter',
'find',
'findAll',
'get',
'hasChanges',
'inject',
'lastModified',
'lastSaved',
'loadRelations',
'previous',
'refresh',
'save',
'update',
'updateAll'
];
/**
* @doc method
* @id DS.sync_methods:defineResource
* @name defineResource
* @description
* Define a resource and register it with the data store.
*
* ## Signature:
* ```js
* DS.defineResource(definition)
* ```
*
* ## Example:
*
* ```js
* DS.defineResource({
* name: 'document',
* idAttribute: '_id',
* endpoint: '/documents
* baseUrl: 'http://myapp.com/api',
* beforeDestroy: function (resourceName attrs, cb) {
* console.log('looks good to me');
* cb(null, attrs);
* }
* });
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{RuntimeError}`
*
* @param {string|object} definition Name of resource or resource definition object: Properties:
*
* - `{string}` - `name` - The name by which this resource will be identified.
* - `{string="id"}` - `idAttribute` - The attribute that specifies the primary key for this resource.
* - `{string=}` - `endpoint` - The attribute that specifies the primary key for this resource. Default is the value of `name`.
* - `{string=}` - `baseUrl` - The url relative to which all AJAX requests will be made.
* - `{boolean=}` - `useClass` - Whether to use a wrapper class created from the ProperCase name of the resource. The wrapper will always be used for resources that have `methods` defined.
* - `{function=}` - `defaultFilter` - Override the filtering used internally by `DS.filter` with you own function here.
* - `{*=}` - `meta` - A property reserved for developer use. This will never be used by the API.
* - `{object=}` - `methods` - If provided, items of this resource will be wrapped in a constructor function that is
* empty save for the attributes in this option which will be mixed in to the constructor function prototype. Enabling
* this feature for this resource will incur a slight performance penalty, but allows you to give custom behavior to what
* are now "instances" of this resource.
* - `{function=}` - `beforeValidate` - Lifecycle hook. Overrides global. Signature: `beforeValidate(resourceName, attrs, cb)`. Callback signature: `cb(err, attrs)`.
* - `{function=}` - `validate` - Lifecycle hook. Overrides global. Signature: `validate(resourceName, attrs, cb)`. Callback signature: `cb(err, attrs)`.
* - `{function=}` - `afterValidate` - Lifecycle hook. Overrides global. Signature: `afterValidate(resourceName, attrs, cb)`. Callback signature: `cb(err, attrs)`.
* - `{function=}` - `beforeCreate` - Lifecycle hook. Overrides global. Signature: `beforeCreate(resourceName, attrs, cb)`. Callback signature: `cb(err, attrs)`.
* - `{function=}` - `afterCreate` - Lifecycle hook. Overrides global. Signature: `afterCreate(resourceName, attrs, cb)`. Callback signature: `cb(err, attrs)`.
* - `{function=}` - `beforeUpdate` - Lifecycle hook. Overrides global. Signature: `beforeUpdate(resourceName, attrs, cb)`. Callback signature: `cb(err, attrs)`.
* - `{function=}` - `afterUpdate` - Lifecycle hook. Overrides global. Signature: `afterUpdate(resourceName, attrs, cb)`. Callback signature: `cb(err, attrs)`.
* - `{function=}` - `beforeDestroy` - Lifecycle hook. Overrides global. Signature: `beforeDestroy(resourceName, attrs, cb)`. Callback signature: `cb(err, attrs)`.
* - `{function=}` - `afterDestroy` - Lifecycle hook. Overrides global. Signature: `afterDestroy(resourceName, attrs, cb)`. Callback signature: `cb(err, attrs)`.
* - `{function=}` - `beforeInject` - Lifecycle hook. Overrides global. Signature: `beforeInject(resourceName, attrs)`.
* - `{function=}` - `afterInject` - Lifecycle hook. Overrides global. Signature: `afterInject(resourceName, attrs)`.
* - `{function=}` - `serialize` - Serialization hook. Overrides global. Signature: `serialize(resourceName, attrs)`.
* - `{function=}` - `deserialize` - Deserialization hook. Overrides global. Signature: `deserialize(resourceName, attrs)`.
*
* See [DSProvider.defaults](/documentation/api/angular-data/DSProvider.properties:defaults).
*/
function defineResource(definition) {
var IA = this.errors.IA;
var DS = this;
if (this.utils.isString(definition)) {
definition = definition.replace(/\s/gi, '');
definition = {
name: definition
};
}
if (!this.utils.isObject(definition)) {
throw new IA(errorPrefix + 'definition: Must be an object!');
} else if (!this.utils.isString(definition.name)) {
throw new IA(errorPrefix + 'definition.name: Must be a string!');
} else if (definition.idAttribute && !this.utils.isString(definition.idAttribute)) {
throw new IA(errorPrefix + 'definition.idAttribute: Must be a string!');
} else if (definition.endpoint && !this.utils.isString(definition.endpoint)) {
throw new IA(errorPrefix + 'definition.endpoint: Must be a string!');
} else if (this.store[definition.name]) {
throw new this.errors.R(errorPrefix + definition.name + ' is already registered!');
}
try {
// Inherit from global defaults
Resource.prototype = DS.defaults;
DS.definitions[definition.name] = new Resource(DS.utils, definition);
var def = DS.definitions[definition.name];
// Remove this in v0.11.0 and make a breaking change notice
// the the `filter` option has been renamed to `defaultFilter`
if (def.filter) {
def.defaultFilter = def.filter;
delete def.filter;
}
// Setup the cache
var cache = DS.cacheFactory('DS.' + def.name, {
maxAge: def.maxAge || null,
recycleFreq: def.recycleFreq || 1000,
cacheFlushInterval: def.cacheFlushInterval || null,
deleteOnExpire: def.deleteOnExpire || 'none',
onExpire: function (id) {
DS.eject(def.name, id);
},
capacity: Number.MAX_VALUE,
storageMode: 'memory',
storageImpl: null,
disabled: false,
storagePrefix: 'DS.' + def.name
});
// Create the wrapper class for the new resource
def.class = DS.utils.pascalCase(definition.name);
eval('function ' + def.class + '() {}');
def[def.class] = eval(def.class);
// Apply developer-defined methods
if (def.methods) {
DS.utils.deepMixIn(def[def.class].prototype, def.methods);
}
// Prepare for computed properties
if (def.computed) {
DS.utils.forOwn(def.computed, function (fn, field) {
if (def.methods && field in def.methods) {
DS.$log.warn(errorPrefix + 'Computed property "' + field + '" conflicts with previously defined prototype method!');
}
var deps;
if (angular.isFunction(fn)) {
var match = fn.toString().match(/function.*?\(([\s\S]*?)\)/);
deps = match[1].split(',');
DS.$log.warn(errorPrefix + 'Use the computed property array for compatibility with minified code!');
} else {
deps = fn.slice(0, fn.length - 1);
}
fn.deps = DS.utils.filter(deps, function (dep) {
return !!dep;
});
angular.forEach(fn.deps, function (val, index) {
fn.deps[index] = val.trim();
});
});
}
// Initialize store data for the new resource
DS.store[def.name] = {
collection: [],
completedQueries: {},
pendingQueries: {},
index: cache,
modified: {},
saved: {},
previousAttributes: {},
observers: {},
collectionModified: 0
};
// Proxy DS methods with shorthand ones
angular.forEach(methodsToProxy, function (name) {
if (name === 'bindOne' || name === 'bindAll') {
def[name] = function () {
var args = Array.prototype.slice.call(arguments);
args.splice(2, 0, def.name);
return DS[name].apply(DS, args);
};
} else {
def[name] = function () {
var args = Array.prototype.slice.call(arguments);
args.unshift(def.name);
return DS[name].apply(DS, args);
};
}
});
return def;
} catch (err) {
DS.$log.error(err);
delete this.definitions[definition.name];
delete this.store[definition.name];
throw err;
}
}
module.exports = defineResource;
},{}],55:[function(require,module,exports){
var observe = require('../../../lib/observe-js/observe-js');
/**
* @doc method
* @id DS.sync_methods:digest
* @name digest
* @description
* Trigger a digest loop that checks for changes and updates the `lastModified` timestamp if an object has changed.
* Anything $watching `DS.lastModified(...)` will detect the updated timestamp and execute the callback function.
*
* ## Signature:
* ```js
* DS.digest()
* ```
*
* ## Example:
*
* ```js
* Works like $scope.$apply()
* ```
*
*/
function digest() {
if (!this.$rootScope.$$phase) {
this.$rootScope.$apply(function () {
observe.Platform.performMicrotaskCheckpoint();
});
} else {
observe.Platform.performMicrotaskCheckpoint();
}
}
module.exports = digest;
},{"../../../lib/observe-js/observe-js":1}],56:[function(require,module,exports){
var errorPrefix = 'DS.eject(resourceName, id): ';
function _eject(definition, resource, id) {
var found = false;
for (var i = 0; i < resource.collection.length; i++) {
if (resource.collection[i][definition.idAttribute] == id) {
found = true;
break;
}
}
if (found) {
resource.collection.splice(i, 1);
resource.observers[id].close();
delete resource.observers[id];
resource.index.remove(id);
delete resource.previousAttributes[id];
delete resource.modified[id];
delete resource.saved[id];
}
}
/**
* @doc method
* @id DS.sync_methods:eject
* @name eject
* @description
* Eject the item of the specified type that has the given primary key from the data store. Ejection only removes items
* from the data store and does not attempt to delete items on the server.
*
* ## Signature:
* ```js
* DS.eject(resourceName[, id])
* ```
*
* ## Example:
*
* ```js
* DS.get('document', 45); // { title: 'How to Cook', id: 45 }
*
* DS.eject('document', 45);
*
* DS.get('document', 45); // undefined
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item to eject.
*/
function eject(resourceName, id) {
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new this.errors.IA(errorPrefix + 'id: Must be a string or a number!');
}
var resource = this.store[resourceName];
var _this = this;
if (!this.$rootScope.$$phase) {
this.$rootScope.$apply(function () {
_eject(_this.definitions[resourceName], resource, id);
resource.collectionModified = _this.utils.updateTimestamp(resource.collectionModified);
});
} else {
_eject(_this.definitions[resourceName], resource, id);
resource.collectionModified = _this.utils.updateTimestamp(resource.collectionModified);
}
delete this.store[resourceName].completedQueries[id];
}
module.exports = eject;
},{}],57:[function(require,module,exports){
var errorPrefix = 'DS.ejectAll(resourceName[, params]): ';
function _ejectAll(definition, resource, params) {
var queryHash = this.utils.toJson(params);
var items = this.filter(definition.name, params);
var ids = this.utils.toLookup(items, definition.idAttribute);
var _this = this;
angular.forEach(ids, function (item, id) {
_this.eject(definition.name, id);
});
delete resource.completedQueries[queryHash];
}
/**
* @doc method
* @id DS.sync_methods:ejectAll
* @name ejectAll
* @description
* Eject all matching items of the specified type from the data store. If query is specified then all items of the
* specified type will be removed. Ejection only removes items from the data store and does not attempt to delete items
* on the server.
*
* ## Signature:
* ```js
* DS.ejectAll(resourceName[, params])
* ```
*
* ## Example:
*
* ```js
* DS.get('document', 45); // { title: 'How to Cook', id: 45 }
*
* DS.eject('document', 45);
*
* DS.get('document', 45); // undefined
* ```
*
* Eject all items of the specified type that match the criteria from the data store.
*
* ```js
* DS.filter('document'); // [ { title: 'How to Cook', id: 45, author: 'John Anderson' },
* // { title: 'How to Eat', id: 46, author: 'Sally Jane' } ]
*
* DS.ejectAll('document', { where: { author: 'Sally Jane' } });
*
* DS.filter('document'); // [ { title: 'How to Cook', id: 45, author: 'John Anderson' } ]
* ```
*
* Eject all items of the specified type from the data store.
*
* ```js
* DS.filter('document'); // [ { title: 'How to Cook', id: 45, author: 'John Anderson' },
* // { title: 'How to Eat', id: 46, author: 'Sally Jane' } ]
*
* DS.ejectAll('document');
*
* DS.filter('document'); // [ ]
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {object} params Parameter object that is serialized into the query string. Properties:
*
* - `{object=}` - `where` - Where clause.
* - `{number=}` - `limit` - Limit clause.
* - `{number=}` - `skip` - Skip clause.
* - `{number=}` - `offset` - Same as skip.
* - `{string|array=}` - `orderBy` - OrderBy clause.
*/
function ejectAll(resourceName, params) {
params = params || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isObject(params)) {
throw new this.errors.IA(errorPrefix + 'params: Must be an object!');
}
var _this = this;
var resource = this.store[resourceName];
var queryHash = this.utils.toJson(params);
delete resource.completedQueries[queryHash];
if (this.utils.isEmpty(params)) {
resource.completedQueries = {};
}
if (!this.$rootScope.$$phase) {
this.$rootScope.$apply(function () {
_ejectAll.apply(_this, [_this.definitions[resourceName], resource, params]);
resource.collectionModified = _this.utils.updateTimestamp(resource.collectionModified);
});
} else {
_ejectAll.apply(_this, [_this.definitions[resourceName], resource, params]);
resource.collectionModified = this.utils.updateTimestamp(resource.collectionModified);
}
}
module.exports = ejectAll;
},{}],58:[function(require,module,exports){
var errorPrefix = 'DS.filter(resourceName[, params][, options]): ';
/**
* @doc method
* @id DS.sync_methods:filter
* @name filter
* @description
* Synchronously filter items in the data store of the type specified by `resourceName`.
*
* ## Signature:
* ```js
* DS.filter(resourceName[, params][, options])
* ```
*
* ## Example:
*
* ```js
* TODO: filter(resourceName, params[, options]) example
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {object=} params Parameter object that is serialized into the query string. Properties:
*
* - `{object=}` - `where` - Where clause.
* - `{number=}` - `limit` - Limit clause.
* - `{number=}` - `skip` - Skip clause.
* - `{number=}` - `offset` - Same as skip.
* - `{string|array=}` - `orderBy` - OrderBy clause.
*
* @param {object=} options Optional configuration. Properties:
* - `{boolean=}` - `loadFromServer` - Send the query to server if it has not been sent yet. Default: `false`.
* - `{boolean=}` - `allowSimpleWhere` - Treat top-level fields on the `params` argument as simple "where" equality clauses. Default: `true`.
* @returns {array} The filtered collection of items of the type specified by `resourceName`.
*/
function filter(resourceName, params, options) {
var IA = this.errors.IA;
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (params && !this.utils.isObject(params)) {
throw new IA(errorPrefix + 'params: Must be an object!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
var definition = this.definitions[resourceName];
var resource = this.store[resourceName];
// Protect against null
params = params || {};
if ('allowSimpleWhere' in options) {
options.allowSimpleWhere = !!options.allowSimpleWhere;
} else {
options.allowSimpleWhere = true;
}
var queryHash = this.utils.toJson(params);
if (!(queryHash in resource.completedQueries) && options.loadFromServer) {
// This particular query has never been completed
if (!resource.pendingQueries[queryHash]) {
// This particular query has never even been started
this.findAll(resourceName, params, options);
}
}
return definition.defaultFilter.call(this, resource.collection, resourceName, params, options);
}
module.exports = filter;
},{}],59:[function(require,module,exports){
var errorPrefix = 'DS.get(resourceName, id[, options]): ';
/**
* @doc method
* @id DS.sync_methods:get
* @name get
* @description
* Synchronously return the resource with the given id. The data store will forward the request to the server if the
* item is not in the cache and `loadFromServer` is set to `true` in the options hash.
*
* ## Signature:
* ```js
* DS.get(resourceName, id[, options])
* ```
*
* ## Example:
*
* ```js
* DS.get('document', 5'); // { author: 'John Anderson', id: 5 }
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item to retrieve.
* @param {object=} options Optional configuration. Properties:
*
* - `{boolean=}` - `loadFromServer` - Send the query to server if it has not been sent yet. Default: `false`.
*
* @returns {object} The item of the type specified by `resourceName` with the primary key specified by `id`.
*/
function get(resourceName, id, options) {
var IA = this.errors.IA;
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new IA(errorPrefix + 'id: Must be a string or a number!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
var _this = this;
// cache miss, request resource from server
var item = this.store[resourceName].index.get(id);
if (!item && options.loadFromServer) {
this.find(resourceName, id).then(null, function (err) {
return _this.$q.reject(err);
});
}
// return resource from cache
return item;
}
module.exports = get;
},{}],60:[function(require,module,exports){
var errorPrefix = 'DS.hasChanges(resourceName, id): ';
function diffIsEmpty(utils, diff) {
return !(utils.isEmpty(diff.added) &&
utils.isEmpty(diff.removed) &&
utils.isEmpty(diff.changed));
}
/**
* @doc method
* @id DS.sync_methods:hasChanges
* @name hasChanges
* @description
* Synchronously return whether object of the item of the type specified by `resourceName` that has the primary key
* specified by `id` has changes.
*
* ## Signature:
* ```js
* DS.hasChanges(resourceName, id)
* ```
*
* ## Example:
*
* ```js
* var d = DS.get('document', 5); // { author: 'John Anderson', id: 5 }
*
* d.author = 'Sally';
*
* DS.hasChanges('document', 5); // true
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item.
* @returns {boolean} Whether the item of the type specified by `resourceName` with the primary key specified by `id` has changes.
*/
function hasChanges(resourceName, id) {
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new this.errors.IA(errorPrefix + 'id: Must be a string or a number!');
}
// return resource from cache
if (this.get(resourceName, id)) {
return diffIsEmpty(this.utils, this.changes(resourceName, id));
} else {
return false;
}
}
module.exports = hasChanges;
},{}],61:[function(require,module,exports){
module.exports = {
/**
* @doc method
* @id DS.sync_methods:bindOne
* @name bindOne
* @methodOf DS
* @description
* See [DS.bindOne](/documentation/api/api/DS.sync_methods:bindOne).
*/
bindOne: require('./bindOne'),
/**
* @doc method
* @id DS.sync_methods:bindAll
* @name bindAll
* @methodOf DS
* @description
* See [DS.bindAll](/documentation/api/api/DS.sync_methods:bindAll).
*/
bindAll: require('./bindAll'),
/**
* @doc method
* @id DS.sync_methods:createInstance
* @name createInstance
* @methodOf DS
* @description
* See [DS.createInstance](/documentation/api/api/DS.sync_methods:createInstance).
*/
createInstance: require('./createInstance'),
/**
* @doc method
* @id DS.sync_methods:defineResource
* @name defineResource
* @methodOf DS
* @description
* See [DS.defineResource](/documentation/api/api/DS.sync_methods:defineResource).
*/
defineResource: require('./defineResource'),
/**
* @doc method
* @id DS.sync_methods:eject
* @name eject
* @methodOf DS
* @description
* See [DS.eject](/documentation/api/api/DS.sync_methods:eject).
*/
eject: require('./eject'),
/**
* @doc method
* @id DS.sync_methods:ejectAll
* @name ejectAll
* @methodOf DS
* @description
* See [DS.ejectAll](/documentation/api/api/DS.sync_methods:ejectAll).
*/
ejectAll: require('./ejectAll'),
/**
* @doc method
* @id DS.sync_methods:filter
* @name filter
* @methodOf DS
* @description
* See [DS.filter](/documentation/api/api/DS.sync_methods:filter).
*/
filter: require('./filter'),
/**
* @doc method
* @id DS.sync_methods:get
* @name get
* @methodOf DS
* @description
* See [DS.get](/documentation/api/api/DS.sync_methods:get).
*/
get: require('./get'),
/**
* @doc method
* @id DS.sync_methods:inject
* @name inject
* @methodOf DS
* @description
* See [DS.inject](/documentation/api/api/DS.sync_methods:inject).
*/
inject: require('./inject'),
/**
* @doc method
* @id DS.sync_methods:lastModified
* @name lastModified
* @methodOf DS
* @description
* See [DS.lastModified](/documentation/api/api/DS.sync_methods:lastModified).
*/
lastModified: require('./lastModified'),
/**
* @doc method
* @id DS.sync_methods:lastSaved
* @name lastSaved
* @methodOf DS
* @description
* See [DS.lastSaved](/documentation/api/api/DS.sync_methods:lastSaved).
*/
lastSaved: require('./lastSaved'),
/**
* @doc method
* @id DS.sync_methods:digest
* @name digest
* @methodOf DS
* @description
* See [DS.digest](/documentation/api/api/DS.sync_methods:digest).
*/
digest: require('./digest'),
/**
* @doc method
* @id DS.sync_methods:changes
* @name changes
* @methodOf DS
* @description
* See [DS.changes](/documentation/api/api/DS.sync_methods:changes).
*/
changes: require('./changes'),
/**
* @doc method
* @id DS.sync_methods:previous
* @name previous
* @methodOf DS
* @description
* See [DS.previous](/documentation/api/api/DS.sync_methods:previous).
*/
previous: require('./previous'),
/**
* @doc method
* @id DS.sync_methods:hasChanges
* @name hasChanges
* @methodOf DS
* @description
* See [DS.hasChanges](/documentation/api/api/DS.sync_methods:hasChanges).
*/
hasChanges: require('./hasChanges')
};
},{"./bindAll":50,"./bindOne":51,"./changes":52,"./createInstance":53,"./defineResource":54,"./digest":55,"./eject":56,"./ejectAll":57,"./filter":58,"./get":59,"./hasChanges":60,"./inject":62,"./lastModified":63,"./lastSaved":64,"./previous":65}],62:[function(require,module,exports){
var observe = require('../../../lib/observe-js/observe-js');
var errorPrefix = 'DS.inject(resourceName, attrs[, options]): ';
function _inject(definition, resource, attrs) {
var _this = this;
var $log = _this.$log;
function _react(added, removed, changed, oldValueFn) {
var target = this;
var innerId = (oldValueFn && oldValueFn(definition.idAttribute)) ? oldValueFn(definition.idAttribute) : target[definition.idAttribute];
resource.modified[innerId] = _this.utils.updateTimestamp(resource.modified[innerId]);
resource.collectionModified = _this.utils.updateTimestamp(resource.collectionModified);
if (definition.computed) {
var item = _this.get(definition.name, innerId);
_this.utils.forOwn(definition.computed, function (fn, field) {
var compute = false;
// check if required fields changed
angular.forEach(fn.deps, function (dep) {
if (dep in added || dep in removed || dep in changed || !(field in item)) {
compute = true;
}
});
if (compute) {
var args = [];
angular.forEach(fn.deps, function (dep) {
args.push(item[dep]);
});
// recompute property
if (angular.isFunction(fn)) {
item[field] = fn.apply(item, args);
} else {
item[field] = fn[fn.length - 1].apply(item, args);
}
}
});
}
if (definition.idAttribute in changed) {
$log.error('Doh! You just changed the primary key of an object! ' +
'I don\'t know how to handle this yet, so your data for the "' + definition.name +
'" resource is now in an undefined (probably broken) state.');
}
}
var injected;
if (_this.utils.isArray(attrs)) {
injected = [];
for (var i = 0; i < attrs.length; i++) {
injected.push(_inject.call(_this, definition, resource, attrs[i]));
}
} else {
// check if "idAttribute" is a computed property
if (definition.computed && definition.computed[definition.idAttribute]) {
var args = [];
angular.forEach(definition.computed[definition.idAttribute].deps, function (dep) {
args.push(attrs[dep]);
});
attrs[definition.idAttribute] = definition.computed[definition.idAttribute].apply(attrs, args);
}
if (!(definition.idAttribute in attrs)) {
var error = new _this.errors.R(errorPrefix + 'attrs: Must contain the property specified by `idAttribute`!');
$log.error(error);
throw error;
} else {
try {
definition.beforeInject(definition.name, attrs);
var id = attrs[definition.idAttribute];
var item = this.get(definition.name, id);
if (!item) {
if (definition.methods || definition.useClass) {
if (attrs instanceof definition[definition.class]) {
item = attrs;
} else {
item = new definition[definition.class]();
}
} else {
item = {};
}
resource.previousAttributes[id] = {};
_this.utils.deepMixIn(item, attrs);
_this.utils.deepMixIn(resource.previousAttributes[id], attrs);
resource.collection.push(item);
resource.observers[id] = new observe.ObjectObserver(item);
resource.observers[id].open(_react, item);
resource.index.put(id, item);
_react.call(item, {}, {}, {});
} else {
_this.utils.deepMixIn(item, attrs);
if (typeof resource.index.touch === 'function') {
resource.index.touch(id);
} else {
resource.index.put(id, resource.index.get(id));
}
resource.observers[id].deliver();
}
resource.saved[id] = _this.utils.updateTimestamp(resource.saved[id]);
definition.afterInject(definition.name, item);
injected = item;
} catch (err) {
$log.error(err);
$log.error('inject failed!', definition.name, attrs);
}
}
}
return injected;
}
function _injectRelations(definition, injected) {
var _this = this;
_this.utils.forOwn(definition.relations, function (relation, type) {
_this.utils.forOwn(relation, function (def, relationName) {
if (_this.definitions[relationName] && injected[def.localField]) {
try {
injected[def.localField] = _this.inject(relationName, injected[def.localField]);
} catch (err) {
_this.$log.error(errorPrefix + 'Failed to inject ' + type + ' relation: "' + relationName + '"!', err);
}
}
});
});
}
/**
* @doc method
* @id DS.sync_methods:inject
* @name inject
* @description
* Inject the given item into the data store as the specified type. If `attrs` is an array, inject each item into the
* data store. Injecting an item into the data store does not save it to the server.
*
* ## Signature:
* ```js
* DS.inject(resourceName, attrs[, options])
* ```
*
* ## Examples:
*
* ```js
* DS.get('document', 45); // undefined
*
* DS.inject('document', { title: 'How to Cook', id: 45 });
*
* DS.get('document', 45); // { title: 'How to Cook', id: 45 }
* ```
*
* Inject a collection into the data store:
*
* ```js
* DS.filter('document'); // [ ]
*
* DS.inject('document', [ { title: 'How to Cook', id: 45 }, { title: 'How to Eat', id: 46 } ]);
*
* DS.filter('document'); // [ { title: 'How to Cook', id: 45 }, { title: 'How to Eat', id: 46 } ]
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{RuntimeError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {object|array} attrs The item or collection of items to inject into the data store.
* @param {object=} options Optional configuration. Properties:
* @returns {object|array} A reference to the item that was injected into the data store or an array of references to
* the items that were injected into the data store.
*/
function inject(resourceName, attrs, options) {
var IA = this.errors.IA;
options = options || {};
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isObject(attrs) && !this.utils.isArray(attrs)) {
throw new IA(errorPrefix + 'attrs: Must be an object or an array!');
} else if (!this.utils.isObject(options)) {
throw new IA(errorPrefix + 'options: Must be an object!');
}
var definition = this.definitions[resourceName];
var resource = this.store[resourceName];
var _this = this;
var injected;
if (!this.$rootScope.$$phase) {
this.$rootScope.$apply(function () {
injected = _inject.call(_this, definition, resource, attrs);
});
} else {
injected = _inject.call(_this, definition, resource, attrs);
}
if (definition.relations) {
_injectRelations.call(_this, definition, injected);
}
return injected;
}
module.exports = inject;
},{"../../../lib/observe-js/observe-js":1}],63:[function(require,module,exports){
var errorPrefix = 'DS.lastModified(resourceName[, id]): ';
/**
* @doc method
* @id DS.sync_methods:lastModified
* @name lastModified
* @description
* Return the timestamp of the last time either the collection for `resourceName` or the item of type `resourceName`
* with the given primary key was modified.
*
* ## Signature:
* ```js
* DS.lastModified(resourceName[, id])
* ```
*
* ## Example:
*
* ```js
* DS.lastModified('document', 5); // undefined
*
* DS.find('document', 5).then(function (document) {
* DS.lastModified('document', 5); // 1234235825494
* });
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number=} id The primary key of the item to remove.
* @returns {number} The timestamp of the last time either the collection for `resourceName` or the item of type
* `resourceName` with the given primary key was modified.
*/
function lastModified(resourceName, id) {
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (id && !this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new this.errors.IA(errorPrefix + 'id: Must be a string or a number!');
}
if (id) {
if (!(id in this.store[resourceName].modified)) {
this.store[resourceName].modified[id] = 0;
}
return this.store[resourceName].modified[id];
}
return this.store[resourceName].collectionModified;
}
module.exports = lastModified;
},{}],64:[function(require,module,exports){
var errorPrefix = 'DS.lastSaved(resourceName[, id]): ';
/**
* @doc method
* @id DS.sync_methods:lastSaved
* @name lastSaved
* @description
* Return the timestamp of the last time either the collection for `resourceName` or the item of type `resourceName`
* with the given primary key was saved via an async adapter.
*
* ## Signature:
* ```js
* DS.lastSaved(resourceName[, id])
* ```
*
* ## Example:
*
* ```js
* DS.lastModified('document', 5); // undefined
* DS.lastSaved('document', 5); // undefined
*
* DS.find('document', 5).then(function (document) {
* DS.lastModified('document', 5); // 1234235825494
* DS.lastSaved('document', 5); // 1234235825494
*
* document.author = 'Sally';
*
* DS.lastModified('document', 5); // 1234304985344 - something different
* DS.lastSaved('document', 5); // 1234235825494 - still the same
* });
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item for which to retrieve the lastSaved timestamp.
* @returns {number} The timestamp of the last time the item of type `resourceName` with the given primary key was saved.
*/
function lastSaved(resourceName, id) {
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new this.errors.IA(errorPrefix + 'id: Must be a string or a number!');
}
if (!(id in this.store[resourceName].saved)) {
this.store[resourceName].saved[id] = 0;
}
return this.store[resourceName].saved[id];
}
module.exports = lastSaved;
},{}],65:[function(require,module,exports){
var errorPrefix = 'DS.previous(resourceName, id): ';
/**
* @doc method
* @id DS.sync_methods:previous
* @name previous
* @description
* Synchronously return the previous attributes of the item of the type specified by `resourceName` that has the primary key
* specified by `id`. This object represents the state of the item the last time it was saved via an async adapter.
*
* ## Signature:
* ```js
* DS.previous(resourceName, id)
* ```
*
* ## Example:
*
* ```js
* var d = DS.get('document', 5); // { author: 'John Anderson', id: 5 }
*
* d.author = 'Sally';
*
* d; // { author: 'Sally', id: 5 }
*
* DS.previous('document', 5); // { author: 'John Anderson', id: 5 }
* ```
*
* ## Throws
*
* - `{IllegalArgumentError}`
* - `{NonexistentResourceError}`
*
* @param {string} resourceName The resource type, e.g. 'user', 'comment', etc.
* @param {string|number} id The primary key of the item whose previous attributes are to be retrieved.
* @returns {object} The previous attributes of the item of the type specified by `resourceName` with the primary key specified by `id`.
*/
function previous(resourceName, id) {
if (!this.definitions[resourceName]) {
throw new this.errors.NER(errorPrefix + resourceName);
} else if (!this.utils.isString(id) && !this.utils.isNumber(id)) {
throw new this.errors.IA(errorPrefix + 'id: Must be a string or a number!');
}
// return resource from cache
return angular.copy(this.store[resourceName].previousAttributes[id]);
}
module.exports = previous;
},{}],66:[function(require,module,exports){
/**
* @doc function
* @id errors.types:IllegalArgumentError
* @name IllegalArgumentError
* @description Error that is thrown/returned when a caller does not honor the pre-conditions of a method/function.
* @param {string=} message Error message. Default: `"Illegal Argument!"`.
* @returns {IllegalArgumentError} A new instance of `IllegalArgumentError`.
*/
function IllegalArgumentError(message) {
Error.call(this);
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor);
}
/**
* @doc property
* @id errors.types:IllegalArgumentError.type
* @name type
* @propertyOf errors.types:IllegalArgumentError
* @description Name of error type. Default: `"IllegalArgumentError"`.
*/
this.type = this.constructor.name;
/**
* @doc property
* @id errors.types:IllegalArgumentError.message
* @name message
* @propertyOf errors.types:IllegalArgumentError
* @description Error message. Default: `"Illegal Argument!"`.
*/
this.message = message || 'Illegal Argument!';
}
IllegalArgumentError.prototype = Object.create(Error.prototype);
IllegalArgumentError.prototype.constructor = IllegalArgumentError;
/**
* @doc function
* @id errors.types:RuntimeError
* @name RuntimeError
* @description Error that is thrown/returned for invalid state during runtime.
* @param {string=} message Error message. Default: `"Runtime Error!"`.
* @returns {RuntimeError} A new instance of `RuntimeError`.
*/
function RuntimeError(message) {
Error.call(this);
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor);
}
/**
* @doc property
* @id errors.types:RuntimeError.type
* @name type
* @propertyOf errors.types:RuntimeError
* @description Name of error type. Default: `"RuntimeError"`.
*/
this.type = this.constructor.name;
/**
* @doc property
* @id errors.types:RuntimeError.message
* @name message
* @propertyOf errors.types:RuntimeError
* @description Error message. Default: `"Runtime Error!"`.
*/
this.message = message || 'RuntimeError Error!';
}
RuntimeError.prototype = Object.create(Error.prototype);
RuntimeError.prototype.constructor = RuntimeError;
/**
* @doc function
* @id errors.types:NonexistentResourceError
* @name NonexistentResourceError
* @description Error that is thrown/returned when trying to access a resource that does not exist.
* @param {string=} resourceName Name of non-existent resource.
* @returns {NonexistentResourceError} A new instance of `NonexistentResourceError`.
*/
function NonexistentResourceError(resourceName) {
Error.call(this);
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor);
}
/**
* @doc property
* @id errors.types:NonexistentResourceError.type
* @name type
* @propertyOf errors.types:NonexistentResourceError
* @description Name of error type. Default: `"NonexistentResourceError"`.
*/
this.type = this.constructor.name;
/**
* @doc property
* @id errors.types:NonexistentResourceError.message
* @name message
* @propertyOf errors.types:NonexistentResourceError
* @description Error message. Default: `"Runtime Error!"`.
*/
this.message = (resourceName || '') + ' is not a registered resource!';
}
NonexistentResourceError.prototype = Object.create(Error.prototype);
NonexistentResourceError.prototype.constructor = NonexistentResourceError;
/**
* @doc interface
* @id errors
* @name angular-data error types
* @description
* Various error types that may be thrown by angular-data.
*
* - [IllegalArgumentError](/documentation/api/api/errors.types:IllegalArgumentError)
* - [RuntimeError](/documentation/api/api/errors.types:RuntimeError)
* - [NonexistentResourceError](/documentation/api/api/errors.types:NonexistentResourceError)
*
* References to the constructor functions of these errors can be found in `DS.errors`.
*/
module.exports = [function () {
return {
IllegalArgumentError: IllegalArgumentError,
IA: IllegalArgumentError,
RuntimeError: RuntimeError,
R: RuntimeError,
NonexistentResourceError: NonexistentResourceError,
NER: NonexistentResourceError
};
}];
},{}],67:[function(require,module,exports){
(function (window, angular, undefined) {
'use strict';
/**
* @doc overview
* @id angular-data
* @name angular-data
* @description
* __Version:__ 0.10.0
*
* ## Install
*
* #### Bower
* ```text
* bower install angular-data
* ```
*
* Load `dist/angular-data.js` or `dist/angular-data.min.js` onto your web page after Angular.js.
*
* #### Npm
* ```text
* npm install angular-data
* ```
*
* Load `dist/angular-data.js` or `dist/angular-data.min.js` onto your web page after Angular.js.
*
* #### Manual download
* Download angular-data-<%= pkg.version %>.js from the [Releases](https://github.com/jmdobry/angular-data/releases)
* section of the angular-data GitHub project.
*
* ## Load into Angular
* Your Angular app must depend on the module `"angular-data.DS"` in order to use angular-data. Loading
* angular-data into your app allows you to inject the following:
*
* - `DS`
* - `DSHttpAdapter`
* - `DSUtils`
* - `DSErrors`
*
* [DS](/documentation/api/api/DS) is the Data Store itself, which you will inject often.
* [DSHttpAdapter](/documentation/api/api/DSHttpAdapter) is useful as a wrapper for `$http` and is configurable.
* [DSUtils](/documentation/api/api/DSUtils) has some useful utility methods.
* [DSErrors](/documentation/api/api/DSErrors) provides references to the various errors thrown by the data store.
*/
angular.module('angular-data.DS', ['ng'])
.factory('DSUtils', require('./utils'))
.factory('DSErrors', require('./errors'))
.provider('DSHttpAdapter', require('./adapters/http'))
.provider('DSLocalStorageAdapter', require('./adapters/localStorage'))
.provider('DS', require('./datastore'))
.config(['$provide', function ($provide) {
$provide.decorator('$q', ['$delegate', function ($delegate) {
// do whatever you you want
$delegate.promisify = function (fn, target) {
var _this = this;
return function () {
var deferred = _this.defer(),
args = Array.prototype.slice.apply(arguments);
args.push(function (err, result) {
if (err) {
deferred.reject(err);
} else {
deferred.resolve(result);
}
});
try {
fn.apply(target || this, args);
} catch (err) {
deferred.reject(err);
}
return deferred.promise;
};
};
return $delegate;
}]);
}]);
})(window, window.angular);
},{"./adapters/http":36,"./adapters/localStorage":37,"./datastore":49,"./errors":66,"./utils":68}],68:[function(require,module,exports){
module.exports = [function () {
return {
isBoolean: require('mout/lang/isBoolean'),
isString: angular.isString,
isArray: angular.isArray,
isObject: angular.isObject,
isNumber: angular.isNumber,
isFunction: angular.isFunction,
isEmpty: require('mout/lang/isEmpty'),
toJson: angular.toJson,
makePath: require('mout/string/makePath'),
upperCase: require('mout/string/upperCase'),
pascalCase: require('mout/string/pascalCase'),
deepMixIn: require('mout/object/deepMixIn'),
forOwn: require('mout/object/forOwn'),
pick: require('mout/object/pick'),
set: require('mout/object/set'),
contains: require('mout/array/contains'),
filter: require('mout/array/filter'),
toLookup: require('mout/array/toLookup'),
slice: require('mout/array/slice'),
sort: require('mout/array/sort'),
updateTimestamp: function (timestamp) {
var newTimestamp = typeof Date.now === 'function' ? Date.now() : new Date().getTime();
if (timestamp && newTimestamp <= timestamp) {
return timestamp + 1;
} else {
return newTimestamp;
}
},
deepFreeze: function deepFreeze(o) {
if (typeof Object.freeze === 'function') {
var prop, propKey;
Object.freeze(o); // First freeze the object.
for (propKey in o) {
prop = o[propKey];
if (!o.hasOwnProperty(propKey) || typeof prop !== 'object' || Object.isFrozen(prop)) {
// If the object is on the prototype, not an object, or is already frozen,
// skip it. Note that this might leave an unfrozen reference somewhere in the
// object if there is an already frozen object containing an unfrozen object.
continue;
}
deepFreeze(prop); // Recursively call deepFreeze.
}
}
},
diffObjectFromOldObject: function (object, oldObject) {
var added = {};
var removed = {};
var changed = {};
for (var prop in oldObject) {
var newValue = object[prop];
if (newValue !== undefined && newValue === oldObject[prop])
continue;
if (!(prop in object)) {
removed[prop] = undefined;
continue;
}
if (newValue !== oldObject[prop])
changed[prop] = newValue;
}
for (var prop2 in object) {
if (prop2 in oldObject)
continue;
added[prop2] = object[prop2];
}
return {
added: added,
removed: removed,
changed: changed
};
}
};
}];
},{"mout/array/contains":2,"mout/array/filter":3,"mout/array/slice":7,"mout/array/sort":8,"mout/array/toLookup":9,"mout/lang/isBoolean":14,"mout/lang/isEmpty":15,"mout/object/deepMixIn":22,"mout/object/forOwn":24,"mout/object/pick":27,"mout/object/set":28,"mout/string/makePath":31,"mout/string/pascalCase":32,"mout/string/upperCase":35}]},{},[67]); |
src/components/PhotoGrid.js | bigwisu/asik-sehat | import React, { Component } from 'react';
import Photo from "./Photo";
import { connect } from "react-redux";
const mapStateToProps = (state) => {
return {
posts: state.posts
}
}
class PhotoGrid extends Component {
render() {
return (
<div className="photo-grid">
{
this.props.posts.map((post, i) => <Photo {...this.props} key={i} i={i} post={post} />)
}
</div>
)
}
}
export default connect(mapStateToProps)(PhotoGrid) |
src/Tooltip.js | erictherobot/react-bootstrap | import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
import CustomPropTypes from './utils/CustomPropTypes';
const Tooltip = React.createClass({
mixins: [BootstrapMixin],
propTypes: {
/**
* An html id attribute, necessary for accessibility
* @type {string}
* @required
*/
id: CustomPropTypes.isRequiredForA11y(
React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number
])
),
/**
* Sets the direction the Tooltip is positioned towards.
*/
placement: React.PropTypes.oneOf(['top', 'right', 'bottom', 'left']),
/**
* The "left" position value for the Tooltip.
*/
positionLeft: React.PropTypes.number,
/**
* The "top" position value for the Tooltip.
*/
positionTop: React.PropTypes.number,
/**
* The "left" position value for the Tooltip arrow.
*/
arrowOffsetLeft: React.PropTypes.oneOfType([
React.PropTypes.number, React.PropTypes.string
]),
/**
* The "top" position value for the Tooltip arrow.
*/
arrowOffsetTop: React.PropTypes.oneOfType([
React.PropTypes.number, React.PropTypes.string
]),
/**
* Title text
*/
title: React.PropTypes.node
},
getDefaultProps() {
return {
placement: 'right'
};
},
render() {
const classes = {
'tooltip': true,
[this.props.placement]: true
};
const style = {
'left': this.props.positionLeft,
'top': this.props.positionTop,
...this.props.style
};
const arrowStyle = {
'left': this.props.arrowOffsetLeft,
'top': this.props.arrowOffsetTop
};
return (
<div role="tooltip" {...this.props} className={classNames(this.props.className, classes)} style={style}>
<div className="tooltip-arrow" style={arrowStyle} />
<div className="tooltip-inner">
{this.props.children}
</div>
</div>
);
}
});
export default Tooltip;
|
ajax/libs/bootstrap.native/2.0.9/bootstrap-native-v4.js | seogi1004/cdnjs | // Native Javascript for Bootstrap 4 v2.0.9 | © dnp_theme | MIT-License
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD support:
define([], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like:
module.exports = factory();
} else {
// Browser globals (root is window)
var bsn = factory();
root.Alert = bsn.Alert;
root.Button = bsn.Button;
root.Carousel = bsn.Carousel;
root.Collapse = bsn.Collapse;
root.Dropdown = bsn.Dropdown;
root.Modal = bsn.Modal;
root.Popover = bsn.Popover;
root.ScrollSpy = bsn.ScrollSpy;
root.Tab = bsn.Tab;
root.Tooltip = bsn.Tooltip;
}
}(this, function () {
/* Native Javascript for Bootstrap 4 | Internal Utility Functions
----------------------------------------------------------------*/
// globals
var globalObject = typeof global !== 'undefined' ? global : this||window,
doc = document.documentElement, body = document.body,
// function toggle attributes
dataToggle = 'data-toggle',
dataDismiss = 'data-dismiss',
dataSpy = 'data-spy',
dataRide = 'data-ride',
// components
stringAlert = 'Alert',
stringButton = 'Button',
stringCarousel = 'Carousel',
stringCollapse = 'Collapse',
stringDropdown = 'Dropdown',
stringModal = 'Modal',
stringPopover = 'Popover',
stringScrollSpy = 'ScrollSpy',
stringTab = 'Tab',
stringTooltip = 'Tooltip',
// options DATA API
databackdrop = 'data-backdrop',
dataKeyboard = 'data-keyboard',
dataTarget = 'data-target',
dataInterval = 'data-interval',
dataHeight = 'data-height',
dataPause = 'data-pause',
dataOriginalTitle = 'data-original-title',
dataOriginalText = 'data-original-text',
dataDismissible = 'data-dismissible',
dataTrigger = 'data-trigger',
dataAnimation = 'data-animation',
dataContainer = 'data-container',
dataPlacement = 'data-placement',
dataDelay = 'data-delay',
dataOffsetTop = 'data-offset-top',
dataOffsetBottom = 'data-offset-bottom',
// option keys
backdrop = 'backdrop', keyboard = 'keyboard', delay = 'delay',
content = 'content', target = 'target',
interval = 'interval', pause = 'pause', animation = 'animation',
placement = 'placement', container = 'container',
// box model
offsetTop = 'offsetTop', offsetBottom = 'offsetBottom',
offsetLeft = 'offsetLeft',
scrollTop = 'scrollTop', scrollLeft = 'scrollLeft',
clientWidth = 'clientWidth', clientHeight = 'clientHeight',
offsetWidth = 'offsetWidth', offsetHeight = 'offsetHeight',
innerWidth = 'innerWidth', innerHeight = 'innerHeight',
scrollHeight = 'scrollHeight', height = 'height',
// aria
ariaExpanded = 'aria-expanded',
ariaHidden = 'aria-hidden',
// event names
clickEvent = 'click',
hoverEvent = 'hover',
keydownEvent = 'keydown',
resizeEvent = 'resize',
scrollEvent = 'scroll',
// originalEvents
showEvent = 'show',
shownEvent = 'shown',
hideEvent = 'hide',
hiddenEvent = 'hidden',
closeEvent = 'close',
closedEvent = 'closed',
slidEvent = 'slid',
slideEvent = 'slide',
changeEvent = 'change',
// other
getAttribute = 'getAttribute',
setAttribute = 'setAttribute',
hasAttribute = 'hasAttribute',
getElementsByTagName = 'getElementsByTagName',
getBoundingClientRect = 'getBoundingClientRect',
getElementsByCLASSNAME = 'getElementsByClassName',
indexOf = 'indexOf',
parentNode = 'parentNode',
length = 'length',
toLowerCase = 'toLowerCase',
Transition = 'Transition',
Webkit = 'Webkit',
style = 'style',
active = 'active',
showClass = 'show',
collapsing = 'collapsing',
disabled = 'disabled',
loading = 'loading',
left = 'left',
right = 'right',
top = 'top',
bottom = 'bottom',
// tooltip / popover
fixedTop = 'fixed-top',
fixedBottom = 'fixed-bottom',
mouseHover = ('onmouseleave' in document) ? [ 'mouseenter', 'mouseleave'] : [ 'mouseover', 'mouseout' ],
tipPositions = /\b(top|bottom|left|top)+/,
// transitionEnd since 2.0.4
supportTransitions = Webkit+Transition in doc[style] || Transition[toLowerCase]() in doc[style],
transitionEndEvent = Webkit+Transition in doc[style] ? Webkit[toLowerCase]()+Transition+'End' : Transition[toLowerCase]()+'end',
// set new focus element since 2.0.3
setFocus = function(element){
element.focus ? element.focus() : element.setActive();
},
// class manipulation, since 2.0.0 requires polyfill.js
addClass = function(element,classNAME) {
element.classList.add(classNAME);
},
removeClass = function(element,classNAME) {
element.classList.remove(classNAME);
},
hasClass = function(element,classNAME){ // since 2.0.0
return element.classList.contains(classNAME);
},
// selection methods
getElementsByClassName = function(element,classNAME) { // returns Array
return [].slice.call(element[getElementsByCLASSNAME]( classNAME ));
},
queryElement = function (selector, parent) {
var lookUp = parent ? parent : document;
return typeof selector === 'object' ? selector : lookUp.querySelector(selector);
},
getClosest = function (element, selector) { //element is the element and selector is for the closest parent element to find
// source http://gomakethings.com/climbing-up-and-down-the-dom-tree-with-vanilla-javascript/
var firstChar = selector.charAt(0);
for ( ; element && element !== document; element = element[parentNode] ) {// Get closest match
if ( firstChar === '.' ) {// If selector is a class
if ( queryElement(selector,element[parentNode]) !== null && hasClass(element,selector.replace('.','')) ) { return element; }
} else if ( firstChar === '#' ) { // If selector is an ID
if ( element.id === selector.substr(1) ) { return element; }
}
}
return false;
},
// event attach jQuery style / trigger since 1.2.0
on = function (element, event, handler) {
element.addEventListener(event, handler, false);
},
off = function(element, event, handler) {
element.removeEventListener(event, handler, false);
},
one = function (element, event, handler) { // one since 2.0.4
on(element, event, function handlerWrapper(e){
handler(e);
off(element, event, handlerWrapper);
});
},
emulateTransitionEnd = function(element,handler){ // emulateTransitionEnd since 2.0.4
if (supportTransitions) { one(element, transitionEndEvent, function(e){ handler(e); }); }
else { handler(); }
},
bootstrapCustomEvent = function (eventName, componentName, related) {
var OriginalCustomEvent = new CustomEvent( eventName + '.bs.' + componentName);
OriginalCustomEvent.relatedTarget = related;
this.dispatchEvent(OriginalCustomEvent);
},
// reference a live collection of the DOM
AllDOMElements = document[getElementsByTagName]('*'),
// Init DATA API
initializeDataAPI = function( component, constructor, dataAttribute, collection ){
var lookUp = collection && collection[length] ? collection : AllDOMElements;
for (var i=0; i < lookUp[length]; i++) {
var attrValue = lookUp[i][getAttribute](dataAttribute), expectedAttrValue = component.replace(/spy/i,'')[toLowerCase]();
if ( attrValue && component === stringButton && ( attrValue[indexOf](expectedAttrValue) > -1 ) // data-toggle="buttons"
|| attrValue === expectedAttrValue ) { // all other components
new constructor(lookUp[i]);
}
}
},
// tab / collapse stuff
targetsReg = /^\#(.)+$/,
getOuterHeight = function (child) {
var childStyle = child && globalObject.getComputedStyle(child),
btp = /px/.test(childStyle.borderTopWidth) ? Math.round(childStyle.borderTopWidth.replace('px','')) : 0,
btb = /px/.test(childStyle.borderBottomWidth) ? Math.round(childStyle.borderBottomWidth.replace('px','')) : 0,
mtp = /px/.test(childStyle.marginTop) ? Math.round(childStyle.marginTop.replace('px','')) : 0,
mbp = /px/.test(childStyle.marginBottom) ? Math.round(childStyle.marginBottom.replace('px','')) : 0;
return child[clientHeight] + parseInt( btp ) + parseInt( btb ) + parseInt( mtp ) + parseInt( mbp );
},
getMaxHeight = function(parent) { // get collapse trueHeight and border
var parentHeight = 0;
for (var k = 0, ll = parent.children[length]; k < ll; k++) {
parentHeight += getOuterHeight(parent.children[k]);
}
return parentHeight;
},
// tooltip / popover stuff
isElementInViewport = function(element) { // check if this.tooltip is in viewport
var rect = element[getBoundingClientRect]();
return ( rect[top] >= 0 && rect[left] >= 0 &&
rect[bottom] <= (globalObject[innerHeight] || doc[clientHeight]) &&
rect[right] <= (globalObject[innerWidth] || doc[clientWidth]) )
},
getScroll = function() { // also Affix and ScrollSpy uses it
return {
y : globalObject.pageYOffset || doc[scrollTop],
x : globalObject.pageXOffset || doc[scrollLeft]
}
},
styleTip = function(link,element,position,parent) { // both popovers and tooltips
var rect = link[getBoundingClientRect](),
scroll = parent === body ? getScroll() : { x: parent[offsetLeft] + parent[scrollLeft], y: parent[offsetTop] + parent[scrollTop] },
linkDimensions = { w: rect[right] - rect[left], h: rect[bottom] - rect[top] },
elementDimensions = { w : element[offsetWidth], h: element[offsetHeight] };
// apply styling to tooltip or popover
if ( position === top ) { // TOP
element[style][top] = rect[top] + scroll.y - elementDimensions.h + 'px';
element[style][left] = rect[left] + scroll.x - elementDimensions.w/2 + linkDimensions.w/2 + 'px'
} else if ( position === bottom ) { // BOTTOM
element[style][top] = rect[top] + scroll.y + linkDimensions.h + 'px';
element[style][left] = rect[left] + scroll.x - elementDimensions.w/2 + linkDimensions.w/2 + 'px';
} else if ( position === left ) { // LEFT
element[style][top] = rect[top] + scroll.y - elementDimensions.h/2 + linkDimensions.h/2 + 'px';
element[style][left] = rect[left] + scroll.x - elementDimensions.w + 'px';
} else if ( position === right ) { // RIGHT
element[style][top] = rect[top] + scroll.y - elementDimensions.h/2 + linkDimensions.h/2 + 'px';
element[style][left] = rect[left] + scroll.x + linkDimensions.w + 'px';
}
element.className[indexOf](position) === -1 && (element.className = element.className.replace(tipPositions,position));
},
updatePlacement = function(position) {
return position === top ? bottom : // top
position === bottom ? top : // bottom
position === left ? right : // left
position === right ? left : position; // right
};
/* Native Javascript for Bootstrap 4 | Alert
-------------------------------------------*/
// ALERT DEFINITION
// ================
var Alert = function( element ) {
// initialization element
element = queryElement(element);
// bind, target alert, duration and stuff
var self = this, component = 'alert',
alert = getClosest(element,'.'+component),
// handlers
clickHandler = function(e){
var eventTarget = e[target];
eventTarget = eventTarget[hasAttribute](dataDismiss) ? eventTarget : eventTarget[parentNode];
if (eventTarget && eventTarget[hasAttribute](dataDismiss)) { // we double check the data attribute, it's important
alert = getClosest(eventTarget,'.'+component);
element = queryElement('['+dataDismiss+'="'+component+'"]',alert);
(element === eventTarget || element === eventTarget[parentNode]) && alert && self.close();
}
},
transitionEndHandler = function(){
bootstrapCustomEvent.call(alert, closedEvent, component);
off(element, clickEvent, clickHandler); // detach it's listener
alert[parentNode].removeChild(alert);
};
// public method
this.close = function() {
if ( alert && element && hasClass(alert,showClass) ) {
bootstrapCustomEvent.call(alert, closeEvent, component);
removeClass(alert,showClass);
(function(){ alert && emulateTransitionEnd(alert,transitionEndHandler);}())
}
};
// init
if ( !(stringAlert in element ) ) { // prevent adding event handlers twice
on(element, clickEvent, clickHandler);
}
element[stringAlert] = this;
};
// ALERT DATA API
// ==============
initializeDataAPI ( stringAlert, Alert, dataDismiss );
/* Native Javascript for Bootstrap 4 | Button
---------------------------------------------*/
// BUTTON DEFINITION
// ===================
var Button = function( element ) {
// initialization element
element = queryElement(element);
// constant
var toggled = false, // toggled makes sure to prevent triggering twice the change.bs.button events
// strings
component = 'button',
checked = 'checked',
reset = 'reset',
LABEL = 'LABEL',
INPUT = 'INPUT',
// private methods
toggle = function(e) {
var parent = e[target][parentNode],
label = e[target].tagName === LABEL ? e[target] : parent.tagName === LABEL ? parent : null; // the .btn label
if ( !label ) return; //react if a label or its immediate child is clicked
var eventTarget = this, // the button group, the target of the handler function
labels = getElementsByClassName(eventTarget,'btn'), // all the button group buttons
input = label[getElementsByTagName](INPUT)[0];
if ( !input ) return; //return if no input found
// manage the dom manipulation
if ( input.type === 'checkbox' ) { //checkboxes
if ( !input[checked] ) {
addClass(label,active);
input[getAttribute](checked);
input[setAttribute](checked,checked);
input[checked] = true;
} else {
removeClass(label,active);
input[getAttribute](checked);
input.removeAttribute(checked);
input[checked] = false;
}
if (!toggled) { // prevent triggering the event twice
toggled = true;
bootstrapCustomEvent.call(input, changeEvent, component); //trigger the change for the input
bootstrapCustomEvent.call(element, changeEvent, component); //trigger the change for the btn-group
}
}
if ( input.type === 'radio' && !toggled ) { // radio buttons
if ( !input[checked] ) { // don't trigger if already active
addClass(label,active);
input[setAttribute](checked,checked);
input[checked] = true;
bootstrapCustomEvent.call(input, changeEvent, component); //trigger the change for the input
bootstrapCustomEvent.call(element, changeEvent, component); //trigger the change for the btn-group
toggled = true;
for (var i = 0, ll = labels[length]; i<ll; i++) {
var otherLabel = labels[i], otherInput = otherLabel[getElementsByTagName](INPUT)[0];
if ( otherLabel !== label && hasClass(otherLabel,active) ) {
removeClass(otherLabel,active);
otherInput.removeAttribute(checked);
otherInput[checked] = false;
bootstrapCustomEvent.call(otherInput, changeEvent, component); // trigger the change
}
}
}
}
setTimeout( function() { toggled = false; }, 50 );
};
// init
if ( hasClass(element,'btn-group') ) {
if ( !( stringButton in element ) ) { // prevent adding event handlers twice
on( element, clickEvent, toggle );
}
element[stringButton] = this;
}
};
// BUTTON DATA API
// =================
initializeDataAPI( stringButton, Button, dataToggle );
/* Native Javascript for Bootstrap 4 | Carousel
----------------------------------------------*/
// CAROUSEL DEFINITION
// ===================
var Carousel = function( element, options ) {
// initialization element
element = queryElement( element );
// set options
options = options || {};
// DATA API
var intervalData = element[getAttribute](dataInterval) === 'false' ? false : parseInt(element[getAttribute](dataInterval)) || 5000, // bootstrap carousel default interval
pauseData = element[getAttribute](dataPause) === hoverEvent || false,
keyboardData = element[getAttribute](dataKeyboard) === 'true' || false,
// strings
component = 'carousel',
paused = 'paused',
direction = 'direction',
carouselItem = 'carousel-item',
dataSlideTo = 'data-slide-to';
this[keyboard] = options[keyboard] === true || keyboardData;
this[pause] = (options[pause] === hoverEvent || pauseData) ? hoverEvent : false; // false / hover
if ( !( options[interval] || intervalData ) ) { // determine slide interval
this[interval] = false;
} else {
this[interval] = parseInt(options[interval]) || intervalData; // default slide interval
}
// bind, event targets
var self = this, index = element.index = 0, timer = element.timer = 0,
isSliding = false, // isSliding prevents click event handlers when animation is running
slides = getElementsByClassName(element,carouselItem), total = slides[length],
slideDirection = this[direction] = left,
leftArrow = getElementsByClassName(element,component+'-control-prev')[0],
rightArrow = getElementsByClassName(element,component+'-control-next')[0],
indicator = queryElement( '.'+component+'-indicators', element ),
indicators = indicator && indicator[getElementsByTagName]( "LI" ) || [];
// handlers
var pauseHandler = function () {
if ( self[interval] !==false && !hasClass(element,paused) ) {
addClass(element,paused);
!isSliding && clearInterval( timer );
}
},
resumeHandler = function() {
if ( self[interval] !== false && hasClass(element,paused) ) {
removeClass(element,paused);
!isSliding && clearInterval( timer );
!isSliding && self.cycle();
}
},
indicatorHandler = function(e) {
e.preventDefault();
if (isSliding) return;
var eventTarget = e[target], activeIndicator = self.getActiveIndex(); // event target | the current active item
if ( eventTarget && !hasClass(eventTarget,active) && eventTarget[getAttribute](dataSlideTo) ) {
index = parseInt( eventTarget[getAttribute](dataSlideTo), 10 );
//determine direction first
if ( (activeIndicator < index ) || (activeIndicator === 0 && index === total -1 ) ) {
slideDirection = self[direction] = left; // next
} else if ( (activeIndicator > index) || (activeIndicator === total - 1 && index === 0 ) ) {
slideDirection = self[direction] = right; // prev
}
} else { return false; }
self.slideTo( index ); //Do the slide
},
controlsHandler = function (e) {
e.preventDefault();
if (isSliding) return;
var eventTarget = e.currentTarget || e.srcElement;
if ( eventTarget === rightArrow ) {
index++;
slideDirection = self[direction] = left; //set direction first
if( index === total - 1 ) {
index = total - 1;
} else if ( index === total ){
index = 0;
}
} else if ( eventTarget === leftArrow ) {
index--;
slideDirection = self[direction] = right; //set direction first
if( index === 0 ) {
index = 0;
} else if ( index < 0 ){
index = total - 1
}
}
self.slideTo( index ); //Do the slide
},
keyHandler = function (e) {
if (isSliding) return;
switch (e.which) {
case 39:
index++;
slideDirection = self[direction] = left;
if( index == total - 1 ) { index = total - 1; } else
if ( index == total ){ index = 0 }
break;
case 37:
index--;
slideDirection = self[direction] = right;
if ( index == 0 ) { index = 0; } else
if ( index < 0 ) { index = total - 1 }
break;
default: return;
}
self.slideTo( index ); //Do the slide
},
// private methods
setActivePage = function( pageIndex ) { //indicators
for ( var i = 0, icl = indicators[length]; i < icl; i++ ) {
removeClass(indicators[i],active);
}
if (indicators[pageIndex]) addClass(indicators[pageIndex], active);
};
// public methods
this.cycle = function() {
slideDirection = this[direction] = left; // make sure to always come back to default slideDirection
timer = setInterval(function() {
index++;
index = index === total ? 0 : index;
self.slideTo( index );
}, this[interval]);
};
this.slideTo = function( next ) {
var activeItem = this.getActiveIndex(), // the current active
orientation = slideDirection === left ? 'next' : 'prev'; //determine type
bootstrapCustomEvent.call(element, slideEvent, component, slides[next]); // here we go with the slide
isSliding = true;
clearInterval(timer);
setActivePage( next );
if ( supportTransitions && hasClass(element,'slide')
&& ( // we now check if the media queries do actually filter out BS4 transitions
globalObject.getComputedStyle(slides[next])[Transition[toLowerCase]()]
|| globalObject.getComputedStyle(slides[next])[Webkit[toLowerCase]() + Transition]
|| globalObject.getComputedStyle(slides[next])[Webkit + Transition + 'Duration'] // old Safari stuff
)
) {
addClass(slides[next],carouselItem +'-'+ orientation);
slides[next][offsetWidth];
addClass(slides[next],carouselItem +'-'+ slideDirection);
addClass(slides[activeItem],carouselItem +'-'+ slideDirection);
one(slides[activeItem], transitionEndEvent, function(e) {
var timeout = e[target] !== slides[activeItem] ? e.elapsedTime*1000 : 0;
setTimeout(function(){
isSliding = false;
addClass(slides[next],active);
removeClass(slides[activeItem],active);
removeClass(slides[next],carouselItem +'-'+ orientation);
removeClass(slides[next],carouselItem +'-'+ slideDirection);
removeClass(slides[activeItem],carouselItem +'-'+ slideDirection);
bootstrapCustomEvent.call(element, slidEvent, component, slides[next]);
if ( !document.hidden && self[interval] && !hasClass(element,paused) ) {
self.cycle();
}
},timeout);
});
} else {
addClass(slides[next],active);
slides[next][offsetWidth];
removeClass(slides[activeItem],active);
setTimeout(function() {
isSliding = false;
if ( self[interval] && !hasClass(element,paused) ) {
self.cycle();
}
bootstrapCustomEvent.call(element, slidEvent, component, slides[next]);
}, 100 );
}
};
this.getActiveIndex = function () {
return slides[indexOf](getElementsByClassName(element,carouselItem+' active')[0]) || 0;
};
// init
if ( !(stringCarousel in element ) ) { // prevent adding event handlers twice
if ( this[pause] && this[interval] ) {
on( element, mouseHover[0], pauseHandler );
on( element, mouseHover[1], resumeHandler );
on( element, 'touchstart', pauseHandler );
on( element, 'touchend', resumeHandler );
}
rightArrow && on( rightArrow, clickEvent, controlsHandler );
leftArrow && on( leftArrow, clickEvent, controlsHandler );
indicator && on( indicator, clickEvent, indicatorHandler, false);
this[keyboard] === true && on( globalObject, keydownEvent, keyHandler, false);
}
if (this.getActiveIndex()<0) {
slides[length] && addClass(slides[0],active);
indicators[length] && setActivePage(0);
}
if ( this[interval] ){ this.cycle(); }
element[stringCarousel] = this;
};
// CAROUSEL DATA API
// =================
initializeDataAPI( stringCarousel, Carousel, dataRide );
/* Native Javascript for Bootstrap 4 | Collapse
-----------------------------------------------*/
// COLLAPSE DEFINITION
// ===================
var Collapse = function( element, options ) {
// initialization element
element = queryElement(element);
// set options
options = options || {};
// event targets and constants
var accordion = null, collapse = null, self = this,
isAnimating = false, // when true it will prevent click handlers
accordionData = element[getAttribute]('data-parent'),
// component strings
component = 'collapse',
collapsed = 'collapsed',
// private methods
openAction = function(collapseElement) {
bootstrapCustomEvent.call(collapseElement, showEvent, component);
isAnimating = true;
addClass(collapseElement,collapsing);
addClass(collapseElement,showClass);
setTimeout(function() {
collapseElement[style][height] = getMaxHeight(collapseElement) + 'px';
(function(){
emulateTransitionEnd(collapseElement, function(){
isAnimating = false;
collapseElement[setAttribute](ariaExpanded,'true');
removeClass(collapseElement,collapsing);
collapseElement[style][height] = '';
bootstrapCustomEvent.call(collapseElement, shownEvent, component);
});
}());
}, 20);
},
closeAction = function(collapseElement) {
bootstrapCustomEvent.call(collapseElement, hideEvent, component);
isAnimating = true;
collapseElement[style][height] = getMaxHeight(collapseElement) + 'px';
setTimeout(function() {
addClass(collapseElement,collapsing);
collapseElement[style][height] = '0px';
(function() {
emulateTransitionEnd(collapseElement, function(){
isAnimating = false;
collapseElement[setAttribute](ariaExpanded,'false');
removeClass(collapseElement,collapsing);
removeClass(collapseElement,showClass);
collapseElement[style][height] = '';
bootstrapCustomEvent.call(collapseElement, hiddenEvent, component);
});
}());
},20);
},
getTarget = function() {
var href = element.href && element[getAttribute]('href'),
parent = element[getAttribute](dataTarget),
id = href || ( parent && targetsReg.test(parent) ) && parent;
return id && queryElement(id);
};
// public methods
this.toggle = function(e) {
e.preventDefault();
if (isAnimating) return;
if (!hasClass(collapse,showClass)) { self.show(); }
else { self.hide(); }
};
this.hide = function() {
closeAction(collapse);
addClass(element,collapsed);
};
this.show = function() {
openAction(collapse);
removeClass(element,collapsed);
if ( accordion !== null ) {
var activeCollapses = getElementsByClassName(accordion,component+' '+showClass),
allToggles = accordion.querySelectorAll('['+dataToggle+'="'+component+'"]'),
correspondingCollapse;
for (var i=0, al=activeCollapses[length]; i<al; i++) {
if ( activeCollapses[i] !== collapse ) { closeAction(activeCollapses[i]); }
}
for (var u=0, atl=allToggles[length]; u<atl; u++) {
correspondingCollapse = allToggles[u][getAttribute][dataTarget] || allToggles[u].href;
if ( correspondingCollapse.split('#')[1] !== collapse.id ) { addClass(allToggles[u],collapsed); }
else { removeClass(allToggles[u],collapsed); }
}
}
};
// init
if ( !(stringCollapse in element ) ) { // prevent adding event handlers twice
on(element, clickEvent, this.toggle);
}
collapse = getTarget();
accordion = queryElement(options.parent) || accordionData && getClosest(element, accordionData);
element[stringCollapse] = this;
};
// COLLAPSE DATA API
// =================
initializeDataAPI(stringCollapse, Collapse, dataToggle);
/* Native Javascript for Bootstrap 4 | Dropdown
----------------------------------------------*/
// DROPDOWN DEFINITION
// ===================
var Dropdown = function( element, option ) {
// initialization element
element = queryElement(element);
// set option
this.persist = option === true || element[getAttribute]('data-persist') === 'true' || false;
// constants, event targets, strings
var self = this, isOpen = false,
parent = element[parentNode],
component = 'dropdown',
relatedTarget = null,
menu = queryElement('.dropdown-menu', parent),
children = [].slice.call( menu[getElementsByTagName]('*')),
// handlers
keyHandler = function(e) {
if (isOpen && (e.which == 27 || e.keyCode == 27)) { relatedTarget = null; hide(); } // e.keyCode for IE8
},
clickHandler = function(e) {
var eventTarget = e[target], hasData;
hasData = ( eventTarget.nodeType !== 1 && (eventTarget[getAttribute](dataToggle) || eventTarget[parentNode][getAttribute](dataToggle)) );
if ( eventTarget === element || eventTarget === parent || eventTarget[parentNode] === element ) {
e.preventDefault(); // comment this line to stop preventing navigation when click target is a link
relatedTarget = element;
self.toggle();
} else if ( isOpen ) {
if ( (eventTarget === menu || children && children[indexOf](eventTarget) > -1) && ( self.persist || hasData ) ) {
return;
} else { relatedTarget = null; hide(); }
}
(/\#$/.test(eventTarget.href) || eventTarget[parentNode] && /\#$/.test(eventTarget[parentNode].href)) && e.preventDefault(); // should be here to prevent jumps
},
// private methods
show = function() {
bootstrapCustomEvent.call(parent, showEvent, component, relatedTarget);
addClass(parent,showClass);
menu[setAttribute](ariaExpanded,true);
bootstrapCustomEvent.call(parent, shownEvent, component, relatedTarget);
on(document, keydownEvent, keyHandler);
isOpen = true;
},
hide = function() {
bootstrapCustomEvent.call(parent, hideEvent, component, relatedTarget);
removeClass(parent,showClass);
menu[setAttribute](ariaExpanded,false);
bootstrapCustomEvent.call(parent, hiddenEvent, component, relatedTarget);
off(document, keydownEvent, keyHandler);
isOpen = false;
};
// public methods
this.toggle = function() {
if (hasClass(parent,showClass) && isOpen) { hide(); }
else { show(); }
};
// init
if ( !(stringDropdown in element) ) { // prevent adding event handlers twice
menu[setAttribute]('tabindex', '0'); // Fix onblur on Chrome | Safari
on(document, clickEvent, clickHandler);
}
element[stringDropdown] = this;
};
// DROPDOWN DATA API
// =================
initializeDataAPI( stringDropdown, Dropdown, dataToggle );
/* Native Javascript for Bootstrap 4 | Modal
-------------------------------------------*/
// MODAL DEFINITION
// ===============
var Modal = function(element, options) { // element can be the modal/triggering button
// the modal (both JavaScript / DATA API init) / triggering button element (DATA API)
element = queryElement(element);
// determine modal, triggering element
var btnCheck = element[getAttribute](dataTarget)||element[getAttribute]('href'),
checkModal = queryElement( btnCheck ),
modal = hasClass(element,'modal') ? element : checkModal,
// strings
component = 'modal',
staticString = 'static',
paddingLeft = 'paddingLeft',
paddingRight = 'paddingRight',
modalBackdropString = 'modal-backdrop';
if ( hasClass(element,'modal') ) { element = null; } // modal is now independent of it's triggering element
if ( !modal ) { return; } // invalidate
// set options
options = options || {};
this[keyboard] = options[keyboard] === false || modal[getAttribute](dataKeyboard) === 'false' ? false : true;
this[backdrop] = options[backdrop] === staticString || modal[getAttribute](databackdrop) === staticString ? staticString : true;
this[backdrop] = options[backdrop] === false || modal[getAttribute](databackdrop) === 'false' ? false : this[backdrop];
this[content] = options[content]; // JavaScript only
// bind, constants, event targets and other vars
var self = this, open = this.open = false, relatedTarget = null,
bodyIsOverflowing, modalIsOverflowing, scrollbarWidth, overlay,
// also find fixed-top / fixed-bottom items
fixedItems = getElementsByClassName(doc,fixedTop).concat(getElementsByClassName(doc,fixedBottom)),
// private methods
getWindowWidth = function() {
var htmlRect = doc[getBoundingClientRect]();
return globalObject[innerWidth] || (htmlRect[right] - Math.abs(htmlRect[left]));
},
setScrollbar = function () {
var bodyStyle = globalObject.getComputedStyle(body),
bodyPad = parseInt((bodyStyle[paddingRight]), 10), itemPad;
if (bodyIsOverflowing) {
body[style][paddingRight] = (bodyPad + scrollbarWidth) + 'px';
if (fixedItems[length]){
for (var i = 0; i < fixedItems[length]; i++) {
itemPad = globalObject.getComputedStyle(fixedItems[i])[paddingRight];
fixedItems[i][style][paddingRight] = ( parseInt(itemPad) + scrollbarWidth) + 'px';
}
}
}
},
resetScrollbar = function () {
body[style][paddingRight] = '';
if (fixedItems[length]){
for (var i = 0; i < fixedItems[length]; i++) {
fixedItems[i][style][paddingRight] = '';
}
}
},
measureScrollbar = function () { // thx walsh
var scrollDiv = document.createElement('div'), scrollBarWidth;
scrollDiv.className = component+'-scrollbar-measure'; // this is here to stay
body.appendChild(scrollDiv);
scrollBarWidth = scrollDiv[offsetWidth] - scrollDiv[clientWidth];
body.removeChild(scrollDiv);
return scrollBarWidth;
},
checkScrollbar = function () {
bodyIsOverflowing = body[clientWidth] < getWindowWidth();
modalIsOverflowing = modal[scrollHeight] > doc[clientHeight];
scrollbarWidth = measureScrollbar();
},
adjustDialog = function () {
modal[style][paddingLeft] = !bodyIsOverflowing && modalIsOverflowing ? scrollbarWidth + 'px' : '';
modal[style][paddingRight] = bodyIsOverflowing && !modalIsOverflowing ? scrollbarWidth + 'px' : '';
},
resetAdjustments = function () {
modal[style][paddingLeft] = '';
modal[style][paddingRight] = '';
},
createOverlay = function() {
var newOverlay = document.createElement('div');
overlay = queryElement('.'+modalBackdropString);
if ( overlay === null ) {
newOverlay[setAttribute]('class',modalBackdropString+' fade');
overlay = newOverlay;
body.appendChild(overlay);
}
},
removeOverlay = function() {
overlay = queryElement('.'+modalBackdropString);
if ( overlay && overlay !== null && typeof overlay === 'object' ) {
body.removeChild(overlay); overlay = null;
}
},
keydownHandlerToggle = function() {
if (!hasClass(modal,showClass)) {
on(document, keydownEvent, keyHandler);
} else {
off(document, keydownEvent, keyHandler);
}
},
resizeHandlerToggle = function() {
if (!hasClass(modal,showClass)) {
on(globalObject, resizeEvent, self.update);
} else {
off(globalObject, resizeEvent, self.update);
}
},
dismissHandlerToggle = function() {
if (!hasClass(modal,showClass)) {
on(modal, clickEvent, dismissHandler);
} else {
off(modal, clickEvent, dismissHandler);
}
},
// handlers
clickHandler = function(e) {
var clickTarget = e[target];
clickTarget = clickTarget[hasAttribute](dataTarget) || clickTarget[hasAttribute]('href') ? clickTarget : clickTarget[parentNode];
if ( !open && clickTarget === element && !hasClass(modal,showClass) ) {
modal.modalTrigger = element;
relatedTarget = element;
self.show();
e.preventDefault();
}
},
keyHandler = function(e) {
var key = e.which || e.keyCode; // keyCode for IE8
if (self[keyboard] && key == 27 && open) {
self.hide();
}
},
dismissHandler = function(e) {
var clickTarget = e[target];
if ( open && (clickTarget[parentNode][getAttribute](dataDismiss) === component
|| clickTarget[getAttribute](dataDismiss) === component
|| (clickTarget === modal && self[backdrop] !== staticString) ) ) {
self.hide(); relatedTarget = null;
e.preventDefault();
}
};
// public methods
this.toggle = function() {
if (open && hasClass(modal,showClass)) {this.hide();} else {this.show();}
};
this.show = function() {
bootstrapCustomEvent.call(modal, showEvent, component, relatedTarget);
// we elegantly hide any opened modal
var currentOpen = getElementsByClassName(document,component+' '+showClass)[0];
currentOpen && currentOpen !== modal && currentOpen.modalTrigger[stringModal].hide();
if ( this[backdrop] ) {
createOverlay();
}
if ( overlay && !hasClass(overlay,showClass)) {
setTimeout( function() { addClass(overlay, showClass); },0);
}
setTimeout( function() {
modal[style].display = 'block';
checkScrollbar();
setScrollbar();
adjustDialog();
resizeHandlerToggle();
dismissHandlerToggle();
keydownHandlerToggle();
addClass(body,component+'-open');
addClass(modal,showClass);
modal[setAttribute](ariaHidden, false);
emulateTransitionEnd(modal, function(){
open = self.open = true;
setFocus(modal);
bootstrapCustomEvent.call(modal, shownEvent, component, relatedTarget);
});
}, supportTransitions ? 150 : 0);
};
this.hide = function() {
bootstrapCustomEvent.call(modal, hideEvent, component);
overlay = queryElement('.'+modalBackdropString);
removeClass(modal,showClass);
modal[setAttribute](ariaHidden, true);
!!overlay && removeClass(overlay,showClass);
setTimeout(function(){
emulateTransitionEnd(modal, function(){
resizeHandlerToggle();
dismissHandlerToggle();
keydownHandlerToggle();
modal[style].display = '';
open = self.open = false;
element && (setFocus(element));
bootstrapCustomEvent.call(modal, hiddenEvent, component);
setTimeout(function(){
if (!getElementsByClassName(document,component+' '+showClass)[0]) {
resetAdjustments();
resetScrollbar();
removeClass(body,component+'-open');
removeOverlay();
}
}, 100);
});
}, supportTransitions ? 150 : 0);
};
this.setContent = function( content ) {
queryElement('.'+component+'-content',modal).innerHTML = content;
};
this.update = function() {
if (open) {
checkScrollbar();
setScrollbar();
adjustDialog();
}
};
// init
// prevent adding event handlers over and over
// modal is independent of a triggering element
if ( !!element && !(stringModal in element) ) {
on(element, clickEvent, clickHandler);
}
if ( !!this[content] ) { this.setContent( this[content] ); }
!!element && (element[stringModal] = this);
};
// DATA API
initializeDataAPI(stringModal, Modal, dataToggle);
/* Native Javascript for Bootstrap 4 | Popover
----------------------------------------------*/
// POPOVER DEFINITION
// ==================
var Popover = function( element, options ) {
// initialization element
element = queryElement(element);
// DATA API
var triggerData = element[getAttribute](dataTrigger), // click / hover / focus
animationData = element[getAttribute](dataAnimation), // true / false
placementData = element[getAttribute](dataPlacement),
dismissibleData = element[getAttribute](dataDismissible),
delayData = element[getAttribute](dataDelay),
containerData = element[getAttribute](dataContainer),
// internal strings
component = 'popover',
template = 'template',
trigger = 'trigger',
classString = 'class',
div = 'div',
fade = 'fade',
title = 'title',
content = 'content',
dataTitle = 'data-title',
dataContent = 'data-content',
dismissible = 'dismissible',
closeBtn = '<button type="button" class="close">×</button>',
// maybe the element is inside a modal
modal = getClosest(element,'.modal'),
// maybe the element is inside a fixed navbar
navbarFixedTop = getClosest(element,'.'+fixedTop),
navbarFixedBottom = getClosest(element,'.'+fixedBottom);
// set options
options = options || {};
this[template] = options[template] ? options[template] : null; // JavaScript only
this[trigger] = options[trigger] ? options[trigger] : triggerData || hoverEvent;
this[animation] = options[animation] && options[animation] !== fade ? options[animation] : animationData || fade;
this[placement] = options[placement] ? options[placement] : placementData || top;
this[delay] = parseInt(options[delay] || delayData) || 200;
this[dismissible] = options[dismissible] || dismissibleData === 'true' ? true : false;
this[container] = queryElement(options[container]) ? queryElement(options[container])
: queryElement(containerData) ? queryElement(containerData)
: navbarFixedTop ? navbarFixedTop
: navbarFixedBottom ? navbarFixedBottom
: modal ? modal : body;
// bind, content
var self = this,
titleString = element[getAttribute](dataTitle) || null,
contentString = element[getAttribute](dataContent) || null;
if ( !contentString && !this[template] ) return; // invalidate
// constants, vars
var popover = null, timer = 0, placementSetting = this[placement],
// handlers
dismissibleHandler = function(e) {
if (popover !== null && e[target] === queryElement('.close',popover)) {
self.hide();
}
},
// private methods
removePopover = function() {
self[container].removeChild(popover);
timer = null; popover = null;
},
createPopover = function() {
titleString = element[getAttribute](dataTitle); // check content again
contentString = element[getAttribute](dataContent);
popover = document.createElement(div);
if ( contentString !== null && self[template] === null ) { //create the popover from data attributes
popover[setAttribute]('role','tooltip');
if (titleString !== null) {
var popoverTitle = document.createElement('h3');
popoverTitle[setAttribute](classString,component+'-title');
popoverTitle.innerHTML = self[dismissible] ? titleString + closeBtn : titleString;
popover.appendChild(popoverTitle);
}
//set popover content
var popoverContent = document.createElement(div);
popoverContent[setAttribute](classString,component+'-content');
popoverContent.innerHTML = self[dismissible] && titleString === null ? contentString + closeBtn : contentString;
popover.appendChild(popoverContent);
} else { // or create the popover from template
var popoverTemplate = document.createElement(div);
popoverTemplate.innerHTML = self[template];
popover.innerHTML = popoverTemplate.firstChild.innerHTML;
}
//append to the container
self[container].appendChild(popover);
popover[style].display = 'block';
popover[setAttribute](classString, component+ ' ' + component+'-'+placementSetting + ' ' + self[animation]);
},
showPopover = function () {
!hasClass(popover,showClass) && ( addClass(popover,showClass) );
},
updatePopover = function() {
styleTip(element,popover,placementSetting,self[container]);
if (!isElementInViewport(popover) ) {
placementSetting = updatePlacement(placementSetting);
styleTip(element,popover,placementSetting,self[container]);
}
};
// public methods / handlers
this.toggle = function() {
if (popover === null) { self.show(); }
else { self.hide(); }
};
this.show = function() {
clearTimeout(timer);
timer = setTimeout( function() {
if (popover === null) {
placementSetting = self[placement]; // we reset placement in all cases
createPopover();
updatePopover();
showPopover();
bootstrapCustomEvent.call(element, showEvent, component);
emulateTransitionEnd(popover, function(){
bootstrapCustomEvent.call(element, shownEvent, component);
});
}
}, 20 );
};
this.hide = function() {
clearTimeout(timer);
timer = setTimeout( function() {
if (popover && popover !== null && hasClass(popover,showClass)) {
bootstrapCustomEvent.call(element, hideEvent, component);
removeClass(popover,showClass);
emulateTransitionEnd(popover, function() {
removePopover();
bootstrapCustomEvent.call(element, hiddenEvent, component);
});
}
}, self[delay] );
};
// init
if ( !(stringPopover in element) ) { // prevent adding event handlers twice
if (self[trigger] === hoverEvent) {
on( element, mouseHover[0], self.show );
if (!self[dismissible]) { on( element, mouseHover[1], self.hide ); }
} else if (/^(click|focus)$/.test(self[trigger])) {
on( element, self[trigger], self.toggle );
if (!self[dismissible]) { on( element, 'blur', self.hide ); }
}
if (self[dismissible]) { on( document, clickEvent, dismissibleHandler ); }
// dismiss on window resize
on( globalObject, resizeEvent, self.hide );
}
element[stringPopover] = self;
};
// POPOVER DATA API
// ================
initializeDataAPI(stringPopover, Popover, dataToggle);
/* Native Javascript for Bootstrap 4 | ScrollSpy
-----------------------------------------------*/
// SCROLLSPY DEFINITION
// ====================
var ScrollSpy = function(element, options) {
// initialization element, the element we spy on
element = queryElement(element);
// DATA API
var targetData = queryElement(element[getAttribute](dataTarget));
// set options
options = options || {};
if ( !options[target] && !targetData ) { return; } // invalidate
// event targets, constants
var spyTarget = options[target] && queryElement(options[target]) || targetData,
links = spyTarget && spyTarget[getElementsByTagName]('A'),
items = [], targetItems = [], scrollOffset,
scrollTarget = element[offsetHeight] < element[scrollHeight] ? element : globalObject, // determine which is the real scrollTarget
isWindow = scrollTarget === globalObject;
// populate items and targets
for (var i=0, il=links[length]; i<il; i++) {
var href = links[i][getAttribute]('href'),
targetItem = href && targetsReg.test(href) && queryElement(href);
if ( !!targetItem ) {
items.push(links[i]);
targetItems.push(targetItem);
}
}
// private methods
var updateItem = function(index) {
// var parent = items[index][parentNode], // item's item LI element
var item = items[index],
targetItem = targetItems[index], // the menu item targets this element
dropdown = item[parentNode][parentNode],
dropdownLink = hasClass(dropdown,'dropdown') && dropdown[getElementsByTagName]('A')[0],
targetRect = isWindow && targetItem[getBoundingClientRect](),
isActive = hasClass(item,active) || false,
topEdge = isWindow ? targetRect[top] + scrollOffset : targetItem[offsetTop] - (targetItems[index-1] ? 0 : 10),
bottomEdge = isWindow ? targetRect[bottom] + scrollOffset : targetItems[index+1] ? targetItems[index+1][offsetTop] : element[scrollHeight],
inside = scrollOffset >= topEdge && bottomEdge > scrollOffset;
if ( !isActive && inside ) {
if ( !hasClass(item,active) ) {
addClass(item,active);
isActive = true;
if (dropdownLink && !hasClass(dropdownLink,active) ) {
addClass(dropdownLink,active);
}
bootstrapCustomEvent.call(element, 'activate', 'scrollspy', items[index]);
}
} else if ( !inside ) {
if ( hasClass(item,active) ) {
removeClass(item,active);
isActive = false;
if (dropdownLink && hasClass(dropdownLink,active) && !getElementsByClassName(item[parentNode],active).length ) {
removeClass(dropdownLink,active);
}
}
} else if ( !inside && !isActive || isActive && inside ) {
return;
}
},
updateItems = function(){
scrollOffset = isWindow ? getScroll().y : element[scrollTop];
for (var index=0, itl=items[length]; index<itl; index++) {
updateItem(index)
}
};
// public method
this.refresh = function () {
updateItems();
}
// init
if ( !(stringScrollSpy in element) ) { // prevent adding event handlers twice
on( scrollTarget, scrollEvent, this.refresh );
on( globalObject, resizeEvent, this.refresh );
}
this.refresh();
element[stringScrollSpy] = this;
};
// SCROLLSPY DATA API
// ==================
initializeDataAPI(stringScrollSpy, ScrollSpy, dataSpy);
/* Native Javascript for Bootstrap 4 | Tab
-----------------------------------------*/
// TAB DEFINITION
// ==============
var Tab = function( element, options ) {
// initialization element
element = queryElement(element);
// DATA API
var heightData = element[getAttribute](dataHeight),
// strings
component = 'tab', height = 'height', isAnimating = 'isAnimating';
// set default animation state
element[isAnimating] = false;
// set options
options = options || {};
this[height] = supportTransitions ? (options[height] || heightData === 'true') : false;
// bind, event targets
var self = this, next,
tabs = getClosest(element,'.nav'),
tabsContentContainer,
dropdown = tabs && queryElement('.dropdown-toggle',tabs);
if (!tabs) return; // invalidate
// private methods
var getActiveTab = function() {
var activeTabs = getElementsByClassName(tabs,active), activeTab;
if ( activeTabs[length] === 1 && !hasClass(activeTabs[0][parentNode],'dropdown') ) {
activeTab = activeTabs[0];
} else if ( activeTabs[length] > 1 ) {
activeTab = activeTabs[activeTabs[length]-1];
}
return activeTab;
},
getActiveContent = function() {
return queryElement(getActiveTab()[getAttribute]('href'));
},
// handler
clickHandler = function(e) {
e.preventDefault();
next = e[target][getAttribute](dataToggle) === component || targetsReg.test(e[target][getAttribute]('href'))
? e[target] : e[target][parentNode]; // allow for child elements like icons to use the handler
self.show();
};
// public method
this.show = function() { // the tab we clicked is now the next tab
var nextContent = queryElement(next[getAttribute]('href')), //this is the actual object, the next tab content to activate
activeTab = getActiveTab(), activeContent = getActiveContent();
if ( (!activeTab[isAnimating] || !next[isAnimating]) && !hasClass(next,active) ) {
activeTab[isAnimating] = next[isAnimating] = true;
removeClass(activeTab,active);
addClass(next,active);
if ( dropdown ) {
if ( !hasClass(element[parentNode],'dropdown-menu') ) {
if (hasClass(dropdown,active)) removeClass(dropdown,active);
} else {
if (!hasClass(dropdown,active)) addClass(dropdown,active);
}
}
if (tabsContentContainer) tabsContentContainer[style][height] = getMaxHeight(activeContent) + 'px'; // height animation
(function() {
removeClass(activeContent,showClass);
bootstrapCustomEvent.call(activeTab, hideEvent, component, next);
(function(){
emulateTransitionEnd(activeContent, function() {
removeClass(activeContent,active);
addClass(nextContent,active);
setTimeout(function() {
addClass(nextContent,showClass);
nextContent[offsetHeight];
if (tabsContentContainer) addClass(tabsContentContainer,collapsing);
(function() {
bootstrapCustomEvent.call(next, showEvent, component, activeTab);
(function() {
if (tabsContentContainer) tabsContentContainer[style][height] = getMaxHeight(nextContent) + 'px'; // height animation
bootstrapCustomEvent.call(activeTab, hiddenEvent, component, next);
}());
}());
},20);
});
}());
}());
(function(){
emulateTransitionEnd(nextContent, function() {
bootstrapCustomEvent.call(next, shownEvent, component, activeTab);
if (tabsContentContainer) { // height animation
(function(){
emulateTransitionEnd(tabsContentContainer, function(){
setTimeout(function(){
tabsContentContainer[style][height] = '';
removeClass(tabsContentContainer,collapsing);
activeTab[isAnimating] = next[isAnimating] = false;
},200);
});
}());
} else {
activeTab[isAnimating] = next[isAnimating] = false;
}
});
}());
}
};
// init
if ( !(stringTab in element) ) { // prevent adding event handlers twice
on(element, clickEvent, clickHandler);
}
if (this[height]) { tabsContentContainer = getActiveContent()[parentNode]; }
element[stringTab] = this;
};
// TAB DATA API
// ============
initializeDataAPI(stringTab, Tab, dataToggle);
/* Native Javascript for Bootstrap 4 | Tooltip
---------------------------------------------*/
// TOOLTIP DEFINITION
// ==================
var Tooltip = function( element,options ) {
// initialization element
element = queryElement(element);
// DATA API
var animationData = element[getAttribute](dataAnimation),
placementData = element[getAttribute](dataPlacement),
delayData = element[getAttribute](dataDelay),
containerData = element[getAttribute](dataContainer),
// strings
component = 'tooltip',
classString = 'class',
title = 'title',
fade = 'fade',
div = 'div',
// maybe the element is inside a modal
modal = getClosest(element,'.modal'),
// maybe the element is inside a fixed navbar
navbarFixedTop = getClosest(element,'.'+fixedTop),
navbarFixedBottom = getClosest(element,'.'+fixedBottom);
// set options
options = options || {};
this[animation] = options[animation] && options[animation] !== fade ? options[animation] : animationData || fade;
this[placement] = options[placement] ? options[placement] : placementData || top;
this[delay] = parseInt(options[delay] || delayData) || 200;
this[container] = queryElement(options[container]) ? queryElement(options[container])
: queryElement(containerData) ? queryElement(containerData)
: navbarFixedTop ? navbarFixedTop
: navbarFixedBottom ? navbarFixedBottom
: modal ? modal : body;
// bind, event targets, title and constants
var self = this, timer = 0, placementSetting = this[placement], tooltip = null,
titleString = element[getAttribute](title) || element[getAttribute](dataOriginalTitle);
if ( !titleString ) return; // invalidate
// private methods
var removeToolTip = function() {
self[container].removeChild(tooltip);
tooltip = null; timer = null;
},
createToolTip = function() {
titleString = element[getAttribute](title) || element[getAttribute](dataOriginalTitle); // read the title again
tooltip = document.createElement(div);
tooltip[setAttribute]('role',component);
var tooltipInner = document.createElement(div);
tooltipInner[setAttribute](classString,component+'-inner');
tooltip.appendChild(tooltipInner);
tooltipInner.innerHTML = titleString;
self[container].appendChild(tooltip);
tooltip[setAttribute](classString, component + ' ' + component+'-'+placementSetting + ' ' + self[animation]);
},
updateTooltip = function () {
styleTip(element,tooltip,placementSetting,self[container]);
if (!isElementInViewport(tooltip) ) {
placementSetting = updatePlacement(placementSetting);
styleTip(element,tooltip,placementSetting,self[container]);
}
},
showTooltip = function () {
!hasClass(tooltip,showClass) && ( addClass(tooltip,showClass) );
};
// public methods
this.show = function() {
clearTimeout(timer);
timer = setTimeout( function() {
if (tooltip === null) {
placementSetting = self[placement]; // we reset placement in all cases
createToolTip();
updateTooltip();
showTooltip();
bootstrapCustomEvent.call(element, showEvent, component);
emulateTransitionEnd(tooltip, function() {
bootstrapCustomEvent.call(element, shownEvent, component);
});
}
}, 20 );
};
this.hide = function() {
clearTimeout(timer);
timer = setTimeout( function() {
if (tooltip && tooltip !== null && hasClass(tooltip,showClass)) {
bootstrapCustomEvent.call(element, hideEvent, component);
removeClass(tooltip,showClass);
emulateTransitionEnd(tooltip, function() {
removeToolTip();
bootstrapCustomEvent.call(element, hiddenEvent, component);
});
}
}, self[delay]);
};
this.toggle = function() {
if (!tooltip) { self.show(); }
else { self.hide(); }
};
// init
if ( !(stringTooltip in element) ) { // prevent adding event handlers twice
element[setAttribute](dataOriginalTitle,titleString);
element.removeAttribute(title);
on(element, mouseHover[0], this.show);
on(element, mouseHover[1], this.hide);
}
element[stringTooltip] = this;
};
// TOOLTIP DATA API
// =================
initializeDataAPI(stringTooltip, Tooltip, dataToggle);
return {
Alert: Alert,
Button: Button,
Carousel: Carousel,
Collapse: Collapse,
Dropdown: Dropdown,
Modal: Modal,
Popover: Popover,
ScrollSpy: ScrollSpy,
Tab: Tab,
Tooltip: Tooltip
};
}));
|
src/index.js | kgrubic/Bullet-graph-React | import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.js';
import './index.css';
ReactDOM.render(
<App />,
document.getElementById('root')
);
|
src/scripts/globals.js | mikah1337/null-terminator | import React from 'react';
// ============ VARIABLES ============ //
var RGB = {R: 0, B: 0, G: 0};
var prev_option = 0; // Temp variable that holds a prev value
// ============ HELPER FUNCTIONS ============ //
export var changeBrightness = (hex, percent, opacity = 1) => {
var isDarkness = percent < 0; // Check to see if setting darkness or brightness
var percent = isDarkness && Math.abs(percent); // If it's darkness, change to positive for formulas
var hex = hex.replace("#", ""); // Strip the leading # if it's there
var percent = percent / 100; // Convert the percent to decimal form
var percent_diff = 1 - percent; // The value of 100% - (percent)
var new_rgb = Object.keys(RGB);
var counter = 0;
opacity = opacity > 1 ? opacity / 100 : opacity;
// Convert 3 char codes --> 6, e.g. `E0F` --> `EE00FF`
if(hex.length == 3) {
let temp = hex.split("");
hex = "";
temp.map(letter => {hex += (letter + letter)});
}
// Calculate what the new RGB values are going to be
for (var i = 0; i < hex.length; i += 2) {
let rgb_index = new_rgb[counter]; // Current color of iteration, used to index RGB dictionary
let c_rgb = parseInt(hex.slice(i, i+2), 16); // Converts the current slice of hex string from hex to RGB (hex color has 6 alphanumeric chars, first two represent R, next two G, last two B)
let formula = isDarkness? (Math.floor((c_rgb * percent_diff))) : ((0|1<<8) + c_rgb + Math.floor(((256-c_rgb) * percent)-256)); // Calculates new value based on if darkening or brightening color
if(formula.length < 2) formula += "0"; // Conversion cuts off trailing "0"s, need to add them back in
RGB[rgb_index] = formula; // Save the new conversion value in the RGB dict for the current color
counter++;
}
return 'rgba(' + Object.values(RGB).join(',') + ',' + opacity + ')';
}
export var getRandomInt = (min, max) => {
return Math.floor(Math.random() * (max - min)) + min;
}
export var getRandomChoice = (list) => {
var max = 0 || list.length;
return list[getRandomInt(0, max)];
}
export var getRandomColor = (opacity = 1) => {
var new_color = getRandomInt(0, 256); // Random returns float < 1, return decimal version
let color1 = Math.floor(Math.random() * 256);
Object.keys(RGB).map(color => {
do{
new_color = getRandomInt(0, 256);
} while (new_color == prev_option);
RGB[color] = new_color;
prev_option = new_color;
});
return 'rgba(' + Object.values(RGB).join(',') + ',' + opacity + ')'
}
export var dictSplicer = (obj, start, stop) => {
start = --start; // B/c zero index based
stop = --stop;
var counter = 0;
let new_dict = {};
Object.keys(obj).forEach(key => {
if(counter >= start && counter <= stop) {
new_dict[key] = obj[key];
counter++;
}
})
return new_dict;
}
// ============ THEME VARS ============ //
// Theme colors:
const Theme_Colors = {
accent_one: "#FE6B6B", // Red
accent_two: "#556270", // Navy
accent_three: "#AED957", // Lime green
accent_four: "#4ECDC4", // Turquoise-ey
accent_five: "#7F8086", // Dark Grey
accent_six: "#D2D4D8", // Light Grey
accent_seven: "#292c35", // Dark midnight blackish-blue
accent_eight: "#081525" // Darker midnight blackish-blue
}
export const theme_color_hovers = {
accent_one: "#cb5656", // Darker red
accent_two: "",
accent_three: "",
accent_four: "",
accent_five: "",
accent_six: "",
accent_seven: "#081525" // Darker midnight blackish-blue
}
export const theme_fonts = {
content: "Catamaran",
other: "Roboto"
}
export default Theme_Colors; |
lib/cli.js | relution-io/relution-cli | #!/usr/bin/env node --harmony
"use strict";
var rxjs_1 = require('@reactivex/rxjs');
var RelutionSDK = require('./utility/RelutionSDK');
var Server_1 = require('./commands/Server');
var Environment_1 = require('./commands/Environment');
var Tower_1 = require('./commands/Tower');
var Project_1 = require('./commands/Project');
var Connection_1 = require('./commands/Connection');
var Push_1 = require('./commands/Push');
// command line preprocessing
var argv = new (Array.bind.apply(Array, [void 0].concat(process.argv)))();
// console.log(argv);
argv.splice(0, 2); // node cli.js
RelutionSDK.initFromArgs(argv);
// console.log('2', argv);
// all sub commands add to be here
var staticCommands = {
server: new Server_1.Server(),
project: new Project_1.Project(),
env: new Environment_1.Environment(),
connection: new Connection_1.Connection(),
push: new Push_1.Push()
};
// observable to wait for before loading the tower some commands need a some data befor it can be initialised
var all = Object.keys(staticCommands).map(function (commandName) {
return staticCommands[commandName].preload().defaultIfEmpty();
});
// preload done
rxjs_1.Observable.forkJoin(all).subscribe(function (a) {
// console.log(a);
}, function (e) {
console.error('preload', e);
process.exit(-1);
}, function () {
return new Tower_1.Tower(staticCommands, argv);
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NsaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLHFCQUF5QixpQkFBaUIsQ0FBQyxDQUFBO0FBQzNDLElBQVksV0FBVyxXQUFNLHVCQUF1QixDQUFDLENBQUE7QUFHckQsdUJBQXFCLG1CQUFtQixDQUFDLENBQUE7QUFDekMsNEJBQTBCLHdCQUF3QixDQUFDLENBQUE7QUFDbkQsc0JBQW9CLGtCQUFrQixDQUFDLENBQUE7QUFDdkMsd0JBQXNCLG9CQUFvQixDQUFDLENBQUE7QUFDM0MsMkJBQXlCLHVCQUF1QixDQUFDLENBQUE7QUFDakQscUJBQW1CLGlCQUFpQixDQUFDLENBQUE7QUFHckMsNkJBQTZCO0FBQzdCLElBQUksSUFBSSxHQUFHLEtBQUksS0FBSyxZQUFMLEtBQUssa0JBQVksT0FBTyxDQUFDLElBQUksS0FBQyxDQUFDO0FBQzlDLHFCQUFxQjtBQUNyQixJQUFJLENBQUMsTUFBTSxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDLGNBQWM7QUFDakMsV0FBVyxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsQ0FBQztBQUUvQiwwQkFBMEI7QUFDMUIsa0NBQWtDO0FBQ2xDLElBQU0sY0FBYyxHQUEyQjtJQUM3QyxNQUFNLEVBQUUsSUFBSSxlQUFNLEVBQUU7SUFDcEIsT0FBTyxFQUFFLElBQUksaUJBQU8sRUFBRTtJQUN0QixHQUFHLEVBQUUsSUFBSSx5QkFBVyxFQUFFO0lBQ3RCLFVBQVUsRUFBRSxJQUFJLHVCQUFVLEVBQUU7SUFDNUIsSUFBSSxFQUFFLElBQUksV0FBSSxFQUFFO0NBQ2pCLENBQUM7QUFFRiw2R0FBNkc7QUFDN0csSUFBTSxHQUFHLEdBQUcsTUFBTSxDQUFDLElBQUksQ0FBQyxjQUFjLENBQUMsQ0FBQyxHQUFHLENBQUMsVUFBQyxXQUFnQjtJQUMzRCxNQUFNLENBQUMsY0FBYyxDQUFDLFdBQVcsQ0FBQyxDQUFDLE9BQU8sRUFBRSxDQUFDLGNBQWMsRUFBRSxDQUFDO0FBQ2hFLENBQUMsQ0FBQyxDQUFDO0FBRUgsZUFBZTtBQUNmLGlCQUFVLENBQUMsUUFBUSxDQUFDLEdBQUcsQ0FBQyxDQUFDLFNBQVMsQ0FDaEMsVUFBQyxDQUFNO0lBQ0wsa0JBQWtCO0FBQ3BCLENBQUMsRUFDRCxVQUFDLENBQU07SUFDTCxPQUFPLENBQUMsS0FBSyxDQUFDLFNBQVMsRUFBRSxDQUFDLENBQUMsQ0FBQztJQUM1QixPQUFPLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7QUFDbkIsQ0FBQyxFQUNEO0lBQ0UsTUFBTSxDQUFDLElBQUksYUFBSyxDQUFDLGNBQWMsRUFBRSxJQUFJLENBQUMsQ0FBQztBQUN6QyxDQUFDLENBQ0YsQ0FBQyJ9 |
assets/grocery_crud/js/jquery-1.11.1.min.js | BrunoMarty/MenuiserieCI | /*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;
if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")
},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on("unload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
|
src/icons/AndroidStar.js | fbfeix/react-icons | import React from 'react';
import IconBase from './../components/IconBase/IconBase';
export default class AndroidStar extends React.Component {
render() {
if(this.props.bare) {
return <g>
<g>
<polygon points="256,372.686 380.83,448 347.809,305.934 458,210.409 312.733,197.934 256,64 199.257,197.934 54,210.409
164.192,305.934 131.161,448 "></polygon>
</g>
</g>;
} return <IconBase>
<g>
<polygon points="256,372.686 380.83,448 347.809,305.934 458,210.409 312.733,197.934 256,64 199.257,197.934 54,210.409
164.192,305.934 131.161,448 "></polygon>
</g>
</IconBase>;
}
};AndroidStar.defaultProps = {bare: false} |
docs/src/app/components/pages/components/Snackbar/ExampleTwice.js | tan-jerene/material-ui | import React from 'react';
import Snackbar from 'material-ui/Snackbar';
import RaisedButton from 'material-ui/RaisedButton';
export default class SnackbarExampleTwice extends React.Component {
constructor(props) {
super(props);
this.state = {
message: 'Event 1 added to your calendar',
open: false,
};
this.timer = undefined;
}
componentWillUnMount() {
clearTimeout(this.timer);
}
handleTouchTap = () => {
this.setState({
open: true,
});
this.timer = setTimeout(() => {
this.setState({
message: `Event ${Math.round(Math.random() * 100)} added to your calendar`,
});
}, 1500);
};
handleRequestClose = () => {
this.setState({
open: false,
});
};
render() {
return (
<div>
<RaisedButton
onTouchTap={this.handleTouchTap}
label="Add to my calendar two times"
/>
<Snackbar
open={this.state.open}
message={this.state.message}
action="undo"
autoHideDuration={3000}
onRequestClose={this.handleRequestClose}
/>
</div>
);
}
}
|
ajax/libs/cyclejs-dom/4.0.0/cycle-dom.js | gaearon/cdnjs | (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.CycleDOM = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";
var Rx = require("rx");
function makeRequestProxies(drivers) {
var requestProxies = {};
for (var _name in drivers) {
if (drivers.hasOwnProperty(_name)) {
requestProxies[_name] = new Rx.ReplaySubject(1);
}
}
return requestProxies;
}
function callDrivers(drivers, requestProxies) {
var responses = {};
for (var _name2 in drivers) {
if (drivers.hasOwnProperty(_name2)) {
responses[_name2] = drivers[_name2](requestProxies[_name2], _name2);
}
}
return responses;
}
function attachDisposeToRequests(requests, replicationSubscription) {
Object.defineProperty(requests, "dispose", {
enumerable: false,
value: function value() {
replicationSubscription.dispose();
}
});
return requests;
}
function makeDisposeResponses(responses) {
return function dispose() {
for (var _name3 in responses) {
if (responses.hasOwnProperty(_name3) && typeof responses[_name3].dispose === "function") {
responses[_name3].dispose();
}
}
};
}
function attachDisposeToResponses(responses) {
Object.defineProperty(responses, "dispose", {
enumerable: false,
value: makeDisposeResponses(responses)
});
return responses;
}
function logToConsoleError(err) {
var target = err.stack || err;
if (console && console.error) {
console.error(target);
}
}
function replicateMany(observables, subjects) {
return Rx.Observable.create(function (observer) {
var subscription = new Rx.CompositeDisposable();
setTimeout(function () {
for (var _name4 in observables) {
if (observables.hasOwnProperty(_name4) && subjects.hasOwnProperty(_name4) && !subjects[_name4].isDisposed) {
subscription.add(observables[_name4].doOnError(logToConsoleError).subscribe(subjects[_name4].asObserver()));
}
}
observer.onNext(subscription);
}, 1);
return function dispose() {
subscription.dispose();
for (var x in subjects) {
if (subjects.hasOwnProperty(x)) {
subjects[x].dispose();
}
}
};
});
}
function isObjectEmpty(obj) {
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
return false;
}
}
return true;
}
function run(main, drivers) {
if (typeof main !== "function") {
throw new Error("First argument given to Cycle.run() must be the 'main' " + "function.");
}
if (typeof drivers !== "object" || drivers === null) {
throw new Error("Second argument given to Cycle.run() must be an object " + "with driver functions as properties.");
}
if (isObjectEmpty(drivers)) {
throw new Error("Second argument given to Cycle.run() must be an object " + "with at least one driver function declared as a property.");
}
var requestProxies = makeRequestProxies(drivers);
var responses = callDrivers(drivers, requestProxies);
var requests = main(responses);
var subscription = replicateMany(requests, requestProxies).subscribe();
var requestsWithDispose = attachDisposeToRequests(requests, subscription);
var responsesWithDispose = attachDisposeToResponses(responses);
return [requestsWithDispose, responsesWithDispose];
}
var Cycle = {
/**
* Takes an `main` function and circularly connects it to the given collection
* of driver functions.
*
* The `main` function expects a collection of "driver response" Observables
* as input, and should return a collection of "driver request" Observables.
* A "collection of Observables" is a JavaScript object where
* keys match the driver names registered by the `drivers` object, and values
* are Observables or a collection of Observables.
*
* @param {Function} main a function that takes `responses` as input
* and outputs a collection of `requests` Observables.
* @param {Object} drivers an object where keys are driver names and values
* are driver functions.
* @return {Array} an array where the first object is the collection of driver
* requests, and the second object is the collection of driver responses, that
* can be used for debugging or testing.
* @function run
*/
run: run,
/**
* A shortcut to the root object of
* [RxJS](https://github.com/Reactive-Extensions/RxJS).
* @name Rx
*/
Rx: Rx
};
module.exports = Cycle;
},{"rx":59}],2:[function(require,module,exports){
},{}],3:[function(require,module,exports){
// shim for using process in browser
var process = module.exports = {};
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = setTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
currentQueue[queueIndex].run();
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
clearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
setTimeout(drainQueue, 0);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
// TODO(shtylman)
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
},{}],4:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')() ? Map : require('./polyfill');
},{"./is-implemented":5,"./polyfill":58}],5:[function(require,module,exports){
'use strict';
module.exports = function () {
var map, iterator, result;
if (typeof Map !== 'function') return false;
try {
// WebKit doesn't support arguments and crashes
map = new Map([['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']]);
} catch (e) {
return false;
}
if (map.size !== 3) return false;
if (typeof map.clear !== 'function') return false;
if (typeof map.delete !== 'function') return false;
if (typeof map.entries !== 'function') return false;
if (typeof map.forEach !== 'function') return false;
if (typeof map.get !== 'function') return false;
if (typeof map.has !== 'function') return false;
if (typeof map.keys !== 'function') return false;
if (typeof map.set !== 'function') return false;
if (typeof map.values !== 'function') return false;
iterator = map.entries();
result = iterator.next();
if (result.done !== false) return false;
if (!result.value) return false;
if (result.value[0] !== 'raz') return false;
if (result.value[1] !== 'one') return false;
return true;
};
},{}],6:[function(require,module,exports){
// Exports true if environment provides native `Map` implementation,
// whatever that is.
'use strict';
module.exports = (function () {
if (typeof Map === 'undefined') return false;
return (Object.prototype.toString.call(Map.prototype) === '[object Map]');
}());
},{}],7:[function(require,module,exports){
'use strict';
module.exports = require('es5-ext/object/primitive-set')('key',
'value', 'key+value');
},{"es5-ext/object/primitive-set":32}],8:[function(require,module,exports){
'use strict';
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
, d = require('d')
, Iterator = require('es6-iterator')
, toStringTagSymbol = require('es6-symbol').toStringTag
, kinds = require('./iterator-kinds')
, defineProperties = Object.defineProperties
, unBind = Iterator.prototype._unBind
, MapIterator;
MapIterator = module.exports = function (map, kind) {
if (!(this instanceof MapIterator)) return new MapIterator(map, kind);
Iterator.call(this, map.__mapKeysData__, map);
if (!kind || !kinds[kind]) kind = 'key+value';
defineProperties(this, {
__kind__: d('', kind),
__values__: d('w', map.__mapValuesData__)
});
};
if (setPrototypeOf) setPrototypeOf(MapIterator, Iterator);
MapIterator.prototype = Object.create(Iterator.prototype, {
constructor: d(MapIterator),
_resolve: d(function (i) {
if (this.__kind__ === 'value') return this.__values__[i];
if (this.__kind__ === 'key') return this.__list__[i];
return [this.__list__[i], this.__values__[i]];
}),
_unBind: d(function () {
this.__values__ = null;
unBind.call(this);
}),
toString: d(function () { return '[object Map Iterator]'; })
});
Object.defineProperty(MapIterator.prototype, toStringTagSymbol,
d('c', 'Map Iterator'));
},{"./iterator-kinds":7,"d":10,"es5-ext/object/set-prototype-of":33,"es6-iterator":45,"es6-symbol":54}],9:[function(require,module,exports){
'use strict';
var copy = require('es5-ext/object/copy')
, map = require('es5-ext/object/map')
, callable = require('es5-ext/object/valid-callable')
, validValue = require('es5-ext/object/valid-value')
, bind = Function.prototype.bind, defineProperty = Object.defineProperty
, hasOwnProperty = Object.prototype.hasOwnProperty
, define;
define = function (name, desc, bindTo) {
var value = validValue(desc) && callable(desc.value), dgs;
dgs = copy(desc);
delete dgs.writable;
delete dgs.value;
dgs.get = function () {
if (hasOwnProperty.call(this, name)) return value;
desc.value = bind.call(value, (bindTo == null) ? this : this[bindTo]);
defineProperty(this, name, desc);
return this[name];
};
return dgs;
};
module.exports = function (props/*, bindTo*/) {
var bindTo = arguments[1];
return map(props, function (desc, name) {
return define(name, desc, bindTo);
});
};
},{"es5-ext/object/copy":22,"es5-ext/object/map":30,"es5-ext/object/valid-callable":36,"es5-ext/object/valid-value":37}],10:[function(require,module,exports){
'use strict';
var assign = require('es5-ext/object/assign')
, normalizeOpts = require('es5-ext/object/normalize-options')
, isCallable = require('es5-ext/object/is-callable')
, contains = require('es5-ext/string/#/contains')
, d;
d = module.exports = function (dscr, value/*, options*/) {
var c, e, w, options, desc;
if ((arguments.length < 2) || (typeof dscr !== 'string')) {
options = value;
value = dscr;
dscr = null;
} else {
options = arguments[2];
}
if (dscr == null) {
c = w = true;
e = false;
} else {
c = contains.call(dscr, 'c');
e = contains.call(dscr, 'e');
w = contains.call(dscr, 'w');
}
desc = { value: value, configurable: c, enumerable: e, writable: w };
return !options ? desc : assign(normalizeOpts(options), desc);
};
d.gs = function (dscr, get, set/*, options*/) {
var c, e, options, desc;
if (typeof dscr !== 'string') {
options = set;
set = get;
get = dscr;
dscr = null;
} else {
options = arguments[3];
}
if (get == null) {
get = undefined;
} else if (!isCallable(get)) {
options = get;
get = set = undefined;
} else if (set == null) {
set = undefined;
} else if (!isCallable(set)) {
options = set;
set = undefined;
}
if (dscr == null) {
c = true;
e = false;
} else {
c = contains.call(dscr, 'c');
e = contains.call(dscr, 'e');
}
desc = { get: get, set: set, configurable: c, enumerable: e };
return !options ? desc : assign(normalizeOpts(options), desc);
};
},{"es5-ext/object/assign":19,"es5-ext/object/is-callable":25,"es5-ext/object/normalize-options":31,"es5-ext/string/#/contains":38}],11:[function(require,module,exports){
// Inspired by Google Closure:
// http://closure-library.googlecode.com/svn/docs/
// closure_goog_array_array.js.html#goog.array.clear
'use strict';
var value = require('../../object/valid-value');
module.exports = function () {
value(this).length = 0;
return this;
};
},{"../../object/valid-value":37}],12:[function(require,module,exports){
'use strict';
var toPosInt = require('../../number/to-pos-integer')
, value = require('../../object/valid-value')
, indexOf = Array.prototype.indexOf
, hasOwnProperty = Object.prototype.hasOwnProperty
, abs = Math.abs, floor = Math.floor;
module.exports = function (searchElement/*, fromIndex*/) {
var i, l, fromIndex, val;
if (searchElement === searchElement) { //jslint: ignore
return indexOf.apply(this, arguments);
}
l = toPosInt(value(this).length);
fromIndex = arguments[1];
if (isNaN(fromIndex)) fromIndex = 0;
else if (fromIndex >= 0) fromIndex = floor(fromIndex);
else fromIndex = toPosInt(this.length) - floor(abs(fromIndex));
for (i = fromIndex; i < l; ++i) {
if (hasOwnProperty.call(this, i)) {
val = this[i];
if (val !== val) return i; //jslint: ignore
}
}
return -1;
};
},{"../../number/to-pos-integer":17,"../../object/valid-value":37}],13:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')()
? Math.sign
: require('./shim');
},{"./is-implemented":14,"./shim":15}],14:[function(require,module,exports){
'use strict';
module.exports = function () {
var sign = Math.sign;
if (typeof sign !== 'function') return false;
return ((sign(10) === 1) && (sign(-20) === -1));
};
},{}],15:[function(require,module,exports){
'use strict';
module.exports = function (value) {
value = Number(value);
if (isNaN(value) || (value === 0)) return value;
return (value > 0) ? 1 : -1;
};
},{}],16:[function(require,module,exports){
'use strict';
var sign = require('../math/sign')
, abs = Math.abs, floor = Math.floor;
module.exports = function (value) {
if (isNaN(value)) return 0;
value = Number(value);
if ((value === 0) || !isFinite(value)) return value;
return sign(value) * floor(abs(value));
};
},{"../math/sign":13}],17:[function(require,module,exports){
'use strict';
var toInteger = require('./to-integer')
, max = Math.max;
module.exports = function (value) { return max(0, toInteger(value)); };
},{"./to-integer":16}],18:[function(require,module,exports){
// Internal method, used by iteration functions.
// Calls a function for each key-value pair found in object
// Optionally takes compareFn to iterate object in specific order
'use strict';
var isCallable = require('./is-callable')
, callable = require('./valid-callable')
, value = require('./valid-value')
, call = Function.prototype.call, keys = Object.keys
, propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
module.exports = function (method, defVal) {
return function (obj, cb/*, thisArg, compareFn*/) {
var list, thisArg = arguments[2], compareFn = arguments[3];
obj = Object(value(obj));
callable(cb);
list = keys(obj);
if (compareFn) {
list.sort(isCallable(compareFn) ? compareFn.bind(obj) : undefined);
}
return list[method](function (key, index) {
if (!propertyIsEnumerable.call(obj, key)) return defVal;
return call.call(cb, thisArg, obj[key], key, obj, index);
});
};
};
},{"./is-callable":25,"./valid-callable":36,"./valid-value":37}],19:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')()
? Object.assign
: require('./shim');
},{"./is-implemented":20,"./shim":21}],20:[function(require,module,exports){
'use strict';
module.exports = function () {
var assign = Object.assign, obj;
if (typeof assign !== 'function') return false;
obj = { foo: 'raz' };
assign(obj, { bar: 'dwa' }, { trzy: 'trzy' });
return (obj.foo + obj.bar + obj.trzy) === 'razdwatrzy';
};
},{}],21:[function(require,module,exports){
'use strict';
var keys = require('../keys')
, value = require('../valid-value')
, max = Math.max;
module.exports = function (dest, src/*, …srcn*/) {
var error, i, l = max(arguments.length, 2), assign;
dest = Object(value(dest));
assign = function (key) {
try { dest[key] = src[key]; } catch (e) {
if (!error) error = e;
}
};
for (i = 1; i < l; ++i) {
src = arguments[i];
keys(src).forEach(assign);
}
if (error !== undefined) throw error;
return dest;
};
},{"../keys":27,"../valid-value":37}],22:[function(require,module,exports){
'use strict';
var assign = require('./assign')
, value = require('./valid-value');
module.exports = function (obj) {
var copy = Object(value(obj));
if (copy !== obj) return copy;
return assign({}, obj);
};
},{"./assign":19,"./valid-value":37}],23:[function(require,module,exports){
// Workaround for http://code.google.com/p/v8/issues/detail?id=2804
'use strict';
var create = Object.create, shim;
if (!require('./set-prototype-of/is-implemented')()) {
shim = require('./set-prototype-of/shim');
}
module.exports = (function () {
var nullObject, props, desc;
if (!shim) return create;
if (shim.level !== 1) return create;
nullObject = {};
props = {};
desc = { configurable: false, enumerable: false, writable: true,
value: undefined };
Object.getOwnPropertyNames(Object.prototype).forEach(function (name) {
if (name === '__proto__') {
props[name] = { configurable: true, enumerable: false, writable: true,
value: undefined };
return;
}
props[name] = desc;
});
Object.defineProperties(nullObject, props);
Object.defineProperty(shim, 'nullPolyfill', { configurable: false,
enumerable: false, writable: false, value: nullObject });
return function (prototype, props) {
return create((prototype === null) ? nullObject : prototype, props);
};
}());
},{"./set-prototype-of/is-implemented":34,"./set-prototype-of/shim":35}],24:[function(require,module,exports){
'use strict';
module.exports = require('./_iterate')('forEach');
},{"./_iterate":18}],25:[function(require,module,exports){
// Deprecated
'use strict';
module.exports = function (obj) { return typeof obj === 'function'; };
},{}],26:[function(require,module,exports){
'use strict';
var map = { function: true, object: true };
module.exports = function (x) {
return ((x != null) && map[typeof x]) || false;
};
},{}],27:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')()
? Object.keys
: require('./shim');
},{"./is-implemented":28,"./shim":29}],28:[function(require,module,exports){
'use strict';
module.exports = function () {
try {
Object.keys('primitive');
return true;
} catch (e) { return false; }
};
},{}],29:[function(require,module,exports){
'use strict';
var keys = Object.keys;
module.exports = function (object) {
return keys(object == null ? object : Object(object));
};
},{}],30:[function(require,module,exports){
'use strict';
var callable = require('./valid-callable')
, forEach = require('./for-each')
, call = Function.prototype.call;
module.exports = function (obj, cb/*, thisArg*/) {
var o = {}, thisArg = arguments[2];
callable(cb);
forEach(obj, function (value, key, obj, index) {
o[key] = call.call(cb, thisArg, value, key, obj, index);
});
return o;
};
},{"./for-each":24,"./valid-callable":36}],31:[function(require,module,exports){
'use strict';
var forEach = Array.prototype.forEach, create = Object.create;
var process = function (src, obj) {
var key;
for (key in src) obj[key] = src[key];
};
module.exports = function (options/*, …options*/) {
var result = create(null);
forEach.call(arguments, function (options) {
if (options == null) return;
process(Object(options), result);
});
return result;
};
},{}],32:[function(require,module,exports){
'use strict';
var forEach = Array.prototype.forEach, create = Object.create;
module.exports = function (arg/*, …args*/) {
var set = create(null);
forEach.call(arguments, function (name) { set[name] = true; });
return set;
};
},{}],33:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')()
? Object.setPrototypeOf
: require('./shim');
},{"./is-implemented":34,"./shim":35}],34:[function(require,module,exports){
'use strict';
var create = Object.create, getPrototypeOf = Object.getPrototypeOf
, x = {};
module.exports = function (/*customCreate*/) {
var setPrototypeOf = Object.setPrototypeOf
, customCreate = arguments[0] || create;
if (typeof setPrototypeOf !== 'function') return false;
return getPrototypeOf(setPrototypeOf(customCreate(null), x)) === x;
};
},{}],35:[function(require,module,exports){
// Big thanks to @WebReflection for sorting this out
// https://gist.github.com/WebReflection/5593554
'use strict';
var isObject = require('../is-object')
, value = require('../valid-value')
, isPrototypeOf = Object.prototype.isPrototypeOf
, defineProperty = Object.defineProperty
, nullDesc = { configurable: true, enumerable: false, writable: true,
value: undefined }
, validate;
validate = function (obj, prototype) {
value(obj);
if ((prototype === null) || isObject(prototype)) return obj;
throw new TypeError('Prototype must be null or an object');
};
module.exports = (function (status) {
var fn, set;
if (!status) return null;
if (status.level === 2) {
if (status.set) {
set = status.set;
fn = function (obj, prototype) {
set.call(validate(obj, prototype), prototype);
return obj;
};
} else {
fn = function (obj, prototype) {
validate(obj, prototype).__proto__ = prototype;
return obj;
};
}
} else {
fn = function self(obj, prototype) {
var isNullBase;
validate(obj, prototype);
isNullBase = isPrototypeOf.call(self.nullPolyfill, obj);
if (isNullBase) delete self.nullPolyfill.__proto__;
if (prototype === null) prototype = self.nullPolyfill;
obj.__proto__ = prototype;
if (isNullBase) defineProperty(self.nullPolyfill, '__proto__', nullDesc);
return obj;
};
}
return Object.defineProperty(fn, 'level', { configurable: false,
enumerable: false, writable: false, value: status.level });
}((function () {
var x = Object.create(null), y = {}, set
, desc = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__');
if (desc) {
try {
set = desc.set; // Opera crashes at this point
set.call(x, y);
} catch (ignore) { }
if (Object.getPrototypeOf(x) === y) return { set: set, level: 2 };
}
x.__proto__ = y;
if (Object.getPrototypeOf(x) === y) return { level: 2 };
x = {};
x.__proto__ = y;
if (Object.getPrototypeOf(x) === y) return { level: 1 };
return false;
}())));
require('../create');
},{"../create":23,"../is-object":26,"../valid-value":37}],36:[function(require,module,exports){
'use strict';
module.exports = function (fn) {
if (typeof fn !== 'function') throw new TypeError(fn + " is not a function");
return fn;
};
},{}],37:[function(require,module,exports){
'use strict';
module.exports = function (value) {
if (value == null) throw new TypeError("Cannot use null or undefined");
return value;
};
},{}],38:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')()
? String.prototype.contains
: require('./shim');
},{"./is-implemented":39,"./shim":40}],39:[function(require,module,exports){
'use strict';
var str = 'razdwatrzy';
module.exports = function () {
if (typeof str.contains !== 'function') return false;
return ((str.contains('dwa') === true) && (str.contains('foo') === false));
};
},{}],40:[function(require,module,exports){
'use strict';
var indexOf = String.prototype.indexOf;
module.exports = function (searchString/*, position*/) {
return indexOf.call(this, searchString, arguments[1]) > -1;
};
},{}],41:[function(require,module,exports){
'use strict';
var toString = Object.prototype.toString
, id = toString.call('');
module.exports = function (x) {
return (typeof x === 'string') || (x && (typeof x === 'object') &&
((x instanceof String) || (toString.call(x) === id))) || false;
};
},{}],42:[function(require,module,exports){
'use strict';
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
, contains = require('es5-ext/string/#/contains')
, d = require('d')
, Iterator = require('./')
, defineProperty = Object.defineProperty
, ArrayIterator;
ArrayIterator = module.exports = function (arr, kind) {
if (!(this instanceof ArrayIterator)) return new ArrayIterator(arr, kind);
Iterator.call(this, arr);
if (!kind) kind = 'value';
else if (contains.call(kind, 'key+value')) kind = 'key+value';
else if (contains.call(kind, 'key')) kind = 'key';
else kind = 'value';
defineProperty(this, '__kind__', d('', kind));
};
if (setPrototypeOf) setPrototypeOf(ArrayIterator, Iterator);
ArrayIterator.prototype = Object.create(Iterator.prototype, {
constructor: d(ArrayIterator),
_resolve: d(function (i) {
if (this.__kind__ === 'value') return this.__list__[i];
if (this.__kind__ === 'key+value') return [i, this.__list__[i]];
return i;
}),
toString: d(function () { return '[object Array Iterator]'; })
});
},{"./":45,"d":10,"es5-ext/object/set-prototype-of":33,"es5-ext/string/#/contains":38}],43:[function(require,module,exports){
'use strict';
var callable = require('es5-ext/object/valid-callable')
, isString = require('es5-ext/string/is-string')
, get = require('./get')
, isArray = Array.isArray, call = Function.prototype.call;
module.exports = function (iterable, cb/*, thisArg*/) {
var mode, thisArg = arguments[2], result, doBreak, broken, i, l, char, code;
if (isArray(iterable)) mode = 'array';
else if (isString(iterable)) mode = 'string';
else iterable = get(iterable);
callable(cb);
doBreak = function () { broken = true; };
if (mode === 'array') {
iterable.some(function (value) {
call.call(cb, thisArg, value, doBreak);
if (broken) return true;
});
return;
}
if (mode === 'string') {
l = iterable.length;
for (i = 0; i < l; ++i) {
char = iterable[i];
if ((i + 1) < l) {
code = char.charCodeAt(0);
if ((code >= 0xD800) && (code <= 0xDBFF)) char += iterable[++i];
}
call.call(cb, thisArg, char, doBreak);
if (broken) break;
}
return;
}
result = iterable.next();
while (!result.done) {
call.call(cb, thisArg, result.value, doBreak);
if (broken) return;
result = iterable.next();
}
};
},{"./get":44,"es5-ext/object/valid-callable":36,"es5-ext/string/is-string":41}],44:[function(require,module,exports){
'use strict';
var isString = require('es5-ext/string/is-string')
, ArrayIterator = require('./array')
, StringIterator = require('./string')
, iterable = require('./valid-iterable')
, iteratorSymbol = require('es6-symbol').iterator;
module.exports = function (obj) {
if (typeof iterable(obj)[iteratorSymbol] === 'function') return obj[iteratorSymbol]();
if (isString(obj)) return new StringIterator(obj);
return new ArrayIterator(obj);
};
},{"./array":42,"./string":52,"./valid-iterable":53,"es5-ext/string/is-string":41,"es6-symbol":47}],45:[function(require,module,exports){
'use strict';
var clear = require('es5-ext/array/#/clear')
, assign = require('es5-ext/object/assign')
, callable = require('es5-ext/object/valid-callable')
, value = require('es5-ext/object/valid-value')
, d = require('d')
, autoBind = require('d/auto-bind')
, Symbol = require('es6-symbol')
, defineProperty = Object.defineProperty
, defineProperties = Object.defineProperties
, Iterator;
module.exports = Iterator = function (list, context) {
if (!(this instanceof Iterator)) return new Iterator(list, context);
defineProperties(this, {
__list__: d('w', value(list)),
__context__: d('w', context),
__nextIndex__: d('w', 0)
});
if (!context) return;
callable(context.on);
context.on('_add', this._onAdd);
context.on('_delete', this._onDelete);
context.on('_clear', this._onClear);
};
defineProperties(Iterator.prototype, assign({
constructor: d(Iterator),
_next: d(function () {
var i;
if (!this.__list__) return;
if (this.__redo__) {
i = this.__redo__.shift();
if (i !== undefined) return i;
}
if (this.__nextIndex__ < this.__list__.length) return this.__nextIndex__++;
this._unBind();
}),
next: d(function () { return this._createResult(this._next()); }),
_createResult: d(function (i) {
if (i === undefined) return { done: true, value: undefined };
return { done: false, value: this._resolve(i) };
}),
_resolve: d(function (i) { return this.__list__[i]; }),
_unBind: d(function () {
this.__list__ = null;
delete this.__redo__;
if (!this.__context__) return;
this.__context__.off('_add', this._onAdd);
this.__context__.off('_delete', this._onDelete);
this.__context__.off('_clear', this._onClear);
this.__context__ = null;
}),
toString: d(function () { return '[object Iterator]'; })
}, autoBind({
_onAdd: d(function (index) {
if (index >= this.__nextIndex__) return;
++this.__nextIndex__;
if (!this.__redo__) {
defineProperty(this, '__redo__', d('c', [index]));
return;
}
this.__redo__.forEach(function (redo, i) {
if (redo >= index) this.__redo__[i] = ++redo;
}, this);
this.__redo__.push(index);
}),
_onDelete: d(function (index) {
var i;
if (index >= this.__nextIndex__) return;
--this.__nextIndex__;
if (!this.__redo__) return;
i = this.__redo__.indexOf(index);
if (i !== -1) this.__redo__.splice(i, 1);
this.__redo__.forEach(function (redo, i) {
if (redo > index) this.__redo__[i] = --redo;
}, this);
}),
_onClear: d(function () {
if (this.__redo__) clear.call(this.__redo__);
this.__nextIndex__ = 0;
})
})));
defineProperty(Iterator.prototype, Symbol.iterator, d(function () {
return this;
}));
defineProperty(Iterator.prototype, Symbol.toStringTag, d('', 'Iterator'));
},{"d":10,"d/auto-bind":9,"es5-ext/array/#/clear":11,"es5-ext/object/assign":19,"es5-ext/object/valid-callable":36,"es5-ext/object/valid-value":37,"es6-symbol":47}],46:[function(require,module,exports){
'use strict';
var isString = require('es5-ext/string/is-string')
, iteratorSymbol = require('es6-symbol').iterator
, isArray = Array.isArray;
module.exports = function (value) {
if (value == null) return false;
if (isArray(value)) return true;
if (isString(value)) return true;
return (typeof value[iteratorSymbol] === 'function');
};
},{"es5-ext/string/is-string":41,"es6-symbol":47}],47:[function(require,module,exports){
'use strict';
module.exports = require('./is-implemented')() ? Symbol : require('./polyfill');
},{"./is-implemented":48,"./polyfill":50}],48:[function(require,module,exports){
'use strict';
module.exports = function () {
var symbol;
if (typeof Symbol !== 'function') return false;
symbol = Symbol('test symbol');
try { String(symbol); } catch (e) { return false; }
if (typeof Symbol.iterator === 'symbol') return true;
// Return 'true' for polyfills
if (typeof Symbol.isConcatSpreadable !== 'object') return false;
if (typeof Symbol.iterator !== 'object') return false;
if (typeof Symbol.toPrimitive !== 'object') return false;
if (typeof Symbol.toStringTag !== 'object') return false;
if (typeof Symbol.unscopables !== 'object') return false;
return true;
};
},{}],49:[function(require,module,exports){
'use strict';
module.exports = function (x) {
return (x && ((typeof x === 'symbol') || (x['@@toStringTag'] === 'Symbol'))) || false;
};
},{}],50:[function(require,module,exports){
'use strict';
var d = require('d')
, validateSymbol = require('./validate-symbol')
, create = Object.create, defineProperties = Object.defineProperties
, defineProperty = Object.defineProperty, objPrototype = Object.prototype
, Symbol, HiddenSymbol, globalSymbols = create(null);
var generateName = (function () {
var created = create(null);
return function (desc) {
var postfix = 0, name;
while (created[desc + (postfix || '')]) ++postfix;
desc += (postfix || '');
created[desc] = true;
name = '@@' + desc;
defineProperty(objPrototype, name, d.gs(null, function (value) {
defineProperty(this, name, d(value));
}));
return name;
};
}());
HiddenSymbol = function Symbol(description) {
if (this instanceof HiddenSymbol) throw new TypeError('TypeError: Symbol is not a constructor');
return Symbol(description);
};
module.exports = Symbol = function Symbol(description) {
var symbol;
if (this instanceof Symbol) throw new TypeError('TypeError: Symbol is not a constructor');
symbol = create(HiddenSymbol.prototype);
description = (description === undefined ? '' : String(description));
return defineProperties(symbol, {
__description__: d('', description),
__name__: d('', generateName(description))
});
};
defineProperties(Symbol, {
for: d(function (key) {
if (globalSymbols[key]) return globalSymbols[key];
return (globalSymbols[key] = Symbol(String(key)));
}),
keyFor: d(function (s) {
var key;
validateSymbol(s);
for (key in globalSymbols) if (globalSymbols[key] === s) return key;
}),
hasInstance: d('', Symbol('hasInstance')),
isConcatSpreadable: d('', Symbol('isConcatSpreadable')),
iterator: d('', Symbol('iterator')),
match: d('', Symbol('match')),
replace: d('', Symbol('replace')),
search: d('', Symbol('search')),
species: d('', Symbol('species')),
split: d('', Symbol('split')),
toPrimitive: d('', Symbol('toPrimitive')),
toStringTag: d('', Symbol('toStringTag')),
unscopables: d('', Symbol('unscopables'))
});
defineProperties(HiddenSymbol.prototype, {
constructor: d(Symbol),
toString: d('', function () { return this.__name__; })
});
defineProperties(Symbol.prototype, {
toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),
valueOf: d(function () { return validateSymbol(this); })
});
defineProperty(Symbol.prototype, Symbol.toPrimitive, d('',
function () { return validateSymbol(this); }));
defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol'));
defineProperty(HiddenSymbol.prototype, Symbol.toPrimitive,
d('c', Symbol.prototype[Symbol.toPrimitive]));
defineProperty(HiddenSymbol.prototype, Symbol.toStringTag,
d('c', Symbol.prototype[Symbol.toStringTag]));
},{"./validate-symbol":51,"d":10}],51:[function(require,module,exports){
'use strict';
var isSymbol = require('./is-symbol');
module.exports = function (value) {
if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
return value;
};
},{"./is-symbol":49}],52:[function(require,module,exports){
// Thanks @mathiasbynens
// http://mathiasbynens.be/notes/javascript-unicode#iterating-over-symbols
'use strict';
var setPrototypeOf = require('es5-ext/object/set-prototype-of')
, d = require('d')
, Iterator = require('./')
, defineProperty = Object.defineProperty
, StringIterator;
StringIterator = module.exports = function (str) {
if (!(this instanceof StringIterator)) return new StringIterator(str);
str = String(str);
Iterator.call(this, str);
defineProperty(this, '__length__', d('', str.length));
};
if (setPrototypeOf) setPrototypeOf(StringIterator, Iterator);
StringIterator.prototype = Object.create(Iterator.prototype, {
constructor: d(StringIterator),
_next: d(function () {
if (!this.__list__) return;
if (this.__nextIndex__ < this.__length__) return this.__nextIndex__++;
this._unBind();
}),
_resolve: d(function (i) {
var char = this.__list__[i], code;
if (this.__nextIndex__ === this.__length__) return char;
code = char.charCodeAt(0);
if ((code >= 0xD800) && (code <= 0xDBFF)) return char + this.__list__[this.__nextIndex__++];
return char;
}),
toString: d(function () { return '[object String Iterator]'; })
});
},{"./":45,"d":10,"es5-ext/object/set-prototype-of":33}],53:[function(require,module,exports){
'use strict';
var isIterable = require('./is-iterable');
module.exports = function (value) {
if (!isIterable(value)) throw new TypeError(value + " is not iterable");
return value;
};
},{"./is-iterable":46}],54:[function(require,module,exports){
arguments[4][47][0].apply(exports,arguments)
},{"./is-implemented":55,"./polyfill":56,"dup":47}],55:[function(require,module,exports){
'use strict';
module.exports = function () {
var symbol;
if (typeof Symbol !== 'function') return false;
symbol = Symbol('test symbol');
try { String(symbol); } catch (e) { return false; }
if (typeof Symbol.iterator === 'symbol') return true;
// Return 'true' for polyfills
if (typeof Symbol.isConcatSpreadable !== 'object') return false;
if (typeof Symbol.isRegExp !== 'object') return false;
if (typeof Symbol.iterator !== 'object') return false;
if (typeof Symbol.toPrimitive !== 'object') return false;
if (typeof Symbol.toStringTag !== 'object') return false;
if (typeof Symbol.unscopables !== 'object') return false;
return true;
};
},{}],56:[function(require,module,exports){
'use strict';
var d = require('d')
, create = Object.create, defineProperties = Object.defineProperties
, generateName, Symbol;
generateName = (function () {
var created = create(null);
return function (desc) {
var postfix = 0;
while (created[desc + (postfix || '')]) ++postfix;
desc += (postfix || '');
created[desc] = true;
return '@@' + desc;
};
}());
module.exports = Symbol = function (description) {
var symbol;
if (this instanceof Symbol) {
throw new TypeError('TypeError: Symbol is not a constructor');
}
symbol = create(Symbol.prototype);
description = (description === undefined ? '' : String(description));
return defineProperties(symbol, {
__description__: d('', description),
__name__: d('', generateName(description))
});
};
Object.defineProperties(Symbol, {
create: d('', Symbol('create')),
hasInstance: d('', Symbol('hasInstance')),
isConcatSpreadable: d('', Symbol('isConcatSpreadable')),
isRegExp: d('', Symbol('isRegExp')),
iterator: d('', Symbol('iterator')),
toPrimitive: d('', Symbol('toPrimitive')),
toStringTag: d('', Symbol('toStringTag')),
unscopables: d('', Symbol('unscopables'))
});
defineProperties(Symbol.prototype, {
properToString: d(function () {
return 'Symbol (' + this.__description__ + ')';
}),
toString: d('', function () { return this.__name__; })
});
Object.defineProperty(Symbol.prototype, Symbol.toPrimitive, d('',
function (hint) {
throw new TypeError("Conversion of symbol objects is not allowed");
}));
Object.defineProperty(Symbol.prototype, Symbol.toStringTag, d('c', 'Symbol'));
},{"d":10}],57:[function(require,module,exports){
'use strict';
var d = require('d')
, callable = require('es5-ext/object/valid-callable')
, apply = Function.prototype.apply, call = Function.prototype.call
, create = Object.create, defineProperty = Object.defineProperty
, defineProperties = Object.defineProperties
, hasOwnProperty = Object.prototype.hasOwnProperty
, descriptor = { configurable: true, enumerable: false, writable: true }
, on, once, off, emit, methods, descriptors, base;
on = function (type, listener) {
var data;
callable(listener);
if (!hasOwnProperty.call(this, '__ee__')) {
data = descriptor.value = create(null);
defineProperty(this, '__ee__', descriptor);
descriptor.value = null;
} else {
data = this.__ee__;
}
if (!data[type]) data[type] = listener;
else if (typeof data[type] === 'object') data[type].push(listener);
else data[type] = [data[type], listener];
return this;
};
once = function (type, listener) {
var once, self;
callable(listener);
self = this;
on.call(this, type, once = function () {
off.call(self, type, once);
apply.call(listener, this, arguments);
});
once.__eeOnceListener__ = listener;
return this;
};
off = function (type, listener) {
var data, listeners, candidate, i;
callable(listener);
if (!hasOwnProperty.call(this, '__ee__')) return this;
data = this.__ee__;
if (!data[type]) return this;
listeners = data[type];
if (typeof listeners === 'object') {
for (i = 0; (candidate = listeners[i]); ++i) {
if ((candidate === listener) ||
(candidate.__eeOnceListener__ === listener)) {
if (listeners.length === 2) data[type] = listeners[i ? 0 : 1];
else listeners.splice(i, 1);
}
}
} else {
if ((listeners === listener) ||
(listeners.__eeOnceListener__ === listener)) {
delete data[type];
}
}
return this;
};
emit = function (type) {
var i, l, listener, listeners, args;
if (!hasOwnProperty.call(this, '__ee__')) return;
listeners = this.__ee__[type];
if (!listeners) return;
if (typeof listeners === 'object') {
l = arguments.length;
args = new Array(l - 1);
for (i = 1; i < l; ++i) args[i - 1] = arguments[i];
listeners = listeners.slice();
for (i = 0; (listener = listeners[i]); ++i) {
apply.call(listener, this, args);
}
} else {
switch (arguments.length) {
case 1:
call.call(listeners, this);
break;
case 2:
call.call(listeners, this, arguments[1]);
break;
case 3:
call.call(listeners, this, arguments[1], arguments[2]);
break;
default:
l = arguments.length;
args = new Array(l - 1);
for (i = 1; i < l; ++i) {
args[i - 1] = arguments[i];
}
apply.call(listeners, this, args);
}
}
};
methods = {
on: on,
once: once,
off: off,
emit: emit
};
descriptors = {
on: d(on),
once: d(once),
off: d(off),
emit: d(emit)
};
base = defineProperties({}, descriptors);
module.exports = exports = function (o) {
return (o == null) ? create(base) : defineProperties(Object(o), descriptors);
};
exports.methods = methods;
},{"d":10,"es5-ext/object/valid-callable":36}],58:[function(require,module,exports){
'use strict';
var clear = require('es5-ext/array/#/clear')
, eIndexOf = require('es5-ext/array/#/e-index-of')
, setPrototypeOf = require('es5-ext/object/set-prototype-of')
, callable = require('es5-ext/object/valid-callable')
, validValue = require('es5-ext/object/valid-value')
, d = require('d')
, ee = require('event-emitter')
, Symbol = require('es6-symbol')
, iterator = require('es6-iterator/valid-iterable')
, forOf = require('es6-iterator/for-of')
, Iterator = require('./lib/iterator')
, isNative = require('./is-native-implemented')
, call = Function.prototype.call, defineProperties = Object.defineProperties
, MapPoly;
module.exports = MapPoly = function (/*iterable*/) {
var iterable = arguments[0], keys, values;
if (!(this instanceof MapPoly)) return new MapPoly(iterable);
if (this.__mapKeysData__ !== undefined) {
throw new TypeError(this + " cannot be reinitialized");
}
if (iterable != null) iterator(iterable);
defineProperties(this, {
__mapKeysData__: d('c', keys = []),
__mapValuesData__: d('c', values = [])
});
if (!iterable) return;
forOf(iterable, function (value) {
var key = validValue(value)[0];
value = value[1];
if (eIndexOf.call(keys, key) !== -1) return;
keys.push(key);
values.push(value);
}, this);
};
if (isNative) {
if (setPrototypeOf) setPrototypeOf(MapPoly, Map);
MapPoly.prototype = Object.create(Map.prototype, {
constructor: d(MapPoly)
});
}
ee(defineProperties(MapPoly.prototype, {
clear: d(function () {
if (!this.__mapKeysData__.length) return;
clear.call(this.__mapKeysData__);
clear.call(this.__mapValuesData__);
this.emit('_clear');
}),
delete: d(function (key) {
var index = eIndexOf.call(this.__mapKeysData__, key);
if (index === -1) return false;
this.__mapKeysData__.splice(index, 1);
this.__mapValuesData__.splice(index, 1);
this.emit('_delete', index, key);
return true;
}),
entries: d(function () { return new Iterator(this, 'key+value'); }),
forEach: d(function (cb/*, thisArg*/) {
var thisArg = arguments[1], iterator, result;
callable(cb);
iterator = this.entries();
result = iterator._next();
while (result !== undefined) {
call.call(cb, thisArg, this.__mapValuesData__[result],
this.__mapKeysData__[result], this);
result = iterator._next();
}
}),
get: d(function (key) {
var index = eIndexOf.call(this.__mapKeysData__, key);
if (index === -1) return;
return this.__mapValuesData__[index];
}),
has: d(function (key) {
return (eIndexOf.call(this.__mapKeysData__, key) !== -1);
}),
keys: d(function () { return new Iterator(this, 'key'); }),
set: d(function (key, value) {
var index = eIndexOf.call(this.__mapKeysData__, key), emit;
if (index === -1) {
index = this.__mapKeysData__.push(key) - 1;
emit = true;
}
this.__mapValuesData__[index] = value;
if (emit) this.emit('_add', index, key);
return this;
}),
size: d.gs(function () { return this.__mapKeysData__.length; }),
values: d(function () { return new Iterator(this, 'value'); }),
toString: d(function () { return '[object Map]'; })
}));
Object.defineProperty(MapPoly.prototype, Symbol.iterator, d(function () {
return this.entries();
}));
Object.defineProperty(MapPoly.prototype, Symbol.toStringTag, d('c', 'Map'));
},{"./is-native-implemented":6,"./lib/iterator":8,"d":10,"es5-ext/array/#/clear":11,"es5-ext/array/#/e-index-of":12,"es5-ext/object/set-prototype-of":33,"es5-ext/object/valid-callable":36,"es5-ext/object/valid-value":37,"es6-iterator/for-of":43,"es6-iterator/valid-iterable":53,"es6-symbol":54,"event-emitter":57}],59:[function(require,module,exports){
(function (process,global){
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = {
internals: {},
config: {
Promise: root.Promise
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
identity = Rx.helpers.identity = function (x) { return x; },
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
just = Rx.helpers.just = function (value) { return function () { return value; }; },
defaultNow = Rx.helpers.defaultNow = Date.now,
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
not = Rx.helpers.not = function (a) { return !a; },
isFunction = Rx.helpers.isFunction = (function () {
var isFn = function (value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFn(/x/)) {
isFn = function(value) {
return typeof value == 'function' && toString.call(value) == '[object Function]';
};
}
return isFn;
}());
function cloneArray(arr) { for(var a = [], i = 0, len = arr.length; i < len; i++) { a.push(arr[i]); } return a;}
Rx.config.longStackSupport = false;
var hasStacks = false;
try {
throw new Error();
} catch (e) {
hasStacks = !!e.stack;
}
// All code after this point will be filtered from stack traces reported by RxJS
var rStartingLine = captureLine(), rFileName;
var STACK_JUMP_SEPARATOR = "From previous event:";
function makeStackTraceLong(error, observable) {
// If possible, transform the error stack trace by removing Node and RxJS
// cruft, then concatenating with the stack trace of `observable`.
if (hasStacks &&
observable.stack &&
typeof error === "object" &&
error !== null &&
error.stack &&
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
) {
var stacks = [];
for (var o = observable; !!o; o = o.source) {
if (o.stack) {
stacks.unshift(o.stack);
}
}
stacks.unshift(error.stack);
var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
error.stack = filterStackString(concatedStacks);
}
}
function filterStackString(stackString) {
var lines = stackString.split("\n"),
desiredLines = [];
for (var i = 0, len = lines.length; i < len; i++) {
var line = lines[i];
if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
desiredLines.push(line);
}
}
return desiredLines.join("\n");
}
function isInternalFrame(stackLine) {
var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
if (!fileNameAndLineNumber) {
return false;
}
var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];
return fileName === rFileName &&
lineNumber >= rStartingLine &&
lineNumber <= rEndingLine;
}
function isNodeFrame(stackLine) {
return stackLine.indexOf("(module.js:") !== -1 ||
stackLine.indexOf("(node.js:") !== -1;
}
function captureLine() {
if (!hasStacks) { return; }
try {
throw new Error();
} catch (e) {
var lines = e.stack.split("\n");
var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
if (!fileNameAndLineNumber) { return; }
rFileName = fileNameAndLineNumber[0];
return fileNameAndLineNumber[1];
}
}
function getFileNameAndLineNumber(stackLine) {
// Named functions: "at functionName (filename:lineNumber:columnNumber)"
var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }
// Anonymous functions: "at filename:lineNumber:columnNumber"
var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }
// Firefox style: "function@filename:lineNumber or @filename:lineNumber"
var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }
}
var EmptyError = Rx.EmptyError = function() {
this.message = 'Sequence contains no elements.';
Error.call(this);
};
EmptyError.prototype = Error.prototype;
var ObjectDisposedError = Rx.ObjectDisposedError = function() {
this.message = 'Object has been disposed';
Error.call(this);
};
ObjectDisposedError.prototype = Error.prototype;
var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () {
this.message = 'Argument out of range';
Error.call(this);
};
ArgumentOutOfRangeError.prototype = Error.prototype;
var NotSupportedError = Rx.NotSupportedError = function (message) {
this.message = message || 'This operation is not supported';
Error.call(this);
};
NotSupportedError.prototype = Error.prototype;
var NotImplementedError = Rx.NotImplementedError = function (message) {
this.message = message || 'This operation is not implemented';
Error.call(this);
};
NotImplementedError.prototype = Error.prototype;
var notImplemented = Rx.helpers.notImplemented = function () {
throw new NotImplementedError();
};
var notSupported = Rx.helpers.notSupported = function () {
throw new NotSupportedError();
};
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Bug for mozilla version
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };
var isIterable = Rx.helpers.isIterable = function (o) {
return o[$iterator$] !== undefined;
}
var isArrayLike = Rx.helpers.isArrayLike = function (o) {
return o && o.length !== undefined;
}
Rx.helpers.iterator = $iterator$;
var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) {
if (typeof thisArg === 'undefined') { return func; }
switch(argCount) {
case 0:
return function() {
return func.call(thisArg)
};
case 1:
return function(arg) {
return func.call(thisArg, arg);
}
case 2:
return function(value, index) {
return func.call(thisArg, value, index);
};
case 3:
return function(value, index, collection) {
return func.call(thisArg, value, index, collection);
};
}
return function() {
return func.apply(thisArg, arguments);
};
};
/** Used to determine if values are of the language type Object */
var dontEnums = ['toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'],
dontEnumsLength = dontEnums.length;
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
supportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
stringProto = String.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch (e) {
supportNodeClass = true;
}
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
var isObject = Rx.internals.isObject = function(value) {
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
};
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = dontEnumsLength;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = dontEnums[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
var isArguments = function(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a) ?
b != +b :
// but treat `-0` vs. `+0` as not equal
(a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
var result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var hasProp = {}.hasOwnProperty,
slice = Array.prototype.slice;
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
var addProperties = Rx.internals.addProperties = function (obj) {
for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
for (var idx = 0, ln = sources.length; idx < ln; idx++) {
var source = sources[idx];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
var errorObj = {e: {}};
var tryCatchTarget;
function tryCatcher() {
try {
return tryCatchTarget.apply(this, arguments);
} catch (e) {
errorObj.e = e;
return errorObj;
}
}
function tryCatch(fn) {
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
tryCatchTarget = fn;
return tryCatcher;
}
function thrower(e) {
throw e;
}
// Collections
function IndexedItem(id, value) {
this.id = id;
this.value = value;
}
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
c === 0 && (c = this.id - other.id);
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) { return; }
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) { return; }
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
+index || (index = 0);
if (index >= this.length || index < 0) { return; }
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
this.items[this.length] = undefined;
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
var args = [], i, len;
if (Array.isArray(arguments[0])) {
args = arguments[0];
len = args.length;
} else {
len = arguments.length;
args = new Array(len);
for(i = 0; i < len; i++) { args[i] = arguments[i]; }
}
for(i = 0; i < len; i++) {
if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); }
}
this.disposables = args;
this.isDisposed = false;
this.length = args.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var len = this.disposables.length, currentDisposables = new Array(len);
for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; }
this.disposables = [];
this.length = 0;
for (i = 0; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Provides a set of static methods for creating Disposables.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
/**
* Validates whether the given object is a disposable
* @param {Object} Object to test whether it has a dispose method
* @returns {Boolean} true if a disposable object, else false.
*/
var isDisposable = Disposable.isDisposable = function (d) {
return d && isFunction(d.dispose);
};
var checkDisposed = Disposable.checkDisposed = function (disposable) {
if (disposable.isDisposed) { throw new ObjectDisposedError(); }
};
// Single assignment
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {
this.isDisposed = false;
this.current = null;
};
SingleAssignmentDisposable.prototype.getDisposable = function () {
return this.current;
};
SingleAssignmentDisposable.prototype.setDisposable = function (value) {
if (this.current) { throw new Error('Disposable has already been assigned'); }
var shouldDispose = this.isDisposed;
!shouldDispose && (this.current = value);
shouldDispose && value && value.dispose();
};
SingleAssignmentDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
}
old && old.dispose();
};
// Multiple assignment disposable
var SerialDisposable = Rx.SerialDisposable = function () {
this.isDisposed = false;
this.current = null;
};
SerialDisposable.prototype.getDisposable = function () {
return this.current;
};
SerialDisposable.prototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed;
if (!shouldDispose) {
var old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
SerialDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var old = this.current;
this.current = null;
}
old && old.dispose();
};
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed && !this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed && !this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
function scheduleItem(s, self) {
if (!self.isDisposed) {
self.isDisposed = true;
self.disposable.dispose();
}
}
ScheduledDisposable.prototype.dispose = function () {
this.scheduler.scheduleWithState(this, scheduleItem);
};
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
/** Determines whether the given object is a scheduler */
Scheduler.isScheduler = function (s) {
return s instanceof Scheduler;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
timeSpan < 0 && (timeSpan = 0);
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair[0], action = pair[1], group = new CompositeDisposable();
function recursiveAction(state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
}
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair[0], action = pair[1], group = new CompositeDisposable();
function recursiveAction(state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method](state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function scheduleInnerRecursive(action, self) {
action(function(dt) { self(action, dt); });
}
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState([state, action], invokeRecImmediate);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative([state, action], dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute([state, action], dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, action);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) {
if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); }
period = normalizeTime(period);
var s = state, id = root.setInterval(function () { s = action(s); }, period);
return disposableCreate(function () { root.clearInterval(id); });
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
* @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.
* @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.
*/
schedulerProto.catchError = schedulerProto['catch'] = function (handler) {
return new CatchScheduler(this, handler);
};
}(Scheduler.prototype));
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
/** Gets a scheduler that schedules work immediately on the current thread. */
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline () {
while (queue.length > 0) {
var item = queue.dequeue();
!item.isCancelled() && item.invoke();
}
}
function scheduleNow(state, action) {
var si = new ScheduledItem(this, state, action, this.now());
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
var result = tryCatch(runTrampoline)();
queue = null;
if (result === errorObj) { return thrower(result.e); }
} else {
queue.enqueue(si);
}
return si.disposable;
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
currentScheduler.scheduleRequired = function () { return !queue; };
return currentScheduler;
}());
var scheduleMethod, clearMethod;
var localTimer = (function () {
var localSetTimeout, localClearTimeout = noop;
if (!!root.setTimeout) {
localSetTimeout = root.setTimeout;
localClearTimeout = root.clearTimeout;
} else if (!!root.WScript) {
localSetTimeout = function (fn, time) {
root.WScript.Sleep(time);
fn();
};
} else {
throw new NotSupportedError();
}
return {
setTimeout: localSetTimeout,
clearTimeout: localClearTimeout
};
}());
var localSetTimeout = localTimer.setTimeout,
localClearTimeout = localTimer.clearTimeout;
(function () {
var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false;
clearMethod = function (handle) {
delete tasksByHandle[handle];
};
function runTask(handle) {
if (currentlyRunning) {
localSetTimeout(function () { runTask(handle) }, 0);
} else {
var task = tasksByHandle[handle];
if (task) {
currentlyRunning = true;
var result = tryCatch(task)();
clearMethod(handle);
currentlyRunning = false;
if (result === errorObj) { return thrower(result.e); }
}
}
}
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false, oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('', '*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
if (isFunction(setImmediate)) {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
setImmediate(function () { runTask(id); });
return id;
};
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
process.nextTick(function () { runTask(id); });
return id;
};
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random();
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
runTask(event.data.substring(MSG_PREFIX.length));
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else if (root.attachEvent) {
root.attachEvent('onmessage', onGlobalPostMessage);
} else {
root.onmessage = onGlobalPostMessage;
}
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
return id;
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel();
channel.port1.onmessage = function (e) { runTask(e.data); };
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
channel.port2.postMessage(id);
return id;
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
var id = nextHandle++;
tasksByHandle[id] = action;
scriptElement.onreadystatechange = function () {
runTask(id);
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
return id;
};
} else {
scheduleMethod = function (action) {
var id = nextHandle++;
tasksByHandle[id] = action;
localSetTimeout(function () {
runTask(id);
}, 0);
return id;
};
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = Scheduler['default'] = (function () {
function scheduleNow(state, action) {
var scheduler = this, disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
!disposable.isDisposed && disposable.setDisposable(action(scheduler, state));
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this, dt = Scheduler.normalize(dueTime), disposable = new SingleAssignmentDisposable();
if (dt === 0) { return scheduler.scheduleWithState(state, action); }
var id = localSetTimeout(function () {
!disposable.isDisposed && disposable.setDisposable(action(scheduler, state));
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
localClearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
var CatchScheduler = (function (__super__) {
function scheduleNow(state, action) {
return this._scheduler.scheduleWithState(state, this._wrap(action));
}
function scheduleRelative(state, dueTime, action) {
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action));
}
function scheduleAbsolute(state, dueTime, action) {
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action));
}
inherits(CatchScheduler, __super__);
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
__super__.call(this, this._scheduler.now.bind(this._scheduler), scheduleNow, scheduleRelative, scheduleAbsolute);
}
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
CatchScheduler.prototype._wrap = function (action) {
var parent = this;
return function (self, state) {
try {
return action(parent._getRecursiveWrapper(self), state);
} catch (e) {
if (!parent._handler(e)) { throw e; }
return disposableEmpty;
}
};
};
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {
if (this._recursiveOriginal !== scheduler) {
this._recursiveOriginal = scheduler;
var wrapper = this._clone(scheduler);
wrapper._recursiveOriginal = scheduler;
wrapper._recursiveWrapper = wrapper;
this._recursiveWrapper = wrapper;
}
return this._recursiveWrapper;
};
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var self = this, failed = false, d = new SingleAssignmentDisposable();
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) {
if (failed) { return null; }
try {
return action(state1);
} catch (e) {
failed = true;
if (!self._handler(e)) { throw e; }
d.dispose();
return null;
}
}));
return d;
};
return CatchScheduler;
}(Scheduler));
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, value, exception, accept, acceptObservable, toString) {
this.kind = kind;
this.value = value;
this.exception = exception;
this._accept = accept;
this._acceptObservable = acceptObservable;
this.toString = toString;
}
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notifications
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
Notification.prototype.toObservable = function (scheduler) {
var self = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithState(self, function (_, notification) {
notification._acceptObservable(observer);
notification.kind === 'N' && observer.onCompleted();
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept(onNext) { return onNext(this.value); }
function _acceptObservable(observer) { return observer.onNext(this.value); }
function toString() { return 'OnNext(' + this.value + ')'; }
return function (value) {
return new Notification('N', value, null, _accept, _acceptObservable, toString);
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) { return onError(this.exception); }
function _acceptObservable(observer) { return observer.onError(this.exception); }
function toString () { return 'OnError(' + this.exception + ')'; }
return function (e) {
return new Notification('E', null, e, _accept, _acceptObservable, toString);
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
function _acceptObservable(observer) { return observer.onCompleted(); }
function toString () { return 'OnCompleted()'; }
return function () {
return new Notification('C', null, null, _accept, _acceptObservable, toString);
};
}());
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) { return n.accept(observer); };
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
* If a violation is detected, an Error is thrown from the offending observer method call.
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/
Observer.prototype.checked = function () { return new CheckedObserver(this); };
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler, thisArg) {
return new AnonymousObserver(function (x) {
return handler.call(thisArg, notificationCreateOnNext(x));
}, function (e) {
return handler.call(thisArg, notificationCreateOnError(e));
}, function () {
return handler.call(thisArg, notificationCreateOnCompleted());
});
};
/**
* Schedules the invocation of observer methods on the given scheduler.
* @param {Scheduler} scheduler Scheduler to schedule observer messages on.
* @returns {Observer} Observer whose messages are scheduled on the given scheduler.
*/
Observer.prototype.notifyOn = function (scheduler) {
return new ObserveOnObserver(scheduler, this);
};
Observer.prototype.makeSafe = function(disposable) {
return new AnonymousSafeObserver(this._onNext, this._onError, this._onCompleted, disposable);
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
inherits(AbstractObserver, __super__);
/**
* Creates a new observer in a non-stopped state.
*/
function AbstractObserver() {
this.isStopped = false;
__super__.call(this);
}
// Must be implemented by other observers
AbstractObserver.prototype.next = notImplemented;
AbstractObserver.prototype.error = notImplemented;
AbstractObserver.prototype.completed = notImplemented;
/**
* Notifies the observer of a new element in the sequence.
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) { this.next(value); }
};
/**
* Notifies the observer that an exception has occurred.
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {
inherits(AnonymousObserver, __super__);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
__super__.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (error) {
this._onError(error);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var CheckedObserver = (function (__super__) {
inherits(CheckedObserver, __super__);
function CheckedObserver(observer) {
__super__.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
var res = tryCatch(this._observer.onNext).call(this._observer, value);
this._state = 0;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
var res = tryCatch(this._observer.onError).call(this._observer, err);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
var res = tryCatch(this._observer.onCompleted).call(this._observer);
this._state = 2;
res === errorObj && thrower(res.e);
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (__super__) {
inherits(ScheduledObserver, __super__);
function ScheduledObserver(scheduler, observer) {
__super__.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () { self.observer.onNext(value); });
};
ScheduledObserver.prototype.error = function (e) {
var self = this;
this.queue.push(function () { self.observer.onError(e); });
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () { self.observer.onCompleted(); });
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
ScheduledObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
var ObserveOnObserver = (function (__super__) {
inherits(ObserveOnObserver, __super__);
function ObserveOnObserver(scheduler, observer, cancel) {
__super__.call(this, scheduler, observer);
this._cancel = cancel;
}
ObserveOnObserver.prototype.next = function (value) {
__super__.prototype.next.call(this, value);
this.ensureActive();
};
ObserveOnObserver.prototype.error = function (e) {
__super__.prototype.error.call(this, e);
this.ensureActive();
};
ObserveOnObserver.prototype.completed = function () {
__super__.prototype.completed.call(this);
this.ensureActive();
};
ObserveOnObserver.prototype.dispose = function () {
__super__.prototype.dispose.call(this);
this._cancel && this._cancel.dispose();
this._cancel = null;
};
return ObserveOnObserver;
})(ScheduledObserver);
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
if (Rx.config.longStackSupport && hasStacks) {
try {
throw new Error();
} catch (e) {
this.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
}
var self = this;
this._subscribe = function (observer) {
var oldOnError = observer.onError.bind(observer);
observer.onError = function (err) {
makeStackTraceLong(err, self);
oldOnError(err);
};
return subscribe.call(self, observer);
};
} else {
this._subscribe = subscribe;
}
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
return this._subscribe(typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onNext The function to invoke on each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnNext = function (onNext, thisArg) {
return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext));
};
/**
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnError = function (onError, thisArg) {
return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError));
};
/**
* Subscribes to the next value in the sequence with an optional "this" argument.
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
*/
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted));
};
return Observable;
})();
var ObservableBase = Rx.ObservableBase = (function (__super__) {
inherits(ObservableBase, __super__);
function fixSubscriber(subscriber) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], self = state[1];
var sub = tryCatch(self.subscribeCore).call(self, ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}
function subscribe(observer) {
var ado = new AutoDetachObserver(observer), state = [ado, this];
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.scheduleWithState(state, setDisposable);
} else {
setDisposable(null, state);
}
return ado;
}
function ObservableBase() {
__super__.call(this, subscribe);
}
ObservableBase.prototype.subscribeCore = notImplemented;
return ObservableBase;
}(Observable));
var Enumerable = Rx.internals.Enumerable = function () { };
var ConcatEnumerableObservable = (function(__super__) {
inherits(ConcatEnumerableObservable, __super__);
function ConcatEnumerableObservable(sources) {
this.sources = sources;
__super__.call(this);
}
ConcatEnumerableObservable.prototype.subscribeCore = function (o) {
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursiveWithState(this.sources[$iterator$](), function (e, self) {
if (isDisposed) { return; }
var currentItem = tryCatch(e.next).call(e);
if (currentItem === errorObj) { return o.onError(currentItem.e); }
if (currentItem.done) {
return o.onCompleted();
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(new InnerObserver(o, self, e)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
};
function InnerObserver(o, s, e) {
this.o = o;
this.s = s;
this.e = e;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.o.onNext(x); } };
InnerObserver.prototype.onError = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(err);
}
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.s(this.e);
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; };
InnerObserver.prototype.fail = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(err);
return true;
}
return false;
};
return ConcatEnumerableObservable;
}(ObservableBase));
Enumerable.prototype.concat = function () {
return new ConcatEnumerableObservable(this);
};
var CatchErrorObservable = (function(__super__) {
inherits(CatchErrorObservable, __super__);
function CatchErrorObservable(sources) {
this.sources = sources;
__super__.call(this);
}
CatchErrorObservable.prototype.subscribeCore = function (o) {
var e = this.sources[$iterator$]();
var isDisposed, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) {
if (isDisposed) { return; }
var currentItem = tryCatch(e.next).call(e);
if (currentItem === errorObj) { return o.onError(currentItem.e); }
if (currentItem.done) {
return lastException !== null ? o.onError(lastException) : o.onCompleted();
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
self,
function() { o.onCompleted(); }));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
};
return CatchErrorObservable;
}(ObservableBase));
Enumerable.prototype.catchError = function () {
return new CatchErrorObservable(this);
};
Enumerable.prototype.catchErrorWhen = function (notificationHandler) {
var sources = this;
return new AnonymousObservable(function (o) {
var exceptions = new Subject(),
notifier = new Subject(),
handled = notificationHandler(exceptions),
notificationDisposable = handled.subscribe(notifier);
var e = sources[$iterator$]();
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
var currentItem = tryCatch(e.next).call(e);
if (currentItem === errorObj) { return o.onError(currentItem.e); }
if (currentItem.done) {
if (lastException) {
o.onError(lastException);
} else {
o.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var outer = new SingleAssignmentDisposable();
var inner = new SingleAssignmentDisposable();
subscription.setDisposable(new CompositeDisposable(inner, outer));
outer.setDisposable(currentValue.subscribe(
function(x) { o.onNext(x); },
function (exn) {
inner.setDisposable(notifier.subscribe(self, function(ex) {
o.onError(ex);
}, function() {
o.onCompleted();
}));
exceptions.onNext(exn);
},
function() { o.onCompleted(); }));
});
return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var RepeatEnumerable = (function (__super__) {
inherits(RepeatEnumerable, __super__);
function RepeatEnumerable(v, c) {
this.v = v;
this.c = c == null ? -1 : c;
}
RepeatEnumerable.prototype[$iterator$] = function () {
return new RepeatEnumerator(this);
};
function RepeatEnumerator(p) {
this.v = p.v;
this.l = p.c;
}
RepeatEnumerator.prototype.next = function () {
if (this.l === 0) { return doneEnumerator; }
if (this.l > 0) { this.l--; }
return { done: false, value: this.v };
};
return RepeatEnumerable;
}(Enumerable));
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
return new RepeatEnumerable(value, repeatCount);
};
var OfEnumerable = (function(__super__) {
inherits(OfEnumerable, __super__);
function OfEnumerable(s, fn, thisArg) {
this.s = s;
this.fn = fn ? bindCallback(fn, thisArg, 3) : null;
}
OfEnumerable.prototype[$iterator$] = function () {
return new OfEnumerator(this);
};
function OfEnumerator(p) {
this.i = -1;
this.s = p.s;
this.l = this.s.length;
this.fn = p.fn;
}
OfEnumerator.prototype.next = function () {
return ++this.i < this.l ?
{ done: false, value: !this.fn ? this.s[this.i] : this.fn(this.s[this.i], this.i, this.s) } :
doneEnumerator;
};
return OfEnumerable;
}(Enumerable));
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
return new OfEnumerable(source, selector, thisArg);
};
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
}, source);
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
}, source);
};
var FromPromiseObservable = (function(__super__) {
inherits(FromPromiseObservable, __super__);
function FromPromiseObservable(p) {
this.p = p;
__super__.call(this);
}
FromPromiseObservable.prototype.subscribeCore = function(o) {
this.p.then(function (data) {
o.onNext(data);
o.onCompleted();
}, function (err) { o.onError(err); });
return disposableEmpty;
};
return FromPromiseObservable;
}(ObservableBase));
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return new FromPromiseObservable(promise);
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) { throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); }
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, reject, function () {
hasValue && resolve(value);
});
});
};
var ToArrayObservable = (function(__super__) {
inherits(ToArrayObservable, __super__);
function ToArrayObservable(source) {
this.source = source;
__super__.call(this);
}
ToArrayObservable.prototype.subscribeCore = function(o) {
return this.source.subscribe(new InnerObserver(o));
};
function InnerObserver(o) {
this.o = o;
this.a = [];
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.o.onNext(this.a);
this.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return ToArrayObservable;
}(ObservableBase));
/**
* Creates an array from an observable sequence.
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
return new ToArrayObservable(this);
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe, parent) {
return new AnonymousObservable(subscribe, parent);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
var EmptyObservable = (function(__super__) {
inherits(EmptyObservable, __super__);
function EmptyObservable(scheduler) {
this.scheduler = scheduler;
__super__.call(this);
}
EmptyObservable.prototype.subscribeCore = function (observer) {
var sink = new EmptySink(observer, this);
return sink.run();
};
function EmptySink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
function scheduleItem(s, state) {
state.onCompleted();
}
EmptySink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState(this.observer, scheduleItem);
};
return EmptyObservable;
}(ObservableBase));
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new EmptyObservable(scheduler);
};
var FromObservable = (function(__super__) {
inherits(FromObservable, __super__);
function FromObservable(iterable, mapper, scheduler) {
this.iterable = iterable;
this.mapper = mapper;
this.scheduler = scheduler;
__super__.call(this);
}
FromObservable.prototype.subscribeCore = function (observer) {
var sink = new FromSink(observer, this);
return sink.run();
};
return FromObservable;
}(ObservableBase));
var FromSink = (function () {
function FromSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
FromSink.prototype.run = function () {
var list = Object(this.parent.iterable),
it = getIterable(list),
observer = this.observer,
mapper = this.parent.mapper;
function loopRecursive(i, recurse) {
try {
var next = it.next();
} catch (e) {
return observer.onError(e);
}
if (next.done) {
return observer.onCompleted();
}
var result = next.value;
if (mapper) {
try {
result = mapper(result, i);
} catch (e) {
return observer.onError(e);
}
}
observer.onNext(result);
recurse(i + 1);
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
return FromSink;
}());
var maxSafeInteger = Math.pow(2, 53) - 1;
function StringIterable(str) {
this._s = s;
}
StringIterable.prototype[$iterator$] = function () {
return new StringIterator(this._s);
};
function StringIterator(str) {
this._s = s;
this._l = s.length;
this._i = 0;
}
StringIterator.prototype[$iterator$] = function () {
return this;
};
StringIterator.prototype.next = function () {
return this._i < this._l ? { done: false, value: this._s.charAt(this._i++) } : doneEnumerator;
};
function ArrayIterable(a) {
this._a = a;
}
ArrayIterable.prototype[$iterator$] = function () {
return new ArrayIterator(this._a);
};
function ArrayIterator(a) {
this._a = a;
this._l = toLength(a);
this._i = 0;
}
ArrayIterator.prototype[$iterator$] = function () {
return this;
};
ArrayIterator.prototype.next = function () {
return this._i < this._l ? { done: false, value: this._a[this._i++] } : doneEnumerator;
};
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function getIterable(o) {
var i = o[$iterator$], it;
if (!i && typeof o === 'string') {
it = new StringIterable(o);
return it[$iterator$]();
}
if (!i && o.length !== undefined) {
it = new ArrayIterable(o);
return it[$iterator$]();
}
if (!i) { throw new TypeError('Object is not iterable'); }
return o[$iterator$]();
}
function sign(value) {
var number = +value;
if (number === 0) { return number; }
if (isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
}
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
if (len <= 0) { return 0; }
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
}
/**
* This method creates a new Observable sequence from an array-like or iterable object.
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
* @param {Function} [mapFn] Map function to call on every element of the array.
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
*/
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isFunction(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
if (mapFn) {
var mapper = bindCallback(mapFn, thisArg, 2);
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromObservable(iterable, mapper, scheduler);
}
var FromArrayObservable = (function(__super__) {
inherits(FromArrayObservable, __super__);
function FromArrayObservable(args, scheduler) {
this.args = args;
this.scheduler = scheduler;
__super__.call(this);
}
FromArrayObservable.prototype.subscribeCore = function (observer) {
var sink = new FromArraySink(observer, this);
return sink.run();
};
return FromArrayObservable;
}(ObservableBase));
function FromArraySink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
FromArraySink.prototype.run = function () {
var observer = this.observer, args = this.parent.args, len = args.length;
function loopRecursive(i, recurse) {
if (i < len) {
observer.onNext(args[i]);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
* @deprecated use Observable.from or Observable.of
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromArrayObservable(array, scheduler)
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (o) {
var first = true;
return scheduler.scheduleRecursiveWithState(initialState, function (state, self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
hasResult && (result = resultSelector(state));
} catch (e) {
return o.onError(e);
}
if (hasResult) {
o.onNext(result);
self(state);
} else {
o.onCompleted();
}
});
});
};
function observableOf (scheduler, array) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new FromArrayObservable(array, scheduler);
}
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.of = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new FromArrayObservable(args, currentThreadScheduler);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.ofWithScheduler = function (scheduler) {
var len = arguments.length, args = new Array(len - 1);
for(var i = 1; i < len; i++) { args[i - 1] = arguments[i]; }
return new FromArrayObservable(args, scheduler);
};
/**
* Creates an Observable sequence from changes to an array using Array.observe.
* @param {Array} array An array to observe changes.
* @returns {Observable} An observable sequence containing changes to an array from Array.observe.
*/
Observable.ofArrayChanges = function(array) {
if (!Array.isArray(array)) { throw new TypeError('Array.observe only accepts arrays.'); }
if (typeof Array.observe !== 'function' && typeof Array.unobserve !== 'function') { throw new TypeError('Array.observe is not supported on your platform') }
return new AnonymousObservable(function(observer) {
function observerFn(changes) {
for(var i = 0, len = changes.length; i < len; i++) {
observer.onNext(changes[i]);
}
}
Array.observe(array, observerFn);
return function () {
Array.unobserve(array, observerFn);
};
});
};
/**
* Creates an Observable sequence from changes to an object using Object.observe.
* @param {Object} obj An object to observe changes.
* @returns {Observable} An observable sequence containing changes to an object from Object.observe.
*/
Observable.ofObjectChanges = function(obj) {
if (obj == null) { throw new TypeError('object must not be null or undefined.'); }
if (typeof Object.observe !== 'function' && typeof Object.unobserve !== 'function') { throw new TypeError('Object.observe is not supported on your platform') }
return new AnonymousObservable(function(observer) {
function observerFn(changes) {
for(var i = 0, len = changes.length; i < len; i++) {
observer.onNext(changes[i]);
}
}
Object.observe(obj, observerFn);
return function () {
Object.unobserve(obj, observerFn);
};
});
};
var NeverObservable = (function(__super__) {
inherits(NeverObservable, __super__);
function NeverObservable() {
__super__.call(this);
}
NeverObservable.prototype.subscribeCore = function (observer) {
return disposableEmpty;
};
return NeverObservable;
}(ObservableBase));
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new NeverObservable();
};
var PairsObservable = (function(__super__) {
inherits(PairsObservable, __super__);
function PairsObservable(obj, scheduler) {
this.obj = obj;
this.keys = Object.keys(obj);
this.scheduler = scheduler;
__super__.call(this);
}
PairsObservable.prototype.subscribeCore = function (observer) {
var sink = new PairsSink(observer, this);
return sink.run();
};
return PairsObservable;
}(ObservableBase));
function PairsSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
PairsSink.prototype.run = function () {
var observer = this.observer, obj = this.parent.obj, keys = this.parent.keys, len = keys.length;
function loopRecursive(i, recurse) {
if (i < len) {
var key = keys[i];
observer.onNext([key, obj[key]]);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
/**
* Convert an object into an observable sequence of [key, value] pairs.
* @param {Object} obj The object to inspect.
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} An observable sequence of [key, value] pairs from the object.
*/
Observable.pairs = function (obj, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new PairsObservable(obj, scheduler);
};
var RangeObservable = (function(__super__) {
inherits(RangeObservable, __super__);
function RangeObservable(start, count, scheduler) {
this.start = start;
this.rangeCount = count;
this.scheduler = scheduler;
__super__.call(this);
}
RangeObservable.prototype.subscribeCore = function (observer) {
var sink = new RangeSink(observer, this);
return sink.run();
};
return RangeObservable;
}(ObservableBase));
var RangeSink = (function () {
function RangeSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
RangeSink.prototype.run = function () {
var start = this.parent.start, count = this.parent.rangeCount, observer = this.observer;
function loopRecursive(i, recurse) {
if (i < count) {
observer.onNext(start + i);
recurse(i + 1);
} else {
observer.onCompleted();
}
}
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
};
return RangeSink;
}());
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new RangeObservable(start, count, scheduler);
};
var RepeatObservable = (function(__super__) {
inherits(RepeatObservable, __super__);
function RepeatObservable(value, repeatCount, scheduler) {
this.value = value;
this.repeatCount = repeatCount == null ? -1 : repeatCount;
this.scheduler = scheduler;
__super__.call(this);
}
RepeatObservable.prototype.subscribeCore = function (observer) {
var sink = new RepeatSink(observer, this);
return sink.run();
};
return RepeatObservable;
}(ObservableBase));
function RepeatSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
RepeatSink.prototype.run = function () {
var observer = this.observer, value = this.parent.value;
function loopRecursive(i, recurse) {
if (i === -1 || i > 0) {
observer.onNext(value);
i > 0 && i--;
}
if (i === 0) { return observer.onCompleted(); }
recurse(i);
}
return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount, loopRecursive);
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new RepeatObservable(value, repeatCount, scheduler);
};
var JustObservable = (function(__super__) {
inherits(JustObservable, __super__);
function JustObservable(value, scheduler) {
this.value = value;
this.scheduler = scheduler;
__super__.call(this);
}
JustObservable.prototype.subscribeCore = function (observer) {
var sink = new JustSink(observer, this);
return sink.run();
};
function JustSink(observer, parent) {
this.observer = observer;
this.parent = parent;
}
function scheduleItem(s, state) {
var value = state[0], observer = state[1];
observer.onNext(value);
observer.onCompleted();
}
JustSink.prototype.run = function () {
return this.parent.scheduler.scheduleWithState([this.parent.value, this.observer], scheduleItem);
};
return JustObservable;
}(ObservableBase));
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just' or browsers <IE9.
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.just = Observable.returnValue = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new JustObservable(value, scheduler);
};
var ThrowObservable = (function(__super__) {
inherits(ThrowObservable, __super__);
function ThrowObservable(error, scheduler) {
this.error = error;
this.scheduler = scheduler;
__super__.call(this);
}
ThrowObservable.prototype.subscribeCore = function (o) {
var sink = new ThrowSink(o, this);
return sink.run();
};
function ThrowSink(o, p) {
this.o = o;
this.p = p;
}
function scheduleItem(s, state) {
var e = state[0], o = state[1];
o.onError(e);
}
ThrowSink.prototype.run = function () {
return this.p.scheduler.scheduleWithState([this.p.error, this.o], scheduleItem);
};
return ThrowObservable;
}(ObservableBase));
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwError' for browsers <IE9.
* @param {Mixed} error An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwError = Observable.throwException = function (error, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new ThrowObservable(error, scheduler);
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new AnonymousObservable(function (observer) {
var disposable = disposableEmpty, resource, source;
try {
resource = resourceFactory();
resource && (disposable = resource);
source = observableFactory(resource);
} catch (exception) {
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
}
return new CompositeDisposable(source.subscribe(observer), disposable);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
* @param {Observable} rightSource Second observable sequence or Promise.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/
observableProto.amb = function (rightSource) {
var leftSource = this;
return new AnonymousObservable(function (observer) {
var choice,
leftChoice = 'L', rightChoice = 'R',
leftSubscription = new SingleAssignmentDisposable(),
rightSubscription = new SingleAssignmentDisposable();
isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));
function choiceL() {
if (!choice) {
choice = leftChoice;
rightSubscription.dispose();
}
}
function choiceR() {
if (!choice) {
choice = rightChoice;
leftSubscription.dispose();
}
}
leftSubscription.setDisposable(leftSource.subscribe(function (left) {
choiceL();
choice === leftChoice && observer.onNext(left);
}, function (err) {
choiceL();
choice === leftChoice && observer.onError(err);
}, function () {
choiceL();
choice === leftChoice && observer.onCompleted();
}));
rightSubscription.setDisposable(rightSource.subscribe(function (right) {
choiceR();
choice === rightChoice && observer.onNext(right);
}, function (err) {
choiceR();
choice === rightChoice && observer.onError(err);
}, function () {
choiceR();
choice === rightChoice && observer.onCompleted();
}));
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
*
* @example
* var = Rx.Observable.amb(xs, ys, zs);
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(), items = [];
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); }
}
function func(previous, current) {
return previous.amb(current);
}
for (var i = 0, len = items.length; i < len; i++) {
acc = func(acc, items[i]);
}
return acc;
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (o) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(function (x) { o.onNext(x); }, function (e) {
try {
var result = handler(e);
} catch (ex) {
return o.onError(ex);
}
isPromise(result) && (result = observableFromPromise(result));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(o));
}, function (x) { o.onCompleted(x); }));
return subscription;
}, source);
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchError = observableProto.catchException = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?
observableCatchHandler(this, handlerOrSecond) :
observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchError = Observable['catch'] = Observable.catchException = function () {
var items = [];
if (Array.isArray(arguments[0])) {
items = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { items.push(arguments[i]); }
}
return enumerableOf(items).catchError();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop();
Array.isArray(args[0]) && (args = args[0]);
return new AnonymousObservable(function (o) {
var n = args.length,
falseFactory = function () { return false; },
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
var res = resultSelector.apply(null, values);
} catch (e) {
return o.onError(e);
}
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
o.onCompleted();
}
}
function done (i) {
isDone[i] = true;
isDone.every(identity) && o.onCompleted();
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
},
function(e) { o.onError(e); },
function () { done(i); }
));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
}, this);
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
args.unshift(this);
return observableConcat.apply(null, args);
};
var ConcatObservable = (function(__super__) {
inherits(ConcatObservable, __super__);
function ConcatObservable(sources) {
this.sources = sources;
__super__.call(this);
}
ConcatObservable.prototype.subscribeCore = function(o) {
var sink = new ConcatSink(this.sources, o);
return sink.run();
};
function ConcatSink(sources, o) {
this.sources = sources;
this.o = o;
}
ConcatSink.prototype.run = function () {
var isDisposed, subscription = new SerialDisposable(), sources = this.sources, length = sources.length, o = this.o;
var cancelable = immediateScheduler.scheduleRecursiveWithState(0, function (i, self) {
if (isDisposed) { return; }
if (i === length) {
return o.onCompleted();
}
// Check if promise
var currentValue = sources[i];
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
function (x) { o.onNext(x); },
function (e) { o.onError(e); },
function () { self(i + 1); }
));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
};
return ConcatObservable;
}(ObservableBase));
/**
* Concatenates all the observable sequences.
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
args = new Array(arguments.length);
for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; }
}
return new ConcatObservable(args);
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatAll = observableProto.concatObservable = function () {
return this.merge(1);
};
var MergeObservable = (function (__super__) {
inherits(MergeObservable, __super__);
function MergeObservable(source, maxConcurrent) {
this.source = source;
this.maxConcurrent = maxConcurrent;
__super__.call(this);
}
MergeObservable.prototype.subscribeCore = function(observer) {
var g = new CompositeDisposable();
g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g)));
return g;
};
return MergeObservable;
}(ObservableBase));
var MergeObserver = (function () {
function MergeObserver(o, max, g) {
this.o = o;
this.max = max;
this.g = g;
this.done = false;
this.q = [];
this.activeCount = 0;
this.isStopped = false;
}
MergeObserver.prototype.handleSubscribe = function (xs) {
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(xs) && (xs = observableFromPromise(xs));
sad.setDisposable(xs.subscribe(new InnerObserver(this, sad)));
};
MergeObserver.prototype.onNext = function (innerSource) {
if (this.isStopped) { return; }
if(this.activeCount < this.max) {
this.activeCount++;
this.handleSubscribe(innerSource);
} else {
this.q.push(innerSource);
}
};
MergeObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.done = true;
this.activeCount === 0 && this.o.onCompleted();
}
};
MergeObserver.prototype.dispose = function() { this.isStopped = true; };
MergeObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, sad) {
this.parent = parent;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
var parent = this.parent;
parent.g.remove(this.sad);
if (parent.q.length > 0) {
parent.handleSubscribe(parent.q.shift());
} else {
parent.activeCount--;
parent.done && parent.activeCount === 0 && parent.o.onCompleted();
}
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return MergeObserver;
}());
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
return typeof maxConcurrentOrOther !== 'number' ?
observableMerge(this, maxConcurrentOrOther) :
new MergeObservable(this, maxConcurrentOrOther);
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources = [], i, len = arguments.length;
if (!arguments[0]) {
scheduler = immediateScheduler;
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
} else if (isScheduler(arguments[0])) {
scheduler = arguments[0];
for(i = 1; i < len; i++) { sources.push(arguments[i]); }
} else {
scheduler = immediateScheduler;
for(i = 0; i < len; i++) { sources.push(arguments[i]); }
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableOf(scheduler, sources).mergeAll();
};
var MergeAllObservable = (function (__super__) {
inherits(MergeAllObservable, __super__);
function MergeAllObservable(source) {
this.source = source;
__super__.call(this);
}
MergeAllObservable.prototype.subscribeCore = function (observer) {
var g = new CompositeDisposable(), m = new SingleAssignmentDisposable();
g.add(m);
m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g)));
return g;
};
function MergeAllObserver(o, g) {
this.o = o;
this.g = g;
this.isStopped = false;
this.done = false;
}
MergeAllObserver.prototype.onNext = function(innerSource) {
if(this.isStopped) { return; }
var sad = new SingleAssignmentDisposable();
this.g.add(sad);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
sad.setDisposable(innerSource.subscribe(new InnerObserver(this, this.g, sad)));
};
MergeAllObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
MergeAllObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
this.done = true;
this.g.length === 1 && this.o.onCompleted();
}
};
MergeAllObserver.prototype.dispose = function() { this.isStopped = true; };
MergeAllObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, g, sad) {
this.parent = parent;
this.g = g;
this.sad = sad;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) { if (!this.isStopped) { this.parent.o.onNext(x); } };
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
var parent = this.parent;
this.isStopped = true;
parent.g.remove(this.sad);
parent.done && parent.g.length === 1 && parent.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return MergeAllObservable;
}(ObservableBase));
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeAll = observableProto.mergeObservable = function () {
return new MergeAllObservable(this);
};
var CompositeError = Rx.CompositeError = function(errors) {
this.name = "NotImplementedError";
this.innerErrors = errors;
this.message = 'This contains multiple errors. Check the innerErrors';
Error.call(this);
}
CompositeError.prototype = Error.prototype;
/**
* Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to
* receive all successfully emitted items from all of the source Observables without being interrupted by
* an error notification from one of them.
*
* This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an
* error via the Observer's onError, mergeDelayError will refrain from propagating that
* error notification until all of the merged Observables have finished emitting items.
* @param {Array | Arguments} args Arguments or an array to merge.
* @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable
*/
Observable.mergeDelayError = function() {
var args;
if (Array.isArray(arguments[0])) {
args = arguments[0];
} else {
var len = arguments.length;
args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
}
var source = observableOf(null, args);
return new AnonymousObservable(function (o) {
var group = new CompositeDisposable(),
m = new SingleAssignmentDisposable(),
isStopped = false,
errors = [];
function setCompletion() {
if (errors.length === 0) {
o.onCompleted();
} else if (errors.length === 1) {
o.onError(errors[0]);
} else {
o.onError(new CompositeError(errors));
}
}
group.add(m);
m.setDisposable(source.subscribe(
function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check for promises support
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) { o.onNext(x); },
function (e) {
errors.push(e);
group.remove(innerSubscription);
isStopped && group.length === 1 && setCompletion();
},
function () {
group.remove(innerSubscription);
isStopped && group.length === 1 && setCompletion();
}));
},
function (e) {
errors.push(e);
isStopped = true;
group.length === 1 && setCompletion();
},
function () {
isStopped = true;
group.length === 1 && setCompletion();
}));
return group;
});
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) { throw new Error('Second observable is required'); }
return onErrorResumeNext([this, second]);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = [];
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
}
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
isPromise(current) && (current = observableFromPromise(current));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), self, self));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (o) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && o.onNext(left);
}, function (e) { o.onError(e); }, function () {
isOpen && o.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, function (e) { o.onError(e); }, function () {
rightSubscription.dispose();
}));
return disposables;
}, source);
};
var SwitchObservable = (function(__super__) {
inherits(SwitchObservable, __super__);
function SwitchObservable(source) {
this.source = source;
__super__.call(this);
}
SwitchObservable.prototype.subscribeCore = function (o) {
var inner = new SerialDisposable(), s = this.source.subscribe(new SwitchObserver(o, inner));
return new CompositeDisposable(s, inner);
};
function SwitchObserver(o, inner) {
this.o = o;
this.inner = inner;
this.stopped = false;
this.latest = 0;
this.hasLatest = false;
this.isStopped = false;
}
SwitchObserver.prototype.onNext = function (innerSource) {
if (this.isStopped) { return; }
var d = new SingleAssignmentDisposable(), id = ++this.latest;
this.hasLatest = true;
this.inner.setDisposable(d);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
d.setDisposable(innerSource.subscribe(new InnerObserver(this, id)));
};
SwitchObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
}
};
SwitchObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.stopped = true;
!this.hasLatest && this.o.onCompleted();
}
};
SwitchObserver.prototype.dispose = function () { this.isStopped = true; };
SwitchObserver.prototype.fail = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
function InnerObserver(parent, id) {
this.parent = parent;
this.id = id;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
this.parent.latest === this.id && this.parent.o.onNext(x);
};
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.parent.latest === this.id && this.parent.o.onError(e);
}
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
if (this.parent.latest === this.id) {
this.parent.hasLatest = false;
this.parent.isStopped && this.parent.o.onCompleted();
}
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
InnerObserver.prototype.fail = function (e) {
if(!this.isStopped) {
this.isStopped = true;
this.parent.o.onError(e);
return true;
}
return false;
};
return SwitchObservable;
}(ObservableBase));
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
return new SwitchObservable(this);
};
var TakeUntilObservable = (function(__super__) {
inherits(TakeUntilObservable, __super__);
function TakeUntilObservable(source, other) {
this.source = source;
this.other = isPromise(other) ? observableFromPromise(other) : other;
__super__.call(this);
}
TakeUntilObservable.prototype.subscribeCore = function(o) {
return new CompositeDisposable(
this.source.subscribe(o),
this.other.subscribe(new InnerObserver(o))
);
};
function InnerObserver(o) {
this.o = o;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
this.o.onCompleted();
};
InnerObserver.prototype.onError = function (err) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(err);
}
};
InnerObserver.prototype.onCompleted = function () {
!this.isStopped && (this.isStopped = true);
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return TakeUntilObservable;
}(ObservableBase));
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
return new TakeUntilObservable(this, other);
};
function falseFactory() { return false; }
/**
* Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.withLatestFrom = function () {
var len = arguments.length, args = new Array(len)
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var resultSelector = args.pop(), source = this;
Array.isArray(args[0]) && (args = args[0]);
return new AnonymousObservable(function (observer) {
var n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
values = new Array(n);
var subscriptions = new Array(n + 1);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var other = args[i], sad = new SingleAssignmentDisposable();
isPromise(other) && (other = observableFromPromise(other));
sad.setDisposable(other.subscribe(function (x) {
values[i] = x;
hasValue[i] = true;
hasValueAll = hasValue.every(identity);
}, function (e) { observer.onError(e); }, noop));
subscriptions[i] = sad;
}(idx));
}
var sad = new SingleAssignmentDisposable();
sad.setDisposable(source.subscribe(function (x) {
var allValues = [x].concat(values);
if (!hasValueAll) { return; }
var res = tryCatch(resultSelector).apply(null, allValues);
if (res === errorObj) { return observer.onError(res.e); }
observer.onNext(res);
}, function (e) { observer.onError(e); }, function () {
observer.onCompleted();
}));
subscriptions[n] = sad;
return new CompositeDisposable(subscriptions);
}, this);
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (o) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], res = tryCatch(resultSelector)(left, right);
if (res === errorObj) { return o.onError(res.e); }
o.onNext(res);
} else {
o.onCompleted();
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, first);
}
function falseFactory() { return false; }
function emptyArrayFactory() { return []; }
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.
* @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) { return zipArray.apply(this, arguments); }
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var parent = this, resultSelector = args.pop();
args.unshift(parent);
return new AnonymousObservable(function (o) {
var n = args.length,
queues = arrayInitialize(n, emptyArrayFactory),
isDone = arrayInitialize(n, falseFactory);
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
if (queues.every(function (x) { return x.length > 0; })) {
var queuedValues = queues.map(function (x) { return x.shift(); }),
res = tryCatch(resultSelector).apply(parent, queuedValues);
if (res === errorObj) { return o.onError(res.e); }
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
o.onCompleted();
}
}, function (e) { o.onError(e); }, function () {
isDone[i] = true;
isDone.every(identity) && o.onCompleted();
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
}, parent);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
var first = args.shift();
return first.zip.apply(first, args);
};
function falseFactory() { return false; }
function arrayFactory() { return []; }
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources;
if (Array.isArray(arguments[0])) {
sources = arguments[0];
} else {
var len = arguments.length;
sources = new Array(len);
for(var i = 0; i < len; i++) { sources[i] = arguments[i]; }
}
return new AnonymousObservable(function (o) {
var n = sources.length,
queues = arrayInitialize(n, arrayFactory),
isDone = arrayInitialize(n, falseFactory);
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
o.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
return o.onCompleted();
}
}, function (e) { o.onError(e); }, function () {
isDone[i] = true;
isDone.every(identity) && o.onCompleted();
}));
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
var source = this;
return new AnonymousObservable(function (o) { return source.subscribe(o); }, source);
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
*
* @example
* var res = xs.bufferWithCount(10);
* var res = xs.bufferWithCount(10, 1);
* @param {Number} count Length of each buffer.
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithCount = function (count, skip) {
if (typeof skip !== 'number') {
skip = count;
}
return this.windowWithCount(count, skip).selectMany(function (x) {
return x.toArray();
}).where(function (x) {
return x.length > 0;
});
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (o) {
return source.subscribe(function (x) { return x.accept(o); }, function(e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var key = value;
if (keySelector) {
key = tryCatch(keySelector)(value);
if (key === errorObj) { return o.onError(key.e); }
}
if (hasCurrentKey) {
var comparerEquals = tryCatch(comparer)(currentKey, key);
if (comparerEquals === errorObj) { return o.onError(comparerEquals.e); }
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
o.onNext(value);
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
var TapObservable = (function(__super__) {
inherits(TapObservable,__super__);
function TapObservable(source, observerOrOnNext, onError, onCompleted) {
this.source = source;
this.t = !observerOrOnNext || isFunction(observerOrOnNext) ?
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
observerOrOnNext;
__super__.call(this);
}
TapObservable.prototype.subscribeCore = function(o) {
return this.source.subscribe(new InnerObserver(o, this.t));
};
function InnerObserver(o, t) {
this.o = o;
this.t = t;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var res = tryCatch(this.t.onNext).call(this.t, x);
if (res === errorObj) { this.o.onError(res.e); }
this.o.onNext(x);
};
InnerObserver.prototype.onError = function(err) {
if (!this.isStopped) {
this.isStopped = true;
var res = tryCatch(this.t.onError).call(this.t, err);
if (res === errorObj) { return this.o.onError(res.e); }
this.o.onError(err);
}
};
InnerObserver.prototype.onCompleted = function() {
if (!this.isStopped) {
this.isStopped = true;
var res = tryCatch(this.t.onCompleted).call(this.t);
if (res === errorObj) { return this.o.onError(res.e); }
this.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return TapObservable;
}(ObservableBase));
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
return new TapObservable(this, observerOrOnNext, onError, onCompleted);
};
/**
* Invokes an action for each element in the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onNext Action to invoke for each element in the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext);
};
/**
* Invokes an action upon exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError);
};
/**
* Invokes an action upon graceful termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted);
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.ensure = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription;
try {
subscription = source.subscribe(observer);
} catch (e) {
action();
throw e;
}
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
}, this);
};
/**
* @deprecated use #finally or #ensure instead.
*/
observableProto.finallyAction = function (action) {
//deprecate('finallyAction', 'finally or ensure');
return this.ensure(action);
};
var IgnoreElementsObservable = (function(__super__) {
inherits(IgnoreElementsObservable, __super__);
function IgnoreElementsObservable(source) {
this.source = source;
__super__.call(this);
}
IgnoreElementsObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new InnerObserver(o));
};
function InnerObserver(o) {
this.o = o;
this.isStopped = false;
}
InnerObserver.prototype.onNext = noop;
InnerObserver.prototype.onError = function (err) {
if(!this.isStopped) {
this.isStopped = true;
this.o.onError(err);
}
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) {
this.isStopped = true;
this.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
return IgnoreElementsObservable;
}(ObservableBase));
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
return new IgnoreElementsObservable(this);
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
}, source);
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(2);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchError();
};
/**
* Repeats the source observable sequence upon error each time the notifier emits or until it successfully terminates.
* if the notifier completes, the observable sequence completes.
*
* @example
* var timer = Observable.timer(500);
* var source = observable.retryWhen(timer);
* @param {Observable} [notifier] An observable that triggers the retries or completes the observable with onNext or onCompleted respectively.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retryWhen = function (notifier) {
return enumerableRepeat(this).catchErrorWhen(notifier);
};
var ScanObservable = (function(__super__) {
inherits(ScanObservable, __super__);
function ScanObservable(source, accumulator, hasSeed, seed) {
this.source = source;
this.accumulator = accumulator;
this.hasSeed = hasSeed;
this.seed = seed;
__super__.call(this);
}
ScanObservable.prototype.subscribeCore = function(observer) {
return this.source.subscribe(new ScanObserver(observer,this));
};
return ScanObservable;
}(ObservableBase));
function ScanObserver(observer, parent) {
this.observer = observer;
this.accumulator = parent.accumulator;
this.hasSeed = parent.hasSeed;
this.seed = parent.seed;
this.hasAccumulation = false;
this.accumulation = null;
this.hasValue = false;
this.isStopped = false;
}
ScanObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
!this.hasValue && (this.hasValue = true);
try {
if (this.hasAccumulation) {
this.accumulation = this.accumulator(this.accumulation, x);
} else {
this.accumulation = this.hasSeed ? this.accumulator(this.seed, x) : x;
this.hasAccumulation = true;
}
} catch (e) {
return this.observer.onError(e);
}
this.observer.onNext(this.accumulation);
};
ScanObserver.prototype.onError = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
}
};
ScanObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
!this.hasValue && this.hasSeed && this.observer.onNext(this.seed);
this.observer.onCompleted();
}
};
ScanObserver.prototype.dispose = function() { this.isStopped = true; };
ScanObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.observer.onError(e);
return true;
}
return false;
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new ScanObservable(this, accumulator, hasSeed, seed);
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && o.onNext(q.shift());
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
* @example
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
* @param {Arguments} args The specified values to prepend to the observable sequence
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && isScheduler(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
for(var args = [], i = start, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
return enumerableOf([observableFromArray(args, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, function (e) { o.onError(e); }, function () {
while (q.length > 0) { o.onNext(q.shift()); }
o.onCompleted();
});
}, source);
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, function (e) { o.onError(e); }, function () {
o.onNext(q);
o.onCompleted();
});
}, source);
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* var res = xs.windowWithCount(10);
* var res = xs.windowWithCount(10, 1);
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
+count || (count = 0);
Math.abs(count) === Infinity && (count = 0);
if (count <= 0) { throw new ArgumentOutOfRangeError(); }
skip == null && (skip = count);
+skip || (skip = 0);
Math.abs(skip) === Infinity && (skip = 0);
if (skip <= 0) { throw new ArgumentOutOfRangeError(); }
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [];
function createWindow () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
createWindow();
m.setDisposable(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
var c = n - count + 1;
c >= 0 && c % skip === 0 && q.shift().onCompleted();
++n % skip === 0 && createWindow();
},
function (e) {
while (q.length > 0) { q.shift().onError(e); }
observer.onError(e);
},
function () {
while (q.length > 0) { q.shift().onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
function concatMap(source, selector, thisArg) {
var selectorFunc = bindCallback(selector, thisArg, 3);
return source.map(function (x, i) {
var result = selectorFunc(x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).concatAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
});
}
return isFunction(selector) ?
concatMap(this, selector, thisArg) :
concatMap(this, function () { return selector; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) {
var source = this,
onNextFunc = bindCallback(onNext, thisArg, 2),
onErrorFunc = bindCallback(onError, thisArg, 1),
onCompletedFunc = bindCallback(onCompleted, thisArg, 0);
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNextFunc(x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onErrorFunc(err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompletedFunc();
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}, this).concatAll();
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* var res = obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
defaultValue === undefined && (defaultValue = null);
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
},
function (e) { observer.onError(e); },
function () {
!found && observer.onNext(defaultValue);
observer.onCompleted();
});
}, source);
};
// Swap out for Array.findIndex
function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
}
function HashSet(comparer) {
this.comparer = comparer;
this.set = [];
}
HashSet.prototype.push = function(value) {
var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;
retValue && this.set.push(value);
return retValue;
};
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* var res = obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [comparer] Used to compare items in the collection.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var hashSet = new HashSet(comparer);
return source.subscribe(function (x) {
var key = x;
if (keySelector) {
try {
key = keySelector(x);
} catch (e) {
o.onError(e);
return;
}
}
hashSet.push(key) && o.onNext(x);
},
function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, this);
};
/**
* Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
*
* @example
* var res = observable.groupBy(function (x) { return x.id; });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
* @param {Function} [comparer] Used to determine whether the objects are equal.
* @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
*/
observableProto.groupBy = function (keySelector, elementSelector, comparer) {
return this.groupByUntil(keySelector, elementSelector, observableNever, comparer);
};
/**
* Groups the elements of an observable sequence according to a specified key selector function.
* A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
*
* @example
* var res = observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} durationSelector A function to signal the expiration of a group.
* @param {Function} [comparer] Used to compare objects. When not specified, the default comparer is used.
* @returns {Observable}
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
* If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
*
*/
observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector, comparer) {
var source = this;
elementSelector || (elementSelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
function handleError(e) { return function (item) { item.onError(e); }; }
var map = new Dictionary(0, comparer),
groupDisposable = new CompositeDisposable(),
refCountDisposable = new RefCountDisposable(groupDisposable);
groupDisposable.add(source.subscribe(function (x) {
var key;
try {
key = keySelector(x);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
var fireNewMapEntry = false,
writer = map.tryGetValue(key);
if (!writer) {
writer = new Subject();
map.set(key, writer);
fireNewMapEntry = true;
}
if (fireNewMapEntry) {
var group = new GroupedObservable(key, writer, refCountDisposable),
durationGroup = new GroupedObservable(key, writer);
try {
duration = durationSelector(durationGroup);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
observer.onNext(group);
var md = new SingleAssignmentDisposable();
groupDisposable.add(md);
var expire = function () {
map.remove(key) && writer.onCompleted();
groupDisposable.remove(md);
};
md.setDisposable(duration.take(1).subscribe(
noop,
function (exn) {
map.getValues().forEach(handleError(exn));
observer.onError(exn);
},
expire)
);
}
var element;
try {
element = elementSelector(x);
} catch (e) {
map.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
writer.onNext(element);
}, function (ex) {
map.getValues().forEach(handleError(ex));
observer.onError(ex);
}, function () {
map.getValues().forEach(function (item) { item.onCompleted(); });
observer.onCompleted();
}));
return refCountDisposable;
}, source);
};
var MapObservable = (function (__super__) {
inherits(MapObservable, __super__);
function MapObservable(source, selector, thisArg) {
this.source = source;
this.selector = bindCallback(selector, thisArg, 3);
__super__.call(this);
}
function innerMap(selector, self) {
return function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }
}
MapObservable.prototype.internalMap = function (selector, thisArg) {
return new MapObservable(this.source, innerMap(selector, this), thisArg);
};
MapObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new InnerObserver(o, this.selector, this));
};
function InnerObserver(o, selector, source) {
this.o = o;
this.selector = selector;
this.source = source;
this.i = 0;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var result = tryCatch(this.selector)(x, this.i++, this.source);
if (result === errorObj) {
return this.o.onError(result.e);
}
this.o.onNext(result);
};
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return MapObservable;
}(ObservableBase));
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.map = observableProto.select = function (selector, thisArg) {
var selectorFn = typeof selector === 'function' ? selector : function () { return selector; };
return this instanceof MapObservable ?
this.internalMap(selectorFn, thisArg) :
new MapObservable(this, selectorFn, thisArg);
};
/**
* Retrieves the value of a specified nested property from all elements in
* the Observable sequence.
* @param {Arguments} arguments The nested properties to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function () {
var args = arguments, len = arguments.length;
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
return this.map(function (x) {
var currentProp = x;
for (var i = 0; i < len; i++) {
var p = currentProp[args[i]];
if (typeof p !== 'undefined') {
currentProp = p;
} else {
return undefined;
}
}
return currentProp;
});
};
function flatMap(source, selector, thisArg) {
var selectorFunc = bindCallback(selector, thisArg, 3);
return source.map(function (x, i) {
var result = selectorFunc(x, i, source);
isPromise(result) && (result = observableFromPromise(result));
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
return result;
}).mergeAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
if (isFunction(selector) && isFunction(resultSelector)) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i);
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
return selectorResult.map(function (y, i2) {
return resultSelector(x, y, i, i2);
});
}, thisArg);
}
return isFunction(selector) ?
flatMap(this, selector, thisArg) :
flatMap(this, function () { return selector; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNext.call(thisArg, x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onError.call(thisArg, err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompleted.call(thisArg);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}, source).mergeAll();
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
var SkipObservable = (function(__super__) {
inherits(SkipObservable, __super__);
function SkipObservable(source, count) {
this.source = source;
this.skipCount = count;
__super__.call(this);
}
SkipObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new InnerObserver(o, this.skipCount));
};
function InnerObserver(o, c) {
this.c = c;
this.r = c;
this.o = o;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
if (this.r <= 0) {
this.o.onNext(x);
} else {
this.r--;
}
};
InnerObserver.prototype.onError = function(e) {
if (!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function() {
if (!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function(e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return SkipObservable;
}(ObservableBase));
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
return new SkipObservable(this, count);
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this,
callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !callback(x, i++, source);
} catch (e) {
o.onError(e);
return;
}
}
running && o.onNext(x);
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) { throw new ArgumentOutOfRangeError(); }
if (count === 0) { return observableEmpty(scheduler); }
var source = this;
return new AnonymousObservable(function (o) {
var remaining = count;
return source.subscribe(function (x) {
if (remaining-- > 0) {
o.onNext(x);
remaining <= 0 && o.onCompleted();
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var source = this,
callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0, running = true;
return source.subscribe(function (x) {
if (running) {
try {
running = callback(x, i++, source);
} catch (e) {
o.onError(e);
return;
}
if (running) {
o.onNext(x);
} else {
o.onCompleted();
}
}
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
}, source);
};
var FilterObservable = (function (__super__) {
inherits(FilterObservable, __super__);
function FilterObservable(source, predicate, thisArg) {
this.source = source;
this.predicate = bindCallback(predicate, thisArg, 3);
__super__.call(this);
}
FilterObservable.prototype.subscribeCore = function (o) {
return this.source.subscribe(new InnerObserver(o, this.predicate, this));
};
function innerPredicate(predicate, self) {
return function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }
}
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg);
};
function InnerObserver(o, predicate, source) {
this.o = o;
this.predicate = predicate;
this.source = source;
this.i = 0;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function(x) {
if (this.isStopped) { return; }
var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source);
if (shouldYield === errorObj) {
return this.o.onError(shouldYield.e);
}
shouldYield && this.o.onNext(x);
};
InnerObserver.prototype.onError = function (e) {
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function () {
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
};
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
InnerObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return FilterObservable;
}(ObservableBase));
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.filter = observableProto.where = function (predicate, thisArg) {
return this instanceof FilterObservable ? this.internalFilter(predicate, thisArg) :
new FilterObservable(this, predicate, thisArg);
};
function extremaBy(source, keySelector, comparer) {
return new AnonymousObservable(function (o) {
var hasValue = false, lastKey = null, list = [];
return source.subscribe(function (x) {
var comparison, key;
try {
key = keySelector(x);
} catch (ex) {
o.onError(ex);
return;
}
comparison = 0;
if (!hasValue) {
hasValue = true;
lastKey = key;
} else {
try {
comparison = comparer(key, lastKey);
} catch (ex1) {
o.onError(ex1);
return;
}
}
if (comparison > 0) {
lastKey = key;
list = [];
}
if (comparison >= 0) { list.push(x); }
}, function (e) { o.onError(e); }, function () {
o.onNext(list);
o.onCompleted();
});
}, source);
}
function firstOnly(x) {
if (x.length === 0) { throw new EmptyError(); }
return x[0];
}
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @deprecated Use #reduce instead
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.aggregate = function () {
var hasSeed = false, accumulator, seed, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (o) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
!hasValue && (hasValue = true);
try {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
return o.onError(e);
}
},
function (e) { o.onError(e); },
function () {
hasValue && o.onNext(accumulation);
!hasValue && hasSeed && o.onNext(seed);
!hasValue && !hasSeed && o.onError(new EmptyError());
o.onCompleted();
}
);
}, source);
};
var ReduceObservable = (function(__super__) {
inherits(ReduceObservable, __super__);
function ReduceObservable(source, acc, hasSeed, seed) {
this.source = source;
this.acc = acc;
this.hasSeed = hasSeed;
this.seed = seed;
__super__.call(this);
}
ReduceObservable.prototype.subscribeCore = function(observer) {
return this.source.subscribe(new InnerObserver(observer,this));
};
function InnerObserver(o, parent) {
this.o = o;
this.acc = parent.acc;
this.hasSeed = parent.hasSeed;
this.seed = parent.seed;
this.hasAccumulation = false;
this.result = null;
this.hasValue = false;
this.isStopped = false;
}
InnerObserver.prototype.onNext = function (x) {
if (this.isStopped) { return; }
!this.hasValue && (this.hasValue = true);
if (this.hasAccumulation) {
this.result = tryCatch(this.acc)(this.result, x);
} else {
this.result = this.hasSeed ? tryCatch(this.acc)(this.seed, x) : x;
this.hasAccumulation = true;
}
if (this.result === errorObj) { this.o.onError(this.result.e); }
};
InnerObserver.prototype.onError = function (e) {
if (!this.isStopped) { this.isStopped = true; this.o.onError(e); }
};
InnerObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.hasValue && this.o.onNext(this.result);
!this.hasValue && this.hasSeed && this.o.onNext(this.seed);
!this.hasValue && !this.hasSeed && this.o.onError(new EmptyError());
this.o.onCompleted();
}
};
InnerObserver.prototype.dispose = function () { this.isStopped = true; };
InnerObserver.prototype.fail = function(e) {
if (!this.isStopped) {
this.isStopped = true;
this.o.onError(e);
return true;
}
return false;
};
return ReduceObservable;
}(ObservableBase));
/**
* Applies an accumulator function over an observable sequence, returning the result of the aggregation as a single element in the result sequence. The specified seed value is used as the initial accumulator value.
* For aggregation behavior with incremental intermediate results, see Observable.scan.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @param {Any} [seed] The initial accumulator value.
* @returns {Observable} An observable sequence containing a single element with the final accumulator value.
*/
observableProto.reduce = function (accumulator) {
var hasSeed = false;
if (arguments.length === 2) {
hasSeed = true;
var seed = arguments[1];
}
return new ReduceObservable(this, accumulator, hasSeed, seed);
};
/**
* Determines whether any element of an observable sequence satisfies a condition if present, else if any items are in the sequence.
* @param {Function} [predicate] A function to test each element for a condition.
* @returns {Observable} An observable sequence containing a single element determining whether any elements in the source sequence pass the test in the specified predicate if given, else if any items are in the sequence.
*/
observableProto.some = function (predicate, thisArg) {
var source = this;
return predicate ?
source.filter(predicate, thisArg).some() :
new AnonymousObservable(function (observer) {
return source.subscribe(function () {
observer.onNext(true);
observer.onCompleted();
}, function (e) { observer.onError(e); }, function () {
observer.onNext(false);
observer.onCompleted();
});
}, source);
};
/** @deprecated use #some instead */
observableProto.any = function () {
//deprecate('any', 'some');
return this.some.apply(this, arguments);
};
/**
* Determines whether an observable sequence is empty.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence is empty.
*/
observableProto.isEmpty = function () {
return this.any().map(not);
};
/**
* Determines whether all elements of an observable sequence satisfy a condition.
* @param {Function} [predicate] A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element determining whether all elements in the source sequence pass the test in the specified predicate.
*/
observableProto.every = function (predicate, thisArg) {
return this.filter(function (v) { return !predicate(v); }, thisArg).some().map(not);
};
/** @deprecated use #every instead */
observableProto.all = function () {
//deprecate('all', 'every');
return this.every.apply(this, arguments);
};
/**
* Determines whether an observable sequence includes a specified element with an optional equality comparer.
* @param searchElement The value to locate in the source sequence.
* @param {Number} [fromIndex] An equality comparer to compare elements.
* @returns {Observable} An observable sequence containing a single element determining whether the source sequence includes an element that has the specified value from the given index.
*/
observableProto.includes = function (searchElement, fromIndex) {
var source = this;
function comparer(a, b) {
return (a === 0 && b === 0) || (a === b || (isNaN(a) && isNaN(b)));
}
return new AnonymousObservable(function (o) {
var i = 0, n = +fromIndex || 0;
Math.abs(n) === Infinity && (n = 0);
if (n < 0) {
o.onNext(false);
o.onCompleted();
return disposableEmpty;
}
return source.subscribe(
function (x) {
if (i++ >= n && comparer(x, searchElement)) {
o.onNext(true);
o.onCompleted();
}
},
function (e) { o.onError(e); },
function () {
o.onNext(false);
o.onCompleted();
});
}, this);
};
/**
* @deprecated use #includes instead.
*/
observableProto.contains = function (searchElement, fromIndex) {
//deprecate('contains', 'includes');
observableProto.includes(searchElement, fromIndex);
};
/**
* Returns an observable sequence containing a value that represents how many elements in the specified observable sequence satisfy a condition if provided, else the count of items.
* @example
* res = source.count();
* res = source.count(function (x) { return x > 3; });
* @param {Function} [predicate]A function to test each element for a condition.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with a number that represents how many elements in the input sequence satisfy the condition in the predicate function if provided, else the count of items in the sequence.
*/
observableProto.count = function (predicate, thisArg) {
return predicate ?
this.filter(predicate, thisArg).count() :
this.reduce(function (count) { return count + 1; }, 0);
};
/**
* Returns the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
* @param {Any} searchElement Element to locate in the array.
* @param {Number} [fromIndex] The index to start the search. If not specified, defaults to 0.
* @returns {Observable} And observable sequence containing the first index at which a given element can be found in the observable sequence, or -1 if it is not present.
*/
observableProto.indexOf = function(searchElement, fromIndex) {
var source = this;
return new AnonymousObservable(function (o) {
var i = 0, n = +fromIndex || 0;
Math.abs(n) === Infinity && (n = 0);
if (n < 0) {
o.onNext(-1);
o.onCompleted();
return disposableEmpty;
}
return source.subscribe(
function (x) {
if (i >= n && x === searchElement) {
o.onNext(i);
o.onCompleted();
}
i++;
},
function (e) { o.onError(e); },
function () {
o.onNext(-1);
o.onCompleted();
});
}, source);
};
/**
* Computes the sum of a sequence of values that are obtained by invoking an optional transform function on each element of the input sequence, else if not specified computes the sum on each item in the sequence.
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the sum of the values in the source sequence.
*/
observableProto.sum = function (keySelector, thisArg) {
return keySelector && isFunction(keySelector) ?
this.map(keySelector, thisArg).sum() :
this.reduce(function (prev, curr) { return prev + curr; }, 0);
};
/**
* Returns the elements in an observable sequence with the minimum key value according to the specified comparer.
* @example
* var res = source.minBy(function (x) { return x.value; });
* var res = source.minBy(function (x) { return x.value; }, function (x, y) { return x - y; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a minimum key value.
*/
observableProto.minBy = function (keySelector, comparer) {
comparer || (comparer = defaultSubComparer);
return extremaBy(this, keySelector, function (x, y) { return comparer(x, y) * -1; });
};
/**
* Returns the minimum element in an observable sequence according to the optional comparer else a default greater than less than check.
* @example
* var res = source.min();
* var res = source.min(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the minimum element in the source sequence.
*/
observableProto.min = function (comparer) {
return this.minBy(identity, comparer).map(function (x) { return firstOnly(x); });
};
/**
* Returns the elements in an observable sequence with the maximum key value according to the specified comparer.
* @example
* var res = source.maxBy(function (x) { return x.value; });
* var res = source.maxBy(function (x) { return x.value; }, function (x, y) { return x - y;; });
* @param {Function} keySelector Key selector function.
* @param {Function} [comparer] Comparer used to compare key values.
* @returns {Observable} An observable sequence containing a list of zero or more elements that have a maximum key value.
*/
observableProto.maxBy = function (keySelector, comparer) {
comparer || (comparer = defaultSubComparer);
return extremaBy(this, keySelector, comparer);
};
/**
* Returns the maximum value in an observable sequence according to the specified comparer.
* @example
* var res = source.max();
* var res = source.max(function (x, y) { return x.value - y.value; });
* @param {Function} [comparer] Comparer used to compare elements.
* @returns {Observable} An observable sequence containing a single element with the maximum element in the source sequence.
*/
observableProto.max = function (comparer) {
return this.maxBy(identity, comparer).map(function (x) { return firstOnly(x); });
};
/**
* Computes the average of an observable sequence of values that are in the sequence or obtained by invoking a transform function on each element of the input sequence if present.
* @param {Function} [selector] A transform function to apply to each element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence containing a single element with the average of the sequence of values.
*/
observableProto.average = function (keySelector, thisArg) {
return keySelector && isFunction(keySelector) ?
this.map(keySelector, thisArg).average() :
this.reduce(function (prev, cur) {
return {
sum: prev.sum + cur,
count: prev.count + 1
};
}, {sum: 0, count: 0 }).map(function (s) {
if (s.count === 0) { throw new EmptyError(); }
return s.sum / s.count;
});
};
/**
* Determines whether two sequences are equal by comparing the elements pairwise using a specified equality comparer.
*
* @example
* var res = res = source.sequenceEqual([1,2,3]);
* var res = res = source.sequenceEqual([{ value: 42 }], function (x, y) { return x.value === y.value; });
* 3 - res = source.sequenceEqual(Rx.Observable.returnValue(42));
* 4 - res = source.sequenceEqual(Rx.Observable.returnValue({ value: 42 }), function (x, y) { return x.value === y.value; });
* @param {Observable} second Second observable sequence or array to compare.
* @param {Function} [comparer] Comparer used to compare elements of both sequences.
* @returns {Observable} An observable sequence that contains a single element which indicates whether both sequences are of equal length and their corresponding elements are equal according to the specified equality comparer.
*/
observableProto.sequenceEqual = function (second, comparer) {
var first = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (o) {
var donel = false, doner = false, ql = [], qr = [];
var subscription1 = first.subscribe(function (x) {
var equal, v;
if (qr.length > 0) {
v = qr.shift();
try {
equal = comparer(v, x);
} catch (e) {
o.onError(e);
return;
}
if (!equal) {
o.onNext(false);
o.onCompleted();
}
} else if (doner) {
o.onNext(false);
o.onCompleted();
} else {
ql.push(x);
}
}, function(e) { o.onError(e); }, function () {
donel = true;
if (ql.length === 0) {
if (qr.length > 0) {
o.onNext(false);
o.onCompleted();
} else if (doner) {
o.onNext(true);
o.onCompleted();
}
}
});
(isArrayLike(second) || isIterable(second)) && (second = observableFrom(second));
isPromise(second) && (second = observableFromPromise(second));
var subscription2 = second.subscribe(function (x) {
var equal;
if (ql.length > 0) {
var v = ql.shift();
try {
equal = comparer(v, x);
} catch (exception) {
o.onError(exception);
return;
}
if (!equal) {
o.onNext(false);
o.onCompleted();
}
} else if (donel) {
o.onNext(false);
o.onCompleted();
} else {
qr.push(x);
}
}, function(e) { o.onError(e); }, function () {
doner = true;
if (qr.length === 0) {
if (ql.length > 0) {
o.onNext(false);
o.onCompleted();
} else if (donel) {
o.onNext(true);
o.onCompleted();
}
}
});
return new CompositeDisposable(subscription1, subscription2);
}, first);
};
function elementAtOrDefault(source, index, hasDefault, defaultValue) {
if (index < 0) { throw new ArgumentOutOfRangeError(); }
return new AnonymousObservable(function (o) {
var i = index;
return source.subscribe(function (x) {
if (i-- === 0) {
o.onNext(x);
o.onCompleted();
}
}, function (e) { o.onError(e); }, function () {
if (!hasDefault) {
o.onError(new ArgumentOutOfRangeError());
} else {
o.onNext(defaultValue);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the element at a specified index in a sequence.
* @example
* var res = source.elementAt(5);
* @param {Number} index The zero-based index of the element to retrieve.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence.
*/
observableProto.elementAt = function (index) {
return elementAtOrDefault(this, index, false);
};
/**
* Returns the element at a specified index in a sequence or a default value if the index is out of range.
* @example
* var res = source.elementAtOrDefault(5);
* var res = source.elementAtOrDefault(5, 0);
* @param {Number} index The zero-based index of the element to retrieve.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @returns {Observable} An observable sequence that produces the element at the specified position in the source sequence, or a default value if the index is outside the bounds of the source sequence.
*/
observableProto.elementAtOrDefault = function (index, defaultValue) {
return elementAtOrDefault(this, index, true, defaultValue);
};
function singleOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (o) {
var value = defaultValue, seenValue = false;
return source.subscribe(function (x) {
if (seenValue) {
o.onError(new Error('Sequence contains more than one element'));
} else {
value = x;
seenValue = true;
}
}, function (e) { o.onError(e); }, function () {
if (!seenValue && !hasDefault) {
o.onError(new EmptyError());
} else {
o.onNext(value);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the only element of an observable sequence that satisfies the condition in the optional predicate, and reports an exception if there is not exactly one element in the observable sequence.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate.
*/
observableProto.single = function (predicate, thisArg) {
return predicate && isFunction(predicate) ?
this.where(predicate, thisArg).single() :
singleOrDefaultAsync(this, false);
};
/**
* Returns the only element of an observable sequence that matches the predicate, or a default value if no such element exists; this method reports an exception if there is more than one element in the observable sequence.
* @example
* var res = res = source.singleOrDefault();
* var res = res = source.singleOrDefault(function (x) { return x === 42; });
* res = source.singleOrDefault(function (x) { return x === 42; }, 0);
* res = source.singleOrDefault(null, 0);
* @memberOf Observable#
* @param {Function} predicate A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if the index is outside the bounds of the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the single element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.singleOrDefault = function (predicate, defaultValue, thisArg) {
return predicate && isFunction(predicate) ?
this.filter(predicate, thisArg).singleOrDefault(null, defaultValue) :
singleOrDefaultAsync(this, true, defaultValue);
};
function firstOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (o) {
return source.subscribe(function (x) {
o.onNext(x);
o.onCompleted();
}, function (e) { o.onError(e); }, function () {
if (!hasDefault) {
o.onError(new EmptyError());
} else {
o.onNext(defaultValue);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate if present else the first item in the sequence.
* @example
* var res = res = source.first();
* var res = res = source.first(function (x) { return x > 3; });
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate if provided, else the first item in the sequence.
*/
observableProto.first = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).first() :
firstOrDefaultAsync(this, false);
};
/**
* Returns the first element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [defaultValue] The default value if no such element exists. If not specified, defaults to null.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the first element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.firstOrDefault = function (predicate, defaultValue, thisArg) {
return predicate ?
this.where(predicate).firstOrDefault(null, defaultValue) :
firstOrDefaultAsync(this, true, defaultValue);
};
function lastOrDefaultAsync(source, hasDefault, defaultValue) {
return new AnonymousObservable(function (o) {
var value = defaultValue, seenValue = false;
return source.subscribe(function (x) {
value = x;
seenValue = true;
}, function (e) { o.onError(e); }, function () {
if (!seenValue && !hasDefault) {
o.onError(new EmptyError());
} else {
o.onNext(value);
o.onCompleted();
}
});
}, source);
}
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate if specified, else the last element.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate.
*/
observableProto.last = function (predicate, thisArg) {
return predicate ?
this.where(predicate, thisArg).last() :
lastOrDefaultAsync(this, false);
};
/**
* Returns the last element of an observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
* @param {Function} [predicate] A predicate function to evaluate for elements in the source sequence.
* @param [defaultValue] The default value if no such element exists. If not specified, defaults to null.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} Sequence containing the last element in the observable sequence that satisfies the condition in the predicate, or a default value if no such element exists.
*/
observableProto.lastOrDefault = function (predicate, defaultValue, thisArg) {
return predicate ?
this.where(predicate, thisArg).lastOrDefault(null, defaultValue) :
lastOrDefaultAsync(this, true, defaultValue);
};
function findValue (source, predicate, thisArg, yieldIndex) {
var callback = bindCallback(predicate, thisArg, 3);
return new AnonymousObservable(function (o) {
var i = 0;
return source.subscribe(function (x) {
var shouldRun;
try {
shouldRun = callback(x, i, source);
} catch (e) {
o.onError(e);
return;
}
if (shouldRun) {
o.onNext(yieldIndex ? i : x);
o.onCompleted();
} else {
i++;
}
}, function (e) { o.onError(e); }, function () {
o.onNext(yieldIndex ? -1 : undefined);
o.onCompleted();
});
}, source);
}
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the first element that matches the conditions defined by the specified predicate, if found; otherwise, undefined.
*/
observableProto.find = function (predicate, thisArg) {
return findValue(this, predicate, thisArg, false);
};
/**
* Searches for an element that matches the conditions defined by the specified predicate, and returns
* an Observable sequence with the zero-based index of the first occurrence within the entire Observable sequence.
* @param {Function} predicate The predicate that defines the conditions of the element to search for.
* @param {Any} [thisArg] Object to use as `this` when executing the predicate.
* @returns {Observable} An Observable sequence with the zero-based index of the first occurrence of an element that matches the conditions defined by match, if found; otherwise, –1.
*/
observableProto.findIndex = function (predicate, thisArg) {
return findValue(this, predicate, thisArg, true);
};
/**
* Converts the observable sequence to a Set if it exists.
* @returns {Observable} An observable sequence with a single value of a Set containing the values from the observable sequence.
*/
observableProto.toSet = function () {
if (typeof root.Set === 'undefined') { throw new TypeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var s = new root.Set();
return source.subscribe(
function (x) { s.add(x); },
function (e) { o.onError(e); },
function () {
o.onNext(s);
o.onCompleted();
});
}, source);
};
/**
* Converts the observable sequence to a Map if it exists.
* @param {Function} keySelector A function which produces the key for the Map.
* @param {Function} [elementSelector] An optional function which produces the element for the Map. If not present, defaults to the value from the observable sequence.
* @returns {Observable} An observable sequence with a single value of a Map containing the values from the observable sequence.
*/
observableProto.toMap = function (keySelector, elementSelector) {
if (typeof root.Map === 'undefined') { throw new TypeError(); }
var source = this;
return new AnonymousObservable(function (o) {
var m = new root.Map();
return source.subscribe(
function (x) {
var key;
try {
key = keySelector(x);
} catch (e) {
o.onError(e);
return;
}
var element = x;
if (elementSelector) {
try {
element = elementSelector(x);
} catch (e) {
o.onError(e);
return;
}
}
m.set(key, element);
},
function (e) { o.onError(e); },
function () {
o.onNext(m);
o.onCompleted();
});
}, source);
};
var fnString = 'function',
throwString = 'throw',
isObject = Rx.internals.isObject;
function toThunk(obj, ctx) {
if (Array.isArray(obj)) { return objectToThunk.call(ctx, obj); }
if (isGeneratorFunction(obj)) { return observableSpawn(obj.call(ctx)); }
if (isGenerator(obj)) { return observableSpawn(obj); }
if (isObservable(obj)) { return observableToThunk(obj); }
if (isPromise(obj)) { return promiseToThunk(obj); }
if (typeof obj === fnString) { return obj; }
if (isObject(obj) || Array.isArray(obj)) { return objectToThunk.call(ctx, obj); }
return obj;
}
function objectToThunk(obj) {
var ctx = this;
return function (done) {
var keys = Object.keys(obj),
pending = keys.length,
results = new obj.constructor(),
finished;
if (!pending) {
timeoutScheduler.schedule(function () { done(null, results); });
return;
}
for (var i = 0, len = keys.length; i < len; i++) {
run(obj[keys[i]], keys[i]);
}
function run(fn, key) {
if (finished) { return; }
try {
fn = toThunk(fn, ctx);
if (typeof fn !== fnString) {
results[key] = fn;
return --pending || done(null, results);
}
fn.call(ctx, function(err, res) {
if (finished) { return; }
if (err) {
finished = true;
return done(err);
}
results[key] = res;
--pending || done(null, results);
});
} catch (e) {
finished = true;
done(e);
}
}
}
}
function observableToThunk(observable) {
return function (fn) {
var value, hasValue = false;
observable.subscribe(
function (v) {
value = v;
hasValue = true;
},
fn,
function () {
hasValue && fn(null, value);
});
}
}
function promiseToThunk(promise) {
return function(fn) {
promise.then(function(res) {
fn(null, res);
}, fn);
}
}
function isObservable(obj) {
return obj && typeof obj.subscribe === fnString;
}
function isGeneratorFunction(obj) {
return obj && obj.constructor && obj.constructor.name === 'GeneratorFunction';
}
function isGenerator(obj) {
return obj && typeof obj.next === fnString && typeof obj[throwString] === fnString;
}
/*
* Spawns a generator function which allows for Promises, Observable sequences, Arrays, Objects, Generators and functions.
* @param {Function} The spawning function.
* @returns {Function} a function which has a done continuation.
*/
var observableSpawn = Rx.spawn = function (fn) {
var isGenFun = isGeneratorFunction(fn);
return function (done) {
var ctx = this,
gen = fn;
if (isGenFun) {
for(var args = [], i = 0, len = arguments.length; i < len; i++) { args.push(arguments[i]); }
var len = args.length,
hasCallback = len && typeof args[len - 1] === fnString;
done = hasCallback ? args.pop() : handleError;
gen = fn.apply(this, args);
} else {
done = done || handleError;
}
next();
function exit(err, res) {
timeoutScheduler.schedule(done.bind(ctx, err, res));
}
function next(err, res) {
var ret;
// multiple args
if (arguments.length > 2) {
for(var res = [], i = 1, len = arguments.length; i < len; i++) { res.push(arguments[i]); }
}
if (err) {
try {
ret = gen[throwString](err);
} catch (e) {
return exit(e);
}
}
if (!err) {
try {
ret = gen.next(res);
} catch (e) {
return exit(e);
}
}
if (ret.done) {
return exit(null, ret.value);
}
ret.value = toThunk(ret.value, ctx);
if (typeof ret.value === fnString) {
var called = false;
try {
ret.value.call(ctx, function() {
if (called) {
return;
}
called = true;
next.apply(ctx, arguments);
});
} catch (e) {
timeoutScheduler.schedule(function () {
if (called) {
return;
}
called = true;
next.call(ctx, e);
});
}
return;
}
// Not supported
next(new TypeError('Rx.spawn only supports a function, Promise, Observable, Object or Array.'));
}
}
};
function handleError(err) {
if (!err) { return; }
timeoutScheduler.schedule(function() {
throw err;
});
}
/**
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
*
* @example
* var res = Rx.Observable.start(function () { console.log('hello'); });
* var res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);
* var res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console);
*
* @param {Function} func Function to run asynchronously.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*
* Remarks
* * The function is called immediately, not during the subscription of the resulting sequence.
* * Multiple subscriptions to the resulting sequence can observe the function's result.
*/
Observable.start = function (func, context, scheduler) {
return observableToAsync(func, context, scheduler)();
};
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
* @param {Function} function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
var observableToAsync = Observable.toAsync = function (func, context, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return function () {
var args = arguments,
subject = new AsyncSubject();
scheduler.schedule(function () {
var result;
try {
result = func.apply(context, args);
} catch (e) {
subject.onError(e);
return;
}
subject.onNext(result);
subject.onCompleted();
});
return subject.asObservable();
};
};
/**
* Converts a callback function to an observable sequence.
*
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
*/
Observable.fromCallback = function (func, context, selector) {
return function () {
var len = arguments.length, args = new Array(len)
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new AnonymousObservable(function (observer) {
function handler() {
var len = arguments.length, results = new Array(len);
for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
if (selector) {
try {
results = selector.apply(context, results);
} catch (e) {
return observer.onError(e);
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
/**
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
* @param {Function} func The function to call
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
*/
Observable.fromNodeCallback = function (func, context, selector) {
return function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return new AnonymousObservable(function (observer) {
function handler(err) {
if (err) {
observer.onError(err);
return;
}
var len = arguments.length, results = [];
for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }
if (selector) {
try {
results = selector.apply(context, results);
} catch (e) {
return observer.onError(e);
}
observer.onNext(results);
} else {
if (results.length <= 1) {
observer.onNext.apply(observer, results);
} else {
observer.onNext(results);
}
}
observer.onCompleted();
}
args.push(handler);
func.apply(context, args);
}).publishLast().refCount();
};
};
function createListener (element, name, handler) {
if (element.addEventListener) {
element.addEventListener(name, handler, false);
return disposableCreate(function () {
element.removeEventListener(name, handler, false);
});
}
throw new Error('No listener found');
}
function createEventListener (el, eventName, handler) {
var disposables = new CompositeDisposable();
// Asume NodeList or HTMLCollection
var toStr = Object.prototype.toString;
if (toStr.call(el) === '[object NodeList]' || toStr.call(el) === '[object HTMLCollection]') {
for (var i = 0, len = el.length; i < len; i++) {
disposables.add(createEventListener(el.item(i), eventName, handler));
}
} else if (el) {
disposables.add(createListener(el, eventName, handler));
}
return disposables;
}
/**
* Configuration option to determine whether to use native events only
*/
Rx.config.useNativeEvents = false;
/**
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
*
* @example
* var source = Rx.Observable.fromEvent(element, 'mouseup');
*
* @param {Object} element The DOMElement or NodeList to attach a listener.
* @param {String} eventName The event name to attach the observable sequence.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence of events from the specified element and the specified event.
*/
Observable.fromEvent = function (element, eventName, selector) {
// Node.js specific
if (element.addListener) {
return fromEventPattern(
function (h) { element.addListener(eventName, h); },
function (h) { element.removeListener(eventName, h); },
selector);
}
// Use only if non-native events are allowed
if (!Rx.config.useNativeEvents) {
// Handles jq, Angular.js, Zepto, Marionette, Ember.js
if (typeof element.on === 'function' && typeof element.off === 'function') {
return fromEventPattern(
function (h) { element.on(eventName, h); },
function (h) { element.off(eventName, h); },
selector);
}
}
return new AnonymousObservable(function (observer) {
return createEventListener(
element,
eventName,
function handler (e) {
var results = e;
if (selector) {
try {
results = selector(arguments);
} catch (err) {
return observer.onError(err);
}
}
observer.onNext(results);
});
}).publish().refCount();
};
/**
* Creates an observable sequence from an event emitter via an addHandler/removeHandler pair.
* @param {Function} addHandler The function to add a handler to the emitter.
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
* @returns {Observable} An observable sequence which wraps an event from an event emitter
*/
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
return new AnonymousObservable(function (observer) {
function innerHandler (e) {
var result = e;
if (selector) {
try {
result = selector(arguments);
} catch (err) {
return observer.onError(err);
}
}
observer.onNext(result);
}
var returnValue = addHandler(innerHandler);
return disposableCreate(function () {
if (removeHandler) {
removeHandler(innerHandler, returnValue);
}
});
}).publish().refCount();
};
/**
* Invokes the asynchronous function, surfacing the result through an observable sequence.
* @param {Function} functionAsync Asynchronous function which returns a Promise to run.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*/
Observable.startAsync = function (functionAsync) {
var promise;
try {
promise = functionAsync();
} catch (e) {
return observableThrow(e);
}
return observableFromPromise(promise);
}
var PausableObservable = (function (__super__) {
inherits(PausableObservable, __super__);
function subscribe(observer) {
var conn = this.source.publish(),
subscription = conn.subscribe(observer),
connection = disposableEmpty;
var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
if (b) {
connection = conn.connect();
} else {
connection.dispose();
connection = disposableEmpty;
}
});
return new CompositeDisposable(subscription, connection, pausable);
}
function PausableObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe, source);
}
PausableObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausable(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausable = function (pauser) {
return new PausableObservable(this, pauser);
};
function combineLatestSource(source, subject, resultSelector) {
return new AnonymousObservable(function (o) {
var hasValue = [false, false],
hasValueAll = false,
isDone = false,
values = new Array(2),
err;
function next(x, i) {
values[i] = x
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
if (err) { return o.onError(err); }
var res = tryCatch(resultSelector).apply(null, values);
if (res === errorObj) { return o.onError(res.e); }
o.onNext(res);
}
isDone && values[1] && o.onCompleted();
}
return new CompositeDisposable(
source.subscribe(
function (x) {
next(x, 0);
},
function (e) {
if (values[1]) {
o.onError(e);
} else {
err = e;
}
},
function () {
isDone = true;
values[1] && o.onCompleted();
}),
subject.subscribe(
function (x) {
next(x, 1);
},
function (e) { o.onError(e); },
function () {
isDone = true;
next(true, 1);
})
);
}, source);
}
var PausableBufferedObservable = (function (__super__) {
inherits(PausableBufferedObservable, __super__);
function subscribe(o) {
var q = [], previousShouldFire;
function drainQueue() { while (q.length > 0) { o.onNext(q.shift()); } }
var subscription =
combineLatestSource(
this.source,
this.pauser.distinctUntilChanged().startWith(false),
function (data, shouldFire) {
return { data: data, shouldFire: shouldFire };
})
.subscribe(
function (results) {
if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
previousShouldFire = results.shouldFire;
// change in shouldFire
if (results.shouldFire) { drainQueue(); }
} else {
previousShouldFire = results.shouldFire;
// new data
if (results.shouldFire) {
o.onNext(results.data);
} else {
q.push(results.data);
}
}
},
function (err) {
drainQueue();
o.onError(err);
},
function () {
drainQueue();
o.onCompleted();
}
);
return subscription;
}
function PausableBufferedObservable(source, pauser) {
this.source = source;
this.controller = new Subject();
if (pauser && pauser.subscribe) {
this.pauser = this.controller.merge(pauser);
} else {
this.pauser = this.controller;
}
__super__.call(this, subscribe, source);
}
PausableBufferedObservable.prototype.pause = function () {
this.controller.onNext(false);
};
PausableBufferedObservable.prototype.resume = function () {
this.controller.onNext(true);
};
return PausableBufferedObservable;
}(Observable));
/**
* Pauses the underlying observable sequence based upon the observable sequence which yields true/false,
* and yields the values that were buffered while paused.
* @example
* var pauser = new Rx.Subject();
* var source = Rx.Observable.interval(100).pausableBuffered(pauser);
* @param {Observable} pauser The observable sequence used to pause the underlying sequence.
* @returns {Observable} The observable sequence which is paused based upon the pauser.
*/
observableProto.pausableBuffered = function (subject) {
return new PausableBufferedObservable(this, subject);
};
var ControlledObservable = (function (__super__) {
inherits(ControlledObservable, __super__);
function subscribe (observer) {
return this.source.subscribe(observer);
}
function ControlledObservable (source, enableQueue, scheduler) {
__super__.call(this, subscribe, source);
this.subject = new ControlledSubject(enableQueue, scheduler);
this.source = source.multicast(this.subject).refCount();
}
ControlledObservable.prototype.request = function (numberOfItems) {
return this.subject.request(numberOfItems == null ? -1 : numberOfItems);
};
return ControlledObservable;
}(Observable));
var ControlledSubject = (function (__super__) {
function subscribe (observer) {
return this.subject.subscribe(observer);
}
inherits(ControlledSubject, __super__);
function ControlledSubject(enableQueue, scheduler) {
enableQueue == null && (enableQueue = true);
__super__.call(this, subscribe);
this.subject = new Subject();
this.enableQueue = enableQueue;
this.queue = enableQueue ? [] : null;
this.requestedCount = 0;
this.requestedDisposable = disposableEmpty;
this.error = null;
this.hasFailed = false;
this.hasCompleted = false;
this.scheduler = scheduler || currentThreadScheduler;
}
addProperties(ControlledSubject.prototype, Observer, {
onCompleted: function () {
this.hasCompleted = true;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onCompleted();
} else {
this.queue.push(Notification.createOnCompleted());
}
},
onError: function (error) {
this.hasFailed = true;
this.error = error;
if (!this.enableQueue || this.queue.length === 0) {
this.subject.onError(error);
} else {
this.queue.push(Notification.createOnError(error));
}
},
onNext: function (value) {
var hasRequested = false;
if (this.requestedCount === 0) {
this.enableQueue && this.queue.push(Notification.createOnNext(value));
} else {
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
hasRequested = true;
}
hasRequested && this.subject.onNext(value);
},
_processRequest: function (numberOfItems) {
if (this.enableQueue) {
while ((this.queue.length >= numberOfItems && numberOfItems > 0) ||
(this.queue.length > 0 && this.queue[0].kind !== 'N')) {
var first = this.queue.shift();
first.accept(this.subject);
if (first.kind === 'N') {
numberOfItems--;
} else {
this.disposeCurrentRequest();
this.queue = [];
}
}
return { numberOfItems : numberOfItems, returnValue: this.queue.length !== 0};
}
return { numberOfItems: numberOfItems, returnValue: false };
},
request: function (number) {
this.disposeCurrentRequest();
var self = this;
this.requestedDisposable = this.scheduler.scheduleWithState(number,
function(s, i) {
var r = self._processRequest(i), remaining = r.numberOfItems;
if (!r.returnValue) {
self.requestedCount = remaining;
self.requestedDisposable = disposableCreate(function () {
self.requestedCount = 0;
});
}
});
return this.requestedDisposable;
},
disposeCurrentRequest: function () {
this.requestedDisposable.dispose();
this.requestedDisposable = disposableEmpty;
}
});
return ControlledSubject;
}(Observable));
/**
* Attaches a controller to the observable sequence with the ability to queue.
* @example
* var source = Rx.Observable.interval(100).controlled();
* source.request(3); // Reads 3 values
* @param {bool} enableQueue truthy value to determine if values should be queued pending the next request
* @param {Scheduler} scheduler determines how the requests will be scheduled
* @returns {Observable} The observable sequence which only propagates values on request.
*/
observableProto.controlled = function (enableQueue, scheduler) {
if (enableQueue && isScheduler(enableQueue)) {
scheduler = enableQueue;
enableQueue = true;
}
if (enableQueue == null) { enableQueue = true; }
return new ControlledObservable(this, enableQueue, scheduler);
};
var StopAndWaitObservable = (function (__super__) {
function subscribe (observer) {
this.subscription = this.source.subscribe(new StopAndWaitObserver(observer, this, this.subscription));
var self = this;
timeoutScheduler.schedule(function () { self.source.request(1); });
return this.subscription;
}
inherits(StopAndWaitObservable, __super__);
function StopAndWaitObservable (source) {
__super__.call(this, subscribe, source);
this.source = source;
}
var StopAndWaitObserver = (function (__sub__) {
inherits(StopAndWaitObserver, __sub__);
function StopAndWaitObserver (observer, observable, cancel) {
__sub__.call(this);
this.observer = observer;
this.observable = observable;
this.cancel = cancel;
}
var stopAndWaitObserverProto = StopAndWaitObserver.prototype;
stopAndWaitObserverProto.completed = function () {
this.observer.onCompleted();
this.dispose();
};
stopAndWaitObserverProto.error = function (error) {
this.observer.onError(error);
this.dispose();
}
stopAndWaitObserverProto.next = function (value) {
this.observer.onNext(value);
var self = this;
timeoutScheduler.schedule(function () {
self.observable.source.request(1);
});
};
stopAndWaitObserverProto.dispose = function () {
this.observer = null;
if (this.cancel) {
this.cancel.dispose();
this.cancel = null;
}
__sub__.prototype.dispose.call(this);
};
return StopAndWaitObserver;
}(AbstractObserver));
return StopAndWaitObservable;
}(Observable));
/**
* Attaches a stop and wait observable to the current observable.
* @returns {Observable} A stop and wait observable.
*/
ControlledObservable.prototype.stopAndWait = function () {
return new StopAndWaitObservable(this);
};
var WindowedObservable = (function (__super__) {
function subscribe (observer) {
this.subscription = this.source.subscribe(new WindowedObserver(observer, this, this.subscription));
var self = this;
timeoutScheduler.schedule(function () {
self.source.request(self.windowSize);
});
return this.subscription;
}
inherits(WindowedObservable, __super__);
function WindowedObservable(source, windowSize) {
__super__.call(this, subscribe, source);
this.source = source;
this.windowSize = windowSize;
}
var WindowedObserver = (function (__sub__) {
inherits(WindowedObserver, __sub__);
function WindowedObserver(observer, observable, cancel) {
this.observer = observer;
this.observable = observable;
this.cancel = cancel;
this.received = 0;
}
var windowedObserverPrototype = WindowedObserver.prototype;
windowedObserverPrototype.completed = function () {
this.observer.onCompleted();
this.dispose();
};
windowedObserverPrototype.error = function (error) {
this.observer.onError(error);
this.dispose();
};
windowedObserverPrototype.next = function (value) {
this.observer.onNext(value);
this.received = ++this.received % this.observable.windowSize;
if (this.received === 0) {
var self = this;
timeoutScheduler.schedule(function () {
self.observable.source.request(self.observable.windowSize);
});
}
};
windowedObserverPrototype.dispose = function () {
this.observer = null;
if (this.cancel) {
this.cancel.dispose();
this.cancel = null;
}
__sub__.prototype.dispose.call(this);
};
return WindowedObserver;
}(AbstractObserver));
return WindowedObservable;
}(Observable));
/**
* Creates a sliding windowed observable based upon the window size.
* @param {Number} windowSize The number of items in the window
* @returns {Observable} A windowed observable based upon the window size.
*/
ControlledObservable.prototype.windowed = function (windowSize) {
return new WindowedObservable(this, windowSize);
};
/**
* Pipes the existing Observable sequence into a Node.js Stream.
* @param {Stream} dest The destination Node.js stream.
* @returns {Stream} The destination stream.
*/
observableProto.pipe = function (dest) {
var source = this.pausableBuffered();
function onDrain() {
source.resume();
}
dest.addListener('drain', onDrain);
source.subscribe(
function (x) {
!dest.write(String(x)) && source.pause();
},
function (err) {
dest.emit('error', err);
},
function () {
// Hack check because STDIO is not closable
!dest._isStdio && dest.end();
dest.removeListener('drain', onDrain);
});
source.resume();
return dest;
};
/**
* Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
* subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
* invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
*
* @example
* 1 - res = source.multicast(observable);
* 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
*
* @param {Function|Subject} subjectOrSubjectSelector
* Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
* Or:
* Subject to push source elements into.
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.multicast = function (subjectOrSubjectSelector, selector) {
var source = this;
return typeof subjectOrSubjectSelector === 'function' ?
new AnonymousObservable(function (observer) {
var connectable = source.multicast(subjectOrSubjectSelector());
return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
}, source) :
new ConnectableObservable(source, subjectOrSubjectSelector);
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of Multicast using a regular Subject.
*
* @example
* var resres = source.publish();
* var res = source.publish(function (x) { return x; });
*
* @param {Function} [selector] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all notifications of the source from the time of the subscription on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publish = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new Subject(); }, selector) :
this.multicast(new Subject());
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence.
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.share = function () {
return this.publish().refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence containing only the last notification.
* This operator is a specialization of Multicast using a AsyncSubject.
*
* @example
* var res = source.publishLast();
* var res = source.publishLast(function (x) { return x; });
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will only receive the last notification of the source.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishLast = function (selector) {
return selector && isFunction(selector) ?
this.multicast(function () { return new AsyncSubject(); }, selector) :
this.multicast(new AsyncSubject());
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence and starts with initialValue.
* This operator is a specialization of Multicast using a BehaviorSubject.
*
* @example
* var res = source.publishValue(42);
* var res = source.publishValue(function (x) { return x.select(function (y) { return y * y; }) }, 42);
*
* @param {Function} [selector] Optional selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive immediately receive the initial value, followed by all notifications of the source from the time of the subscription on.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.publishValue = function (initialValueOrSelector, initialValue) {
return arguments.length === 2 ?
this.multicast(function () {
return new BehaviorSubject(initialValue);
}, initialValueOrSelector) :
this.multicast(new BehaviorSubject(initialValueOrSelector));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
* @param {Mixed} initialValue Initial value received by observers upon subscription.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareValue = function (initialValue) {
return this.publishValue(initialValue).refCount();
};
/**
* Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of Multicast using a ReplaySubject.
*
* @example
* var res = source.replay(null, 3);
* var res = source.replay(null, 3, 500);
* var res = source.replay(null, 3, 500, scheduler);
* var res = source.replay(function (x) { return x.take(6).repeat(); }, 3, 500, scheduler);
*
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param windowSize [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.replay = function (selector, bufferSize, windowSize, scheduler) {
return selector && isFunction(selector) ?
this.multicast(function () { return new ReplaySubject(bufferSize, windowSize, scheduler); }, selector) :
this.multicast(new ReplaySubject(bufferSize, windowSize, scheduler));
};
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence replaying notifications subject to a maximum time length for the replay buffer.
* This operator is a specialization of replay which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
*
* @example
* var res = source.shareReplay(3);
* var res = source.shareReplay(3, 500);
* var res = source.shareReplay(3, 500, scheduler);
*
* @param bufferSize [Optional] Maximum element count of the replay buffer.
* @param window [Optional] Maximum time length of the replay buffer.
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
*/
observableProto.shareReplay = function (bufferSize, windowSize, scheduler) {
return this.replay(null, bufferSize, windowSize, scheduler).refCount();
};
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents a value that changes over time.
* Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
*/
var BehaviorSubject = Rx.BehaviorSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
observer.onNext(this.value);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(BehaviorSubject, __super__);
/**
* Initializes a new instance of the BehaviorSubject class which creates a subject that caches its last value and starts with the specified value.
* @param {Mixed} value Initial value sent to observers when no other value has been received by the subject yet.
*/
function BehaviorSubject(value) {
__super__.call(this, subscribe);
this.value = value,
this.observers = [],
this.isDisposed = false,
this.isStopped = false,
this.hasError = false;
}
addProperties(BehaviorSubject.prototype, Observer, {
/**
* Gets the current value or throws an exception.
* Value is frozen after onCompleted is called.
* After onError is called always throws the specified exception.
* An exception is always thrown after dispose is called.
* @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext.
*/
getValue: function () {
checkDisposed(this);
if (this.hasError) {
throw this.error;
}
return this.value;
},
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () { return this.observers.length > 0; },
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.hasError = true;
this.error = error;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed(this);
if (this.isStopped) { return; }
this.value = value;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onNext(value);
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.value = null;
this.exception = null;
}
});
return BehaviorSubject;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.
*/
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
var maxSafeInteger = Math.pow(2, 53) - 1;
function createRemovableDisposable(subject, observer) {
return disposableCreate(function () {
observer.dispose();
!subject.isDisposed && subject.observers.splice(subject.observers.indexOf(observer), 1);
});
}
function subscribe(observer) {
var so = new ScheduledObserver(this.scheduler, observer),
subscription = createRemovableDisposable(this, so);
checkDisposed(this);
this._trim(this.scheduler.now());
this.observers.push(so);
for (var i = 0, len = this.q.length; i < len; i++) {
so.onNext(this.q[i].value);
}
if (this.hasError) {
so.onError(this.error);
} else if (this.isStopped) {
so.onCompleted();
}
so.ensureActive();
return subscription;
}
inherits(ReplaySubject, __super__);
/**
* Initializes a new instance of the ReplaySubject class with the specified buffer size, window size and scheduler.
* @param {Number} [bufferSize] Maximum element count of the replay buffer.
* @param {Number} [windowSize] Maximum time length of the replay buffer.
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
*/
function ReplaySubject(bufferSize, windowSize, scheduler) {
this.bufferSize = bufferSize == null ? maxSafeInteger : bufferSize;
this.windowSize = windowSize == null ? maxSafeInteger : windowSize;
this.scheduler = scheduler || currentThreadScheduler;
this.q = [];
this.observers = [];
this.isStopped = false;
this.isDisposed = false;
this.hasError = false;
this.error = null;
__super__.call(this, subscribe);
}
addProperties(ReplaySubject.prototype, Observer.prototype, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
_trim: function (now) {
while (this.q.length > this.bufferSize) {
this.q.shift();
}
while (this.q.length > 0 && (now - this.q[0].interval) > this.windowSize) {
this.q.shift();
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed(this);
if (this.isStopped) { return; }
var now = this.scheduler.now();
this.q.push({ interval: now, value: value });
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onNext(value);
observer.ensureActive();
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
this.error = error;
this.hasError = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onError(error);
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (this.isStopped) { return; }
this.isStopped = true;
var now = this.scheduler.now();
this._trim(now);
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
var observer = os[i];
observer.onCompleted();
observer.ensureActive();
}
this.observers.length = 0;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
return ReplaySubject;
}(Observable));
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
inherits(ConnectableObservable, __super__);
function ConnectableObservable(source, subject) {
var hasSubscription = false,
subscription,
sourceObservable = source.asObservable();
this.connect = function () {
if (!hasSubscription) {
hasSubscription = true;
subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
hasSubscription = false;
}));
}
return subscription;
};
__super__.call(this, function (o) { return subject.subscribe(o); });
}
ConnectableObservable.prototype.refCount = function () {
var connectableSubscription, count = 0, source = this;
return new AnonymousObservable(function (observer) {
var shouldConnect = ++count === 1,
subscription = source.subscribe(observer);
shouldConnect && (connectableSubscription = source.connect());
return function () {
subscription.dispose();
--count === 0 && connectableSubscription.dispose();
};
});
};
return ConnectableObservable;
}(Observable));
/**
* Returns an observable sequence that shares a single subscription to the underlying sequence. This observable sequence
* can be resubscribed to, even if all prior subscriptions have ended. (unlike `.publish().refCount()`)
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source.
*/
observableProto.singleInstance = function() {
var source = this, hasObservable = false, observable;
function getObservable() {
if (!hasObservable) {
hasObservable = true;
observable = source.finally(function() { hasObservable = false; }).publish().refCount();
}
return observable;
};
return new AnonymousObservable(function(o) {
return getObservable().subscribe(o);
});
};
var Dictionary = (function () {
var primes = [1, 3, 7, 13, 31, 61, 127, 251, 509, 1021, 2039, 4093, 8191, 16381, 32749, 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593, 16777213, 33554393, 67108859, 134217689, 268435399, 536870909, 1073741789, 2147483647],
noSuchkey = "no such key",
duplicatekey = "duplicate key";
function isPrime(candidate) {
if ((candidate & 1) === 0) { return candidate === 2; }
var num1 = Math.sqrt(candidate),
num2 = 3;
while (num2 <= num1) {
if (candidate % num2 === 0) { return false; }
num2 += 2;
}
return true;
}
function getPrime(min) {
var index, num, candidate;
for (index = 0; index < primes.length; ++index) {
num = primes[index];
if (num >= min) { return num; }
}
candidate = min | 1;
while (candidate < primes[primes.length - 1]) {
if (isPrime(candidate)) { return candidate; }
candidate += 2;
}
return min;
}
function stringHashFn(str) {
var hash = 757602046;
if (!str.length) { return hash; }
for (var i = 0, len = str.length; i < len; i++) {
var character = str.charCodeAt(i);
hash = ((hash << 5) - hash) + character;
hash = hash & hash;
}
return hash;
}
function numberHashFn(key) {
var c2 = 0x27d4eb2d;
key = (key ^ 61) ^ (key >>> 16);
key = key + (key << 3);
key = key ^ (key >>> 4);
key = key * c2;
key = key ^ (key >>> 15);
return key;
}
var getHashCode = (function () {
var uniqueIdCounter = 0;
return function (obj) {
if (obj == null) { throw new Error(noSuchkey); }
// Check for built-ins before tacking on our own for any object
if (typeof obj === 'string') { return stringHashFn(obj); }
if (typeof obj === 'number') { return numberHashFn(obj); }
if (typeof obj === 'boolean') { return obj === true ? 1 : 0; }
if (obj instanceof Date) { return numberHashFn(obj.valueOf()); }
if (obj instanceof RegExp) { return stringHashFn(obj.toString()); }
if (typeof obj.valueOf === 'function') {
// Hack check for valueOf
var valueOf = obj.valueOf();
if (typeof valueOf === 'number') { return numberHashFn(valueOf); }
if (typeof valueOf === 'string') { return stringHashFn(valueOf); }
}
if (obj.hashCode) { return obj.hashCode(); }
var id = 17 * uniqueIdCounter++;
obj.hashCode = function () { return id; };
return id;
};
}());
function newEntry() {
return { key: null, value: null, next: 0, hashCode: 0 };
}
function Dictionary(capacity, comparer) {
if (capacity < 0) { throw new ArgumentOutOfRangeError(); }
if (capacity > 0) { this._initialize(capacity); }
this.comparer = comparer || defaultComparer;
this.freeCount = 0;
this.size = 0;
this.freeList = -1;
}
var dictionaryProto = Dictionary.prototype;
dictionaryProto._initialize = function (capacity) {
var prime = getPrime(capacity), i;
this.buckets = new Array(prime);
this.entries = new Array(prime);
for (i = 0; i < prime; i++) {
this.buckets[i] = -1;
this.entries[i] = newEntry();
}
this.freeList = -1;
};
dictionaryProto.add = function (key, value) {
this._insert(key, value, true);
};
dictionaryProto._insert = function (key, value, add) {
if (!this.buckets) { this._initialize(0); }
var index3,
num = getHashCode(key) & 2147483647,
index1 = num % this.buckets.length;
for (var index2 = this.buckets[index1]; index2 >= 0; index2 = this.entries[index2].next) {
if (this.entries[index2].hashCode === num && this.comparer(this.entries[index2].key, key)) {
if (add) { throw new Error(duplicatekey); }
this.entries[index2].value = value;
return;
}
}
if (this.freeCount > 0) {
index3 = this.freeList;
this.freeList = this.entries[index3].next;
--this.freeCount;
} else {
if (this.size === this.entries.length) {
this._resize();
index1 = num % this.buckets.length;
}
index3 = this.size;
++this.size;
}
this.entries[index3].hashCode = num;
this.entries[index3].next = this.buckets[index1];
this.entries[index3].key = key;
this.entries[index3].value = value;
this.buckets[index1] = index3;
};
dictionaryProto._resize = function () {
var prime = getPrime(this.size * 2),
numArray = new Array(prime);
for (index = 0; index < numArray.length; ++index) { numArray[index] = -1; }
var entryArray = new Array(prime);
for (index = 0; index < this.size; ++index) { entryArray[index] = this.entries[index]; }
for (var index = this.size; index < prime; ++index) { entryArray[index] = newEntry(); }
for (var index1 = 0; index1 < this.size; ++index1) {
var index2 = entryArray[index1].hashCode % prime;
entryArray[index1].next = numArray[index2];
numArray[index2] = index1;
}
this.buckets = numArray;
this.entries = entryArray;
};
dictionaryProto.remove = function (key) {
if (this.buckets) {
var num = getHashCode(key) & 2147483647,
index1 = num % this.buckets.length,
index2 = -1;
for (var index3 = this.buckets[index1]; index3 >= 0; index3 = this.entries[index3].next) {
if (this.entries[index3].hashCode === num && this.comparer(this.entries[index3].key, key)) {
if (index2 < 0) {
this.buckets[index1] = this.entries[index3].next;
} else {
this.entries[index2].next = this.entries[index3].next;
}
this.entries[index3].hashCode = -1;
this.entries[index3].next = this.freeList;
this.entries[index3].key = null;
this.entries[index3].value = null;
this.freeList = index3;
++this.freeCount;
return true;
} else {
index2 = index3;
}
}
}
return false;
};
dictionaryProto.clear = function () {
var index, len;
if (this.size <= 0) { return; }
for (index = 0, len = this.buckets.length; index < len; ++index) {
this.buckets[index] = -1;
}
for (index = 0; index < this.size; ++index) {
this.entries[index] = newEntry();
}
this.freeList = -1;
this.size = 0;
};
dictionaryProto._findEntry = function (key) {
if (this.buckets) {
var num = getHashCode(key) & 2147483647;
for (var index = this.buckets[num % this.buckets.length]; index >= 0; index = this.entries[index].next) {
if (this.entries[index].hashCode === num && this.comparer(this.entries[index].key, key)) {
return index;
}
}
}
return -1;
};
dictionaryProto.count = function () {
return this.size - this.freeCount;
};
dictionaryProto.tryGetValue = function (key) {
var entry = this._findEntry(key);
return entry >= 0 ?
this.entries[entry].value :
undefined;
};
dictionaryProto.getValues = function () {
var index = 0, results = [];
if (this.entries) {
for (var index1 = 0; index1 < this.size; index1++) {
if (this.entries[index1].hashCode >= 0) {
results[index++] = this.entries[index1].value;
}
}
}
return results;
};
dictionaryProto.get = function (key) {
var entry = this._findEntry(key);
if (entry >= 0) { return this.entries[entry].value; }
throw new Error(noSuchkey);
};
dictionaryProto.set = function (key, value) {
this._insert(key, value, false);
};
dictionaryProto.containskey = function (key) {
return this._findEntry(key) >= 0;
};
return Dictionary;
}());
/**
* Correlates the elements of two sequences based on overlapping durations.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any two overlapping elements of the left and right observable sequences. The parameters passed to the function correspond with the elements from the left and right source sequences for which overlap occurs.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.join = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var leftDone = false, rightDone = false;
var leftId = 0, rightId = 0;
var leftMap = new Dictionary(), rightMap = new Dictionary();
group.add(left.subscribe(
function (value) {
var id = leftId++;
var md = new SingleAssignmentDisposable();
leftMap.add(id, value);
group.add(md);
var expire = function () {
leftMap.remove(id) && leftMap.count() === 0 && leftDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
rightMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(value, v);
} catch (exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
leftDone = true;
(rightDone || leftMap.count() === 0) && observer.onCompleted();
})
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
var md = new SingleAssignmentDisposable();
rightMap.add(id, value);
group.add(md);
var expire = function () {
rightMap.remove(id) && rightMap.count() === 0 && rightDone && observer.onCompleted();
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(noop, observer.onError.bind(observer), expire));
leftMap.getValues().forEach(function (v) {
var result;
try {
result = resultSelector(v, value);
} catch (exn) {
observer.onError(exn);
return;
}
observer.onNext(result);
});
},
observer.onError.bind(observer),
function () {
rightDone = true;
(leftDone || rightMap.count() === 0) && observer.onCompleted();
})
);
return group;
}, left);
};
/**
* Correlates the elements of two sequences based on overlapping durations, and groups the results.
*
* @param {Observable} right The right observable sequence to join elements for.
* @param {Function} leftDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the left observable sequence, used to determine overlap.
* @param {Function} rightDurationSelector A function to select the duration (expressed as an observable sequence) of each element of the right observable sequence, used to determine overlap.
* @param {Function} resultSelector A function invoked to compute a result element for any element of the left sequence with overlapping elements from the right observable sequence. The first parameter passed to the function is an element of the left sequence. The second parameter passed to the function is an observable sequence with elements from the right sequence that overlap with the left sequence's element.
* @returns {Observable} An observable sequence that contains result elements computed from source elements that have an overlapping duration.
*/
observableProto.groupJoin = function (right, leftDurationSelector, rightDurationSelector, resultSelector) {
var left = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable();
var r = new RefCountDisposable(group);
var leftMap = new Dictionary(), rightMap = new Dictionary();
var leftId = 0, rightId = 0;
function handleError(e) { return function (v) { v.onError(e); }; };
group.add(left.subscribe(
function (value) {
var s = new Subject();
var id = leftId++;
leftMap.add(id, s);
var result;
try {
result = resultSelector(value, addRef(s, r));
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
observer.onNext(result);
rightMap.getValues().forEach(function (v) { s.onNext(v); });
var md = new SingleAssignmentDisposable();
group.add(md);
var expire = function () {
leftMap.remove(id) && s.onCompleted();
group.remove(md);
};
var duration;
try {
duration = leftDurationSelector(value);
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(
noop,
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
expire)
);
},
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
observer.onCompleted.bind(observer))
);
group.add(right.subscribe(
function (value) {
var id = rightId++;
rightMap.add(id, value);
var md = new SingleAssignmentDisposable();
group.add(md);
var expire = function () {
rightMap.remove(id);
group.remove(md);
};
var duration;
try {
duration = rightDurationSelector(value);
} catch (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
return;
}
md.setDisposable(duration.take(1).subscribe(
noop,
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
},
expire)
);
leftMap.getValues().forEach(function (v) { v.onNext(value); });
},
function (e) {
leftMap.getValues().forEach(handleError(e));
observer.onError(e);
})
);
return r;
}, left);
};
/**
* Projects each element of an observable sequence into zero or more buffers.
*
* @param {Mixed} bufferOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [bufferClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.buffer = function (bufferOpeningsOrClosingSelector, bufferClosingSelector) {
return this.window.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
};
/**
* Projects each element of an observable sequence into zero or more windows.
*
* @param {Mixed} windowOpeningsOrClosingSelector Observable sequence whose elements denote the creation of new windows, or, a function invoked to define the boundaries of the produced windows (a new window is started when the previous one is closed, resulting in non-overlapping windows).
* @param {Function} [windowClosingSelector] A function invoked to define the closing of each produced window. If a closing selector function is specified for the first parameter, this parameter is ignored.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.window = function (windowOpeningsOrClosingSelector, windowClosingSelector) {
if (arguments.length === 1 && typeof arguments[0] !== 'function') {
return observableWindowWithBoundaries.call(this, windowOpeningsOrClosingSelector);
}
return typeof windowOpeningsOrClosingSelector === 'function' ?
observableWindowWithClosingSelector.call(this, windowOpeningsOrClosingSelector) :
observableWindowWithOpenings.call(this, windowOpeningsOrClosingSelector, windowClosingSelector);
};
function observableWindowWithOpenings(windowOpenings, windowClosingSelector) {
return windowOpenings.groupJoin(this, windowClosingSelector, observableEmpty, function (_, win) {
return win;
});
}
function observableWindowWithBoundaries(windowBoundaries) {
var source = this;
return new AnonymousObservable(function (observer) {
var win = new Subject(),
d = new CompositeDisposable(),
r = new RefCountDisposable(d);
observer.onNext(addRef(win, r));
d.add(source.subscribe(function (x) {
win.onNext(x);
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
isPromise(windowBoundaries) && (windowBoundaries = observableFromPromise(windowBoundaries));
d.add(windowBoundaries.subscribe(function (w) {
win.onCompleted();
win = new Subject();
observer.onNext(addRef(win, r));
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
return r;
}, source);
}
function observableWindowWithClosingSelector(windowClosingSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SerialDisposable(),
d = new CompositeDisposable(m),
r = new RefCountDisposable(d),
win = new Subject();
observer.onNext(addRef(win, r));
d.add(source.subscribe(function (x) {
win.onNext(x);
}, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
observer.onCompleted();
}));
function createWindowClose () {
var windowClose;
try {
windowClose = windowClosingSelector();
} catch (e) {
observer.onError(e);
return;
}
isPromise(windowClose) && (windowClose = observableFromPromise(windowClose));
var m1 = new SingleAssignmentDisposable();
m.setDisposable(m1);
m1.setDisposable(windowClose.take(1).subscribe(noop, function (err) {
win.onError(err);
observer.onError(err);
}, function () {
win.onCompleted();
win = new Subject();
observer.onNext(addRef(win, r));
createWindowClose();
}));
}
createWindowClose();
return r;
}, source);
}
/**
* Returns a new observable that triggers on the second and subsequent triggerings of the input observable.
* The Nth triggering of the input observable passes the arguments from the N-1th and Nth triggering as a pair.
* The argument passed to the N-1th triggering is held in hidden internal state until the Nth triggering occurs.
* @returns {Observable} An observable that triggers on successive pairs of observations from the input observable as an array.
*/
observableProto.pairwise = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var previous, hasPrevious = false;
return source.subscribe(
function (x) {
if (hasPrevious) {
observer.onNext([previous, x]);
} else {
hasPrevious = true;
}
previous = x;
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer));
}, source);
};
/**
* Returns two observables which partition the observations of the source by the given function.
* The first will trigger observations for those values for which the predicate returns true.
* The second will trigger observations for those values where the predicate returns false.
* The predicate is executed once for each subscribed observer.
* Both also propagate all error observations arising from the source and each completes
* when the source completes.
* @param {Function} predicate
* The function to determine which output Observable will trigger a particular observation.
* @returns {Array}
* An array of observables. The first triggers when the predicate returns true,
* and the second triggers when the predicate returns false.
*/
observableProto.partition = function(predicate, thisArg) {
return [
this.filter(predicate, thisArg),
this.filter(function (x, i, o) { return !predicate.call(thisArg, x, i, o); })
];
};
var WhileEnumerable = (function(__super__) {
inherits(WhileEnumerable, __super__);
function WhileEnumerable(c, s) {
this.c = c;
this.s = s;
}
WhileEnumerable.prototype[$iterator$] = function () {
var self = this;
return {
next: function () {
return self.c() ?
{ done: false, value: self.s } :
{ done: true, value: void 0 };
}
};
};
return WhileEnumerable;
}(Enumerable));
function enumerableWhile(condition, source) {
return new WhileEnumerable(condition, source);
}
/**
* Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
* This operator allows for a fluent style of writing queries that use the same sequence multiple times.
*
* @param {Function} selector Selector function which can use the source sequence as many times as needed, without sharing subscriptions to the source sequence.
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
*/
observableProto.letBind = observableProto['let'] = function (func) {
return func(this);
};
/**
* Determines whether an observable collection contains values. There is an alias for this method called 'ifThen' for browsers <IE9
*
* @example
* 1 - res = Rx.Observable.if(condition, obs1);
* 2 - res = Rx.Observable.if(condition, obs1, obs2);
* 3 - res = Rx.Observable.if(condition, obs1, scheduler);
* @param {Function} condition The condition which determines if the thenSource or elseSource will be run.
* @param {Observable} thenSource The observable sequence or Promise that will be run if the condition function returns true.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the condition function returns false. If this is not provided, it defaults to Rx.Observabe.Empty with the specified scheduler.
* @returns {Observable} An observable sequence which is either the thenSource or elseSource.
*/
Observable['if'] = Observable.ifThen = function (condition, thenSource, elseSourceOrScheduler) {
return observableDefer(function () {
elseSourceOrScheduler || (elseSourceOrScheduler = observableEmpty());
isPromise(thenSource) && (thenSource = observableFromPromise(thenSource));
isPromise(elseSourceOrScheduler) && (elseSourceOrScheduler = observableFromPromise(elseSourceOrScheduler));
// Assume a scheduler for empty only
typeof elseSourceOrScheduler.now === 'function' && (elseSourceOrScheduler = observableEmpty(elseSourceOrScheduler));
return condition() ? thenSource : elseSourceOrScheduler;
});
};
/**
* Concatenates the observable sequences obtained by running the specified result selector for each element in source.
* There is an alias for this method called 'forIn' for browsers <IE9
* @param {Array} sources An array of values to turn into an observable sequence.
* @param {Function} resultSelector A function to apply to each item in the sources array to turn it into an observable sequence.
* @returns {Observable} An observable sequence from the concatenated observable sequences.
*/
Observable['for'] = Observable.forIn = function (sources, resultSelector, thisArg) {
return enumerableOf(sources, resultSelector, thisArg).concat();
};
/**
* Repeats source as long as condition holds emulating a while loop.
* There is an alias for this method called 'whileDo' for browsers <IE9
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
var observableWhileDo = Observable['while'] = Observable.whileDo = function (condition, source) {
isPromise(source) && (source = observableFromPromise(source));
return enumerableWhile(condition, source).concat();
};
/**
* Repeats source as long as condition holds emulating a do while loop.
*
* @param {Function} condition The condition which determines if the source will be repeated.
* @param {Observable} source The observable sequence that will be run if the condition function returns true.
* @returns {Observable} An observable sequence which is repeated as long as the condition holds.
*/
observableProto.doWhile = function (condition) {
return observableConcat([this, observableWhileDo(condition, this)]);
};
/**
* Uses selector to determine which source in sources to use.
* There is an alias 'switchCase' for browsers <IE9.
*
* @example
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 });
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, obs0);
* 1 - res = Rx.Observable.case(selector, { '1': obs1, '2': obs2 }, scheduler);
*
* @param {Function} selector The function which extracts the value for to test in a case statement.
* @param {Array} sources A object which has keys which correspond to the case statement labels.
* @param {Observable} [elseSource] The observable sequence or Promise that will be run if the sources are not matched. If this is not provided, it defaults to Rx.Observabe.empty with the specified scheduler.
*
* @returns {Observable} An observable sequence which is determined by a case statement.
*/
Observable['case'] = Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {
return observableDefer(function () {
isPromise(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableFromPromise(defaultSourceOrScheduler));
defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty());
typeof defaultSourceOrScheduler.now === 'function' && (defaultSourceOrScheduler = observableEmpty(defaultSourceOrScheduler));
var result = sources[selector()];
isPromise(result) && (result = observableFromPromise(result));
return result || defaultSourceOrScheduler;
});
};
/**
* Expands an observable sequence by recursively invoking selector.
*
* @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
* @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
* @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.
*/
observableProto.expand = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var q = [],
m = new SerialDisposable(),
d = new CompositeDisposable(m),
activeCount = 0,
isAcquired = false;
var ensureActive = function () {
var isOwner = false;
if (q.length > 0) {
isOwner = !isAcquired;
isAcquired = true;
}
if (isOwner) {
m.setDisposable(scheduler.scheduleRecursive(function (self) {
var work;
if (q.length > 0) {
work = q.shift();
} else {
isAcquired = false;
return;
}
var m1 = new SingleAssignmentDisposable();
d.add(m1);
m1.setDisposable(work.subscribe(function (x) {
observer.onNext(x);
var result = null;
try {
result = selector(x);
} catch (e) {
observer.onError(e);
}
q.push(result);
activeCount++;
ensureActive();
}, observer.onError.bind(observer), function () {
d.remove(m1);
activeCount--;
if (activeCount === 0) {
observer.onCompleted();
}
}));
self();
}));
}
};
q.push(source);
activeCount++;
ensureActive();
return d;
}, this);
};
/**
* Runs all observable sequences in parallel and collect their last elements.
*
* @example
* 1 - res = Rx.Observable.forkJoin([obs1, obs2]);
* 1 - res = Rx.Observable.forkJoin(obs1, obs2, ...);
* @returns {Observable} An observable sequence with an array collecting the last elements of all the input sequences.
*/
Observable.forkJoin = function () {
var allSources = [];
if (Array.isArray(arguments[0])) {
allSources = arguments[0];
} else {
for(var i = 0, len = arguments.length; i < len; i++) { allSources.push(arguments[i]); }
}
return new AnonymousObservable(function (subscriber) {
var count = allSources.length;
if (count === 0) {
subscriber.onCompleted();
return disposableEmpty;
}
var group = new CompositeDisposable(),
finished = false,
hasResults = new Array(count),
hasCompleted = new Array(count),
results = new Array(count);
for (var idx = 0; idx < count; idx++) {
(function (i) {
var source = allSources[i];
isPromise(source) && (source = observableFromPromise(source));
group.add(
source.subscribe(
function (value) {
if (!finished) {
hasResults[i] = true;
results[i] = value;
}
},
function (e) {
finished = true;
subscriber.onError(e);
group.dispose();
},
function () {
if (!finished) {
if (!hasResults[i]) {
subscriber.onCompleted();
return;
}
hasCompleted[i] = true;
for (var ix = 0; ix < count; ix++) {
if (!hasCompleted[ix]) { return; }
}
finished = true;
subscriber.onNext(results);
subscriber.onCompleted();
}
}));
})(idx);
}
return group;
});
};
/**
* Runs two observable sequences in parallel and combines their last elemenets.
*
* @param {Observable} second Second observable sequence.
* @param {Function} resultSelector Result selector function to invoke with the last elements of both sequences.
* @returns {Observable} An observable sequence with the result of calling the selector function with the last elements of both input sequences.
*/
observableProto.forkJoin = function (second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var leftStopped = false, rightStopped = false,
hasLeft = false, hasRight = false,
lastLeft, lastRight,
leftSubscription = new SingleAssignmentDisposable(), rightSubscription = new SingleAssignmentDisposable();
isPromise(second) && (second = observableFromPromise(second));
leftSubscription.setDisposable(
first.subscribe(function (left) {
hasLeft = true;
lastLeft = left;
}, function (err) {
rightSubscription.dispose();
observer.onError(err);
}, function () {
leftStopped = true;
if (rightStopped) {
if (!hasLeft) {
observer.onCompleted();
} else if (!hasRight) {
observer.onCompleted();
} else {
var result;
try {
result = resultSelector(lastLeft, lastRight);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
observer.onCompleted();
}
}
})
);
rightSubscription.setDisposable(
second.subscribe(function (right) {
hasRight = true;
lastRight = right;
}, function (err) {
leftSubscription.dispose();
observer.onError(err);
}, function () {
rightStopped = true;
if (leftStopped) {
if (!hasLeft) {
observer.onCompleted();
} else if (!hasRight) {
observer.onCompleted();
} else {
var result;
try {
result = resultSelector(lastLeft, lastRight);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
observer.onCompleted();
}
}
})
);
return new CompositeDisposable(leftSubscription, rightSubscription);
}, first);
};
/**
* Comonadic bind operator.
* @param {Function} selector A transform function to apply to each element.
* @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
* @returns {Observable} An observable sequence which results from the comonadic bind operation.
*/
observableProto.manySelect = observableProto.extend = function (selector, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
var source = this;
return observableDefer(function () {
var chain;
return source
.map(function (x) {
var curr = new ChainObservable(x);
chain && chain.onNext(x);
chain = curr;
return curr;
})
.tap(
noop,
function (e) { chain && chain.onError(e); },
function () { chain && chain.onCompleted(); }
)
.observeOn(scheduler)
.map(selector);
}, source);
};
var ChainObservable = (function (__super__) {
function subscribe (observer) {
var self = this, g = new CompositeDisposable();
g.add(currentThreadScheduler.schedule(function () {
observer.onNext(self.head);
g.add(self.tail.mergeAll().subscribe(observer));
}));
return g;
}
inherits(ChainObservable, __super__);
function ChainObservable(head) {
__super__.call(this, subscribe);
this.head = head;
this.tail = new AsyncSubject();
}
addProperties(ChainObservable.prototype, Observer, {
onCompleted: function () {
this.onNext(Observable.empty());
},
onError: function (e) {
this.onNext(Observable.throwError(e));
},
onNext: function (v) {
this.tail.onNext(v);
this.tail.onCompleted();
}
});
return ChainObservable;
}(Observable));
/** @private */
var Map = root.Map || (function () {
function Map() {
this._keys = [];
this._values = [];
}
Map.prototype.get = function (key) {
var i = this._keys.indexOf(key);
return i !== -1 ? this._values[i] : undefined;
};
Map.prototype.set = function (key, value) {
var i = this._keys.indexOf(key);
i !== -1 && (this._values[i] = value);
this._values[this._keys.push(key) - 1] = value;
};
Map.prototype.forEach = function (callback, thisArg) {
for (var i = 0, len = this._keys.length; i < len; i++) {
callback.call(thisArg, this._values[i], this._keys[i]);
}
};
return Map;
}());
/**
* @constructor
* Represents a join pattern over observable sequences.
*/
function Pattern(patterns) {
this.patterns = patterns;
}
/**
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
* @param other Observable sequence to match in addition to the current pattern.
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
*/
Pattern.prototype.and = function (other) {
return new Pattern(this.patterns.concat(other));
};
/**
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
Pattern.prototype.thenDo = function (selector) {
return new Plan(this, selector);
};
function Plan(expression, selector) {
this.expression = expression;
this.selector = selector;
}
Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {
var self = this;
var joinObservers = [];
for (var i = 0, len = this.expression.patterns.length; i < len; i++) {
joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer)));
}
var activePlan = new ActivePlan(joinObservers, function () {
var result;
try {
result = self.selector.apply(self, arguments);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
}, function () {
for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {
joinObservers[j].removeActivePlan(activePlan);
}
deactivate(activePlan);
});
for (i = 0, len = joinObservers.length; i < len; i++) {
joinObservers[i].addActivePlan(activePlan);
}
return activePlan;
};
function planCreateObserver(externalSubscriptions, observable, onError) {
var entry = externalSubscriptions.get(observable);
if (!entry) {
var observer = new JoinObserver(observable, onError);
externalSubscriptions.set(observable, observer);
return observer;
}
return entry;
}
function ActivePlan(joinObserverArray, onNext, onCompleted) {
this.joinObserverArray = joinObserverArray;
this.onNext = onNext;
this.onCompleted = onCompleted;
this.joinObservers = new Map();
for (var i = 0, len = this.joinObserverArray.length; i < len; i++) {
var joinObserver = this.joinObserverArray[i];
this.joinObservers.set(joinObserver, joinObserver);
}
}
ActivePlan.prototype.dequeue = function () {
this.joinObservers.forEach(function (v) { v.queue.shift(); });
};
ActivePlan.prototype.match = function () {
var i, len, hasValues = true;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
if (this.joinObserverArray[i].queue.length === 0) {
hasValues = false;
break;
}
}
if (hasValues) {
var firstValues = [],
isCompleted = false;
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
firstValues.push(this.joinObserverArray[i].queue[0]);
this.joinObserverArray[i].queue[0].kind === 'C' && (isCompleted = true);
}
if (isCompleted) {
this.onCompleted();
} else {
this.dequeue();
var values = [];
for (i = 0, len = firstValues.length; i < firstValues.length; i++) {
values.push(firstValues[i].value);
}
this.onNext.apply(this, values);
}
}
};
var JoinObserver = (function (__super__) {
inherits(JoinObserver, __super__);
function JoinObserver(source, onError) {
__super__.call(this);
this.source = source;
this.onError = onError;
this.queue = [];
this.activePlans = [];
this.subscription = new SingleAssignmentDisposable();
this.isDisposed = false;
}
var JoinObserverPrototype = JoinObserver.prototype;
JoinObserverPrototype.next = function (notification) {
if (!this.isDisposed) {
if (notification.kind === 'E') {
return this.onError(notification.exception);
}
this.queue.push(notification);
var activePlans = this.activePlans.slice(0);
for (var i = 0, len = activePlans.length; i < len; i++) {
activePlans[i].match();
}
}
};
JoinObserverPrototype.error = noop;
JoinObserverPrototype.completed = noop;
JoinObserverPrototype.addActivePlan = function (activePlan) {
this.activePlans.push(activePlan);
};
JoinObserverPrototype.subscribe = function () {
this.subscription.setDisposable(this.source.materialize().subscribe(this));
};
JoinObserverPrototype.removeActivePlan = function (activePlan) {
this.activePlans.splice(this.activePlans.indexOf(activePlan), 1);
this.activePlans.length === 0 && this.dispose();
};
JoinObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
if (!this.isDisposed) {
this.isDisposed = true;
this.subscription.dispose();
}
};
return JoinObserver;
} (AbstractObserver));
/**
* Creates a pattern that matches when both observable sequences have an available value.
*
* @param right Observable sequence to match with the current sequence.
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
*/
observableProto.and = function (right) {
return new Pattern([this, right]);
};
/**
* Matches when the observable sequence has an available value and projects the value.
*
* @param {Function} selector Selector that will be invoked for values in the source sequence.
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
*/
observableProto.thenDo = function (selector) {
return new Pattern([this]).thenDo(selector);
};
/**
* Joins together the results from several patterns.
*
* @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.
* @returns {Observable} Observable sequence with the results form matching several patterns.
*/
Observable.when = function () {
var len = arguments.length, plans;
if (Array.isArray(arguments[0])) {
plans = arguments[0];
} else {
plans = new Array(len);
for(var i = 0; i < len; i++) { plans[i] = arguments[i]; }
}
return new AnonymousObservable(function (o) {
var activePlans = [],
externalSubscriptions = new Map();
var outObserver = observerCreate(
function (x) { o.onNext(x); },
function (err) {
externalSubscriptions.forEach(function (v) { v.onError(err); });
o.onError(err);
},
function (x) { o.onCompleted(); }
);
try {
for (var i = 0, len = plans.length; i < len; i++) {
activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) {
var idx = activePlans.indexOf(activePlan);
activePlans.splice(idx, 1);
activePlans.length === 0 && o.onCompleted();
}));
}
} catch (e) {
observableThrow(e).subscribe(o);
}
var group = new CompositeDisposable();
externalSubscriptions.forEach(function (joinObserver) {
joinObserver.subscribe();
group.add(joinObserver);
});
return group;
});
};
function observableTimerDate(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithAbsolute(dueTime, function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerDateAndPeriod(dueTime, period, scheduler) {
return new AnonymousObservable(function (observer) {
var d = dueTime, p = normalizeTime(period);
return scheduler.scheduleRecursiveWithAbsoluteAndState(0, d, function (count, self) {
if (p > 0) {
var now = scheduler.now();
d = d + p;
d <= now && (d = now + p);
}
observer.onNext(count);
self(count + 1, d);
});
});
}
function observableTimerTimeSpan(dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
return scheduler.scheduleWithRelative(normalizeTime(dueTime), function () {
observer.onNext(0);
observer.onCompleted();
});
});
}
function observableTimerTimeSpanAndPeriod(dueTime, period, scheduler) {
return dueTime === period ?
new AnonymousObservable(function (observer) {
return scheduler.schedulePeriodicWithState(0, period, function (count) {
observer.onNext(count);
return count + 1;
});
}) :
observableDefer(function () {
return observableTimerDateAndPeriod(scheduler.now() + dueTime, period, scheduler);
});
}
/**
* Returns an observable sequence that produces a value after each period.
*
* @example
* 1 - res = Rx.Observable.interval(1000);
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
*
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
* @returns {Observable} An observable sequence that produces a value after each period.
*/
var observableinterval = Observable.interval = function (period, scheduler) {
return observableTimerTimeSpanAndPeriod(period, period, isScheduler(scheduler) ? scheduler : timeoutScheduler);
};
/**
* Returns an observable sequence that produces a value after dueTime has elapsed and then after each period.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) at which to produce the first value.
* @param {Mixed} [periodOrScheduler] Period to produce subsequent values (specified as an integer denoting milliseconds), or the scheduler to run the timer on. If not specified, the resulting timer is not recurring.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence that produces a value after due time has elapsed and then each period.
*/
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
var period;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (periodOrScheduler !== undefined && typeof periodOrScheduler === 'number') {
period = periodOrScheduler;
} else if (isScheduler(periodOrScheduler)) {
scheduler = periodOrScheduler;
}
if (dueTime instanceof Date && period === undefined) {
return observableTimerDate(dueTime.getTime(), scheduler);
}
if (dueTime instanceof Date && period !== undefined) {
period = periodOrScheduler;
return observableTimerDateAndPeriod(dueTime.getTime(), period, scheduler);
}
return period === undefined ?
observableTimerTimeSpan(dueTime, scheduler) :
observableTimerTimeSpanAndPeriod(dueTime, period, scheduler);
};
function observableDelayTimeSpan(source, dueTime, scheduler) {
return new AnonymousObservable(function (observer) {
var active = false,
cancelable = new SerialDisposable(),
exception = null,
q = [],
running = false,
subscription;
subscription = source.materialize().timestamp(scheduler).subscribe(function (notification) {
var d, shouldRun;
if (notification.value.kind === 'E') {
q = [];
q.push(notification);
exception = notification.value.exception;
shouldRun = !running;
} else {
q.push({ value: notification.value, timestamp: notification.timestamp + dueTime });
shouldRun = !active;
active = true;
}
if (shouldRun) {
if (exception !== null) {
observer.onError(exception);
} else {
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleRecursiveWithRelative(dueTime, function (self) {
var e, recurseDueTime, result, shouldRecurse;
if (exception !== null) {
return;
}
running = true;
do {
result = null;
if (q.length > 0 && q[0].timestamp - scheduler.now() <= 0) {
result = q.shift().value;
}
if (result !== null) {
result.accept(observer);
}
} while (result !== null);
shouldRecurse = false;
recurseDueTime = 0;
if (q.length > 0) {
shouldRecurse = true;
recurseDueTime = Math.max(0, q[0].timestamp - scheduler.now());
} else {
active = false;
}
e = exception;
running = false;
if (e !== null) {
observer.onError(e);
} else if (shouldRecurse) {
self(recurseDueTime);
}
}));
}
}
});
return new CompositeDisposable(subscription, cancelable);
}, source);
}
function observableDelayDate(source, dueTime, scheduler) {
return observableDefer(function () {
return observableDelayTimeSpan(source, dueTime - scheduler.now(), scheduler);
});
}
/**
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
*
* @example
* 1 - res = Rx.Observable.delay(new Date());
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
*
* 3 - res = Rx.Observable.delay(5000);
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
* @memberOf Observable#
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) by which to shift the observable sequence.
* @param {Scheduler} [scheduler] Scheduler to run the delay timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delay = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return dueTime instanceof Date ?
observableDelayDate(this, dueTime.getTime(), scheduler) :
observableDelayTimeSpan(this, dueTime, scheduler);
};
/**
* Ignores values from an observable sequence which are followed by another value before dueTime.
* @param {Number} dueTime Duration of the debounce period for each value (specified as an integer denoting milliseconds).
* @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The debounced sequence.
*/
observableProto.debounce = observableProto.throttleWithTimeout = function (dueTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (observer) {
var cancelable = new SerialDisposable(), hasvalue = false, value, id = 0;
var subscription = source.subscribe(
function (x) {
hasvalue = true;
value = x;
id++;
var currentId = id,
d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(scheduler.scheduleWithRelative(dueTime, function () {
hasvalue && id === currentId && observer.onNext(value);
hasvalue = false;
}));
},
function (e) {
cancelable.dispose();
observer.onError(e);
hasvalue = false;
id++;
},
function () {
cancelable.dispose();
hasvalue && observer.onNext(value);
observer.onCompleted();
hasvalue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
}, this);
};
/**
* @deprecated use #debounce or #throttleWithTimeout instead.
*/
observableProto.throttle = function(dueTime, scheduler) {
//deprecate('throttle', 'debounce or throttleWithTimeout');
return this.debounce(dueTime, scheduler);
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
* @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
var source = this, timeShift;
timeShiftOrScheduler == null && (timeShift = timeSpan);
isScheduler(scheduler) || (scheduler = timeoutScheduler);
if (typeof timeShiftOrScheduler === 'number') {
timeShift = timeShiftOrScheduler;
} else if (isScheduler(timeShiftOrScheduler)) {
timeShift = timeSpan;
scheduler = timeShiftOrScheduler;
}
return new AnonymousObservable(function (observer) {
var groupDisposable,
nextShift = timeShift,
nextSpan = timeSpan,
q = [],
refCountDisposable,
timerD = new SerialDisposable(),
totalTime = 0;
groupDisposable = new CompositeDisposable(timerD),
refCountDisposable = new RefCountDisposable(groupDisposable);
function createTimer () {
var m = new SingleAssignmentDisposable(),
isSpan = false,
isShift = false;
timerD.setDisposable(m);
if (nextSpan === nextShift) {
isSpan = true;
isShift = true;
} else if (nextSpan < nextShift) {
isSpan = true;
} else {
isShift = true;
}
var newTotalTime = isSpan ? nextSpan : nextShift,
ts = newTotalTime - totalTime;
totalTime = newTotalTime;
if (isSpan) {
nextSpan += timeShift;
}
if (isShift) {
nextShift += timeShift;
}
m.setDisposable(scheduler.scheduleWithRelative(ts, function () {
if (isShift) {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
}
isSpan && q.shift().onCompleted();
createTimer();
}));
};
q.push(new Subject());
observer.onNext(addRef(q[0], refCountDisposable));
createTimer();
groupDisposable.add(source.subscribe(
function (x) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
},
function (e) {
for (var i = 0, len = q.length; i < len; i++) { q[i].onError(e); }
observer.onError(e);
},
function () {
for (var i = 0, len = q.length; i < len; i++) { q[i].onCompleted(); }
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
/**
* Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
* @param {Number} timeSpan Maximum time length of a window.
* @param {Number} count Maximum element count of a window.
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithTimeOrCount = function (timeSpan, count, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var timerD = new SerialDisposable(),
groupDisposable = new CompositeDisposable(timerD),
refCountDisposable = new RefCountDisposable(groupDisposable),
n = 0,
windowId = 0,
s = new Subject();
function createTimer(id) {
var m = new SingleAssignmentDisposable();
timerD.setDisposable(m);
m.setDisposable(scheduler.scheduleWithRelative(timeSpan, function () {
if (id !== windowId) { return; }
n = 0;
var newId = ++windowId;
s.onCompleted();
s = new Subject();
observer.onNext(addRef(s, refCountDisposable));
createTimer(newId);
}));
}
observer.onNext(addRef(s, refCountDisposable));
createTimer(0);
groupDisposable.add(source.subscribe(
function (x) {
var newId = 0, newWindow = false;
s.onNext(x);
if (++n === count) {
newWindow = true;
n = 0;
newId = ++windowId;
s.onCompleted();
s = new Subject();
observer.onNext(addRef(s, refCountDisposable));
}
newWindow && createTimer(newId);
},
function (e) {
s.onError(e);
observer.onError(e);
}, function () {
s.onCompleted();
observer.onCompleted();
}
));
return refCountDisposable;
}, source);
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
*
* @example
* 1 - res = xs.bufferWithTime(1000, scheduler); // non-overlapping segments of 1 second
* 2 - res = xs.bufferWithTime(1000, 500, scheduler; // segments of 1 second with time shift 0.5 seconds
*
* @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
* @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
return this.windowWithTime.apply(this, arguments).selectMany(function (x) { return x.toArray(); });
};
/**
* Projects each element of an observable sequence into a buffer that is completed when either it's full or a given amount of time has elapsed.
*
* @example
* 1 - res = source.bufferWithTimeOrCount(5000, 50); // 5s or 50 items in an array
* 2 - res = source.bufferWithTimeOrCount(5000, 50, scheduler); // 5s or 50 items in an array
*
* @param {Number} timeSpan Maximum time length of a buffer.
* @param {Number} count Maximum element count of a buffer.
* @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithTimeOrCount = function (timeSpan, count, scheduler) {
return this.windowWithTimeOrCount(timeSpan, count, scheduler).selectMany(function (x) {
return x.toArray();
});
};
/**
* Records the time interval between consecutive values in an observable sequence.
*
* @example
* 1 - res = source.timeInterval();
* 2 - res = source.timeInterval(Rx.Scheduler.timeout);
*
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
* @returns {Observable} An observable sequence with time interval information on values.
*/
observableProto.timeInterval = function (scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return observableDefer(function () {
var last = scheduler.now();
return source.map(function (x) {
var now = scheduler.now(), span = now - last;
last = now;
return { value: x, interval: span };
});
});
};
/**
* Records the timestamp for each value in an observable sequence.
*
* @example
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
* 2 - res = source.timestamp(Rx.Scheduler.default);
*
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the default scheduler is used.
* @returns {Observable} An observable sequence with timestamp information on values.
*/
observableProto.timestamp = function (scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return this.map(function (x) {
return { value: x, timestamp: scheduler.now() };
});
};
function sampleObservable(source, sampler) {
return new AnonymousObservable(function (o) {
var atEnd = false, value, hasValue = false;
function sampleSubscribe() {
if (hasValue) {
hasValue = false;
o.onNext(value);
}
atEnd && o.onCompleted();
}
var sourceSubscription = new SingleAssignmentDisposable();
sourceSubscription.setDisposable(source.subscribe(
function (newValue) {
hasValue = true;
value = newValue;
},
function (e) { o.onError(e); },
function () {
atEnd = true;
sourceSubscription.dispose();
}
));
return new CompositeDisposable(
sourceSubscription,
sampler.subscribe(sampleSubscribe, function (e) { o.onError(e); }, sampleSubscribe)
);
}, source);
}
/**
* Samples the observable sequence at each interval.
*
* @example
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
* 2 - res = source.sample(5000); // 5 seconds
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
*
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Sampled observable sequence.
*/
observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return typeof intervalOrSampler === 'number' ?
sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
sampleObservable(this, intervalOrSampler);
};
/**
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeout = function (dueTime, other, scheduler) {
(other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout')));
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = dueTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (observer) {
var id = 0,
original = new SingleAssignmentDisposable(),
subscription = new SerialDisposable(),
switched = false,
timer = new SerialDisposable();
subscription.setDisposable(original);
function createTimer() {
var myId = id;
timer.setDisposable(scheduler[schedulerMethod](dueTime, function () {
if (id === myId) {
isPromise(other) && (other = observableFromPromise(other));
subscription.setDisposable(other.subscribe(observer));
}
}));
}
createTimer();
original.setDisposable(source.subscribe(function (x) {
if (!switched) {
id++;
observer.onNext(x);
createTimer();
}
}, function (e) {
if (!switched) {
id++;
observer.onError(e);
}
}, function () {
if (!switched) {
id++;
observer.onCompleted();
}
}));
return new CompositeDisposable(subscription, timer);
}, source);
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithAbsoluteTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return new Date(); }
* });
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning Date values.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithAbsoluteTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false;
return scheduler.scheduleRecursiveWithAbsoluteAndState(initialState, scheduler.now(), function (state, self) {
hasResult && observer.onNext(state);
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
var result = resultSelector(state);
var time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(result, time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
*
* @example
* res = source.generateWithRelativeTime(0,
* function (x) { return return true; },
* function (x) { return x + 1; },
* function (x) { return x; },
* function (x) { return 500; }
* );
*
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Function} timeSelector Time selector function to control the speed of values being produced each iteration, returning integer values denoting milliseconds.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not specified, the timeout scheduler is used.
* @returns {Observable} The generated sequence.
*/
Observable.generateWithRelativeTime = function (initialState, condition, iterate, resultSelector, timeSelector, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var first = true,
hasResult = false;
return scheduler.scheduleRecursiveWithRelativeAndState(initialState, 0, function (state, self) {
hasResult && observer.onNext(state);
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
var result = resultSelector(state);
var time = timeSelector(state);
}
} catch (e) {
observer.onError(e);
return;
}
if (hasResult) {
self(result, time);
} else {
observer.onCompleted();
}
});
});
};
/**
* Time shifts the observable sequence by delaying the subscription with the specified relative time duration, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.delaySubscription(5000); // 5s
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.default); // 5 seconds
*
* @param {Number} dueTime Relative or absolute time shift of the subscription.
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delaySubscription = function (dueTime, scheduler) {
var scheduleMethod = dueTime instanceof Date ? 'scheduleWithAbsolute' : 'scheduleWithRelative';
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
var d = new SerialDisposable();
d.setDisposable(scheduler[scheduleMethod](dueTime, function() {
d.setDisposable(source.subscribe(o));
}));
return d;
}, this);
};
/**
* Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
*
* @example
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
*
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
* @returns {Observable} Time-shifted sequence.
*/
observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {
var source = this, subDelay, selector;
if (isFunction(subscriptionDelay)) {
selector = subscriptionDelay;
} else {
subDelay = subscriptionDelay;
selector = delayDurationSelector;
}
return new AnonymousObservable(function (observer) {
var delays = new CompositeDisposable(), atEnd = false, subscription = new SerialDisposable();
function start() {
subscription.setDisposable(source.subscribe(
function (x) {
var delay = tryCatch(selector)(x);
if (delay === errorObj) { return observer.onError(delay.e); }
var d = new SingleAssignmentDisposable();
delays.add(d);
d.setDisposable(delay.subscribe(
function () {
observer.onNext(x);
delays.remove(d);
done();
},
function (e) { observer.onError(e); },
function () {
observer.onNext(x);
delays.remove(d);
done();
}
))
},
function (e) { observer.onError(e); },
function () {
atEnd = true;
subscription.dispose();
done();
}
))
}
function done () {
atEnd && delays.length === 0 && observer.onCompleted();
}
if (!subDelay) {
start();
} else {
subscription.setDisposable(subDelay.subscribe(start, function (e) { observer.onError(e); }, start));
}
return new CompositeDisposable(subscription, delays);
}, this);
};
/**
* Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
* @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
* @param {Function} timeoutDurationSelector Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
*/
observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) {
if (arguments.length === 1) {
timeoutdurationSelector = firstTimeout;
firstTimeout = observableNever();
}
other || (other = observableThrow(new Error('Timeout')));
var source = this;
return new AnonymousObservable(function (observer) {
var subscription = new SerialDisposable(), timer = new SerialDisposable(), original = new SingleAssignmentDisposable();
subscription.setDisposable(original);
var id = 0, switched = false;
function setTimer(timeout) {
var myId = id;
function timerWins () {
return id === myId;
}
var d = new SingleAssignmentDisposable();
timer.setDisposable(d);
d.setDisposable(timeout.subscribe(function () {
timerWins() && subscription.setDisposable(other.subscribe(observer));
d.dispose();
}, function (e) {
timerWins() && observer.onError(e);
}, function () {
timerWins() && subscription.setDisposable(other.subscribe(observer));
}));
};
setTimer(firstTimeout);
function observerWins() {
var res = !switched;
if (res) { id++; }
return res;
}
original.setDisposable(source.subscribe(function (x) {
if (observerWins()) {
observer.onNext(x);
var timeout;
try {
timeout = timeoutdurationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
setTimer(isPromise(timeout) ? observableFromPromise(timeout) : timeout);
}
}, function (e) {
observerWins() && observer.onError(e);
}, function () {
observerWins() && observer.onCompleted();
}));
return new CompositeDisposable(subscription, timer);
}, source);
};
/**
* Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
* @param {Function} durationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
* @returns {Observable} The debounced sequence.
*/
observableProto.debounceWithSelector = function (durationSelector) {
var source = this;
return new AnonymousObservable(function (observer) {
var value, hasValue = false, cancelable = new SerialDisposable(), id = 0;
var subscription = source.subscribe(function (x) {
var throttle;
try {
throttle = durationSelector(x);
} catch (e) {
observer.onError(e);
return;
}
isPromise(throttle) && (throttle = observableFromPromise(throttle));
hasValue = true;
value = x;
id++;
var currentid = id, d = new SingleAssignmentDisposable();
cancelable.setDisposable(d);
d.setDisposable(throttle.subscribe(function () {
hasValue && id === currentid && observer.onNext(value);
hasValue = false;
d.dispose();
}, observer.onError.bind(observer), function () {
hasValue && id === currentid && observer.onNext(value);
hasValue = false;
d.dispose();
}));
}, function (e) {
cancelable.dispose();
observer.onError(e);
hasValue = false;
id++;
}, function () {
cancelable.dispose();
hasValue && observer.onNext(value);
observer.onCompleted();
hasValue = false;
id++;
});
return new CompositeDisposable(subscription, cancelable);
}, source);
};
/**
* @deprecated use #debounceWithSelector instead.
*/
observableProto.throttleWithSelector = function (durationSelector) {
//deprecate('throttleWithSelector', 'debounceWithSelector');
return this.debounceWithSelector(durationSelector);
};
/**
* Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
*
* 1 - res = source.skipLastWithTime(5000);
* 2 - res = source.skipLastWithTime(5000, scheduler);
*
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for skipping elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
*/
observableProto.skipLastWithTime = function (duration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this;
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
o.onNext(q.shift().value);
}
}, function (e) { o.onError(e); }, function () {
var now = scheduler.now();
while (q.length > 0 && now - q[0].interval >= duration) {
o.onNext(q.shift().value);
}
o.onCompleted();
});
}, source);
};
/**
* Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, function (e) { o.onError(e); }, function () {
var now = scheduler.now();
while (q.length > 0) {
var next = q.shift();
if (now - next.interval <= duration) { o.onNext(next.value); }
}
o.onCompleted();
});
}, source);
};
/**
* Returns an array with the elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the end of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
*/
observableProto.takeLastBufferWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
var q = [];
return source.subscribe(function (x) {
var now = scheduler.now();
q.push({ interval: now, value: x });
while (q.length > 0 && now - q[0].interval >= duration) {
q.shift();
}
}, function (e) { o.onError(e); }, function () {
var now = scheduler.now(), res = [];
while (q.length > 0) {
var next = q.shift();
now - next.interval <= duration && res.push(next.value);
}
o.onNext(res);
o.onCompleted();
});
}, source);
};
/**
* Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
* @description
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
* result sequence. This causes elements to be delayed with duration.
* @param {Number} duration Duration for taking elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
*/
observableProto.takeWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (o) {
return new CompositeDisposable(scheduler.scheduleWithRelative(duration, function () { o.onCompleted(); }), source.subscribe(o));
}, source);
};
/**
* Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
*
* @example
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
*
* @description
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.
* This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
* may not execute immediately, despite the zero due time.
*
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
* @param {Number} duration Duration for skipping elements from the start of the sequence.
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
*/
observableProto.skipWithTime = function (duration, scheduler) {
var source = this;
isScheduler(scheduler) || (scheduler = timeoutScheduler);
return new AnonymousObservable(function (observer) {
var open = false;
return new CompositeDisposable(
scheduler.scheduleWithRelative(duration, function () { open = true; }),
source.subscribe(function (x) { open && observer.onNext(x); }, observer.onError.bind(observer), observer.onCompleted.bind(observer)));
}, source);
};
/**
* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.
*
* @examples
* 1 - res = source.skipUntilWithTime(new Date(), [scheduler]);
* 2 - res = source.skipUntilWithTime(5000, [scheduler]);
* @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
*/
observableProto.skipUntilWithTime = function (startTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = startTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (o) {
var open = false;
return new CompositeDisposable(
scheduler[schedulerMethod](startTime, function () { open = true; }),
source.subscribe(
function (x) { open && o.onNext(x); },
function (e) { o.onError(e); }, function () { o.onCompleted(); }));
}, source);
};
/**
* Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
* @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
* @param {Scheduler} [scheduler] Scheduler to run the timer on.
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
*/
observableProto.takeUntilWithTime = function (endTime, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var source = this, schedulerMethod = endTime instanceof Date ?
'scheduleWithAbsolute' :
'scheduleWithRelative';
return new AnonymousObservable(function (o) {
return new CompositeDisposable(
scheduler[schedulerMethod](endTime, function () { o.onCompleted(); }),
source.subscribe(o));
}, source);
};
/**
* Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
* @param {Number} windowDuration time to wait before emitting another item after emitting the last item
* @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
* @returns {Observable} An Observable that performs the throttle operation.
*/
observableProto.throttleFirst = function (windowDuration, scheduler) {
isScheduler(scheduler) || (scheduler = timeoutScheduler);
var duration = +windowDuration || 0;
if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }
var source = this;
return new AnonymousObservable(function (o) {
var lastOnNext = 0;
return source.subscribe(
function (x) {
var now = scheduler.now();
if (lastOnNext === 0 || now - lastOnNext >= duration) {
lastOnNext = now;
o.onNext(x);
}
},function (e) { o.onError(e); }, function () { o.onCompleted(); }
);
}, source);
};
/**
* Executes a transducer to transform the observable sequence
* @param {Transducer} transducer A transducer to execute
* @returns {Observable} An Observable sequence containing the results from the transducer.
*/
observableProto.transduce = function(transducer) {
var source = this;
function transformForObserver(o) {
return {
'@@transducer/init': function() {
return o;
},
'@@transducer/step': function(obs, input) {
return obs.onNext(input);
},
'@@transducer/result': function(obs) {
return obs.onCompleted();
}
};
}
return new AnonymousObservable(function(o) {
var xform = transducer(transformForObserver(o));
return source.subscribe(
function(v) {
try {
xform['@@transducer/step'](o, v);
} catch (e) {
o.onError(e);
}
},
function (e) { o.onError(e); },
function() { xform['@@transducer/result'](o); }
);
}, source);
};
/*
* Performs a exclusive waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @returns {Observable} A exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusive = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasCurrent = false,
isStopped = false,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
var innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
innerSubscription.setDisposable(innerSource.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (!hasCurrent && g.length === 1) {
observer.onCompleted();
}
}));
return g;
}, this);
};
/*
* Performs a exclusive map waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @param {Function} selector Selector to invoke for every item in the current subscription.
* @param {Any} [thisArg] An optional context to invoke with the selector parameter.
* @returns {Observable} An exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusiveMap = function (selector, thisArg) {
var sources = this,
selectorFunc = bindCallback(selector, thisArg, 3);
return new AnonymousObservable(function (observer) {
var index = 0,
hasCurrent = false,
isStopped = true,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) {
var result;
try {
result = selectorFunc(x, index++, innerSource);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
},
function (e) { observer.onError(e); },
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
function (e) { observer.onError(e); },
function () {
isStopped = true;
if (g.length === 1 && !hasCurrent) {
observer.onCompleted();
}
}));
return g;
}, this);
};
/** Provides a set of extension methods for virtual time scheduling. */
Rx.VirtualTimeScheduler = (function (__super__) {
function localNow() {
return this.toDateTimeOffset(this.clock);
}
function scheduleNow(state, action) {
return this.scheduleAbsoluteWithState(state, this.clock, action);
}
function scheduleRelative(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime), action);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime - this.now()), action);
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
inherits(VirtualTimeScheduler, __super__);
/**
* Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
*
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function VirtualTimeScheduler(initialClock, comparer) {
this.clock = initialClock;
this.comparer = comparer;
this.isEnabled = false;
this.queue = new PriorityQueue(1024);
__super__.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
VirtualTimeSchedulerPrototype.add = notImplemented;
/**
* Converts an absolute time to a number
* @param {Any} The absolute time.
* @returns {Number} The absolute time in ms
*/
VirtualTimeSchedulerPrototype.toDateTimeOffset = notImplemented;
/**
* Converts the TimeSpan value to a relative virtual time value.
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
VirtualTimeSchedulerPrototype.toRelative = notImplemented;
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) {
var s = new SchedulePeriodicRecursive(this, state, period, action);
return s.start();
};
/**
* Schedules an action to be executed after dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) {
var runAt = this.add(this.clock, dueTime);
return this.scheduleAbsoluteWithState(state, runAt, action);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) {
return this.scheduleRelativeWithState(action, dueTime, invokeAction);
};
/**
* Starts the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.start = function () {
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
}
};
/**
* Stops the virtual time scheduler.
*/
VirtualTimeSchedulerPrototype.stop = function () {
this.isEnabled = false;
};
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
VirtualTimeSchedulerPrototype.advanceTo = function (time) {
var dueToClock = this.comparer(this.clock, time);
if (this.comparer(this.clock, time) > 0) { throw new ArgumentOutOfRangeError(); }
if (dueToClock === 0) { return; }
if (!this.isEnabled) {
this.isEnabled = true;
do {
var next = this.getNext();
if (next !== null && this.comparer(next.dueTime, time) <= 0) {
this.comparer(next.dueTime, this.clock) > 0 && (this.clock = next.dueTime);
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
this.clock = time;
}
};
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.advanceBy = function (time) {
var dt = this.add(this.clock, time),
dueToClock = this.comparer(this.clock, dt);
if (dueToClock > 0) { throw new ArgumentOutOfRangeError(); }
if (dueToClock === 0) { return; }
this.advanceTo(dt);
};
/**
* Advances the scheduler's clock by the specified relative time.
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.sleep = function (time) {
var dt = this.add(this.clock, time);
if (this.comparer(this.clock, dt) >= 0) { throw new ArgumentOutOfRangeError(); }
this.clock = dt;
};
/**
* Gets the next scheduled item to be executed.
* @returns {ScheduledItem} The next scheduled item.
*/
VirtualTimeSchedulerPrototype.getNext = function () {
while (this.queue.length > 0) {
var next = this.queue.peek();
if (next.isCancelled()) {
this.queue.dequeue();
} else {
return next;
}
}
return null;
};
/**
* Schedules an action to be executed at dueTime.
* @param {Scheduler} scheduler Scheduler to execute the action on.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) {
return this.scheduleAbsoluteWithState(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
var self = this;
function run(scheduler, state1) {
self.queue.remove(si);
return action(scheduler, state1);
}
var si = new ScheduledItem(this, state, run, dueTime, this.comparer);
this.queue.enqueue(si);
return si.disposable;
};
return VirtualTimeScheduler;
}(Scheduler));
/** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */
Rx.HistoricalScheduler = (function (__super__) {
inherits(HistoricalScheduler, __super__);
/**
* Creates a new historical scheduler with the specified initial clock value.
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function HistoricalScheduler(initialClock, comparer) {
var clock = initialClock == null ? 0 : initialClock;
var cmp = comparer || defaultSubComparer;
__super__.call(this, clock, cmp);
}
var HistoricalSchedulerProto = HistoricalScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
HistoricalSchedulerProto.add = function (absolute, relative) {
return absolute + relative;
};
HistoricalSchedulerProto.toDateTimeOffset = function (absolute) {
return new Date(absolute).getTime();
};
/**
* Converts the TimeSpan value to a relative virtual time value.
* @memberOf HistoricalScheduler
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
HistoricalSchedulerProto.toRelative = function (timeSpan) {
return timeSpan;
};
return HistoricalScheduler;
}(Rx.VirtualTimeScheduler));
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
return subscriber && isFunction(subscriber.dispose) ? subscriber :
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
}
function setDisposable(s, state) {
var ado = state[0], subscribe = state[1];
var sub = tryCatch(subscribe)(ado);
if (sub === errorObj) {
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
}
ado.setDisposable(fixSubscriber(sub));
}
function AnonymousObservable(subscribe, parent) {
this.source = parent;
function s(observer) {
var ado = new AutoDetachObserver(observer), state = [ado, subscribe];
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.scheduleWithState(state, setDisposable);
} else {
setDisposable(null, state);
}
return ado;
}
__super__.call(this, s);
}
return AnonymousObservable;
}(Observable));
var AutoDetachObserver = (function (__super__) {
inherits(AutoDetachObserver, __super__);
function AutoDetachObserver(observer) {
__super__.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var result = tryCatch(this.observer.onNext).call(this.observer, value);
if (result === errorObj) {
this.dispose();
thrower(result.e);
}
};
AutoDetachObserverPrototype.error = function (err) {
var result = tryCatch(this.observer.onError).call(this.observer, err);
this.dispose();
result === errorObj && thrower(result.e);
};
AutoDetachObserverPrototype.completed = function () {
var result = tryCatch(this.observer.onCompleted).call(this.observer);
this.dispose();
result === errorObj && thrower(result.e);
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); };
AutoDetachObserverPrototype.dispose = function () {
__super__.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
var GroupedObservable = (function (__super__) {
inherits(GroupedObservable, __super__);
function subscribe(observer) {
return this.underlyingObservable.subscribe(observer);
}
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
__super__.call(this, subscribe);
this.key = key;
this.underlyingObservable = !mergedDisposable ?
underlyingObservable :
new AnonymousObservable(function (observer) {
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
});
}
return GroupedObservable;
}(Observable));
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, __super__);
/**
* Creates a subject.
*/
function Subject() {
__super__.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
this.hasError = false;
}
addProperties(Subject.prototype, Observer.prototype, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () { return this.observers.length > 0; },
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
this.error = error;
this.hasError = true;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed(this);
if (!this.isStopped) {
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (__super__) {
function subscribe(observer) {
checkDisposed(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.hasError) {
observer.onError(this.error);
} else if (this.hasValue) {
observer.onNext(this.value);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, __super__);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
__super__.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.hasValue = false;
this.observers = [];
this.hasError = false;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var i, len;
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
var os = cloneArray(this.observers), len = os.length;
if (this.hasValue) {
for (i = 0; i < len; i++) {
var o = os[i];
o.onNext(this.value);
o.onCompleted();
}
} else {
for (i = 0; i < len; i++) {
os[i].onCompleted();
}
}
this.observers.length = 0;
}
},
/**
* Notifies all subscribed observers about the error.
* @param {Mixed} error The Error to send to all observers.
*/
onError: function (error) {
checkDisposed(this);
if (!this.isStopped) {
this.isStopped = true;
this.hasError = true;
this.error = error;
for (var i = 0, os = cloneArray(this.observers), len = os.length; i < len; i++) {
os[i].onError(error);
}
this.observers.length = 0;
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed(this);
if (this.isStopped) { return; }
this.value = value;
this.hasValue = true;
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function subscribe(observer) {
return this.observable.subscribe(observer);
}
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, subscribe);
}
addProperties(AnonymousSubject.prototype, Observer.prototype, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (error) {
this.observer.onError(error);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
/**
* Used to pause and resume streams.
*/
Rx.Pauser = (function (__super__) {
inherits(Pauser, __super__);
function Pauser() {
__super__.call(this);
}
/**
* Pauses the underlying sequence.
*/
Pauser.prototype.pause = function () { this.onNext(false); };
/**
* Resumes the underlying sequence.
*/
Pauser.prototype.resume = function () { this.onNext(true); };
return Pauser;
}(Subject));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
// All code before this point will be filtered from stack traces.
var rEndingLine = captureLine();
}.call(this));
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"_process":3}],60:[function(require,module,exports){
/**
* index.js
*
* A client-side DOM to vdom parser based on DOMParser API
*/
'use strict';
var VNode = require('virtual-dom/vnode/vnode');
var VText = require('virtual-dom/vnode/vtext');
var domParser = new DOMParser();
var propertyMap = require('./property-map');
var namespaceMap = require('./namespace-map');
var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
module.exports = parser;
/**
* DOM/html string to vdom parser
*
* @param Mixed el DOM element or html string
* @param String attr Attribute name that contains vdom key
* @return Object VNode or VText
*/
function parser(el, attr) {
// empty input fallback to empty text node
if (!el) {
return createNode(document.createTextNode(''));
}
if (typeof el === 'string') {
var doc = domParser.parseFromString(el, 'text/html');
// most tags default to body
if (doc.body.firstChild) {
el = doc.body.firstChild;
// some tags, like script and style, default to head
} else if (doc.head.firstChild && (doc.head.firstChild.tagName !== 'TITLE' || doc.title)) {
el = doc.head.firstChild;
// special case for html comment, cdata, doctype
} else if (doc.firstChild && doc.firstChild.tagName !== 'HTML') {
el = doc.firstChild;
// other element, such as whitespace, or html/body/head tag, fallback to empty text node
} else {
el = document.createTextNode('');
}
}
if (typeof el !== 'object' || !el || !el.nodeType) {
throw new Error('invalid dom node', el);
}
return createNode(el, attr);
}
/**
* Create vdom from dom node
*
* @param Object el DOM element
* @param String attr Attribute name that contains vdom key
* @return Object VNode or VText
*/
function createNode(el, attr) {
// html comment is not currently supported by virtual-dom
if (el.nodeType === 3) {
return createVirtualTextNode(el);
// cdata or doctype is not currently supported by virtual-dom
} else if (el.nodeType === 1 || el.nodeType === 9) {
return createVirtualDomNode(el, attr);
}
// default to empty text node
return new VText('');
}
/**
* Create vtext from dom node
*
* @param Object el Text node
* @return Object VText
*/
function createVirtualTextNode(el) {
return new VText(el.nodeValue);
}
/**
* Create vnode from dom node
*
* @param Object el DOM element
* @param String attr Attribute name that contains vdom key
* @return Object VNode
*/
function createVirtualDomNode(el, attr) {
var ns = el.namespaceURI !== HTML_NAMESPACE ? el.namespaceURI : null;
var key = attr && el.getAttribute(attr) ? el.getAttribute(attr) : null;
return new VNode(
el.tagName
, createProperties(el)
, createChildren(el, attr)
, key
, ns
);
}
/**
* Recursively create vdom
*
* @param Object el Parent element
* @param String attr Attribute name that contains vdom key
* @return Array Child vnode or vtext
*/
function createChildren(el, attr) {
var children = [];
for (var i = 0; i < el.childNodes.length; i++) {
children.push(createNode(el.childNodes[i], attr));
};
return children;
}
/**
* Create properties from dom node
*
* @param Object el DOM element
* @return Object Node properties and attributes
*/
function createProperties(el) {
var properties = {};
if (!el.hasAttributes()) {
return properties;
}
var ns;
if (el.namespaceURI && el.namespaceURI !== HTML_NAMESPACE) {
ns = el.namespaceURI;
}
var attr;
for (var i = 0; i < el.attributes.length; i++) {
if (ns) {
attr = createPropertyNS(el.attributes[i]);
} else {
attr = createProperty(el.attributes[i]);
}
// special case, namespaced attribute, use properties.foobar
if (attr.ns) {
properties[attr.name] = {
namespace: attr.ns
, value: attr.value
};
// special case, use properties.attributes.foobar
} else if (attr.isAttr) {
// init attributes object only when necessary
if (!properties.attributes) {
properties.attributes = {}
}
properties.attributes[attr.name] = attr.value;
// default case, use properties.foobar
} else {
properties[attr.name] = attr.value;
}
};
return properties;
}
/**
* Create property from dom attribute
*
* @param Object attr DOM attribute
* @return Object Normalized attribute
*/
function createProperty(attr) {
var name, value, isAttr;
// using a map to find the correct case of property name
if (propertyMap[attr.name]) {
name = propertyMap[attr.name];
} else {
name = attr.name;
}
// special cases for style attribute, we default to properties.style
if (name === 'style') {
var style = {};
attr.value.split(';').forEach(function (s) {
var pos = s.indexOf(':');
if (pos < 0) {
return;
}
style[s.substr(0, pos).trim()] = s.substr(pos + 1).trim();
});
value = style;
// special cases for data attribute, we default to properties.attributes.data
} else if (name.indexOf('data-') === 0) {
value = attr.value;
isAttr = true;
} else {
value = attr.value;
}
return {
name: name
, value: value
, isAttr: isAttr || false
};
}
/**
* Create namespaced property from dom attribute
*
* @param Object attr DOM attribute
* @return Object Normalized attribute
*/
function createPropertyNS(attr) {
var name, value;
return {
name: attr.name
, value: attr.value
, ns: namespaceMap[attr.name] || ''
};
}
},{"./namespace-map":61,"./property-map":62,"virtual-dom/vnode/vnode":104,"virtual-dom/vnode/vtext":106}],61:[function(require,module,exports){
/**
* namespace-map.js
*
* Necessary to map svg attributes back to their namespace
*/
'use strict';
// extracted from https://github.com/Matt-Esch/virtual-dom/blob/master/virtual-hyperscript/svg-attribute-namespace.js
var DEFAULT_NAMESPACE = null;
var EV_NAMESPACE = 'http://www.w3.org/2001/xml-events';
var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
var namespaces = {
'about': DEFAULT_NAMESPACE
, 'accent-height': DEFAULT_NAMESPACE
, 'accumulate': DEFAULT_NAMESPACE
, 'additive': DEFAULT_NAMESPACE
, 'alignment-baseline': DEFAULT_NAMESPACE
, 'alphabetic': DEFAULT_NAMESPACE
, 'amplitude': DEFAULT_NAMESPACE
, 'arabic-form': DEFAULT_NAMESPACE
, 'ascent': DEFAULT_NAMESPACE
, 'attributeName': DEFAULT_NAMESPACE
, 'attributeType': DEFAULT_NAMESPACE
, 'azimuth': DEFAULT_NAMESPACE
, 'bandwidth': DEFAULT_NAMESPACE
, 'baseFrequency': DEFAULT_NAMESPACE
, 'baseProfile': DEFAULT_NAMESPACE
, 'baseline-shift': DEFAULT_NAMESPACE
, 'bbox': DEFAULT_NAMESPACE
, 'begin': DEFAULT_NAMESPACE
, 'bias': DEFAULT_NAMESPACE
, 'by': DEFAULT_NAMESPACE
, 'calcMode': DEFAULT_NAMESPACE
, 'cap-height': DEFAULT_NAMESPACE
, 'class': DEFAULT_NAMESPACE
, 'clip': DEFAULT_NAMESPACE
, 'clip-path': DEFAULT_NAMESPACE
, 'clip-rule': DEFAULT_NAMESPACE
, 'clipPathUnits': DEFAULT_NAMESPACE
, 'color': DEFAULT_NAMESPACE
, 'color-interpolation': DEFAULT_NAMESPACE
, 'color-interpolation-filters': DEFAULT_NAMESPACE
, 'color-profile': DEFAULT_NAMESPACE
, 'color-rendering': DEFAULT_NAMESPACE
, 'content': DEFAULT_NAMESPACE
, 'contentScriptType': DEFAULT_NAMESPACE
, 'contentStyleType': DEFAULT_NAMESPACE
, 'cursor': DEFAULT_NAMESPACE
, 'cx': DEFAULT_NAMESPACE
, 'cy': DEFAULT_NAMESPACE
, 'd': DEFAULT_NAMESPACE
, 'datatype': DEFAULT_NAMESPACE
, 'defaultAction': DEFAULT_NAMESPACE
, 'descent': DEFAULT_NAMESPACE
, 'diffuseConstant': DEFAULT_NAMESPACE
, 'direction': DEFAULT_NAMESPACE
, 'display': DEFAULT_NAMESPACE
, 'divisor': DEFAULT_NAMESPACE
, 'dominant-baseline': DEFAULT_NAMESPACE
, 'dur': DEFAULT_NAMESPACE
, 'dx': DEFAULT_NAMESPACE
, 'dy': DEFAULT_NAMESPACE
, 'edgeMode': DEFAULT_NAMESPACE
, 'editable': DEFAULT_NAMESPACE
, 'elevation': DEFAULT_NAMESPACE
, 'enable-background': DEFAULT_NAMESPACE
, 'end': DEFAULT_NAMESPACE
, 'ev:event': EV_NAMESPACE
, 'event': DEFAULT_NAMESPACE
, 'exponent': DEFAULT_NAMESPACE
, 'externalResourcesRequired': DEFAULT_NAMESPACE
, 'fill': DEFAULT_NAMESPACE
, 'fill-opacity': DEFAULT_NAMESPACE
, 'fill-rule': DEFAULT_NAMESPACE
, 'filter': DEFAULT_NAMESPACE
, 'filterRes': DEFAULT_NAMESPACE
, 'filterUnits': DEFAULT_NAMESPACE
, 'flood-color': DEFAULT_NAMESPACE
, 'flood-opacity': DEFAULT_NAMESPACE
, 'focusHighlight': DEFAULT_NAMESPACE
, 'focusable': DEFAULT_NAMESPACE
, 'font-family': DEFAULT_NAMESPACE
, 'font-size': DEFAULT_NAMESPACE
, 'font-size-adjust': DEFAULT_NAMESPACE
, 'font-stretch': DEFAULT_NAMESPACE
, 'font-style': DEFAULT_NAMESPACE
, 'font-variant': DEFAULT_NAMESPACE
, 'font-weight': DEFAULT_NAMESPACE
, 'format': DEFAULT_NAMESPACE
, 'from': DEFAULT_NAMESPACE
, 'fx': DEFAULT_NAMESPACE
, 'fy': DEFAULT_NAMESPACE
, 'g1': DEFAULT_NAMESPACE
, 'g2': DEFAULT_NAMESPACE
, 'glyph-name': DEFAULT_NAMESPACE
, 'glyph-orientation-horizontal': DEFAULT_NAMESPACE
, 'glyph-orientation-vertical': DEFAULT_NAMESPACE
, 'glyphRef': DEFAULT_NAMESPACE
, 'gradientTransform': DEFAULT_NAMESPACE
, 'gradientUnits': DEFAULT_NAMESPACE
, 'handler': DEFAULT_NAMESPACE
, 'hanging': DEFAULT_NAMESPACE
, 'height': DEFAULT_NAMESPACE
, 'horiz-adv-x': DEFAULT_NAMESPACE
, 'horiz-origin-x': DEFAULT_NAMESPACE
, 'horiz-origin-y': DEFAULT_NAMESPACE
, 'id': DEFAULT_NAMESPACE
, 'ideographic': DEFAULT_NAMESPACE
, 'image-rendering': DEFAULT_NAMESPACE
, 'in': DEFAULT_NAMESPACE
, 'in2': DEFAULT_NAMESPACE
, 'initialVisibility': DEFAULT_NAMESPACE
, 'intercept': DEFAULT_NAMESPACE
, 'k': DEFAULT_NAMESPACE
, 'k1': DEFAULT_NAMESPACE
, 'k2': DEFAULT_NAMESPACE
, 'k3': DEFAULT_NAMESPACE
, 'k4': DEFAULT_NAMESPACE
, 'kernelMatrix': DEFAULT_NAMESPACE
, 'kernelUnitLength': DEFAULT_NAMESPACE
, 'kerning': DEFAULT_NAMESPACE
, 'keyPoints': DEFAULT_NAMESPACE
, 'keySplines': DEFAULT_NAMESPACE
, 'keyTimes': DEFAULT_NAMESPACE
, 'lang': DEFAULT_NAMESPACE
, 'lengthAdjust': DEFAULT_NAMESPACE
, 'letter-spacing': DEFAULT_NAMESPACE
, 'lighting-color': DEFAULT_NAMESPACE
, 'limitingConeAngle': DEFAULT_NAMESPACE
, 'local': DEFAULT_NAMESPACE
, 'marker-end': DEFAULT_NAMESPACE
, 'marker-mid': DEFAULT_NAMESPACE
, 'marker-start': DEFAULT_NAMESPACE
, 'markerHeight': DEFAULT_NAMESPACE
, 'markerUnits': DEFAULT_NAMESPACE
, 'markerWidth': DEFAULT_NAMESPACE
, 'mask': DEFAULT_NAMESPACE
, 'maskContentUnits': DEFAULT_NAMESPACE
, 'maskUnits': DEFAULT_NAMESPACE
, 'mathematical': DEFAULT_NAMESPACE
, 'max': DEFAULT_NAMESPACE
, 'media': DEFAULT_NAMESPACE
, 'mediaCharacterEncoding': DEFAULT_NAMESPACE
, 'mediaContentEncodings': DEFAULT_NAMESPACE
, 'mediaSize': DEFAULT_NAMESPACE
, 'mediaTime': DEFAULT_NAMESPACE
, 'method': DEFAULT_NAMESPACE
, 'min': DEFAULT_NAMESPACE
, 'mode': DEFAULT_NAMESPACE
, 'name': DEFAULT_NAMESPACE
, 'nav-down': DEFAULT_NAMESPACE
, 'nav-down-left': DEFAULT_NAMESPACE
, 'nav-down-right': DEFAULT_NAMESPACE
, 'nav-left': DEFAULT_NAMESPACE
, 'nav-next': DEFAULT_NAMESPACE
, 'nav-prev': DEFAULT_NAMESPACE
, 'nav-right': DEFAULT_NAMESPACE
, 'nav-up': DEFAULT_NAMESPACE
, 'nav-up-left': DEFAULT_NAMESPACE
, 'nav-up-right': DEFAULT_NAMESPACE
, 'numOctaves': DEFAULT_NAMESPACE
, 'observer': DEFAULT_NAMESPACE
, 'offset': DEFAULT_NAMESPACE
, 'opacity': DEFAULT_NAMESPACE
, 'operator': DEFAULT_NAMESPACE
, 'order': DEFAULT_NAMESPACE
, 'orient': DEFAULT_NAMESPACE
, 'orientation': DEFAULT_NAMESPACE
, 'origin': DEFAULT_NAMESPACE
, 'overflow': DEFAULT_NAMESPACE
, 'overlay': DEFAULT_NAMESPACE
, 'overline-position': DEFAULT_NAMESPACE
, 'overline-thickness': DEFAULT_NAMESPACE
, 'panose-1': DEFAULT_NAMESPACE
, 'path': DEFAULT_NAMESPACE
, 'pathLength': DEFAULT_NAMESPACE
, 'patternContentUnits': DEFAULT_NAMESPACE
, 'patternTransform': DEFAULT_NAMESPACE
, 'patternUnits': DEFAULT_NAMESPACE
, 'phase': DEFAULT_NAMESPACE
, 'playbackOrder': DEFAULT_NAMESPACE
, 'pointer-events': DEFAULT_NAMESPACE
, 'points': DEFAULT_NAMESPACE
, 'pointsAtX': DEFAULT_NAMESPACE
, 'pointsAtY': DEFAULT_NAMESPACE
, 'pointsAtZ': DEFAULT_NAMESPACE
, 'preserveAlpha': DEFAULT_NAMESPACE
, 'preserveAspectRatio': DEFAULT_NAMESPACE
, 'primitiveUnits': DEFAULT_NAMESPACE
, 'propagate': DEFAULT_NAMESPACE
, 'property': DEFAULT_NAMESPACE
, 'r': DEFAULT_NAMESPACE
, 'radius': DEFAULT_NAMESPACE
, 'refX': DEFAULT_NAMESPACE
, 'refY': DEFAULT_NAMESPACE
, 'rel': DEFAULT_NAMESPACE
, 'rendering-intent': DEFAULT_NAMESPACE
, 'repeatCount': DEFAULT_NAMESPACE
, 'repeatDur': DEFAULT_NAMESPACE
, 'requiredExtensions': DEFAULT_NAMESPACE
, 'requiredFeatures': DEFAULT_NAMESPACE
, 'requiredFonts': DEFAULT_NAMESPACE
, 'requiredFormats': DEFAULT_NAMESPACE
, 'resource': DEFAULT_NAMESPACE
, 'restart': DEFAULT_NAMESPACE
, 'result': DEFAULT_NAMESPACE
, 'rev': DEFAULT_NAMESPACE
, 'role': DEFAULT_NAMESPACE
, 'rotate': DEFAULT_NAMESPACE
, 'rx': DEFAULT_NAMESPACE
, 'ry': DEFAULT_NAMESPACE
, 'scale': DEFAULT_NAMESPACE
, 'seed': DEFAULT_NAMESPACE
, 'shape-rendering': DEFAULT_NAMESPACE
, 'slope': DEFAULT_NAMESPACE
, 'snapshotTime': DEFAULT_NAMESPACE
, 'spacing': DEFAULT_NAMESPACE
, 'specularConstant': DEFAULT_NAMESPACE
, 'specularExponent': DEFAULT_NAMESPACE
, 'spreadMethod': DEFAULT_NAMESPACE
, 'startOffset': DEFAULT_NAMESPACE
, 'stdDeviation': DEFAULT_NAMESPACE
, 'stemh': DEFAULT_NAMESPACE
, 'stemv': DEFAULT_NAMESPACE
, 'stitchTiles': DEFAULT_NAMESPACE
, 'stop-color': DEFAULT_NAMESPACE
, 'stop-opacity': DEFAULT_NAMESPACE
, 'strikethrough-position': DEFAULT_NAMESPACE
, 'strikethrough-thickness': DEFAULT_NAMESPACE
, 'string': DEFAULT_NAMESPACE
, 'stroke': DEFAULT_NAMESPACE
, 'stroke-dasharray': DEFAULT_NAMESPACE
, 'stroke-dashoffset': DEFAULT_NAMESPACE
, 'stroke-linecap': DEFAULT_NAMESPACE
, 'stroke-linejoin': DEFAULT_NAMESPACE
, 'stroke-miterlimit': DEFAULT_NAMESPACE
, 'stroke-opacity': DEFAULT_NAMESPACE
, 'stroke-width': DEFAULT_NAMESPACE
, 'surfaceScale': DEFAULT_NAMESPACE
, 'syncBehavior': DEFAULT_NAMESPACE
, 'syncBehaviorDefault': DEFAULT_NAMESPACE
, 'syncMaster': DEFAULT_NAMESPACE
, 'syncTolerance': DEFAULT_NAMESPACE
, 'syncToleranceDefault': DEFAULT_NAMESPACE
, 'systemLanguage': DEFAULT_NAMESPACE
, 'tableValues': DEFAULT_NAMESPACE
, 'target': DEFAULT_NAMESPACE
, 'targetX': DEFAULT_NAMESPACE
, 'targetY': DEFAULT_NAMESPACE
, 'text-anchor': DEFAULT_NAMESPACE
, 'text-decoration': DEFAULT_NAMESPACE
, 'text-rendering': DEFAULT_NAMESPACE
, 'textLength': DEFAULT_NAMESPACE
, 'timelineBegin': DEFAULT_NAMESPACE
, 'title': DEFAULT_NAMESPACE
, 'to': DEFAULT_NAMESPACE
, 'transform': DEFAULT_NAMESPACE
, 'transformBehavior': DEFAULT_NAMESPACE
, 'type': DEFAULT_NAMESPACE
, 'typeof': DEFAULT_NAMESPACE
, 'u1': DEFAULT_NAMESPACE
, 'u2': DEFAULT_NAMESPACE
, 'underline-position': DEFAULT_NAMESPACE
, 'underline-thickness': DEFAULT_NAMESPACE
, 'unicode': DEFAULT_NAMESPACE
, 'unicode-bidi': DEFAULT_NAMESPACE
, 'unicode-range': DEFAULT_NAMESPACE
, 'units-per-em': DEFAULT_NAMESPACE
, 'v-alphabetic': DEFAULT_NAMESPACE
, 'v-hanging': DEFAULT_NAMESPACE
, 'v-ideographic': DEFAULT_NAMESPACE
, 'v-mathematical': DEFAULT_NAMESPACE
, 'values': DEFAULT_NAMESPACE
, 'version': DEFAULT_NAMESPACE
, 'vert-adv-y': DEFAULT_NAMESPACE
, 'vert-origin-x': DEFAULT_NAMESPACE
, 'vert-origin-y': DEFAULT_NAMESPACE
, 'viewBox': DEFAULT_NAMESPACE
, 'viewTarget': DEFAULT_NAMESPACE
, 'visibility': DEFAULT_NAMESPACE
, 'width': DEFAULT_NAMESPACE
, 'widths': DEFAULT_NAMESPACE
, 'word-spacing': DEFAULT_NAMESPACE
, 'writing-mode': DEFAULT_NAMESPACE
, 'x': DEFAULT_NAMESPACE
, 'x-height': DEFAULT_NAMESPACE
, 'x1': DEFAULT_NAMESPACE
, 'x2': DEFAULT_NAMESPACE
, 'xChannelSelector': DEFAULT_NAMESPACE
, 'xlink:actuate': XLINK_NAMESPACE
, 'xlink:arcrole': XLINK_NAMESPACE
, 'xlink:href': XLINK_NAMESPACE
, 'xlink:role': XLINK_NAMESPACE
, 'xlink:show': XLINK_NAMESPACE
, 'xlink:title': XLINK_NAMESPACE
, 'xlink:type': XLINK_NAMESPACE
, 'xml:base': XML_NAMESPACE
, 'xml:id': XML_NAMESPACE
, 'xml:lang': XML_NAMESPACE
, 'xml:space': XML_NAMESPACE
, 'y': DEFAULT_NAMESPACE
, 'y1': DEFAULT_NAMESPACE
, 'y2': DEFAULT_NAMESPACE
, 'yChannelSelector': DEFAULT_NAMESPACE
, 'z': DEFAULT_NAMESPACE
, 'zoomAndPan': DEFAULT_NAMESPACE
};
module.exports = namespaces;
},{}],62:[function(require,module,exports){
/**
* property-map.js
*
* Necessary to map dom attributes back to vdom properties
*/
'use strict';
// invert of https://www.npmjs.com/package/html-attributes
var properties = {
'abbr': 'abbr'
, 'accept': 'accept'
, 'accept-charset': 'acceptCharset'
, 'accesskey': 'accessKey'
, 'action': 'action'
, 'allowfullscreen': 'allowFullScreen'
, 'allowtransparency': 'allowTransparency'
, 'alt': 'alt'
, 'async': 'async'
, 'autocomplete': 'autoComplete'
, 'autofocus': 'autoFocus'
, 'autoplay': 'autoPlay'
, 'cellpadding': 'cellPadding'
, 'cellspacing': 'cellSpacing'
, 'challenge': 'challenge'
, 'charset': 'charset'
, 'checked': 'checked'
, 'cite': 'cite'
, 'class': 'className'
, 'cols': 'cols'
, 'colspan': 'colSpan'
, 'command': 'command'
, 'content': 'content'
, 'contenteditable': 'contentEditable'
, 'contextmenu': 'contextMenu'
, 'controls': 'controls'
, 'coords': 'coords'
, 'crossorigin': 'crossOrigin'
, 'data': 'data'
, 'datetime': 'dateTime'
, 'default': 'default'
, 'defer': 'defer'
, 'dir': 'dir'
, 'disabled': 'disabled'
, 'download': 'download'
, 'draggable': 'draggable'
, 'dropzone': 'dropzone'
, 'enctype': 'encType'
, 'for': 'htmlFor'
, 'form': 'form'
, 'formaction': 'formAction'
, 'formenctype': 'formEncType'
, 'formmethod': 'formMethod'
, 'formnovalidate': 'formNoValidate'
, 'formtarget': 'formTarget'
, 'frameBorder': 'frameBorder'
, 'headers': 'headers'
, 'height': 'height'
, 'hidden': 'hidden'
, 'high': 'high'
, 'href': 'href'
, 'hreflang': 'hrefLang'
, 'http-equiv': 'httpEquiv'
, 'icon': 'icon'
, 'id': 'id'
, 'inputmode': 'inputMode'
, 'ismap': 'isMap'
, 'itemid': 'itemId'
, 'itemprop': 'itemProp'
, 'itemref': 'itemRef'
, 'itemscope': 'itemScope'
, 'itemtype': 'itemType'
, 'kind': 'kind'
, 'label': 'label'
, 'lang': 'lang'
, 'list': 'list'
, 'loop': 'loop'
, 'manifest': 'manifest'
, 'max': 'max'
, 'maxlength': 'maxLength'
, 'media': 'media'
, 'mediagroup': 'mediaGroup'
, 'method': 'method'
, 'min': 'min'
, 'minlength': 'minLength'
, 'multiple': 'multiple'
, 'muted': 'muted'
, 'name': 'name'
, 'novalidate': 'noValidate'
, 'open': 'open'
, 'optimum': 'optimum'
, 'pattern': 'pattern'
, 'ping': 'ping'
, 'placeholder': 'placeholder'
, 'poster': 'poster'
, 'preload': 'preload'
, 'radiogroup': 'radioGroup'
, 'readonly': 'readOnly'
, 'rel': 'rel'
, 'required': 'required'
, 'role': 'role'
, 'rows': 'rows'
, 'rowspan': 'rowSpan'
, 'sandbox': 'sandbox'
, 'scope': 'scope'
, 'scoped': 'scoped'
, 'scrolling': 'scrolling'
, 'seamless': 'seamless'
, 'selected': 'selected'
, 'shape': 'shape'
, 'size': 'size'
, 'sizes': 'sizes'
, 'sortable': 'sortable'
, 'span': 'span'
, 'spellcheck': 'spellCheck'
, 'src': 'src'
, 'srcdoc': 'srcDoc'
, 'srcset': 'srcSet'
, 'start': 'start'
, 'step': 'step'
, 'style': 'style'
, 'tabindex': 'tabIndex'
, 'target': 'target'
, 'title': 'title'
, 'translate': 'translate'
, 'type': 'type'
, 'typemustmatch': 'typeMustMatch'
, 'usemap': 'useMap'
, 'value': 'value'
, 'width': 'width'
, 'wmode': 'wmode'
, 'wrap': 'wrap'
};
module.exports = properties;
},{}],63:[function(require,module,exports){
var escape = require('escape-html');
var propConfig = require('./property-config');
var types = propConfig.attributeTypes;
var properties = propConfig.properties;
var attributeNames = propConfig.attributeNames;
var prefixAttribute = memoizeString(function (name) {
return escape(name) + '="';
});
module.exports = createAttribute;
/**
* Create attribute string.
*
* @param {String} name The name of the property or attribute
* @param {*} value The value
* @param {Boolean} [isAttribute] Denotes whether `name` is an attribute.
* @return {?String} Attribute string || null if not a valid property or custom attribute.
*/
function createAttribute(name, value, isAttribute) {
if (properties.hasOwnProperty(name)) {
if (shouldSkip(name, value)) return '';
name = (attributeNames[name] || name).toLowerCase();
var attrType = properties[name];
// for BOOLEAN `value` only has to be truthy
// for OVERLOADED_BOOLEAN `value` has to be === true
if ((attrType === types.BOOLEAN) ||
(attrType === types.OVERLOADED_BOOLEAN && value === true)) {
return escape(name);
}
return prefixAttribute(name) + escape(value) + '"';
} else if (isAttribute) {
if (value == null) return '';
return prefixAttribute(name) + escape(value) + '"';
}
// return null if `name` is neither a valid property nor an attribute
return null;
}
/**
* Should skip false boolean attributes.
*/
function shouldSkip(name, value) {
var attrType = properties[name];
return value == null ||
(attrType === types.BOOLEAN && !value) ||
(attrType === types.OVERLOADED_BOOLEAN && value === false);
}
/**
* Memoizes the return value of a function that accepts one string argument.
*
* @param {function} callback
* @return {function}
*/
function memoizeString(callback) {
var cache = {};
return function(string) {
if (cache.hasOwnProperty(string)) {
return cache[string];
} else {
return cache[string] = callback.call(this, string);
}
};
}
},{"./property-config":73,"escape-html":65}],64:[function(require,module,exports){
var escape = require('escape-html');
var extend = require('xtend');
var isVNode = require('virtual-dom/vnode/is-vnode');
var isVText = require('virtual-dom/vnode/is-vtext');
var isThunk = require('virtual-dom/vnode/is-thunk');
var isWidget = require('virtual-dom/vnode/is-widget');
var softHook = require('virtual-dom/virtual-hyperscript/hooks/soft-set-hook');
var attrHook = require('virtual-dom/virtual-hyperscript/hooks/attribute-hook');
var paramCase = require('param-case');
var createAttribute = require('./create-attribute');
var voidElements = require('./void-elements');
module.exports = toHTML;
function toHTML(node, parent) {
if (!node) return '';
if (isThunk(node)) {
node = node.render();
}
if (isWidget(node) && node.render) {
node = node.render();
}
if (isVNode(node)) {
return openTag(node) + tagContent(node) + closeTag(node);
} else if (isVText(node)) {
if (parent && parent.tagName.toLowerCase() === 'script') return String(node.text);
return escape(String(node.text));
}
return '';
}
function openTag(node) {
var props = node.properties;
var ret = '<' + node.tagName.toLowerCase();
for (var name in props) {
var value = props[name];
if (value == null) continue;
if (name == 'attributes') {
value = extend({}, value);
for (var attrProp in value) {
ret += ' ' + createAttribute(attrProp, value[attrProp], true);
}
continue;
}
if (name == 'style') {
var css = '';
value = extend({}, value);
for (var styleProp in value) {
css += paramCase(styleProp) + ': ' + value[styleProp] + '; ';
}
value = css.trim();
}
if (value instanceof softHook || value instanceof attrHook) {
ret += ' ' + createAttribute(name, value.value, true);
continue;
}
var attr = createAttribute(name, value);
if (attr) ret += ' ' + attr;
}
return ret + '>';
}
function tagContent(node) {
var innerHTML = node.properties.innerHTML;
if (innerHTML != null) return innerHTML;
else {
var ret = '';
if (node.children && node.children.length) {
for (var i = 0, l = node.children.length; i<l; i++) {
var child = node.children[i];
ret += toHTML(child, node);
}
}
return ret;
}
}
function closeTag(node) {
var tag = node.tagName.toLowerCase();
return voidElements[tag] ? '' : '</' + tag + '>';
}
},{"./create-attribute":63,"./void-elements":74,"escape-html":65,"param-case":71,"virtual-dom/virtual-hyperscript/hooks/attribute-hook":90,"virtual-dom/virtual-hyperscript/hooks/soft-set-hook":92,"virtual-dom/vnode/is-thunk":98,"virtual-dom/vnode/is-vnode":100,"virtual-dom/vnode/is-vtext":101,"virtual-dom/vnode/is-widget":102,"xtend":72}],65:[function(require,module,exports){
/*!
* escape-html
* Copyright(c) 2012-2013 TJ Holowaychuk
* MIT Licensed
*/
/**
* Module exports.
* @public
*/
module.exports = escapeHtml;
/**
* Escape special characters in the given string of html.
*
* @param {string} str The string to escape for inserting into HTML
* @return {string}
* @public
*/
function escapeHtml(html) {
return String(html)
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/</g, '<')
.replace(/>/g, '>');
}
},{}],66:[function(require,module,exports){
/**
* Special language-specific overrides.
*
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
*
* @type {Object}
*/
var LANGUAGES = {
tr: {
regexp: /\u0130|\u0049|\u0049\u0307/g,
map: {
'\u0130': '\u0069',
'\u0049': '\u0131',
'\u0049\u0307': '\u0069'
}
},
az: {
regexp: /[\u0130]/g,
map: {
'\u0130': '\u0069',
'\u0049': '\u0131',
'\u0049\u0307': '\u0069'
}
},
lt: {
regexp: /[\u0049\u004A\u012E\u00CC\u00CD\u0128]/g,
map: {
'\u0049': '\u0069\u0307',
'\u004A': '\u006A\u0307',
'\u012E': '\u012F\u0307',
'\u00CC': '\u0069\u0307\u0300',
'\u00CD': '\u0069\u0307\u0301',
'\u0128': '\u0069\u0307\u0303'
}
}
}
/**
* Lowercase a string.
*
* @param {String} str
* @return {String}
*/
module.exports = function (str, locale) {
var lang = LANGUAGES[locale]
str = str == null ? '' : String(str)
if (lang) {
str = str.replace(lang.regexp, function (m) { return lang.map[m] })
}
return str.toLowerCase()
}
},{}],67:[function(require,module,exports){
var lowerCase = require('lower-case')
var NON_WORD_REGEXP = require('./vendor/non-word-regexp')
var CAMEL_CASE_REGEXP = require('./vendor/camel-case-regexp')
var TRAILING_DIGIT_REGEXP = require('./vendor/trailing-digit-regexp')
/**
* Sentence case a string.
*
* @param {String} str
* @param {String} locale
* @param {String} replacement
* @return {String}
*/
module.exports = function (str, locale, replacement) {
if (str == null) {
return ''
}
replacement = replacement || ' '
function replace (match, index, string) {
if (index === 0 || index === (string.length - match.length)) {
return ''
}
return replacement
}
str = String(str)
// Support camel case ("camelCase" -> "camel Case").
.replace(CAMEL_CASE_REGEXP, '$1 $2')
// Support digit groups ("test2012" -> "test 2012").
.replace(TRAILING_DIGIT_REGEXP, '$1 $2')
// Remove all non-word characters and replace with a single space.
.replace(NON_WORD_REGEXP, replace)
// Lower case the entire string.
return lowerCase(str, locale)
}
},{"./vendor/camel-case-regexp":68,"./vendor/non-word-regexp":69,"./vendor/trailing-digit-regexp":70,"lower-case":66}],68:[function(require,module,exports){
module.exports = /([\u0061-\u007A\u00B5\u00DF-\u00F6\u00F8-\u00FF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0561-\u0587\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7FA\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A])([\u0041-\u005A\u00C0-\u00D6\u00D8-\u00DE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA\uFF21-\uFF3A\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])/g
},{}],69:[function(require,module,exports){
module.exports = /[^\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]+/g
},{}],70:[function(require,module,exports){
module.exports = /([\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])([^\u0030-\u0039\u00B2\u00B3\u00B9\u00BC-\u00BE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D66-\u0D75\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19])/g
},{}],71:[function(require,module,exports){
var sentenceCase = require('sentence-case');
/**
* Param case a string.
*
* @param {String} string
* @param {String} [locale]
* @return {String}
*/
module.exports = function (string, locale) {
return sentenceCase(string, locale, '-');
};
},{"sentence-case":67}],72:[function(require,module,exports){
module.exports = extend
function extend() {
var target = {}
for (var i = 0; i < arguments.length; i++) {
var source = arguments[i]
for (var key in source) {
if (source.hasOwnProperty(key)) {
target[key] = source[key]
}
}
}
return target
}
},{}],73:[function(require,module,exports){
/**
* Attribute types.
*/
var types = {
BOOLEAN: 1,
OVERLOADED_BOOLEAN: 2
};
/**
* Properties.
*
* Taken from https://github.com/facebook/react/blob/847357e42e5267b04dd6e297219eaa125ab2f9f4/src/browser/ui/dom/HTMLDOMPropertyConfig.js
*
*/
var properties = {
/**
* Standard Properties
*/
accept: true,
acceptCharset: true,
accessKey: true,
action: true,
allowFullScreen: types.BOOLEAN,
allowTransparency: true,
alt: true,
async: types.BOOLEAN,
autocomplete: true,
autofocus: types.BOOLEAN,
autoplay: types.BOOLEAN,
cellPadding: true,
cellSpacing: true,
charset: true,
checked: types.BOOLEAN,
classID: true,
className: true,
cols: true,
colSpan: true,
content: true,
contentEditable: true,
contextMenu: true,
controls: types.BOOLEAN,
coords: true,
crossOrigin: true,
data: true, // For `<object />` acts as `src`.
dateTime: true,
defer: types.BOOLEAN,
dir: true,
disabled: types.BOOLEAN,
download: types.OVERLOADED_BOOLEAN,
draggable: true,
enctype: true,
form: true,
formAction: true,
formEncType: true,
formMethod: true,
formNoValidate: types.BOOLEAN,
formTarget: true,
frameBorder: true,
headers: true,
height: true,
hidden: types.BOOLEAN,
href: true,
hreflang: true,
htmlFor: true,
httpEquiv: true,
icon: true,
id: true,
label: true,
lang: true,
list: true,
loop: types.BOOLEAN,
manifest: true,
marginHeight: true,
marginWidth: true,
max: true,
maxLength: true,
media: true,
mediaGroup: true,
method: true,
min: true,
multiple: types.BOOLEAN,
muted: types.BOOLEAN,
name: true,
noValidate: types.BOOLEAN,
open: true,
pattern: true,
placeholder: true,
poster: true,
preload: true,
radiogroup: true,
readOnly: types.BOOLEAN,
rel: true,
required: types.BOOLEAN,
role: true,
rows: true,
rowSpan: true,
sandbox: true,
scope: true,
scrolling: true,
seamless: types.BOOLEAN,
selected: types.BOOLEAN,
shape: true,
size: true,
sizes: true,
span: true,
spellcheck: true,
src: true,
srcdoc: true,
srcset: true,
start: true,
step: true,
style: true,
tabIndex: true,
target: true,
title: true,
type: true,
useMap: true,
value: true,
width: true,
wmode: true,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
autocapitalize: true,
autocorrect: true,
// itemProp, itemScope, itemType are for Microdata support. See
// http://schema.org/docs/gs.html
itemProp: true,
itemScope: types.BOOLEAN,
itemType: true,
// property is supported for OpenGraph in meta tags.
property: true
};
/**
* Properties to attributes mapping.
*
* The ones not here are simply converted to lower case.
*/
var attributeNames = {
acceptCharset: 'accept-charset',
className: 'class',
htmlFor: 'for',
httpEquiv: 'http-equiv'
};
/**
* Exports.
*/
module.exports = {
attributeTypes: types,
properties: properties,
attributeNames: attributeNames
};
},{}],74:[function(require,module,exports){
/**
* Void elements.
*
* https://github.com/facebook/react/blob/v0.12.0/src/browser/ui/ReactDOMComponent.js#L99
*/
module.exports = {
'area': true,
'base': true,
'br': true,
'col': true,
'embed': true,
'hr': true,
'img': true,
'input': true,
'keygen': true,
'link': true,
'meta': true,
'param': true,
'source': true,
'track': true,
'wbr': true
};
},{}],75:[function(require,module,exports){
var diff = require("./vtree/diff.js")
module.exports = diff
},{"./vtree/diff.js":108}],76:[function(require,module,exports){
/*!
* Cross-Browser Split 1.1.1
* Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
* Available under the MIT License
* ECMAScript compliant, uniform cross-browser split method
*/
/**
* Splits a string into an array of strings using a regex or string separator. Matches of the
* separator are not included in the result array. However, if `separator` is a regex that contains
* capturing groups, backreferences are spliced into the result each time `separator` is matched.
* Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably
* cross-browser.
* @param {String} str String to split.
* @param {RegExp|String} separator Regex or string to use for separating the string.
* @param {Number} [limit] Maximum number of items to include in the result array.
* @returns {Array} Array of substrings.
* @example
*
* // Basic use
* split('a b c d', ' ');
* // -> ['a', 'b', 'c', 'd']
*
* // With limit
* split('a b c d', ' ', 2);
* // -> ['a', 'b']
*
* // Backreferences in result array
* split('..word1 word2..', /([a-z]+)(\d+)/i);
* // -> ['..', 'word', '1', ' ', 'word', '2', '..']
*/
module.exports = (function split(undef) {
var nativeSplit = String.prototype.split,
compliantExecNpcg = /()??/.exec("")[1] === undef,
// NPCG: nonparticipating capturing group
self;
self = function(str, separator, limit) {
// If `separator` is not a regex, use `nativeSplit`
if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
return nativeSplit.call(str, separator, limit);
}
var output = [],
flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + // Proposed for ES6
(separator.sticky ? "y" : ""),
// Firefox 3+
lastLastIndex = 0,
// Make `global` and avoid `lastIndex` issues by working with a copy
separator = new RegExp(separator.source, flags + "g"),
separator2, match, lastIndex, lastLength;
str += ""; // Type-convert
if (!compliantExecNpcg) {
// Doesn't need flags gy, but they don't hurt
separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
}
/* Values for `limit`, per the spec:
* If undefined: 4294967295 // Math.pow(2, 32) - 1
* If 0, Infinity, or NaN: 0
* If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
* If negative number: 4294967296 - Math.floor(Math.abs(limit))
* If other: Type-convert, then use the above rules
*/
limit = limit === undef ? -1 >>> 0 : // Math.pow(2, 32) - 1
limit >>> 0; // ToUint32(limit)
while (match = separator.exec(str)) {
// `separator.lastIndex` is not reliable cross-browser
lastIndex = match.index + match[0].length;
if (lastIndex > lastLastIndex) {
output.push(str.slice(lastLastIndex, match.index));
// Fix browsers whose `exec` methods don't consistently return `undefined` for
// nonparticipating capturing groups
if (!compliantExecNpcg && match.length > 1) {
match[0].replace(separator2, function() {
for (var i = 1; i < arguments.length - 2; i++) {
if (arguments[i] === undef) {
match[i] = undef;
}
}
});
}
if (match.length > 1 && match.index < str.length) {
Array.prototype.push.apply(output, match.slice(1));
}
lastLength = match[0].length;
lastLastIndex = lastIndex;
if (output.length >= limit) {
break;
}
}
if (separator.lastIndex === match.index) {
separator.lastIndex++; // Avoid an infinite loop
}
}
if (lastLastIndex === str.length) {
if (lastLength || !separator.test("")) {
output.push("");
}
} else {
output.push(str.slice(lastLastIndex));
}
return output.length > limit ? output.slice(0, limit) : output;
};
return self;
})();
},{}],77:[function(require,module,exports){
'use strict';
var OneVersionConstraint = require('individual/one-version');
var MY_VERSION = '7';
OneVersionConstraint('ev-store', MY_VERSION);
var hashKey = '__EV_STORE_KEY@' + MY_VERSION;
module.exports = EvStore;
function EvStore(elem) {
var hash = elem[hashKey];
if (!hash) {
hash = elem[hashKey] = {};
}
return hash;
}
},{"individual/one-version":79}],78:[function(require,module,exports){
(function (global){
'use strict';
/*global window, global*/
var root = typeof window !== 'undefined' ?
window : typeof global !== 'undefined' ?
global : {};
module.exports = Individual;
function Individual(key, value) {
if (key in root) {
return root[key];
}
root[key] = value;
return value;
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{}],79:[function(require,module,exports){
'use strict';
var Individual = require('./index.js');
module.exports = OneVersion;
function OneVersion(moduleName, version, defaultValue) {
var key = '__INDIVIDUAL_ONE_VERSION_' + moduleName;
var enforceKey = key + '_ENFORCE_SINGLETON';
var versionValue = Individual(enforceKey, version);
if (versionValue !== version) {
throw new Error('Can only have one copy of ' +
moduleName + '.\n' +
'You already have version ' + versionValue +
' installed.\n' +
'This means you cannot install version ' + version);
}
return Individual(key, defaultValue);
}
},{"./index.js":78}],80:[function(require,module,exports){
(function (global){
var topLevel = typeof global !== 'undefined' ? global :
typeof window !== 'undefined' ? window : {}
var minDoc = require('min-document');
if (typeof document !== 'undefined') {
module.exports = document;
} else {
var doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];
if (!doccy) {
doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;
}
module.exports = doccy;
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"min-document":2}],81:[function(require,module,exports){
"use strict";
module.exports = function isObject(x) {
return typeof x === "object" && x !== null;
};
},{}],82:[function(require,module,exports){
var nativeIsArray = Array.isArray
var toString = Object.prototype.toString
module.exports = nativeIsArray || isArray
function isArray(obj) {
return toString.call(obj) === "[object Array]"
}
},{}],83:[function(require,module,exports){
var patch = require("./vdom/patch.js")
module.exports = patch
},{"./vdom/patch.js":88}],84:[function(require,module,exports){
var isObject = require("is-object")
var isHook = require("../vnode/is-vhook.js")
module.exports = applyProperties
function applyProperties(node, props, previous) {
for (var propName in props) {
var propValue = props[propName]
if (propValue === undefined) {
removeProperty(node, propName, propValue, previous);
} else if (isHook(propValue)) {
removeProperty(node, propName, propValue, previous)
if (propValue.hook) {
propValue.hook(node,
propName,
previous ? previous[propName] : undefined)
}
} else {
if (isObject(propValue)) {
patchObject(node, props, previous, propName, propValue);
} else {
node[propName] = propValue
}
}
}
}
function removeProperty(node, propName, propValue, previous) {
if (previous) {
var previousValue = previous[propName]
if (!isHook(previousValue)) {
if (propName === "attributes") {
for (var attrName in previousValue) {
node.removeAttribute(attrName)
}
} else if (propName === "style") {
for (var i in previousValue) {
node.style[i] = ""
}
} else if (typeof previousValue === "string") {
node[propName] = ""
} else {
node[propName] = null
}
} else if (previousValue.unhook) {
previousValue.unhook(node, propName, propValue)
}
}
}
function patchObject(node, props, previous, propName, propValue) {
var previousValue = previous ? previous[propName] : undefined
// Set attributes
if (propName === "attributes") {
for (var attrName in propValue) {
var attrValue = propValue[attrName]
if (attrValue === undefined) {
node.removeAttribute(attrName)
} else {
node.setAttribute(attrName, attrValue)
}
}
return
}
if(previousValue && isObject(previousValue) &&
getPrototype(previousValue) !== getPrototype(propValue)) {
node[propName] = propValue
return
}
if (!isObject(node[propName])) {
node[propName] = {}
}
var replacer = propName === "style" ? "" : undefined
for (var k in propValue) {
var value = propValue[k]
node[propName][k] = (value === undefined) ? replacer : value
}
}
function getPrototype(value) {
if (Object.getPrototypeOf) {
return Object.getPrototypeOf(value)
} else if (value.__proto__) {
return value.__proto__
} else if (value.constructor) {
return value.constructor.prototype
}
}
},{"../vnode/is-vhook.js":99,"is-object":81}],85:[function(require,module,exports){
var document = require("global/document")
var applyProperties = require("./apply-properties")
var isVNode = require("../vnode/is-vnode.js")
var isVText = require("../vnode/is-vtext.js")
var isWidget = require("../vnode/is-widget.js")
var handleThunk = require("../vnode/handle-thunk.js")
module.exports = createElement
function createElement(vnode, opts) {
var doc = opts ? opts.document || document : document
var warn = opts ? opts.warn : null
vnode = handleThunk(vnode).a
if (isWidget(vnode)) {
return vnode.init()
} else if (isVText(vnode)) {
return doc.createTextNode(vnode.text)
} else if (!isVNode(vnode)) {
if (warn) {
warn("Item is not a valid virtual dom node", vnode)
}
return null
}
var node = (vnode.namespace === null) ?
doc.createElement(vnode.tagName) :
doc.createElementNS(vnode.namespace, vnode.tagName)
var props = vnode.properties
applyProperties(node, props)
var children = vnode.children
for (var i = 0; i < children.length; i++) {
var childNode = createElement(children[i], opts)
if (childNode) {
node.appendChild(childNode)
}
}
return node
}
},{"../vnode/handle-thunk.js":97,"../vnode/is-vnode.js":100,"../vnode/is-vtext.js":101,"../vnode/is-widget.js":102,"./apply-properties":84,"global/document":80}],86:[function(require,module,exports){
// Maps a virtual DOM tree onto a real DOM tree in an efficient manner.
// We don't want to read all of the DOM nodes in the tree so we use
// the in-order tree indexing to eliminate recursion down certain branches.
// We only recurse into a DOM node if we know that it contains a child of
// interest.
var noChild = {}
module.exports = domIndex
function domIndex(rootNode, tree, indices, nodes) {
if (!indices || indices.length === 0) {
return {}
} else {
indices.sort(ascending)
return recurse(rootNode, tree, indices, nodes, 0)
}
}
function recurse(rootNode, tree, indices, nodes, rootIndex) {
nodes = nodes || {}
if (rootNode) {
if (indexInRange(indices, rootIndex, rootIndex)) {
nodes[rootIndex] = rootNode
}
var vChildren = tree.children
if (vChildren) {
var childNodes = rootNode.childNodes
for (var i = 0; i < tree.children.length; i++) {
rootIndex += 1
var vChild = vChildren[i] || noChild
var nextIndex = rootIndex + (vChild.count || 0)
// skip recursion down the tree if there are no nodes down here
if (indexInRange(indices, rootIndex, nextIndex)) {
recurse(childNodes[i], vChild, indices, nodes, rootIndex)
}
rootIndex = nextIndex
}
}
}
return nodes
}
// Binary search for an index in the interval [left, right]
function indexInRange(indices, left, right) {
if (indices.length === 0) {
return false
}
var minIndex = 0
var maxIndex = indices.length - 1
var currentIndex
var currentItem
while (minIndex <= maxIndex) {
currentIndex = ((maxIndex + minIndex) / 2) >> 0
currentItem = indices[currentIndex]
if (minIndex === maxIndex) {
return currentItem >= left && currentItem <= right
} else if (currentItem < left) {
minIndex = currentIndex + 1
} else if (currentItem > right) {
maxIndex = currentIndex - 1
} else {
return true
}
}
return false;
}
function ascending(a, b) {
return a > b ? 1 : -1
}
},{}],87:[function(require,module,exports){
var applyProperties = require("./apply-properties")
var isWidget = require("../vnode/is-widget.js")
var VPatch = require("../vnode/vpatch.js")
var updateWidget = require("./update-widget")
module.exports = applyPatch
function applyPatch(vpatch, domNode, renderOptions) {
var type = vpatch.type
var vNode = vpatch.vNode
var patch = vpatch.patch
switch (type) {
case VPatch.REMOVE:
return removeNode(domNode, vNode)
case VPatch.INSERT:
return insertNode(domNode, patch, renderOptions)
case VPatch.VTEXT:
return stringPatch(domNode, vNode, patch, renderOptions)
case VPatch.WIDGET:
return widgetPatch(domNode, vNode, patch, renderOptions)
case VPatch.VNODE:
return vNodePatch(domNode, vNode, patch, renderOptions)
case VPatch.ORDER:
reorderChildren(domNode, patch)
return domNode
case VPatch.PROPS:
applyProperties(domNode, patch, vNode.properties)
return domNode
case VPatch.THUNK:
return replaceRoot(domNode,
renderOptions.patch(domNode, patch, renderOptions))
default:
return domNode
}
}
function removeNode(domNode, vNode) {
var parentNode = domNode.parentNode
if (parentNode) {
parentNode.removeChild(domNode)
}
destroyWidget(domNode, vNode);
return null
}
function insertNode(parentNode, vNode, renderOptions) {
var newNode = renderOptions.render(vNode, renderOptions)
if (parentNode) {
parentNode.appendChild(newNode)
}
return parentNode
}
function stringPatch(domNode, leftVNode, vText, renderOptions) {
var newNode
if (domNode.nodeType === 3) {
domNode.replaceData(0, domNode.length, vText.text)
newNode = domNode
} else {
var parentNode = domNode.parentNode
newNode = renderOptions.render(vText, renderOptions)
if (parentNode && newNode !== domNode) {
parentNode.replaceChild(newNode, domNode)
}
}
return newNode
}
function widgetPatch(domNode, leftVNode, widget, renderOptions) {
var updating = updateWidget(leftVNode, widget)
var newNode
if (updating) {
newNode = widget.update(leftVNode, domNode) || domNode
} else {
newNode = renderOptions.render(widget, renderOptions)
}
var parentNode = domNode.parentNode
if (parentNode && newNode !== domNode) {
parentNode.replaceChild(newNode, domNode)
}
if (!updating) {
destroyWidget(domNode, leftVNode)
}
return newNode
}
function vNodePatch(domNode, leftVNode, vNode, renderOptions) {
var parentNode = domNode.parentNode
var newNode = renderOptions.render(vNode, renderOptions)
if (parentNode && newNode !== domNode) {
parentNode.replaceChild(newNode, domNode)
}
return newNode
}
function destroyWidget(domNode, w) {
if (typeof w.destroy === "function" && isWidget(w)) {
w.destroy(domNode)
}
}
function reorderChildren(domNode, moves) {
var childNodes = domNode.childNodes
var keyMap = {}
var node
var remove
var insert
for (var i = 0; i < moves.removes.length; i++) {
remove = moves.removes[i]
node = childNodes[remove.from]
if (remove.key) {
keyMap[remove.key] = node
}
domNode.removeChild(node)
}
var length = childNodes.length
for (var j = 0; j < moves.inserts.length; j++) {
insert = moves.inserts[j]
node = keyMap[insert.key]
// this is the weirdest bug i've ever seen in webkit
domNode.insertBefore(node, insert.to >= length++ ? null : childNodes[insert.to])
}
}
function replaceRoot(oldRoot, newRoot) {
if (oldRoot && newRoot && oldRoot !== newRoot && oldRoot.parentNode) {
oldRoot.parentNode.replaceChild(newRoot, oldRoot)
}
return newRoot;
}
},{"../vnode/is-widget.js":102,"../vnode/vpatch.js":105,"./apply-properties":84,"./update-widget":89}],88:[function(require,module,exports){
var document = require("global/document")
var isArray = require("x-is-array")
var render = require("./create-element")
var domIndex = require("./dom-index")
var patchOp = require("./patch-op")
module.exports = patch
function patch(rootNode, patches, renderOptions) {
renderOptions = renderOptions || {}
renderOptions.patch = renderOptions.patch || patchRecursive
renderOptions.render = renderOptions.render || render
return renderOptions.patch(rootNode, patches, renderOptions)
}
function patchRecursive(rootNode, patches, renderOptions) {
var indices = patchIndices(patches)
if (indices.length === 0) {
return rootNode
}
var index = domIndex(rootNode, patches.a, indices)
var ownerDocument = rootNode.ownerDocument
if (!renderOptions.document && ownerDocument !== document) {
renderOptions.document = ownerDocument
}
for (var i = 0; i < indices.length; i++) {
var nodeIndex = indices[i]
rootNode = applyPatch(rootNode,
index[nodeIndex],
patches[nodeIndex],
renderOptions)
}
return rootNode
}
function applyPatch(rootNode, domNode, patchList, renderOptions) {
if (!domNode) {
return rootNode
}
var newNode
if (isArray(patchList)) {
for (var i = 0; i < patchList.length; i++) {
newNode = patchOp(patchList[i], domNode, renderOptions)
if (domNode === rootNode) {
rootNode = newNode
}
}
} else {
newNode = patchOp(patchList, domNode, renderOptions)
if (domNode === rootNode) {
rootNode = newNode
}
}
return rootNode
}
function patchIndices(patches) {
var indices = []
for (var key in patches) {
if (key !== "a") {
indices.push(Number(key))
}
}
return indices
}
},{"./create-element":85,"./dom-index":86,"./patch-op":87,"global/document":80,"x-is-array":82}],89:[function(require,module,exports){
var isWidget = require("../vnode/is-widget.js")
module.exports = updateWidget
function updateWidget(a, b) {
if (isWidget(a) && isWidget(b)) {
if ("name" in a && "name" in b) {
return a.id === b.id
} else {
return a.init === b.init
}
}
return false
}
},{"../vnode/is-widget.js":102}],90:[function(require,module,exports){
'use strict';
module.exports = AttributeHook;
function AttributeHook(namespace, value) {
if (!(this instanceof AttributeHook)) {
return new AttributeHook(namespace, value);
}
this.namespace = namespace;
this.value = value;
}
AttributeHook.prototype.hook = function (node, prop, prev) {
if (prev && prev.type === 'AttributeHook' &&
prev.value === this.value &&
prev.namespace === this.namespace) {
return;
}
node.setAttributeNS(this.namespace, prop, this.value);
};
AttributeHook.prototype.unhook = function (node, prop, next) {
if (next && next.type === 'AttributeHook' &&
next.namespace === this.namespace) {
return;
}
var colonPosition = prop.indexOf(':');
var localName = colonPosition > -1 ? prop.substr(colonPosition + 1) : prop;
node.removeAttributeNS(this.namespace, localName);
};
AttributeHook.prototype.type = 'AttributeHook';
},{}],91:[function(require,module,exports){
'use strict';
var EvStore = require('ev-store');
module.exports = EvHook;
function EvHook(value) {
if (!(this instanceof EvHook)) {
return new EvHook(value);
}
this.value = value;
}
EvHook.prototype.hook = function (node, propertyName) {
var es = EvStore(node);
var propName = propertyName.substr(3);
es[propName] = this.value;
};
EvHook.prototype.unhook = function(node, propertyName) {
var es = EvStore(node);
var propName = propertyName.substr(3);
es[propName] = undefined;
};
},{"ev-store":77}],92:[function(require,module,exports){
'use strict';
module.exports = SoftSetHook;
function SoftSetHook(value) {
if (!(this instanceof SoftSetHook)) {
return new SoftSetHook(value);
}
this.value = value;
}
SoftSetHook.prototype.hook = function (node, propertyName) {
if (node[propertyName] !== this.value) {
node[propertyName] = this.value;
}
};
},{}],93:[function(require,module,exports){
'use strict';
var isArray = require('x-is-array');
var VNode = require('../vnode/vnode.js');
var VText = require('../vnode/vtext.js');
var isVNode = require('../vnode/is-vnode');
var isVText = require('../vnode/is-vtext');
var isWidget = require('../vnode/is-widget');
var isHook = require('../vnode/is-vhook');
var isVThunk = require('../vnode/is-thunk');
var parseTag = require('./parse-tag.js');
var softSetHook = require('./hooks/soft-set-hook.js');
var evHook = require('./hooks/ev-hook.js');
module.exports = h;
function h(tagName, properties, children) {
var childNodes = [];
var tag, props, key, namespace;
if (!children && isChildren(properties)) {
children = properties;
props = {};
}
props = props || properties || {};
tag = parseTag(tagName, props);
// support keys
if (props.hasOwnProperty('key')) {
key = props.key;
props.key = undefined;
}
// support namespace
if (props.hasOwnProperty('namespace')) {
namespace = props.namespace;
props.namespace = undefined;
}
// fix cursor bug
if (tag === 'INPUT' &&
!namespace &&
props.hasOwnProperty('value') &&
props.value !== undefined &&
!isHook(props.value)
) {
props.value = softSetHook(props.value);
}
transformProperties(props);
if (children !== undefined && children !== null) {
addChild(children, childNodes, tag, props);
}
return new VNode(tag, props, childNodes, key, namespace);
}
function addChild(c, childNodes, tag, props) {
if (typeof c === 'string') {
childNodes.push(new VText(c));
} else if (typeof c === 'number') {
childNodes.push(new VText(String(c)));
} else if (isChild(c)) {
childNodes.push(c);
} else if (isArray(c)) {
for (var i = 0; i < c.length; i++) {
addChild(c[i], childNodes, tag, props);
}
} else if (c === null || c === undefined) {
return;
} else {
throw UnexpectedVirtualElement({
foreignObject: c,
parentVnode: {
tagName: tag,
properties: props
}
});
}
}
function transformProperties(props) {
for (var propName in props) {
if (props.hasOwnProperty(propName)) {
var value = props[propName];
if (isHook(value)) {
continue;
}
if (propName.substr(0, 3) === 'ev-') {
// add ev-foo support
props[propName] = evHook(value);
}
}
}
}
function isChild(x) {
return isVNode(x) || isVText(x) || isWidget(x) || isVThunk(x);
}
function isChildren(x) {
return typeof x === 'string' || isArray(x) || isChild(x);
}
function UnexpectedVirtualElement(data) {
var err = new Error();
err.type = 'virtual-hyperscript.unexpected.virtual-element';
err.message = 'Unexpected virtual child passed to h().\n' +
'Expected a VNode / Vthunk / VWidget / string but:\n' +
'got:\n' +
errorString(data.foreignObject) +
'.\n' +
'The parent vnode is:\n' +
errorString(data.parentVnode)
'\n' +
'Suggested fix: change your `h(..., [ ... ])` callsite.';
err.foreignObject = data.foreignObject;
err.parentVnode = data.parentVnode;
return err;
}
function errorString(obj) {
try {
return JSON.stringify(obj, null, ' ');
} catch (e) {
return String(obj);
}
}
},{"../vnode/is-thunk":98,"../vnode/is-vhook":99,"../vnode/is-vnode":100,"../vnode/is-vtext":101,"../vnode/is-widget":102,"../vnode/vnode.js":104,"../vnode/vtext.js":106,"./hooks/ev-hook.js":91,"./hooks/soft-set-hook.js":92,"./parse-tag.js":94,"x-is-array":82}],94:[function(require,module,exports){
'use strict';
var split = require('browser-split');
var classIdSplit = /([\.#]?[a-zA-Z0-9\u007F-\uFFFF_:-]+)/;
var notClassId = /^\.|#/;
module.exports = parseTag;
function parseTag(tag, props) {
if (!tag) {
return 'DIV';
}
var noId = !(props.hasOwnProperty('id'));
var tagParts = split(tag, classIdSplit);
var tagName = null;
if (notClassId.test(tagParts[1])) {
tagName = 'DIV';
}
var classes, part, type, i;
for (i = 0; i < tagParts.length; i++) {
part = tagParts[i];
if (!part) {
continue;
}
type = part.charAt(0);
if (!tagName) {
tagName = part;
} else if (type === '.') {
classes = classes || [];
classes.push(part.substring(1, part.length));
} else if (type === '#' && noId) {
props.id = part.substring(1, part.length);
}
}
if (classes) {
if (props.className) {
classes.push(props.className);
}
props.className = classes.join(' ');
}
return props.namespace ? tagName : tagName.toUpperCase();
}
},{"browser-split":76}],95:[function(require,module,exports){
'use strict';
var DEFAULT_NAMESPACE = null;
var EV_NAMESPACE = 'http://www.w3.org/2001/xml-events';
var XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
var XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';
// http://www.w3.org/TR/SVGTiny12/attributeTable.html
// http://www.w3.org/TR/SVG/attindex.html
var SVG_PROPERTIES = {
'about': DEFAULT_NAMESPACE,
'accent-height': DEFAULT_NAMESPACE,
'accumulate': DEFAULT_NAMESPACE,
'additive': DEFAULT_NAMESPACE,
'alignment-baseline': DEFAULT_NAMESPACE,
'alphabetic': DEFAULT_NAMESPACE,
'amplitude': DEFAULT_NAMESPACE,
'arabic-form': DEFAULT_NAMESPACE,
'ascent': DEFAULT_NAMESPACE,
'attributeName': DEFAULT_NAMESPACE,
'attributeType': DEFAULT_NAMESPACE,
'azimuth': DEFAULT_NAMESPACE,
'bandwidth': DEFAULT_NAMESPACE,
'baseFrequency': DEFAULT_NAMESPACE,
'baseProfile': DEFAULT_NAMESPACE,
'baseline-shift': DEFAULT_NAMESPACE,
'bbox': DEFAULT_NAMESPACE,
'begin': DEFAULT_NAMESPACE,
'bias': DEFAULT_NAMESPACE,
'by': DEFAULT_NAMESPACE,
'calcMode': DEFAULT_NAMESPACE,
'cap-height': DEFAULT_NAMESPACE,
'class': DEFAULT_NAMESPACE,
'clip': DEFAULT_NAMESPACE,
'clip-path': DEFAULT_NAMESPACE,
'clip-rule': DEFAULT_NAMESPACE,
'clipPathUnits': DEFAULT_NAMESPACE,
'color': DEFAULT_NAMESPACE,
'color-interpolation': DEFAULT_NAMESPACE,
'color-interpolation-filters': DEFAULT_NAMESPACE,
'color-profile': DEFAULT_NAMESPACE,
'color-rendering': DEFAULT_NAMESPACE,
'content': DEFAULT_NAMESPACE,
'contentScriptType': DEFAULT_NAMESPACE,
'contentStyleType': DEFAULT_NAMESPACE,
'cursor': DEFAULT_NAMESPACE,
'cx': DEFAULT_NAMESPACE,
'cy': DEFAULT_NAMESPACE,
'd': DEFAULT_NAMESPACE,
'datatype': DEFAULT_NAMESPACE,
'defaultAction': DEFAULT_NAMESPACE,
'descent': DEFAULT_NAMESPACE,
'diffuseConstant': DEFAULT_NAMESPACE,
'direction': DEFAULT_NAMESPACE,
'display': DEFAULT_NAMESPACE,
'divisor': DEFAULT_NAMESPACE,
'dominant-baseline': DEFAULT_NAMESPACE,
'dur': DEFAULT_NAMESPACE,
'dx': DEFAULT_NAMESPACE,
'dy': DEFAULT_NAMESPACE,
'edgeMode': DEFAULT_NAMESPACE,
'editable': DEFAULT_NAMESPACE,
'elevation': DEFAULT_NAMESPACE,
'enable-background': DEFAULT_NAMESPACE,
'end': DEFAULT_NAMESPACE,
'ev:event': EV_NAMESPACE,
'event': DEFAULT_NAMESPACE,
'exponent': DEFAULT_NAMESPACE,
'externalResourcesRequired': DEFAULT_NAMESPACE,
'fill': DEFAULT_NAMESPACE,
'fill-opacity': DEFAULT_NAMESPACE,
'fill-rule': DEFAULT_NAMESPACE,
'filter': DEFAULT_NAMESPACE,
'filterRes': DEFAULT_NAMESPACE,
'filterUnits': DEFAULT_NAMESPACE,
'flood-color': DEFAULT_NAMESPACE,
'flood-opacity': DEFAULT_NAMESPACE,
'focusHighlight': DEFAULT_NAMESPACE,
'focusable': DEFAULT_NAMESPACE,
'font-family': DEFAULT_NAMESPACE,
'font-size': DEFAULT_NAMESPACE,
'font-size-adjust': DEFAULT_NAMESPACE,
'font-stretch': DEFAULT_NAMESPACE,
'font-style': DEFAULT_NAMESPACE,
'font-variant': DEFAULT_NAMESPACE,
'font-weight': DEFAULT_NAMESPACE,
'format': DEFAULT_NAMESPACE,
'from': DEFAULT_NAMESPACE,
'fx': DEFAULT_NAMESPACE,
'fy': DEFAULT_NAMESPACE,
'g1': DEFAULT_NAMESPACE,
'g2': DEFAULT_NAMESPACE,
'glyph-name': DEFAULT_NAMESPACE,
'glyph-orientation-horizontal': DEFAULT_NAMESPACE,
'glyph-orientation-vertical': DEFAULT_NAMESPACE,
'glyphRef': DEFAULT_NAMESPACE,
'gradientTransform': DEFAULT_NAMESPACE,
'gradientUnits': DEFAULT_NAMESPACE,
'handler': DEFAULT_NAMESPACE,
'hanging': DEFAULT_NAMESPACE,
'height': DEFAULT_NAMESPACE,
'horiz-adv-x': DEFAULT_NAMESPACE,
'horiz-origin-x': DEFAULT_NAMESPACE,
'horiz-origin-y': DEFAULT_NAMESPACE,
'id': DEFAULT_NAMESPACE,
'ideographic': DEFAULT_NAMESPACE,
'image-rendering': DEFAULT_NAMESPACE,
'in': DEFAULT_NAMESPACE,
'in2': DEFAULT_NAMESPACE,
'initialVisibility': DEFAULT_NAMESPACE,
'intercept': DEFAULT_NAMESPACE,
'k': DEFAULT_NAMESPACE,
'k1': DEFAULT_NAMESPACE,
'k2': DEFAULT_NAMESPACE,
'k3': DEFAULT_NAMESPACE,
'k4': DEFAULT_NAMESPACE,
'kernelMatrix': DEFAULT_NAMESPACE,
'kernelUnitLength': DEFAULT_NAMESPACE,
'kerning': DEFAULT_NAMESPACE,
'keyPoints': DEFAULT_NAMESPACE,
'keySplines': DEFAULT_NAMESPACE,
'keyTimes': DEFAULT_NAMESPACE,
'lang': DEFAULT_NAMESPACE,
'lengthAdjust': DEFAULT_NAMESPACE,
'letter-spacing': DEFAULT_NAMESPACE,
'lighting-color': DEFAULT_NAMESPACE,
'limitingConeAngle': DEFAULT_NAMESPACE,
'local': DEFAULT_NAMESPACE,
'marker-end': DEFAULT_NAMESPACE,
'marker-mid': DEFAULT_NAMESPACE,
'marker-start': DEFAULT_NAMESPACE,
'markerHeight': DEFAULT_NAMESPACE,
'markerUnits': DEFAULT_NAMESPACE,
'markerWidth': DEFAULT_NAMESPACE,
'mask': DEFAULT_NAMESPACE,
'maskContentUnits': DEFAULT_NAMESPACE,
'maskUnits': DEFAULT_NAMESPACE,
'mathematical': DEFAULT_NAMESPACE,
'max': DEFAULT_NAMESPACE,
'media': DEFAULT_NAMESPACE,
'mediaCharacterEncoding': DEFAULT_NAMESPACE,
'mediaContentEncodings': DEFAULT_NAMESPACE,
'mediaSize': DEFAULT_NAMESPACE,
'mediaTime': DEFAULT_NAMESPACE,
'method': DEFAULT_NAMESPACE,
'min': DEFAULT_NAMESPACE,
'mode': DEFAULT_NAMESPACE,
'name': DEFAULT_NAMESPACE,
'nav-down': DEFAULT_NAMESPACE,
'nav-down-left': DEFAULT_NAMESPACE,
'nav-down-right': DEFAULT_NAMESPACE,
'nav-left': DEFAULT_NAMESPACE,
'nav-next': DEFAULT_NAMESPACE,
'nav-prev': DEFAULT_NAMESPACE,
'nav-right': DEFAULT_NAMESPACE,
'nav-up': DEFAULT_NAMESPACE,
'nav-up-left': DEFAULT_NAMESPACE,
'nav-up-right': DEFAULT_NAMESPACE,
'numOctaves': DEFAULT_NAMESPACE,
'observer': DEFAULT_NAMESPACE,
'offset': DEFAULT_NAMESPACE,
'opacity': DEFAULT_NAMESPACE,
'operator': DEFAULT_NAMESPACE,
'order': DEFAULT_NAMESPACE,
'orient': DEFAULT_NAMESPACE,
'orientation': DEFAULT_NAMESPACE,
'origin': DEFAULT_NAMESPACE,
'overflow': DEFAULT_NAMESPACE,
'overlay': DEFAULT_NAMESPACE,
'overline-position': DEFAULT_NAMESPACE,
'overline-thickness': DEFAULT_NAMESPACE,
'panose-1': DEFAULT_NAMESPACE,
'path': DEFAULT_NAMESPACE,
'pathLength': DEFAULT_NAMESPACE,
'patternContentUnits': DEFAULT_NAMESPACE,
'patternTransform': DEFAULT_NAMESPACE,
'patternUnits': DEFAULT_NAMESPACE,
'phase': DEFAULT_NAMESPACE,
'playbackOrder': DEFAULT_NAMESPACE,
'pointer-events': DEFAULT_NAMESPACE,
'points': DEFAULT_NAMESPACE,
'pointsAtX': DEFAULT_NAMESPACE,
'pointsAtY': DEFAULT_NAMESPACE,
'pointsAtZ': DEFAULT_NAMESPACE,
'preserveAlpha': DEFAULT_NAMESPACE,
'preserveAspectRatio': DEFAULT_NAMESPACE,
'primitiveUnits': DEFAULT_NAMESPACE,
'propagate': DEFAULT_NAMESPACE,
'property': DEFAULT_NAMESPACE,
'r': DEFAULT_NAMESPACE,
'radius': DEFAULT_NAMESPACE,
'refX': DEFAULT_NAMESPACE,
'refY': DEFAULT_NAMESPACE,
'rel': DEFAULT_NAMESPACE,
'rendering-intent': DEFAULT_NAMESPACE,
'repeatCount': DEFAULT_NAMESPACE,
'repeatDur': DEFAULT_NAMESPACE,
'requiredExtensions': DEFAULT_NAMESPACE,
'requiredFeatures': DEFAULT_NAMESPACE,
'requiredFonts': DEFAULT_NAMESPACE,
'requiredFormats': DEFAULT_NAMESPACE,
'resource': DEFAULT_NAMESPACE,
'restart': DEFAULT_NAMESPACE,
'result': DEFAULT_NAMESPACE,
'rev': DEFAULT_NAMESPACE,
'role': DEFAULT_NAMESPACE,
'rotate': DEFAULT_NAMESPACE,
'rx': DEFAULT_NAMESPACE,
'ry': DEFAULT_NAMESPACE,
'scale': DEFAULT_NAMESPACE,
'seed': DEFAULT_NAMESPACE,
'shape-rendering': DEFAULT_NAMESPACE,
'slope': DEFAULT_NAMESPACE,
'snapshotTime': DEFAULT_NAMESPACE,
'spacing': DEFAULT_NAMESPACE,
'specularConstant': DEFAULT_NAMESPACE,
'specularExponent': DEFAULT_NAMESPACE,
'spreadMethod': DEFAULT_NAMESPACE,
'startOffset': DEFAULT_NAMESPACE,
'stdDeviation': DEFAULT_NAMESPACE,
'stemh': DEFAULT_NAMESPACE,
'stemv': DEFAULT_NAMESPACE,
'stitchTiles': DEFAULT_NAMESPACE,
'stop-color': DEFAULT_NAMESPACE,
'stop-opacity': DEFAULT_NAMESPACE,
'strikethrough-position': DEFAULT_NAMESPACE,
'strikethrough-thickness': DEFAULT_NAMESPACE,
'string': DEFAULT_NAMESPACE,
'stroke': DEFAULT_NAMESPACE,
'stroke-dasharray': DEFAULT_NAMESPACE,
'stroke-dashoffset': DEFAULT_NAMESPACE,
'stroke-linecap': DEFAULT_NAMESPACE,
'stroke-linejoin': DEFAULT_NAMESPACE,
'stroke-miterlimit': DEFAULT_NAMESPACE,
'stroke-opacity': DEFAULT_NAMESPACE,
'stroke-width': DEFAULT_NAMESPACE,
'surfaceScale': DEFAULT_NAMESPACE,
'syncBehavior': DEFAULT_NAMESPACE,
'syncBehaviorDefault': DEFAULT_NAMESPACE,
'syncMaster': DEFAULT_NAMESPACE,
'syncTolerance': DEFAULT_NAMESPACE,
'syncToleranceDefault': DEFAULT_NAMESPACE,
'systemLanguage': DEFAULT_NAMESPACE,
'tableValues': DEFAULT_NAMESPACE,
'target': DEFAULT_NAMESPACE,
'targetX': DEFAULT_NAMESPACE,
'targetY': DEFAULT_NAMESPACE,
'text-anchor': DEFAULT_NAMESPACE,
'text-decoration': DEFAULT_NAMESPACE,
'text-rendering': DEFAULT_NAMESPACE,
'textLength': DEFAULT_NAMESPACE,
'timelineBegin': DEFAULT_NAMESPACE,
'title': DEFAULT_NAMESPACE,
'to': DEFAULT_NAMESPACE,
'transform': DEFAULT_NAMESPACE,
'transformBehavior': DEFAULT_NAMESPACE,
'type': DEFAULT_NAMESPACE,
'typeof': DEFAULT_NAMESPACE,
'u1': DEFAULT_NAMESPACE,
'u2': DEFAULT_NAMESPACE,
'underline-position': DEFAULT_NAMESPACE,
'underline-thickness': DEFAULT_NAMESPACE,
'unicode': DEFAULT_NAMESPACE,
'unicode-bidi': DEFAULT_NAMESPACE,
'unicode-range': DEFAULT_NAMESPACE,
'units-per-em': DEFAULT_NAMESPACE,
'v-alphabetic': DEFAULT_NAMESPACE,
'v-hanging': DEFAULT_NAMESPACE,
'v-ideographic': DEFAULT_NAMESPACE,
'v-mathematical': DEFAULT_NAMESPACE,
'values': DEFAULT_NAMESPACE,
'version': DEFAULT_NAMESPACE,
'vert-adv-y': DEFAULT_NAMESPACE,
'vert-origin-x': DEFAULT_NAMESPACE,
'vert-origin-y': DEFAULT_NAMESPACE,
'viewBox': DEFAULT_NAMESPACE,
'viewTarget': DEFAULT_NAMESPACE,
'visibility': DEFAULT_NAMESPACE,
'width': DEFAULT_NAMESPACE,
'widths': DEFAULT_NAMESPACE,
'word-spacing': DEFAULT_NAMESPACE,
'writing-mode': DEFAULT_NAMESPACE,
'x': DEFAULT_NAMESPACE,
'x-height': DEFAULT_NAMESPACE,
'x1': DEFAULT_NAMESPACE,
'x2': DEFAULT_NAMESPACE,
'xChannelSelector': DEFAULT_NAMESPACE,
'xlink:actuate': XLINK_NAMESPACE,
'xlink:arcrole': XLINK_NAMESPACE,
'xlink:href': XLINK_NAMESPACE,
'xlink:role': XLINK_NAMESPACE,
'xlink:show': XLINK_NAMESPACE,
'xlink:title': XLINK_NAMESPACE,
'xlink:type': XLINK_NAMESPACE,
'xml:base': XML_NAMESPACE,
'xml:id': XML_NAMESPACE,
'xml:lang': XML_NAMESPACE,
'xml:space': XML_NAMESPACE,
'y': DEFAULT_NAMESPACE,
'y1': DEFAULT_NAMESPACE,
'y2': DEFAULT_NAMESPACE,
'yChannelSelector': DEFAULT_NAMESPACE,
'z': DEFAULT_NAMESPACE,
'zoomAndPan': DEFAULT_NAMESPACE
};
module.exports = SVGAttributeNamespace;
function SVGAttributeNamespace(value) {
if (SVG_PROPERTIES.hasOwnProperty(value)) {
return SVG_PROPERTIES[value];
}
}
},{}],96:[function(require,module,exports){
'use strict';
var isArray = require('x-is-array');
var h = require('./index.js');
var SVGAttributeNamespace = require('./svg-attribute-namespace');
var attributeHook = require('./hooks/attribute-hook');
var SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
module.exports = svg;
function svg(tagName, properties, children) {
if (!children && isChildren(properties)) {
children = properties;
properties = {};
}
properties = properties || {};
// set namespace for svg
properties.namespace = SVG_NAMESPACE;
var attributes = properties.attributes || (properties.attributes = {});
for (var key in properties) {
if (!properties.hasOwnProperty(key)) {
continue;
}
var namespace = SVGAttributeNamespace(key);
if (namespace === undefined) { // not a svg attribute
continue;
}
var value = properties[key];
if (typeof value !== 'string' &&
typeof value !== 'number' &&
typeof value !== 'boolean'
) {
continue;
}
if (namespace !== null) { // namespaced attribute
properties[key] = attributeHook(namespace, value);
continue;
}
attributes[key] = value
properties[key] = undefined
}
return h(tagName, properties, children);
}
function isChildren(x) {
return typeof x === 'string' || isArray(x);
}
},{"./hooks/attribute-hook":90,"./index.js":93,"./svg-attribute-namespace":95,"x-is-array":82}],97:[function(require,module,exports){
var isVNode = require("./is-vnode")
var isVText = require("./is-vtext")
var isWidget = require("./is-widget")
var isThunk = require("./is-thunk")
module.exports = handleThunk
function handleThunk(a, b) {
var renderedA = a
var renderedB = b
if (isThunk(b)) {
renderedB = renderThunk(b, a)
}
if (isThunk(a)) {
renderedA = renderThunk(a, null)
}
return {
a: renderedA,
b: renderedB
}
}
function renderThunk(thunk, previous) {
var renderedThunk = thunk.vnode
if (!renderedThunk) {
renderedThunk = thunk.vnode = thunk.render(previous)
}
if (!(isVNode(renderedThunk) ||
isVText(renderedThunk) ||
isWidget(renderedThunk))) {
throw new Error("thunk did not return a valid node");
}
return renderedThunk
}
},{"./is-thunk":98,"./is-vnode":100,"./is-vtext":101,"./is-widget":102}],98:[function(require,module,exports){
module.exports = isThunk
function isThunk(t) {
return t && t.type === "Thunk"
}
},{}],99:[function(require,module,exports){
module.exports = isHook
function isHook(hook) {
return hook &&
(typeof hook.hook === "function" && !hook.hasOwnProperty("hook") ||
typeof hook.unhook === "function" && !hook.hasOwnProperty("unhook"))
}
},{}],100:[function(require,module,exports){
var version = require("./version")
module.exports = isVirtualNode
function isVirtualNode(x) {
return x && x.type === "VirtualNode" && x.version === version
}
},{"./version":103}],101:[function(require,module,exports){
var version = require("./version")
module.exports = isVirtualText
function isVirtualText(x) {
return x && x.type === "VirtualText" && x.version === version
}
},{"./version":103}],102:[function(require,module,exports){
module.exports = isWidget
function isWidget(w) {
return w && w.type === "Widget"
}
},{}],103:[function(require,module,exports){
module.exports = "2"
},{}],104:[function(require,module,exports){
var version = require("./version")
var isVNode = require("./is-vnode")
var isWidget = require("./is-widget")
var isThunk = require("./is-thunk")
var isVHook = require("./is-vhook")
module.exports = VirtualNode
var noProperties = {}
var noChildren = []
function VirtualNode(tagName, properties, children, key, namespace) {
this.tagName = tagName
this.properties = properties || noProperties
this.children = children || noChildren
this.key = key != null ? String(key) : undefined
this.namespace = (typeof namespace === "string") ? namespace : null
var count = (children && children.length) || 0
var descendants = 0
var hasWidgets = false
var hasThunks = false
var descendantHooks = false
var hooks
for (var propName in properties) {
if (properties.hasOwnProperty(propName)) {
var property = properties[propName]
if (isVHook(property) && property.unhook) {
if (!hooks) {
hooks = {}
}
hooks[propName] = property
}
}
}
for (var i = 0; i < count; i++) {
var child = children[i]
if (isVNode(child)) {
descendants += child.count || 0
if (!hasWidgets && child.hasWidgets) {
hasWidgets = true
}
if (!hasThunks && child.hasThunks) {
hasThunks = true
}
if (!descendantHooks && (child.hooks || child.descendantHooks)) {
descendantHooks = true
}
} else if (!hasWidgets && isWidget(child)) {
if (typeof child.destroy === "function") {
hasWidgets = true
}
} else if (!hasThunks && isThunk(child)) {
hasThunks = true;
}
}
this.count = count + descendants
this.hasWidgets = hasWidgets
this.hasThunks = hasThunks
this.hooks = hooks
this.descendantHooks = descendantHooks
}
VirtualNode.prototype.version = version
VirtualNode.prototype.type = "VirtualNode"
},{"./is-thunk":98,"./is-vhook":99,"./is-vnode":100,"./is-widget":102,"./version":103}],105:[function(require,module,exports){
var version = require("./version")
VirtualPatch.NONE = 0
VirtualPatch.VTEXT = 1
VirtualPatch.VNODE = 2
VirtualPatch.WIDGET = 3
VirtualPatch.PROPS = 4
VirtualPatch.ORDER = 5
VirtualPatch.INSERT = 6
VirtualPatch.REMOVE = 7
VirtualPatch.THUNK = 8
module.exports = VirtualPatch
function VirtualPatch(type, vNode, patch) {
this.type = Number(type)
this.vNode = vNode
this.patch = patch
}
VirtualPatch.prototype.version = version
VirtualPatch.prototype.type = "VirtualPatch"
},{"./version":103}],106:[function(require,module,exports){
var version = require("./version")
module.exports = VirtualText
function VirtualText(text) {
this.text = String(text)
}
VirtualText.prototype.version = version
VirtualText.prototype.type = "VirtualText"
},{"./version":103}],107:[function(require,module,exports){
var isObject = require("is-object")
var isHook = require("../vnode/is-vhook")
module.exports = diffProps
function diffProps(a, b) {
var diff
for (var aKey in a) {
if (!(aKey in b)) {
diff = diff || {}
diff[aKey] = undefined
}
var aValue = a[aKey]
var bValue = b[aKey]
if (aValue === bValue) {
continue
} else if (isObject(aValue) && isObject(bValue)) {
if (getPrototype(bValue) !== getPrototype(aValue)) {
diff = diff || {}
diff[aKey] = bValue
} else if (isHook(bValue)) {
diff = diff || {}
diff[aKey] = bValue
} else {
var objectDiff = diffProps(aValue, bValue)
if (objectDiff) {
diff = diff || {}
diff[aKey] = objectDiff
}
}
} else {
diff = diff || {}
diff[aKey] = bValue
}
}
for (var bKey in b) {
if (!(bKey in a)) {
diff = diff || {}
diff[bKey] = b[bKey]
}
}
return diff
}
function getPrototype(value) {
if (Object.getPrototypeOf) {
return Object.getPrototypeOf(value)
} else if (value.__proto__) {
return value.__proto__
} else if (value.constructor) {
return value.constructor.prototype
}
}
},{"../vnode/is-vhook":99,"is-object":81}],108:[function(require,module,exports){
var isArray = require("x-is-array")
var VPatch = require("../vnode/vpatch")
var isVNode = require("../vnode/is-vnode")
var isVText = require("../vnode/is-vtext")
var isWidget = require("../vnode/is-widget")
var isThunk = require("../vnode/is-thunk")
var handleThunk = require("../vnode/handle-thunk")
var diffProps = require("./diff-props")
module.exports = diff
function diff(a, b) {
var patch = { a: a }
walk(a, b, patch, 0)
return patch
}
function walk(a, b, patch, index) {
if (a === b) {
return
}
var apply = patch[index]
var applyClear = false
if (isThunk(a) || isThunk(b)) {
thunks(a, b, patch, index)
} else if (b == null) {
// If a is a widget we will add a remove patch for it
// Otherwise any child widgets/hooks must be destroyed.
// This prevents adding two remove patches for a widget.
if (!isWidget(a)) {
clearState(a, patch, index)
apply = patch[index]
}
apply = appendPatch(apply, new VPatch(VPatch.REMOVE, a, b))
} else if (isVNode(b)) {
if (isVNode(a)) {
if (a.tagName === b.tagName &&
a.namespace === b.namespace &&
a.key === b.key) {
var propsPatch = diffProps(a.properties, b.properties)
if (propsPatch) {
apply = appendPatch(apply,
new VPatch(VPatch.PROPS, a, propsPatch))
}
apply = diffChildren(a, b, patch, apply, index)
} else {
apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))
applyClear = true
}
} else {
apply = appendPatch(apply, new VPatch(VPatch.VNODE, a, b))
applyClear = true
}
} else if (isVText(b)) {
if (!isVText(a)) {
apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))
applyClear = true
} else if (a.text !== b.text) {
apply = appendPatch(apply, new VPatch(VPatch.VTEXT, a, b))
}
} else if (isWidget(b)) {
if (!isWidget(a)) {
applyClear = true
}
apply = appendPatch(apply, new VPatch(VPatch.WIDGET, a, b))
}
if (apply) {
patch[index] = apply
}
if (applyClear) {
clearState(a, patch, index)
}
}
function diffChildren(a, b, patch, apply, index) {
var aChildren = a.children
var orderedSet = reorder(aChildren, b.children)
var bChildren = orderedSet.children
var aLen = aChildren.length
var bLen = bChildren.length
var len = aLen > bLen ? aLen : bLen
for (var i = 0; i < len; i++) {
var leftNode = aChildren[i]
var rightNode = bChildren[i]
index += 1
if (!leftNode) {
if (rightNode) {
// Excess nodes in b need to be added
apply = appendPatch(apply,
new VPatch(VPatch.INSERT, null, rightNode))
}
} else {
walk(leftNode, rightNode, patch, index)
}
if (isVNode(leftNode) && leftNode.count) {
index += leftNode.count
}
}
if (orderedSet.moves) {
// Reorder nodes last
apply = appendPatch(apply, new VPatch(
VPatch.ORDER,
a,
orderedSet.moves
))
}
return apply
}
function clearState(vNode, patch, index) {
// TODO: Make this a single walk, not two
unhook(vNode, patch, index)
destroyWidgets(vNode, patch, index)
}
// Patch records for all destroyed widgets must be added because we need
// a DOM node reference for the destroy function
function destroyWidgets(vNode, patch, index) {
if (isWidget(vNode)) {
if (typeof vNode.destroy === "function") {
patch[index] = appendPatch(
patch[index],
new VPatch(VPatch.REMOVE, vNode, null)
)
}
} else if (isVNode(vNode) && (vNode.hasWidgets || vNode.hasThunks)) {
var children = vNode.children
var len = children.length
for (var i = 0; i < len; i++) {
var child = children[i]
index += 1
destroyWidgets(child, patch, index)
if (isVNode(child) && child.count) {
index += child.count
}
}
} else if (isThunk(vNode)) {
thunks(vNode, null, patch, index)
}
}
// Create a sub-patch for thunks
function thunks(a, b, patch, index) {
var nodes = handleThunk(a, b)
var thunkPatch = diff(nodes.a, nodes.b)
if (hasPatches(thunkPatch)) {
patch[index] = new VPatch(VPatch.THUNK, null, thunkPatch)
}
}
function hasPatches(patch) {
for (var index in patch) {
if (index !== "a") {
return true
}
}
return false
}
// Execute hooks when two nodes are identical
function unhook(vNode, patch, index) {
if (isVNode(vNode)) {
if (vNode.hooks) {
patch[index] = appendPatch(
patch[index],
new VPatch(
VPatch.PROPS,
vNode,
undefinedKeys(vNode.hooks)
)
)
}
if (vNode.descendantHooks || vNode.hasThunks) {
var children = vNode.children
var len = children.length
for (var i = 0; i < len; i++) {
var child = children[i]
index += 1
unhook(child, patch, index)
if (isVNode(child) && child.count) {
index += child.count
}
}
}
} else if (isThunk(vNode)) {
thunks(vNode, null, patch, index)
}
}
function undefinedKeys(obj) {
var result = {}
for (var key in obj) {
result[key] = undefined
}
return result
}
// List diff, naive left to right reordering
function reorder(aChildren, bChildren) {
// O(M) time, O(M) memory
var bChildIndex = keyIndex(bChildren)
var bKeys = bChildIndex.keys
var bFree = bChildIndex.free
if (bFree.length === bChildren.length) {
return {
children: bChildren,
moves: null
}
}
// O(N) time, O(N) memory
var aChildIndex = keyIndex(aChildren)
var aKeys = aChildIndex.keys
var aFree = aChildIndex.free
if (aFree.length === aChildren.length) {
return {
children: bChildren,
moves: null
}
}
// O(MAX(N, M)) memory
var newChildren = []
var freeIndex = 0
var freeCount = bFree.length
var deletedItems = 0
// Iterate through a and match a node in b
// O(N) time,
for (var i = 0 ; i < aChildren.length; i++) {
var aItem = aChildren[i]
var itemIndex
if (aItem.key) {
if (bKeys.hasOwnProperty(aItem.key)) {
// Match up the old keys
itemIndex = bKeys[aItem.key]
newChildren.push(bChildren[itemIndex])
} else {
// Remove old keyed items
itemIndex = i - deletedItems++
newChildren.push(null)
}
} else {
// Match the item in a with the next free item in b
if (freeIndex < freeCount) {
itemIndex = bFree[freeIndex++]
newChildren.push(bChildren[itemIndex])
} else {
// There are no free items in b to match with
// the free items in a, so the extra free nodes
// are deleted.
itemIndex = i - deletedItems++
newChildren.push(null)
}
}
}
var lastFreeIndex = freeIndex >= bFree.length ?
bChildren.length :
bFree[freeIndex]
// Iterate through b and append any new keys
// O(M) time
for (var j = 0; j < bChildren.length; j++) {
var newItem = bChildren[j]
if (newItem.key) {
if (!aKeys.hasOwnProperty(newItem.key)) {
// Add any new keyed items
// We are adding new items to the end and then sorting them
// in place. In future we should insert new items in place.
newChildren.push(newItem)
}
} else if (j >= lastFreeIndex) {
// Add any leftover non-keyed items
newChildren.push(newItem)
}
}
var simulate = newChildren.slice()
var simulateIndex = 0
var removes = []
var inserts = []
var simulateItem
for (var k = 0; k < bChildren.length;) {
var wantedItem = bChildren[k]
simulateItem = simulate[simulateIndex]
// remove items
while (simulateItem === null && simulate.length) {
removes.push(remove(simulate, simulateIndex, null))
simulateItem = simulate[simulateIndex]
}
if (!simulateItem || simulateItem.key !== wantedItem.key) {
// if we need a key in this position...
if (wantedItem.key) {
if (simulateItem && simulateItem.key) {
// if an insert doesn't put this key in place, it needs to move
if (bKeys[simulateItem.key] !== k + 1) {
removes.push(remove(simulate, simulateIndex, simulateItem.key))
simulateItem = simulate[simulateIndex]
// if the remove didn't put the wanted item in place, we need to insert it
if (!simulateItem || simulateItem.key !== wantedItem.key) {
inserts.push({key: wantedItem.key, to: k})
}
// items are matching, so skip ahead
else {
simulateIndex++
}
}
else {
inserts.push({key: wantedItem.key, to: k})
}
}
else {
inserts.push({key: wantedItem.key, to: k})
}
k++
}
// a key in simulate has no matching wanted key, remove it
else if (simulateItem && simulateItem.key) {
removes.push(remove(simulate, simulateIndex, simulateItem.key))
}
}
else {
simulateIndex++
k++
}
}
// remove all the remaining nodes from simulate
while(simulateIndex < simulate.length) {
simulateItem = simulate[simulateIndex]
removes.push(remove(simulate, simulateIndex, simulateItem && simulateItem.key))
}
// If the only moves we have are deletes then we can just
// let the delete patch remove these items.
if (removes.length === deletedItems && !inserts.length) {
return {
children: newChildren,
moves: null
}
}
return {
children: newChildren,
moves: {
removes: removes,
inserts: inserts
}
}
}
function remove(arr, index, key) {
arr.splice(index, 1)
return {
from: index,
key: key
}
}
function keyIndex(children) {
var keys = {}
var free = []
var length = children.length
for (var i = 0; i < length; i++) {
var child = children[i]
if (child.key) {
keys[child.key] = i
} else {
free.push(i)
}
}
return {
keys: keys, // A hash of key name to index
free: free // An array of unkeyed item indices
}
}
function appendPatch(apply, patch) {
if (apply) {
if (isArray(apply)) {
apply.push(patch)
} else {
apply = [apply, patch]
}
return apply
} else {
return patch
}
}
},{"../vnode/handle-thunk":97,"../vnode/is-thunk":98,"../vnode/is-vnode":100,"../vnode/is-vtext":101,"../vnode/is-widget":102,"../vnode/vpatch":105,"./diff-props":107,"x-is-array":82}],109:[function(require,module,exports){
"use strict";
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 _require = require("@cycle/core");
var Rx = _require.Rx;
var ALL_PROPS = "*";
var PROPS_DRIVER_NAME = "props";
var EVENTS_SINK_NAME = "events";
function makeDispatchFunction(element, eventName) {
return function dispatchCustomEvent(evData) {
//console.log(`%cdispatchCustomEvent ` + eventName,
// `background-color: #CCCCFF; color: black`);
var event = undefined;
try {
event = new Event(eventName);
} catch (err) {
event = document.createEvent("Event");
event.initEvent(eventName, true, true);
}
event.detail = evData;
element.dispatchEvent(event);
};
}
function subscribeDispatchers(element) {
var customEvents = element.cycleCustomElementMetadata.customEvents;
var disposables = new Rx.CompositeDisposable();
for (var _name in customEvents) {
if (customEvents.hasOwnProperty(_name) && typeof customEvents[_name].subscribe === "function") {
var disposable = customEvents[_name].subscribe(makeDispatchFunction(element, _name));
disposables.add(disposable);
}
}
return disposables;
}
function subscribeDispatchersWhenRootChanges(metadata) {
return metadata.rootElem$.distinctUntilChanged(Rx.helpers.identity, function (x, y) {
return x && y && x.isEqualNode && x.isEqualNode(y);
}).subscribe(function resubscribeDispatchers(rootElem) {
if (metadata.eventDispatchingSubscription) {
metadata.eventDispatchingSubscription.dispose();
}
metadata.eventDispatchingSubscription = subscribeDispatchers(rootElem);
});
}
function subscribeEventDispatchingSink(element, widget) {
element.cycleCustomElementMetadata.eventDispatchingSubscription = subscribeDispatchers(element);
widget.disposables.add(element.cycleCustomElementMetadata.eventDispatchingSubscription);
widget.disposables.add(subscribeDispatchersWhenRootChanges(element.cycleCustomElementMetadata));
}
function makePropertiesDriver() {
var propertiesDriver = {};
var defaultComparer = Rx.helpers.defaultComparer;
Object.defineProperty(propertiesDriver, "type", {
enumerable: false,
value: "PropertiesDriver"
});
Object.defineProperty(propertiesDriver, "get", {
enumerable: false,
value: function get(streamKey) {
var comparer = arguments.length <= 1 || arguments[1] === undefined ? defaultComparer : arguments[1];
if (typeof streamKey === "undefined") {
throw new Error("Custom element driver `props.get()` expects an " + "argument in the getter.");
}
if (typeof this[streamKey] === "undefined") {
this[streamKey] = new Rx.ReplaySubject(1);
}
return this[streamKey].distinctUntilChanged(Rx.helpers.identity, comparer);
}
});
Object.defineProperty(propertiesDriver, "getAll", {
enumerable: false,
value: function getAll() {
return this.get(ALL_PROPS);
}
});
return propertiesDriver;
}
function createContainerElement(tagName, vtreeProperties) {
var element = document.createElement("div");
element.id = vtreeProperties.id || "";
element.className = vtreeProperties.className || "";
element.className += " cycleCustomElement-" + tagName.toUpperCase();
element.className = element.className.trim();
element.cycleCustomElementMetadata = {
propertiesDriver: null,
rootElem$: null,
customEvents: null,
eventDispatchingSubscription: false
};
return element;
}
function throwIfVTreeHasPropertyChildren(vtree) {
if (typeof vtree.properties.children !== "undefined") {
throw new Error("Custom element should not have property `children`. " + "It is reserved for children elements nested into this custom element.");
}
}
function makeCustomElementInput(domOutput, propertiesDriver, domDriverName) {
var _ref;
return (_ref = {}, _defineProperty(_ref, domDriverName, domOutput), _defineProperty(_ref, PROPS_DRIVER_NAME, propertiesDriver), _ref);
}
function makeConstructor() {
return function customElementConstructor(vtree, CERegistry, driverName) {
//console.log(`%cnew (constructor) custom element ` + vtree.tagName,
// `color: #880088`)
throwIfVTreeHasPropertyChildren(vtree);
this.type = "Widget";
this.properties = vtree.properties;
this.properties.children = vtree.children;
this.key = vtree.key;
this.isCustomElementWidget = true;
this.customElementsRegistry = CERegistry;
this.driverName = driverName;
this.firstRootElem$ = new Rx.ReplaySubject(1);
this.disposables = new Rx.CompositeDisposable();
};
}
function validateDefFnOutput(defFnOutput, domDriverName, tagName) {
if (typeof defFnOutput !== "object") {
throw new Error("Custom element definition function for `" + tagName + "` " + " should output an object.");
}
if (typeof defFnOutput[domDriverName] === "undefined") {
throw new Error("Custom element definition function for '" + tagName + "' " + ("should output an object containing `" + domDriverName + "`."));
}
if (typeof defFnOutput[domDriverName].subscribe !== "function") {
throw new Error("Custom element definition function for `" + tagName + "` " + "should output an object containing an Observable of VTree, named " + ("`" + domDriverName + "`."));
}
for (var _name2 in defFnOutput) {
if (defFnOutput.hasOwnProperty(_name2) && _name2 !== domDriverName && _name2 !== EVENTS_SINK_NAME) {
throw new Error("Unknown `" + _name2 + "` found on custom element " + ("`" + tagName + "`s definition function's output."));
}
}
}
function makeInit(tagName, definitionFn) {
var _require2 = require("./render-dom");
var makeDOMDriverWithRegistry = _require2.makeDOMDriverWithRegistry;
return function initCustomElement() {
//console.log(`%cInit() custom element ` + tagName, `color: #880088`)
var widget = this;
var driverName = widget.driverName;
var registry = widget.customElementsRegistry;
var element = createContainerElement(tagName, widget.properties);
var proxyVTree$ = new Rx.ReplaySubject(1);
var domDriver = makeDOMDriverWithRegistry(element, registry);
var propertiesDriver = makePropertiesDriver();
var domResponse = domDriver(proxyVTree$, driverName);
var rootElem$ = domResponse.get(":root");
rootElem$.subscribe(function (rootElem) {
// This is expected to happen before initCustomElement() returns `element`
element = rootElem;
});
var defFnInput = makeCustomElementInput(domResponse, propertiesDriver, driverName);
var requests = definitionFn(defFnInput);
validateDefFnOutput(requests, driverName, tagName);
widget.disposables.add(requests[driverName].subscribe(proxyVTree$.asObserver()));
widget.disposables.add(rootElem$.subscribe(widget.firstRootElem$.asObserver()));
element.cycleCustomElementMetadata = {
propertiesDriver: propertiesDriver,
rootElem$: rootElem$,
customEvents: requests.events,
eventDispatchingSubscription: false
};
subscribeEventDispatchingSink(element, widget);
widget.disposables.add(widget.firstRootElem$);
widget.disposables.add(proxyVTree$);
widget.disposables.add(domResponse);
widget.update(null, element);
return element;
};
}
function validatePropertiesDriverInMetadata(element, fnName) {
if (!element) {
throw new Error("Missing DOM element when calling `" + fnName + "` on " + "custom element Widget.");
}
if (!element.cycleCustomElementMetadata) {
throw new Error("Missing custom element metadata on DOM element when " + ("calling `" + fnName + "` on custom element Widget."));
}
var metadata = element.cycleCustomElementMetadata;
if (metadata.propertiesDriver.type !== "PropertiesDriver") {
throw new Error("Custom element metadata's propertiesDriver type is " + ("invalid: `" + metadata.propertiesDriver.type + "`."));
}
}
function updateCustomElement(previous, element) {
if (previous) {
this.disposables = previous.disposables;
this.firstRootElem$.onNext(0);
this.firstRootElem$.onCompleted();
}
validatePropertiesDriverInMetadata(element, "update()");
//console.log(`%cupdate() ${element.className}`, `color: #880088`)
var propsDriver = element.cycleCustomElementMetadata.propertiesDriver;
if (propsDriver.hasOwnProperty(ALL_PROPS)) {
propsDriver[ALL_PROPS].onNext(this.properties);
}
for (var prop in propsDriver) {
if (propsDriver.hasOwnProperty(prop) && this.properties.hasOwnProperty(prop)) {
propsDriver[prop].onNext(this.properties[prop]);
}
}
}
function destroyCustomElement(element) {
//console.log(`%cdestroy() custom el ${element.className}`, `color: #808`)
// Dispose propertiesDriver
var propsDriver = element.cycleCustomElementMetadata.propertiesDriver;
for (var prop in propsDriver) {
if (propsDriver.hasOwnProperty(prop)) {
this.disposables.add(propsDriver[prop]);
}
}
if (element.cycleCustomElementMetadata.eventDispatchingSubscription) {
// This subscription has to be disposed.
// Because disposing subscribeDispatchersWhenRootChanges only
// is not enough.
this.disposables.add(element.cycleCustomElementMetadata.eventDispatchingSubscription);
}
this.disposables.dispose();
}
function makeWidgetClass(tagName, definitionFn) {
if (typeof definitionFn !== "function") {
throw new Error("A custom element definition given to the DOM driver " + "should be a function.");
}
var WidgetClass = makeConstructor();
WidgetClass.definitionFn = definitionFn; // needed by renderAsHTML
WidgetClass.prototype.init = makeInit(tagName, definitionFn);
WidgetClass.prototype.update = updateCustomElement;
WidgetClass.prototype.destroy = destroyCustomElement;
return WidgetClass;
}
module.exports = {
makeDispatchFunction: makeDispatchFunction,
subscribeDispatchers: subscribeDispatchers,
subscribeDispatchersWhenRootChanges: subscribeDispatchersWhenRootChanges,
makePropertiesDriver: makePropertiesDriver,
createContainerElement: createContainerElement,
throwIfVTreeHasPropertyChildren: throwIfVTreeHasPropertyChildren,
makeConstructor: makeConstructor,
makeInit: makeInit,
updateCustomElement: updateCustomElement,
destroyCustomElement: destroyCustomElement,
ALL_PROPS: ALL_PROPS,
makeCustomElementInput: makeCustomElementInput,
makeWidgetClass: makeWidgetClass
};
},{"./render-dom":112,"@cycle/core":1}],110:[function(require,module,exports){
"use strict";
var _require = require("./custom-element-widget");
var makeWidgetClass = _require.makeWidgetClass;
var Map = Map || require("es6-map"); // eslint-disable-line no-native-reassign
function replaceCustomElementsWithSomething(vtree, registry, toSomethingFn) {
// Silently ignore corner cases
if (!vtree) {
return vtree;
}
var tagName = (vtree.tagName || "").toUpperCase();
// Replace vtree itself
if (tagName && registry.has(tagName)) {
var WidgetClass = registry.get(tagName);
return toSomethingFn(vtree, WidgetClass);
}
// Or replace children recursively
if (Array.isArray(vtree.children)) {
for (var i = vtree.children.length - 1; i >= 0; i--) {
vtree.children[i] = replaceCustomElementsWithSomething(vtree.children[i], registry, toSomethingFn);
}
}
return vtree;
}
function makeCustomElementsRegistry(definitions) {
var registry = new Map();
for (var tagName in definitions) {
if (definitions.hasOwnProperty(tagName)) {
registry.set(tagName.toUpperCase(), makeWidgetClass(tagName, definitions[tagName]));
}
}
return registry;
}
module.exports = {
replaceCustomElementsWithSomething: replaceCustomElementsWithSomething,
makeCustomElementsRegistry: makeCustomElementsRegistry
};
},{"./custom-element-widget":109,"es6-map":4}],111:[function(require,module,exports){
"use strict";
var svg = require("virtual-dom/virtual-hyperscript/svg");
var _require = require("./render-dom");
var makeDOMDriver = _require.makeDOMDriver;
var _require2 = require("./render-html");
var makeHTMLDriver = _require2.makeHTMLDriver;
var h = require("./virtual-hyperscript");
var CycleDOM = {
/**
* A factory for the DOM driver function. Takes a `container` to define the
* target on the existing DOM which this driver will operate on. All custom
* elements which this driver can detect should be given as the second
* parameter. The output of this driver is a collection of Observables queried
* by a getter function: `domDriverOutput.get(selector, eventType)` returns an
* Observable of events of `eventType` happening on the element determined by
* `selector`. Also, `domDriverOutput.get(':root')` returns an Observable of
* DOM element corresponding to the root (or container) of the app on the DOM.
*
* @param {(String|HTMLElement)} container the DOM selector for the element
* (or the element itself) to contain the rendering of the VTrees.
* @param {Object} customElements a collection of custom element definitions.
* The key of each property should be the tag name of the custom element, and
* the value should be a function defining the implementation of the custom
* element. This function follows the same contract as the top-most `main`
* function: input are driver responses, output are requests to drivers.
* @return {Function} the DOM driver function. The function expects an
* Observable of VTree as input, and outputs the response object for this
* driver, containing functions `get()` and `dispose()` that can be used for
* debugging and testing.
* @function makeDOMDriver
*/
makeDOMDriver: makeDOMDriver,
/**
* A factory for the HTML driver function. Takes the registry object of all
* custom elements as the only parameter. The HTML driver function will use
* the custom element registry to detect custom element on the VTree and apply
* their implementations.
*
* @param {Object} customElements a collection of custom element definitions.
* The key of each property should be the tag name of the custom element, and
* the value should be a function defining the implementation of the custom
* element. This function follows the same contract as the top-most `main`
* function: input are driver responses, output are requests to drivers.
* @return {Function} the HTML driver function. The function expects an
* Observable of Virtual DOM elements as input, and outputs an Observable of
* strings as the HTML renderization of the virtual DOM elements.
* @function makeHTMLDriver
*/
makeHTMLDriver: makeHTMLDriver,
/**
* A shortcut to [virtual-hyperscript](
* https://github.com/Matt-Esch/virtual-dom/tree/master/virtual-hyperscript).
* This is a helper for creating VTrees in Views.
* @name h
*/
h: h,
/**
* An adapter around virtual-hyperscript `h()` to allow JSX to be used easily
* with Babel. Place the [Babel configuration comment](
* http://babeljs.io/docs/advanced/transformers/other/react/) `@jsx hJSX` at
* the top of the ES6 file, make sure you import `hJSX` with
* `import {hJSX} from '@cycle/dom'`, and then you can use JSX to create
* VTrees.
* @name hJSX
*/
hJSX: function hJSX(tag, attrs) {
for (var _len = arguments.length, children = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
children[_key - 2] = arguments[_key];
}
return h(tag, attrs, children);
},
/**
* A shortcut to the svg hyperscript function.
* @name svg
*/
svg: svg
};
module.exports = CycleDOM;
},{"./render-dom":112,"./render-html":113,"./virtual-hyperscript":115,"virtual-dom/virtual-hyperscript/svg":96}],112:[function(require,module,exports){
"use strict";
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })();
var _require = require("@cycle/core");
var Rx = _require.Rx;
var VDOM = {
h: require("./virtual-hyperscript"),
diff: require("virtual-dom/diff"),
patch: require("virtual-dom/patch"),
parse: typeof window !== "undefined" ? require("vdom-parser") : function () {}
};
var _require2 = require("./custom-elements");
var replaceCustomElementsWithSomething = _require2.replaceCustomElementsWithSomething;
var makeCustomElementsRegistry = _require2.makeCustomElementsRegistry;
var _require3 = require("./transposition");
var transposeVTree = _require3.transposeVTree;
function isElement(obj) {
return typeof HTMLElement === "object" ? obj instanceof HTMLElement || obj instanceof DocumentFragment : //DOM2
obj && typeof obj === "object" && obj !== null && (obj.nodeType === 1 || obj.nodeType === 11) && typeof obj.nodeName === "string";
}
function fixRootElem$(rawRootElem$, domContainer) {
// Create rootElem stream and automatic className correction
var originalClasses = (domContainer.className || "").trim().split(/\s+/);
var originalId = domContainer.id;
//console.log('%coriginalClasses: ' + originalClasses, 'color: lightgray')
return rawRootElem$.map(function fixRootElemClassNameAndId(rootElem) {
var previousClasses = rootElem.className.trim().split(/\s+/);
var missingClasses = originalClasses.filter(function (clss) {
return previousClasses.indexOf(clss) < 0;
});
var classes = previousClasses.length > 0 ? previousClasses.concat(missingClasses) : missingClasses;
//console.log('%cfixRootElemClassName(), missingClasses: ' +
// missingClasses, 'color: lightgray')
rootElem.className = classes.join(" ").trim();
if (originalId) {
rootElem.id = originalId;
}
//console.log('%c result: ' + rootElem.className, 'color: lightgray')
//console.log('%cEmit rootElem$ ' + rootElem.tagName + '.' +
// rootElem.className, 'color: #009988')
return rootElem;
});
}
function isVTreeCustomElement(vtree) {
return vtree.type === "Widget" && vtree.isCustomElementWidget;
}
function makeReplaceCustomElementsWithWidgets(CERegistry, driverName) {
return function replaceCustomElementsWithWidgets(vtree) {
return replaceCustomElementsWithSomething(vtree, CERegistry, function (_vtree, WidgetClass) {
return new WidgetClass(_vtree, CERegistry, driverName);
});
};
}
function getArrayOfAllWidgetFirstRootElem$(vtree) {
if (vtree.type === "Widget" && vtree.firstRootElem$) {
return [vtree.firstRootElem$];
}
// Or replace children recursively
var array = [];
if (Array.isArray(vtree.children)) {
for (var i = vtree.children.length - 1; i >= 0; i--) {
array = array.concat(getArrayOfAllWidgetFirstRootElem$(vtree.children[i]));
}
}
return array;
}
function checkRootVTreeNotCustomElement(vtree) {
if (isVTreeCustomElement(vtree)) {
throw new Error("Illegal to use a Cycle custom element as the root of " + "a View.");
}
}
function isRootForCustomElement(rootElem) {
return !!rootElem.cycleCustomElementMetadata;
}
function wrapTopLevelVTree(vtree, rootElem) {
if (isRootForCustomElement(rootElem)) {
return vtree;
}
var _vtree$properties$id = vtree.properties.id;
var vtreeId = _vtree$properties$id === undefined ? "" : _vtree$properties$id;
var _vtree$properties$className = vtree.properties.className;
var vtreeClass = _vtree$properties$className === undefined ? "" : _vtree$properties$className;
var sameId = vtreeId === rootElem.id;
var sameClass = vtreeClass === rootElem.className;
var sameTagName = vtree.tagName.toUpperCase() === rootElem.tagName;
if (sameId && sameClass && sameTagName) {
return vtree;
}
var attrs = {};
if (rootElem.id) {
attrs.id = rootElem.id;
}
if (rootElem.className) {
attrs.className = rootElem.className;
}
return VDOM.h(rootElem.tagName, attrs, [vtree]);
}
function makeDiffAndPatchToElement$(rootElem) {
return function diffAndPatchToElement$(_ref) {
var _ref2 = _slicedToArray(_ref, 2);
var oldVTree = _ref2[0];
var newVTree = _ref2[1];
if (typeof newVTree === "undefined") {
return Rx.Observable.empty();
}
//let isCustomElement = isRootForCustomElement(rootElem)
//let k = isCustomElement ? ' is custom element ' : ' is top level'
var prevVTree = wrapTopLevelVTree(oldVTree, rootElem);
var nextVTree = wrapTopLevelVTree(newVTree, rootElem);
var waitForChildrenStreams = getArrayOfAllWidgetFirstRootElem$(nextVTree);
var rootElemAfterChildrenFirstRootElem$ = Rx.Observable.combineLatest(waitForChildrenStreams, function () {
//console.log('%crawRootElem$ emits. (1)' + k, 'color: #008800')
return rootElem;
});
var cycleCustomElementMetadata = rootElem.cycleCustomElementMetadata;
//console.log('%cVDOM diff and patch START' + k, 'color: #636300')
/* eslint-disable */
rootElem = VDOM.patch(rootElem, VDOM.diff(prevVTree, nextVTree));
/* eslint-enable */
//console.log('%cVDOM diff and patch END' + k, 'color: #636300')
if (cycleCustomElementMetadata) {
rootElem.cycleCustomElementMetadata = cycleCustomElementMetadata;
}
if (waitForChildrenStreams.length === 0) {
//console.log('%crawRootElem$ emits. (2)' + k, 'color: #008800')
return Rx.Observable.just(rootElem);
}
//console.log('%crawRootElem$ waiting children.' + k, 'color: #008800')
return rootElemAfterChildrenFirstRootElem$;
};
}
function renderRawRootElem$(vtree$, domContainer, _ref3) {
var CERegistry = _ref3.CERegistry;
var driverName = _ref3.driverName;
var diffAndPatchToElement$ = makeDiffAndPatchToElement$(domContainer);
return vtree$.flatMapLatest(transposeVTree).startWith(VDOM.parse(domContainer)).map(makeReplaceCustomElementsWithWidgets(CERegistry, driverName)).doOnNext(checkRootVTreeNotCustomElement).pairwise().flatMap(diffAndPatchToElement$);
}
function makeRootElemToEvent$(selector, eventName) {
return function rootElemToEvent$(rootElem) {
if (!rootElem) {
return Rx.Observable.empty();
}
//let isCustomElement = !!rootElem.cycleCustomElementMetadata
//console.log(`%cget('${selector}', '${eventName}') flatMapper` +
// (isCustomElement ? ' for a custom element' : ' for top-level View'),
// 'color: #0000BB')
var klass = selector.replace(".", "");
if (rootElem.className.search(new RegExp("\\b" + klass + "\\b")) >= 0) {
//console.log('%c Good return. (A)', 'color:#0000BB')
//console.log(rootElem)
return Rx.Observable.fromEvent(rootElem, eventName);
}
var targetElements = rootElem.querySelectorAll(selector);
if (targetElements && targetElements.length > 0) {
//console.log('%c Good return. (B)', 'color:#0000BB')
//console.log(targetElements)
return Rx.Observable.fromEvent(targetElements, eventName);
}
//console.log('%c returning empty!', 'color: #0000BB')
return Rx.Observable.empty();
};
}
function makeResponseGetter(rootElem$) {
return function get(selector, eventName) {
if (typeof selector !== "string") {
throw new Error("DOM driver's get() expects first argument to be a " + "string as a CSS selector");
}
if (selector.trim() === ":root") {
return rootElem$;
}
if (typeof eventName !== "string") {
throw new Error("DOM driver's get() expects second argument to be a " + "string representing the event type to listen for.");
}
//console.log(`%cget("${selector}", "${eventName}")`, 'color: #0000BB')
return rootElem$.flatMapLatest(makeRootElemToEvent$(selector, eventName)).share();
};
}
function validateDOMDriverInput(vtree$) {
if (!vtree$ || typeof vtree$.subscribe !== "function") {
throw new Error("The DOM driver function expects as input an " + "Observable of virtual DOM elements");
}
}
function makeDOMDriverWithRegistry(container, CERegistry) {
return function domDriver(vtree$, driverName) {
validateDOMDriverInput(vtree$);
var rawRootElem$ = renderRawRootElem$(vtree$, container, { CERegistry: CERegistry, driverName: driverName });
if (!isRootForCustomElement(container)) {
rawRootElem$ = rawRootElem$.startWith(container);
}
var rootElem$ = fixRootElem$(rawRootElem$, container).replay(null, 1);
var disposable = rootElem$.connect();
return {
get: makeResponseGetter(rootElem$),
dispose: disposable.dispose.bind(disposable)
};
};
}
function makeDOMDriver(container) {
var customElementDefinitions = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
// Find and prepare the container
var domContainer = typeof container === "string" ? document.querySelector(container) : container;
// Check pre-conditions
if (typeof container === "string" && domContainer === null) {
throw new Error("Cannot render into unknown element `" + container + "`");
} else if (!isElement(domContainer)) {
throw new Error("Given container is not a DOM element neither a selector " + "string.");
}
var registry = makeCustomElementsRegistry(customElementDefinitions);
return makeDOMDriverWithRegistry(domContainer, registry);
}
module.exports = {
isElement: isElement,
fixRootElem$: fixRootElem$,
isVTreeCustomElement: isVTreeCustomElement,
makeReplaceCustomElementsWithWidgets: makeReplaceCustomElementsWithWidgets,
getArrayOfAllWidgetFirstRootElem$: getArrayOfAllWidgetFirstRootElem$,
isRootForCustomElement: isRootForCustomElement,
wrapTopLevelVTree: wrapTopLevelVTree,
checkRootVTreeNotCustomElement: checkRootVTreeNotCustomElement,
makeDiffAndPatchToElement$: makeDiffAndPatchToElement$,
renderRawRootElem$: renderRawRootElem$,
makeResponseGetter: makeResponseGetter,
validateDOMDriverInput: validateDOMDriverInput,
makeDOMDriverWithRegistry: makeDOMDriverWithRegistry,
makeDOMDriver: makeDOMDriver
};
},{"./custom-elements":110,"./transposition":114,"./virtual-hyperscript":115,"@cycle/core":1,"vdom-parser":60,"virtual-dom/diff":75,"virtual-dom/patch":83}],113:[function(require,module,exports){
"use strict";
var _require = require("@cycle/core");
var Rx = _require.Rx;
var toHTML = require("vdom-to-html");
var _require2 = require("./custom-elements");
var replaceCustomElementsWithSomething = _require2.replaceCustomElementsWithSomething;
var makeCustomElementsRegistry = _require2.makeCustomElementsRegistry;
var _require3 = require("./custom-element-widget");
var makeCustomElementInput = _require3.makeCustomElementInput;
var ALL_PROPS = _require3.ALL_PROPS;
var _require4 = require("./transposition");
var transposeVTree = _require4.transposeVTree;
function makePropertiesDriverFromVTree(vtree) {
return {
get: function get(propertyName) {
if (propertyName === ALL_PROPS) {
return Rx.Observable.just(vtree.properties);
} else {
return Rx.Observable.just(vtree.properties[propertyName]);
}
}
};
}
function makeReplaceCustomElementsWithVTree$(CERegistry, driverName) {
return function replaceCustomElementsWithVTree$(vtree) {
return replaceCustomElementsWithSomething(vtree, CERegistry, function toVTree$(_vtree, WidgetClass) {
var interactions = { get: function get() {
return Rx.Observable.empty();
} };
var props = makePropertiesDriverFromVTree(_vtree);
var input = makeCustomElementInput(interactions, props);
var output = WidgetClass.definitionFn(input);
var vtree$ = output[driverName].last();
/*eslint-disable no-use-before-define */
return convertCustomElementsToVTree(vtree$, CERegistry, driverName);
/*eslint-enable no-use-before-define */
});
};
}
function convertCustomElementsToVTree(vtree$, CERegistry, driverName) {
return vtree$.map(makeReplaceCustomElementsWithVTree$(CERegistry, driverName)).flatMap(transposeVTree);
}
function makeResponseGetter() {
return function get(selector) {
if (selector === ":root") {
return this;
} else {
return Rx.Observable.empty();
}
};
}
function makeHTMLDriver() {
var customElementDefinitions = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var registry = makeCustomElementsRegistry(customElementDefinitions);
return function htmlDriver(vtree$, driverName) {
var vtreeLast$ = vtree$.last();
var output$ = convertCustomElementsToVTree(vtreeLast$, registry, driverName).map(function (vtree) {
return toHTML(vtree);
});
output$.get = makeResponseGetter();
return output$;
};
}
module.exports = {
makePropertiesDriverFromVTree: makePropertiesDriverFromVTree,
makeReplaceCustomElementsWithVTree$: makeReplaceCustomElementsWithVTree$,
convertCustomElementsToVTree: convertCustomElementsToVTree,
makeHTMLDriver: makeHTMLDriver
};
},{"./custom-element-widget":109,"./custom-elements":110,"./transposition":114,"@cycle/core":1,"vdom-to-html":64}],114:[function(require,module,exports){
"use strict";
var _require = require("@cycle/core");
var Rx = _require.Rx;
var VirtualNode = require("virtual-dom/vnode/vnode");
/**
* Converts a tree of VirtualNode|Observable<VirtualNode> into
* Observable<VirtualNode>.
*/
function transposeVTree(vtree) {
if (typeof vtree.subscribe === "function") {
return vtree.flatMap(transposeVTree);
} else if (vtree.type === "VirtualText") {
return Rx.Observable.just(vtree);
} else if (vtree.type === "VirtualNode" && Array.isArray(vtree.children) && vtree.children.length > 0) {
return Rx.Observable.combineLatest(vtree.children.map(transposeVTree), function () {
for (var _len = arguments.length, arr = Array(_len), _key = 0; _key < _len; _key++) {
arr[_key] = arguments[_key];
}
return new VirtualNode(vtree.tagName, vtree.properties, arr, vtree.key, vtree.namespace);
});
} else if (vtree.type === "VirtualNode") {
return Rx.Observable.just(vtree);
} else {
throw new Error("Unhandled case in transposeVTree()");
}
}
module.exports = {
transposeVTree: transposeVTree
};
},{"@cycle/core":1,"virtual-dom/vnode/vnode":104}],115:[function(require,module,exports){
/* eslint-disable */
'use strict';
var isArray = require('virtual-dom/node_modules/x-is-array');
var VNode = require('virtual-dom/vnode/vnode.js');
var VText = require('virtual-dom/vnode/vtext.js');
var isVNode = require('virtual-dom/vnode/is-vnode');
var isVText = require('virtual-dom/vnode/is-vtext');
var isWidget = require('virtual-dom/vnode/is-widget');
var isHook = require('virtual-dom/vnode/is-vhook');
var isVThunk = require('virtual-dom/vnode/is-thunk');
var parseTag = require('virtual-dom/virtual-hyperscript/parse-tag.js');
var softSetHook = require('virtual-dom/virtual-hyperscript/hooks/soft-set-hook.js');
var evHook = require('virtual-dom/virtual-hyperscript/hooks/ev-hook.js');
module.exports = h;
function h(tagName, properties, children) {
var childNodes = [];
var tag, props, key, namespace;
if (!children && isChildren(properties)) {
children = properties;
props = {};
}
props = props || properties || {};
tag = parseTag(tagName, props);
// support keys
if (props.hasOwnProperty('key')) {
key = props.key;
props.key = undefined;
}
// support namespace
if (props.hasOwnProperty('namespace')) {
namespace = props.namespace;
props.namespace = undefined;
}
// fix cursor bug
if (tag === 'INPUT' && !namespace && props.hasOwnProperty('value') && props.value !== undefined && !isHook(props.value)) {
props.value = softSetHook(props.value);
}
transformProperties(props);
if (children !== undefined && children !== null) {
addChild(children, childNodes, tag, props);
}
return new VNode(tag, props, childNodes, key, namespace);
}
function addChild(c, childNodes, tag, props) {
if (typeof c === 'string') {
childNodes.push(new VText(c));
} else if (typeof c === 'number') {
childNodes.push(new VText(String(c)));
} else if (isChild(c)) {
childNodes.push(c);
} else if (isArray(c)) {
for (var i = 0; i < c.length; i++) {
addChild(c[i], childNodes, tag, props);
}
} else if (c === null || c === undefined) {
return;
} else {
throw UnexpectedVirtualElement({
foreignObject: c,
parentVnode: {
tagName: tag,
properties: props
}
});
}
}
function transformProperties(props) {
for (var propName in props) {
if (props.hasOwnProperty(propName)) {
var value = props[propName];
if (isHook(value)) {
continue;
}
if (propName.substr(0, 3) === 'ev-') {
// add ev-foo support
props[propName] = evHook(value);
}
}
}
}
// START Cycle.js-specific code >>>>>>>>
function isObservable(x) {
return x && typeof x.subscribe === 'function';
}
function isChild(x) {
return isVNode(x) || isVText(x) || isObservable(x) || isWidget(x) || isVThunk(x);
}
// END Cycle.js-specific code <<<<<<<<<<
function isChildren(x) {
return typeof x === 'string' || isArray(x) || isChild(x);
}
function UnexpectedVirtualElement(data) {
var err = new Error();
err.type = 'virtual-hyperscript.unexpected.virtual-element';
err.message = 'Unexpected virtual child passed to h().\n' + 'Expected a VNode / Vthunk / VWidget / string but:\n' + 'got:\n' + errorString(data.foreignObject) + '.\n' + 'The parent vnode is:\n' + errorString(data.parentVnode);
'\n' + 'Suggested fix: change your `h(..., [ ... ])` callsite.';
err.foreignObject = data.foreignObject;
err.parentVnode = data.parentVnode;
return err;
}
function errorString(obj) {
try {
return JSON.stringify(obj, null, ' ');
} catch (e) {
return String(obj);
}
}
/* eslint-enable */
},{"virtual-dom/node_modules/x-is-array":82,"virtual-dom/virtual-hyperscript/hooks/ev-hook.js":91,"virtual-dom/virtual-hyperscript/hooks/soft-set-hook.js":92,"virtual-dom/virtual-hyperscript/parse-tag.js":94,"virtual-dom/vnode/is-thunk":98,"virtual-dom/vnode/is-vhook":99,"virtual-dom/vnode/is-vnode":100,"virtual-dom/vnode/is-vtext":101,"virtual-dom/vnode/is-widget":102,"virtual-dom/vnode/vnode.js":104,"virtual-dom/vnode/vtext.js":106}]},{},[111])(111)
}); |
packages/react-jsx-highcharts/test/components/Subtitle/Subtitle.spec.js | AlexMayants/react-jsx-highcharts | import React from 'react';
import { mount } from 'enzyme';
import Subtitle from '../../../src/components/Subtitle/Subtitle';
describe('<Subtitle />', function () {
beforeEach(function () {
this.setTitle = sinon.spy();
});
describe('when mounted', function () {
it('adds a subtitle using the Highcharts setTitle method', function () {
mount(<Subtitle setTitle={this.setTitle}>My Subtitle</Subtitle>);
expect(this.setTitle).to.have.been.calledWith(
null, { text: 'My Subtitle', setTitle: this.setTitle }, true
);
});
it('should pass additional props through to Highcharts setTitle method', function () {
mount(<Subtitle align="right" setTitle={this.setTitle}>My Other Subtitle</Subtitle>);
expect(this.setTitle).to.have.been.calledWith(
null, { text: 'My Other Subtitle', align: 'right', setTitle: this.setTitle }, true
);
});
});
describe('update', function () {
it('should use the setTitle method when the data changes', function () {
const wrapper = mount(
<Subtitle setTitle={this.setTitle}>My Subtitle</Subtitle>
);
wrapper.setProps({ x: 10, y: 20, children: 'My New Subtitle' });
expect(this.setTitle).to.have.been.calledWith(null, { x: 10, y: 20, text: 'My New Subtitle' }, true);
});
});
describe('when unmounted', function () {
it('removes the subtitle by setting the subtitle to text', function () {
const wrapper = mount(<Subtitle setTitle={this.setTitle}>My Subtitle</Subtitle>);
wrapper.unmount();
expect(this.setTitle).to.have.been.calledWith(null, { text: null }, true);
});
});
});
|
ajax/libs/yui/3.8.1/datatable-body/datatable-body-debug.js | ljharb/cdnjs | YUI.add('datatable-body', function (Y, NAME) {
/**
View class responsible for rendering the `<tbody>` section of a table. Used as
the default `bodyView` for `Y.DataTable.Base` and `Y.DataTable` classes.
@module datatable
@submodule datatable-body
@since 3.5.0
**/
var Lang = Y.Lang,
isArray = Lang.isArray,
isNumber = Lang.isNumber,
isString = Lang.isString,
fromTemplate = Lang.sub,
htmlEscape = Y.Escape.html,
toArray = Y.Array,
bind = Y.bind,
YObject = Y.Object;
/**
View class responsible for rendering the `<tbody>` section of a table. Used as
the default `bodyView` for `Y.DataTable.Base` and `Y.DataTable` classes.
Translates the provided `modelList` into a rendered `<tbody>` based on the data
in the constituent Models, altered or ammended by any special column
configurations.
The `columns` configuration, passed to the constructor, determines which
columns will be rendered.
The rendering process involves constructing an HTML template for a complete row
of data, built by concatenating a customized copy of the instance's
`CELL_TEMPLATE` into the `ROW_TEMPLATE` once for each column. This template is
then populated with values from each Model in the `modelList`, aggregating a
complete HTML string of all row and column data. A `<tbody>` Node is then created from the markup and any column `nodeFormatter`s are applied.
Supported properties of the column objects include:
* `key` - Used to link a column to an attribute in a Model.
* `name` - Used for columns that don't relate to an attribute in the Model
(`formatter` or `nodeFormatter` only) if the implementer wants a
predictable name to refer to in their CSS.
* `cellTemplate` - Overrides the instance's `CELL_TEMPLATE` for cells in this
column only.
* `formatter` - Used to customize or override the content value from the
Model. These do not have access to the cell or row Nodes and should
return string (HTML) content.
* `nodeFormatter` - Used to provide content for a cell as well as perform any
custom modifications on the cell or row Node that could not be performed by
`formatter`s. Should be used sparingly for better performance.
* `emptyCellValue` - String (HTML) value to use if the Model data for a
column, or the content generated by a `formatter`, is the empty string,
`null`, or `undefined`.
* `allowHTML` - Set to `true` if a column value, `formatter`, or
`emptyCellValue` can contain HTML. This defaults to `false` to protect
against XSS.
* `className` - Space delimited CSS classes to add to all `<td>`s in a column.
Column `formatter`s are passed an object (`o`) with the following properties:
* `value` - The current value of the column's associated attribute, if any.
* `data` - An object map of Model keys to their current values.
* `record` - The Model instance.
* `column` - The column configuration object for the current column.
* `className` - Initially empty string to allow `formatter`s to add CSS
classes to the cell's `<td>`.
* `rowIndex` - The zero-based row number.
* `rowClass` - Initially empty string to allow `formatter`s to add CSS
classes to the cell's containing row `<tr>`.
They may return a value or update `o.value` to assign specific HTML content. A
returned value has higher precedence.
Column `nodeFormatter`s are passed an object (`o`) with the following
properties:
* `value` - The current value of the column's associated attribute, if any.
* `td` - The `<td>` Node instance.
* `cell` - The `<div>` liner Node instance if present, otherwise, the `<td>`.
When adding content to the cell, prefer appending into this property.
* `data` - An object map of Model keys to their current values.
* `record` - The Model instance.
* `column` - The column configuration object for the current column.
* `rowIndex` - The zero-based row number.
They are expected to inject content into the cell's Node directly, including
any "empty" cell content. Each `nodeFormatter` will have access through the
Node API to all cells and rows in the `<tbody>`, but not to the `<table>`, as
it will not be attached yet.
If a `nodeFormatter` returns `false`, the `o.td` and `o.cell` Nodes will be
`destroy()`ed to remove them from the Node cache and free up memory. The DOM
elements will remain as will any content added to them. _It is highly
advisable to always return `false` from your `nodeFormatter`s_.
@class BodyView
@namespace DataTable
@extends View
@since 3.5.0
**/
Y.namespace('DataTable').BodyView = Y.Base.create('tableBody', Y.View, [], {
// -- Instance properties -------------------------------------------------
/**
HTML template used to create table cells.
@property CELL_TEMPLATE
@type {HTML}
@default '<td {headers} class="{className}">{content}</td>'
@since 3.5.0
**/
CELL_TEMPLATE: '<td {headers} class="{className}">{content}</td>',
/**
CSS class applied to even rows. This is assigned at instantiation.
For DataTable, this will be `yui3-datatable-even`.
@property CLASS_EVEN
@type {String}
@default 'yui3-table-even'
@since 3.5.0
**/
//CLASS_EVEN: null
/**
CSS class applied to odd rows. This is assigned at instantiation.
When used by DataTable instances, this will be `yui3-datatable-odd`.
@property CLASS_ODD
@type {String}
@default 'yui3-table-odd'
@since 3.5.0
**/
//CLASS_ODD: null
/**
HTML template used to create table rows.
@property ROW_TEMPLATE
@type {HTML}
@default '<tr id="{rowId}" data-yui3-record="{clientId}" class="{rowClass}">{content}</tr>'
@since 3.5.0
**/
ROW_TEMPLATE : '<tr id="{rowId}" data-yui3-record="{clientId}" class="{rowClass}">{content}</tr>',
/**
The object that serves as the source of truth for column and row data.
This property is assigned at instantiation from the `host` property of
the configuration object passed to the constructor.
@property host
@type {Object}
@default (initially unset)
@since 3.5.0
**/
//TODO: should this be protected?
//host: null,
/**
HTML templates used to create the `<tbody>` containing the table rows.
@property TBODY_TEMPLATE
@type {HTML}
@default '<tbody class="{className}">{content}</tbody>'
@since 3.6.0
**/
TBODY_TEMPLATE: '<tbody class="{className}"></tbody>',
// -- Public methods ------------------------------------------------------
/**
Returns the `<td>` Node from the given row and column index. Alternately,
the `seed` can be a Node. If so, the nearest ancestor cell is returned.
If the `seed` is a cell, it is returned. If there is no cell at the given
coordinates, `null` is returned.
Optionally, include an offset array or string to return a cell near the
cell identified by the `seed`. The offset can be an array containing the
number of rows to shift followed by the number of columns to shift, or one
of "above", "below", "next", or "previous".
<pre><code>// Previous cell in the previous row
var cell = table.getCell(e.target, [-1, -1]);
// Next cell
var cell = table.getCell(e.target, 'next');
var cell = table.getCell(e.taregt, [0, 1];</pre></code>
@method getCell
@param {Number[]|Node} seed Array of row and column indexes, or a Node that
is either the cell itself or a descendant of one.
@param {Number[]|String} [shift] Offset by which to identify the returned
cell Node
@return {Node}
@since 3.5.0
**/
getCell: function (seed, shift) {
var tbody = this.tbodyNode,
row, cell, index, rowIndexOffset;
if (seed && tbody) {
if (isArray(seed)) {
row = tbody.get('children').item(seed[0]);
cell = row && row.get('children').item(seed[1]);
} else if (Y.instanceOf(seed, Y.Node)) {
cell = seed.ancestor('.' + this.getClassName('cell'), true);
}
if (cell && shift) {
rowIndexOffset = tbody.get('firstChild.rowIndex');
if (isString(shift)) {
// TODO this should be a static object map
switch (shift) {
case 'above' : shift = [-1, 0]; break;
case 'below' : shift = [1, 0]; break;
case 'next' : shift = [0, 1]; break;
case 'previous': shift = [0, -1]; break;
}
}
if (isArray(shift)) {
index = cell.get('parentNode.rowIndex') +
shift[0] - rowIndexOffset;
row = tbody.get('children').item(index);
index = cell.get('cellIndex') + shift[1];
cell = row && row.get('children').item(index);
}
}
}
return cell || null;
},
/**
Returns the generated CSS classname based on the input. If the `host`
attribute is configured, it will attempt to relay to its `getClassName`
or use its static `NAME` property as a string base.
If `host` is absent or has neither method nor `NAME`, a CSS classname
will be generated using this class's `NAME`.
@method getClassName
@param {String} token* Any number of token strings to assemble the
classname from.
@return {String}
@protected
@since 3.5.0
**/
getClassName: function () {
var host = this.host,
args;
if (host && host.getClassName) {
return host.getClassName.apply(host, arguments);
} else {
args = toArray(arguments);
args.unshift(this.constructor.NAME);
return Y.ClassNameManager.getClassName
.apply(Y.ClassNameManager, args);
}
},
/**
Returns the Model associated to the row Node or id provided. Passing the
Node or id for a descendant of the row also works.
If no Model can be found, `null` is returned.
@method getRecord
@param {String|Node} seed Row Node or `id`, or one for a descendant of a row
@return {Model}
@since 3.5.0
**/
getRecord: function (seed) {
var modelList = this.get('modelList'),
tbody = this.tbodyNode,
row = null,
record;
if (tbody) {
if (isString(seed)) {
seed = tbody.one('#' + seed);
}
if (Y.instanceOf(seed, Y.Node)) {
row = seed.ancestor(function (node) {
return node.get('parentNode').compareTo(tbody);
}, true);
record = row &&
modelList.getByClientId(row.getData('yui3-record'));
}
}
return record || null;
},
/**
Returns the `<tr>` Node from the given row index, Model, or Model's
`clientId`. If the rows haven't been rendered yet, or if the row can't be
found by the input, `null` is returned.
@method getRow
@param {Number|String|Model} id Row index, Model instance, or clientId
@return {Node}
@since 3.5.0
**/
getRow: function (id) {
var tbody = this.tbodyNode,
row = null;
if (tbody) {
if (id) {
id = this._idMap[id.get ? id.get('clientId') : id] || id;
}
row = isNumber(id) ?
tbody.get('children').item(id) :
tbody.one('#' + id);
}
return row;
},
/**
Creates the table's `<tbody>` content by assembling markup generated by
populating the `ROW\_TEMPLATE`, and `CELL\_TEMPLATE` templates with content
from the `columns` and `modelList` attributes.
The rendering process happens in three stages:
1. A row template is assembled from the `columns` attribute (see
`_createRowTemplate`)
2. An HTML string is built up by concatening the application of the data in
each Model in the `modelList` to the row template. For cells with
`formatter`s, the function is called to generate cell content. Cells
with `nodeFormatter`s are ignored. For all other cells, the data value
from the Model attribute for the given column key is used. The
accumulated row markup is then inserted into the container.
3. If any column is configured with a `nodeFormatter`, the `modelList` is
iterated again to apply the `nodeFormatter`s.
Supported properties of the column objects include:
* `key` - Used to link a column to an attribute in a Model.
* `name` - Used for columns that don't relate to an attribute in the Model
(`formatter` or `nodeFormatter` only) if the implementer wants a
predictable name to refer to in their CSS.
* `cellTemplate` - Overrides the instance's `CELL_TEMPLATE` for cells in
this column only.
* `formatter` - Used to customize or override the content value from the
Model. These do not have access to the cell or row Nodes and should
return string (HTML) content.
* `nodeFormatter` - Used to provide content for a cell as well as perform
any custom modifications on the cell or row Node that could not be
performed by `formatter`s. Should be used sparingly for better
performance.
* `emptyCellValue` - String (HTML) value to use if the Model data for a
column, or the content generated by a `formatter`, is the empty string,
`null`, or `undefined`.
* `allowHTML` - Set to `true` if a column value, `formatter`, or
`emptyCellValue` can contain HTML. This defaults to `false` to protect
against XSS.
* `className` - Space delimited CSS classes to add to all `<td>`s in a
column.
Column `formatter`s are passed an object (`o`) with the following
properties:
* `value` - The current value of the column's associated attribute, if
any.
* `data` - An object map of Model keys to their current values.
* `record` - The Model instance.
* `column` - The column configuration object for the current column.
* `className` - Initially empty string to allow `formatter`s to add CSS
classes to the cell's `<td>`.
* `rowIndex` - The zero-based row number.
* `rowClass` - Initially empty string to allow `formatter`s to add CSS
classes to the cell's containing row `<tr>`.
They may return a value or update `o.value` to assign specific HTML
content. A returned value has higher precedence.
Column `nodeFormatter`s are passed an object (`o`) with the following
properties:
* `value` - The current value of the column's associated attribute, if
any.
* `td` - The `<td>` Node instance.
* `cell` - The `<div>` liner Node instance if present, otherwise, the
`<td>`. When adding content to the cell, prefer appending into this
property.
* `data` - An object map of Model keys to their current values.
* `record` - The Model instance.
* `column` - The column configuration object for the current column.
* `rowIndex` - The zero-based row number.
They are expected to inject content into the cell's Node directly, including
any "empty" cell content. Each `nodeFormatter` will have access through the
Node API to all cells and rows in the `<tbody>`, but not to the `<table>`,
as it will not be attached yet.
If a `nodeFormatter` returns `false`, the `o.td` and `o.cell` Nodes will be
`destroy()`ed to remove them from the Node cache and free up memory. The
DOM elements will remain as will any content added to them. _It is highly
advisable to always return `false` from your `nodeFormatter`s_.
@method render
@return {BodyView} The instance
@chainable
@since 3.5.0
**/
render: function () {
var table = this.get('container'),
data = this.get('modelList'),
columns = this.get('columns'),
tbody = this.tbodyNode ||
(this.tbodyNode = this._createTBodyNode());
// Needed for mutation
this._createRowTemplate(columns);
if (data) {
tbody.setHTML(this._createDataHTML(columns));
this._applyNodeFormatters(tbody, columns);
}
if (tbody.get('parentNode') !== table) {
table.appendChild(tbody);
}
this.bindUI();
return this;
},
// -- Protected and private methods ---------------------------------------
/**
Handles changes in the source's columns attribute. Redraws the table data.
@method _afterColumnsChange
@param {EventFacade} e The `columnsChange` event object
@protected
@since 3.5.0
**/
// TODO: Preserve existing DOM
// This will involve parsing and comparing the old and new column configs
// and reacting to four types of changes:
// 1. formatter, nodeFormatter, emptyCellValue changes
// 2. column deletions
// 3. column additions
// 4. column moves (preserve cells)
_afterColumnsChange: function (e) {
this.render();
},
/**
Handles modelList changes, including additions, deletions, and updates.
Modifies the existing table DOM accordingly.
@method _afterDataChange
@param {EventFacade} e The `change` event from the ModelList
@protected
@since 3.5.0
**/
_afterDataChange: function (e) {
//var type = e.type.slice(e.type.lastIndexOf(':') + 1);
// TODO: Isolate changes
this.render();
},
/**
Handles replacement of the modelList.
Rerenders the `<tbody>` contents.
@method _afterModelListChange
@param {EventFacade} e The `modelListChange` event
@protected
@since 3.6.0
**/
_afterModelListChange: function (e) {
var handles = this._eventHandles;
if (handles.dataChange) {
handles.dataChange.detach();
delete handles.dataChange;
this.bindUI();
}
if (this.tbodyNode) {
this.render();
}
},
/**
Iterates the `modelList`, and calls any `nodeFormatter`s found in the
`columns` param on the appropriate cell Nodes in the `tbody`.
@method _applyNodeFormatters
@param {Node} tbody The `<tbody>` Node whose columns to update
@param {Object[]} columns The column configurations
@protected
@since 3.5.0
**/
_applyNodeFormatters: function (tbody, columns) {
var host = this.host,
data = this.get('modelList'),
formatters = [],
linerQuery = '.' + this.getClassName('liner'),
rows, i, len;
// Only iterate the ModelList again if there are nodeFormatters
for (i = 0, len = columns.length; i < len; ++i) {
if (columns[i].nodeFormatter) {
formatters.push(i);
}
}
if (data && formatters.length) {
rows = tbody.get('childNodes');
data.each(function (record, index) {
var formatterData = {
data : record.toJSON(),
record : record,
rowIndex : index
},
row = rows.item(index),
i, len, col, key, cells, cell, keep;
if (row) {
cells = row.get('childNodes');
for (i = 0, len = formatters.length; i < len; ++i) {
cell = cells.item(formatters[i]);
if (cell) {
col = formatterData.column = columns[formatters[i]];
key = col.key || col.id;
formatterData.value = record.get(key);
formatterData.td = cell;
formatterData.cell = cell.one(linerQuery) || cell;
keep = col.nodeFormatter.call(host,formatterData);
if (keep === false) {
// Remove from the Node cache to reduce
// memory footprint. This also purges events,
// which you shouldn't be scoping to a cell
// anyway. You've been warned. Incidentally,
// you should always return false. Just sayin.
cell.destroy(true);
}
}
}
}
});
}
},
/**
Binds event subscriptions from the UI and the host (if assigned).
@method bindUI
@protected
@since 3.5.0
**/
bindUI: function () {
var handles = this._eventHandles,
modelList = this.get('modelList'),
changeEvent = modelList.model.NAME + ':change';
if (!handles.columnsChange) {
handles.columnsChange = this.after('columnsChange',
bind('_afterColumnsChange', this));
}
if (modelList && !handles.dataChange) {
handles.dataChange = modelList.after(
['add', 'remove', 'reset', changeEvent],
bind('_afterDataChange', this));
}
},
/**
Iterates the `modelList` and applies each Model to the `_rowTemplate`,
allowing any column `formatter` or `emptyCellValue` to override cell
content for the appropriate column. The aggregated HTML string is
returned.
@method _createDataHTML
@param {Object[]} columns The column configurations to customize the
generated cell content or class names
@return {HTML} The markup for all Models in the `modelList`, each applied
to the `_rowTemplate`
@protected
@since 3.5.0
**/
_createDataHTML: function (columns) {
var data = this.get('modelList'),
html = '';
if (data) {
data.each(function (model, index) {
html += this._createRowHTML(model, index, columns);
}, this);
}
return html;
},
/**
Applies the data of a given Model, modified by any column formatters and
supplemented by other template values to the instance's `_rowTemplate` (see
`_createRowTemplate`). The generated string is then returned.
The data from Model's attributes is fetched by `toJSON` and this data
object is appended with other properties to supply values to {placeholders}
in the template. For a template generated from a Model with 'foo' and 'bar'
attributes, the data object would end up with the following properties
before being used to populate the `_rowTemplate`:
* `clientID` - From Model, used the assign the `<tr>`'s 'id' attribute.
* `foo` - The value to populate the 'foo' column cell content. This
value will be the value stored in the Model's `foo` attribute, or the
result of the column's `formatter` if assigned. If the value is '',
`null`, or `undefined`, and the column's `emptyCellValue` is assigned,
that value will be used.
* `bar` - Same for the 'bar' column cell content.
* `foo-className` - String of CSS classes to apply to the `<td>`.
* `bar-className` - Same.
* `rowClass` - String of CSS classes to apply to the `<tr>`. This
will be the odd/even class per the specified index plus any additional
classes assigned by column formatters (via `o.rowClass`).
Because this object is available to formatters, any additional properties
can be added to fill in custom {placeholders} in the `_rowTemplate`.
@method _createRowHTML
@param {Model} model The Model instance to apply to the row template
@param {Number} index The index the row will be appearing
@param {Object[]} columns The column configurations
@return {HTML} The markup for the provided Model, less any `nodeFormatter`s
@protected
@since 3.5.0
**/
_createRowHTML: function (model, index, columns) {
var data = model.toJSON(),
clientId = model.get('clientId'),
values = {
rowId : this._getRowId(clientId),
clientId: clientId,
rowClass: (index % 2) ? this.CLASS_ODD : this.CLASS_EVEN
},
host = this.host || this,
i, len, col, token, value, formatterData;
for (i = 0, len = columns.length; i < len; ++i) {
col = columns[i];
value = data[col.key];
token = col._id || col.key;
values[token + '-className'] = '';
if (col.formatter) {
formatterData = {
value : value,
data : data,
column : col,
record : model,
className: '',
rowClass : '',
rowIndex : index
};
if (typeof col.formatter === 'string') {
if (value !== undefined) {
// TODO: look for known formatters by string name
value = fromTemplate(col.formatter, formatterData);
}
} else {
// Formatters can either return a value
value = col.formatter.call(host, formatterData);
// or update the value property of the data obj passed
if (value === undefined) {
value = formatterData.value;
}
values[token + '-className'] = formatterData.className;
values.rowClass += ' ' + formatterData.rowClass;
}
}
if (value === undefined || value === null || value === '') {
value = col.emptyCellValue || '';
}
values[token] = col.allowHTML ? value : htmlEscape(value);
values.rowClass = values.rowClass.replace(/\s+/g, ' ');
}
return fromTemplate(this._rowTemplate, values);
},
/**
Creates a custom HTML template string for use in generating the markup for
individual table rows with {placeholder}s to capture data from the Models
in the `modelList` attribute or from column `formatter`s.
Assigns the `_rowTemplate` property.
@method _createRowTemplate
@param {Object[]} columns Array of column configuration objects
@protected
@since 3.5.0
**/
_createRowTemplate: function (columns) {
var html = '',
cellTemplate = this.CELL_TEMPLATE,
i, len, col, key, token, headers, tokenValues;
for (i = 0, len = columns.length; i < len; ++i) {
col = columns[i];
key = col.key;
token = col._id || key;
// Only include headers if there are more than one
headers = (col._headers || []).length > 1 ?
'headers="' + col._headers.join(' ') + '"' : '';
tokenValues = {
content : '{' + token + '}',
headers : headers,
className: this.getClassName('col', token) + ' ' +
(col.className || '') + ' ' +
this.getClassName('cell') +
' {' + token + '-className}'
};
if (col.nodeFormatter) {
// Defer all node decoration to the formatter
tokenValues.content = '';
}
html += fromTemplate(col.cellTemplate || cellTemplate, tokenValues);
}
this._rowTemplate = fromTemplate(this.ROW_TEMPLATE, {
content: html
});
},
/**
Creates the `<tbody>` node that will store the data rows.
@method _createTBodyNode
@return {Node}
@protected
@since 3.6.0
**/
_createTBodyNode: function () {
return Y.Node.create(fromTemplate(this.TBODY_TEMPLATE, {
className: this.getClassName('data')
}));
},
/**
Destroys the instance.
@method destructor
@protected
@since 3.5.0
**/
destructor: function () {
(new Y.EventHandle(YObject.values(this._eventHandles))).detach();
},
/**
Holds the event subscriptions needing to be detached when the instance is
`destroy()`ed.
@property _eventHandles
@type {Object}
@default undefined (initially unset)
@protected
@since 3.5.0
**/
//_eventHandles: null,
/**
Returns the row ID associated with a Model's clientId.
@method _getRowId
@param {String} clientId The Model clientId
@return {String}
@protected
**/
_getRowId: function (clientId) {
return this._idMap[clientId] || (this._idMap[clientId] = Y.guid());
},
/**
Map of Model clientIds to row ids.
@property _idMap
@type {Object}
@protected
**/
//_idMap,
/**
Initializes the instance. Reads the following configuration properties in
addition to the instance attributes:
* `columns` - (REQUIRED) The initial column information
* `host` - The object to serve as source of truth for column info and
for generating class names
@method initializer
@param {Object} config Configuration data
@protected
@since 3.5.0
**/
initializer: function (config) {
this.host = config.host;
this._eventHandles = {
modelListChange: this.after('modelListChange',
bind('_afterModelListChange', this))
};
this._idMap = {};
this.CLASS_ODD = this.getClassName('odd');
this.CLASS_EVEN = this.getClassName('even');
}
/**
The HTML template used to create a full row of markup for a single Model in
the `modelList` plus any customizations defined in the column
configurations.
@property _rowTemplate
@type {HTML}
@default (initially unset)
@protected
@since 3.5.0
**/
//_rowTemplate: null
});
}, '@VERSION@', {"requires": ["datatable-core", "view", "classnamemanager"]});
|
src/names/list/locked/EditLockedNameInfo.js | VasilyShelkov/ClientRelationshipManagerUI | import React from 'react';
import { connect } from 'react-redux';
import moment from 'moment';
import FlatButton from 'material-ui/FlatButton';
import PhoneIcon from 'material-ui/svg-icons/communication/phone';
import CancelIcon from 'material-ui/svg-icons/content/clear';
import NameDialogForm from '../../NameDialog';
import {
closeEditProtectedNameCallDialog,
closeEditProtectedNameMeetingDialog,
} from '../../nameActions';
import { MetWithProtectedIcon } from '../../../app/icons';
export const EditNameProtectedInfo = ({
names,
editMeetingDialogOpen,
editCallDialogOpen,
onSubmitBookMeeting,
onSubmitBookCall,
closeEditMeetingDialog,
closeEditCallDialog,
}) => {
if (editMeetingDialogOpen !== false) {
const nameMeetingToEdit = names.find(
name => name.name.id === editMeetingDialogOpen,
);
const displayName = `${nameMeetingToEdit.name.firstName} ${
nameMeetingToEdit.name.lastName
}`;
return (
<NameDialogForm
title={`Edit ${displayName}`}
displayName={displayName}
open={editMeetingDialogOpen !== false}
close={closeEditMeetingDialog}
onSubmit={onSubmitBookMeeting(editMeetingDialogOpen)}
initialValues={{
meetingDay: nameMeetingToEdit.meetingBooked
? moment(nameMeetingToEdit.meetingBooked).toDate()
: null,
meetingTime: nameMeetingToEdit.meetingBooked
? moment(nameMeetingToEdit.meetingBooked).toDate()
: null,
}}
actions={[
<FlatButton
secondary
onClick={closeEditMeetingDialog}
label="Cancel"
icon={<CancelIcon />}
/>,
<FlatButton
primary
id="submitEditProtectedMeeting"
form="protectNameForm"
type="submit"
label="Book Meeting"
icon={<MetWithProtectedIcon />}
/>,
]}
/>
);
}
if (editCallDialogOpen !== false) {
const nameCallToEdit = names.find(
name => name.name.id === editCallDialogOpen,
);
const displayName = `${nameCallToEdit.name.firstName} ${
nameCallToEdit.name.lastName
}`;
return (
<NameDialogForm
title={`Edit ${displayName}`}
displayName={displayName}
open={editCallDialogOpen !== false}
close={closeEditCallDialog}
onSubmit={onSubmitBookCall(editCallDialogOpen)}
initialValues={{
callDay: nameCallToEdit.callBooked
? moment(nameCallToEdit.callBooked).toDate()
: null,
callTime: nameCallToEdit.callBooked
? moment(nameCallToEdit.callBooked).toDate()
: null,
}}
actions={[
<FlatButton
secondary
onClick={closeEditCallDialog}
label="Cancel"
icon={<CancelIcon />}
/>,
<FlatButton
primary
id="submitEditProtectedCall"
form="protectNameForm"
type="submit"
label="Book Call"
icon={<PhoneIcon />}
/>,
]}
/>
);
}
return null;
};
const mapStateToProps = state => ({
editCallDialogOpen: state.name.editProtectedNameCallDialogOpen,
editMeetingDialogOpen: state.name.editProtectedNameMeetingDialogOpen,
});
const mapDispatchToProps = dispatch => ({
closeEditCallDialog: () => dispatch(closeEditProtectedNameCallDialog()),
closeEditMeetingDialog: () => dispatch(closeEditProtectedNameMeetingDialog()),
});
export default connect(mapStateToProps, mapDispatchToProps)(
EditNameProtectedInfo,
);
|
src/components/common/svg-icons/image/camera-roll.js | abzfarah/Pearson.NAPLAN.GnomeH | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageCameraRoll = (props) => (
<SvgIcon {...props}>
<path d="M14 5c0-1.1-.9-2-2-2h-1V2c0-.55-.45-1-1-1H6c-.55 0-1 .45-1 1v1H4c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2h8V5h-8zm-2 13h-2v-2h2v2zm0-9h-2V7h2v2zm4 9h-2v-2h2v2zm0-9h-2V7h2v2zm4 9h-2v-2h2v2zm0-9h-2V7h2v2z"/>
</SvgIcon>
);
ImageCameraRoll = pure(ImageCameraRoll);
ImageCameraRoll.displayName = 'ImageCameraRoll';
ImageCameraRoll.muiName = 'SvgIcon';
export default ImageCameraRoll;
|
addons/docs/src/lib/convert/__testfixtures__/proptypes/arrays.js | kadirahq/react-storybook | import React from 'react';
import PropTypes from 'prop-types';
export const Component = (props) => <>JSON.stringify(props)</>;
Component.propTypes = {
optionalArray: PropTypes.array,
arrayOfStrings: PropTypes.arrayOf(PropTypes.string),
arrayOfShape: PropTypes.arrayOf(
PropTypes.shape({
active: PropTypes.bool,
})
),
};
|
packages/react-tv-navigation/__tests__/with-navigation-test.js | raphamorim/react-tv | import React from 'react';
import Enzyme, { mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
import SpatialNavigation from '../src/spatial-navigation';
import withNavigation from '../src/with-navigation';
describe('withNavigation', () => {
const Component = () => <div />;
const EnhancedComponent = withNavigation(Component);
const renderComponent = () => mount(<EnhancedComponent />);
let component;
describe('#setFocus', () => {
beforeEach(() => {
spyOn(SpatialNavigation, 'setCurrentFocusedPath').and.callThrough();
component = renderComponent();
});
describe('for the same focusPath', () => {
it('does nothing', () => {
component.setState({ currentFocusPath: 'focusPath' });
component.children().props().setFocus('focusPath');
expect(SpatialNavigation.setCurrentFocusedPath).not.toHaveBeenCalled();
});
});
describe('for a different focusPath', () => {
it('updates navigation currentFocusPath', () => {
component.setState({ currentFocusPath: 'focusPath' });
component.children().props().setFocus('anotherFocusPath');
expect(SpatialNavigation.getCurrentFocusedPath())
.toEqual('anotherFocusPath');
});
it('updates currentFocusPath state', () => {
component.setState({ currentFocusPath: 'focusPath' });
component.children().props().setFocus('anotherFocusPath');
expect(component.state().currentFocusPath).toEqual('anotherFocusPath');
});
});
});
describe('lifecycle', () => {
beforeEach(() => {
spyOn(SpatialNavigation, 'init');
spyOn(SpatialNavigation, 'destroy');
});
it('initializes after component mounts', () => {
component = renderComponent();
expect(SpatialNavigation.init).toHaveBeenCalled();
});
it('initializes after component updates', () => {
component = renderComponent();
SpatialNavigation.init.calls.reset();
expect(SpatialNavigation.init).not.toHaveBeenCalled();
component.setProps({ prop: 'test' });
expect(SpatialNavigation.init).toHaveBeenCalled();
});
it('destroys after component unmounts', () => {
component = renderComponent();
component.unmount();
expect(SpatialNavigation.destroy).toHaveBeenCalled();
});
});
});
|
ajax/libs/vega/5.0.0-rc2/vega.min.js | sufuf3/cdnjs | !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t=t||self).vega={})}(this,function(t){"use strict";function n(t,n,e){return t.fields=n||[],t.fname=e,t}function e(t){return null==t?null:t.fname}function r(t){return null==t?null:t.fields}function i(t){throw Error(t)}function a(t){var n,e,r,a=[],u=null,o=0,s=t.length,l="";function c(){a.push(l+t.substring(n,e)),l="",n=e+1}for(t+="",n=e=0;e<s;++e)if("\\"===(r=t[e]))l+=t.substring(n,e),n=++e;else if(r===u)c(),u=null,o=-1;else{if(u)continue;n===o&&'"'===r?(n=e+1,u=r):n===o&&"'"===r?(n=e+1,u=r):"."!==r||o?"["===r?(e>n&&c(),o=n=e+1):"]"===r&&(o||i("Access path missing open bracket: "+t),o>0&&c(),o=0,n=e+1):e>n?c():n=e+1}return o&&i("Access path missing closing bracket: "+t),u&&i("Access path missing closing quote: "+t),e>n&&(e++,c()),a}var u=Array.isArray;function o(t){return t===Object(t)}function s(t){return"string"==typeof t}function l(t){return u(t)?"["+t.map(l)+"]":o(t)||s(t)?JSON.stringify(t).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):t}function c(t,e){var r=a(t),i="return _["+r.map(l).join("][")+"];";return n(Function("_",i),[t=1===r.length?r[0]:t],e||t)}var f=[],h=c("id"),d=n(function(t){return t},f,"identity"),p=n(function(){return 0},f,"zero"),g=n(function(){return 1},f,"one"),v=n(function(){return!0},f,"true"),m=n(function(){return!1},f,"false");function y(t,n,e){var r=[n].concat([].slice.call(e));console[t].apply(console,r)}var _=0,x=1,b=2,w=3,A=4;function M(t){var n=t||_;return{level:function(t){return arguments.length?(n=+t,this):n},error:function(){return n>=x&&y("error","ERROR",arguments),this},warn:function(){return n>=b&&y("warn","WARN",arguments),this},info:function(){return n>=w&&y("log","INFO",arguments),this},debug:function(){return n>=A&&y("log","DEBUG",arguments),this}}}function k(t){return t[t.length-1]}function E(t){return null==t||""===t?null:+t}function C(t){return function(n){return t*Math.exp(n)}}function D(t){return function(n){return Math.log(t*n)}}function F(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function S(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function B(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function N(t,n,e,r){var i=e(t[0]),a=e(k(t)),u=(a-i)*n;return[r(i-u),r(a-u)]}function O(t,n){return N(t,n,E,d)}function z(t,n){var e=Math.sign(t[0]);return N(t,n,D(e),C(e))}function T(t,n,e){return N(t,n,B(e),B(1/e))}function R(t,n,e){return N(t,n,F(e),S(e))}function P(t,n,e,r,i){var a=r(t[0]),u=r(k(t)),o=null!=n?r(n):(a+u)/2;return[i(o+(a-o)*e),i(o+(u-o)*e)]}function L(t,n,e){return P(t,n,e,E,d)}function q(t,n,e){var r=Math.sign(t[0]);return P(t,n,e,D(r),C(r))}function U(t,n,e,r){return P(t,n,e,B(r),B(1/r))}function j(t,n,e,r){return P(t,n,e,F(r),S(r))}function I(t){return 1+~~(new Date(t).getMonth()/3)}function $(t){return 1+~~(new Date(t).getUTCMonth()/3)}function W(t){return null!=t?u(t)?t:[t]:[]}function H(t,n,e){var r,i=t[0],a=t[1];return a<i&&(r=a,a=i,i=r),(r=a-i)>=e-n?[n,e]:[i=Math.min(Math.max(i,n),e-r),i+r]}function Y(t){return"function"==typeof t}function G(t,e){var i,u,o,s,c,f,h,d,p,g=[],v=(t=W(t)).map(function(t,n){return null==t?null:(g.push(n),Y(t)?t:a(t).map(l).join("]["))}),m=g.length-1,y=W(e),_="var u,v;return ";if(m<0)return null;for(u=0;u<=m;++u)Y(o=v[i=g[u]])?(s="(u=this."+(f="f"+i)+"(a))",c="(v=this."+f+"(b))",(h=h||{})[f]=o):(s="(u=a["+o+"])",c="(v=b["+o+"])"),f="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==y[i]?(p=1,d=-1):(p=-1,d=1),_+="("+s+"<"+c+"||u==null)&&v!=null?"+d+":(u>v||v==null)&&u!=null?"+p+":"+f+"!==u&&v===v?"+d+":v!==v&&u===u?"+p+(i<m?":":":0");return o=Function("a","b",_+";"),h&&(o=o.bind(h)),t=t.reduce(function(t,n){return Y(n)?(r(n)||[]).forEach(function(n){t[n]=1}):null!=n&&(t[n+""]=1),t},{}),n(o,Object.keys(t))}function V(t){return Y(t)?t:function(){return t}}function X(t,n){var e,r;function i(){n(r),e=r=null}return function(n){r=n,e&&clearTimeout(e),e=setTimeout(i,t)}}function Z(t){for(var n,e,r=1,i=arguments.length;r<i;++r)for(e in n=arguments[r])t[e]=n[e];return t}function J(t,n){var e,r,i,a,u=0;if(t&&(e=t.length))if(null==n){for(r=t[u];null==r||r!=r;r=t[++u]);for(i=a=r;u<e;++u)null!=(r=t[u])&&(r<i&&(i=r),r>a&&(a=r))}else{for(r=n(t[u]);null==r||r!=r;r=n(t[++u]));for(i=a=r;u<e;++u)null!=(r=n(t[u]))&&(r<i&&(i=r),r>a&&(a=r))}return[i,a]}function Q(t,n){var e,r,i,a,u,o=-1,s=t.length;if(null==n){for(;++o<s;)if(null!=(r=t[o])&&r>=r){e=i=r;break}for(a=u=o;++o<s;)null!=(r=t[o])&&(e>r&&(e=r,a=o),i<r&&(i=r,u=o))}else{for(;++o<s;)if(null!=(r=n(t[o],o,t))&&r>=r){e=i=r;break}for(a=u=o;++o<s;)null!=(r=n(t[o],o,t))&&(e>r&&(e=r,a=o),i<r&&(i=r,u=o))}return[a,u]}var K={};function tt(t){var n,e,r={};function i(t){return r.hasOwnProperty(t)&&r[t]!==K}return n={size:0,empty:0,object:r,has:i,get:function(t){return i(t)?r[t]:void 0},set:function(t,e){return i(t)||(++n.size,r[t]===K&&--n.empty),r[t]=e,this},delete:function(t){return i(t)&&(--n.size,++n.empty,r[t]=K),this},clear:function(){n.size=n.empty=0,n.object=r={}},test:function(t){return arguments.length?(e=t,n):e},clean:function(){var t,i,a={},u=0;for(t in r)(i=r[t])===K||e&&e(i)||(a[t]=i,++u);n.size=u,n.empty=0,n.object=r=a}},t&&Object.keys(t).forEach(function(e){n.set(e,t[e])}),n}function nt(t,n,e,r,i,a){if(!e&&0!==e)return a;var u,o,s=t[0],l=k(t),c=+e;return l<s&&(u=s,s=l,l=u),(u=Math.abs(n-s))<(o=Math.abs(l-n))&&u<=c?r:o<=c?i:a}function et(t,n){var e=t.prototype=Object.create(n.prototype);return e.constructor=t,e}function rt(t,n,e,r){var i,a=n[0],u=n[n.length-1];return a>u&&(i=a,a=u,u=i),r=void 0===r||r,((e=void 0===e||e)?a<=t:a<t)&&(r?t<=u:t<u)}function it(t){return"boolean"==typeof t}function at(t){return"[object Date]"===Object.prototype.toString.call(t)}function ut(t){return"number"==typeof t}function ot(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function st(t,e){return t&&(t=e?W(t).map(function(t){return t.replace(/\\(.)/g,"$1")}):W(t)),n(t&&t.length?Function("_","return ''+"+t.map(function(t){return"_["+(e?l(t):a(t).map(l).join("]["))+"]"}).join("+'|'+")+";"):function(){return""},t,"key")}function lt(t,n,e,r){var i=n.length,a=e.length;if(!a)return n;if(!i)return e;for(var u=r||new n.constructor(i+a),o=0,s=0,l=0;o<i&&s<a;++l)u[l]=t(n[o],e[s])>0?e[s++]:n[o++];for(;o<i;++o,++l)u[l]=n[o];for(;s<a;++s,++l)u[l]=e[s];return u}function ct(t,n){for(var e="";--n>=0;)e+=t;return e}function ft(t,n,e,r){var i=e||" ",a=t+"",u=n-a.length;return u<=0?a:"left"===r?ct(i,u)+a:"center"===r?ct(i,~~(u/2))+a+ct(i,Math.ceil(u/2)):a+ct(i,u)}function ht(t){return k(t)-t[0]||0}function dt(t){return null==t||""===t?null:!(!t||"false"===t||"0"===t)&&!!t}function pt(t){return ut(t)?t:at(t)?t:Date.parse(t)}function gt(t,n){return n=n||pt,null==t||""===t?null:n(t)}function vt(t){return null==t||""===t?null:t+""}function mt(t){for(var n={},e=0,r=t.length;e<r;++e)n[t[e]]=!0;return n}function yt(t,n,e,r){var i=null!=r?r:"…",a=t+"",u=a.length,o=Math.max(0,n-i.length);return u<=n?a:"left"===e?i+a.slice(u-o):"center"===e?a.slice(0,Math.ceil(o/2))+i+a.slice(u-~~(o/2)):a.slice(0,o)+i}function _t(t,n,e){if(t){var r,i=0,a=t.length;if(n)for(;i<a;++i)(r=n(t[i]))&&e(r,i,t);else t.forEach(e)}}function xt(t){var n=t||d,e=[],r={};return e.add=function(t){var i=n(t);return r[i]||(r[i]=1,e.push(t)),e},e.remove=function(t){var i,a=n(t);return r[a]&&(r[a]=0,(i=e.indexOf(t))>=0&&e.splice(i,1)),e},e}async function bt(t,n){try{await n(t)}catch(n){t.error(n)}}var wt=Symbol("vega_id"),At=1;function Mt(t){return!(!t||!kt(t))}function kt(t){return t[wt]}function Et(t,n){return t[wt]=n,t}function Ct(t){var n=t===Object(t)?t:{data:t};return kt(n)?n:Et(n,At++)}function Dt(t){return Ft(t,Ct({}))}function Ft(t,n){for(var e in t)n[e]=t[e];return n}function St(t,n){return Et(n,kt(t))}function Bt(t){return t&&t.constructor===Nt}function Nt(){var t=[],n=[],e=[],r=[],i=[],a=!1;return{constructor:Nt,insert:function(n){for(var e=W(n),r=0,i=e.length;r<i;++r)t.push(e[r]);return this},remove:function(t){for(var e=Y(t)?r:n,i=W(t),a=0,u=i.length;a<u;++a)e.push(i[a]);return this},modify:function(t,n,r){var a={field:n,value:V(r)};return Y(t)?(a.filter=t,i.push(a)):(a.tuple=t,e.push(a)),this},encode:function(t,n){return Y(t)?i.push({filter:t,field:n}):e.push({tuple:t,field:n}),this},reflow:function(){return a=!0,this},pulse:function(u,o){var s,l,c,f,h,d,p={},g={};for(s=0,l=o.length;s<l;++s)p[kt(o[s])]=1;for(s=0,l=n.length;s<l;++s)p[kt(h=n[s])]=-1;for(s=0,l=r.length;s<l;++s)f=r[s],o.forEach(function(t){f(t)&&(p[kt(t)]=-1)});for(s=0,l=t.length;s<l;++s)d=kt(h=t[s]),p[d]?p[d]=1:u.add.push(Ct(t[s]));for(s=0,l=o.length;s<l;++s)h=o[s],p[kt(h)]<0&&u.rem.push(h);function v(t,n,e){e?t[n]=e(t):u.encode=n,a||(g[kt(t)]=t)}for(s=0,l=e.length;s<l;++s)h=(c=e[s]).tuple,f=c.field,(d=p[kt(h)])>0&&(v(h,f,c.value),u.modifies(f));for(s=0,l=i.length;s<l;++s)c=i[s],f=c.filter,o.forEach(function(t){f(t)&&p[kt(t)]>0&&v(t,c.field,c.value)}),u.modifies(c.field);if(a)u.mod=n.length||r.length?o.filter(function(t){return p[kt(t)]>0}):o.slice();else for(d in g)u.mod.push(g[d]);return u}}}var Ot="_:mod:_";function zt(){Object.defineProperty(this,Ot,{writable:!0,value:{}})}var Tt=zt.prototype;Tt.set=function(t,n,e,r){var i=this,a=i[t],o=i[Ot];return null!=n&&n>=0?(a[n]!==e||r)&&(a[n]=e,o[n+":"+t]=-1,o[t]=-1):(a!==e||r)&&(i[t]=e,o[t]=u(e)?1+e.length:-1),i},Tt.modified=function(t,n){var e,r=this[Ot];if(!arguments.length){for(e in r)if(r[e])return!0;return!1}if(u(t)){for(e=0;e<t.length;++e)if(r[t[e]])return!0;return!1}return null!=n&&n>=0?n+1<r[t]||!!r[n+":"+t]:!!r[t]},Tt.clear=function(){return this[Ot]={},this};var Rt=0,Pt=new zt;function Lt(t,n,e,r){this.id=++Rt,this.value=t,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,n&&(this._update=n),e&&this.parameters(e,r)}var qt=Lt.prototype;function Ut(t){return function(n){var e=this.flags;return 0===arguments.length?!!(e&t):(this.flags=n?e|t:e&~t,this)}}qt.targets=function(){return this._targets||(this._targets=xt(h))},qt.set=function(t){return this.value!==t?(this.value=t,1):0},qt.skip=Ut(1),qt.modified=Ut(2),qt.parameters=function(t,n,e){n=!1!==n;var r,a,o,s,l=this,c=l._argval=l._argval||new zt,f=l._argops=l._argops||[],h=[];function d(t,e,r){r instanceof Lt?(r!==l&&(n&&r.targets().add(l),h.push(r)),f.push({op:r,name:t,index:e})):c.set(t,e,r)}for(r in t)if(a=t[r],"pulse"===r)W(a).forEach(function(t){t instanceof Lt?t!==l&&(t.targets().add(l),h.push(t)):i("Pulse parameters must be operator instances.")}),l.source=a;else if(u(a))for(c.set(r,-1,Array(o=a.length)),s=0;s<o;++s)d(r,s,a[s]);else d(r,-1,a);return this.marshall().clear(),e&&(f.initonly=!0),h},qt.marshall=function(t){var n,e,r,i,a,u=this._argval||Pt,o=this._argops;if(o){for(e=0,r=o.length;e<r;++e)a=(i=(n=o[e]).op).modified()&&i.stamp===t,u.set(n.name,n.index,i.value,a);if(o.initonly){for(e=0;e<r;++e)(n=o[e]).op.targets().remove(this);this._argops=null,this._update=null}}return u},qt.evaluate=function(t){var n=this._update;if(n){var e=this.marshall(t.stamp),r=n.call(this,e,t);if(e.clear(),r!==this.value)this.value=r;else if(!this.modified())return t.StopPropagation}},qt.run=function(t){return t.stamp<=this.stamp?t.StopPropagation:(this.skip()?(this.skip(!1),n=0):n=this.evaluate(t),this.stamp=t.stamp,this.pulse=n||t);var n};var jt=0;function It(t,n,e){this.id=++jt,this.value=null,e&&(this.receive=e),t&&(this._filter=t),n&&(this._apply=n)}function $t(t,n,e){return new It(t,n,e)}var Wt=It.prototype;Wt._filter=v,Wt._apply=d,Wt.targets=function(){return this._targets||(this._targets=xt(h))},Wt.consume=function(t){return arguments.length?(this._consume=!!t,this):!!this._consume},Wt.receive=function(t){if(this._filter(t)){for(var n=this.value=this._apply(t),e=this._targets,r=e?e.length:0,i=0;i<r;++i)e[i].receive(n);this._consume&&(t.preventDefault(),t.stopPropagation())}},Wt.filter=function(t){var n=$t(t);return this.targets().add(n),n},Wt.apply=function(t){var n=$t(null,t);return this.targets().add(n),n},Wt.merge=function(){var t=$t();this.targets().add(t);for(var n=0,e=arguments.length;n<e;++n)arguments[n].targets().add(t);return t},Wt.throttle=function(t){var n=-1;return this.filter(function(){var e=Date.now();return e-n>t?(n=e,1):0})},Wt.debounce=function(t){var n=$t();return this.targets().add($t(null,null,X(t,function(t){var e=t.dataflow;n.receive(t),e&&e.run&&e.run()}))),n},Wt.between=function(t,n){var e=!1;return t.targets().add($t(null,null,function(){e=!0})),n.targets().add($t(null,null,function(){e=!1})),this.filter(function(){return e})};var Ht=/^([A-Za-z]+:)?\/\//,Yt="file://";async function Gt(t,n){const e=await this.sanitize(t,n),r=e.href;return e.localFile?this.file(r):this.http(r,n)}async function Vt(t,n){n=Z({},this.options,n);const e=this.fileAccess,r={href:null};let a,u,o,s;return null!=t&&"string"==typeof t||i("Sanitize failure, invalid URI: "+l(t)),u=Ht.test(t),(s=n.baseURL)&&!u&&(t.startsWith("/")||"/"===s[s.length-1]||(t="/"+t),t=s+t),o=(a=t.startsWith(Yt))||"file"===n.mode||"http"!==n.mode&&!u&&e,a?t=t.slice(Yt.length):t.startsWith("//")&&("file"===n.defaultProtocol?(t=t.slice(2),o=!0):t=(n.defaultProtocol||"http")+":"+t),Object.defineProperty(r,"localFile",{value:!!o}),r.href=t,n.target&&(r.target=n.target+""),n.rel&&(r.rel=n.rel+""),r}function Xt(t){return t?function(n){return new Promise(function(e,r){t.readFile(n,function(t,n){t?r(t):e(n)})})}:Zt}async function Zt(){i("No file system access.")}function Jt(t){return t?async function(n,e){const r=Z({},this.options.http,e),a=e&&e.response,u=await t(n,r);return u.ok?Y(u[a])?u[a]():u.text():i(u.status+""+u.statusText)}:Qt}async function Qt(){i("No HTTP fetch method available.")}var Kt={boolean:dt,integer:E,number:E,date:gt,string:vt,unknown:d},tn=[function(t){return"true"===t||"false"===t||!0===t||!1===t},function(t){return an(t)&&(t=+t)==~~t},an,function(t){return!isNaN(Date.parse(t))}],nn=["boolean","integer","number","date"];function en(t,n){if(!t||!t.length)return"unknown";var e,r,i,a,u=0,o=t.length,s=tn.length,l=tn.map(function(t,n){return n+1});for(r=0,o=t.length;r<o;++r)for(e=n?t[r][n]:t[r],i=0;i<s;++i)if(l[i]&&(null!=(a=e)&&a==a)&&!tn[i](e)&&(l[i]=0,++u===tn.length))return"string";return u=l.reduce(function(t,n){return 0===t?n:t},0)-1,nn[u]}function rn(t,n){return n.reduce(function(n,e){return n[e]=en(t,e),n},{})}function an(t){return!(isNaN(+t)||t instanceof Date)}var un={},on={},sn=34,ln=10,cn=13;function fn(t){return new Function("d","return {"+t.map(function(t,n){return JSON.stringify(t)+": d["+n+"]"}).join(",")+"}")}function hn(t){var n=Object.create(null),e=[];return t.forEach(function(t){for(var r in t)r in n||e.push(n[r]=r)}),e}function dn(t,n){var e=t+"",r=e.length;return r<n?new Array(n-r+1).join(0)+e:e}function pn(t){var n,e=t.getUTCHours(),r=t.getUTCMinutes(),i=t.getUTCSeconds(),a=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((n=t.getUTCFullYear())<0?"-"+dn(-n,6):n>9999?"+"+dn(n,6):dn(n,4))+"-"+dn(t.getUTCMonth()+1,2)+"-"+dn(t.getUTCDate(),2)+(a?"T"+dn(e,2)+":"+dn(r,2)+":"+dn(i,2)+"."+dn(a,3)+"Z":i?"T"+dn(e,2)+":"+dn(r,2)+":"+dn(i,2)+"Z":r||e?"T"+dn(e,2)+":"+dn(r,2)+"Z":"")}function gn(t){var n=new RegExp('["'+t+"\n\r]"),e=t.charCodeAt(0);function r(t,n){var r,i=[],a=t.length,u=0,o=0,s=a<=0,l=!1;function c(){if(s)return on;if(l)return l=!1,un;var n,r,i=u;if(t.charCodeAt(i)===sn){for(;u++<a&&t.charCodeAt(u)!==sn||t.charCodeAt(++u)===sn;);return(n=u)>=a?s=!0:(r=t.charCodeAt(u++))===ln?l=!0:r===cn&&(l=!0,t.charCodeAt(u)===ln&&++u),t.slice(i+1,n-1).replace(/""/g,'"')}for(;u<a;){if((r=t.charCodeAt(n=u++))===ln)l=!0;else if(r===cn)l=!0,t.charCodeAt(u)===ln&&++u;else if(r!==e)continue;return t.slice(i,n)}return s=!0,t.slice(i,a)}for(t.charCodeAt(a-1)===ln&&--a,t.charCodeAt(a-1)===cn&&--a;(r=c())!==on;){for(var f=[];r!==un&&r!==on;)f.push(r),r=c();n&&null==(f=n(f,o++))||i.push(f)}return i}function i(n,e){return n.map(function(n){return e.map(function(t){return u(n[t])}).join(t)})}function a(n){return n.map(u).join(t)}function u(t){return null==t?"":t instanceof Date?pn(t):n.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,n){var e,i,a=r(t,function(t,r){if(e)return e(t,r-1);i=t,e=n?function(t,n){var e=fn(t);return function(r,i){return n(e(r),i,t)}}(t,n):fn(t)});return a.columns=i||[],a},parseRows:r,format:function(n,e){return null==e&&(e=hn(n)),[e.map(u).join(t)].concat(i(n,e)).join("\n")},formatBody:function(t,n){return null==n&&(n=hn(t)),i(t,n).join("\n")},formatRows:function(t){return t.map(a).join("\n")}}}gn(","),gn("\t");function vn(t){const n=function(n,e){const r={delimiter:t};return mn(n,e?Z(e,r):r)};return n.responseType="text",n}function mn(t,n){return n.header&&(t=n.header.map(l).join(n.delimiter)+"\n"+t),gn(n.delimiter).parse(t+"")}function yn(t,n){const e=n&&n.property?c(n.property):d;return!o(t)||(r=t,"function"==typeof Buffer&&Y(Buffer.isBuffer)&&Buffer.isBuffer(r))?e(JSON.parse(t)):function(t,n){return n&&n.copy?JSON.parse(JSON.stringify(t)):t}(e(t));var r}function _n(t){return t}function xn(t,n){return"GeometryCollection"===n.type?{type:"FeatureCollection",features:n.geometries.map(function(n){return bn(t,n)})}:bn(t,n)}function bn(t,n){var e=n.id,r=n.bbox,i=null==n.properties?{}:n.properties,a=wn(t,n);return null==e&&null==r?{type:"Feature",properties:i,geometry:a}:null==r?{type:"Feature",id:e,properties:i,geometry:a}:{type:"Feature",id:e,bbox:r,properties:i,geometry:a}}function wn(t,n){var e=function(t){if(null==t)return _n;var n,e,r=t.scale[0],i=t.scale[1],a=t.translate[0],u=t.translate[1];return function(t,o){o||(n=e=0);var s=2,l=t.length,c=new Array(l);for(c[0]=(n+=t[0])*r+a,c[1]=(e+=t[1])*i+u;s<l;)c[s]=t[s],++s;return c}}(t.transform),r=t.arcs;function i(t,n){n.length&&n.pop();for(var i=r[t<0?~t:t],a=0,u=i.length;a<u;++a)n.push(e(i[a],a));t<0&&function(t,n){for(var e,r=t.length,i=r-n;i<--r;)e=t[i],t[i++]=t[r],t[r]=e}(n,u)}function a(t){return e(t)}function u(t){for(var n=[],e=0,r=t.length;e<r;++e)i(t[e],n);return n.length<2&&n.push(n[0]),n}function o(t){for(var n=u(t);n.length<4;)n.push(n[0]);return n}function s(t){return t.map(o)}return function t(n){var e,r=n.type;switch(r){case"GeometryCollection":return{type:r,geometries:n.geometries.map(t)};case"Point":e=a(n.coordinates);break;case"MultiPoint":e=n.coordinates.map(a);break;case"LineString":e=u(n.arcs);break;case"MultiLineString":e=n.arcs.map(u);break;case"Polygon":e=s(n.arcs);break;case"MultiPolygon":e=n.arcs.map(s);break;default:return null}return{type:r,coordinates:e}}(n)}function An(t,n){var e={},r={},i={},a=[],u=-1;function o(t,n){for(var r in t){var i=t[r];delete n[i.start],delete i.start,delete i.end,i.forEach(function(t){e[t<0?~t:t]=1}),a.push(i)}}return n.forEach(function(e,r){var i,a=t.arcs[e<0?~e:e];a.length<3&&!a[1][0]&&!a[1][1]&&(i=n[++u],n[u]=e,n[r]=i)}),n.forEach(function(n){var e,a,u=function(n){var e,r=t.arcs[n<0?~n:n],i=r[0];t.transform?(e=[0,0],r.forEach(function(t){e[0]+=t[0],e[1]+=t[1]})):e=r[r.length-1];return n<0?[e,i]:[i,e]}(n),o=u[0],s=u[1];if(e=i[o])if(delete i[e.end],e.push(n),e.end=s,a=r[s]){delete r[a.start];var l=a===e?e:e.concat(a);r[l.start=e.start]=i[l.end=a.end]=l}else r[e.start]=i[e.end]=e;else if(e=r[s])if(delete r[e.start],e.unshift(n),e.start=o,a=i[o]){delete i[a.end];var c=a===e?e:a.concat(e);r[c.start=a.start]=i[c.end=e.end]=c}else r[e.start]=i[e.end]=e;else r[(e=[n]).start=o]=i[e.end=s]=e}),o(i,r),o(r,i),n.forEach(function(t){e[t<0?~t:t]||a.push([t])}),a}function Mn(t){return wn(t,function(t,n,e){var r,i,a;if(arguments.length>1)r=function(t,n,e){var r,i=[],a=[];function u(t){var n=t<0?~t:t;(a[n]||(a[n]=[])).push({i:t,g:r})}function o(t){t.forEach(u)}function s(t){t.forEach(o)}return function t(n){switch(r=n,n.type){case"GeometryCollection":n.geometries.forEach(t);break;case"LineString":o(n.arcs);break;case"MultiLineString":case"Polygon":s(n.arcs);break;case"MultiPolygon":n.arcs.forEach(s)}}(n),a.forEach(null==e?function(t){i.push(t[0].i)}:function(t){e(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,n,e);else for(i=0,r=new Array(a=t.arcs.length);i<a;++i)r[i]=i;return{type:"MultiLineString",arcs:An(t,r)}}.apply(this,arguments))}function kn(t,n){var e,r,a;return t=yn(t,n),e=n&&(a=n.feature)?xn:n&&(a=n.mesh)?Mn:i("Missing TopoJSON feature or mesh parameter."),(r=(r=t.objects[a])?e(t,r):i("Invalid TopoJSON object: "+a))&&r.features||[r]}mn.responseType="text",yn.responseType="json",kn.responseType="json";const En={dsv:mn,csv:vn(","),tsv:vn("\t"),json:yn,topojson:kn};function Cn(t,n){return arguments.length>1?(En[t]=n,this):En.hasOwnProperty(t)?En[t]:null}function Dn(t){const n=Cn(t);return n&&n.responseType||"text"}var Fn=new Date,Sn=new Date;function Bn(t,n,e,r){function i(n){return t(n=new Date(+n)),n}return i.floor=i,i.ceil=function(e){return t(e=new Date(e-1)),n(e,1),t(e),e},i.round=function(t){var n=i(t),e=i.ceil(t);return t-n<e-t?n:e},i.offset=function(t,e){return n(t=new Date(+t),null==e?1:Math.floor(e)),t},i.range=function(e,r,a){var u,o=[];if(e=i.ceil(e),a=null==a?1:Math.floor(a),!(e<r&&a>0))return o;do{o.push(u=new Date(+e)),n(e,a),t(e)}while(u<e&&e<r);return o},i.filter=function(e){return Bn(function(n){if(n>=n)for(;t(n),!e(n);)n.setTime(n-1)},function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;n(t,-1),!e(t););else for(;--r>=0;)for(;n(t,1),!e(t););})},e&&(i.count=function(n,r){return Fn.setTime(+n),Sn.setTime(+r),t(Fn),t(Sn),Math.floor(e(Fn,Sn))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(n){return r(n)%t==0}:function(n){return i.count(0,n)%t==0}):i:null}),i}var Nn=Bn(function(){},function(t,n){t.setTime(+t+n)},function(t,n){return n-t});Nn.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?Bn(function(n){n.setTime(Math.floor(n/t)*t)},function(n,e){n.setTime(+n+e*t)},function(n,e){return(e-n)/t}):Nn:null};Nn.range;var On=6e4,zn=6048e5,Tn=Bn(function(t){t.setTime(t-t.getMilliseconds())},function(t,n){t.setTime(+t+1e3*n)},function(t,n){return(n-t)/1e3},function(t){return t.getUTCSeconds()}),Rn=(Tn.range,Bn(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds())},function(t,n){t.setTime(+t+n*On)},function(t,n){return(n-t)/On},function(t){return t.getMinutes()})),Pn=(Rn.range,Bn(function(t){t.setTime(t-t.getMilliseconds()-1e3*t.getSeconds()-t.getMinutes()*On)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getHours()})),Ln=(Pn.range,Bn(function(t){t.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*On)/864e5},function(t){return t.getDate()-1}));Ln.range;function qn(t){return Bn(function(n){n.setDate(n.getDate()-(n.getDay()+7-t)%7),n.setHours(0,0,0,0)},function(t,n){t.setDate(t.getDate()+7*n)},function(t,n){return(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*On)/zn})}var Un=qn(0),jn=qn(1),In=(qn(2),qn(3),qn(4)),$n=(qn(5),qn(6),Un.range,jn.range,In.range,Bn(function(t){t.setDate(1),t.setHours(0,0,0,0)},function(t,n){t.setMonth(t.getMonth()+n)},function(t,n){return n.getMonth()-t.getMonth()+12*(n.getFullYear()-t.getFullYear())},function(t){return t.getMonth()})),Wn=($n.range,Bn(function(t){t.setMonth(0,1),t.setHours(0,0,0,0)},function(t,n){t.setFullYear(t.getFullYear()+n)},function(t,n){return n.getFullYear()-t.getFullYear()},function(t){return t.getFullYear()}));Wn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Bn(function(n){n.setFullYear(Math.floor(n.getFullYear()/t)*t),n.setMonth(0,1),n.setHours(0,0,0,0)},function(n,e){n.setFullYear(n.getFullYear()+e*t)}):null};Wn.range;var Hn=Bn(function(t){t.setUTCSeconds(0,0)},function(t,n){t.setTime(+t+n*On)},function(t,n){return(n-t)/On},function(t){return t.getUTCMinutes()}),Yn=(Hn.range,Bn(function(t){t.setUTCMinutes(0,0,0)},function(t,n){t.setTime(+t+36e5*n)},function(t,n){return(n-t)/36e5},function(t){return t.getUTCHours()})),Gn=(Yn.range,Bn(function(t){t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+n)},function(t,n){return(n-t)/864e5},function(t){return t.getUTCDate()-1}));Gn.range;function Vn(t){return Bn(function(n){n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-t)%7),n.setUTCHours(0,0,0,0)},function(t,n){t.setUTCDate(t.getUTCDate()+7*n)},function(t,n){return(n-t)/zn})}var Xn=Vn(0),Zn=Vn(1),Jn=(Vn(2),Vn(3),Vn(4)),Qn=(Vn(5),Vn(6),Xn.range,Zn.range,Jn.range,Bn(function(t){t.setUTCDate(1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCMonth(t.getUTCMonth()+n)},function(t,n){return n.getUTCMonth()-t.getUTCMonth()+12*(n.getUTCFullYear()-t.getUTCFullYear())},function(t){return t.getUTCMonth()})),Kn=(Qn.range,Bn(function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n)},function(t,n){return n.getUTCFullYear()-t.getUTCFullYear()},function(t){return t.getUTCFullYear()}));Kn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?Bn(function(n){n.setUTCFullYear(Math.floor(n.getUTCFullYear()/t)*t),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},function(n,e){n.setUTCFullYear(n.getUTCFullYear()+e*t)}):null};Kn.range;function te(t){if(0<=t.y&&t.y<100){var n=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return n.setFullYear(t.y),n}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function ne(t){if(0<=t.y&&t.y<100){var n=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return n.setUTCFullYear(t.y),n}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function ee(t){return{y:t,m:0,d:1,H:0,M:0,S:0,L:0}}var re,ie,ae,ue,oe,se={"-":"",_:" ",0:"0"},le=/^\s*\d+/,ce=/^%/,fe=/[\\^$*+?|[\]().{}]/g;function he(t,n,e){var r=t<0?"-":"",i=(r?-t:t)+"",a=i.length;return r+(a<e?new Array(e-a+1).join(n)+i:i)}function de(t){return t.replace(fe,"\\$&")}function pe(t){return new RegExp("^(?:"+t.map(de).join("|")+")","i")}function ge(t){for(var n={},e=-1,r=t.length;++e<r;)n[t[e].toLowerCase()]=e;return n}function ve(t,n,e){var r=le.exec(n.slice(e,e+1));return r?(t.w=+r[0],e+r[0].length):-1}function me(t,n,e){var r=le.exec(n.slice(e,e+1));return r?(t.u=+r[0],e+r[0].length):-1}function ye(t,n,e){var r=le.exec(n.slice(e,e+2));return r?(t.U=+r[0],e+r[0].length):-1}function _e(t,n,e){var r=le.exec(n.slice(e,e+2));return r?(t.V=+r[0],e+r[0].length):-1}function xe(t,n,e){var r=le.exec(n.slice(e,e+2));return r?(t.W=+r[0],e+r[0].length):-1}function be(t,n,e){var r=le.exec(n.slice(e,e+4));return r?(t.y=+r[0],e+r[0].length):-1}function we(t,n,e){var r=le.exec(n.slice(e,e+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),e+r[0].length):-1}function Ae(t,n,e){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(e,e+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),e+r[0].length):-1}function Me(t,n,e){var r=le.exec(n.slice(e,e+2));return r?(t.m=r[0]-1,e+r[0].length):-1}function ke(t,n,e){var r=le.exec(n.slice(e,e+2));return r?(t.d=+r[0],e+r[0].length):-1}function Ee(t,n,e){var r=le.exec(n.slice(e,e+3));return r?(t.m=0,t.d=+r[0],e+r[0].length):-1}function Ce(t,n,e){var r=le.exec(n.slice(e,e+2));return r?(t.H=+r[0],e+r[0].length):-1}function De(t,n,e){var r=le.exec(n.slice(e,e+2));return r?(t.M=+r[0],e+r[0].length):-1}function Fe(t,n,e){var r=le.exec(n.slice(e,e+2));return r?(t.S=+r[0],e+r[0].length):-1}function Se(t,n,e){var r=le.exec(n.slice(e,e+3));return r?(t.L=+r[0],e+r[0].length):-1}function Be(t,n,e){var r=le.exec(n.slice(e,e+6));return r?(t.L=Math.floor(r[0]/1e3),e+r[0].length):-1}function Ne(t,n,e){var r=ce.exec(n.slice(e,e+1));return r?e+r[0].length:-1}function Oe(t,n,e){var r=le.exec(n.slice(e));return r?(t.Q=+r[0],e+r[0].length):-1}function ze(t,n,e){var r=le.exec(n.slice(e));return r?(t.Q=1e3*+r[0],e+r[0].length):-1}function Te(t,n){return he(t.getDate(),n,2)}function Re(t,n){return he(t.getHours(),n,2)}function Pe(t,n){return he(t.getHours()%12||12,n,2)}function Le(t,n){return he(1+Ln.count(Wn(t),t),n,3)}function qe(t,n){return he(t.getMilliseconds(),n,3)}function Ue(t,n){return qe(t,n)+"000"}function je(t,n){return he(t.getMonth()+1,n,2)}function Ie(t,n){return he(t.getMinutes(),n,2)}function $e(t,n){return he(t.getSeconds(),n,2)}function We(t){var n=t.getDay();return 0===n?7:n}function He(t,n){return he(Un.count(Wn(t),t),n,2)}function Ye(t,n){var e=t.getDay();return t=e>=4||0===e?In(t):In.ceil(t),he(In.count(Wn(t),t)+(4===Wn(t).getDay()),n,2)}function Ge(t){return t.getDay()}function Ve(t,n){return he(jn.count(Wn(t),t),n,2)}function Xe(t,n){return he(t.getFullYear()%100,n,2)}function Ze(t,n){return he(t.getFullYear()%1e4,n,4)}function Je(t){var n=t.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+he(n/60|0,"0",2)+he(n%60,"0",2)}function Qe(t,n){return he(t.getUTCDate(),n,2)}function Ke(t,n){return he(t.getUTCHours(),n,2)}function tr(t,n){return he(t.getUTCHours()%12||12,n,2)}function nr(t,n){return he(1+Gn.count(Kn(t),t),n,3)}function er(t,n){return he(t.getUTCMilliseconds(),n,3)}function rr(t,n){return er(t,n)+"000"}function ir(t,n){return he(t.getUTCMonth()+1,n,2)}function ar(t,n){return he(t.getUTCMinutes(),n,2)}function ur(t,n){return he(t.getUTCSeconds(),n,2)}function or(t){var n=t.getUTCDay();return 0===n?7:n}function sr(t,n){return he(Xn.count(Kn(t),t),n,2)}function lr(t,n){var e=t.getUTCDay();return t=e>=4||0===e?Jn(t):Jn.ceil(t),he(Jn.count(Kn(t),t)+(4===Kn(t).getUTCDay()),n,2)}function cr(t){return t.getUTCDay()}function fr(t,n){return he(Zn.count(Kn(t),t),n,2)}function hr(t,n){return he(t.getUTCFullYear()%100,n,2)}function dr(t,n){return he(t.getUTCFullYear()%1e4,n,4)}function pr(){return"+0000"}function gr(){return"%"}function vr(t){return+t}function mr(t){return Math.floor(+t/1e3)}function yr(t){return re=function(t){var n=t.dateTime,e=t.date,r=t.time,i=t.periods,a=t.days,u=t.shortDays,o=t.months,s=t.shortMonths,l=pe(i),c=ge(i),f=pe(a),h=ge(a),d=pe(u),p=ge(u),g=pe(o),v=ge(o),m=pe(s),y=ge(s),_={a:function(t){return u[t.getDay()]},A:function(t){return a[t.getDay()]},b:function(t){return s[t.getMonth()]},B:function(t){return o[t.getMonth()]},c:null,d:Te,e:Te,f:Ue,H:Re,I:Pe,j:Le,L:qe,m:je,M:Ie,p:function(t){return i[+(t.getHours()>=12)]},Q:vr,s:mr,S:$e,u:We,U:He,V:Ye,w:Ge,W:Ve,x:null,X:null,y:Xe,Y:Ze,Z:Je,"%":gr},x={a:function(t){return u[t.getUTCDay()]},A:function(t){return a[t.getUTCDay()]},b:function(t){return s[t.getUTCMonth()]},B:function(t){return o[t.getUTCMonth()]},c:null,d:Qe,e:Qe,f:rr,H:Ke,I:tr,j:nr,L:er,m:ir,M:ar,p:function(t){return i[+(t.getUTCHours()>=12)]},Q:vr,s:mr,S:ur,u:or,U:sr,V:lr,w:cr,W:fr,x:null,X:null,y:hr,Y:dr,Z:pr,"%":gr},b={a:function(t,n,e){var r=d.exec(n.slice(e));return r?(t.w=p[r[0].toLowerCase()],e+r[0].length):-1},A:function(t,n,e){var r=f.exec(n.slice(e));return r?(t.w=h[r[0].toLowerCase()],e+r[0].length):-1},b:function(t,n,e){var r=m.exec(n.slice(e));return r?(t.m=y[r[0].toLowerCase()],e+r[0].length):-1},B:function(t,n,e){var r=g.exec(n.slice(e));return r?(t.m=v[r[0].toLowerCase()],e+r[0].length):-1},c:function(t,e,r){return M(t,n,e,r)},d:ke,e:ke,f:Be,H:Ce,I:Ce,j:Ee,L:Se,m:Me,M:De,p:function(t,n,e){var r=l.exec(n.slice(e));return r?(t.p=c[r[0].toLowerCase()],e+r[0].length):-1},Q:Oe,s:ze,S:Fe,u:me,U:ye,V:_e,w:ve,W:xe,x:function(t,n,r){return M(t,e,n,r)},X:function(t,n,e){return M(t,r,n,e)},y:we,Y:be,Z:Ae,"%":Ne};function w(t,n){return function(e){var r,i,a,u=[],o=-1,s=0,l=t.length;for(e instanceof Date||(e=new Date(+e));++o<l;)37===t.charCodeAt(o)&&(u.push(t.slice(s,o)),null!=(i=se[r=t.charAt(++o)])?r=t.charAt(++o):i="e"===r?" ":"0",(a=n[r])&&(r=a(e,i)),u.push(r),s=o+1);return u.push(t.slice(s,o)),u.join("")}}function A(t,n){return function(e){var r,i,a=ee(1900);if(M(a,t,e+="",0)!=e.length)return null;if("Q"in a)return new Date(a.Q);if("p"in a&&(a.H=a.H%12+12*a.p),"V"in a){if(a.V<1||a.V>53)return null;"w"in a||(a.w=1),"Z"in a?(i=(r=ne(ee(a.y))).getUTCDay(),r=i>4||0===i?Zn.ceil(r):Zn(r),r=Gn.offset(r,7*(a.V-1)),a.y=r.getUTCFullYear(),a.m=r.getUTCMonth(),a.d=r.getUTCDate()+(a.w+6)%7):(i=(r=n(ee(a.y))).getDay(),r=i>4||0===i?jn.ceil(r):jn(r),r=Ln.offset(r,7*(a.V-1)),a.y=r.getFullYear(),a.m=r.getMonth(),a.d=r.getDate()+(a.w+6)%7)}else("W"in a||"U"in a)&&("w"in a||(a.w="u"in a?a.u%7:"W"in a?1:0),i="Z"in a?ne(ee(a.y)).getUTCDay():n(ee(a.y)).getDay(),a.m=0,a.d="W"in a?(a.w+6)%7+7*a.W-(i+5)%7:a.w+7*a.U-(i+6)%7);return"Z"in a?(a.H+=a.Z/100|0,a.M+=a.Z%100,ne(a)):n(a)}}function M(t,n,e,r){for(var i,a,u=0,o=n.length,s=e.length;u<o;){if(r>=s)return-1;if(37===(i=n.charCodeAt(u++))){if(i=n.charAt(u++),!(a=b[i in se?n.charAt(u++):i])||(r=a(t,e,r))<0)return-1}else if(i!=e.charCodeAt(r++))return-1}return r}return _.x=w(e,_),_.X=w(r,_),_.c=w(n,_),x.x=w(e,x),x.X=w(r,x),x.c=w(n,x),{format:function(t){var n=w(t+="",_);return n.toString=function(){return t},n},parse:function(t){var n=A(t+="",te);return n.toString=function(){return t},n},utcFormat:function(t){var n=w(t+="",x);return n.toString=function(){return t},n},utcParse:function(t){var n=A(t,ne);return n.toString=function(){return t},n}}}(t),ie=re.format,ae=re.parse,ue=re.utcFormat,oe=re.utcParse,re}yr({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Date.prototype.toISOString||ue("%Y-%m-%dT%H:%M:%S.%LZ");+new Date("2000-01-01T00:00:00.000Z")||oe("%Y-%m-%dT%H:%M:%S.%LZ");function _r(t,n,e){const r=Cn((n=n||{}).type||"json");return r||i("Unknown data format type: "+n.type),t=r(t,n),n.parse&&function(t,n,e){if(!t.length)return;e=e||ae;var r,i,a,u,o,s,l,c=t.columns||Object.keys(t[0]);"auto"===n&&(n=rn(t,c));for(c=Object.keys(n),r=c.map(function(t){var r,i,a=n[t];if(a&&(0===a.indexOf("date:")||0===a.indexOf("utc:")))return("'"===(i=(r=a.split(/:(.+)?/,2))[1])[0]&&"'"===i[i.length-1]||'"'===i[0]&&'"'===i[i.length-1])&&(i=i.slice(1,-1)),"utc"===r[0]?oe(i):e(i);if(!Kt[a])throw Error("Illegal format pattern: "+t+":"+a);return Kt[a]}),u=0,s=t.length,l=c.length;u<s;++u)for(i=t[u],o=0;o<l;++o)a=c[o],i[a]=r[o](i[a])}(t,n.parse,e),t.hasOwnProperty("columns")&&delete t.columns,t}var xr=function(t,n){return function(e){return{options:e||{},sanitize:Vt,load:Gt,fileAccess:!!n,file:Xt(n),http:Jt(t)}}}("undefined"!=typeof fetch&&fetch,null);const br=_r;var wr={skip:!0};function Ar(t,n,e,r,i,a){var u,o,s=Z({},a,wr);Y(e)||(e=V(e)),void 0===r?u=function(n){t.touch(e(n))}:Y(r)?(o=new Lt(null,r,i,!1),u=function(n){var r,i=e(n);o.evaluate(n),Bt(r=o.value)?t.pulse(i,r,a):t.update(i,r,s)}):u=function(n){t.update(e(n),r,s)},n.apply(u)}function Mr(t,n,e,r,i,a){var u,o;void 0===r?o=e:(u=Y(r)?r:V(r),(o=new Lt(null,r=e?function(t,n){var r=u(t,n);return e.skip()||(e.skip(r!==this.value).value=r),r}:u,i,!1)).modified(a&&a.force),o.rank=0,e&&(o.skip(!0),o.value=e.value,o.targets().add(e))),n.targets().add(o)}var kr={};function Er(t,n,e){this.dataflow=t,this.stamp=null==n?-1:n,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=e||null}var Cr=Er.prototype;function Dr(t,n){return t?function(e,r){return t(e,r)&&n(e,r)}:n}function Fr(t,n){var e=[];return _t(t,n,function(t){e.push(t)}),e}function Sr(t,n){var e={};return t.visit(n,function(t){e[kt(t)]=1}),function(t){return e[kt(t)]?null:t}}function Br(t,n,e,r){var i,a,u,o,s,l=this,c=0;for(this.dataflow=t,this.stamp=n,this.fields=null,this.encode=r||null,this.pulses=e,u=0,o=e.length;u<o;++u)if((i=e[u]).stamp===n){if(i.fields)for(s in a=l.fields||(l.fields={}),i.fields)a[s]=1;i.changed(l.ADD)&&(c|=l.ADD),i.changed(l.REM)&&(c|=l.REM),i.changed(l.MOD)&&(c|=l.MOD)}this.changes=c}Cr.StopPropagation=kr,Cr.ADD=1,Cr.REM=2,Cr.MOD=4,Cr.ADD_REM=3,Cr.ADD_MOD=5,Cr.ALL=7,Cr.REFLOW=8,Cr.SOURCE=16,Cr.NO_SOURCE=32,Cr.NO_FIELDS=64,Cr.fork=function(t){return new Er(this.dataflow).init(this,t)},Cr.clone=function(){var t=this.fork(7);return t.add=t.add.slice(),t.rem=t.rem.slice(),t.mod=t.mod.slice(),t.source&&(t.source=t.source.slice()),t.materialize(23)},Cr.addAll=function(){var t=this;return this.source&&this.source.length!==this.add.length?((t=new Er(this.dataflow).init(this)).add=t.source,t):t},Cr.init=function(t,n){var e=this;return e.stamp=t.stamp,e.encode=t.encode,!t.fields||64&n||(e.fields=t.fields),1&n?(e.addF=t.addF,e.add=t.add):(e.addF=null,e.add=[]),2&n?(e.remF=t.remF,e.rem=t.rem):(e.remF=null,e.rem=[]),4&n?(e.modF=t.modF,e.mod=t.mod):(e.modF=null,e.mod=[]),32&n?(e.srcF=null,e.source=null):(e.srcF=t.srcF,e.source=t.source),e},Cr.runAfter=function(t){this.dataflow.runAfter(t)},Cr.changed=function(t){var n=t||7;return 1&n&&this.add.length||2&n&&this.rem.length||4&n&&this.mod.length},Cr.reflow=function(t){if(t)return this.fork(7).reflow();var n=this.add.length,e=this.source&&this.source.length;return e&&e!==n&&(this.mod=this.source,n&&this.filter(4,Sr(this,1))),this},Cr.modifies=function(t){var n=W(t),e=this.fields||(this.fields={});return n.forEach(function(t){e[t]=!0}),this},Cr.modified=function(t){var n=this.fields;return!(!this.mod.length||!n)&&(arguments.length?u(t)?t.some(function(t){return n[t]}):n[t]:!!n)},Cr.filter=function(t,n){var e=this;return 1&t&&(e.addF=Dr(e.addF,n)),2&t&&(e.remF=Dr(e.remF,n)),4&t&&(e.modF=Dr(e.modF,n)),16&t&&(e.srcF=Dr(e.srcF,n)),e},Cr.materialize=function(t){var n=this;return 1&(t=t||7)&&n.addF&&(n.add=Fr(n.add,n.addF),n.addF=null),2&t&&n.remF&&(n.rem=Fr(n.rem,n.remF),n.remF=null),4&t&&n.modF&&(n.mod=Fr(n.mod,n.modF),n.modF=null),16&t&&n.srcF&&(n.source=n.source.filter(n.srcF),n.srcF=null),n},Cr.visit=function(t,n){var e,r,i=this,a=n;return 16&t?(_t(i.source,i.srcF,a),i):(1&t&&_t(i.add,i.addF,a),2&t&&_t(i.rem,i.remF,a),4&t&&_t(i.mod,i.modF,a),8&t&&(e=i.source)&&((r=i.add.length+i.mod.length)===e.length||_t(e,r?Sr(i,5):i.srcF,a)),i)};var Nr=et(Br,Er);function Or(t){return t.error("Dataflow already running. Use runAsync() to chain invocations."),t}Nr.fork=function(t){var n=new Er(this.dataflow).init(this,t&this.NO_FIELDS);return void 0!==t&&(t&n.ADD&&this.visit(n.ADD,function(t){return n.add.push(t)}),t&n.REM&&this.visit(n.REM,function(t){return n.rem.push(t)}),t&n.MOD&&this.visit(n.MOD,function(t){return n.mod.push(t)})),n},Nr.changed=function(t){return this.changes&t},Nr.modified=function(t){var n=this,e=n.fields;return e&&n.changes&n.MOD?u(t)?t.some(function(t){return e[t]}):e[t]:0},Nr.filter=function(){i("MultiPulse does not support filtering.")},Nr.materialize=function(){i("MultiPulse does not support materialization.")},Nr.visit=function(t,n){var e=this,r=e.pulses,i=r.length,a=0;if(t&e.SOURCE)for(;a<i;++a)r[a].visit(t,n);else for(;a<i;++a)r[a].stamp===e.stamp&&r[a].visit(t,n);return e};var zr={skip:!1,force:!1};function Tr(t){this.cmp=t,this.nodes=[]}var Rr=Tr.prototype;function Pr(t,n,e,r){var i,a,u;for(i=t[e];e>n&&r(i,a=t[u=e-1>>1])<0;)t[e]=a,e=u;return t[e]=i}function Lr(t,n,e){for(var r,i=n,a=t.length,u=t[n],o=2*n+1;o<a;)(r=o+1)<a&&e(t[o],t[r])>=0&&(o=r),t[n]=t[o],o=2*(n=o)+1;return t[n]=u,Pr(t,i,n,e)}function qr(){this._log=M(),this.logLevel(x),this._clock=0,this._rank=0;try{this._loader=xr()}catch(t){}this._touched=xt(h),this._pulses={},this._pulse=null,this._heap=new Tr(function(t,n){return t.qrank-n.qrank}),this._postrun=[]}Rr.size=function(){return this.nodes.length},Rr.clear=function(){return this.nodes=[],this},Rr.peek=function(){return this.nodes[0]},Rr.push=function(t){var n=this.nodes;return n.push(t),Pr(n,0,n.length-1,this.cmp)},Rr.pop=function(){var t,n=this.nodes,e=n.pop();return n.length?(t=n[0],n[0]=e,Lr(n,0,this.cmp)):t=e,t},Rr.replace=function(t){var n=this.nodes,e=n[0];return n[0]=t,Lr(n,0,this.cmp),e},Rr.pushpop=function(t){var n=this.nodes,e=n[0];return n.length&&this.cmp(e,t)<0&&(n[0]=t,t=e,Lr(n,0,this.cmp)),t};var Ur=qr.prototype;function jr(t){return function(){return this._log[t].apply(this,arguments)}}function Ir(t,n){Lt.call(this,t,null,n)}Ur.stamp=function(){return this._clock},Ur.loader=function(t){return arguments.length?(this._loader=t,this):this._loader},Ur.cleanThreshold=1e4,Ur.add=function(t,n,e,r){var i,a=1;return t instanceof Lt?i=t:t&&t.prototype instanceof Lt?i=new t:Y(t)?i=new Lt(null,t):(a=0,i=new Lt(t,n)),this.rank(i),a&&(r=e,e=n),e&&this.connect(i,i.parameters(e,r)),this.touch(i),i},Ur.connect=function(t,n){var e,r,i=t.rank;for(e=0,r=n.length;e<r;++e)if(i<n[e].rank)return void this.rerank(t)},Ur.rank=function(t){t.rank=++this._rank},Ur.rerank=function(t){for(var n,e,r,a=[t];a.length;)if(this.rank(n=a.pop()),e=n._targets)for(r=e.length;--r>=0;)a.push(n=e[r]),n===t&&i("Cycle detected in dataflow graph.")},Ur.pulse=function(t,n,e){this.touch(t,e||zr);var r=new Er(this,this._clock+(this._pulse?0:1)),i=t.pulse&&t.pulse.source||[];return r.target=t,this._pulses[t.id]=n.pulse(r,i),this},Ur.touch=function(t,n){var e=n||zr;return this._pulse?this._enqueue(t):this._touched.add(t),e.skip&&t.skip(!0),this},Ur.update=function(t,n,e){var r=e||zr;return(t.set(n)||r.force)&&this.touch(t,r),this},Ur.changeset=Nt,Ur.ingest=function(t,n,e){return this.pulse(t,this.changeset().insert(br(n,e)))},Ur.parse=br,Ur.preload=async function(t,n,e){const r=this,i=r._pending||function(t){var n,e=new Promise(function(t){n=t});return e.requests=0,e.done=function(){0==--e.requests&&(t._pending=null,n(t))},t._pending=e}(r);i.requests+=1;const a=await r.request(n,e);return r.pulse(t,r.changeset().remove(v).insert(a.data||[])),i.done(),a},Ur.request=async function(t,n){const e=this;let r,i=0;try{r=await e.loader().load(t,{context:"dataflow",response:Dn(n&&n.type)});try{r=br(r,n)}catch(n){i=-2,e.warn("Data ingestion failed",t,n)}}catch(n){i=-1,e.warn("Loading failed",t,n)}return{data:r,status:i}},Ur.events=function(t,n,e,r){for(var i,a=this,u=$t(e,r),o=function(t){t.dataflow=a;try{u.receive(t)}catch(t){a.error(t)}finally{a.run()}},s=0,l=(i="string"==typeof t&&"undefined"!=typeof document?document.querySelectorAll(t):W(t)).length;s<l;++s)i[s].addEventListener(n,o);return u},Ur.on=function(t,n,e,r,i){return(t instanceof Lt?Mr:Ar)(this,t,n,e,r,i),this},Ur.evaluate=async function(t,n,e){const r=this,i=r.logLevel();if(r._pulse)return Or(r);if(r._pending&&await r._pending,n&&await bt(r,n),!r._touched.length)return r.info("Dataflow invoked, but nothing to do."),r;let a,u,o,s,l=++r._clock,c=0;r._pulse=new Er(r,l,t),i>=w&&(o=Date.now(),r.debug("-- START PROPAGATION ("+l+") -----")),r._touched.forEach(function(t){r._enqueue(t,!0)}),r._touched=xt(h);try{for(;r._heap.size()>0;)(a=r._heap.pop()).rank===a.qrank?((u=a.run(r._getPulse(a,t))).then&&(u=await u),i>=A&&r.debug(a.id,u===kr?"STOP":u,a),u!==kr&&(r._pulse=u,a._targets&&a._targets.forEach(t=>r._enqueue(t))),++c):r._enqueue(a,!0)}catch(t){s=t}if(r._pulses={},r._pulse=null,i>=w&&(o=Date.now()-o,r.info("> Pulse "+l+": "+c+" operators; "+o+"ms")),s&&(r._postrun=[],r.error(s)),r._postrun.length){const t=r._postrun;r._postrun=[],t.sort((t,n)=>n.priority-t.priority).forEach(async function(t){await bt(r,t.callback)})}return e&&await bt(r,e),r},Ur.run=function(t,n,e){return this._pulse?Or(this):(this.evaluate(t,n,e),this)},Ur.runAsync=async function(t,n,e){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(t,n,e)).then(r,r),this._running},Ur.runAfter=function(t,n,e){if(this._pulse||n)this._postrun.push({priority:e||0,callback:t});else try{t(this)}catch(t){this.error(t)}},Ur._enqueue=function(t,n){var e=!this._pulses[t.id];e&&(this._pulses[t.id]=this._pulse),(e||n)&&(t.qrank=t.rank,this._heap.push(t))},Ur._getPulse=function(t,n){var e,r=t.source,i=this._clock;return r&&u(r)?new Br(this,i,e=r.map(function(t){return t.pulse}),n):(e=this._pulses[t.id],r&&((r=r.pulse)&&r!==kr?r.stamp===i&&e.target!==t?e=r:e.source=r.source:e.source=[]),e)},Ur.error=jr("error"),Ur.warn=jr("warn"),Ur.info=jr("info"),Ur.debug=jr("debug"),Ur.logLevel=jr("level");var $r=et(Ir,Lt);$r.run=function(t){return t.stamp<=this.stamp?t.StopPropagation:(this.skip()?this.skip(!1):n=this.evaluate(t),n=n||t,this.stamp=t.stamp,n.then?n=n.then(t=>this.pulse=t):n!==t.StopPropagation&&(this.pulse=n),n);var n},$r.evaluate=function(t){var n=this.marshall(t.stamp),e=this.transform(n,t);return n.clear(),e},$r.transform=function(){};var Wr={};function Hr(t){var n=Yr(t);return n&&n.Definition||null}function Yr(t){return t=t&&t.toLowerCase(),Wr.hasOwnProperty(t)?Wr[t]:null}function Gr(t){return t&&t.length?1===t.length?t[0]:(n=t,function(t){for(var e=n.length,r=1,i=String(n[0](t));r<e;++r)i+="|"+n[r](t);return i}):function(){return""};var n}function Vr(t,n,e){return e||t+(n?"_"+n:"")}var Xr={values:Qr({name:"values",init:"cell.store = true;",set:"cell.data.values()",idx:-1}),count:Qr({name:"count",set:"cell.num"}),__count__:Qr({name:"count",set:"this.missing + this.valid"}),missing:Qr({name:"missing",set:"this.missing"}),valid:Qr({name:"valid",set:"this.valid"}),sum:Qr({name:"sum",init:"this.sum = 0;",add:"this.sum += +v;",rem:"this.sum -= v;",set:"this.sum"}),mean:Qr({name:"mean",init:"this.mean = 0;",add:"var d = v - this.mean; this.mean += d / this.valid;",rem:"var d = v - this.mean; this.mean -= this.valid ? d / this.valid : this.mean;",set:"this.valid ? this.mean : undefined"}),average:Qr({name:"average",set:"this.valid ? this.mean : undefined",req:["mean"],idx:1}),variance:Qr({name:"variance",init:"this.dev = 0;",add:"this.dev += d * (v - this.mean);",rem:"this.dev -= d * (v - this.mean);",set:"this.valid > 1 ? this.dev / (this.valid-1) : undefined",req:["mean"],idx:1}),variancep:Qr({name:"variancep",set:"this.valid > 1 ? this.dev / this.valid : undefined",req:["variance"],idx:2}),stdev:Qr({name:"stdev",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid-1)) : undefined",req:["variance"],idx:2}),stdevp:Qr({name:"stdevp",set:"this.valid > 1 ? Math.sqrt(this.dev / this.valid) : undefined",req:["variance"],idx:2}),stderr:Qr({name:"stderr",set:"this.valid > 1 ? Math.sqrt(this.dev / (this.valid * (this.valid-1))) : undefined",req:["variance"],idx:2}),distinct:Qr({name:"distinct",set:"cell.data.distinct(this.get)",req:["values"],idx:3}),ci0:Qr({name:"ci0",set:"cell.data.ci0(this.get)",req:["values"],idx:3}),ci1:Qr({name:"ci1",set:"cell.data.ci1(this.get)",req:["values"],idx:3}),median:Qr({name:"median",set:"cell.data.q2(this.get)",req:["values"],idx:3}),q1:Qr({name:"q1",set:"cell.data.q1(this.get)",req:["values"],idx:3}),q3:Qr({name:"q3",set:"cell.data.q3(this.get)",req:["values"],idx:3}),argmin:Qr({name:"argmin",init:"this.argmin = undefined;",add:"if (v < this.min) this.argmin = t;",rem:"if (v <= this.min) this.argmin = undefined;",set:"this.argmin || cell.data.argmin(this.get)",req:["min"],str:["values"],idx:3}),argmax:Qr({name:"argmax",init:"this.argmax = undefined;",add:"if (v > this.max) this.argmax = t;",rem:"if (v >= this.max) this.argmax = undefined;",set:"this.argmax || cell.data.argmax(this.get)",req:["max"],str:["values"],idx:3}),min:Qr({name:"min",init:"this.min = undefined;",add:"if (v < this.min || this.min === undefined) this.min = v;",rem:"if (v <= this.min) this.min = NaN;",set:"this.min = (isNaN(this.min) ? cell.data.min(this.get) : this.min)",str:["values"],idx:4}),max:Qr({name:"max",init:"this.max = undefined;",add:"if (v > this.max || this.max === undefined) this.max = v;",rem:"if (v >= this.max) this.max = NaN;",set:"this.max = (isNaN(this.max) ? cell.data.max(this.get) : this.max)",str:["values"],idx:4})},Zr=Object.keys(Xr);function Jr(t,n){return Xr[t](n)}function Qr(t){return function(n){var e=Z({init:"",add:"",rem:"",idx:0},t);return e.out=n||t.name,e}}function Kr(t,n){return t.idx-n.idx}function ti(t,n){var e=n||d,r=function(t,n){var e,r=t.reduce(function t(e,r){function i(n){e[n]||t(e,e[n]=Xr[n]())}return r.req&&r.req.forEach(i),n&&r.str&&r.str.forEach(i),e},t.reduce(function(t,n){return t[n.name]=n,t},{})),i=[];for(e in r)i.push(r[e]);return i.sort(Kr)}(t,!0),i="var cell = this.cell; this.valid = 0; this.missing = 0;",a="this.cell = cell; this.init();",u="if(v==null){++this.missing; return;} if(v!==v) return; ++this.valid;",o="if(v==null){--this.missing; return;} if(v!==v) return; --this.valid;",s="var cell = this.cell;";return r.forEach(function(t){i+=t.init,u+=t.add,o+=t.rem}),t.slice().sort(Kr).forEach(function(t){s+="t['"+t.out+"']="+t.set+";"}),s+="return t;",(a=Function("cell",a)).prototype.init=Function(i),a.prototype.add=Function("v","t",u),a.prototype.rem=Function("v","t",o),a.prototype.set=Function("t",s),a.prototype.get=e,a.fields=t.map(function(t){return t.out}),a}function ni(t){var n,e,r,i,a,u,o,s,l=t.maxbins||20,c=t.base||10,f=Math.log(c),h=t.divide||[5,2],d=t.extent[0],p=t.extent[1],g=p-d;if(t.step)n=t.step;else if(t.steps){for(a=g/l,u=0,o=t.steps.length;u<o&&t.steps[u]<a;++u);n=t.steps[Math.max(0,u-1)]}else{for(e=Math.ceil(Math.log(l)/f),r=t.minstep||0,n=Math.max(r,Math.pow(c,Math.round(Math.log(g)/f)-e));Math.ceil(g/n)>l;)n*=c;for(u=0,o=h.length;u<o;++u)(a=n/h[u])>=r&&g/a<=l&&(n=a)}return i=(a=Math.log(n))>=0?0:1+~~(-a/f),s=Math.pow(c,-i-1),(t.nice||void 0===t.nice)&&(d=d<(a=Math.floor(d/n+s)*n)?a-n:a,p=Math.ceil(p/n)*n),{start:d,stop:p,step:n}}function ei(t,n){var e,r=[],i=t.length,a=-1;if(null==n)for(;++a<i;)isNaN(e=ri(t[a]))||r.push(e);else for(;++a<i;)isNaN(e=ri(n(t[a],a,t)))||r.push(e);return r}function ri(t){return null===t?NaN:+t}function ii(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function ai(t){var n;return 1===t.length&&(n=t,t=function(t,e){return ii(n(t),e)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var a=r+i>>>1;t(n[a],e)<0?r=a+1:i=a}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var a=r+i>>>1;t(n[a],e)>0?i=a:r=a+1}return r}}}t.random=Math.random;var ui=ai(ii),oi=ui.right,si=ui.left;function li(t,n){let e,r;if(void 0===n)for(let n of t)null!=n&&n>=n&&(void 0===e?e=r=n:(e>n&&(e=n),r<n&&(r=n)));else{let i=-1;for(let a of t)null!=(a=n(a,++i,t))&&a>=a&&(void 0===e?e=r=a:(e>a&&(e=a),r<a&&(r=a)))}return[e,r]}function ci(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),a=new Array(i);++r<i;)a[r]=t+r*e;return a}var fi=Math.sqrt(50),hi=Math.sqrt(10),di=Math.sqrt(2);function pi(t,n,e=function(t){return null===t?NaN:+t}){if(r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,a=Math.floor(i),u=+e(t[a],a,t);return u+(+e(t[a+1],a+1,t)-u)*(i-a)}}function gi(t,n,e=0,r=t.length-1,i=ii){for(;r>e;){if(r-e>600){const a=r-e+1,u=n-e+1,o=Math.log(a),s=.5*Math.exp(2*o/3),l=.5*Math.sqrt(o*s*(a-s)/a)*(u-a/2<0?-1:1);gi(t,n,Math.max(e,Math.floor(n-u*s/a+l)),Math.min(r,Math.floor(n+(a-u)*s/a+l)),i)}const a=t[n];let u=e,o=r;for(vi(t,e,n),i(t[r],a)>0&&vi(t,e,r);u<o;){for(vi(t,u,o),++u,--o;i(t[u],a)<0;)++u;for(;i(t[o],a)>0;)--o}0===i(t[e],a)?vi(t,e,o):vi(t,++o,r),o<=n&&(e=o+1),n<=o&&(r=o-1)}return t}function vi(t,n,e){const r=t[n];t[n]=t[e],t[e]=r}function mi(n,e,r,i){if(!n.length)return[void 0,void 0];var a,u,o,s,l=ei(n,i),c=l.length,f=e;for(o=0,s=Array(f);o<f;++o){for(a=0,u=0;u<c;++u)a+=l[~~(t.random()*c)];s[o]=a/c}return[pi(s.sort(ii),r/2),pi(s,1-r/2)]}function yi(t,n){var e=ei(t,n);return[pi(e.sort(ii),.25),pi(e,.5),pi(e,.75)]}function _i(n,e){var r,i,a=NaN,u={mean:function(t){return arguments.length?(r=t||0,a=NaN,u):r},stdev:function(t){return arguments.length?(i=null==t?1:t,a=NaN,u):i},sample:function(){var n,e,u=0,o=0;if(a==a)return u=a,a=NaN,u;do{n=(u=2*t.random()-1)*u+(o=2*t.random()-1)*o}while(0===n||n>1);return e=Math.sqrt(-2*Math.log(n)/n),a=r+o*e*i,r+u*e*i},pdf:function(t){var n=Math.exp(Math.pow(t-r,2)/(-2*Math.pow(i,2)));return 1/(i*Math.sqrt(2*Math.PI))*n},cdf:function(t){var n,e=(t-r)/i,a=Math.abs(e);if(a>37)n=0;else{var u=Math.exp(-a*a/2);a<7.07106781186547?(n=u*((((((.0352624965998911*a+.700383064443688)*a+6.37396220353165)*a+33.912866078383)*a+112.079291497871)*a+221.213596169931)*a+220.206867912376),n/=((((((.0883883476483184*a+1.75566716318264)*a+16.064177579207)*a+86.7807322029461)*a+296.564248779674)*a+637.333633378831)*a+793.826512519948)*a+440.413735824752):n=u/(a+1/(a+2/(a+3/(a+4/(a+.65)))))/2.506628274631}return e>0?1-n:n},icdf:function(t){if(t<=0||t>=1)return NaN;var n=2*t-1,e=8*(Math.PI-3)/(3*Math.PI*(4-Math.PI)),a=2/(Math.PI*e)+Math.log(1-Math.pow(n,2))/2,u=Math.log(1-n*n)/e,o=(n>0?1:-1)*Math.sqrt(Math.sqrt(a*a-u)-a);return r+i*Math.SQRT2*o}};return u.mean(n).stdev(e)}function xi(n,e){var r=_i(),i={},a=0;return i.data=function(t){return arguments.length?(n=t,a=t?t.length:0,i.bandwidth(e)):n},i.bandwidth=function(t){return arguments.length?(!(e=t)&&n&&(a=(r=n).length,u=yi(r),o=(u[2]-u[0])/1.34,e=1.06*Math.min(Math.sqrt(function(t,n){let e,r=0,i=0,a=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(a+=(e=n-i)*(n-(i+=e/++r)));else{let u=-1;for(let o of t)null!=(o=n(o,++u,t))&&(o=+o)>=o&&(a+=(e=o-i)*(o-(i+=e/++r)))}if(r>1)return a/(r-1)}(r)),o)*Math.pow(a,-.2)),i):e;var r,a,u,o},i.sample=function(){return n[~~(t.random()*a)]+e*r.sample()},i.pdf=function(t){for(var i=0,u=0;u<a;++u)i+=r.pdf((t-n[u])/e);return i/e/a},i.cdf=function(t){for(var i=0,u=0;u<a;++u)i+=r.cdf((t-n[u])/e);return i/a},i.icdf=function(){throw Error("KDE icdf not supported.")},i.data(n)}function bi(n,e){var r,i={},a=0;return i.weights=function(t){return arguments.length?(r=function(t){var n,e=[],r=0;for(n=0;n<a;++n)r+=e[n]=null==t[n]?1:+t[n];for(n=0;n<a;++n)e[n]/=r;return e}(e=t||[]),i):e},i.distributions=function(t){return arguments.length?(t?(a=t.length,n=t):(a=0,n=[]),i.weights(e)):n},i.sample=function(){for(var e=t.random(),i=n[a-1],u=r[0],o=0;o<a-1;u+=r[++o])if(e<u){i=n[o];break}return i.sample()},i.pdf=function(t){for(var e=0,i=0;i<a;++i)e+=r[i]*n[i].pdf(t);return e},i.cdf=function(t){for(var e=0,i=0;i<a;++i)e+=r[i]*n[i].cdf(t);return e},i.icdf=function(){throw Error("Mixture icdf not supported.")},i.distributions(n).weights(e)}function wi(n,e){null==e&&(e=null==n?1:n,n=0);var r,i,a,u={};return u.min=function(t){return arguments.length?(a=i-(r=t||0),u):r},u.max=function(t){return arguments.length?(a=(i=t||0)-r,u):i},u.sample=function(){return r+a*t.random()},u.pdf=function(t){return t>=r&&t<=i?1/a:0},u.cdf=function(t){return t<r?0:t>i?1:(t-r)/a},u.icdf=function(t){return t>=0&&t<=1?r+t*a:NaN},u.min(n).max(e)}function Ai(t){this._key=t?c(t):kt,this.reset()}var Mi=Ai.prototype;function ki(t){Ir.call(this,null,t),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}Mi.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Mi.add=function(t){this._add.push(t)},Mi.rem=function(t){this._rem.push(t)},Mi.values=function(){if(this._get=null,0===this._rem.length)return this._add;var t,n,e,r=this._add,i=this._rem,a=this._key,u=r.length,o=i.length,s=Array(u-o),l={};for(t=0;t<o;++t)l[a(i[t])]=1;for(t=0,n=0;t<u;++t)l[a(e=r[t])]?l[a(e)]=0:s[n++]=e;return this._rem=[],this._add=s},Mi.distinct=function(t){for(var n,e=this.values(),r=e.length,i={},a=0;--r>=0;)n=t(e[r])+"",i.hasOwnProperty(n)||(i[n]=1,++a);return a},Mi.extent=function(t){if(this._get!==t||!this._ext){var n=this.values(),e=Q(n,t);this._ext=[n[e[0]],n[e[1]]],this._get=t}return this._ext},Mi.argmin=function(t){return this.extent(t)[0]||{}},Mi.argmax=function(t){return this.extent(t)[1]||{}},Mi.min=function(t){var n=this.extent(t)[0];return null!=n?t(n):void 0},Mi.max=function(t){var n=this.extent(t)[1];return null!=n?t(n):void 0},Mi.quartile=function(t){return this._get===t&&this._q||(this._q=yi(this.values(),t),this._get=t),this._q},Mi.q1=function(t){return this.quartile(t)[0]},Mi.q2=function(t){return this.quartile(t)[1]},Mi.q3=function(t){return this.quartile(t)[2]},Mi.ci=function(t){return this._get===t&&this._ci||(this._ci=mi(this.values(),1e3,.05,t),this._get=t),this._ci},Mi.ci0=function(t){return this.ci(t)[0]},Mi.ci1=function(t){return this.ci(t)[1]},ki.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Zr},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};var Ei=et(ki,Ir);function Ci(t){Ir.call(this,null,t)}Ei.transform=function(t,n){var e,r=this,i=n.fork(n.NO_SOURCE|n.NO_FIELDS);return this.stamp=i.stamp,this.value&&((e=t.modified())||n.modified(this._inputs))?(this._prev=this.value,this.value=e?this.init(t):{},n.visit(n.SOURCE,function(t){r.add(t)})):(this.value=this.value||this.init(t),n.visit(n.REM,function(t){r.rem(t)}),n.visit(n.ADD,function(t){r.add(t)})),i.modifies(this._outputs),r._drop=!1!==t.drop,t.cross&&r._dims.length>1&&(r._drop=!1,this.cross()),r.changes(i)},Ei.cross=function(){var t=this,n=t.value,e=t._dnames,r=e.map(function(){return{}}),i=e.length;function a(t){var n,a,u,o;for(n in t)for(u=t[n].tuple,a=0;a<i;++a)r[a][o=u[e[a]]]=o}a(t._prev),a(n),function a(u,o,s){var l,c,f=e[s],h=r[s++];for(l in h)o[f]=h[l],c=u?u+"|"+l:l,s<i?a(c,o,s):n[c]||t.cell(c,o)}("",{},0)},Ei.init=function(t){var n=this._inputs=[],a=this._outputs=[],u={};function o(t){for(var e,i=W(r(t)),a=0,o=i.length;a<o;++a)u[e=i[a]]||(u[e]=1,n.push(e))}this._dims=W(t.groupby),this._dnames=this._dims.map(function(t){var n=e(t);return o(t),a.push(n),n}),this.cellkey=t.key?t.key:Gr(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];var s,l,c,f,h,d,p=t.fields||[null],g=t.ops||["count"],v=t.as||[],m=p.length,y={};for(m!==g.length&&i("Unmatched number of fields and aggregate ops."),d=0;d<m;++d)s=p[d],l=g[d],null==s&&"count"!==l&&i("Null aggregate field specified."),h=Vr(l,f=e(s),v[d]),a.push(h),"count"!==l?((c=y[f])||(o(s),(c=y[f]=[]).field=s,this._measures.push(c)),"count"!==l&&(this._countOnly=!1),c.push(Jr(l,h))):this._counts.push(h);return this._measures=this._measures.map(function(t){return ti(t,t.field)}),{}},Ei.cellkey=Gr(),Ei.cell=function(t,n){var e=this.value[t];return e?0===e.num&&this._drop&&e.stamp<this.stamp?(e.stamp=this.stamp,this._adds[this._alen++]=e):e.stamp<this.stamp&&(e.stamp=this.stamp,this._mods[this._mlen++]=e):(e=this.value[t]=this.newcell(t,n),this._adds[this._alen++]=e),e},Ei.newcell=function(t,n){var e={key:t,num:0,agg:null,tuple:this.newtuple(n,this._prev&&this._prev[t]),stamp:this.stamp,store:!1};if(!this._countOnly){var r,i=this._measures,a=i.length;for(e.agg=Array(a),r=0;r<a;++r)e.agg[r]=new i[r](e)}return e.store&&(e.data=new Ai),e},Ei.newtuple=function(t,n){var e,r,i=this._dnames,a=this._dims,u={};for(e=0,r=a.length;e<r;++e)u[i[e]]=a[e](t);return n?St(n.tuple,u):Ct(u)},Ei.add=function(t){var n,e,r,i=this.cellkey(t),a=this.cell(i,t);if(a.num+=1,!this._countOnly)for(a.store&&a.data.add(t),e=0,r=(n=a.agg).length;e<r;++e)n[e].add(n[e].get(t),t)},Ei.rem=function(t){var n,e,r,i=this.cellkey(t),a=this.cell(i,t);if(a.num-=1,!this._countOnly)for(a.store&&a.data.rem(t),e=0,r=(n=a.agg).length;e<r;++e)n[e].rem(n[e].get(t),t)},Ei.celltuple=function(t){var n,e,r,i=t.tuple,a=this._counts;for(t.store&&t.data.values(),e=0,r=a.length;e<r;++e)i[a[e]]=t.num;if(!this._countOnly)for(e=0,r=(n=t.agg).length;e<r;++e)n[e].set(i);return i},Ei.changes=function(t){var n,e,r,i,a=this._adds,u=this._mods,o=this._prev,s=this._drop,l=t.add,c=t.rem,f=t.mod;if(o)for(e in o)n=o[e],s&&!n.num||c.push(n.tuple);for(r=0,i=this._alen;r<i;++r)l.push(this.celltuple(a[r])),a[r]=null;for(r=0,i=this._mlen;r<i;++r)(0===(n=u[r]).num&&s?c:f).push(this.celltuple(n)),u[r]=null;return this._alen=this._mlen=0,this._prev=null,t},Ci.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]};var Di=et(Ci,Ir);function Fi(t,n,e){var r=t,i=n||[],a=e||[],u={},o=0;return{add:function(t){a.push(t)},remove:function(t){u[r(t)]=++o},size:function(){return i.length},data:function(t,n){return o&&(i=i.filter(function(t){return!u[r(t)]}),u={},o=0),n&&t&&i.sort(t),a.length&&(i=t?lt(t,i,a.sort(t)):i.concat(a),a=[]),i}}}function Si(t){Ir.call(this,[],t)}function Bi(t){Lt.call(this,null,Ni,t)}function Ni(t){return this.value&&!t.modified()?this.value:G(t.fields,t.orders)}function Oi(t){Ir.call(this,null,t)}Di.transform=function(t,n){var e,i=this._bins(t),a=i.start,u=i.step,o=t.as||["bin0","bin1"],s=o[0],l=o[1];return e=t.modified()?(n=n.reflow(!0)).SOURCE:n.modified(r(t.field))?n.ADD_MOD:n.ADD,n.visit(e,function(t){var n=i(t);t[s]=n,t[l]=null==n?null:a+u*(1+(n-a)/u)}),n.modifies(o)},Di._bins=function(t){if(this.value&&!t.modified())return this.value;var i,a,u=t.field,o=ni(t),s=o.start,l=o.stop,c=o.step;null!=(i=t.anchor)&&(a=i-(s+c*Math.floor((i-s)/c)),s+=a,l+=a);var f=function(t){var n=u(t);return null==n?null:(n=Math.max(s,Math.min(+n,l-c)),s+c*Math.floor((n-s)/c))};return f.start=s,f.stop=l,f.step=c,this.value=n(f,r(u),t.name||"bin_"+e(u))},Si.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},et(Si,Ir).transform=function(t,n){var e=n.fork(n.ALL),r=Fi(kt,this.value,e.materialize(e.ADD).add),i=t.sort,a=n.changed()||i&&(t.modified("sort")||n.modified(i.fields));return e.visit(e.REM,r.remove),this.modified(a),this.value=e.source=r.data(i,a),n.source&&n.source.root&&(this.value.root=n.source.root),e},et(Bi,Lt),Oi.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};var zi=et(Oi,Ir);function Ti(t){Ir.call(this,null,t)}zi.transform=function(t,n){function e(n){return function(e){for(var r,i=function(t,n,e){switch(n){case"upper":t=t.toUpperCase();break;case"lower":t=t.toLowerCase()}return t.match(e)}(o(e),t.case,a)||[],s=0,l=i.length;s<l;++s)u.test(r=i[s])||n(r)}}var r=this._parameterCheck(t,n),i=this._counts,a=this._match,u=this._stop,o=t.field,s=t.as||["text","count"],l=e(function(t){i[t]=1+(i[t]||0)}),c=e(function(t){i[t]-=1});return r?n.visit(n.SOURCE,l):(n.visit(n.ADD,l),n.visit(n.REM,c)),this._finish(n,s)},zi._parameterCheck=function(t,n){var e=!1;return!t.modified("stopwords")&&this._stop||(this._stop=new RegExp("^"+(t.stopwords||"")+"$","i"),e=!0),!t.modified("pattern")&&this._match||(this._match=new RegExp(t.pattern||"[\\w']+","g"),e=!0),(t.modified("field")||n.modified(t.field.fields))&&(e=!0),e&&(this._counts={}),e},zi._finish=function(t,n){var e,r,i,a=this._counts,u=this._tuples||(this._tuples={}),o=n[0],s=n[1],l=t.fork(t.NO_SOURCE|t.NO_FIELDS);for(e in a)r=u[e],i=a[e]||0,!r&&i?(u[e]=r=Ct({}),r[o]=e,r[s]=i,l.add.push(r)):0===i?(r&&l.rem.push(r),a[e]=null,u[e]=null):r[s]!==i&&(r[s]=i,l.mod.push(r));return l.modifies(n)},Ti.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},et(Ti,Ir).transform=function(t,n){var e=n.fork(n.NO_SOURCE),r=this.value,i=t.as||["a","b"],a=i[0],u=i[1];return!r||n.changed(n.ADD_REM)||t.modified("as")||t.modified("filter")?(r&&(e.rem=r),r=n.materialize(n.SOURCE).source,e.add=this.value=function(t,n,e,r){for(var i,a,u=[],o={},s=t.length,l=0;l<s;++l)for(o[n]=a=t[l],i=0;i<s;++i)o[e]=t[i],r(o)&&(u.push(Ct(o)),(o={})[n]=a);return u}(r,a,u,t.filter||v)):e.mod=r,e.source=this.value,e.modifies(i)};var Ri={kde:xi,mixture:bi,normal:_i,uniform:wi},Pi="distributions",Li="function",qi="field";function Ui(t){Ir.call(this,null,t)}var ji=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],Ii={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:ji},{name:"weights",type:"number",array:!0}]};function $i(t){Lt.call(this,null,Wi,t),this.modified(!0)}function Wi(t){var i=t.expr;return this.value&&!t.modified("expr")?this.value:n(function(n){return i(n,t)},r(i),e(i))}function Hi(t){Ir.call(this,[void 0,void 0],t)}function Yi(t,n){Lt.call(this,t),this.parent=n}Ui.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number",default:100},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:ji.concat(Ii)},{name:"as",type:"string",array:!0,default:["value","density"]}]},et(Ui,Ir).transform=function(t,n){var e=n.fork(n.NO_SOURCE|n.NO_FIELDS);if(!this.value||n.changed()||t.modified()){var r=function t(n,e){var r=n[Li];Ri.hasOwnProperty(r)||i("Unknown distribution function: "+r);var a=Ri[r]();for(var u in n)u===qi?a.data((n.from||e()).map(n[u])):u===Pi?a[u](n[u].map(function(n){return t(n,e)})):typeof a[u]===Li&&a[u](n[u]);return a}(t.distribution,function(t){return function(){return t.materialize(t.SOURCE).source}}(n)),a=t.method||"pdf";"pdf"!==a&&"cdf"!==a&&i("Invalid density method: "+a),t.extent||r.data||i("Missing density extent parameter."),a=r[a];var u=t.as||["value","density"],o=t.extent||li(r.data()),s=(o[1]-o[0])/(t.steps||100),l=ci(o[0],o[1]+s/2,s).map(function(t){var n={};return n[u[0]]=t,n[u[1]]=a(t),Ct(n)});this.value&&(e.rem=this.value),this.value=e.add=e.source=l}return e},et($i,Lt),Hi.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},et(Hi,Ir).transform=function(t,n){var e,r=this.value,i=t.field,a=r[0],u=r[1];((e=n.changed()||n.modified(i.fields)||t.modified("field"))||null==a)&&(a=1/0,u=-1/0),n.visit(e?n.SOURCE:n.ADD,function(t){var n=i(t);null!=n&&((n=+n)<a&&(a=n),n>u&&(u=n))}),isFinite(a)&&isFinite(u)||(a=u=void 0),this.value=[a,u]};var Gi=et(Yi,Lt);function Vi(t){Ir.call(this,{},t),this._keys=tt();var n=this._targets=[];n.active=0,n.forEach=function(t){for(var e=0,r=n.active;e<r;++e)t(n[e],e,n)}}Gi.connect=function(t){return this.targets().add(t),t.source=this},Gi.add=function(t){this.value.add.push(t)},Gi.rem=function(t){this.value.rem.push(t)},Gi.mod=function(t){this.value.mod.push(t)},Gi.init=function(t){this.value.init(t,t.NO_SOURCE)},Gi.evaluate=function(){return this.value};var Xi=et(Vi,Ir);function Zi(t){Lt.call(this,null,Ji,t)}function Ji(t){return this.value&&!t.modified()?this.value:u(t.name)?W(t.name).map(function(t){return c(t)}):c(t.name,t.as)}function Qi(t){Ir.call(this,tt(),t)}function Ki(t,n){return t?t.map(function(t,r){return n[r]||e(t)}):null}function ta(t){Ir.call(this,[],t)}function na(t){Ir.call(this,[],t)}function ea(t){Ir.call(this,null,t)}function ra(t){Ir.call(this,[],t)}Xi.activate=function(t){this._targets[this._targets.active++]=t},Xi.subflow=function(t,n,e,r){var i,a,u=this.value,o=u.hasOwnProperty(t)&&u[t];return o?o.value.stamp<e.stamp&&(o.init(e),this.activate(o)):(a=r||(a=this._group[t])&&a.tuple,o=(i=e.dataflow).add(new Yi(e.fork(e.NO_SOURCE),this)).connect(n(i,t,a)),u[t]=o,this.activate(o)),o},Xi.transform=function(t,n){var e=n.dataflow,r=this,i=t.key,a=t.subflow,u=this._keys,o=t.modified("key");function s(t){return r.subflow(t,a,n)}return this._group=t.group||{},this._targets.active=0,n.visit(n.REM,function(t){var n=kt(t),e=u.get(n);void 0!==e&&(u.delete(n),s(e).rem(t))}),n.visit(n.ADD,function(t){var n=i(t);u.set(kt(t),n),s(n).add(t)}),o||n.modified(i.fields)?n.visit(n.MOD,function(t){var n=kt(t),e=u.get(n),r=i(t);e===r?s(r).mod(t):(u.set(n,r),s(e).rem(t),s(r).add(t))}):n.changed(n.MOD)&&n.visit(n.MOD,function(t){s(u.get(kt(t))).mod(t)}),o&&n.visit(n.REFLOW,function(t){var n=kt(t),e=u.get(n),r=i(t);e!==r&&(u.set(n,r),s(e).rem(t),s(r).add(t))}),u.empty>e.cleanThreshold&&e.runAfter(u.clean),n},et(Zi,Lt),Qi.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},et(Qi,Ir).transform=function(t,n){var e=n.dataflow,r=this.value,i=n.fork(),a=i.add,u=i.rem,o=i.mod,s=t.expr,l=!0;function c(n){var e=kt(n),i=s(n,t),c=r.get(e);i&&c?(r.delete(e),a.push(n)):i||c?l&&i&&!c&&o.push(n):(r.set(e,1),u.push(n))}return n.visit(n.REM,function(t){var n=kt(t);r.has(n)?r.delete(n):u.push(t)}),n.visit(n.ADD,function(n){s(n,t)?a.push(n):r.set(kt(n),1)}),n.visit(n.MOD,c),t.modified()&&(l=!1,n.visit(n.REFLOW,c)),r.empty>e.cleanThreshold&&e.runAfter(r.clean),i},ta.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0}]},et(ta,Ir).transform=function(t,n){var e=n.fork(n.NO_SOURCE),r=t.fields,i=Ki(r,t.as||[]),a=i.length;return e.rem=this.value,n.visit(n.SOURCE,function(t){for(var n,u,o,s=r.map(function(n){return n(t)}),l=s.reduce(function(t,n){return Math.max(t,n.length)},0),c=0;c<l;++c){for(u=Dt(t),n=0;n<a;++n)u[i[n]]=null==(o=s[n][c])?null:o;e.add.push(u)}}),this.value=e.source=e.add,e.modifies(i)},na.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},et(na,Ir).transform=function(t,n){var r=n.fork(n.NO_SOURCE),i=t.fields,a=i.map(e),u=t.as||["key","value"],o=u[0],s=u[1],l=i.length;return r.rem=this.value,n.visit(n.SOURCE,function(t){for(var n,e=0;e<l;++e)(n=Dt(t))[o]=a[e],n[s]=i[e](t),r.add.push(n)}),this.value=r.source=r.add,r.modifies(u)},ea.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},et(ea,Ir).transform=function(t,n){var e=t.expr,r=t.as,i=t.modified(),a=t.initonly?n.ADD:i?n.SOURCE:n.modified(e.fields)?n.ADD_MOD:n.ADD;return i&&(n=n.materialize().reflow(!0)),t.initonly||n.modifies(r),n.visit(a,function(n){n[r]=e(n,t)})},et(ra,Ir).transform=function(t,n){var e,r,i,a=this.value,u=n.fork(n.ALL),o=t.size-a.length,s=t.generator;if(o>0){for(e=[];--o>=0;)e.push(i=Ct(s(t))),a.push(i);u.add=u.add.length?u.materialize(u.ADD).add.concat(e):e}else r=a.slice(0,-o),u.rem=u.rem.length?u.materialize(u.REM).rem.concat(r):r,a=a.slice(-o);return u.source=this.value=a,u};var ia={value:"value",median:function(t,n){if(!(t=Float64Array.from(function*(t,n){if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(yield n);else{let e=-1;for(let r of t)null!=(r=n(r,++e,t))&&(r=+r)>=r&&(yield r)}}(t,n))).length)return;const e=t.length,r=e>>1;return gi(t,r-1,0),0==(1&e)&&gi(t,r,r),pi(t,.5)},mean:function(t,n){let e=0,r=0;if(void 0===n)for(let n of t)null!=n&&(n=+n)>=n&&(++e,r+=n);else{let i=-1;for(let a of t)null!=(a=n(a,++i,t))&&(a=+a)>=a&&(++e,r+=a)}if(e)return r/e},min:function(t,n){let e;if(void 0===n)for(let n of t)null!=n&&n>=n&&(void 0===e||e>n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&i>=i&&(void 0===e||e>i)&&(e=i)}return e},max:function(t,n){let e;if(void 0===n)for(let n of t)null!=n&&n>=n&&(void 0===e||e<n)&&(e=n);else{let r=-1;for(let i of t)null!=(i=n(i,++r,t))&&i>=i&&(void 0===e||e<i)&&(e=i)}return e}},aa=[];function ua(t){Ir.call(this,[],t)}function oa(t){ki.call(this,t)}ua.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]},et(ua,Ir).transform=function(t,n){var r,a,u,o,s,l,c,f,h,d,p=n.fork(n.ALL),g=function(t){var n,e=t.method||ia.value;if(null!=ia[e])return e===ia.value?(n=void 0!==t.value?t.value:0,function(){return n}):ia[e];i("Unrecognized imputation method: "+e)}(t),v=function(t){var n=t.field;return function(t){return t?n(t):NaN}}(t),m=e(t.field),y=e(t.key),_=(t.groupby||[]).map(e),x=function(t,n,e,r){var i,a,u,o,s,l,c,f,h=function(t){return t(f)},d=[],p=r?r.slice():[],g={},v={};for(p.forEach(function(t,n){g[t]=n+1}),o=0,c=t.length;o<c;++o)f=t[o],l=e(f),s=g[l]||(g[l]=p.push(l)),a=(i=n?n.map(h):aa)+"",(u=v[a])||(u=v[a]=[],d.push(u),u.values=i),u[s-1]=f;return d.domain=p,d}(n.source,t.groupby,t.key,t.keyvals),b=[],w=this.value,A=x.domain.length;for(s=0,f=x.length;s<f;++s)for(u=(r=x[s]).values,a=NaN,c=0;c<A;++c)if(null==r[c]){for(o=x.domain[c],d={_impute:!0},l=0,h=u.length;l<h;++l)d[_[l]]=u[l];d[y]=o,d[m]=isNaN(a)?a=g(r,v):a,b.push(Ct(d))}return b.length&&(p.add=p.materialize(p.ADD).add.concat(b)),w.length&&(p.rem=p.materialize(p.REM).rem.concat(w)),this.value=b,p},oa.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:Zr},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]};var sa=et(oa,ki);function la(t){Lt.call(this,null,ca,t)}function ca(t){return this.value&&!t.modified()?this.value:st(t.fields,t.flat)}function fa(t){Ir.call(this,[],t)}function ha(t,n,e){e.forEach(Ct);const r=n.fork(n.NO_FIELDS&n.NO_SOURCE);return r.rem=t.value,t.value=r.add=r.source=e,r}function da(t){Ir.call(this,{},t)}function pa(t){Lt.call(this,null,ga,t)}function ga(t){if(this.value&&!t.modified())return this.value;var n,e,r,i=1/0,a=-1/0,u=t.extents;for(n=0,e=u.length;n<e;++n)(r=u[n])[0]<i&&(i=r[0]),r[1]>a&&(a=r[1]);return[i,a]}function va(t){Lt.call(this,null,ma,t)}function ma(t){return this.value&&!t.modified()?this.value:t.values.reduce(function(t,n){return t.concat(n)},[])}function ya(t){Ir.call(this,null,t)}function _a(t){ki.call(this,t)}sa.transform=function(t,n){var e,r=this,i=t.modified();return r.value&&(i||n.modified(r._inputs))?(e=r.value=i?r.init(t):{},n.visit(n.SOURCE,function(t){r.add(t)})):(e=r.value=r.value||this.init(t),n.visit(n.REM,function(t){r.rem(t)}),n.visit(n.ADD,function(t){r.add(t)})),r.changes(),n.visit(n.SOURCE,function(t){Z(t,e[r.cellkey(t)].tuple)}),n.reflow(i).modifies(this._outputs)},sa.changes=function(){var t,n,e=this._adds,r=this._mods;for(t=0,n=this._alen;t<n;++t)this.celltuple(e[t]),e[t]=null;for(t=0,n=this._mlen;t<n;++t)this.celltuple(r[t]),r[t]=null;this._alen=this._mlen=0},et(la,Lt),et(fa,Ir).transform=function(t,n){const e=n.dataflow;return t.values?ha(this,n,e.parse(t.values,t.format)):e.request(t.url,t.format).then(t=>ha(this,n,t.data||[]))},da.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},et(da,Ir).transform=function(t,n){var r,a,u=n,o=t.as,s=t.fields,l=t.index,c=t.values,f=null==t.default?null:t.default,h=t.modified(),d=h?n.SOURCE:n.ADD,p=s.length;return c?(a=c.length,p>1&&!o&&i('Multi-field lookup requires explicit "as" parameter.'),o&&o.length!==p*a&&i('The "as" parameter has too few output field names.'),o=o||c.map(e),r=function(t){for(var n,e,r=0,i=0;r<p;++r)if(null==(e=l.get(s[r](t))))for(n=0;n<a;++n,++i)t[o[i]]=f;else for(n=0;n<a;++n,++i)t[o[i]]=c[n](e)}):(o||i("Missing output field names."),r=function(t){for(var n,e=0;e<p;++e)n=l.get(s[e](t)),t[o[e]]=null==n?f:n}),h?u=n.reflow(!0):d|=s.some(function(t){return n.modified(t.fields)})?n.MOD:0,n.visit(d,r),u.modifies(o)},et(pa,Lt),et(va,Lt),et(ya,Ir),ya.prototype.transform=function(t,n){return this.modified(t.modified()),this.value=t,n.fork(n.NO_SOURCE|n.NO_FIELDS)},_a.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:Zr,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};var xa=et(_a,ki);function ba(t){Vi.call(this,t)}function wa(t){Ir.call(this,null,t)}function Aa(t){Ir.call(this,null,t)}function Ma(t){Ir.call(this,null,t)}function ka(t){Ir.call(this,[],t),this.count=0}function Ea(t){Ir.call(this,null,t)}function Ca(t){Ir.call(this,null,t),this.modified(!0)}function Da(t){Ir.call(this,tt(),t)}function Fa(t){Ir.call(this,null,t)}xa._transform=xa.transform,xa.transform=function(t,e){return this._transform(function(t,e){var i=t.field,a=t.value,u=("count"===t.op?"__count__":t.op)||"sum",o=r(i).concat(r(a)),s=function(t,n,e){var r={},i=[];return e.visit(e.SOURCE,function(n){var e=t(n);r[e]||(r[e]=1,i.push(e))}),i.sort(function(t,n){return(t<n||null==t)&&null!=n?-1:(t>n||null==n)&&null!=t?1:(n=n instanceof Date?+n:n,(t=t instanceof Date?+t:t)!==t&&n==n?-1:n!=n&&t==t?1:0)}),n?i.slice(0,n):i}(i,t.limit||0,e);return{key:t.key,groupby:t.groupby,ops:s.map(function(){return u}),fields:s.map(function(t){return function(t,e,r,i){return n(function(n){return e(n)===t?r(n):NaN},i,t+"")}(t,i,a,o)}),as:s.map(function(t){return t+""}),modified:t.modified.bind(t)}}(t,e),e)},et(ba,Vi).transform=function(t,n){var e=this,a=t.subflow,u=t.field;return(t.modified("field")||u&&n.modified(r(u)))&&i("PreFacet does not support field modification."),this._targets.active=0,n.visit(n.MOD,function(t){var r=e.subflow(kt(t),a,n,t);u?u(t).forEach(function(t){r.mod(t)}):r.mod(t)}),n.visit(n.ADD,function(t){var r=e.subflow(kt(t),a,n,t);u?u(t).forEach(function(t){r.add(Ct(t))}):r.add(t)}),n.visit(n.REM,function(t){var r=e.subflow(kt(t),a,n,t);u?u(t).forEach(function(t){r.rem(t)}):r.rem(t)}),n},wa.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},et(wa,Ir).transform=function(t,n){var e,r,i=t.fields,a=Ki(t.fields,t.as||[]),u=i?function(t,n){return function(t,n,e,r){for(var i=0,a=e.length;i<a;++i)n[r[i]]=e[i](t);return n}(t,n,i,a)}:Ft;return this.value?r=this.value:(n=n.addAll(),r=this.value={}),e=n.fork(n.NO_SOURCE),n.visit(n.REM,function(t){var n=kt(t);e.rem.push(r[n]),r[n]=null}),n.visit(n.ADD,function(t){var n=u(t,Ct({}));r[kt(t)]=n,e.add.push(n)}),n.visit(n.MOD,function(t){e.mod.push(u(t,r[kt(t)]))}),e},et(Aa,Ir).transform=function(t,n){return this.value=t.value,t.modified("value")?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation},et(Ma,Ir).transform=function(t,n){var e,r;return this.value?r=this.value:(e=n=n.addAll(),r=this.value={}),t.derive&&(e=n.fork(n.NO_SOURCE),n.visit(n.REM,function(t){var n=kt(t);e.rem.push(r[n]),r[n]=null}),n.visit(n.ADD,function(t){var n=Dt(t);r[kt(t)]=n,e.add.push(n)}),n.visit(n.MOD,function(t){e.mod.push(Ft(t,r[kt(t)]))})),e},ka.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},et(ka,Ir).transform=function(n,e){var r=e.fork(e.NO_SOURCE),i=n.modified("size"),a=n.size,u=this.value,o=this.count,s=0,l=u.reduce(function(t,n){return t[kt(n)]=1,t},{});function c(n){var e,i;u.length<a?u.push(n):(i=~~((o+1)*t.random()))<u.length&&i>=s&&(e=u[i],l[kt(e)]&&r.rem.push(e),u[i]=n),++o}if(e.rem.length&&(e.visit(e.REM,function(t){var n=kt(t);l[n]&&(l[n]=-1,r.rem.push(t)),--o}),u=u.filter(function(t){return-1!==l[kt(t)]})),(e.rem.length||i)&&u.length<a&&e.source&&(s=o=u.length,e.visit(e.SOURCE,function(t){l[kt(t)]||c(t)}),s=-1),i&&u.length>a){for(var f=0,h=u.length-a;f<h;++f)l[kt(u[f])]=-1,r.rem.push(u[f]);u=u.slice(h)}return e.mod.length&&e.visit(e.MOD,function(t){l[kt(t)]&&r.mod.push(t)}),e.add.length&&e.visit(e.ADD,c),(e.add.length||s<0)&&(r.add=u.filter(function(t){return!l[kt(t)]})),this.count=o,this.value=r.source=u,r},Ea.Definition={type:"Sequence",metadata:{changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},et(Ea,Ir).transform=function(t,n){if(!this.value||t.modified()){var e=n.materialize().fork(n.MOD),r=t.as||"data";return e.rem=this.value?n.rem.concat(this.value):n.rem,this.value=ci(t.start,t.stop,t.step||1).map(function(t){var n={};return n[r]=t,Ct(n)}),e.add=n.add.concat(this.value),e}},et(Ca,Ir).transform=function(t,n){return this.value=n.source,n.changed()?n.fork(n.NO_SOURCE|n.NO_FIELDS):n.StopPropagation},et(Da,Ir).transform=function(t,n){var e=n.dataflow,r=t.field,i=this.value,a=!0;function u(t){i.set(r(t),t)}return t.modified("field")||n.modified(r.fields)?(i.clear(),n.visit(n.SOURCE,u)):n.changed()?(n.visit(n.REM,function(t){i.delete(r(t))}),n.visit(n.ADD,u)):a=!1,this.modified(a),i.empty>e.cleanThreshold&&e.runAfter(i.clean),n.fork()},et(Fa,Ir).transform=function(t,n){(!this.value||t.modified("field")||t.modified("sort")||n.changed()||t.sort&&n.modified(t.sort.fields))&&(this.value=(t.sort?n.source.slice().sort(t.sort):n.source).map(t.field))};var Sa={row_number:function(){return{next:function(t){return t.index+1}}},rank:function(){var t;return{init:function(){t=1},next:function(n){var e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?t=e+1:t}}},dense_rank:function(){var t;return{init:function(){t=1},next:function(n){var e=n.index,r=n.data;return e&&n.compare(r[e-1],r[e])?++t:t}}},percent_rank:function(){var t=Sa.rank(),n=t.next;return{init:t.init,next:function(t){return(n(t)-1)/(t.data.length-1)}}},cume_dist:function(){var t;return{init:function(){t=0},next:function(n){var e=n.index,r=n.data,i=n.compare;if(t<e){for(;e+1<r.length&&!i(r[e],r[e+1]);)++e;t=e}return(1+t)/r.length}}},ntile:function(t,n){(n=+n)>0||i("ntile num must be greater than zero.");var e=Sa.cume_dist(),r=e.next;return{init:e.init,next:function(t){return Math.ceil(n*r(t))}}},lag:function(t,n){return n=+n||1,{next:function(e){var r=e.index-n;return r>=0?t(e.data[r]):null}}},lead:function(t,n){return n=+n||1,{next:function(e){var r=e.index+n,i=e.data;return r<i.length?t(i[r]):null}}},first_value:function(t){return{next:function(n){return t(n.data[n.i0])}}},last_value:function(t){return{next:function(n){return t(n.data[n.i1-1])}}},nth_value:function(t,n){return(n=+n)>0||i("nth_value nth must be greater than zero."),{next:function(e){var r=e.i0+(n-1);return r<e.i1?t(e.data[r]):null}}}},Ba=Object.keys(Sa);function Na(t){var n=W(t.ops),a=W(t.fields),u=W(t.params),o=W(t.as),s=this.outputs=[],l=this.windows=[],c={},f={},h=!0,d=[],g=[];function v(t){W(r(t)).forEach(function(t){c[t]=1})}v(t.sort),n.forEach(function(t,n){var r=a[n],c=e(r),m=Vr(t,c,o[n]);if(v(r),s.push(m),Sa.hasOwnProperty(t))l.push(function(t,n,e,r){var i=Sa[t](n,e);return{init:i.init||p,update:function(t,n){n[r]=i.next(t)}}}(t,a[n],u[n],m));else{if(null==r&&"count"!==t&&i("Null aggregate field specified."),"count"===t)return void d.push(m);h=!1;var y=f[c];y||((y=f[c]=[]).field=r,g.push(y)),y.push(Jr(t,m))}}),(d.length||g.length)&&(this.cell=function(t,n,e){t=t.map(function(t){return ti(t,t.field)});var r={num:0,agg:null,store:!1,count:n};if(!e)for(var i=t.length,a=r.agg=Array(i),u=0;u<i;++u)a[u]=new t[u](r);if(r.store)var o=r.data=new Ai;return r.add=function(t){if(r.num+=1,!e){o&&o.add(t);for(var n=0;n<i;++n)a[n].add(a[n].get(t),t)}},r.rem=function(t){if(r.num-=1,!e){o&&o.rem(t);for(var n=0;n<i;++n)a[n].rem(a[n].get(t),t)}},r.set=function(t){var i,u;for(o&&o.values(),i=0,u=n.length;i<u;++i)t[n[i]]=r.num;if(!e)for(i=0,u=a.length;i<u;++i)a[i].set(t)},r.init=function(){r.num=0,o&&o.reset();for(var t=0;t<i;++t)a[t].init()},r}(g,d,h)),this.inputs=Object.keys(c)}var Oa=Na.prototype;function za(t){Ir.call(this,{},t),this._mlen=0,this._mods=[]}Oa.init=function(){this.windows.forEach(function(t){t.init()}),this.cell&&this.cell.init()},Oa.update=function(t,n){var e,r=this.cell,i=this.windows,a=t.data,u=i&&i.length;if(r){for(e=t.p0;e<t.i0;++e)r.rem(a[e]);for(e=t.p1;e<t.i1;++e)r.add(a[e]);r.set(n)}for(e=0;e<u;++e)i[e].update(t,n)},za.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Ba.concat(Zr)},{name:"params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]};var Ta=et(za,Ir);function Ra(t,n,e){var r=e.sort,i=r&&!e.ignorePeers,a=e.frame||[null,0],u=t.data(r),o=u.length,s=0,l=i?ai(r):null,c={i0:0,i1:0,p0:0,p1:0,index:0,data:u,compare:r||V(-1)};for(n.init();s<o;++s)Pa(c,a,s,o),i&&La(c,l),n.update(c,u[s])}function Pa(t,n,e,r){t.p0=t.i0,t.p1=t.i1,t.i0=null==n[0]?0:Math.max(0,e-Math.abs(n[0])),t.i1=null==n[1]?r:Math.min(r,e+Math.abs(n[1])+1),t.index=e}function La(t,n){var e=t.i0,r=t.i1-1,i=t.compare,a=t.data,u=a.length-1;e>0&&!i(a[e],a[e-1])&&(t.i0=n.left(a,a[e])),r<u&&!i(a[r],a[r+1])&&(t.i1=n.right(a,a[r]))}Ta.transform=function(t,n){var e,r,i=this,a=i.state,u=t.modified();this.stamp=n.stamp,a&&!u||(a=i.state=new Na(t));var o=Gr(t.groupby);function s(t){return i.group(o(t))}for(u||n.modified(a.inputs)?(i.value={},n.visit(n.SOURCE,function(t){s(t).add(t)})):(n.visit(n.REM,function(t){s(t).remove(t)}),n.visit(n.ADD,function(t){s(t).add(t)})),e=0,r=i._mlen;e<r;++e)Ra(i._mods[e],a,t);return i._mlen=0,i._mods=[],n.reflow(u).modifies(a.outputs)},Ta.group=function(t){var n=this.value[t];return n||((n=this.value[t]=Fi(kt)).stamp=-1),n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n),n};var qa=Object.freeze({aggregate:ki,bin:Ci,collect:Si,compare:Bi,countpattern:Oi,cross:Ti,density:Ui,expression:$i,extent:Hi,facet:Vi,field:Zi,filter:Qi,flatten:ta,fold:na,formula:ea,generate:ra,impute:ua,joinaggregate:oa,key:la,load:fa,lookup:da,multiextent:pa,multivalues:va,params:ya,pivot:_a,prefacet:ba,project:wa,proxy:Aa,relay:Ma,sample:ka,sequence:Ea,sieve:Ca,subflow:Yi,tupleindex:Da,values:Fa,window:za}),Ua="top",ja="left",Ia="right",$a="bottom",Wa="top-left",Ha="top-right",Ya="bottom-left",Ga="bottom-right",Va="start",Xa="end",Za="group",Ja="axis",Qa="title",Ka="frame",tu="scope",nu="legend",eu="row-header",ru="row-footer",iu="row-title",au="column-header",uu="column-footer",ou="column-title",su="padding",lu="symbol",cu="fit",fu="fit-x",hu="fit-y",du="pad",pu="none",gu="all",vu="each",mu="flush",yu="column",_u="row";function xu(t){this.clear(),t&&this.union(t)}var bu=xu.prototype;bu.clone=function(){return new xu(this)},bu.clear=function(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},bu.empty=function(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},bu.set=function(t,n,e,r){return e<t?(this.x2=t,this.x1=e):(this.x1=t,this.x2=e),r<n?(this.y2=n,this.y1=r):(this.y1=n,this.y2=r),this},bu.add=function(t,n){return t<this.x1&&(this.x1=t),n<this.y1&&(this.y1=n),t>this.x2&&(this.x2=t),n>this.y2&&(this.y2=n),this},bu.expand=function(t){return this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t,this},bu.round=function(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},bu.translate=function(t,n){return this.x1+=t,this.x2+=t,this.y1+=n,this.y2+=n,this},bu.rotate=function(t,n,e){const r=this.rotatedPoints(t,n,e);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},bu.rotatedPoints=function(t,n,e){var{x1:r,y1:i,x2:a,y2:u}=this,o=Math.cos(t),s=Math.sin(t),l=n-n*o+e*s,c=e-n*s-e*o;return[o*r-s*i+l,s*r+o*i+c,o*r-s*u+l,s*r+o*u+c,o*a-s*i+l,s*a+o*i+c,o*a-s*u+l,s*a+o*u+c]},bu.union=function(t){return t.x1<this.x1&&(this.x1=t.x1),t.y1<this.y1&&(this.y1=t.y1),t.x2>this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this},bu.intersect=function(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2<this.x2&&(this.x2=t.x2),t.y2<this.y2&&(this.y2=t.y2),this},bu.encloses=function(t){return t&&this.x1<=t.x1&&this.x2>=t.x2&&this.y1<=t.y1&&this.y2>=t.y2},bu.alignsWith=function(t){return t&&(this.x1==t.x1||this.x2==t.x2||this.y1==t.y1||this.y2==t.y2)},bu.intersects=function(t){return t&&!(this.x2<t.x1||this.x1>t.x2||this.y2<t.y1||this.y1>t.y2)},bu.contains=function(t,n){return!(t<this.x1||t>this.x2||n<this.y1||n>this.y2)},bu.width=function(){return this.x2-this.x1},bu.height=function(){return this.y2-this.y1};var wu=0;function Au(t,n){var e,r=[];return e={id:"gradient_"+wu++,x1:t?t[0]:0,y1:t?t[1]:0,x2:n?n[0]:1,y2:n?n[1]:0,stops:r,stop:function(t,n){return r.push({offset:t,color:n}),e}}}function Mu(t){this.mark=t,this.bounds=this.bounds||new xu}function ku(t){Mu.call(this,t),this.items=this.items||[]}function Eu(t,n){if("undefined"!=typeof document&&document.createElement){var e=document.createElement("canvas");if(e&&e.getContext)return e.width=t,e.height=n,e}return null}function Cu(){return"undefined"!=typeof Image?Image:null}function Du(t){this._pending=0,this._loader=t||xr()}et(ku,Mu);var Fu=Du.prototype;function Su(t){t._pending+=1}function Bu(t){t._pending-=1}Fu.pending=function(){return this._pending},Fu.sanitizeURL=function(t){var n=this;return Su(n),n._loader.sanitize(t,{context:"href"}).then(function(t){return Bu(n),t}).catch(function(){return Bu(n),null})},Fu.loadImage=function(t){var n=this,e=Cu();return Su(n),n._loader.sanitize(t,{context:"image"}).then(function(t){var r=t.href;if(!r||!e)throw{url:r};var i=new e;return i.onload=function(){Bu(n),i.loaded=!0},i.onerror=function(){Bu(n),i.loaded=!1},i.src=r,i}).catch(function(t){return Bu(n),{loaded:!1,width:0,height:0,src:t&&t.url||""}})},Fu.ready=function(){var t=this;return new Promise(function(n){!function e(r){t.pending()?setTimeout(function(){e(!0)},10):n(r)}(!1)})};var Nu=Math.PI,Ou=2*Nu,zu=Ou-1e-6;function Tu(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function Ru(){return new Tu}function Pu(t){return function(){return t}}Tu.prototype=Ru.prototype={constructor:Tu,moveTo:function(t,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,n){this._+="L"+(this._x1=+t)+","+(this._y1=+n)},quadraticCurveTo:function(t,n,e,r){this._+="Q"+ +t+","+ +n+","+(this._x1=+e)+","+(this._y1=+r)},bezierCurveTo:function(t,n,e,r,i,a){this._+="C"+ +t+","+ +n+","+ +e+","+ +r+","+(this._x1=+i)+","+(this._y1=+a)},arcTo:function(t,n,e,r,i){t=+t,n=+n,e=+e,r=+r,i=+i;var a=this._x1,u=this._y1,o=e-t,s=r-n,l=a-t,c=u-n,f=l*l+c*c;if(i<0)throw new Error("negative radius: "+i);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=n);else if(f>1e-6)if(Math.abs(c*o-s*l)>1e-6&&i){var h=e-a,d=r-u,p=o*o+s*s,g=h*h+d*d,v=Math.sqrt(p),m=Math.sqrt(f),y=i*Math.tan((Nu-Math.acos((p+f-g)/(2*v*m)))/2),_=y/m,x=y/v;Math.abs(_-1)>1e-6&&(this._+="L"+(t+_*l)+","+(n+_*c)),this._+="A"+i+","+i+",0,0,"+ +(c*h>l*d)+","+(this._x1=t+x*o)+","+(this._y1=n+x*s)}else this._+="L"+(this._x1=t)+","+(this._y1=n);else;},arc:function(t,n,e,r,i,a){t=+t,n=+n;var u=(e=+e)*Math.cos(r),o=e*Math.sin(r),s=t+u,l=n+o,c=1^a,f=a?r-i:i-r;if(e<0)throw new Error("negative radius: "+e);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+s+","+l),e&&(f<0&&(f=f%Ou+Ou),f>zu?this._+="A"+e+","+e+",0,1,"+c+","+(t-u)+","+(n-o)+"A"+e+","+e+",0,1,"+c+","+(this._x1=s)+","+(this._y1=l):f>1e-6&&(this._+="A"+e+","+e+",0,"+ +(f>=Nu)+","+c+","+(this._x1=t+e*Math.cos(i))+","+(this._y1=n+e*Math.sin(i))))},rect:function(t,n,e,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+n)+"h"+ +e+"v"+ +r+"h"+-e+"Z"},toString:function(){return this._}};var Lu=Math.abs,qu=Math.atan2,Uu=Math.cos,ju=Math.max,Iu=Math.min,$u=Math.sin,Wu=Math.sqrt,Hu=1e-12,Yu=Math.PI,Gu=Yu/2,Vu=2*Yu;function Xu(t){return t>=1?Gu:t<=-1?-Gu:Math.asin(t)}function Zu(t){return t.innerRadius}function Ju(t){return t.outerRadius}function Qu(t){return t.startAngle}function Ku(t){return t.endAngle}function to(t){return t&&t.padAngle}function no(t,n,e,r,i,a,u){var o=t-e,s=n-r,l=(u?a:-a)/Wu(o*o+s*s),c=l*s,f=-l*o,h=t+c,d=n+f,p=e+c,g=r+f,v=(h+p)/2,m=(d+g)/2,y=p-h,_=g-d,x=y*y+_*_,b=i-a,w=h*g-p*d,A=(_<0?-1:1)*Wu(ju(0,b*b*x-w*w)),M=(w*_-y*A)/x,k=(-w*y-_*A)/x,E=(w*_+y*A)/x,C=(-w*y+_*A)/x,D=M-v,F=k-m,S=E-v,B=C-m;return D*D+F*F>S*S+B*B&&(M=E,k=C),{cx:M,cy:k,x01:-c,y01:-f,x11:M*(i/b-1),y11:k*(i/b-1)}}function eo(t){this._context=t}function ro(t){return new eo(t)}function io(t){return t[0]}function ao(t){return t[1]}function uo(){var t=io,n=ao,e=Pu(!0),r=null,i=ro,a=null;function u(u){var o,s,l,c=u.length,f=!1;for(null==r&&(a=i(l=Ru())),o=0;o<=c;++o)!(o<c&&e(s=u[o],o,u))===f&&((f=!f)?a.lineStart():a.lineEnd()),f&&a.point(+t(s,o,u),+n(s,o,u));if(l)return a=null,l+""||null}return u.x=function(n){return arguments.length?(t="function"==typeof n?n:Pu(+n),u):t},u.y=function(t){return arguments.length?(n="function"==typeof t?t:Pu(+t),u):n},u.defined=function(t){return arguments.length?(e="function"==typeof t?t:Pu(!!t),u):e},u.curve=function(t){return arguments.length?(i=t,null!=r&&(a=i(r)),u):i},u.context=function(t){return arguments.length?(null==t?r=a=null:a=i(r=t),u):r},u}function oo(){var t=io,n=null,e=Pu(0),r=ao,i=Pu(!0),a=null,u=ro,o=null;function s(s){var l,c,f,h,d,p=s.length,g=!1,v=new Array(p),m=new Array(p);for(null==a&&(o=u(d=Ru())),l=0;l<=p;++l){if(!(l<p&&i(h=s[l],l,s))===g)if(g=!g)c=l,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),f=l-1;f>=c;--f)o.point(v[f],m[f]);o.lineEnd(),o.areaEnd()}g&&(v[l]=+t(h,l,s),m[l]=+e(h,l,s),o.point(n?+n(h,l,s):v[l],r?+r(h,l,s):m[l]))}if(d)return o=null,d+""||null}function l(){return uo().defined(i).curve(u).context(a)}return s.x=function(e){return arguments.length?(t="function"==typeof e?e:Pu(+e),n=null,s):t},s.x0=function(n){return arguments.length?(t="function"==typeof n?n:Pu(+n),s):t},s.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:Pu(+t),s):n},s.y=function(t){return arguments.length?(e="function"==typeof t?t:Pu(+t),r=null,s):e},s.y0=function(t){return arguments.length?(e="function"==typeof t?t:Pu(+t),s):e},s.y1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Pu(+t),s):r},s.lineX0=s.lineY0=function(){return l().x(t).y(e)},s.lineY1=function(){return l().x(t).y(r)},s.lineX1=function(){return l().x(n).y(e)},s.defined=function(t){return arguments.length?(i="function"==typeof t?t:Pu(!!t),s):i},s.curve=function(t){return arguments.length?(u=t,null!=a&&(o=u(a)),s):u},s.context=function(t){return arguments.length?(null==t?a=o=null:o=u(a=t),s):a},s}eo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:this._context.lineTo(t,n)}}};var so={draw:function(t,n){var e=Math.sqrt(n/Yu);t.moveTo(e,0),t.arc(0,0,e,0,Vu)}};function lo(){}function co(t,n,e){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+n)/6,(t._y0+4*t._y1+e)/6)}function fo(t){this._context=t}function ho(t){this._context=t}function po(t){this._context=t}function go(t,n){this._basis=new fo(t),this._beta=n}fo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:co(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:co(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},ho.prototype={areaStart:lo,areaEnd:lo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x2=t,this._y2=n;break;case 1:this._point=2,this._x3=t,this._y3=n;break;case 2:this._point=3,this._x4=t,this._y4=n,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+n)/6);break;default:co(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},po.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var e=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 3:this._point=4;default:co(this,t,n)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n}},go.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,n=this._y,e=t.length-1;if(e>0)for(var r,i=t[0],a=n[0],u=t[e]-i,o=n[e]-a,s=-1;++s<=e;)r=s/e,this._basis.point(this._beta*t[s]+(1-this._beta)*(i+r*u),this._beta*n[s]+(1-this._beta)*(a+r*o));this._x=this._y=null,this._basis.lineEnd()},point:function(t,n){this._x.push(+t),this._y.push(+n)}};var vo=function t(n){function e(t){return 1===n?new fo(t):new go(t,n)}return e.beta=function(n){return t(+n)},e}(.85);function mo(t,n,e){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-n),t._y2+t._k*(t._y1-e),t._x2,t._y2)}function yo(t,n){this._context=t,this._k=(1-n)/6}yo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:mo(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2,this._x1=t,this._y1=n;break;case 2:this._point=3;default:mo(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var _o=function t(n){function e(t){return new yo(t,n)}return e.tension=function(n){return t(+n)},e}(0);function xo(t,n){this._context=t,this._k=(1-n)/6}xo.prototype={areaStart:lo,areaEnd:lo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:mo(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var bo=function t(n){function e(t){return new xo(t,n)}return e.tension=function(n){return t(+n)},e}(0);function wo(t,n){this._context=t,this._k=(1-n)/6}wo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:mo(this,t,n)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Ao=function t(n){function e(t){return new wo(t,n)}return e.tension=function(n){return t(+n)},e}(0);function Mo(t,n,e){var r=t._x1,i=t._y1,a=t._x2,u=t._y2;if(t._l01_a>Hu){var o=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,s=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*o-t._x0*t._l12_2a+t._x2*t._l01_2a)/s,i=(i*o-t._y0*t._l12_2a+t._y2*t._l01_2a)/s}if(t._l23_a>Hu){var l=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);a=(a*l+t._x1*t._l23_2a-n*t._l12_2a)/c,u=(u*l+t._y1*t._l23_2a-e*t._l12_2a)/c}t._context.bezierCurveTo(r,i,a,u,t._x2,t._y2)}function ko(t,n){this._context=t,this._alpha=n}ko.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3;default:Mo(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Eo=function t(n){function e(t){return n?new ko(t,n):new yo(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Co(t,n){this._context=t,this._alpha=n}Co.prototype={areaStart:lo,areaEnd:lo,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=n;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=n);break;case 2:this._point=3,this._x5=t,this._y5=n;break;default:Mo(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var Do=function t(n){function e(t){return n?new Co(t,n):new xo(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Fo(t,n){this._context=t,this._alpha=n}Fo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){if(t=+t,n=+n,this._point){var e=this._x2-t,r=this._y2-n;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(e*e+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Mo(this,t,n)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=n}};var So=function t(n){function e(t){return n?new Fo(t,n):new wo(t,0)}return e.alpha=function(n){return t(+n)},e}(.5);function Bo(t){this._context=t}function No(t){return t<0?-1:1}function Oo(t,n,e){var r=t._x1-t._x0,i=n-t._x1,a=(t._y1-t._y0)/(r||i<0&&-0),u=(e-t._y1)/(i||r<0&&-0),o=(a*i+u*r)/(r+i);return(No(a)+No(u))*Math.min(Math.abs(a),Math.abs(u),.5*Math.abs(o))||0}function zo(t,n){var e=t._x1-t._x0;return e?(3*(t._y1-t._y0)/e-n)/2:n}function To(t,n,e){var r=t._x0,i=t._y0,a=t._x1,u=t._y1,o=(a-r)/3;t._context.bezierCurveTo(r+o,i+o*n,a-o,u-o*e,a,u)}function Ro(t){this._context=t}function Po(t){this._context=new Lo(t)}function Lo(t){this._context=t}function qo(t){this._context=t}function Uo(t){var n,e,r=t.length-1,i=new Array(r),a=new Array(r),u=new Array(r);for(i[0]=0,a[0]=2,u[0]=t[0]+2*t[1],n=1;n<r-1;++n)i[n]=1,a[n]=4,u[n]=4*t[n]+2*t[n+1];for(i[r-1]=2,a[r-1]=7,u[r-1]=8*t[r-1]+t[r],n=1;n<r;++n)e=i[n]/a[n-1],a[n]-=e,u[n]-=e*u[n-1];for(i[r-1]=u[r-1]/a[r-1],n=r-2;n>=0;--n)i[n]=(u[n]-i[n+1])/a[n];for(a[r-1]=(t[r]+i[r-1])/2,n=0;n<r-1;++n)a[n]=2*t[n+1]-i[n+1];return[i,a]}function jo(t,n){this._context=t,this._t=n}Bo.prototype={areaStart:lo,areaEnd:lo,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,n){t=+t,n=+n,this._point?this._context.lineTo(t,n):(this._point=1,this._context.moveTo(t,n))}},Ro.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:To(this,this._t0,zo(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,n){var e=NaN;if(n=+n,(t=+t)!==this._x1||n!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;break;case 2:this._point=3,To(this,zo(this,e=Oo(this,t,n)),e);break;default:To(this,this._t0,e=Oo(this,t,n))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=n,this._t0=e}}},(Po.prototype=Object.create(Ro.prototype)).point=function(t,n){Ro.prototype.point.call(this,n,t)},Lo.prototype={moveTo:function(t,n){this._context.moveTo(n,t)},closePath:function(){this._context.closePath()},lineTo:function(t,n){this._context.lineTo(n,t)},bezierCurveTo:function(t,n,e,r,i,a){this._context.bezierCurveTo(n,t,r,e,a,i)}},qo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,n=this._y,e=t.length;if(e)if(this._line?this._context.lineTo(t[0],n[0]):this._context.moveTo(t[0],n[0]),2===e)this._context.lineTo(t[1],n[1]);else for(var r=Uo(t),i=Uo(n),a=0,u=1;u<e;++a,++u)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],t[u],n[u]);(this._line||0!==this._line&&1===e)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,n){this._x.push(+t),this._y.push(+n)}},jo.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,n){switch(t=+t,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(t,n);else{var e=this._x*(1-this._t)+t*this._t;this._context.lineTo(e,this._y),this._context.lineTo(e,n)}}this._x=t,this._y=n}};var Io={basis:{curve:function(t){return new fo(t)}},"basis-closed":{curve:function(t){return new ho(t)}},"basis-open":{curve:function(t){return new po(t)}},bundle:{curve:vo,tension:"beta",value:.85},cardinal:{curve:_o,tension:"tension",value:0},"cardinal-open":{curve:Ao,tension:"tension",value:0},"cardinal-closed":{curve:bo,tension:"tension",value:0},"catmull-rom":{curve:Eo,tension:"alpha",value:.5},"catmull-rom-closed":{curve:Do,tension:"alpha",value:.5},"catmull-rom-open":{curve:So,tension:"alpha",value:.5},linear:{curve:ro},"linear-closed":{curve:function(t){return new Bo(t)}},monotone:{horizontal:function(t){return new Po(t)},vertical:function(t){return new Ro(t)}},natural:{curve:function(t){return new qo(t)}},step:{curve:function(t){return new jo(t,.5)}},"step-after":{curve:function(t){return new jo(t,1)}},"step-before":{curve:function(t){return new jo(t,0)}}};function $o(t,n,e){var r=Io.hasOwnProperty(t)&&Io[t],i=null;return r&&(i=r.curve||r[n||"vertical"],r.tension&&null!=e&&(i=i[r.tension](e))),i}var Wo={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},Ho=[/([MLHVCSQTAZmlhvcsqtaz])/g,/###/,/(\d)([-+])/g,/\s|,|###/];function Yo(t){var n,e,r,i,a,u,o,s,l,c,f,h=[];for(s=0,c=(n=t.slice().replace(Ho[0],"###$1").split(Ho[1]).slice(1)).length;s<c;++s){for(r=(e=n[s]).slice(1).trim().replace(Ho[2],"$1###$2").split(Ho[3]),i=[u=e.charAt(0)],l=0,f=r.length;l<f;++l)(a=+r[l])===a&&i.push(a);if(o=Wo[u.toLowerCase()],i.length-1>o)for(l=1,f=i.length;l<f;l+=o)h.push([u].concat(i.slice(l,l+o)));else h.push(i)}return h}var Go=Math.PI/180,Vo=Math.PI/2,Xo=2*Math.PI,Zo=Math.sqrt(3)/2,Jo={},Qo={},Ko=[].join;function ts(t){var n=Ko.call(t);if(Qo[n])return Qo[n];var e=t[0],r=t[1],i=t[2],a=t[3],u=t[4],o=t[5],s=t[6],l=t[7],c=l*u,f=-s*o,h=s*u,d=l*o,p=Math.cos(i),g=Math.sin(i),v=Math.cos(a),m=Math.sin(a),y=.5*(a-i),_=Math.sin(.5*y),x=8/3*_*_/Math.sin(y),b=e+p-x*g,w=r+g+x*p,A=e+v,M=r+m,k=A+x*m,E=M-x*v;return Qo[n]=[c*b+f*w,h*b+d*w,c*k+f*E,h*k+d*E,c*A+f*M,h*A+d*M]}var ns=["l",0,0,0,0,0,0,0];function es(t,n){var e=ns[0]=t[0];if("a"===e||"A"===e)ns[1]=n*t[1],ns[2]=n*t[2],ns[3]=t[3],ns[4]=t[4],ns[5]=t[5],ns[6]=n*t[6],ns[7]=n*t[7];else for(var r=1,i=t.length;r<i;++r)ns[r]=n*t[r];return ns}function rs(t,n,e,r,i){var a,u,o,s,l,c=null,f=0,h=0,d=0,p=0;null==e&&(e=0),null==r&&(r=0),null==i&&(i=1),t.beginPath&&t.beginPath();for(var g=0,v=n.length;g<v;++g){switch(a=n[g],1!==i&&(a=es(a,i)),a[0]){case"l":f+=a[1],h+=a[2],t.lineTo(f+e,h+r);break;case"L":f=a[1],h=a[2],t.lineTo(f+e,h+r);break;case"h":f+=a[1],t.lineTo(f+e,h+r);break;case"H":f=a[1],t.lineTo(f+e,h+r);break;case"v":h+=a[1],t.lineTo(f+e,h+r);break;case"V":h=a[1],t.lineTo(f+e,h+r);break;case"m":f+=a[1],h+=a[2],t.moveTo(f+e,h+r);break;case"M":f=a[1],h=a[2],t.moveTo(f+e,h+r);break;case"c":u=f+a[5],o=h+a[6],d=f+a[3],p=h+a[4],t.bezierCurveTo(f+a[1]+e,h+a[2]+r,d+e,p+r,u+e,o+r),f=u,h=o;break;case"C":f=a[5],h=a[6],d=a[3],p=a[4],t.bezierCurveTo(a[1]+e,a[2]+r,d+e,p+r,f+e,h+r);break;case"s":u=f+a[3],o=h+a[4],d=2*f-d,p=2*h-p,t.bezierCurveTo(d+e,p+r,f+a[1]+e,h+a[2]+r,u+e,o+r),d=f+a[1],p=h+a[2],f=u,h=o;break;case"S":u=a[3],o=a[4],d=2*f-d,p=2*h-p,t.bezierCurveTo(d+e,p+r,a[1]+e,a[2]+r,u+e,o+r),f=u,h=o,d=a[1],p=a[2];break;case"q":u=f+a[3],o=h+a[4],d=f+a[1],p=h+a[2],t.quadraticCurveTo(d+e,p+r,u+e,o+r),f=u,h=o;break;case"Q":u=a[3],o=a[4],t.quadraticCurveTo(a[1]+e,a[2]+r,u+e,o+r),f=u,h=o,d=a[1],p=a[2];break;case"t":u=f+a[1],o=h+a[2],null===c[0].match(/[QqTt]/)?(d=f,p=h):"t"===c[0]?(d=2*f-s,p=2*h-l):"q"===c[0]&&(d=2*f-d,p=2*h-p),s=d,l=p,t.quadraticCurveTo(d+e,p+r,u+e,o+r),h=o,d=(f=u)+a[1],p=h+a[2];break;case"T":u=a[1],o=a[2],d=2*f-d,p=2*h-p,t.quadraticCurveTo(d+e,p+r,u+e,o+r),f=u,h=o;break;case"a":is(t,f+e,h+r,[a[1],a[2],a[3],a[4],a[5],a[6]+f+e,a[7]+h+r]),f+=a[6],h+=a[7];break;case"A":is(t,f+e,h+r,[a[1],a[2],a[3],a[4],a[5],a[6]+e,a[7]+r]),f=a[6],h=a[7];break;case"z":case"Z":t.closePath()}c=a}}function is(t,n,e,r){for(var i=function(t,n,e,r,i,a,u,o,s){var l=Ko.call(arguments);if(Jo[l])return Jo[l];var c=u*Go,f=Math.sin(c),h=Math.cos(c),d=h*(o-t)*.5+f*(s-n)*.5,p=h*(s-n)*.5-f*(o-t)*.5,g=d*d/((e=Math.abs(e))*e)+p*p/((r=Math.abs(r))*r);g>1&&(e*=g=Math.sqrt(g),r*=g);var v=h/e,m=f/e,y=-f/r,_=h/r,x=v*o+m*s,b=y*o+_*s,w=v*t+m*n,A=y*t+_*n,M=1/((w-x)*(w-x)+(A-b)*(A-b))-.25;M<0&&(M=0);var k=Math.sqrt(M);a==i&&(k=-k);var E=.5*(x+w)-k*(A-b),C=.5*(b+A)+k*(w-x),D=Math.atan2(b-C,x-E),F=Math.atan2(A-C,w-E)-D;F<0&&1===a?F+=Xo:F>0&&0===a&&(F-=Xo);for(var S=Math.ceil(Math.abs(F/(Vo+.001))),B=[],N=0;N<S;++N){var O=D+N*F/S,z=D+(N+1)*F/S;B[N]=[E,C,O,z,e,r,f,h]}return Jo[l]=B}(r[5],r[6],r[0],r[1],r[3],r[4],r[2],n,e),a=0;a<i.length;++a){var u=ts(i[a]);t.bezierCurveTo(u[0],u[1],u[2],u[3],u[4],u[5])}}var as={circle:{draw:function(t,n){var e=Math.sqrt(n)/2;t.moveTo(e,0),t.arc(0,0,e,0,Xo)}},cross:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/2.5;t.moveTo(-e,-r),t.lineTo(-e,r),t.lineTo(-r,r),t.lineTo(-r,e),t.lineTo(r,e),t.lineTo(r,r),t.lineTo(e,r),t.lineTo(e,-r),t.lineTo(r,-r),t.lineTo(r,-e),t.lineTo(-r,-e),t.lineTo(-r,-r),t.closePath()}},diamond:{draw:function(t,n){var e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(0,-e),t.lineTo(e,0),t.lineTo(0,e),t.closePath()}},square:{draw:function(t,n){var e=Math.sqrt(n),r=-e/2;t.rect(r,r,e,e)}},arrow:{draw:function(t,n){var e=Math.sqrt(n)/2,r=e/7,i=e/2.5,a=e/8;t.moveTo(-r,e),t.lineTo(r,e),t.lineTo(r,-a),t.lineTo(i,-a),t.lineTo(0,-e),t.lineTo(-i,-a),t.lineTo(-r,-a),t.closePath()}},wedge:{draw:function(t,n){var e=Math.sqrt(n)/2,r=Zo*e,i=r-.5773502691896257*e,a=e/4;t.moveTo(0,-r-i),t.lineTo(-a,r-i),t.lineTo(a,r-i),t.closePath()}},triangle:{draw:function(t,n){var e=Math.sqrt(n)/2,r=Zo*e,i=r-.5773502691896257*e;t.moveTo(0,-r-i),t.lineTo(-e,r-i),t.lineTo(e,r-i),t.closePath()}},"triangle-up":{draw:function(t,n){var e=Math.sqrt(n)/2,r=Zo*e;t.moveTo(0,-r),t.lineTo(-e,r),t.lineTo(e,r),t.closePath()}},"triangle-down":{draw:function(t,n){var e=Math.sqrt(n)/2,r=Zo*e;t.moveTo(0,r),t.lineTo(-e,-r),t.lineTo(e,-r),t.closePath()}},"triangle-right":{draw:function(t,n){var e=Math.sqrt(n)/2,r=Zo*e;t.moveTo(r,0),t.lineTo(-r,-e),t.lineTo(-r,e),t.closePath()}},"triangle-left":{draw:function(t,n){var e=Math.sqrt(n)/2,r=Zo*e;t.moveTo(-r,0),t.lineTo(r,-e),t.lineTo(r,e),t.closePath()}},stroke:{draw:function(t,n){var e=Math.sqrt(n)/2;t.moveTo(-e,0),t.lineTo(e,0)}}};function us(t){return as.hasOwnProperty(t)?as[t]:function(t){if(!os.hasOwnProperty(t)){var n=Yo(t);os[t]={draw:function(t,e){rs(t,n,0,0,Math.sqrt(e)/2)}}}return os[t]}(t)}var os={};function ss(t){return t.x}function ls(t){return t.y}function cs(t){return t.width}function fs(t){return t.height}function hs(t){return function(){return t}}function ds(){var t=ss,n=ls,e=cs,r=fs,i=hs(0),a=null;function u(u,o,s){var l,c=null!=o?o:+t.call(this,u),f=null!=s?s:+n.call(this,u),h=+e.call(this,u),d=+r.call(this,u),p=+i.call(this,u);if(a||(a=l=Ru()),p<=0)a.rect(c,f,h,d);else{var g=c+h,v=f+d;a.moveTo(c+p,f),a.lineTo(g-p,f),a.quadraticCurveTo(g,f,g,f+p),a.lineTo(g,v-p),a.quadraticCurveTo(g,v,g-p,v),a.lineTo(c+p,v),a.quadraticCurveTo(c,v,c,v-p),a.lineTo(c,f+p),a.quadraticCurveTo(c,f,c+p,f),a.closePath()}if(l)return a=null,l+""||null}return u.x=function(n){return arguments.length?(t="function"==typeof n?n:hs(+n),u):t},u.y=function(t){return arguments.length?(n="function"==typeof t?t:hs(+t),u):n},u.width=function(t){return arguments.length?(e="function"==typeof t?t:hs(+t),u):e},u.height=function(t){return arguments.length?(r="function"==typeof t?t:hs(+t),u):r},u.cornerRadius=function(t){return arguments.length?(i="function"==typeof t?t:hs(+t),u):i},u.context=function(t){return arguments.length?(a=null==t?null:t,u):a},u}function ps(){var t,n,e,r,i,a,u,o,s=null;function l(t,n,e){var r=e/2;if(i){var l=u-n,c=t-a;if(l||c){var f=Math.sqrt(l*l+c*c),h=(l/=f)*o,d=(c/=f)*o,p=Math.atan2(c,l);s.moveTo(a-h,u-d),s.lineTo(t-l*r,n-c*r),s.arc(t,n,r,p-Math.PI,p),s.lineTo(a+h,u+d),s.arc(a,u,o,p,p+Math.PI)}else s.arc(t,n,r,0,Xo);s.closePath()}else i=1;a=t,u=n,o=r}function c(a){var u,o,c,f=a.length,h=!1;for(null==s&&(s=c=Ru()),u=0;u<=f;++u)!(u<f&&r(o=a[u],u,a))===h&&(h=!h)&&(i=0),h&&l(+t(o,u,a),+n(o,u,a),+e(o,u,a));if(c)return s=null,c+""||null}return c.x=function(n){return arguments.length?(t=n,c):t},c.y=function(t){return arguments.length?(n=t,c):n},c.size=function(t){return arguments.length?(e=t,c):e},c.defined=function(t){return arguments.length?(r=t,c):r},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c}function gs(t){return t.x||0}function vs(t){return t.y||0}function ms(t){return t.cornerRadius||0}function ys(t){return!(!1===t.defined)}var _s=function(){var t=Zu,n=Ju,e=Pu(0),r=null,i=Qu,a=Ku,u=to,o=null;function s(){var s,l,c,f=+t.apply(this,arguments),h=+n.apply(this,arguments),d=i.apply(this,arguments)-Gu,p=a.apply(this,arguments)-Gu,g=Lu(p-d),v=p>d;if(o||(o=s=Ru()),h<f&&(l=h,h=f,f=l),h>Hu)if(g>Vu-Hu)o.moveTo(h*Uu(d),h*$u(d)),o.arc(0,0,h,d,p,!v),f>Hu&&(o.moveTo(f*Uu(p),f*$u(p)),o.arc(0,0,f,p,d,v));else{var m,y,_=d,x=p,b=d,w=p,A=g,M=g,k=u.apply(this,arguments)/2,E=k>Hu&&(r?+r.apply(this,arguments):Wu(f*f+h*h)),C=Iu(Lu(h-f)/2,+e.apply(this,arguments)),D=C,F=C;if(E>Hu){var S=Xu(E/f*$u(k)),B=Xu(E/h*$u(k));(A-=2*S)>Hu?(b+=S*=v?1:-1,w-=S):(A=0,b=w=(d+p)/2),(M-=2*B)>Hu?(_+=B*=v?1:-1,x-=B):(M=0,_=x=(d+p)/2)}var N=h*Uu(_),O=h*$u(_),z=f*Uu(w),T=f*$u(w);if(C>Hu){var R,P=h*Uu(x),L=h*$u(x),q=f*Uu(b),U=f*$u(b);if(g<Yu&&(R=function(t,n,e,r,i,a,u,o){var s=e-t,l=r-n,c=u-i,f=o-a,h=f*s-c*l;if(!(h*h<Hu))return[t+(h=(c*(n-a)-f*(t-i))/h)*s,n+h*l]}(N,O,q,U,P,L,z,T))){var j=N-R[0],I=O-R[1],$=P-R[0],W=L-R[1],H=1/$u(((c=(j*$+I*W)/(Wu(j*j+I*I)*Wu($*$+W*W)))>1?0:c<-1?Yu:Math.acos(c))/2),Y=Wu(R[0]*R[0]+R[1]*R[1]);D=Iu(C,(f-Y)/(H-1)),F=Iu(C,(h-Y)/(H+1))}}M>Hu?F>Hu?(m=no(q,U,N,O,h,F,v),y=no(P,L,z,T,h,F,v),o.moveTo(m.cx+m.x01,m.cy+m.y01),F<C?o.arc(m.cx,m.cy,F,qu(m.y01,m.x01),qu(y.y01,y.x01),!v):(o.arc(m.cx,m.cy,F,qu(m.y01,m.x01),qu(m.y11,m.x11),!v),o.arc(0,0,h,qu(m.cy+m.y11,m.cx+m.x11),qu(y.cy+y.y11,y.cx+y.x11),!v),o.arc(y.cx,y.cy,F,qu(y.y11,y.x11),qu(y.y01,y.x01),!v))):(o.moveTo(N,O),o.arc(0,0,h,_,x,!v)):o.moveTo(N,O),f>Hu&&A>Hu?D>Hu?(m=no(z,T,P,L,f,-D,v),y=no(N,O,q,U,f,-D,v),o.lineTo(m.cx+m.x01,m.cy+m.y01),D<C?o.arc(m.cx,m.cy,D,qu(m.y01,m.x01),qu(y.y01,y.x01),!v):(o.arc(m.cx,m.cy,D,qu(m.y01,m.x01),qu(m.y11,m.x11),!v),o.arc(0,0,f,qu(m.cy+m.y11,m.cx+m.x11),qu(y.cy+y.y11,y.cx+y.x11),v),o.arc(y.cx,y.cy,D,qu(y.y11,y.x11),qu(y.y01,y.x01),!v))):o.arc(0,0,f,w,b,v):o.lineTo(z,T)}else o.moveTo(0,0);if(o.closePath(),s)return o=null,s+""||null}return s.centroid=function(){var e=(+t.apply(this,arguments)+ +n.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-Yu/2;return[Uu(r)*e,$u(r)*e]},s.innerRadius=function(n){return arguments.length?(t="function"==typeof n?n:Pu(+n),s):t},s.outerRadius=function(t){return arguments.length?(n="function"==typeof t?t:Pu(+t),s):n},s.cornerRadius=function(t){return arguments.length?(e="function"==typeof t?t:Pu(+t),s):e},s.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:Pu(+t),s):r},s.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:Pu(+t),s):i},s.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:Pu(+t),s):a},s.padAngle=function(t){return arguments.length?(u="function"==typeof t?t:Pu(+t),s):u},s.context=function(t){return arguments.length?(o=null==t?null:t,s):o},s}().startAngle(function(t){return t.startAngle||0}).endAngle(function(t){return t.endAngle||0}).padAngle(function(t){return t.padAngle||0}).innerRadius(function(t){return t.innerRadius||0}).outerRadius(function(t){return t.outerRadius||0}).cornerRadius(ms),xs=oo().x(gs).y1(vs).y0(function(t){return(t.y||0)+(t.height||0)}).defined(ys),bs=oo().y(vs).x1(gs).x0(function(t){return(t.x||0)+(t.width||0)}).defined(ys),ws=uo().x(gs).y(vs).defined(ys),As=ds().x(gs).y(vs).width(function(t){return t.width||0}).height(function(t){return t.height||0}).cornerRadius(ms),Ms=function(){var t=Pu(so),n=Pu(64),e=null;function r(){var r;if(e||(e=r=Ru()),t.apply(this,arguments).draw(e,+n.apply(this,arguments)),r)return e=null,r+""||null}return r.type=function(n){return arguments.length?(t="function"==typeof n?n:Pu(n),r):t},r.size=function(t){return arguments.length?(n="function"==typeof t?t:Pu(+t),r):n},r.context=function(t){return arguments.length?(e=null==t?null:t,r):e},r}().type(function(t){return us(t.shape||"circle")}).size(function(t){return null==t.size?64:t.size}),ks=ps().x(gs).y(vs).defined(ys).size(function(t){return t.size||1});function Es(t,n,e,r){return As.context(t)(n,e,r)}function Cs(t,n){return n.stroke&&0!==n.opacity&&0!==n.strokeOpacity&&t.expand(null!=n.strokeWidth?+n.strokeWidth:1),t}var Ds,Fs=Xo-1e-8;function Ss(t){return Ds=t,Ss}function Bs(){}function Ns(t,n){Ds.add(t,n)}Ss.beginPath=Bs,Ss.closePath=Bs,Ss.moveTo=Ns,Ss.lineTo=Ns,Ss.rect=function(t,n,e,r){Ns(t,n),Ns(t+e,n+r)},Ss.quadraticCurveTo=function(t,n,e,r){Ns(t,n),Ns(e,r)},Ss.bezierCurveTo=function(t,n,e,r,i,a){Ns(t,n),Ns(e,r),Ns(i,a)},Ss.arc=function(t,n,e,r,i,a){if(Math.abs(i-r)>Fs)return Ns(t-e,n-e),void Ns(t+e,n+e);var u,o,s,l,c=1/0,f=-1/0,h=1/0,d=-1/0;function p(t){s=e*Math.cos(t),l=e*Math.sin(t),s<c&&(c=s),s>f&&(f=s),l<h&&(h=l),l>d&&(d=l)}if(p(r),p(i),i!==r)if((r%=Xo)<0&&(r+=Xo),(i%=Xo)<0&&(i+=Xo),i<r&&(a=!a,u=r,r=i,i=u),a)for(i-=Xo,u=r-r%Vo,o=0;o<4&&u>i;++o,u-=Vo)p(u);else for(u=r-r%Vo+Vo,o=0;o<4&&u<i;++o,u+=Vo)p(u);Ns(t+c,n+h),Ns(t+f,n+d)};var Os=(Os=Eu(1,1))?Os.getContext("2d"):null;const zs=new xu;function Ts(t){return function(n,e){if(!Os)return!0;t(Os,n),zs.clear().union(n.bounds).intersect(e).round();const{x1:r,y1:i,x2:a,y2:u}=zs;for(let t=i;t<=u;++t)for(let n=r;n<=a;++n)if(Os.isPointInPath(n,t))return!0;return!1}}function Rs(t,n){return n.contains(t.x||0,t.y||0)}function Ps(t,n){const e=t.x||0,r=t.y||0,i=t.width||0,a=t.height||0;return n.intersects(zs.set(e,r,e+i,r+a))}function Ls(t,n){const e=t.x||0,r=t.y||0;return qs(n,e,r,null!=t.x2?t.x2:e,null!=t.y2?t.y2:r)}function qs(t,n,e,r,i){const{x1:a,y1:u,x2:o,y2:s}=t,l=r-n,c=i-e;let f,h,d,p,g=0,v=1;for(p=0;p<4;++p){if(0===p&&(f=-l,h=-(a-n)),1===p&&(f=l,h=o-n),2===p&&(f=-c,h=-(u-e)),3===p&&(f=c,h=s-e),Math.abs(f)<1e-10&&h<0)return!1;if(d=h/f,f<0){if(d>v)return!1;d>g&&(g=d)}else if(f>0){if(d<g)return!1;d<v&&(v=d)}}return!0}function Us(t,n,e){return e.id?function(t,n,e){for(var r=e.width(),i=e.height(),a=e.x1+n.x1*r,u=e.y1+n.y1*i,o=e.x1+n.x2*r,s=e.y1+n.y2*i,l=n.stops,c=0,f=l.length,h=t.createLinearGradient(a,u,o,s);c<f;++c)h.addColorStop(l[c].offset,l[c].color);return h}(t,e,n.bounds):e}function js(t,n,e){return(e*=null==n.fillOpacity?1:n.fillOpacity)>0&&(t.globalAlpha=e,t.fillStyle=Us(t,n,n.fill),!0)}var Is=[];function $s(t,n,e){var r=null!=(r=n.strokeWidth)?r:1;return!(r<=0)&&((e*=null==n.strokeOpacity?1:n.strokeOpacity)>0&&(t.globalAlpha=e,t.strokeStyle=Us(t,n,n.stroke),t.lineWidth=r,t.lineCap=n.strokeCap||"butt",t.lineJoin=n.strokeJoin||"miter",t.miterLimit=n.strokeMiterLimit||10,t.setLineDash&&(t.setLineDash(n.strokeDash||Is),t.lineDashOffset=n.strokeDashOffset||0),!0))}function Ws(t,n){return t.zindex-n.zindex||t.index-n.index}function Hs(t){if(!t.zdirty)return t.zitems;var n,e,r,i=t.items,a=[];for(e=0,r=i.length;e<r;++e)(n=i[e]).index=e,n.zindex&&a.push(n);return t.zdirty=!1,t.zitems=a.sort(Ws)}function Ys(t,n){var e,r,i=t.items;if(i&&i.length){var a=Hs(t);if(a&&a.length){for(e=0,r=i.length;e<r;++e)i[e].zindex||n(i[e]);i=a}for(e=0,r=i.length;e<r;++e)n(i[e])}}function Gs(t,n){var e,r,i=t.items;if(!i||!i.length)return null;var a=Hs(t);for(a&&a.length&&(i=a),r=i.length;--r>=0;)if(e=n(i[r]))return e;if(i===a)for(r=(i=t.items).length;--r>=0;)if(!i[r].zindex&&(e=n(i[r])))return e;return null}function Vs(t){return function(n,e,r){Ys(e,function(e){r&&!r.intersects(e.bounds)||Xs(t,n,e,e)})}}function Xs(t,n,e,r){var i=null==e.opacity?1:e.opacity;0!==i&&(t(n,r)||(e.fill&&js(n,e,i)&&n.fill(),e.stroke&&$s(n,e,i)&&n.stroke()))}function Zs(t){return t=t||v,function(n,e,r,i,a,u){return r*=n.pixelRatio,i*=n.pixelRatio,Gs(e,function(e){var o=e.bounds;if((!o||o.contains(a,u))&&o)return t(n,e,r,i,a,u)?e:void 0})}}function Js(t,n){return function(e,r,i,a){var u,o,s=Array.isArray(r)?r[0]:r,l=null==n?s.fill:n,c=s.stroke&&e.isPointInStroke;return c&&(u=s.strokeWidth,o=s.strokeCap,e.lineWidth=null!=u?u:1,e.lineCap=null!=o?o:"butt"),!t(e,r)&&(l&&e.isPointInPath(i,a)||c&&e.isPointInStroke(i,a))}}function Qs(t){return Zs(Js(t))}function Ks(t,n){return"translate("+t+","+n+")"}function tl(t){return"rotate("+t+")"}function nl(t){return Ks(t.x||0,t.y||0)}function el(t,n,e){function r(t,e){var r=e.x||0,i=e.y||0,a=e.angle||0;t.translate(r,i),a&&t.rotate(a*=Go),t.beginPath(),n(t,e),a&&t.rotate(-a),t.translate(-r,-i)}return{type:t,tag:"path",nested:!1,attr:function(t,e){t("transform",function(t){return Ks(t.x||0,t.y||0)+(t.angle?" "+tl(t.angle):"")}(e)),t("d",n(null,e))},bound:function(t,e){var r=e.x||0,i=e.y||0;return n(Ss(t),e),Cs(t,e).translate(r,i),e.angle&&t.rotate(e.angle*Go,r,i),t},draw:Vs(r),pick:Qs(r),isect:e||Ts(r)}}var rl=el("arc",function(t,n){return _s.context(t)(n)});function il(t,n,e){function r(t,e){t.beginPath(),n(t,e)}var i,a=Js(r);return{type:t,tag:"path",nested:!0,attr:function(t,e){var r=e.mark.items;r.length&&t("d",n(null,r))},bound:function(t,e){var r=e.items;return 0===r.length?t:(n(Ss(t),r),Cs(t,r[0]))},draw:(i=r,function(t,n,e){!n.items.length||e&&!e.intersects(n.bounds)||Xs(i,t,n.items[0],n.items)}),pick:function(t,n,e,r,i,u){var o=n.items,s=n.bounds;return!o||!o.length||s&&!s.contains(i,u)?null:(e*=t.pixelRatio,r*=t.pixelRatio,a(t,o,e,r)?o[0]:null)},isect:Rs,tip:e}}var al=il("area",function(t,n){var e=n[0],r=e.interpolate||"linear";return("horizontal"===e.orient?bs:xs).curve($o(r,e.orient,e.tension)).context(t)(n)},function(t,n){for(var e,r,i="horizontal"===t[0].orient?n[1]:n[0],a="horizontal"===t[0].orient?"y":"x",u=t.length,o=1/0;--u>=0;)!1!==t[u].defined&&(r=Math.abs(t[u][a]-i))<o&&(o=r,e=t[u]);return e}),ul=1;function ol(t,n,e){var r=n.clip,i=t._defs,a=n.clip_id||(n.clip_id="clip"+ul++),u=i.clipping[a]||(i.clipping[a]={id:a});return Y(r)?u.path=r(null):(u.width=e.width||0,u.height=e.height||0),"url(#"+a+")"}var sl=.5;function ll(t,n){var e=n.stroke?sl:0;t.beginPath(),Es(t,n,e,e)}var cl=Js(ll);var fl={type:"group",tag:"g",nested:!1,attr:function(t,n){t("transform",nl(n))},bound:function(t,n){if(!n.clip&&n.items)for(var e=n.items,r=0,i=e.length;r<i;++r)t.union(e[r].bounds);return(n.clip||n.width||n.height)&&!n.noBound&&t.add(0,0).add(n.width||0,n.height||0),Cs(t,n),t.translate(n.x||0,n.y||0)},draw:function(t,n,e){var r=this;Ys(n,function(n){var i,a=n.x||0,u=n.y||0,o=n.width||0,s=n.height||0;t.save(),t.translate(a,u),(n.stroke||n.fill)&&(i=null==n.opacity?1:n.opacity)>0&&(ll(t,n),n.fill&&js(t,n,i)&&t.fill(),n.stroke&&$s(t,n,i)&&t.stroke()),n.clip&&(t.beginPath(),t.rect(0,0,o,s),t.clip()),e&&e.translate(-a,-u),Ys(n,function(n){r.draw(t,n,e)}),e&&e.translate(a,u),t.restore()})},pick:function(t,n,e,r,i,a){if(n.bounds&&!n.bounds.contains(i,a)||!n.items)return null;var u=this,o=e*t.pixelRatio,s=r*t.pixelRatio;return Gs(n,function(l){var c,f,h,d;if(!(d=l.bounds)||d.contains(i,a))return f=l.x||0,h=l.y||0,t.save(),t.translate(f,h),f=i-f,h=a-h,!(c=Gs(l,function(t){return function(t,n,e){return(!1!==t.interactive||"group"===t.marktype)&&t.bounds&&t.bounds.contains(n,e)}(t,f,h)?u.pick(t,e,r,f,h):null}))&&!1!==n.interactive&&(l.fill||l.stroke)&&cl(t,l,o,s)&&(c=l),t.restore(),c||null})},isect:Ps,background:function(t,n){var e=n.stroke?sl:0;t("class","background"),t("d",Es(null,n,e,e))},foreground:function(t,n,e){t("clip-path",n.clip?ol(e,n,n):null)}};function hl(t,n){var e=t.image;return e&&e.url===t.url||(e={loaded:!1,width:0,height:0},n.loadImage(t.url).then(function(n){t.image=n,t.image.url=t.url})),e}function dl(t,n){return"center"===t?n/2:"right"===t?n:0}function pl(t,n){return"middle"===t?n/2:"bottom"===t?n:0}var gl={type:"image",tag:"image",nested:!1,attr:function(t,n,e){var r=hl(n,e),i=n.x||0,a=n.y||0,u=(null!=n.width?n.width:r.width)||0,o=(null!=n.height?n.height:r.height)||0,s=!1===n.aspect?"none":"xMidYMid";i-=dl(n.align,u),a-=pl(n.baseline,o),t("href",r.src||"","http://www.w3.org/1999/xlink","xlink:href"),t("transform",Ks(i,a)),t("width",u),t("height",o),t("preserveAspectRatio",s)},bound:function(t,n){var e=n.image,r=n.x||0,i=n.y||0,a=(null!=n.width?n.width:e&&e.width)||0,u=(null!=n.height?n.height:e&&e.height)||0;return r-=dl(n.align,a),i-=pl(n.baseline,u),t.set(r,i,r+a,i+u)},draw:function(t,n,e){var r=this;Ys(n,function(n){if(!e||e.intersects(n.bounds)){var i,a,u,o,s=hl(n,r),l=n.x||0,c=n.y||0,f=(null!=n.width?n.width:s.width)||0,h=(null!=n.height?n.height:s.height)||0;l-=dl(n.align,f),c-=pl(n.baseline,h),!1!==n.aspect&&(a=s.width/s.height,u=n.width/n.height,a==a&&u==u&&a!==u&&(u<a?(c+=(h-(o=f/a))/2,h=o):(l+=(f-(o=h*a))/2,f=o))),s.loaded&&(t.globalAlpha=null!=(i=n.opacity)?i:1,t.drawImage(s,l,c,f,h))}})},pick:Zs(),isect:v,get:hl,xOffset:dl,yOffset:pl},vl=il("line",function(t,n){var e=n[0],r=e.interpolate||"linear";return ws.curve($o(r,e.orient,e.tension)).context(t)(n)},function(t,n){for(var e,r,i=Math.pow(t[0].strokeWidth||1,2),a=t.length;--a>=0;)if(!1!==t[a].defined&&(e=t[a].x-n[0])*e+(r=t[a].y-n[1])*r<i)return t[a];return null});function ml(t,n){var e=n.path;if(null==e)return!0;var r=n.pathCache;r&&r.path===e||((n.pathCache=r=Yo(e)).path=e),rs(t,r,n.x,n.y)}var yl={type:"path",tag:"path",nested:!1,attr:function(t,n){t("transform",nl(n)),t("d",n.path)},bound:function(t,n){return ml(Ss(t),n)?t.set(0,0,0,0):Cs(t,n)},draw:Vs(ml),pick:Qs(ml),isect:Ts(ml)};function _l(t,n){t.beginPath(),Es(t,n)}var xl={type:"rect",tag:"path",nested:!1,attr:function(t,n){t("d",Es(null,n))},bound:function(t,n){var e,r;return Cs(t.set(e=n.x||0,r=n.y||0,e+n.width||0,r+n.height||0),n)},draw:Vs(_l),pick:Qs(_l),isect:Ps};function bl(t,n,e){var r,i,a,u;return!(!n.stroke||!$s(t,n,e))&&(r=n.x||0,i=n.y||0,a=null!=n.x2?n.x2:r,u=null!=n.y2?n.y2:i,t.beginPath(),t.moveTo(r,i),t.lineTo(a,u),!0)}var wl,Al={type:"rule",tag:"line",nested:!1,attr:function(t,n){t("transform",nl(n)),t("x2",null!=n.x2?n.x2-(n.x||0):0),t("y2",null!=n.y2?n.y2-(n.y||0):0)},bound:function(t,n){var e,r;return Cs(t.set(e=n.x||0,r=n.y||0,null!=n.x2?n.x2:e,null!=n.y2?n.y2:r),n)},draw:function(t,n,e){Ys(n,function(n){if(!e||e.intersects(n.bounds)){var r=null==n.opacity?1:n.opacity;r&&bl(t,n,r)&&t.stroke()}})},pick:Zs(function(t,n,e,r){return!!t.isPointInStroke&&bl(t,n,1)&&t.isPointInStroke(e,r)}),isect:Ls},Ml=el("shape",function(t,n){return(n.mark.shape||n.shape).context(t)(n)}),kl=el("symbol",function(t,n){return Ms.context(t)(n)},Rs),El={height:Bl,measureWidth:Fl,estimateWidth:Cl,width:Cl,canvas:Nl};function Cl(t){return wl=Bl(t),Dl(Ol(t))}function Dl(t){return~~(.8*t.length*wl)}function Fl(t){return Bl(t)<=0?0:(Os.font=Tl(t),Sl(Ol(t)))}function Sl(t){return Os.measureText(t).width}function Bl(t){return null!=t.fontSize?t.fontSize:11}function Nl(t){El.width=t&&Os?Fl:Cl}function Ol(t){var n=t.text;return null==n?"":t.limit>0?function(t){var n,e=+t.limit,r=t.text+"";El.width===Fl?(Os.font=Tl(t),n=Sl):(wl=Bl(t),n=Dl);if(n(r)<e)return r;var i,a=t.ellipsis||"…",u="rtl"===t.dir,o=0,s=r.length;if(e-=n(a),u){for(;o<s;)i=o+s>>>1,n(r.slice(i))>e?o=i+1:s=i;return a+r.slice(o)}for(;o<s;)i=1+(o+s>>>1),n(r.slice(0,i))<e?o=i:s=i-1;return r.slice(0,o)+a}(t):n+""}function zl(t,n){var e=t.font;return(n&&e?String(e).replace(/"/g,"'"):e)||"sans-serif"}function Tl(t,n){return(t.fontStyle?t.fontStyle+" ":"")+(t.fontVariant?t.fontVariant+" ":"")+(t.fontWeight?t.fontWeight+" ":"")+Bl(t)+"px "+zl(t,n)}function Rl(t){var n=t.baseline,e=Bl(t);return Math.round("top"===n?.79*e:"middle"===n?.3*e:"bottom"===n?-.21*e:0)}Nl(!0);var Pl={left:"start",center:"middle",right:"end"},Ll=new xu;function ql(t){var n,e=t.x||0,r=t.y||0,i=t.radius||0;return i&&(n=(t.theta||0)-Vo,e+=i*Math.cos(n),r+=i*Math.sin(n)),Ll.x1=e,Ll.y1=r,Ll}function Ul(t,n,e){var r,i=El.height(n),a=n.align,u=ql(n),o=u.x1,s=u.y1,l=n.dx||0,c=(n.dy||0)+Rl(n)-Math.round(.8*i);if(r=El.width(n),"center"===a?l-=r/2:"right"===a&&(l-=r),t.set(l+=o,c+=s,l+r,c+i),n.angle&&!e)t.rotate(n.angle*Go,o,s);else if(2===e)return t.rotatedPoints(n.angle*Go,o,s);return t.expand(e||!r?0:1)}var jl={arc:rl,area:al,group:fl,image:gl,line:vl,path:yl,rect:xl,rule:Al,shape:Ml,symbol:kl,text:{type:"text",tag:"text",nested:!1,attr:function(t,n){var e,r=n.dx||0,i=(n.dy||0)+Rl(n),a=ql(n),u=a.x1,o=a.y1,s=n.angle||0;t("text-anchor",Pl[n.align]||"start"),s?(e=Ks(u,o)+" "+tl(s),(r||i)&&(e+=" "+Ks(r,i))):e=Ks(u+r,o+i),t("transform",e)},bound:Ul,draw:function(t,n,e){Ys(n,function(n){var r,i,a,u,o;e&&!e.intersects(n.bounds)||(o=Ol(n))&&(0===(r=null==n.opacity?1:n.opacity)||n.fontSize<=0||(t.font=Tl(n),t.textAlign=n.align||"left",a=(i=ql(n)).x1,u=i.y1,n.angle&&(t.save(),t.translate(a,u),t.rotate(n.angle*Go),a=u=0),a+=n.dx||0,u+=(n.dy||0)+Rl(n),n.fill&&js(t,n,r)&&t.fillText(o,a,u),n.stroke&&$s(t,n,r)&&t.strokeText(o,a,u),n.angle&&t.restore()))})},pick:Zs(function(t,n,e,r,i,a){if(n.fontSize<=0)return!1;if(!n.angle)return!0;var u=ql(n),o=u.x1,s=u.y1,l=Ul(Ll,n,1),c=-n.angle*Go,f=Math.cos(c),h=Math.sin(c),d=f*i-h*a+(o-f*o+h*s),p=h*i+f*a+(s-h*o-f*s);return l.contains(d,p)}),isect:function(t,n){var e=Ul(Ll,t,2);return qs(n,e[0],e[1],e[2],e[3])||qs(n,e[0],e[1],e[4],e[5])||qs(n,e[4],e[5],e[6],e[7])||qs(n,e[2],e[3],e[6],e[7])}},trail:il("trail",function(t,n){return ks.context(t)(n)},function(t,n){for(var e,r,i=t.length;--i>=0;)if(!1!==t[i].defined&&(e=t[i].x-n[0])*e+(r=t[i].y-n[1])*r<(e=t[i].size||1)*e)return t[i];return null})};function Il(t,n,e){var r=jl[t.mark.marktype],i=n||r.bound;return r.nested&&(t=t.mark),i(t.bounds||(t.bounds=new xu),t,e)}var $l={mark:null};function Wl(t,n,e){var r,i,a,u,o=jl[t.marktype],s=o.bound,l=t.items,c=l&&l.length;if(o.nested)return c?a=l[0]:($l.mark=t,a=$l),u=Il(a,s,e),n=n&&n.union(u)||u;if(n=n||t.bounds&&t.bounds.clear()||new xu,c)for(r=0,i=l.length;r<i;++r)n.union(Il(l[r],s,e));return t.bounds=n}var Hl=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","interpolate","tension","orient","defined","url","path","x2","y2","size","shape","text","angle","theta","radius","dx","dy","font","fontSize","fontWeight","fontStyle","fontVariant"];function Yl(t,n){return JSON.stringify(t,Hl,n)}function Gl(t){return function t(n){var e,r,i,a=n.marktype,u=n.items;if(u)for(r=0,i=u.length;r<i;++r)e=a?"mark":"group",u[r][e]=n,u[r].zindex&&(u[r][e].zdirty=!0),"group"===(a||e)&&t(u[r]);a&&Wl(n);return n}("string"==typeof t?JSON.parse(t):t)}function Vl(t){arguments.length?this.root=Gl(t):(this.root=Zl({marktype:"group",name:"root",role:"frame"}),this.root.items=[new ku(this.root)])}var Xl=Vl.prototype;function Zl(t,n){return{bounds:new xu,clip:!!t.clip,group:n,interactive:!1!==t.interactive,items:[],marktype:t.marktype,name:t.name||void 0,role:t.role||void 0,zindex:t.zindex||0}}function Jl(t,n,e){return!t&&"undefined"!=typeof document&&document.createElement&&(t=document),t?e?t.createElementNS(e,n):t.createElement(n):null}function Ql(t,n){n=n.toLowerCase();for(var e=t.childNodes,r=0,i=e.length;r<i;++r)if(e[r].tagName.toLowerCase()===n)return e[r]}function Kl(t,n,e,r){var i,a=t.childNodes[n];return a&&a.tagName.toLowerCase()===e.toLowerCase()||(i=a||null,a=Jl(t.ownerDocument,e,r),t.insertBefore(a,i)),a}function tc(t,n){for(var e=t.childNodes,r=e.length;r>n;)t.removeChild(e[--r]);return t}function nc(t){return"mark-"+t.marktype+(t.role?" role-"+t.role:"")+(t.name?" "+t.name:"")}function ec(t,n){var e=n.getBoundingClientRect();return[t.clientX-e.left-(n.clientLeft||0),t.clientY-e.top-(n.clientTop||0)]}function rc(t,n){this._active=null,this._handlers={},this._loader=t||xr(),this._tooltip=n||ic}function ic(t,n,e,r){t.element().setAttribute("title",r||"")}Xl.toJSON=function(t){return Yl(this.root,t||0)},Xl.mark=function(t,n,e){var r=Zl(t,n=n||this.root.items[0]);return n.items[e]=r,r.zindex&&(r.group.zdirty=!0),r};var ac=rc.prototype;function uc(t){this._el=null,this._bgcolor=null,this._loader=new Du(t)}ac.initialize=function(t,n,e){return this._el=t,this._obj=e||null,this.origin(n)},ac.element=function(){return this._el},ac.canvas=function(){return this._el&&this._el.firstChild},ac.origin=function(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()},ac.scene=function(t){return arguments.length?(this._scene=t,this):this._scene},ac.on=function(){},ac.off=function(){},ac._handlerIndex=function(t,n,e){for(var r=t?t.length:0;--r>=0;)if(t[r].type===n&&(!e||t[r].handler===e))return r;return-1},ac.handlers=function(t){var n,e=this._handlers,r=[];if(t)r.push.apply(r,e[this.eventName(t)]);else for(n in e)r.push.apply(r,e[n]);return r},ac.eventName=function(t){var n=t.indexOf(".");return n<0?t:t.slice(0,n)},ac.handleHref=function(t,n,e){this._loader.sanitize(e,{context:"href"}).then(function(n){var e=new MouseEvent(t.type,t),r=Jl(null,"a");for(var i in n)r.setAttribute(i,n[i]);r.dispatchEvent(e)}).catch(function(){})},ac.handleTooltip=function(t,n,e){if(n&&null!=n.tooltip){n=function(t,n,e,r){var i,a,u=t&&t.mark;if(u&&(i=jl[u.marktype]).tip){for((a=ec(n,e))[0]-=r[0],a[1]-=r[1];t=t.mark.group;)a[0]-=t.x||0,a[1]-=t.y||0;t=i.tip(u.items,a)}return t}(n,t,this.canvas(),this._origin);var r=e&&n&&n.tooltip||null;this._tooltip.call(this._obj,this,t,n,r)}},ac.getItemBoundingClientRect=function(t){if(n=this.canvas()){for(var n,e=n.getBoundingClientRect(),r=this._origin,i=t.bounds,a=i.x1+r[0]+e.left,u=i.y1+r[1]+e.top,o=i.width(),s=i.height();t.mark&&(t=t.mark.group);)a+=t.x||0,u+=t.y||0;return{x:a,y:u,width:o,height:s,left:a,top:u,right:a+o,bottom:u+s}}};var oc=uc.prototype;oc.initialize=function(t,n,e,r,i){return this._el=t,this.resize(n,e,r,i)},oc.element=function(){return this._el},oc.canvas=function(){return this._el&&this._el.firstChild},oc.background=function(t){return 0===arguments.length?this._bgcolor:(this._bgcolor=t,this)},oc.resize=function(t,n,e,r){return this._width=t,this._height=n,this._origin=e||[0,0],this._scale=r||1,this},oc.dirty=function(){},oc.render=function(t){var n=this;return n._call=function(){n._render(t)},n._call(),n._call=null,n},oc._render=function(){},oc.renderAsync=function(t){var n=this.render(t);return this._ready?this._ready.then(function(){return n}):Promise.resolve(n)},oc._load=function(t,n){var e=this,r=e._loader[t](n);if(!e._ready){var i=e._call;e._ready=e._loader.ready().then(function(t){t&&i(),e._ready=null})}return r},oc.sanitizeURL=function(t){return this._load("sanitizeURL",t)},oc.loadImage=function(t){return this._load("loadImage",t)};var sc="mouseout";function lc(t,n){rc.call(this,t,n),this._down=null,this._touch=null,this._first=!0}var cc=et(lc,rc);function fc(t,n,e){return function(r){var i=this._active,a=this.pickEvent(r);a===i?this.fire(t,r):(i&&i.exit||this.fire(e,r),this._active=a,this.fire(n,r),this.fire(t,r))}}function hc(t){return function(n){this.fire(t,n),this._active=null}}cc.initialize=function(t,n,e){var r=this._canvas=t&&Ql(t,"canvas");if(r){var i=this;this.events.forEach(function(t){r.addEventListener(t,function(n){cc[t]?cc[t].call(i,n):i.fire(t,n)})})}return rc.prototype.initialize.call(this,t,n,e)},cc.canvas=function(){return this._canvas},cc.context=function(){return this._canvas.getContext("2d")},cc.events=["keydown","keypress","keyup","dragenter","dragleave","dragover","mousedown","mouseup","mousemove","mouseout","mouseover","click","dblclick","wheel","mousewheel","touchstart","touchmove","touchend"],cc.DOMMouseScroll=function(t){this.fire("mousewheel",t)},cc.mousemove=fc("mousemove","mouseover","mouseout"),cc.dragover=fc("dragover","dragenter","dragleave"),cc.mouseout=hc("mouseout"),cc.dragleave=hc("dragleave"),cc.mousedown=function(t){this._down=this._active,this.fire("mousedown",t)},cc.click=function(t){this._down===this._active&&(this.fire("click",t),this._down=null)},cc.touchstart=function(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire("touchstart",t,!0)},cc.touchmove=function(t){this.fire("touchmove",t,!0)},cc.touchend=function(t){this.fire("touchend",t,!0),this._touch=null},cc.fire=function(t,n,e){var r,i,a=e?this._touch:this._active,u=this._handlers[t];if(n.vegaType=t,"click"===t&&a&&a.href?this.handleHref(n,a,a.href):"mousemove"!==t&&t!==sc||this.handleTooltip(n,a,t!==sc),u)for(r=0,i=u.length;r<i;++r)u[r].handler.call(this._obj,n,a)},cc.on=function(t,n){var e=this.eventName(t),r=this._handlers;return this._handlerIndex(r[e],t,n)<0&&(r[e]||(r[e]=[])).push({type:t,handler:n}),this},cc.off=function(t,n){var e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&r.splice(i,1),this},cc.pickEvent=function(t){var n=ec(t,this._canvas),e=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-e[0],n[1]-e[1])},cc.pick=function(t,n,e,r,i){var a=this.context();return jl[t.marktype].pick.call(this,a,t,n,e,r,i)};var dc="undefined"!=typeof window&&window.devicePixelRatio||1;function pc(t){uc.call(this,t),this._redraw=!1,this._dirty=new xu}var gc=et(pc,uc),vc=uc.prototype,mc=new xu;function yc(t,n){rc.call(this,t,n);var e=this;e._hrefHandler=xc(e,function(t,n){n&&n.href&&e.handleHref(t,n,n.href)}),e._tooltipHandler=xc(e,function(t,n){e.handleTooltip(t,n,t.type!==sc)})}gc.initialize=function(t,n,e,r,i,a){return this._options=a,this._canvas=Eu(1,1,a&&a.type),t&&(tc(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),vc.initialize.call(this,t,n,e,r,i)},gc.resize=function(t,n,e,r){return vc.resize.call(this,t,n,e,r),function(t,n,e,r,i,a){var u,o="undefined"!=typeof HTMLElement&&t instanceof HTMLElement&&null!=t.parentNode,s=t.getContext("2d"),l=o?dc:i;for(u in t.width=n*l,t.height=e*l,a)s[u]=a[u];o&&1!==l&&(t.style.width=n+"px",t.style.height=e+"px"),s.pixelRatio=l,s.setTransform(l,0,0,l,l*r[0],l*r[1])}(this._canvas,this._width,this._height,this._origin,this._scale,this._options&&this._options.context),this._redraw=!0,this},gc.canvas=function(){return this._canvas},gc.context=function(){return this._canvas?this._canvas.getContext("2d"):null},gc.dirty=function(t){var n=function(t,n){if(null==n)return t;for(var e=mc.clear().union(t);null!=n;n=n.mark.group)e.translate(n.x||0,n.y||0);return e}(t.bounds,t.mark.group);this._dirty.union(n)},gc._render=function(t){var n=this.context(),e=this._origin,r=this._width,i=this._height,a=this._dirty;return n.save(),this._redraw||a.empty()?(this._redraw=!1,a=null):a=function(t,n,e){return n.expand(1).round(),n.translate(-e[0]%1,-e[1]%1),t.beginPath(),t.rect(n.x1,n.y1,n.width(),n.height()),t.clip(),n}(n,a,e),this.clear(-e[0],-e[1],r,i),this.draw(n,t,a),n.restore(),this._dirty.clear(),this},gc.draw=function(t,n,e){var r=jl[n.marktype];n.clip&&function(t,n){var e=n.clip;if(t.save(),t.beginPath(),Y(e))e(t);else{var r=n.group;t.rect(0,0,r.width||0,r.height||0)}t.clip()}(t,n),r.draw.call(this,t,n,e),n.clip&&t.restore()},gc.clear=function(t,n,e,r){var i=this.context();i.clearRect(t,n,e,r),null!=this._bgcolor&&(i.fillStyle=this._bgcolor,i.fillRect(t,n,e,r))};var _c=et(yc,rc);function xc(t,n){return function(e){var r=e.target.__data__;e.vegaType=e.type,r=Array.isArray(r)?r[0]:r,n.call(t._obj,e,r)}}function bc(t,n,e){var r,i,a="<"+t;if(n)for(r in n)null!=(i=n[r])&&(a+=" "+r+'="'+i+'"');return e&&(a+=" "+e),a+">"}function wc(t){return"</"+t+">"}_c.initialize=function(t,n,e){var r=this._svg;return r&&(r.removeEventListener("click",this._hrefHandler),r.removeEventListener("mousemove",this._tooltipHandler),r.removeEventListener(sc,this._tooltipHandler)),this._svg=r=t&&Ql(t,"svg"),r&&(r.addEventListener("click",this._hrefHandler),r.addEventListener("mousemove",this._tooltipHandler),r.addEventListener(sc,this._tooltipHandler)),rc.prototype.initialize.call(this,t,n,e)},_c.canvas=function(){return this._svg},_c.on=function(t,n){var e=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[e],t,n)<0){var i={type:t,handler:n,listener:xc(this,n)};(r[e]||(r[e]=[])).push(i),this._svg&&this._svg.addEventListener(e,i.listener)}return this},_c.off=function(t,n){var e=this.eventName(t),r=this._handlers[e],i=this._handlerIndex(r,t,n);return i>=0&&(this._svg&&this._svg.removeEventListener(e,r[i].listener),r.splice(i,1)),this};var Ac={version:"1.1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},Mc={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},kc=Object.keys(Mc),Ec=Ac.xmlns;function Cc(t){uc.call(this,t),this._dirtyID=1,this._dirty=[],this._svg=null,this._root=null,this._defs=null}var Dc=et(Cc,uc),Fc=uc.prototype;function Sc(t,n,e){var r,i,a;for((t=Kl(t,e,"linearGradient",Ec)).setAttribute("id",n.id),t.setAttribute("x1",n.x1),t.setAttribute("x2",n.x2),t.setAttribute("y1",n.y1),t.setAttribute("y2",n.y2),r=0,i=n.stops.length;r<i;++r)(a=Kl(t,r,"stop",Ec)).setAttribute("offset",n.stops[r].offset),a.setAttribute("stop-color",n.stops[r].color);tc(t,r)}function Bc(t,n,e){var r;(t=Kl(t,e,"clipPath",Ec)).setAttribute("id",n.id),n.path?(r=Kl(t,0,"path",Ec)).setAttribute("d",n.path):((r=Kl(t,0,"rect",Ec)).setAttribute("x",0),r.setAttribute("y",0),r.setAttribute("width",n.width),r.setAttribute("height",n.height))}function Nc(t,n){for(;t&&t.dirty!==n;t=t.mark.group){if(t.dirty=n,!t.mark||t.mark.dirty===n)return;t.mark.dirty=n}}function Oc(t,n,e,r,i){var a,u=t._svg;if(!u&&(u=Jl(a=n.ownerDocument,r,Ec),t._svg=u,t.mark&&(u.__data__=t,u.__values__={fill:"default"},"g"===r))){var o=Jl(a,"path",Ec);o.setAttribute("class","background"),u.appendChild(o),o.__data__=t;var s=Jl(a,"g",Ec);u.appendChild(s),s.__data__=t}return(u.ownerSVGElement!==i||function(t){var n=t.mark||t.group;return n&&n.items.length>1}(t)&&u.previousSibling!==e)&&n.insertBefore(u,e?e.nextSibling:n.firstChild),u}Dc.initialize=function(t,n,e,r){return t&&(this._svg=Kl(t,0,"svg",Ec),this._svg.setAttribute("class","marks"),tc(t,1),this._root=Kl(this._svg,0,"g",Ec),tc(this._svg,1)),this._defs={gradient:{},clipping:{}},this.background(this._bgcolor),Fc.initialize.call(this,t,n,e,r)},Dc.background=function(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),Fc.background.apply(this,arguments)},Dc.resize=function(t,n,e,r){return Fc.resize.call(this,t,n,e,r),this._svg&&(this._svg.setAttribute("width",this._width*this._scale),this._svg.setAttribute("height",this._height*this._scale),this._svg.setAttribute("viewBox","0 0 "+this._width+" "+this._height),this._root.setAttribute("transform","translate("+this._origin+")")),this._dirty=[],this},Dc.canvas=function(){return this._svg},Dc.svg=function(){if(!this._svg)return null;var t={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var n in Ac)t[n]=Ac[n];var e=this._bgcolor?bc("rect",{width:this._width,height:this._height,style:"fill: "+this._bgcolor+";"})+wc("rect"):"";return bc("svg",t)+e+this._svg.innerHTML+wc("svg")},Dc._render=function(t){return this._dirtyCheck()&&(this._dirtyAll&&this._resetDefs(),this.draw(this._root,t),tc(this._root,1)),this.updateDefs(),this._dirty=[],++this._dirtyID,this},Dc.updateDefs=function(){var t,n=this._svg,e=this._defs,r=e.el,i=0;for(t in e.gradient)r||(e.el=r=Kl(n,0,"defs",Ec)),Sc(r,e.gradient[t],i++);for(t in e.clipping)r||(e.el=r=Kl(n,0,"defs",Ec)),Bc(r,e.clipping[t],i++);r&&(0===i?(n.removeChild(r),e.el=null):tc(r,i))},Dc._resetDefs=function(){var t=this._defs;t.gradient={},t.clipping={}},Dc.dirty=function(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))},Dc.isDirty=function(t){return this._dirtyAll||!t._svg||t.dirty===this._dirtyID},Dc._dirtyCheck=function(){this._dirtyAll=!0;var t=this._dirty;if(!t.length)return!0;var n,e,r,i,a,u,o,s=++this._dirtyID;for(a=0,u=t.length;a<u;++a)(e=(n=t[a]).mark).marktype!==r&&(r=e.marktype,i=jl[r]),e.zdirty&&e.dirty!==s&&(this._dirtyAll=!1,Nc(n,s),e.items.forEach(function(t){t.dirty=s})),e.zdirty||(n.exit?(i.nested&&e.items.length?(o=e.items[0])._svg&&this._update(i,o._svg,o):n._svg&&(o=n._svg.parentNode)&&o.removeChild(n._svg),n._svg=null):(n=i.nested?e.items[0]:n)._update!==s&&(n._svg&&n._svg.ownerSVGElement?this._update(i,n._svg,n):(this._dirtyAll=!1,Nc(n,s)),n._update=s));return!this._dirtyAll},Dc.draw=function(t,n,e){if(!this.isDirty(n))return n._svg;var r,i=this,a=this._svg,u=jl[n.marktype],o=!1===n.interactive?"none":null,s="g"===u.tag,l=null,c=0;function f(t){var n=i.isDirty(t),e=Oc(t,r,l,u.tag,a);n&&(i._update(u,e,t),s&&function(t,n,e){n=n.lastChild;var r,i=0;Ys(e,function(e){r=t.draw(n,e,r),++i}),tc(n,1+i)}(i,e,t)),l=e,++c}return(r=Oc(n,t,e,"g",a)).setAttribute("class",nc(n)),s||r.style.setProperty("pointer-events",o),n.clip?r.setAttribute("clip-path",ol(i,n,n.group)):r.removeAttribute("clip-path"),u.nested?n.items.length&&f(n.items[0]):Ys(n,f),tc(r,c),r};var zc=null,Tc=null,Rc={group:function(t,n,e){Tc=n.__values__,zc=n.childNodes[1],t.foreground(Lc,e,this),zc=n.childNodes[0],t.background(Lc,e,this);var r=!1===e.mark.interactive?"none":null;r!==Tc.events&&(zc.style.setProperty("pointer-events",r),Tc.events=r)},text:function(t,n,e){var r;(r=Ol(e))!==Tc.text&&(n.textContent=r,Tc.text=r),Pc(n,"font-family",zl(e)),Pc(n,"font-size",Bl(e)+"px"),Pc(n,"font-style",e.fontStyle),Pc(n,"font-variant",e.fontVariant),Pc(n,"font-weight",e.fontWeight)}};function Pc(t,n,e){e!==Tc[n]&&(null==e?t.style.removeProperty(n):t.style.setProperty(n,e+""),Tc[n]=e)}function Lc(t,n,e){n!==Tc[t]&&(null!=n?e?zc.setAttributeNS(e,t,n):zc.setAttribute(t,n):e?zc.removeAttributeNS(e,t):zc.removeAttribute(t),Tc[t]=n)}function qc(t){uc.call(this,t),this._text={head:"",bg:"",root:"",foot:"",defs:"",body:""},this._defs={gradient:{},clipping:{}}}Dc._update=function(t,n,e){zc=n,Tc=n.__values__,t.attr(Lc,e,this);var r=Rc[t.type];r&&r.call(this,t,n,e),this.style(zc,e)},Dc.style=function(t,n){var e,r,i,a,u,o;if(null!=n)for(e=0,r=kc.length;e<r;++e)u=n[i=kc[e]],"font"===i&&(u=zl(n)),u!==Tc[i]&&(a=Mc[i],null==u?"fill"===a?t.style.setProperty(a,"none"):t.style.removeProperty(a):(u.id&&(this._defs.gradient[u.id]=u,u="url("+(o=void 0,"undefined"==typeof window?"":(o=window.location).hash?o.href.slice(0,-o.hash.length):o.href)+"#"+u.id+")"),t.style.setProperty(a,u+"")),Tc[i]=u)};var Uc,jc=et(qc,uc),Ic=uc.prototype;function $c(t,n,e,r){Uc[r||t]=n}function Wc(t,n,e,r){if(null==t)return"";var i,a,u,o,s,l="";for("bgrect"===e&&!1===n.interactive&&(l+="pointer-events: none; "),"text"===e&&(l+="font-family: "+zl(t)+"; ",l+="font-size: "+Bl(t)+"px; ",t.fontStyle&&(l+="font-style: "+t.fontStyle+"; "),t.fontVariant&&(l+="font-variant: "+t.fontVariant+"; "),t.fontWeight&&(l+="font-weight: "+t.fontWeight+"; ")),i=0,a=kc.length;i<a;++i)u=kc[i],o=Mc[u],null==(s=t[u])?"fill"===o&&(l+="fill: none; "):"transparent"!==s||"fill"!==o&&"stroke"!==o?(s.id&&(r.gradient[s.id]=s,s="url(#"+s.id+")"),l+=o+": "+s+"; "):l+=o+": none; ";return l?'style="'+l.trim()+'"':null}jc.resize=function(t,n,e,r){Ic.resize.call(this,t,n,e,r);var i=this._origin,a=this._text,u={class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:"0 0 "+this._width+" "+this._height};for(var o in Ac)u[o]=Ac[o];a.head=bc("svg",u);var s=this._bgcolor;return"transparent"!==s&&"none"!==s||(s=null),a.bg=s?bc("rect",{width:this._width,height:this._height,style:"fill: "+s+";"})+wc("rect"):"",a.root=bc("g",{transform:"translate("+i+")"}),a.foot=wc("g")+wc("svg"),this},jc.background=function(){var t=Ic.background.apply(this,arguments);return arguments.length&&this._text.head&&this.resize(this._width,this._height,this._origin,this._scale),t},jc.svg=function(){var t=this._text;return t.head+t.bg+t.defs+t.root+t.body+t.foot},jc._render=function(t){return this._text.body=this.mark(t),this._text.defs=this.buildDefs(),this},jc.buildDefs=function(){var t,n,e,r,i=this._defs,a="";for(n in i.gradient){for(r=(e=i.gradient[n]).stops,a+=bc("linearGradient",{id:n,x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2}),t=0;t<r.length;++t)a+=bc("stop",{offset:r[t].offset,"stop-color":r[t].color})+wc("stop");a+=wc("linearGradient")}for(n in i.clipping)e=i.clipping[n],a+=bc("clipPath",{id:n}),e.path?a+=bc("path",{d:e.path})+wc("path"):a+=bc("rect",{x:0,y:0,width:e.width,height:e.height})+wc("rect"),a+=wc("clipPath");return a.length>0?bc("defs")+a+wc("defs"):""},jc.attributes=function(t,n){return Uc={},t($c,n,this),Uc},jc.href=function(t){var n,e=this,r=t.href;if(r){if(n=e._hrefs&&e._hrefs[r])return n;e.sanitizeURL(r).then(function(t){t["xlink:href"]=t.href,t.href=null,(e._hrefs||(e._hrefs={}))[r]=t})}return null},jc.mark=function(t){var n,e=this,r=jl[t.marktype],i=r.tag,a=this._defs,u="";function o(o){var s=e.href(o);s&&(u+=bc("a",s)),n="g"!==i?Wc(o,t,i,a):null,u+=bc(i,e.attributes(r.attr,o),n),"text"===i?u+=Ol(o).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"):"g"===i&&(u+=bc("path",e.attributes(r.background,o),Wc(o,t,"bgrect",a))+wc("path"),u+=bc("g",e.attributes(r.foreground,o))+e.markGroup(o)+wc("g")),u+=wc(i),s&&(u+=wc("a"))}return"g"!==i&&!1===t.interactive&&(n='style="pointer-events: none;"'),u+=bc("g",{class:nc(t),"clip-path":t.clip?ol(e,t,t.group):null},n),r.nested?t.items&&t.items.length&&o(t.items[0]):Ys(t,o),u+wc("g")},jc.markGroup=function(t){var n=this,e="";return Ys(t,function(t){e+=n.mark(t)}),e};var Hc={Canvas:"canvas",PNG:"png",SVG:"svg",None:"none"},Yc={};function Gc(t,n){return t=String(t||"").toLowerCase(),arguments.length>1?(Yc[t]=n,this):Yc[t]}function Vc(t,n,e){const r=[],a=(new xu).union(n),u=t.marktype;return u?Xc(t,a,e,r):"group"===u?Zc(t,a,e,r):i("Intersect scene must be mark node or group item.")}function Xc(t,n,e,r){if(function(t,n,e){return t.bounds&&n.intersects(t.bounds)&&("group"===t.marktype||!1!==t.interactive&&(!e||e(t)))}(t,n,e)){const i=t.items,a=t.marktype,u=i.length;let o=0;if("group"===a)for(;o<u;++o)Zc(i[o],n,e,r);else for(const t=jl[a].isect;o<u;++o){let e=i[o];Jc(e,n,t)&&r.push(e)}}return r}function Zc(t,n,e,r){e&&e(t.mark)&&Jc(t,n,jl.group.isect)&&r.push(t);const i=t.items,a=i&&i.length;if(a){const u=t.x||0,o=t.y||0;n.translate(-u,-o);for(let t=0;t<a;++t)Xc(i[t],n,e,r);n.translate(u,o)}return r}function Jc(t,n,e){const r=t.bounds;return n.encloses(r)||n.intersects(r)&&e(t,n)}Yc.canvas=Yc.png={renderer:pc,headless:pc,handler:lc},Yc.svg={renderer:Cc,headless:qc,handler:yc},Yc.none={};var Qc=new xu;function Kc(t){var n=t.clip;if(Y(n))n(Ss(Qc.clear()));else{if(!n)return;Qc.set(0,0,t.group.width,t.group.height)}t.bounds.intersect(Qc)}var tf=1e-9;function nf(t,n,e){return t===n||("path"===e?ef(t,n):t instanceof Date&&n instanceof Date?+t==+n:ut(t)&&ut(n)?Math.abs(t-n)<=tf:t&&n&&(o(t)||o(n))?null!=t&&null!=n&&function(t,n){var e,r,i=Object.keys(t),a=Object.keys(n);if(i.length!==a.length)return!1;for(i.sort(),a.sort(),r=i.length-1;r>=0;r--)if(i[r]!=a[r])return!1;for(r=i.length-1;r>=0;r--)if(e=i[r],!nf(t[e],n[e],e))return!1;return typeof t==typeof n}(t,n):t==n)}function ef(t,n){return nf(Yo(t),Yo(n))}function rf(t){Ir.call(this,null,t)}function af(t,n,e){return n(t.bounds.clear(),t,e)}et(rf,Ir).transform=function(t,n){var e,r=n.dataflow,i=t.mark,a=i.marktype,u=jl[a],o=u.bound,s=i.bounds;return u.nested?(i.items.length&&r.dirty(i.items[0]),s=af(i,o),i.items.forEach(function(t){t.bounds.clear().union(s)})):a===Za||t.modified()?(n.visit(n.MOD,function(t){r.dirty(t)}),s.clear(),i.items.forEach(function(t){s.union(af(t,o))}),i.role===nu&&n.reflow()):(e=n.changed(n.REM),n.visit(n.ADD,function(t){s.union(af(t,o))}),n.visit(n.MOD,function(t){e=e||s.alignsWith(t.bounds),r.dirty(t),s.union(af(t,o))}),e&&(s.clear(),i.items.forEach(function(t){s.union(t.bounds)}))),Kc(i),n.modifies("bounds")};var uf=":vega_identifier:";function of(t){Ir.call(this,0,t)}function sf(t){Ir.call(this,null,t)}function lf(t){Ir.call(this,null,t)}of.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},et(of,Ir).transform=function(t,n){var e=function(t){var n=t._signals[uf];n||(t._signals[uf]=n=t.add(0));return n}(n.dataflow),r=e.value,i=t.as;return n.visit(n.ADD,function(t){t[i]||(t[i]=++r)}),e.set(this.value=r),n},et(sf,Ir).transform=function(t,n){var e=this.value;e||((e=n.dataflow.scenegraph().mark(t.markdef,function(t){var n=t.groups,e=t.parent;return n&&1===n.size?n.get(Object.keys(n.object)[0]):n&&e?n.lookup(e):null}(t),t.index)).group.context=t.context,t.context.group||(t.context.group=e.group),e.source=this,e.clip=t.clip,e.interactive=t.interactive,this.value=e);var r=e.marktype===Za?ku:Mu;return n.visit(n.ADD,function(t){r.call(t,e)}),(t.modified("clip")||t.modified("interactive"))&&(e.clip=t.clip,e.interactive=!!t.interactive,e.zdirty=!0,n.reflow()),e.items=n.source,n};var cf=et(lf,Ir),ff={parity:function(t){return t.filter(function(t,n){return n%2?t.opacity=0:1})},greedy:function(t,n){var e;return t.filter(function(t,r){return r&&hf(e.bounds,t.bounds,n)?t.opacity=0:(e=t,1)})}};function hf(t,n,e){return e>Math.max(n.x1-t.x2,t.x1-n.x2,n.y1-t.y2,t.y1-n.y2)}function df(t,n){for(var e,r=1,i=t.length,a=t[0].bounds;r<i;a=e,++r)if(hf(a,e=t[r].bounds,n))return!0}function pf(t){var n=t.bounds;return n.width()>1&&n.height()>1}function gf(t){return t.forEach(function(t){t.opacity=1}),t}function vf(t,n){return t.reflow(n.modified()).modifies("opacity")}function mf(t){Ir.call(this,null,t)}function yf(t,n){for(var e=0,r=t.length;e<r;++e)n.push(t[e])}function _f(t){return{x1:0,y1:0,x2:t.width||0,y2:t.height||0}}function xf(t){var n=t.bounds.clone();return n.empty()?n.set(0,0,0,0):n.translate(-(t.x||0),-(t.y||0))}function bf(t,n){return"x1"===n?t.x||0:"y1"===n?t.y||0:"x2"===n?(t.x||0)+(t.width||0):"y2"===n?(t.y||0)+(t.height||0):void 0}function wf(t,n){return t.bounds[n]}function Af(t,n,e){var r=o(t)?t[n]:t;return null!=r?r:void 0!==e?e:0}function Mf(t){return t<0?Math.ceil(-t):0}function kf(t,n,e){var r,i,a,u,o,s,l,c,f,h,d,p,g=function(t){for(var n,e,r=t.items,i=r.length,a=0,u={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};a<i;++a)if(e=(n=r[a]).items,n.marktype===Za)switch(n.role){case Ja:case nu:break;case eu:yf(e,u.rowheaders);break;case ru:yf(e,u.rowfooters);break;case au:yf(e,u.colheaders);break;case uu:yf(e,u.colfooters);break;case iu:u.rowtitle=e[0];break;case ou:u.coltitle=e[0];break;default:yf(e,u.marks)}return u}(n),v=g.marks,m=e.bounds===mu,y=m?_f:xf,_=new xu(0,0,0,0),x=Af(e.align,yu),b=Af(e.align,_u),w=Af(e.padding,yu),A=Af(e.padding,_u),M=e.offset,k=n.columns||e.columns||v.length,E=k<0?1:Math.ceil(v.length/k),C=E*k,D=[],F=[],S=0,B=[],N=[],O=0,z=v.length;for(i=0;i<k;++i)F[i]=0;for(i=0;i<E;++i)N[i]=0;for(i=0;i<z;++i)o=y(v[i]),a=i%k,u=~~(i/k),l=Math.ceil(y(v[i]).x2),c=Math.ceil(y(v[i]).y2),S=Math.max(S,l),O=Math.max(O,c),F[a]=Math.max(F[a],l),N[u]=Math.max(N[u],c),D.push(w+Mf(o.x1)),B.push(A+Mf(o.y1)),t.dirty(v[i]);for(i=0;i<z;++i)i%k==0&&(D[i]=0),i<k&&(B[i]=0);if(x===vu)for(a=1;a<k;++a){for(p=0,i=a;i<z;i+=k)p<D[i]&&(p=D[i]);for(i=a;i<z;i+=k)D[i]=p+F[a-1]}else if(x===gu){for(p=0,i=0;i<z;++i)i%k&&p<D[i]&&(p=D[i]);for(i=0;i<z;++i)i%k&&(D[i]=p+S)}else for(x=!1,a=1;a<k;++a)for(i=a;i<z;i+=k)D[i]+=F[a-1];if(b===vu)for(u=1;u<E;++u){for(p=0,r=(i=u*k)+k;i<r;++i)p<B[i]&&(p=B[i]);for(i=u*k;i<r;++i)B[i]=p+N[u-1]}else if(b===gu){for(p=0,i=k;i<z;++i)p<B[i]&&(p=B[i]);for(i=k;i<z;++i)B[i]=p+O}else for(b=!1,u=1;u<E;++u)for(r=(i=u*k)+k;i<r;++i)B[i]+=N[u-1];for(f=0,i=0;i<z;++i)l=(s=v[i]).x||0,s.x=f=D[i]+(i%k?f:0),s.bounds.translate(f-l,0);for(a=0;a<k;++a)for(h=0,i=a;i<z;i+=k)c=(s=v[i]).y||0,s.y=h+=B[i],s.bounds.translate(0,h-c);if(Af(e.center,yu)&&E>1&&x)for(i=0;i<z;++i)s=v[i],(f=(o=x===gu?S:F[i%k])-y(s).x2)>0&&(s.x+=l=f/2,s.bounds.translate(l,0));if(Af(e.center,_u)&&1!==k&&b)for(i=0;i<z;++i)s=v[i],(h=(o=b===gu?O:N[~~(i/k)])-y(s).y2)>0&&(s.y+=c=h/2,s.bounds.translate(0,c));for(i=0;i<z;++i)v[i].mark.bounds.clear();for(i=0;i<z;++i)s=v[i],t.dirty(s),_.union(s.mark.bounds.union(s.bounds));function T(t,n){return Math.floor(Math.min(t,n))}function R(t,n){return Math.ceil(Math.max(t,n))}y=m?bf:wf,d=Af(e.headerBand,_u,null),f=Ef(t,g.rowheaders,v,k,E,-Af(M,"rowHeader"),T,0,y,"x1",0,k,1,d),d=Af(e.headerBand,yu,null),h=Ef(t,g.colheaders,v,k,k,-Af(M,"columnHeader"),T,1,y,"y1",0,1,k,d),d=Af(e.footerBand,_u,null),Ef(t,g.rowfooters,v,k,E,Af(M,"rowFooter"),R,0,y,"x2",k-1,k,1,d),d=Af(e.footerBand,yu,null),Ef(t,g.colfooters,v,k,k,Af(M,"columnFooter"),R,1,y,"y2",C-k,1,k,d),g.rowtitle&&(p=f-Af(M,"rowTitle"),d=Af(e.titleBand,_u,.5),Cf(t,g.rowtitle,p,0,_,d)),g.coltitle&&(p=h-Af(M,"columnTitle"),d=Af(e.titleBand,yu,.5),Cf(t,g.coltitle,p,1,_,d))}function Ef(t,n,e,r,i,a,u,o,s,l,c,f,h,d){var p,g,v,m,y,_,x,b,w,A=e.length,M=0,k=0;if(!A)return M;for(p=c;p<A;p+=f)e[p]&&(M=u(M,s(e[p],l)));if(!n.length)return M;for(n.length>i&&(t.warn("Grid headers exceed limit: "+i),n=n.slice(0,i)),M+=a,g=0,m=n.length;g<m;++g)t.dirty(n[g]),n[g].mark.bounds.clear();for(p=c,g=0,m=n.length;g<m;++g,p+=f){for(y=(_=n[g]).mark.bounds,v=p;v>=0&&null==(x=e[v]);v-=h);o?(b=null==d?x.x:Math.round(x.bounds.x1+d*x.bounds.width()),w=M):(b=M,w=null==d?x.y:Math.round(x.bounds.y1+d*x.bounds.height())),y.union(_.bounds.translate(b-(_.x||0),w-(_.y||0))),_.x=b,_.y=w,t.dirty(_),k=u(k,y[l])}return k}function Cf(t,n,e,r,i,a){if(n){t.dirty(n);var u=e,o=e;r?u=Math.round(i.x1+a*i.width()):o=Math.round(i.y1+a*i.height()),n.bounds.translate(u-(n.x||0),o-(n.y||0)),n.mark.bounds.clear().union(n.bounds),n.x=u,n.y=o,t.dirty(n)}}cf.transform=function(t,n){var e,r,i=ff[t.method]||ff.parity,a=n.materialize(n.SOURCE).source,u=t.separation||0;if(a){if(!t.method)return t.modified("method")&&(gf(a),n=vf(n,t)),n;if(t.sort&&(a=a.slice().sort(t.sort)),e=gf(a=a.filter(pf)),n=vf(n,t),e.length>=3&&df(e,u)){do{e=i(e,u)}while(e.length>=3&&df(e,u));e.length<3&&!k(a).opacity&&(e.length>1&&(k(e).opacity=0),k(a).opacity=1)}var o,s,l,c,f;return t.boundScale&&t.boundTolerance>=0&&(o=t.boundScale,s=t.boundOrient,l=+t.boundTolerance,c=o.range(),f=new xu,s===Ua||s===$a?f.set(c[0],-1/0,c[1],1/0):f.set(-1/0,c[0],1/0,c[1]),f.expand(l||1),r=function(t){return f.encloses(t.bounds)},a.forEach(function(t){r(t)||(t.opacity=0)})),n}},et(mf,Ir).transform=function(t,n){var e=n.dataflow;if(n.visit(n.ALL,function(t){e.dirty(t)}),n.fields&&n.fields.zindex){var r=n.source&&n.source[0];r&&(r.mark.zdirty=!0)}};var Df=.5,Ff=new xu;function Sf(t){Ir.call(this,null,t)}function Bf(t,n,e){return t[n]===e?0:(t[n]=e,1)}function Nf(t){var n=t.items[0].datum.orient;return n===ja||n===Ia}function Of(t,n,e,r){var i,a,u=n.items[0],o=u.datum,s=o.orient,l=function(t){var n=+t.grid;return[t.ticks?n++:-1,t.labels?n++:-1,n+ +t.domain]}(o),c=u.range,f=u.offset,h=u.position,d=u.minExtent,p=u.maxExtent,g=o.title&&u.items[l[2]].items[0],v=u.titlePadding,m=u.bounds,y=0,_=0;switch(Ff.clear().union(m),m.clear(),(i=l[0])>-1&&m.union(u.items[i].bounds),(i=l[1])>-1&&m.union(u.items[i].bounds),s){case Ua:y=h||0,_=-f,a=Math.max(d,Math.min(p,-m.y1)),g&&(a=zf(g,a,v,0,-1,m)),m.add(0,-a).add(c,0);break;case ja:y=-f,_=h||0,a=Math.max(d,Math.min(p,-m.x1)),g&&(a=zf(g,a,v,1,-1,m)),m.add(-a,0).add(0,c);break;case Ia:y=e+f,_=h||0,a=Math.max(d,Math.min(p,m.x2)),g&&(a=zf(g,a,v,1,1,m)),m.add(0,0).add(a,c);break;case $a:y=h||0,_=r+f,a=Math.max(d,Math.min(p,m.y2)),g&&(a=zf(g,a,v,0,1,m)),m.add(0,0).add(c,a);break;default:y=u.x,_=u.y}return Cs(m.translate(y,_),u),Bf(u,"x",y+Df)|Bf(u,"y",_+Df)&&(u.bounds=Ff,t.dirty(u),u.bounds=m,t.dirty(u)),u.mark.bounds.clear().union(m)}function zf(t,n,e,r,i,a){var u=t.bounds,o=0,s=0;return t.auto?(n+=e,r?o=(t.x||0)-(t.x=i*n):s=(t.y||0)-(t.y=i*n),u.translate(-o,-s),t.mark.bounds.set(u.x1,u.y1,u.x2,u.y2),r?(a.add(0,u.y1).add(0,u.y2),n+=u.width()):(a.add(u.x1,0).add(u.x2,0),n+=u.height())):a.union(u),n}function Tf(t,n){return n.reduce(function(n,e){var r=e.items[0];if(function(t,n,e){var r=n.padding-e.x,i=n.padding-e.y;if(n.datum.title){var a=n.items[1].items[0];i+=n.titlePadding+a.fontSize}(r||i)&&(e.x+=r,e.y+=i,e.bounds.translate(r,i),e.mark.bounds.translate(r,i),t.dirty(e))}(t,r,r.items[0].items[0]),r.datum.orient===ja){var i=Ff.clear();r.items.forEach(function(t){i.union(t.bounds)}),n=Math.max(n,Math.ceil(i.width()+2*r.padding-1))}return n},0)}function Rf(t,n,e,r,i,a,u){var o,s,l,c,f,h=n.items[0],d=h.datum,p=d.orient,g=h.offset,v=h.bounds,m=0,y=0;switch(p===Ua||p===$a?(l=i,m=e[p]):p!==ja&&p!==Ia||(l=r,y=e[p]),Ff.clear().union(v),v.clear(),h.items.forEach(function(t){v.union(t.bounds)}),o=2*h.padding-1,s=2*h.padding-1,v.empty()||(o=Math.ceil(v.width()+o),s=Math.ceil(v.height()+s)),d.type===lu&&(c=h.items[0].items[0].items[0].items,f=c.reduce(function(t,n){return t[n.column]=Math.max(n.bounds.x2-n.x,t[n.column]||0),t},{}),c.forEach(function(t){t.width=f[t.column],t.height=t.bounds.y2-t.y})),p){case ja:m-=e.leftWidth+g-Math.floor(l.x1),e.left+=s+e.margin;break;case Ia:m+=g+Math.ceil(l.x2),e.right+=s+e.margin;break;case Ua:y-=s+g-Math.floor(l.y1),e.top+=o+e.margin;break;case $a:y+=g+Math.ceil(l.y2),e.bottom+=o+e.margin;break;case Wa:m+=g,y+=g;break;case Ha:m+=a-o-g,y+=g;break;case Ya:m+=g,y+=u-s-g;break;case Ga:m+=a-o-g,y+=u-s-g;break;default:m=h.x,y=h.y}return Cs(v.set(m,y,m+o,y+s),h),Bf(h,"x",m)|Bf(h,"width",o)|Bf(h,"y",y)|Bf(h,"height",s)&&(h.bounds=Ff,t.dirty(h),h.bounds=v,t.dirty(h)),h.mark.bounds.clear().union(v)}et(Sf,Ir).transform=function(t,n){var e=n.dataflow;return t.mark.items.forEach(function(n){t.layout&&kf(e,n,t.layout),function(t,n,e){var r,i,a,u,o,s,l=n.items,c=Math.max(0,n.width||0),f=Math.max(0,n.height||0),h=(new xu).set(0,0,c,f),d=h.clone(),p=h.clone(),g=[];for(o=0,s=l.length;o<s;++o)switch((i=l[o]).role){case Ja:(u=Nf(i)?d:p).union(Of(t,i,c,f));break;case Qa:r=i;break;case nu:g.push(i);break;case Ka:case tu:case eu:case ru:case iu:case au:case uu:case ou:d.union(i.bounds),p.union(i.bounds);break;default:h.union(i.bounds)}if(g.length)for(a={leftWidth:Tf(t,g),margin:e.legendMargin||8,left:0,right:0,top:0,bottom:0},o=0,s=g.length;o<s;++o)if(u=Rf(t,g[o],a,d,p,c,f),e.autosize&&e.autosize.type===cu){var v=g[o].items[0].datum.orient;v===ja||v===Ia?h.add(u.x1,0).add(u.x2,0):v!==Ua&&v!==$a||h.add(0,u.y1).add(0,u.y2)}else h.union(u);h.union(d).union(p),r&&h.union(function(t,n,e,r,i){var a,u=n.items[0],o=u.orient,s=u.frame,l=u.anchor,c=u.offset,f=u.bounds,h=0,d=o===ja||o===Ia?r:e,p=0,g=0;s!==Za?o===ja?(h=i.y2,d=i.y1):o===Ia?(h=i.y1,d=i.y2):(h=i.x1,d=i.x2):o===ja&&(h=r,d=0);switch(a=l===Va?h:l===Xa?d:(h+d)/2,Ff.clear().union(f),o){case Ua:p=a,g=i.y1-c;break;case ja:p=i.x1-c,g=a;break;case Ia:p=i.x2+c,g=a;break;case $a:p=a,g=i.y2+c;break;default:p=u.x,g=u.y}f.translate(p-u.x,g-u.y),Bf(u,"x",p)|Bf(u,"y",g)&&(u.bounds=Ff,t.dirty(u),u.bounds=f,t.dirty(u));return n.bounds.clear().union(f)}(t,r,c,f,h));!function(t,n,e,r){var i=r.autosize||{},a=i.type,u=t._width,o=t._height,s=t.padding();if(t._autosize<1||!a)return;var l=Math.max(0,n.width||0),c=Math.max(0,Math.ceil(-e.x1)),f=Math.max(0,Math.ceil(e.x2-l)),h=Math.max(0,n.height||0),d=Math.max(0,Math.ceil(-e.y1)),p=Math.max(0,Math.ceil(e.y2-h));i.contains===su&&(u-=s.left+s.right,o-=s.top+s.bottom);a===pu?(c=0,d=0,l=u,h=o):a===cu?(l=Math.max(0,u-c-f),h=Math.max(0,o-d-p)):a===fu?(l=Math.max(0,u-c-f),o=h+d+p):a===hu?(u=l+c+f,h=Math.max(0,o-d-p)):a===du&&(u=l+c+f,o=h+d+p);t._resizeView(u,o,l,h,[c,d],i.resize)}(t,n,h,e)}(e,n,t)}),t.modified()&&n.reflow(),n};var Pf=Object.freeze({bound:rf,identifier:of,mark:sf,overlap:lf,render:mf,viewlayout:Sf});function Lf(t,n,e){var r=t-n+2*e;return t?r>0?r:1:0}const qf="identity",Uf="linear",jf="log",If="pow",$f="sqrt",Wf="symlog",Hf="time",Yf="utc",Gf="sequential",Vf="diverging",Xf="quantile",Zf="quantize",Jf="threshold",Qf="ordinal",Kf="point",th="band",nh="bin-ordinal";function eh(t){return t===nh}function rh(t){return t===Xf}function ih(t){return function(t){return t&&t.startsWith(Gf)}(t)||function(t){return t&&t.startsWith(Vf)}(t)}function ah(t){return t===jf||t.endsWith("-log")}function uh(t){switch(t){case Uf:case jf:case If:case $f:case Wf:case Hf:case Yf:case Gf:return!0}return!1}function oh(t){return eh(t)||t===Qf||t===th||t===Kf}function sh(t){return eh(t)||t===Xf||t===Zf||t===Jf}var lh={millisecond:Nn,second:Tn,minute:Rn,hour:Pn,day:Ln,week:Un,month:$n,year:Wn},ch={millisecond:Nn,second:Tn,minute:Hn,hour:Yn,day:Gn,week:Xn,month:Qn,year:Kn};function fh(t,n){const e=n===Yf?ch:lh;return e.hasOwnProperty(t)&&e[t]}function hh(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}function dh(t){var n;return 1===t.length&&(n=t,t=function(t,e){return hh(n(t),e)}),{left:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var a=r+i>>>1;t(n[a],e)<0?r=a+1:i=a}return r},right:function(n,e,r,i){for(null==r&&(r=0),null==i&&(i=n.length);r<i;){var a=r+i>>>1;t(n[a],e)>0?i=a:r=a+1}return r}}}var ph=dh(hh).right;function gh(t){return null===t?NaN:+t}var vh=Math.sqrt(50),mh=Math.sqrt(10),yh=Math.sqrt(2);function _h(t,n,e){var r,i,a,u,o=-1;if(e=+e,(t=+t)===(n=+n)&&e>0)return[t];if((r=n<t)&&(i=t,t=n,n=i),0===(u=xh(t,n,e))||!isFinite(u))return[];if(u>0)for(t=Math.ceil(t/u),n=Math.floor(n/u),a=new Array(i=Math.ceil(n-t+1));++o<i;)a[o]=(t+o)*u;else for(t=Math.floor(t*u),n=Math.ceil(n*u),a=new Array(i=Math.ceil(t-n+1));++o<i;)a[o]=(t-o)/u;return r&&a.reverse(),a}function xh(t,n,e){var r=(n-t)/Math.max(0,e),i=Math.floor(Math.log(r)/Math.LN10),a=r/Math.pow(10,i);return i>=0?(a>=vh?10:a>=mh?5:a>=yh?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=vh?10:a>=mh?5:a>=yh?2:1)}function bh(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=vh?i*=10:a>=mh?i*=5:a>=yh&&(i*=2),n<t?-i:i}function wh(t,n,e){if(null==e&&(e=gh),r=t.length){if((n=+n)<=0||r<2)return+e(t[0],0,t);if(n>=1)return+e(t[r-1],r-1,t);var r,i=(r-1)*n,a=Math.floor(i),u=+e(t[a],a,t);return u+(+e(t[a+1],a+1,t)-u)*(i-a)}}function Ah(t,n){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(n).domain(t)}return this}function Mh(t,n){switch(arguments.length){case 0:break;case 1:this.interpolator(t);break;default:this.interpolator(n).domain(t)}return this}function kh(){}function Eh(t,n){var e=new kh;if(t instanceof kh)t.each(function(t,n){e.set(n,t)});else if(Array.isArray(t)){var r,i=-1,a=t.length;if(null==n)for(;++i<a;)e.set(i,t[i]);else for(;++i<a;)e.set(n(r=t[i],i,t),r)}else if(t)for(var u in t)e.set(u,t[u]);return e}function Ch(){}kh.prototype=Eh.prototype={constructor:kh,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var Dh=Eh.prototype;Ch.prototype=function(t,n){var e=new Ch;if(t instanceof Ch)t.each(function(t){e.add(t)});else if(t){var r=-1,i=t.length;if(null==n)for(;++r<i;)e.add(t[r]);else for(;++r<i;)e.add(n(t[r],r,t))}return e}.prototype={constructor:Ch,has:Dh.has,add:function(t){return this["$"+(t+="")]=t,this},remove:Dh.remove,clear:Dh.clear,values:Dh.keys,size:Dh.size,empty:Dh.empty,each:Dh.each};var Fh=Array.prototype,Sh=Fh.map,Bh=Fh.slice,Nh={name:"implicit"};function Oh(){var t=Eh(),n=[],e=[],r=Nh;function i(i){var a=i+"",u=t.get(a);if(!u){if(r!==Nh)return r;t.set(a,u=n.push(i))}return e[(u-1)%e.length]}return i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=Eh();for(var r,a,u=-1,o=e.length;++u<o;)t.has(a=(r=e[u])+"")||t.set(a,n.push(r));return i},i.range=function(t){return arguments.length?(e=Bh.call(t),i):e.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return Oh(n,e).unknown(r)},Ah.apply(i,arguments),i}function zh(t,n,e){t.prototype=n.prototype=e,e.constructor=t}function Th(t,n){var e=Object.create(t.prototype);for(var r in n)e[r]=n[r];return e}function Rh(){}var Ph="\\s*([+-]?\\d+)\\s*",Lh="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",qh="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Uh=/^#([0-9a-f]{3})$/,jh=/^#([0-9a-f]{6})$/,Ih=new RegExp("^rgb\\("+[Ph,Ph,Ph]+"\\)$"),$h=new RegExp("^rgb\\("+[qh,qh,qh]+"\\)$"),Wh=new RegExp("^rgba\\("+[Ph,Ph,Ph,Lh]+"\\)$"),Hh=new RegExp("^rgba\\("+[qh,qh,qh,Lh]+"\\)$"),Yh=new RegExp("^hsl\\("+[Lh,qh,qh]+"\\)$"),Gh=new RegExp("^hsla\\("+[Lh,qh,qh,Lh]+"\\)$"),Vh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Xh(t){var n;return t=(t+"").trim().toLowerCase(),(n=Uh.exec(t))?new td((n=parseInt(n[1],16))>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):(n=jh.exec(t))?Zh(parseInt(n[1],16)):(n=Ih.exec(t))?new td(n[1],n[2],n[3],1):(n=$h.exec(t))?new td(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Wh.exec(t))?Jh(n[1],n[2],n[3],n[4]):(n=Hh.exec(t))?Jh(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Yh.exec(t))?ed(n[1],n[2]/100,n[3]/100,1):(n=Gh.exec(t))?ed(n[1],n[2]/100,n[3]/100,n[4]):Vh.hasOwnProperty(t)?Zh(Vh[t]):"transparent"===t?new td(NaN,NaN,NaN,0):null}function Zh(t){return new td(t>>16&255,t>>8&255,255&t,1)}function Jh(t,n,e,r){return r<=0&&(t=n=e=NaN),new td(t,n,e,r)}function Qh(t){return t instanceof Rh||(t=Xh(t)),t?new td((t=t.rgb()).r,t.g,t.b,t.opacity):new td}function Kh(t,n,e,r){return 1===arguments.length?Qh(t):new td(t,n,e,null==r?1:r)}function td(t,n,e,r){this.r=+t,this.g=+n,this.b=+e,this.opacity=+r}function nd(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ed(t,n,e,r){return r<=0?t=n=e=NaN:e<=0||e>=1?t=n=NaN:n<=0&&(t=NaN),new id(t,n,e,r)}function rd(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof id)return new id(t.h,t.s,t.l,t.opacity);if(t instanceof Rh||(t=Xh(t)),!t)return new id;if(t instanceof id)return t;var n=(t=t.rgb()).r/255,e=t.g/255,r=t.b/255,i=Math.min(n,e,r),a=Math.max(n,e,r),u=NaN,o=a-i,s=(a+i)/2;return o?(u=n===a?(e-r)/o+6*(e<r):e===a?(r-n)/o+2:(n-e)/o+4,o/=s<.5?a+i:2-a-i,u*=60):o=s>0&&s<1?0:u,new id(u,o,s,t.opacity)}(t):new id(t,n,e,null==r?1:r)}function id(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function ad(t,n,e){return 255*(t<60?n+(e-n)*t/60:t<180?e:t<240?n+(e-n)*(240-t)/60:n)}zh(Rh,Xh,{displayable:function(){return this.rgb().displayable()},hex:function(){return this.rgb().hex()},toString:function(){return this.rgb()+""}}),zh(td,Kh,Th(Rh,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new td(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new td(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},hex:function(){return"#"+nd(this.r)+nd(this.g)+nd(this.b)},toString:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}})),zh(id,rd,Th(Rh,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new id(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new id(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),n=isNaN(t)||isNaN(this.s)?0:this.s,e=this.l,r=e+(e<.5?e:1-e)*n,i=2*e-r;return new td(ad(t>=240?t-240:t+120,i,r),ad(t,i,r),ad(t<120?t+240:t-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var ud=Math.PI/180,od=180/Math.PI,sd=.96422,ld=1,cd=.82521,fd=4/29,hd=6/29,dd=3*hd*hd,pd=hd*hd*hd;function gd(t){if(t instanceof md)return new md(t.l,t.a,t.b,t.opacity);if(t instanceof Ad){if(isNaN(t.h))return new md(t.l,0,0,t.opacity);var n=t.h*ud;return new md(t.l,Math.cos(n)*t.c,Math.sin(n)*t.c,t.opacity)}t instanceof td||(t=Qh(t));var e,r,i=bd(t.r),a=bd(t.g),u=bd(t.b),o=yd((.2225045*i+.7168786*a+.0606169*u)/ld);return i===a&&a===u?e=r=o:(e=yd((.4360747*i+.3850649*a+.1430804*u)/sd),r=yd((.0139322*i+.0971045*a+.7141733*u)/cd)),new md(116*o-16,500*(e-o),200*(o-r),t.opacity)}function vd(t,n,e,r){return 1===arguments.length?gd(t):new md(t,n,e,null==r?1:r)}function md(t,n,e,r){this.l=+t,this.a=+n,this.b=+e,this.opacity=+r}function yd(t){return t>pd?Math.pow(t,1/3):t/dd+fd}function _d(t){return t>hd?t*t*t:dd*(t-fd)}function xd(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function bd(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function wd(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Ad)return new Ad(t.h,t.c,t.l,t.opacity);if(t instanceof md||(t=gd(t)),0===t.a&&0===t.b)return new Ad(NaN,0,t.l,t.opacity);var n=Math.atan2(t.b,t.a)*od;return new Ad(n<0?n+360:n,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new Ad(t,n,e,null==r?1:r)}function Ad(t,n,e,r){this.h=+t,this.c=+n,this.l=+e,this.opacity=+r}zh(md,vd,Th(Rh,{brighter:function(t){return new md(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new md(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,n=isNaN(this.a)?t:t+this.a/500,e=isNaN(this.b)?t:t-this.b/200;return new td(xd(3.1338561*(n=sd*_d(n))-1.6168667*(t=ld*_d(t))-.4906146*(e=cd*_d(e))),xd(-.9787684*n+1.9161415*t+.033454*e),xd(.0719453*n-.2289914*t+1.4052427*e),this.opacity)}})),zh(Ad,wd,Th(Rh,{brighter:function(t){return new Ad(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new Ad(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return gd(this).rgb()}}));var Md=-.14861,kd=1.78277,Ed=-.29227,Cd=-.90649,Dd=1.97294,Fd=Dd*Cd,Sd=Dd*kd,Bd=kd*Ed-Cd*Md;function Nd(t,n,e,r){return 1===arguments.length?function(t){if(t instanceof Od)return new Od(t.h,t.s,t.l,t.opacity);t instanceof td||(t=Qh(t));var n=t.r/255,e=t.g/255,r=t.b/255,i=(Bd*r+Fd*n-Sd*e)/(Bd+Fd-Sd),a=r-i,u=(Dd*(e-i)-Ed*a)/Cd,o=Math.sqrt(u*u+a*a)/(Dd*i*(1-i)),s=o?Math.atan2(u,a)*od-120:NaN;return new Od(s<0?s+360:s,o,i,t.opacity)}(t):new Od(t,n,e,null==r?1:r)}function Od(t,n,e,r){this.h=+t,this.s=+n,this.l=+e,this.opacity=+r}function zd(t,n,e,r,i){var a=t*t,u=a*t;return((1-3*t+3*a-u)*n+(4-6*a+3*u)*e+(1+3*t+3*a-3*u)*r+u*i)/6}function Td(t){var n=t.length-1;return function(e){var r=e<=0?e=0:e>=1?(e=1,n-1):Math.floor(e*n),i=t[r],a=t[r+1],u=r>0?t[r-1]:2*i-a,o=r<n-1?t[r+2]:2*a-i;return zd((e-r/n)*n,u,i,a,o)}}function Rd(t){var n=t.length;return function(e){var r=Math.floor(((e%=1)<0?++e:e)*n),i=t[(r+n-1)%n],a=t[r%n],u=t[(r+1)%n],o=t[(r+2)%n];return zd((e-r/n)*n,i,a,u,o)}}function Pd(t){return function(){return t}}function Ld(t,n){return function(e){return t+e*n}}function qd(t,n){var e=n-t;return e?Ld(t,e>180||e<-180?e-360*Math.round(e/360):e):Pd(isNaN(t)?n:t)}function Ud(t){return 1==(t=+t)?jd:function(n,e){return e-n?function(t,n,e){return t=Math.pow(t,e),n=Math.pow(n,e)-t,e=1/e,function(r){return Math.pow(t+r*n,e)}}(n,e,t):Pd(isNaN(n)?e:n)}}function jd(t,n){var e=n-t;return e?Ld(t,e):Pd(isNaN(t)?n:t)}zh(Od,Nd,Th(Rh,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new Od(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new Od(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*ud,n=+this.l,e=isNaN(this.s)?0:this.s*n*(1-n),r=Math.cos(t),i=Math.sin(t);return new td(255*(n+e*(Md*r+kd*i)),255*(n+e*(Ed*r+Cd*i)),255*(n+e*(Dd*r)),this.opacity)}}));var Id=function t(n){var e=Ud(n);function r(t,n){var r=e((t=Kh(t)).r,(n=Kh(n)).r),i=e(t.g,n.g),a=e(t.b,n.b),u=jd(t.opacity,n.opacity);return function(n){return t.r=r(n),t.g=i(n),t.b=a(n),t.opacity=u(n),t+""}}return r.gamma=t,r}(1);function $d(t){return function(n){var e,r,i=n.length,a=new Array(i),u=new Array(i),o=new Array(i);for(e=0;e<i;++e)r=Kh(n[e]),a[e]=r.r||0,u[e]=r.g||0,o[e]=r.b||0;return a=t(a),u=t(u),o=t(o),r.opacity=1,function(t){return r.r=a(t),r.g=u(t),r.b=o(t),r+""}}}var Wd=$d(Td),Hd=$d(Rd);function Yd(t,n){var e,r=n?n.length:0,i=t?Math.min(r,t.length):0,a=new Array(i),u=new Array(r);for(e=0;e<i;++e)a[e]=Kd(t[e],n[e]);for(;e<r;++e)u[e]=n[e];return function(t){for(e=0;e<i;++e)u[e]=a[e](t);return u}}function Gd(t,n){var e=new Date;return n-=t=+t,function(r){return e.setTime(t+n*r),e}}function Vd(t,n){return n-=t=+t,function(e){return t+n*e}}function Xd(t,n){var e,r={},i={};for(e in null!==t&&"object"==typeof t||(t={}),null!==n&&"object"==typeof n||(n={}),n)e in t?r[e]=Kd(t[e],n[e]):i[e]=n[e];return function(t){for(e in r)i[e]=r[e](t);return i}}var Zd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jd=new RegExp(Zd.source,"g");function Qd(t,n){var e,r,i,a=Zd.lastIndex=Jd.lastIndex=0,u=-1,o=[],s=[];for(t+="",n+="";(e=Zd.exec(t))&&(r=Jd.exec(n));)(i=r.index)>a&&(i=n.slice(a,i),o[u]?o[u]+=i:o[++u]=i),(e=e[0])===(r=r[0])?o[u]?o[u]+=r:o[++u]=r:(o[++u]=null,s.push({i:u,x:Vd(e,r)})),a=Jd.lastIndex;return a<n.length&&(i=n.slice(a),o[u]?o[u]+=i:o[++u]=i),o.length<2?s[0]?function(t){return function(n){return t(n)+""}}(s[0].x):function(t){return function(){return t}}(n):(n=s.length,function(t){for(var e,r=0;r<n;++r)o[(e=s[r]).i]=e.x(t);return o.join("")})}function Kd(t,n){var e,r=typeof n;return null==n||"boolean"===r?Pd(n):("number"===r?Vd:"string"===r?(e=Xh(n))?(n=e,Id):Qd:n instanceof Xh?Id:n instanceof Date?Gd:Array.isArray(n)?Yd:"function"!=typeof n.valueOf&&"function"!=typeof n.toString||isNaN(n)?Xd:Vd)(t,n)}function tp(t,n){return n-=t=+t,function(e){return Math.round(t+n*e)}}var np,ep,rp,ip,ap=180/Math.PI,up={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function op(t,n,e,r,i,a){var u,o,s;return(u=Math.sqrt(t*t+n*n))&&(t/=u,n/=u),(s=t*e+n*r)&&(e-=t*s,r-=n*s),(o=Math.sqrt(e*e+r*r))&&(e/=o,r/=o,s/=o),t*r<n*e&&(t=-t,n=-n,s=-s,u=-u),{translateX:i,translateY:a,rotate:Math.atan2(n,t)*ap,skewX:Math.atan(s)*ap,scaleX:u,scaleY:o}}function sp(t,n,e,r){function i(t){return t.length?t.pop()+" ":""}return function(a,u){var o=[],s=[];return a=t(a),u=t(u),function(t,r,i,a,u,o){if(t!==i||r!==a){var s=u.push("translate(",null,n,null,e);o.push({i:s-4,x:Vd(t,i)},{i:s-2,x:Vd(r,a)})}else(i||a)&&u.push("translate("+i+n+a+e)}(a.translateX,a.translateY,u.translateX,u.translateY,o,s),function(t,n,e,a){t!==n?(t-n>180?n+=360:n-t>180&&(t+=360),a.push({i:e.push(i(e)+"rotate(",null,r)-2,x:Vd(t,n)})):n&&e.push(i(e)+"rotate("+n+r)}(a.rotate,u.rotate,o,s),function(t,n,e,a){t!==n?a.push({i:e.push(i(e)+"skewX(",null,r)-2,x:Vd(t,n)}):n&&e.push(i(e)+"skewX("+n+r)}(a.skewX,u.skewX,o,s),function(t,n,e,r,a,u){if(t!==e||n!==r){var o=a.push(i(a)+"scale(",null,",",null,")");u.push({i:o-4,x:Vd(t,e)},{i:o-2,x:Vd(n,r)})}else 1===e&&1===r||a.push(i(a)+"scale("+e+","+r+")")}(a.scaleX,a.scaleY,u.scaleX,u.scaleY,o,s),a=u=null,function(t){for(var n,e=-1,r=s.length;++e<r;)o[(n=s[e]).i]=n.x(t);return o.join("")}}}var lp=sp(function(t){return"none"===t?up:(np||(np=document.createElement("DIV"),ep=document.documentElement,rp=document.defaultView),np.style.transform=t,t=rp.getComputedStyle(ep.appendChild(np),null).getPropertyValue("transform"),ep.removeChild(np),op(+(t=t.slice(7,-1).split(","))[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),cp=sp(function(t){return null==t?up:(ip||(ip=document.createElementNS("http://www.w3.org/2000/svg","g")),ip.setAttribute("transform",t),(t=ip.transform.baseVal.consolidate())?op((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):up)},", ",")",")"),fp=Math.SQRT2,hp=2,dp=4,pp=1e-12;function gp(t){return((t=Math.exp(t))+1/t)/2}function vp(t){return function(n,e){var r=t((n=rd(n)).h,(e=rd(e)).h),i=jd(n.s,e.s),a=jd(n.l,e.l),u=jd(n.opacity,e.opacity);return function(t){return n.h=r(t),n.s=i(t),n.l=a(t),n.opacity=u(t),n+""}}}var mp=vp(qd),yp=vp(jd);function _p(t){return function(n,e){var r=t((n=wd(n)).h,(e=wd(e)).h),i=jd(n.c,e.c),a=jd(n.l,e.l),u=jd(n.opacity,e.opacity);return function(t){return n.h=r(t),n.c=i(t),n.l=a(t),n.opacity=u(t),n+""}}}var xp=_p(qd),bp=_p(jd);function wp(t){return function n(e){function r(n,r){var i=t((n=Nd(n)).h,(r=Nd(r)).h),a=jd(n.s,r.s),u=jd(n.l,r.l),o=jd(n.opacity,r.opacity);return function(t){return n.h=i(t),n.s=a(t),n.l=u(Math.pow(t,e)),n.opacity=o(t),n+""}}return e=+e,r.gamma=n,r}(1)}var Ap=wp(qd),Mp=wp(jd);function kp(t,n){for(var e=0,r=n.length-1,i=n[0],a=new Array(r<0?0:r);e<r;)a[e]=t(i,i=n[++e]);return function(t){var n=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return a[n](t-n)}}var Ep=Object.freeze({interpolate:Kd,interpolateArray:Yd,interpolateBasis:Td,interpolateBasisClosed:Rd,interpolateDate:Gd,interpolateDiscrete:function(t){var n=t.length;return function(e){return t[Math.max(0,Math.min(n-1,Math.floor(e*n)))]}},interpolateHue:function(t,n){var e=qd(+t,+n);return function(t){var n=e(t);return n-360*Math.floor(n/360)}},interpolateNumber:Vd,interpolateObject:Xd,interpolateRound:tp,interpolateString:Qd,interpolateTransformCss:lp,interpolateTransformSvg:cp,interpolateZoom:function(t,n){var e,r,i=t[0],a=t[1],u=t[2],o=n[0],s=n[1],l=n[2],c=o-i,f=s-a,h=c*c+f*f;if(h<pp)r=Math.log(l/u)/fp,e=function(t){return[i+t*c,a+t*f,u*Math.exp(fp*t*r)]};else{var d=Math.sqrt(h),p=(l*l-u*u+dp*h)/(2*u*hp*d),g=(l*l-u*u-dp*h)/(2*l*hp*d),v=Math.log(Math.sqrt(p*p+1)-p),m=Math.log(Math.sqrt(g*g+1)-g);r=(m-v)/fp,e=function(t){var n,e=t*r,o=gp(v),s=u/(hp*d)*(o*(n=fp*e+v,((n=Math.exp(2*n))-1)/(n+1))-function(t){return((t=Math.exp(t))-1/t)/2}(v));return[i+s*c,a+s*f,u*o/gp(fp*e+v)]}}return e.duration=1e3*r,e},interpolateRgb:Id,interpolateRgbBasis:Wd,interpolateRgbBasisClosed:Hd,interpolateHsl:mp,interpolateHslLong:yp,interpolateLab:function(t,n){var e=jd((t=vd(t)).l,(n=vd(n)).l),r=jd(t.a,n.a),i=jd(t.b,n.b),a=jd(t.opacity,n.opacity);return function(n){return t.l=e(n),t.a=r(n),t.b=i(n),t.opacity=a(n),t+""}},interpolateHcl:xp,interpolateHclLong:bp,interpolateCubehelix:Ap,interpolateCubehelixLong:Mp,piecewise:kp,quantize:function(t,n){for(var e=new Array(n),r=0;r<n;++r)e[r]=t(r/(n-1));return e}});function Cp(t){return+t}var Dp=[0,1];function Fp(t){return t}function Sp(t,n){return(n-=t=+t)?function(e){return(e-t)/n}:(e=isNaN(n)?NaN:.5,function(){return e});var e}function Bp(t){var n,e=t[0],r=t[t.length-1];return e>r&&(n=e,e=r,r=n),function(t){return Math.max(e,Math.min(r,t))}}function Np(t,n,e){var r=t[0],i=t[1],a=n[0],u=n[1];return i<r?(r=Sp(i,r),a=e(u,a)):(r=Sp(r,i),a=e(a,u)),function(t){return a(r(t))}}function Op(t,n,e){var r=Math.min(t.length,n.length)-1,i=new Array(r),a=new Array(r),u=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),n=n.slice().reverse());++u<r;)i[u]=Sp(t[u],t[u+1]),a[u]=e(n[u],n[u+1]);return function(n){var e=ph(t,n,1,r)-1;return a[e](i[e](n))}}function zp(t,n){return n.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Tp(){var t,n,e,r,i,a,u=Dp,o=Dp,s=Kd,l=Fp;function c(){return r=Math.min(u.length,o.length)>2?Op:Np,i=a=null,f}function f(n){return isNaN(n=+n)?e:(i||(i=r(u.map(t),o,s)))(t(l(n)))}return f.invert=function(e){return l(n((a||(a=r(o,u.map(t),Vd)))(e)))},f.domain=function(t){return arguments.length?(u=Sh.call(t,Cp),l===Fp||(l=Bp(u)),c()):u.slice()},f.range=function(t){return arguments.length?(o=Bh.call(t),c()):o.slice()},f.rangeRound=function(t){return o=Bh.call(t),s=tp,c()},f.clamp=function(t){return arguments.length?(l=t?Bp(u):Fp,f):l!==Fp},f.interpolate=function(t){return arguments.length?(s=t,c()):s},f.unknown=function(t){return arguments.length?(e=t,f):e},function(e,r){return t=e,n=r,c()}}function Rp(t,n){return Tp()(t,n)}function Pp(t,n){if((e=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var e,r=t.slice(0,e);return[r.length>1?r[0]+r.slice(2):r,+t.slice(e+1)]}function Lp(t){return(t=Pp(Math.abs(t)))?t[1]:NaN}var qp,Up=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function jp(t){return new Ip(t)}function Ip(t){if(!(n=Up.exec(t)))throw new Error("invalid format: "+t);var n;this.fill=n[1]||" ",this.align=n[2]||">",this.sign=n[3]||"-",this.symbol=n[4]||"",this.zero=!!n[5],this.width=n[6]&&+n[6],this.comma=!!n[7],this.precision=n[8]&&+n[8].slice(1),this.trim=!!n[9],this.type=n[10]||""}function $p(t,n){var e=Pp(t,n);if(!e)return t+"";var r=e[0],i=e[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}jp.prototype=Ip.prototype,Ip.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var Wp={"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return $p(100*t,n)},r:$p,s:function(t,n){var e=Pp(t,n);if(!e)return t+"";var r=e[0],i=e[1],a=i-(qp=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,u=r.length;return a===u?r:a>u?r+new Array(a-u+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+Pp(t,Math.max(0,n+a-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function Hp(t){return t}var Yp,Gp,Vp,Xp=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Zp(t){var n,e,r=t.grouping&&t.thousands?(n=t.grouping,e=t.thousands,function(t,r){for(var i=t.length,a=[],u=0,o=n[0],s=0;i>0&&o>0&&(s+o+1>r&&(o=Math.max(1,r-s)),a.push(t.substring(i-=o,i+o)),!((s+=o+1)>r));)o=n[u=(u+1)%n.length];return a.reverse().join(e)}):Hp,i=t.currency,a=t.decimal,u=t.numerals?function(t){return function(n){return n.replace(/[0-9]/g,function(n){return t[+n]})}}(t.numerals):Hp,o=t.percent||"%";function s(t){var n=(t=jp(t)).fill,e=t.align,s=t.sign,l=t.symbol,c=t.zero,f=t.width,h=t.comma,d=t.precision,p=t.trim,g=t.type;"n"===g?(h=!0,g="g"):Wp[g]||(null==d&&(d=12),p=!0,g="g"),(c||"0"===n&&"="===e)&&(c=!0,n="0",e="=");var v="$"===l?i[0]:"#"===l&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",m="$"===l?i[1]:/[%p]/.test(g)?o:"",y=Wp[g],_=/[defgprs%]/.test(g);function x(t){var i,o,l,x=v,b=m;if("c"===g)b=y(t)+b,t="";else{var w=(t=+t)<0;if(t=y(Math.abs(t),d),p&&(t=function(t){t:for(var n,e=t.length,r=1,i=-1;r<e;++r)switch(t[r]){case".":i=n=r;break;case"0":0===i&&(i=r),n=r;break;default:if(i>0){if(!+t[r])break t;i=0}}return i>0?t.slice(0,i)+t.slice(n+1):t}(t)),w&&0==+t&&(w=!1),x=(w?"("===s?s:"-":"-"===s||"("===s?"":s)+x,b=("s"===g?Xp[8+qp/3]:"")+b+(w&&"("===s?")":""),_)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){b=(46===l?a+t.slice(i+1):t.slice(i))+b,t=t.slice(0,i);break}}h&&!c&&(t=r(t,1/0));var A=x.length+t.length+b.length,M=A<f?new Array(f-A+1).join(n):"";switch(h&&c&&(t=r(M+t,M.length?f-b.length:1/0),M=""),e){case"<":t=x+t+b+M;break;case"=":t=x+M+t+b;break;case"^":t=M.slice(0,A=M.length>>1)+x+t+b+M.slice(A);break;default:t=M+x+t+b}return u(t)}return d=null==d?6:/[gprs]/.test(g)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),x.toString=function(){return t+""},x}return{format:s,formatPrefix:function(t,n){var e=s(((t=jp(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Lp(n)/3))),i=Math.pow(10,-r),a=Xp[8+r/3];return function(t){return e(i*t)+a}}}}function Jp(t){return Yp=Zp(t),Gp=Yp.format,Vp=Yp.formatPrefix,Yp}function Qp(t,n,e,r){var i,a=bh(t,n,e);switch((r=jp(null==r?",f":r)).type){case"s":var u=Math.max(Math.abs(t),Math.abs(n));return null!=r.precision||isNaN(i=function(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Lp(n)/3)))-Lp(Math.abs(t)))}(a,u))||(r.precision=i),Vp(r,u);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=function(t,n){return t=Math.abs(t),n=Math.abs(n)-t,Math.max(0,Lp(n)-Lp(t))+1}(a,Math.max(Math.abs(t),Math.abs(n))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=function(t){return Math.max(0,-Lp(Math.abs(t)))}(a))||(r.precision=i-2*("%"===r.type))}return Gp(r)}function Kp(t){var n=t.domain;return t.ticks=function(t){var e=n();return _h(e[0],e[e.length-1],null==t?10:t)},t.tickFormat=function(t,e){var r=n();return Qp(r[0],r[r.length-1],null==t?10:t,e)},t.nice=function(e){null==e&&(e=10);var r,i=n(),a=0,u=i.length-1,o=i[a],s=i[u];return s<o&&(r=o,o=s,s=r,r=a,a=u,u=r),(r=xh(o,s,e))>0?r=xh(o=Math.floor(o/r)*r,s=Math.ceil(s/r)*r,e):r<0&&(r=xh(o=Math.ceil(o*r)/r,s=Math.floor(s*r)/r,e)),r>0?(i[a]=Math.floor(o/r)*r,i[u]=Math.ceil(s/r)*r,n(i)):r<0&&(i[a]=Math.ceil(o*r)/r,i[u]=Math.floor(s*r)/r,n(i)),t},t}function tg(t,n){var e,r=0,i=(t=t.slice()).length-1,a=t[r],u=t[i];return u<a&&(e=r,r=i,i=e,e=a,a=u,u=e),t[r]=n.floor(a),t[i]=n.ceil(u),t}function ng(t){return Math.log(t)}function eg(t){return Math.exp(t)}function rg(t){return-Math.log(-t)}function ig(t){return-Math.exp(-t)}function ag(t){return isFinite(t)?+("1e"+t):t<0?0:t}function ug(t){return function(n){return-t(-n)}}function og(t){var n,e,r=t(ng,eg),i=r.domain,a=10;function u(){return n=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),function(n){return Math.log(n)/t})}(a),e=function(t){return 10===t?ag:t===Math.E?Math.exp:function(n){return Math.pow(t,n)}}(a),i()[0]<0?(n=ug(n),e=ug(e),t(rg,ig)):t(ng,eg),r}return r.base=function(t){return arguments.length?(a=+t,u()):a},r.domain=function(t){return arguments.length?(i(t),u()):i()},r.ticks=function(t){var r,u=i(),o=u[0],s=u[u.length-1];(r=s<o)&&(h=o,o=s,s=h);var l,c,f,h=n(o),d=n(s),p=null==t?10:+t,g=[];if(!(a%1)&&d-h<p){if(h=Math.round(h)-1,d=Math.round(d)+1,o>0){for(;h<d;++h)for(c=1,l=e(h);c<a;++c)if(!((f=l*c)<o)){if(f>s)break;g.push(f)}}else for(;h<d;++h)for(c=a-1,l=e(h);c>=1;--c)if(!((f=l*c)<o)){if(f>s)break;g.push(f)}}else g=_h(h,d,Math.min(d-h,p)).map(e);return r?g.reverse():g},r.tickFormat=function(t,i){if(null==i&&(i=10===a?".0e":","),"function"!=typeof i&&(i=Gp(i)),t===1/0)return i;null==t&&(t=10);var u=Math.max(1,a*t/r.ticks().length);return function(t){var r=t/e(Math.round(n(t)));return r*a<a-.5&&(r*=a),r<=u?i(t):""}},r.nice=function(){return i(tg(i(),{floor:function(t){return e(Math.floor(n(t)))},ceil:function(t){return e(Math.ceil(n(t)))}}))},r}function sg(t){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/t))}}function lg(t){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*t}}function cg(t){var n=1,e=t(sg(n),lg(n));return e.constant=function(e){return arguments.length?t(sg(n=+e),lg(n)):n},Kp(e)}function fg(t){return function(n){return n<0?-Math.pow(-n,t):Math.pow(n,t)}}function hg(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function dg(t){return t<0?-t*t:t*t}function pg(t){var n=t(Fp,Fp),e=1;return n.exponent=function(n){return arguments.length?1===(e=+n)?t(Fp,Fp):.5===e?t(hg,dg):t(fg(e),fg(1/e)):e},Kp(n)}function gg(){var t=pg(Tp());return t.copy=function(){return zp(t,gg()).exponent(t.exponent())},Ah.apply(t,arguments),t}Jp({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var vg=1e3,mg=60*vg,yg=60*mg,_g=24*yg,xg=7*_g,bg=30*_g,wg=365*_g;function Ag(t){return new Date(t)}function Mg(t){return t instanceof Date?+t:+new Date(+t)}function kg(t,n,e,r,i,a,u,o,s){var l=Rp(Fp,Fp),c=l.invert,f=l.domain,h=s(".%L"),d=s(":%S"),p=s("%I:%M"),g=s("%I %p"),v=s("%a %d"),m=s("%b %d"),y=s("%B"),_=s("%Y"),x=[[u,1,vg],[u,5,5*vg],[u,15,15*vg],[u,30,30*vg],[a,1,mg],[a,5,5*mg],[a,15,15*mg],[a,30,30*mg],[i,1,yg],[i,3,3*yg],[i,6,6*yg],[i,12,12*yg],[r,1,_g],[r,2,2*_g],[e,1,xg],[n,1,bg],[n,3,3*bg],[t,1,wg]];function b(o){return(u(o)<o?h:a(o)<o?d:i(o)<o?p:r(o)<o?g:n(o)<o?e(o)<o?v:m:t(o)<o?y:_)(o)}function w(n,e,r,i){if(null==n&&(n=10),"number"==typeof n){var a=Math.abs(r-e)/n,u=dh(function(t){return t[2]}).right(x,a);u===x.length?(i=bh(e/wg,r/wg,n),n=t):u?(i=(u=x[a/x[u-1][2]<x[u][2]/a?u-1:u])[1],n=u[0]):(i=Math.max(bh(e,r,n),1),n=o)}return null==i?n:n.every(i)}return l.invert=function(t){return new Date(c(t))},l.domain=function(t){return arguments.length?f(Sh.call(t,Mg)):f().map(Ag)},l.ticks=function(t,n){var e,r=f(),i=r[0],a=r[r.length-1],u=a<i;return u&&(e=i,i=a,a=e),e=(e=w(t,i,a,n))?e.range(i,a+1):[],u?e.reverse():e},l.tickFormat=function(t,n){return null==n?b:s(n)},l.nice=function(t,n){var e=f();return(t=w(t,e[0],e[e.length-1],n))?f(tg(e,t)):l},l.copy=function(){return zp(l,kg(t,n,e,r,i,a,u,o,s))},l}function Eg(){var t,n,e,r,i,a=0,u=1,o=Fp,s=!1;function l(n){return isNaN(n=+n)?i:o(0===e?.5:(n=(r(n)-t)*e,s?Math.max(0,Math.min(1,n)):n))}return l.domain=function(i){return arguments.length?(t=r(a=+i[0]),n=r(u=+i[1]),e=t===n?0:1/(n-t),l):[a,u]},l.clamp=function(t){return arguments.length?(s=!!t,l):s},l.interpolator=function(t){return arguments.length?(o=t,l):o},l.unknown=function(t){return arguments.length?(i=t,l):i},function(i){return r=i,t=i(a),n=i(u),e=t===n?0:1/(n-t),l}}function Cg(t,n){return n.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Dg(){var t=Kp(Eg()(Fp));return t.copy=function(){return Cg(t,Dg())},Mh.apply(t,arguments)}function Fg(){var t=pg(Eg());return t.copy=function(){return Cg(t,Fg()).exponent(t.exponent())},Mh.apply(t,arguments)}function Sg(){var t,n,e,r,i,a,u,o=0,s=.5,l=1,c=Fp,f=!1;function h(t){return isNaN(t=+t)?u:(t=.5+((t=+a(t))-n)*(t<n?r:i),c(f?Math.max(0,Math.min(1,t)):t))}return h.domain=function(u){return arguments.length?(t=a(o=+u[0]),n=a(s=+u[1]),e=a(l=+u[2]),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),h):[o,s,l]},h.clamp=function(t){return arguments.length?(f=!!t,h):f},h.interpolator=function(t){return arguments.length?(c=t,h):c},h.unknown=function(t){return arguments.length?(u=t,h):u},function(u){return a=u,t=u(o),n=u(s),e=u(l),r=t===n?0:.5/(n-t),i=n===e?0:.5/(e-n),h}}function Bg(){var t=pg(Sg());return t.copy=function(){return Cg(t,Bg()).exponent(t.exponent())},Mh.apply(t,arguments)}function Ng(){var t,n,e=Oh().unknown(void 0),r=e.domain,i=e.range,a=[0,1],u=!1,o=0,s=0,l=.5;function c(){var e=r().length,c=a[1]<a[0],f=a[c-0],h=a[1-c],d=Lf(e,o,s);t=(h-f)/(d||1),u&&(t=Math.floor(t)),f+=(h-f-t*(e-o))*l,n=t*(1-o),u&&(f=Math.round(f),n=Math.round(n));var p=ci(e).map(function(n){return f+t*n});return i(c?p.reverse():p)}return delete e.unknown,e.domain=function(t){return arguments.length?(r(t),c()):r()},e.range=function(t){return arguments.length?(a=[+t[0],+t[1]],c()):a.slice()},e.rangeRound=function(t){return a=[+t[0],+t[1]],u=!0,c()},e.bandwidth=function(){return n},e.step=function(){return t},e.round=function(t){return arguments.length?(u=!!t,c()):u},e.padding=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),o=s,c()):o},e.paddingInner=function(t){return arguments.length?(o=Math.max(0,Math.min(1,t)),c()):o},e.paddingOuter=function(t){return arguments.length?(s=Math.max(0,Math.min(1,t)),c()):s},e.align=function(t){return arguments.length?(l=Math.max(0,Math.min(1,t)),c()):l},e.invertRange=function(t){if(null!=t[0]&&null!=t[1]){var e,u,o,s=+t[0],l=+t[1],c=a[1]<a[0],f=c?i().reverse():i(),h=f.length-1;if(s==s&&l==l&&(l<s&&(o=s,s=l,l=o),!(l<f[0]||s>a[1-c])))return e=Math.max(0,oi(f,s)-1),u=s===l?e:oi(f,l)-1,s-f[e]>n+1e-10&&++e,c&&(o=e,e=h-u,u=h-o),e>u?void 0:r().slice(e,u+1)}},e.invert=function(t){var n=e.invertRange([t,t]);return n?n[0]:n},e.copy=function(){return Ng().domain(r()).range(a).round(u).paddingInner(o).paddingOuter(s).align(l)},c()}var Og=Array.prototype.map;var zg=Array.prototype.slice;function Tg(t,n){return arguments.length>1?(Rg[t]=function(t,n){return function(){var e=n();return e.invertRange||(e.invertRange=e.invert?function(t){return function(n){var e,r=n[0],i=n[1];return i<r&&(e=r,r=i,i=e),[t.invert(r),t.invert(i)]}}(e):e.invertExtent?function(t){return function(n){var e,r,i,a,u=t.range(),o=n[0],s=n[1],l=-1;for(s<o&&(r=o,o=s,s=r),i=0,a=u.length;i<a;++i)u[i]>=o&&u[i]<=s&&(l<0&&(l=i),e=i);if(!(l<0))return o=t.invertExtent(u[l]),s=t.invertExtent(u[e]),[void 0===o[0]?o[1]:o[0],void 0===s[1]?s[0]:s[1]]}}(e):void 0),e.type=t,e}}(t,n),this):Rg.hasOwnProperty(t)?Rg[t]:void 0}var Rg={[qf]:function t(n){var e;function r(t){return isNaN(t=+t)?e:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(n=Sh.call(t,Cp),r):n.slice()},r.unknown=function(t){return arguments.length?(e=t,r):e},r.copy=function(){return t(n).unknown(e)},n=arguments.length?Sh.call(n,Cp):[0,1],Kp(r)},[Uf]:function t(){var n=Rp(Fp,Fp);return n.copy=function(){return zp(n,t())},Ah.apply(n,arguments),Kp(n)},[jf]:function t(){var n=og(Tp()).domain([1,10]);return n.copy=function(){return zp(n,t()).base(n.base())},Ah.apply(n,arguments),n},[If]:gg,[$f]:function(){return gg.apply(null,arguments).exponent(.5)},[Wf]:function t(){var n=cg(Tp());return n.copy=function(){return zp(n,t()).constant(n.constant())},Ah.apply(n,arguments)},[Hf]:function(){return Ah.apply(kg(Wn,$n,Un,Ln,Pn,Rn,Tn,Nn,ie).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)},[Yf]:function(){return Ah.apply(kg(Kn,Qn,Xn,Gn,Yn,Hn,Tn,Nn,ue).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},[Gf]:Dg,[Gf+"-"+Uf]:Dg,[Gf+"-"+jf]:function t(){var n=og(Eg()).domain([1,10]);return n.copy=function(){return Cg(n,t()).base(n.base())},Mh.apply(n,arguments)},[Gf+"-"+If]:Fg,[Gf+"-"+$f]:function(){return Fg.apply(null,arguments).exponent(.5)},[Gf+"-"+Wf]:function t(){var n=cg(Eg());return n.copy=function(){return Cg(n,t()).constant(n.constant())},Mh.apply(n,arguments)},[Vf+"-"+Uf]:function t(){var n=Kp(Sg()(Fp));return n.copy=function(){return Cg(n,t())},Mh.apply(n,arguments)},[Vf+"-"+jf]:function t(){var n=og(Sg()).domain([.1,1,10]);return n.copy=function(){return Cg(n,t()).base(n.base())},Mh.apply(n,arguments)},[Vf+"-"+If]:Bg,[Vf+"-"+$f]:function(){return Bg.apply(null,arguments).exponent(.5)},[Vf+"-"+Wf]:function t(){var n=cg(Sg());return n.copy=function(){return Cg(n,t()).constant(n.constant())},Mh.apply(n,arguments)},[Xf]:function t(){var n,e=[],r=[],i=[];function a(){var t=0,n=Math.max(1,r.length);for(i=new Array(n-1);++t<n;)i[t-1]=wh(e,t/n);return u}function u(t){return isNaN(t=+t)?n:r[ph(i,t)]}return u.invertExtent=function(t){var n=r.indexOf(t);return n<0?[NaN,NaN]:[n>0?i[n-1]:e[0],n<i.length?i[n]:e[e.length-1]]},u.domain=function(t){if(!arguments.length)return e.slice();e=[];for(var n,r=0,i=t.length;r<i;++r)null==(n=t[r])||isNaN(n=+n)||e.push(n);return e.sort(hh),a()},u.range=function(t){return arguments.length?(r=Bh.call(t),a()):r.slice()},u.unknown=function(t){return arguments.length?(n=t,u):n},u.quantiles=function(){return i.slice()},u.copy=function(){return t().domain(e).range(r).unknown(n)},Ah.apply(u,arguments)},[Zf]:function t(){var n,e=0,r=1,i=1,a=[.5],u=[0,1];function o(t){return t<=t?u[ph(a,t,0,i)]:n}function s(){var t=-1;for(a=new Array(i);++t<i;)a[t]=((t+1)*r-(t-i)*e)/(i+1);return o}return o.domain=function(t){return arguments.length?(e=+t[0],r=+t[1],s()):[e,r]},o.range=function(t){return arguments.length?(i=(u=Bh.call(t)).length-1,s()):u.slice()},o.invertExtent=function(t){var n=u.indexOf(t);return n<0?[NaN,NaN]:n<1?[e,a[0]]:n>=i?[a[i-1],r]:[a[n-1],a[n]]},o.unknown=function(t){return arguments.length?(n=t,o):o},o.thresholds=function(){return a.slice()},o.copy=function(){return t().domain([e,r]).range(u).unknown(n)},Ah.apply(Kp(o),arguments)},[Jf]:function t(){var n,e=[.5],r=[0,1],i=1;function a(t){return t<=t?r[ph(e,t,0,i)]:n}return a.domain=function(t){return arguments.length?(e=Bh.call(t),i=Math.min(e.length,r.length-1),a):e.slice()},a.range=function(t){return arguments.length?(r=Bh.call(t),i=Math.min(e.length,r.length-1),a):r.slice()},a.invertExtent=function(t){var n=r.indexOf(t);return[e[n-1],e[n]]},a.unknown=function(t){return arguments.length?(n=t,a):n},a.copy=function(){return t().domain(e).range(r).unknown(n)},Ah.apply(a,arguments)},[nh]:function t(){var n=[],e=[];function r(t){return null==t||t!=t?void 0:e[(oi(n,t)-1)%e.length]}return r.domain=function(t){return arguments.length?(n=function(t){return Og.call(t,function(t){return+t})}(t),r):n.slice()},r.range=function(t){return arguments.length?(e=zg.call(t),r):e.slice()},r.tickFormat=function(t,e){return Qp(n[0],k(n),null==t?10:t,e)},r.copy=function(){return t().domain(r.domain()).range(r.range())},r},[Qf]:Oh,[th]:Ng,[Kf]:function(){return function t(n){var e=n.copy;return n.padding=n.paddingOuter,delete n.paddingInner,n.copy=function(){return t(e())},n}(Ng().paddingInner(1))}};for(var Pg in Rg)Tg(Pg,Rg[Pg]);const Lg=["clamp","base","constant","exponent"];function qg(t,n){var e=n[0],r=k(n)-e;return function(n){return t(e+n*r)}}function Ug(t,n,e){return kp($g(n||"rgb",e),t)}function jg(t,n){for(var e=new Array(n),r=n+1,i=0;i<n;)e[i]=t(++i/r);return e}function Ig(t,n,e){var r,i,a,u=e-n;return u&&isFinite(u)?(r=(i=t.type).indexOf("-"),i=r<0?i:i.slice(r+1),a=Tg(i)().domain([n,e]).range([0,1]),Lg.forEach(n=>t[n]?a[n](t[n]()):0),a):V(.5)}function $g(t,n){var e=Ep[function(t){return"interpolate"+t.toLowerCase().split("-").map(function(t){return t[0].toUpperCase()+t.slice(1)}).join("")}(t)];return null!=n&&e&&e.gamma?e.gamma(n):e}function Wg(t){for(var n=t.length/6|0,e=new Array(n),r=0;r<n;)e[r]="#"+t.slice(6*r,6*++r);return e}function Hg(t,n){for(let e in t)Gg(e,n(t[e]))}const Yg={};function Gg(t,n){return t=t&&t.toLowerCase(),arguments.length>1?(Yg[t]=n,this):Yg[t]}function Vg(t,n,e){var r;return ut(n)&&null!=e&&(n=Math.min(n,~~(ht(t.domain())/e)||1)),o(n)&&(r=n.step,n=n.interval),s(n)&&(n=fh(n,t.type)||i("Only time and utc scales accept interval strings."),r&&(n=n.every(r))),n}function Xg(t,n,e){var r=t.range(),i=Math.floor(r[0]),a=Math.ceil(k(r));if(i>a&&(r=a,a=i,i=r),n=n.filter(function(n){return n=t(n),i<=n&&n<=a}),e>0&&n.length>1){for(var u=[n[0],k(n)];n.length>e&&n.length>=3;)n=n.filter(function(t,n){return!(n%2)});n.length<3&&(n=u)}return n}function Zg(t,n){return t.bins?Xg(t,function(t,n){var e=t.length,r=~~(e/(n||e));return r<2?t.slice():t.filter(function(t,n){return!(n%r)})}(t.bins,n)):t.ticks?t.ticks(n):t.domain()}function Jg(t,n,e){var r,i,a=t.tickFormat?t.tickFormat(n,e):e?Gp(e):String;if(ah(t.type)){var u=function(t){var n=jp(t||",");if(null==n.precision){switch(n.precision=12,n.type){case"%":n.precision-=2;break;case"e":n.precision-=1}return e=Gp(n),r=Gp(".1f")(1)[1],function(t){var n,i,a=e(t),u=a.indexOf(r);if(u<0)return a;for(n=function(t,n){var e,r=t.lastIndexOf("e");if(r>0)return r;for(r=t.length;--r>n;)if((e=t.charCodeAt(r))>=48&&e<=57)return r+1}(a,u),i=n<a.length?a.slice(n):"";--n>u;)if("0"!==a[n]){++n;break}return a.slice(0,n)+i}}return Gp(n);var e,r}(e);a=t.bins?u:(r=a,i=u,function(t){return r(t)?i(t):""})}return a}function Qg(t){Ir.call(this,null,t)}function Kg(t){Ir.call(this,null,t)}function tv(){return Ct({})}function nv(t){return t.exit}function ev(t){Ir.call(this,null,t)}Hg({category10:"1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf",category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5",accent:"7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666",dark2:"1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666",paired:"a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928",pastel1:"fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2",pastel2:"b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc",set1:"e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999",set2:"66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3",set3:"8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"},Wg),Hg({blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},t=>Ug(Wg(t))),et(Qg,Ir).transform=function(t,n){if(this.value&&!t.modified())return n.StopPropagation;var e=n.fork(n.NO_SOURCE|n.NO_FIELDS),r=this.value,i=t.scale,a=Vg(i,null==t.count?t.values?t.values.length:10:t.count,t.minstep),u=t.format||Jg(i,a,t.formatSpecifier),o=t.values?Xg(i,t.values,a):Zg(i,a);return r&&(e.rem=r),r=o.map(function(t,n){return Ct({index:n/(o.length-1),value:t,label:u(t)})}),t.extra&&r.length&&r.push(Ct({index:-1,extra:{value:r[0].value},label:""})),e.source=r,e.add=r,this.value=r,e},et(Kg,Ir).transform=function(t,n){var e=n.dataflow,r=n.fork(n.NO_SOURCE|n.NO_FIELDS),a=t.item||tv,o=t.key||kt,s=this.value;return u(r.encode)&&(r.encode=null),s&&(t.modified("key")||n.modified(o))&&i("DataJoin does not support modified key function or fields."),s||(n=n.addAll(),this.value=s=tt().test(nv),s.lookup=function(t){return s.get(o(t))}),n.visit(n.ADD,function(t){var n=o(t),e=s.get(n);e?e.exit?(s.empty--,r.add.push(e)):r.mod.push(e):(s.set(n,e=a(t)),r.add.push(e)),e.datum=t,e.exit=!1}),n.visit(n.MOD,function(t){var n=o(t),e=s.get(n);e&&(e.datum=t,r.mod.push(e))}),n.visit(n.REM,function(t){var n=o(t),e=s.get(n);t!==e.datum||e.exit||(r.rem.push(e),e.exit=!0,++s.empty)}),n.changed(n.ADD_MOD)&&r.modifies("datum"),t.clean&&s.empty>e.cleanThreshold&&e.runAfter(s.clean),r},et(ev,Ir).transform=function(t,n){var e=n.fork(n.ADD_REM),r=t.encoders,i=n.encode;if(u(i)){if(!e.changed()&&!i.every(function(t){return r[t]}))return n.StopPropagation;i=i[0],e.encode=null}var a="enter"===i,o=r.update||m,s=r.enter||m,l=r.exit||m,c=(i&&!a?r[i]:o)||m;if(n.changed(n.ADD)&&(n.visit(n.ADD,function(n){s(n,t),o(n,t),c!==m&&c!==o&&c(n,t)}),e.modifies(s.output),e.modifies(o.output),c!==m&&c!==o&&e.modifies(c.output)),n.changed(n.REM)&&l!==m&&(n.visit(n.REM,function(n){l(n,t)}),e.modifies(l.output)),a||c!==m){var f=n.MOD|(t.modified()?n.REFLOW:0);a?(n.visit(f,function(n){var r=s(n,t);(c(n,t)||r)&&e.mod.push(n)}),e.mod.length&&e.modifies(s.output)):n.visit(f,function(n){c(n,t)&&e.mod.push(n)}),e.mod.length&&e.modifies(c.output)}return e.changed()?e:n.StopPropagation};var rv="symbol",iv="discrete";const av={[Xf]:function(t){var n=[-1/0].concat(t.quantiles());return n.max=1/0,n},[Zf]:function(t){var n=t.domain(),e=n[0],r=k(n),i=t.range().length,a=new Array(i),u=0;a[0]=-1/0;for(;++u<i;)a[u]=(u*r-(u-i)*e)/i;return a.max=1/0,a},[Jf]:function(t){var n=[-1/0].concat(t.domain());return n.max=1/0,n}};function uv(t,n,e){return e===rv&&function(t){return av[t.type]||t.bins}(t)?function(t){return function(n,e,r){var i=r[e+1]||r.max||1/0,a=ov(n,t),u=ov(i,t);return a&&u?a+"–"+u:u?"< "+u:"≥ "+a}}(n):e===iv?function(t){return function(n,e){return e?t(n):null}}(n):function(t){return function(n){return t(n)}}(n)}function ov(t,n){return isFinite(t)?n(t):null}function sv(t){Ir.call(this,[],t)}et(sv,Ir).transform=function(t,n){if(null!=this.value&&!t.modified())return n.StopPropagation;var e,r,i,a,u=n.fork(n.NO_SOURCE|n.NO_FIELDS),o=this.value,s=t.type||rv,l=t.scale,c=Vg(l,null==t.count?5:t.count,t.minstep),f=t.format||Jg(l,c,t.formatSpecifier),h=t.values||function(t,n){return t.bins?((e=t.bins.slice()).max=e.pop(),e):av[t.type]?av[t.type](t):Zg(t,n);var e}(l,c);return f=uv(l,f,s),o&&(u.rem=o),s===rv?(Y(i=t.size)?(t.values||0!==l(h[0])||(h=h.slice(1)),a=h.reduce(function(n,e){return Math.max(n,i(e,t))},0)):i=V(a=i||8),o=h.map(function(n,e){return Ct({index:e,label:f(n,e,h),value:n,offset:a,size:i(n,t)})})):"gradient"===s?(e=l.domain(),r=Ig(l,e[0],k(e)),h.length<3&&!t.values&&e[0]!==k(e)&&(h=[e[0],k(e)]),o=h.map(function(t,n){return Ct({index:n,label:f(t,n,h),value:t,perc:r(t)})})):(i=h.length-1,r=function(t){var n=t.domain(),e=n.length-1,r=+n[0],i=+k(n),a=i-r;if(t.type===Jf){var u=e?a/e:.1;a=(i+=u)-(r-=u)}return function(t){return(t-r)/a}}(l),o=h.map(function(t,n){return Ct({index:n,label:f(t,n,h),value:t,perc:n?r(t):0,perc2:n===i?1:r(h[n+1])})})),u.source=o,u.add=o,this.value=o,u};var lv=tt({line:gv,"line-radial":function(t,n,e,r){return gv(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e))},arc:vv,"arc-radial":function(t,n,e,r){return vv(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e))},curve:mv,"curve-radial":function(t,n,e,r){return mv(n*Math.cos(t),n*Math.sin(t),r*Math.cos(e),r*Math.sin(e))},"orthogonal-horizontal":function(t,n,e,r){return"M"+t+","+n+"V"+r+"H"+e},"orthogonal-vertical":function(t,n,e,r){return"M"+t+","+n+"H"+e+"V"+r},"orthogonal-radial":function(t,n,e,r){var i=Math.cos(t),a=Math.sin(t),u=Math.cos(e),o=Math.sin(e),s=Math.abs(e-t)>Math.PI?e<=t:e>t;return"M"+n*i+","+n*a+"A"+n+","+n+" 0 0,"+(s?1:0)+" "+n*u+","+n*o+"L"+r*u+","+r*o},"diagonal-horizontal":function(t,n,e,r){var i=(t+e)/2;return"M"+t+","+n+"C"+i+","+n+" "+i+","+r+" "+e+","+r},"diagonal-vertical":function(t,n,e,r){var i=(n+r)/2;return"M"+t+","+n+"C"+t+","+i+" "+e+","+i+" "+e+","+r},"diagonal-radial":function(t,n,e,r){var i=Math.cos(t),a=Math.sin(t),u=Math.cos(e),o=Math.sin(e),s=(n+r)/2;return"M"+n*i+","+n*a+"C"+s*i+","+s*a+" "+s*u+","+s*o+" "+r*u+","+r*o}});function cv(t){return t.source.x}function fv(t){return t.source.y}function hv(t){return t.target.x}function dv(t){return t.target.y}function pv(t){Ir.call(this,{},t)}function gv(t,n,e,r){return"M"+t+","+n+"L"+e+","+r}function vv(t,n,e,r){var i=e-t,a=r-n,u=Math.sqrt(i*i+a*a)/2;return"M"+t+","+n+"A"+u+","+u+" "+180*Math.atan2(a,i)/Math.PI+" 0 1 "+e+","+r}function mv(t,n,e,r){var i=e-t,a=r-n,u=.2*(i+a),o=.2*(a-i);return"M"+t+","+n+"C"+(t+u)+","+(n+o)+" "+(e+o)+","+(r-u)+" "+e+","+r}function yv(t){Ir.call(this,null,t)}pv.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},et(pv,Ir).transform=function(t,n){var e=t.sourceX||cv,r=t.sourceY||fv,a=t.targetX||hv,u=t.targetY||dv,o=t.as||"path",s=t.orient||"vertical",l=t.shape||"line",c=lv.get(l+"-"+s)||lv.get(l);return c||i("LinkPath unsupported type: "+t.shape+(t.orient?"-"+t.orient:"")),n.visit(n.SOURCE,function(t){t[o]=c(e(t),r(t),a(t),u(t))}),n.reflow(t.modified()).modifies(o)},yv.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},et(yv,Ir).transform=function(t,n){var e,r,i,a=t.as||["startAngle","endAngle"],u=a[0],o=a[1],s=t.field||g,l=t.startAngle||0,c=null!=t.endAngle?t.endAngle:2*Math.PI,f=n.source,h=f.map(s),d=h.length,p=l,v=(c-l)/function(t,n){let e=0;if(void 0===n)for(let n of t)(n=+n)&&(e+=n);else{let r=-1;for(let i of t)(i=+n(i,++r,t))&&(e+=i)}return e}(h),m=ci(d);for(t.sort&&m.sort(function(t,n){return h[t]-h[n]}),e=0;e<d;++e)i=h[m[e]],(r=f[m[e]])[u]=p,r[o]=p+=i*v;return this.value=h,n.reflow(t.modified()).modifies(a)};var _v=5;function xv(t){return uh(t)&&t!==Gf}var bv=mt(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function wv(t){Ir.call(this,null,t),this.modified(!0)}function Av(t,n,e){ah(t)&&(Math.abs(n.reduce(function(t,n){return t+(n<0?-1:n>0?1:0)},0))!==n.length&&e.warn("Log scale domain includes zero: "+l(n)));return n}function Mv(t,n,e){return Y(t)&&(n||e)?qg(t,kv(n||[0,1],e)):t}function kv(t,n){return n?t.slice().reverse():t}function Ev(t){Ir.call(this,null,t)}et(wv,Ir).transform=function(t,n){var e=n.dataflow,r=this.value,a=function(t){var n,e=t.type,r="";if(e===Gf)return Gf+"-"+Uf;(function(t){const n=t.type;return uh(n)&&n!==Hf&&n!==Yf&&(t.scheme||t.range&&t.range.length&&t.range.every(s))})(t)&&(n=t.rawDomain?t.rawDomain.length:t.domain?t.domain.length+ +(null!=t.domainMid):0,r=2===n?Gf+"-":3===n?Vf+"-":"");return(r+e||Uf).toLowerCase()}(t);for(a in r&&a===r.type||(this.value=r=Tg(a)()),t)if(!bv[a]){if("padding"===a&&xv(r.type))continue;Y(r[a])?r[a](t[a]):e.warn("Unsupported scale property: "+a)}return function(t,n,e){var r=n.round||!1,a=n.range;if(null!=n.rangeStep)a=function(t,n,e){t!==th&&t!==Kf&&i("Only band and point scales support rangeStep.");var r=(null!=n.paddingOuter?n.paddingOuter:n.padding)||0,a=t===Kf?1:(null!=n.paddingInner?n.paddingInner:n.padding)||0;return[0,n.rangeStep*Lf(e,a,r)]}(t.type,n,e);else if(n.scheme){if(a=function(t,n,e){var r,a,o=n.schemeExtent;u(n.scheme)?a=Ug(n.scheme,n.interpolate,n.interpolateGamma):(r=n.scheme.toLowerCase(),(a=Gg(r))||i("Unrecognized scheme name: "+n.scheme));return e=t===Jf?e+1:t===nh?e-1:t===Xf||t===Zf?+n.schemeCount||_v:e,ih(t)?Mv(a,o,n.reverse):Y(a)?jg(Mv(a,o),e):t===Qf?a:a.slice(0,e)}(t.type,n,e),Y(a))return t.interpolator(a)}else if(a&&ih(t.type))return t.interpolator(Ug(kv(a,n.reverse),n.interpolate,n.interpolateGamma));a&&n.interpolate&&t.interpolate?t.interpolate($g(n.interpolate,n.interpolateGamma)):Y(t.round)?t.round(r):Y(t.rangeRound)&&t.interpolate(r?tp:Kd);a&&t.range(kv(a,n.reverse))}(r,t,function(t,n,e){let r=n.bins;if(r&&!u(r)){const n=(null==r.start||null==r.stop)&&t.domain(),e=null==r.start?n[0]:r.start,a=null==r.stop?k(n):r.stop,u=r.step;u||i("Scale bins parameter missing step property."),r=ci(e,a+u,u)}r?t.bins=r:t.bins&&delete t.bins;t.type===nh&&(r?n.domain||(t.domain(r),e=r.length):t.bins=t.domain());return e}(r,t,function(t,n,e){var r=function(t,n,e){return n?(t.domain(Av(t.type,n,e)),n.length):-1}(t,n.domainRaw,e);if(r>-1)return r;var i,a,u=n.domain,o=t.type,s=n.zero||void 0===n.zero&&function(t){const n=t.type;return!t.bins&&(n===Uf||n===If||n===$f)}(t);if(!u)return 0;xv(o)&&n.padding&&u[0]!==k(u)&&(u=function(t,n,e,r,i,a){var u=Math.abs(k(e)-e[0]),o=u/(u-2*r),s=t===jf?q(n,null,o):t===$f?U(n,null,o,.5):t===If?U(n,null,o,i||1):t===Wf?j(n,null,o,a||1):L(n,null,o);return(n=n.slice())[0]=s[0],n[n.length-1]=s[1],n}(o,u,n.range,n.padding,n.exponent,n.constant));(s||null!=n.domainMin||null!=n.domainMax||null!=n.domainMid)&&(i=(u=u.slice()).length-1||1,s&&(u[0]>0&&(u[0]=0),u[i]<0&&(u[i]=0)),null!=n.domainMin&&(u[0]=n.domainMin),null!=n.domainMax&&(u[i]=n.domainMax),null!=n.domainMid&&(((a=n.domainMid)<u[0]||a>u[i])&&e.warn("Scale domainMid exceeds domain min or max.",a),u.splice(i,0,a)));t.domain(Av(o,u,e)),o===Qf&&t.unknown(n.domainImplicit?Nh:void 0);n.nice&&t.nice&&t.nice(!0!==n.nice&&Vg(t,n.nice)||null);return u.length}(r,t,e))),n.fork(n.NO_SOURCE|n.NO_FIELDS)},et(Ev,Ir).transform=function(t,n){var e=t.modified("sort")||n.changed(n.ADD)||n.modified(t.sort.fields)||n.modified("datum");return e&&n.source.sort(t.sort),this.modified(e),n};var Cv=["y0","y1"];function Dv(t){Ir.call(this,null,t)}function Fv(t,n,e,r,i){for(var a,u=(n-t.sum)/2,o=t.length,s=0;s<o;++s)(a=t[s])[r]=u,a[i]=u+=Math.abs(e(a))}function Sv(t,n,e,r,i){for(var a,u=1/t.sum,o=0,s=t.length,l=0,c=0;l<s;++l)(a=t[l])[r]=o,a[i]=o=u*(c+=Math.abs(e(a)))}function Bv(t,n,e,r,i){for(var a,u,o=0,s=0,l=t.length,c=0;c<l;++c)(a=e(u=t[c]))<0?(u[r]=s,u[i]=s+=a):(u[r]=o,u[i]=o+=a)}Dv.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:"zero",values:["zero","center","normalize"]},{name:"as",type:"string",array:!0,length:2,default:Cv}]},et(Dv,Ir).transform=function(t,n){var e,r,i,a,u=t.as||Cv,o=u[0],s=u[1],l=t.field||g,c="center"===t.offset?Fv:"normalize"===t.offset?Sv:Bv;for(e=function(t,n,e,r){var i,a,u,o,s,l,c,f,h,d=[],p=function(t){return t(s)};if(null==n)d.push(t.slice());else for(i={},a=0,u=t.length;a<u;++a)s=t[a],l=n.map(p),(c=i[l])||(i[l]=c=[],d.push(c)),c.push(s);for(l=0,h=0,o=d.length;l<o;++l){for(c=d[l],a=0,f=0,u=c.length;a<u;++a)f+=Math.abs(r(c[a]));c.sum=f,f>h&&(h=f),e&&c.sort(e)}return d.max=h,d}(n.source,t.groupby,t.sort,l),r=0,i=e.length,a=e.max;r<i;++r)c(e[r],a,l,o,s);return n.reflow(t.modified()).modifies(u)};var Nv=Object.freeze({axisticks:Qg,datajoin:Kg,encode:ev,legendentries:sv,linkpath:pv,pie:yv,scale:wv,sortitems:Ev,stack:Dv,validTicks:Xg});function Ov(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}!function(t){var n;1===t.length&&(n=t,t=function(t,e){return Ov(n(t),e)})}(Ov);function zv(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),a=new Array(i);++r<i;)a[r]=t+r*e;return a}var Tv=Math.sqrt(50),Rv=Math.sqrt(10),Pv=Math.sqrt(2);function Lv(t,n,e){var r=Math.abs(n-t)/Math.max(0,e),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),a=r/i;return a>=Tv?i*=10:a>=Rv?i*=5:a>=Pv&&(i*=2),n<t?-i:i}function qv(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1}var Uv=Array.prototype.slice;function jv(t,n){return t-n}function Iv(t){return function(){return t}}function $v(t,n){for(var e,r=-1,i=n.length;++r<i;)if(e=Wv(t,n[r]))return e;return 0}function Wv(t,n){for(var e=n[0],r=n[1],i=-1,a=0,u=t.length,o=u-1;a<u;o=a++){var s=t[a],l=s[0],c=s[1],f=t[o],h=f[0],d=f[1];if(Hv(s,f,n))return 0;c>r!=d>r&&e<(h-l)*(r-c)/(d-c)+l&&(i=-i)}return i}function Hv(t,n,e){var r,i,a,u;return function(t,n,e){return(n[0]-t[0])*(e[1]-t[1])==(e[0]-t[0])*(n[1]-t[1])}(t,n,e)&&(i=t[r=+(t[0]===n[0])],a=e[r],u=n[r],i<=a&&a<=u||u<=a&&a<=i)}function Yv(){}var Gv=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Vv(){var t=1,n=1,e=qv,r=o;function i(t){var n=e(t);if(Array.isArray(n))n=n.slice().sort(jv);else{var r=function(t,n){var e,r,i,a=t.length,u=-1;if(null==n){for(;++u<a;)if(null!=(e=t[u])&&e>=e)for(r=i=e;++u<a;)null!=(e=t[u])&&(r>e&&(r=e),i<e&&(i=e))}else for(;++u<a;)if(null!=(e=n(t[u],u,t))&&e>=e)for(r=i=e;++u<a;)null!=(e=n(t[u],u,t))&&(r>e&&(r=e),i<e&&(i=e));return[r,i]}(t),i=r[0],u=r[1];n=Lv(i,u,n),n=zv(Math.floor(i/n)*n,Math.floor(u/n)*n,n)}return n.map(function(n){return a(t,n)})}function a(e,i){var a=[],o=[];return function(e,r,i){var a,o,s,l,c,f,h=new Array,d=new Array;a=o=-1,l=e[0]>=r,Gv[l<<1].forEach(p);for(;++a<t-1;)s=l,l=e[a+1]>=r,Gv[s|l<<1].forEach(p);Gv[l<<0].forEach(p);for(;++o<n-1;){for(a=-1,l=e[o*t+t]>=r,c=e[o*t]>=r,Gv[l<<1|c<<2].forEach(p);++a<t-1;)s=l,l=e[o*t+t+a+1]>=r,f=c,c=e[o*t+a+1]>=r,Gv[s|l<<1|c<<2|f<<3].forEach(p);Gv[l|c<<3].forEach(p)}a=-1,c=e[o*t]>=r,Gv[c<<2].forEach(p);for(;++a<t-1;)f=c,c=e[o*t+a+1]>=r,Gv[c<<2|f<<3].forEach(p);function p(t){var n,e,r=[t[0][0]+a,t[0][1]+o],s=[t[1][0]+a,t[1][1]+o],l=u(r),c=u(s);(n=d[l])?(e=h[c])?(delete d[n.end],delete h[e.start],n===e?(n.ring.push(s),i(n.ring)):h[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete d[n.end],n.ring.push(s),d[n.end=c]=n):(n=h[c])?(e=d[l])?(delete h[n.start],delete d[e.end],n===e?(n.ring.push(s),i(n.ring)):h[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete h[n.start],n.ring.unshift(r),h[n.start=l]=n):h[l]=d[c]={start:l,end:c,ring:[r,s]}}Gv[c<<3].forEach(p)}(e,i,function(t){r(t,e,i),function(t){for(var n=0,e=t.length,r=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++n<e;)r+=t[n-1][1]*t[n][0]-t[n-1][0]*t[n][1];return r}(t)>0?a.push([t]):o.push(t)}),o.forEach(function(t){for(var n,e=0,r=a.length;e<r;++e)if(-1!==$v((n=a[e])[0],t))return void n.push(t)}),{type:"MultiPolygon",value:i,coordinates:a}}function u(n){return 2*n[0]+n[1]*(t+1)*4}function o(e,r,i){e.forEach(function(e){var a,u=e[0],o=e[1],s=0|u,l=0|o,c=r[l*t+s];u>0&&u<t&&s===u&&(a=r[l*t+s-1],e[0]=u+(i-a)/(c-a)-.5),o>0&&o<n&&l===o&&(a=r[(l-1)*t+s],e[1]=o+(i-a)/(c-a)-.5)})}return i.contour=a,i.size=function(e){if(!arguments.length)return[t,n];var r=Math.ceil(e[0]),a=Math.ceil(e[1]);if(!(r>0&&a>0))throw new Error("invalid size");return t=r,n=a,i},i.thresholds=function(t){return arguments.length?(e="function"==typeof t?t:Array.isArray(t)?Iv(Uv.call(t)):Iv(t),i):e},i.smooth=function(t){return arguments.length?(r=t?o:Yv,i):r===o},i}function Xv(t,n,e){for(var r=t.width,i=t.height,a=1+(e<<1),u=0;u<i;++u)for(var o=0,s=0;o<r+e;++o)o<r&&(s+=t.data[o+u*r]),o>=e&&(o>=a&&(s-=t.data[o-a+u*r]),n.data[o-e+u*r]=s/Math.min(o+1,r-1+a-o,a))}function Zv(t,n,e){for(var r=t.width,i=t.height,a=1+(e<<1),u=0;u<r;++u)for(var o=0,s=0;o<i+e;++o)o<i&&(s+=t.data[u+o*r]),o>=e&&(o>=a&&(s-=t.data[u+(o-a)*r]),n.data[u+(o-e)*r]=s/Math.min(o+1,i-1+a-o,a))}function Jv(t){return t[0]}function Qv(t){return t[1]}function Kv(){return 1}var tm=["size","smooth"],nm=["x","y","weight","size","cellSize","bandwidth"];function em(t){Ir.call(this,null,t)}em.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"smooth",type:"boolean"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0}]},et(em,Ir).transform=function(t,n){if(this.value&&!n.changed()&&!t.modified())return n.StopPropagation;var e,r,i,a,u=n.fork(n.NO_SOURCE|n.NO_FIELDS),o=t.count||10;return t.values?(e=Vv(),r=tm,i=t.values):(e=function(){var t=Jv,n=Qv,e=Kv,r=960,i=500,a=20,u=2,o=3*a,s=r+2*o>>u,l=i+2*o>>u,c=Iv(20);function f(r){var i=new Float32Array(s*l),f=new Float32Array(s*l);r.forEach(function(r,a,c){var f=+t(r,a,c)+o>>u,h=+n(r,a,c)+o>>u,d=+e(r,a,c);f>=0&&f<s&&h>=0&&h<l&&(i[f+h*s]+=d)}),Xv({width:s,height:l,data:i},{width:s,height:l,data:f},a>>u),Zv({width:s,height:l,data:f},{width:s,height:l,data:i},a>>u),Xv({width:s,height:l,data:i},{width:s,height:l,data:f},a>>u),Zv({width:s,height:l,data:f},{width:s,height:l,data:i},a>>u),Xv({width:s,height:l,data:i},{width:s,height:l,data:f},a>>u),Zv({width:s,height:l,data:f},{width:s,height:l,data:i},a>>u);var d=c(i);if(!Array.isArray(d)){var p=function(t,n){var e,r,i=t.length,a=-1;if(null==n){for(;++a<i;)if(null!=(e=t[a])&&e>=e)for(r=e;++a<i;)null!=(e=t[a])&&e>r&&(r=e)}else for(;++a<i;)if(null!=(e=n(t[a],a,t))&&e>=e)for(r=e;++a<i;)null!=(e=n(t[a],a,t))&&e>r&&(r=e);return r}(i);d=Lv(0,p,d),(d=zv(0,Math.floor(p/d)*d,d)).shift()}return Vv().thresholds(d).size([s,l])(i).map(h)}function h(t){return t.value*=Math.pow(2,-2*u),t.coordinates.forEach(d),t}function d(t){t.forEach(p)}function p(t){t.forEach(g)}function g(t){t[0]=t[0]*Math.pow(2,u)-o,t[1]=t[1]*Math.pow(2,u)-o}function v(){return s=r+2*(o=3*a)>>u,l=i+2*o>>u,f}return f.x=function(n){return arguments.length?(t="function"==typeof n?n:Iv(+n),f):t},f.y=function(t){return arguments.length?(n="function"==typeof t?t:Iv(+t),f):n},f.weight=function(t){return arguments.length?(e="function"==typeof t?t:Iv(+t),f):e},f.size=function(t){if(!arguments.length)return[r,i];var n=Math.ceil(t[0]),e=Math.ceil(t[1]);if(!(n>=0||n>=0))throw new Error("invalid size");return r=n,i=e,v()},f.cellSize=function(t){if(!arguments.length)return 1<<u;if(!((t=+t)>=1))throw new Error("invalid cell size");return u=Math.floor(Math.log(t)/Math.LN2),v()},f.thresholds=function(t){return arguments.length?(c="function"==typeof t?t:Array.isArray(t)?Iv(Uv.call(t)):Iv(t),f):c},f.bandwidth=function(t){if(!arguments.length)return Math.sqrt(a*(a+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return a=Math.round((Math.sqrt(4*t*t+1)-1)/2),v()},f}(),r=nm,i=n.materialize(n.SOURCE).source),e.thresholds(t.thresholds||(t.nice?o:(a=o,function(t){for(var n=li(t),e=n[0],r=n[1]-e,i=[],u=1;u<=a;++u)i.push(e+r*u/(a+1));return i}))),r.forEach(function(n){null!=t[n]&&e[n](t[n])}),this.value&&(u.rem=this.value),i=i&&i.length?e(i).map(Ct):[],this.value=u.source=u.add=i,u};var rm="FeatureCollection";function im(t){Ir.call(this,null,t)}function am(){return new um}function um(){this.reset()}im.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},et(im,Ir).transform=function(t,n){var e,i=this._features,a=this._points,u=t.fields,o=u&&u[0],s=u&&u[1],l=t.geojson,c=n.ADD;e=t.modified()||n.changed(n.REM)||n.modified(r(l))||o&&n.modified(r(o))||s&&n.modified(r(s)),this.value&&!e||(c=n.SOURCE,this._features=i=[],this._points=a=[]),l&&n.visit(c,function(t){i.push(l(t))}),o&&s&&(n.visit(c,function(t){var n=o(t),e=s(t);null!=n&&null!=e&&(n=+n)===n&&(e=+e)===e&&a.push([n,e])}),i=i.concat({type:"Feature",geometry:{type:"MultiPoint",coordinates:a}})),this.value={type:rm,features:i}},um.prototype={constructor:um,reset:function(){this.s=this.t=0},add:function(t){sm(om,t,this.t),sm(this,om.s,this.s),this.s?this.t+=om.t:this.s=om.t},valueOf:function(){return this.s}};var om=new um;function sm(t,n,e){var r=t.s=n+e,i=r-n,a=r-i;t.t=n-a+(e-i)}var lm=1e-6,cm=1e-12,fm=Math.PI,hm=fm/2,dm=fm/4,pm=2*fm,gm=180/fm,vm=fm/180,mm=Math.abs,ym=Math.atan,_m=Math.atan2,xm=Math.cos,bm=Math.ceil,wm=Math.exp,Am=Math.log,Mm=Math.pow,km=Math.sin,Em=Math.sign||function(t){return t>0?1:t<0?-1:0},Cm=Math.sqrt,Dm=Math.tan;function Fm(t){return t>1?0:t<-1?fm:Math.acos(t)}function Sm(t){return t>1?hm:t<-1?-hm:Math.asin(t)}function Bm(){}function Nm(t,n){t&&zm.hasOwnProperty(t.type)&&zm[t.type](t,n)}var Om={Feature:function(t,n){Nm(t.geometry,n)},FeatureCollection:function(t,n){for(var e=t.features,r=-1,i=e.length;++r<i;)Nm(e[r].geometry,n)}},zm={Sphere:function(t,n){n.sphere()},Point:function(t,n){t=t.coordinates,n.point(t[0],t[1],t[2])},MultiPoint:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)t=e[r],n.point(t[0],t[1],t[2])},LineString:function(t,n){Tm(t.coordinates,n,0)},MultiLineString:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Tm(e[r],n,0)},Polygon:function(t,n){Rm(t.coordinates,n)},MultiPolygon:function(t,n){for(var e=t.coordinates,r=-1,i=e.length;++r<i;)Rm(e[r],n)},GeometryCollection:function(t,n){for(var e=t.geometries,r=-1,i=e.length;++r<i;)Nm(e[r],n)}};function Tm(t,n,e){var r,i=-1,a=t.length-e;for(n.lineStart();++i<a;)r=t[i],n.point(r[0],r[1],r[2]);n.lineEnd()}function Rm(t,n){var e=-1,r=t.length;for(n.polygonStart();++e<r;)Tm(t[e],n,1);n.polygonEnd()}function Pm(t,n){t&&Om.hasOwnProperty(t.type)?Om[t.type](t,n):Nm(t,n)}var Lm,qm,Um,jm,Im,$m=am(),Wm=am(),Hm={point:Bm,lineStart:Bm,lineEnd:Bm,polygonStart:function(){$m.reset(),Hm.lineStart=Ym,Hm.lineEnd=Gm},polygonEnd:function(){var t=+$m;Wm.add(t<0?pm+t:t),this.lineStart=this.lineEnd=this.point=Bm},sphere:function(){Wm.add(pm)}};function Ym(){Hm.point=Vm}function Gm(){Xm(Lm,qm)}function Vm(t,n){Hm.point=Xm,Lm=t,qm=n,Um=t*=vm,jm=xm(n=(n*=vm)/2+dm),Im=km(n)}function Xm(t,n){var e=(t*=vm)-Um,r=e>=0?1:-1,i=r*e,a=xm(n=(n*=vm)/2+dm),u=km(n),o=Im*u,s=jm*a+o*xm(i),l=o*r*km(i);$m.add(_m(l,s)),Um=t,jm=a,Im=u}function Zm(t){return[_m(t[1],t[0]),Sm(t[2])]}function Jm(t){var n=t[0],e=t[1],r=xm(e);return[r*xm(n),r*km(n),km(e)]}function Qm(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function Km(t,n){return[t[1]*n[2]-t[2]*n[1],t[2]*n[0]-t[0]*n[2],t[0]*n[1]-t[1]*n[0]]}function ty(t,n){t[0]+=n[0],t[1]+=n[1],t[2]+=n[2]}function ny(t,n){return[t[0]*n,t[1]*n,t[2]*n]}function ey(t){var n=Cm(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=n,t[1]/=n,t[2]/=n}var ry,iy,ay,uy,oy,sy,ly,cy,fy,hy,dy,py,gy,vy,my,yy,_y,xy,by,wy,Ay,My,ky,Ey,Cy,Dy,Fy=am(),Sy={point:By,lineStart:Oy,lineEnd:zy,polygonStart:function(){Sy.point=Ty,Sy.lineStart=Ry,Sy.lineEnd=Py,Fy.reset(),Hm.polygonStart()},polygonEnd:function(){Hm.polygonEnd(),Sy.point=By,Sy.lineStart=Oy,Sy.lineEnd=zy,$m<0?(ry=-(ay=180),iy=-(uy=90)):Fy>lm?uy=90:Fy<-lm&&(iy=-90),hy[0]=ry,hy[1]=ay}};function By(t,n){fy.push(hy=[ry=t,ay=t]),n<iy&&(iy=n),n>uy&&(uy=n)}function Ny(t,n){var e=Jm([t*vm,n*vm]);if(cy){var r=Km(cy,e),i=Km([r[1],-r[0],0],r);ey(i),i=Zm(i);var a,u=t-oy,o=u>0?1:-1,s=i[0]*gm*o,l=mm(u)>180;l^(o*oy<s&&s<o*t)?(a=i[1]*gm)>uy&&(uy=a):l^(o*oy<(s=(s+360)%360-180)&&s<o*t)?(a=-i[1]*gm)<iy&&(iy=a):(n<iy&&(iy=n),n>uy&&(uy=n)),l?t<oy?Ly(ry,t)>Ly(ry,ay)&&(ay=t):Ly(t,ay)>Ly(ry,ay)&&(ry=t):ay>=ry?(t<ry&&(ry=t),t>ay&&(ay=t)):t>oy?Ly(ry,t)>Ly(ry,ay)&&(ay=t):Ly(t,ay)>Ly(ry,ay)&&(ry=t)}else fy.push(hy=[ry=t,ay=t]);n<iy&&(iy=n),n>uy&&(uy=n),cy=e,oy=t}function Oy(){Sy.point=Ny}function zy(){hy[0]=ry,hy[1]=ay,Sy.point=By,cy=null}function Ty(t,n){if(cy){var e=t-oy;Fy.add(mm(e)>180?e+(e>0?360:-360):e)}else sy=t,ly=n;Hm.point(t,n),Ny(t,n)}function Ry(){Hm.lineStart()}function Py(){Ty(sy,ly),Hm.lineEnd(),mm(Fy)>lm&&(ry=-(ay=180)),hy[0]=ry,hy[1]=ay,cy=null}function Ly(t,n){return(n-=t)<0?n+360:n}function qy(t,n){return t[0]-n[0]}function Uy(t,n){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var jy={sphere:Bm,point:Iy,lineStart:Wy,lineEnd:Gy,polygonStart:function(){jy.lineStart=Vy,jy.lineEnd=Xy},polygonEnd:function(){jy.lineStart=Wy,jy.lineEnd=Gy}};function Iy(t,n){t*=vm;var e=xm(n*=vm);$y(e*xm(t),e*km(t),km(n))}function $y(t,n,e){gy+=(t-gy)/++dy,vy+=(n-vy)/dy,my+=(e-my)/dy}function Wy(){jy.point=Hy}function Hy(t,n){t*=vm;var e=xm(n*=vm);Ey=e*xm(t),Cy=e*km(t),Dy=km(n),jy.point=Yy,$y(Ey,Cy,Dy)}function Yy(t,n){t*=vm;var e=xm(n*=vm),r=e*xm(t),i=e*km(t),a=km(n),u=_m(Cm((u=Cy*a-Dy*i)*u+(u=Dy*r-Ey*a)*u+(u=Ey*i-Cy*r)*u),Ey*r+Cy*i+Dy*a);py+=u,yy+=u*(Ey+(Ey=r)),_y+=u*(Cy+(Cy=i)),xy+=u*(Dy+(Dy=a)),$y(Ey,Cy,Dy)}function Gy(){jy.point=Iy}function Vy(){jy.point=Zy}function Xy(){Jy(My,ky),jy.point=Iy}function Zy(t,n){My=t,ky=n,t*=vm,n*=vm,jy.point=Jy;var e=xm(n);Ey=e*xm(t),Cy=e*km(t),Dy=km(n),$y(Ey,Cy,Dy)}function Jy(t,n){t*=vm;var e=xm(n*=vm),r=e*xm(t),i=e*km(t),a=km(n),u=Cy*a-Dy*i,o=Dy*r-Ey*a,s=Ey*i-Cy*r,l=Cm(u*u+o*o+s*s),c=Sm(l),f=l&&-c/l;by+=f*u,wy+=f*o,Ay+=f*s,py+=c,yy+=c*(Ey+(Ey=r)),_y+=c*(Cy+(Cy=i)),xy+=c*(Dy+(Dy=a)),$y(Ey,Cy,Dy)}function Qy(t,n){function e(e,r){return e=t(e,r),n(e[0],e[1])}return t.invert&&n.invert&&(e.invert=function(e,r){return(e=n.invert(e,r))&&t.invert(e[0],e[1])}),e}function Ky(t,n){return[mm(t)>fm?t+Math.round(-t/pm)*pm:t,n]}function t_(t,n,e){return(t%=pm)?n||e?Qy(e_(t),r_(n,e)):e_(t):n||e?r_(n,e):Ky}function n_(t){return function(n,e){return[(n+=t)>fm?n-pm:n<-fm?n+pm:n,e]}}function e_(t){var n=n_(t);return n.invert=n_(-t),n}function r_(t,n){var e=xm(t),r=km(t),i=xm(n),a=km(n);function u(t,n){var u=xm(n),o=xm(t)*u,s=km(t)*u,l=km(n),c=l*e+o*r;return[_m(s*i-c*a,o*e-l*r),Sm(c*i+s*a)]}return u.invert=function(t,n){var u=xm(n),o=xm(t)*u,s=km(t)*u,l=km(n),c=l*i-s*a;return[_m(s*i+l*a,o*e+c*r),Sm(c*e-o*r)]},u}function i_(t,n){(n=Jm(n))[0]-=t,ey(n);var e=Fm(-n[1]);return((-n[2]<0?-e:e)+pm-lm)%pm}function a_(){var t,n=[];return{point:function(n,e){t.push([n,e])},lineStart:function(){n.push(t=[])},lineEnd:Bm,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function u_(t,n){return mm(t[0]-n[0])<lm&&mm(t[1]-n[1])<lm}function o_(t,n,e,r){this.x=t,this.z=n,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function s_(t,n,e,r,i){var a,u,o=[],s=[];if(t.forEach(function(t){if(!((n=t.length-1)<=0)){var n,e,r=t[0],u=t[n];if(u_(r,u)){for(i.lineStart(),a=0;a<n;++a)i.point((r=t[a])[0],r[1]);i.lineEnd()}else o.push(e=new o_(r,t,null,!0)),s.push(e.o=new o_(r,null,e,!1)),o.push(e=new o_(u,t,null,!1)),s.push(e.o=new o_(u,null,e,!0))}}),o.length){for(s.sort(n),l_(o),l_(s),a=0,u=s.length;a<u;++a)s[a].e=e=!e;for(var l,c,f=o[0];;){for(var h=f,d=!0;h.v;)if((h=h.n)===f)return;l=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(a=0,u=l.length;a<u;++a)i.point((c=l[a])[0],c[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(l=h.p.z,a=l.length-1;a>=0;--a)i.point((c=l[a])[0],c[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}}function l_(t){if(n=t.length){for(var n,e,r=0,i=t[0];++r<n;)i.n=e=t[r],e.p=i,i=e;i.n=e=t[0],e.p=i}}Ky.invert=Ky;var c_=am();function f_(t,n){return t<n?-1:t>n?1:t>=n?0:NaN}!function(t){var n;1===t.length&&(n=t,t=function(t,e){return f_(n(t),e)})}(f_);function h_(t,n,e){t=+t,n=+n,e=(i=arguments.length)<2?(n=t,t=0,1):i<3?1:+e;for(var r=-1,i=0|Math.max(0,Math.ceil((n-t)/e)),a=new Array(i);++r<i;)a[r]=t+r*e;return a}function d_(t){for(var n,e,r,i=t.length,a=-1,u=0;++a<i;)u+=t[a].length;for(e=new Array(u);--i>=0;)for(n=(r=t[i]).length;--n>=0;)e[--u]=r[n];return e}function p_(t,n,e,r){return function(i){var a,u,o,s=n(i),l=a_(),c=n(l),f=!1,h={point:d,lineStart:g,lineEnd:v,polygonStart:function(){h.point=m,h.lineStart=y,h.lineEnd=_,u=[],a=[]},polygonEnd:function(){h.point=d,h.lineStart=g,h.lineEnd=v,u=d_(u);var t=function(t,n){var e=n[0],r=n[1],i=km(r),a=[km(e),-xm(e),0],u=0,o=0;c_.reset(),1===i?r=hm+lm:-1===i&&(r=-hm-lm);for(var s=0,l=t.length;s<l;++s)if(f=(c=t[s]).length)for(var c,f,h=c[f-1],d=h[0],p=h[1]/2+dm,g=km(p),v=xm(p),m=0;m<f;++m,d=_,g=b,v=w,h=y){var y=c[m],_=y[0],x=y[1]/2+dm,b=km(x),w=xm(x),A=_-d,M=A>=0?1:-1,k=M*A,E=k>fm,C=g*b;if(c_.add(_m(C*M*km(k),v*w+C*xm(k))),u+=E?A+M*pm:A,E^d>=e^_>=e){var D=Km(Jm(h),Jm(y));ey(D);var F=Km(a,D);ey(F);var S=(E^A>=0?-1:1)*Sm(F[2]);(r>S||r===S&&(D[0]||D[1]))&&(o+=E^A>=0?1:-1)}}return(u<-lm||u<lm&&c_<-lm)^1&o}(a,r);u.length?(f||(i.polygonStart(),f=!0),s_(u,v_,t,e,i)):t&&(f||(i.polygonStart(),f=!0),i.lineStart(),e(null,null,1,i),i.lineEnd()),f&&(i.polygonEnd(),f=!1),u=a=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(n,e){t(n,e)&&i.point(n,e)}function p(t,n){s.point(t,n)}function g(){h.point=p,s.lineStart()}function v(){h.point=d,s.lineEnd()}function m(t,n){o.push([t,n]),c.point(t,n)}function y(){c.lineStart(),o=[]}function _(){m(o[0][0],o[0][1]),c.lineEnd();var t,n,e,r,s=c.clean(),h=l.result(),d=h.length;if(o.pop(),a.push(o),o=null,d)if(1&s){if((n=(e=h[0]).length-1)>0){for(f||(i.polygonStart(),f=!0),i.lineStart(),t=0;t<n;++t)i.point((r=e[t])[0],r[1]);i.lineEnd()}}else d>1&&2&s&&h.push(h.pop().concat(h.shift())),u.push(h.filter(g_))}return h}}function g_(t){return t.length>1}function v_(t,n){return((t=t.x)[0]<0?t[1]-hm-lm:hm-t[1])-((n=n.x)[0]<0?n[1]-hm-lm:hm-n[1])}var m_=p_(function(){return!0},function(t){var n,e=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),n=1},point:function(a,u){var o=a>0?fm:-fm,s=mm(a-e);mm(s-fm)<lm?(t.point(e,r=(r+u)/2>0?hm:-hm),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),t.point(a,r),n=0):i!==o&&s>=fm&&(mm(e-i)<lm&&(e-=i*lm),mm(a-o)<lm&&(a-=o*lm),r=function(t,n,e,r){var i,a,u=km(t-e);return mm(u)>lm?ym((km(n)*(a=xm(r))*km(e)-km(r)*(i=xm(n))*km(t))/(i*a*u)):(n+r)/2}(e,r,a,u),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(o,r),n=0),t.point(e=a,r=u),i=o},lineEnd:function(){t.lineEnd(),e=r=NaN},clean:function(){return 2-n}}},function(t,n,e,r){var i;if(null==t)i=e*hm,r.point(-fm,i),r.point(0,i),r.point(fm,i),r.point(fm,0),r.point(fm,-i),r.point(0,-i),r.point(-fm,-i),r.point(-fm,0),r.point(-fm,i);else if(mm(t[0]-n[0])>lm){var a=t[0]<n[0]?fm:-fm;i=e*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(n[0],n[1])},[-fm,-hm]);function y_(t){var n=xm(t),e=6*vm,r=n>0,i=mm(n)>lm;function a(t,e){return xm(t)*xm(e)>n}function u(t,e,r){var i=[1,0,0],a=Km(Jm(t),Jm(e)),u=Qm(a,a),o=a[0],s=u-o*o;if(!s)return!r&&t;var l=n*u/s,c=-n*o/s,f=Km(i,a),h=ny(i,l);ty(h,ny(a,c));var d=f,p=Qm(h,d),g=Qm(d,d),v=p*p-g*(Qm(h,h)-1);if(!(v<0)){var m=Cm(v),y=ny(d,(-p-m)/g);if(ty(y,h),y=Zm(y),!r)return y;var _,x=t[0],b=e[0],w=t[1],A=e[1];b<x&&(_=x,x=b,b=_);var M=b-x,k=mm(M-fm)<lm;if(!k&&A<w&&(_=w,w=A,A=_),k||M<lm?k?w+A>0^y[1]<(mm(y[0]-x)<lm?w:A):w<=y[1]&&y[1]<=A:M>fm^(x<=y[0]&&y[0]<=b)){var E=ny(d,(-p+m)/g);return ty(E,h),[y,Zm(E)]}}}function o(n,e){var i=r?t:fm-t,a=0;return n<-i?a|=1:n>i&&(a|=2),e<-i?a|=4:e>i&&(a|=8),a}return p_(a,function(t){var n,e,s,l,c;return{lineStart:function(){l=s=!1,c=1},point:function(f,h){var d,p=[f,h],g=a(f,h),v=r?g?0:o(f,h):g?o(f+(f<0?fm:-fm),h):0;if(!n&&(l=s=g)&&t.lineStart(),g!==s&&(!(d=u(n,p))||u_(n,d)||u_(p,d))&&(p[0]+=lm,p[1]+=lm,g=a(p[0],p[1])),g!==s)c=0,g?(t.lineStart(),d=u(p,n),t.point(d[0],d[1])):(d=u(n,p),t.point(d[0],d[1]),t.lineEnd()),n=d;else if(i&&n&&r^g){var m;v&e||!(m=u(p,n,!0))||(c=0,r?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||n&&u_(n,p)||t.point(p[0],p[1]),n=p,s=g,e=v},lineEnd:function(){s&&t.lineEnd(),n=null},clean:function(){return c|(l&&s)<<1}}},function(n,r,i,a){!function(t,n,e,r,i,a){if(e){var u=xm(n),o=km(n),s=r*e;null==i?(i=n+r*pm,a=n-s/2):(i=i_(u,i),a=i_(u,a),(r>0?i<a:i>a)&&(i+=r*pm));for(var l,c=i;r>0?c>a:c<a;c-=s)l=Zm([u,-o*xm(c),-o*km(c)]),t.point(l[0],l[1])}}(a,t,e,i,n,r)},r?[0,-t]:[-fm,t-fm])}var __=1e9,x_=-__;function b_(t,n,e,r){function i(i,a){return t<=i&&i<=e&&n<=a&&a<=r}function a(i,a,o,l){var c=0,f=0;if(null==i||(c=u(i,o))!==(f=u(a,o))||s(i,a)<0^o>0)do{l.point(0===c||3===c?t:e,c>1?r:n)}while((c=(c+o+4)%4)!==f);else l.point(a[0],a[1])}function u(r,i){return mm(r[0]-t)<lm?i>0?0:3:mm(r[0]-e)<lm?i>0?2:1:mm(r[1]-n)<lm?i>0?1:0:i>0?3:2}function o(t,n){return s(t.x,n.x)}function s(t,n){var e=u(t,1),r=u(n,1);return e!==r?e-r:0===e?n[1]-t[1]:1===e?t[0]-n[0]:2===e?t[1]-n[1]:n[0]-t[0]}return function(u){var s,l,c,f,h,d,p,g,v,m,y,_=u,x=a_(),b={point:w,lineStart:function(){b.point=A,l&&l.push(c=[]);m=!0,v=!1,p=g=NaN},lineEnd:function(){s&&(A(f,h),d&&v&&x.rejoin(),s.push(x.result()));b.point=w,v&&_.lineEnd()},polygonStart:function(){_=x,s=[],l=[],y=!0},polygonEnd:function(){var n=function(){for(var n=0,e=0,i=l.length;e<i;++e)for(var a,u,o=l[e],s=1,c=o.length,f=o[0],h=f[0],d=f[1];s<c;++s)a=h,u=d,f=o[s],h=f[0],d=f[1],u<=r?d>r&&(h-a)*(r-u)>(d-u)*(t-a)&&++n:d<=r&&(h-a)*(r-u)<(d-u)*(t-a)&&--n;return n}(),e=y&&n,i=(s=d_(s)).length;(e||i)&&(u.polygonStart(),e&&(u.lineStart(),a(null,null,1,u),u.lineEnd()),i&&s_(s,o,n,a,u),u.polygonEnd());_=u,s=l=c=null}};function w(t,n){i(t,n)&&_.point(t,n)}function A(a,u){var o=i(a,u);if(l&&c.push([a,u]),m)f=a,h=u,d=o,m=!1,o&&(_.lineStart(),_.point(a,u));else if(o&&v)_.point(a,u);else{var s=[p=Math.max(x_,Math.min(__,p)),g=Math.max(x_,Math.min(__,g))],x=[a=Math.max(x_,Math.min(__,a)),u=Math.max(x_,Math.min(__,u))];!function(t,n,e,r,i,a){var u,o=t[0],s=t[1],l=0,c=1,f=n[0]-o,h=n[1]-s;if(u=e-o,f||!(u>0)){if(u/=f,f<0){if(u<l)return;u<c&&(c=u)}else if(f>0){if(u>c)return;u>l&&(l=u)}if(u=i-o,f||!(u<0)){if(u/=f,f<0){if(u>c)return;u>l&&(l=u)}else if(f>0){if(u<l)return;u<c&&(c=u)}if(u=r-s,h||!(u>0)){if(u/=h,h<0){if(u<l)return;u<c&&(c=u)}else if(h>0){if(u>c)return;u>l&&(l=u)}if(u=a-s,h||!(u<0)){if(u/=h,h<0){if(u>c)return;u>l&&(l=u)}else if(h>0){if(u<l)return;u<c&&(c=u)}return l>0&&(t[0]=o+l*f,t[1]=s+l*h),c<1&&(n[0]=o+c*f,n[1]=s+c*h),!0}}}}}(s,x,t,n,e,r)?o&&(_.lineStart(),_.point(a,u),y=!1):(v||(_.lineStart(),_.point(s[0],s[1])),_.point(x[0],x[1]),o||_.lineEnd(),y=!1)}p=a,g=u,v=o}return b}}am();function w_(t,n,e){var r=h_(t,n-lm,e).concat(n);return function(t){return r.map(function(n){return[t,n]})}}function A_(t,n,e){var r=h_(t,n-lm,e).concat(n);return function(t){return r.map(function(n){return[n,t]})}}function M_(t){return t}var k_,E_,C_,D_,F_=am(),S_=am(),B_={point:Bm,lineStart:Bm,lineEnd:Bm,polygonStart:function(){B_.lineStart=N_,B_.lineEnd=T_},polygonEnd:function(){B_.lineStart=B_.lineEnd=B_.point=Bm,F_.add(mm(S_)),S_.reset()},result:function(){var t=F_/2;return F_.reset(),t}};function N_(){B_.point=O_}function O_(t,n){B_.point=z_,k_=C_=t,E_=D_=n}function z_(t,n){S_.add(D_*t-C_*n),C_=t,D_=n}function T_(){z_(k_,E_)}var R_=1/0,P_=R_,L_=-R_,q_=L_,U_={point:function(t,n){t<R_&&(R_=t);t>L_&&(L_=t);n<P_&&(P_=n);n>q_&&(q_=n)},lineStart:Bm,lineEnd:Bm,polygonStart:Bm,polygonEnd:Bm,result:function(){var t=[[R_,P_],[L_,q_]];return L_=q_=-(P_=R_=1/0),t}};var j_,I_,$_,W_,H_=0,Y_=0,G_=0,V_=0,X_=0,Z_=0,J_=0,Q_=0,K_=0,tx={point:nx,lineStart:ex,lineEnd:ax,polygonStart:function(){tx.lineStart=ux,tx.lineEnd=ox},polygonEnd:function(){tx.point=nx,tx.lineStart=ex,tx.lineEnd=ax},result:function(){var t=K_?[J_/K_,Q_/K_]:Z_?[V_/Z_,X_/Z_]:G_?[H_/G_,Y_/G_]:[NaN,NaN];return H_=Y_=G_=V_=X_=Z_=J_=Q_=K_=0,t}};function nx(t,n){H_+=t,Y_+=n,++G_}function ex(){tx.point=rx}function rx(t,n){tx.point=ix,nx($_=t,W_=n)}function ix(t,n){var e=t-$_,r=n-W_,i=Cm(e*e+r*r);V_+=i*($_+t)/2,X_+=i*(W_+n)/2,Z_+=i,nx($_=t,W_=n)}function ax(){tx.point=nx}function ux(){tx.point=sx}function ox(){lx(j_,I_)}function sx(t,n){tx.point=lx,nx(j_=$_=t,I_=W_=n)}function lx(t,n){var e=t-$_,r=n-W_,i=Cm(e*e+r*r);V_+=i*($_+t)/2,X_+=i*(W_+n)/2,Z_+=i,J_+=(i=W_*t-$_*n)*($_+t),Q_+=i*(W_+n),K_+=3*i,nx($_=t,W_=n)}function cx(t){this._context=t}cx.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._context.moveTo(t,n),this._point=1;break;case 1:this._context.lineTo(t,n);break;default:this._context.moveTo(t+this._radius,n),this._context.arc(t,n,this._radius,0,pm)}},result:Bm};var fx,hx,dx,px,gx,vx=am(),mx={point:Bm,lineStart:function(){mx.point=yx},lineEnd:function(){fx&&_x(hx,dx),mx.point=Bm},polygonStart:function(){fx=!0},polygonEnd:function(){fx=null},result:function(){var t=+vx;return vx.reset(),t}};function yx(t,n){mx.point=_x,hx=px=t,dx=gx=n}function _x(t,n){px-=t,gx-=n,vx.add(Cm(px*px+gx*gx)),px=t,gx=n}function xx(){this._string=[]}function bx(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function wx(t,n){var e,r,i=4.5;function a(t){return t&&("function"==typeof i&&r.pointRadius(+i.apply(this,arguments)),Pm(t,e(r))),r.result()}return a.area=function(t){return Pm(t,e(B_)),B_.result()},a.measure=function(t){return Pm(t,e(mx)),mx.result()},a.bounds=function(t){return Pm(t,e(U_)),U_.result()},a.centroid=function(t){return Pm(t,e(tx)),tx.result()},a.projection=function(n){return arguments.length?(e=null==n?(t=null,M_):(t=n).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(n=null,new xx):new cx(n=t),"function"!=typeof i&&r.pointRadius(i),a):n},a.pointRadius=function(t){return arguments.length?(i="function"==typeof t?t:(r.pointRadius(+t),+t),a):i},a.projection(t).context(n)}function Ax(t){return function(n){var e=new Mx;for(var r in t)e[r]=t[r];return e.stream=n,e}}function Mx(){}function kx(t,n,e){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Pm(e,t.stream(U_)),n(U_.result()),null!=r&&t.clipExtent(r),t}function Ex(t,n,e){return kx(t,function(e){var r=n[1][0]-n[0][0],i=n[1][1]-n[0][1],a=Math.min(r/(e[1][0]-e[0][0]),i/(e[1][1]-e[0][1])),u=+n[0][0]+(r-a*(e[1][0]+e[0][0]))/2,o=+n[0][1]+(i-a*(e[1][1]+e[0][1]))/2;t.scale(150*a).translate([u,o])},e)}function Cx(t,n,e){return Ex(t,[[0,0],n],e)}function Dx(t,n,e){return kx(t,function(e){var r=+n,i=r/(e[1][0]-e[0][0]),a=(r-i*(e[1][0]+e[0][0]))/2,u=-i*e[0][1];t.scale(150*i).translate([a,u])},e)}function Fx(t,n,e){return kx(t,function(e){var r=+n,i=r/(e[1][1]-e[0][1]),a=-i*e[0][0],u=(r-i*(e[1][1]+e[0][1]))/2;t.scale(150*i).translate([a,u])},e)}xx.prototype={_radius:4.5,_circle:bx(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,n){switch(this._point){case 0:this._string.push("M",t,",",n),this._point=1;break;case 1:this._string.push("L",t,",",n);break;default:null==this._circle&&(this._circle=bx(this._radius)),this._string.push("M",t,",",n,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Mx.prototype={constructor:Mx,point:function(t,n){this.stream.point(t,n)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Sx=16,Bx=xm(30*vm);function Nx(t,n){return+n?function(t,n){function e(r,i,a,u,o,s,l,c,f,h,d,p,g,v){var m=l-r,y=c-i,_=m*m+y*y;if(_>4*n&&g--){var x=u+h,b=o+d,w=s+p,A=Cm(x*x+b*b+w*w),M=Sm(w/=A),k=mm(mm(w)-1)<lm||mm(a-f)<lm?(a+f)/2:_m(b,x),E=t(k,M),C=E[0],D=E[1],F=C-r,S=D-i,B=y*F-m*S;(B*B/_>n||mm((m*F+y*S)/_-.5)>.3||u*h+o*d+s*p<Bx)&&(e(r,i,a,u,o,s,C,D,k,x/=A,b/=A,w,g,v),v.point(C,D),e(C,D,k,x,b,w,l,c,f,h,d,p,g,v))}}return function(n){var r,i,a,u,o,s,l,c,f,h,d,p,g={point:v,lineStart:m,lineEnd:_,polygonStart:function(){n.polygonStart(),g.lineStart=x},polygonEnd:function(){n.polygonEnd(),g.lineStart=m}};function v(e,r){e=t(e,r),n.point(e[0],e[1])}function m(){c=NaN,g.point=y,n.lineStart()}function y(r,i){var a=Jm([r,i]),u=t(r,i);e(c,f,l,h,d,p,c=u[0],f=u[1],l=r,h=a[0],d=a[1],p=a[2],Sx,n),n.point(c,f)}function _(){g.point=v,n.lineEnd()}function x(){m(),g.point=b,g.lineEnd=w}function b(t,n){y(r=t,n),i=c,a=f,u=h,o=d,s=p,g.point=y}function w(){e(c,f,l,h,d,p,i,a,r,u,o,s,Sx,n),g.lineEnd=_,_()}return g}}(t,n):function(t){return Ax({point:function(n,e){n=t(n,e),this.stream.point(n[0],n[1])}})}(t)}var Ox=Ax({point:function(t,n){this.stream.point(t*vm,n*vm)}});function zx(t,n,e,r){var i=xm(r),a=km(r),u=i*t,o=a*t,s=i/t,l=a/t,c=(a*e-i*n)/t,f=(a*n+i*e)/t;function h(t,r){return[u*t-o*r+n,e-o*t-u*r]}return h.invert=function(t,n){return[s*t-l*n+c,f-l*t-s*n]},h}function Tx(t){return Rx(function(){return t})()}function Rx(t){var n,e,r,i,a,u,o,s,l,c,f=150,h=480,d=250,p=0,g=0,v=0,m=0,y=0,_=0,x=null,b=m_,w=null,A=M_,M=.5;function k(t){return s(t[0]*vm,t[1]*vm)}function E(t){return(t=s.invert(t[0],t[1]))&&[t[0]*gm,t[1]*gm]}function C(){var t=zx(f,0,0,_).apply(null,n(p,g)),r=(_?zx:function(t,n,e){function r(r,i){return[n+t*r,e-t*i]}return r.invert=function(r,i){return[(r-n)/t,(e-i)/t]},r})(f,h-t[0],d-t[1],_);return e=t_(v,m,y),o=Qy(n,r),s=Qy(e,o),u=Nx(o,M),D()}function D(){return l=c=null,k}return k.stream=function(t){return l&&c===t?l:l=Ox(function(t){return Ax({point:function(n,e){var r=t(n,e);return this.stream.point(r[0],r[1])}})}(e)(b(u(A(c=t)))))},k.preclip=function(t){return arguments.length?(b=t,x=void 0,D()):b},k.postclip=function(t){return arguments.length?(A=t,w=r=i=a=null,D()):A},k.clipAngle=function(t){return arguments.length?(b=+t?y_(x=t*vm):(x=null,m_),D()):x*gm},k.clipExtent=function(t){return arguments.length?(A=null==t?(w=r=i=a=null,M_):b_(w=+t[0][0],r=+t[0][1],i=+t[1][0],a=+t[1][1]),D()):null==w?null:[[w,r],[i,a]]},k.scale=function(t){return arguments.length?(f=+t,C()):f},k.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],C()):[h,d]},k.center=function(t){return arguments.length?(p=t[0]%360*vm,g=t[1]%360*vm,C()):[p*gm,g*gm]},k.rotate=function(t){return arguments.length?(v=t[0]%360*vm,m=t[1]%360*vm,y=t.length>2?t[2]%360*vm:0,C()):[v*gm,m*gm,y*gm]},k.angle=function(t){return arguments.length?(_=t%360*vm,C()):_*gm},k.precision=function(t){return arguments.length?(u=Nx(o,M=t*t),D()):Cm(M)},k.fitExtent=function(t,n){return Ex(k,t,n)},k.fitSize=function(t,n){return Cx(k,t,n)},k.fitWidth=function(t,n){return Dx(k,t,n)},k.fitHeight=function(t,n){return Fx(k,t,n)},function(){return n=t.apply(this,arguments),k.invert=n.invert&&E,C()}}function Px(t){var n=0,e=fm/3,r=Rx(t),i=r(n,e);return i.parallels=function(t){return arguments.length?r(n=t[0]*vm,e=t[1]*vm):[n*gm,e*gm]},i}function Lx(t,n){var e=km(t),r=(e+km(n))/2;if(mm(r)<lm)return function(t){var n=xm(t);function e(t,e){return[t*n,km(e)/n]}return e.invert=function(t,e){return[t/n,Sm(e*n)]},e}(t);var i=1+e*(2*r-e),a=Cm(i)/r;function u(t,n){var e=Cm(i-2*r*km(n))/r;return[e*km(t*=r),a-e*xm(t)]}return u.invert=function(t,n){var e=a-n;return[_m(t,mm(e))/r*Em(e),Sm((i-(t*t+e*e)*r*r)/(2*r))]},u}function qx(){return Px(Lx).scale(155.424).center([0,33.6442])}function Ux(){return qx().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function jx(t){return function(n,e){var r=xm(n),i=xm(e),a=t(r*i);return[a*i*km(n),a*km(e)]}}function Ix(t){return function(n,e){var r=Cm(n*n+e*e),i=t(r),a=km(i),u=xm(i);return[_m(n*a,r*u),Sm(r&&e*a/r)]}}var $x=jx(function(t){return Cm(2/(1+t))});$x.invert=Ix(function(t){return 2*Sm(t/2)});var Wx=jx(function(t){return(t=Fm(t))&&t/km(t)});function Hx(t,n){return[t,Am(Dm((hm+n)/2))]}function Yx(t){var n,e,r,i=Tx(t),a=i.center,u=i.scale,o=i.translate,s=i.clipExtent,l=null;function c(){var a=fm*u(),o=i(function(t){function n(n){return(n=t(n[0]*vm,n[1]*vm))[0]*=gm,n[1]*=gm,n}return t=t_(t[0]*vm,t[1]*vm,t.length>2?t[2]*vm:0),n.invert=function(n){return(n=t.invert(n[0]*vm,n[1]*vm))[0]*=gm,n[1]*=gm,n},n}(i.rotate()).invert([0,0]));return s(null==l?[[o[0]-a,o[1]-a],[o[0]+a,o[1]+a]]:t===Hx?[[Math.max(o[0]-a,l),n],[Math.min(o[0]+a,e),r]]:[[l,Math.max(o[1]-a,n)],[e,Math.min(o[1]+a,r)]])}return i.scale=function(t){return arguments.length?(u(t),c()):u()},i.translate=function(t){return arguments.length?(o(t),c()):o()},i.center=function(t){return arguments.length?(a(t),c()):a()},i.clipExtent=function(t){return arguments.length?(null==t?l=n=e=r=null:(l=+t[0][0],n=+t[0][1],e=+t[1][0],r=+t[1][1]),c()):null==l?null:[[l,n],[e,r]]},c()}function Gx(t){return Dm((hm+t)/2)}function Vx(t,n){var e=xm(t),r=t===n?km(t):Am(e/xm(n))/Am(Gx(n)/Gx(t)),i=e*Mm(Gx(t),r)/r;if(!r)return Hx;function a(t,n){i>0?n<-hm+lm&&(n=-hm+lm):n>hm-lm&&(n=hm-lm);var e=i/Mm(Gx(n),r);return[e*km(r*t),i-e*xm(r*t)]}return a.invert=function(t,n){var e=i-n,a=Em(r)*Cm(t*t+e*e);return[_m(t,mm(e))/r*Em(e),2*ym(Mm(i/a,1/r))-hm]},a}function Xx(t,n){return[t,n]}function Zx(t,n){var e=xm(t),r=t===n?km(t):(e-xm(n))/(n-t),i=e/r+t;if(mm(r)<lm)return Xx;function a(t,n){var e=i-n,a=r*t;return[e*km(a),i-e*xm(a)]}return a.invert=function(t,n){var e=i-n;return[_m(t,mm(e))/r*Em(e),i-Em(r)*Cm(t*t+e*e)]},a}function Jx(t,n){var e=xm(n),r=xm(t)*e;return[e*km(t)/r,km(n)/r]}function Qx(t,n,e,r){return 1===t&&1===n&&0===e&&0===r?M_:Ax({point:function(i,a){this.stream.point(i*t+e,a*n+r)}})}function Kx(t,n){var e=n*n,r=e*e;return[t*(.8707-.131979*e+r*(r*(.003971*e-.001529*r)-.013791)),n*(1.007226+e*(.015085+r*(.028874*e-.044475-.005916*r)))]}function tb(t,n){return[xm(n)*km(t),km(n)]}function nb(t,n){var e=xm(n),r=1+xm(t)*e;return[e*km(t)/r,km(n)/r]}function eb(t,n){return[Am(Dm((hm+n)/2)),-t]}Wx.invert=Ix(function(t){return t}),Hx.invert=function(t,n){return[t,2*ym(wm(n))-hm]},Xx.invert=Xx,Jx.invert=Ix(ym),Kx.invert=function(t,n){var e,r=n,i=25;do{var a=r*r,u=a*a;r-=e=(r*(1.007226+a*(.015085+u*(.028874*a-.044475-.005916*u)))-n)/(1.007226+a*(.045255+u*(.259866*a-.311325-.005916*11*u)))}while(mm(e)>lm&&--i>0);return[t/(.8707+(a=r*r)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),r]},tb.invert=Ix(Sm),nb.invert=Ix(function(t){return 2*ym(t)}),eb.invert=function(t,n){return[-n,2*ym(wm(t))-hm]};var rb=wx(),ib=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function ab(t,n){if(!t||"string"!=typeof t)throw new Error("Projection type must be a name string.");return t=t.toLowerCase(),arguments.length>1?(ob[t]=function(t,n){return function e(){var r=n();return r.type=t,r.path=wx().projection(r),r.copy=r.copy||function(){var t=e();return ib.forEach(function(n){r.hasOwnProperty(n)&&t[n](r[n]())}),t.path.pointRadius(r.path.pointRadius()),t},r}}(t,n),this):ob.hasOwnProperty(t)?ob[t]:null}function ub(t){return t&&t.path||rb}var ob={albers:Ux,albersusa:function(){var t,n,e,r,i,a,u=Ux(),o=qx().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=qx().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,n){a=[t,n]}};function c(t){var n=t[0],u=t[1];return a=null,e.point(n,u),a||(r.point(n,u),a)||(i.point(n,u),a)}function f(){return t=n=null,c}return c.invert=function(t){var n=u.scale(),e=u.translate(),r=(t[0]-e[0])/n,i=(t[1]-e[1])/n;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?o:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:u).invert(t)},c.stream=function(e){return t&&n===e?t:(r=[u.stream(n=e),o.stream(e),s.stream(e)],i=r.length,t={point:function(t,n){for(var e=-1;++e<i;)r[e].point(t,n)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},c.precision=function(t){return arguments.length?(u.precision(t),o.precision(t),s.precision(t),f()):u.precision()},c.scale=function(t){return arguments.length?(u.scale(t),o.scale(.35*t),s.scale(t),c.translate(u.translate())):u.scale()},c.translate=function(t){if(!arguments.length)return u.translate();var n=u.scale(),a=+t[0],c=+t[1];return e=u.translate(t).clipExtent([[a-.455*n,c-.238*n],[a+.455*n,c+.238*n]]).stream(l),r=o.translate([a-.307*n,c+.201*n]).clipExtent([[a-.425*n+lm,c+.12*n+lm],[a-.214*n-lm,c+.234*n-lm]]).stream(l),i=s.translate([a-.205*n,c+.212*n]).clipExtent([[a-.214*n+lm,c+.166*n+lm],[a-.115*n-lm,c+.234*n-lm]]).stream(l),f()},c.fitExtent=function(t,n){return Ex(c,t,n)},c.fitSize=function(t,n){return Cx(c,t,n)},c.fitWidth=function(t,n){return Dx(c,t,n)},c.fitHeight=function(t,n){return Fx(c,t,n)},c.scale(1070)},azimuthalequalarea:function(){return Tx($x).scale(124.75).clipAngle(179.999)},azimuthalequidistant:function(){return Tx(Wx).scale(79.4188).clipAngle(179.999)},conicconformal:function(){return Px(Vx).scale(109.5).parallels([30,30])},conicequalarea:qx,conicequidistant:function(){return Px(Zx).scale(131.154).center([0,13.9389])},equirectangular:function(){return Tx(Xx).scale(152.63)},gnomonic:function(){return Tx(Jx).scale(144.049).clipAngle(60)},identity:function(){var t,n,e,r,i,a,u=1,o=0,s=0,l=1,c=1,f=M_,h=null,d=M_;function p(){return r=i=null,a}return a={stream:function(t){return r&&i===t?r:r=f(d(i=t))},postclip:function(r){return arguments.length?(d=r,h=t=n=e=null,p()):d},clipExtent:function(r){return arguments.length?(d=null==r?(h=t=n=e=null,M_):b_(h=+r[0][0],t=+r[0][1],n=+r[1][0],e=+r[1][1]),p()):null==h?null:[[h,t],[n,e]]},scale:function(t){return arguments.length?(f=Qx((u=+t)*l,u*c,o,s),p()):u},translate:function(t){return arguments.length?(f=Qx(u*l,u*c,o=+t[0],s=+t[1]),p()):[o,s]},reflectX:function(t){return arguments.length?(f=Qx(u*(l=t?-1:1),u*c,o,s),p()):l<0},reflectY:function(t){return arguments.length?(f=Qx(u*l,u*(c=t?-1:1),o,s),p()):c<0},fitExtent:function(t,n){return Ex(a,t,n)},fitSize:function(t,n){return Cx(a,t,n)},fitWidth:function(t,n){return Dx(a,t,n)},fitHeight:function(t,n){return Fx(a,t,n)}}},mercator:function(){return Yx(Hx).scale(961/pm)},naturalEarth1:function(){return Tx(Kx).scale(175.295)},orthographic:function(){return Tx(tb).scale(249.5).clipAngle(90+lm)},stereographic:function(){return Tx(nb).scale(250).clipAngle(142)},transversemercator:function(){var t=Yx(eb),n=t.center,e=t.rotate;return t.center=function(t){return arguments.length?n([-t[1],t[0]]):[(t=n())[1],-t[0]]},t.rotate=function(t){return arguments.length?e([t[0],t[1],t.length>2?t[2]+90:90]):[(t=e())[0],t[1],t[2]-90]},e([0,0,90]).scale(159.155)}};for(var sb in ob)ab(sb,ob[sb]);function lb(t){Ir.call(this,null,t)}function cb(t){Ir.call(this,null,t)}function fb(t){Ir.call(this,null,t)}function hb(t){Ir.call(this,[],t),this.generator=function(){var t,n,e,r,i,a,u,o,s,l,c,f,h=10,d=h,p=90,g=360,v=2.5;function m(){return{type:"MultiLineString",coordinates:y()}}function y(){return h_(bm(r/p)*p,e,p).map(c).concat(h_(bm(o/g)*g,u,g).map(f)).concat(h_(bm(n/h)*h,t,h).filter(function(t){return mm(t%p)>lm}).map(s)).concat(h_(bm(a/d)*d,i,d).filter(function(t){return mm(t%g)>lm}).map(l))}return m.lines=function(){return y().map(function(t){return{type:"LineString",coordinates:t}})},m.outline=function(){return{type:"Polygon",coordinates:[c(r).concat(f(u).slice(1),c(e).reverse().slice(1),f(o).reverse().slice(1))]}},m.extent=function(t){return arguments.length?m.extentMajor(t).extentMinor(t):m.extentMinor()},m.extentMajor=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],u=+t[1][1],r>e&&(t=r,r=e,e=t),o>u&&(t=o,o=u,u=t),m.precision(v)):[[r,o],[e,u]]},m.extentMinor=function(e){return arguments.length?(n=+e[0][0],t=+e[1][0],a=+e[0][1],i=+e[1][1],n>t&&(e=n,n=t,t=e),a>i&&(e=a,a=i,i=e),m.precision(v)):[[n,a],[t,i]]},m.step=function(t){return arguments.length?m.stepMajor(t).stepMinor(t):m.stepMinor()},m.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],m):[p,g]},m.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],m):[h,d]},m.precision=function(h){return arguments.length?(v=+h,s=w_(a,i,90),l=A_(n,t,v),c=w_(o,u,90),f=A_(r,e,v),m):v},m.extentMajor([[-180,-90+lm],[180,90-lm]]).extentMinor([[-180,-80-lm],[180,80+lm]])}()}function db(t){Ir.call(this,null,t),this.modified(!0)}function pb(t,n,e){Y(t[n])&&t[n](e)}lb.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},et(lb,Ir).transform=function(t,n){var e=n.fork(n.ALL),r=this.value,i=t.field||d,a=t.as||"path",u=e.SOURCE;!r||t.modified()?(this.value=r=ub(t.projection),e.materialize().reflow()):u=i===d||n.modified(i.fields)?e.ADD_MOD:e.ADD;var o=function(t,n){var e=t.pointRadius();t.context(null),null!=n&&t.pointRadius(n);return e}(r,t.pointRadius);return e.visit(u,function(t){t[a]=r(i(t))}),r.pointRadius(o),e.modifies(a)},cb.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},et(cb,Ir).transform=function(t,n){var e,r=t.projection,i=t.fields[0],a=t.fields[1],u=t.as||["x","y"],o=u[0],s=u[1];function l(t){var n=r([i(t),a(t)]);n?(t[o]=n[0],t[s]=n[1]):(t[o]=void 0,t[s]=void 0)}return t.modified()?n=n.materialize().reflow(!0).visit(n.SOURCE,l):(e=n.modified(i.fields)||n.modified(a.fields),n.visit(e?n.ADD_MOD:n.ADD,l)),n.modifies(u)},fb.Definition={type:"GeoShape",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},et(fb,Ir).transform=function(t,n){var e=n.fork(n.ALL),r=this.value,i=t.field||c("datum"),a=t.as||"shape",u=e.ADD_MOD;return r&&!t.modified()||(this.value=r=function(t,n,e){var r=null==e?function(e){return t(n(e))}:function(r){var i=t.pointRadius(),a=t.pointRadius(e)(n(r));return t.pointRadius(i),a};return r.context=function(n){return t.context(n),r},r}(ub(t.projection),i,t.pointRadius),e.materialize().reflow(),u=e.SOURCE),e.visit(u,function(t){t[a]=r}),e.modifies(a)},hb.Definition={type:"Graticule",metadata:{changes:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},et(hb,Ir).transform=function(t,n){var e,r=this.value,i=this.generator;if(!r.length||t.modified())for(var a in t)Y(i[a])&&i[a](t[a]);return e=i(),r.length?n.mod.push(St(r[0],e)):n.add.push(Ct(e)),r[0]=e,n},et(db,Ir).transform=function(t,n){var e=this.value;return!e||t.modified("type")?(this.value=e=function(t){var n=ab((t||"mercator").toLowerCase());n||i("Unrecognized projection type: "+t);return n()}(t.type),ib.forEach(function(n){null!=t[n]&&pb(e,n,t[n])})):ib.forEach(function(n){t.modified(n)&&pb(e,n,t[n])}),null!=t.pointRadius&&e.path.pointRadius(t.pointRadius),t.fit&&function(t,n){var e=(r=n.fit,1===(r=W(r)).length?r[0]:{type:rm,features:r.reduce(function(t,n){return n&&n.type===rm?t.push.apply(t,n.features):u(n)?t.push.apply(t,n):t.push(n),t},[])});var r;n.extent?t.fitExtent(n.extent,e):n.size&&t.fitSize(n.size,e)}(e,t),n.fork(n.NO_SOURCE|n.NO_FIELDS)};var gb=Object.freeze({contour:em,geojson:im,geopath:lb,geopoint:cb,geoshape:fb,graticule:hb,projection:db});function vb(t,n,e,r){if(isNaN(n)||isNaN(e))return t;var i,a,u,o,s,l,c,f,h,d=t._root,p={data:r},g=t._x0,v=t._y0,m=t._x1,y=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((l=n>=(a=(g+m)/2))?g=a:m=a,(c=e>=(u=(v+y)/2))?v=u:y=u,i=d,!(d=d[f=c<<1|l]))return i[f]=p,t;if(o=+t._x.call(null,d.data),s=+t._y.call(null,d.data),n===o&&e===s)return p.next=d,i?i[f]=p:t._root=p,t;do{i=i?i[f]=new Array(4):t._root=new Array(4),(l=n>=(a=(g+m)/2))?g=a:m=a,(c=e>=(u=(v+y)/2))?v=u:y=u}while((f=c<<1|l)==(h=(s>=u)<<1|o>=a));return i[h]=d,i[f]=p,t}function mb(t,n,e,r,i){this.node=t,this.x0=n,this.y0=e,this.x1=r,this.y1=i}function yb(t){return t[0]}function _b(t){return t[1]}function xb(t,n,e){var r=new bb(null==n?yb:n,null==e?_b:e,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function bb(t,n,e,r,i,a){this._x=t,this._y=n,this._x0=e,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function wb(t){for(var n={data:t.data},e=n;t=t.next;)e=e.next={data:t.data};return n}var Ab=xb.prototype=bb.prototype;function Mb(t){return function(){return t}}function kb(){return 1e-6*(Math.random()-.5)}function Eb(t){return t.x+t.vx}function Cb(t){return t.y+t.vy}function Db(t){return t.index}function Fb(t,n){var e=t.get(n);if(!e)throw new Error("missing: "+n);return e}Ab.copy=function(){var t,n,e=new bb(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return e;if(!r.length)return e._root=wb(r),e;for(t=[{source:r,target:e._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(n=r.source[i])&&(n.length?t.push({source:n,target:r.target[i]=new Array(4)}):r.target[i]=wb(n));return e},Ab.add=function(t){var n=+this._x.call(null,t),e=+this._y.call(null,t);return vb(this.cover(n,e),n,e,t)},Ab.addAll=function(t){var n,e,r,i,a=t.length,u=new Array(a),o=new Array(a),s=1/0,l=1/0,c=-1/0,f=-1/0;for(e=0;e<a;++e)isNaN(r=+this._x.call(null,n=t[e]))||isNaN(i=+this._y.call(null,n))||(u[e]=r,o[e]=i,r<s&&(s=r),r>c&&(c=r),i<l&&(l=i),i>f&&(f=i));if(s>c||l>f)return this;for(this.cover(s,l).cover(c,f),e=0;e<a;++e)vb(this,u[e],o[e],t[e]);return this},Ab.cover=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var e=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(e))i=(e=Math.floor(t))+1,a=(r=Math.floor(n))+1;else{for(var u,o,s=i-e,l=this._root;e>t||t>=i||r>n||n>=a;)switch(o=(n<r)<<1|t<e,(u=new Array(4))[o]=l,l=u,s*=2,o){case 0:i=e+s,a=r+s;break;case 1:e=i-s,a=r+s;break;case 2:i=e+s,r=a-s;break;case 3:e=i-s,r=a-s}this._root&&this._root.length&&(this._root=l)}return this._x0=e,this._y0=r,this._x1=i,this._y1=a,this},Ab.data=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},Ab.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},Ab.find=function(t,n,e){var r,i,a,u,o,s,l,c=this._x0,f=this._y0,h=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new mb(g,c,f,h,d)),null==e?e=1/0:(c=t-e,f=n-e,h=t+e,d=n+e,e*=e);s=p.pop();)if(!(!(g=s.node)||(i=s.x0)>h||(a=s.y0)>d||(u=s.x1)<c||(o=s.y1)<f))if(g.length){var v=(i+u)/2,m=(a+o)/2;p.push(new mb(g[3],v,m,u,o),new mb(g[2],i,m,v,o),new mb(g[1],v,a,u,m),new mb(g[0],i,a,v,m)),(l=(n>=m)<<1|t>=v)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var y=t-+this._x.call(null,g.data),_=n-+this._y.call(null,g.data),x=y*y+_*_;if(x<e){var b=Math.sqrt(e=x);c=t-b,f=n-b,h=t+b,d=n+b,r=g.data}}return r},Ab.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(u=+this._y.call(null,t)))return this;var n,e,r,i,a,u,o,s,l,c,f,h,d=this._root,p=this._x0,g=this._y0,v=this._x1,m=this._y1;if(!d)return this;if(d.length)for(;;){if((l=a>=(o=(p+v)/2))?p=o:v=o,(c=u>=(s=(g+m)/2))?g=s:m=s,n=d,!(d=d[f=c<<1|l]))return this;if(!d.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(e=n,h=f)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):n?(i?n[f]=i:delete n[f],(d=n[0]||n[1]||n[2]||n[3])&&d===(n[3]||n[2]||n[1]||n[0])&&!d.length&&(e?e[h]=d:this._root=d),this):(this._root=i,this)},Ab.removeAll=function(t){for(var n=0,e=t.length;n<e;++n)this.remove(t[n]);return this},Ab.root=function(){return this._root},Ab.size=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},Ab.visit=function(t){var n,e,r,i,a,u,o=[],s=this._root;for(s&&o.push(new mb(s,this._x0,this._y0,this._x1,this._y1));n=o.pop();)if(!t(s=n.node,r=n.x0,i=n.y0,a=n.x1,u=n.y1)&&s.length){var l=(r+a)/2,c=(i+u)/2;(e=s[3])&&o.push(new mb(e,l,c,a,u)),(e=s[2])&&o.push(new mb(e,r,c,l,u)),(e=s[1])&&o.push(new mb(e,l,i,a,c)),(e=s[0])&&o.push(new mb(e,r,i,l,c))}return this},Ab.visitAfter=function(t){var n,e=[],r=[];for(this._root&&e.push(new mb(this._root,this._x0,this._y0,this._x1,this._y1));n=e.pop();){var i=n.node;if(i.length){var a,u=n.x0,o=n.y0,s=n.x1,l=n.y1,c=(u+s)/2,f=(o+l)/2;(a=i[0])&&e.push(new mb(a,u,o,c,f)),(a=i[1])&&e.push(new mb(a,c,o,s,f)),(a=i[2])&&e.push(new mb(a,u,f,c,l)),(a=i[3])&&e.push(new mb(a,c,f,s,l))}r.push(n)}for(;n=r.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},Ab.x=function(t){return arguments.length?(this._x=t,this):this._x},Ab.y=function(t){return arguments.length?(this._y=t,this):this._y};var Sb={value:function(){}};function Bb(){for(var t,n=0,e=arguments.length,r={};n<e;++n){if(!(t=arguments[n]+"")||t in r)throw new Error("illegal type: "+t);r[t]=[]}return new Nb(r)}function Nb(t){this._=t}function Ob(t,n){for(var e,r=0,i=t.length;r<i;++r)if((e=t[r]).name===n)return e.value}function zb(t,n,e){for(var r=0,i=t.length;r<i;++r)if(t[r].name===n){t[r]=Sb,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=e&&t.push({name:n,value:e}),t}Nb.prototype=Bb.prototype={constructor:Nb,on:function(t,n){var e,r,i=this._,a=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var n="",e=t.indexOf(".");if(e>=0&&(n=t.slice(e+1),t=t.slice(0,e)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})),u=-1,o=a.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++u<o;)if(e=(t=a[u]).type)i[e]=zb(i[e],t.name,n);else if(null==n)for(e in i)i[e]=zb(i[e],t.name,null);return this}for(;++u<o;)if((e=(t=a[u]).type)&&(e=Ob(i[e],t.name)))return e},copy:function(){var t={},n=this._;for(var e in n)t[e]=n[e].slice();return new Nb(t)},call:function(t,n){if((e=arguments.length-2)>0)for(var e,r,i=new Array(e),a=0;a<e;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,e=(r=this._[t]).length;a<e;++a)r[a].value.apply(n,i)},apply:function(t,n,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,a=r.length;i<a;++i)r[i].value.apply(n,e)}};var Tb,Rb,Pb=0,Lb=0,qb=0,Ub=1e3,jb=0,Ib=0,$b=0,Wb="object"==typeof performance&&performance.now?performance:Date,Hb="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Yb(){return Ib||(Hb(Gb),Ib=Wb.now()+$b)}function Gb(){Ib=0}function Vb(){this._call=this._time=this._next=null}function Xb(t,n,e){var r=new Vb;return r.restart(t,n,e),r}function Zb(){Ib=(jb=Wb.now())+$b,Pb=Lb=0;try{!function(){Yb(),++Pb;for(var t,n=Tb;n;)(t=Ib-n._time)>=0&&n._call.call(null,t),n=n._next;--Pb}()}finally{Pb=0,function(){var t,n,e=Tb,r=1/0;for(;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Tb=n);Rb=t,Qb(r)}(),Ib=0}}function Jb(){var t=Wb.now(),n=t-jb;n>Ub&&($b-=n,jb=t)}function Qb(t){Pb||(Lb&&(Lb=clearTimeout(Lb)),t-Ib>24?(t<1/0&&(Lb=setTimeout(Zb,t-Wb.now()-$b)),qb&&(qb=clearInterval(qb))):(qb||(jb=Wb.now(),qb=setInterval(Jb,Ub)),Pb=1,Hb(Zb)))}function Kb(t){return t.x}function tw(t){return t.y}Vb.prototype=Xb.prototype={constructor:Vb,restart:function(t,n,e){if("function"!=typeof t)throw new TypeError("callback is not a function");e=(null==e?Yb():+e)+(null==n?0:+n),this._next||Rb===this||(Rb?Rb._next=this:Tb=this,Rb=this),this._call=t,this._time=e,Qb()},stop:function(){this._call&&(this._call=null,this._time=1/0,Qb())}};var nw=10,ew=Math.PI*(3-Math.sqrt(5));var rw={center:function(t,n){var e;function r(){var r,i,a=e.length,u=0,o=0;for(r=0;r<a;++r)u+=(i=e[r]).x,o+=i.y;for(u=u/a-t,o=o/a-n,r=0;r<a;++r)(i=e[r]).x-=u,i.y-=o}return null==t&&(t=0),null==n&&(n=0),r.initialize=function(t){e=t},r.x=function(n){return arguments.length?(t=+n,r):t},r.y=function(t){return arguments.length?(n=+t,r):n},r},collide:function(t){var n,e,r=1,i=1;function a(){for(var t,a,o,s,l,c,f,h=n.length,d=0;d<i;++d)for(a=xb(n,Eb,Cb).visitAfter(u),t=0;t<h;++t)o=n[t],c=e[o.index],f=c*c,s=o.x+o.vx,l=o.y+o.vy,a.visit(p);function p(t,n,e,i,a){var u=t.data,h=t.r,d=c+h;if(!u)return n>s+d||i<s-d||e>l+d||a<l-d;if(u.index>o.index){var p=s-u.x-u.vx,g=l-u.y-u.vy,v=p*p+g*g;v<d*d&&(0===p&&(v+=(p=kb())*p),0===g&&(v+=(g=kb())*g),v=(d-(v=Math.sqrt(v)))/v*r,o.vx+=(p*=v)*(d=(h*=h)/(f+h)),o.vy+=(g*=v)*d,u.vx-=p*(d=1-d),u.vy-=g*d)}}}function u(t){if(t.data)return t.r=e[t.data.index];for(var n=t.r=0;n<4;++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function o(){if(n){var r,i,a=n.length;for(e=new Array(a),r=0;r<a;++r)i=n[r],e[i.index]=+t(i,r,n)}}return"function"!=typeof t&&(t=Mb(null==t?1:+t)),a.initialize=function(t){n=t,o()},a.iterations=function(t){return arguments.length?(i=+t,a):i},a.strength=function(t){return arguments.length?(r=+t,a):r},a.radius=function(n){return arguments.length?(t="function"==typeof n?n:Mb(+n),o(),a):t},a},nbody:function(){var t,n,e,r,i=Mb(-30),a=1,u=1/0,o=.81;function s(r){var i,a=t.length,u=xb(t,Kb,tw).visitAfter(c);for(e=r,i=0;i<a;++i)n=t[i],u.visit(f)}function l(){if(t){var n,e,a=t.length;for(r=new Array(a),n=0;n<a;++n)e=t[n],r[e.index]=+i(e,n,t)}}function c(t){var n,e,i,a,u,o=0,s=0;if(t.length){for(i=a=u=0;u<4;++u)(n=t[u])&&(e=Math.abs(n.value))&&(o+=n.value,s+=e,i+=e*n.x,a+=e*n.y);t.x=i/s,t.y=a/s}else{(n=t).x=n.data.x,n.y=n.data.y;do{o+=r[n.data.index]}while(n=n.next)}t.value=o}function f(t,i,s,l){if(!t.value)return!0;var c=t.x-n.x,f=t.y-n.y,h=l-i,d=c*c+f*f;if(h*h/o<d)return d<u&&(0===c&&(d+=(c=kb())*c),0===f&&(d+=(f=kb())*f),d<a&&(d=Math.sqrt(a*d)),n.vx+=c*t.value*e/d,n.vy+=f*t.value*e/d),!0;if(!(t.length||d>=u)){(t.data!==n||t.next)&&(0===c&&(d+=(c=kb())*c),0===f&&(d+=(f=kb())*f),d<a&&(d=Math.sqrt(a*d)));do{t.data!==n&&(h=r[t.data.index]*e/d,n.vx+=c*h,n.vy+=f*h)}while(t=t.next)}}return s.initialize=function(n){t=n,l()},s.strength=function(t){return arguments.length?(i="function"==typeof t?t:Mb(+t),l(),s):i},s.distanceMin=function(t){return arguments.length?(a=t*t,s):Math.sqrt(a)},s.distanceMax=function(t){return arguments.length?(u=t*t,s):Math.sqrt(u)},s.theta=function(t){return arguments.length?(o=t*t,s):Math.sqrt(o)},s},link:function(t){var n,e,r,i,a,u=Db,o=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},s=Mb(30),l=1;function c(r){for(var i=0,u=t.length;i<l;++i)for(var o,s,c,f,h,d,p,g=0;g<u;++g)s=(o=t[g]).source,f=(c=o.target).x+c.vx-s.x-s.vx||kb(),h=c.y+c.vy-s.y-s.vy||kb(),f*=d=((d=Math.sqrt(f*f+h*h))-e[g])/d*r*n[g],h*=d,c.vx-=f*(p=a[g]),c.vy-=h*p,s.vx+=f*(p=1-p),s.vy+=h*p}function f(){if(r){var o,s,l=r.length,c=t.length,f=new Map(r.map((t,n)=>[u(t,n,r),t]));for(o=0,i=new Array(l);o<c;++o)(s=t[o]).index=o,"object"!=typeof s.source&&(s.source=Fb(f,s.source)),"object"!=typeof s.target&&(s.target=Fb(f,s.target)),i[s.source.index]=(i[s.source.index]||0)+1,i[s.target.index]=(i[s.target.index]||0)+1;for(o=0,a=new Array(c);o<c;++o)s=t[o],a[o]=i[s.source.index]/(i[s.source.index]+i[s.target.index]);n=new Array(c),h(),e=new Array(c),d()}}function h(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+o(t[e],e,t)}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+s(t[n],n,t)}return null==t&&(t=[]),c.initialize=function(t){r=t,f()},c.links=function(n){return arguments.length?(t=n,f(),c):t},c.id=function(t){return arguments.length?(u=t,c):u},c.iterations=function(t){return arguments.length?(l=+t,c):l},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:Mb(+t),h(),c):o},c.distance=function(t){return arguments.length?(s="function"==typeof t?t:Mb(+t),d(),c):s},c},x:function(t){var n,e,r,i=Mb(.1);function a(t){for(var i,a=0,u=n.length;a<u;++a)(i=n[a]).vx+=(r[a]-i.x)*e[a]*t}function u(){if(n){var a,u=n.length;for(e=new Array(u),r=new Array(u),a=0;a<u;++a)e[a]=isNaN(r[a]=+t(n[a],a,n))?0:+i(n[a],a,n)}}return"function"!=typeof t&&(t=Mb(null==t?0:+t)),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(i="function"==typeof t?t:Mb(+t),u(),a):i},a.x=function(n){return arguments.length?(t="function"==typeof n?n:Mb(+n),u(),a):t},a},y:function(t){var n,e,r,i=Mb(.1);function a(t){for(var i,a=0,u=n.length;a<u;++a)(i=n[a]).vy+=(r[a]-i.y)*e[a]*t}function u(){if(n){var a,u=n.length;for(e=new Array(u),r=new Array(u),a=0;a<u;++a)e[a]=isNaN(r[a]=+t(n[a],a,n))?0:+i(n[a],a,n)}}return"function"!=typeof t&&(t=Mb(null==t?0:+t)),a.initialize=function(t){n=t,u()},a.strength=function(t){return arguments.length?(i="function"==typeof t?t:Mb(+t),u(),a):i},a.y=function(n){return arguments.length?(t="function"==typeof n?n:Mb(+n),u(),a):t},a}},iw="forces",aw=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],uw=["static","iterations"],ow=["x","y","vx","vy"];function sw(t){Ir.call(this,null,t)}sw.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:ow}]};var lw=et(sw,Ir);function cw(t,n,e,r){var i,a,u,o,s=W(n.forces);for(i=0,a=aw.length;i<a;++i)(u=aw[i])!==iw&&n.modified(u)&&t[u](n[u]);for(i=0,a=s.length;i<a;++i)o=iw+i,(u=e||n.modified(iw,i)?hw(s[i]):r&&fw(s[i],r)?t.force(o):null)&&t.force(o,u);for(a=t.numForces||0;i<a;++i)t.force(iw+i,null);return t.numForces=s.length,t}function fw(t,n){var e,i;for(e in t)if(Y(i=t[e])&&n.modified(r(i)))return 1;return 0}function hw(t){var n,e;for(e in rw.hasOwnProperty(t.force)||i("Unrecognized force: "+t.force),n=rw[t.force](),t)Y(n[e])&&dw(n[e],t[e],t);return n}function dw(t,n,e){t(Y(n)?function(t){return n(t,e)}:n)}lw.transform=function(t,n){var e,r,i=this.value,a=n.changed(n.ADD_REM),u=t.modified(aw),o=t.iterations||300;if(i?(a&&(n.modifies("index"),i.nodes(n.source)),(u||n.changed(n.MOD))&&cw(i,t,0,n)):(this.value=i=function(t,n){var e=function(t){var n,e=1,r=.001,i=1-Math.pow(r,1/300),a=0,u=.6,o=new Map,s=Xb(c),l=Bb("tick","end");function c(){f(),l.call("tick",n),e<r&&(s.stop(),l.call("end",n))}function f(r){var s,l,c=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(e+=(a-e)*i,o.forEach(function(t){t(e)}),s=0;s<c;++s)null==(l=t[s]).fx?l.x+=l.vx*=u:(l.x=l.fx,l.vx=0),null==l.fy?l.y+=l.vy*=u:(l.y=l.fy,l.vy=0);return n}function h(){for(var n,e=0,r=t.length;e<r;++e){if((n=t[e]).index=e,isNaN(n.fx)||(n.x=n.fx),isNaN(n.fy)||(n.y=n.fy),isNaN(n.x)||isNaN(n.y)){var i=nw*Math.sqrt(e),a=e*ew;n.x=i*Math.cos(a),n.y=i*Math.sin(a)}(isNaN(n.vx)||isNaN(n.vy))&&(n.vx=n.vy=0)}}function d(n){return n.initialize&&n.initialize(t),n}return null==t&&(t=[]),h(),n={tick:f,restart:function(){return s.restart(c),n},stop:function(){return s.stop(),n},nodes:function(e){return arguments.length?(t=e,h(),o.forEach(d),n):t},alpha:function(t){return arguments.length?(e=+t,n):e},alphaMin:function(t){return arguments.length?(r=+t,n):r},alphaDecay:function(t){return arguments.length?(i=+t,n):+i},alphaTarget:function(t){return arguments.length?(a=+t,n):a},velocityDecay:function(t){return arguments.length?(u=1-t,n):1-u},force:function(t,e){return arguments.length>1?(null==e?o.delete(t):o.set(t,d(e)),n):o.get(t)},find:function(n,e,r){var i,a,u,o,s,l=0,c=t.length;for(null==r?r=1/0:r*=r,l=0;l<c;++l)(u=(i=n-(o=t[l]).x)*i+(a=e-o.y)*a)<r&&(s=o,r=u);return s},on:function(t,e){return arguments.length>1?(l.on(t,e),n):l.on(t)}}}(t),r=!1,i=e.stop,a=e.restart;return e.stopped=function(){return r},e.restart=function(){return r=!1,a()},e.stop=function(){return r=!0,i()},cw(e,n,!0).on("end",function(){r=!0})}(n.source,t),i.on("tick",(e=n.dataflow,r=this,function(){e.touch(r).run()})),t.static||(a=!0,i.tick()),n.modifies("index")),u||a||t.modified(uw)||n.changed()&&t.restart)if(i.alpha(Math.max(i.alpha(),t.alpha||1)).alphaDecay(1-Math.pow(i.alphaMin(),1/o)),t.static)for(i.stop();--o>=0;)i.tick();else if(i.stopped()&&i.restart(),!a)return n.StopPropagation;return this.finish(t,n)},lw.finish=function(t,n){for(var e,r=n.dataflow,i=this._argops,a=0,u=i.length;a<u;++a)if((e=i[a]).name===iw&&"link"===e.op._argval.force)for(var o,s=e.op._argops,l=0,c=s.length;l<c;++l)if("links"===s[l].name&&(o=s[l].op.source)){r.pulse(o,r.changeset().reflow());break}return n.reflow(t.modified()).modifies(ow)};var pw=Object.freeze({force:sw});function gw(t,n,e){var r={};return t.each(function(t){var i=t.data;e(i)&&(r[n(i)]=t)}),t.lookup=r,t}function vw(t,n){return t.parent===n.parent?1:2}function mw(t,n){return t+n.x}function yw(t,n){return Math.max(t,n.y)}function _w(t){var n=0,e=t.children,r=e&&e.length;if(r)for(;--r>=0;)n+=e[r].value;else n=1;t.value=n}function xw(t,n){var e,r,i,a,u,o=new Mw(t),s=+t.value&&(o.value=t.value),l=[o];for(null==n&&(n=bw);e=l.pop();)if(s&&(e.value=+e.data.value),(i=n(e.data))&&(u=i.length))for(e.children=new Array(u),a=u-1;a>=0;--a)l.push(r=e.children[a]=new Mw(i[a])),r.parent=e,r.depth=e.depth+1;return o.eachBefore(Aw)}function bw(t){return t.children}function ww(t){t.data=t.data.data}function Aw(t){var n=0;do{t.height=n}while((t=t.parent)&&t.height<++n)}function Mw(t){this.data=t,this.depth=this.height=0,this.parent=null}Mw.prototype=xw.prototype={constructor:Mw,count:function(){return this.eachAfter(_w)},each:function(t){var n,e,r,i,a=this,u=[a];do{for(n=u.reverse(),u=[];a=n.pop();)if(t(a),e=a.children)for(r=0,i=e.length;r<i;++r)u.push(e[r])}while(u.length);return this},eachAfter:function(t){for(var n,e,r,i=this,a=[i],u=[];i=a.pop();)if(u.push(i),n=i.children)for(e=0,r=n.length;e<r;++e)a.push(n[e]);for(;i=u.pop();)t(i);return this},eachBefore:function(t){for(var n,e,r=this,i=[r];r=i.pop();)if(t(r),n=r.children)for(e=n.length-1;e>=0;--e)i.push(n[e]);return this},sum:function(t){return this.eachAfter(function(n){for(var e=+t(n.data)||0,r=n.children,i=r&&r.length;--i>=0;)e+=r[i].value;n.value=e})},sort:function(t){return this.eachBefore(function(n){n.children&&n.children.sort(t)})},path:function(t){for(var n=this,e=function(t,n){if(t===n)return t;var e=t.ancestors(),r=n.ancestors(),i=null;for(t=e.pop(),n=r.pop();t===n;)i=t,t=e.pop(),n=r.pop();return i}(n,t),r=[n];n!==e;)n=n.parent,r.push(n);for(var i=r.length;t!==e;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,n=[t];t=t.parent;)n.push(t);return n},descendants:function(){var t=[];return this.each(function(n){t.push(n)}),t},leaves:function(){var t=[];return this.eachBefore(function(n){n.children||t.push(n)}),t},links:function(){var t=this,n=[];return t.each(function(e){e!==t&&n.push({source:e.parent,target:e})}),n},copy:function(){return xw(this).eachBefore(ww)}};var kw=Array.prototype.slice;function Ew(t){for(var n,e,r=0,i=(t=function(t){for(var n,e,r=t.length;r;)e=Math.random()*r--|0,n=t[r],t[r]=t[e],t[e]=n;return t}(kw.call(t))).length,a=[];r<i;)n=t[r],e&&Fw(e,n)?++r:(e=Bw(a=Cw(a,n)),r=0);return e}function Cw(t,n){var e,r;if(Sw(n,t))return[n];for(e=0;e<t.length;++e)if(Dw(n,t[e])&&Sw(Nw(t[e],n),t))return[t[e],n];for(e=0;e<t.length-1;++e)for(r=e+1;r<t.length;++r)if(Dw(Nw(t[e],t[r]),n)&&Dw(Nw(t[e],n),t[r])&&Dw(Nw(t[r],n),t[e])&&Sw(Ow(t[e],t[r],n),t))return[t[e],t[r],n];throw new Error}function Dw(t,n){var e=t.r-n.r,r=n.x-t.x,i=n.y-t.y;return e<0||e*e<r*r+i*i}function Fw(t,n){var e=t.r-n.r+1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function Sw(t,n){for(var e=0;e<n.length;++e)if(!Fw(t,n[e]))return!1;return!0}function Bw(t){switch(t.length){case 1:return{x:(n=t[0]).x,y:n.y,r:n.r};case 2:return Nw(t[0],t[1]);case 3:return Ow(t[0],t[1],t[2])}var n}function Nw(t,n){var e=t.x,r=t.y,i=t.r,a=n.x,u=n.y,o=n.r,s=a-e,l=u-r,c=o-i,f=Math.sqrt(s*s+l*l);return{x:(e+a+s/f*c)/2,y:(r+u+l/f*c)/2,r:(f+i+o)/2}}function Ow(t,n,e){var r=t.x,i=t.y,a=t.r,u=n.x,o=n.y,s=n.r,l=e.x,c=e.y,f=e.r,h=r-u,d=r-l,p=i-o,g=i-c,v=s-a,m=f-a,y=r*r+i*i-a*a,_=y-u*u-o*o+s*s,x=y-l*l-c*c+f*f,b=d*p-h*g,w=(p*x-g*_)/(2*b)-r,A=(g*v-p*m)/b,M=(d*_-h*x)/(2*b)-i,k=(h*m-d*v)/b,E=A*A+k*k-1,C=2*(a+w*A+M*k),D=w*w+M*M-a*a,F=-(E?(C+Math.sqrt(C*C-4*E*D))/(2*E):D/C);return{x:r+w+A*F,y:i+M+k*F,r:F}}function zw(t,n,e){var r,i,a,u,o=t.x-n.x,s=t.y-n.y,l=o*o+s*s;l?(i=n.r+e.r,i*=i,u=t.r+e.r,i>(u*=u)?(r=(l+u-i)/(2*l),a=Math.sqrt(Math.max(0,u/l-r*r)),e.x=t.x-r*o-a*s,e.y=t.y-r*s+a*o):(r=(l+i-u)/(2*l),a=Math.sqrt(Math.max(0,i/l-r*r)),e.x=n.x+r*o-a*s,e.y=n.y+r*s+a*o)):(e.x=n.x+e.r,e.y=n.y)}function Tw(t,n){var e=t.r+n.r-1e-6,r=n.x-t.x,i=n.y-t.y;return e>0&&e*e>r*r+i*i}function Rw(t){var n=t._,e=t.next._,r=n.r+e.r,i=(n.x*e.r+e.x*n.r)/r,a=(n.y*e.r+e.y*n.r)/r;return i*i+a*a}function Pw(t){this._=t,this.next=null,this.previous=null}function Lw(t){if("function"!=typeof t)throw new Error;return t}function qw(){return 0}function Uw(t){return function(){return t}}function jw(t){return Math.sqrt(t.value)}function Iw(t){return function(n){n.children||(n.r=Math.max(0,+t(n)||0))}}function $w(t,n){return function(e){if(r=e.children){var r,i,a,u=r.length,o=t(e)*n||0;if(o)for(i=0;i<u;++i)r[i].r+=o;if(a=function(t){if(!(i=t.length))return 0;var n,e,r,i,a,u,o,s,l,c,f;if((n=t[0]).x=0,n.y=0,!(i>1))return n.r;if(e=t[1],n.x=-e.r,e.x=n.r,e.y=0,!(i>2))return n.r+e.r;zw(e,n,r=t[2]),n=new Pw(n),e=new Pw(e),r=new Pw(r),n.next=r.previous=e,e.next=n.previous=r,r.next=e.previous=n;t:for(o=3;o<i;++o){zw(n._,e._,r=t[o]),r=new Pw(r),s=e.next,l=n.previous,c=e._.r,f=n._.r;do{if(c<=f){if(Tw(s._,r._)){e=s,n.next=e,e.previous=n,--o;continue t}c+=s._.r,s=s.next}else{if(Tw(l._,r._)){(n=l).next=e,e.previous=n,--o;continue t}f+=l._.r,l=l.previous}}while(s!==l.next);for(r.previous=n,r.next=e,n.next=e.previous=e=r,a=Rw(n);(r=r.next)!==e;)(u=Rw(r))<a&&(n=r,a=u);e=n.next}for(n=[e._],r=e;(r=r.next)!==e;)n.push(r._);for(r=Ew(n),o=0;o<i;++o)(n=t[o]).x-=r.x,n.y-=r.y;return r.r}(r),o)for(i=0;i<u;++i)r[i].r-=o;e.r=a+o}}}function Ww(t){return function(n){var e=n.parent;n.r*=t,e&&(n.x=e.x+t*n.x,n.y=e.y+t*n.y)}}function Hw(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Yw(t,n,e,r,i){for(var a,u=t.children,o=-1,s=u.length,l=t.value&&(r-n)/t.value;++o<s;)(a=u[o]).y0=e,a.y1=i,a.x0=n,a.x1=n+=a.value*l}var Gw="$",Vw={depth:-1},Xw={};function Zw(t){return t.id}function Jw(t){return t.parentId}function Qw(){var t=Zw,n=Jw;function e(e){var r,i,a,u,o,s,l,c=e.length,f=new Array(c),h={};for(i=0;i<c;++i)r=e[i],o=f[i]=new Mw(r),null!=(s=t(r,i,e))&&(s+="")&&(h[l=Gw+(o.id=s)]=l in h?Xw:o);for(i=0;i<c;++i)if(o=f[i],null!=(s=n(e[i],i,e))&&(s+="")){if(!(u=h[Gw+s]))throw new Error("missing: "+s);if(u===Xw)throw new Error("ambiguous: "+s);u.children?u.children.push(o):u.children=[o],o.parent=u}else{if(a)throw new Error("multiple roots");a=o}if(!a)throw new Error("no root");if(a.parent=Vw,a.eachBefore(function(t){t.depth=t.parent.depth+1,--c}).eachBefore(Aw),a.parent=null,c>0)throw new Error("cycle");return a}return e.id=function(n){return arguments.length?(t=Lw(n),e):t},e.parentId=function(t){return arguments.length?(n=Lw(t),e):n},e}function Kw(t,n){return t.parent===n.parent?1:2}function tA(t){var n=t.children;return n?n[0]:t.t}function nA(t){var n=t.children;return n?n[n.length-1]:t.t}function eA(t,n,e){var r=e/(n.i-t.i);n.c-=r,n.s+=e,t.c+=r,n.z+=e,n.m+=e}function rA(t,n,e){return t.a.parent===n.parent?t.a:e}function iA(t,n){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=n}function aA(t,n,e,r,i){for(var a,u=t.children,o=-1,s=u.length,l=t.value&&(i-e)/t.value;++o<s;)(a=u[o]).x0=n,a.x1=r,a.y0=e,a.y1=e+=a.value*l}iA.prototype=Object.create(Mw.prototype);var uA=(1+Math.sqrt(5))/2;function oA(t,n,e,r,i,a){for(var u,o,s,l,c,f,h,d,p,g,v,m=[],y=n.children,_=0,x=0,b=y.length,w=n.value;_<b;){s=i-e,l=a-r;do{c=y[x++].value}while(!c&&x<b);for(f=h=c,v=c*c*(g=Math.max(l/s,s/l)/(w*t)),p=Math.max(h/v,v/f);x<b;++x){if(c+=o=y[x].value,o<f&&(f=o),o>h&&(h=o),v=c*c*g,(d=Math.max(h/v,v/f))>p){c-=o;break}p=d}m.push(u={value:c,dice:s<l,children:y.slice(_,x)}),u.dice?Yw(u,e,r,i,w?r+=l*c/w:a):aA(u,e,r,w?e+=s*c/w:i,a),w-=c,_=x}return m}var sA=function t(n){function e(t,e,r,i,a){oA(n,t,e,r,i,a)}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(uA);var lA=function t(n){function e(t,e,r,i,a){if((u=t._squarify)&&u.ratio===n)for(var u,o,s,l,c,f=-1,h=u.length,d=t.value;++f<h;){for(s=(o=u[f]).children,l=o.value=0,c=s.length;l<c;++l)o.value+=s[l].value;o.dice?Yw(o,e,r,i,r+=(a-r)*o.value/d):aA(o,e,r,e+=(i-e)*o.value/d,a),d-=o.value}else t._squarify=u=oA(n,t,e,r,i,a),u.ratio=n}return e.ratio=function(n){return t((n=+n)>1?n:1)},e}(uA);function cA(t){Ir.call(this,null,t)}function fA(t){return t.values}function hA(){var t,n=[];return t={entries:function(t){return function t(e,r){if(++r>n.length)return e;var i,a=[];for(i in e)a.push({key:i,values:t(e[i],r)});return a}(function t(e,r){if(r>=n.length)return e;for(var i,a,u,o=-1,s=e.length,l=n[r++],c={},f={};++o<s;)(u=c[i=l(a=e[o])+""])?u.push(a):c[i]=[a];for(i in c)f[i]=t(c[i],r);return f}(t,0),0)},key:function(e){return n.push(e),t}}}function dA(t){Ir.call(this,null,t)}function pA(t,n){return t.parent===n.parent?1:2}cA.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]},et(cA,Ir).transform=function(t,n){n.source||i("Nest transform requires an upstream data source.");var e=t.generate,r=t.modified(),a=n.clone(),u=this.value;return(!u||r||n.changed())&&(u&&u.each(function(t){t.children&&Mt(t.data)&&a.rem.push(t.data)}),this.value=u=xw({values:W(t.keys).reduce(function(t,n){return t.key(n),t},hA()).entries(a.source)},fA),e&&u.each(function(t){t.children&&(t=Ct(t.data),a.add.push(t),a.source.push(t))}),gw(u,kt,kt)),a.source.root=u,a},et(dA,Ir).transform=function(t,n){n.source&&n.source.root||i(this.constructor.name+" transform requires a backing tree data source.");var e=this.layout(t.method),r=this.fields,a=n.source.root,u=t.as||r;t.field&&a.sum(t.field),t.sort&&a.sort(t.sort),function(t,n,e){for(var r,i=0,a=n.length;i<a;++i)(r=n[i])in e&&t[r](e[r])}(e,this.params,t),e.separation&&e.separation(!1!==t.separation?pA:g);try{this.value=e(a)}catch(t){i(t)}return a.each(function(t){!function(t,n,e){for(var r=t.data,i=0,a=n.length-1;i<a;++i)r[e[i]]=t[n[i]];r[e[a]]=t.children?t.children.length:0}(t,r,u)}),n.reflow(t.modified()).modifies(u).modifies("leaf")};var gA=["x","y","r","depth","children"];function vA(t){dA.call(this,t)}vA.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:gA.length,default:gA}]};var mA=et(vA,dA);mA.layout=function(){var t=null,n=1,e=1,r=qw;function i(i){return i.x=n/2,i.y=e/2,t?i.eachBefore(Iw(t)).eachAfter($w(r,.5)).eachBefore(Ww(1)):i.eachBefore(Iw(jw)).eachAfter($w(qw,1)).eachAfter($w(r,i.r/Math.min(n,e))).eachBefore(Ww(Math.min(n,e)/(2*i.r))),i}return i.radius=function(n){return arguments.length?(t=null==(e=n)?null:Lw(e),i):t;var e},i.size=function(t){return arguments.length?(n=+t[0],e=+t[1],i):[n,e]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:Uw(+t),i):r},i},mA.params=["size","padding"],mA.fields=gA;var yA=["x0","y0","x1","y1","depth","children"];function _A(t){dA.call(this,t)}_A.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:yA.length,default:yA}]};var xA=et(_A,dA);function bA(t){Ir.call(this,null,t)}xA.layout=function(){var t=1,n=1,e=0,r=!1;function i(i){var a=i.height+1;return i.x0=i.y0=e,i.x1=t,i.y1=n/a,i.eachBefore(function(t,n){return function(r){r.children&&Yw(r,r.x0,t*(r.depth+1)/n,r.x1,t*(r.depth+2)/n);var i=r.x0,a=r.y0,u=r.x1-e,o=r.y1-e;u<i&&(i=u=(i+u)/2),o<a&&(a=o=(a+o)/2),r.x0=i,r.y0=a,r.x1=u,r.y1=o}}(n,a)),r&&i.eachBefore(Hw),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.padding=function(t){return arguments.length?(e=+t,i):e},i},xA.params=["size","round","padding"],xA.fields=yA,bA.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},et(bA,Ir).transform=function(t,n){n.source||i("Stratify transform requires an upstream data source.");var e=this.value,r=t.modified(),a=n.fork(n.ALL).materialize(n.SOURCE),u=!this.value||r||n.changed(n.ADD_REM)||n.modified(t.key.fields)||n.modified(t.parentKey.fields);return a.source=a.source.slice(),u&&(e=a.source.length?gw(Qw().id(t.key).parentId(t.parentKey)(a.source),t.key,v):gw(Qw()([{}]),t.key,t.key)),a.source.root=this.value=e,a};var wA={tidy:function(){var t=Kw,n=1,e=1,r=null;function i(i){var s=function(t){for(var n,e,r,i,a,u=new iA(t,0),o=[u];n=o.pop();)if(r=n._.children)for(n.children=new Array(a=r.length),i=a-1;i>=0;--i)o.push(e=n.children[i]=new iA(r[i],i)),e.parent=n;return(u.parent=new iA(null,0)).children=[u],u}(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(u),r)i.eachBefore(o);else{var l=i,c=i,f=i;i.eachBefore(function(t){t.x<l.x&&(l=t),t.x>c.x&&(c=t),t.depth>f.depth&&(f=t)});var h=l===c?1:t(l,c)/2,d=h-l.x,p=n/(c.x+h+d),g=e/(f.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*p,t.y=t.depth*g})}return i}function a(n){var e=n.children,r=n.parent.children,i=n.i?r[n.i-1]:null;if(e){!function(t){for(var n,e=0,r=0,i=t.children,a=i.length;--a>=0;)(n=i[a]).z+=e,n.m+=e,e+=n.s+(r+=n.c)}(n);var a=(e[0].z+e[e.length-1].z)/2;i?(n.z=i.z+t(n._,i._),n.m=n.z-a):n.z=a}else i&&(n.z=i.z+t(n._,i._));n.parent.A=function(n,e,r){if(e){for(var i,a=n,u=n,o=e,s=a.parent.children[0],l=a.m,c=u.m,f=o.m,h=s.m;o=nA(o),a=tA(a),o&&a;)s=tA(s),(u=nA(u)).a=n,(i=o.z+f-a.z-l+t(o._,a._))>0&&(eA(rA(o,n,r),n,i),l+=i,c+=i),f+=o.m,l+=a.m,h+=s.m,c+=u.m;o&&!nA(u)&&(u.t=o,u.m+=f-c),a&&!tA(s)&&(s.t=a,s.m+=l-h,r=n)}return r}(n,i,n.parent.A||r[0])}function u(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function o(t){t.x*=n,t.y=t.depth*e}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i},cluster:function(){var t=vw,n=1,e=1,r=!1;function i(i){var a,u=0;i.eachAfter(function(n){var e=n.children;e?(n.x=function(t){return t.reduce(mw,0)/t.length}(e),n.y=function(t){return 1+t.reduce(yw,0)}(e)):(n.x=a?u+=t(n,a):0,n.y=0,a=n)});var o=function(t){for(var n;n=t.children;)t=n[0];return t}(i),s=function(t){for(var n;n=t.children;)t=n[n.length-1];return t}(i),l=o.x-t(o,s)/2,c=s.x+t(s,o)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*n,t.y=(i.y-t.y)*e}:function(t){t.x=(t.x-l)/(c-l)*n,t.y=(1-(i.y?t.y/i.y:1))*e})}return i.separation=function(n){return arguments.length?(t=n,i):t},i.size=function(t){return arguments.length?(r=!1,n=+t[0],e=+t[1],i):r?null:[n,e]},i.nodeSize=function(t){return arguments.length?(r=!0,n=+t[0],e=+t[1],i):r?[n,e]:null},i}},AA=["x","y","depth","children"];function MA(t){dA.call(this,t)}MA.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:AA.length,default:AA}]};var kA=et(MA,dA);function EA(t){Ir.call(this,[],t)}kA.layout=function(t){var n=t||"tidy";if(wA.hasOwnProperty(n))return wA[n]();i("Unrecognized Tree layout method: "+n)},kA.params=["size","nodeSize"],kA.fields=AA,EA.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},et(EA,Ir).transform=function(t,n){var e=this.value,r=n.source&&n.source.root,a=n.fork(n.NO_SOURCE),u={};return r||i("TreeLinks transform requires a tree data source."),n.changed(n.ADD_REM)?(a.rem=e,n.visit(n.SOURCE,function(t){u[kt(t)]=1}),r.each(function(t){var n=t.data,e=t.parent&&t.parent.data;e&&u[kt(n)]&&u[kt(e)]&&a.add.push(Ct({source:e,target:n}))}),this.value=a.add):n.changed(n.MOD)&&(n.visit(n.MOD,function(t){u[kt(t)]=1}),e.forEach(function(t){(u[kt(t.source)]||u[kt(t.target)])&&a.mod.push(t)})),a};var CA={binary:function(t,n,e,r,i){var a,u,o=t.children,s=o.length,l=new Array(s+1);for(l[0]=u=a=0;a<s;++a)l[a+1]=u+=o[a].value;!function t(n,e,r,i,a,u,s){if(n>=e-1){var c=o[n];return c.x0=i,c.y0=a,c.x1=u,void(c.y1=s)}for(var f=l[n],h=r/2+f,d=n+1,p=e-1;d<p;){var g=d+p>>>1;l[g]<h?d=g+1:p=g}h-l[d-1]<l[d]-h&&n+1<d&&--d;var v=l[d]-f,m=r-v;if(u-i>s-a){var y=(i*m+u*v)/r;t(n,d,v,i,a,y,s),t(d,e,m,y,a,u,s)}else{var _=(a*m+s*v)/r;t(n,d,v,i,a,u,_),t(d,e,m,i,_,u,s)}}(0,s,t.value,n,e,r,i)},dice:Yw,slice:aA,slicedice:function(t,n,e,r,i){(1&t.depth?aA:Yw)(t,n,e,r,i)},squarify:sA,resquarify:lA},DA=["x0","y0","x1","y1","depth","children"];function FA(t){dA.call(this,t)}FA.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:DA.length,default:DA}]};var SA=et(FA,dA);SA.layout=function(){var t=function(){var t=sA,n=!1,e=1,r=1,i=[0],a=qw,u=qw,o=qw,s=qw,l=qw;function c(t){return t.x0=t.y0=0,t.x1=e,t.y1=r,t.eachBefore(f),i=[0],n&&t.eachBefore(Hw),t}function f(n){var e=i[n.depth],r=n.x0+e,c=n.y0+e,f=n.x1-e,h=n.y1-e;f<r&&(r=f=(r+f)/2),h<c&&(c=h=(c+h)/2),n.x0=r,n.y0=c,n.x1=f,n.y1=h,n.children&&(e=i[n.depth+1]=a(n)/2,r+=l(n)-e,c+=u(n)-e,(f-=o(n)-e)<r&&(r=f=(r+f)/2),(h-=s(n)-e)<c&&(c=h=(c+h)/2),t(n,r,c,f,h))}return c.round=function(t){return arguments.length?(n=!!t,c):n},c.size=function(t){return arguments.length?(e=+t[0],r=+t[1],c):[e,r]},c.tile=function(n){return arguments.length?(t=Lw(n),c):t},c.padding=function(t){return arguments.length?c.paddingInner(t).paddingOuter(t):c.paddingInner()},c.paddingInner=function(t){return arguments.length?(a="function"==typeof t?t:Uw(+t),c):a},c.paddingOuter=function(t){return arguments.length?c.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):c.paddingTop()},c.paddingTop=function(t){return arguments.length?(u="function"==typeof t?t:Uw(+t),c):u},c.paddingRight=function(t){return arguments.length?(o="function"==typeof t?t:Uw(+t),c):o},c.paddingBottom=function(t){return arguments.length?(s="function"==typeof t?t:Uw(+t),c):s},c.paddingLeft=function(t){return arguments.length?(l="function"==typeof t?t:Uw(+t),c):l},c}();return t.ratio=function(n){var e=t.tile();e.ratio&&t.tile(e.ratio(n))},t.method=function(n){CA.hasOwnProperty(n)?t.tile(CA[n]):i("Unrecognized Treemap layout method: "+n)},t},SA.params=["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],SA.fields=DA;var BA=Object.freeze({nest:cA,pack:vA,partition:_A,stratify:bA,tree:MA,treelinks:EA,treemap:FA});function NA(t){return function(){return t}}function OA(t){return t[0]}function zA(t){return t[1]}function TA(){this._=null}function RA(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function PA(t,n){var e=n,r=n.R,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function LA(t,n){var e=n,r=n.L,i=e.U;i?i.L===e?i.L=r:i.R=r:t._=r,r.U=i,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function qA(t){for(;t.L;)t=t.L;return t}function UA(t,n,e,r){var i=[null,null],a=cM.push(i)-1;return i.left=t,i.right=n,e&&IA(i,t,n,e),r&&IA(i,n,t,r),sM[t.index].halfedges.push(a),sM[n.index].halfedges.push(a),i}function jA(t,n,e){var r=[n,e];return r.left=t,r}function IA(t,n,e,r){t[0]||t[1]?t.left===e?t[1]=r:t[0]=r:(t[0]=r,t.left=n,t.right=e)}function $A(t,n,e,r,i){var a,u=t[0],o=t[1],s=u[0],l=u[1],c=0,f=1,h=o[0]-s,d=o[1]-l;if(a=n-s,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<f&&(f=a)}else if(h>0){if(a>f)return;a>c&&(c=a)}if(a=r-s,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<f&&(f=a)}if(a=e-l,d||!(a>0)){if(a/=d,d<0){if(a<c)return;a<f&&(f=a)}else if(d>0){if(a>f)return;a>c&&(c=a)}if(a=i-l,d||!(a<0)){if(a/=d,d<0){if(a>f)return;a>c&&(c=a)}else if(d>0){if(a<c)return;a<f&&(f=a)}return!(c>0||f<1)||(c>0&&(t[0]=[s+c*h,l+c*d]),f<1&&(t[1]=[s+f*h,l+f*d]),!0)}}}}}function WA(t,n,e,r,i){var a=t[1];if(a)return!0;var u,o,s=t[0],l=t.left,c=t.right,f=l[0],h=l[1],d=c[0],p=c[1],g=(f+d)/2,v=(h+p)/2;if(p===h){if(g<n||g>=r)return;if(f>d){if(s){if(s[1]>=i)return}else s=[g,e];a=[g,i]}else{if(s){if(s[1]<e)return}else s=[g,i];a=[g,e]}}else if(o=v-(u=(f-d)/(p-h))*g,u<-1||u>1)if(f>d){if(s){if(s[1]>=i)return}else s=[(e-o)/u,e];a=[(i-o)/u,i]}else{if(s){if(s[1]<e)return}else s=[(i-o)/u,i];a=[(e-o)/u,e]}else if(h<p){if(s){if(s[0]>=r)return}else s=[n,u*n+o];a=[r,u*r+o]}else{if(s){if(s[0]<n)return}else s=[r,u*r+o];a=[n,u*n+o]}return t[0]=s,t[1]=a,!0}function HA(t,n){var e=t.site,r=n.left,i=n.right;return e===i&&(i=r,r=e),i?Math.atan2(i[1]-r[1],i[0]-r[0]):(e===r?(r=n[1],i=n[0]):(r=n[0],i=n[1]),Math.atan2(r[0]-i[0],i[1]-r[1]))}function YA(t,n){return n[+(n.left!==t.site)]}function GA(t,n){return n[+(n.left===t.site)]}TA.prototype={constructor:TA,insert:function(t,n){var e,r,i;if(t){if(n.P=t,n.N=t.N,t.N&&(t.N.P=n),t.N=n,t.R){for(t=t.R;t.L;)t=t.L;t.L=n}else t.R=n;e=t}else this._?(t=qA(this._),n.P=null,n.N=t,t.P=t.L=n,e=t):(n.P=n.N=null,this._=n,e=null);for(n.L=n.R=null,n.U=e,n.C=!0,t=n;e&&e.C;)e===(r=e.U).L?(i=r.R)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.R&&(PA(this,e),e=(t=e).U),e.C=!1,r.C=!0,LA(this,r)):(i=r.L)&&i.C?(e.C=i.C=!1,r.C=!0,t=r):(t===e.L&&(LA(this,e),e=(t=e).U),e.C=!1,r.C=!0,PA(this,r)),e=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var n,e,r,i=t.U,a=t.L,u=t.R;if(e=a?u?qA(u):a:u,i?i.L===t?i.L=e:i.R=e:this._=e,a&&u?(r=e.C,e.C=t.C,e.L=a,a.U=e,e!==u?(i=e.U,e.U=t.U,t=e.R,i.L=t,e.R=u,u.U=e):(e.U=i,i=e,t=e.R)):(r=t.C,t=e),t&&(t.U=i),!r)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((n=i.R).C&&(n.C=!1,i.C=!0,PA(this,i),n=i.R),n.L&&n.L.C||n.R&&n.R.C){n.R&&n.R.C||(n.L.C=!1,n.C=!0,LA(this,n),n=i.R),n.C=i.C,i.C=n.R.C=!1,PA(this,i),t=this._;break}}else if((n=i.L).C&&(n.C=!1,i.C=!0,LA(this,i),n=i.L),n.L&&n.L.C||n.R&&n.R.C){n.L&&n.L.C||(n.R.C=!1,n.C=!0,PA(this,n),n=i.L),n.C=i.C,i.C=n.L.C=!1,LA(this,i),t=this._;break}n.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}};var VA,XA=[];function ZA(){RA(this),this.x=this.y=this.arc=this.site=this.cy=null}function JA(t){var n=t.P,e=t.N;if(n&&e){var r=n.site,i=t.site,a=e.site;if(r!==a){var u=i[0],o=i[1],s=r[0]-u,l=r[1]-o,c=a[0]-u,f=a[1]-o,h=2*(s*f-l*c);if(!(h>=-hM)){var d=s*s+l*l,p=c*c+f*f,g=(f*d-l*p)/h,v=(s*p-c*d)/h,m=XA.pop()||new ZA;m.arc=t,m.site=i,m.x=g+u,m.y=(m.cy=v+o)+Math.sqrt(g*g+v*v),t.circle=m;for(var y=null,_=lM._;_;)if(m.y<_.y||m.y===_.y&&m.x<=_.x){if(!_.L){y=_.P;break}_=_.L}else{if(!_.R){y=_;break}_=_.R}lM.insert(y,m),y||(VA=m)}}}}function QA(t){var n=t.circle;n&&(n.P||(VA=n.N),lM.remove(n),XA.push(n),RA(n),t.circle=null)}var KA=[];function tM(){RA(this),this.edge=this.site=this.circle=null}function nM(t){var n=KA.pop()||new tM;return n.site=t,n}function eM(t){QA(t),oM.remove(t),KA.push(t),RA(t)}function rM(t){var n=t.circle,e=n.x,r=n.cy,i=[e,r],a=t.P,u=t.N,o=[t];eM(t);for(var s=a;s.circle&&Math.abs(e-s.circle.x)<fM&&Math.abs(r-s.circle.cy)<fM;)a=s.P,o.unshift(s),eM(s),s=a;o.unshift(s),QA(s);for(var l=u;l.circle&&Math.abs(e-l.circle.x)<fM&&Math.abs(r-l.circle.cy)<fM;)u=l.N,o.push(l),eM(l),l=u;o.push(l),QA(l);var c,f=o.length;for(c=1;c<f;++c)l=o[c],s=o[c-1],IA(l.edge,s.site,l.site,i);s=o[0],(l=o[f-1]).edge=UA(s.site,l.site,null,i),JA(s),JA(l)}function iM(t){for(var n,e,r,i,a=t[0],u=t[1],o=oM._;o;)if((r=aM(o,u)-a)>fM)o=o.L;else{if(!((i=a-uM(o,u))>fM)){r>-fM?(n=o.P,e=o):i>-fM?(n=o,e=o.N):n=e=o;break}if(!o.R){n=o;break}o=o.R}!function(t){sM[t.index]={site:t,halfedges:[]}}(t);var s=nM(t);if(oM.insert(n,s),n||e){if(n===e)return QA(n),e=nM(n.site),oM.insert(s,e),s.edge=e.edge=UA(n.site,s.site),JA(n),void JA(e);if(e){QA(n),QA(e);var l=n.site,c=l[0],f=l[1],h=t[0]-c,d=t[1]-f,p=e.site,g=p[0]-c,v=p[1]-f,m=2*(h*v-d*g),y=h*h+d*d,_=g*g+v*v,x=[(v*y-d*_)/m+c,(h*_-g*y)/m+f];IA(e.edge,l,p,x),s.edge=UA(l,t,null,x),e.edge=UA(t,p,null,x),JA(n),JA(e)}else s.edge=UA(n.site,s.site)}}function aM(t,n){var e=t.site,r=e[0],i=e[1],a=i-n;if(!a)return r;var u=t.P;if(!u)return-1/0;var o=(e=u.site)[0],s=e[1],l=s-n;if(!l)return o;var c=o-r,f=1/a-1/l,h=c/l;return f?(-h+Math.sqrt(h*h-2*f*(c*c/(-2*l)-s+l/2+i-a/2)))/f+r:(r+o)/2}function uM(t,n){var e=t.N;if(e)return aM(e,n);var r=t.site;return r[1]===n?r[0]:1/0}var oM,sM,lM,cM,fM=1e-6,hM=1e-12;function dM(t,n){return n[1]-t[1]||n[0]-t[0]}function pM(t,n){var e,r,i,a=t.sort(dM).pop();for(cM=[],sM=new Array(t.length),oM=new TA,lM=new TA;;)if(i=VA,a&&(!i||a[1]<i.y||a[1]===i.y&&a[0]<i.x))a[0]===e&&a[1]===r||(iM(a),e=a[0],r=a[1]),a=t.pop();else{if(!i)break;rM(i.arc)}if(function(){for(var t,n,e,r,i=0,a=sM.length;i<a;++i)if((t=sM[i])&&(r=(n=t.halfedges).length)){var u=new Array(r),o=new Array(r);for(e=0;e<r;++e)u[e]=e,o[e]=HA(t,cM[n[e]]);for(u.sort(function(t,n){return o[n]-o[t]}),e=0;e<r;++e)o[e]=n[u[e]];for(e=0;e<r;++e)n[e]=o[e]}}(),n){var u=+n[0][0],o=+n[0][1],s=+n[1][0],l=+n[1][1];!function(t,n,e,r){for(var i,a=cM.length;a--;)WA(i=cM[a],t,n,e,r)&&$A(i,t,n,e,r)&&(Math.abs(i[0][0]-i[1][0])>fM||Math.abs(i[0][1]-i[1][1])>fM)||delete cM[a]}(u,o,s,l),function(t,n,e,r){var i,a,u,o,s,l,c,f,h,d,p,g,v=sM.length,m=!0;for(i=0;i<v;++i)if(a=sM[i]){for(u=a.site,o=(s=a.halfedges).length;o--;)cM[s[o]]||s.splice(o,1);for(o=0,l=s.length;o<l;)p=(d=GA(a,cM[s[o]]))[0],g=d[1],f=(c=YA(a,cM[s[++o%l]]))[0],h=c[1],(Math.abs(p-f)>fM||Math.abs(g-h)>fM)&&(s.splice(o,0,cM.push(jA(u,d,Math.abs(p-t)<fM&&r-g>fM?[t,Math.abs(f-t)<fM?h:r]:Math.abs(g-r)<fM&&e-p>fM?[Math.abs(h-r)<fM?f:e,r]:Math.abs(p-e)<fM&&g-n>fM?[e,Math.abs(f-e)<fM?h:n]:Math.abs(g-n)<fM&&p-t>fM?[Math.abs(h-n)<fM?f:t,n]:null))-1),++l);l&&(m=!1)}if(m){var y,_,x,b=1/0;for(i=0,m=null;i<v;++i)(a=sM[i])&&(x=(y=(u=a.site)[0]-t)*y+(_=u[1]-n)*_)<b&&(b=x,m=a);if(m){var w=[t,n],A=[t,r],M=[e,r],k=[e,n];m.halfedges.push(cM.push(jA(u=m.site,w,A))-1,cM.push(jA(u,A,M))-1,cM.push(jA(u,M,k))-1,cM.push(jA(u,k,w))-1)}}for(i=0;i<v;++i)(a=sM[i])&&(a.halfedges.length||delete sM[i])}(u,o,s,l)}this.edges=cM,this.cells=sM,oM=lM=cM=sM=null}function gM(t){Ir.call(this,null,t)}pM.prototype={constructor:pM,polygons:function(){var t=this.edges;return this.cells.map(function(n){var e=n.halfedges.map(function(e){return YA(n,t[e])});return e.data=n.site.data,e})},triangles:function(){var t=[],n=this.edges;return this.cells.forEach(function(e,r){if(a=(i=e.halfedges).length)for(var i,a,u,o,s,l,c=e.site,f=-1,h=n[i[a-1]],d=h.left===c?h.right:h.left;++f<a;)u=d,d=(h=n[i[f]]).left===c?h.right:h.left,u&&d&&r<u.index&&r<d.index&&(s=u,l=d,((o=c)[0]-l[0])*(s[1]-o[1])-(o[0]-s[0])*(l[1]-o[1])<0)&&t.push([c.data,u.data,d.data])}),t},links:function(){return this.edges.filter(function(t){return t.right}).map(function(t){return{source:t.left.data,target:t.right.data}})},find:function(t,n,e){for(var r,i,a=this,u=a._found||0,o=a.cells.length;!(i=a.cells[u]);)if(++u>=o)return null;var s=t-i.site[0],l=n-i.site[1],c=s*s+l*l;do{i=a.cells[r=u],u=null,i.halfedges.forEach(function(e){var r=a.edges[e],o=r.left;if(o!==i.site&&o||(o=r.right)){var s=t-o[0],l=n-o[1],f=s*s+l*l;f<c&&(c=f,u=o.index)}})}while(null!==u);return a._found=r,null==e||c<=e*e?i.site:null}},gM.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};var vM=et(gM,Ir),mM=[[-1e5,-1e5],[1e5,1e5]];vM.transform=function(t,n){var e,r,i,a,u=t.as||"path",o=n.source;for(e=function(){var t=OA,n=zA,e=null;function r(r){return new pM(r.map(function(e,i){var a=[Math.round(t(e,i,r)/fM)*fM,Math.round(n(e,i,r)/fM)*fM];return a.index=i,a.data=e,a}),e)}return r.polygons=function(t){return r(t).polygons()},r.links=function(t){return r(t).links()},r.triangles=function(t){return r(t).triangles()},r.x=function(n){return arguments.length?(t="function"==typeof n?n:NA(+n),r):t},r.y=function(t){return arguments.length?(n="function"==typeof t?t:NA(+t),r):n},r.extent=function(t){return arguments.length?(e=null==t?null:[[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]],r):e&&[[e[0][0],e[0][1]],[e[1][0],e[1][1]]]},r.size=function(t){return arguments.length?(e=null==t?null:[[0,0],[+t[0],+t[1]]],r):e&&[e[1][0]-e[0][0],e[1][1]-e[0][1]]},r}().x(t.x).y(t.y),t.size?e.size(t.size):e.extent(t.extent||mM),this.value=e=e(o),r=e.polygons(),i=0,a=o.length;i<a;++i)o[i][u]=r[i]?"M"+r[i].join("L")+"Z":null;return n.reflow(t.modified()).modifies(u)};var yM=Object.freeze({voronoi:gM}),_M=Math.PI/180,xM=64,bM=2048;function wM(){var t,n,e,r,i,a,u,o=[256,256],s=EM,l=[],c=Math.random,f={};function h(t,n,e){for(var r,i,a,u,l,f=n.x,h=n.y,d=Math.sqrt(o[0]*o[0]+o[1]*o[1]),p=s(o),g=c()<.5?1:-1,v=-g;(r=p(v+=g))&&(i=~~r[0],a=~~r[1],!(Math.min(Math.abs(i),Math.abs(a))>=d));)if(n.x=f+i,n.y=h+a,!(n.x+n.x0<0||n.y+n.y0<0||n.x+n.x1>o[0]||n.y+n.y1>o[1]||e&&MM(n,t,o[0])||e&&(l=e,!((u=n).x+u.x1>l[0].x&&u.x+u.x0<l[1].x&&u.y+u.y1>l[0].y&&u.y+u.y0<l[1].y)))){for(var m,y=n.sprite,_=n.width>>5,x=o[0]>>5,b=n.x-(_<<4),w=127&b,A=32-w,M=n.y1-n.y0,k=(n.y+n.y0)*x+(b>>5),E=0;E<M;E++){m=0;for(var C=0;C<=_;C++)t[k+C]|=m<<A|(C<_?(m=y[E*_+C])>>>w:0);k+=x}return n.sprite=null,!0}return!1}return f.layout=function(){for(var s=function(t){t.width=t.height=1;var n=Math.sqrt(t.getContext("2d").getImageData(0,0,1,1).data.length>>2);t.width=(xM<<5)/n,t.height=bM/n;var e=t.getContext("2d");return e.fillStyle=e.strokeStyle="red",e.textAlign="center",{context:e,ratio:n}}(Eu()),f=function(t){var n=[],e=-1;for(;++e<t;)n[e]=0;return n}((o[0]>>5)*o[1]),d=null,p=l.length,g=-1,v=[],m=l.map(function(o){return{text:t(o),font:n(o),style:r(o),weight:i(o),rotate:a(o),size:~~e(o),padding:u(o),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:o}}).sort(function(t,n){return n.size-t.size});++g<p;){var y=m[g];y.x=o[0]*(c()+.5)>>1,y.y=o[1]*(c()+.5)>>1,AM(s,y,m,g),y.hasText&&h(f,y,d)&&(v.push(y),d?kM(d,y):d=[{x:y.x+y.x0,y:y.y+y.y0},{x:y.x+y.x1,y:y.y+y.y1}],y.x-=o[0]>>1,y.y-=o[1]>>1)}return v},f.words=function(t){return arguments.length?(l=t,f):l},f.size=function(t){return arguments.length?(o=[+t[0],+t[1]],f):o},f.font=function(t){return arguments.length?(n=CM(t),f):n},f.fontStyle=function(t){return arguments.length?(r=CM(t),f):r},f.fontWeight=function(t){return arguments.length?(i=CM(t),f):i},f.rotate=function(t){return arguments.length?(a=CM(t),f):a},f.text=function(n){return arguments.length?(t=CM(n),f):t},f.spiral=function(t){return arguments.length?(s=DM[t]||t,f):s},f.fontSize=function(t){return arguments.length?(e=CM(t),f):e},f.padding=function(t){return arguments.length?(u=CM(t),f):u},f.random=function(t){return arguments.length?(c=t,f):c},f}function AM(t,n,e,r){if(!n.sprite){var i=t.context,a=t.ratio;i.clearRect(0,0,(xM<<5)/a,bM/a);var u,o,s,l,c,f=0,h=0,d=0,p=e.length;for(--r;++r<p;){if(n=e[r],i.save(),i.font=n.style+" "+n.weight+" "+~~((n.size+1)/a)+"px "+n.font,u=i.measureText(n.text+"m").width*a,s=n.size<<1,n.rotate){var g=Math.sin(n.rotate*_M),v=Math.cos(n.rotate*_M),m=u*v,y=u*g,_=s*v,x=s*g;u=Math.max(Math.abs(m+x),Math.abs(m-x))+31>>5<<5,s=~~Math.max(Math.abs(y+_),Math.abs(y-_))}else u=u+31>>5<<5;if(s>d&&(d=s),f+u>=xM<<5&&(f=0,h+=d,d=0),h+s>=bM)break;i.translate((f+(u>>1))/a,(h+(s>>1))/a),n.rotate&&i.rotate(n.rotate*_M),i.fillText(n.text,0,0),n.padding&&(i.lineWidth=2*n.padding,i.strokeText(n.text,0,0)),i.restore(),n.width=u,n.height=s,n.xoff=f,n.yoff=h,n.x1=u>>1,n.y1=s>>1,n.x0=-n.x1,n.y0=-n.y1,n.hasText=!0,f+=u}for(var b=i.getImageData(0,0,(xM<<5)/a,bM/a).data,w=[];--r>=0;)if((n=e[r]).hasText){for(o=(u=n.width)>>5,s=n.y1-n.y0,l=0;l<s*o;l++)w[l]=0;if(null==(f=n.xoff))return;h=n.yoff;var A=0,M=-1;for(c=0;c<s;c++){for(l=0;l<u;l++){var k=o*c+(l>>5),E=b[(h+c)*(xM<<5)+(f+l)<<2]?1<<31-l%32:0;w[k]|=E,A|=E}A?M=c:(n.y0++,s--,c--,h++)}n.y1=n.y0+M,n.sprite=w.slice(0,(n.y1-n.y0)*o)}}}function MM(t,n,e){e>>=5;for(var r,i=t.sprite,a=t.width>>5,u=t.x-(a<<4),o=127&u,s=32-o,l=t.y1-t.y0,c=(t.y+t.y0)*e+(u>>5),f=0;f<l;f++){r=0;for(var h=0;h<=a;h++)if((r<<s|(h<a?(r=i[f*a+h])>>>o:0))&n[c+h])return!0;c+=e}return!1}function kM(t,n){var e=t[0],r=t[1];n.x+n.x0<e.x&&(e.x=n.x+n.x0),n.y+n.y0<e.y&&(e.y=n.y+n.y0),n.x+n.x1>r.x&&(r.x=n.x+n.x1),n.y+n.y1>r.y&&(r.y=n.y+n.y1)}function EM(t){var n=t[0]/t[1];return function(t){return[n*(t*=.1)*Math.cos(t),t*Math.sin(t)]}}function CM(t){return"function"==typeof t?t:function(){return t}}var DM={archimedean:EM,rectangular:function(t){var n=4*t[0]/t[1],e=0,r=0;return function(t){var i=t<0?-1:1;switch(Math.sqrt(1+4*i*t)-i&3){case 0:e+=n;break;case 1:r+=4;break;case 2:e-=n;break;default:r-=4}return[e,r]}}},FM=["x","y","font","fontSize","fontStyle","fontWeight","angle"],SM=["text","font","rotate","fontSize","fontStyle","fontWeight"];function BM(t){Ir.call(this,wM(),t)}BM.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:FM}]},et(BM,Ir).transform=function(n,e){var r=n.modified();if(r||e.changed(e.ADD_REM)||SM.some(function(t){var r=n[t];return Y(r)&&e.modified(r.fields)})){var i,a=e.materialize(e.SOURCE).source,u=this.value,o=n.as||FM,s=n.fontSize||14;if(Y(s)?i=n.fontSizeRange:s=V(s),i){var l=s,c=Tg("sqrt")().domain(function(t,n){for(var e,r=1/0,i=-1/0,a=0,u=n.length;a<u;++a)(e=t(n[a]))<r&&(r=e),e>i&&(i=e);return[r,i]}(l,a)).range(i);s=function(t){return c(l(t))}}a.forEach(function(t){t[o[0]]=NaN,t[o[1]]=NaN,t[o[3]]=0});for(var f,h,d=u.words(a).text(n.text).size(n.size||[500,500]).padding(n.padding||1).spiral(n.spiral||"archimedean").rotate(n.rotate||0).font(n.font||"sans-serif").fontStyle(n.fontStyle||"normal").fontWeight(n.fontWeight||"normal").fontSize(s).random(t.random).layout(),p=u.size(),g=p[0]>>1,v=p[1]>>1,m=0,y=d.length;m<y;++m)(h=(f=d[m]).datum)[o[0]]=f.x+g,h[o[1]]=f.y+v,h[o[2]]=f.font,h[o[3]]=f.size,h[o[4]]=f.style,h[o[5]]=f.weight,h[o[6]]=f.rotate;return e.reflow(r).modifies(o)}};var NM=Object.freeze({wordcloud:BM});function OM(t){return new Uint32Array(t)}function zM(t,n,e){var r=(n<257?function(t){return new Uint8Array(t)}:n<65537?function(t){return new Uint16Array(t)}:OM)(t);return e&&r.set(e),r}function TM(t,n,e){var r=1<<n;return{one:r,zero:~r,range:e.slice(),bisect:t.bisect,index:t.index,size:t.size,onAdd:function(t,n){var e,i=this.bisect(this.range,t.value),a=t.index,u=i[0],o=i[1],s=a.length;for(e=0;e<u;++e)n[a[e]]|=r;for(e=o;e<s;++e)n[a[e]]|=r;return this}}}function RM(){var t=OM(0),n=[],e=0;return{insert:function(r,i,a){if(!i.length)return[];var u,o,s,l=e,c=i.length,f=Array(c),h=OM(c);for(s=0;s<c;++s)f[s]=r(i[s]),h[s]=s;if(f=function(t,n){return t.sort.call(n,function(n,e){var r=t[n],i=t[e];return r<i?-1:r>i?1:0}),function(t,n){for(var e=n.length,r=new Array(e);e--;)r[e]=t[n[e]];return r}(t,n)}(f,h),l)u=n,o=t,n=Array(l+c),t=OM(l+c),function(t,n,e,r,i,a,u,o,s){var l,c=0,f=0;for(l=0;c<r&&f<u;++l)n[c]<i[f]?(o[l]=n[c],s[l]=e[c++]):(o[l]=i[f],s[l]=a[f++]+t);for(;c<r;++c,++l)o[l]=n[c],s[l]=e[c];for(;f<u;++f,++l)o[l]=i[f],s[l]=a[f]+t}(a,u,o,l,f,h,c,n,t);else{if(a>0)for(s=0;s<c;++s)h[s]+=a;n=f,t=h}return e=l+c,{index:h,value:f}},remove:function(r,i){var a,u,o,s=e;for(u=0;!i[t[u]]&&u<s;++u);for(o=u;u<s;++u)i[a=t[u]]||(t[o]=a,n[o]=n[u],++o);e=s-r},bisect:function(t,r){var i;return r?i=r.length:(r=n,i=e),[si(r,t[0],0,i),oi(r,t[1],0,i)]},reindex:function(n){for(var r=0,i=e;r<i;++r)t[r]=n[t[r]]},index:function(){return t},size:function(){return e}}}function PM(t){var n,e,r,i,a;Ir.call(this,(n=8,e=[],r=OM(0),i=zM(0,n),a=zM(0,n),{data:function(){return e},seen:function(){return t=r,n=e.length,r=t.length>=n?t:((i=i||new t.constructor(n)).set(t),i);var t,n,i},add:function(t){for(var n,r=0,i=e.length,a=t.length;r<a;++r)(n=t[r])._index=i++,e.push(n)},remove:function(t,n){var r,u,o,s=e.length,l=Array(s-t),c=e;for(u=0;!n[u]&&u<s;++u)l[u]=e[u],c[u]=u;for(o=u;u<s;++u)r=e[u],n[u]?c[u]=-1:(c[u]=o,i[o]=i[u],a[o]=a[u],l[o]=r,r._index=o++),i[u]=0;return e=l,c},size:function(){return e.length},curr:function(){return i},prev:function(){return a},reset:function(t){a[t]=i[t]},all:function(){return n<257?255:n<65537?65535:4294967295},set:function(t,n){i[t]|=n},clear:function(t,n){i[t]&=~n},resize:function(t,e){(t>i.length||e>n)&&(n=Math.max(e,n),i=zM(t,n,i),a=zM(t,n))}}),t),this._indices=null,this._dims=null}PM.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]};var LM=et(PM,Ir);function qM(t){Ir.call(this,null,t)}LM.transform=function(t,n){return this._dims?t.modified("fields")||t.fields.some(function(t){return n.modified(t.fields)})?this.reinit(t,n):this.eval(t,n):this.init(t,n)},LM.init=function(t,n){for(var e,r,i=t.fields,a=t.query,u=this._indices={},o=this._dims=[],s=a.length,l=0;l<s;++l)r=u[e=i[l].fname]||(u[e]=RM()),o.push(TM(r,l,a[l]));return this.eval(t,n)},LM.reinit=function(t,n){var e,r,i,a,u,o,s,l,c,f=n.materialize().fork(),h=t.fields,d=t.query,p=this._indices,g=this._dims,v=this.value,m=v.curr(),y=v.prev(),_=v.all(),x=f.rem=f.add,b=f.mod,w=d.length,A={};if(y.set(m),n.rem.length&&(u=this.remove(t,n,f)),n.add.length&&v.add(n.add),n.mod.length)for(o={},s=0,l=(a=n.mod).length;s<l;++s)o[a[s]._index]=1;for(s=0;s<w;++s)c=h[s],(!g[s]||t.modified("fields",s)||n.modified(c.fields))&&((e=A[i=c.fname])||(p[i]=r=RM(),A[i]=e=r.insert(c,n.source,0)),g[s]=TM(r,s,d[s]).onAdd(e,m));for(s=0,l=v.data().length;s<l;++s)u[s]||(y[s]!==m[s]?x.push(s):o[s]&&m[s]!==_&&b.push(s));return v.mask=(1<<w)-1,f},LM.eval=function(t,n){var e=n.materialize().fork(),r=this._dims.length,i=0;return n.rem.length&&(this.remove(t,n,e),i|=(1<<r)-1),t.modified("query")&&!t.modified("fields")&&(i|=this.update(t,n,e)),n.add.length&&(this.insert(t,n,e),i|=(1<<r)-1),n.mod.length&&(this.modify(n,e),i|=(1<<r)-1),this.value.mask=i,e},LM.insert=function(t,n,e){var r,i,a,u=n.add,o=this.value,s=this._dims,l=this._indices,c=t.fields,f={},h=e.add,d=o.size(),p=d+u.length,g=s.length;o.resize(p,g),o.add(u);var v=o.curr(),m=o.prev(),y=o.all();for(r=0;r<g;++r)a=f[i=c[r].fname]||(f[i]=l[i].insert(c[r],u,d)),s[r].onAdd(a,v);for(;d<p;++d)m[d]=y,v[d]!==y&&h.push(d)},LM.modify=function(t,n){var e,r,i,a=n.mod,u=this.value,o=u.curr(),s=u.all(),l=t.mod;for(e=0,r=l.length;e<r;++e)o[i=l[e]._index]!==s&&a.push(i)},LM.remove=function(t,n,e){var r,i,a,u,o=this._indices,s=this.value,l=s.curr(),c=s.prev(),f=s.all(),h={},d=e.rem,p=n.rem;for(r=0,i=p.length;r<i;++r)h[a=p[r]._index]=1,c[a]=u=l[a],l[a]=f,u!==f&&d.push(a);for(a in o)o[a].remove(i,h);return this.reindex(n,i,h),h},LM.reindex=function(t,n,e){var r=this._indices,i=this.value;t.runAfter(function(){var t=i.remove(n,e);for(var a in r)r[a].reindex(t)})},LM.update=function(t,n,e){var r,i,a=this._dims,u=t.query,o=n.stamp,s=a.length,l=0;for(e.filters=0,i=0;i<s;++i)t.modified("query",i)&&(r=i,++l);if(1===l)l=a[r].one,this.incrementOne(a[r],u[r],e.add,e.rem);else for(i=0,l=0;i<s;++i)t.modified("query",i)&&(l|=a[i].one,this.incrementAll(a[i],u[i],o,e.add),e.rem=e.add);return l},LM.incrementAll=function(t,n,e,r){var i,a,u,o=this.value,s=o.seen(),l=o.curr(),c=o.prev(),f=t.index(),h=t.bisect(t.range),d=t.bisect(n),p=d[0],g=d[1],v=h[0],m=h[1],y=t.one;if(p<v)for(i=p,a=Math.min(v,g);i<a;++i)s[u=f[i]]!==e&&(c[u]=l[u],s[u]=e,r.push(u)),l[u]^=y;else if(p>v)for(i=v,a=Math.min(p,m);i<a;++i)s[u=f[i]]!==e&&(c[u]=l[u],s[u]=e,r.push(u)),l[u]^=y;if(g>m)for(i=Math.max(p,m),a=g;i<a;++i)s[u=f[i]]!==e&&(c[u]=l[u],s[u]=e,r.push(u)),l[u]^=y;else if(g<m)for(i=Math.max(v,g),a=m;i<a;++i)s[u=f[i]]!==e&&(c[u]=l[u],s[u]=e,r.push(u)),l[u]^=y;t.range=n.slice()},LM.incrementOne=function(t,n,e,r){var i,a,u,o=this.value.curr(),s=t.index(),l=t.bisect(t.range),c=t.bisect(n),f=c[0],h=c[1],d=l[0],p=l[1],g=t.one;if(f<d)for(i=f,a=Math.min(d,h);i<a;++i)o[u=s[i]]^=g,e.push(u);else if(f>d)for(i=d,a=Math.min(f,p);i<a;++i)o[u=s[i]]^=g,r.push(u);if(h>p)for(i=Math.max(f,p),a=h;i<a;++i)o[u=s[i]]^=g,e.push(u);else if(h<p)for(i=Math.max(d,h),a=p;i<a;++i)o[u=s[i]]^=g,r.push(u);t.range=n.slice()},qM.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},et(qM,Ir).transform=function(t,n){var e=~(t.ignore||0),r=t.filter,i=r.mask;if(0==(i&e))return n.StopPropagation;var a=n.fork(n.ALL),u=r.data(),o=r.curr(),s=r.prev(),l=function(t){return o[t]&e?null:u[t]};return a.filter(a.MOD,l),i&i-1?(a.filter(a.ADD,function(t){var n=o[t]&e;return!n&&n^s[t]&e?u[t]:null}),a.filter(a.REM,function(t){var n=o[t]&e;return n&&!(n^n^s[t]&e)?u[t]:null})):(a.filter(a.ADD,l),a.filter(a.REM,function(t){return(o[t]&e)===i?u[t]:null})),a.filter(a.SOURCE,function(t){return l(t._index)})};var UM=Object.freeze({crossfilter:PM,resolvefilter:qM}),jM="default";function IM(t){var n=t._signals.cursor;n||(t._signals.cursor=n=t.add({user:jM,item:null})),t.on(t.events("view","mousemove"),n,function(t,e){var r=n.value,i=r?s(r)?r:r.user:jM,a=e.item&&e.item.cursor||null;return r&&i===r.user&&a==r.item?r:{user:i,item:a}}),t.add(null,function(t){var n,e=t.cursor,r=this.value;return s(e)||(r=e.item,e=e.user),n=e&&e!==jM?e:r||e,"undefined"!=typeof document&&document.body&&(document.body.style.cursor=n),r},{cursor:n})}function $M(t,n){var e=t._runtime.data;return e.hasOwnProperty(n)||i("Unrecognized data set: "+n),e[n]}function WM(t,n){Bt(n)||i("Second argument to changes must be a changeset.");var e=$M(this,t);return e.modified=!0,this.pulse(e.input,n)}function HM(t){var n=t.padding();return Math.max(0,t._viewWidth+n.left+n.right)}function YM(t){var n=t.padding();return Math.max(0,t._viewHeight+n.top+n.bottom)}function GM(t){var n=t.padding(),e=t._origin;return[n.left+e[0],n.top+e[1]]}function VM(t,n,e){var r,i,a=t._renderer.canvas();return a&&(i=GM(t),(r=ec(n.changedTouches?n.changedTouches[0]:n,a))[0]-=i[0],r[1]-=i[1]),n.dataflow=t,n.vega=function(t,n,e){var r=n?"group"===n.mark.marktype?n:n.mark.group:null;function i(t){var e,i=r;if(t)for(e=n;e;e=e.mark.group)if(e.mark.name===t){i=e;break}return i&&i.mark&&i.mark.interactive?i:{}}function a(t){if(!t)return e;s(t)&&(t=i(t));for(var n=e.slice();t;)n[0]-=t.x||0,n[1]-=t.y||0,t=t.mark&&t.mark.group;return n}return{view:V(t),item:V(n||{}),group:i,xy:a,x:function(t){return a(t)[0]},y:function(t){return a(t)[1]}}}(t,e,r),n.item=e,n}var XM="view",ZM="timer",JM="window",QM={trap:!1};function KM(t){return t.item}function tk(t){var n=t.item.mark.source;return n.source||n}function nk(t){return function(n,e){return e.vega.view().changeset().encode(e.item,t)}}function ek(t,n,e){var r=document.createElement(t);for(var i in n)r.setAttribute(i,n[i]);return null!=e&&(r.textContent=e),r}var rk="vega-bind",ik="vega-bind-name",ak="vega-bind-radio",uk="vega-option-";function ok(t,n,e){if(n){var r=e.param,i=e.state;return i||(i=e.state={elements:null,active:!1,set:null,update:function(n){n!==t.signal(r.signal)&&t.runAsync(null,function(){i.source=!0,t.signal(r.signal,n)})}},r.debounce&&(i.update=X(r.debounce,i.update))),function(t,n,e,r){var i=ek("div",{class:rk});i.appendChild(ek("span",{class:ik},e.name||e.signal)),n.appendChild(i);var a=sk;switch(e.input){case"checkbox":a=lk;break;case"select":a=ck;break;case"radio":a=fk;break;case"range":a=hk}a(t,i,e,r)}(i,n,r,t.signal(r.signal)),i.active||(t.on(t._signals[r.signal],null,function(){i.source?i.source=!1:i.set(t.signal(r.signal))}),i.active=!0),i}}function sk(t,n,e,r){var i=ek("input");for(var a in e)"signal"!==a&&"element"!==a&&i.setAttribute("input"===a?"type":a,e[a]);i.setAttribute("name",e.signal),i.value=r,n.appendChild(i),i.addEventListener("input",function(){t.update(i.value)}),t.elements=[i],t.set=function(t){i.value=t}}function lk(t,n,e,r){var i={type:"checkbox",name:e.signal};r&&(i.checked=!0);var a=ek("input",i);n.appendChild(a),a.addEventListener("change",function(){t.update(a.checked)}),t.elements=[a],t.set=function(t){a.checked=!!t||null}}function ck(t,n,e,r){var i=ek("select",{name:e.signal});e.options.forEach(function(t){var n={value:t};dk(t,r)&&(n.selected=!0),i.appendChild(ek("option",n,t+""))}),n.appendChild(i),i.addEventListener("change",function(){t.update(e.options[i.selectedIndex])}),t.elements=[i],t.set=function(t){for(var n=0,r=e.options.length;n<r;++n)if(dk(e.options[n],t))return void(i.selectedIndex=n)}}function fk(t,n,e,r){var i=ek("span",{class:ak});n.appendChild(i),t.elements=e.options.map(function(n){var a=uk+e.signal+"-"+n,u={id:a,type:"radio",name:e.signal,value:n};dk(n,r)&&(u.checked=!0);var o=ek("input",u);return o.addEventListener("change",function(){t.update(n)}),i.appendChild(o),i.appendChild(ek("label",{for:a},n+"")),o}),t.set=function(n){for(var e=t.elements,r=0,i=e.length;r<i;++r)dk(e[r].value,n)&&(e[r].checked=!0)}}function hk(t,n,e,r){r=void 0!==r?r:(+e.max+ +e.min)/2;var i,a,u,o,s,l,c=e.min||Math.min(0,+r)||0,f=e.max||Math.max(100,+r)||100,h=e.step||(i=c,a=f,u=100,o=Math.abs(a-i)/Math.max(0,u),s=Math.pow(10,Math.floor(Math.log(o)/Math.LN10)),(l=o/s)>=fi?s*=10:l>=hi?s*=5:l>=di&&(s*=2),a<i?-s:s),d=ek("input",{type:"range",name:e.signal,min:c,max:f,step:h});d.value=r;var p=ek("label",{},+r);function g(){p.textContent=d.value,t.update(+d.value)}n.appendChild(d),n.appendChild(p),d.addEventListener("input",g),d.addEventListener("change",g),t.elements=[d],t.set=function(t){d.value=t,p.textContent=t}}function dk(t,n){return t===n||t+""==n+""}function pk(t,n,e,r,i,a){return(n=n||new r(t.loader())).initialize(e,HM(t),YM(t),GM(t),i,a).background(t._background)}function gk(t,n){return n?function(){try{n.apply(this,arguments)}catch(n){t.error(n)}}:null}function vk(t,n){if("string"==typeof n){if("undefined"==typeof document)return t.error("DOM document instance not found."),null;if(!(n=document.querySelector(n)))return t.error("Signal bind element not found: "+n),null}if(n)try{n.innerHTML=""}catch(e){n=null,t.error(e)}return n}async function mk(t,n,e,r){const a=Gc(n),u=a&&a.headless;return u||i("Unrecognized renderer type: "+n),await t.runAsync(),pk(t,null,null,u,e,r).renderAsync(t._scenegraph.root)}var yk,_k,xk,bk,wk,Ak="RawCode",Mk="Literal",kk="Property",Ek="Identifier",Ck="ArrayExpression",Dk="BinaryExpression",Fk="CallExpression",Sk="ConditionalExpression",Bk="LogicalExpression",Nk="MemberExpression",Ok="ObjectExpression",zk="UnaryExpression";function Tk(t){this.type=t}Tk.prototype.visit=function(t){var n,e,r;if(t(this))return 1;for(e=0,r=(n=function(t){switch(t.type){case Ck:return t.elements;case Dk:case Bk:return[t.left,t.right];case Fk:var n=t.arguments.slice();return n.unshift(t.callee),n;case Sk:return[t.test,t.consequent,t.alternate];case Nk:return[t.object,t.property];case Ok:return t.properties;case kk:return[t.key,t.value];case zk:return[t.argument];case Ek:case Mk:case Ak:default:return[]}}(this)).length;e<r;++e)if(n[e].visit(t))return 1};var Rk=1,Pk=2,Lk=3,qk=4,Uk=5,jk=6,Ik=7,$k=8;(yk={})[Rk]="Boolean",yk[Pk]="<end>",yk[Lk]="Identifier",yk[qk]="Keyword",yk[Uk]="Null",yk[jk]="Numeric",yk[Ik]="Punctuator",yk[$k]="String",yk[9]="RegularExpression";var Wk="ArrayExpression",Hk="BinaryExpression",Yk="CallExpression",Gk="ConditionalExpression",Vk="Identifier",Xk="Literal",Zk="LogicalExpression",Jk="MemberExpression",Qk="ObjectExpression",Kk="Property",tE="UnaryExpression",nE="Unexpected token %0",eE="Unexpected number",rE="Unexpected string",iE="Unexpected identifier",aE="Unexpected reserved word",uE="Unexpected end of input",oE="Invalid regular expression",sE="Invalid regular expression: missing /",lE="Octal literals are not allowed in strict mode.",cE="Duplicate data property in object literal not allowed in strict mode",fE="ILLEGAL",hE="Disabled.",dE=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),pE=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function gE(t,n){if(!t)throw new Error("ASSERT: "+n)}function vE(t){return t>=48&&t<=57}function mE(t){return"0123456789abcdefABCDEF".indexOf(t)>=0}function yE(t){return"01234567".indexOf(t)>=0}function _E(t){return 32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(t)>=0}function xE(t){return 10===t||13===t||8232===t||8233===t}function bE(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||92===t||t>=128&&dE.test(String.fromCharCode(t))}function wE(t){return 36===t||95===t||t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||92===t||t>=128&&pE.test(String.fromCharCode(t))}var AE={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function ME(){for(var t;xk<bk&&(_E(t=_k.charCodeAt(xk))||xE(t));)++xk}function kE(t){var n,e,r,i=0;for(e="u"===t?4:2,n=0;n<e;++n)xk<bk&&mE(_k[xk])?(r=_k[xk++],i=16*i+"0123456789abcdef".indexOf(r.toLowerCase())):jE({},nE,fE);return String.fromCharCode(i)}function EE(){var t,n,e,r;for(n=0,"}"===(t=_k[xk])&&jE({},nE,fE);xk<bk&&mE(t=_k[xk++]);)n=16*n+"0123456789abcdef".indexOf(t.toLowerCase());return(n>1114111||"}"!==t)&&jE({},nE,fE),n<=65535?String.fromCharCode(n):(e=55296+(n-65536>>10),r=56320+(n-65536&1023),String.fromCharCode(e,r))}function CE(){var t,n;for(t=_k.charCodeAt(xk++),n=String.fromCharCode(t),92===t&&(117!==_k.charCodeAt(xk)&&jE({},nE,fE),++xk,(t=kE("u"))&&"\\"!==t&&bE(t.charCodeAt(0))||jE({},nE,fE),n=t);xk<bk&&wE(t=_k.charCodeAt(xk));)++xk,n+=String.fromCharCode(t),92===t&&(n=n.substr(0,n.length-1),117!==_k.charCodeAt(xk)&&jE({},nE,fE),++xk,(t=kE("u"))&&"\\"!==t&&wE(t.charCodeAt(0))||jE({},nE,fE),n+=t);return n}function DE(){var t,n;return t=xk,{type:1===(n=92===_k.charCodeAt(xk)?CE():function(){var t,n;for(t=xk++;xk<bk;){if(92===(n=_k.charCodeAt(xk)))return xk=t,CE();if(!wE(n))break;++xk}return _k.slice(t,xk)}()).length?Lk:AE.hasOwnProperty(n)?qk:"null"===n?Uk:"true"===n||"false"===n?Rk:Lk,value:n,start:t,end:xk}}function FE(){var t,n,e,r,i=xk,a=_k.charCodeAt(xk),u=_k[xk];switch(a){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++xk,{type:Ik,value:String.fromCharCode(a),start:i,end:xk};default:if(61===(t=_k.charCodeAt(xk+1)))switch(a){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return xk+=2,{type:Ik,value:String.fromCharCode(a)+String.fromCharCode(t),start:i,end:xk};case 33:case 61:return xk+=2,61===_k.charCodeAt(xk)&&++xk,{type:Ik,value:_k.slice(i,xk),start:i,end:xk}}}return">>>="===(r=_k.substr(xk,4))?{type:Ik,value:r,start:i,end:xk+=4}:">>>"===(e=r.substr(0,3))||"<<="===e||">>="===e?{type:Ik,value:e,start:i,end:xk+=3}:u===(n=e.substr(0,2))[1]&&"+-<>&|".indexOf(u)>=0||"=>"===n?{type:Ik,value:n,start:i,end:xk+=2}:"<>=!+-*%&|^/".indexOf(u)>=0?{type:Ik,value:u,start:i,end:++xk}:void jE({},nE,fE)}function SE(){var t,n,e;if(gE(vE((e=_k[xk]).charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point"),n=xk,t="","."!==e){if(t=_k[xk++],e=_k[xk],"0"===t){if("x"===e||"X"===e)return++xk,function(t){for(var n="";xk<bk&&mE(_k[xk]);)n+=_k[xk++];return 0===n.length&&jE({},nE,fE),bE(_k.charCodeAt(xk))&&jE({},nE,fE),{type:jk,value:parseInt("0x"+n,16),start:t,end:xk}}(n);if(yE(e))return function(t){for(var n="0"+_k[xk++];xk<bk&&yE(_k[xk]);)n+=_k[xk++];return(bE(_k.charCodeAt(xk))||vE(_k.charCodeAt(xk)))&&jE({},nE,fE),{type:jk,value:parseInt(n,8),octal:!0,start:t,end:xk}}(n);e&&vE(e.charCodeAt(0))&&jE({},nE,fE)}for(;vE(_k.charCodeAt(xk));)t+=_k[xk++];e=_k[xk]}if("."===e){for(t+=_k[xk++];vE(_k.charCodeAt(xk));)t+=_k[xk++];e=_k[xk]}if("e"===e||"E"===e)if(t+=_k[xk++],"+"!==(e=_k[xk])&&"-"!==e||(t+=_k[xk++]),vE(_k.charCodeAt(xk)))for(;vE(_k.charCodeAt(xk));)t+=_k[xk++];else jE({},nE,fE);return bE(_k.charCodeAt(xk))&&jE({},nE,fE),{type:jk,value:parseFloat(t),start:n,end:xk}}function BE(){var t,n,e,r;return wk=null,ME(),t=xk,n=function(){var t,n,e,r;for(gE("/"===(t=_k[xk]),"Regular expression literal must start with a slash"),n=_k[xk++],e=!1,r=!1;xk<bk;)if(n+=t=_k[xk++],"\\"===t)xE((t=_k[xk++]).charCodeAt(0))&&jE({},sE),n+=t;else if(xE(t.charCodeAt(0)))jE({},sE);else if(e)"]"===t&&(e=!1);else{if("/"===t){r=!0;break}"["===t&&(e=!0)}return r||jE({},sE),{value:n.substr(1,n.length-2),literal:n}}(),e=function(){var t,n,e;for(n="",e="";xk<bk&&wE((t=_k[xk]).charCodeAt(0));)++xk,"\\"===t&&xk<bk?jE({},nE,fE):(e+=t,n+=t);return e.search(/[^gimuy]/g)>=0&&jE({},oE,e),{value:e,literal:n}}(),r=function(t,n){var e=t;n.indexOf("u")>=0&&(e=e.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(t,n){if(parseInt(n,16)<=1114111)return"x";jE({},oE)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{return new RegExp(t,n)}catch(t){return null}}(n.value,e.value),{literal:n.literal+e.literal,value:r,regex:{pattern:n.value,flags:e.value},start:t,end:xk}}function NE(){var t;return ME(),xk>=bk?{type:Pk,start:xk,end:xk}:bE(t=_k.charCodeAt(xk))?DE():40===t||41===t||59===t?FE():39===t||34===t?function(){var t,n,e,r,i="",a=!1;for(gE("'"===(t=_k[xk])||'"'===t,"String literal must starts with a quote"),n=xk,++xk;xk<bk;){if((e=_k[xk++])===t){t="";break}if("\\"===e)if((e=_k[xk++])&&xE(e.charCodeAt(0)))"\r"===e&&"\n"===_k[xk]&&++xk;else switch(e){case"u":case"x":"{"===_k[xk]?(++xk,i+=EE()):i+=kE(e);break;case"n":i+="\n";break;case"r":i+="\r";break;case"t":i+="\t";break;case"b":i+="\b";break;case"f":i+="\f";break;case"v":i+="\v";break;default:yE(e)?(0!==(r="01234567".indexOf(e))&&(a=!0),xk<bk&&yE(_k[xk])&&(a=!0,r=8*r+"01234567".indexOf(_k[xk++]),"0123".indexOf(e)>=0&&xk<bk&&yE(_k[xk])&&(r=8*r+"01234567".indexOf(_k[xk++]))),i+=String.fromCharCode(r)):i+=e}else{if(xE(e.charCodeAt(0)))break;i+=e}}return""!==t&&jE({},nE,fE),{type:$k,value:i,octal:a,start:n,end:xk}}():46===t?vE(_k.charCodeAt(xk+1))?SE():FE():vE(t)?SE():FE()}function OE(){var t;return xk=(t=wk).end,wk=NE(),xk=t.end,t}function zE(){var t;t=xk,wk=NE(),xk=t}function TE(t,n,e){var r=new Tk("||"===t||"&&"===t?Zk:Hk);return r.operator=t,r.left=n,r.right=e,r}function RE(t,n){var e=new Tk(Yk);return e.callee=t,e.arguments=n,e}function PE(t){var n=new Tk(Vk);return n.name=t,n}function LE(t){var n=new Tk(Xk);return n.value=t.value,n.raw=_k.slice(t.start,t.end),t.regex&&("//"===n.raw&&(n.raw="/(?:)/"),n.regex=t.regex),n}function qE(t,n,e){var r=new Tk(Jk);return r.computed="["===t,r.object=n,r.property=e,r.computed||(e.member=!0),r}function UE(t,n,e){var r=new Tk(Kk);return r.key=n,r.value=e,r.kind=t,r}function jE(t,n){var e,r=Array.prototype.slice.call(arguments,2),i=n.replace(/%(\d)/g,function(t,n){return gE(n<r.length,"Message reference must be in range"),r[n]});throw(e=new Error(i)).index=xk,e.description=i,e}function IE(t){t.type===Pk&&jE(t,uE),t.type===jk&&jE(t,eE),t.type===$k&&jE(t,rE),t.type===Lk&&jE(t,iE),t.type===qk&&jE(t,aE),jE(t,nE,t.value)}function $E(t){var n=OE();n.type===Ik&&n.value===t||IE(n)}function WE(t){return wk.type===Ik&&wk.value===t}function HE(t){return wk.type===qk&&wk.value===t}function YE(){var t=[];for(xk=wk.start,$E("[");!WE("]");)WE(",")?(OE(),t.push(null)):(t.push(iC()),WE("]")||$E(","));return OE(),function(t){var n=new Tk(Wk);return n.elements=t,n}(t)}function GE(){var t;return xk=wk.start,(t=OE()).type===$k||t.type===jk?(t.octal&&jE(t,lE),LE(t)):PE(t.value)}function VE(){var t,n,e;return xk=wk.start,(t=wk).type===Lk?(e=GE(),$E(":"),UE("init",e,iC())):t.type!==Pk&&t.type!==Ik?(n=GE(),$E(":"),UE("init",n,iC())):void IE(t)}function XE(){var t,n,e=[],r={},i=String;for(xk=wk.start,$E("{");!WE("}");)n="$"+((t=VE()).key.type===Vk?t.key.name:i(t.key.value)),Object.prototype.hasOwnProperty.call(r,n)?jE({},cE):r[n]=!0,e.push(t),WE("}")||$E(",");return $E("}"),function(t){var n=new Tk(Qk);return n.properties=t,n}(e)}var ZE={if:1,this:1};function JE(){var t,n,e;if(WE("("))return function(){var t;return $E("("),t=aC(),$E(")"),t}();if(WE("["))return YE();if(WE("{"))return XE();if(t=wk.type,xk=wk.start,t===Lk||ZE[wk.value])e=PE(OE().value);else if(t===$k||t===jk)wk.octal&&jE(wk,lE),e=LE(OE());else{if(t===qk)throw new Error(hE);t===Rk?((n=OE()).value="true"===n.value,e=LE(n)):t===Uk?((n=OE()).value=null,e=LE(n)):WE("/")||WE("/=")?(e=LE(BE()),zE()):IE(OE())}return e}function QE(){var t=[];if($E("("),!WE(")"))for(;xk<bk&&(t.push(iC()),!WE(")"));)$E(",");return $E(")"),t}function KE(){var t;return xk=wk.start,function(t){return t.type===Lk||t.type===qk||t.type===Rk||t.type===Uk}(t=OE())||IE(t),PE(t.value)}function tC(){var t;return $E("["),t=aC(),$E("]"),t}function nC(){var t=function(){var t;for(t=JE();;)if(WE("."))$E("."),t=qE(".",t,KE());else if(WE("("))t=RE(t,QE());else{if(!WE("["))break;t=qE("[",t,tC())}return t}();if(wk.type===Ik&&(WE("++")||WE("--")))throw new Error(hE);return t}function eC(){var t,n,e,r,i;if(wk.type!==Ik&&wk.type!==qk)n=nC();else{if(WE("++")||WE("--"))throw new Error(hE);if(WE("+")||WE("-")||WE("~")||WE("!"))t=OE(),n=eC(),e=t.value,r=n,(i=new Tk(tE)).operator=e,i.argument=r,i.prefix=!0,n=i;else{if(HE("delete")||HE("void")||HE("typeof"))throw new Error(hE);n=nC()}}return n}function rC(t){var n=0;if(t.type!==Ik&&t.type!==qk)return 0;switch(t.value){case"||":n=1;break;case"&&":n=2;break;case"|":n=3;break;case"^":n=4;break;case"&":n=5;break;case"==":case"!=":case"===":case"!==":n=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":n=7;break;case"<<":case">>":case">>>":n=8;break;case"+":case"-":n=9;break;case"*":case"/":case"%":n=11}return n}function iC(){var t,n;return t=function(){var t,n,e,r,i,a,u,o,s,l;if(t=wk,s=eC(),0===(i=rC(r=wk)))return s;for(r.prec=i,OE(),n=[t,wk],a=[s,r,u=eC()];(i=rC(wk))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)u=a.pop(),o=a.pop().value,s=a.pop(),n.pop(),e=TE(o,s,u),a.push(e);(r=OE()).prec=i,a.push(r),n.push(wk),e=eC(),a.push(e)}for(e=a[l=a.length-1],n.pop();l>1;)n.pop(),e=TE(a[l-1].value,a[l-2],e),l-=2;return e}(),WE("?")&&(OE(),n=iC(),$E(":"),t=function(t,n,e){var r=new Tk(Gk);return r.test=t,r.consequent=n,r.alternate=e,r}(t,n,iC())),t}function aC(){var t=iC();if(WE(","))throw new Error(hE);return t}var uC={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function oC(t){function n(n,e,r){return function(i){return function(n,e,r,i){var a=t(e[0]);return r&&(a=r+"("+a+")",0===r.lastIndexOf("new ",0)&&(a="("+a+")")),a+"."+n+(i<0?"":0===i?"()":"("+e.slice(1).map(t).join(",")+")")}(n,i,e,r)}}var e="new Date";return{isNaN:"isNaN",isFinite:"isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(n){n.length<3&&i("Missing arguments to clamp function."),n.length>3&&i("Too many arguments to clamp function.");var e=n.map(t);return"Math.max("+e[1]+", Math.min("+e[2]+","+e[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:e,date:n("getDate",e,0),day:n("getDay",e,0),year:n("getFullYear",e,0),month:n("getMonth",e,0),hours:n("getHours",e,0),minutes:n("getMinutes",e,0),seconds:n("getSeconds",e,0),milliseconds:n("getMilliseconds",e,0),time:n("getTime",e,0),timezoneoffset:n("getTimezoneOffset",e,0),utcdate:n("getUTCDate",e,0),utcday:n("getUTCDay",e,0),utcyear:n("getUTCFullYear",e,0),utcmonth:n("getUTCMonth",e,0),utchours:n("getUTCHours",e,0),utcminutes:n("getUTCMinutes",e,0),utcseconds:n("getUTCSeconds",e,0),utcmilliseconds:n("getUTCMilliseconds",e,0),length:n("length",null,-1),indexof:n("indexOf",null),lastindexof:n("lastIndexOf",null),slice:n("slice",null),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase","String",0),lower:n("toLowerCase","String",0),substring:n("substring","String"),split:n("split","String"),replace:n("replace","String"),regexp:"RegExp",test:n("test","RegExp"),if:function(n){n.length<3&&i("Missing arguments to if function."),n.length>3&&i("Too many arguments to if function.");var e=n.map(t);return"("+e[0]+"?"+e[1]+":"+e[2]+")"}}}const sC="intersect",lC="union";var cC="E",fC="R",hC="R-E",dC="R-LE",pC="R-RE",gC="index:unit";function vC(t,n){for(var e,r,i=n.fields,a=n.values,o=i.length,s=0;s<o;++s)if((r=i[s]).getter=c.getter||c(r.field),at(e=r.getter(t))&&(e=E(e)),at(a[s])&&(a[s]=E(a[s])),at(a[s][0])&&(a[s]=a[s].map(E)),r.type===cC){if(u(a[s])?a[s].indexOf(e)<0:e!==a[s])return!1}else if(r.type===fC){if(!rt(e,a[s]))return!1}else if(r.type===pC){if(!rt(e,a[s],!0,!1))return!1}else if(r.type===hC){if(!rt(e,a[s],!1,!1))return!1}else if(r.type===dC&&!rt(e,a[s],!1,!0))return!1;return!0}var mC={E_union:function(t,n){if(!t.length)return n;for(var e=0,r=n.length;e<r;++e)t.indexOf(n[e])<0&&t.push(n[e]);return t},E_intersect:function(t,n){return t.length?t.filter(function(t){return n.indexOf(t)>=0}):n},R_union:function(t,n){var e=E(n[0]),r=E(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?(t[0]>e&&(t[0]=e),t[1]<r&&(t[1]=r),t):[e,r]},R_intersect:function(t,n){var e=E(n[0]),r=E(n[1]);return e>r&&(e=n[1],r=n[0]),t.length?r<t[0]||t[1]<e?[]:(t[0]<e&&(t[0]=e),t[1]>r&&(t[1]=r),t):[e,r]}};const yC=":",_C="@";function xC(t,n,e,r){n[0].type!==Mk&&i("First argument to selection functions must be a string literal.");const a=n[0].value,u=n.length>=2&&k(n).value,o=_C+"unit",s=yC+a;u!==sC||r.hasOwnProperty(o)||(r[o]=e.getData(a).indataRef(e,"unit")),r.hasOwnProperty(s)||(r[s]=e.getData(a).tuplesRef())}function bC(t){const n=this.context.data[t];return n?n.values.value:[]}const wC={};function AC(t,n,e){let r=t+":"+e,i=wC[r];return i&&i[0]===n||(wC[r]=i=[n,n(e)]),i[1]}function MC(t,n){return AC("timeFormat",ie,n)(t)}var kC=new Date(2e3,0,1);function EC(t,n,e){return kC.setMonth(t),kC.setDate(n),MC(kC,e)}function CC(t,n){let e;return Y(t)?t:s(t)?(e=n.scales[t])&&e.value:void 0}function DC(t,n){return function(e,r,i){if(e){const n=CC(e,(i||this).context);return n&&n.path[t](r)}return n(r)}}const FC=DC("area",function(t){return Wm.reset(),Pm(t,Hm),2*Wm}),SC=DC("bounds",function(t){var n,e,r,i,a,u,o;if(uy=ay=-(ry=iy=1/0),fy=[],Pm(t,Sy),e=fy.length){for(fy.sort(qy),n=1,a=[r=fy[0]];n<e;++n)Uy(r,(i=fy[n])[0])||Uy(r,i[1])?(Ly(r[0],i[1])>Ly(r[0],r[1])&&(r[1]=i[1]),Ly(i[0],r[1])>Ly(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(u=-1/0,n=0,r=a[e=a.length-1];n<=e;r=i,++n)i=a[n],(o=Ly(r[1],i[0]))>u&&(u=o,ry=i[0],ay=r[1])}return fy=hy=null,ry===1/0||iy===1/0?[[NaN,NaN],[NaN,NaN]]:[[ry,iy],[ay,uy]]}),BC=DC("centroid",function(t){dy=py=gy=vy=my=yy=_y=xy=by=wy=Ay=0,Pm(t,jy);var n=by,e=wy,r=Ay,i=n*n+e*e+r*r;return i<cm&&(n=yy,e=_y,r=xy,py<lm&&(n=gy,e=vy,r=my),(i=n*n+e*e+r*r)<cm)?[NaN,NaN]:[_m(e,n)*gm,Sm(r/Cm(i))*gm]});function NC(t,n,e){try{t[n].apply(t,["EXPRESSION"].concat([].slice.call(e)))}catch(n){t.warn(n)}return e[e.length-1]}function OC(t,n){return t===n||t!=t&&n!=n||!(!u(t)||!u(n)||t.length!==n.length)&&function(t,n){for(let e=0,r=t.length;e<r;++e)if(!OC(t[e],n[e]))return!1;return!0}(t,n)}function zC(t){return function(n){for(let e in t)if(!OC(n[e],t[e]))return!1;return!0}}const TC={};function RC(t){return t.data}function PC(t,n){const e=bC.call(n,t);return e.root&&e.root.lookup||TC}const LC="undefined"!=typeof window&&window||null;const qC=":",UC="@",jC="%",IC="$";function $C(t,n,e,r){n[0].type!==Mk&&i("First argument to data functions must be a string literal.");const a=n[0].value,u=qC+a;r.hasOwnProperty(u)||(r[u]=e.getData(a).tuplesRef())}function WC(t,n,e,r){if(n[0].type===Mk)HC(e,r,n[0].value);else if(n[0].type===Ek)for(t in e.scales)HC(e,r,t)}function HC(t,n,e){const r=jC+e;if(!n.hasOwnProperty(r))try{n[r]=t.scaleRef(e)}catch(t){}}const YC={random:function(){return t.random()},isArray:u,isBoolean:it,isDate:at,isNumber:ut,isObject:o,isRegExp:ot,isString:s,isTuple:Mt,toBoolean:dt,toDate:gt,toNumber:E,toString:vt,pad:ft,peek:k,truncate:yt,rgb:Kh,lab:vd,hcl:wd,hsl:rd,sequence:ci,format:function(t,n){return AC("format",Gp,n)(t)},utcFormat:function(t,n){return AC("utcFormat",ue,n)(t)},utcParse:function(t,n){return AC("utcParse",oe,n)(t)},timeFormat:MC,timeParse:function(t,n){return AC("timeParse",ae,n)(t)},monthFormat:function(t){return EC(t,1,"%B")},monthAbbrevFormat:function(t){return EC(t,1,"%b")},dayFormat:function(t){return EC(0,2+t,"%A")},dayAbbrevFormat:function(t){return EC(0,2+t,"%a")},quarter:I,utcquarter:$,warn:function(){return NC(this.context.dataflow,"warn",arguments)},info:function(){return NC(this.context.dataflow,"info",arguments)},debug:function(){return NC(this.context.dataflow,"debug",arguments)},extent:J,inScope:function(t){let n=this.context.group,e=!1;if(n)for(;t;){if(t===n){e=!0;break}t=t.mark.group}return e},intersect:function(t,n,e){if(!t)return[];const[r,i]=t,a=(new xu).set(r[0],r[1],i[0],i[1]);return Vc(e||this.context.dataflow.scenegraph().root,a,function(t){let n=null;if(t){const e=W(t.marktype),r=W(t.markname);n=(t=>(!e.length||e.some(n=>t.marktype===n))&&(!r.length||r.some(n=>t.name===n)))}return n}(n))},clampRange:H,pinchDistance:function(t){const n=t.touches,e=n[0].clientX-n[1].clientX,r=n[0].clientY-n[1].clientY;return Math.sqrt(e*e+r*r)},pinchAngle:function(t){const n=t.touches;return Math.atan2(n[0].clientY-n[1].clientY,n[0].clientX-n[1].clientX)},screen:function(){return LC?LC.screen:{}},containerSize:function(){const t=this.context.dataflow,n=t.container&&t.container();return n?[n.clientWidth,n.clientHeight]:[void 0,void 0]},windowSize:function(){return LC?[LC.innerWidth,LC.innerHeight]:[void 0,void 0]},span:ht,merge:function(){var t=[].slice.call(arguments);return t.unshift({}),Z.apply(null,t)},flush:nt,bandspace:function(t,n,e){return Lf(t||0,n||0,e||0)},inrange:rt,setdata:function(t,n){const e=this.context.dataflow,r=this.context.data[t].input;return e.pulse(r,e.changeset().remove(v).insert(n)),1},pathShape:function(t){let n=null;return function(e){return e?rs(e,n=n||Yo(t)):t}},panLinear:O,panLog:z,panPow:T,panSymlog:R,zoomLinear:L,zoomLog:q,zoomPow:U,zoomSymlog:j,encode:function(t,n,e){if(t){const e=this.context.dataflow,r=t.mark.source;e.pulse(r,e.changeset().encode(t,n))}return void 0!==e?e:t},modify:function(t,n,e,r,i,a){let o,s,l=this.context.dataflow,c=this.context.data[t],f=c.input,h=c.changes,d=l.stamp();if(!1===l._trigger||!(f.value.length||n||r))return 0;if((!h||h.stamp<d)&&(c.changes=h=l.changeset(),h.stamp=d,l.runAfter(function(){c.modified=!0,l.pulse(f,h).run()},!0,1)),e&&(o=!0===e?v:u(e)||Mt(e)?e:zC(e),h.remove(o)),n&&h.insert(n),r&&(o=zC(r),f.value.some(o)?h.remove(o):h.insert(r)),i)for(s in a)h.modify(i,s,a[s]);return 1}},GC=["view","item","group","xy","x","y"],VC="event.vega.",XC="this.",ZC={};function JC(t,n,e){return 1===arguments.length?YC[t]:(YC[t]=n,e&&(ZC[t]=e),KC&&(KC.functions[t]=XC+t),this)}JC("bandwidth",function(t,n){const e=CC(t,(n||this).context);return e&&e.bandwidth?e.bandwidth():0},WC),JC("copy",function(t,n){const e=CC(t,(n||this).context);return e?e.copy():void 0},WC),JC("domain",function(t,n){const e=CC(t,(n||this).context);return e?e.domain():[]},WC),JC("range",function(t,n){const e=CC(t,(n||this).context);return e&&e.range?e.range():[]},WC),JC("invert",function(t,n,e){const r=CC(t,(e||this).context);return r?u(n)?(r.invertRange||r.invert)(n):(r.invert||r.invertExtent)(n):void 0},WC),JC("scale",function(t,n,e){const r=CC(t,(e||this).context);return r?r(n):void 0},WC),JC("gradient",function(t,n,e,r,i){t=CC(t,(i||this).context);const a=Au(n,e);let u=t.domain(),o=u[0],s=k(u),l=d;return s-o?l=Ig(t,o,s):t=(t.interpolator?Tg("sequential")().interpolator(t.interpolator()):Tg("linear")().interpolate(t.interpolate()).range(t.range())).domain([o=0,s=1]),t.ticks&&(o!==(u=t.ticks(+r||15))[0]&&u.unshift(o),s!==k(u)&&u.push(s)),u.forEach(n=>a.stop(l(n),t(n))),a},WC),JC("geoArea",FC,WC),JC("geoBounds",SC,WC),JC("geoCentroid",BC,WC),JC("geoShape",function(t,n,e){const r=CC(t,(e||this).context);return function(t){return r?r.path.context(t)(n):""}},WC),JC("indata",function(t,n,e){const r=this.context.data[t]["index:"+n],i=r?r.value.get(e):void 0;return i?i.count:i},function(t,n,e,r){n[0].type!==Mk&&i("First argument to indata must be a string literal."),n[1].type!==Mk&&i("Second argument to indata must be a string literal.");const a=n[0].value,u=n[1].value,o=UC+u;r.hasOwnProperty(o)||(r[o]=e.getData(a).indataRef(e,u))}),JC("data",bC,$C),JC("treePath",function(t,n,e){const r=PC(t,this),i=r[n],a=r[e];return i&&a?i.path(a).map(RC):void 0},$C),JC("treeAncestors",function(t,n){const e=PC(t,this)[n];return e?e.ancestors().map(RC):void 0},$C),JC("vlSelectionTest",function(t,n,e){for(var r,i,a,u,o,s=this.context.data[t],l=s?s.values.value:[],c=s?s[gC]&&s[gC].value:void 0,f=e===sC,h=l.length,d=0;d<h;++d)if(r=l[d],c&&f){if(-1===(a=(i=i||{})[u=r.unit]||0))continue;if(o=vC(n,r),i[u]=o?-1:++a,o&&1===c.size)return!0;if(!o&&a===c.get(u).count)return!1}else if(f^(o=vC(n,r)))return o;return h&&f},xC),JC("vlSelectionResolve",function(t,n){for(var e,r,i,a,u,o,s,l,c,f,h,d=this.context.data[t],p=d?d.values.value:[],g={},v={},m=p.length,y=0;y<m;++y)for(a=(e=p[y]).unit,r=e.fields,i=e.values,f=0,h=r.length;f<h;++f)u=r[f],s=(o=g[u.field]||(g[u.field]={}))[a]||(o[a]=[]),v[u.field]=l=u.type.charAt(0),c=mC[l+"_union"],o[a]=c(s,W(i[f]));return n=n||lC,Object.keys(g).forEach(function(t){g[t]=Object.keys(g[t]).map(function(n){return g[t][n]}).reduce(function(e,r){return void 0===e?r:mC[v[t]+"_"+n](e,r)})}),g},xC);const QC={blacklist:["_"],whitelist:["datum","event","item"],fieldvar:"datum",globalvar:function(t){return"_["+l(IC+t)+"]"},functions:function(t){const n=oC(t);GC.forEach(t=>n[t]=VC+t);for(let t in YC)n[t]=XC+t;return n},constants:uC,visitors:ZC};var KC=function(t){var n=(t=t||{}).whitelist?mt(t.whitelist):{},e=t.blacklist?mt(t.blacklist):{},r=t.constants||uC,a=(t.functions||oC)(d),u=t.globalvar,o=t.fieldvar,l={},c={},f=0,h=Y(u)?u:function(t){return u+'["'+t+'"]'};function d(t){if(s(t))return t;var n=p[t.type];return null==n&&i("Unsupported type: "+t.type),n(t)}var p={Literal:function(t){return t.raw},Identifier:function(t){var a=t.name;return f>0?a:e.hasOwnProperty(a)?i("Illegal identifier: "+a):r.hasOwnProperty(a)?r[a]:n.hasOwnProperty(a)?a:(l[a]=1,h(a))},MemberExpression:function(t){var n=!t.computed,e=d(t.object);n&&(f+=1);var r=d(t.property);return e===o&&(c[r]=1),n&&(f-=1),e+(n?"."+r:"["+r+"]")},CallExpression:function(t){"Identifier"!==t.callee.type&&i("Illegal callee type: "+t.callee.type);var n=t.callee.name,e=t.arguments,r=a.hasOwnProperty(n)&&a[n];return r||i("Unrecognized function: "+n),Y(r)?r(e):r+"("+e.map(d).join(",")+")"},ArrayExpression:function(t){return"["+t.elements.map(d).join(",")+"]"},BinaryExpression:function(t){return"("+d(t.left)+t.operator+d(t.right)+")"},UnaryExpression:function(t){return"("+t.operator+d(t.argument)+")"},ConditionalExpression:function(t){return"("+d(t.test)+"?"+d(t.consequent)+":"+d(t.alternate)+")"},LogicalExpression:function(t){return"("+d(t.left)+t.operator+d(t.right)+")"},ObjectExpression:function(t){return"{"+t.properties.map(d).join(",")+"}"},Property:function(t){f+=1;var n=d(t.key);return f-=1,n+":"+d(t.value)}};function g(t){var n={code:d(t),globals:Object.keys(l),fields:Object.keys(c)};return l={},c={},n}return g.functions=a,g.constants=r,g}(QC);function tD(t,n,e){";"!==n[n.length-1]&&(n="return("+n+");");var r=Function.apply(null,t.concat(n));return e&&e.functions?r.bind(e.functions):r}function nD(t,n){return tD(["event"],t,n)}function eD(t,n){return tD(["item","_"],t,n)}function rD(t,n,e){var r,i;for(r in e=e||{},t)i=t[r],e[r]=u(i)?i.map(function(t){return iD(t,n,e)}):iD(i,n,e);return e}function iD(t,n,e){if(!t||!o(t))return t;for(var r,i=0,a=aD.length;i<a;++i)if(r=aD[i],t.hasOwnProperty(r.key))return r.parse(t,n,e);return t}var aD=[{key:"$ref",parse:function(t,n){return n.get(t.$ref)||i("Operator not defined: "+t.$ref)}},{key:"$key",parse:function(t,n){var e="k:"+t.$key+"_"+!!t.$flat;return n.fn[e]||(n.fn[e]=st(t.$key,t.$flat))}},{key:"$expr",parse:function(t,e,r){t.$params&&rD(t.$params,e,r);var i="e:"+t.$expr+"_"+t.$name;return e.fn[i]||(e.fn[i]=n(function(t,n){return tD(["datum","_"],t,n)}(t.$expr,e),t.$fields,t.$name))}},{key:"$field",parse:function(t,n){if(!t.$field)return null;var e="f:"+t.$field+"_"+t.$name;return n.fn[e]||(n.fn[e]=c(t.$field,t.$name))}},{key:"$encode",parse:function(t,e){var r,i,a=t.$encode,u={};for(r in a)i=a[r],u[r]=n(eD(i.$expr,e),i.$fields),u[r].output=i.$output;return u}},{key:"$compare",parse:function(t,n){var e="c:"+t.$compare+"_"+t.$order,r=W(t.$compare).map(function(t){return t&&t.$tupleid?kt:t});return n.fn[e]||(n.fn[e]=G(r,t.$order))}},{key:"$context",parse:function(t,n){return n}},{key:"$subflow",parse:function(t,n){var e=t.$subflow;return function(t,r,i){var a=lD(e,n.fork()),u=a.get(e.operators[0].id),o=a.signals.parent;return o&&o.set(i),u}}},{key:"$tupleid",parse:function(){return kt}}];function uD(t){return(t+"").toLowerCase()}function oD(t,n){"operator"!==uD(t.type)&&t.type?n.transform(t,t.type):n.operator(t,t.update?function(t,n){return tD(["_"],t,n)}(t.update,n):null)}function sD(t,n){var e=o(e=t.source)?e.$ref:e,r=n.get(e),a=null,u=t.update,s=void 0;r||i("Source not defined: "+t.source),a=t.target&&t.target.$expr?nD(t.target.$expr,n):n.get(t.target),u&&u.$expr&&(u.$params&&(s=rD(u.$params,n)),u=function(t,n){return tD(["_","event"],t,n)}(u.$expr,n)),n.update(t,r,a,u,s)}function lD(t,n){var e=t.operators||[];return t.background&&(n.background=t.background),t.eventConfig&&(n.eventConfig=t.eventConfig),e.forEach(function(t){oD(t,n)}),e.forEach(function(t){!function(t,n){if(t.params){var e=n.get(t.id);e||i("Invalid operator id: "+t.id),n.dataflow.connect(e,e.parameters(rD(t.params,n),t.react,t.initonly))}}(t,n)}),(t.streams||[]).forEach(function(t){!function(t,n){var e,r=null!=t.filter?nD(t.filter,n):void 0,a=null!=t.stream?n.get(t.stream):void 0;t.source?a=n.events(t.source,t.type,r):t.merge&&(a=(e=t.merge.map(n.get.bind(n)))[0].merge.apply(e[0],e.slice(1))),t.between&&(e=t.between.map(n.get.bind(n)),a=a.between(e[0],e[1])),t.filter&&(a=a.filter(r)),null!=t.throttle&&(a=a.throttle(+t.throttle)),null!=t.debounce&&(a=a.debounce(+t.debounce)),null==a&&i("Invalid stream definition: "+JSON.stringify(t)),t.consume&&a.consume(!0),n.stream(t,a)}(t,n)}),(t.updates||[]).forEach(function(t){sD(t,n)}),n.resolve()}var cD={skip:!0};function fD(t,n,e){return new hD(t,n,e)}function hD(t,n,e){this.dataflow=t,this.transforms=n,this.events=t.events.bind(t),this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},e&&(this.functions=Object.create(e),this.functions.context=this)}function dD(t){this.dataflow=t.dataflow,this.transforms=t.transforms,this.functions=t.functions,this.events=t.events,this.signals=Object.create(t.signals),this.scales=Object.create(t.scales),this.nodes=Object.create(t.nodes),this.data=Object.create(t.data),this.fn=Object.create(t.fn),t.functions&&(this.functions=Object.create(t.functions),this.functions.context=this)}hD.prototype=dD.prototype={fork:function(){var t=new dD(this);return(this.subcontext||(this.subcontext=[])).push(t),t},get:function(t){return this.nodes[t]},set:function(t,n){return this.nodes[t]=n},add:function(t,n){var e,r=this,i=r.dataflow;if(r.set(t.id,n),"collect"===uD(t.type)&&(e=t.value)&&(e.$ingest?i.ingest(n,e.$ingest,e.$format):e.$request?i.preload(n,e.$request,e.$format):i.pulse(n,i.changeset().insert(e))),t.root&&(r.root=n),t.parent){var a=r.get(t.parent.$ref);a?(i.connect(a,[n]),n.targets().add(a)):(r.unresolved=r.unresolved||[]).push(function(){a=r.get(t.parent.$ref),i.connect(a,[n]),n.targets().add(a)})}if(t.signal&&(r.signals[t.signal]=n),t.scale&&(r.scales[t.scale]=n),t.data)for(var u in t.data)e=r.data[u]||(r.data[u]={}),t.data[u].forEach(function(t){e[t]=n})},resolve:function(){return(this.unresolved||[]).forEach(function(t){t()}),delete this.unresolved,this},operator:function(t,n){this.add(t,this.dataflow.add(t.value,n))},transform:function(t,n){this.add(t,this.dataflow.add(this.transforms[uD(n)]))},stream:function(t,n){this.set(t.id,n)},update:function(t,n,e,r,i){this.dataflow.on(n,e,r,i,t.options)},getState:function(t){var n=this,e={};if(t.signals){var r=e.signals={};Object.keys(n.signals).forEach(function(e){var i=n.signals[e];t.signals(e,i)&&(r[e]=i.value)})}if(t.data){var i=e.data={};Object.keys(n.data).forEach(function(e){var r=n.data[e];t.data(e,r)&&(i[e]=r.input.value)})}return n.subcontext&&!1!==t.recurse&&(e.subcontext=n.subcontext.map(function(n){return n.getState(t)})),e},setState:function(t){var n=this,e=n.dataflow,r=t.data,i=t.signals;Object.keys(i||{}).forEach(function(t){e.update(n.signals[t],i[t],cD)}),Object.keys(r||{}).forEach(function(t){e.pulse(n.data[t].input,e.changeset().remove(v).insert(r[t]))}),(t.subcontext||[]).forEach(function(t,e){var r=n.subcontext[e];r&&r.setState(t)})}};var pD="width",gD="height",vD="padding",mD={skip:!0};function yD(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===vD?r.left+r.right:0)}function _D(t,n){var e=t.autosize(),r=t.padding();return n-(e&&e.contains===vD?r.top+r.bottom:0)}function xD(t,n){return n.modified&&u(n.input.value)&&t.indexOf("_:vega:_")}function bD(t,n){return!("parent"===t||n instanceof Wr.proxy)}function wD(t,n,e,r){var i=t.element();i&&i.setAttribute("title",function(t){return null==t?"":u(t)?AD(t):o(t)&&!at(t)?(n=t,Object.keys(n).map(function(t){var e=n[t];return t+": "+(u(e)?AD(e):MD(e))}).join("\n")):t+"";var n}(r))}function AD(t){return"["+t.map(MD).join(", ")+"]"}function MD(t){return u(t)?"[…]":o(t)&&!at(t)?"{…}":t}function kD(t,n){n=n||{},qr.call(this),this.loader(n.loader||this._loader),this.logLevel(n.logLevel||0),this._el=null,this._elBind=null,this._renderType=n.renderer||Hc.Canvas,this._scenegraph=new Vl;var e=this._scenegraph.root;this._renderer=null,this._tooltip=n.tooltip||wD,this._redraw=!0,this._handler=(new lc).scene(e),this._preventDefault=!1,this._timers=[],this._eventListeners=[],this._resizeListeners=[];var r,i,a=function(t,n,e){return lD(n,fD(t,Wr,e||YC))}(this,t,n.functions);this._runtime=a,this._signals=a.signals,this._bind=(t.bindings||[]).map(function(t){return{state:null,param:Z({},t)}}),a.root&&a.root.set(e),e.source=a.data.root.input,this.pulse(a.data.root.input,this.changeset().insert(e.items)),this._background=a.background||null,this._eventConfig=(r=a.eventConfig,(i=(r=Z({},r)).defaults)&&(u(i.prevent)&&(i.prevent=mt(i.prevent)),u(i.allow)&&(i.allow=mt(i.allow))),r),this._width=this.width(),this._height=this.height(),this._viewWidth=yD(this,this._width),this._viewHeight=_D(this,this._height),this._origin=[0,0],this._resize=0,this._autosize=1,function(t){var n=t._signals,e=n[pD],r=n[gD],i=n[vD];function a(){t._autosize=t._resize=1}t._resizeWidth=t.add(null,function(n){t._width=n.size,t._viewWidth=yD(t,n.size),a()},{size:e}),t._resizeHeight=t.add(null,function(n){t._height=n.size,t._viewHeight=_D(t,n.size),a()},{size:r});var u=t.add(null,a,{pad:i});t._resizeWidth.rank=e.rank+1,t._resizeHeight.rank=r.rank+1,u.rank=i.rank+1}(this),IM(this)}var ED=et(kD,qr);function CD(t,n){return t._signals.hasOwnProperty(n)?t._signals[n]:i("Unrecognized signal name: "+l(n))}function DD(t,n){var e=(t._targets||[]).filter(function(t){var e=t._update;return e&&e.handler===n});return e.length?e[0]:null}function FD(t,n,e,r){var i=DD(e,r);return i||((i=gk(this,function(){r(n,e.value)})).handler=r,t.on(e,null,i)),t}function SD(t,n,e){var r=DD(n,e);return r&&n._targets.remove(r),t}function BD(t){return+t||0}ED.evaluate=async function(t,n,e){if(await qr.prototype.evaluate.call(this,t,n),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,i=GM(r=this),a=HM(r),u=YM(r),r._renderer.background(r._background),r._renderer.resize(a,u,i),r._handler.origin(i),r._resizeListeners.forEach(function(t){try{t(a,u)}catch(t){r.error(t)}})),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(t){this.error(t)}var r,i,a,u;return e&&bt(this,e),this},ED.dirty=function(t){this._redraw=!0,this._renderer&&this._renderer.dirty(t)},ED.container=function(){return this._el},ED.scenegraph=function(){return this._scenegraph},ED.origin=function(){return this._origin.slice()},ED.signal=function(t,n,e){var r=CD(this,t);return 1===arguments.length?r.value:this.update(r,n,e)},ED.background=function(t){return arguments.length?(this._background=t,this._resize=1,this):this._background},ED.width=function(t){return arguments.length?this.signal("width",t):this.signal("width")},ED.height=function(t){return arguments.length?this.signal("height",t):this.signal("height")},ED.padding=function(t){return arguments.length?this.signal("padding",t):this.signal("padding")},ED.autosize=function(t){return arguments.length?this.signal("autosize",t):this.signal("autosize")},ED.renderer=function(t){return arguments.length?(Gc(t)||i("Unrecognized renderer type: "+t),t!==this._renderType&&(this._renderType=t,this._resetRenderer()),this):this._renderType},ED.tooltip=function(t){return arguments.length?(t!==this._tooltip&&(this._tooltip=t,this._resetRenderer()),this):this._tooltip},ED.loader=function(t){return arguments.length?(t!==this._loader&&(qr.prototype.loader.call(this,t),this._resetRenderer()),this):this._loader},ED.resize=function(){return this._autosize=1,this.touch(CD(this,"autosize"))},ED._resetRenderer=function(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},ED._resizeView=function(t,n,e,r,i,a){this.runAfter(function(u){var o=0;u._autosize=0,u.width()!==e&&(o=1,u.signal(pD,e,mD),u._resizeWidth.skip(!0)),u.height()!==r&&(o=1,u.signal(gD,r,mD),u._resizeHeight.skip(!0)),u._viewWidth!==t&&(u._resize=1,u._viewWidth=t),u._viewHeight!==n&&(u._resize=1,u._viewHeight=n),u._origin[0]===i[0]&&u._origin[1]===i[1]||(u._resize=1,u._origin=i),o&&u.run("enter"),a&&u.runAfter(t=>t.resize())},!1,1)},ED.addEventListener=function(t,n,e){var r=n;return e&&!1===e.trap||((r=gk(this,n)).raw=n),this._handler.on(t,r),this},ED.removeEventListener=function(t,n){for(var e,r,i=this._handler.handlers(t),a=i.length;--a>=0;)if(r=i[a].type,e=i[a].handler,t===r&&(n===e||n===e.raw)){this._handler.off(r,e);break}return this},ED.addResizeListener=function(t){var n=this._resizeListeners;return n.indexOf(t)<0&&n.push(t),this},ED.removeResizeListener=function(t){var n=this._resizeListeners,e=n.indexOf(t);return e>=0&&n.splice(e,1),this},ED.addSignalListener=function(t,n){return FD(this,t,CD(this,t),n)},ED.removeSignalListener=function(t,n){return SD(this,CD(this,t),n)},ED.addDataListener=function(t,n){return FD(this,t,$M(this,t).values,n)},ED.removeDataListener=function(t,n){return SD(this,$M(this,t).values,n)},ED.preventDefault=function(t){return arguments.length?(this._preventDefault=t,this):this._preventDefault},ED.timer=function(t,n){this._timers.push(function(t,n,e){var r=new Vb,i=n;return null==n?(r.restart(t,n,e),r):(n=+n,e=null==e?Yb():+e,r.restart(function a(u){u+=i,r.restart(a,i+=n,e),t(u)},n,e),r)}(function(n){t({timestamp:Date.now(),elapsed:n})},n))},ED.events=function(t,n,e){var r,i=this,a=new It(e),u=function(e,r){i.runAsync(null,()=>{t===XM&&function(t,n){var e=t._eventConfig.defaults,r=e&&e.prevent,i=e&&e.allow;return!1!==r&&!0!==i&&(!0===r||!1===i||(r?r[n]:i?!i[n]:t.preventDefault()))}(i,n)&&e.preventDefault(),a.receive(VM(i,e,r))})};if(t===ZM)i.timer(u,n);else if(t===XM)i.addEventListener(n,u,QM);else if(t===JM?"undefined"!=typeof window&&(r=[window]):"undefined"!=typeof document&&(r=document.querySelectorAll(t)),r){for(var o=0,s=r.length;o<s;++o)r[o].addEventListener(n,u);i._eventListeners.push({type:n,sources:r,handler:u})}else i.warn("Can not resolve event source: "+t);return a},ED.finalize=function(){var t,n,e,r=this._tooltip,i=this._timers,a=this._eventListeners;for(t=i.length;--t>=0;)i[t].stop();for(t=a.length;--t>=0;)for(n=(e=a[t]).sources.length;--n>=0;)e.sources[n].removeEventListener(e.type,e.handler);return r&&r.call(this,this._handler,null,null,null),this},ED.hover=function(t,n){return n=[n||"update",(t=[t||"hover"])[0]],this.on(this.events("view","mouseover",KM),tk,nk(t)),this.on(this.events("view","mouseout",KM),tk,nk(n)),this},ED.data=function(t){return $M(this,t).values.value},ED.change=WM,ED.insert=function(t,n){return WM.call(this,t,Nt().insert(n))},ED.remove=function(t,n){return WM.call(this,t,Nt().remove(n))},ED.scale=function(t){var n=this._runtime.scales;return n.hasOwnProperty(t)||i("Unrecognized scale or projection: "+t),n[t].value},ED.initialize=function(t,n){var e,r,i=this,a=i._renderType,u=Gc(a);return t=i._el=t?vk(i,t):null,u||i.error("Unrecognized renderer type: "+a),e=u.handler||lc,r=t?u.renderer:u.headless,i._renderer=r?pk(i,i._renderer,t,r):null,i._handler=function(t,n,e,r){var i=new r(t.loader(),gk(t,t.tooltip())).scene(t.scenegraph().root).initialize(e,GM(t),t);return n&&n.handlers().forEach(function(t){i.on(t.type,t.handler)}),i}(i,i._handler,t,e),i._redraw=!0,t&&(n=n?i._elBind=vk(i,n):t.appendChild(ek("div",{class:"vega-bindings"})),i._bind.forEach(function(t){t.param.element&&(t.element=vk(i,t.param.element))}),i._bind.forEach(function(t){ok(i,t.element||n,t)})),i},ED.toImageURL=async function(t,n){t!==Hc.Canvas&&t!==Hc.SVG&&t!==Hc.PNG&&i("Unrecognized image type: "+t);const e=await mk(this,t,n);return t===Hc.SVG?(r=e.svg(),a=new Blob([r],{type:"image/svg+xml"}),window.URL.createObjectURL(a)):e.canvas().toDataURL("image/png");var r,a},ED.toCanvas=async function(t,n){return(await mk(this,Hc.Canvas,t,n)).canvas()},ED.toSVG=async function(t){return(await mk(this,Hc.SVG,t)).svg()},ED.getState=function(t){return this._runtime.getState(t||{data:xD,signals:bD,recurse:!0})},ED.setState=function(t){return this.runAsync(null,n=>{n._trigger=!1,n._runtime.setState(t)},t=>{t._trigger=!0}),this};var ND="outer",OD=["value","update","init","react","bind"];function zD(t,n){i(t+' for "outer" push: '+l(n))}function TD(t,n){var e=t.name;if(t.push===ND)n.signals[e]||zD("No prior signal definition",e),OD.forEach(function(n){void 0!==t[n]&&zD("Invalid property ",n)});else{var r=n.addSignal(e,t.value);!1===t.react&&(r.react=!1),t.bind&&n.addBinding(e,t.bind)}}function RD(t,n,e){var r,a,u={};try{r=function(t){xk=0,bk=(_k=t).length,wk=null,zE();var n=aC();if(wk.type!==Pk)throw new Error("Unexpect token after expression.");return n}(t=s(t)?t:l(t)+"")}catch(n){i("Expression parse error: "+t)}return r.visit(function(t){if(t.type===Fk){var e=t.callee.name,r=QC.visitors[e];r&&r(e,t.arguments,n,u)}}),(a=KC(r)).globals.forEach(function(t){var e=IC+t;!u.hasOwnProperty(e)&&n.getSignal(t)&&(u[e]=n.signalRef(t))}),{$expr:e?e+"return("+a.code+");":a.code,$fields:a.fields,$params:u}}function PD(t,n,e,r){this.id=-1,this.type=t,this.value=n,this.params=e,r&&(this.parent=r)}function LD(t,n,e,r){return new PD(t,n,e,r)}function qD(t,n){return LD("operator",t,n)}function UD(t){var n={$ref:t.id};return t.id<0&&(t.refs=t.refs||[]).push(n),n}var jD={$tupleid:1,toString:function(){return":_tupleid_:"}};function ID(t,n){return n?{$field:t,$name:n}:{$field:t}}var $D=ID("key");function WD(t,n){return{$compare:t,$order:n}}var HD="descending";function YD(t,n){return(t&&t.signal?"$"+t.signal:t||"")+(t&&n?"_":"")+(n&&n.signal?"$"+n.signal:n||"")}var GD="scope",VD="view";function XD(t){return t&&t.signal}function ZD(t){if(XD(t))return!0;if(o(t))for(var n in t)if(ZD(t[n]))return!0;return!1}function JD(t,n){return null!=t?t:n}function QD(t){return t&&t.signal||t}var KD="timer";function tF(t,n){return(t.merge?nF:t.stream?eF:t.type?rF:i("Invalid stream specification: "+l(t)))(t,n)}function nF(t,n){var e=iF({merge:t.merge.map(function(t){return tF(t,n)})},t,n);return n.addStream(e).id}function eF(t,n){var e=iF({stream:tF(t.stream,n)},t,n);return n.addStream(e).id}function rF(t,n){var e,r,i;return t.type===KD?(e=n.event(KD,t.throttle),t={between:t.between,filter:t.filter}):e=n.event((i=t.source)===GD?VD:i||VD,t.type),r=iF({stream:e},t,n),1===Object.keys(r).length?e:n.addStream(r).id}function iF(t,n,e){var r,a,u,o,s=n.between;return s&&(2!==s.length&&i('Stream "between" parameter must have 2 entries: '+l(n)),t.between=[tF(s[0],e),tF(s[1],e)]),s=n.filter?W(n.filter):[],(n.marktype||n.markname||n.markrole)&&s.push((r=n.marktype,a=n.markname,u=n.markrole,(o="event.item")+(r&&"*"!==r?"&&"+o+".mark.marktype==='"+r+"'":"")+(u?"&&"+o+".mark.role==='"+u+"'":"")+(a?"&&"+o+".mark.name==='"+a+"'":""))),n.source===GD&&s.push("inScope(event.item)"),s.length&&(t.filter=RD("("+s.join(")&&(")+")").$expr),null!=(s=n.throttle)&&(t.throttle=+s),null!=(s=n.debounce)&&(t.debounce=+s),n.consume&&(t.consume=!0),t}var aF,uF,oF="view",sF="[",lF="]",cF="{",fF="}",hF=":",dF=",",pF="@",gF=">",vF=/[[\]{}]/,mF={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};function yF(t,n,e,r,i){for(var a,u=0,o=t.length;n<o;++n){if(a=t[n],!u&&a===e)return n;i&&i.indexOf(a)>=0?--u:r&&r.indexOf(a)>=0&&++u}return n}function _F(t){for(var n=[],e=0,r=t.length,i=0;i<r;)i=yF(t,i,dF,sF+cF,lF+fF),n.push(t.substring(e,i).trim()),e=++i;if(0===n.length)throw"Empty event selector: "+t;return n}function xF(t){return"["===t[0]?function(t){var n,e,r=t.length,i=1;if((i=yF(t,i,lF,sF,lF))===r)throw"Empty between selector: "+t;if(2!==(n=_F(t.substring(1,i))).length)throw"Between selector must have two elements: "+t;if((t=t.slice(i+1).trim())[0]!==gF)throw"Expected '>' after between selector: "+t;if(n=n.map(xF),(e=xF(t.slice(1).trim())).between)return{between:n,stream:e};e.between=n;return e}(t):function(t){var n,e,r={source:aF},i=[],a=[0,0],u=0,o=0,s=t.length,l=0;if(t[s-1]===fF){if(!((l=t.lastIndexOf(cF))>=0))throw"Unmatched right brace: "+t;try{a=function(t){var n=t.split(dF);if(!t.length||n.length>2)throw t;return n.map(function(n){var e=+n;if(e!=e)throw t;return e})}(t.substring(l+1,s-1))}catch(n){throw"Invalid throttle specification: "+t}t=t.slice(0,l).trim(),s=t.length,l=0}if(!s)throw t;t[0]===pF&&(u=++l);(n=yF(t,l,hF))<s&&(i.push(t.substring(o,n).trim()),o=l=++n);if((l=yF(t,l,sF))===s)i.push(t.substring(o,s).trim());else if(i.push(t.substring(o,l).trim()),e=[],(o=++l)===s)throw"Unmatched left bracket: "+t;for(;l<s;){if((l=yF(t,l,lF))===s)throw"Unmatched left bracket: "+t;if(e.push(t.substring(o,l).trim()),l<s-1&&t[++l]!==sF)throw"Expected left bracket: "+t;o=++l}if(!(s=i.length)||vF.test(i[s-1]))throw"Invalid event selector: "+t;s>1?(r.type=i[1],u?r.markname=i[0].slice(1):(c=i[0],uF.hasOwnProperty(c)?r.marktype=i[0]:r.source=i[0])):r.type=i[0];var c;"!"===r.type.slice(-1)&&(r.consume=!0,r.type=r.type.slice(0,-1));null!=e&&(r.filter=e);a[0]&&(r.throttle=a[0]);a[1]&&(r.debounce=a[1]);return r}(t)}var bF="var datum=event.item&&event.item.datum;";function wF(t,n,e){var r,a,u=t.events,o=t.update,c=t.encode,f=[];u||i("Signal update missing events specification."),s(u)&&(u=function(t,n,e){return aF=n||oF,uF=e||mF,_F(t.trim()).map(xF)}(u,n.isSubscope()?GD:VD)),(u=W(u).filter(function(t){return t.signal||t.scale?(f.push(t),0):1})).length&&f.push(u.length>1?{merge:u}:u[0]),null!=c&&(o&&i("Signal encode and update are mutually exclusive."),o="encode(item(),"+l(c)+")"),r=s(o)?RD(o,n,bF):null!=o.expr?RD(o.expr,n,bF):null!=o.value?o.value:null!=o.signal?{$expr:"_.value",$params:{value:n.signalRef(o.signal)}}:i("Invalid signal update specification."),a={target:e,update:r},t.force&&(a.options={force:!0}),f.forEach(function(t){n.addUpdate(Z(function(t,n){return{source:t.signal?n.signalRef(t.signal):t.scale?n.scaleRef(t.scale):tF(t,n)}}(t,n),a))})}function AF(t){return function(n,e,r){return LD(t,e,n||void 0,r)}}var MF=AF("aggregate"),kF=AF("axisticks"),EF=AF("bound"),CF=AF("collect"),DF=AF("compare"),FF=AF("datajoin"),SF=AF("encode"),BF=AF("expression"),NF=AF("facet"),OF=AF("field"),zF=AF("key"),TF=AF("legendentries"),RF=AF("load"),PF=AF("mark"),LF=AF("multiextent"),qF=AF("multivalues"),UF=AF("overlap"),jF=AF("params"),IF=AF("prefacet"),$F=AF("projection"),WF=AF("proxy"),HF=AF("relay"),YF=AF("render"),GF=AF("scale"),VF=AF("sieve"),XF=AF("sortitems"),ZF=AF("viewlayout"),JF=AF("values"),QF=0;function KF(t,n){var e=t.type||"linear";(function(t){switch(t){case qf:case Uf:case jf:case If:case $f:case Wf:case Hf:case Yf:case Gf:case Xf:case Zf:case Jf:case Qf:case Kf:case th:case nh:return!0}return!1})(e)||i("Unrecognized scale type: "+l(e)),n.addScale(t.name,{type:e,domain:void 0})}function tS(t,n){var e,r,a=n.getScale(t.name).params;for(e in a.domain=iS(t.domain,t,n),null!=t.range&&(a.range=function t(n,e,r){var a=n.range,o=e.config.range;if(a.signal)return e.signalRef(a.signal);if(s(a)){if(o&&o.hasOwnProperty(a))return n=Z({},n,{range:o[a]}),t(n,e,r);"width"===a?a=[0,{signal:"width"}]:"height"===a?a=oh(n.type)?[0,{signal:"height"}]:[{signal:"height"},0]:i("Unrecognized scale range value: "+l(a))}else{if(a.scheme)return r.scheme=u(a.scheme)?eS(a.scheme,e):nS(a.scheme,e),a.extent&&(r.schemeExtent=eS(a.extent,e)),void(a.count&&(r.schemeCount=nS(a.count,e)));if(a.step)return void(r.rangeStep=nS(a.step,e));if(oh(n.type)&&!u(a))return iS(a,n,e);u(a)||i("Unsupported range type: "+l(a))}return a.map(function(t){return nS(t,e)})}(t,n,a)),null!=t.interpolate&&function(t,n){n.interpolate=nS(t.type||t),null!=t.gamma&&(n.interpolateGamma=nS(t.gamma))}(t.interpolate,a),null!=t.nice&&(a.nice=o(r=t.nice)?{interval:nS(r.interval),step:nS(r.step)}:nS(r)),null!=t.bins&&(a.bins=function(t,n){return t.signal||u(t)?eS(t,n):n.objectProperty(t)}(t.bins,n)),t)a.hasOwnProperty(e)||"name"===e||(a[e]=nS(t[e],n))}function nS(t,n){return o(t)?t.signal?n.signalRef(t.signal):i("Unsupported object: "+l(t)):t}function eS(t,n){return t.signal?n.signalRef(t.signal):t.map(function(t){return nS(t,n)})}function rS(t){i("Can not find data set: "+l(t))}function iS(t,n,e){if(t)return t.signal?e.signalRef(t.signal):(u(t)?function(t,n,e){return t.map(function(t){return nS(t,e)})}:t.fields?function(t,n,e){var r=t.data,i=t.fields.reduce(function(t,n){return n=s(n)?{data:r,field:n}:u(n)||n.signal?function(t,n){var e="_:vega:_"+QF++,r=CF({});if(u(t))r.value={$ingest:t};else if(t.signal){var i="setdata("+l(e)+","+t.signal+")";r.params.input=n.signalRef(i)}return n.addDataPipeline(e,[r,VF({})]),{data:e,field:"data"}}(n,e):n,t.push(n),t},[]);return(oh(n.type)?function(t,n,e){var r,i,a,u;return r=e.map(function(t){var e=n.getData(t.data);return e||rS(t.data),e.countsRef(n,t.field)}),i=n.add(MF({groupby:$D,ops:["sum"],fields:[n.fieldRef("count")],as:["count"],pulse:r})),a=n.add(CF({pulse:UD(i)})),u=n.add(JF({field:$D,sort:n.sortRef(aS(t.sort,!0)),pulse:UD(a)})),UD(u)}:rh(n.type)?function(t,n,e){var r=e.map(function(t){var e=n.getData(t.data);return e||rS(t.data),e.domainRef(n,t.field)});return UD(n.add(qF({values:r})))}:function(t,n,e){var r=e.map(function(t){var e=n.getData(t.data);return e||rS(t.data),e.extentRef(n,t.field)});return UD(n.add(LF({extents:r})))})(t,e,i)}:function(t,n,e){var r=e.getData(t.data);r||rS(t.data);return oh(n.type)?r.valuesRef(e,t.field,aS(t.sort,!1)):rh(n.type)?r.domainRef(e,t.field):r.extentRef(e,t.field)})(t,n,e);null==n.domainMin&&null==n.domainMax||i("No scale domain defined for domainMin/domainMax to override.")}function aS(t,n){return t&&(t.field||t.op?t.field||"count"===t.op?n&&t.field?i("Multiple domain scales can not sort by field."):n&&t.op&&"count"!==t.op&&i("Multiple domain scales support op count only."):i("No field provided for sort aggregate op: "+t.op):o(t)?t.field="key":t={field:"key"}),t}function uS(t,n,e){return u(t)?t.map(function(t){return uS(t,n,e)}):o(t)?t.signal?e.signalRef(t.signal):"fit"===n?t:i("Unsupported parameter object: "+l(t)):t}var oS="top",sS="left",lS="right",cS="bottom",fS="vertical",hS="start",dS="end",pS="index",gS="label",vS="offset",mS="perc",yS="perc2",_S="size",xS="value",bS="guide-label",wS="guide-title",AS="group-title",MS="symbol",kS="gradient",ES="discrete",CS=["size","shape","fill","stroke","strokeWidth","strokeDash","opacity"],DS={name:1,interactive:1},FS=mt(["rule"]),SS=mt(["group","image","rect"]);function BS(t,n,e,r){var i=RD(t,n);return i.$fields.forEach(function(t){r[t]=1}),Z(e,i.$params),i.$expr}function NS(t,n,e,r){return function t(n,e,r,u){var o,c,f;if(n.signal)o="datum",f=BS(n.signal,e,r,u);else if(n.group||n.parent){for(c=Math.max(1,n.level||1),o="item";c-- >0;)o+=".mark.group";n.parent?(f=n.parent,o+=".datum"):f=n.group}else n.datum?(o="datum",f=n.datum):i("Invalid field reference: "+l(n));n.signal||(s(f)?(u[f]=1,f=a(f).map(l).join("][")):f=t(f,e,r,u));return o+"["+f+"]"}(o(t)?t:{datum:t},n,e,r)}function OS(t,n,e,r,i){var a,u,o,l=zS(t.scale,e,r,i);return null!=t.range?(u=l+".range()",n=0===(a=+t.range)?u+"[0]":"($="+u+","+(1===a?"$[$.length-1]":"$[0]+"+a+"*($[$.length-1]-$[0])")+")"):(void 0!==n&&(n=l+"("+n+")"),t.band&&(o=function(t,n){if(!s(t))return-1;var e=n.scaleType(t);return"band"===e||"point"===e?1:0}(t.scale,e))&&(a=(u=l+".bandwidth")+"()"+(1===(a=+t.band)?"":"*"+a),o<0&&(a="("+u+"?"+a+":0)"),n=(n?n+"+":"")+a,t.extra&&(n="(datum.extra?"+l+"(datum.extra.value):"+n+")")),null==n&&(n="0")),n}function zS(t,n,e,r){var i;if(s(t))i=jC+t,e.hasOwnProperty(i)||(e[i]=n.scaleRef(t)),i=l(i);else{for(i in n.scales)e[jC+i]=n.scaleRef(i);i=l(jC)+"+"+(t.signal?"("+BS(t.signal,n,e,r)+")":NS(t,n,e,r))}return"_["+i+"]"}function TS(t,n,e,r){return o(t)?"("+RS(null,t,n,e,r)+")":t}function RS(t,n,e,r,i){if(null!=n.gradient)return function(t,n,e,r){return"this.gradient("+zS(t.gradient,n,e,r)+","+l(t.start)+","+l(t.stop)+","+l(t.count)+")"}(n,e,r,i);var a=n.signal?BS(n.signal,e,r,i):n.color?function(t,n,e,r){function i(t,i,a,u){return"this."+t+"("+[RS(null,i,n,e,r),RS(null,a,n,e,r),RS(null,u,n,e,r)].join(",")+").toString()"}return t.c?i("hcl",t.h,t.c,t.l):t.h||t.s?i("hsl",t.h,t.s,t.l):t.l||t.a?i("lab",t.l,t.a,t.b):t.r||t.g||t.b?i("rgb",t.r,t.g,t.b):null}(n.color,e,r,i):null!=n.field?NS(n.field,e,r,i):void 0!==n.value?l(n.value):void 0;return null!=n.scale&&(a=OS(n,a,e,r,i)),void 0===a&&(a=null),null!=n.exponent&&(a="Math.pow("+a+","+TS(n.exponent,e,r,i)+")"),null!=n.mult&&(a+="*"+TS(n.mult,e,r,i)),null!=n.offset&&(a+="+"+TS(n.offset,e,r,i)),n.round&&(a="Math.round("+a+")"),a}function PS(t,n,e){return t+"["+l(n)+"]="+e+";"}function LS(t,n,e,r,i){var a="";return n.forEach(function(t){var n=RS(0,t,e,r,i);a+=t.test?BS(t.test,e,r,i)+"?"+n+":":n}),":"===k(a)&&(a+="null"),PS("o",t,a)}function qS(t,n,e,r){var i,a,o={},s="var o=item,datum=o.datum,$;";for(i in t)a=t[i],u(a)?s+=LS(i,a,r,e,o):s+=PS("o",i,RS(0,a,r,e,o));return s+=function(t,n){var e="";return FS[n]?e:(t.x2&&(t.x?(SS[n]&&(e+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),e+="o.width=o.x2-o.x;"):e+="o.x=o.x2-(o.width||0);"),t.xc&&(e+="o.x=o.xc-(o.width||0)/2;"),t.y2&&(t.y?(SS[n]&&(e+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),e+="o.height=o.y2-o.y;"):e+="o.y=o.y2-(o.height||0);"),t.yc&&(e+="o.y=o.yc-(o.height||0)/2;"),e)}(t,n),{$expr:s+="return 1;",$fields:Object.keys(o),$output:Object.keys(t)}}var US="mark",jS="frame",IS="scope",$S="axis",WS="axis-domain",HS="axis-grid",YS="axis-label",GS="axis-tick",VS="axis-title",XS="legend",ZS="legend-band",JS="legend-entry",QS="legend-gradient",KS="legend-label",tB="legend-symbol",nB="legend-title",eB="title";function rB(t){return o(t)?Z({},t):{value:t}}function iB(t,n,e,r){return null!=e?(o(e)&&!u(e)?t.update[n]=e:t[r||"enter"][n]={value:e},1):0}function aB(t,n,e){for(var r in n)e&&e.hasOwnProperty(r)||(t[r]=Z(t[r]||{},n[r]));return t}function uB(t,n,e,r,i,a){var u,o;for(o in(a=a||{}).encoders={$encode:u={}},t=function(t,n,e,r,i){var a,u,o={};"legend"!=e&&0!==String(e).indexOf("axis")||(e=null);for(a in u=e===jS?i.group:e===US?Z({},i.mark,i[n]):null)sB(a,t)||("fill"===a||"stroke"===a)&&(sB("fill",t)||sB("stroke",t))||(o[a]=oB(u[a]));return W(r).forEach(function(n){var e=i.style&&i.style[n];for(var r in e)sB(r,t)||(o[r]=oB(e[r]))}),(t=Z({},t)).enter=Z(o,t.enter),t}(t,n,e,r,i.config))u[o]=qS(t[o],n,a,i);return a}function oB(t){return t&&t.signal?{signal:t.signal}:{value:t}}function sB(t,n){return n&&(n.enter&&n.enter[t]||n.update&&n.update[t])}function lB(t,n,e,r,i,a,u){return{type:t,name:u?u.name:void 0,role:n,style:u&&u.style||e,key:r,from:i,interactive:!(!u||!u.interactive),encode:aB(a,u,DS)}}function cB(t,n,e){return JD(n[t],e[t])}function fB(t,n){return JD(t.direction,n)===fS}function hB(t,n){return JD(t.gradientLength,n.gradientLength||n.gradientWidth)}function dB(t,n){return JD(t.gradientThickness,n.gradientThickness||n.gradientHeight)}function pB(t,n){return JD(t.columns,JD(n.columns,+fB(t,n.symbolDirection)))}function gB(t,n){var e=n&&(n.update&&n.update[t]||n.enter&&n.enter[t]);return e&&e.signal?e:e?e.value:null}var vB="group",mB="rect",yB="rule",_B="symbol",xB="text";function bB(t,n,e,r){var i,a,u,o,s,l,c={value:0},f=fB(t,e.gradientDirection),h=dB(t,e),d=hB(t,e);return f?(u=[0,1],o=[0,0],s=h,l=d):(u=[0,0],o=[1,0],s=d,l=h),iB(i={enter:a={opacity:c,x:c,y:c,width:rB(s),height:rB(l)},update:Z({},a,{opacity:{value:1},fill:{gradient:n,start:u,stop:o}}),exit:{opacity:c}},"stroke",cB("gradientStrokeColor",t,e)),iB(i,"strokeWidth",cB("gradientStrokeWidth",t,e)),iB(i,"opacity",cB("gradientOpacity",t,e),"update"),lB(mB,QS,null,void 0,void 0,i,r)}function wB(t,n,e,r,i){var a,u,o,s,l,c,f={value:0},h=fB(t,e.gradientDirection),d=dB(t,e),p=hB(t,e),g="";return h?(o="y",l="y2",s="x",c="width",g="1-"):(o="x",l="x2",s="y",c="height"),(u={opacity:f,fill:{scale:n,field:xS}})[o]={signal:g+"datum."+mS,mult:p},u[s]=f,u[l]={signal:g+"datum."+yS,mult:p},u[c]=rB(d),iB(a={enter:u,update:Z({},u,{opacity:{value:1}}),exit:{opacity:f}},"stroke",cB("gradientStrokeColor",t,e)),iB(a,"strokeWidth",cB("gradientStrokeWidth",t,e)),iB(a,"opacity",cB("gradientOpacity",t,e),"update"),lB(mB,ZS,null,xS,i,a,r)}var AB="datum."+mS+'<=0?"left":datum.'+mS+'>=1?"right":"center"',MB="datum."+mS+'<=0?"bottom":datum.'+mS+'>=1?"top":"middle"';function kB(t,n,e,r){var i,a,u,o,s,l={value:0},c=fB(t,n.gradientDirection),f=rB(dB(t,n)),h=hB(t,n),d=cB("labelOverlap",t,n),p=cB("labelSeparation",t,n),g="";return iB(i={enter:a={opacity:l},update:u={opacity:{value:1},text:{field:gS}},exit:{opacity:l}},"fill",cB("labelColor",t,n)),iB(i,"font",cB("labelFont",t,n)),iB(i,"fontSize",cB("labelFontSize",t,n)),iB(i,"fontStyle",cB("labelFontStyle",t,n)),iB(i,"fontWeight",cB("labelFontWeight",t,n)),iB(i,"fillOpacity",cB("labelOpacity",t,n)),iB(i,"limit",JD(t.labelLimit,n.gradientLabelLimit)),c?(a.align={value:"left"},a.baseline=u.baseline={signal:MB},o="y",s="x",g="1-"):(a.align=u.align={signal:AB},a.baseline={value:"top"},o="x",s="y"),a[o]=u[o]={signal:g+"datum."+mS,mult:h},a[s]=u[s]=f,f.offset=JD(t.labelOffset,n.gradientLabelOffset)||0,t=lB(xB,KS,bS,xS,r,i,e),d&&(t.overlap={separation:p,method:d,order:"datum."+pS}),t}function EB(t,n,e,r,i,a,u,o){return{type:vB,name:e,role:t,style:n,from:r,interactive:i||!1,encode:a,marks:u,layout:o}}var CB={value:0};function DB(t,n,e,r,i){var a,u,o,s,l,c,f,h=e.entries,d=!(!h||!h.interactive),p=h?h.name:void 0,g=cB("clipHeight",t,n),v=cB("symbolOffset",t,n),m={data:"value"},y={},_=i+"?datum."+vS+":datum."+_S,x=g?rB(g):{field:_S},b="datum."+pS,w="max(1,"+i+")";return x.mult=.5,y={enter:a={opacity:CB,x:{signal:_,mult:.5,offset:v},y:x},update:u={opacity:{value:1},x:a.x,y:a.y},exit:{opacity:CB}},t.fill||(iB(y,"fill",n.symbolBaseFillColor),iB(y,"stroke",n.symbolBaseStrokeColor)),iB(y,"shape",cB("symbolType",t,n)),iB(y,"size",cB("symbolSize",t,n)),iB(y,"strokeWidth",cB("symbolStrokeWidth",t,n)),iB(y,"fill",cB("symbolFillColor",t,n)),iB(y,"stroke",cB("symbolStrokeColor",t,n)),iB(y,"opacity",cB("symbolOpacity",t,n),"update"),CS.forEach(function(n){t[n]&&(u[n]=a[n]={scale:t[n],field:xS})}),s=lB(_B,tB,null,xS,m,y,e.symbols),g&&(s.clip=!0),(o=rB(v)).offset=cB("labelOffset",t,n),iB(y={enter:a={opacity:CB,x:{signal:_,offset:o},y:x},update:u={opacity:{value:1},text:{field:gS},x:a.x,y:a.y},exit:{opacity:CB}},"align",cB("labelAlign",t,n)),iB(y,"baseline",cB("labelBaseline",t,n)),iB(y,"fill",cB("labelColor",t,n)),iB(y,"font",cB("labelFont",t,n)),iB(y,"fontSize",cB("labelFontSize",t,n)),iB(y,"fontStyle",cB("labelFontStyle",t,n)),iB(y,"fontWeight",cB("labelFontWeight",t,n)),iB(y,"limit",cB("labelLimit",t,n)),iB(y,"fillOpacity",cB("labelOpacity",t,n)),l=lB(xB,KS,bS,xS,m,y,e.labels),y={enter:{noBound:{value:!0},width:CB,height:g?rB(g):CB,opacity:CB},exit:{opacity:CB},update:u={opacity:{value:1},row:{signal:null},column:{signal:null}}},fB(t,n.symbolDirection)?(c="ceil(item.mark.items.length/"+w+")",u.row.signal=b+"%"+c,u.column.signal="floor("+b+"/"+c+")",f={field:["row",b]}):(u.row.signal="floor("+b+"/"+w+")",u.column.signal=b+"%"+w,f={field:b}),u.column.signal=i+"?"+u.column.signal+":"+b,(t=EB(IS,null,p,r={facet:{data:r,name:"value",groupby:pS}},d,aB(y,h,DS),[s,l])).sort=f,t}function FB(t,n){var e;return o(t)&&(t.signal?e=t.signal:t.path?e="pathShape("+SB(t.path)+")":t.sphere&&(e="geoShape("+SB(t.sphere)+', {type: "Sphere"})')),e?n.signalRef(e):!!t}function SB(t){return o(t)&&t.signal?t.signal:l(t)}function BB(t){var n=t.role||"";return n.indexOf("axis")&&n.indexOf("legend")?t.type===vB?IS:n||US:n}function NB(t){return{marktype:t.type,name:t.name||void 0,role:t.role||BB(t),zindex:+t.zindex||void 0}}function OB(t,n){return t&&t.signal?n.signalRef(t.signal):!1!==t}function zB(t,n){var e=Hr(t.type);e||i("Unrecognized transform type: "+l(t.type));var r=LD(e.type.toLowerCase(),null,TB(e,t,n));return t.signal&&n.addSignal(t.signal,n.proxy(r)),r.metadata=e.metadata||{},r}function TB(t,n,e){var r,i,a,u={};for(i=0,a=t.params.length;i<a;++i)u[(r=t.params[i]).name]=RB(r,n,e);return u}function RB(t,n,e){var r=t.type,a=n[t.name];return"index"===r?function(t,n,e){s(n.from)||i('Lookup "from" parameter must be a string literal.');return e.getData(n.from).lookupRef(e,n.key)}(0,n,e):void 0!==a?"param"===r?function(t,n,e){var r=n[t.name];return t.array?(u(r)||i("Expected an array of sub-parameters. Instead: "+l(r)),r.map(function(n){return LB(t,n,e)})):LB(t,r,e)}(t,n,e):"projection"===r?e.projectionRef(n[t.name]):t.array&&!XD(a)?a.map(function(n){return PB(t,n,e)}):PB(t,a,e):void(t.required&&i("Missing required "+l(n.type)+" parameter: "+l(t.name)))}function PB(t,n,e){var r=t.type;if(XD(n))return qB(r)?i("Expression references can not be signals."):UB(r)?e.fieldRef(n):jB(r)?e.compareRef(n):e.signalRef(n.signal);var a,u=t.expr||UB(r);return u&&((a=n)&&a.expr)?e.exprRef(n.expr,n.as):u&&function(t){return t&&t.field}(n)?ID(n.field,n.as):qB(r)?RD(n,e):function(t){return"data"===t}(r)?UD(e.getData(n).values):UB(r)?ID(n):jB(r)?e.compareRef(n):n}function LB(t,n,e){var r,a,u,o,s;for(o=0,s=t.params.length;o<s;++o){for(u in(a=t.params[o]).key)if(a.key[u]!==n[u]){a=null;break}if(a)break}return a||i("Unsupported parameter: "+l(n)),r=Z(TB(a,n,e),a.key),UD(e.add(jF(r)))}function qB(t){return"expr"===t}function UB(t){return"field"===t}function jB(t){return"compare"===t}function IB(t,n){return t.$ref?t:t.data&&t.data.$ref?t.data:UD(n.getData(t.data).output)}function $B(t,n,e,r,i){this.scope=t,this.input=n,this.output=e,this.values=r,this.aggregate=i,this.index={}}$B.fromEntries=function(t,n){var e=n.length,r=1,i=n[0],a=n[e-1],u=n[e-2],o=null;for(i&&"load"===i.type&&(i=n[1]),t.add(n[0]);r<e;++r)n[r].params.pulse=UD(n[r-1]),t.add(n[r]),"aggregate"===n[r].type&&(o=n[r]);return new $B(t,i,u,a,o)};var WB=$B.prototype;function HB(t){return s(t)?t:null}function YB(t,n,e){var r,i=YD(e.op,e.field);if(n.ops){for(var a=0,u=n.as.length;a<u;++a)if(n.as[a]===i)return}else n.ops=["count"],n.fields=[null],n.as=["count"];e.op&&(n.ops.push((r=e.op.signal)?t.signalRef(r):e.op),n.fields.push(t.fieldRef(e.field)),n.as.push(i))}function GB(t,n,e,r,i,a,u){var s,l,c=n[e]||(n[e]={}),f=function(t){return o(t)?(t.order===HD?"-":"+")+YD(t.op,t.field):""}(a),h=HB(i);if(null!=h&&(t=n.scope,s=c[h+=f?"|"+f:""]),!s){var d=a?{field:$D,pulse:n.countsRef(t,i,a)}:{field:t.fieldRef(i),pulse:UD(n.output)};f&&(d.sort=t.sortRef(a)),l=t.add(LD(r,void 0,d)),u&&(n.index[i]=l),s=UD(l),null!=h&&(c[h]=s)}return s}function VB(t,n,e){var r,i=t.remove,a=t.insert,u=t.toggle,o=t.modify,s=t.values,l=n.add(qD());r=RD("if("+t.trigger+',modify("'+e+'",'+[a,i,u,o,s].map(function(t){return null==t?"null":t}).join(",")+"),0)",n),l.update=r.$expr,l.params=r.$params}function XB(t,n){var e,r,a,u,o,s,c,f,h,d,p,g,v,m=BB(t),y=t.type===vB,_=t.from&&t.from.facet,x=t.layout||m===IS||m===jS,b=m===US||x||_,w=t.overlap;a=function(t,n,e){var r,a,u,o,s;return t?(r=t.facet)&&(n||i("Only group marks can be faceted."),null!=r.field?o=s=IB(r,e):(t.data?s=UD(e.getData(t.data).aggregate):((u=zB(Z({type:"aggregate",groupby:W(r.groupby)},r.aggregate),e)).params.key=e.keyRef(r.groupby),u.params.pulse=IB(r,e),o=s=UD(e.add(u))),a=e.keyRef(r.groupby,!0))):o=UD(e.add(CF(null,[{}]))),o||(o=IB(t,e)),{key:a,pulse:o,parent:s}}(t.from,y,n),h=UD(r=n.add(FF({key:a.key||(t.key?ID(t.key):void 0),pulse:a.pulse,clean:!y}))),r=u=n.add(CF({pulse:h})),r=n.add(PF({markdef:NB(t),interactive:OB(t.interactive,n),clip:FB(t.clip,n),context:{$context:!0},groups:n.lookup(),parent:n.signals.parent?n.signalRef("parent"):null,index:n.markpath(),pulse:UD(r)})),d=UD(r),(r=n.add(SF(uB(t.encode,t.type,m,t.style,n,{pulse:d})))).params.parent=n.encode(),t.transform&&t.transform.forEach(function(t){var e=zB(t,n);(e.metadata.generates||e.metadata.changes)&&i("Mark transforms should not generate new data."),e.params.pulse=UD(r),n.add(r=e)}),t.sort&&(r=n.add(XF({sort:n.compareRef(t.sort,!0),pulse:UD(r)}))),p=UD(r),(_||x)&&(g=UD(x=n.add(ZF({layout:n.objectProperty(t.layout),legendMargin:n.config.legendMargin,mark:d,pulse:p})))),v=UD(o=n.add(EF({mark:d,pulse:g||p}))),y&&(b&&((e=n.operators).pop(),x&&e.pop()),n.pushState(p,g||v,h),_?function(t,n,e){var r,a,u,o,s=t.from.facet,c=s.name,f=IB(s,n);s.name||i("Facet must have a name: "+l(s)),s.data||i("Facet must reference a data set: "+l(s)),s.field?o=n.add(IF({field:n.fieldRef(s.field),pulse:f})):s.groupby?o=n.add(NF({key:n.keyRef(s.groupby),group:UD(n.proxy(e.parent)),pulse:f})):i("Facet must specify groupby or field: "+l(s)),a=(r=n.fork()).add(CF()),u=r.add(VF({pulse:UD(a)})),r.addData(c,new $B(r,a,a,u)),r.addSignal("parent",null),o.params.subflow={$subflow:lN(t,r).toRuntime()}}(t,n,a):b?function(t,n,e){var r=n.add(IF({pulse:e.pulse})),i=n.fork();i.add(VF()),i.addSignal("parent",null),r.params.subflow={$subflow:lN(t,i).toRuntime()}}(t,n,a):lN(t,n),n.popState(),b&&(x&&e.push(x),e.push(o))),w&&(v=function(t,n,e){var r,i=t.method,a=t.bound,u=t.separation,o={separation:XD(u)?e.signalRef(u.signal):u,method:XD(i)?e.signalRef(i.signal):i,pulse:n};t.order&&(o.sort=e.compareRef({field:t.order}));a&&(r=a.tolerance,o.boundTolerance=XD(r)?e.signalRef(r.signal):+r,o.boundScale=e.scaleRef(a.scale),o.boundOrient=a.orient);return UD(e.add(UF(o)))}(w,v,n)),s=n.add(YF({pulse:v})),c=n.add(VF({pulse:UD(s)},void 0,n.parent())),null!=t.name&&(f=t.name,n.addData(f,new $B(n,u,s,c)),t.on&&t.on.forEach(function(t){(t.insert||t.remove||t.toggle)&&i("Marks only support modify triggers."),VB(t,n,f)}))}function ZB(t,n){var e,r,a,u,o,s,l,c,f,h=n.config.legend,d=t.encode||{},p=d.legend||{},g=p.name||void 0,v=p.interactive,m=p.style,y=CS.reduce(function(n,e){return n||t[e]},0);return y||i("Missing valid scale for legend."),o=function(t,n){var e=t.type||MS;t.type||1!==function(t){return CS.reduce(function(n,e){return n+(t[e]?1:0)},0)}(t)||!t.fill&&!t.stroke||(e=uh(n)?kS:sh(n)?ES:MS);return e!==kS?e:sh(n)?ES:kS}(t,n.scaleType(y)),s={orient:cB("orient",t,h),title:null!=t.title,type:o},l=UD(n.add(CF(null,[s]))),p=aB(function(t,n){var e={enter:{},update:{}};return iB(e,"offset",cB("offset",t,n)),iB(e,"padding",cB("padding",t,n)),iB(e,"titlePadding",cB("titlePadding",t,n)),iB(e,"fill",cB("fillColor",t,n)),iB(e,"stroke",cB("strokeColor",t,n)),iB(e,"cornerRadius",cB("cornerRadius",t,n)),iB(e,"strokeWidth",n.strokeWidth),iB(e,"strokeDash",n.strokeDash),e}(t,h),p,DS),e={enter:{x:{value:0},y:{value:0}}},c=UD(n.add(TF(a={type:o,scale:n.scaleRef(y),count:n.objectProperty(t.tickCount),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatSpecifier:n.property(t.format)}))),o===kS?(u=[bB(t,y,h,d.gradient),kB(t,h,d.labels,c)],a.count=a.count||n.signalRef("max(2,2*floor(("+QD(hB(t,h))+")/100))")):o===ES?u=[wB(t,y,h,d.gradient,c),kB(t,h,d.labels,c)]:(r=function(t,n){return{align:cB("gridAlign",t,n),center:{row:!0,column:!1},columns:pB(t,n),padding:{row:cB("rowPadding",t,n),column:cB("columnPadding",t,n)}}}(t,h),u=[DB(t,h,d,c,QD(r.columns))],a.size=function(t,n,e){var r=QD(JB("size",t,e)),i=QD(JB("strokeWidth",t,e)),a=QD(function(t,n,e){return gB("fontSize",t)||function(t,n,e){var r=n.config.style[e];return r&&r[t]}("fontSize",n,e)}(e[1].encode,n,bS));return RD(`max(ceil(sqrt(${r}) + ${i}), ${a})`,n)}(t,n,u[0].marks)),u=[EB(JS,null,null,l,v,e,u,r)],s.title&&u.push(function(t,n,e,r){var i,a,u={value:0};return iB(i={enter:a={opacity:u,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},update:{opacity:{value:1},text:rB(t.title),x:a.x,y:a.y},exit:{opacity:u}},"align",cB("titleAlign",t,n)),iB(i,"baseline",cB("titleBaseline",t,n)),iB(i,"fill",cB("titleColor",t,n)),iB(i,"font",cB("titleFont",t,n)),iB(i,"fontSize",cB("titleFontSize",t,n)),iB(i,"fontStyle",cB("titleFontStyle",t,n)),iB(i,"fontWeight",cB("titleFontWeight",t,n)),iB(i,"limit",cB("titleLimit",t,n)),iB(i,"fillOpacity",cB("titleOpacity",t,n)),lB(xB,nB,wS,null,r,i,e)}(t,h,d.title,l)),f=EB(XS,m,g,l,v,p,u),t.zindex&&(f.zindex=t.zindex),XB(f,n)}function JB(t,n,e){return n[t]?'scale("'+n[t]+'",datum)':gB(t,e[0].encode)}function QB(t,n,e){return'item.anchor==="'+hS+'"?'+t+':item.anchor==="'+dS+'"?'+n+":"+e}WB.countsRef=function(t,n,e){var r,i,a,u=this.counts||(this.counts={}),o=HB(n);return null!=o&&(t=this.scope,r=u[o]),r?e&&e.field&&YB(t,r.agg.params,e):(a={groupby:t.fieldRef(n,"key"),pulse:UD(this.output)},e&&e.field&&YB(t,a,e),i=t.add(MF(a)),r=t.add(CF({pulse:UD(i)})),r={agg:i,ref:UD(r)},null!=o&&(u[o]=r)),r.ref},WB.tuplesRef=function(){return UD(this.values)},WB.extentRef=function(t,n){return GB(t,this,"extent","extent",n,!1)},WB.domainRef=function(t,n){return GB(t,this,"domain","values",n,!1)},WB.valuesRef=function(t,n,e){return GB(t,this,"vals","values",n,e||!0)},WB.lookupRef=function(t,n){return GB(t,this,"lookup","tupleindex",n,!1)},WB.indataRef=function(t,n){return GB(t,this,"indata","tupleindex",n,!0,!0)};var KB=QB(l(sS),l(lS),l("center")),tN=QB('+(item.orient==="'+lS+'")','+(item.orient!=="'+sS+'")',"0.5");function nN(t,n){t=s(t)?{text:t}:t;var e,r,i,a=n.config.title,u=Z({},t.encode);return e={orient:cB("orient",t,a)},r=UD(n.add(CF(null,[e]))),u.name=t.name,u.interactive=t.interactive,i=function(t,n,e,r){var i,a,u,o,s,l={value:0},c=t.text,f=cB("orient",t,n),h=cB("anchor",t,n),d=f===sS||f===oS?-1:1,p=f===oS||f===cS,g={group:p?"width":"height"};o={field:g,mult:{signal:tN}},s=d<0?l:p?{field:{group:"height"}}:{field:{group:"width"}},i={enter:a={opacity:l},update:u={opacity:{value:1},text:rB(c),anchor:rB(h),orient:rB(f),extent:{field:g},align:{signal:KB}},exit:{opacity:l}},p?(u.x=o,u.y=s,a.angle=l,a.baseline={value:f===oS?cS:oS}):(u.x=s,u.y=o,a.angle={value:90*d},a.baseline={value:cS});return iB(i,"align",cB("align",t,n),"update"),iB(i,"angle",cB("angle",t,n)),iB(i,"baseline",cB("baseline",t,n)),iB(i,"fill",cB("color",t,n)),iB(i,"font",cB("font",t,n)),iB(i,"fontSize",cB("fontSize",t,n)),iB(i,"fontStyle",cB("fontStyle",t,n)),iB(i,"fontWeight",cB("fontWeight",t,n)),iB(i,"frame",cB("frame",t,n)),iB(i,"limit",cB("limit",t,n)),iB(i,"offset",cB("offset",t,n)||0),lB(xB,eB,t.style||AS,null,r,i,e)}(t,a,u,r),t.zindex&&(i.zindex=t.zindex),XB(i,n)}function eN(t,n){var e=[];t.transform&&t.transform.forEach(function(t){e.push(zB(t,n))}),t.on&&t.on.forEach(function(e){VB(e,n,t.name)}),n.addDataPipeline(t.name,function(t,n,e){var r,i,a,u,o,s=[],l=null,c=!1,f=!1;t.values?ZD(t.values)||ZD(t.format)?(s.push(iN(n,t)),s.push(l=rN())):s.push(l=rN({$ingest:t.values,$format:t.format})):t.url?ZD(t.url)||ZD(t.format)?(s.push(iN(n,t)),s.push(l=rN())):s.push(l=rN({$request:t.url,$format:t.format})):t.source&&(l=r=W(t.source).map(function(t){return UD(n.getData(t).output)}),s.push(null));for(i=0,a=e.length;i<a;++i)u=e[i],o=u.metadata,l||o.source||s.push(l=rN()),s.push(u),o.generates&&(f=!0),o.modifies&&!f&&(c=!0),o.source?l=u:o.changes&&(l=null);r&&(a=r.length-1,s[0]=HF({derive:c,pulse:a?r:r[0]}),(c||a)&&s.splice(1,0,rN()));l||s.push(rN());return s.push(VF({})),s}(t,n,e))}function rN(t){var n=CF({},t);return n.metadata={source:!0},n}function iN(t,n){return RF({url:n.url?t.property(n.url):void 0,values:n.values?t.property(n.values):void 0,format:t.objectProperty(n.format)})}function aN(t,n){return{scale:t.scale,range:n}}function uN(t,n,e,r){var i,a,u,s,l,c,f,h,d,p=t.orient,g=t.gridScale,v=p===sS||p===oS?1:-1,m=function(t,n){if(1===n);else if(o(t)){for(var e=t=Z({},t);null!=e.mult;){if(!o(e.mult))return e.mult*=n,t;e=e.mult=Z({},e.mult)}e.mult=n}else t=n*(t||0);return t}(t.offset,v),y={value:0};return iB(i={enter:a={opacity:y},update:s={opacity:{value:1}},exit:u={opacity:y}},"stroke",cB("gridColor",t,n)),iB(i,"strokeDash",cB("gridDash",t,n)),iB(i,"strokeOpacity",cB("gridOpacity",t,n)),iB(i,"strokeWidth",cB("gridWidth",t,n)),l={scale:t.scale,field:xS,band:cB("bandPosition",t,n),round:cB("tickRound",t,n),extra:cB("tickExtra",t,n),offset:cB("tickOffset",t,n)},p===oS||p===cS?(c="x",f="y",d="height"):(c="y",f="x",d="width"),h=f+"2",s[c]=a[c]=u[c]=l,g?(s[f]=a[f]={scale:g,range:0,mult:v,offset:m},s[h]=a[h]={scale:g,range:1,mult:v,offset:m}):(s[f]=a[f]={value:0,offset:m},s[h]=a[h]={signal:d,mult:v,offset:m}),lB(yB,HS,null,xS,r,i,e)}function oN(t,n,e,r,i){return{signal:'flush(range("'+t+'"), scale("'+t+'", datum.value), '+n+","+e+","+r+","+i+")"}}function sN(t,n){var e,r,i,a,u,o,s=function(t,n){var e=n.config,r=t.orient,i=r===oS||r===cS?e.axisX:e.axisY,a=e["axis"+r[0].toUpperCase()+r.slice(1)],u="band"===n.scaleType(t.scale)&&e.axisBand;return i||a||u?Z({},e.axis,i,a,u):e.axis}(t,n),l=t.encode||{},c=l.axis||{},f=c.name||void 0,h=c.interactive,d=c.style;return e={orient:t.orient,ticks:!!cB("ticks",t,s),labels:!!cB("labels",t,s),grid:!!cB("grid",t,s),domain:!!cB("domain",t,s),title:!!JD(t.title,!1)},r=UD(n.add(CF({},[e]))),c=aB({update:{range:{signal:'abs(span(range("'+t.scale+'")))'},offset:rB(JD(t.offset,0)),position:rB(JD(t.position,0)),titlePadding:rB(cB("titlePadding",t,s)),minExtent:rB(cB("minExtent",t,s)),maxExtent:rB(cB("maxExtent",t,s))}},l.axis,DS),i=UD(n.add(kF({scale:n.scaleRef(t.scale),extra:n.property(cB("tickExtra",t,s)),count:n.objectProperty(t.tickCount),values:n.objectProperty(t.values),minstep:n.property(t.tickMinStep),formatSpecifier:n.property(t.format)}))),o=[],e.grid&&o.push(uN(t,s,l.grid,i)),e.ticks&&(a=cB("tickSize",t,s),o.push(function(t,n,e,r,i){var a,u,o,s,l,c,f=t.orient,h=f===sS||f===oS?-1:1,d={value:0};return iB(a={enter:u={opacity:d},update:s={opacity:{value:1}},exit:o={opacity:d}},"stroke",cB("tickColor",t,n)),iB(a,"strokeOpacity",cB("tickOpacity",t,n)),iB(a,"strokeWidth",cB("tickWidth",t,n)),(l=rB(i)).mult=h,c={scale:t.scale,field:xS,band:cB("bandPosition",t,n),round:cB("tickRound",t,n),extra:cB("tickExtra",t,n),offset:cB("tickOffset",t,n)},f===oS||f===cS?(s.y=u.y=d,s.y2=u.y2=l,s.x=u.x=o.x=c):(s.x=u.x=d,s.x2=u.x2=l,s.y=u.y=o.y=c),lB(yB,GS,null,xS,r,a,e)}(t,s,l.ticks,i,a))),e.labels&&(a=e.ticks?a:0,o.push(function(t,n,e,r,i){var a,u,o,s,l,c,f,h,d,p,g=t.orient,v=g===sS||g===oS?-1:1,m=g===oS||g===cS,y=t.scale,_=QD(cB("labelFlush",t,n)),x=QD(cB("labelFlushOffset",t,n)),b=0===_||!!_,w=cB("labelAlign",t,n),A=cB("labelBaseline",t,n),M={value:0};return(o=rB(i)).mult=v,o.offset=rB(cB("labelPadding",t,n)||0),o.offset.mult=v,s={scale:y,field:xS,band:.5,offset:cB("tickOffset",t,n)},m?(l=w||(b?oN(y,_,'"left"','"right"','"center"'):"center"),c=A||(g===oS?"bottom":"top"),f=!w):(l=w||(g===lS?"left":"right"),c=A||(b?oN(y,_,'"top"','"bottom"','"middle"'):"middle"),f=!A),f=f&&b&&x?oN(y,_,"-"+x,x,0):null,iB(a={enter:u={opacity:M,x:m?s:o,y:m?o:s},update:{opacity:{value:1},text:{field:gS},x:u.x,y:u.y},exit:{opacity:M,x:u.x,y:u.y}},m?"dx":"dy",f),iB(a,"align",l),iB(a,"baseline",c),iB(a,"angle",cB("labelAngle",t,n)),iB(a,"fill",cB("labelColor",t,n)),iB(a,"font",cB("labelFont",t,n)),iB(a,"fontSize",cB("labelFontSize",t,n)),iB(a,"fontWeight",cB("labelFontWeight",t,n)),iB(a,"fontStyle",cB("labelFontStyle",t,n)),iB(a,"limit",cB("labelLimit",t,n)),iB(a,"fillOpacity",cB("labelOpacity",t,n)),h=cB("labelBound",t,n),d=cB("labelOverlap",t,n),p=cB("labelSeparation",t,n),t=lB(xB,YS,bS,xS,r,a,e),(d||h)&&(t.overlap={separation:p,method:d,order:"datum.index",bound:h?{scale:y,orient:g,tolerance:h}:null}),t}(t,s,l.labels,i,a))),e.domain&&o.push(function(t,n,e,r){var i,a,u,o,s,l,c=t.orient,f={value:0};return iB(i={enter:a={opacity:f},update:u={opacity:{value:1}},exit:{opacity:f}},"stroke",cB("domainColor",t,n)),iB(i,"strokeWidth",cB("domainWidth",t,n)),iB(i,"strokeOpacity",cB("domainOpacity",t,n)),c===oS||c===cS?(o="x",l="y"):(o="y",l="x"),s=o+"2",a[l]=f,u[o]=a[o]=aN(t,0),u[s]=a[s]=aN(t,1),lB(yB,WS,null,null,r,i,e)}(t,s,l.domain,r)),e.title&&o.push(function(t,n,e,r){var i,a,u,o,s=t.orient,l=s===sS||s===oS?-1:1,c=s===oS||s===cS,f={value:0};return i={enter:a={opacity:f},update:u={opacity:{value:1},text:rB(t.title)},exit:{opacity:f}},o={scale:t.scale,range:.5},c?(u.x=o,a.angle={value:0},a.baseline={value:s===oS?"bottom":"top"}):(u.y=o,a.angle={value:90*l},a.baseline={value:"bottom"}),iB(i,"align",cB("titleAlign",t,n)),iB(i,"angle",cB("titleAngle",t,n)),iB(i,"baseline",cB("titleBaseline",t,n)),iB(i,"fill",cB("titleColor",t,n)),iB(i,"font",cB("titleFont",t,n)),iB(i,"fontSize",cB("titleFontSize",t,n)),iB(i,"fontStyle",cB("titleFontStyle",t,n)),iB(i,"fontWeight",cB("titleFontWeight",t,n)),iB(i,"limit",cB("titleLimit",t,n)),iB(i,"fillOpacity",cB("titleOpacity",t,n)),!iB(i,"x",cB("titleX",t,n),"update")&&c&&!sB("x",e)&&(i.enter.auto={value:!0}),!iB(i,"y",cB("titleY",t,n),"update")&&!c&&!sB("y",e)&&(i.enter.auto={value:!0}),lB(xB,VS,wS,null,r,i,e)}(t,s,l.title,r)),u=EB($S,d,f,r,h,c,o),t.zindex&&(u.zindex=t.zindex),XB(u,n)}function lN(t,n,e){var r=W(t.signals),a=W(t.scales);return e||r.forEach(function(t){TD(t,n)}),W(t.projections).forEach(function(t){!function(t,n){var e={};for(var r in t)"name"!==r&&(e[r]=uS(t[r],r,n));n.addProjection(t.name,e)}(t,n)}),a.forEach(function(t){KF(t,n)}),W(t.data).forEach(function(t){eN(t,n)}),a.forEach(function(t){tS(t,n)}),r.forEach(function(t){!function(t,n){var e=n.getSignal(t.name),r=t.update;t.init&&(r?i("Signals can not include both init and update expressions."):(r=t.init,e.initonly=!0)),r&&(r=RD(r,n),e.update=r.$expr,e.params=r.$params),t.on&&t.on.forEach(function(t){wF(t,n,e.id)})}(t,n)}),W(t.axes).forEach(function(t){sN(t,n)}),W(t.marks).forEach(function(t){XB(t,n)}),W(t.legends).forEach(function(t){ZB(t,n)}),t.title&&nN(t.title,n),n.parseLambdas(),n}var cN=mt(["width","height","padding","autosize"]);function fN(t,n){var e,r,i,a,u,s=n.config;return n.background=t.background||s.background,n.eventConfig=s.events,u=UD(n.root=n.add(qD())),n.addSignal("width",t.width||0),n.addSignal("height",t.height||0),n.addSignal("padding",function(t,n){return o(t=t||n.padding)?{top:BD(t.top),bottom:BD(t.bottom),left:BD(t.left),right:BD(t.right)}:{top:e=BD(t),bottom:e,left:e,right:e};var e}(t.padding,s)),n.addSignal("autosize",function(t,n){return o(t=t||n.autosize)?t:{type:t=t||"pad"}}(t.autosize,s)),W(t.signals).forEach(function(t){cN[t.name]||TD(t,n)}),r=n.add(CF()),i=aB({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},t.encode),i=n.add(SF(uB(i,vB,jS,t.style,n,{pulse:UD(r)}))),a=n.add(ZF({layout:n.objectProperty(t.layout),legendMargin:s.legendMargin,autosize:n.signalRef("autosize"),mark:u,pulse:UD(i)})),n.operators.pop(),n.pushState(UD(i),UD(a),null),lN(t,n,!0),n.operators.push(a),e=n.add(EF({mark:u,pulse:UD(a)})),e=n.add(YF({pulse:UD(e)})),e=n.add(VF({pulse:UD(e)})),n.addData("root",new $B(n,r,r,e)),n}function hN(t){this.config=t,this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.background=null,this.eventConfig=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function dN(t){this.config=t.config,this.field=Object.create(t.field),this.signals=Object.create(t.signals),this.lambdas=Object.create(t.lambdas),this.scales=Object.create(t.scales),this.events=Object.create(t.events),this.data=Object.create(t.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++t._nextsub[0],this._nextsub=t._nextsub,this._parent=t._parent.slice(),this._encode=t._encode.slice(),this._lookup=t._lookup.slice(),this._markpath=t._markpath}var pN=hN.prototype=dN.prototype;function gN(t){return(u(t)?function(t){for(var n,e="[",r=0,i=t.length;r<i;++r)n=t[r],e+=(r>0?",":"")+(o(n)?n.signal||gN(n):l(n));return e+"]"}:function(t){var n,e,r="{",i=0;for(n in t)e=t[n],r+=(++i>1?",":"")+l(n)+":"+(o(e)?e.signal||gN(e):l(e));return r+"}"})(t)}function vN(t){var n={padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:xN},area:{fill:xN},image:null,line:{stroke:xN,strokeWidth:_N},path:{stroke:xN},rect:{fill:xN},rule:{stroke:bN},shape:{stroke:xN},symbol:{fill:xN,size:64},text:{fill:bN,font:mN,fontSize:11},style:{"guide-label":{fill:bN,font:mN,fontSize:10},"guide-title":{fill:bN,font:mN,fontSize:11,fontWeight:"bold"},"group-title":{fill:bN,font:mN,fontSize:13,fontWeight:"bold"},point:{size:yN,strokeWidth:_N,shape:"circle"},circle:{size:yN,strokeWidth:_N},square:{size:yN,strokeWidth:_N,shape:"square"},cell:{fill:"transparent",stroke:AN}},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:wN,grid:!1,gridWidth:1,gridColor:AN,labels:!0,labelAngle:0,labelLimit:180,labelPadding:2,ticks:!0,tickColor:wN,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titleAlign:"center",titlePadding:4},axisBand:{tickOffset:-1},legend:{orient:"right",offset:18,padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:AN,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:wN,titleAlign:"left",titleBaseline:"top",titleLimit:180,titlePadding:5},title:{orient:"top",anchor:"middle",offset:4},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}};return(t||[]).forEach(function(t){var e,r,i;if(t)for(e in t)if("style"===e)for(e in i=n.style||(n.style={}),t.style)i[e]=Z(i[e]||{},t.style[e]);else r=t[e],n[e]=o(r)&&!u(r)?Z(o(n[e])?n[e]:{},r):r}),n}pN.fork=function(){return new dN(this)},pN.isSubscope=function(){return this._subid>0},pN.toRuntime=function(){return this.finish(),{background:this.background,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig}},pN.id=function(){return(this._subid?this._subid+":":0)+this._id++},pN.add=function(t){return this.operators.push(t),t.id=this.id(),t.refs&&(t.refs.forEach(function(n){n.$ref=t.id}),t.refs=null),t},pN.proxy=function(t){var n=t instanceof PD?UD(t):t;return this.add(WF({value:n}))},pN.addStream=function(t){return this.streams.push(t),t.id=this.id(),t},pN.addUpdate=function(t){return this.updates.push(t),t},pN.finish=function(){var t,n;for(t in this.root&&(this.root.root=!0),this.signals)this.signals[t].signal=t;for(t in this.scales)this.scales[t].scale=t;function e(t,n,e){var r;t&&((r=t.data||(t.data={}))[n]||(r[n]=[])).push(e)}for(t in this.data)for(var r in e((n=this.data[t]).input,t,"input"),e(n.output,t,"output"),e(n.values,t,"values"),n.index)e(n.index[r],t,"index:"+r);return this},pN.pushState=function(t,n,e){this._encode.push(UD(this.add(VF({pulse:t})))),this._parent.push(n),this._lookup.push(e?UD(this.proxy(e)):null),this._markpath.push(-1)},pN.popState=function(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},pN.parent=function(){return k(this._parent)},pN.encode=function(){return k(this._encode)},pN.lookup=function(){return k(this._lookup)},pN.markpath=function(){var t=this._markpath;return++t[t.length-1]},pN.fieldRef=function(t,n){if(s(t))return ID(t,n);t.signal||i("Unsupported field reference: "+l(t));var e,r=t.signal,a=this.field[r];return a||(e={name:this.signalRef(r)},n&&(e.as=n),this.field[r]=a=UD(this.add(OF(e)))),a},pN.compareRef=function(t,n){function e(t){return XD(t)?(i=!0,r.signalRef(t.signal)):t}var r=this,i=!1,a=W(t.field).map(e),u=W(t.order).map(e);return n&&a.push(jD),i?UD(this.add(DF({fields:a,orders:u}))):WD(a,u)},pN.keyRef=function(t,n){var e=this.signals,r=!1;return t=W(t).map(function(t){return XD(t)?(r=!0,UD(e[t.signal])):t}),r?UD(this.add(zF({fields:t,flat:n}))):function(t,n){var e={$key:t};return n&&(e.$flat=!0),e}(t,n)},pN.sortRef=function(t){if(!t)return t;var n=[YD(t.op,t.field),jD],e=t.order||"ascending";return e.signal?UD(this.add(DF({fields:n,orders:[e=this.signalRef(e.signal),e]}))):WD(n,[e,e])},pN.event=function(t,n){var e=t+":"+n;if(!this.events[e]){var r=this.id();this.streams.push({id:r,source:t,type:n}),this.events[e]=r}return this.events[e]},pN.addSignal=function(t,n){this.signals.hasOwnProperty(t)&&i("Duplicate signal name: "+l(t));var e=n instanceof PD?n:this.add(qD(n));return this.signals[t]=e},pN.getSignal=function(t){return this.signals[t]||i("Unrecognized signal name: "+l(t)),this.signals[t]},pN.signalRef=function(t){return this.signals[t]?UD(this.signals[t]):(this.lambdas.hasOwnProperty(t)||(this.lambdas[t]=this.add(qD(null))),UD(this.lambdas[t]))},pN.parseLambdas=function(){for(var t=Object.keys(this.lambdas),n=0,e=t.length;n<e;++n){var r=t[n],i=RD(r,this),a=this.lambdas[r];a.params=i.$params,a.update=i.$expr}},pN.property=function(t){return t&&t.signal?this.signalRef(t.signal):t},pN.objectProperty=function(t){return t&&o(t)?this.signalRef(t.signal||gN(t)):t},pN.exprRef=function(t,n){var e={expr:RD(t,this)};return n&&(e.expr.$name=n),UD(this.add(BF(e)))},pN.addBinding=function(t,n){this.bindings||i("Nested signals do not support binding: "+l(t)),this.bindings.push(Z({signal:t},n))},pN.addScaleProj=function(t,n){this.scales.hasOwnProperty(t)&&i("Duplicate scale or projection name: "+l(t)),this.scales[t]=this.add(n)},pN.addScale=function(t,n){this.addScaleProj(t,GF(n))},pN.addProjection=function(t,n){this.addScaleProj(t,$F(n))},pN.getScale=function(t){return this.scales[t]||i("Unrecognized scale name: "+l(t)),this.scales[t]},pN.projectionRef=pN.scaleRef=function(t){return UD(this.getScale(t))},pN.projectionType=pN.scaleType=function(t){return this.getScale(t).params.type},pN.addData=function(t,n){return this.data.hasOwnProperty(t)&&i("Duplicate data set name: "+l(t)),this.data[t]=n},pN.getData=function(t){return this.data[t]||i("Undefined data set name: "+l(t)),this.data[t]},pN.addDataPipeline=function(t,n){return this.data.hasOwnProperty(t)&&i("Duplicate data set name: "+l(t)),this.addData(t,$B.fromEntries(this,n))};var mN="sans-serif",yN=30,_N=2,xN="#4c78a8",bN="#000",wN="#888",AN="#ddd";Z(Wr,qa,Pf,Nv,gb,pw,BA,yM,NM,UM),t.version="5.0.0-rc2",t.Dataflow=qr,t.EventStream=It,t.Parameters=zt,t.Pulse=Er,t.MultiPulse=Br,t.Operator=Lt,t.Transform=Ir,t.changeset=Nt,t.ingest=Ct,t.isTuple=Mt,t.definition=Hr,t.transform=Yr,t.transforms=Wr,t.tupleid=kt,t.scale=Tg,t.scheme=Gg,t.interpolate=$g,t.interpolateColors=Ug,t.interpolateRange=qg,t.timeInterval=fh,t.quantizeInterpolator=jg,t.projection=ab,t.View=kD,t.expressionFunction=JC,t.formatLocale=Jp,t.timeFormatLocale=yr,t.parse=function(t,n){return o(t)||i("Input Vega specification must be an object."),fN(t,new hN(vN([n,t.config]))).toRuntime()},t.runtime=lD,t.runtimeContext=fD,t.bin=ni,t.bootstrapCI=mi,t.quartiles=yi,t.setRandom=function(n){t.random=n},t.randomInteger=function(n,e){null==e&&(e=n,n=0);var r,i,a,u={};return u.min=function(t){return arguments.length?(a=i-(r=t||0),u):r},u.max=function(t){return arguments.length?(a=(i=t||0)-r,u):i},u.sample=function(){return r+Math.floor(a*t.random())},u.pdf=function(t){return t===Math.floor(t)&&t>=r&&t<i?1/a:0},u.cdf=function(t){var n=Math.floor(t);return n<r?0:n>=i?1:(n-r+1)/a},u.icdf=function(t){return t>=0&&t<=1?r-1+Math.floor(t*a):NaN},u.min(n).max(e)},t.randomKDE=xi,t.randomMixture=bi,t.randomNormal=_i,t.randomUniform=wi,t.accessor=n,t.accessorName=e,t.accessorFields=r,t.id=h,t.identity=d,t.zero=p,t.one=g,t.truthy=v,t.falsy=m,t.logger=M,t.None=_,t.Error=x,t.Warn=b,t.Info=w,t.Debug=A,t.panLinear=O,t.panLog=z,t.panPow=T,t.panSymlog=R,t.zoomLinear=L,t.zoomLog=q,t.zoomPow=U,t.zoomSymlog=j,t.quarter=I,t.utcquarter=$,t.array=W,t.clampRange=H,t.compare=G,t.constant=V,t.debounce=X,t.error=i,t.extend=Z,t.extent=J,t.extentIndex=Q,t.fastmap=tt,t.field=c,t.flush=nt,t.inherits=et,t.inrange=rt,t.isArray=u,t.isBoolean=it,t.isDate=at,t.isFunction=Y,t.isNumber=ut,t.isObject=o,t.isRegExp=ot,t.isString=s,t.key=st,t.merge=lt,t.pad=ft,t.peek=k,t.repeat=ct,t.span=ht,t.splitAccessPath=a,t.stringValue=l,t.toBoolean=dt,t.toDate=gt,t.toNumber=E,t.toString=vt,t.toSet=mt,t.truncate=yt,t.visitArray=_t,t.loader=xr,t.read=_r,t.inferType=en,t.inferTypes=rn,t.typeParsers=Kt,t.format=En,t.formats=Cn,t.responseType=Dn,t.Bounds=xu,t.Gradient=Au,t.GroupItem=ku,t.ResourceLoader=Du,t.Item=Mu,t.Scenegraph=Vl,t.Handler=rc,t.Renderer=uc,t.CanvasHandler=lc,t.CanvasRenderer=pc,t.SVGHandler=yc,t.SVGRenderer=Cc,t.SVGStringRenderer=qc,t.RenderType=Hc,t.renderModule=Gc,t.intersect=Vc,t.Marks=jl,t.boundClip=Kc,t.boundContext=Ss,t.boundStroke=Cs,t.boundItem=Il,t.boundMark=Wl,t.pathCurves=$o,t.pathSymbols=us,t.pathRectangle=ds,t.pathTrail=ps,t.pathParse=Yo,t.pathRender=rs,t.point=ec,t.domCreate=Jl,t.domFind=Ql,t.domChild=Kl,t.domClear=tc,t.openTag=bc,t.closeTag=wc,t.font=Tl,t.fontFamily=zl,t.fontSize=Bl,t.textMetrics=El,t.resetSVGClipId=function(){ul=1},t.sceneEqual=nf,t.pathEqual=ef,t.sceneToJSON=Yl,t.sceneFromJSON=Gl,t.intersectPath=Ts,t.intersectPoint=Rs,t.intersectRule=Ls,t.intersectBoxLine=qs,t.sceneZOrder=Hs,t.sceneVisit=Ys,t.scenePickVisit=Gs,Object.defineProperty(t,"__esModule",{value:!0})}); |
src/main/resources/public/js/components/store-install-app.js | SICTIAM/ozwillo-portal | 'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import {connect} from 'react-redux';
import createClass from 'create-react-class';
import PropTypes from 'prop-types'
import { withRouter } from 'react-router-dom';
const Showdown = require('showdown');
const converter = new Showdown.Converter({tables: true});
import {Modal} from './bootstrap-react';
import {RatingWrapper} from './rating';
import customFetch from '../util/custom-fetch';
import { i18n } from "../config/i18n-config"
class AppModal extends React.Component {
constructor(props) {
super(props);
this.state = this.initialState;
this.loadApp = this.loadApp.bind(this);
this.loadOrgs = this.loadOrgs.bind(this);
this.open = this.open.bind(this);
this.close = this.close.bind(this);
this.doInstallApp = this.doInstallApp.bind(this);
this.rateApp = this.rateApp.bind(this);
this.continueInstallProcess = this.continueInstallProcess.bind(this);
this.renderBuying = this.renderBuying.bind(this);
this.renderInstallingForm = this.renderInstallingForm.bind(this);
this.renderAppDescription = this.renderAppDescription.bind(this);
this.renderSucessfulInstallationForm = this.renderSucessfulInstallationForm.bind(this);
}
get initialState () {
return {
app: {rating: 0, rateable: true, tos: '', policy: '', longdescription: '', screenshots: null},
orgs: [],
selectedOrg: '',
buying: false,
installing: false,
isInstalled: false,
error: {status : false, http_status : 200}
};
}
componentDidUpdate() {
const desc = $(ReactDOM.findDOMNode(this)).find(".app-description table");
desc.addClass("table table-bordered table-condensed table-striped");
}
loadApp() {
customFetch(`/api/store/details/${this.props.app.type}/${this.props.app.id}`)
.then((data) => this.setState({ app: data }));
}
loadOrgs() {
customFetch(`/api/store/organizations/${this.props.app.type}/${this.props.app.id}`)
.then((data) => this.setState({ orgs: data }));
}
open() {
this.setState(this.initialState);
const href = `/${this.props.config.language}/store/${this.props.app.type}/${this.props.app.id}`;
this.props.history.replace(href);
this.loadApp();
const isLogged = !!this.props.userInfo.sub;
if (isLogged) {
this.loadOrgs();
}
this.refs.modal.open();
}
close () {
this.props.history.replace(`/${this.props.config.language}/store`);
if (this.state.isInstalled) {
this.props.history.push('/my/dashboard');
}
}
doInstallApp(organizationId) {
// set buying to true to display the spinner until any below ajax response is received.
this.setState({ installing: false, buying: true });
let request = {appId: this.props.app.id, appType: this.props.app.type};
if (organizationId) {
request.organizationId = organizationId;
}
customFetch('/api/store/buy', {
method: 'POST',
json: request
}).then(() => {
this.setState({ buying: false, isInstalled: true });
}).catch((error) =>{
this.setState({ buying: false, error: {status: true, http_status: error.status} })})
}
rateApp(rate) {
customFetch(`/api/store/rate/${this.props.app.type}/${this.props.app.id}`, {
method: 'POST',
json: { "rate": rate }
}).then(() => {
const state = this.state;
state.app.rateable = false;
state.app.rating = rate;
this.setState(state);
})
}
continueInstallProcess(installType, selectedOrgId) {
const state = this.state;
state.installType = installType;
if (state.installType === 'ORG') {
state.installing = false;
this.doInstallApp(selectedOrgId);
} else { // PERSONAL
this.doInstallApp(null);
}
}
renderBuying() {
return (<h3><i className="fa fa-spinner fa-spin loading"/> {i18n._('buying')}</h3>);
}
renderInstallingForm() {
return (<InstallForm url={this.state.app.serviceUrl}
app={this.props.app}
orgs={this.state.orgs}
continueInstallProcess={this.continueInstallProcess}
/>);
}
renderAppDescription() {
return (
<AppDescriptionComponentWithRedux app={this.props.app} stateApp={this.state.app}
rateApp={this.rateApp}
onInstallButton={() => this.setState({ installing: true })}
error={this.state.error}/>
);
}
renderSucessfulInstallationForm() {
return (<div>
<div className='form-horizontal'>
<i id="success-app-install" className="fa fa-check pull-left col-sm-offset-1"></i>
<div className='form-group'>
<h5 className="col-sm-offset-2">{i18n._('install.org.success-msg-1')}</h5><br/>
</div>
{!this.props.app.paid ? '' :
<div className='form-group'>
<h5 className="col-sm-offset-2">{i18n._('install.org.success-msg-2')}</h5><br/>
</div>
}
{this.state.installType === 'PERSONAL' ? '' :
<div className='form-group'>
<h5 className="col-sm-offset-2">{i18n._('install.org.success-msg-3')}</h5><br/>
</div>
}
<div className='form-group'>
<h5 className="col-sm-offset-2">{i18n._('install.org.success-msg-4')}</h5><br/>
</div>
</div>
</div>
);
}
render() {
let title = this.props.app.name;
let content = null;
if (this.state.buying) {
content = this.renderBuying();
} else if (this.state.installing) {
content = this.renderInstallingForm();
} else if (this.state.isInstalled) {
content = this.renderSucessfulInstallationForm();
} else {
content = this.renderAppDescription();
}
return (
<div>
<Modal ref="modal" large={true} infobox={true} title={title} cancelHandler={this.close}>
{content}
</Modal>
<Modal ref="modalError" title={i18n._('ui.something_went_wrong_title')} infobox={true}
cancelHandler={null}>
<div><h5>{i18n._('search.organization.cannot-be-used')}</h5></div>
</Modal>
</div>);
}
}
/** PROPS: app{}, stateApp{}, rateApp(), onInstallButton(), errors[] */
const AppDescriptionComponent = createClass({
handleError: function() {
let {status, http_status} = this.props.error;
if(status && http_status){
let message = '';
if(http_status.toString().startsWith('4')) {
message = i18n._('could-not-install-app-400')
}else if(http_status.toString().startsWith('5')){
message = i18n._('could-not-install-app-500')
}else{
message = i18n._('could-not-install-app')
}
return (
<div className="alert alert-danger alert-dismissible" role="alert">
<button type="button" className="close" data-dismiss="alert">
<span aria-hidden="true">×</span>
<span className="sr-only">{i18n._('ui.close')}</span>
</button>
<strong>{i18n._('sorry')}</strong>
{message +' ('+ i18n._('error-code')+' : ' + http_status+')'}
</div>
)
}
},
render: function () {
const stateApp = this.props.stateApp;
const carousel = (stateApp.screenshots && stateApp.screenshots.length > 0)
? (<div className="row">
<Carousel images={stateApp.screenshots}/>
</div>)
: null;
const error = this.handleError();
let rateInfo = null;
const isLogged = !!this.props.userInfo.sub;
if (isLogged && !stateApp.rateable) {
rateInfo = (<p>{i18n._('already-rated')}</p>);
}
const description = converter.makeHtml(stateApp.longdescription);
let launchOrInstallButton;
if (this.props.app.type === "service" && this.props.app.installed) {
if (this.props.stateApp && this.props.stateApp.serviceUrl) {
launchOrInstallButton =
<a className="btn btn-default btn-lg pull-right" href={this.props.stateApp.serviceUrl}
target="_new">{i18n._('launch')}</a>;
} else {
launchOrInstallButton = (<label> <i className="fa fa-spinner fa-spin loading"/> </label>);
}
} else {
const storeUrl = `/${this.props.config.language}/store`;
launchOrInstallButton = !isLogged
? (<a className="btn btn-default btn-lg pull-right"
href={storeUrl + "/login?appId=" + this.props.app.id + "&appType=" + this.props.app.type}>{i18n._('store.install')}</a>)
: (<button type="button" className="btn btn-default btn-lg pull-right"
onClick={this.props.onInstallButton}>{i18n._('store.install')}</button>)
}
return (
<div className="store-app-card">
<div className="row">
<div className="col-sm-1">
<img src={this.props.app.icon} alt={this.props.app.name}/>
</div>
<div className="col-sm-7">
<div>
<p>{i18n._('by')} {this.props.app.provider}</p>
<RatingWrapper rating={stateApp.rating} appId={this.props.app.id}
rateable={stateApp.rateable} rate={this.props.rateApp}/>
{rateInfo}
</div>
</div>
<div className="col-sm-4">
{launchOrInstallButton}
</div>
</div>
{error}
{carousel}
<div className="row">
<div className="col-sm-12">
<div className="app-description" dangerouslySetInnerHTML={{__html: description}}></div>
</div>
</div>
<div className="row">
<div className="col-sm-12">
<div className="app-tos">
<p>{i18n._('agree-to-tos')}</p>
<p>
<a href={stateApp.tos} target="_new">{i18n._('tos')}</a>
</p>
<p>
<a href={stateApp.policy} target="_new">{i18n._('privacy')}</a>
</p>
</div>
</div>
</div>
</div>
);
}
});
const mapStateToProps = state => {
return {
config: state.config,
userInfo: state.userInfo
};
};
const AppDescriptionComponentWithRedux = connect(mapStateToProps)(AppDescriptionComponent)
// INSTALLATION PROCESS
/** PROPS: app{}, errors[], url, orgs[], continueInstallProcess() */
const InstallForm = createClass({
getInitialState: function () {
return ({
installType: 'PERSONAL',
errors: []
})
},
getInstallType: function () {
const installTypeRestrictions = {personal: this.hasCitizens(), org: this.hasOrganizations()};
if (this.state.installType === 'PERSONAL' && installTypeRestrictions.personal === false) {
return 'ORG';
}
else if (this.state.installType === 'ORG' && installTypeRestrictions.org === false) {
return 'PERSONAL';
}
else {
return this.state.installType;
}
},
isOnlyForCitizens: function () {
return this.props.app.target_citizens && !this.props.app.target_companies && !this.props.app.target_publicbodies;
},
hasCitizens: function () {
return this.props.app.target_citizens;
},
hasOrganizations: function () {
return (this.props.app.target_companies) || (this.props.app.target_publicbodies);
},
toggleType: function (event) {
const installType = event.target.value;
this.setState({installType: installType});
},
renderInstallType: function () {
const installTypeRestrictions = {personal: this.hasCitizens(), org: this.hasOrganizations()};
const installType = this.getInstallType();
const personal = !installTypeRestrictions.personal ? null
: (<div className='radio col-sm-offset-3 col-sm-8'>
<label>
<input type="radio" value="PERSONAL" checked={installType === 'PERSONAL'}
onChange={this.toggleType}/>{i18n._('install.org.type.PERSONAL')}
</label>
</div>
);
const org = !installTypeRestrictions.org ? null
: (<div className='radio col-sm-offset-3 col-sm-8'>
<label>
<input type="radio" value="ORG" checked={installType === 'ORG'}
onChange={this.toggleType}/>{i18n._('install.org.type.ORG')}
</label>
</div>
);
return (
<div>
<h4>{i18n._('choose-install-type')}</h4>
<div className="form-group">
{personal}
{org}
</div>
</div>
);
},
validateAndContinue: function () {
const installType = this.getInstallType();
if (installType === 'PERSONAL') {
this.props.continueInstallProcess(installType, null);
} else if (installType === 'ORG' && (this.refs.setOrgComponent && this.refs.setOrgComponent.validate())) {
this.props.continueInstallProcess(installType, this.refs.setOrgComponent.getSelectedOrganization());
}
},
render: function () {
const installType = this.getInstallType();
return (
<div className='form-horizontal'>
{this.renderInstallType()}
{(installType === 'PERSONAL') || (this.props.app.type === "service")
? (<div className="next">
<button className="btn btn-default pull-right"
onClick={this.validateAndContinue}>{i18n._('ui.next')}</button>
</div>
)
: (<div>
<SetOrganizationComponent ref='setOrgComponent' url={this.props.url} app={this.props.app}
orgs={this.props.orgs}
isOnlyForCitizens={this.isOnlyForCitizens}/>
<div className="next">
<button className="btn btn-default pull-right"
onClick={this.validateAndContinue}>{i18n._('ui.next')}</button>
</div>
</div>)
}
</div>
);
}
});
/** PROPS: app{}, orgs[], url, isOnlyForCitizens() */
const SetOrganizationComponent = createClass({
getInitialState: function () {
return {
selectedOrgId: '',
errors: []
}
},
getSelectedOrganization: function () {
return this.state.selectedOrgId
},
renderOrganizations: function () {
const opts = [];
opts.push(<option key={-1} value=""></option>);
this.props.orgs.map(function (org) {
opts.push(<option key={org.id} value={org.id}>{org.name}</option>);
});
const formGroupClass = ($.inArray('typeInstallOrg', this.state.errors) != -1) ? 'form-group has-error' : 'form-group';
return (
<div className={formGroupClass}>
{this.renderLabel('organization', i18n._('search.organization.title'), true)}
<div className="col-sm-8">
<select id="organization" className="col-sm-8 form-control"
onChange={(event) => this.setState({ selectedOrgId: event.target.value })}
value={this.state.selectedOrgId || ''}>
{opts}
</select>
</div>
</div>
);
},
validate: function () {
const errors = [];
if (this.state.selectedOrgId.trim() === '') {
errors.push('typeInstallOrg');
}
this.setState({ errors: errors });
return errors.length <= 0;
},
renderLabel: function (htmlFor, label, isRequired) {
const labelClass = isRequired ? 'col-sm-3 control-label required' : 'col-sm-3 control-label';
return (
<label htmlFor={htmlFor} className={labelClass}>{label} {isRequired ? '*' : ''}</label>
);
},
render: function () {
return (
<div>
{this.renderOrganizations()}
</div>
);
}
});
//END NEW INSTALL PROCESS
/** PROPS: images */
const Carousel = createClass({
getInitialState: function () {
return {index: 0};
},
back: function () {
let index = this.state.index;
index = Math.max(0, index - 1);
this.setState({index: index});
},
forward: function () {
let index = this.state.index;
index = Math.min(this.props.images.length, index + 1);
this.setState({index: index});
},
render: function () {
if (!this.props.images) {
return null;
}
let back = null;
if (this.state.index > 0) {
back = <a className="back" onClick={this.back}>
<i className="fa fa-chevron-left"></i>
</a>;
}
let forward = null;
if (this.state.index < this.props.images.length - 1) {
forward = <a className="forward" onClick={this.forward}>
<i className="fa fa-chevron-right"></i>
</a>;
}
return (
<div className="col-md-12">
<div className="app-screenshots">
{back}
<img src={this.props.images[this.state.index]} alt={this.state.index}/>
{forward}
</div>
</div>
);
}
});
export default withRouter(connect(state => {
return {
config: state.config,
userInfo: state.userInfo
}
}, null, null, {withRef: true})(AppModal));
|
src/components/WeatherForecast/WeatherForecastBlock.js | Mikosko/EimPanel | /**
* @Author: Miloš Kolčák
* @Date: 2017-01-04T15:32:41+01:00
* @Email: milos.kolcak@gmail.com
* @Last modified by: Miloš Kolčák
* @Last modified time: 2017-01-05T17:07:33+01:00
*/
import React from 'react'
import style from './style.scss'
class WeatherForecastBlock extends React.Component {
render() {
const { width, value, icon, symbol, label } = this.props
return <div className={style.coll} style={{width: width+'%'}}>
<div className={style.value}>{value}{symbol}</div>
<div className={style.icon + " streamline " + icon}></div>
<div className={style.label}>{label}</div>
</div>
}
}
export default WeatherForecastBlock
|
react-ui/src/components/Admin.js | EdwinJow/truthindata | import React, { Component } from 'react';
import axios from 'axios';
import { GoogleLogin } from 'react-google-login-component';
class Admin extends Component {
constructor(props) {
super(props);
this.state = {
isAuthenticated: false
};
}
flushRedisCache = () => {
axios.get('/cache/flush-all')
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
});
}
componentDidMount() {
}
handleGoogleResponse = (user) => {
let token = user.getAuthResponse().id_token;
axios.post('/user/authenticate', {
token: token
})
.then(function(response){
if(response.data.isAdmin){
this.setState({isAuthenticated: true});
}
}.bind(this))
.catch(function (error) {
console.log(error);
});
}
render() {
return (
<div>
<GoogleLogin socialId="604862335880-g909ass4c0uicmhj6nuta8c376qi2vck.apps.googleusercontent.com"
className={this.state.isAuthenticated ? "login-button" : "hidden"}
scope="profile email"
responseHandler={this.handleGoogleResponse.bind(this)}
buttonText="Login With Google"/>
</div>
);
}
}
export default Admin;
|
src/Parser/Rogue/Subtlety/Modules/Talents/DarkShadow/DarkShadowSpecterOfBetrayal.js | enragednuke/WoWAnalyzer | import React from 'react';
import SPELLS from 'common/SPELLS';
import SpellLink from 'common/SpellLink';
import Wrapper from 'common/Wrapper';
import ItemLink from 'common/ItemLink';
import ITEMS from 'common/ITEMS';
import { formatPercentage } from 'common/format';
import DarkShadow from './DarkShadow';
class DarkShadowSpecterOfBetrayal extends DarkShadow {
suggestions(when) {
const totalSpecterCastsInShadowDance = this.danceDamageTracker.getAbility(SPELLS.SUMMON_DREAD_REFLECTION.id).casts;
const totalSpecterCast = this.damageTracker.getAbility(SPELLS.SUMMON_DREAD_REFLECTION.id).casts;
const castsInDanceShare = totalSpecterCastsInShadowDance / totalSpecterCast;
when(castsInDanceShare).isLessThan(0.90)
.addSuggestion((suggest, actual, recommended) => {
return suggest(<Wrapper>Use <ItemLink id={ITEMS.SPECTER_OF_BETRAYAL.id} /> during <SpellLink id={SPELLS.SHADOW_DANCE.id} /> when you are using <SpellLink id={SPELLS.DARK_SHADOW_TALENT.id} />. </Wrapper>)
.icon(ITEMS.SPECTER_OF_BETRAYAL.icon)
.actual(`You used Specter of Betrayal in Shadow Dance ${formatPercentage(actual)}% of the time`)
.recommended(`>${formatPercentage(recommended)}% is recommended`)
.regular(0.80);
//Its around 1% dps loss when pressing it on cooldown, so never Major.
});
}
}
export default DarkShadowSpecterOfBetrayal;
|
app/components/logs-list.js | nypl-spacetime/logs-viewer | import React, { Component } from 'react';
import ReactDOM from 'react-dom'
import {Table, Column, Cell} from 'fixed-data-table';
import Filters from './filters'
import '../../node_modules/fixed-data-table/dist/fixed-data-table.css'
import './logs-list.scss'
var Renderers = {}
function requireAll(r) {
r.keys().forEach((filename, i) => {
var [, dataset, step] = filename.match(/\.\/(.*)\/(.*)\.js/)
if (!Renderers[dataset]) {
Renderers[dataset] = {}
}
Renderers[dataset][step] = r(filename).default
})
}
requireAll(require.context('./datasets/', true, /\.js$/))
var SortTypes = {
ASC: 'ASC',
DESC: 'DESC',
}
function reverseSortDirection(sortDir) {
return sortDir === SortTypes.DESC ? SortTypes.ASC : SortTypes.DESC;
}
const SortFilterHeaderCell = React.createClass({
render: function() {
var sortDir = this.props.sortDir
var children = this.props.children
return (
<Cell>
<a onClick={this.onSortChange} href='javascript:void(0)'>
{children} {sortDir ? (sortDir === SortTypes.DESC ? '↓' : '↑') : ''}
</a>
<div>
<input ref='filter' placeholder={'Filter'} onChange={this.onFilterChange}/>
</div>
</Cell>
)
},
onFilterChange: function(e) {
if (this.props.onFilterChange) {
var input = ReactDOM.findDOMNode(this.refs.filter)
var filter = input.value.length ? input.value : null
this.props.onFilterChange(this.props.column, filter)
}
},
onSortChange: function(e) {
e.preventDefault()
if (this.props.onSortChange) {
this.props.onSortChange(
this.props.column,
this.props.sortDir ?
reverseSortDirection(this.props.sortDir) :
SortTypes.DESC
)
}
}
})
const LogsList = React.createClass({
getInitialState: function() {
var allIndexes = []
for (var index = 0; index < this.props.logs.length; index++) {
allIndexes.push(index)
}
const container = document.querySelector('.logs-container')
const totalHeight = container.offsetHeight
return {
colSortDirs: {},
colFilters: {},
allIndexes: allIndexes,
sortedAndFilteredIndexes: allIndexes.slice(),
totalHeight
}
},
render: function() {
const rowHeight = 30
const rowsCountHeight = 30
const totalWidth = 1000
const totalHeight = this.state.totalHeight
const columns = Object.keys(this.props.logs[0])
const columnCount = columns.length
const dataset = this.props.dataset
const step = this.props.step
var renderer = Object.assign({}, Renderers.default.default)
if (Renderers[dataset] && Renderers[dataset][step]) {
renderer = Object.assign(renderer, Renderers[dataset][step])
}
const filteredCount = this.state.sortedAndFilteredIndexes.length
const totalCount = this.state.allIndexes.length
var totalCountStr = ''
if (filteredCount !== totalCount) {
totalCountStr = `(${totalCount} total)`
}
return (
<div>
<div className='rows-count' style={{height: rowsCountHeight}}>
{this.state.sortedAndFilteredIndexes.length} items {totalCountStr}
</div>
<Table
rowHeight={rowHeight}
rowHeightGetter={(rowIndex) => {
var row = this.props.logs[this.state.sortedAndFilteredIndexes[rowIndex]]
return renderer.rowHeight(row, rowHeight)
}}
rowsCount={filteredCount}
width={totalWidth}
height={totalHeight - rowsCountHeight}
headerHeight={rowHeight * 2}>
{ columns.map((column, i) => (
<Column
key={i}
width={renderer.columnWidth(column, columnCount, totalWidth) || 250}
header={<SortFilterHeaderCell
onSortChange={this.onSortChange}
onFilterChange={this.onFilterChange}
column={column}
sortDir={this.state.colSortDirs[column]}>
{renderer.header(column)}
</SortFilterHeaderCell>}
cell={({rowIndex}) => {
var row = this.props.logs[this.state.sortedAndFilteredIndexes[rowIndex]]
return (
<Cell
className='log-cell'
key={`${i}-${column}`} >
{renderer.cell(column, row[column], row)}
</Cell>
)
}}
/>
)) }
</Table>
</div>
)
},
onFilterChange: function (column, filter) {
var colFilters
if (filter) {
colFilters = Object.assign(this.state.colFilters, {[column]: filter})
} else {
colFilters = Object.assign(this.state.colFilters)
delete colFilters[column]
}
var colSortDirs = Object.assign({}, this.state.colSortDirs)
this.filterAndSort(colSortDirs, colFilters)
},
onSortChange: function (column, sortDir) {
var colSortDirs = {
[column]: sortDir
}
var colFilters = Object.assign({}, this.state.colFilters)
this.filterAndSort(colSortDirs, colFilters)
},
filterAndSort(colSortDirs, colFilters) {
// First filter, then sort
const filterColumns = Object.keys(colFilters)
var filteredIndexes = this.state.allIndexes.slice()
if (colFilters && Object.keys(colFilters).length) {
var applyFilter = (value, filter) => {
var columnType = typeof value
if (columnType === 'object') {
value = JSON.stringify(value)
}
return `${value}`.toLowerCase().indexOf(filter.toLowerCase()) > -1
}
filteredIndexes = filteredIndexes.filter((index) => {
var row = this.props.logs[index]
var filtered = filterColumns.reduce((filtered, column) => {
return filtered && applyFilter(row[column], colFilters[column])
}, true)
return filtered
})
}
if (colSortDirs && Object.keys(colSortDirs).length) {
var column = Object.keys(colSortDirs)[0]
var sortDir = colSortDirs[column]
filteredIndexes.sort((indexA, indexB) => {
var valueA = this.props.logs[indexA][column]
var valueB = this.props.logs[indexB][column]
var sortVal = 0
if (valueA > valueB) {
sortVal = 1
}
if (valueA < valueB) {
sortVal = -1
}
if (sortVal !== 0 && sortDir === SortTypes.ASC) {
sortVal = sortVal * -1
}
return sortVal
})
}
this.setState({
colSortDirs: colSortDirs,
colFilters: colFilters,
sortedAndFilteredIndexes: filteredIndexes
})
},
handleResize: function(e) {
const container = document.querySelector('.logs-container')
const totalHeight = container.offsetHeight
this.setState({
totalHeight
})
},
componentDidMount: function() {
window.addEventListener('resize', this.handleResize)
},
componentWillUnmount: function() {
window.removeEventListener('resize', this.handleResize);
}
})
export default LogsList
|
public/src/components/Home.js | dolchi21/open-prices-web | import React from 'react';
import LoginForm from '../containers/LoginForm.js';
require('/css/Home.less');
var Home = React.createClass({
render : function render(){
return (
<div id="Home">
<div>
<h1>HOME</h1>
</div>
<div>
<a href="/login">login</a>
</div>
</div>
);
}
});
export default Home;
|
src/components/main/parts/documents/documents.page.js | PolexRufous/FarmReactUI | import React from 'react';
import DocumentsTable from './documents.table';
import {FormattedMessage} from 'react-intl';
import DocumentsDispatcher from '../../dispatchers/documents.dispatcher';
import {Link} from 'react-router-dom';
import * as GlobalConfig from '../../../../global.config.json';
export default class DocumentsPage extends React.Component{
constructor() {
super();
this.refreshDocuments = this.refreshDocuments.bind(this);
}
refreshDocuments() {
const event = {
type: 'RECENT'
};
DocumentsDispatcher.dispatch(event);
}
render(){
const { documents } = this.props;
const {main} = GlobalConfig.routes;
return(
<main id="main-section-main" className="col-md-6">
<button type='button' className='refresh-button btn btn-default'
onClick={this.refreshDocuments}>
<FormattedMessage id='REFRESH'/></button>
<Link to={main.base + main.documents + '/new'}>
<button type='button' className='btn btn-default'><span><FormattedMessage id='ADD'/></span></button>
</Link>
<h4><FormattedMessage id='RECENT_DOCUMENTS'/></h4>
<DocumentsTable documents={documents}/>
</main>
);
}
}
|
ajax/libs/yui/3.15.0/datatable-core/datatable-core-debug.js | tonytlwu/cdnjs | /*
YUI 3.15.0 (build 834026e)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('datatable-core', function (Y, NAME) {
/**
The core implementation of the `DataTable` and `DataTable.Base` Widgets.
@module datatable
@submodule datatable-core
@since 3.5.0
**/
var INVALID = Y.Attribute.INVALID_VALUE,
Lang = Y.Lang,
isFunction = Lang.isFunction,
isObject = Lang.isObject,
isArray = Lang.isArray,
isString = Lang.isString,
isNumber = Lang.isNumber,
toArray = Y.Array,
keys = Y.Object.keys,
Table;
/**
_API docs for this extension are included in the DataTable class._
Class extension providing the core API and structure for the DataTable Widget.
Use this class extension with Widget or another Base-based superclass to create
the basic DataTable model API and composing class structure.
@class DataTable.Core
@for DataTable
@since 3.5.0
**/
Table = Y.namespace('DataTable').Core = function () {};
Table.ATTRS = {
/**
Columns to include in the rendered table.
If omitted, the attributes on the configured `recordType` or the first item
in the `data` collection will be used as a source.
This attribute takes an array of strings or objects (mixing the two is
fine). Each string or object is considered a column to be rendered.
Strings are converted to objects, so `columns: ['first', 'last']` becomes
`columns: [{ key: 'first' }, { key: 'last' }]`.
DataTable.Core only concerns itself with a few properties of columns.
These properties are:
* `key` - Used to identify the record field/attribute containing content for
this column. Also used to create a default Model if no `recordType` or
`data` are provided during construction. If `name` is not specified, this
is assigned to the `_id` property (with added incrementer if the key is
used by multiple columns).
* `children` - Traversed to initialize nested column objects
* `name` - Used in place of, or in addition to, the `key`. Useful for
columns that aren't bound to a field/attribute in the record data. This
is assigned to the `_id` property.
* `id` - For backward compatibility. Implementers can specify the id of
the header cell. This should be avoided, if possible, to avoid the
potential for creating DOM elements with duplicate IDs.
* `field` - For backward compatibility. Implementers should use `name`.
* `_id` - Assigned unique-within-this-instance id for a column. By order
of preference, assumes the value of `name`, `key`, `id`, or `_yuid`.
This is used by the rendering views as well as feature module
as a means to identify a specific column without ambiguity (such as
multiple columns using the same `key`.
* `_yuid` - Guid stamp assigned to the column object.
* `_parent` - Assigned to all child columns, referencing their parent
column.
@attribute columns
@type {Object[]|String[]}
@default (from `recordType` ATTRS or first item in the `data`)
@since 3.5.0
**/
columns: {
// TODO: change to setter to clone input array/objects
validator: isArray,
setter: '_setColumns',
getter: '_getColumns'
},
/**
Model subclass to use as the `model` for the ModelList stored in the `data`
attribute.
If not provided, it will try really hard to figure out what to use. The
following attempts will be made to set a default value:
1. If the `data` attribute is set with a ModelList instance and its `model`
property is set, that will be used.
2. If the `data` attribute is set with a ModelList instance, and its
`model` property is unset, but it is populated, the `ATTRS` of the
`constructor of the first item will be used.
3. If the `data` attribute is set with a non-empty array, a Model subclass
will be generated using the keys of the first item as its `ATTRS` (see
the `_createRecordClass` method).
4. If the `columns` attribute is set, a Model subclass will be generated
using the columns defined with a `key`. This is least desirable because
columns can be duplicated or nested in a way that's not parsable.
5. If neither `data` nor `columns` is set or populated, a change event
subscriber will listen for the first to be changed and try all over
again.
@attribute recordType
@type {Function}
@default (see description)
@since 3.5.0
**/
recordType: {
getter: '_getRecordType',
setter: '_setRecordType'
},
/**
The collection of data records to display. This attribute is a pass
through to a `data` property, which is a ModelList instance.
If this attribute is passed a ModelList or subclass, it will be assigned to
the property directly. If an array of objects is passed, a new ModelList
will be created using the configured `recordType` as its `model` property
and seeded with the array.
Retrieving this attribute will return the ModelList stored in the `data`
property.
@attribute data
@type {ModelList|Object[]}
@default `new ModelList()`
@since 3.5.0
**/
data: {
valueFn: '_initData',
setter : '_setData',
lazyAdd: false
},
/**
Content for the `<table summary="ATTRIBUTE VALUE HERE">`. Values assigned
to this attribute will be HTML escaped for security.
@attribute summary
@type {String}
@default '' (empty string)
@since 3.5.0
**/
//summary: {},
/**
HTML content of an optional `<caption>` element to appear above the table.
Leave this config unset or set to a falsy value to remove the caption.
@attribute caption
@type HTML
@default '' (empty string)
@since 3.5.0
**/
//caption: {},
/**
Deprecated as of 3.5.0. Passes through to the `data` attribute.
WARNING: `get('recordset')` will NOT return a Recordset instance as of
3.5.0. This is a break in backward compatibility.
@attribute recordset
@type {Object[]|Recordset}
@deprecated Use the `data` attribute
@since 3.5.0
**/
recordset: {
setter: '_setRecordset',
getter: '_getRecordset',
lazyAdd: false
},
/**
Deprecated as of 3.5.0. Passes through to the `columns` attribute.
WARNING: `get('columnset')` will NOT return a Columnset instance as of
3.5.0. This is a break in backward compatibility.
@attribute columnset
@type {Object[]}
@deprecated Use the `columns` attribute
@since 3.5.0
**/
columnset: {
setter: '_setColumnset',
getter: '_getColumnset',
lazyAdd: false
}
};
Y.mix(Table.prototype, {
// -- Instance properties -------------------------------------------------
/**
The ModelList that manages the table's data.
@property data
@type {ModelList}
@default undefined (initially unset)
@since 3.5.0
**/
//data: null,
// -- Public methods ------------------------------------------------------
/**
Gets the column configuration object for the given key, name, or index. For
nested columns, `name` can be an array of indexes, each identifying the index
of that column in the respective parent's "children" array.
If you pass a column object, it will be returned.
For columns with keys, you can also fetch the column with
`instance.get('columns.foo')`.
@method getColumn
@param {String|Number|Number[]} name Key, "name", index, or index array to
identify the column
@return {Object} the column configuration object
@since 3.5.0
**/
getColumn: function (name) {
var col, columns, i, len, cols;
if (isObject(name) && !isArray(name)) {
if (name instanceof Y.Node) {
col = this.body.getColumn(name);
} else {
col = name;
}
} else {
col = this.get('columns.' + name);
}
if (col) {
return col;
}
columns = this.get('columns');
if (isNumber(name) || isArray(name)) {
name = toArray(name);
cols = columns;
for (i = 0, len = name.length - 1; cols && i < len; ++i) {
cols = cols[name[i]] && cols[name[i]].children;
}
return (cols && cols[name[i]]) || null;
}
return null;
},
/**
Returns the Model associated to the record `id`, `clientId`, or index (not
row index). If none of those yield a Model from the `data` ModelList, the
arguments will be passed to the `view` instance's `getRecord` method
if it has one.
If no Model can be found, `null` is returned.
@method getRecord
@param {Number|String|Node} seed Record `id`, `clientId`, index, Node, or
identifier for a row or child element
@return {Model}
@since 3.5.0
**/
getRecord: function (seed) {
var record = this.data.getById(seed) || this.data.getByClientId(seed);
if (!record) {
if (isNumber(seed)) {
record = this.data.item(seed);
}
// TODO: this should be split out to base somehow
if (!record && this.view && this.view.getRecord) {
record = this.view.getRecord.apply(this.view, arguments);
}
}
return record || null;
},
// -- Protected and private properties and methods ------------------------
/**
This tells `Y.Base` that it should create ad-hoc attributes for config
properties passed to DataTable's constructor. This is useful for setting
configurations on the DataTable that are intended for the rendering View(s).
@property _allowAdHocAttrs
@type Boolean
@default true
@protected
@since 3.6.0
**/
_allowAdHocAttrs: true,
/**
A map of column key to column configuration objects parsed from the
`columns` attribute.
@property _columnMap
@type {Object}
@default undefined (initially unset)
@protected
@since 3.5.0
**/
//_columnMap: null,
/**
The Node instance of the table containing the data rows. This is set when
the table is rendered. It may also be set by progressive enhancement,
though this extension does not provide the logic to parse from source.
@property _tableNode
@type {Node}
@default undefined (initially unset)
@protected
@since 3.5.0
**/
//_tableNode: null,
/**
Updates the `_columnMap` property in response to changes in the `columns`
attribute.
@method _afterColumnsChange
@param {EventFacade} e The `columnsChange` event object
@protected
@since 3.5.0
**/
_afterColumnsChange: function (e) {
this._setColumnMap(e.newVal);
},
/**
Updates the `modelList` attributes of the rendered views in response to the
`data` attribute being assigned a new ModelList.
@method _afterDataChange
@param {EventFacade} e the `dataChange` event
@protected
@since 3.5.0
**/
_afterDataChange: function (e) {
var modelList = e.newVal;
this.data = e.newVal;
if (!this.get('columns') && modelList.size()) {
// TODO: this will cause a re-render twice because the Views are
// subscribed to columnsChange
this._initColumns();
}
},
/**
Assigns to the new recordType as the model for the data ModelList
@method _afterRecordTypeChange
@param {EventFacade} e recordTypeChange event
@protected
@since 3.6.0
**/
_afterRecordTypeChange: function (e) {
var data = this.data.toJSON();
this.data.model = e.newVal;
this.data.reset(data);
if (!this.get('columns') && data) {
if (data.length) {
this._initColumns();
} else {
this.set('columns', keys(e.newVal.ATTRS));
}
}
},
/**
Creates a Model subclass from an array of attribute names or an object of
attribute definitions. This is used to generate a class suitable to
represent the data passed to the `data` attribute if no `recordType` is
set.
@method _createRecordClass
@param {String[]|Object} attrs Names assigned to the Model subclass's
`ATTRS` or its entire `ATTRS` definition object
@return {Model}
@protected
@since 3.5.0
**/
_createRecordClass: function (attrs) {
var ATTRS, i, len;
if (isArray(attrs)) {
ATTRS = {};
for (i = 0, len = attrs.length; i < len; ++i) {
ATTRS[attrs[i]] = {};
}
} else if (isObject(attrs)) {
ATTRS = attrs;
}
return Y.Base.create('record', Y.Model, [], null, { ATTRS: ATTRS });
},
/**
Tears down the instance.
@method destructor
@protected
@since 3.6.0
**/
destructor: function () {
new Y.EventHandle(Y.Object.values(this._eventHandles)).detach();
},
/**
The getter for the `columns` attribute. Returns the array of column
configuration objects if `instance.get('columns')` is called, or the
specific column object if `instance.get('columns.columnKey')` is called.
@method _getColumns
@param {Object[]} columns The full array of column objects
@param {String} name The attribute name requested
(e.g. 'columns' or 'columns.foo');
@protected
@since 3.5.0
**/
_getColumns: function (columns, name) {
// Workaround for an attribute oddity (ticket #2529254)
// getter is expected to return an object if get('columns.foo') is called.
// Note 'columns.' is 8 characters
return name.length > 8 ? this._columnMap : columns;
},
/**
Relays the `get()` request for the deprecated `columnset` attribute to the
`columns` attribute.
THIS BREAKS BACKWARD COMPATIBILITY. 3.4.1 and prior implementations will
expect a Columnset instance returned from `get('columnset')`.
@method _getColumnset
@param {Object} ignored The current value stored in the `columnset` state
@param {String} name The attribute name requested
(e.g. 'columnset' or 'columnset.foo');
@deprecated This will be removed with the `columnset` attribute in a future
version.
@protected
@since 3.5.0
**/
_getColumnset: function (_, name) {
return this.get(name.replace(/^columnset/, 'columns'));
},
/**
Returns the Model class of the instance's `data` attribute ModelList. If
not set, returns the explicitly configured value.
@method _getRecordType
@param {Model} val The currently configured value
@return {Model}
**/
_getRecordType: function (val) {
// Prefer the value stored in the attribute because the attribute
// change event defaultFn sets e.newVal = this.get('recordType')
// before notifying the after() subs. But if this getter returns
// this.data.model, then after() subs would get e.newVal === previous
// model before _afterRecordTypeChange can set
// this.data.model = e.newVal
return val || (this.data && this.data.model);
},
/**
Initializes the `_columnMap` property from the configured `columns`
attribute. If `columns` is not set, but there are records in the `data`
ModelList, use
`ATTRS` of that class.
@method _initColumns
@protected
@since 3.5.0
**/
_initColumns: function () {
var columns = this.get('columns') || [],
item;
// Default column definition from the configured recordType
if (!columns.length && this.data.size()) {
// TODO: merge superclass attributes up to Model?
item = this.data.item(0);
if (item.toJSON) {
item = item.toJSON();
}
this.set('columns', keys(item));
}
this._setColumnMap(columns);
},
/**
Sets up the change event subscriptions to maintain internal state.
@method _initCoreEvents
@protected
@since 3.6.0
**/
_initCoreEvents: function () {
this._eventHandles.coreAttrChanges = this.after({
columnsChange : Y.bind('_afterColumnsChange', this),
recordTypeChange: Y.bind('_afterRecordTypeChange', this),
dataChange : Y.bind('_afterDataChange', this)
});
},
/**
Defaults the `data` attribute to an empty ModelList if not set during
construction. Uses the configured `recordType` for the ModelList's `model`
proeprty if set.
@method _initData
@protected
@return {ModelList}
@since 3.6.0
**/
_initData: function () {
var recordType = this.get('recordType'),
// TODO: LazyModelList if recordType doesn't have complex ATTRS
modelList = new Y.ModelList();
if (recordType) {
modelList.model = recordType;
}
return modelList;
},
/**
Initializes the instance's `data` property from the value of the `data`
attribute. If the attribute value is a ModelList, it is assigned directly
to `this.data`. If it is an array, a ModelList is created, its `model`
property is set to the configured `recordType` class, and it is seeded with
the array data. This ModelList is then assigned to `this.data`.
@method _initDataProperty
@param {Array|ModelList|ArrayList} data Collection of data to populate the
DataTable
@protected
@since 3.6.0
**/
_initDataProperty: function (data) {
var recordType;
if (!this.data) {
recordType = this.get('recordType');
if (data && data.each && data.toJSON) {
this.data = data;
if (recordType) {
this.data.model = recordType;
}
} else {
// TODO: customize the ModelList or read the ModelList class
// from a configuration option?
this.data = new Y.ModelList();
if (recordType) {
this.data.model = recordType;
}
}
// TODO: Replace this with an event relay for specific events.
// Using bubbling causes subscription conflicts with the models'
// aggregated change event and 'change' events from DOM elements
// inside the table (via Widget UI event).
this.data.addTarget(this);
}
},
/**
Initializes the columns, `recordType` and data ModelList.
@method initializer
@param {Object} config Configuration object passed to constructor
@protected
@since 3.5.0
**/
initializer: function (config) {
var data = config.data,
columns = config.columns,
recordType;
// Referencing config.data to allow _setData to be more stringent
// about its behavior
this._initDataProperty(data);
// Default columns from recordType ATTRS if recordType is supplied at
// construction. If no recordType is supplied, but the data is
// supplied as a non-empty array, use the keys of the first item
// as the columns.
if (!columns) {
recordType = (config.recordType || config.data === this.data) &&
this.get('recordType');
if (recordType) {
columns = keys(recordType.ATTRS);
} else if (isArray(data) && data.length) {
columns = keys(data[0]);
}
if (columns) {
this.set('columns', columns);
}
}
this._initColumns();
this._eventHandles = {};
this._initCoreEvents();
},
/**
Iterates the array of column configurations to capture all columns with a
`key` property. An map is built with column keys as the property name and
the corresponding column object as the associated value. This map is then
assigned to the instance's `_columnMap` property.
@method _setColumnMap
@param {Object[]|String[]} columns The array of column config objects
@protected
@since 3.6.0
**/
_setColumnMap: function (columns) {
var map = {};
function process(cols) {
var i, len, col, key;
for (i = 0, len = cols.length; i < len; ++i) {
col = cols[i];
key = col.key;
// First in wins for multiple columns with the same key
// because the first call to genId (in _setColumns) will
// return the same key, which will then be overwritten by the
// subsequent same-keyed column. So table.getColumn(key) would
// return the last same-keyed column.
if (key && !map[key]) {
map[key] = col;
}
else {Y.log('Key of column matches existing key or name: ' + key, 'warn', NAME);}
if (map[col._id]) {Y.log('Key of column matches existing key or name: ' + col._id, 'warn', NAME);}
//TODO: named columns can conflict with keyed columns
map[col._id] = col;
if (col.children) {
process(col.children);
}
}
}
process(columns);
this._columnMap = map;
},
/**
Translates string columns into objects with that string as the value of its
`key` property.
All columns are assigned a `_yuid` stamp and `_id` property corresponding
to the column's configured `name` or `key` property with any spaces
replaced with dashes. If the same `name` or `key` appears in multiple
columns, subsequent appearances will have their `_id` appended with an
incrementing number (e.g. if column "foo" is included in the `columns`
attribute twice, the first will get `_id` of "foo", and the second an `_id`
of "foo1"). Columns that are children of other columns will have the
`_parent` property added, assigned the column object to which they belong.
@method _setColumns
@param {null|Object[]|String[]} val Array of config objects or strings
@return {null|Object[]}
@protected
**/
_setColumns: function (val) {
var keys = {},
known = [],
knownCopies = [],
arrayIndex = Y.Array.indexOf;
function copyObj(o) {
var copy = {},
key, val, i;
known.push(o);
knownCopies.push(copy);
for (key in o) {
if (o.hasOwnProperty(key)) {
val = o[key];
if (isArray(val)) {
copy[key] = val.slice();
} else if (isObject(val, true)) {
i = arrayIndex(known, val);
copy[key] = i === -1 ? copyObj(val) : knownCopies[i];
} else {
copy[key] = o[key];
}
}
}
return copy;
}
function genId(name) {
// Sanitize the name for use in generated CSS classes.
// TODO: is there more to do for other uses of _id?
name = name.replace(/\s+/, '-');
if (keys[name]) {
name += (keys[name]++);
} else {
keys[name] = 1;
}
return name;
}
function process(cols, parent) {
var columns = [],
i, len, col, yuid;
for (i = 0, len = cols.length; i < len; ++i) {
columns[i] = // chained assignment
col = isString(cols[i]) ? { key: cols[i] } : copyObj(cols[i]);
yuid = Y.stamp(col);
// For backward compatibility
if (!col.id) {
// Implementers can shoot themselves in the foot by setting
// this config property to a non-unique value
col.id = yuid;
}
if (col.field) {
// Field is now known as "name" to avoid confusion with data
// fields or schema.resultFields
col.name = col.field;
}
if (parent) {
col._parent = parent;
} else {
delete col._parent;
}
// Unique id based on the column's configured name or key,
// falling back to the yuid. Duplicates will have a counter
// added to the end.
col._id = genId(col.name || col.key || col.id);
if (isArray(col.children)) {
col.children = process(col.children, col);
}
}
return columns;
}
return val && process(val);
},
/**
Relays attribute assignments of the deprecated `columnset` attribute to the
`columns` attribute. If a Columnset is object is passed, its basic object
structure is mined.
@method _setColumnset
@param {Array|Columnset} val The columnset value to relay
@deprecated This will be removed with the deprecated `columnset` attribute
in a later version.
@protected
@since 3.5.0
**/
_setColumnset: function (val) {
this.set('columns', val);
return isArray(val) ? val : INVALID;
},
/**
Accepts an object with `each` and `getAttrs` (preferably a ModelList or
subclass) or an array of data objects. If an array is passes, it will
create a ModelList to wrap the data. In doing so, it will set the created
ModelList's `model` property to the class in the `recordType` attribute,
which will be defaulted if not yet set.
If the `data` property is already set with a ModelList, passing an array as
the value will call the ModelList's `reset()` method with that array rather
than replacing the stored ModelList wholesale.
Any non-ModelList-ish and non-array value is invalid.
@method _setData
@protected
@since 3.5.0
**/
_setData: function (val) {
if (val === null) {
val = [];
}
if (isArray(val)) {
this._initDataProperty();
// silent to prevent subscribers to both reset and dataChange
// from reacting to the change twice.
// TODO: would it be better to return INVALID to silence the
// dataChange event, or even allow both events?
this.data.reset(val, { silent: true });
// Return the instance ModelList to avoid storing unprocessed
// data in the state and their vivified Model representations in
// the instance's data property. Decreases memory consumption.
val = this.data;
} else if (!val || !val.each || !val.toJSON) {
// ModelList/ArrayList duck typing
val = INVALID;
}
return val;
},
/**
Relays the value assigned to the deprecated `recordset` attribute to the
`data` attribute. If a Recordset instance is passed, the raw object data
will be culled from it.
@method _setRecordset
@param {Object[]|Recordset} val The recordset value to relay
@deprecated This will be removed with the deprecated `recordset` attribute
in a later version.
@protected
@since 3.5.0
**/
_setRecordset: function (val) {
var data;
if (val && Y.Recordset && val instanceof Y.Recordset) {
data = [];
val.each(function (record) {
data.push(record.get('data'));
});
val = data;
}
this.set('data', val);
return val;
},
/**
Accepts a Base subclass (preferably a Model subclass). Alternately, it will
generate a custom Model subclass from an array of attribute names or an
object defining attributes and their respective configurations (it is
assigned as the `ATTRS` of the new class).
Any other value is invalid.
@method _setRecordType
@param {Function|String[]|Object} val The Model subclass, array of
attribute names, or the `ATTRS` definition for a custom model
subclass
@return {Function} A Base/Model subclass
@protected
@since 3.5.0
**/
_setRecordType: function (val) {
var modelClass;
// Duck type based on known/likely consumed APIs
if (isFunction(val) && val.prototype.toJSON && val.prototype.setAttrs) {
modelClass = val;
} else if (isObject(val)) {
modelClass = this._createRecordClass(val);
}
return modelClass || INVALID;
}
});
/**
_This is a documentation entry only_
Columns are described by object literals with a set of properties.
There is not an actual `DataTable.Column` class.
However, for the purpose of documenting it, this pseudo-class is declared here.
DataTables accept an array of column definitions in their [columns](DataTable.html#attr_columns)
attribute. Each entry in this array is a column definition which may contain
any combination of the properties listed below.
There are no mandatory properties though a column will usually have a
[key](#property_key) property to reference the data it is supposed to show.
The [columns](DataTable.html#attr_columns) attribute can accept a plain string
in lieu of an object literal, which is the equivalent of an object with the
[key](#property_key) property set to that string.
@class DataTable.Column
*/
/**
Binds the column values to the named property in the [data](DataTable.html#attr_data).
Optional if [formatter](#property_formatter), [nodeFormatter](#property_nodeFormatter),
or [cellTemplate](#property_cellTemplate) is used to populate the content.
It should not be set if [children](#property_children) is set.
The value is used for the [\_id](#property__id) property unless the [name](#property_name)
property is also set.
{ key: 'username' }
The above column definition can be reduced to this:
'username'
@property key
@type String
*/
/**
An identifier that can be used to locate a column via
[getColumn](DataTable.html#method_getColumn)
or style columns with class `yui3-datatable-col-NAME` after dropping characters
that are not valid for CSS class names.
It defaults to the [key](#property_key).
The value is used for the [\_id](#property__id) property.
{ name: 'fullname', formatter: ... }
@property name
@type String
*/
/**
An alias for [name](#property_name) for backward compatibility.
{ field: 'fullname', formatter: ... }
@property field
@type String
*/
/**
Overrides the default unique id assigned `<th id="HERE">`.
__Use this with caution__, since it can result in
duplicate ids in the DOM.
{
name: 'checkAll',
id: 'check-all',
label: ...
formatter: ...
}
@property id
@type String
*/
/**
HTML to populate the header `<th>` for the column.
It defaults to the value of the [key](#property_key) property or the text
`Column n` where _n_ is an ordinal number.
{ key: 'MfgvaPrtNum', label: 'Part Number' }
@property label
@type {String}
*/
/**
Used to create stacked headers.
Child columns may also contain `children`. There is no limit
to the depth of nesting.
Columns configured with `children` are for display only and
<strong>should not</strong> be configured with a [key](#property_key).
Configurations relating to the display of data, such as
[formatter](#property_formatter), [nodeFormatter](#property_nodeFormatter),
[emptyCellValue](#property_emptyCellValue), etc. are ignored.
{ label: 'Name', children: [
{ key: 'firstName', label: 'First`},
{ key: 'lastName', label: 'Last`}
]}
@property children
@type Array
*/
/**
Assigns the value `<th abbr="HERE">`.
{
key : 'forecast',
label: '1yr Target Forecast',
abbr : 'Forecast'
}
@property abbr
@type String
*/
/**
Assigns the value `<th title="HERE">`.
{
key : 'forecast',
label: '1yr Target Forecast',
title: 'Target Forecast for the Next 12 Months'
}
@property title
@type String
*/
/**
Overrides the default [CELL_TEMPLATE](DataTable.HeaderView.html#property_CELL_TEMPLATE)
used by `Y.DataTable.HeaderView` to render the header cell
for this column. This is necessary when more control is
needed over the markup for the header itself, rather than
its content.
Use the [label](#property_label) configuration if you don't need to
customize the `<th>` iteself.
Implementers are strongly encouraged to preserve at least
the `{id}` and `{_id}` placeholders in the custom value.
{
headerTemplate:
'<th id="{id}" ' +
'title="Unread" ' +
'class="{className}" ' +
'{_id}>●</th>'
}
@property headerTemplate
@type HTML
*/
/**
Overrides the default [CELL_TEMPLATE](DataTable.BodyView.html#property_CELL_TEMPLATE)
used by `Y.DataTable.BodyView` to render the data cells
for this column. This is necessary when more control is
needed over the markup for the `<td>` itself, rather than
its content.
{
key: 'id',
cellTemplate:
'<td class="{className}">' +
'<input type="checkbox" ' +
'id="{content}">' +
'</td>'
}
@property cellTemplate
@type String
*/
/**
String or function used to translate the raw record data for each cell in a
given column into a format better suited to display.
If it is a string, it will initially be assumed to be the name of one of the
formatting functions in
[Y.DataTable.BodyView.Formatters](DataTable.BodyView.Formatters.html).
If one such formatting function exists, it will be used.
If no such named formatter is found, it will be assumed to be a template
string and will be expanded. The placeholders can contain the key to any
field in the record or the placeholder `{value}` which represents the value
of the current field.
If the value is a function, it will be assumed to be a formatting function.
A formatting function receives a single argument, an object with the following properties:
* __value__ The raw value from the record Model to populate this cell.
Equivalent to `o.record.get(o.column.key)` or `o.data[o.column.key]`.
* __data__ The Model data for this row in simple object format.
* __record__ The Model for this row.
* __column__ The column configuration object.
* __className__ A string of class names to add `<td class="HERE">` in addition to
the column class and any classes in the column's className configuration.
* __rowIndex__ The index of the current Model in the ModelList.
Typically correlates to the row index as well.
* __rowClass__ A string of css classes to add `<tr class="HERE"><td....`
This is useful to avoid the need for nodeFormatters to add classes to the containing row.
The formatter function may return a string value that will be used for the cell
contents or it may change the value of the `value`, `className` or `rowClass`
properties which well then be used to format the cell. If the value for the cell
is returned in the `value` property of the input argument, no value should be returned.
{
key: 'name',
formatter: 'link', // named formatter
linkFrom: 'website' // extra column property for link formatter
},
{
key: 'cost',
formatter: '${value}' // formatter template string
//formatter: '${cost}' // same result but less portable
},
{
name: 'Name', // column does not have associated field value
// thus, it uses name instead of key
formatter: '{firstName} {lastName}' // template references other fields
},
{
key: 'price',
formatter: function (o) { // function both returns a string to show
if (o.value > 3) { // and a className to apply to the cell
o.className += 'expensive';
}
return '$' + o.value.toFixed(2);
}
},
@property formatter
@type String || Function
*/
/**
Used to customize the content of the data cells for this column.
`nodeFormatter` is significantly slower than [formatter](#property_formatter)
and should be avoided if possible. Unlike [formatter](#property_formatter),
`nodeFormatter` has access to the `<td>` element and its ancestors.
The function provided is expected to fill in the `<td>` element itself.
__Node formatters should return `false`__ except in certain conditions as described
in the users guide.
The function receives a single object
argument with the following properties:
* __td__ The `<td>` Node for this cell.
* __cell__ If the cell `<td> contains an element with class `yui3-datatable-liner,
this will refer to that Node. Otherwise, it is equivalent to `td` (default behavior).
* __value__ The raw value from the record Model to populate this cell.
Equivalent to `o.record.get(o.column.key)` or `o.data[o.column.key]`.
* __data__ The Model data for this row in simple object format.
* __record__ The Model for this row.
* __column__ The column configuration object.
* __rowIndex__ The index of the current Model in the ModelList.
_Typically_ correlates to the row index as well.
@example
nodeFormatter: function (o) {
if (o.value < o.data.quota) {
o.td.setAttribute('rowspan', 2);
o.td.setAttribute('data-term-id', this.record.get('id'));
o.td.ancestor().insert(
'<tr><td colspan"3">' +
'<button class="term">terminate</button>' +
'</td></tr>',
'after');
}
o.cell.setHTML(o.value);
return false;
}
@property nodeFormatter
@type Function
*/
/**
Provides the default value to populate the cell if the data
for that cell is `undefined`, `null`, or an empty string.
{
key: 'price',
emptyCellValue: '???'
}
@property emptyCellValue
@type {String} depending on the setting of allowHTML
*/
/**
Skips the security step of HTML escaping the value for cells
in this column.
This is also necessary if [emptyCellValue](#property_emptyCellValue)
is set with an HTML string.
`nodeFormatter`s ignore this configuration. If using a
`nodeFormatter`, it is recommended to use
[Y.Escape.html()](Escape.html#method_html)
on any user supplied content that is to be displayed.
{
key: 'preview',
allowHTML: true
}
@property allowHTML
@type Boolean
*/
/**
A string of CSS classes that will be added to the `<td>`'s
`class` attribute.
Note, all cells will automatically have a class in the
form of "yui3-datatable-col-XXX" added to the `<td>`, where
XXX is the column's configured `name`, `key`, or `id` (in
that order of preference) sanitized from invalid characters.
{
key: 'symbol',
className: 'no-hide'
}
@property className
@type String
*/
/**
(__read-only__) The unique identifier assigned
to each column. This is used for the `id` if not set, and
the `_id` if none of [name](#property_name),
[field](#property_field), [key](#property_key), or [id](#property_id) are
set.
@property _yuid
@type String
@protected
*/
/**
(__read-only__) A unique-to-this-instance name
used extensively in the rendering process. It is also used
to create the column's classname, as the input name
`table.getColumn(HERE)`, and in the column header's
`<th data-yui3-col-id="HERE">`.
The value is populated by the first of [name](#property_name),
[field](#property_field), [key](#property_key), [id](#property_id),
or [_yuid](#property__yuid) to have a value. If that value
has already been used (such as when multiple columns have
the same `key`), an incrementer is added to the end. For
example, two columns with `key: "id"` will have `_id`s of
"id" and "id2". `table.getColumn("id")` will return the
first column, and `table.getColumn("id2")` will return the
second.
@property _id
@type String
@protected
*/
/**
(__read-only__) Used by
`Y.DataTable.HeaderView` when building stacked column
headers.
@property _colspan
@type Integer
@protected
*/
/**
(__read-only__) Used by
`Y.DataTable.HeaderView` when building stacked column
headers.
@property _rowspan
@type Integer
@protected
*/
/**
(__read-only__) Assigned to all columns in a
column's `children` collection. References the parent
column object.
@property _parent
@type DataTable.Column
@protected
*/
/**
(__read-only__) Array of the `id`s of the
column and all parent columns. Used by
`Y.DataTable.BodyView` to populate `<td headers="THIS">`
when a cell references more than one header.
@property _headers
@type Array
@protected
*/
}, '3.15.0', {"requires": ["escape", "model-list", "node-event-delegate"]});
|
src/components/center/inputs/name.input.js | Conservationist/HexNow | import React from 'react';
import firebase from 'firebase';
import {INPUT, Fade} from '../../_themes/text.style';
import {DIV, H1} from './input.style'
class NameInput extends React.Component {
constructor(props){
super(props)
this.state = {
user_name: null,
};
this.handleSubmit = this.handleSubmit.bind(this);
this.handleChange = this.handleChange.bind(this);
}
handleSubmit(e){
e.preventDefault(e);
let user_id = this.props.userid
let displayname = this.state.user_name
firebase.database().ref("users/" + user_id + '/').update({display_name: displayname});
}
handleChange(e){
this.setState({
user_name: e.target.value
})
}
render(){
console.log(this.state.user_name)
return(
<DIV on={this.state.visability}>
<H1>Please enter a display name.</H1>
<br />
<Fade>
<form onSubmit={this.handleSubmit}>
<INPUT type="text" onChange={this.handleChange}/>
</form>
</Fade>
</DIV>
)
}
}
export default NameInput; |
imports/ui/pages/NotificationPage/NotificationPage.js | jamiebones/Journal_Publication | import React from 'react';
import PropTypes from 'prop-types';
import { Table, Alert, Button , Label , Row , Col } from 'react-bootstrap';
import Notification from '../../components/Notification/Notification';
const NotificationPage = () => (
<div>
<Row>
<Col sm={8} smOffset={2} md={8} mdOffset={2}>
<Notification />
</Col>
</Row>
</div>
);
export default NotificationPage;
|
webshop/sites/all/modules/jquery_update/replace/jquery/1.7/jquery.js | cooper-webdesign/cooper.dk | /*!
* jQuery JavaScript Library v1.7.2
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Wed Mar 21 12:46:34 2012 -0700
*/
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
navigator = window.navigator,
location = window.location;
var jQuery = (function() {
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// A central reference to the root jQuery(document)
rootjQuery,
// A simple way to check for HTML strings or ID strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
// Used for trimming whitespace
trimLeft = /^\s+/,
trimRight = /\s+$/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
// Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
// Matches dashed string for camelizing
rdashAlpha = /-([a-z]|[0-9])/ig,
rmsPrefix = /^-ms-/,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase();
},
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
// For matching the engine and version of the browser
browserMatch,
// The deferred used on DOM ready
readyList,
// The ready event handler
DOMContentLoaded,
// Save a reference to some core methods
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// The body element only exists once, optimize finding it
if ( selector === "body" && !context && document.body ) {
this.context = document;
this[0] = document.body;
this.selector = selector;
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = quickExpr.exec( selector );
}
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
doc = ( context ? context.ownerDocument || context : document );
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
ret = rsingleTag.exec( selector );
if ( ret ) {
if ( jQuery.isPlainObject( context ) ) {
selector = [ document.createElement( ret[1] ) ];
jQuery.fn.attr.call( selector, context, true );
} else {
selector = [ doc.createElement( ret[1] ) ];
}
} else {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
}
return jQuery.merge( this, selector );
// HANDLE: $("#id")
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.7.2",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return slice.call( this, 0 );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = this.constructor();
if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems );
} else {
jQuery.merge( ret, elems );
}
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Attach the listeners
jQuery.bindReady();
// Add the callback
readyList.add( fn );
return this;
},
eq: function( i ) {
i = +i;
return i === -1 ?
this.slice( i ) :
this.slice( i, i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ),
"slice", slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Either a released hold or an DOMready/load event and not yet ready
if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.fireWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger( "ready" ).off( "ready" );
}
}
},
bindReady: function() {
if ( readyList ) {
return;
}
readyList = jQuery.Callbacks( "once memory" );
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout( jQuery.ready, 1 );
}
// Mozilla, Opera and webkit nightlies currently support this event
if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
// If IE event model is used
} else if ( document.attachEvent ) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", DOMContentLoaded );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
// If IE and not a frame
// continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
if ( document.documentElement.doScroll && toplevel ) {
doScrollCheck();
}
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
isWindow: function( obj ) {
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call(obj, "constructor") &&
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
var xml, tmp;
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction( object );
if ( args ) {
if ( isObj ) {
for ( name in object ) {
if ( callback.apply( object[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( object[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in object ) {
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
break;
}
}
}
}
return object;
},
// Use native String.trim function wherever possible
trim: trim ?
function( text ) {
return text == null ?
"" :
trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
},
// results is for internal usage only
makeArray: function( array, results ) {
var ret = results || [];
if ( array != null ) {
// The window, strings (and functions) also have 'length'
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type( array );
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
} else {
jQuery.merge( ret, array );
}
}
return ret;
},
inArray: function( elem, array, i ) {
var len;
if ( array ) {
if ( indexOf ) {
return indexOf.call( array, elem, i );
}
len = array.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in array && array[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var i = first.length,
j = 0;
if ( typeof second.length === "number" ) {
for ( var l = second.length; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var ret = [], retVal;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value, key, ret = [],
i = 0,
length = elems.length,
// jquery objects are treated as arrays
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( key in elems ) {
value = callback( elems[ key ], key, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
if ( typeof context === "string" ) {
var tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
var args = slice.call( arguments, 2 ),
proxy = function() {
return fn.apply( context, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
return proxy;
},
// Mutifunctional method to get and set values to a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
var exec,
bulk = key == null,
i = 0,
length = elems.length;
// Sets many values
if ( key && typeof key === "object" ) {
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
}
chainable = 1;
// Sets one value
} else if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = pass === undefined && jQuery.isFunction( value );
if ( bulk ) {
// Bulk operations only iterate when executing function values
if ( exec ) {
exec = fn;
fn = function( elem, key, value ) {
return exec.call( jQuery( elem ), value );
};
// Otherwise they run against the entire set
} else {
fn.call( elems, value );
fn = null;
}
}
if ( fn ) {
for (; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
}
chainable = 1;
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
},
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
uaMatch: function( ua ) {
ua = ua.toLowerCase();
var match = rwebkit.exec( ua ) ||
ropera.exec( ua ) ||
rmsie.exec( ua ) ||
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
[];
return { browser: match[1] || "", version: match[2] || "0" };
},
sub: function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
return jQuerySub;
},
browser: {}
});
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
browserMatch = jQuery.uaMatch( userAgent );
if ( browserMatch.browser ) {
jQuery.browser[ browserMatch.browser ] = true;
jQuery.browser.version = browserMatch.version;
}
// Deprecated, use jQuery.browser.webkit instead
if ( jQuery.browser.webkit ) {
jQuery.browser.safari = true;
}
// IE doesn't match non-breaking spaces with \s
if ( rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// Cleanup functions for the document ready method
if ( document.addEventListener ) {
DOMContentLoaded = function() {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
};
} else if ( document.attachEvent ) {
DOMContentLoaded = function() {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( document.readyState === "complete" ) {
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
};
}
// The DOM ready check for Internet Explorer
function doScrollCheck() {
if ( jQuery.isReady ) {
return;
}
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch(e) {
setTimeout( doScrollCheck, 1 );
return;
}
// and execute any waiting functions
jQuery.ready();
}
return jQuery;
})();
// String to Object flags format cache
var flagsCache = {};
// Convert String-formatted flags into Object-formatted ones and store in cache
function createFlags( flags ) {
var object = flagsCache[ flags ] = {},
i, length;
flags = flags.split( /\s+/ );
for ( i = 0, length = flags.length; i < length; i++ ) {
object[ flags[i] ] = true;
}
return object;
}
/*
* Create a callback list using the following parameters:
*
* flags: an optional list of space-separated flags that will change how
* the callback list behaves
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible flags:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( flags ) {
// Convert flags from String-formatted to Object-formatted
// (we check in cache first)
flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
var // Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = [],
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Add one or several callbacks to the list
add = function( args ) {
var i,
length,
elem,
type,
actual;
for ( i = 0, length = args.length; i < length; i++ ) {
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
// Inspect recursively
add( elem );
} else if ( type === "function" ) {
// Add if not in unique mode and callback is not in
if ( !flags.unique || !self.has( elem ) ) {
list.push( elem );
}
}
}
},
// Fire callbacks
fire = function( context, args ) {
args = args || [];
memory = !flags.memory || [ context, args ];
fired = true;
firing = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
memory = true; // Mark as halted
break;
}
}
firing = false;
if ( list ) {
if ( !flags.once ) {
if ( stack && stack.length ) {
memory = stack.shift();
self.fireWith( memory[ 0 ], memory[ 1 ] );
}
} else if ( memory === true ) {
self.disable();
} else {
list = [];
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
var length = list.length;
add( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away, unless previous
// firing was halted (stopOnFalse)
} else if ( memory && memory !== true ) {
firingStart = length;
fire( memory[ 0 ], memory[ 1 ] );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
var args = arguments,
argIndex = 0,
argLength = args.length;
for ( ; argIndex < argLength ; argIndex++ ) {
for ( var i = 0; i < list.length; i++ ) {
if ( args[ argIndex ] === list[ i ] ) {
// Handle firingIndex and firingLength
if ( firing ) {
if ( i <= firingLength ) {
firingLength--;
if ( i <= firingIndex ) {
firingIndex--;
}
}
}
// Remove the element
list.splice( i--, 1 );
// If we have some unicity property then
// we only need to do this once
if ( flags.unique ) {
break;
}
}
}
}
}
return this;
},
// Control if a given callback is in the list
has: function( fn ) {
if ( list ) {
var i = 0,
length = list.length;
for ( ; i < length; i++ ) {
if ( fn === list[ i ] ) {
return true;
}
}
}
return false;
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory || memory === true ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( stack ) {
if ( firing ) {
if ( !flags.once ) {
stack.push( [ context, args ] );
}
} else if ( !( flags.once && memory ) ) {
fire( context, args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
var // Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({
Deferred: function( func ) {
var doneList = jQuery.Callbacks( "once memory" ),
failList = jQuery.Callbacks( "once memory" ),
progressList = jQuery.Callbacks( "memory" ),
state = "pending",
lists = {
resolve: doneList,
reject: failList,
notify: progressList
},
promise = {
done: doneList.add,
fail: failList.add,
progress: progressList.add,
state: function() {
return state;
},
// Deprecated
isResolved: doneList.fired,
isRejected: failList.fired,
then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
return this;
},
always: function() {
deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
return this;
},
pipe: function( fnDone, fnFail, fnProgress ) {
return jQuery.Deferred(function( newDefer ) {
jQuery.each( {
done: [ fnDone, "resolve" ],
fail: [ fnFail, "reject" ],
progress: [ fnProgress, "notify" ]
}, function( handler, data ) {
var fn = data[ 0 ],
action = data[ 1 ],
returned;
if ( jQuery.isFunction( fn ) ) {
deferred[ handler ](function() {
returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {
deferred[ handler ]( newDefer[ action ] );
}
});
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
if ( obj == null ) {
obj = promise;
} else {
for ( var key in promise ) {
obj[ key ] = promise[ key ];
}
}
return obj;
}
},
deferred = promise.promise({}),
key;
for ( key in lists ) {
deferred[ key ] = lists[ key ].fire;
deferred[ key + "With" ] = lists[ key ].fireWith;
}
// Handle state
deferred.done( function() {
state = "resolved";
}, failList.disable, progressList.lock ).fail( function() {
state = "rejected";
}, doneList.disable, progressList.lock );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( firstParam ) {
var args = sliceDeferred.call( arguments, 0 ),
i = 0,
length = args.length,
pValues = new Array( length ),
count = length,
pCount = length,
deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
firstParam :
jQuery.Deferred(),
promise = deferred.promise();
function resolveFunc( i ) {
return function( value ) {
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
if ( !( --count ) ) {
deferred.resolveWith( deferred, args );
}
};
}
function progressFunc( i ) {
return function( value ) {
pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
deferred.notifyWith( promise, pValues );
};
}
if ( length > 1 ) {
for ( ; i < length; i++ ) {
if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
} else {
--count;
}
}
if ( !count ) {
deferred.resolveWith( deferred, args );
}
} else if ( deferred !== firstParam ) {
deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
}
return promise;
}
});
jQuery.support = (function() {
var support,
all,
a,
select,
opt,
input,
fragment,
tds,
events,
eventName,
i,
isSupported,
div = document.createElement( "div" ),
documentElement = document.documentElement;
// Preliminary tests
div.setAttribute("className", "t");
div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
all = div.getElementsByTagName( "*" );
a = div.getElementsByTagName( "a" )[ 0 ];
// Can't get basic test support
if ( !all || !all.length || !a ) {
return {};
}
// First batch of supports tests
select = document.createElement( "select" );
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName( "input" )[ 0 ];
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: ( a.getAttribute("href") === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.55/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Tests for enctype support on a form(#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true,
pixelMargin: true
};
// jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.attachEvent( "onclick", function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent( "onclick" );
}
// Check if a radio maintains its value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute("type", "radio");
support.radioValue = input.value === "t";
input.setAttribute("checked", "checked");
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "name", "t" );
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.lastChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
fragment.removeChild( input );
fragment.appendChild( div );
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for ( i in {
submit: 1,
change: 1,
focusin: 1
}) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
fragment.removeChild( div );
// Null elements to avoid leaks in IE
fragment = select = opt = div = input = null;
// Run tests that need a body at doc ready
jQuery(function() {
var container, outer, inner, table, td, offsetSupport,
marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
paddingMarginBorderVisibility, paddingMarginBorder,
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
conMarginTop = 1;
paddingMarginBorder = "padding:0;margin:0;border:";
positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +
"<table " + style + "' cellpadding='0' cellspacing='0'>" +
"<tr><td></td></tr></table>";
container = document.createElement("div");
container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
body.insertBefore( container, body.firstChild );
// Construct the test element
div = document.createElement("div");
container.appendChild( div );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";
tds = div.getElementsByTagName( "td" );
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE <= 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( window.getComputedStyle ) {
div.innerHTML = "";
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.style.width = "2px";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
if ( typeof div.style.zoom !== "undefined" ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.innerHTML = "";
div.style.width = div.style.padding = "1px";
div.style.border = 0;
div.style.overflow = "hidden";
div.style.display = "inline";
div.style.zoom = 1;
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "block";
div.style.overflow = "visible";
div.innerHTML = "<div style='width:5px;'></div>";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
}
div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
div.innerHTML = html;
outer = div.firstChild;
inner = outer.firstChild;
td = outer.nextSibling.firstChild.firstChild;
offsetSupport = {
doesNotAddBorder: ( inner.offsetTop !== 5 ),
doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
};
inner.style.position = "fixed";
inner.style.top = "20px";
// safari subtracts parent border width here which is 5px
offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
inner.style.position = inner.style.top = "";
outer.style.overflow = "hidden";
outer.style.position = "relative";
offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
if ( window.getComputedStyle ) {
div.style.marginTop = "1%";
support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";
}
if ( typeof container.style.zoom !== "undefined" ) {
container.style.zoom = 1;
}
body.removeChild( container );
marginDiv = div = container = null;
jQuery.extend( support, offsetSupport );
});
return support;
})();
var rbrace = /^(?:\{.*\}|\[.*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
// Please use with caution
uuid: 0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var privateCache, thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
isEvents = name === "events";
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = ++jQuery.uuid;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
privateCache = thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Users should not attempt to inspect the internal events object using jQuery.data,
// it is undocumented and subject to change. But does anyone listen? No.
if ( isEvents && !thisCache[ name ] ) {
return privateCache.events;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i, l,
// Reference to internal data cache key
internalKey = jQuery.expando,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
// See jQuery.data for more information
id = isNode ? elem[ internalKey ] : internalKey;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split( " " );
}
}
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject(cache[ id ]) ) {
return;
}
}
// Browsers that fail expando deletion also refuse to delete expandos on
// the window, but it will allow it on all other JS objects; other browsers
// don't care
// Ensure that `cache` is not a window object #10080
if ( jQuery.support.deleteExpando || !cache.setInterval ) {
delete cache[ id ];
} else {
cache[ id ] = null;
}
// We destroyed the cache and need to eliminate the expando on the node to avoid
// false lookups in the cache for entries that no longer exist
if ( isNode ) {
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( jQuery.support.deleteExpando ) {
delete elem[ internalKey ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
}
},
// For internal use only.
_data: function( elem, name, data ) {
return jQuery.data( elem, name, data, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
if ( elem.nodeName ) {
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
if ( match ) {
return !(match === true || elem.getAttribute("classid") !== match);
}
}
return true;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var parts, part, attr, name, l,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attr = elem.attributes;
for ( l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
parts = key.split( ".", 2 );
parts[1] = parts[1] ? "." + parts[1] : "";
part = parts[1] + "!";
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
data = this.triggerHandler( "getData" + part, [ parts[0] ] );
// Try to fetch any internally stored data first
if ( data === undefined && elem ) {
data = jQuery.data( elem, key );
data = dataAttr( elem, key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
}
parts[1] = value;
this.each(function() {
var self = jQuery( this );
self.triggerHandler( "setData" + part, parts );
jQuery.data( this, key, value );
self.triggerHandler( "changeData" + part, parts );
});
}, null, value, arguments.length > 1, null, false );
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
jQuery.isNumeric( data ) ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
for ( var name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
function handleQueueMarkDefer( elem, type, src ) {
var deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
defer = jQuery._data( elem, deferDataKey );
if ( defer &&
( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
// Give room for hard-coded callbacks to fire first
// and eventually mark/queue something else on the element
setTimeout( function() {
if ( !jQuery._data( elem, queueDataKey ) &&
!jQuery._data( elem, markDataKey ) ) {
jQuery.removeData( elem, deferDataKey, true );
defer.fire();
}
}, 0 );
}
}
jQuery.extend({
_mark: function( elem, type ) {
if ( elem ) {
type = ( type || "fx" ) + "mark";
jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
}
},
_unmark: function( force, elem, type ) {
if ( force !== true ) {
type = elem;
elem = force;
force = false;
}
if ( elem ) {
type = type || "fx";
var key = type + "mark",
count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
if ( count ) {
jQuery._data( elem, key, count );
} else {
jQuery.removeData( elem, key, true );
handleQueueMarkDefer( elem, type, "mark" );
}
}
},
queue: function( elem, type, data ) {
var q;
if ( elem ) {
type = ( type || "fx" ) + "queue";
q = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !q || jQuery.isArray(data) ) {
q = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
q.push( data );
}
}
return q || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
hooks = {};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
jQuery._data( elem, type + ".run", hooks );
fn.call( elem, function() {
jQuery.dequeue( elem, type );
}, hooks );
}
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue " + type + ".run", true );
handleQueueMarkDefer( elem, type, "queue" );
}
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
i = elements.length,
count = 1,
deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
tmp;
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
count++;
tmp.add( resolve );
}
}
resolve();
return defer.promise( object );
}
});
var rclass = /[\n\t\r]/g,
rspace = /\s+/,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
nodeHook, boolHook, fixSpecified;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classNames, i, l, elem, className, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
classNames = ( value || "" ).split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
className = (" " + elem.className + " ").replace( rclass, " " );
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[ c ] + " ", " ");
}
elem.className = jQuery.trim( className );
} else {
elem.className = "";
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var self = jQuery(this), val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, i, max, option,
index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type === "select-one";
// Nothing was selected
if ( index < 0 ) {
return null;
}
// Loop through all the selected options
i = one ? index : 0;
max = one ? index + 1 : options.length;
for ( ; i < max; i++ ) {
option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
if ( one && !values.length && options.length ) {
return jQuery( options[ index ] ).val();
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attrFn: {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
height: true,
offset: true
},
attr: function( elem, name, value, pass ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, "" + value );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var propName, attrNames, name, l, isBool,
i = 0;
if ( value && elem.nodeType === 1 ) {
attrNames = value.toLowerCase().split( rspace );
l = attrNames.length;
for ( ; i < l; i++ ) {
name = attrNames[ i ];
if ( name ) {
propName = jQuery.propFix[ name ] || name;
isBool = rboolean.test( name );
// See #9699 for explanation of this approach (setting first, then removal)
// Do not do this for boolean attributes (see #10870)
if ( !isBool ) {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
// Set corresponding property to false for boolean attributes
if ( isBool && propName in elem ) {
elem[ propName ] = false;
}
}
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
fixSpecified = {
name: true,
id: true,
coords: true
};
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
ret.nodeValue :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
return ( ret.nodeValue = value + "" );
}
};
// Apply the nodeHook to tabindex
jQuery.attrHooks.tabindex.set = nodeHook.set;
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
if ( value === "" ) {
value = "false";
}
nodeHook.set( elem, value, name );
}
};
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = "" + value );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:textarea|input|select)$/i,
rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
rhoverHack = /(?:^|\s)hover(\.\S+)?\b/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
quickParse = function( selector ) {
var quick = rquickIs.exec( selector );
if ( quick ) {
// 0 1 2 3
// [ _, tag, id, class ]
quick[1] = ( quick[1] || "" ).toLowerCase();
quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
}
return quick;
},
quickIs = function( elem, m ) {
var attrs = elem.attributes || {};
return (
(!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
(!m[2] || (attrs.id || {}).value === m[2]) &&
(!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
);
},
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
add: function( elem, types, handler, data, selector ) {
var elemData, eventHandle, events,
t, tns, type, namespaces, handleObj,
handleObjIn, quick, handlers, special;
// Don't attach events to noData or text/comment nodes (allow plain objects tho)
if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
events = elemData.events;
if ( !events ) {
elemData.events = events = {};
}
eventHandle = elemData.handle;
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = jQuery.trim( hoverHack(types) ).split( " " );
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = ( tns[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: tns[1],
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
quick: selector && quickParse( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
handlers = events[ type ];
if ( !handlers ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
t, tns, type, origType, namespaces, origCount,
j, events, special, handle, eventType, handleObj;
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = origType = tns[1];
namespaces = tns[2];
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector? special.delegateType : special.bindType ) || type;
eventType = events[ type ] || [];
origCount = eventType.length;
namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
// Remove matching events
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !namespaces || namespaces.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
eventType.splice( j--, 1 );
if ( handleObj.selector ) {
eventType.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( eventType.length === 0 && origCount !== eventType.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
handle = elemData.handle;
if ( handle ) {
handle.elem = null;
}
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery.removeData( elem, [ "events", "handle" ], true );
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Don't do events on text and comment nodes
if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
return;
}
// Event object or event type
var type = event.type || event,
namespaces = [],
cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "!" ) >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf( "." ) >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.isTrigger = true;
event.exclusive = exclusive;
event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
cache = jQuery.cache;
for ( i in cache ) {
if ( cache[ i ].events && cache[ i ].events[ type ] ) {
jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
}
}
return;
}
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
eventPath = [[ elem, special.bindType || type ]];
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
old = null;
for ( ; cur; cur = cur.parentNode ) {
eventPath.push([ cur, bubbleType ]);
old = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( old && old === elem.ownerDocument ) {
eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
}
}
// Fire handlers on the event path
for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
cur = eventPath[i][0];
event.type = eventPath[i][1];
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Note that this is a bare JS function and not a jQuery handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486)
if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( old ) {
elem[ ontype ] = old;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event );
var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount,
args = [].slice.call( arguments, 0 ),
run_all = !event.exclusive && !event.namespace,
special = jQuery.event.special[ event.type ] || {},
handlerQueue = [],
i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers that should run if there are delegated events
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !(event.button && event.type === "click") ) {
// Pregenerate a single jQuery object for reuse with .is()
jqcur = jQuery(this);
jqcur.context = this.ownerDocument || this;
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
// Don't process events on disabled elements (#6911, #8165)
if ( cur.disabled !== true ) {
selMatch = {};
matches = [];
jqcur[0] = cur;
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
sel = handleObj.selector;
if ( selMatch[ sel ] === undefined ) {
selMatch[ sel ] = (
handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
);
}
if ( selMatch[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, matches: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( handlers.length > delegateCount ) {
handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
}
// Run delegates first; they may want to stop propagation beneath us
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
// Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var eventDoc, doc, body,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop,
originalEvent = event,
fixHook = jQuery.event.fixHooks[ event.type ] || {},
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = jQuery.Event( originalEvent );
for ( i = copy.length; i; ) {
prop = copy[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Target should not be a text node (#504, Safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
if ( event.metaKey === undefined ) {
event.metaKey = event.ctrlKey;
}
return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
special: {
ready: {
// Make sure the ready event is setup
setup: jQuery.bindReady
},
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
delegateType: "focusin"
},
blur: {
delegateType: "focusout"
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle = jQuery.event.dispatch;
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
if ( elem.detachEvent ) {
elem.detachEvent( "on" + type, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var target = this,
related = event.relatedTarget,
handleObj = event.handleObj,
selector = handleObj.selector,
ret;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !form._submit_attached ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
form._submit_attached = true;
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
jQuery.event.simulate( "change", this, event, true );
}
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
elem._change_attached = true;
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) { // && selector != null
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
var handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( var type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
live: function( types, data, fn ) {
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
},
die: function( types, fn ) {
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
if ( jQuery.attrFn ) {
jQuery.attrFn[ name ] = true;
}
if ( rkeyEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
}
if ( rmouseEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
expando = "sizcache" + (Math.random() + '').replace('.', ''),
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
baseHasDuplicate = true,
rBackslash = /\\/g,
rReturn = /\r\n/g,
rNonWord = /\W/;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function() {
baseHasDuplicate = false;
return 0;
});
var Sizzle = function( selector, context, results, seed ) {
results = results || [];
context = context || document;
var origContext = context;
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var m, set, checkSet, extra, ret, cur, pop, i,
prune = true,
contextXML = Sizzle.isXML( context ),
parts = [],
soFar = selector;
// Reset the position of the chunker regexp (start from head)
do {
chunker.exec( "" );
m = chunker.exec( soFar );
if ( m ) {
soFar = m[3];
parts.push( m[1] );
if ( m[2] ) {
extra = m[3];
break;
}
}
} while ( m );
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context, seed );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] ) {
selector += parts.shift();
}
set = posProcess( selector, set, seed );
}
}
} else {
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ?
Sizzle.filter( ret.expr, ret.set )[0] :
ret.set[0];
}
if ( context ) {
ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ?
Sizzle.filter( ret.expr, ret.set ) :
ret.set;
if ( parts.length > 0 ) {
checkSet = makeArray( set );
} else {
prune = false;
}
while ( parts.length ) {
cur = parts.pop();
pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
} else {
checkSet = parts = [];
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
Sizzle.error( cur || selector );
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context && context.nodeType === 1 ) {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}
return results;
};
Sizzle.uniqueSort = function( results ) {
if ( sortOrder ) {
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[ i - 1 ] ) {
results.splice( i--, 1 );
}
}
}
}
return results;
};
Sizzle.matches = function( expr, set ) {
return Sizzle( expr, null, null, set );
};
Sizzle.matchesSelector = function( node, expr ) {
return Sizzle( expr, null, null, [node] ).length > 0;
};
Sizzle.find = function( expr, context, isXML ) {
var set, i, len, match, type, left;
if ( !expr ) {
return [];
}
for ( i = 0, len = Expr.order.length; i < len; i++ ) {
type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
left = match[1];
match.splice( 1, 1 );
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace( rBackslash, "" );
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( "*" ) :
[];
}
return { set: set, expr: expr };
};
Sizzle.filter = function( expr, set, inplace, not ) {
var match, anyFound,
type, found, item, filter, left,
i, pass,
old = expr,
result = [],
curLoop = set,
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
while ( expr && set.length ) {
for ( type in Expr.filter ) {
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
filter = Expr.filter[ type ];
left = match[1];
anyFound = false;
match.splice(1,1);
if ( left.substr( left.length - 1 ) === "\\" ) {
continue;
}
if ( curLoop === result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
pass = not ^ found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curLoop;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Utility function for retreiving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
var getText = Sizzle.getText = function( elem ) {
var i, node,
nodeType = elem.nodeType,
ret = "";
if ( nodeType ) {
if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent || innerText for elements
if ( typeof elem.textContent === 'string' ) {
return elem.textContent;
} else if ( typeof elem.innerText === 'string' ) {
// Replace IE's carriage returns
return elem.innerText.replace( rReturn, '' );
} else {
// Traverse it's children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
} else {
// If no nodeType, this is expected to be an array
for ( i = 0; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
if ( node.nodeType !== 8 ) {
ret += getText( node );
}
}
}
return ret;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function( elem ) {
return elem.getAttribute( "href" );
},
type: function( elem ) {
return elem.getAttribute( "type" );
}
},
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !rNonWord.test( part ),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
if ( isPartStr && !rNonWord.test( part ) ) {
part = part.toLowerCase();
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
} else {
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
},
"~": function( checkSet, part, isXML ) {
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
}
},
find: {
ID: function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
},
NAME: function( match, context ) {
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [],
results = context.getElementsByName( match[1] );
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function( match, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( match[1] );
}
}
},
preFilter: {
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
match = " " + match[1].replace( rBackslash, "" ) + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
if ( !inplace ) {
result.push( elem );
}
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function( match ) {
return match[1].replace( rBackslash, "" );
},
TAG: function( match, curLoop ) {
return match[1].replace( rBackslash, "" ).toLowerCase();
},
CHILD: function( match ) {
if ( match[1] === "nth" ) {
if ( !match[2] ) {
Sizzle.error( match[0] );
}
match[2] = match[2].replace(/^\+|\s*/g, '');
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
else if ( match[2] ) {
Sizzle.error( match[0] );
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
// Handle if an un-quoted value was used
match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function( match, curLoop, inplace, result, not ) {
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function( match ) {
match.unshift( true );
return match;
}
},
filters: {
enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function( elem ) {
return elem.disabled === true;
},
checked: function( elem ) {
return elem.checked === true;
},
selected: function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
parent: function( elem ) {
return !!elem.firstChild;
},
empty: function( elem ) {
return !elem.firstChild;
},
has: function( elem, i, match ) {
return !!Sizzle( match[3], elem ).length;
},
header: function( elem ) {
return (/h\d/i).test( elem.nodeName );
},
text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
},
radio: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
},
checkbox: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
},
file: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
},
password: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
},
submit: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "submit" === elem.type;
},
image: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
},
reset: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "reset" === elem.type;
},
button: function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && "button" === elem.type || name === "button";
},
input: function( elem ) {
return (/input|select|textarea|button/i).test( elem.nodeName );
},
focus: function( elem ) {
return elem === elem.ownerDocument.activeElement;
}
},
setFilters: {
first: function( elem, i ) {
return i === 0;
},
last: function( elem, i, match, array ) {
return i === array.length - 1;
},
even: function( elem, i ) {
return i % 2 === 0;
},
odd: function( elem, i ) {
return i % 2 === 1;
},
lt: function( elem, i, match ) {
return i < match[3] - 0;
},
gt: function( elem, i, match ) {
return i > match[3] - 0;
},
nth: function( elem, i, match ) {
return match[3] - 0 === i;
},
eq: function( elem, i, match ) {
return match[3] - 0 === i;
}
},
filter: {
PSEUDO: function( elem, match, i, array ) {
var name = match[1],
filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
for ( var j = 0, l = not.length; j < l; j++ ) {
if ( not[j] === elem ) {
return false;
}
}
return true;
} else {
Sizzle.error( name );
}
},
CHILD: function( elem, match ) {
var first, last,
doneName, parent, cache,
count, diff,
type = match[1],
node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
/* falls through */
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
case "nth":
first = match[2];
last = match[3];
if ( first === 1 && last === 0 ) {
return true;
}
doneName = match[0];
parent = elem.parentNode;
if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent[ expando ] = doneName;
}
diff = elem.nodeIndex - last;
if ( first === 0 ) {
return diff === 0;
} else {
return ( diff % first === 0 && diff / first >= 0 );
}
}
},
ID: function( elem, match ) {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
},
CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
},
ATTR: function( elem, match ) {
var name = match[1],
result = Sizzle.attr ?
Sizzle.attr( elem, name ) :
Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getAttribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ?
type === "!=" :
!type && Sizzle.attr ?
result != null :
type === "=" ?
value === check :
type === "*=" ?
value.indexOf(check) >= 0 :
type === "~=" ?
(" " + value + " ").indexOf(check) >= 0 :
!check ?
value && result !== false :
type === "!=" ?
value !== check :
type === "^=" ?
value.indexOf(check) === 0 :
type === "$=" ?
value.substr(value.length - check.length) === check :
type === "|=" ?
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
POS: function( elem, match, i, array ) {
var name = match[2],
filter = Expr.setFilters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
var origPOS = Expr.match.POS,
fescape = function(all, num){
return "\\" + (num - 0 + 1);
};
for ( var type in Expr.match ) {
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}
// Expose origPOS
// "global" as in regardless of relation to brackets/parens
Expr.match.globalPOS = origPOS;
var makeArray = function( array, results ) {
array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
// Also verifies that the returned array holds DOM nodes
// (which is not the case in the Blackberry browser)
try {
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
} catch( e ) {
makeArray = function( array, results ) {
var i = 0,
ret = results || [];
if ( toString.call(array) === "[object Array]" ) {
Array.prototype.push.apply( ret, array );
} else {
if ( typeof array.length === "number" ) {
for ( var l = array.length; i < l; i++ ) {
ret.push( array[i] );
}
} else {
for ( ; array[i]; i++ ) {
ret.push( array[i] );
}
}
}
return ret;
};
}
var sortOrder, siblingCheck;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
return a.compareDocumentPosition ? -1 : 1;
}
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
};
} else {
sortOrder = function( a, b ) {
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
siblingCheck = function( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
};
}
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("div"),
id = "script" + (new Date()).getTime(),
root = document.documentElement;
form.innerHTML = "<a name='" + id + "'/>";
// Inject it into the root element, check its status, and remove it quickly
root.insertBefore( form, root.firstChild );
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
if ( document.getElementById( id ) ) {
Expr.find.ID = function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ?
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
[m] :
undefined :
[];
}
};
Expr.filter.ID = function( elem, match ) {
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return elem.nodeType === 1 && node && node.nodeValue === match;
};
}
root.removeChild( form );
// release memory in IE
root = form = null;
})();
(function(){
// Check to see if the browser returns only elements
// when doing getElementsByTagName("*")
// Create a fake element
var div = document.createElement("div");
div.appendChild( document.createComment("") );
// Make sure no comments are found
if ( div.getElementsByTagName("*").length > 0 ) {
Expr.find.TAG = function( match, context ) {
var results = context.getElementsByTagName( match[1] );
// Filter out possible comments
if ( match[1] === "*" ) {
var tmp = [];
for ( var i = 0; results[i]; i++ ) {
if ( results[i].nodeType === 1 ) {
tmp.push( results[i] );
}
}
results = tmp;
}
return results;
};
}
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function( elem ) {
return elem.getAttribute( "href", 2 );
};
}
// release memory in IE
div = null;
})();
if ( document.querySelectorAll ) {
(function(){
var oldSizzle = Sizzle,
div = document.createElement("div"),
id = "__sizzle__";
div.innerHTML = "<p class='TEST'></p>";
// Safari can't handle uppercase or unicode characters when
// in quirks mode.
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return;
}
Sizzle = function( query, context, extra, seed ) {
context = context || document;
// Only use querySelectorAll on non-XML documents
// (ID selectors don't work in non-HTML documents)
if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG")
if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra );
}
}
if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it
if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) {
var elem = context.getElementById( match[3] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra );
}
} else {
return makeArray( [], extra );
}
}
try {
return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {}
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
var oldContext = context,
old = context.getAttribute( "id" ),
nid = old || id,
hasParent = context.parentNode,
relativeHierarchySelector = /^\s*[+~]/.test( query );
if ( !old ) {
context.setAttribute( "id", nid );
} else {
nid = nid.replace( /'/g, "\\$&" );
}
if ( relativeHierarchySelector && hasParent ) {
context = context.parentNode;
}
try {
if ( !relativeHierarchySelector || hasParent ) {
return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
}
} catch(pseudoError) {
} finally {
if ( !old ) {
oldContext.removeAttribute( "id" );
}
}
}
}
return oldSizzle(query, context, extra, seed);
};
for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ];
}
// release memory in IE
div = null;
})();
}
(function(){
var html = document.documentElement,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
if ( matches ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9 fails this)
var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
pseudoWorks = false;
try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) {
pseudoWorks = true;
}
Sizzle.matchesSelector = function( node, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) {
try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || !disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9, so check for that
node.document && node.document.nodeType !== 11 ) {
return ret;
}
}
} catch(e) {}
}
return Sizzle(expr, null, null, [node]).length > 0;
};
}
})();
(function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
// Opera can't find a second classname (in 9.6)
// Also, make sure that getElementsByClassName actually exists
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
return;
}
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
if ( div.getElementsByClassName("e").length === 1 ) {
return;
}
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
// release memory in IE
div = null;
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 && !isXML ){
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( elem.nodeName.toLowerCase() === cur ) {
match = elem;
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 ) {
if ( !isXML ) {
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
break;
}
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
match = elem;
break;
}
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
if ( document.documentElement.contains ) {
Sizzle.contains = function( a, b ) {
return a !== b && (a.contains ? a.contains(b) : true);
};
} else if ( document.documentElement.compareDocumentPosition ) {
Sizzle.contains = function( a, b ) {
return !!(a.compareDocumentPosition(b) & 16);
};
} else {
Sizzle.contains = function() {
return false;
};
}
Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
var posProcess = function( selector, context, seed ) {
var match,
tmpSet = [],
later = "",
root = context.nodeType ? [context] : context;
// Position selectors must be done after the filter
// And so must :not(positional) so we move all PSEUDOs to the end
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
later += match[0];
selector = selector.replace( Expr.match.PSEUDO, "" );
}
selector = Expr.relative[selector] ? selector + "*" : selector;
for ( var i = 0, l = root.length; i < l; i++ ) {
Sizzle( selector, root[i], tmpSet, seed );
}
return Sizzle.filter( later, tmpSet );
};
// EXPOSE
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
Sizzle.selectors.attrMap = {};
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})();
var runtil = /Until$/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector = /,/,
isSimple = /^.[^:#\[\.,]*$/,
slice = Array.prototype.slice,
POS = jQuery.expr.match.globalPOS,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var self = this,
i, l;
if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() {
for ( i = 0, l = self.length; i < l; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
});
}
var ret = this.pushStack( "", "find", selector ),
length, n, r;
for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( n = length; n < ret.length; n++ ) {
for ( r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var targets = jQuery( target );
return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
POS.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0];
// Array (deprecated as of jQuery 1.7)
if ( jQuery.isArray( selectors ) ) {
var level = 1;
while ( cur && cur.ownerDocument && cur !== context ) {
for ( i = 0; i < selectors.length; i++ ) {
if ( jQuery( cur ).is( selectors[ i ] ) ) {
ret.push({ selector: selectors[ i ], elem: cur, level: level });
}
}
cur = cur.parentNode;
level++;
}
return ret;
}
// String
var pos = POS.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
} else {
cur = cur.parentNode;
if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
break;
}
}
}
}
ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
andSelf: function() {
return this.add( this.prevObject );
}
});
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return jQuery.nth( elem, 2, "nextSibling" );
},
prev: function( elem ) {
return jQuery.nth( elem, 2, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.makeArray( elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, slice.call( arguments ).join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
nth: function( cur, result, dir, elem ) {
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] ) {
if ( cur.nodeType === 1 && ++num === result ) {
break;
}
}
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style)/i,
rnocache = /<(?:script|object|embed|option|style)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
},
safeFragment = createSafeFragment( document );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE can't serialize <link> and <script> tags normally
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "div<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
} else if ( arguments.length ) {
var set = jQuery.clean( arguments );
set.push.apply( set, this.toArray() );
return this.pushStack( set, "before", arguments );
}
},
after: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
} else if ( arguments.length ) {
var set = this.pushStack( this, "after", arguments );
set.push.apply( set, jQuery.clean(arguments) );
return set;
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
null;
}
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName( "*" ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function( value ) {
if ( this[0] && this[0].parentNode ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
} else {
return this.length ?
this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
this;
}
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
var results, first, fragment, parent,
value = args[0],
scripts = [];
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback, true );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call(this, i, table ? self.html() : undefined);
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
parent = value && value.parentNode;
// If we're in a fragment, just use that instead of building a new one
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
results = { fragment: parent };
} else {
results = jQuery.buildFragment( args, this, scripts );
}
fragment = results.fragment;
if ( fragment.childNodes.length === 1 ) {
first = fragment = fragment.firstChild;
} else {
first = fragment.firstChild;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
callback.call(
table ?
root(this[i], first) :
this[i],
// Make sure that we do not leak memory by inadvertently discarding
// the original fragment (which might have attached data) instead of
// using it; in addition, use the original fragment object for the last
// item instead of first because it can end up being emptied incorrectly
// in certain situations (Bug #8070).
// Fragments from the fragment cache must always be cloned and never used
// in place.
results.cacheable || ( l > 1 && i < lastIndex ) ?
jQuery.clone( fragment, true, true ) :
fragment
);
}
}
if ( scripts.length ) {
jQuery.each( scripts, function( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
type: "GET",
global: false,
url: elem.src,
async: false,
dataType: "script"
});
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
});
}
}
return this;
}
});
function root( elem, cur ) {
return jQuery.nodeName(elem, "table") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 fail to clone children inside object elements that use
// the proprietary classid attribute value (rather than the type
// attribute) to identify the type of content to display
if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML;
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
if ( src.checked ) {
dest.defaultChecked = dest.checked = src.checked;
}
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
// IE blanks contents when cloning scripts
} else if ( nodeName === "script" && dest.text !== src.text ) {
dest.text = src.text;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
// Clear flags for bubbling special change/submit events, they must
// be reattached when the newly cloned events are first activated
dest.removeAttribute( "_submit_attached" );
dest.removeAttribute( "_change_attached" );
}
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults, doc,
first = args[ 0 ];
// nodes may contain either an explicit document object,
// a jQuery collection or context object.
// If nodes[0] contains a valid object to assign to doc
if ( nodes && nodes[0] ) {
doc = nodes[0].ownerDocument || nodes[0];
}
// Ensure that an attr object doesn't incorrectly stand in as a document object
// Chrome and Firefox seem to allow this to occur and will throw exception
// Fixes #8950
if ( !doc.createDocumentFragment ) {
doc = document;
}
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
first.charAt(0) === "<" && !rnocache.test( first ) &&
(jQuery.support.checkClone || !rchecked.test( first )) &&
(jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
cacheable = true;
cacheresults = jQuery.fragments[ first ];
if ( cacheresults && cacheresults !== 1 ) {
fragment = cacheresults;
}
}
if ( !fragment ) {
fragment = doc.createDocumentFragment();
jQuery.clean( args, doc, fragment, scripts );
}
if ( cacheable ) {
jQuery.fragments[ first ] = cacheresults ? fragment : 1;
}
return { fragment: fragment, cacheable: cacheable };
};
jQuery.fragments = {};
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var ret = [],
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = ( i > 0 ? this.clone(true) : this ).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
function getAll( elem ) {
if ( typeof elem.getElementsByTagName !== "undefined" ) {
return elem.getElementsByTagName( "*" );
} else if ( typeof elem.querySelectorAll !== "undefined" ) {
return elem.querySelectorAll( "*" );
} else {
return [];
}
}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( elem.type === "checkbox" || elem.type === "radio" ) {
elem.defaultChecked = elem.checked;
}
}
// Finds all inputs and passes them to fixDefaultChecked
function findInputs( elem ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "input" ) {
fixDefaultChecked( elem );
// Skip scripts, get other children
} else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
function shimCloneNode( elem ) {
var div = document.createElement( "div" );
safeFragment.appendChild( div );
div.innerHTML = elem.outerHTML;
return div.firstChild;
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var srcElements,
destElements,
i,
// IE<=8 does not properly clone detached, unknown element nodes
clone = jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ?
elem.cloneNode( true ) :
shimCloneNode( elem );
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// IE copies events bound via attachEvent when using cloneNode.
// Calling detachEvent on the clone will also remove the events
// from the original. In order to get around this, we use some
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
cloneFixAttributes( elem, clone );
// Using Sizzle here is crazy slow, so we use getElementsByTagName instead
srcElements = getAll( elem );
destElements = getAll( clone );
// Weird iteration because IE will replace the length property
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for ( i = 0; srcElements[i]; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
cloneFixAttributes( srcElements[i], destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
cloneCopyEvent( elem, clone );
if ( deepDataAndEvents ) {
srcElements = getAll( elem );
destElements = getAll( clone );
for ( i = 0; srcElements[i]; ++i ) {
cloneCopyEvent( srcElements[i], destElements[i] );
}
}
}
srcElements = destElements = null;
// Return the cloned set
return clone;
},
clean: function( elems, context, fragment, scripts ) {
var checkScriptType, script, j,
ret = [];
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" ) {
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
}
if ( !elem ) {
continue;
}
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
if ( !rhtml.test( elem ) ) {
elem = context.createTextNode( elem );
} else {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Trim whitespace, otherwise indexOf won't work as expected
var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div"),
safeChildNodes = safeFragment.childNodes,
remove;
// Append wrapper element to unknown element safe doc fragment
if ( context === document ) {
// Use the fragment we've already created for this document
safeFragment.appendChild( div );
} else {
// Use a fragment created with the owner document
createSafeFragment( context ).appendChild( div );
}
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( depth-- ) {
div = div.lastChild;
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
var hasBody = rtbody.test(elem),
tbody = tag === "table" && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !hasBody ?
div.childNodes :
[];
for ( j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
}
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
}
elem = div.childNodes;
// Clear elements from DocumentFragment (safeFragment or otherwise)
// to avoid hoarding elements. Fixes #11356
if ( div ) {
div.parentNode.removeChild( div );
// Guard against -1 index exceptions in FF3.6
if ( safeChildNodes.length > 0 ) {
remove = safeChildNodes[ safeChildNodes.length - 1 ];
if ( remove && remove.parentNode ) {
remove.parentNode.removeChild( remove );
}
}
}
}
}
// Resets defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
var len;
if ( !jQuery.support.appendChecked ) {
if ( elem[0] && typeof (len = elem.length) === "number" ) {
for ( j = 0; j < len; j++ ) {
findInputs( elem[j] );
}
} else {
findInputs( elem );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
ret = jQuery.merge( ret, elem );
}
}
if ( fragment ) {
checkScriptType = function( elem ) {
return !elem.type || rscriptType.test( elem.type );
};
for ( i = 0; ret[i]; i++ ) {
script = ret[i];
if ( scripts && jQuery.nodeName( script, "script" ) && (!script.type || rscriptType.test( script.type )) ) {
scripts.push( script.parentNode ? script.parentNode.removeChild( script ) : script );
} else {
if ( script.nodeType === 1 ) {
var jsTags = jQuery.grep( script.getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
fragment.appendChild( script );
}
}
}
return ret;
},
cleanData: function( elems ) {
var data, id,
cache = jQuery.cache,
special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
continue;
}
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ];
if ( data && data.events ) {
for ( var type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
// Null the DOM reference to avoid IE6/7/8 leak (#7054)
if ( data.handle ) {
data.handle.elem = null;
}
}
if ( deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];
}
}
}
});
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnum = /^[\-+]?(?:\d*\.)?\d+$/i,
rnumnonpx = /^-?(?:\d*\.)?\d+(?!px)[^\d\s]+$/i,
rrelNum = /^([\-+])=([\-+.\de]+)/,
rmargin = /^margin/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
// order is important!
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
curCSS,
getComputedStyle,
currentStyle;
jQuery.fn.css = function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
};
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
} else {
return elem.style.opacity;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra ) {
var ret, hooks;
// Make sure that we're working with the right name
name = jQuery.camelCase( name );
hooks = jQuery.cssHooks[ name ];
name = jQuery.cssProps[ name ] || name;
// cssFloat needs a special treatment
if ( name === "cssFloat" ) {
name = "float";
}
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
return ret;
// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
return curCSS( elem, name );
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {},
ret, name;
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
// DEPRECATED in 1.3, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, name ) {
var ret, defaultView, computedStyle, width,
style = elem.style;
name = name.replace( rupper, "-$1" ).toLowerCase();
if ( (defaultView = elem.ownerDocument.defaultView) &&
(computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
}
// A tribute to the "awesome hack by Dean Edwards"
// WebKit uses "computed value (percentage if specified)" instead of "used value" for margins
// which is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( !jQuery.support.pixelMargin && computedStyle && rmargin.test( name ) && rnumnonpx.test( ret ) ) {
width = style.width;
style.width = ret;
ret = computedStyle.width;
style.width = width;
}
return ret;
};
}
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left, rsLeft, uncomputed,
ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && (uncomputed = style[ name ]) ) {
ret = uncomputed;
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( rnumnonpx.test( ret ) ) {
// Remember the original values
left = style.left;
rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
elem.runtimeStyle.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
curCSS = getComputedStyle || currentStyle;
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
i = name === "width" ? 1 : 0,
len = 4;
if ( val > 0 ) {
if ( extra !== "border" ) {
for ( ; i < len; i += 2 ) {
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ] ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
}
}
return val + "px";
}
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Add padding, border, margin
if ( extra ) {
for ( ; i < len; i += 2 ) {
val += parseFloat( jQuery.css( elem, "padding" + cssExpand[ i ] ) ) || 0;
if ( extra !== "padding" ) {
val += parseFloat( jQuery.css( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + cssExpand[ i ]) ) || 0;
}
}
}
return val + "px";
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
return getWidthOrHeight( elem, name, extra );
} else {
return jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
});
}
}
},
set: function( elem, value ) {
return rnum.test( value ) ?
value + "px" :
value;
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( parseFloat( RegExp.$1 ) / 100 ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there there is no filter style applied in a css rule, we are done
if ( currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
jQuery(function() {
// This hook cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
return curCSS( elem, "margin-right" );
} else {
return elem.style.marginRight;
}
});
}
};
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i,
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ],
expanded = {};
for ( i = 0; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rspacesAjax = /\s+/,
rts = /([?&])_=[^&]*/,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Document location
ajaxLocation,
// Document location segments
ajaxLocParts,
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"];
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
if ( jQuery.isFunction( func ) ) {
var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
i = 0,
length = dataTypes.length,
dataType,
list,
placeBefore;
// For each dataType in the dataTypeExpression
for ( ; i < length; i++ ) {
dataType = dataTypes[ i ];
// We control if we're asked to add before
// any existing element
placeBefore = /^\+/.test( dataType );
if ( placeBefore ) {
dataType = dataType.substr( 1 ) || "*";
}
list = structure[ dataType ] = structure[ dataType ] || [];
// then we add to the structure accordingly
list[ placeBefore ? "unshift" : "push" ]( func );
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
dataType /* internal */, inspected /* internal */ ) {
dataType = dataType || options.dataTypes[ 0 ];
inspected = inspected || {};
inspected[ dataType ] = true;
var list = structure[ dataType ],
i = 0,
length = list ? list.length : 0,
executeOnly = ( structure === prefilters ),
selection;
for ( ; i < length && ( executeOnly || !selection ); i++ ) {
selection = list[ i ]( options, originalOptions, jqXHR );
// If we got redirected to another dataType
// we try there if executing only and not done already
if ( typeof selection === "string" ) {
if ( !executeOnly || inspected[ selection ] ) {
selection = undefined;
} else {
options.dataTypes.unshift( selection );
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, selection, inspected );
}
}
}
// If we're only executing or nothing was selected
// we try the catchall dataType if not done already
if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, "*", inspected );
}
// unnecessary when only executing (prefilters)
// but it'll be ignored by the caller in that case
return selection;
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
}
jQuery.fn.extend({
load: function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
// Don't do a request if no elements are being requested
} else if ( !this.length ) {
return this;
}
var off = url.indexOf( " " );
if ( off >= 0 ) {
var selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// Default to a GET request
var type = "GET";
// If the second parameter was provided
if ( params ) {
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( typeof params === "object" ) {
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
type = "POST";
}
}
var self = this;
// Request the remote document
jQuery.ajax({
url: url,
type: type,
dataType: "html",
data: params,
// Complete callback (responseText is used internally)
complete: function( jqXHR, status, responseText ) {
// Store the response as specified by the jqXHR object
responseText = jqXHR.responseText;
// If successful, inject the HTML into all the matched elements
if ( jqXHR.isResolved() ) {
// #4825: Get the actual response in case
// a dataFilter is present in ajaxSettings
jqXHR.done(function( r ) {
responseText = r;
});
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(responseText.replace(rscript, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
responseText );
}
if ( callback ) {
self.each( callback, [ responseText, status, jqXHR ] );
}
}
});
return this;
},
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
return this.elements ? jQuery.makeArray( this.elements ) : this;
})
.filter(function(){
return this.name && !this.disabled &&
( this.checked || rselectTextarea.test( this.nodeName ) ||
rinput.test( this.type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val, i ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
jQuery.fn[ o ] = function( f ){
return this.on( o, f );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
};
});
jQuery.extend({
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
if ( settings ) {
// Building a settings object
ajaxExtend( target, jQuery.ajaxSettings );
} else {
// Extending ajaxSettings
settings = target;
target = jQuery.ajaxSettings;
}
ajaxExtend( target, settings );
return target;
},
ajaxSettings: {
url: ajaxLocation,
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
processData: true,
async: true,
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
traditional: false,
headers: {},
*/
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
"*": allTypes
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// List of data converters
// 1) key format is "source_type destination_type" (a single space in-between)
// 2) the catchall symbol "*" can be used for source_type
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
context: true,
url: true
}
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node or a jQuery collection
globalEventContext = callbackContext !== s &&
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// ifModified key
ifModifiedKey,
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// The jqXHR state
state = 0,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Fake xhr
jqXHR = {
readyState: 0,
// Caches the header
setRequestHeader: function( name, value ) {
if ( !state ) {
var lname = name.toLowerCase();
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match === undefined ? null : match;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Cancel the request
abort: function( statusText ) {
statusText = statusText || "abort";
if ( transport ) {
transport.abort( statusText );
}
done( 0, statusText );
return this;
}
};
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
function done( status, nativeStatusText, responses, headers ) {
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
var isSuccess,
success,
error,
statusText = nativeStatusText,
response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
lastModified,
etag;
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
jQuery.lastModified[ ifModifiedKey ] = lastModified;
}
if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
jQuery.etag[ ifModifiedKey ] = etag;
}
}
// If not modified
if ( status === 304 ) {
statusText = "notmodified";
isSuccess = true;
// If we have data
} else {
try {
success = ajaxConvert( s, response );
statusText = "success";
isSuccess = true;
} catch(e) {
// We have a parsererror
statusText = "parsererror";
error = e;
}
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( !statusText || status ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = "" + ( nativeStatusText || statusText );
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
// Attach deferreds
deferred.promise( jqXHR );
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
jqXHR.complete = completeDeferred.add;
// Status-dependent callbacks
jqXHR.statusCode = function( map ) {
if ( map ) {
var tmp;
if ( state < 2 ) {
for ( tmp in map ) {
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
}
} else {
tmp = map[ jqXHR.status ];
jqXHR.then( tmp, tmp );
}
}
return this;
};
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// We also use the url parameter if available
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
// Determine if a cross-domain request is in order
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( state === 2 ) {
return false;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
ifModifiedKey = s.url;
// Add anti-cache in url if needed
if ( s.cache === false ) {
var ts = jQuery.now(),
// try replacing _= if it is there
ret = s.url.replace( rts, "$1_=" + ts );
// if nothing was replaced, add timestamp to the end
s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
ifModifiedKey = ifModifiedKey || s.url;
if ( jQuery.lastModified[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
}
if ( jQuery.etag[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
}
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already
jqXHR.abort();
return false;
}
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout( function(){
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
}
return jqXHR;
},
// Serialize an array of form elements or a set of
// key/values into a query string
param: function( a, traditional ) {
var s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : value;
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( var prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
}
});
function buildParams( prefix, obj, traditional, add ) {
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( var name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// This is still on the jQuery object... for now
// Want to move this to jQuery.ajax some day
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields,
ct,
type,
finalDataType,
firstDataType;
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
var dataTypes = s.dataTypes,
converters = {},
i,
key,
length = dataTypes.length,
tmp,
// Current and previous dataTypes
current = dataTypes[ 0 ],
prev,
// Conversion expression
conversion,
// Conversion function
conv,
// Conversion functions (transitive conversion)
conv1,
conv2;
// For each dataType in the chain
for ( i = 1; i < length; i++ ) {
// Create converters map
// with lowercased keys
if ( i === 1 ) {
for ( key in s.converters ) {
if ( typeof key === "string" ) {
converters[ key.toLowerCase() ] = s.converters[ key ];
}
}
}
// Get the dataTypes
prev = current;
current = dataTypes[ i ];
// If current is auto dataType, update it to prev
if ( current === "*" ) {
current = prev;
// If no auto and dataTypes are actually different
} else if ( prev !== "*" && prev !== current ) {
// Get the converter
conversion = prev + " " + current;
conv = converters[ conversion ] || converters[ "* " + current ];
// If there is no direct converter, search transitively
if ( !conv ) {
conv2 = undefined;
for ( conv1 in converters ) {
tmp = conv1.split( " " );
if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
conv2 = converters[ tmp[1] + " " + current ];
if ( conv2 ) {
conv1 = converters[ conv1 ];
if ( conv1 === true ) {
conv = conv2;
} else if ( conv2 === true ) {
conv = conv1;
}
break;
}
}
}
}
// If we found no converter, dispatch an error
if ( !( conv || conv2 ) ) {
jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
}
// If found converter is not an equivalence
if ( conv !== true ) {
// Convert with 1 or 2 converters accordingly
response = conv ? conv( response ) : conv2( conv1(response) );
}
}
}
return response;
}
var jsc = jQuery.now(),
jsre = /(\=)\?(&|$)|\?\?/i;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
return jQuery.expando + "_" + ( jsc++ );
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var inspectData = ( typeof s.data === "string" ) && /^application\/x\-www\-form\-urlencoded/.test( s.contentType );
if ( s.dataTypes[ 0 ] === "jsonp" ||
s.jsonp !== false && ( jsre.test( s.url ) ||
inspectData && jsre.test( s.data ) ) ) {
var responseContainer,
jsonpCallback = s.jsonpCallback =
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
previous = window[ jsonpCallback ],
url = s.url,
data = s.data,
replace = "$1" + jsonpCallback + "$2";
if ( s.jsonp !== false ) {
url = url.replace( jsre, replace );
if ( s.url === url ) {
if ( inspectData ) {
data = data.replace( jsre, replace );
}
if ( s.data === data ) {
// Add callback manually
url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
}
}
}
s.url = url;
s.data = data;
// Install callback
window[ jsonpCallback ] = function( response ) {
responseContainer = [ response ];
};
// Clean-up function
jqXHR.always(function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( previous ) ) {
window[ jsonpCallback ]( responseContainer[ 0 ] );
}
});
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( jsonpCallback + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Delegate to script
return "script";
}
});
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript|ecmascript/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = "async";
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( head && script.parentNode ) {
head.removeChild( script );
}
// Dereference the script
script = undefined;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( 0, 1 );
}
}
};
}
});
var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject ? function() {
// Abort all pending requests
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( 0, 1 );
}
} : false,
xhrId = 0,
xhrCallbacks;
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
(function( xhr ) {
jQuery.extend( jQuery.support, {
ajax: !!xhr,
cors: !!xhr && ( "withCredentials" in xhr )
});
})( jQuery.ajaxSettings.xhr() );
// Create transport if the browser can provide an xhr
if ( jQuery.support.ajax ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var xhr = s.xhr(),
handle,
i;
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( _ ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status,
statusText,
responseHeaders,
responses,
xml;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occured
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
try {
responses.text = xhr.responseText;
} catch( _ ) {
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
// if we're in sync mode or it's in cache
// and has been retrieved directly (IE6 & IE7)
// we need to manually fire the callback
if ( !s.async || xhr.readyState === 4 ) {
callback();
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback(0,1);
}
}
};
}
});
}
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
// width animations
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
],
fxNow;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback );
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
elem = this[ i ];
if ( elem.style ) {
display = elem.style.display;
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
display = elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( (display === "" && jQuery.css(elem, "display") === "none") ||
!jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
elem = this[ i ];
if ( elem.style ) {
display = elem.style.display;
if ( display === "" || display === "none" ) {
elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
}
}
}
return this;
}
},
hide: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
return this.animate( genFx("hide", 3), speed, easing, callback);
} else {
var elem, display,
i = 0,
j = this.length;
for ( ; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = jQuery.css( elem, "display" );
if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
jQuery._data( elem, "olddisplay", display );
}
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
if ( this[i].style ) {
this[i].style.display = "none";
}
}
return this;
}
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2, callback ) {
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
this._toggle.apply( this, arguments );
} else if ( fn == null || bool ) {
this.each(function() {
var state = bool ? fn : jQuery(this).is(":hidden");
jQuery(this)[ state ? "show" : "hide" ]();
});
} else {
this.animate(genFx("toggle", 3), fn, fn2, callback);
}
return this;
},
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed( speed, easing, callback );
if ( jQuery.isEmptyObject( prop ) ) {
return this.each( optall.complete, [ false ] );
}
// Do not change referenced properties as per-property easing will be lost
prop = jQuery.extend( {}, prop );
function doAnimation() {
// XXX 'this' does not always have a nodeName when running the
// test suite
if ( optall.queue === false ) {
jQuery._mark( this );
}
var opt = jQuery.extend( {}, optall ),
isElement = this.nodeType === 1,
hidden = isElement && jQuery(this).is(":hidden"),
name, val, p, e, hooks, replace,
parts, start, end, unit,
method;
// will store per property easing and be used to determine when an animation is complete
opt.animatedProperties = {};
// first pass over propertys to expand / normalize
for ( p in prop ) {
name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
delete prop[ p ];
}
if ( ( hooks = jQuery.cssHooks[ name ] ) && "expand" in hooks ) {
replace = hooks.expand( prop[ name ] );
delete prop[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'p' from above because we have the correct "name"
for ( p in replace ) {
if ( ! ( p in prop ) ) {
prop[ p ] = replace[ p ];
}
}
}
}
for ( name in prop ) {
val = prop[ name ];
// easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
if ( jQuery.isArray( val ) ) {
opt.animatedProperties[ name ] = val[ 1 ];
val = prop[ name ] = val[ 0 ];
} else {
opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
}
if ( val === "hide" && hidden || val === "show" && !hidden ) {
return opt.complete.call( this );
}
if ( isElement && ( name === "height" || name === "width" ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( this, "display" ) === "inline" &&
jQuery.css( this, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
this.style.display = "inline-block";
} else {
this.style.zoom = 1;
}
}
}
}
if ( opt.overflow != null ) {
this.style.overflow = "hidden";
}
for ( p in prop ) {
e = new jQuery.fx( this, opt, p );
val = prop[ p ];
if ( rfxtypes.test( val ) ) {
// Tracks whether to show or hide based on private
// data attached to the element
method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
if ( method ) {
jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
e[ method ]();
} else {
e[ val ]();
}
} else {
parts = rfxnum.exec( val );
start = e.cur();
if ( parts ) {
end = parseFloat( parts[2] );
unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" ) {
jQuery.style( this, p, (end || 1) + unit);
start = ( (end || 1) / e.cur() ) * start;
jQuery.style( this, p, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] ) {
end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
}
e.custom( start, end, unit );
} else {
e.custom( start, val, "" );
}
}
}
// For JS strict compliance
return true;
}
return optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var index,
hadTimers = false,
timers = jQuery.timers,
data = jQuery._data( this );
// clear marker counters if we know they won't be
if ( !gotoEnd ) {
jQuery._unmark( true, this );
}
function stopQueue( elem, data, index ) {
var hooks = data[ index ];
jQuery.removeData( elem, index, true );
hooks.stop( gotoEnd );
}
if ( type == null ) {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
stopQueue( this, data, index );
}
}
} else if ( data[ index = type + ".run" ] && data[ index ].stop ){
stopQueue( this, data, index );
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
if ( gotoEnd ) {
// force the next step to be the last
timers[ index ]( true );
} else {
timers[ index ].saveState();
}
hadTimers = true;
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( !( gotoEnd && hadTimers ) ) {
jQuery.dequeue( this, type );
}
});
}
});
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout( clearFxNow, 0 );
return ( fxNow = jQuery.now() );
}
function clearFxNow() {
fxNow = undefined;
}
// Generate parameters to create a standard animation
function genFx( type, num ) {
var obj = {};
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
obj[ this ] = type;
});
return obj;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx( "show", 1 ),
slideUp: genFx( "hide", 1 ),
slideToggle: genFx( "toggle", 1 ),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.extend({
speed: function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function( noUnmark ) {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
} else if ( noUnmark !== false ) {
jQuery._unmark( this );
}
};
return opt;
},
easing: {
linear: function( p ) {
return p;
},
swing: function( p ) {
return ( -Math.cos( p*Math.PI ) / 2 ) + 0.5;
}
},
timers: [],
fx: function( elem, options, prop ) {
this.options = options;
this.elem = elem;
this.prop = prop;
options.orig = options.orig || {};
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
},
// Get the current size
cur: function() {
if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
return this.elem[ this.prop ];
}
var parsed,
r = jQuery.css( this.elem, this.prop );
// Empty strings, null, undefined and "auto" are converted to 0,
// complex values such as "rotate(1rad)" are returned as is,
// simple values such as "10px" are parsed to Float.
return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
},
// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
fx = jQuery.fx;
this.startTime = fxNow || createFxNow();
this.end = to;
this.now = this.start = from;
this.pos = this.state = 0;
this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
function t( gotoEnd ) {
return self.step( gotoEnd );
}
t.queue = this.options.queue;
t.elem = this.elem;
t.saveState = function() {
if ( jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
if ( self.options.hide ) {
jQuery._data( self.elem, "fxshow" + self.prop, self.start );
} else if ( self.options.show ) {
jQuery._data( self.elem, "fxshow" + self.prop, self.end );
}
}
};
if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = setInterval( fx.tick, fx.interval );
}
},
// Simple 'show' function
show: function() {
var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
// Remember where we started, so that we can go back to it later
this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any flash of content
if ( dataShow !== undefined ) {
// This show is picking up where a previous hide or show left off
this.custom( this.cur(), dataShow );
} else {
this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
}
// Start by showing the element
jQuery( this.elem ).show();
},
// Simple 'hide' function
hide: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
this.options.hide = true;
// Begin the animation
this.custom( this.cur(), 0 );
},
// Each step of an animation
step: function( gotoEnd ) {
var p, n, complete,
t = fxNow || createFxNow(),
done = true,
elem = this.elem,
options = this.options;
if ( gotoEnd || t >= options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
options.animatedProperties[ this.prop ] = true;
for ( p in options.animatedProperties ) {
if ( options.animatedProperties[ p ] !== true ) {
done = false;
}
}
if ( done ) {
// Reset the overflow
if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
jQuery.each( [ "", "X", "Y" ], function( index, value ) {
elem.style[ "overflow" + value ] = options.overflow[ index ];
});
}
// Hide the element if the "hide" operation was done
if ( options.hide ) {
jQuery( elem ).hide();
}
// Reset the properties, if the item has been hidden or shown
if ( options.hide || options.show ) {
for ( p in options.animatedProperties ) {
jQuery.style( elem, p, options.orig[ p ] );
jQuery.removeData( elem, "fxshow" + p, true );
// Toggle data is no longer needed
jQuery.removeData( elem, "toggle" + p, true );
}
}
// Execute the complete function
// in the event that the complete function throws an exception
// we must ensure it won't be called twice. #5684
complete = options.complete;
if ( complete ) {
options.complete = false;
complete.call( elem );
}
}
return false;
} else {
// classical easing cannot be used with an Infinity duration
if ( options.duration == Infinity ) {
this.now = t;
} else {
n = t - this.startTime;
this.state = n / options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
this.now = this.start + ( (this.end - this.start) * this.pos );
}
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.extend( jQuery.fx, {
tick: function() {
var timer,
timers = jQuery.timers,
i = 0;
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
},
interval: 13,
stop: function() {
clearInterval( timerId );
timerId = null;
},
speeds: {
slow: 600,
fast: 200,
// Default speed
_default: 400
},
step: {
opacity: function( fx ) {
jQuery.style( fx.elem, "opacity", fx.now );
},
_default: function( fx ) {
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
} else {
fx.elem[ fx.prop ] = fx.now;
}
}
}
});
// Ensure props that can't be negative don't go there on undershoot easing
jQuery.each( fxAttrs.concat.apply( [], fxAttrs ), function( i, prop ) {
// exclude marginTop, marginLeft, marginBottom and marginRight from this list
if ( prop.indexOf( "margin" ) ) {
jQuery.fx.step[ prop ] = function( fx ) {
jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
};
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
// Try to restore the default display value of an element
function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
var body = document.body,
elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
display = elem.css( "display" );
elem.remove();
// If the simple way fails,
// get element's real default display by attaching it to a temp iframe
if ( display === "none" || display === "" ) {
// No iframe to use yet, so create it
if ( !iframe ) {
iframe = document.createElement( "iframe" );
iframe.frameBorder = iframe.width = iframe.height = 0;
}
body.appendChild( iframe );
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write( ( jQuery.support.boxModel ? "<!doctype html>" : "" ) + "<html><body>" );
iframeDoc.close();
}
elem = iframeDoc.createElement( nodeName );
iframeDoc.body.appendChild( elem );
display = jQuery.css( elem, "display" );
body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return elemdisplay[ nodeName ];
}
var getOffset,
rtable = /^t(?:able|d|h)$/i,
rroot = /^(?:body|html)$/i;
if ( "getBoundingClientRect" in document.documentElement ) {
getOffset = function( elem, doc, docElem, box ) {
try {
box = elem.getBoundingClientRect();
} catch(e) {}
// Make sure we're not dealing with a disconnected DOM node
if ( !box || !jQuery.contains( docElem, elem ) ) {
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
}
var body = doc.body,
win = getWindow( doc ),
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
top = box.top + scrollTop - clientTop,
left = box.left + scrollLeft - clientLeft;
return { top: top, left: left };
};
} else {
getOffset = function( elem, doc, docElem ) {
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
body = doc.body,
defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop,
left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
break;
}
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
top -= elem.scrollTop;
left -= elem.scrollLeft;
if ( elem === offsetParent ) {
top += elem.offsetTop;
left += elem.offsetLeft;
if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevOffsetParent = offsetParent;
offsetParent = elem.offsetParent;
}
if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevComputedStyle = computedStyle;
}
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
top += body.offsetTop;
left += body.offsetLeft;
}
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
top += Math.max( docElem.scrollTop, body.scrollTop );
left += Math.max( docElem.scrollLeft, body.scrollLeft );
}
return { top: top, left: left };
};
}
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var elem = this[0],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return null;
}
if ( elem === doc.body ) {
return jQuery.offset.bodyOffset( elem );
}
return getOffset( elem, doc, doc.documentElement );
};
jQuery.offset = {
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return null;
}
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
var clientProp = "client" + name,
scrollProp = "scroll" + name,
offsetProp = "offset" + name;
// innerHeight and innerWidth
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
this[ type ]() :
null;
};
// outerHeight and outerWidth
jQuery.fn[ "outer" + name ] = function( margin ) {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
this[ type ]() :
null;
};
jQuery.fn[ type ] = function( value ) {
return jQuery.access( this, function( elem, type, value ) {
var doc, docElemProp, orig, ret;
if ( jQuery.isWindow( elem ) ) {
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
doc = elem.document;
docElemProp = doc.documentElement[ clientProp ];
return jQuery.support.boxModel && docElemProp ||
doc.body && doc.body[ clientProp ] || docElemProp;
}
// Get document width or height
if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
doc = elem.documentElement;
// when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]
// so we can't use max, as it'll choose the incorrect offset[Width/Height]
// instead we use the correct client[Width/Height]
// support:IE6
if ( doc[ clientProp ] >= doc[ scrollProp ] ) {
return doc[ clientProp ];
}
return Math.max(
elem.body[ scrollProp ], doc[ scrollProp ],
elem.body[ offsetProp ], doc[ offsetProp ]
);
}
// Get width or height on the element
if ( value === undefined ) {
orig = jQuery.css( elem, type );
ret = parseFloat( orig );
return jQuery.isNumeric( ret ) ? ret : orig;
}
// Set the width or height on the element
jQuery( elem ).css( type, value );
}, type, value, arguments.length, null );
};
});
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( window );
|
docs/app/Examples/collections/Table/index.js | Rohanhacker/Semantic-UI-React | import React from 'react'
import States from './States'
import Types from './Types'
import Variations from './Variations'
const TableExamples = () => (
<div>
<Types />
<States />
<Variations />
</div>
)
export default TableExamples
|
docs/app/Examples/collections/Table/Variations/TableExampleCompact.js | clemensw/stardust | import React from 'react'
import { Table } from 'semantic-ui-react'
const TableExampleCompact = () => {
return (
<Table compact>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>Status</Table.HeaderCell>
<Table.HeaderCell>Notes</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>John</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>None</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Jamie</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>Requires call</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>John</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>None</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Jamie</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>Requires call</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>John</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>None</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Jamie</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>Requires call</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>John</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>None</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Jamie</Table.Cell>
<Table.Cell>Approved</Table.Cell>
<Table.Cell>Requires call</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
)
}
export default TableExampleCompact
|
src/tabs/tabs.container.js | Trampss/kriya | import { connect } from 'react-redux'
import { getKeys } from './redux'
import Component from './tabs'
export const mapStateToProps = (state, ownProps) => {
if (ownProps.children) return {}
return {
tabs: getKeys(state),
}
}
export default connect(mapStateToProps)(Component)
|
client/src/entrypoints/admin/wagtailadmin.js | zerolab/wagtail | import React from 'react';
import ReactDOM from 'react-dom';
import { Icon, Portal, initUpgradeNotification } from '../..';
if (process.env.NODE_ENV === 'development') {
// Run react-axe in development only, so it does not affect performance
// in production, and does not break unit tests either.
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
const axe = require('react-axe');
axe(React, ReactDOM, 1000);
}
// Expose components as globals for third-party reuse.
window.wagtail.components = {
Icon,
Portal,
};
/**
* Add in here code to run once the page is loaded.
*/
document.addEventListener('DOMContentLoaded', () => {
initUpgradeNotification();
});
|
ajax/libs/material-ui/4.11.2/Breadcrumbs/Breadcrumbs.min.js | cdnjs/cdnjs | "use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.styles=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),React=_interopRequireWildcard(require("react")),_reactIs=require("react-is"),_propTypes=_interopRequireDefault(require("prop-types")),_clsx=_interopRequireDefault(require("clsx")),_withStyles=_interopRequireDefault(require("../styles/withStyles")),_Typography=_interopRequireDefault(require("../Typography")),_BreadcrumbCollapsed=_interopRequireDefault(require("./BreadcrumbCollapsed")),styles={root:{},ol:{display:"flex",flexWrap:"wrap",alignItems:"center",padding:0,margin:0,listStyle:"none"},li:{},separator:{display:"flex",userSelect:"none",marginLeft:8,marginRight:8}};function insertSeparators(a,o,s){return a.reduce(function(e,r,t){return t<a.length-1?e=e.concat(r,React.createElement("li",{"aria-hidden":!0,key:"separator-".concat(t),className:o},s)):e.push(r),e},[])}exports.styles=styles;var Breadcrumbs=React.forwardRef(function(e,r){var t,a=e.children,o=e.classes,s=e.className,l=e.component,i=void 0===l?"nav":l,n=e.expandText,p=void 0===n?"Show path":n,u=e.itemsAfterCollapse,c=void 0===u?1:u,l=e.itemsBeforeCollapse,d=void 0===l?1:l,n=e.maxItems,m=void 0===n?8:n,u=e.separator,l=void 0===u?"/":u,n=(0,_objectWithoutProperties2.default)(e,["children","classes","className","component","expandText","itemsAfterCollapse","itemsBeforeCollapse","maxItems","separator"]),u=React.useState(!1),e=u[0],f=u[1],_=React.Children.toArray(a).filter(function(e){return"production"!==process.env.NODE_ENV&&(0,_reactIs.isFragment)(e)&&console.error(["Material-UI: The Breadcrumbs component doesn't accept a Fragment as a child.","Consider providing an array instead."].join("\n")),React.isValidElement(e)}).map(function(e,r){return React.createElement("li",{className:o.li,key:"child-".concat(r)},e)});return React.createElement(_Typography.default,(0,_extends2.default)({ref:r,component:i,color:"textSecondary",className:(0,_clsx.default)(o.root,s)},n),React.createElement("ol",{className:o.ol},insertSeparators(e||m&&_.length<=m?_:d+c>=(t=_).length?("production"!==process.env.NODE_ENV&&console.error(["Material-UI: You have provided an invalid combination of props to the Breadcrumbs.","itemsAfterCollapse={".concat(c,"} + itemsBeforeCollapse={").concat(d,"} >= maxItems={").concat(m,"}")].join("\n")),t):[].concat((0,_toConsumableArray2.default)(t.slice(0,d)),[React.createElement(_BreadcrumbCollapsed.default,{"aria-label":p,key:"ellipsis",onClick:function(e){f(!0);e=e.currentTarget.parentNode.querySelector("a[href],button,[tabindex]");e&&e.focus()}})],(0,_toConsumableArray2.default)(t.slice(t.length-c,t.length))),o.separator,l)))});"production"!==process.env.NODE_ENV&&(Breadcrumbs.propTypes={children:_propTypes.default.node,classes:_propTypes.default.object,className:_propTypes.default.string,component:_propTypes.default.elementType,expandText:_propTypes.default.string,itemsAfterCollapse:_propTypes.default.number,itemsBeforeCollapse:_propTypes.default.number,maxItems:_propTypes.default.number,separator:_propTypes.default.node});var _default=(0,_withStyles.default)(styles,{name:"MuiBreadcrumbs"})(Breadcrumbs);exports.default=_default; |
shared/modules/utils/components/StepButtons.js | founderlab/fl-base-webapp | import _ from 'lodash' // eslint-disable-line
import React from 'react'
import PropTypes from 'prop-types'
import { Row, Col } from 'reactstrap'
import Button from './Button'
export default class StepButtons extends React.PureComponent {
static propTypes = {
loading: PropTypes.bool,
nextDisabled: PropTypes.bool,
onBack: PropTypes.func,
onNext: PropTypes.func,
nextText: PropTypes.node,
color: PropTypes.string,
size: PropTypes.string,
}
static defaultProps ={
nextText: 'Continue',
color: 'primary',
size: 'lg',
}
render() {
const { loading, nextDisabled, onBack, onNext, nextText, color, size } = this.props
const buttonProps = {loading, color, size}
if (onNext) buttonProps.onClick = onNext
if (nextDisabled) buttonProps.disabled = true
return (
<Row className="mt-4 align-items-center justify-content-between">
<Col xs="auto">
{onBack && <Button outline color={color} disabled={loading} size={size} onClick={onBack}>Back</Button>}
</Col>
<Col xs="auto">
<Button type="submit" {...buttonProps}>{nextText}</Button>
</Col>
</Row>
)
}
}
|
client/src/containers/RSVPForm/RSVPFormComponent.js | pqmcgill/stamp-wedding-app | import React from 'react';
import { connect } from 'react-redux';
import { Field, formValueSelector } from 'redux-form';
import { Row, Col } from 'react-flexbox-grid-aphrodite';
import { css } from 'aphrodite';
import styles from './styles';
import { RadioButton } from 'material-ui/RadioButton';
import ActionFavorite from 'material-ui/svg-icons/action/favorite';
import ActionFavoriteBorder from 'material-ui/svg-icons/action/favorite-border';
import { RadioButtonGroup, Checkbox } from 'redux-form-material-ui';
const Form = ({ handleSubmit, user, guestRSVP, plusOneRSVP, dirty, error, ...props }) => {
const hasGuestRSVPd = guestRSVP === 'YES';
const hasPlusOneRSVPd = plusOneRSVP === 'YES';
let buttonClassName, buttonWrapperClassName;
const capitalize = (val) => {
if (!val) return;
return val.charAt(0).toUpperCase() + val.substring(1, val.length);
};
buttonClassName = (dirty && !error) ?
css(styles.submitBtn) :
css(styles.submitBtn, styles.disabled);
buttonWrapperClassName = (dirty && !error) ?
css(styles.buttonWrapper) :
css(styles.buttonWrapperDisabled);
return (
<form onSubmit={ handleSubmit } className=" quicksandRegular">
<Row center="xs,sm,md,lg" className={ css(styles.guestRow) }>
<Col xsOffset={0} smOffset={0} mdOffset={1} lgOffset={1} xs={11} sm={5} md={4} lg={4}>
<div className={ css(styles.formSection) }>
<Row start="xs,sm,md,lg">
<Col xs={12} className={ css(styles.formHeader) + ' princessSofia'}>
{ capitalize(user.guestName) }
</Col>
</Row>
<Row start="xs,sm,md,lg">
<Col xs={12}>
<p className={ css(styles.radioQuestion) }>Are you able to attend the wedding?</p>
<Field name="guestRSVP" component={ RadioButtonGroup }>
<RadioButton value="YES" label="Yes" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="NO" label="No" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
</Field>
</Col>
</Row>
{ hasGuestRSVPd ?
<Row start="xs,sm,md,lg">
<Col xs={12}>
<p className={ css(styles.radioQuestion) }>What would you like for dinner?</p>
<Field name="guestDinnerSelection" component={ RadioButtonGroup }>
<RadioButton value="BRISKET" label="brisket" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="PULLED_PORT" label="pulled pork" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="VEGETARIAN" label="vegetarian meal" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="VEGAN" label="vegan meal" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
</Field>
</Col>
</Row>
:''}
{ hasGuestRSVPd ?
<Row start="xs,sm,md,lg">
<Col xs={12}>
<p className={ css(styles.radioQuestion) }>I dance better when I drink...</p>
<Field name="guestBeverageSelection" component={ RadioButtonGroup }>
<RadioButton value="BEER" label="Beer" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="WINE_SWEET" label="Wine (Sweet)" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="WINE_DRY" label="Wine (Dry)" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="NONALC" label="Non alcoholic beverages" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
</Field>
</Col>
</Row>
:''}
</div>
</Col>
<Col xs={11} sm={5} md={4} lg={4}>
<div className={ css(styles.formSection) }>
<Row>
<Col xs={12} className={ css(styles.formHeader) + ' princessSofia'}>
{ (user.plusOneName && user.plusOneName.length > 0) ? capitalize(user.plusOneName) : 'Plus One' }
</Col>
</Row>
<Row start="xs,sm,md,lg">
<Col xs={12}>
<p className={ css(styles.radioQuestion) }>Are you able to attend the wedding?</p>
<Field name="plusOneRSVP" component={ RadioButtonGroup }>
<RadioButton value="YES" label="Yes" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="NO" label="No" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
</Field>
</Col>
</Row>
{ hasPlusOneRSVPd ?
<Row start="xs,sm,md,lg">
<Col xs={12}>
<p className={ css(styles.radioQuestion) }>What would you like for dinner?</p>
<Field name="plusOneDinnerSelection" component={ RadioButtonGroup }>
<RadioButton value="BRISKET" label="brisket" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="PULLED_PORT" label="pulled pork" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="VEGETARIAN" label="vegetarian meal" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="VEGAN" label="vegan meal" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
</Field>
</Col>
</Row>
:''}
{ hasPlusOneRSVPd ?
<Row start="xs,sm,md,lg">
<Col xs={12}>
<p className={ css(styles.radioQuestion) }>I dance better when I drink...</p>
<Field name="plusOneBeverageSelection" component={ RadioButtonGroup }>
<RadioButton value="BEER" label="Beer" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="WINE_SWEET" label="Wine (Sweet)" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="WINE_DRY" label="Wine (Dry)" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="NONALC" label="Non alcoholic beverages" checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
</Field>
</Col>
</Row>
:''}
</div>
</Col>
</Row>
{ hasGuestRSVPd || hasPlusOneRSVPd ?
<Row center="xs,sm,md,lg">
<Col xs={12} className={ css(styles.formHeaderCenter) + ' princessSofia'}>
General Questions
</Col>
<Col xs={11} sm={10} md={7} lg={7}>
<Row start="xs,sm,md,lg">
<Col xs={12}>
<p className={ css(styles.radioQuestion) }>Will you be staying on the property overnight after the wedding? (See our FAQ page for more details.)</p>
<Field name="overnightSelection" component={ RadioButtonGroup }>
<RadioButton value="YES" label="Yes, and I know I need to bring my own tent to stay in." checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
<RadioButton value="NO" label="No, I am leaving after the reception and staying elsewhere." checkedIcon={<ActionFavorite />} uncheckedIcon={<ActionFavoriteBorder />}/>
</Field>
</Col>
</Row>
</Col>
<Col xs={11} sm={10} md={7} lg={7}>
<Row start="xs,sm,md,lg">
<Col xs={12}>
<p className={ css(styles.radioQuestion) }>What flavors of ice cream do you like? (Check all that apply)</p>
<Field name="iceCreamSelections.STRAWBERRY" label="strawberry" component={ Checkbox } />
<Field name="iceCreamSelections.MINTCHOCCHIP" label="mint chocolate chip" component={ Checkbox } />
<Field name="iceCreamSelections.COOKIES" label="cookies 'n cream" component={ Checkbox } />
<Field name="iceCreamSelections.VANILLA" label="vanilla" component={ Checkbox } />
<Field name="iceCreamSelections.GROSS" label="eww, ice cream is gross!" component={ Checkbox } />
</Col>
</Row>
</Col>
</Row>
:''}
<Row center="xs,sm,md,lg" className={ css( styles.submitContainer) }>
{ dirty && error ? '*some required fields needed' : '' }
<div className={ buttonWrapperClassName }><button className={ buttonClassName } label="Save changes" type="submit">SUBMIT RESPONSE</button></div>
</Row>
</form>
);
};
const selector = formValueSelector('rsvp');
const SelectingFormValuesForm = connect(
state => {
const { guestRSVP, plusOneRSVP } = selector(state, 'guestRSVP', 'plusOneRSVP');
return {
guestRSVP,
plusOneRSVP
};
}
)(Form);
export default SelectingFormValuesForm;
|
packages/flow-upgrade/src/upgrades/0.53.0/ReactComponentExplicitTypeArgs/__tests__/fixtures/DefaultPropsUninitialized.js | mroch/flow | // @flow
import React from 'react';
class MyComponent extends React.Component {
static defaultProps: DefaultProps;
props: Props;
defaultProps: T;
static props: T;
static state: T;
a: T;
b = 5;
c: T = 5;
method() {}
}
const expression = () =>
class extends React.Component {
static defaultProps: DefaultProps;
props: Props;
defaultProps: T;
static props: T;
static state: T;
a: T;
b = 5;
c: T = 5;
method() {}
}
|
cc-install/js/jquery.min.js | alx/CumulusClips | /*!
* jQuery JavaScript Library v1.6.1
* http://jquery.com/
*
* Copyright 2011, John Resig
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Includes Sizzle.js
* http://sizzlejs.com/
* Copyright 2011, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
*
* Date: Thu May 12 15:04:36 2011 -0400
*/
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!cj[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c.body.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write("<!doctype><html><body></body></html>");b=cl.createElement(a),cl.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ck)}cj[a]=d}return cj[a]}function cu(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function ct(){cq=b}function cs(){setTimeout(ct,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function ca(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function b_(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bF.test(a)?d(a,e):b_(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)b_(a+"["+e+"]",b[e],c,d);else d(a,b)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bU,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bQ),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bD(a,b,c){var d=b==="width"?bx:by,e=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return e;f.each(d,function(){c||(e-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?e+=parseFloat(f.css(a,"margin"+this))||0:e-=parseFloat(f.css(a,"border"+this+"Width"))||0});return e}function bn(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bm(a){f.nodeName(a,"input")?bl(a):a.getElementsByTagName&&f.grep(a.getElementsByTagName("input"),bl)}function bl(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bk(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bj(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bi(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bh(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function X(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(S.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b){return(a&&a!=="*"?a+".":"")+b.replace(A,"`").replace(B,"&")}function N(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(y,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function L(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function F(){return!0}function E(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:E?function(a){return a==null?"":E.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?C.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(F)return F.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=D.call(arguments,2),g=function(){return a.apply(c,f.concat(D.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){G["[object "+b+"]"]=b.toLowerCase()}),x=e.uaMatch(w),x.browser&&(e.browser[x.browser]=!0,e.browser.version=x.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?z=function(){c.removeEventListener("DOMContentLoaded",z,!1),e.ready()}:c.attachEvent&&(z=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",z),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g](h)}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r;a.setAttribute("className","t"),a.innerHTML=" <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};f=c.createElement("select"),g=f.appendChild(c.createElement("option")),h=a.getElementsByTagName("input")[0],j={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},h.checked=!0,j.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,j.optDisabled=!g.disabled;try{delete a.test}catch(s){j.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function b(){j.noCloneEvent=!1,a.detachEvent("onclick",b)}),a.cloneNode(!0).fireEvent("onclick")),h=c.createElement("input"),h.value="t",h.setAttribute("type","radio"),j.radioValue=h.value==="t",h.setAttribute("checked","checked"),a.appendChild(h),k=c.createDocumentFragment(),k.appendChild(a.firstChild),j.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",l=c.createElement("body"),m={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(q in m)l.style[q]=m[q];l.appendChild(a),b.insertBefore(l,b.firstChild),j.appendChecked=h.checked,j.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,j.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",j.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",n=a.getElementsByTagName("td"),r=n[0].offsetHeight===0,n[0].style.display="",n[1].style.display="none",j.reliableHiddenOffsets=r&&n[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(i=c.createElement("div"),i.style.width="0",i.style.marginRight="0",a.appendChild(i),j.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(i,null)||{marginRight:0}).marginRight,10)||0)===0),l.innerHTML="",b.removeChild(l);if(a.attachEvent)for(q in{submit:1,change:1,focusin:1})p="on"+q,r=p in a,r||(a.setAttribute(p,"return;"),r=typeof a[p]=="function"),j[q+"Bubbles"]=r;return j}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u=/\:/,v,w;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.addClass(a.call(this,b,c.attr("class")||""))});if(a&&typeof a=="string"){var b=(a||"").split(o);for(var c=0,d=this.length;c<d;c++){var e=this[c];if(e.nodeType===1)if(!e.className)e.className=a;else{var g=" "+e.className+" ",h=e.className;for(var i=0,j=b.length;i<j;i++)g.indexOf(" "+b[i]+" ")<0&&(h+=" "+b[i]);e.className=f.trim(h)}}}return this},removeClass:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a=="string"||a===b){var c=(a||"").split(o);for(var d=0,e=this.length;d<e;d++){var g=this[d];if(g.nodeType===1&&g.className)if(a){var h=(" "+g.className+" ").replace(n," ");for(var i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){var d=f(this);d.toggleClass(a.call(this,c,d.attr("class"),b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c],i||(!t.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?v&&(f.nodeName(a,"form")||u.test(c))&&(i=v):i=w);if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return a[f.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},f.attrHooks.value={get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return a.value},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=Object.prototype.hasOwnProperty,y=/\.(.*)$/,z=/^(?:textarea|input|select)$/i,A=/\./g,B=/ /g,C=/[^\w\s.|`]/g,D=function(a){return a.replace(C,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=E;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=E);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),D).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem
)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,O(a.origType,a.selector),f.extend({},a,{handler:N,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,O(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?F:E):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=F;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=F;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=F,this.stopPropagation()},isDefaultPrevented:E,isPropagationStopped:E,isImmediatePropagationStopped:E};var G=function(a){var b=a.relatedTarget;a.type=a.data;try{if(b&&b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&f.event.handle.apply(this,arguments)}catch(d){}},H=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?H:G,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?H:G)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&f(b).closest("form").length&&L("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&L("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var I,J=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},K=function(c){var d=c.target,e,g;if(!!z.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=J(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:K,beforedeactivate:K,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&K.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&K.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",J(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in I)f.event.add(this,c+".specialChange",I[c]);return z.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return z.test(this.nodeName)}},I=f.event.special.change.filters,I.focus=I.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var M={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||E,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=y.exec(h),k="",j&&(k=j[0],h=h.replace(y,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,M[h]?(a.push(M[h]+k),h=h+k):h=(M[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+O(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+O(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var P=/Until$/,Q=/^(?:parents|prevUntil|prevAll)/,R=/,/,S=/^.[^:#\[\.,]*$/,T=Array.prototype.slice,U=f.expr.match.POS,V={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(X(this,a,!1),"not",a)},filter:function(a){return this.pushStack(X(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=U.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=U.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(W(c[0])||W(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=T.call(arguments);P.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!V[a]?f.unique(e):e,(this.length>1||R.test(d))&&Q.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,_=/<([\w:]+)/,ba=/<tbody/i,bb=/<|&#?\w+;/,bc=/<(?:script|object|embed|option|style)/i,bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Y,""):null;if(typeof a=="string"&&!bc.test(a)&&(f.support.leadingWhitespace||!Z.test(a))&&!bg[(_.exec(a)||["",""])[1].toLowerCase()]){a=a.replace($,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bh(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bn)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!bc.test(a[0])&&(f.support.checkClone||!bd.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bj(a,d),e=bk(a),g=bk(d);for(h=0;e[h];++h)bj(e[h],g[h])}if(b){bi(a,d);if(c){e=bk(a),g=bk(d);for(h=0;e[h];++h)bi(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||
b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bb.test(k))k=b.createTextNode(k);else{k=k.replace($,"<$1></$2>");var l=(_.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=ba.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Z.test(k)&&o.insertBefore(b.createTextNode(Z.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bm(k[i]);else bm(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bo=/alpha\([^)]*\)/i,bp=/opacity=([^)]*)/,bq=/-([a-z])/ig,br=/([A-Z]|^ms)/g,bs=/^-?\d+(?:px)?$/i,bt=/^-?\d/,bu=/^[+\-]=/,bv=/[^+\-\.\de]+/g,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB,bC=function(a,b){return b.toUpperCase()};f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0,widows:!0,orphans:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d;if(h==="number"&&isNaN(d)||d==null)return;h==="string"&&bu.test(d)&&(d=+d.replace(bv,"")+parseFloat(f.css(a,c))),h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bq,bC)}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){a.offsetWidth!==0?e=bD(a,b,d):f.swap(a,bw,function(){e=bD(a,b,d)});if(e<=0){e=bz(a,b,b),e==="0px"&&bB&&(e=bB(a,b,b));if(e!=null)return e===""||e==="auto"?"0px":e}if(e<0||e==null){e=a.style[b];return e===""||e==="auto"?"0px":e}return typeof e=="string"?e:e+"px"}},set:function(a,b){if(!bs.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bp.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bo.test(g)?g.replace(bo,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,c){var d,e,g;c=c.replace(br,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bs.test(d)&&bt.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bE=/%20/g,bF=/\[\]$/,bG=/\r?\n/g,bH=/#.*$/,bI=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bJ=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bK=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bL=/^(?:GET|HEAD)$/,bM=/^\/\//,bN=/\?/,bO=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bP=/^(?:select|textarea)/i,bQ=/\s+/,bR=/([?&])_=[^&]*/,bS=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bT=f.fn.load,bU={},bV={},bW,bX;try{bW=e.href}catch(bY){bW=c.createElement("a"),bW.href="",bW=bW.href}bX=bS.exec(bW.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bT)return bT.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bO,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bP.test(this.nodeName)||bJ.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bG,"\r\n")}}):{name:b.name,value:c.replace(bG,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bW,isLocal:bK.test(bX[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bZ(bU),ajaxTransport:bZ(bV),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?ca(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=cb(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bI.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bH,"").replace(bM,bX[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bQ),d.crossDomain==null&&(r=bS.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bX[1]&&r[2]==bX[2]&&(r[3]||(r[1]==="http:"?80:443))==(bX[3]||(bX[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bU,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bL.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bN.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bR,"$1_="+x);d.url=y+(y===d.url?(bN.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bV,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bE,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq,cr=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cv(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cm.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=cn.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this),f.isFunction(d.old)&&d.old.call(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function h(a){return d.step(a)}var d=this,e=f.fx,g;this.startTime=cq||cs(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,h.elem=this.elem,h()&&f.timers.push(h)&&!co&&(cr?(co=1,g=function(){co&&(cr(g),e.tick())},cr(g)):co=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cq||cs(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(co),co=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); |
monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/utils/InterfaceSelection.js | guardicore/monkey | import React from 'react';
import InlineSelection from '../../../ui-components/inline-selection/InlineSelection';
import LocalManualRunOptions from '../RunManually/LocalManualRunOptions';
function InterfaceSelection(props) {
return InlineSelection(getContents, props, LocalManualRunOptions)
}
const getContents = (props) => {
const ips = props.ips.map((ip) =>
<div key={ip}>{ip}</div>
);
return (<div>{ips}</div>);
}
export default InterfaceSelection;
|
app/components/ProgressBar.js | AngelGallegosE/Osiris | import React from 'react';
class ProgressBar extends React.Component {
render() {
return (
<div id="MainProgressBarContainer">
<progress id="progressBar" value={this.props.value} max="100" className={this.props.value===0?'hidden':''}></progress>
</div>
);
}
}
ProgressBar.propTypes = {
value: React.PropTypes.number
};
export default ProgressBar; |
src/views/Tutorial.js | chrisweilun/lavidioNewSite | import React from 'react';
import '../styles/video.css'
import {Helmet} from 'react-helmet'
//this is how state less setup
const Tutorial = props =>
<div className='container'>
<Helmet>
<title>Tutorial || LaVideoSolution</title>
</Helmet>
<div className='row'>
<div className='col s12 flow-text'>
<div className='video-container z-depth-1'>
<iframe
title="Just Donate"
width="560"
height="315" src="https://www.youtube.com/embed/ZeNFXJ9PfK0" frameBorder="10"
allowFullScreen =""
/>
</div>
</div>
<div>
<p className='col s12 flow-text'>
If you like this video please donate to
<a href="mailto:chrisweilun@hotmail.com"> chrisweilun@hotmail.com </a>
USD9999999999.
</p>
</div>
</div>
</div>
export default Tutorial
|
admin/client/components/CreateForm.js | Ftonso/keystone | import React from 'react';
import Fields from '../fields';
import InvalidFieldType from './InvalidFieldType';
import { Alert, Button, Form, Modal } from 'elemental';
var CreateForm = React.createClass({
displayName: 'CreateForm',
propTypes: {
err: React.PropTypes.object,
isOpen: React.PropTypes.bool,
list: React.PropTypes.object,
onCancel: React.PropTypes.func,
values: React.PropTypes.object,
},
getDefaultProps () {
return {
err: null,
values: {},
isOpen: false
};
},
getInitialState () {
var values = Object.assign({}, this.props.values);
Object.keys(this.props.list.fields).forEach(key => {
var field = this.props.list.fields[key];
if (!values[field.path]) {
values[field.path] = field.defaultValue;
}
});
return {
values: values
};
},
handleChange (event) {
var values = Object.assign({}, this.state.values);
values[event.path] = event.value;
this.setState({
values: values
});
},
componentDidUpdate (prevProps) {
if (this.props.isOpen !== prevProps.isOpen) {
// focus the focusTarget after the "open modal" CSS animation has started
setTimeout(() => this.refs.focusTarget && this.refs.focusTarget.focus(), 0);
}
},
componentDidMount () {
if (this.refs.focusTarget) {
this.refs.focusTarget.focus();
}
},
getFieldProps (field) {
var props = Object.assign({}, field);
props.value = this.state.values[field.path];
props.values = this.state.values;
props.onChange = this.handleChange;
props.mode = 'create';
props.key = field.path;
return props;
},
renderAlerts () {
if (!this.props.err || !this.props.err.errors) return;
var alertContent;
var errorCount = Object.keys(this.props.err.errors).length;
var messages = Object.keys(this.props.err.errors).map((path) => {
return errorCount > 1 ? <li key={path}>{this.props.err.errors[path].message}</li> : <div key={path}>{this.props.err.errors[path].message}</div>;
});
if (errorCount > 1) {
alertContent = (
<div>
<h4>There were {errorCount} errors creating the new {this.props.list.singular}:</h4>
<ul>{messages}</ul>
</div>
);
} else {
alertContent = messages;
}
return <Alert type="danger">{alertContent}</Alert>;
},
renderForm () {
if (!this.props.isOpen) return;
var form = [];
var list = this.props.list;
var formAction = `${Keystone.adminPath}/${list.path}`;
var nameField = this.props.list.nameField;
var focusRef;
if (list.nameIsInitial) {
var nameFieldProps = this.getFieldProps(nameField);
nameFieldProps.ref = focusRef = 'focusTarget';
if (nameField.type === 'text') {
nameFieldProps.className = 'item-name-field';
nameFieldProps.placeholder = nameField.label;
nameFieldProps.label = false;
}
form.push(React.createElement(Fields[nameField.type], nameFieldProps));
}
Object.keys(list.initialFields).forEach(key => {
var field = list.fields[list.initialFields[key]];
if ('function' !== typeof Fields[field.type]) {
form.push(React.createElement(InvalidFieldType, { type: field.type, path: field.path, key: field.path }));
return;
}
var fieldProps = this.getFieldProps(field);
if (!focusRef) {
fieldProps.ref = focusRef = 'focusTarget';
}
form.push(React.createElement(Fields[field.type], fieldProps));
});
return (
<Form type="horizontal" encType="multipart/form-data" method="post" action={formAction} className="create-form">
<input type="hidden" name="action" value="create" />
<input type="hidden" name={Keystone.csrf.key} value={Keystone.csrf.value} />
<Modal.Header text={'Create a new ' + list.singular} onClose={this.props.onCancel} showCloseButton />
<Modal.Body>
{this.renderAlerts()}
{form}
</Modal.Body>
<Modal.Footer>
<Button type="success" submit>Create</Button>
<Button type="link-cancel" onClick={this.props.onCancel}>Cancel</Button>
</Modal.Footer>
</Form>
);
},
render () {
return (
<Modal isOpen={this.props.isOpen} onCancel={this.props.onCancel} backdropClosesModal>
{this.renderForm()}
</Modal>
);
}
});
module.exports = CreateForm;
|
src/components/FinalizeAuction/FinalizeAuctionInfo.js | PhyrexTsai/ens-bid-dapp | // @flow weak
import React from 'react';
import Button from 'material-ui/Button';
import Card from 'material-ui/Card';
import './FinalizeAuctionInfo.css';
export const FinalizeAuctionInfo = (props) => (
<Card raised>
<div className='FinalizeAuctionInfo'>
<h3>ENS: {props.searchName}.eth</h3>
<p>
Congratulations! You've owned the <strong>{props.searchName}.eth</strong> domain name!
</p>
<div className='FinalizeAuctionInfo-actions'>
<Button raised onClick={() => props.backToSearch()}>
BACK TO SEARCH
</Button>
{/*<Button raised>MY ENS LIST</Button>*/}
</div>
</div>
</Card>
); |
ajax/libs/x-editable/1.5.0/bootstrap-editable/js/bootstrap-editable.js | ComputerWolf/cdnjs | /*! X-editable - v1.5.0
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
/**
Form with single input element, two buttons and two states: normal/loading.
Applied as jQuery method to DIV tag (not to form tag!). This is because form can be in loading state when spinner shown.
Editableform is linked with one of input types, e.g. 'text', 'select' etc.
@class editableform
@uses text
@uses textarea
**/
(function ($) {
"use strict";
var EditableForm = function (div, options) {
this.options = $.extend({}, $.fn.editableform.defaults, options);
this.$div = $(div); //div, containing form. Not form tag. Not editable-element.
if(!this.options.scope) {
this.options.scope = this;
}
//nothing shown after init
};
EditableForm.prototype = {
constructor: EditableForm,
initInput: function() { //called once
//take input from options (as it is created in editable-element)
this.input = this.options.input;
//set initial value
//todo: may be add check: typeof str === 'string' ?
this.value = this.input.str2value(this.options.value);
//prerender: get input.$input
this.input.prerender();
},
initTemplate: function() {
this.$form = $($.fn.editableform.template);
},
initButtons: function() {
var $btn = this.$form.find('.editable-buttons');
$btn.append($.fn.editableform.buttons);
if(this.options.showbuttons === 'bottom') {
$btn.addClass('editable-buttons-bottom');
}
},
/**
Renders editableform
@method render
**/
render: function() {
//init loader
this.$loading = $($.fn.editableform.loading);
this.$div.empty().append(this.$loading);
//init form template and buttons
this.initTemplate();
if(this.options.showbuttons) {
this.initButtons();
} else {
this.$form.find('.editable-buttons').remove();
}
//show loading state
this.showLoading();
//flag showing is form now saving value to server.
//It is needed to wait when closing form.
this.isSaving = false;
/**
Fired when rendering starts
@event rendering
@param {Object} event event object
**/
this.$div.triggerHandler('rendering');
//init input
this.initInput();
//append input to form
this.$form.find('div.editable-input').append(this.input.$tpl);
//append form to container
this.$div.append(this.$form);
//render input
$.when(this.input.render())
.then($.proxy(function () {
//setup input to submit automatically when no buttons shown
if(!this.options.showbuttons) {
this.input.autosubmit();
}
//attach 'cancel' handler
this.$form.find('.editable-cancel').click($.proxy(this.cancel, this));
if(this.input.error) {
this.error(this.input.error);
this.$form.find('.editable-submit').attr('disabled', true);
this.input.$input.attr('disabled', true);
//prevent form from submitting
this.$form.submit(function(e){ e.preventDefault(); });
} else {
this.error(false);
this.input.$input.removeAttr('disabled');
this.$form.find('.editable-submit').removeAttr('disabled');
var value = (this.value === null || this.value === undefined || this.value === '') ? this.options.defaultValue : this.value;
this.input.value2input(value);
//attach submit handler
this.$form.submit($.proxy(this.submit, this));
}
/**
Fired when form is rendered
@event rendered
@param {Object} event event object
**/
this.$div.triggerHandler('rendered');
this.showForm();
//call postrender method to perform actions required visibility of form
if(this.input.postrender) {
this.input.postrender();
}
}, this));
},
cancel: function() {
/**
Fired when form was cancelled by user
@event cancel
@param {Object} event event object
**/
this.$div.triggerHandler('cancel');
},
showLoading: function() {
var w, h;
if(this.$form) {
//set loading size equal to form
w = this.$form.outerWidth();
h = this.$form.outerHeight();
if(w) {
this.$loading.width(w);
}
if(h) {
this.$loading.height(h);
}
this.$form.hide();
} else {
//stretch loading to fill container width
w = this.$loading.parent().width();
if(w) {
this.$loading.width(w);
}
}
this.$loading.show();
},
showForm: function(activate) {
this.$loading.hide();
this.$form.show();
if(activate !== false) {
this.input.activate();
}
/**
Fired when form is shown
@event show
@param {Object} event event object
**/
this.$div.triggerHandler('show');
},
error: function(msg) {
var $group = this.$form.find('.control-group'),
$block = this.$form.find('.editable-error-block'),
lines;
if(msg === false) {
$group.removeClass($.fn.editableform.errorGroupClass);
$block.removeClass($.fn.editableform.errorBlockClass).empty().hide();
} else {
//convert newline to <br> for more pretty error display
if(msg) {
lines = msg.split("\n");
for (var i = 0; i < lines.length; i++) {
lines[i] = $('<div>').text(lines[i]).html();
}
msg = lines.join('<br>');
}
$group.addClass($.fn.editableform.errorGroupClass);
$block.addClass($.fn.editableform.errorBlockClass).html(msg).show();
}
},
submit: function(e) {
e.stopPropagation();
e.preventDefault();
var error,
newValue = this.input.input2value(); //get new value from input
//validation
if (error = this.validate(newValue)) {
this.error(error);
this.showForm();
return;
}
//if value not changed --> trigger 'nochange' event and return
/*jslint eqeq: true*/
if (!this.options.savenochange && this.input.value2str(newValue) == this.input.value2str(this.value)) {
/*jslint eqeq: false*/
/**
Fired when value not changed but form is submitted. Requires savenochange = false.
@event nochange
@param {Object} event event object
**/
this.$div.triggerHandler('nochange');
return;
}
//convert value for submitting to server
var submitValue = this.input.value2submit(newValue);
this.isSaving = true;
//sending data to server
$.when(this.save(submitValue))
.done($.proxy(function(response) {
this.isSaving = false;
//run success callback
var res = typeof this.options.success === 'function' ? this.options.success.call(this.options.scope, response, newValue) : null;
//if success callback returns false --> keep form open and do not activate input
if(res === false) {
this.error(false);
this.showForm(false);
return;
}
//if success callback returns string --> keep form open, show error and activate input
if(typeof res === 'string') {
this.error(res);
this.showForm();
return;
}
//if success callback returns object like {newValue: <something>} --> use that value instead of submitted
//it is usefull if you want to chnage value in url-function
if(res && typeof res === 'object' && res.hasOwnProperty('newValue')) {
newValue = res.newValue;
}
//clear error message
this.error(false);
this.value = newValue;
/**
Fired when form is submitted
@event save
@param {Object} event event object
@param {Object} params additional params
@param {mixed} params.newValue raw new value
@param {mixed} params.submitValue submitted value as string
@param {Object} params.response ajax response
@example
$('#form-div').on('save'), function(e, params){
if(params.newValue === 'username') {...}
});
**/
this.$div.triggerHandler('save', {newValue: newValue, submitValue: submitValue, response: response});
}, this))
.fail($.proxy(function(xhr) {
this.isSaving = false;
var msg;
if(typeof this.options.error === 'function') {
msg = this.options.error.call(this.options.scope, xhr, newValue);
} else {
msg = typeof xhr === 'string' ? xhr : xhr.responseText || xhr.statusText || 'Unknown error!';
}
this.error(msg);
this.showForm();
}, this));
},
save: function(submitValue) {
//try parse composite pk defined as json string in data-pk
this.options.pk = $.fn.editableutils.tryParseJson(this.options.pk, true);
var pk = (typeof this.options.pk === 'function') ? this.options.pk.call(this.options.scope) : this.options.pk,
/*
send on server in following cases:
1. url is function
2. url is string AND (pk defined OR send option = always)
*/
send = !!(typeof this.options.url === 'function' || (this.options.url && ((this.options.send === 'always') || (this.options.send === 'auto' && pk !== null && pk !== undefined)))),
params;
if (send) { //send to server
this.showLoading();
//standard params
params = {
name: this.options.name || '',
value: submitValue,
pk: pk
};
//additional params
if(typeof this.options.params === 'function') {
params = this.options.params.call(this.options.scope, params);
} else {
//try parse json in single quotes (from data-params attribute)
this.options.params = $.fn.editableutils.tryParseJson(this.options.params, true);
$.extend(params, this.options.params);
}
if(typeof this.options.url === 'function') { //user's function
return this.options.url.call(this.options.scope, params);
} else {
//send ajax to server and return deferred object
return $.ajax($.extend({
url : this.options.url,
data : params,
type : 'POST'
}, this.options.ajaxOptions));
}
}
},
validate: function (value) {
if (value === undefined) {
value = this.value;
}
if (typeof this.options.validate === 'function') {
return this.options.validate.call(this.options.scope, value);
}
},
option: function(key, value) {
if(key in this.options) {
this.options[key] = value;
}
if(key === 'value') {
this.setValue(value);
}
//do not pass option to input as it is passed in editable-element
},
setValue: function(value, convertStr) {
if(convertStr) {
this.value = this.input.str2value(value);
} else {
this.value = value;
}
//if form is visible, update input
if(this.$form && this.$form.is(':visible')) {
this.input.value2input(this.value);
}
}
};
/*
Initialize editableform. Applied to jQuery object.
@method $().editableform(options)
@params {Object} options
@example
var $form = $('<div>').editableform({
type: 'text',
name: 'username',
url: '/post',
value: 'vitaliy'
});
//to display form you should call 'render' method
$form.editableform('render');
*/
$.fn.editableform = function (option) {
var args = arguments;
return this.each(function () {
var $this = $(this),
data = $this.data('editableform'),
options = typeof option === 'object' && option;
if (!data) {
$this.data('editableform', (data = new EditableForm(this, options)));
}
if (typeof option === 'string') { //call method
data[option].apply(data, Array.prototype.slice.call(args, 1));
}
});
};
//keep link to constructor to allow inheritance
$.fn.editableform.Constructor = EditableForm;
//defaults
$.fn.editableform.defaults = {
/* see also defaults for input */
/**
Type of input. Can be <code>text|textarea|select|date|checklist</code>
@property type
@type string
@default 'text'
**/
type: 'text',
/**
Url for submit, e.g. <code>'/post'</code>
If function - it will be called instead of ajax. Function should return deferred object to run fail/done callbacks.
@property url
@type string|function
@default null
@example
url: function(params) {
var d = new $.Deferred;
if(params.value === 'abc') {
return d.reject('error message'); //returning error via deferred object
} else {
//async saving data in js model
someModel.asyncSaveMethod({
...,
success: function(){
d.resolve();
}
});
return d.promise();
}
}
**/
url:null,
/**
Additional params for submit. If defined as <code>object</code> - it is **appended** to original ajax data (pk, name and value).
If defined as <code>function</code> - returned object **overwrites** original ajax data.
@example
params: function(params) {
//originally params contain pk, name and value
params.a = 1;
return params;
}
@property params
@type object|function
@default null
**/
params:null,
/**
Name of field. Will be submitted on server. Can be taken from <code>id</code> attribute
@property name
@type string
@default null
**/
name: null,
/**
Primary key of editable object (e.g. record id in database). For composite keys use object, e.g. <code>{id: 1, lang: 'en'}</code>.
Can be calculated dynamically via function.
@property pk
@type string|object|function
@default null
**/
pk: null,
/**
Initial value. If not defined - will be taken from element's content.
For __select__ type should be defined (as it is ID of shown text).
@property value
@type string|object
@default null
**/
value: null,
/**
Value that will be displayed in input if original field value is empty (`null|undefined|''`).
@property defaultValue
@type string|object
@default null
@since 1.4.6
**/
defaultValue: null,
/**
Strategy for sending data on server. Can be `auto|always|never`.
When 'auto' data will be sent on server **only if pk and url defined**, otherwise new value will be stored locally.
@property send
@type string
@default 'auto'
**/
send: 'auto',
/**
Function for client-side validation. If returns string - means validation not passed and string showed as error.
@property validate
@type function
@default null
@example
validate: function(value) {
if($.trim(value) == '') {
return 'This field is required';
}
}
**/
validate: null,
/**
Success callback. Called when value successfully sent on server and **response status = 200**.
Usefull to work with json response. For example, if your backend response can be <code>{success: true}</code>
or <code>{success: false, msg: "server error"}</code> you can check it inside this callback.
If it returns **string** - means error occured and string is shown as error message.
If it returns **object like** <code>{newValue: <something>}</code> - it overwrites value, submitted by user.
Otherwise newValue simply rendered into element.
@property success
@type function
@default null
@example
success: function(response, newValue) {
if(!response.success) return response.msg;
}
**/
success: null,
/**
Error callback. Called when request failed (response status != 200).
Usefull when you want to parse error response and display a custom message.
Must return **string** - the message to be displayed in the error block.
@property error
@type function
@default null
@since 1.4.4
@example
error: function(response, newValue) {
if(response.status === 500) {
return 'Service unavailable. Please try later.';
} else {
return response.responseText;
}
}
**/
error: null,
/**
Additional options for submit ajax request.
List of values: http://api.jquery.com/jQuery.ajax
@property ajaxOptions
@type object
@default null
@since 1.1.1
@example
ajaxOptions: {
type: 'put',
dataType: 'json'
}
**/
ajaxOptions: null,
/**
Where to show buttons: left(true)|bottom|false
Form without buttons is auto-submitted.
@property showbuttons
@type boolean|string
@default true
@since 1.1.1
**/
showbuttons: true,
/**
Scope for callback methods (success, validate).
If <code>null</code> means editableform instance itself.
@property scope
@type DOMElement|object
@default null
@since 1.2.0
@private
**/
scope: null,
/**
Whether to save or cancel value when it was not changed but form was submitted
@property savenochange
@type boolean
@default false
@since 1.2.0
**/
savenochange: false
};
/*
Note: following params could redefined in engine: bootstrap or jqueryui:
Classes 'control-group' and 'editable-error-block' must always present!
*/
$.fn.editableform.template = '<form class="form-inline editableform">'+
'<div class="control-group">' +
'<div><div class="editable-input"></div><div class="editable-buttons"></div></div>'+
'<div class="editable-error-block"></div>' +
'</div>' +
'</form>';
//loading div
$.fn.editableform.loading = '<div class="editableform-loading"></div>';
//buttons
$.fn.editableform.buttons = '<button type="submit" class="editable-submit">ok</button>'+
'<button type="button" class="editable-cancel">cancel</button>';
//error class attached to control-group
$.fn.editableform.errorGroupClass = null;
//error class attached to editable-error-block
$.fn.editableform.errorBlockClass = 'editable-error';
//engine
$.fn.editableform.engine = 'jquery';
}(window.jQuery));
/**
* EditableForm utilites
*/
(function ($) {
"use strict";
//utils
$.fn.editableutils = {
/**
* classic JS inheritance function
*/
inherit: function (Child, Parent) {
var F = function() { };
F.prototype = Parent.prototype;
Child.prototype = new F();
Child.prototype.constructor = Child;
Child.superclass = Parent.prototype;
},
/**
* set caret position in input
* see http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area
*/
setCursorPosition: function(elem, pos) {
if (elem.setSelectionRange) {
elem.setSelectionRange(pos, pos);
} else if (elem.createTextRange) {
var range = elem.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
},
/**
* function to parse JSON in *single* quotes. (jquery automatically parse only double quotes)
* That allows such code as: <a data-source="{'a': 'b', 'c': 'd'}">
* safe = true --> means no exception will be thrown
* for details see http://stackoverflow.com/questions/7410348/how-to-set-json-format-to-html5-data-attributes-in-the-jquery
*/
tryParseJson: function(s, safe) {
if (typeof s === 'string' && s.length && s.match(/^[\{\[].*[\}\]]$/)) {
if (safe) {
try {
/*jslint evil: true*/
s = (new Function('return ' + s))();
/*jslint evil: false*/
} catch (e) {} finally {
return s;
}
} else {
/*jslint evil: true*/
s = (new Function('return ' + s))();
/*jslint evil: false*/
}
}
return s;
},
/**
* slice object by specified keys
*/
sliceObj: function(obj, keys, caseSensitive /* default: false */) {
var key, keyLower, newObj = {};
if (!$.isArray(keys) || !keys.length) {
return newObj;
}
for (var i = 0; i < keys.length; i++) {
key = keys[i];
if (obj.hasOwnProperty(key)) {
newObj[key] = obj[key];
}
if(caseSensitive === true) {
continue;
}
//when getting data-* attributes via $.data() it's converted to lowercase.
//details: http://stackoverflow.com/questions/7602565/using-data-attributes-with-jquery
//workaround is code below.
keyLower = key.toLowerCase();
if (obj.hasOwnProperty(keyLower)) {
newObj[key] = obj[keyLower];
}
}
return newObj;
},
/*
exclude complex objects from $.data() before pass to config
*/
getConfigData: function($element) {
var data = {};
$.each($element.data(), function(k, v) {
if(typeof v !== 'object' || (v && typeof v === 'object' && (v.constructor === Object || v.constructor === Array))) {
data[k] = v;
}
});
return data;
},
/*
returns keys of object
*/
objectKeys: function(o) {
if (Object.keys) {
return Object.keys(o);
} else {
if (o !== Object(o)) {
throw new TypeError('Object.keys called on a non-object');
}
var k=[], p;
for (p in o) {
if (Object.prototype.hasOwnProperty.call(o,p)) {
k.push(p);
}
}
return k;
}
},
/**
method to escape html.
**/
escape: function(str) {
return $('<div>').text(str).html();
},
/*
returns array items from sourceData having value property equal or inArray of 'value'
*/
itemsByValue: function(value, sourceData, valueProp) {
if(!sourceData || value === null) {
return [];
}
if (typeof(valueProp) !== "function") {
var idKey = valueProp || 'value';
valueProp = function (e) { return e[idKey]; };
}
var isValArray = $.isArray(value),
result = [],
that = this;
$.each(sourceData, function(i, o) {
if(o.children) {
result = result.concat(that.itemsByValue(value, o.children, valueProp));
} else {
/*jslint eqeq: true*/
if(isValArray) {
if($.grep(value, function(v){ return v == (o && typeof o === 'object' ? valueProp(o) : o); }).length) {
result.push(o);
}
} else {
var itemValue = (o && (typeof o === 'object')) ? valueProp(o) : o;
if(value == itemValue) {
result.push(o);
}
}
/*jslint eqeq: false*/
}
});
return result;
},
/*
Returns input by options: type, mode.
*/
createInput: function(options) {
var TypeConstructor, typeOptions, input,
type = options.type;
//`date` is some kind of virtual type that is transformed to one of exact types
//depending on mode and core lib
if(type === 'date') {
//inline
if(options.mode === 'inline') {
if($.fn.editabletypes.datefield) {
type = 'datefield';
} else if($.fn.editabletypes.dateuifield) {
type = 'dateuifield';
}
//popup
} else {
if($.fn.editabletypes.date) {
type = 'date';
} else if($.fn.editabletypes.dateui) {
type = 'dateui';
}
}
//if type still `date` and not exist in types, replace with `combodate` that is base input
if(type === 'date' && !$.fn.editabletypes.date) {
type = 'combodate';
}
}
//`datetime` should be datetimefield in 'inline' mode
if(type === 'datetime' && options.mode === 'inline') {
type = 'datetimefield';
}
//change wysihtml5 to textarea for jquery UI and plain versions
if(type === 'wysihtml5' && !$.fn.editabletypes[type]) {
type = 'textarea';
}
//create input of specified type. Input will be used for converting value, not in form
if(typeof $.fn.editabletypes[type] === 'function') {
TypeConstructor = $.fn.editabletypes[type];
typeOptions = this.sliceObj(options, this.objectKeys(TypeConstructor.defaults));
input = new TypeConstructor(typeOptions);
return input;
} else {
$.error('Unknown type: '+ type);
return false;
}
},
//see http://stackoverflow.com/questions/7264899/detect-css-transitions-using-javascript-and-without-modernizr
supportsTransitions: function () {
var b = document.body || document.documentElement,
s = b.style,
p = 'transition',
v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms'];
if(typeof s[p] === 'string') {
return true;
}
// Tests for vendor specific prop
p = p.charAt(0).toUpperCase() + p.substr(1);
for(var i=0; i<v.length; i++) {
if(typeof s[v[i] + p] === 'string') {
return true;
}
}
return false;
}
};
}(window.jQuery));
/**
Attaches stand-alone container with editable-form to HTML element. Element is used only for positioning, value is not stored anywhere.<br>
This method applied internally in <code>$().editable()</code>. You should subscribe on it's events (save / cancel) to get profit of it.<br>
Final realization can be different: bootstrap-popover, jqueryui-tooltip, poshytip, inline-div. It depends on which js file you include.<br>
Applied as jQuery method.
@class editableContainer
@uses editableform
**/
(function ($) {
"use strict";
var Popup = function (element, options) {
this.init(element, options);
};
var Inline = function (element, options) {
this.init(element, options);
};
//methods
Popup.prototype = {
containerName: null, //method to call container on element
containerDataName: null, //object name in element's .data()
innerCss: null, //tbd in child class
containerClass: 'editable-container editable-popup', //css class applied to container element
defaults: {}, //container itself defaults
init: function(element, options) {
this.$element = $(element);
//since 1.4.1 container do not use data-* directly as they already merged into options.
this.options = $.extend({}, $.fn.editableContainer.defaults, options);
this.splitOptions();
//set scope of form callbacks to element
this.formOptions.scope = this.$element[0];
this.initContainer();
//flag to hide container, when saving value will finish
this.delayedHide = false;
//bind 'destroyed' listener to destroy container when element is removed from dom
this.$element.on('destroyed', $.proxy(function(){
this.destroy();
}, this));
//attach document handler to close containers on click / escape
if(!$(document).data('editable-handlers-attached')) {
//close all on escape
$(document).on('keyup.editable', function (e) {
if (e.which === 27) {
$('.editable-open').editableContainer('hide');
//todo: return focus on element
}
});
//close containers when click outside
//(mousedown could be better than click, it closes everything also on drag drop)
$(document).on('click.editable', function(e) {
var $target = $(e.target), i,
exclude_classes = ['.editable-container',
'.ui-datepicker-header',
'.datepicker', //in inline mode datepicker is rendered into body
'.modal-backdrop',
'.bootstrap-wysihtml5-insert-image-modal',
'.bootstrap-wysihtml5-insert-link-modal'
];
//check if element is detached. It occurs when clicking in bootstrap datepicker
if (!$.contains(document.documentElement, e.target)) {
return;
}
//for some reason FF 20 generates extra event (click) in select2 widget with e.target = document
//we need to filter it via construction below. See https://github.com/vitalets/x-editable/issues/199
//Possibly related to http://stackoverflow.com/questions/10119793/why-does-firefox-react-differently-from-webkit-and-ie-to-click-event-on-selec
if($target.is(document)) {
return;
}
//if click inside one of exclude classes --> no nothing
for(i=0; i<exclude_classes.length; i++) {
if($target.is(exclude_classes[i]) || $target.parents(exclude_classes[i]).length) {
return;
}
}
//close all open containers (except one - target)
Popup.prototype.closeOthers(e.target);
});
$(document).data('editable-handlers-attached', true);
}
},
//split options on containerOptions and formOptions
splitOptions: function() {
this.containerOptions = {};
this.formOptions = {};
if(!$.fn[this.containerName]) {
throw new Error(this.containerName + ' not found. Have you included corresponding js file?');
}
//keys defined in container defaults go to container, others go to form
for(var k in this.options) {
if(k in this.defaults) {
this.containerOptions[k] = this.options[k];
} else {
this.formOptions[k] = this.options[k];
}
}
},
/*
Returns jquery object of container
@method tip()
*/
tip: function() {
return this.container() ? this.container().$tip : null;
},
/* returns container object */
container: function() {
var container;
//first, try get it by `containerDataName`
if(this.containerDataName) {
if(container = this.$element.data(this.containerDataName)) {
return container;
}
}
//second, try `containerName`
container = this.$element.data(this.containerName);
return container;
},
/* call native method of underlying container, e.g. this.$element.popover('method') */
call: function() {
this.$element[this.containerName].apply(this.$element, arguments);
},
initContainer: function(){
this.call(this.containerOptions);
},
renderForm: function() {
this.$form
.editableform(this.formOptions)
.on({
save: $.proxy(this.save, this), //click on submit button (value changed)
nochange: $.proxy(function(){ this.hide('nochange'); }, this), //click on submit button (value NOT changed)
cancel: $.proxy(function(){ this.hide('cancel'); }, this), //click on calcel button
show: $.proxy(function() {
if(this.delayedHide) {
this.hide(this.delayedHide.reason);
this.delayedHide = false;
} else {
this.setPosition();
}
}, this), //re-position container every time form is shown (occurs each time after loading state)
rendering: $.proxy(this.setPosition, this), //this allows to place container correctly when loading shown
resize: $.proxy(this.setPosition, this), //this allows to re-position container when form size is changed
rendered: $.proxy(function(){
/**
Fired when container is shown and form is rendered (for select will wait for loading dropdown options).
**Note:** Bootstrap popover has own `shown` event that now cannot be separated from x-editable's one.
The workaround is to check `arguments.length` that is always `2` for x-editable.
@event shown
@param {Object} event event object
@example
$('#username').on('shown', function(e, editable) {
editable.input.$input.val('overwriting value of input..');
});
**/
/*
TODO: added second param mainly to distinguish from bootstrap's shown event. It's a hotfix that will be solved in future versions via namespaced events.
*/
this.$element.triggerHandler('shown', $(this.options.scope).data('editable'));
}, this)
})
.editableform('render');
},
/**
Shows container with form
@method show()
@param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.
**/
/* Note: poshytip owerwrites this method totally! */
show: function (closeAll) {
this.$element.addClass('editable-open');
if(closeAll !== false) {
//close all open containers (except this)
this.closeOthers(this.$element[0]);
}
//show container itself
this.innerShow();
this.tip().addClass(this.containerClass);
/*
Currently, form is re-rendered on every show.
The main reason is that we dont know, what will container do with content when closed:
remove(), detach() or just hide() - it depends on container.
Detaching form itself before hide and re-insert before show is good solution,
but visually it looks ugly --> container changes size before hide.
*/
//if form already exist - delete previous data
if(this.$form) {
//todo: destroy prev data!
//this.$form.destroy();
}
this.$form = $('<div>');
//insert form into container body
if(this.tip().is(this.innerCss)) {
//for inline container
this.tip().append(this.$form);
} else {
this.tip().find(this.innerCss).append(this.$form);
}
//render form
this.renderForm();
},
/**
Hides container with form
@method hide()
@param {string} reason Reason caused hiding. Can be <code>save|cancel|onblur|nochange|undefined (=manual)</code>
**/
hide: function(reason) {
if(!this.tip() || !this.tip().is(':visible') || !this.$element.hasClass('editable-open')) {
return;
}
//if form is saving value, schedule hide
if(this.$form.data('editableform').isSaving) {
this.delayedHide = {reason: reason};
return;
} else {
this.delayedHide = false;
}
this.$element.removeClass('editable-open');
this.innerHide();
/**
Fired when container was hidden. It occurs on both save or cancel.
**Note:** Bootstrap popover has own `hidden` event that now cannot be separated from x-editable's one.
The workaround is to check `arguments.length` that is always `2` for x-editable.
@event hidden
@param {object} event event object
@param {string} reason Reason caused hiding. Can be <code>save|cancel|onblur|nochange|manual</code>
@example
$('#username').on('hidden', function(e, reason) {
if(reason === 'save' || reason === 'cancel') {
//auto-open next editable
$(this).closest('tr').next().find('.editable').editable('show');
}
});
**/
this.$element.triggerHandler('hidden', reason || 'manual');
},
/* internal show method. To be overwritten in child classes */
innerShow: function () {
},
/* internal hide method. To be overwritten in child classes */
innerHide: function () {
},
/**
Toggles container visibility (show / hide)
@method toggle()
@param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.
**/
toggle: function(closeAll) {
if(this.container() && this.tip() && this.tip().is(':visible')) {
this.hide();
} else {
this.show(closeAll);
}
},
/*
Updates the position of container when content changed.
@method setPosition()
*/
setPosition: function() {
//tbd in child class
},
save: function(e, params) {
/**
Fired when new value was submitted. You can use <code>$(this).data('editableContainer')</code> inside handler to access to editableContainer instance
@event save
@param {Object} event event object
@param {Object} params additional params
@param {mixed} params.newValue submitted value
@param {Object} params.response ajax response
@example
$('#username').on('save', function(e, params) {
//assuming server response: '{success: true}'
var pk = $(this).data('editableContainer').options.pk;
if(params.response && params.response.success) {
alert('value: ' + params.newValue + ' with pk: ' + pk + ' saved!');
} else {
alert('error!');
}
});
**/
this.$element.triggerHandler('save', params);
//hide must be after trigger, as saving value may require methods of plugin, applied to input
this.hide('save');
},
/**
Sets new option
@method option(key, value)
@param {string} key
@param {mixed} value
**/
option: function(key, value) {
this.options[key] = value;
if(key in this.containerOptions) {
this.containerOptions[key] = value;
this.setContainerOption(key, value);
} else {
this.formOptions[key] = value;
if(this.$form) {
this.$form.editableform('option', key, value);
}
}
},
setContainerOption: function(key, value) {
this.call('option', key, value);
},
/**
Destroys the container instance
@method destroy()
**/
destroy: function() {
this.hide();
this.innerDestroy();
this.$element.off('destroyed');
this.$element.removeData('editableContainer');
},
/* to be overwritten in child classes */
innerDestroy: function() {
},
/*
Closes other containers except one related to passed element.
Other containers can be cancelled or submitted (depends on onblur option)
*/
closeOthers: function(element) {
$('.editable-open').each(function(i, el){
//do nothing with passed element and it's children
if(el === element || $(el).find(element).length) {
return;
}
//otherwise cancel or submit all open containers
var $el = $(el),
ec = $el.data('editableContainer');
if(!ec) {
return;
}
if(ec.options.onblur === 'cancel') {
$el.data('editableContainer').hide('onblur');
} else if(ec.options.onblur === 'submit') {
$el.data('editableContainer').tip().find('form').submit();
}
});
},
/**
Activates input of visible container (e.g. set focus)
@method activate()
**/
activate: function() {
if(this.tip && this.tip().is(':visible') && this.$form) {
this.$form.data('editableform').input.activate();
}
}
};
/**
jQuery method to initialize editableContainer.
@method $().editableContainer(options)
@params {Object} options
@example
$('#edit').editableContainer({
type: 'text',
url: '/post',
pk: 1,
value: 'hello'
});
**/
$.fn.editableContainer = function (option) {
var args = arguments;
return this.each(function () {
var $this = $(this),
dataKey = 'editableContainer',
data = $this.data(dataKey),
options = typeof option === 'object' && option,
Constructor = (options.mode === 'inline') ? Inline : Popup;
if (!data) {
$this.data(dataKey, (data = new Constructor(this, options)));
}
if (typeof option === 'string') { //call method
data[option].apply(data, Array.prototype.slice.call(args, 1));
}
});
};
//store constructors
$.fn.editableContainer.Popup = Popup;
$.fn.editableContainer.Inline = Inline;
//defaults
$.fn.editableContainer.defaults = {
/**
Initial value of form input
@property value
@type mixed
@default null
@private
**/
value: null,
/**
Placement of container relative to element. Can be <code>top|right|bottom|left</code>. Not used for inline container.
@property placement
@type string
@default 'top'
**/
placement: 'top',
/**
Whether to hide container on save/cancel.
@property autohide
@type boolean
@default true
@private
**/
autohide: true,
/**
Action when user clicks outside the container. Can be <code>cancel|submit|ignore</code>.
Setting <code>ignore</code> allows to have several containers open.
@property onblur
@type string
@default 'cancel'
@since 1.1.1
**/
onblur: 'cancel',
/**
Animation speed (inline mode only)
@property anim
@type string
@default false
**/
anim: false,
/**
Mode of editable, can be `popup` or `inline`
@property mode
@type string
@default 'popup'
@since 1.4.0
**/
mode: 'popup'
};
/*
* workaround to have 'destroyed' event to destroy popover when element is destroyed
* see http://stackoverflow.com/questions/2200494/jquery-trigger-event-when-an-element-is-removed-from-the-dom
*/
jQuery.event.special.destroyed = {
remove: function(o) {
if (o.handler) {
o.handler();
}
}
};
}(window.jQuery));
/**
* Editable Inline
* ---------------------
*/
(function ($) {
"use strict";
//copy prototype from EditableContainer
//extend methods
$.extend($.fn.editableContainer.Inline.prototype, $.fn.editableContainer.Popup.prototype, {
containerName: 'editableform',
innerCss: '.editable-inline',
containerClass: 'editable-container editable-inline', //css class applied to container element
initContainer: function(){
//container is <span> element
this.$tip = $('<span></span>');
//convert anim to miliseconds (int)
if(!this.options.anim) {
this.options.anim = 0;
}
},
splitOptions: function() {
//all options are passed to form
this.containerOptions = {};
this.formOptions = this.options;
},
tip: function() {
return this.$tip;
},
innerShow: function () {
this.$element.hide();
this.tip().insertAfter(this.$element).show();
},
innerHide: function () {
this.$tip.hide(this.options.anim, $.proxy(function() {
this.$element.show();
this.innerDestroy();
}, this));
},
innerDestroy: function() {
if(this.tip()) {
this.tip().empty().remove();
}
}
});
}(window.jQuery));
/**
Makes editable any HTML element on the page. Applied as jQuery method.
@class editable
@uses editableContainer
**/
(function ($) {
"use strict";
var Editable = function (element, options) {
this.$element = $(element);
//data-* has more priority over js options: because dynamically created elements may change data-*
this.options = $.extend({}, $.fn.editable.defaults, options, $.fn.editableutils.getConfigData(this.$element));
if(this.options.selector) {
this.initLive();
} else {
this.init();
}
//check for transition support
if(this.options.highlight && !$.fn.editableutils.supportsTransitions()) {
this.options.highlight = false;
}
};
Editable.prototype = {
constructor: Editable,
init: function () {
var isValueByText = false,
doAutotext, finalize;
//name
this.options.name = this.options.name || this.$element.attr('id');
//create input of specified type. Input needed already here to convert value for initial display (e.g. show text by id for select)
//also we set scope option to have access to element inside input specific callbacks (e. g. source as function)
this.options.scope = this.$element[0];
this.input = $.fn.editableutils.createInput(this.options);
if(!this.input) {
return;
}
//set value from settings or by element's text
if (this.options.value === undefined || this.options.value === null) {
this.value = this.input.html2value($.trim(this.$element.html()));
isValueByText = true;
} else {
/*
value can be string when received from 'data-value' attribute
for complext objects value can be set as json string in data-value attribute,
e.g. data-value="{city: 'Moscow', street: 'Lenina'}"
*/
this.options.value = $.fn.editableutils.tryParseJson(this.options.value, true);
if(typeof this.options.value === 'string') {
this.value = this.input.str2value(this.options.value);
} else {
this.value = this.options.value;
}
}
//add 'editable' class to every editable element
this.$element.addClass('editable');
//specifically for "textarea" add class .editable-pre-wrapped to keep linebreaks
if(this.input.type === 'textarea') {
this.$element.addClass('editable-pre-wrapped');
}
//attach handler activating editable. In disabled mode it just prevent default action (useful for links)
if(this.options.toggle !== 'manual') {
this.$element.addClass('editable-click');
this.$element.on(this.options.toggle + '.editable', $.proxy(function(e){
//prevent following link if editable enabled
if(!this.options.disabled) {
e.preventDefault();
}
//stop propagation not required because in document click handler it checks event target
//e.stopPropagation();
if(this.options.toggle === 'mouseenter') {
//for hover only show container
this.show();
} else {
//when toggle='click' we should not close all other containers as they will be closed automatically in document click listener
var closeAll = (this.options.toggle !== 'click');
this.toggle(closeAll);
}
}, this));
} else {
this.$element.attr('tabindex', -1); //do not stop focus on element when toggled manually
}
//if display is function it's far more convinient to have autotext = always to render correctly on init
//see https://github.com/vitalets/x-editable-yii/issues/34
if(typeof this.options.display === 'function') {
this.options.autotext = 'always';
}
//check conditions for autotext:
switch(this.options.autotext) {
case 'always':
doAutotext = true;
break;
case 'auto':
//if element text is empty and value is defined and value not generated by text --> run autotext
doAutotext = !$.trim(this.$element.text()).length && this.value !== null && this.value !== undefined && !isValueByText;
break;
default:
doAutotext = false;
}
//depending on autotext run render() or just finilize init
$.when(doAutotext ? this.render() : true).then($.proxy(function() {
if(this.options.disabled) {
this.disable();
} else {
this.enable();
}
/**
Fired when element was initialized by `$().editable()` method.
Please note that you should setup `init` handler **before** applying `editable`.
@event init
@param {Object} event event object
@param {Object} editable editable instance (as here it cannot accessed via data('editable'))
@since 1.2.0
@example
$('#username').on('init', function(e, editable) {
alert('initialized ' + editable.options.name);
});
$('#username').editable();
**/
this.$element.triggerHandler('init', this);
}, this));
},
/*
Initializes parent element for live editables
*/
initLive: function() {
//store selector
var selector = this.options.selector;
//modify options for child elements
this.options.selector = false;
this.options.autotext = 'never';
//listen toggle events
this.$element.on(this.options.toggle + '.editable', selector, $.proxy(function(e){
var $target = $(e.target);
if(!$target.data('editable')) {
//if delegated element initially empty, we need to clear it's text (that was manually set to `empty` by user)
//see https://github.com/vitalets/x-editable/issues/137
if($target.hasClass(this.options.emptyclass)) {
$target.empty();
}
$target.editable(this.options).trigger(e);
}
}, this));
},
/*
Renders value into element's text.
Can call custom display method from options.
Can return deferred object.
@method render()
@param {mixed} response server response (if exist) to pass into display function
*/
render: function(response) {
//do not display anything
if(this.options.display === false) {
return;
}
//if input has `value2htmlFinal` method, we pass callback in third param to be called when source is loaded
if(this.input.value2htmlFinal) {
return this.input.value2html(this.value, this.$element[0], this.options.display, response);
//if display method defined --> use it
} else if(typeof this.options.display === 'function') {
return this.options.display.call(this.$element[0], this.value, response);
//else use input's original value2html() method
} else {
return this.input.value2html(this.value, this.$element[0]);
}
},
/**
Enables editable
@method enable()
**/
enable: function() {
this.options.disabled = false;
this.$element.removeClass('editable-disabled');
this.handleEmpty(this.isEmpty);
if(this.options.toggle !== 'manual') {
if(this.$element.attr('tabindex') === '-1') {
this.$element.removeAttr('tabindex');
}
}
},
/**
Disables editable
@method disable()
**/
disable: function() {
this.options.disabled = true;
this.hide();
this.$element.addClass('editable-disabled');
this.handleEmpty(this.isEmpty);
//do not stop focus on this element
this.$element.attr('tabindex', -1);
},
/**
Toggles enabled / disabled state of editable element
@method toggleDisabled()
**/
toggleDisabled: function() {
if(this.options.disabled) {
this.enable();
} else {
this.disable();
}
},
/**
Sets new option
@method option(key, value)
@param {string|object} key option name or object with several options
@param {mixed} value option new value
@example
$('.editable').editable('option', 'pk', 2);
**/
option: function(key, value) {
//set option(s) by object
if(key && typeof key === 'object') {
$.each(key, $.proxy(function(k, v){
this.option($.trim(k), v);
}, this));
return;
}
//set option by string
this.options[key] = value;
//disabled
if(key === 'disabled') {
return value ? this.disable() : this.enable();
}
//value
if(key === 'value') {
this.setValue(value);
}
//transfer new option to container!
if(this.container) {
this.container.option(key, value);
}
//pass option to input directly (as it points to the same in form)
if(this.input.option) {
this.input.option(key, value);
}
},
/*
* set emptytext if element is empty
*/
handleEmpty: function (isEmpty) {
//do not handle empty if we do not display anything
if(this.options.display === false) {
return;
}
/*
isEmpty may be set directly as param of method.
It is required when we enable/disable field and can't rely on content
as node content is text: "Empty" that is not empty %)
*/
if(isEmpty !== undefined) {
this.isEmpty = isEmpty;
} else {
//detect empty
//for some inputs we need more smart check
//e.g. wysihtml5 may have <br>, <p></p>, <img>
if(typeof(this.input.isEmpty) === 'function') {
this.isEmpty = this.input.isEmpty(this.$element);
} else {
this.isEmpty = $.trim(this.$element.html()) === '';
}
}
//emptytext shown only for enabled
if(!this.options.disabled) {
if (this.isEmpty) {
this.$element.html(this.options.emptytext);
if(this.options.emptyclass) {
this.$element.addClass(this.options.emptyclass);
}
} else if(this.options.emptyclass) {
this.$element.removeClass(this.options.emptyclass);
}
} else {
//below required if element disable property was changed
if(this.isEmpty) {
this.$element.empty();
if(this.options.emptyclass) {
this.$element.removeClass(this.options.emptyclass);
}
}
}
},
/**
Shows container with form
@method show()
@param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.
**/
show: function (closeAll) {
if(this.options.disabled) {
return;
}
//init editableContainer: popover, tooltip, inline, etc..
if(!this.container) {
var containerOptions = $.extend({}, this.options, {
value: this.value,
input: this.input //pass input to form (as it is already created)
});
this.$element.editableContainer(containerOptions);
//listen `save` event
this.$element.on("save.internal", $.proxy(this.save, this));
this.container = this.$element.data('editableContainer');
} else if(this.container.tip().is(':visible')) {
return;
}
//show container
this.container.show(closeAll);
},
/**
Hides container with form
@method hide()
**/
hide: function () {
if(this.container) {
this.container.hide();
}
},
/**
Toggles container visibility (show / hide)
@method toggle()
@param {boolean} closeAll Whether to close all other editable containers when showing this one. Default true.
**/
toggle: function(closeAll) {
if(this.container && this.container.tip().is(':visible')) {
this.hide();
} else {
this.show(closeAll);
}
},
/*
* called when form was submitted
*/
save: function(e, params) {
//mark element with unsaved class if needed
if(this.options.unsavedclass) {
/*
Add unsaved css to element if:
- url is not user's function
- value was not sent to server
- params.response === undefined, that means data was not sent
- value changed
*/
var sent = false;
sent = sent || typeof this.options.url === 'function';
sent = sent || this.options.display === false;
sent = sent || params.response !== undefined;
sent = sent || (this.options.savenochange && this.input.value2str(this.value) !== this.input.value2str(params.newValue));
if(sent) {
this.$element.removeClass(this.options.unsavedclass);
} else {
this.$element.addClass(this.options.unsavedclass);
}
}
//highlight when saving
if(this.options.highlight) {
var $e = this.$element,
bgColor = $e.css('background-color');
$e.css('background-color', this.options.highlight);
setTimeout(function(){
if(bgColor === 'transparent') {
bgColor = '';
}
$e.css('background-color', bgColor);
$e.addClass('editable-bg-transition');
setTimeout(function(){
$e.removeClass('editable-bg-transition');
}, 1700);
}, 10);
}
//set new value
this.setValue(params.newValue, false, params.response);
/**
Fired when new value was submitted. You can use <code>$(this).data('editable')</code> to access to editable instance
@event save
@param {Object} event event object
@param {Object} params additional params
@param {mixed} params.newValue submitted value
@param {Object} params.response ajax response
@example
$('#username').on('save', function(e, params) {
alert('Saved value: ' + params.newValue);
});
**/
//event itself is triggered by editableContainer. Description here is only for documentation
},
validate: function () {
if (typeof this.options.validate === 'function') {
return this.options.validate.call(this, this.value);
}
},
/**
Sets new value of editable
@method setValue(value, convertStr)
@param {mixed} value new value
@param {boolean} convertStr whether to convert value from string to internal format
**/
setValue: function(value, convertStr, response) {
if(convertStr) {
this.value = this.input.str2value(value);
} else {
this.value = value;
}
if(this.container) {
this.container.option('value', this.value);
}
$.when(this.render(response))
.then($.proxy(function() {
this.handleEmpty();
}, this));
},
/**
Activates input of visible container (e.g. set focus)
@method activate()
**/
activate: function() {
if(this.container) {
this.container.activate();
}
},
/**
Removes editable feature from element
@method destroy()
**/
destroy: function() {
this.disable();
if(this.container) {
this.container.destroy();
}
this.input.destroy();
if(this.options.toggle !== 'manual') {
this.$element.removeClass('editable-click');
this.$element.off(this.options.toggle + '.editable');
}
this.$element.off("save.internal");
this.$element.removeClass('editable editable-open editable-disabled');
this.$element.removeData('editable');
}
};
/* EDITABLE PLUGIN DEFINITION
* ======================= */
/**
jQuery method to initialize editable element.
@method $().editable(options)
@params {Object} options
@example
$('#username').editable({
type: 'text',
url: '/post',
pk: 1
});
**/
$.fn.editable = function (option) {
//special API methods returning non-jquery object
var result = {}, args = arguments, datakey = 'editable';
switch (option) {
/**
Runs client-side validation for all matched editables
@method validate()
@returns {Object} validation errors map
@example
$('#username, #fullname').editable('validate');
// possible result:
{
username: "username is required",
fullname: "fullname should be minimum 3 letters length"
}
**/
case 'validate':
this.each(function () {
var $this = $(this), data = $this.data(datakey), error;
if (data && (error = data.validate())) {
result[data.options.name] = error;
}
});
return result;
/**
Returns current values of editable elements.
Note that it returns an **object** with name-value pairs, not a value itself. It allows to get data from several elements.
If value of some editable is `null` or `undefined` it is excluded from result object.
When param `isSingle` is set to **true** - it is supposed you have single element and will return value of editable instead of object.
@method getValue()
@param {bool} isSingle whether to return just value of single element
@returns {Object} object of element names and values
@example
$('#username, #fullname').editable('getValue');
//result:
{
username: "superuser",
fullname: "John"
}
//isSingle = true
$('#username').editable('getValue', true);
//result "superuser"
**/
case 'getValue':
if(arguments.length === 2 && arguments[1] === true) { //isSingle = true
result = this.eq(0).data(datakey).value;
} else {
this.each(function () {
var $this = $(this), data = $this.data(datakey);
if (data && data.value !== undefined && data.value !== null) {
result[data.options.name] = data.input.value2submit(data.value);
}
});
}
return result;
/**
This method collects values from several editable elements and submit them all to server.
Internally it runs client-side validation for all fields and submits only in case of success.
See <a href="#newrecord">creating new records</a> for details.
@method submit(options)
@param {object} options
@param {object} options.url url to submit data
@param {object} options.data additional data to submit
@param {object} options.ajaxOptions additional ajax options
@param {function} options.error(obj) error handler
@param {function} options.success(obj,config) success handler
@returns {Object} jQuery object
**/
case 'submit': //collects value, validate and submit to server for creating new record
var config = arguments[1] || {},
$elems = this,
errors = this.editable('validate'),
values;
if($.isEmptyObject(errors)) {
values = this.editable('getValue');
if(config.data) {
$.extend(values, config.data);
}
$.ajax($.extend({
url: config.url,
data: values,
type: 'POST'
}, config.ajaxOptions))
.success(function(response) {
//successful response 200 OK
if(typeof config.success === 'function') {
config.success.call($elems, response, config);
}
})
.error(function(){ //ajax error
if(typeof config.error === 'function') {
config.error.apply($elems, arguments);
}
});
} else { //client-side validation error
if(typeof config.error === 'function') {
config.error.call($elems, errors);
}
}
return this;
}
//return jquery object
return this.each(function () {
var $this = $(this),
data = $this.data(datakey),
options = typeof option === 'object' && option;
//for delegated targets do not store `editable` object for element
//it's allows several different selectors.
//see: https://github.com/vitalets/x-editable/issues/312
if(options && options.selector) {
data = new Editable(this, options);
return;
}
if (!data) {
$this.data(datakey, (data = new Editable(this, options)));
}
if (typeof option === 'string') { //call method
data[option].apply(data, Array.prototype.slice.call(args, 1));
}
});
};
$.fn.editable.defaults = {
/**
Type of input. Can be <code>text|textarea|select|date|checklist</code> and more
@property type
@type string
@default 'text'
**/
type: 'text',
/**
Sets disabled state of editable
@property disabled
@type boolean
@default false
**/
disabled: false,
/**
How to toggle editable. Can be <code>click|dblclick|mouseenter|manual</code>.
When set to <code>manual</code> you should manually call <code>show/hide</code> methods of editable.
**Note**: if you call <code>show</code> or <code>toggle</code> inside **click** handler of some DOM element,
you need to apply <code>e.stopPropagation()</code> because containers are being closed on any click on document.
@example
$('#edit-button').click(function(e) {
e.stopPropagation();
$('#username').editable('toggle');
});
@property toggle
@type string
@default 'click'
**/
toggle: 'click',
/**
Text shown when element is empty.
@property emptytext
@type string
@default 'Empty'
**/
emptytext: 'Empty',
/**
Allows to automatically set element's text based on it's value. Can be <code>auto|always|never</code>. Useful for select and date.
For example, if dropdown list is <code>{1: 'a', 2: 'b'}</code> and element's value set to <code>1</code>, it's html will be automatically set to <code>'a'</code>.
<code>auto</code> - text will be automatically set only if element is empty.
<code>always|never</code> - always(never) try to set element's text.
@property autotext
@type string
@default 'auto'
**/
autotext: 'auto',
/**
Initial value of input. If not set, taken from element's text.
Note, that if element's text is empty - text is automatically generated from value and can be customized (see `autotext` option).
For example, to display currency sign:
@example
<a id="price" data-type="text" data-value="100"></a>
<script>
$('#price').editable({
...
display: function(value) {
$(this).text(value + '$');
}
})
</script>
@property value
@type mixed
@default element's text
**/
value: null,
/**
Callback to perform custom displaying of value in element's text.
If `null`, default input's display used.
If `false`, no displaying methods will be called, element's text will never change.
Runs under element's scope.
_**Parameters:**_
* `value` current value to be displayed
* `response` server response (if display called after ajax submit), since 1.4.0
For _inputs with source_ (select, checklist) parameters are different:
* `value` current value to be displayed
* `sourceData` array of items for current input (e.g. dropdown items)
* `response` server response (if display called after ajax submit), since 1.4.0
To get currently selected items use `$.fn.editableutils.itemsByValue(value, sourceData)`.
@property display
@type function|boolean
@default null
@since 1.2.0
@example
display: function(value, sourceData) {
//display checklist as comma-separated values
var html = [],
checked = $.fn.editableutils.itemsByValue(value, sourceData);
if(checked.length) {
$.each(checked, function(i, v) { html.push($.fn.editableutils.escape(v.text)); });
$(this).html(html.join(', '));
} else {
$(this).empty();
}
}
**/
display: null,
/**
Css class applied when editable text is empty.
@property emptyclass
@type string
@since 1.4.1
@default editable-empty
**/
emptyclass: 'editable-empty',
/**
Css class applied when value was stored but not sent to server (`pk` is empty or `send = 'never'`).
You may set it to `null` if you work with editables locally and submit them together.
@property unsavedclass
@type string
@since 1.4.1
@default editable-unsaved
**/
unsavedclass: 'editable-unsaved',
/**
If selector is provided, editable will be delegated to the specified targets.
Usefull for dynamically generated DOM elements.
**Please note**, that delegated targets can't be initialized with `emptytext` and `autotext` options,
as they actually become editable only after first click.
You should manually set class `editable-click` to these elements.
Also, if element originally empty you should add class `editable-empty`, set `data-value=""` and write emptytext into element:
@property selector
@type string
@since 1.4.1
@default null
@example
<div id="user">
<!-- empty -->
<a href="#" data-name="username" data-type="text" class="editable-click editable-empty" data-value="" title="Username">Empty</a>
<!-- non-empty -->
<a href="#" data-name="group" data-type="select" data-source="/groups" data-value="1" class="editable-click" title="Group">Operator</a>
</div>
<script>
$('#user').editable({
selector: 'a',
url: '/post',
pk: 1
});
</script>
**/
selector: null,
/**
Color used to highlight element after update. Implemented via CSS3 transition, works in modern browsers.
@property highlight
@type string|boolean
@since 1.4.5
@default #FFFF80
**/
highlight: '#FFFF80'
};
}(window.jQuery));
/**
AbstractInput - base class for all editable inputs.
It defines interface to be implemented by any input type.
To create your own input you can inherit from this class.
@class abstractinput
**/
(function ($) {
"use strict";
//types
$.fn.editabletypes = {};
var AbstractInput = function () { };
AbstractInput.prototype = {
/**
Initializes input
@method init()
**/
init: function(type, options, defaults) {
this.type = type;
this.options = $.extend({}, defaults, options);
},
/*
this method called before render to init $tpl that is inserted in DOM
*/
prerender: function() {
this.$tpl = $(this.options.tpl); //whole tpl as jquery object
this.$input = this.$tpl; //control itself, can be changed in render method
this.$clear = null; //clear button
this.error = null; //error message, if input cannot be rendered
},
/**
Renders input from tpl. Can return jQuery deferred object.
Can be overwritten in child objects
@method render()
**/
render: function() {
},
/**
Sets element's html by value.
@method value2html(value, element)
@param {mixed} value
@param {DOMElement} element
**/
value2html: function(value, element) {
$(element)[this.options.escape ? 'text' : 'html']($.trim(value));
},
/**
Converts element's html to value
@method html2value(html)
@param {string} html
@returns {mixed}
**/
html2value: function(html) {
return $('<div>').html(html).text();
},
/**
Converts value to string (for internal compare). For submitting to server used value2submit().
@method value2str(value)
@param {mixed} value
@returns {string}
**/
value2str: function(value) {
return value;
},
/**
Converts string received from server into value. Usually from `data-value` attribute.
@method str2value(str)
@param {string} str
@returns {mixed}
**/
str2value: function(str) {
return str;
},
/**
Converts value for submitting to server. Result can be string or object.
@method value2submit(value)
@param {mixed} value
@returns {mixed}
**/
value2submit: function(value) {
return value;
},
/**
Sets value of input.
@method value2input(value)
@param {mixed} value
**/
value2input: function(value) {
this.$input.val(value);
},
/**
Returns value of input. Value can be object (e.g. datepicker)
@method input2value()
**/
input2value: function() {
return this.$input.val();
},
/**
Activates input. For text it sets focus.
@method activate()
**/
activate: function() {
if(this.$input.is(':visible')) {
this.$input.focus();
}
},
/**
Creates input.
@method clear()
**/
clear: function() {
this.$input.val(null);
},
/**
method to escape html.
**/
escape: function(str) {
return $('<div>').text(str).html();
},
/**
attach handler to automatically submit form when value changed (useful when buttons not shown)
**/
autosubmit: function() {
},
/**
Additional actions when destroying element
**/
destroy: function() {
},
// -------- helper functions --------
setClass: function() {
if(this.options.inputclass) {
this.$input.addClass(this.options.inputclass);
}
},
setAttr: function(attr) {
if (this.options[attr] !== undefined && this.options[attr] !== null) {
this.$input.attr(attr, this.options[attr]);
}
},
option: function(key, value) {
this.options[key] = value;
}
};
AbstractInput.defaults = {
/**
HTML template of input. Normally you should not change it.
@property tpl
@type string
@default ''
**/
tpl: '',
/**
CSS class automatically applied to input
@property inputclass
@type string
@default null
**/
inputclass: null,
/**
If `true` - html will be escaped in content of element via $.text() method.
If `false` - html will not be escaped, $.html() used.
When you use own `display` function, this option obviosly has no effect.
@property escape
@type boolean
@since 1.5.0
@default true
**/
escape: true,
//scope for external methods (e.g. source defined as function)
//for internal use only
scope: null,
//need to re-declare showbuttons here to get it's value from common config (passed only options existing in defaults)
showbuttons: true
};
$.extend($.fn.editabletypes, {abstractinput: AbstractInput});
}(window.jQuery));
/**
List - abstract class for inputs that have source option loaded from js array or via ajax
@class list
@extends abstractinput
**/
(function ($) {
"use strict";
var List = function (options) {
};
$.fn.editableutils.inherit(List, $.fn.editabletypes.abstractinput);
$.extend(List.prototype, {
render: function () {
var deferred = $.Deferred();
this.error = null;
this.onSourceReady(function () {
this.renderList();
deferred.resolve();
}, function () {
this.error = this.options.sourceError;
deferred.resolve();
});
return deferred.promise();
},
html2value: function (html) {
return null; //can't set value by text
},
value2html: function (value, element, display, response) {
var deferred = $.Deferred(),
success = function () {
if(typeof display === 'function') {
//custom display method
display.call(element, value, this.sourceData, response);
} else {
this.value2htmlFinal(value, element);
}
deferred.resolve();
};
//for null value just call success without loading source
if(value === null) {
success.call(this);
} else {
this.onSourceReady(success, function () { deferred.resolve(); });
}
return deferred.promise();
},
// ------------- additional functions ------------
onSourceReady: function (success, error) {
//run source if it function
var source;
if ($.isFunction(this.options.source)) {
source = this.options.source.call(this.options.scope);
this.sourceData = null;
//note: if function returns the same source as URL - sourceData will be taken from cahce and no extra request performed
} else {
source = this.options.source;
}
//if allready loaded just call success
if(this.options.sourceCache && $.isArray(this.sourceData)) {
success.call(this);
return;
}
//try parse json in single quotes (for double quotes jquery does automatically)
try {
source = $.fn.editableutils.tryParseJson(source, false);
} catch (e) {
error.call(this);
return;
}
//loading from url
if (typeof source === 'string') {
//try to get sourceData from cache
if(this.options.sourceCache) {
var cacheID = source,
cache;
if (!$(document).data(cacheID)) {
$(document).data(cacheID, {});
}
cache = $(document).data(cacheID);
//check for cached data
if (cache.loading === false && cache.sourceData) { //take source from cache
this.sourceData = cache.sourceData;
this.doPrepend();
success.call(this);
return;
} else if (cache.loading === true) { //cache is loading, put callback in stack to be called later
cache.callbacks.push($.proxy(function () {
this.sourceData = cache.sourceData;
this.doPrepend();
success.call(this);
}, this));
//also collecting error callbacks
cache.err_callbacks.push($.proxy(error, this));
return;
} else { //no cache yet, activate it
cache.loading = true;
cache.callbacks = [];
cache.err_callbacks = [];
}
}
//ajaxOptions for source. Can be overwritten bt options.sourceOptions
var ajaxOptions = $.extend({
url: source,
type: 'get',
cache: false,
dataType: 'json',
success: $.proxy(function (data) {
if(cache) {
cache.loading = false;
}
this.sourceData = this.makeArray(data);
if($.isArray(this.sourceData)) {
if(cache) {
//store result in cache
cache.sourceData = this.sourceData;
//run success callbacks for other fields waiting for this source
$.each(cache.callbacks, function () { this.call(); });
}
this.doPrepend();
success.call(this);
} else {
error.call(this);
if(cache) {
//run error callbacks for other fields waiting for this source
$.each(cache.err_callbacks, function () { this.call(); });
}
}
}, this),
error: $.proxy(function () {
error.call(this);
if(cache) {
cache.loading = false;
//run error callbacks for other fields
$.each(cache.err_callbacks, function () { this.call(); });
}
}, this)
}, this.options.sourceOptions);
//loading sourceData from server
$.ajax(ajaxOptions);
} else { //options as json/array
this.sourceData = this.makeArray(source);
if($.isArray(this.sourceData)) {
this.doPrepend();
success.call(this);
} else {
error.call(this);
}
}
},
doPrepend: function () {
if(this.options.prepend === null || this.options.prepend === undefined) {
return;
}
if(!$.isArray(this.prependData)) {
//run prepend if it is function (once)
if ($.isFunction(this.options.prepend)) {
this.options.prepend = this.options.prepend.call(this.options.scope);
}
//try parse json in single quotes
this.options.prepend = $.fn.editableutils.tryParseJson(this.options.prepend, true);
//convert prepend from string to object
if (typeof this.options.prepend === 'string') {
this.options.prepend = {'': this.options.prepend};
}
this.prependData = this.makeArray(this.options.prepend);
}
if($.isArray(this.prependData) && $.isArray(this.sourceData)) {
this.sourceData = this.prependData.concat(this.sourceData);
}
},
/*
renders input list
*/
renderList: function() {
// this method should be overwritten in child class
},
/*
set element's html by value
*/
value2htmlFinal: function(value, element) {
// this method should be overwritten in child class
},
/**
* convert data to array suitable for sourceData, e.g. [{value: 1, text: 'abc'}, {...}]
*/
makeArray: function(data) {
var count, obj, result = [], item, iterateItem;
if(!data || typeof data === 'string') {
return null;
}
if($.isArray(data)) { //array
/*
function to iterate inside item of array if item is object.
Caclulates count of keys in item and store in obj.
*/
iterateItem = function (k, v) {
obj = {value: k, text: v};
if(count++ >= 2) {
return false;// exit from `each` if item has more than one key.
}
};
for(var i = 0; i < data.length; i++) {
item = data[i];
if(typeof item === 'object') {
count = 0; //count of keys inside item
$.each(item, iterateItem);
//case: [{val1: 'text1'}, {val2: 'text2} ...]
if(count === 1) {
result.push(obj);
//case: [{value: 1, text: 'text1'}, {value: 2, text: 'text2'}, ...]
} else if(count > 1) {
//removed check of existance: item.hasOwnProperty('value') && item.hasOwnProperty('text')
if(item.children) {
item.children = this.makeArray(item.children);
}
result.push(item);
}
} else {
//case: ['text1', 'text2' ...]
result.push({value: item, text: item});
}
}
} else { //case: {val1: 'text1', val2: 'text2, ...}
$.each(data, function (k, v) {
result.push({value: k, text: v});
});
}
return result;
},
option: function(key, value) {
this.options[key] = value;
if(key === 'source') {
this.sourceData = null;
}
if(key === 'prepend') {
this.prependData = null;
}
}
});
List.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
Source data for list.
If **array** - it should be in format: `[{value: 1, text: "text1"}, {value: 2, text: "text2"}, ...]`
For compability, object format is also supported: `{"1": "text1", "2": "text2" ...}` but it does not guarantee elements order.
If **string** - considered ajax url to load items. In that case results will be cached for fields with the same source and name. See also `sourceCache` option.
If **function**, it should return data in format above (since 1.4.0).
Since 1.4.1 key `children` supported to render OPTGROUP (for **select** input only).
`[{text: "group1", children: [{value: 1, text: "text1"}, {value: 2, text: "text2"}]}, ...]`
@property source
@type string | array | object | function
@default null
**/
source: null,
/**
Data automatically prepended to the beginning of dropdown list.
@property prepend
@type string | array | object | function
@default false
**/
prepend: false,
/**
Error message when list cannot be loaded (e.g. ajax error)
@property sourceError
@type string
@default Error when loading list
**/
sourceError: 'Error when loading list',
/**
if <code>true</code> and source is **string url** - results will be cached for fields with the same source.
Usefull for editable column in grid to prevent extra requests.
@property sourceCache
@type boolean
@default true
@since 1.2.0
**/
sourceCache: true,
/**
Additional ajax options to be used in $.ajax() when loading list from server.
Useful to send extra parameters (`data` key) or change request method (`type` key).
@property sourceOptions
@type object|function
@default null
@since 1.5.0
**/
sourceOptions: null
});
$.fn.editabletypes.list = List;
}(window.jQuery));
/**
Text input
@class text
@extends abstractinput
@final
@example
<a href="#" id="username" data-type="text" data-pk="1">awesome</a>
<script>
$(function(){
$('#username').editable({
url: '/post',
title: 'Enter username'
});
});
</script>
**/
(function ($) {
"use strict";
var Text = function (options) {
this.init('text', options, Text.defaults);
};
$.fn.editableutils.inherit(Text, $.fn.editabletypes.abstractinput);
$.extend(Text.prototype, {
render: function() {
this.renderClear();
this.setClass();
this.setAttr('placeholder');
},
activate: function() {
if(this.$input.is(':visible')) {
this.$input.focus();
$.fn.editableutils.setCursorPosition(this.$input.get(0), this.$input.val().length);
if(this.toggleClear) {
this.toggleClear();
}
}
},
//render clear button
renderClear: function() {
if (this.options.clear) {
this.$clear = $('<span class="editable-clear-x"></span>');
this.$input.after(this.$clear)
.css('padding-right', 24)
.keyup($.proxy(function(e) {
//arrows, enter, tab, etc
if(~$.inArray(e.keyCode, [40,38,9,13,27])) {
return;
}
clearTimeout(this.t);
var that = this;
this.t = setTimeout(function() {
that.toggleClear(e);
}, 100);
}, this))
.parent().css('position', 'relative');
this.$clear.click($.proxy(this.clear, this));
}
},
postrender: function() {
/*
//now `clear` is positioned via css
if(this.$clear) {
//can position clear button only here, when form is shown and height can be calculated
// var h = this.$input.outerHeight(true) || 20,
var h = this.$clear.parent().height(),
delta = (h - this.$clear.height()) / 2;
//this.$clear.css({bottom: delta, right: delta});
}
*/
},
//show / hide clear button
toggleClear: function(e) {
if(!this.$clear) {
return;
}
var len = this.$input.val().length,
visible = this.$clear.is(':visible');
if(len && !visible) {
this.$clear.show();
}
if(!len && visible) {
this.$clear.hide();
}
},
clear: function() {
this.$clear.hide();
this.$input.val('').focus();
}
});
Text.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <input type="text">
**/
tpl: '<input type="text">',
/**
Placeholder attribute of input. Shown when input is empty.
@property placeholder
@type string
@default null
**/
placeholder: null,
/**
Whether to show `clear` button
@property clear
@type boolean
@default true
**/
clear: true
});
$.fn.editabletypes.text = Text;
}(window.jQuery));
/**
Textarea input
@class textarea
@extends abstractinput
@final
@example
<a href="#" id="comments" data-type="textarea" data-pk="1">awesome comment!</a>
<script>
$(function(){
$('#comments').editable({
url: '/post',
title: 'Enter comments',
rows: 10
});
});
</script>
**/
(function ($) {
"use strict";
var Textarea = function (options) {
this.init('textarea', options, Textarea.defaults);
};
$.fn.editableutils.inherit(Textarea, $.fn.editabletypes.abstractinput);
$.extend(Textarea.prototype, {
render: function () {
this.setClass();
this.setAttr('placeholder');
this.setAttr('rows');
//ctrl + enter
this.$input.keydown(function (e) {
if (e.ctrlKey && e.which === 13) {
$(this).closest('form').submit();
}
});
},
//using `white-space: pre-wrap` solves \n <--> BR conversion very elegant!
/*
value2html: function(value, element) {
var html = '', lines;
if(value) {
lines = value.split("\n");
for (var i = 0; i < lines.length; i++) {
lines[i] = $('<div>').text(lines[i]).html();
}
html = lines.join('<br>');
}
$(element).html(html);
},
html2value: function(html) {
if(!html) {
return '';
}
var regex = new RegExp(String.fromCharCode(10), 'g');
var lines = html.split(/<br\s*\/?>/i);
for (var i = 0; i < lines.length; i++) {
var text = $('<div>').html(lines[i]).text();
// Remove newline characters (\n) to avoid them being converted by value2html() method
// thus adding extra <br> tags
text = text.replace(regex, '');
lines[i] = text;
}
return lines.join("\n");
},
*/
activate: function() {
$.fn.editabletypes.text.prototype.activate.call(this);
}
});
Textarea.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <textarea></textarea>
**/
tpl:'<textarea></textarea>',
/**
@property inputclass
@default input-large
**/
inputclass: 'input-large',
/**
Placeholder attribute of input. Shown when input is empty.
@property placeholder
@type string
@default null
**/
placeholder: null,
/**
Number of rows in textarea
@property rows
@type integer
@default 7
**/
rows: 7
});
$.fn.editabletypes.textarea = Textarea;
}(window.jQuery));
/**
Select (dropdown)
@class select
@extends list
@final
@example
<a href="#" id="status" data-type="select" data-pk="1" data-url="/post" data-title="Select status"></a>
<script>
$(function(){
$('#status').editable({
value: 2,
source: [
{value: 1, text: 'Active'},
{value: 2, text: 'Blocked'},
{value: 3, text: 'Deleted'}
]
});
});
</script>
**/
(function ($) {
"use strict";
var Select = function (options) {
this.init('select', options, Select.defaults);
};
$.fn.editableutils.inherit(Select, $.fn.editabletypes.list);
$.extend(Select.prototype, {
renderList: function() {
this.$input.empty();
var fillItems = function($el, data) {
var attr;
if($.isArray(data)) {
for(var i=0; i<data.length; i++) {
attr = {};
if(data[i].children) {
attr.label = data[i].text;
$el.append(fillItems($('<optgroup>', attr), data[i].children));
} else {
attr.value = data[i].value;
if(data[i].disabled) {
attr.disabled = true;
}
$el.append($('<option>', attr).text(data[i].text));
}
}
}
return $el;
};
fillItems(this.$input, this.sourceData);
this.setClass();
//enter submit
this.$input.on('keydown.editable', function (e) {
if (e.which === 13) {
$(this).closest('form').submit();
}
});
},
value2htmlFinal: function(value, element) {
var text = '',
items = $.fn.editableutils.itemsByValue(value, this.sourceData);
if(items.length) {
text = items[0].text;
}
//$(element).text(text);
$.fn.editabletypes.abstractinput.prototype.value2html.call(this, text, element);
},
autosubmit: function() {
this.$input.off('keydown.editable').on('change.editable', function(){
$(this).closest('form').submit();
});
}
});
Select.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
/**
@property tpl
@default <select></select>
**/
tpl:'<select></select>'
});
$.fn.editabletypes.select = Select;
}(window.jQuery));
/**
List of checkboxes.
Internally value stored as javascript array of values.
@class checklist
@extends list
@final
@example
<a href="#" id="options" data-type="checklist" data-pk="1" data-url="/post" data-title="Select options"></a>
<script>
$(function(){
$('#options').editable({
value: [2, 3],
source: [
{value: 1, text: 'option1'},
{value: 2, text: 'option2'},
{value: 3, text: 'option3'}
]
});
});
</script>
**/
(function ($) {
"use strict";
var Checklist = function (options) {
this.init('checklist', options, Checklist.defaults);
};
$.fn.editableutils.inherit(Checklist, $.fn.editabletypes.list);
$.extend(Checklist.prototype, {
renderList: function() {
var $label, $div;
this.$tpl.empty();
if(!$.isArray(this.sourceData)) {
return;
}
for(var i=0; i<this.sourceData.length; i++) {
$label = $('<label>').append($('<input>', {
type: 'checkbox',
value: this.sourceData[i].value
}))
.append($('<span>').text(' '+this.sourceData[i].text));
$('<div>').append($label).appendTo(this.$tpl);
}
this.$input = this.$tpl.find('input[type="checkbox"]');
this.setClass();
},
value2str: function(value) {
return $.isArray(value) ? value.sort().join($.trim(this.options.separator)) : '';
},
//parse separated string
str2value: function(str) {
var reg, value = null;
if(typeof str === 'string' && str.length) {
reg = new RegExp('\\s*'+$.trim(this.options.separator)+'\\s*');
value = str.split(reg);
} else if($.isArray(str)) {
value = str;
} else {
value = [str];
}
return value;
},
//set checked on required checkboxes
value2input: function(value) {
this.$input.prop('checked', false);
if($.isArray(value) && value.length) {
this.$input.each(function(i, el) {
var $el = $(el);
// cannot use $.inArray as it performs strict comparison
$.each(value, function(j, val){
/*jslint eqeq: true*/
if($el.val() == val) {
/*jslint eqeq: false*/
$el.prop('checked', true);
}
});
});
}
},
input2value: function() {
var checked = [];
this.$input.filter(':checked').each(function(i, el) {
checked.push($(el).val());
});
return checked;
},
//collect text of checked boxes
value2htmlFinal: function(value, element) {
var html = [],
checked = $.fn.editableutils.itemsByValue(value, this.sourceData),
escape = this.options.escape;
if(checked.length) {
$.each(checked, function(i, v) {
var text = escape ? $.fn.editableutils.escape(v.text) : v.text;
html.push(text);
});
$(element).html(html.join('<br>'));
} else {
$(element).empty();
}
},
activate: function() {
this.$input.first().focus();
},
autosubmit: function() {
this.$input.on('keydown', function(e){
if (e.which === 13) {
$(this).closest('form').submit();
}
});
}
});
Checklist.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
/**
@property tpl
@default <div></div>
**/
tpl:'<div class="editable-checklist"></div>',
/**
@property inputclass
@type string
@default null
**/
inputclass: null,
/**
Separator of values when reading from `data-value` attribute
@property separator
@type string
@default ','
**/
separator: ','
});
$.fn.editabletypes.checklist = Checklist;
}(window.jQuery));
/**
HTML5 input types.
Following types are supported:
* password
* email
* url
* tel
* number
* range
* time
Learn more about html5 inputs:
http://www.w3.org/wiki/HTML5_form_additions
To check browser compatibility please see:
https://developer.mozilla.org/en-US/docs/HTML/Element/Input
@class html5types
@extends text
@final
@since 1.3.0
@example
<a href="#" id="email" data-type="email" data-pk="1">admin@example.com</a>
<script>
$(function(){
$('#email').editable({
url: '/post',
title: 'Enter email'
});
});
</script>
**/
/**
@property tpl
@default depends on type
**/
/*
Password
*/
(function ($) {
"use strict";
var Password = function (options) {
this.init('password', options, Password.defaults);
};
$.fn.editableutils.inherit(Password, $.fn.editabletypes.text);
$.extend(Password.prototype, {
//do not display password, show '[hidden]' instead
value2html: function(value, element) {
if(value) {
$(element).text('[hidden]');
} else {
$(element).empty();
}
},
//as password not displayed, should not set value by html
html2value: function(html) {
return null;
}
});
Password.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
tpl: '<input type="password">'
});
$.fn.editabletypes.password = Password;
}(window.jQuery));
/*
Email
*/
(function ($) {
"use strict";
var Email = function (options) {
this.init('email', options, Email.defaults);
};
$.fn.editableutils.inherit(Email, $.fn.editabletypes.text);
Email.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
tpl: '<input type="email">'
});
$.fn.editabletypes.email = Email;
}(window.jQuery));
/*
Url
*/
(function ($) {
"use strict";
var Url = function (options) {
this.init('url', options, Url.defaults);
};
$.fn.editableutils.inherit(Url, $.fn.editabletypes.text);
Url.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
tpl: '<input type="url">'
});
$.fn.editabletypes.url = Url;
}(window.jQuery));
/*
Tel
*/
(function ($) {
"use strict";
var Tel = function (options) {
this.init('tel', options, Tel.defaults);
};
$.fn.editableutils.inherit(Tel, $.fn.editabletypes.text);
Tel.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
tpl: '<input type="tel">'
});
$.fn.editabletypes.tel = Tel;
}(window.jQuery));
/*
Number
*/
(function ($) {
"use strict";
var NumberInput = function (options) {
this.init('number', options, NumberInput.defaults);
};
$.fn.editableutils.inherit(NumberInput, $.fn.editabletypes.text);
$.extend(NumberInput.prototype, {
render: function () {
NumberInput.superclass.render.call(this);
this.setAttr('min');
this.setAttr('max');
this.setAttr('step');
},
postrender: function() {
if(this.$clear) {
//increase right ffset for up/down arrows
this.$clear.css({right: 24});
/*
//can position clear button only here, when form is shown and height can be calculated
var h = this.$input.outerHeight(true) || 20,
delta = (h - this.$clear.height()) / 2;
//add 12px to offset right for up/down arrows
this.$clear.css({top: delta, right: delta + 16});
*/
}
}
});
NumberInput.defaults = $.extend({}, $.fn.editabletypes.text.defaults, {
tpl: '<input type="number">',
inputclass: 'input-mini',
min: null,
max: null,
step: null
});
$.fn.editabletypes.number = NumberInput;
}(window.jQuery));
/*
Range (inherit from number)
*/
(function ($) {
"use strict";
var Range = function (options) {
this.init('range', options, Range.defaults);
};
$.fn.editableutils.inherit(Range, $.fn.editabletypes.number);
$.extend(Range.prototype, {
render: function () {
this.$input = this.$tpl.filter('input');
this.setClass();
this.setAttr('min');
this.setAttr('max');
this.setAttr('step');
this.$input.on('input', function(){
$(this).siblings('output').text($(this).val());
});
},
activate: function() {
this.$input.focus();
}
});
Range.defaults = $.extend({}, $.fn.editabletypes.number.defaults, {
tpl: '<input type="range"><output style="width: 30px; display: inline-block"></output>',
inputclass: 'input-medium'
});
$.fn.editabletypes.range = Range;
}(window.jQuery));
/*
Time
*/
(function ($) {
"use strict";
var Time = function (options) {
this.init('time', options, Time.defaults);
};
//inherit from abstract, as inheritance from text gives selection error.
$.fn.editableutils.inherit(Time, $.fn.editabletypes.abstractinput);
$.extend(Time.prototype, {
render: function() {
this.setClass();
}
});
Time.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
tpl: '<input type="time">'
});
$.fn.editabletypes.time = Time;
}(window.jQuery));
/**
Select2 input. Based on amazing work of Igor Vaynberg https://github.com/ivaynberg/select2.
Please see [original select2 docs](http://ivaynberg.github.com/select2) for detailed description and options.
You should manually download and include select2 distributive:
<link href="select2/select2.css" rel="stylesheet" type="text/css"></link>
<script src="select2/select2.js"></script>
To make it **bootstrap-styled** you can use css from [here](https://github.com/t0m/select2-bootstrap-css):
<link href="select2-bootstrap.css" rel="stylesheet" type="text/css"></link>
**Note:** currently `autotext` feature does not work for select2 with `ajax` remote source.
You need initially put both `data-value` and element's text youself:
<a href="#" data-type="select2" data-value="1">Text1</a>
@class select2
@extends abstractinput
@since 1.4.1
@final
@example
<a href="#" id="country" data-type="select2" data-pk="1" data-value="ru" data-url="/post" data-title="Select country"></a>
<script>
$(function(){
//local source
$('#country').editable({
source: [
{id: 'gb', text: 'Great Britain'},
{id: 'us', text: 'United States'},
{id: 'ru', text: 'Russia'}
],
select2: {
multiple: true
}
});
//remote source (simple)
$('#country').editable({
source: '/getCountries'
});
//remote source (advanced)
$('#country').editable({
select2: {
placeholder: 'Select Country',
allowClear: true,
minimumInputLength: 3,
id: function (item) {
return item.CountryId;
},
ajax: {
url: '/getCountries',
dataType: 'json',
data: function (term, page) {
return { query: term };
},
results: function (data, page) {
return { results: data };
}
},
formatResult: function (item) {
return item.CountryName;
},
formatSelection: function (item) {
return item.CountryName;
},
initSelection: function (element, callback) {
return $.get('/getCountryById', { query: element.val() }, function (data) {
callback(data);
});
}
}
});
});
</script>
**/
(function ($) {
"use strict";
var Constructor = function (options) {
this.init('select2', options, Constructor.defaults);
options.select2 = options.select2 || {};
this.sourceData = null;
//placeholder
if(options.placeholder) {
options.select2.placeholder = options.placeholder;
}
//if not `tags` mode, use source
if(!options.select2.tags && options.source) {
var source = options.source;
//if source is function, call it (once!)
if ($.isFunction(options.source)) {
source = options.source.call(options.scope);
}
if (typeof source === 'string') {
options.select2.ajax = options.select2.ajax || {};
//some default ajax params
if(!options.select2.ajax.data) {
options.select2.ajax.data = function(term) {return { query:term };};
}
if(!options.select2.ajax.results) {
options.select2.ajax.results = function(data) { return {results:data };};
}
options.select2.ajax.url = source;
} else {
//check format and convert x-editable format to select2 format (if needed)
this.sourceData = this.convertSource(source);
options.select2.data = this.sourceData;
}
}
//overriding objects in config (as by default jQuery extend() is not recursive)
this.options.select2 = $.extend({}, Constructor.defaults.select2, options.select2);
//detect whether it is multi-valued
this.isMultiple = this.options.select2.tags || this.options.select2.multiple;
this.isRemote = ('ajax' in this.options.select2);
//store function returning ID of item
//should be here as used inautotext for local source
this.idFunc = this.options.select2.id;
if (typeof(this.idFunc) !== "function") {
var idKey = this.idFunc || 'id';
this.idFunc = function (e) { return e[idKey]; };
}
//store function that renders text in select2
this.formatSelection = this.options.select2.formatSelection;
if (typeof(this.formatSelection) !== "function") {
this.formatSelection = function (e) { return e.text; };
}
};
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
$.extend(Constructor.prototype, {
render: function() {
this.setClass();
//can not apply select2 here as it calls initSelection
//over input that does not have correct value yet.
//apply select2 only in value2input
//this.$input.select2(this.options.select2);
//when data is loaded via ajax, we need to know when it's done to populate listData
if(this.isRemote) {
//listen to loaded event to populate data
this.$input.on('select2-loaded', $.proxy(function(e) {
this.sourceData = e.items.results;
}, this));
}
//trigger resize of editableform to re-position container in multi-valued mode
if(this.isMultiple) {
this.$input.on('change', function() {
$(this).closest('form').parent().triggerHandler('resize');
});
}
},
value2html: function(value, element) {
var text = '', data,
that = this;
if(this.options.select2.tags) { //in tags mode just assign value
data = value;
//data = $.fn.editableutils.itemsByValue(value, this.options.select2.tags, this.idFunc);
} else if(this.sourceData) {
data = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
} else {
//can not get list of possible values
//(e.g. autotext for select2 with ajax source)
}
//data may be array (when multiple values allowed)
if($.isArray(data)) {
//collect selected data and show with separator
text = [];
$.each(data, function(k, v){
text.push(v && typeof v === 'object' ? that.formatSelection(v) : v);
});
} else if(data) {
text = that.formatSelection(data);
}
text = $.isArray(text) ? text.join(this.options.viewseparator) : text;
//$(element).text(text);
Constructor.superclass.value2html.call(this, text, element);
},
html2value: function(html) {
return this.options.select2.tags ? this.str2value(html, this.options.viewseparator) : null;
},
value2input: function(value) {
//for local source use data directly from source (to allow autotext)
/*
if(!this.isRemote && !this.isMultiple) {
var items = $.fn.editableutils.itemsByValue(value, this.sourceData, this.idFunc);
if(items.length) {
this.$input.select2('data', items[0]);
return;
}
}
*/
//for remote source just set value, text is updated by initSelection
if(!this.$input.data('select2')) {
this.$input.val(value);
this.$input.select2(this.options.select2);
} else {
//second argument needed to separate initial change from user's click (for autosubmit)
this.$input.val(value).trigger('change', true);
}
//if remote source AND no user's initSelection provided --> try to use element's text
if(this.isRemote && !this.isMultiple && !this.options.select2.initSelection) {
var customId = this.options.select2.id,
customText = this.options.select2.formatSelection;
if(!customId && !customText) {
var data = {id: value, text: $(this.options.scope).text()};
this.$input.select2('data', data);
}
}
},
input2value: function() {
return this.$input.select2('val');
},
str2value: function(str, separator) {
if(typeof str !== 'string' || !this.isMultiple) {
return str;
}
separator = separator || this.options.select2.separator || $.fn.select2.defaults.separator;
var val, i, l;
if (str === null || str.length < 1) {
return null;
}
val = str.split(separator);
for (i = 0, l = val.length; i < l; i = i + 1) {
val[i] = $.trim(val[i]);
}
return val;
},
autosubmit: function() {
this.$input.on('change', function(e, isInitial){
if(!isInitial) {
$(this).closest('form').submit();
}
});
},
/*
Converts source from x-editable format: {value: 1, text: "1"} to
select2 format: {id: 1, text: "1"}
*/
convertSource: function(source) {
if($.isArray(source) && source.length && source[0].value !== undefined) {
for(var i = 0; i<source.length; i++) {
if(source[i].value !== undefined) {
source[i].id = source[i].value;
delete source[i].value;
}
}
}
return source;
},
destroy: function() {
if(this.$input.data('select2')) {
this.$input.select2('destroy');
}
}
});
Constructor.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <input type="hidden">
**/
tpl:'<input type="hidden">',
/**
Configuration of select2. [Full list of options](http://ivaynberg.github.com/select2).
@property select2
@type object
@default null
**/
select2: null,
/**
Placeholder attribute of select
@property placeholder
@type string
@default null
**/
placeholder: null,
/**
Source data for select. It will be assigned to select2 `data` property and kept here just for convenience.
Please note, that format is different from simple `select` input: use 'id' instead of 'value'.
E.g. `[{id: 1, text: "text1"}, {id: 2, text: "text2"}, ...]`.
@property source
@type array|string|function
@default null
**/
source: null,
/**
Separator used to display tags.
@property viewseparator
@type string
@default ', '
**/
viewseparator: ', '
});
$.fn.editabletypes.select2 = Constructor;
}(window.jQuery));
/**
* Combodate - 1.0.4
* Dropdown date and time picker.
* Converts text input into dropdowns to pick day, month, year, hour, minute and second.
* Uses momentjs as datetime library http://momentjs.com.
* For internalization include corresponding file from https://github.com/timrwood/moment/tree/master/lang
*
* Confusion at noon and midnight - see http://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight
* In combodate:
* 12:00 pm --> 12:00 (24-h format, midday)
* 12:00 am --> 00:00 (24-h format, midnight, start of day)
*
* Differs from momentjs parse rules:
* 00:00 pm, 12:00 pm --> 12:00 (24-h format, day not change)
* 00:00 am, 12:00 am --> 00:00 (24-h format, day not change)
*
*
* Author: Vitaliy Potapov
* Project page: http://github.com/vitalets/combodate
* Copyright (c) 2012 Vitaliy Potapov. Released under MIT License.
**/
(function ($) {
var Combodate = function (element, options) {
this.$element = $(element);
if(!this.$element.is('input')) {
$.error('Combodate should be applied to INPUT element');
return;
}
this.options = $.extend({}, $.fn.combodate.defaults, options, this.$element.data());
this.init();
};
Combodate.prototype = {
constructor: Combodate,
init: function () {
this.map = {
//key regexp moment.method
day: ['D', 'date'],
month: ['M', 'month'],
year: ['Y', 'year'],
hour: ['[Hh]', 'hours'],
minute: ['m', 'minutes'],
second: ['s', 'seconds'],
ampm: ['[Aa]', '']
};
this.$widget = $('<span class="combodate"></span>').html(this.getTemplate());
this.initCombos();
//update original input on change
this.$widget.on('change', 'select', $.proxy(function(){
this.$element.val(this.getValue());
}, this));
this.$widget.find('select').css('width', 'auto');
//hide original input and insert widget
this.$element.hide().after(this.$widget);
//set initial value
this.setValue(this.$element.val() || this.options.value);
},
/*
Replace tokens in template with <select> elements
*/
getTemplate: function() {
var tpl = this.options.template;
//first pass
$.each(this.map, function(k, v) {
v = v[0];
var r = new RegExp(v+'+'),
token = v.length > 1 ? v.substring(1, 2) : v;
tpl = tpl.replace(r, '{'+token+'}');
});
//replace spaces with
tpl = tpl.replace(/ /g, ' ');
//second pass
$.each(this.map, function(k, v) {
v = v[0];
var token = v.length > 1 ? v.substring(1, 2) : v;
tpl = tpl.replace('{'+token+'}', '<select class="'+k+'"></select>');
});
return tpl;
},
/*
Initialize combos that presents in template
*/
initCombos: function() {
var that = this;
$.each(this.map, function(k, v) {
var $c = that.$widget.find('.'+k), f, items;
if($c.length) {
that['$'+k] = $c; //set properties like this.$day, this.$month etc.
f = 'fill' + k.charAt(0).toUpperCase() + k.slice(1); //define method name to fill items, e.g `fillDays`
items = that[f]();
that['$'+k].html(that.renderItems(items));
}
});
},
/*
Initialize items of combos. Handles `firstItem` option
*/
initItems: function(key) {
var values = [],
relTime;
if(this.options.firstItem === 'name') {
//need both to support moment ver < 2 and >= 2
relTime = moment.relativeTime || moment.langData()._relativeTime;
var header = typeof relTime[key] === 'function' ? relTime[key](1, true, key, false) : relTime[key];
//take last entry (see momentjs lang files structure)
header = header.split(' ').reverse()[0];
values.push(['', header]);
} else if(this.options.firstItem === 'empty') {
values.push(['', '']);
}
return values;
},
/*
render items to string of <option> tags
*/
renderItems: function(items) {
var str = [];
for(var i=0; i<items.length; i++) {
str.push('<option value="'+items[i][0]+'">'+items[i][1]+'</option>');
}
return str.join("\n");
},
/*
fill day
*/
fillDay: function() {
var items = this.initItems('d'), name, i,
twoDigit = this.options.template.indexOf('DD') !== -1;
for(i=1; i<=31; i++) {
name = twoDigit ? this.leadZero(i) : i;
items.push([i, name]);
}
return items;
},
/*
fill month
*/
fillMonth: function() {
var items = this.initItems('M'), name, i,
longNames = this.options.template.indexOf('MMMM') !== -1,
shortNames = this.options.template.indexOf('MMM') !== -1,
twoDigit = this.options.template.indexOf('MM') !== -1;
for(i=0; i<=11; i++) {
if(longNames) {
//see https://github.com/timrwood/momentjs.com/pull/36
name = moment().date(1).month(i).format('MMMM');
} else if(shortNames) {
name = moment().date(1).month(i).format('MMM');
} else if(twoDigit) {
name = this.leadZero(i+1);
} else {
name = i+1;
}
items.push([i, name]);
}
return items;
},
/*
fill year
*/
fillYear: function() {
var items = [], name, i,
longNames = this.options.template.indexOf('YYYY') !== -1;
for(i=this.options.maxYear; i>=this.options.minYear; i--) {
name = longNames ? i : (i+'').substring(2);
items[this.options.yearDescending ? 'push' : 'unshift']([i, name]);
}
items = this.initItems('y').concat(items);
return items;
},
/*
fill hour
*/
fillHour: function() {
var items = this.initItems('h'), name, i,
h12 = this.options.template.indexOf('h') !== -1,
h24 = this.options.template.indexOf('H') !== -1,
twoDigit = this.options.template.toLowerCase().indexOf('hh') !== -1,
min = h12 ? 1 : 0,
max = h12 ? 12 : 23;
for(i=min; i<=max; i++) {
name = twoDigit ? this.leadZero(i) : i;
items.push([i, name]);
}
return items;
},
/*
fill minute
*/
fillMinute: function() {
var items = this.initItems('m'), name, i,
twoDigit = this.options.template.indexOf('mm') !== -1;
for(i=0; i<=59; i+= this.options.minuteStep) {
name = twoDigit ? this.leadZero(i) : i;
items.push([i, name]);
}
return items;
},
/*
fill second
*/
fillSecond: function() {
var items = this.initItems('s'), name, i,
twoDigit = this.options.template.indexOf('ss') !== -1;
for(i=0; i<=59; i+= this.options.secondStep) {
name = twoDigit ? this.leadZero(i) : i;
items.push([i, name]);
}
return items;
},
/*
fill ampm
*/
fillAmpm: function() {
var ampmL = this.options.template.indexOf('a') !== -1,
ampmU = this.options.template.indexOf('A') !== -1,
items = [
['am', ampmL ? 'am' : 'AM'],
['pm', ampmL ? 'pm' : 'PM']
];
return items;
},
/*
Returns current date value from combos.
If format not specified - `options.format` used.
If format = `null` - Moment object returned.
*/
getValue: function(format) {
var dt, values = {},
that = this,
notSelected = false;
//getting selected values
$.each(this.map, function(k, v) {
if(k === 'ampm') {
return;
}
var def = k === 'day' ? 1 : 0;
values[k] = that['$'+k] ? parseInt(that['$'+k].val(), 10) : def;
if(isNaN(values[k])) {
notSelected = true;
return false;
}
});
//if at least one visible combo not selected - return empty string
if(notSelected) {
return '';
}
//convert hours 12h --> 24h
if(this.$ampm) {
//12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day)
if(values.hour === 12) {
values.hour = this.$ampm.val() === 'am' ? 0 : 12;
} else {
values.hour = this.$ampm.val() === 'am' ? values.hour : values.hour+12;
}
}
dt = moment([values.year, values.month, values.day, values.hour, values.minute, values.second]);
//highlight invalid date
this.highlight(dt);
format = format === undefined ? this.options.format : format;
if(format === null) {
return dt.isValid() ? dt : null;
} else {
return dt.isValid() ? dt.format(format) : '';
}
},
setValue: function(value) {
if(!value) {
return;
}
var dt = typeof value === 'string' ? moment(value, this.options.format) : moment(value),
that = this,
values = {};
//function to find nearest value in select options
function getNearest($select, value) {
var delta = {};
$select.children('option').each(function(i, opt){
var optValue = $(opt).attr('value'),
distance;
if(optValue === '') return;
distance = Math.abs(optValue - value);
if(typeof delta.distance === 'undefined' || distance < delta.distance) {
delta = {value: optValue, distance: distance};
}
});
return delta.value;
}
if(dt.isValid()) {
//read values from date object
$.each(this.map, function(k, v) {
if(k === 'ampm') {
return;
}
values[k] = dt[v[1]]();
});
if(this.$ampm) {
//12:00 pm --> 12:00 (24-h format, midday), 12:00 am --> 00:00 (24-h format, midnight, start of day)
if(values.hour >= 12) {
values.ampm = 'pm';
if(values.hour > 12) {
values.hour -= 12;
}
} else {
values.ampm = 'am';
if(values.hour === 0) {
values.hour = 12;
}
}
}
$.each(values, function(k, v) {
//call val() for each existing combo, e.g. this.$hour.val()
if(that['$'+k]) {
if(k === 'minute' && that.options.minuteStep > 1 && that.options.roundTime) {
v = getNearest(that['$'+k], v);
}
if(k === 'second' && that.options.secondStep > 1 && that.options.roundTime) {
v = getNearest(that['$'+k], v);
}
that['$'+k].val(v);
}
});
this.$element.val(dt.format(this.options.format));
}
},
/*
highlight combos if date is invalid
*/
highlight: function(dt) {
if(!dt.isValid()) {
if(this.options.errorClass) {
this.$widget.addClass(this.options.errorClass);
} else {
//store original border color
if(!this.borderColor) {
this.borderColor = this.$widget.find('select').css('border-color');
}
this.$widget.find('select').css('border-color', 'red');
}
} else {
if(this.options.errorClass) {
this.$widget.removeClass(this.options.errorClass);
} else {
this.$widget.find('select').css('border-color', this.borderColor);
}
}
},
leadZero: function(v) {
return v <= 9 ? '0' + v : v;
},
destroy: function() {
this.$widget.remove();
this.$element.removeData('combodate').show();
}
//todo: clear method
};
$.fn.combodate = function ( option ) {
var d, args = Array.apply(null, arguments);
args.shift();
//getValue returns date as string / object (not jQuery object)
if(option === 'getValue' && this.length && (d = this.eq(0).data('combodate'))) {
return d.getValue.apply(d, args);
}
return this.each(function () {
var $this = $(this),
data = $this.data('combodate'),
options = typeof option == 'object' && option;
if (!data) {
$this.data('combodate', (data = new Combodate(this, options)));
}
if (typeof option == 'string' && typeof data[option] == 'function') {
data[option].apply(data, args);
}
});
};
$.fn.combodate.defaults = {
//in this format value stored in original input
format: 'DD-MM-YYYY HH:mm',
//in this format items in dropdowns are displayed
template: 'D / MMM / YYYY H : mm',
//initial value, can be `new Date()`
value: null,
minYear: 1970,
maxYear: 2015,
yearDescending: true,
minuteStep: 5,
secondStep: 1,
firstItem: 'empty', //'name', 'empty', 'none'
errorClass: null,
roundTime: true //whether to round minutes and seconds if step > 1
};
}(window.jQuery));
/**
Combodate input - dropdown date and time picker.
Based on [combodate](http://vitalets.github.com/combodate) plugin (included). To use it you should manually include [momentjs](http://momentjs.com).
<script src="js/moment.min.js"></script>
Allows to input:
* only date
* only time
* both date and time
Please note, that format is taken from momentjs and **not compatible** with bootstrap-datepicker / jquery UI datepicker.
Internally value stored as `momentjs` object.
@class combodate
@extends abstractinput
@final
@since 1.4.0
@example
<a href="#" id="dob" data-type="combodate" data-pk="1" data-url="/post" data-value="1984-05-15" data-title="Select date"></a>
<script>
$(function(){
$('#dob').editable({
format: 'YYYY-MM-DD',
viewformat: 'DD.MM.YYYY',
template: 'D / MMMM / YYYY',
combodate: {
minYear: 2000,
maxYear: 2015,
minuteStep: 1
}
}
});
});
</script>
**/
/*global moment*/
(function ($) {
"use strict";
var Constructor = function (options) {
this.init('combodate', options, Constructor.defaults);
//by default viewformat equals to format
if(!this.options.viewformat) {
this.options.viewformat = this.options.format;
}
//try parse combodate config defined as json string in data-combodate
options.combodate = $.fn.editableutils.tryParseJson(options.combodate, true);
//overriding combodate config (as by default jQuery extend() is not recursive)
this.options.combodate = $.extend({}, Constructor.defaults.combodate, options.combodate, {
format: this.options.format,
template: this.options.template
});
};
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.abstractinput);
$.extend(Constructor.prototype, {
render: function () {
this.$input.combodate(this.options.combodate);
if($.fn.editableform.engine === 'bs3') {
this.$input.siblings().find('select').addClass('form-control');
}
if(this.options.inputclass) {
this.$input.siblings().find('select').addClass(this.options.inputclass);
}
//"clear" link
/*
if(this.options.clear) {
this.$clear = $('<a href="#"></a>').html(this.options.clear).click($.proxy(function(e){
e.preventDefault();
e.stopPropagation();
this.clear();
}, this));
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
}
*/
},
value2html: function(value, element) {
var text = value ? value.format(this.options.viewformat) : '';
//$(element).text(text);
Constructor.superclass.value2html.call(this, text, element);
},
html2value: function(html) {
return html ? moment(html, this.options.viewformat) : null;
},
value2str: function(value) {
return value ? value.format(this.options.format) : '';
},
str2value: function(str) {
return str ? moment(str, this.options.format) : null;
},
value2submit: function(value) {
return this.value2str(value);
},
value2input: function(value) {
this.$input.combodate('setValue', value);
},
input2value: function() {
return this.$input.combodate('getValue', null);
},
activate: function() {
this.$input.siblings('.combodate').find('select').eq(0).focus();
},
/*
clear: function() {
this.$input.data('datepicker').date = null;
this.$input.find('.active').removeClass('active');
},
*/
autosubmit: function() {
}
});
Constructor.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <input type="text">
**/
tpl:'<input type="text">',
/**
@property inputclass
@default null
**/
inputclass: null,
/**
Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br>
See list of tokens in [momentjs docs](http://momentjs.com/docs/#/parsing/string-format)
@property format
@type string
@default YYYY-MM-DD
**/
format:'YYYY-MM-DD',
/**
Format used for displaying date. Also applied when converting date from element's text on init.
If not specified equals to `format`.
@property viewformat
@type string
@default null
**/
viewformat: null,
/**
Template used for displaying dropdowns.
@property template
@type string
@default D / MMM / YYYY
**/
template: 'D / MMM / YYYY',
/**
Configuration of combodate.
Full list of options: http://vitalets.github.com/combodate/#docs
@property combodate
@type object
@default null
**/
combodate: null
/*
(not implemented yet)
Text shown as clear date button.
If <code>false</code> clear button will not be rendered.
@property clear
@type boolean|string
@default 'x clear'
*/
//clear: '× clear'
});
$.fn.editabletypes.combodate = Constructor;
}(window.jQuery));
/*
Editableform based on Twitter Bootstrap 2
*/
(function ($) {
"use strict";
//store parent methods
var pInitInput = $.fn.editableform.Constructor.prototype.initInput;
$.extend($.fn.editableform.Constructor.prototype, {
initTemplate: function() {
this.$form = $($.fn.editableform.template);
this.$form.find('.editable-error-block').addClass('help-block');
},
initInput: function() {
pInitInput.apply(this);
//for bs2 set default class `input-medium` to standard inputs
var emptyInputClass = this.input.options.inputclass === null || this.input.options.inputclass === false;
var defaultClass = 'input-medium';
//add bs2 default class to standard inputs
//if(this.input.$input.is('input,select,textarea')) {
var stdtypes = 'text,select,textarea,password,email,url,tel,number,range,time'.split(',');
if(~$.inArray(this.input.type, stdtypes) && emptyInputClass) {
this.input.options.inputclass = defaultClass;
this.input.$input.addClass(defaultClass);
}
}
});
//buttons
$.fn.editableform.buttons = '<button type="submit" class="btn btn-primary editable-submit"><i class="icon-ok icon-white"></i></button>'+
'<button type="button" class="btn editable-cancel"><i class="icon-remove"></i></button>';
//error classes
$.fn.editableform.errorGroupClass = 'error';
$.fn.editableform.errorBlockClass = null;
//engine
$.fn.editableform.engine = 'bs2';
}(window.jQuery));
/**
* Editable Popover
* ---------------------
* requires bootstrap-popover.js
*/
(function ($) {
"use strict";
//extend methods
$.extend($.fn.editableContainer.Popup.prototype, {
containerName: 'popover',
//for compatibility with bootstrap <= 2.2.1 (content inserted into <p> instead of directly .popover-content)
innerCss: $.fn.popover && $($.fn.popover.defaults.template).find('p').length ? '.popover-content p' : '.popover-content',
defaults: $.fn.popover.defaults,
initContainer: function(){
$.extend(this.containerOptions, {
trigger: 'manual',
selector: false,
content: ' ',
template: this.defaults.template
});
//as template property is used in inputs, hide it from popover
var t;
if(this.$element.data('template')) {
t = this.$element.data('template');
this.$element.removeData('template');
}
this.call(this.containerOptions);
if(t) {
//restore data('template')
this.$element.data('template', t);
}
},
/* show */
innerShow: function () {
this.call('show');
},
/* hide */
innerHide: function () {
this.call('hide');
},
/* destroy */
innerDestroy: function() {
this.call('destroy');
},
setContainerOption: function(key, value) {
this.container().options[key] = value;
},
/**
* move popover to new position. This function mainly copied from bootstrap-popover.
*/
/*jshint laxcomma: true*/
setPosition: function () {
(function() {
var $tip = this.tip()
, inside
, pos
, actualWidth
, actualHeight
, placement
, tp
, tpt
, tpb
, tpl
, tpr;
placement = typeof this.options.placement === 'function' ?
this.options.placement.call(this, $tip[0], this.$element[0]) :
this.options.placement;
inside = /in/.test(placement);
$tip
// .detach()
//vitalets: remove any placement class because otherwise they dont influence on re-positioning of visible popover
.removeClass('top right bottom left')
.css({ top: 0, left: 0, display: 'block' });
// .insertAfter(this.$element);
pos = this.getPosition(inside);
actualWidth = $tip[0].offsetWidth;
actualHeight = $tip[0].offsetHeight;
placement = inside ? placement.split(' ')[1] : placement;
tpb = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2};
tpt = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2};
tpl = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth};
tpr = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width};
switch (placement) {
case 'bottom':
if ((tpb.top + actualHeight) > ($(window).scrollTop() + $(window).height())) {
if (tpt.top > $(window).scrollTop()) {
placement = 'top';
} else if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) {
placement = 'right';
} else if (tpl.left > $(window).scrollLeft()) {
placement = 'left';
} else {
placement = 'right';
}
}
break;
case 'top':
if (tpt.top < $(window).scrollTop()) {
if ((tpb.top + actualHeight) < ($(window).scrollTop() + $(window).height())) {
placement = 'bottom';
} else if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) {
placement = 'right';
} else if (tpl.left > $(window).scrollLeft()) {
placement = 'left';
} else {
placement = 'right';
}
}
break;
case 'left':
if (tpl.left < $(window).scrollLeft()) {
if ((tpr.left + actualWidth) < ($(window).scrollLeft() + $(window).width())) {
placement = 'right';
} else if (tpt.top > $(window).scrollTop()) {
placement = 'top';
} else if (tpt.top > $(window).scrollTop()) {
placement = 'bottom';
} else {
placement = 'right';
}
}
break;
case 'right':
if ((tpr.left + actualWidth) > ($(window).scrollLeft() + $(window).width())) {
if (tpl.left > $(window).scrollLeft()) {
placement = 'left';
} else if (tpt.top > $(window).scrollTop()) {
placement = 'top';
} else if (tpt.top > $(window).scrollTop()) {
placement = 'bottom';
}
}
break;
}
switch (placement) {
case 'bottom':
tp = tpb;
break;
case 'top':
tp = tpt;
break;
case 'left':
tp = tpl;
break;
case 'right':
tp = tpr;
break;
}
$tip
.offset(tp)
.addClass(placement)
.addClass('in');
}).call(this.container());
/*jshint laxcomma: false*/
}
});
}(window.jQuery));
/* =========================================================
* bootstrap-datepicker.js
* http://www.eyecon.ro/bootstrap-datepicker
* =========================================================
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
*
* 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.
* ========================================================= */
(function( $ ) {
function UTCDate(){
return new Date(Date.UTC.apply(Date, arguments));
}
function UTCToday(){
var today = new Date();
return UTCDate(today.getUTCFullYear(), today.getUTCMonth(), today.getUTCDate());
}
// Picker object
var Datepicker = function(element, options) {
var that = this;
this._process_options(options);
this.element = $(element);
this.isInline = false;
this.isInput = this.element.is('input');
this.component = this.element.is('.date') ? this.element.find('.add-on, .btn') : false;
this.hasInput = this.component && this.element.find('input').length;
if(this.component && this.component.length === 0)
this.component = false;
this.picker = $(DPGlobal.template);
this._buildEvents();
this._attachEvents();
if(this.isInline) {
this.picker.addClass('datepicker-inline').appendTo(this.element);
} else {
this.picker.addClass('datepicker-dropdown dropdown-menu');
}
if (this.o.rtl){
this.picker.addClass('datepicker-rtl');
this.picker.find('.prev i, .next i')
.toggleClass('icon-arrow-left icon-arrow-right');
}
this.viewMode = this.o.startView;
if (this.o.calendarWeeks)
this.picker.find('tfoot th.today')
.attr('colspan', function(i, val){
return parseInt(val) + 1;
});
this._allow_update = false;
this.setStartDate(this.o.startDate);
this.setEndDate(this.o.endDate);
this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled);
this.fillDow();
this.fillMonths();
this._allow_update = true;
this.update();
this.showMode();
if(this.isInline) {
this.show();
}
};
Datepicker.prototype = {
constructor: Datepicker,
_process_options: function(opts){
// Store raw options for reference
this._o = $.extend({}, this._o, opts);
// Processed options
var o = this.o = $.extend({}, this._o);
// Check if "de-DE" style date is available, if not language should
// fallback to 2 letter code eg "de"
var lang = o.language;
if (!dates[lang]) {
lang = lang.split('-')[0];
if (!dates[lang])
lang = defaults.language;
}
o.language = lang;
switch(o.startView){
case 2:
case 'decade':
o.startView = 2;
break;
case 1:
case 'year':
o.startView = 1;
break;
default:
o.startView = 0;
}
switch (o.minViewMode) {
case 1:
case 'months':
o.minViewMode = 1;
break;
case 2:
case 'years':
o.minViewMode = 2;
break;
default:
o.minViewMode = 0;
}
o.startView = Math.max(o.startView, o.minViewMode);
o.weekStart %= 7;
o.weekEnd = ((o.weekStart + 6) % 7);
var format = DPGlobal.parseFormat(o.format)
if (o.startDate !== -Infinity) {
o.startDate = DPGlobal.parseDate(o.startDate, format, o.language);
}
if (o.endDate !== Infinity) {
o.endDate = DPGlobal.parseDate(o.endDate, format, o.language);
}
o.daysOfWeekDisabled = o.daysOfWeekDisabled||[];
if (!$.isArray(o.daysOfWeekDisabled))
o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/);
o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function (d) {
return parseInt(d, 10);
});
},
_events: [],
_secondaryEvents: [],
_applyEvents: function(evs){
for (var i=0, el, ev; i<evs.length; i++){
el = evs[i][0];
ev = evs[i][1];
el.on(ev);
}
},
_unapplyEvents: function(evs){
for (var i=0, el, ev; i<evs.length; i++){
el = evs[i][0];
ev = evs[i][1];
el.off(ev);
}
},
_buildEvents: function(){
if (this.isInput) { // single input
this._events = [
[this.element, {
focus: $.proxy(this.show, this),
keyup: $.proxy(this.update, this),
keydown: $.proxy(this.keydown, this)
}]
];
}
else if (this.component && this.hasInput){ // component: input + button
this._events = [
// For components that are not readonly, allow keyboard nav
[this.element.find('input'), {
focus: $.proxy(this.show, this),
keyup: $.proxy(this.update, this),
keydown: $.proxy(this.keydown, this)
}],
[this.component, {
click: $.proxy(this.show, this)
}]
];
}
else if (this.element.is('div')) { // inline datepicker
this.isInline = true;
}
else {
this._events = [
[this.element, {
click: $.proxy(this.show, this)
}]
];
}
this._secondaryEvents = [
[this.picker, {
click: $.proxy(this.click, this)
}],
[$(window), {
resize: $.proxy(this.place, this)
}],
[$(document), {
mousedown: $.proxy(function (e) {
// Clicked outside the datepicker, hide it
if (!(
this.element.is(e.target) ||
this.element.find(e.target).size() ||
this.picker.is(e.target) ||
this.picker.find(e.target).size()
)) {
this.hide();
}
}, this)
}]
];
},
_attachEvents: function(){
this._detachEvents();
this._applyEvents(this._events);
},
_detachEvents: function(){
this._unapplyEvents(this._events);
},
_attachSecondaryEvents: function(){
this._detachSecondaryEvents();
this._applyEvents(this._secondaryEvents);
},
_detachSecondaryEvents: function(){
this._unapplyEvents(this._secondaryEvents);
},
_trigger: function(event, altdate){
var date = altdate || this.date,
local_date = new Date(date.getTime() + (date.getTimezoneOffset()*60000));
this.element.trigger({
type: event,
date: local_date,
format: $.proxy(function(altformat){
var format = altformat || this.o.format;
return DPGlobal.formatDate(date, format, this.o.language);
}, this)
});
},
show: function(e) {
if (!this.isInline)
this.picker.appendTo('body');
this.picker.show();
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
this.place();
this._attachSecondaryEvents();
if (e) {
e.preventDefault();
}
this._trigger('show');
},
hide: function(e){
if(this.isInline) return;
if (!this.picker.is(':visible')) return;
this.picker.hide().detach();
this._detachSecondaryEvents();
this.viewMode = this.o.startView;
this.showMode();
if (
this.o.forceParse &&
(
this.isInput && this.element.val() ||
this.hasInput && this.element.find('input').val()
)
)
this.setValue();
this._trigger('hide');
},
remove: function() {
this.hide();
this._detachEvents();
this._detachSecondaryEvents();
this.picker.remove();
delete this.element.data().datepicker;
if (!this.isInput) {
delete this.element.data().date;
}
},
getDate: function() {
var d = this.getUTCDate();
return new Date(d.getTime() + (d.getTimezoneOffset()*60000));
},
getUTCDate: function() {
return this.date;
},
setDate: function(d) {
this.setUTCDate(new Date(d.getTime() - (d.getTimezoneOffset()*60000)));
},
setUTCDate: function(d) {
this.date = d;
this.setValue();
},
setValue: function() {
var formatted = this.getFormattedDate();
if (!this.isInput) {
if (this.component){
this.element.find('input').val(formatted);
}
} else {
this.element.val(formatted);
}
},
getFormattedDate: function(format) {
if (format === undefined)
format = this.o.format;
return DPGlobal.formatDate(this.date, format, this.o.language);
},
setStartDate: function(startDate){
this._process_options({startDate: startDate});
this.update();
this.updateNavArrows();
},
setEndDate: function(endDate){
this._process_options({endDate: endDate});
this.update();
this.updateNavArrows();
},
setDaysOfWeekDisabled: function(daysOfWeekDisabled){
this._process_options({daysOfWeekDisabled: daysOfWeekDisabled});
this.update();
this.updateNavArrows();
},
place: function(){
if(this.isInline) return;
var zIndex = parseInt(this.element.parents().filter(function() {
return $(this).css('z-index') != 'auto';
}).first().css('z-index'))+10;
var offset = this.component ? this.component.parent().offset() : this.element.offset();
var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(true);
this.picker.css({
top: offset.top + height,
left: offset.left,
zIndex: zIndex
});
},
_allow_update: true,
update: function(){
if (!this._allow_update) return;
var date, fromArgs = false;
if(arguments && arguments.length && (typeof arguments[0] === 'string' || arguments[0] instanceof Date)) {
date = arguments[0];
fromArgs = true;
} else {
date = this.isInput ? this.element.val() : this.element.data('date') || this.element.find('input').val();
delete this.element.data().date;
}
this.date = DPGlobal.parseDate(date, this.o.format, this.o.language);
if(fromArgs) this.setValue();
if (this.date < this.o.startDate) {
this.viewDate = new Date(this.o.startDate);
} else if (this.date > this.o.endDate) {
this.viewDate = new Date(this.o.endDate);
} else {
this.viewDate = new Date(this.date);
}
this.fill();
},
fillDow: function(){
var dowCnt = this.o.weekStart,
html = '<tr>';
if(this.o.calendarWeeks){
var cell = '<th class="cw"> </th>';
html += cell;
this.picker.find('.datepicker-days thead tr:first-child').prepend(cell);
}
while (dowCnt < this.o.weekStart + 7) {
html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>';
}
html += '</tr>';
this.picker.find('.datepicker-days thead').append(html);
},
fillMonths: function(){
var html = '',
i = 0;
while (i < 12) {
html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>';
}
this.picker.find('.datepicker-months td').html(html);
},
setRange: function(range){
if (!range || !range.length)
delete this.range;
else
this.range = $.map(range, function(d){ return d.valueOf(); });
this.fill();
},
getClassNames: function(date){
var cls = [],
year = this.viewDate.getUTCFullYear(),
month = this.viewDate.getUTCMonth(),
currentDate = this.date.valueOf(),
today = new Date();
if (date.getUTCFullYear() < year || (date.getUTCFullYear() == year && date.getUTCMonth() < month)) {
cls.push('old');
} else if (date.getUTCFullYear() > year || (date.getUTCFullYear() == year && date.getUTCMonth() > month)) {
cls.push('new');
}
// Compare internal UTC date with local today, not UTC today
if (this.o.todayHighlight &&
date.getUTCFullYear() == today.getFullYear() &&
date.getUTCMonth() == today.getMonth() &&
date.getUTCDate() == today.getDate()) {
cls.push('today');
}
if (currentDate && date.valueOf() == currentDate) {
cls.push('active');
}
if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate ||
$.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1) {
cls.push('disabled');
}
if (this.range){
if (date > this.range[0] && date < this.range[this.range.length-1]){
cls.push('range');
}
if ($.inArray(date.valueOf(), this.range) != -1){
cls.push('selected');
}
}
return cls;
},
fill: function() {
var d = new Date(this.viewDate),
year = d.getUTCFullYear(),
month = d.getUTCMonth(),
startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity,
startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity,
endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity,
endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity,
currentDate = this.date && this.date.valueOf(),
tooltip;
this.picker.find('.datepicker-days thead th.datepicker-switch')
.text(dates[this.o.language].months[month]+' '+year);
this.picker.find('tfoot th.today')
.text(dates[this.o.language].today)
.toggle(this.o.todayBtn !== false);
this.picker.find('tfoot th.clear')
.text(dates[this.o.language].clear)
.toggle(this.o.clearBtn !== false);
this.updateNavArrows();
this.fillMonths();
var prevMonth = UTCDate(year, month-1, 28,0,0,0,0),
day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
prevMonth.setUTCDate(day);
prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7);
var nextMonth = new Date(prevMonth);
nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
nextMonth = nextMonth.valueOf();
var html = [];
var clsName;
while(prevMonth.valueOf() < nextMonth) {
if (prevMonth.getUTCDay() == this.o.weekStart) {
html.push('<tr>');
if(this.o.calendarWeeks){
// ISO 8601: First week contains first thursday.
// ISO also states week starts on Monday, but we can be more abstract here.
var
// Start of current week: based on weekstart/current date
ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5),
// Thursday of this week
th = new Date(+ws + (7 + 4 - ws.getUTCDay()) % 7 * 864e5),
// First Thursday of year, year from thursday
yth = new Date(+(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5),
// Calendar week: ms between thursdays, div ms per day, div 7 days
calWeek = (th - yth) / 864e5 / 7 + 1;
html.push('<td class="cw">'+ calWeek +'</td>');
}
}
clsName = this.getClassNames(prevMonth);
clsName.push('day');
var before = this.o.beforeShowDay(prevMonth);
if (before === undefined)
before = {};
else if (typeof(before) === 'boolean')
before = {enabled: before};
else if (typeof(before) === 'string')
before = {classes: before};
if (before.enabled === false)
clsName.push('disabled');
if (before.classes)
clsName = clsName.concat(before.classes.split(/\s+/));
if (before.tooltip)
tooltip = before.tooltip;
clsName = $.unique(clsName);
html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>');
if (prevMonth.getUTCDay() == this.o.weekEnd) {
html.push('</tr>');
}
prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
}
this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
var currentYear = this.date && this.date.getUTCFullYear();
var months = this.picker.find('.datepicker-months')
.find('th:eq(1)')
.text(year)
.end()
.find('span').removeClass('active');
if (currentYear && currentYear == year) {
months.eq(this.date.getUTCMonth()).addClass('active');
}
if (year < startYear || year > endYear) {
months.addClass('disabled');
}
if (year == startYear) {
months.slice(0, startMonth).addClass('disabled');
}
if (year == endYear) {
months.slice(endMonth+1).addClass('disabled');
}
html = '';
year = parseInt(year/10, 10) * 10;
var yearCont = this.picker.find('.datepicker-years')
.find('th:eq(1)')
.text(year + '-' + (year + 9))
.end()
.find('td');
year -= 1;
for (var i = -1; i < 11; i++) {
html += '<span class="year'+(i == -1 ? ' old' : i == 10 ? ' new' : '')+(currentYear == year ? ' active' : '')+(year < startYear || year > endYear ? ' disabled' : '')+'">'+year+'</span>';
year += 1;
}
yearCont.html(html);
},
updateNavArrows: function() {
if (!this._allow_update) return;
var d = new Date(this.viewDate),
year = d.getUTCFullYear(),
month = d.getUTCMonth();
switch (this.viewMode) {
case 0:
if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()) {
this.picker.find('.prev').css({visibility: 'hidden'});
} else {
this.picker.find('.prev').css({visibility: 'visible'});
}
if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()) {
this.picker.find('.next').css({visibility: 'hidden'});
} else {
this.picker.find('.next').css({visibility: 'visible'});
}
break;
case 1:
case 2:
if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()) {
this.picker.find('.prev').css({visibility: 'hidden'});
} else {
this.picker.find('.prev').css({visibility: 'visible'});
}
if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()) {
this.picker.find('.next').css({visibility: 'hidden'});
} else {
this.picker.find('.next').css({visibility: 'visible'});
}
break;
}
},
click: function(e) {
e.preventDefault();
var target = $(e.target).closest('span, td, th');
if (target.length == 1) {
switch(target[0].nodeName.toLowerCase()) {
case 'th':
switch(target[0].className) {
case 'datepicker-switch':
this.showMode(1);
break;
case 'prev':
case 'next':
var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1);
switch(this.viewMode){
case 0:
this.viewDate = this.moveMonth(this.viewDate, dir);
break;
case 1:
case 2:
this.viewDate = this.moveYear(this.viewDate, dir);
break;
}
this.fill();
break;
case 'today':
var date = new Date();
date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
this.showMode(-2);
var which = this.o.todayBtn == 'linked' ? null : 'view';
this._setDate(date, which);
break;
case 'clear':
var element;
if (this.isInput)
element = this.element;
else if (this.component)
element = this.element.find('input');
if (element)
element.val("").change();
this._trigger('changeDate');
this.update();
if (this.o.autoclose)
this.hide();
break;
}
break;
case 'span':
if (!target.is('.disabled')) {
this.viewDate.setUTCDate(1);
if (target.is('.month')) {
var day = 1;
var month = target.parent().find('span').index(target);
var year = this.viewDate.getUTCFullYear();
this.viewDate.setUTCMonth(month);
this._trigger('changeMonth', this.viewDate);
if (this.o.minViewMode === 1) {
this._setDate(UTCDate(year, month, day,0,0,0,0));
}
} else {
var year = parseInt(target.text(), 10)||0;
var day = 1;
var month = 0;
this.viewDate.setUTCFullYear(year);
this._trigger('changeYear', this.viewDate);
if (this.o.minViewMode === 2) {
this._setDate(UTCDate(year, month, day,0,0,0,0));
}
}
this.showMode(-1);
this.fill();
}
break;
case 'td':
if (target.is('.day') && !target.is('.disabled')){
var day = parseInt(target.text(), 10)||1;
var year = this.viewDate.getUTCFullYear(),
month = this.viewDate.getUTCMonth();
if (target.is('.old')) {
if (month === 0) {
month = 11;
year -= 1;
} else {
month -= 1;
}
} else if (target.is('.new')) {
if (month == 11) {
month = 0;
year += 1;
} else {
month += 1;
}
}
this._setDate(UTCDate(year, month, day,0,0,0,0));
}
break;
}
}
},
_setDate: function(date, which){
if (!which || which == 'date')
this.date = new Date(date);
if (!which || which == 'view')
this.viewDate = new Date(date);
this.fill();
this.setValue();
this._trigger('changeDate');
var element;
if (this.isInput) {
element = this.element;
} else if (this.component){
element = this.element.find('input');
}
if (element) {
element.change();
if (this.o.autoclose && (!which || which == 'date')) {
this.hide();
}
}
},
moveMonth: function(date, dir){
if (!dir) return date;
var new_date = new Date(date.valueOf()),
day = new_date.getUTCDate(),
month = new_date.getUTCMonth(),
mag = Math.abs(dir),
new_month, test;
dir = dir > 0 ? 1 : -1;
if (mag == 1){
test = dir == -1
// If going back one month, make sure month is not current month
// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
? function(){ return new_date.getUTCMonth() == month; }
// If going forward one month, make sure month is as expected
// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
: function(){ return new_date.getUTCMonth() != new_month; };
new_month = month + dir;
new_date.setUTCMonth(new_month);
// Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
if (new_month < 0 || new_month > 11)
new_month = (new_month + 12) % 12;
} else {
// For magnitudes >1, move one month at a time...
for (var i=0; i<mag; i++)
// ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
new_date = this.moveMonth(new_date, dir);
// ...then reset the day, keeping it in the new month
new_month = new_date.getUTCMonth();
new_date.setUTCDate(day);
test = function(){ return new_month != new_date.getUTCMonth(); };
}
// Common date-resetting loop -- if date is beyond end of month, make it
// end of month
while (test()){
new_date.setUTCDate(--day);
new_date.setUTCMonth(new_month);
}
return new_date;
},
moveYear: function(date, dir){
return this.moveMonth(date, dir*12);
},
dateWithinRange: function(date){
return date >= this.o.startDate && date <= this.o.endDate;
},
keydown: function(e){
if (this.picker.is(':not(:visible)')){
if (e.keyCode == 27) // allow escape to hide and re-show picker
this.show();
return;
}
var dateChanged = false,
dir, day, month,
newDate, newViewDate;
switch(e.keyCode){
case 27: // escape
this.hide();
e.preventDefault();
break;
case 37: // left
case 39: // right
if (!this.o.keyboardNavigation) break;
dir = e.keyCode == 37 ? -1 : 1;
if (e.ctrlKey){
newDate = this.moveYear(this.date, dir);
newViewDate = this.moveYear(this.viewDate, dir);
} else if (e.shiftKey){
newDate = this.moveMonth(this.date, dir);
newViewDate = this.moveMonth(this.viewDate, dir);
} else {
newDate = new Date(this.date);
newDate.setUTCDate(this.date.getUTCDate() + dir);
newViewDate = new Date(this.viewDate);
newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir);
}
if (this.dateWithinRange(newDate)){
this.date = newDate;
this.viewDate = newViewDate;
this.setValue();
this.update();
e.preventDefault();
dateChanged = true;
}
break;
case 38: // up
case 40: // down
if (!this.o.keyboardNavigation) break;
dir = e.keyCode == 38 ? -1 : 1;
if (e.ctrlKey){
newDate = this.moveYear(this.date, dir);
newViewDate = this.moveYear(this.viewDate, dir);
} else if (e.shiftKey){
newDate = this.moveMonth(this.date, dir);
newViewDate = this.moveMonth(this.viewDate, dir);
} else {
newDate = new Date(this.date);
newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
newViewDate = new Date(this.viewDate);
newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7);
}
if (this.dateWithinRange(newDate)){
this.date = newDate;
this.viewDate = newViewDate;
this.setValue();
this.update();
e.preventDefault();
dateChanged = true;
}
break;
case 13: // enter
this.hide();
e.preventDefault();
break;
case 9: // tab
this.hide();
break;
}
if (dateChanged){
this._trigger('changeDate');
var element;
if (this.isInput) {
element = this.element;
} else if (this.component){
element = this.element.find('input');
}
if (element) {
element.change();
}
}
},
showMode: function(dir) {
if (dir) {
this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir));
}
/*
vitalets: fixing bug of very special conditions:
jquery 1.7.1 + webkit + show inline datepicker in bootstrap popover.
Method show() does not set display css correctly and datepicker is not shown.
Changed to .css('display', 'block') solve the problem.
See https://github.com/vitalets/x-editable/issues/37
In jquery 1.7.2+ everything works fine.
*/
//this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).css('display', 'block');
this.updateNavArrows();
}
};
var DateRangePicker = function(element, options){
this.element = $(element);
this.inputs = $.map(options.inputs, function(i){ return i.jquery ? i[0] : i; });
delete options.inputs;
$(this.inputs)
.datepicker(options)
.bind('changeDate', $.proxy(this.dateUpdated, this));
this.pickers = $.map(this.inputs, function(i){ return $(i).data('datepicker'); });
this.updateDates();
};
DateRangePicker.prototype = {
updateDates: function(){
this.dates = $.map(this.pickers, function(i){ return i.date; });
this.updateRanges();
},
updateRanges: function(){
var range = $.map(this.dates, function(d){ return d.valueOf(); });
$.each(this.pickers, function(i, p){
p.setRange(range);
});
},
dateUpdated: function(e){
var dp = $(e.target).data('datepicker'),
new_date = dp.getUTCDate(),
i = $.inArray(e.target, this.inputs),
l = this.inputs.length;
if (i == -1) return;
if (new_date < this.dates[i]){
// Date being moved earlier/left
while (i>=0 && new_date < this.dates[i]){
this.pickers[i--].setUTCDate(new_date);
}
}
else if (new_date > this.dates[i]){
// Date being moved later/right
while (i<l && new_date > this.dates[i]){
this.pickers[i++].setUTCDate(new_date);
}
}
this.updateDates();
},
remove: function(){
$.map(this.pickers, function(p){ p.remove(); });
delete this.element.data().datepicker;
}
};
function opts_from_el(el, prefix){
// Derive options from element data-attrs
var data = $(el).data(),
out = {}, inkey,
replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])'),
prefix = new RegExp('^' + prefix.toLowerCase());
for (var key in data)
if (prefix.test(key)){
inkey = key.replace(replace, function(_,a){ return a.toLowerCase(); });
out[inkey] = data[key];
}
return out;
}
function opts_from_locale(lang){
// Derive options from locale plugins
var out = {};
// Check if "de-DE" style date is available, if not language should
// fallback to 2 letter code eg "de"
if (!dates[lang]) {
lang = lang.split('-')[0]
if (!dates[lang])
return;
}
var d = dates[lang];
$.each(locale_opts, function(i,k){
if (k in d)
out[k] = d[k];
});
return out;
}
var old = $.fn.datepicker;
var datepicker = $.fn.datepicker = function ( option ) {
var args = Array.apply(null, arguments);
args.shift();
var internal_return,
this_return;
this.each(function () {
var $this = $(this),
data = $this.data('datepicker'),
options = typeof option == 'object' && option;
if (!data) {
var elopts = opts_from_el(this, 'date'),
// Preliminary otions
xopts = $.extend({}, defaults, elopts, options),
locopts = opts_from_locale(xopts.language),
// Options priority: js args, data-attrs, locales, defaults
opts = $.extend({}, defaults, locopts, elopts, options);
if ($this.is('.input-daterange') || opts.inputs){
var ropts = {
inputs: opts.inputs || $this.find('input').toArray()
};
$this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts))));
}
else{
$this.data('datepicker', (data = new Datepicker(this, opts)));
}
}
if (typeof option == 'string' && typeof data[option] == 'function') {
internal_return = data[option].apply(data, args);
if (internal_return !== undefined)
return false;
}
});
if (internal_return !== undefined)
return internal_return;
else
return this;
};
var defaults = $.fn.datepicker.defaults = {
autoclose: false,
beforeShowDay: $.noop,
calendarWeeks: false,
clearBtn: false,
daysOfWeekDisabled: [],
endDate: Infinity,
forceParse: true,
format: 'mm/dd/yyyy',
keyboardNavigation: true,
language: 'en',
minViewMode: 0,
rtl: false,
startDate: -Infinity,
startView: 0,
todayBtn: false,
todayHighlight: false,
weekStart: 0
};
var locale_opts = $.fn.datepicker.locale_opts = [
'format',
'rtl',
'weekStart'
];
$.fn.datepicker.Constructor = Datepicker;
var dates = $.fn.datepicker.dates = {
en: {
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
today: "Today",
clear: "Clear"
}
};
var DPGlobal = {
modes: [
{
clsName: 'days',
navFnc: 'Month',
navStep: 1
},
{
clsName: 'months',
navFnc: 'FullYear',
navStep: 1
},
{
clsName: 'years',
navFnc: 'FullYear',
navStep: 10
}],
isLeapYear: function (year) {
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0));
},
getDaysInMonth: function (year, month) {
return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month];
},
validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g,
nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g,
parseFormat: function(format){
// IE treats \0 as a string end in inputs (truncating the value),
// so it's a bad format delimiter, anyway
var separators = format.replace(this.validParts, '\0').split('\0'),
parts = format.match(this.validParts);
if (!separators || !separators.length || !parts || parts.length === 0){
throw new Error("Invalid date format.");
}
return {separators: separators, parts: parts};
},
parseDate: function(date, format, language) {
if (date instanceof Date) return date;
if (typeof format === 'string')
format = DPGlobal.parseFormat(format);
if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)) {
var part_re = /([\-+]\d+)([dmwy])/,
parts = date.match(/([\-+]\d+)([dmwy])/g),
part, dir;
date = new Date();
for (var i=0; i<parts.length; i++) {
part = part_re.exec(parts[i]);
dir = parseInt(part[1]);
switch(part[2]){
case 'd':
date.setUTCDate(date.getUTCDate() + dir);
break;
case 'm':
date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
break;
case 'w':
date.setUTCDate(date.getUTCDate() + dir * 7);
break;
case 'y':
date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
break;
}
}
return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
}
var parts = date && date.match(this.nonpunctuation) || [],
date = new Date(),
parsed = {},
setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
setters_map = {
yyyy: function(d,v){ return d.setUTCFullYear(v); },
yy: function(d,v){ return d.setUTCFullYear(2000+v); },
m: function(d,v){
v -= 1;
while (v<0) v += 12;
v %= 12;
d.setUTCMonth(v);
while (d.getUTCMonth() != v)
d.setUTCDate(d.getUTCDate()-1);
return d;
},
d: function(d,v){ return d.setUTCDate(v); }
},
val, filtered, part;
setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
setters_map['dd'] = setters_map['d'];
date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0);
var fparts = format.parts.slice();
// Remove noop parts
if (parts.length != fparts.length) {
fparts = $(fparts).filter(function(i,p){
return $.inArray(p, setters_order) !== -1;
}).toArray();
}
// Process remainder
if (parts.length == fparts.length) {
for (var i=0, cnt = fparts.length; i < cnt; i++) {
val = parseInt(parts[i], 10);
part = fparts[i];
if (isNaN(val)) {
switch(part) {
case 'MM':
filtered = $(dates[language].months).filter(function(){
var m = this.slice(0, parts[i].length),
p = parts[i].slice(0, m.length);
return m == p;
});
val = $.inArray(filtered[0], dates[language].months) + 1;
break;
case 'M':
filtered = $(dates[language].monthsShort).filter(function(){
var m = this.slice(0, parts[i].length),
p = parts[i].slice(0, m.length);
return m == p;
});
val = $.inArray(filtered[0], dates[language].monthsShort) + 1;
break;
}
}
parsed[part] = val;
}
for (var i=0, s; i<setters_order.length; i++){
s = setters_order[i];
if (s in parsed && !isNaN(parsed[s]))
setters_map[s](date, parsed[s]);
}
}
return date;
},
formatDate: function(date, format, language){
if (typeof format === 'string')
format = DPGlobal.parseFormat(format);
var val = {
d: date.getUTCDate(),
D: dates[language].daysShort[date.getUTCDay()],
DD: dates[language].days[date.getUTCDay()],
m: date.getUTCMonth() + 1,
M: dates[language].monthsShort[date.getUTCMonth()],
MM: dates[language].months[date.getUTCMonth()],
yy: date.getUTCFullYear().toString().substring(2),
yyyy: date.getUTCFullYear()
};
val.dd = (val.d < 10 ? '0' : '') + val.d;
val.mm = (val.m < 10 ? '0' : '') + val.m;
var date = [],
seps = $.extend([], format.separators);
for (var i=0, cnt = format.parts.length; i <= cnt; i++) {
if (seps.length)
date.push(seps.shift());
date.push(val[format.parts[i]]);
}
return date.join('');
},
headTemplate: '<thead>'+
'<tr>'+
'<th class="prev"><i class="icon-arrow-left"/></th>'+
'<th colspan="5" class="datepicker-switch"></th>'+
'<th class="next"><i class="icon-arrow-right"/></th>'+
'</tr>'+
'</thead>',
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
footTemplate: '<tfoot><tr><th colspan="7" class="today"></th></tr><tr><th colspan="7" class="clear"></th></tr></tfoot>'
};
DPGlobal.template = '<div class="datepicker">'+
'<div class="datepicker-days">'+
'<table class=" table-condensed">'+
DPGlobal.headTemplate+
'<tbody></tbody>'+
DPGlobal.footTemplate+
'</table>'+
'</div>'+
'<div class="datepicker-months">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
DPGlobal.footTemplate+
'</table>'+
'</div>'+
'<div class="datepicker-years">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
DPGlobal.footTemplate+
'</table>'+
'</div>'+
'</div>';
$.fn.datepicker.DPGlobal = DPGlobal;
/* DATEPICKER NO CONFLICT
* =================== */
$.fn.datepicker.noConflict = function(){
$.fn.datepicker = old;
return this;
};
/* DATEPICKER DATA-API
* ================== */
$(document).on(
'focus.datepicker.data-api click.datepicker.data-api',
'[data-provide="datepicker"]',
function(e){
var $this = $(this);
if ($this.data('datepicker')) return;
e.preventDefault();
// component click requires us to explicitly show it
datepicker.call($this, 'show');
}
);
$(function(){
//$('[data-provide="datepicker-inline"]').datepicker();
//vit: changed to support noConflict()
datepicker.call($('[data-provide="datepicker-inline"]'));
});
}( window.jQuery ));
/**
Bootstrap-datepicker.
Description and examples: https://github.com/eternicode/bootstrap-datepicker.
For **i18n** you should include js file from here: https://github.com/eternicode/bootstrap-datepicker/tree/master/js/locales
and set `language` option.
Since 1.4.0 date has different appearance in **popup** and **inline** modes.
@class date
@extends abstractinput
@final
@example
<a href="#" id="dob" data-type="date" data-pk="1" data-url="/post" data-title="Select date">15/05/1984</a>
<script>
$(function(){
$('#dob').editable({
format: 'yyyy-mm-dd',
viewformat: 'dd/mm/yyyy',
datepicker: {
weekStart: 1
}
}
});
});
</script>
**/
(function ($) {
"use strict";
//store bootstrap-datepicker as bdateicker to exclude conflict with jQuery UI one
$.fn.bdatepicker = $.fn.datepicker.noConflict();
if(!$.fn.datepicker) { //if there were no other datepickers, keep also original name
$.fn.datepicker = $.fn.bdatepicker;
}
var Date = function (options) {
this.init('date', options, Date.defaults);
this.initPicker(options, Date.defaults);
};
$.fn.editableutils.inherit(Date, $.fn.editabletypes.abstractinput);
$.extend(Date.prototype, {
initPicker: function(options, defaults) {
//'format' is set directly from settings or data-* attributes
//by default viewformat equals to format
if(!this.options.viewformat) {
this.options.viewformat = this.options.format;
}
//try parse datepicker config defined as json string in data-datepicker
options.datepicker = $.fn.editableutils.tryParseJson(options.datepicker, true);
//overriding datepicker config (as by default jQuery extend() is not recursive)
//since 1.4 datepicker internally uses viewformat instead of format. Format is for submit only
this.options.datepicker = $.extend({}, defaults.datepicker, options.datepicker, {
format: this.options.viewformat
});
//language
this.options.datepicker.language = this.options.datepicker.language || 'en';
//store DPglobal
this.dpg = $.fn.bdatepicker.DPGlobal;
//store parsed formats
this.parsedFormat = this.dpg.parseFormat(this.options.format);
this.parsedViewFormat = this.dpg.parseFormat(this.options.viewformat);
},
render: function () {
this.$input.bdatepicker(this.options.datepicker);
//"clear" link
if(this.options.clear) {
this.$clear = $('<a href="#"></a>').html(this.options.clear).click($.proxy(function(e){
e.preventDefault();
e.stopPropagation();
this.clear();
}, this));
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
}
},
value2html: function(value, element) {
var text = value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '';
Date.superclass.value2html.call(this, text, element);
},
html2value: function(html) {
return this.parseDate(html, this.parsedViewFormat);
},
value2str: function(value) {
return value ? this.dpg.formatDate(value, this.parsedFormat, this.options.datepicker.language) : '';
},
str2value: function(str) {
return this.parseDate(str, this.parsedFormat);
},
value2submit: function(value) {
return this.value2str(value);
},
value2input: function(value) {
this.$input.bdatepicker('update', value);
},
input2value: function() {
return this.$input.data('datepicker').date;
},
activate: function() {
},
clear: function() {
this.$input.data('datepicker').date = null;
this.$input.find('.active').removeClass('active');
if(!this.options.showbuttons) {
this.$input.closest('form').submit();
}
},
autosubmit: function() {
this.$input.on('mouseup', '.day', function(e){
if($(e.currentTarget).is('.old') || $(e.currentTarget).is('.new')) {
return;
}
var $form = $(this).closest('form');
setTimeout(function() {
$form.submit();
}, 200);
});
//changedate is not suitable as it triggered when showing datepicker. see #149
/*
this.$input.on('changeDate', function(e){
var $form = $(this).closest('form');
setTimeout(function() {
$form.submit();
}, 200);
});
*/
},
/*
For incorrect date bootstrap-datepicker returns current date that is not suitable
for datefield.
This function returns null for incorrect date.
*/
parseDate: function(str, format) {
var date = null, formattedBack;
if(str) {
date = this.dpg.parseDate(str, format, this.options.datepicker.language);
if(typeof str === 'string') {
formattedBack = this.dpg.formatDate(date, format, this.options.datepicker.language);
if(str !== formattedBack) {
date = null;
}
}
}
return date;
}
});
Date.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <div></div>
**/
tpl:'<div class="editable-date well"></div>',
/**
@property inputclass
@default null
**/
inputclass: null,
/**
Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br>
Possible tokens are: <code>d, dd, m, mm, yy, yyyy</code>
@property format
@type string
@default yyyy-mm-dd
**/
format:'yyyy-mm-dd',
/**
Format used for displaying date. Also applied when converting date from element's text on init.
If not specified equals to <code>format</code>
@property viewformat
@type string
@default null
**/
viewformat: null,
/**
Configuration of datepicker.
Full list of options: http://vitalets.github.com/bootstrap-datepicker
@property datepicker
@type object
@default {
weekStart: 0,
startView: 0,
minViewMode: 0,
autoclose: false
}
**/
datepicker:{
weekStart: 0,
startView: 0,
minViewMode: 0,
autoclose: false
},
/**
Text shown as clear date button.
If <code>false</code> clear button will not be rendered.
@property clear
@type boolean|string
@default 'x clear'
**/
clear: '× clear'
});
$.fn.editabletypes.date = Date;
}(window.jQuery));
/**
Bootstrap datefield input - modification for inline mode.
Shows normal <input type="text"> and binds popup datepicker.
Automatically shown in inline mode.
@class datefield
@extends date
@since 1.4.0
**/
(function ($) {
"use strict";
var DateField = function (options) {
this.init('datefield', options, DateField.defaults);
this.initPicker(options, DateField.defaults);
};
$.fn.editableutils.inherit(DateField, $.fn.editabletypes.date);
$.extend(DateField.prototype, {
render: function () {
this.$input = this.$tpl.find('input');
this.setClass();
this.setAttr('placeholder');
//bootstrap-datepicker is set `bdateicker` to exclude conflict with jQuery UI one. (in date.js)
this.$tpl.bdatepicker(this.options.datepicker);
//need to disable original event handlers
this.$input.off('focus keydown');
//update value of datepicker
this.$input.keyup($.proxy(function(){
this.$tpl.removeData('date');
this.$tpl.bdatepicker('update');
}, this));
},
value2input: function(value) {
this.$input.val(value ? this.dpg.formatDate(value, this.parsedViewFormat, this.options.datepicker.language) : '');
this.$tpl.bdatepicker('update');
},
input2value: function() {
return this.html2value(this.$input.val());
},
activate: function() {
$.fn.editabletypes.text.prototype.activate.call(this);
},
autosubmit: function() {
//reset autosubmit to empty
}
});
DateField.defaults = $.extend({}, $.fn.editabletypes.date.defaults, {
/**
@property tpl
**/
tpl:'<div class="input-append date"><input type="text"/><span class="add-on"><i class="icon-th"></i></span></div>',
/**
@property inputclass
@default 'input-small'
**/
inputclass: 'input-small',
/* datepicker config */
datepicker: {
weekStart: 0,
startView: 0,
minViewMode: 0,
autoclose: true
}
});
$.fn.editabletypes.datefield = DateField;
}(window.jQuery));
/**
Bootstrap-datetimepicker.
Based on [smalot bootstrap-datetimepicker plugin](https://github.com/smalot/bootstrap-datetimepicker).
Before usage you should manually include dependent js and css:
<link href="css/datetimepicker.css" rel="stylesheet" type="text/css"></link>
<script src="js/bootstrap-datetimepicker.js"></script>
For **i18n** you should include js file from here: https://github.com/smalot/bootstrap-datetimepicker/tree/master/js/locales
and set `language` option.
@class datetime
@extends abstractinput
@final
@since 1.4.4
@example
<a href="#" id="last_seen" data-type="datetime" data-pk="1" data-url="/post" title="Select date & time">15/03/2013 12:45</a>
<script>
$(function(){
$('#last_seen').editable({
format: 'yyyy-mm-dd hh:ii',
viewformat: 'dd/mm/yyyy hh:ii',
datetimepicker: {
weekStart: 1
}
}
});
});
</script>
**/
(function ($) {
"use strict";
var DateTime = function (options) {
this.init('datetime', options, DateTime.defaults);
this.initPicker(options, DateTime.defaults);
};
$.fn.editableutils.inherit(DateTime, $.fn.editabletypes.abstractinput);
$.extend(DateTime.prototype, {
initPicker: function(options, defaults) {
//'format' is set directly from settings or data-* attributes
//by default viewformat equals to format
if(!this.options.viewformat) {
this.options.viewformat = this.options.format;
}
//try parse datetimepicker config defined as json string in data-datetimepicker
options.datetimepicker = $.fn.editableutils.tryParseJson(options.datetimepicker, true);
//overriding datetimepicker config (as by default jQuery extend() is not recursive)
//since 1.4 datetimepicker internally uses viewformat instead of format. Format is for submit only
this.options.datetimepicker = $.extend({}, defaults.datetimepicker, options.datetimepicker, {
format: this.options.viewformat
});
//language
this.options.datetimepicker.language = this.options.datetimepicker.language || 'en';
//store DPglobal
this.dpg = $.fn.datetimepicker.DPGlobal;
//store parsed formats
this.parsedFormat = this.dpg.parseFormat(this.options.format, this.options.formatType);
this.parsedViewFormat = this.dpg.parseFormat(this.options.viewformat, this.options.formatType);
},
render: function () {
this.$input.datetimepicker(this.options.datetimepicker);
//adjust container position when viewMode changes
//see https://github.com/smalot/bootstrap-datetimepicker/pull/80
this.$input.on('changeMode', function(e) {
var f = $(this).closest('form').parent();
//timeout here, otherwise container changes position before form has new size
setTimeout(function(){
f.triggerHandler('resize');
}, 0);
});
//"clear" link
if(this.options.clear) {
this.$clear = $('<a href="#"></a>').html(this.options.clear).click($.proxy(function(e){
e.preventDefault();
e.stopPropagation();
this.clear();
}, this));
this.$tpl.parent().append($('<div class="editable-clear">').append(this.$clear));
}
},
value2html: function(value, element) {
//formatDate works with UTCDate!
var text = value ? this.dpg.formatDate(this.toUTC(value), this.parsedViewFormat, this.options.datetimepicker.language, this.options.formatType) : '';
if(element) {
DateTime.superclass.value2html.call(this, text, element);
} else {
return text;
}
},
html2value: function(html) {
//parseDate return utc date!
var value = this.parseDate(html, this.parsedViewFormat);
return value ? this.fromUTC(value) : null;
},
value2str: function(value) {
//formatDate works with UTCDate!
return value ? this.dpg.formatDate(this.toUTC(value), this.parsedFormat, this.options.datetimepicker.language, this.options.formatType) : '';
},
str2value: function(str) {
//parseDate return utc date!
var value = this.parseDate(str, this.parsedFormat);
return value ? this.fromUTC(value) : null;
},
value2submit: function(value) {
return this.value2str(value);
},
value2input: function(value) {
if(value) {
this.$input.data('datetimepicker').setDate(value);
}
},
input2value: function() {
//date may be cleared, in that case getDate() triggers error
var dt = this.$input.data('datetimepicker');
return dt.date ? dt.getDate() : null;
},
activate: function() {
},
clear: function() {
this.$input.data('datetimepicker').date = null;
this.$input.find('.active').removeClass('active');
if(!this.options.showbuttons) {
this.$input.closest('form').submit();
}
},
autosubmit: function() {
this.$input.on('mouseup', '.minute', function(e){
var $form = $(this).closest('form');
setTimeout(function() {
$form.submit();
}, 200);
});
},
//convert date from local to utc
toUTC: function(value) {
return value ? new Date(value.valueOf() - value.getTimezoneOffset() * 60000) : value;
},
//convert date from utc to local
fromUTC: function(value) {
return value ? new Date(value.valueOf() + value.getTimezoneOffset() * 60000) : value;
},
/*
For incorrect date bootstrap-datetimepicker returns current date that is not suitable
for datetimefield.
This function returns null for incorrect date.
*/
parseDate: function(str, format) {
var date = null, formattedBack;
if(str) {
date = this.dpg.parseDate(str, format, this.options.datetimepicker.language, this.options.formatType);
if(typeof str === 'string') {
formattedBack = this.dpg.formatDate(date, format, this.options.datetimepicker.language, this.options.formatType);
if(str !== formattedBack) {
date = null;
}
}
}
return date;
}
});
DateTime.defaults = $.extend({}, $.fn.editabletypes.abstractinput.defaults, {
/**
@property tpl
@default <div></div>
**/
tpl:'<div class="editable-date well"></div>',
/**
@property inputclass
@default null
**/
inputclass: null,
/**
Format used for sending value to server. Also applied when converting date from <code>data-value</code> attribute.<br>
Possible tokens are: <code>d, dd, m, mm, yy, yyyy, h, i</code>
@property format
@type string
@default yyyy-mm-dd hh:ii
**/
format:'yyyy-mm-dd hh:ii',
formatType:'standard',
/**
Format used for displaying date. Also applied when converting date from element's text on init.
If not specified equals to <code>format</code>
@property viewformat
@type string
@default null
**/
viewformat: null,
/**
Configuration of datetimepicker.
Full list of options: https://github.com/smalot/bootstrap-datetimepicker
@property datetimepicker
@type object
@default { }
**/
datetimepicker:{
todayHighlight: false,
autoclose: false
},
/**
Text shown as clear date button.
If <code>false</code> clear button will not be rendered.
@property clear
@type boolean|string
@default 'x clear'
**/
clear: '× clear'
});
$.fn.editabletypes.datetime = DateTime;
}(window.jQuery));
/**
Bootstrap datetimefield input - datetime input for inline mode.
Shows normal <input type="text"> and binds popup datetimepicker.
Automatically shown in inline mode.
@class datetimefield
@extends datetime
**/
(function ($) {
"use strict";
var DateTimeField = function (options) {
this.init('datetimefield', options, DateTimeField.defaults);
this.initPicker(options, DateTimeField.defaults);
};
$.fn.editableutils.inherit(DateTimeField, $.fn.editabletypes.datetime);
$.extend(DateTimeField.prototype, {
render: function () {
this.$input = this.$tpl.find('input');
this.setClass();
this.setAttr('placeholder');
this.$tpl.datetimepicker(this.options.datetimepicker);
//need to disable original event handlers
this.$input.off('focus keydown');
//update value of datepicker
this.$input.keyup($.proxy(function(){
this.$tpl.removeData('date');
this.$tpl.datetimepicker('update');
}, this));
},
value2input: function(value) {
this.$input.val(this.value2html(value));
this.$tpl.datetimepicker('update');
},
input2value: function() {
return this.html2value(this.$input.val());
},
activate: function() {
$.fn.editabletypes.text.prototype.activate.call(this);
},
autosubmit: function() {
//reset autosubmit to empty
}
});
DateTimeField.defaults = $.extend({}, $.fn.editabletypes.datetime.defaults, {
/**
@property tpl
**/
tpl:'<div class="input-append date"><input type="text"/><span class="add-on"><i class="icon-th"></i></span></div>',
/**
@property inputclass
@default 'input-medium'
**/
inputclass: 'input-medium',
/* datetimepicker config */
datetimepicker:{
todayHighlight: false,
autoclose: true
}
});
$.fn.editabletypes.datetimefield = DateTimeField;
}(window.jQuery));
/**
Typeahead input (bootstrap 2 only). Based on Twitter Bootstrap 2 [typeahead](http://getbootstrap.com/2.3.2/javascript.html#typeahead).
Depending on `source` format typeahead operates in two modes:
* **strings**:
When `source` defined as array of strings, e.g. `['text1', 'text2', 'text3' ...]`.
User can submit one of these strings or any text entered in input (even if it is not matching source).
* **objects**:
When `source` defined as array of objects, e.g. `[{value: 1, text: "text1"}, {value: 2, text: "text2"}, ...]`.
User can submit only values that are in source (otherwise `null` is submitted). This is more like *dropdown* behavior.
@class typeahead
@extends list
@since 1.4.1
@final
@example
<a href="#" id="country" data-type="typeahead" data-pk="1" data-url="/post" data-title="Input country"></a>
<script>
$(function(){
$('#country').editable({
value: 'ru',
source: [
{value: 'gb', text: 'Great Britain'},
{value: 'us', text: 'United States'},
{value: 'ru', text: 'Russia'}
]
});
});
</script>
**/
(function ($) {
"use strict";
var Constructor = function (options) {
this.init('typeahead', options, Constructor.defaults);
//overriding objects in config (as by default jQuery extend() is not recursive)
this.options.typeahead = $.extend({}, Constructor.defaults.typeahead, {
//set default methods for typeahead to work with objects
matcher: this.matcher,
sorter: this.sorter,
highlighter: this.highlighter,
updater: this.updater
}, options.typeahead);
};
$.fn.editableutils.inherit(Constructor, $.fn.editabletypes.list);
$.extend(Constructor.prototype, {
renderList: function() {
this.$input = this.$tpl.is('input') ? this.$tpl : this.$tpl.find('input[type="text"]');
//set source of typeahead
this.options.typeahead.source = this.sourceData;
//apply typeahead
this.$input.typeahead(this.options.typeahead);
//patch some methods in typeahead
var ta = this.$input.data('typeahead');
ta.render = $.proxy(this.typeaheadRender, ta);
ta.select = $.proxy(this.typeaheadSelect, ta);
ta.move = $.proxy(this.typeaheadMove, ta);
this.renderClear();
this.setClass();
this.setAttr('placeholder');
},
value2htmlFinal: function(value, element) {
if(this.getIsObjects()) {
var items = $.fn.editableutils.itemsByValue(value, this.sourceData);
value = items.length ? items[0].text : '';
}
$.fn.editabletypes.abstractinput.prototype.value2html.call(this, value, element);
},
html2value: function (html) {
return html ? html : null;
},
value2input: function(value) {
if(this.getIsObjects()) {
var items = $.fn.editableutils.itemsByValue(value, this.sourceData);
this.$input.data('value', value).val(items.length ? items[0].text : '');
} else {
this.$input.val(value);
}
},
input2value: function() {
if(this.getIsObjects()) {
var value = this.$input.data('value'),
items = $.fn.editableutils.itemsByValue(value, this.sourceData);
if(items.length && items[0].text.toLowerCase() === this.$input.val().toLowerCase()) {
return value;
} else {
return null; //entered string not found in source
}
} else {
return this.$input.val();
}
},
/*
if in sourceData values <> texts, typeahead in "objects" mode:
user must pick some value from list, otherwise `null` returned.
if all values == texts put typeahead in "strings" mode:
anything what entered is submited.
*/
getIsObjects: function() {
if(this.isObjects === undefined) {
this.isObjects = false;
for(var i=0; i<this.sourceData.length; i++) {
if(this.sourceData[i].value !== this.sourceData[i].text) {
this.isObjects = true;
break;
}
}
}
return this.isObjects;
},
/*
Methods borrowed from text input
*/
activate: $.fn.editabletypes.text.prototype.activate,
renderClear: $.fn.editabletypes.text.prototype.renderClear,
postrender: $.fn.editabletypes.text.prototype.postrender,
toggleClear: $.fn.editabletypes.text.prototype.toggleClear,
clear: function() {
$.fn.editabletypes.text.prototype.clear.call(this);
this.$input.data('value', '');
},
/*
Typeahead option methods used as defaults
*/
/*jshint eqeqeq:false, curly: false, laxcomma: true, asi: true*/
matcher: function (item) {
return $.fn.typeahead.Constructor.prototype.matcher.call(this, item.text);
},
sorter: function (items) {
var beginswith = []
, caseSensitive = []
, caseInsensitive = []
, item
, text;
while (item = items.shift()) {
text = item.text;
if (!text.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item);
else if (~text.indexOf(this.query)) caseSensitive.push(item);
else caseInsensitive.push(item);
}
return beginswith.concat(caseSensitive, caseInsensitive);
},
highlighter: function (item) {
return $.fn.typeahead.Constructor.prototype.highlighter.call(this, item.text);
},
updater: function (item) {
this.$element.data('value', item.value);
return item.text;
},
/*
Overwrite typeahead's render method to store objects.
There are a lot of disscussion in bootstrap repo on this point and still no result.
See https://github.com/twitter/bootstrap/issues/5967
This function just store item via jQuery data() method instead of attr('data-value')
*/
typeaheadRender: function (items) {
var that = this;
items = $(items).map(function (i, item) {
// i = $(that.options.item).attr('data-value', item)
i = $(that.options.item).data('item', item);
i.find('a').html(that.highlighter(item));
return i[0];
});
//add option to disable autoselect of first line
//see https://github.com/twitter/bootstrap/pull/4164
if (this.options.autoSelect) {
items.first().addClass('active');
}
this.$menu.html(items);
return this;
},
//add option to disable autoselect of first line
//see https://github.com/twitter/bootstrap/pull/4164
typeaheadSelect: function () {
var val = this.$menu.find('.active').data('item')
if(this.options.autoSelect || val){
this.$element
.val(this.updater(val))
.change()
}
return this.hide()
},
/*
if autoSelect = false and nothing matched we need extra press onEnter that is not convinient.
This patch fixes it.
*/
typeaheadMove: function (e) {
if (!this.shown) return
switch(e.keyCode) {
case 9: // tab
case 13: // enter
case 27: // escape
if (!this.$menu.find('.active').length) return
e.preventDefault()
break
case 38: // up arrow
e.preventDefault()
this.prev()
break
case 40: // down arrow
e.preventDefault()
this.next()
break
}
e.stopPropagation()
}
/*jshint eqeqeq: true, curly: true, laxcomma: false, asi: false*/
});
Constructor.defaults = $.extend({}, $.fn.editabletypes.list.defaults, {
/**
@property tpl
@default <input type="text">
**/
tpl:'<input type="text">',
/**
Configuration of typeahead. [Full list of options](http://getbootstrap.com/2.3.2/javascript.html#typeahead).
@property typeahead
@type object
@default null
**/
typeahead: null,
/**
Whether to show `clear` button
@property clear
@type boolean
@default true
**/
clear: true
});
$.fn.editabletypes.typeahead = Constructor;
}(window.jQuery)); |
test/ModalSpec.js | Cellule/react-bootstrap | import React from 'react';
import ReactTestUtils from 'react/lib/ReactTestUtils';
import Modal from '../src/Modal';
describe('Modal', function () {
it('Should render the modal content', function() {
let noOp = function () {};
let instance = ReactTestUtils.renderIntoDocument(
<Modal onRequestHide={noOp}>
<strong>Message</strong>
</Modal>
);
assert.ok(ReactTestUtils.findRenderedDOMComponentWithTag(instance, 'strong'));
});
it('Should add modal-open class to the modal container while open', function(done) {
let Container = React.createClass({
getInitialState() {
return {modalOpen: true};
},
handleCloseModal() {
this.setState({modalOpen: false});
},
render() {
if (this.state.modalOpen) {
return (
<Modal onRequestHide={this.handleCloseModal} container={this}>
<strong>Message</strong>
</Modal>
);
} else {
return <span/>;
}
}
});
let instance = ReactTestUtils.renderIntoDocument(
<Container />
);
assert.ok(React.findDOMNode(instance).className.match(/\modal-open\b/));
let backdrop = React.findDOMNode(instance).getElementsByClassName('modal-backdrop')[0];
ReactTestUtils.Simulate.click(backdrop);
setTimeout(function(){
assert.equal(React.findDOMNode(instance).className.length, 0);
done();
}, 0);
});
it('Should close the modal when the backdrop is clicked', function (done) {
let doneOp = function () { done(); };
let instance = ReactTestUtils.renderIntoDocument(
<Modal onRequestHide={doneOp}>
<strong>Message</strong>
</Modal>
);
let backdrop = React.findDOMNode(instance).getElementsByClassName('modal-backdrop')[0];
ReactTestUtils.Simulate.click(backdrop);
});
it('Should close the modal when the modal background is clicked', function (done) {
let doneOp = function () { done(); };
let instance = ReactTestUtils.renderIntoDocument(
<Modal onRequestHide={doneOp}>
<strong>Message</strong>
</Modal>
);
let backdrop = React.findDOMNode(instance).getElementsByClassName('modal')[0];
ReactTestUtils.Simulate.click(backdrop);
});
it('Should pass bsSize to the dialog', function () {
let noOp = function () {};
let instance = ReactTestUtils.renderIntoDocument(
<Modal bsSize='small' onRequestHide={noOp}>
<strong>Message</strong>
</Modal>
);
let dialog = React.findDOMNode(instance).getElementsByClassName('modal-dialog')[0];
assert.ok(dialog.className.match(/\bmodal-sm\b/));
});
it('Should pass dialogClassName to the dialog', function () {
let noOp = function () {};
let instance = ReactTestUtils.renderIntoDocument(
<Modal dialogClassName="testCss" onRequestHide={noOp}>
<strong>Message</strong>
</Modal>
);
let dialog = ReactTestUtils.findRenderedDOMComponentWithClass(instance, 'modal-dialog');
assert.match(dialog.props.className, /\btestCss\b/);
});
describe('Focused state', function () {
let focusableContainer = null;
beforeEach(function () {
focusableContainer = document.createElement('div');
focusableContainer.tabIndex = 0;
document.body.appendChild(focusableContainer);
focusableContainer.focus();
});
afterEach(function () {
React.unmountComponentAtNode(focusableContainer);
document.body.removeChild(focusableContainer);
});
it('Should focus on the Modal when it is opened', function (done) {
document.activeElement.should.equal(focusableContainer);
let doneOp = function () {
// focus should be back on the previous element when modal closed
setTimeout(function () {
document.activeElement.should.equal(focusableContainer);
done();
}, 0);
};
let Container = React.createClass({
getInitialState() {
return {modalOpen: true};
},
handleCloseModal() {
this.setState({modalOpen: false});
doneOp();
},
render() {
if (this.state.modalOpen) {
return (
<Modal onRequestHide={this.handleCloseModal} container={this}>
<strong>Message</strong>
</Modal>
);
} else {
return <span/>;
}
}
});
let instance = React.render(<Container />, focusableContainer);
setTimeout(function () {
// modal should be focused when opened
let modal = React.findDOMNode(instance).getElementsByClassName('modal')[0];
document.activeElement.should.equal(modal);
// close the modal
let backdrop = React.findDOMNode(instance).getElementsByClassName('modal-backdrop')[0];
ReactTestUtils.Simulate.click(backdrop);
}, 0);
});
});
});
|
front-end/app/containers/category/display_category_container.js | akumbhani66/cantaloupe | import { connect } from 'react-redux';
import DisplayCategory from '../../components/category/Display_category_component';
import React, { Component } from 'react';
import { bindActionCreators } from 'redux';
import * as Actions from '../../actions/actions';
const mapStateToProps = (state) => {
return {
state: state
};
}
const mapDispatchToProps = (dispatch, ownProps) => {
return {
actions: bindActionCreators(Actions, dispatch),
dispatch: dispatch
}
}
export default connect(mapStateToProps, mapDispatchToProps)(DisplayCategory);
|
app/javascript/mastodon/features/follow_requests/index.js | SerCom-KC/mastodon | import React from 'react';
import { connect } from 'react-redux';
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { debounce } from 'lodash';
import LoadingIndicator from '../../components/loading_indicator';
import Column from '../ui/components/column';
import ColumnBackButtonSlim from '../../components/column_back_button_slim';
import AccountAuthorizeContainer from './containers/account_authorize_container';
import { fetchFollowRequests, expandFollowRequests } from '../../actions/accounts';
import ScrollableList from '../../components/scrollable_list';
const messages = defineMessages({
heading: { id: 'column.follow_requests', defaultMessage: 'Follow requests' },
});
const mapStateToProps = state => ({
accountIds: state.getIn(['user_lists', 'follow_requests', 'items']),
});
export default @connect(mapStateToProps)
@injectIntl
class FollowRequests extends ImmutablePureComponent {
static propTypes = {
params: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
shouldUpdateScroll: PropTypes.func,
accountIds: ImmutablePropTypes.list,
intl: PropTypes.object.isRequired,
};
componentWillMount () {
this.props.dispatch(fetchFollowRequests());
}
handleLoadMore = debounce(() => {
this.props.dispatch(expandFollowRequests());
}, 300, { leading: true });
render () {
const { intl, shouldUpdateScroll, accountIds } = this.props;
if (!accountIds) {
return (
<Column>
<LoadingIndicator />
</Column>
);
}
const emptyMessage = <FormattedMessage id='empty_column.follow_requests' defaultMessage="You don't have any follow requests yet. When you receive one, it will show up here." />;
return (
<Column icon='users' heading={intl.formatMessage(messages.heading)}>
<ColumnBackButtonSlim />
<ScrollableList
scrollKey='follow_requests'
onLoadMore={this.handleLoadMore}
shouldUpdateScroll={shouldUpdateScroll}
emptyMessage={emptyMessage}
>
{accountIds.map(id =>
<AccountAuthorizeContainer key={id} id={id} />
)}
</ScrollableList>
</Column>
);
}
}
|
src/components/__tests__/InfoBar-test.js | runnables/react-redux-universal-hot-example | import React from 'react';
import ReactDOM from 'react-dom';
import {renderIntoDocument} from 'react-addons-test-utils';
import { expect} from 'chai';
import { InfoBar } from 'components';
import { Provider } from 'react-redux';
import { browserHistory } from 'react-router';
import createStore from 'redux/create';
import ApiClient from 'helpers/ApiClient';
const client = new ApiClient();
describe('InfoBar', () => {
const mockStore = {
info: {
load: () => {},
loaded: true,
loading: false,
data: {
message: 'This came from the api server',
time: Date.now()
}
}
};
const store = createStore(browserHistory, client, mockStore);
const renderer = renderIntoDocument(
<Provider store={store} key="provider">
<InfoBar/>
</Provider>
);
const dom = ReactDOM.findDOMNode(renderer);
it('should render correctly', () => {
return expect(renderer).to.be.ok;
});
it('should render with correct value', () => {
const text = dom.getElementsByTagName('strong')[0].textContent;
expect(text).to.equal(mockStore.info.data.message);
});
it('should render with a reload button', () => {
const text = dom.getElementsByTagName('button')[0].textContent;
expect(text).to.be.a('string');
});
it('should render the correct className', () => {
const styles = require('components/InfoBar/InfoBar.scss');
expect(styles.infoBar).to.be.a('string');
expect(dom.className).to.include(styles.infoBar);
});
});
|
ajax/libs/F2/1.3.2/f2.js | masklinn/cdnjs | ;(function(exports) {
if (exports.F2 && !exports.F2_TESTING_MODE) {
return;
}
/*!
JSON.org requires the following notice to accompany json2:
Copyright (c) 2002 JSON.org
http://json.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
/*
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or ' '),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
*/
/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
if (typeof JSON !== 'object') {
JSON = {};
}
(function () {
'use strict';
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
return isFinite(this.valueOf())
? this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z'
: null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string'
? c
: '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
// Produce a string from holder[key].
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
// If the value has a toJSON method, call it to obtain a replacement value.
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
// What happens next depends on the value's type.
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
// JSON numbers must be finite. Encode non-finite numbers as null.
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.
return String(value);
// If the type is 'object', we might be dealing with an object or an array or
// null.
case 'object':
// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.
if (!value) {
return 'null';
}
// Make an array to hold the partial results of stringifying this object value.
gap += indent;
partial = [];
// Is the value an array?
if (Object.prototype.toString.apply(value) === '[object Array]') {
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
v = partial.length === 0
? '[]'
: gap
? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
: '[' + partial.join(',') + ']';
gap = mind;
return v;
}
// If the replacer is an array, use it to select the members to be stringified.
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
// Otherwise, iterate through all of the keys in the object.
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
v = partial.length === 0
? '{}'
: gap
? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
: '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
// If the JSON object does not yet have a stringify method, give it one.
if (typeof JSON.stringify !== 'function') {
JSON.stringify = function (value, replacer, space) {
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
var i;
gap = '';
indent = '';
// If the space parameter is a number, make an indent string containing that
// many spaces.
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
// If the space parameter is a string, it will be used as the indent string.
} else if (typeof space === 'string') {
indent = space;
}
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.
return str('', {'': value});
};
}
// If the JSON object does not yet have a parse method, give it one.
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
var j;
function walk(holder, key) {
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with '()' and 'new'
// because they can cause invocation, and '=' because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
j = eval('(' + text + ')');
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
return typeof reviver === 'function'
? walk({'': j}, '')
: j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
throw new SyntaxError('JSON.parse');
};
}
}());
/*!
* jQuery JavaScript Library v1.8.3
* The jQuery Foundation and other contributors require the following notice to accompany jQuery:
*
* Copyright (c) 2013 jQuery Foundation and other contributors
*
* http://jquery.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
* IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
(function( window, undefined ) {
var
// A central reference to the root jQuery(document)
rootjQuery,
// The deferred used on DOM ready
readyList,
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
location = window.location,
navigator = window.navigator,
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// Save a reference to some core methods
core_push = Array.prototype.push,
core_slice = Array.prototype.slice,
core_indexOf = Array.prototype.indexOf,
core_toString = Object.prototype.toString,
core_hasOwn = Object.prototype.hasOwnProperty,
core_trim = String.prototype.trim,
// Define a local copy of jQuery
jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Used for matching numbers
core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
// Used for detecting and trimming whitespace
core_rnotwhite = /\S/,
core_rspace = /\s+/,
// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// A simple way to check for HTML strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
rquickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase();
},
// The ready event handler and self cleanup method
DOMContentLoaded = function() {
if ( document.addEventListener ) {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
} else if ( document.readyState === "complete" ) {
// we're here because readyState === "complete" in oldIE
// which is good enough for us to call the dom ready!
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
},
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), $(undefined), $(false)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = rquickExpr.exec( selector );
}
// Match html or make sure no context is specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
doc = ( context && context.nodeType ? context.ownerDocument || context : document );
// scripts is true for back-compat
selector = jQuery.parseHTML( match[1], doc, true );
if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
this.attr.call( selector, context, true );
}
return jQuery.merge( this, selector );
// HANDLE: $(#id)
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.8.3",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return core_slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Add the callback
jQuery.ready.promise().done( fn );
return this;
},
eq: function( i ) {
i = +i;
return i === -1 ?
this.slice( i ) :
this.slice( i, i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( core_slice.apply( this, arguments ),
"slice", core_slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: core_push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Abort if there are pending holds or we're already ready
if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
return;
}
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.resolveWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger("ready").off("ready");
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
isWindow: function( obj ) {
return obj != null && obj == obj.window;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ core_toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!core_hasOwn.call(obj, "constructor") &&
!core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || core_hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
// data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document
// scripts (optional): If true, will include scripts passed in the html string
parseHTML: function( data, context, scripts ) {
var parsed;
if ( !data || typeof data !== "string" ) {
return null;
}
if ( typeof context === "boolean" ) {
scripts = context;
context = 0;
}
context = context || document;
// Single tag
if ( (parsed = rsingleTag.exec( data )) ) {
return [ context.createElement( parsed[1] ) ];
}
parsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );
return jQuery.merge( [],
(parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );
},
parseJSON: function( data ) {
if ( !data || typeof data !== "string") {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
if ( !data || typeof data !== "string" ) {
return null;
}
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && core_rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
// args is for internal usage only
each: function( obj, callback, args ) {
var name,
i = 0,
length = obj.length,
isObj = length === undefined || jQuery.isFunction( obj );
if ( args ) {
if ( isObj ) {
for ( name in obj ) {
if ( callback.apply( obj[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( obj[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in obj ) {
if ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {
break;
}
}
}
}
return obj;
},
// Use native String.trim function wherever possible
trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
function( text ) {
return text == null ?
"" :
core_trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var type,
ret = results || [];
if ( arr != null ) {
// The window, strings (and functions) also have 'length'
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
type = jQuery.type( arr );
if ( arr.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( arr ) ) {
core_push.call( ret, arr );
} else {
jQuery.merge( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
var len;
if ( arr ) {
if ( core_indexOf ) {
return core_indexOf.call( arr, elem, i );
}
len = arr.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in arr && arr[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var l = second.length,
i = first.length,
j = 0;
if ( typeof l === "number" ) {
for ( ; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var retVal,
ret = [],
i = 0,
length = elems.length;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value, key,
ret = [],
i = 0,
length = elems.length,
// jquery objects are treated as arrays
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object,
} else {
for ( key in elems ) {
value = callback( elems[ key ], key, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = core_slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context, args.concat( core_slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
var exec,
bulk = key == null,
i = 0,
length = elems.length;
// Sets many values
if ( key && typeof key === "object" ) {
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
}
chainable = 1;
// Sets one value
} else if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = pass === undefined && jQuery.isFunction( value );
if ( bulk ) {
// Bulk operations only iterate when executing function values
if ( exec ) {
exec = fn;
fn = function( elem, key, value ) {
return exec.call( jQuery( elem ), value );
};
// Otherwise they run against the entire set
} else {
fn.call( elems, value );
fn = null;
}
}
if ( fn ) {
for (; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
}
chainable = 1;
}
return chainable ?
elems :
// Gets
bulk ?
fn.call( elems ) :
length ? fn( elems[0], key ) : emptyGet;
},
now: function() {
return ( new Date() ).getTime();
}
});
jQuery.ready.promise = function( obj ) {
if ( !readyList ) {
readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred.
// we once tried to use readyState "interactive" here, but it caused issues like the one
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready, 1 );
// Standards-based browsers support DOMContentLoaded
} else if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
// If IE event model is used
} else {
// Ensure firing before onload, maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", DOMContentLoaded );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
// If IE and not a frame
// continually check to see if the document is ready
var top = false;
try {
top = window.frameElement == null && document.documentElement;
} catch(e) {}
if ( top && top.doScroll ) {
(function doScrollCheck() {
if ( !jQuery.isReady ) {
try {
// Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left");
} catch(e) {
return setTimeout( doScrollCheck, 50 );
}
// and execute any waiting functions
jQuery.ready();
}
})();
}
}
}
return readyList.promise( obj );
};
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// String to Object options format cache
var optionsCache = {};
// Convert String-formatted options into Object-formatted ones and store in cache
function createOptions( options ) {
var object = optionsCache[ options ] = {};
jQuery.each( options.split( core_rspace ), function( _, flag ) {
object[ flag ] = true;
});
return object;
}
/*
* Create a callback list using the following parameters:
*
* options: an optional list of space-separated options that will change how
* the callback list behaves or a more traditional option object
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible options:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( options ) {
// Convert options from String-formatted to Object-formatted if needed
// (we check in cache first)
options = typeof options === "string" ?
( optionsCache[ options ] || createOptions( options ) ) :
jQuery.extend( {}, options );
var // Last fire value (for non-forgettable lists)
memory,
// Flag to know if list was already fired
fired,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = !options.once && [],
// Fire callbacks
fire = function( data ) {
memory = options.memory && data;
fired = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
memory = false; // To prevent further calls using add
break;
}
}
firing = false;
if ( list ) {
if ( stack ) {
if ( stack.length ) {
fire( stack.shift() );
}
} else if ( memory ) {
list = [];
} else {
self.disable();
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
// First, we save the current length
var start = list.length;
(function add( args ) {
jQuery.each( args, function( _, arg ) {
var type = jQuery.type( arg );
if ( type === "function" ) {
if ( !options.unique || !self.has( arg ) ) {
list.push( arg );
}
} else if ( arg && arg.length && type !== "string" ) {
// Inspect recursively
add( arg );
}
});
})( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away
} else if ( memory ) {
firingStart = start;
fire( memory );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
if ( index <= firingLength ) {
firingLength--;
}
if ( index <= firingIndex ) {
firingIndex--;
}
}
}
});
}
return this;
},
// Control if a given callback is in the list
has: function( fn ) {
return jQuery.inArray( fn, list ) > -1;
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
args = args || [];
args = [ context, args.slice ? args.slice() : args ];
if ( list && ( !fired || stack ) ) {
if ( firing ) {
stack.push( args );
} else {
fire( args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!fired;
}
};
return self;
};
jQuery.extend({
Deferred: function( func ) {
var tuples = [
// action, add listener, listener list, final state
[ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
[ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
[ "notify", "progress", jQuery.Callbacks("memory") ]
],
state = "pending",
promise = {
state: function() {
return state;
},
always: function() {
deferred.done( arguments ).fail( arguments );
return this;
},
then: function( /* fnDone, fnFail, fnProgress */ ) {
var fns = arguments;
return jQuery.Deferred(function( newDefer ) {
jQuery.each( tuples, function( i, tuple ) {
var action = tuple[ 0 ],
fn = fns[ i ];
// deferred[ done | fail | progress ] for forwarding actions to newDefer
deferred[ tuple[1] ]( jQuery.isFunction( fn ) ?
function() {
var returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise()
.done( newDefer.resolve )
.fail( newDefer.reject )
.progress( newDefer.notify );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
} :
newDefer[ action ]
);
});
fns = null;
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
return obj != null ? jQuery.extend( obj, promise ) : promise;
}
},
deferred = {};
// Keep pipe for back-compat
promise.pipe = promise.then;
// Add list-specific methods
jQuery.each( tuples, function( i, tuple ) {
var list = tuple[ 2 ],
stateString = tuple[ 3 ];
// promise[ done | fail | progress ] = list.add
promise[ tuple[1] ] = list.add;
// Handle state
if ( stateString ) {
list.add(function() {
// state = [ resolved | rejected ]
state = stateString;
// [ reject_list | resolve_list ].disable; progress_list.lock
}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
}
// deferred[ resolve | reject | notify ] = list.fire
deferred[ tuple[0] ] = list.fire;
deferred[ tuple[0] + "With" ] = list.fireWith;
});
// Make the deferred a promise
promise.promise( deferred );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( subordinate /* , ..., subordinateN */ ) {
var i = 0,
resolveValues = core_slice.call( arguments ),
length = resolveValues.length,
// the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values
updateFunc = function( i, contexts, values ) {
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
if( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
}
};
},
progressValues, progressContexts, resolveContexts;
// add listeners to Deferred subordinates; treat others as resolved
if ( length > 1 ) {
progressValues = new Array( length );
progressContexts = new Array( length );
resolveContexts = new Array( length );
for ( ; i < length; i++ ) {
if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
resolveValues[ i ].promise()
.done( updateFunc( i, resolveContexts, resolveValues ) )
.fail( deferred.reject )
.progress( updateFunc( i, progressContexts, progressValues ) );
} else {
--remaining;
}
}
}
// if we're not waiting on anything, resolve the master
if ( !remaining ) {
deferred.resolveWith( resolveContexts, resolveValues );
}
return deferred.promise();
}
});
jQuery.support = (function() {
var support,
all,
a,
select,
opt,
input,
fragment,
eventName,
i,
isSupported,
clickFn,
div = document.createElement("div");
// Setup
div.setAttribute( "className", "t" );
div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
// Support tests won't run in some limited or non-browser environments
all = div.getElementsByTagName("*");
a = div.getElementsByTagName("a")[ 0 ];
if ( !all || !a || !all.length ) {
return {};
}
// First batch of tests
select = document.createElement("select");
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName("input")[ 0 ];
a.style.cssText = "top:1px;float:left;opacity:.5";
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: ( a.getAttribute("href") === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.5/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Tests for enctype support on a form (#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
boxModel: ( document.compatMode === "CSS1Compat" ),
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true,
boxSizingReliable: true,
pixelPosition: false
};
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.attachEvent( "onclick", clickFn = function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent("onclick");
div.detachEvent( "onclick", clickFn );
}
// Check if a radio maintains its value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute( "type", "radio" );
support.radioValue = input.value === "t";
input.setAttribute( "checked", "checked" );
// #11217 - WebKit loses check when the name is after the checked attribute
input.setAttribute( "name", "t" );
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.lastChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
fragment.removeChild( input );
fragment.appendChild( div );
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for ( i in {
submit: true,
change: true,
focusin: true
}) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
// Run tests that need a body at doc ready
jQuery(function() {
var container, div, tds, marginDiv,
divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;",
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
container = document.createElement("div");
container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px";
body.insertBefore( container, body.firstChild );
// Construct the test element
div = document.createElement("div");
container.appendChild( div );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
tds = div.getElementsByTagName("td");
tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE <= 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Check box-sizing and margin behavior
div.innerHTML = "";
div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;";
support.boxSizing = ( div.offsetWidth === 4 );
support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
// NOTE: To any future maintainer, we've window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
marginDiv = document.createElement("div");
marginDiv.style.cssText = div.style.cssText = divReset;
marginDiv.style.marginRight = marginDiv.style.width = "0";
div.style.width = "1px";
div.appendChild( marginDiv );
support.reliableMarginRight =
!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
}
if ( typeof div.style.zoom !== "undefined" ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.innerHTML = "";
div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "block";
div.style.overflow = "visible";
div.innerHTML = "<div></div>";
div.firstChild.style.width = "5px";
support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
container.style.zoom = 1;
}
// Null elements to avoid leaks in IE
body.removeChild( container );
container = div = tds = marginDiv = null;
});
// Null elements to avoid leaks in IE
fragment.removeChild( div );
all = a = select = opt = input = fragment = div = null;
return support;
})();
var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
deletedIds: [],
// Remove at next major release (1.9/2.0)
uuid: 0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i, l,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split(" ");
}
}
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject( cache[ id ] ) ) {
return;
}
}
// Destroy the cache
if ( isNode ) {
jQuery.cleanData( [ elem ], true );
// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
} else if ( jQuery.support.deleteExpando || cache != cache.window ) {
delete cache[ id ];
// When all else fails, null
} else {
cache[ id ] = null;
}
},
// For internal use only.
_data: function( elem, name, data ) {
return jQuery.data( elem, name, data, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
// nodes accept data unless otherwise specified; rejection can be conditional
return !noData || noData !== true && elem.getAttribute("classid") === noData;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var parts, part, attr, name, l,
elem = this[0],
i = 0,
data = null;
// Gets all values
if ( key === undefined ) {
if ( this.length ) {
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
attr = elem.attributes;
for ( l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( !name.indexOf( "data-" ) ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( elem, name, data[ name ] );
}
}
jQuery._data( elem, "parsedAttrs", true );
}
}
return data;
}
// Sets multiple values
if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
parts = key.split( ".", 2 );
parts[1] = parts[1] ? "." + parts[1] : "";
part = parts[1] + "!";
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
data = this.triggerHandler( "getData" + part, [ parts[0] ] );
// Try to fetch any internally stored data first
if ( data === undefined && elem ) {
data = jQuery.data( elem, key );
data = dataAttr( elem, key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
}
parts[1] = value;
this.each(function() {
var self = jQuery( this );
self.triggerHandler( "setData" + part, parts );
jQuery.data( this, key, value );
self.triggerHandler( "changeData" + part, parts );
});
}, null, value, arguments.length > 1, null, false );
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
// Only convert to a number if it doesn't change the string
+data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
var name;
for ( name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
jQuery.extend({
queue: function( elem, type, data ) {
var queue;
if ( elem ) {
type = ( type || "fx" ) + "queue";
queue = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !queue || jQuery.isArray(data) ) {
queue = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
queue.push( data );
}
}
return queue || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
startLength = queue.length,
fn = queue.shift(),
hooks = jQuery._queueHooks( elem, type ),
next = function() {
jQuery.dequeue( elem, type );
};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
startLength--;
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
// clear up the last queue stop function
delete hooks.stop;
fn.call( elem, next, hooks );
}
if ( !startLength && hooks ) {
hooks.empty.fire();
}
},
// not intended for public consumption - generates a queueHooks object, or returns the current one
_queueHooks: function( elem, type ) {
var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, {
empty: jQuery.Callbacks("once memory").add(function() {
jQuery.removeData( elem, type + "queue", true );
jQuery.removeData( elem, key, true );
})
});
}
});
jQuery.fn.extend({
queue: function( type, data ) {
var setter = 2;
if ( typeof type !== "string" ) {
data = type;
type = "fx";
setter--;
}
if ( arguments.length < setter ) {
return jQuery.queue( this[0], type );
}
return data === undefined ?
this :
this.each(function() {
var queue = jQuery.queue( this, type, data );
// ensure a hooks for this queue
jQuery._queueHooks( this, type );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, obj ) {
var tmp,
count = 1,
defer = jQuery.Deferred(),
elements = this,
i = this.length,
resolve = function() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
};
if ( typeof type !== "string" ) {
obj = type;
type = undefined;
}
type = type || "fx";
while( i-- ) {
tmp = jQuery._data( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
tmp.empty.add( resolve );
}
}
resolve();
return defer.promise( obj );
}
});
var nodeHook, boolHook, fixSpecified,
rclass = /[\t\r\n]/g,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea|)$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( core_rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var removes, className, elem, c, cl, i, l;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
removes = ( value || "" ).split( core_rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
className = (" " + elem.className + " ").replace( rclass, " " );
// loop over each item in the removal list
for ( c = 0, cl = removes.length; c < cl; c++ ) {
// Remove until there is nothing to remove,
while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
className = className.replace( " " + removes[ c ] + " " , " " );
}
}
elem.className = value ? jQuery.trim( className ) : "";
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( core_rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space separated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var val,
self = jQuery(this);
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, option,
options = elem.options,
index = elem.selectedIndex,
one = elem.type === "select-one" || index < 0,
values = one ? null : [],
max = one ? index + 1 : options.length,
i = index < 0 ?
max :
one ? index : 0;
// Loop through all the selected options
for ( ; i < max; i++ ) {
option = options[ i ];
// oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) &&
// Don't return options that are disabled or in a disabled optgroup
( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) &&
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
// Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9
attrFn: {},
attr: function( elem, name, value, pass ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
if ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, value + "" );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var propName, attrNames, name, isBool,
i = 0;
if ( value && elem.nodeType === 1 ) {
attrNames = value.split( core_rspace );
for ( ; i < attrNames.length; i++ ) {
name = attrNames[ i ];
if ( name ) {
propName = jQuery.propFix[ name ] || name;
isBool = rboolean.test( name );
// See #9699 for explanation of this approach (setting first, then removal)
// Do not do this for boolean attributes (see #10870)
if ( !isBool ) {
jQuery.attr( elem, name, "" );
}
elem.removeAttribute( getSetAttribute ? name : propName );
// Set corresponding property to false for boolean attributes
if ( isBool && propName in elem ) {
elem[ propName ] = false;
}
}
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
fixSpecified = {
name: true,
id: true,
coords: true
};
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
return ret && ( fixSpecified[ name ] ? ret.value !== "" : ret.specified ) ?
ret.value :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
return ( ret.value = value + "" );
}
};
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
if ( value === "" ) {
value = "false";
}
nodeHook.set( elem, value, name );
}
};
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = value + "" );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:textarea|input|select)$/i,
rtypenamespace = /^([^\.]*|)(?:\.(.+)|)$/,
rhoverHack = /(?:^|\s)hover(\.\S+|)\b/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
add: function( elem, types, handler, data, selector ) {
var elemData, eventHandle, events,
t, tns, type, namespaces, handleObj,
handleObjIn, handlers, special;
// Don't attach events to noData or text/comment nodes (allow plain objects tho)
if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
selector = handleObjIn.selector;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
events = elemData.events;
if ( !events ) {
elemData.events = events = {};
}
eventHandle = elemData.handle;
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = jQuery.trim( hoverHack(types) ).split( " " );
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = ( tns[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: tns[1],
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
handlers = events[ type ];
if ( !handlers ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var t, tns, type, origType, namespaces, origCount,
j, events, special, eventType, handleObj,
elemData = jQuery.hasData( elem ) && jQuery._data( elem );
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = origType = tns[1];
namespaces = tns[2];
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector? special.delegateType : special.bindType ) || type;
eventType = events[ type ] || [];
origCount = eventType.length;
namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
// Remove matching events
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !namespaces || namespaces.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
eventType.splice( j--, 1 );
if ( handleObj.selector ) {
eventType.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( eventType.length === 0 && origCount !== eventType.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
delete elemData.handle;
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery.removeData( elem, "events", true );
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Don't do events on text and comment nodes
if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
return;
}
// Event object or event type
var cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,
type = event.type || event,
namespaces = [];
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "!" ) >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf( "." ) >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.isTrigger = true;
event.exclusive = exclusive;
event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
cache = jQuery.cache;
for ( i in cache ) {
if ( cache[ i ].events && cache[ i ].events[ type ] ) {
jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
}
}
return;
}
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
eventPath = [[ elem, special.bindType || type ]];
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
for ( old = elem; cur; cur = cur.parentNode ) {
eventPath.push([ cur, bubbleType ]);
old = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( old === (elem.ownerDocument || document) ) {
eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
}
}
// Fire handlers on the event path
for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
cur = eventPath[i][0];
event.type = eventPath[i][1];
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Note that this is a bare JS function and not a jQuery handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486)
if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( old ) {
elem[ ontype ] = old;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event );
var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,
handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount,
args = core_slice.call( arguments ),
run_all = !event.exclusive && !event.namespace,
special = jQuery.event.special[ event.type ] || {},
handlerQueue = [];
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Call the preDispatch hook for the mapped type, and let it bail if desired
if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
return;
}
// Determine handlers that should run if there are delegated events
// Avoid non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !(event.button && event.type === "click") ) {
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
// Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)
if ( cur.disabled !== true || event.type !== "click" ) {
selMatch = {};
matches = [];
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
sel = handleObj.selector;
if ( selMatch[ sel ] === undefined ) {
selMatch[ sel ] = handleObj.needsContext ?
jQuery( sel, this ).index( cur ) >= 0 :
jQuery.find( sel, this, null, [ cur ] ).length;
}
if ( selMatch[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, matches: matches });
}
}
}
}
// Add the remaining (directly-bound) handlers
if ( handlers.length > delegateCount ) {
handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
}
// Run delegates first; they may want to stop propagation beneath us
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
// Call the postDispatch hook for the mapped type
if ( special.postDispatch ) {
special.postDispatch.call( this, event );
}
return event.result;
},
// Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var eventDoc, doc, body,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop,
originalEvent = event,
fixHook = jQuery.event.fixHooks[ event.type ] || {},
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = jQuery.Event( originalEvent );
for ( i = copy.length; i; ) {
prop = copy[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Target should not be a text node (#504, Safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)
event.metaKey = !!event.metaKey;
return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
special: {
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
delegateType: "focusin"
},
blur: {
delegateType: "focusout"
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle = jQuery.event.dispatch;
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
var name = "on" + type;
if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC
if ( typeof elem[ name ] === "undefined" ) {
elem[ name ] = null;
}
elem.detachEvent( name, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var ret,
target = this,
related = event.relatedTarget,
handleObj = event.handleObj,
selector = handleObj.selector;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !jQuery._data( form, "_submit_attached" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true;
});
jQuery._data( form, "_submit_attached", true );
}
});
// return undefined since we don't need an event listener
},
postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) {
delete event._submit_bubble;
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
}
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
}
// Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true );
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
jQuery._data( elem, "_change_attached", true );
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return !rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) { // && selector != null
// ( types-Object, data )
data = data || selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on( types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
var handleObj, type;
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
live: function( types, data, fn ) {
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
},
die: function( types, fn ) {
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
if ( rkeyEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
}
if ( rmouseEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2012 jQuery Foundation and other contributors
* Released under the MIT license
* http://sizzlejs.com/
*/
(function( window, undefined ) {
var cachedruns,
assertGetIdNotName,
Expr,
getText,
isXML,
contains,
compile,
sortOrder,
hasDuplicate,
outermostContext,
baseHasDuplicate = true,
strundefined = "undefined",
expando = ( "sizcache" + Math.random() ).replace( ".", "" ),
Token = String,
document = window.document,
docElem = document.documentElement,
dirruns = 0,
done = 0,
pop = [].pop,
push = [].push,
slice = [].slice,
// Use a stripped-down indexOf if a native one is unavailable
indexOf = [].indexOf || function( elem ) {
var i = 0,
len = this.length;
for ( ; i < len; i++ ) {
if ( this[i] === elem ) {
return i;
}
}
return -1;
},
// Augment a function for special use by Sizzle
markFunction = function( fn, value ) {
fn[ expando ] = value == null || value;
return fn;
},
createCache = function() {
var cache = {},
keys = [];
return markFunction(function( key, value ) {
// Only keep the most recent entries
if ( keys.push( key ) > Expr.cacheLength ) {
delete cache[ keys.shift() ];
}
// Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157)
return (cache[ key + " " ] = value);
}, cache );
},
classCache = createCache(),
tokenCache = createCache(),
compilerCache = createCache(),
// Regex
// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
whitespace = "[\\x20\\t\\r\\n\\f]",
// http://www.w3.org/TR/css3-syntax/#characters
characterEncoding = "(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",
// Loosely modeled on CSS identifier characters
// An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)
// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
identifier = characterEncoding.replace( "w", "w#" ),
// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
operators = "([*^$|!~]?=)",
attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
"*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
// Prefer arguments not in parens/brackets,
// then attribute selectors and non-pseudos (denoted by :),
// then anything else
// These preferences are here to reduce the number of selectors
// needing tokenize in the PSEUDO preFilter
pseudos = ":(" + characterEncoding + ")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:" + attributes + ")|[^:]|\\\\.)*|.*))\\)|)",
// For matchExpr.POS and matchExpr.needsContext
pos = ":(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
"*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)",
// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ),
rpseudo = new RegExp( pseudos ),
// Easily-parseable/retrievable ID or TAG or CLASS selectors
rquickExpr = /^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,
rnot = /^:not/,
rsibling = /[\x20\t\r\n\f]*[+~]/,
rendsWithNot = /:not\($/,
rheader = /h\d/i,
rinputs = /input|select|textarea|button/i,
rbackslash = /\\(?!\\)/g,
matchExpr = {
"ID": new RegExp( "^#(" + characterEncoding + ")" ),
"CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
"NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ),
"TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
"ATTR": new RegExp( "^" + attributes ),
"PSEUDO": new RegExp( "^" + pseudos ),
"POS": new RegExp( pos, "i" ),
"CHILD": new RegExp( "^:(only|nth|first|last)-child(?:\\(" + whitespace +
"*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
"*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
// For use in libraries implementing .is()
"needsContext": new RegExp( "^" + whitespace + "*[>+~]|" + pos, "i" )
},
// Support
// Used for testing something on an element
assert = function( fn ) {
var div = document.createElement("div");
try {
return fn( div );
} catch (e) {
return false;
} finally {
// release memory in IE
div = null;
}
},
// Check if getElementsByTagName("*") returns only elements
assertTagNameNoComments = assert(function( div ) {
div.appendChild( document.createComment("") );
return !div.getElementsByTagName("*").length;
}),
// Check if getAttribute returns normalized href attributes
assertHrefNotNormalized = assert(function( div ) {
div.innerHTML = "<a href='#'></a>";
return div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&
div.firstChild.getAttribute("href") === "#";
}),
// Check if attributes should be retrieved by attribute nodes
assertAttributes = assert(function( div ) {
div.innerHTML = "<select></select>";
var type = typeof div.lastChild.getAttribute("multiple");
// IE8 returns a string for some attributes even when not present
return type !== "boolean" && type !== "string";
}),
// Check if getElementsByClassName can be trusted
assertUsableClassName = assert(function( div ) {
// Opera can't find a second classname (in 9.6)
div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>";
if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) {
return false;
}
// Safari 3.2 caches class attributes and doesn't catch changes
div.lastChild.className = "e";
return div.getElementsByClassName("e").length === 2;
}),
// Check if getElementById returns elements by name
// Check if getElementsByName privileges form controls or returns elements by ID
assertUsableName = assert(function( div ) {
// Inject content
div.id = expando + 0;
div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>";
docElem.insertBefore( div, docElem.firstChild );
// Test
var pass = document.getElementsByName &&
// buggy browsers will return fewer than the correct 2
document.getElementsByName( expando ).length === 2 +
// buggy browsers will return more than the correct 0
document.getElementsByName( expando + 0 ).length;
assertGetIdNotName = !document.getElementById( expando );
// Cleanup
docElem.removeChild( div );
return pass;
});
// If slice is not available, provide a backup
try {
slice.call( docElem.childNodes, 0 )[0].nodeType;
} catch ( e ) {
slice = function( i ) {
var elem,
results = [];
for ( ; (elem = this[i]); i++ ) {
results.push( elem );
}
return results;
};
}
function Sizzle( selector, context, results, seed ) {
results = results || [];
context = context || document;
var match, elem, xml, m,
nodeType = context.nodeType;
if ( !selector || typeof selector !== "string" ) {
return results;
}
if ( nodeType !== 1 && nodeType !== 9 ) {
return [];
}
xml = isXML( context );
if ( !xml && !seed ) {
if ( (match = rquickExpr.exec( selector )) ) {
// Speed-up: Sizzle("#ID")
if ( (m = match[1]) ) {
if ( nodeType === 9 ) {
elem = context.getElementById( m );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE, Opera, and Webkit return items
// by name instead of ID
if ( elem.id === m ) {
results.push( elem );
return results;
}
} else {
return results;
}
} else {
// Context is not a document
if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
contains( context, elem ) && elem.id === m ) {
results.push( elem );
return results;
}
}
// Speed-up: Sizzle("TAG")
} else if ( match[2] ) {
push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );
return results;
// Speed-up: Sizzle(".CLASS")
} else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {
push.apply( results, slice.call(context.getElementsByClassName( m ), 0) );
return results;
}
}
}
// All others
return select( selector.replace( rtrim, "$1" ), context, results, seed, xml );
}
Sizzle.matches = function( expr, elements ) {
return Sizzle( expr, null, null, elements );
};
Sizzle.matchesSelector = function( elem, expr ) {
return Sizzle( expr, null, null, [ elem ] ).length > 0;
};
// Returns a function to use in pseudos for input types
function createInputPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === type;
};
}
// Returns a function to use in pseudos for buttons
function createButtonPseudo( type ) {
return function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && elem.type === type;
};
}
// Returns a function to use in pseudos for positionals
function createPositionalPseudo( fn ) {
return markFunction(function( argument ) {
argument = +argument;
return markFunction(function( seed, matches ) {
var j,
matchIndexes = fn( [], seed.length, argument ),
i = matchIndexes.length;
// Match elements found at the specified indexes
while ( i-- ) {
if ( seed[ (j = matchIndexes[i]) ] ) {
seed[j] = !(matches[j] = seed[j]);
}
}
});
});
}
/**
* Utility function for retrieving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
getText = Sizzle.getText = function( elem ) {
var node,
ret = "",
i = 0,
nodeType = elem.nodeType;
if ( nodeType ) {
if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
// Use textContent for elements
// innerText usage removed for consistency of new lines (see #11153)
if ( typeof elem.textContent === "string" ) {
return elem.textContent;
} else {
// Traverse its children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
// Do not include comment or processing instruction nodes
} else {
// If no nodeType, this is expected to be an array
for ( ; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
ret += getText( node );
}
}
return ret;
};
isXML = Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = elem && (elem.ownerDocument || elem).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
// Element contains another
contains = Sizzle.contains = docElem.contains ?
function( a, b ) {
var adown = a.nodeType === 9 ? a.documentElement : a,
bup = b && b.parentNode;
return a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );
} :
docElem.compareDocumentPosition ?
function( a, b ) {
return b && !!( a.compareDocumentPosition( b ) & 16 );
} :
function( a, b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
return false;
};
Sizzle.attr = function( elem, name ) {
var val,
xml = isXML( elem );
if ( !xml ) {
name = name.toLowerCase();
}
if ( (val = Expr.attrHandle[ name ]) ) {
return val( elem );
}
if ( xml || assertAttributes ) {
return elem.getAttribute( name );
}
val = elem.getAttributeNode( name );
return val ?
typeof elem[ name ] === "boolean" ?
elem[ name ] ? name : null :
val.specified ? val.value : null :
null;
};
Expr = Sizzle.selectors = {
// Can be adjusted by the user
cacheLength: 50,
createPseudo: markFunction,
match: matchExpr,
// IE6/7 return a modified href
attrHandle: assertHrefNotNormalized ?
{} :
{
"href": function( elem ) {
return elem.getAttribute( "href", 2 );
},
"type": function( elem ) {
return elem.getAttribute("type");
}
},
find: {
"ID": assertGetIdNotName ?
function( id, context, xml ) {
if ( typeof context.getElementById !== strundefined && !xml ) {
var m = context.getElementById( id );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
} :
function( id, context, xml ) {
if ( typeof context.getElementById !== strundefined && !xml ) {
var m = context.getElementById( id );
return m ?
m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ?
[m] :
undefined :
[];
}
},
"TAG": assertTagNameNoComments ?
function( tag, context ) {
if ( typeof context.getElementsByTagName !== strundefined ) {
return context.getElementsByTagName( tag );
}
} :
function( tag, context ) {
var results = context.getElementsByTagName( tag );
// Filter out possible comments
if ( tag === "*" ) {
var elem,
tmp = [],
i = 0;
for ( ; (elem = results[i]); i++ ) {
if ( elem.nodeType === 1 ) {
tmp.push( elem );
}
}
return tmp;
}
return results;
},
"NAME": assertUsableName && function( tag, context ) {
if ( typeof context.getElementsByName !== strundefined ) {
return context.getElementsByName( name );
}
},
"CLASS": assertUsableClassName && function( className, context, xml ) {
if ( typeof context.getElementsByClassName !== strundefined && !xml ) {
return context.getElementsByClassName( className );
}
}
},
relative: {
">": { dir: "parentNode", first: true },
" ": { dir: "parentNode" },
"+": { dir: "previousSibling", first: true },
"~": { dir: "previousSibling" }
},
preFilter: {
"ATTR": function( match ) {
match[1] = match[1].replace( rbackslash, "" );
// Move the given value to match[3] whether quoted or unquoted
match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" );
if ( match[2] === "~=" ) {
match[3] = " " + match[3] + " ";
}
return match.slice( 0, 4 );
},
"CHILD": function( match ) {
/* matches from matchExpr["CHILD"]
1 type (only|nth|...)
2 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
3 xn-component of xn+y argument ([+-]?\d*n|)
4 sign of xn-component
5 x of xn-component
6 sign of y-component
7 y of y-component
*/
match[1] = match[1].toLowerCase();
if ( match[1] === "nth" ) {
// nth-child requires argument
if ( !match[2] ) {
Sizzle.error( match[0] );
}
// numeric x and y parameters for Expr.filter.CHILD
// remember that false/true cast respectively to 0/1
match[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === "even" || match[2] === "odd" ) );
match[4] = +( ( match[6] + match[7] ) || match[2] === "odd" );
// other types prohibit arguments
} else if ( match[2] ) {
Sizzle.error( match[0] );
}
return match;
},
"PSEUDO": function( match ) {
var unquoted, excess;
if ( matchExpr["CHILD"].test( match[0] ) ) {
return null;
}
if ( match[3] ) {
match[2] = match[3];
} else if ( (unquoted = match[4]) ) {
// Only check arguments that contain a pseudo
if ( rpseudo.test(unquoted) &&
// Get excess from tokenize (recursively)
(excess = tokenize( unquoted, true )) &&
// advance to the next closing parenthesis
(excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
// excess is a negative index
unquoted = unquoted.slice( 0, excess );
match[0] = match[0].slice( 0, excess );
}
match[2] = unquoted;
}
// Return only captures needed by the pseudo filter method (type and argument)
return match.slice( 0, 3 );
}
},
filter: {
"ID": assertGetIdNotName ?
function( id ) {
id = id.replace( rbackslash, "" );
return function( elem ) {
return elem.getAttribute("id") === id;
};
} :
function( id ) {
id = id.replace( rbackslash, "" );
return function( elem ) {
var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
return node && node.value === id;
};
},
"TAG": function( nodeName ) {
if ( nodeName === "*" ) {
return function() { return true; };
}
nodeName = nodeName.replace( rbackslash, "" ).toLowerCase();
return function( elem ) {
return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
};
},
"CLASS": function( className ) {
var pattern = classCache[ expando ][ className + " " ];
return pattern ||
(pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
classCache( className, function( elem ) {
return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" );
});
},
"ATTR": function( name, operator, check ) {
return function( elem, context ) {
var result = Sizzle.attr( elem, name );
if ( result == null ) {
return operator === "!=";
}
if ( !operator ) {
return true;
}
result += "";
return operator === "=" ? result === check :
operator === "!=" ? result !== check :
operator === "^=" ? check && result.indexOf( check ) === 0 :
operator === "*=" ? check && result.indexOf( check ) > -1 :
operator === "$=" ? check && result.substr( result.length - check.length ) === check :
operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" :
false;
};
},
"CHILD": function( type, argument, first, last ) {
if ( type === "nth" ) {
return function( elem ) {
var node, diff,
parent = elem.parentNode;
if ( first === 1 && last === 0 ) {
return true;
}
if ( parent ) {
diff = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
diff++;
if ( elem === node ) {
break;
}
}
}
}
// Incorporate the offset (or cast to NaN), then check against cycle size
diff -= last;
return diff === first || ( diff % first === 0 && diff / first >= 0 );
};
}
return function( elem ) {
var node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
/* falls through */
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
}
};
},
"PSEUDO": function( pseudo, argument ) {
// pseudo-class names are case-insensitive
// http://www.w3.org/TR/selectors/#pseudo-classes
// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
// Remember that setFilters inherits from pseudos
var args,
fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
Sizzle.error( "unsupported pseudo: " + pseudo );
// The user may use createPseudo to indicate that
// arguments are needed to create the filter function
// just as Sizzle does
if ( fn[ expando ] ) {
return fn( argument );
}
// But maintain support for old signatures
if ( fn.length > 1 ) {
args = [ pseudo, pseudo, "", argument ];
return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
markFunction(function( seed, matches ) {
var idx,
matched = fn( seed, argument ),
i = matched.length;
while ( i-- ) {
idx = indexOf.call( seed, matched[i] );
seed[ idx ] = !( matches[ idx ] = matched[i] );
}
}) :
function( elem ) {
return fn( elem, 0, args );
};
}
return fn;
}
},
pseudos: {
"not": markFunction(function( selector ) {
// Trim the selector passed to compile
// to avoid treating leading and trailing
// spaces as combinators
var input = [],
results = [],
matcher = compile( selector.replace( rtrim, "$1" ) );
return matcher[ expando ] ?
markFunction(function( seed, matches, context, xml ) {
var elem,
unmatched = matcher( seed, null, xml, [] ),
i = seed.length;
// Match elements unmatched by `matcher`
while ( i-- ) {
if ( (elem = unmatched[i]) ) {
seed[i] = !(matches[i] = elem);
}
}
}) :
function( elem, context, xml ) {
input[0] = elem;
matcher( input, null, xml, results );
return !results.pop();
};
}),
"has": markFunction(function( selector ) {
return function( elem ) {
return Sizzle( selector, elem ).length > 0;
};
}),
"contains": markFunction(function( text ) {
return function( elem ) {
return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
};
}),
"enabled": function( elem ) {
return elem.disabled === false;
},
"disabled": function( elem ) {
return elem.disabled === true;
},
"checked": function( elem ) {
// In CSS3, :checked should return both checked and selected elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
var nodeName = elem.nodeName.toLowerCase();
return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
},
"selected": function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
"parent": function( elem ) {
return !Expr.pseudos["empty"]( elem );
},
"empty": function( elem ) {
// http://www.w3.org/TR/selectors/#empty-pseudo
// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),
// not comment, processing instructions, or others
// Thanks to Diego Perini for the nodeName shortcut
// Greater than "@" means alpha characters (specifically not starting with "#" or "?")
var nodeType;
elem = elem.firstChild;
while ( elem ) {
if ( elem.nodeName > "@" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {
return false;
}
elem = elem.nextSibling;
}
return true;
},
"header": function( elem ) {
return rheader.test( elem.nodeName );
},
"text": function( elem ) {
var type, attr;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" &&
(type = elem.type) === "text" &&
( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === type );
},
// Input types
"radio": createInputPseudo("radio"),
"checkbox": createInputPseudo("checkbox"),
"file": createInputPseudo("file"),
"password": createInputPseudo("password"),
"image": createInputPseudo("image"),
"submit": createButtonPseudo("submit"),
"reset": createButtonPseudo("reset"),
"button": function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && elem.type === "button" || name === "button";
},
"input": function( elem ) {
return rinputs.test( elem.nodeName );
},
"focus": function( elem ) {
var doc = elem.ownerDocument;
return elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
},
"active": function( elem ) {
return elem === elem.ownerDocument.activeElement;
},
// Positional types
"first": createPositionalPseudo(function() {
return [ 0 ];
}),
"last": createPositionalPseudo(function( matchIndexes, length ) {
return [ length - 1 ];
}),
"eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
return [ argument < 0 ? argument + length : argument ];
}),
"even": createPositionalPseudo(function( matchIndexes, length ) {
for ( var i = 0; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"odd": createPositionalPseudo(function( matchIndexes, length ) {
for ( var i = 1; i < length; i += 2 ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
for ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {
matchIndexes.push( i );
}
return matchIndexes;
}),
"gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
for ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {
matchIndexes.push( i );
}
return matchIndexes;
})
}
};
function siblingCheck( a, b, ret ) {
if ( a === b ) {
return ret;
}
var cur = a.nextSibling;
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
}
sortOrder = docElem.compareDocumentPosition ?
function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
return ( !a.compareDocumentPosition || !b.compareDocumentPosition ?
a.compareDocumentPosition :
a.compareDocumentPosition(b) & 4
) ? -1 : 1;
} :
function( a, b ) {
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
// Always assume the presence of duplicates if sort doesn't
// pass them to our comparison function (as in Google Chrome).
[0, 0].sort( sortOrder );
baseHasDuplicate = !hasDuplicate;
// Document sorting and removing duplicates
Sizzle.uniqueSort = function( results ) {
var elem,
duplicates = [],
i = 1,
j = 0;
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( ; (elem = results[i]); i++ ) {
if ( elem === results[ i - 1 ] ) {
j = duplicates.push( i );
}
}
while ( j-- ) {
results.splice( duplicates[ j ], 1 );
}
}
return results;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
function tokenize( selector, parseOnly ) {
var matched, match, tokens, type,
soFar, groups, preFilters,
cached = tokenCache[ expando ][ selector + " " ];
if ( cached ) {
return parseOnly ? 0 : cached.slice( 0 );
}
soFar = selector;
groups = [];
preFilters = Expr.preFilter;
while ( soFar ) {
// Comma and first run
if ( !matched || (match = rcomma.exec( soFar )) ) {
if ( match ) {
// Don't consume trailing commas as valid
soFar = soFar.slice( match[0].length ) || soFar;
}
groups.push( tokens = [] );
}
matched = false;
// Combinators
if ( (match = rcombinators.exec( soFar )) ) {
tokens.push( matched = new Token( match.shift() ) );
soFar = soFar.slice( matched.length );
// Cast descendant combinators to space
matched.type = match[0].replace( rtrim, " " );
}
// Filters
for ( type in Expr.filter ) {
if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
(match = preFilters[ type ]( match ))) ) {
tokens.push( matched = new Token( match.shift() ) );
soFar = soFar.slice( matched.length );
matched.type = type;
matched.matches = match;
}
}
if ( !matched ) {
break;
}
}
// Return the length of the invalid excess
// if we're just parsing
// Otherwise, throw an error or return tokens
return parseOnly ?
soFar.length :
soFar ?
Sizzle.error( selector ) :
// Cache the tokens
tokenCache( selector, groups ).slice( 0 );
}
function addCombinator( matcher, combinator, base ) {
var dir = combinator.dir,
checkNonElements = base && combinator.dir === "parentNode",
doneName = done++;
return combinator.first ?
// Check against closest ancestor/preceding element
function( elem, context, xml ) {
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
return matcher( elem, context, xml );
}
}
} :
// Check against all ancestor/preceding elements
function( elem, context, xml ) {
// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
if ( !xml ) {
var cache,
dirkey = dirruns + " " + doneName + " ",
cachedkey = dirkey + cachedruns;
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
if ( (cache = elem[ expando ]) === cachedkey ) {
return elem.sizset;
} else if ( typeof cache === "string" && cache.indexOf(dirkey) === 0 ) {
if ( elem.sizset ) {
return elem;
}
} else {
elem[ expando ] = cachedkey;
if ( matcher( elem, context, xml ) ) {
elem.sizset = true;
return elem;
}
elem.sizset = false;
}
}
}
} else {
while ( (elem = elem[ dir ]) ) {
if ( checkNonElements || elem.nodeType === 1 ) {
if ( matcher( elem, context, xml ) ) {
return elem;
}
}
}
}
};
}
function elementMatcher( matchers ) {
return matchers.length > 1 ?
function( elem, context, xml ) {
var i = matchers.length;
while ( i-- ) {
if ( !matchers[i]( elem, context, xml ) ) {
return false;
}
}
return true;
} :
matchers[0];
}
function condense( unmatched, map, filter, context, xml ) {
var elem,
newUnmatched = [],
i = 0,
len = unmatched.length,
mapped = map != null;
for ( ; i < len; i++ ) {
if ( (elem = unmatched[i]) ) {
if ( !filter || filter( elem, context, xml ) ) {
newUnmatched.push( elem );
if ( mapped ) {
map.push( i );
}
}
}
}
return newUnmatched;
}
function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
if ( postFilter && !postFilter[ expando ] ) {
postFilter = setMatcher( postFilter );
}
if ( postFinder && !postFinder[ expando ] ) {
postFinder = setMatcher( postFinder, postSelector );
}
return markFunction(function( seed, results, context, xml ) {
var temp, i, elem,
preMap = [],
postMap = [],
preexisting = results.length,
// Get initial elements from seed or context
elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
// Prefilter to get matcher input, preserving a map for seed-results synchronization
matcherIn = preFilter && ( seed || !selector ) ?
condense( elems, preMap, preFilter, context, xml ) :
elems,
matcherOut = matcher ?
// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
// ...intermediate processing is necessary
[] :
// ...otherwise use results directly
results :
matcherIn;
// Find primary matches
if ( matcher ) {
matcher( matcherIn, matcherOut, context, xml );
}
// Apply postFilter
if ( postFilter ) {
temp = condense( matcherOut, postMap );
postFilter( temp, [], context, xml );
// Un-match failing elements by moving them back to matcherIn
i = temp.length;
while ( i-- ) {
if ( (elem = temp[i]) ) {
matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
}
}
}
if ( seed ) {
if ( postFinder || preFilter ) {
if ( postFinder ) {
// Get the final matcherOut by condensing this intermediate into postFinder contexts
temp = [];
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) ) {
// Restore matcherIn since elem is not yet a final match
temp.push( (matcherIn[i] = elem) );
}
}
postFinder( null, (matcherOut = []), temp, xml );
}
// Move matched elements from seed to results to keep them synchronized
i = matcherOut.length;
while ( i-- ) {
if ( (elem = matcherOut[i]) &&
(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
seed[temp] = !(results[temp] = elem);
}
}
}
// Add elements to results, through postFinder if defined
} else {
matcherOut = condense(
matcherOut === results ?
matcherOut.splice( preexisting, matcherOut.length ) :
matcherOut
);
if ( postFinder ) {
postFinder( null, results, matcherOut, xml );
} else {
push.apply( results, matcherOut );
}
}
});
}
function matcherFromTokens( tokens ) {
var checkContext, matcher, j,
len = tokens.length,
leadingRelative = Expr.relative[ tokens[0].type ],
implicitRelative = leadingRelative || Expr.relative[" "],
i = leadingRelative ? 1 : 0,
// The foundational matcher ensures that elements are reachable from top-level context(s)
matchContext = addCombinator( function( elem ) {
return elem === checkContext;
}, implicitRelative, true ),
matchAnyContext = addCombinator( function( elem ) {
return indexOf.call( checkContext, elem ) > -1;
}, implicitRelative, true ),
matchers = [ function( elem, context, xml ) {
return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
(checkContext = context).nodeType ?
matchContext( elem, context, xml ) :
matchAnyContext( elem, context, xml ) );
} ];
for ( ; i < len; i++ ) {
if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
} else {
matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
// Return special upon seeing a positional matcher
if ( matcher[ expando ] ) {
// Find the next relative operator (if any) for proper handling
j = ++i;
for ( ; j < len; j++ ) {
if ( Expr.relative[ tokens[j].type ] ) {
break;
}
}
return setMatcher(
i > 1 && elementMatcher( matchers ),
i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ),
matcher,
i < j && matcherFromTokens( tokens.slice( i, j ) ),
j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
j < len && tokens.join("")
);
}
matchers.push( matcher );
}
}
return elementMatcher( matchers );
}
function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
var bySet = setMatchers.length > 0,
byElement = elementMatchers.length > 0,
superMatcher = function( seed, context, xml, results, expandContext ) {
var elem, j, matcher,
setMatched = [],
matchedCount = 0,
i = "0",
unmatched = seed && [],
outermost = expandContext != null,
contextBackup = outermostContext,
// We must always have either seed elements or context
elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ),
// Nested matchers should use non-integer dirruns
dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);
if ( outermost ) {
outermostContext = context !== document && context;
cachedruns = superMatcher.el;
}
// Add elements passing elementMatchers directly to results
for ( ; (elem = elems[i]) != null; i++ ) {
if ( byElement && elem ) {
for ( j = 0; (matcher = elementMatchers[j]); j++ ) {
if ( matcher( elem, context, xml ) ) {
results.push( elem );
break;
}
}
if ( outermost ) {
dirruns = dirrunsUnique;
cachedruns = ++superMatcher.el;
}
}
// Track unmatched elements for set filters
if ( bySet ) {
// They will have gone through all possible matchers
if ( (elem = !matcher && elem) ) {
matchedCount--;
}
// Lengthen the array for every element, matched or not
if ( seed ) {
unmatched.push( elem );
}
}
}
// Apply set filters to unmatched elements
matchedCount += i;
if ( bySet && i !== matchedCount ) {
for ( j = 0; (matcher = setMatchers[j]); j++ ) {
matcher( unmatched, setMatched, context, xml );
}
if ( seed ) {
// Reintegrate element matches to eliminate the need for sorting
if ( matchedCount > 0 ) {
while ( i-- ) {
if ( !(unmatched[i] || setMatched[i]) ) {
setMatched[i] = pop.call( results );
}
}
}
// Discard index placeholder values to get only actual matches
setMatched = condense( setMatched );
}
// Add matches to results
push.apply( results, setMatched );
// Seedless set matches succeeding multiple successful matchers stipulate sorting
if ( outermost && !seed && setMatched.length > 0 &&
( matchedCount + setMatchers.length ) > 1 ) {
Sizzle.uniqueSort( results );
}
}
// Override manipulation of globals by nested matchers
if ( outermost ) {
dirruns = dirrunsUnique;
outermostContext = contextBackup;
}
return unmatched;
};
superMatcher.el = 0;
return bySet ?
markFunction( superMatcher ) :
superMatcher;
}
compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
var i,
setMatchers = [],
elementMatchers = [],
cached = compilerCache[ expando ][ selector + " " ];
if ( !cached ) {
// Generate a function of recursive functions that can be used to check each element
if ( !group ) {
group = tokenize( selector );
}
i = group.length;
while ( i-- ) {
cached = matcherFromTokens( group[i] );
if ( cached[ expando ] ) {
setMatchers.push( cached );
} else {
elementMatchers.push( cached );
}
}
// Cache the compiled function
cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
}
return cached;
};
function multipleContexts( selector, contexts, results ) {
var i = 0,
len = contexts.length;
for ( ; i < len; i++ ) {
Sizzle( selector, contexts[i], results );
}
return results;
}
function select( selector, context, results, seed, xml ) {
var i, tokens, token, type, find,
match = tokenize( selector ),
j = match.length;
if ( !seed ) {
// Try to minimize operations if there is only one group
if ( match.length === 1 ) {
// Take a shortcut and set the context if the root selector is an ID
tokens = match[0] = match[0].slice( 0 );
if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
context.nodeType === 9 && !xml &&
Expr.relative[ tokens[1].type ] ) {
context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context, xml )[0];
if ( !context ) {
return results;
}
selector = selector.slice( tokens.shift().length );
}
// Fetch a seed set for right-to-left matching
for ( i = matchExpr["POS"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {
token = tokens[i];
// Abort if we hit a combinator
if ( Expr.relative[ (type = token.type) ] ) {
break;
}
if ( (find = Expr.find[ type ]) ) {
// Search, expanding context for leading sibling combinators
if ( (seed = find(
token.matches[0].replace( rbackslash, "" ),
rsibling.test( tokens[0].type ) && context.parentNode || context,
xml
)) ) {
// If seed is empty or no tokens remain, we can return early
tokens.splice( i, 1 );
selector = seed.length && tokens.join("");
if ( !selector ) {
push.apply( results, slice.call( seed, 0 ) );
return results;
}
break;
}
}
}
}
}
// Compile and execute a filtering function
// Provide `match` to avoid retokenization if we modified the selector above
compile( selector, match )(
seed,
context,
xml,
results,
rsibling.test( selector )
);
return results;
}
if ( document.querySelectorAll ) {
(function() {
var disconnectedMatch,
oldSelect = select,
rescape = /'|\\/g,
rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,
// qSa(:focus) reports false when true (Chrome 21), no need to also add to buggyMatches since matches checks buggyQSA
// A support test would require too much code (would include document ready)
rbuggyQSA = [ ":focus" ],
// matchesSelector(:active) reports false when true (IE9/Opera 11.5)
// A support test would require too much code (would include document ready)
// just skip matchesSelector for :active
rbuggyMatches = [ ":active" ],
matches = docElem.matchesSelector ||
docElem.mozMatchesSelector ||
docElem.webkitMatchesSelector ||
docElem.oMatchesSelector ||
docElem.msMatchesSelector;
// Build QSA regex
// Regex strategy adopted from Diego Perini
assert(function( div ) {
// Select is set to empty string on purpose
// This is to test IE's treatment of not explictly
// setting a boolean content attribute,
// since its presence should be enough
// http://bugs.jquery.com/ticket/12359
div.innerHTML = "<select><option selected=''></option></select>";
// IE8 - Some boolean attributes are not treated correctly
if ( !div.querySelectorAll("[selected]").length ) {
rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" );
}
// Webkit/Opera - :checked should return selected option elements
// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
// IE8 throws error here (do not put tests after this one)
if ( !div.querySelectorAll(":checked").length ) {
rbuggyQSA.push(":checked");
}
});
assert(function( div ) {
// Opera 10-12/IE9 - ^= $= *= and empty values
// Should not select anything
div.innerHTML = "<p test=''></p>";
if ( div.querySelectorAll("[test^='']").length ) {
rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" );
}
// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
// IE8 throws error here (do not put tests after this one)
div.innerHTML = "<input type='hidden'/>";
if ( !div.querySelectorAll(":enabled").length ) {
rbuggyQSA.push(":enabled", ":disabled");
}
});
// rbuggyQSA always contains :focus, so no need for a length check
rbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join("|") );
select = function( selector, context, results, seed, xml ) {
// Only use querySelectorAll when not filtering,
// when this is not xml,
// and when no QSA bugs apply
if ( !seed && !xml && !rbuggyQSA.test( selector ) ) {
var groups, i,
old = true,
nid = expando,
newContext = context,
newSelector = context.nodeType === 9 && selector;
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
groups = tokenize( selector );
if ( (old = context.getAttribute("id")) ) {
nid = old.replace( rescape, "\\$&" );
} else {
context.setAttribute( "id", nid );
}
nid = "[id='" + nid + "'] ";
i = groups.length;
while ( i-- ) {
groups[i] = nid + groups[i].join("");
}
newContext = rsibling.test( selector ) && context.parentNode || context;
newSelector = groups.join(",");
}
if ( newSelector ) {
try {
push.apply( results, slice.call( newContext.querySelectorAll(
newSelector
), 0 ) );
return results;
} catch(qsaError) {
} finally {
if ( !old ) {
context.removeAttribute("id");
}
}
}
}
return oldSelect( selector, context, results, seed, xml );
};
if ( matches ) {
assert(function( div ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9)
disconnectedMatch = matches.call( div, "div" );
// This should fail with an exception
// Gecko does not error, returns false instead
try {
matches.call( div, "[test!='']:sizzle" );
rbuggyMatches.push( "!=", pseudos );
} catch ( e ) {}
});
// rbuggyMatches always contains :active and :focus, so no need for a length check
rbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join("|") );
Sizzle.matchesSelector = function( elem, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace( rattributeQuotes, "='$1']" );
// rbuggyMatches always contains :active, so no need for an existence check
if ( !isXML( elem ) && !rbuggyMatches.test( expr ) && !rbuggyQSA.test( expr ) ) {
try {
var ret = matches.call( elem, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9
elem.document && elem.document.nodeType !== 11 ) {
return ret;
}
} catch(e) {}
}
return Sizzle( expr, null, null, [ elem ] ).length > 0;
};
}
})();
}
// Deprecated
Expr.pseudos["nth"] = Expr.pseudos["eq"];
// Back-compat
function setFilters() {}
Expr.filters = setFilters.prototype = Expr.pseudos;
Expr.setFilters = new setFilters();
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.pseudos;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})( window );
var runtil = /Until$/,
rparentsprev = /^(?:parents|prev(?:Until|All))/,
isSimple = /^.[^:#\[\.,]*$/,
rneedsContext = jQuery.expr.match.needsContext,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var i, l, length, n, r, ret,
self = this;
if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() {
for ( i = 0, l = self.length; i < l; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
});
}
ret = this.pushStack( "", "find", selector );
for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( n = length; n < ret.length; n++ ) {
for ( r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var i,
targets = jQuery( target, this ),
len = targets.length;
return this.filter(function() {
for ( i = 0; i < len; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional/relative selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
rneedsContext.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var cur,
i = 0,
l = this.length,
ret = [],
pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( ; i < l; i++ ) {
cur = this[i];
while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
}
cur = cur.parentNode;
}
}
ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
});
jQuery.fn.andSelf = jQuery.fn.addBack;
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
function sibling( cur, dir ) {
do {
cur = cur[ dir ];
} while ( cur && cur.nodeType !== 1 );
return cur;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return sibling( elem, "nextSibling" );
},
prev: function( elem ) {
return sibling( elem, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.merge( [], elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( this.length > 1 && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, core_slice.call( arguments ).join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style|link)/i,
rnocache = /<(?:script|object|embed|option|style)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
rcheckableType = /^(?:checkbox|radio)$/,
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
},
safeFragment = createSafeFragment( document ),
fragmentDiv = safeFragment.appendChild( document.createElement("div") );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
// unless wrapped in a div with non-breaking characters in front of it.
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "X<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 || this.nodeType === 11 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( !isDisconnected( this[0] ) ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
}
if ( arguments.length ) {
var set = jQuery.clean( arguments );
return this.pushStack( jQuery.merge( set, this ), "before", this.selector );
}
},
after: function() {
if ( !isDisconnected( this[0] ) ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
}
if ( arguments.length ) {
var set = jQuery.clean( arguments );
return this.pushStack( jQuery.merge( this, set ), "after", this.selector );
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
var elem,
i = 0;
for ( ; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
return jQuery.access( this, function( value ) {
var elem = this[0] || {},
i = 0,
l = this.length;
if ( value === undefined ) {
return elem.nodeType === 1 ?
elem.innerHTML.replace( rinlinejQuery, "" ) :
undefined;
}
// See if we can take a shortcut and just use innerHTML
if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) &&
( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&
!wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) {
value = value.replace( rxhtmlTag, "<$1></$2>" );
try {
for (; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
elem = this[i] || {};
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName( "*" ) );
elem.innerHTML = value;
}
}
elem = 0;
// If using innerHTML throws an exception, use the fallback method
} catch(e) {}
}
if ( elem ) {
this.empty().append( value );
}
}, null, value, arguments.length );
},
replaceWith: function( value ) {
if ( !isDisconnected( this[0] ) ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
}
return this.length ?
this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
this;
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
// Flatten any nested arrays
args = [].concat.apply( [], args );
var results, first, fragment, iNoClone,
i = 0,
value = args[0],
scripts = [],
l = this.length;
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && l > 1 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call( this, i, table ? self.html() : undefined );
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
results = jQuery.buildFragment( args, this, scripts );
fragment = results.fragment;
first = fragment.firstChild;
if ( fragment.childNodes.length === 1 ) {
fragment = first;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
// Use the original fragment for the last item instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070).
// Fragments from the fragment cache must always be cloned and never used in place.
for ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {
callback.call(
table && jQuery.nodeName( this[i], "table" ) ?
findOrAppend( this[i], "tbody" ) :
this[i],
i === iNoClone ?
fragment :
jQuery.clone( fragment, true, true )
);
}
}
// Fix #11809: Avoid leaking memory
fragment = first = null;
if ( scripts.length ) {
jQuery.each( scripts, function( i, elem ) {
if ( elem.src ) {
if ( jQuery.ajax ) {
jQuery.ajax({
url: elem.src,
type: "GET",
dataType: "script",
async: false,
global: false,
"throws": true
});
} else {
jQuery.error("no ajax");
}
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
});
}
}
return this;
}
});
function findOrAppend( elem, tag ) {
return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type, events[ type ][ i ] );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
if ( nodeName === "object" ) {
// IE6-10 improperly clones children of object elements using classid.
// IE10 throws NoModificationAllowedError if parent is null, #12132.
if ( dest.parentNode ) {
dest.outerHTML = src.outerHTML;
}
// This path appears unavoidable for IE9. When cloning an object
// element in IE9, the outerHTML strategy above is not sufficient.
// If the src has innerHTML and the destination does not,
// copy the src.innerHTML into the dest.innerHTML. #10324
if ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {
dest.innerHTML = src.innerHTML;
}
} else if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
dest.defaultChecked = dest.checked = src.checked;
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
// IE blanks contents when cloning scripts
} else if ( nodeName === "script" && dest.text !== src.text ) {
dest.text = src.text;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
}
jQuery.buildFragment = function( args, context, scripts ) {
var fragment, cacheable, cachehit,
first = args[ 0 ];
// Set context from what may come in as undefined or a jQuery collection or a node
// Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &
// also doubles as fix for #8950 where plain objects caused createDocumentFragment exception
context = context || document;
context = !context.nodeType && context[0] || context;
context = context.ownerDocument || context;
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
if ( args.length === 1 && typeof first === "string" && first.length < 512 && context === document &&
first.charAt(0) === "<" && !rnocache.test( first ) &&
(jQuery.support.checkClone || !rchecked.test( first )) &&
(jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
// Mark cacheable and look for a hit
cacheable = true;
fragment = jQuery.fragments[ first ];
cachehit = fragment !== undefined;
}
if ( !fragment ) {
fragment = context.createDocumentFragment();
jQuery.clean( args, context, fragment, scripts );
// Update the cache, but only store false
// unless this is a second parsing of the same content
if ( cacheable ) {
jQuery.fragments[ first ] = cachehit && fragment;
}
}
return { fragment: fragment, cacheable: cacheable };
};
jQuery.fragments = {};
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var elems,
i = 0,
ret = [],
insert = jQuery( selector ),
l = insert.length,
parent = this.length === 1 && this[0].parentNode;
if ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( ; i < l; i++ ) {
elems = ( i > 0 ? this.clone(true) : this ).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
function getAll( elem ) {
if ( typeof elem.getElementsByTagName !== "undefined" ) {
return elem.getElementsByTagName( "*" );
} else if ( typeof elem.querySelectorAll !== "undefined" ) {
return elem.querySelectorAll( "*" );
} else {
return [];
}
}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( rcheckableType.test( elem.type ) ) {
elem.defaultChecked = elem.checked;
}
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var srcElements,
destElements,
i,
clone;
if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes
} else {
fragmentDiv.innerHTML = elem.outerHTML;
fragmentDiv.removeChild( clone = fragmentDiv.firstChild );
}
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// IE copies events bound via attachEvent when using cloneNode.
// Calling detachEvent on the clone will also remove the events
// from the original. In order to get around this, we use some
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
cloneFixAttributes( elem, clone );
// Using Sizzle here is crazy slow, so we use getElementsByTagName instead
srcElements = getAll( elem );
destElements = getAll( clone );
// Weird iteration because IE will replace the length property
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for ( i = 0; srcElements[i]; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
cloneFixAttributes( srcElements[i], destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
cloneCopyEvent( elem, clone );
if ( deepDataAndEvents ) {
srcElements = getAll( elem );
destElements = getAll( clone );
for ( i = 0; srcElements[i]; ++i ) {
cloneCopyEvent( srcElements[i], destElements[i] );
}
}
}
srcElements = destElements = null;
// Return the cloned set
return clone;
},
clean: function( elems, context, fragment, scripts ) {
var i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,
safe = context === document && safeFragment,
ret = [];
// Ensure that context is a document
if ( !context || typeof context.createDocumentFragment === "undefined" ) {
context = document;
}
// Use the already-created safe fragment if context permits
for ( i = 0; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
}
if ( !elem ) {
continue;
}
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
if ( !rhtml.test( elem ) ) {
elem = context.createTextNode( elem );
} else {
// Ensure a safe container in which to render the html
safe = safe || createSafeFragment( context );
div = context.createElement("div");
safe.appendChild( div );
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Go to html and back, then peel off extra wrappers
tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
depth = wrap[0];
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( depth-- ) {
div = div.lastChild;
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
hasBody = rtbody.test(elem);
tbody = tag === "table" && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !hasBody ?
div.childNodes :
[];
for ( j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
}
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
}
elem = div.childNodes;
// Take out of fragment container (we need a fresh div each time)
div.parentNode.removeChild( div );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
jQuery.merge( ret, elem );
}
}
// Fix #11356: Clear elements from safeFragment
if ( div ) {
elem = div = safe = null;
}
// Reset defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
if ( !jQuery.support.appendChecked ) {
for ( i = 0; (elem = ret[i]) != null; i++ ) {
if ( jQuery.nodeName( elem, "input" ) ) {
fixDefaultChecked( elem );
} else if ( typeof elem.getElementsByTagName !== "undefined" ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
}
// Append elements to a provided document fragment
if ( fragment ) {
// Special handling of each script element
handleScript = function( elem ) {
// Check if we consider it executable
if ( !elem.type || rscriptType.test( elem.type ) ) {
// Detach the script and store it in the scripts array (if provided) or the fragment
// Return truthy to indicate that it has been handled
return scripts ?
scripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :
fragment.appendChild( elem );
}
};
for ( i = 0; (elem = ret[i]) != null; i++ ) {
// Check if we're done after handling an executable script
if ( !( jQuery.nodeName( elem, "script" ) && handleScript( elem ) ) ) {
// Append to fragment and handle embedded scripts
fragment.appendChild( elem );
if ( typeof elem.getElementsByTagName !== "undefined" ) {
// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration
jsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName("script") ), handleScript );
// Splice the scripts into ret after their former ancestor and advance our index beyond them
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
i += jsTags.length;
}
}
}
}
return ret;
},
cleanData: function( elems, /* internal */ acceptData ) {
var data, id, elem, type,
i = 0,
internalKey = jQuery.expando,
cache = jQuery.cache,
deleteExpando = jQuery.support.deleteExpando,
special = jQuery.event.special;
for ( ; (elem = elems[i]) != null; i++ ) {
if ( acceptData || jQuery.acceptData( elem ) ) {
id = elem[ internalKey ];
data = id && cache[ id ];
if ( data ) {
if ( data.events ) {
for ( type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
}
// Remove cache only if it was not already removed by jQuery.event.remove
if ( cache[ id ] ) {
delete cache[ id ];
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( deleteExpando ) {
delete elem[ internalKey ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
jQuery.deletedIds.push( id );
}
}
}
}
}
});
// Limit scope pollution from any deprecated API
(function() {
var matched, browser;
// Use of jQuery.browser is frowned upon.
// More details: http://api.jquery.com/jQuery.browser
// jQuery.uaMatch maintained for back-compat
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];
return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
matched = jQuery.uaMatch( navigator.userAgent );
browser = {};
if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}
// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}
jQuery.browser = browser;
jQuery.sub = function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
return jQuerySub;
};
})();
var curCSS, iframe, iframeDoc,
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
rposition = /^(top|right|bottom|left)$/,
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rmargin = /^margin/,
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
rrelNum = new RegExp( "^([-+])=(" + core_pnum + ")", "i" ),
elemdisplay = { BODY: "block" },
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = {
letterSpacing: 0,
fontWeight: 400
},
cssExpand = [ "Top", "Right", "Bottom", "Left" ],
cssPrefixes = [ "Webkit", "O", "Moz", "ms" ],
eventsToggle = jQuery.fn.toggle;
// return a css property mapped to a potentially vendor prefixed property
function vendorPropName( style, name ) {
// shortcut for names that are not vendor prefixed
if ( name in style ) {
return name;
}
// check for vendor prefixed names
var capName = name.charAt(0).toUpperCase() + name.slice(1),
origName = name,
i = cssPrefixes.length;
while ( i-- ) {
name = cssPrefixes[ i ] + capName;
if ( name in style ) {
return name;
}
}
return origName;
}
function isHidden( elem, el ) {
elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem );
}
function showHide( elements, show ) {
var elem, display,
values = [],
index = 0,
length = elements.length;
for ( ; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
values[ index ] = jQuery._data( elem, "olddisplay" );
if ( show ) {
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !values[ index ] && elem.style.display === "none" ) {
elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( elem.style.display === "" && isHidden( elem ) ) {
values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) );
}
} else {
display = curCSS( elem, "display" );
if ( !values[ index ] && display !== "none" ) {
jQuery._data( elem, "olddisplay", display );
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( index = 0; index < length; index++ ) {
elem = elements[ index ];
if ( !elem.style ) {
continue;
}
if ( !show || elem.style.display === "none" || elem.style.display === "" ) {
elem.style.display = show ? values[ index ] || "" : "none";
}
}
return elements;
}
jQuery.fn.extend({
css: function( name, value ) {
return jQuery.access( this, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
}, name, value, arguments.length > 1 );
},
show: function() {
return showHide( this, true );
},
hide: function() {
return showHide( this );
},
toggle: function( state, fn2 ) {
var bool = typeof state === "boolean";
if ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {
return eventsToggle.apply( this, arguments );
}
return this.each(function() {
if ( bool ? state : isHidden( this ) ) {
jQuery( this ).show();
} else {
jQuery( this ).hide();
}
});
}
});
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity" );
return ret === "" ? "1" : ret;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, hooks,
origName = jQuery.camelCase( name ),
style = elem.style;
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, numeric, extra ) {
var val, num, hooks,
origName = jQuery.camelCase( name );
// Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
// gets hook for the prefixed version
// followed by the unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks ) {
val = hooks.get( elem, true, extra );
}
// Otherwise, if a way to get the computed value exists, use that
if ( val === undefined ) {
val = curCSS( elem, name );
}
//convert "normal" to computed value
if ( val === "normal" && name in cssNormalTransform ) {
val = cssNormalTransform[ name ];
}
// Return, converting to number if forced or a qualifier was provided and val looks numeric
if ( numeric || extra !== undefined ) {
num = parseFloat( val );
return numeric || jQuery.isNumeric( num ) ? num || 0 : val;
}
return val;
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var ret, name,
old = {};
// Remember the old values, and insert the new ones
for ( name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
ret = callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
return ret;
}
});
// NOTE: To any future maintainer, we've window.getComputedStyle
// because jsdom on node.js will break without it.
if ( window.getComputedStyle ) {
curCSS = function( elem, name ) {
var ret, width, minWidth, maxWidth,
computed = window.getComputedStyle( elem, null ),
style = elem.style;
if ( computed ) {
// getPropertyValue is only needed for .css('filter') in IE9, see #12537
ret = computed.getPropertyValue( name ) || computed[ name ];
if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
ret = jQuery.style( elem, name );
}
// A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
width = style.width;
minWidth = style.minWidth;
maxWidth = style.maxWidth;
style.minWidth = style.maxWidth = style.width = ret;
ret = computed.width;
style.width = width;
style.minWidth = minWidth;
style.maxWidth = maxWidth;
}
}
return ret;
};
} else if ( document.documentElement.currentStyle ) {
curCSS = function( elem, name ) {
var left, rsLeft,
ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret == null && style && style[ name ] ) {
ret = style[ name ];
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are proportional to the parent element instead
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values
left = style.left;
rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
elem.runtimeStyle.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ret;
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
function setPositiveNumber( elem, value, subtract ) {
var matches = rnumsplit.exec( value );
return matches ?
Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) :
value;
}
function augmentWidthOrHeight( elem, name, extra, isBorderBox ) {
var i = extra === ( isBorderBox ? "border" : "content" ) ?
// If we already have the right measurement, avoid augmentation
4 :
// Otherwise initialize for horizontal or vertical properties
name === "width" ? 1 : 0,
val = 0;
for ( ; i < 4; i += 2 ) {
// both box models exclude margin, so add it if we want it
if ( extra === "margin" ) {
// we use jQuery.css instead of curCSS here
// because of the reliableMarginRight CSS hook!
val += jQuery.css( elem, extra + cssExpand[ i ], true );
}
// From this point on we use curCSS for maximum performance (relevant in animations)
if ( isBorderBox ) {
// border-box includes padding, so remove it if we want content
if ( extra === "content" ) {
val -= parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
}
// at this point, extra isn't border nor margin, so remove border
if ( extra !== "margin" ) {
val -= parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
} else {
// at this point, extra isn't content, so add padding
val += parseFloat( curCSS( elem, "padding" + cssExpand[ i ] ) ) || 0;
// at this point, extra isn't content nor padding, so add border
if ( extra !== "padding" ) {
val += parseFloat( curCSS( elem, "border" + cssExpand[ i ] + "Width" ) ) || 0;
}
}
}
return val;
}
function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
valueIsBorderBox = true,
isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
if ( val <= 0 || val == null ) {
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test(val) ) {
return val;
}
// we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
}
// use the active box-sizing model to add/subtract irrelevant styles
return ( val +
augmentWidthOrHeight(
elem,
name,
extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox
)
) + "px";
}
// Try to determine the default display value of an element
function css_defaultDisplay( nodeName ) {
if ( elemdisplay[ nodeName ] ) {
return elemdisplay[ nodeName ];
}
var elem = jQuery( "<" + nodeName + ">" ).appendTo( document.body ),
display = elem.css("display");
elem.remove();
// If the simple way fails,
// get element's real default display by attaching it to a temp iframe
if ( display === "none" || display === "" ) {
// Use the already-created iframe if possible
iframe = document.body.appendChild(
iframe || jQuery.extend( document.createElement("iframe"), {
frameBorder: 0,
width: 0,
height: 0
})
);
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write("<!doctype html><html><body>");
iframeDoc.close();
}
elem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );
display = curCSS( elem, "display" );
document.body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
return display;
}
jQuery.each([ "height", "width" ], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
if ( computed ) {
// certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this
if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) {
return jQuery.swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra );
});
} else {
return getWidthOrHeight( elem, name, extra );
}
}
},
set: function( elem, value, extra ) {
return setPositiveNumber( elem, value, extra ?
augmentWidthOrHeight(
elem,
name,
extra,
jQuery.support.boxSizing && jQuery.css( elem, "boxSizing" ) === "border-box"
) : 0
);
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
style.removeAttribute ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there there is no filter style applied in a css rule, we are done
if ( currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
// These hooks cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
jQuery(function() {
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
return jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
return curCSS( elem, "marginRight" );
}
});
}
};
}
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
// getComputedStyle returns percent when specified for top/left/bottom/right
// rather than make the css module depend on the offset module, we just check for it here
if ( !jQuery.support.pixelPosition && jQuery.fn.position ) {
jQuery.each( [ "top", "left" ], function( i, prop ) {
jQuery.cssHooks[ prop ] = {
get: function( elem, computed ) {
if ( computed ) {
var ret = curCSS( elem, prop );
// if curCSS returns percentage, fallback to offset
return rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + "px" : ret;
}
}
};
});
}
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
// These hooks are used by animate to expand properties
jQuery.each({
margin: "",
padding: "",
border: "Width"
}, function( prefix, suffix ) {
jQuery.cssHooks[ prefix + suffix ] = {
expand: function( value ) {
var i,
// assumes a single number if not a string
parts = typeof value === "string" ? value.split(" ") : [ value ],
expanded = {};
for ( i = 0; i < 4; i++ ) {
expanded[ prefix + cssExpand[ i ] + suffix ] =
parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
}
return expanded;
}
};
if ( !rmargin.test( prefix ) ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
}
});
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
rselectTextarea = /^(?:select|textarea)/i;
jQuery.fn.extend({
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
return this.elements ? jQuery.makeArray( this.elements ) : this;
})
.filter(function(){
return this.name && !this.disabled &&
( this.checked || rselectTextarea.test( this.nodeName ) ||
rinput.test( this.type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val, i ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
//Serialize an array of form elements or a set of
//key/values into a query string
jQuery.param = function( a, traditional ) {
var prefix,
s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value );
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
};
function buildParams( prefix, obj, traditional, add ) {
var name;
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && jQuery.type( obj ) === "object" ) {
// Serialize object item.
for ( name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
var
// Document location
ajaxLocParts,
ajaxLocation,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rts = /([?&])_=[^&]*/,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"];
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
var dataType, list, placeBefore,
dataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),
i = 0,
length = dataTypes.length;
if ( jQuery.isFunction( func ) ) {
// For each dataType in the dataTypeExpression
for ( ; i < length; i++ ) {
dataType = dataTypes[ i ];
// We control if we're asked to add before
// any existing element
placeBefore = /^\+/.test( dataType );
if ( placeBefore ) {
dataType = dataType.substr( 1 ) || "*";
}
list = structure[ dataType ] = structure[ dataType ] || [];
// then we add to the structure accordingly
list[ placeBefore ? "unshift" : "push" ]( func );
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
dataType /* internal */, inspected /* internal */ ) {
dataType = dataType || options.dataTypes[ 0 ];
inspected = inspected || {};
inspected[ dataType ] = true;
var selection,
list = structure[ dataType ],
i = 0,
length = list ? list.length : 0,
executeOnly = ( structure === prefilters );
for ( ; i < length && ( executeOnly || !selection ); i++ ) {
selection = list[ i ]( options, originalOptions, jqXHR );
// If we got redirected to another dataType
// we try there if executing only and not done already
if ( typeof selection === "string" ) {
if ( !executeOnly || inspected[ selection ] ) {
selection = undefined;
} else {
options.dataTypes.unshift( selection );
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, selection, inspected );
}
}
}
// If we're only executing or nothing was selected
// we try the catchall dataType if not done already
if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, "*", inspected );
}
// unnecessary when only executing (prefilters)
// but it'll be ignored by the caller in that case
return selection;
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
}
jQuery.fn.load = function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
}
// Don't do a request if no elements are being requested
if ( !this.length ) {
return this;
}
var selector, type, response,
self = this,
off = url.indexOf(" ");
if ( off >= 0 ) {
selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( params && typeof params === "object" ) {
type = "POST";
}
// Request the remote document
jQuery.ajax({
url: url,
// if "type" variable is undefined, then "GET" method will be used
type: type,
dataType: "html",
data: params,
complete: function( jqXHR, status ) {
if ( callback ) {
self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );
}
}
}).done(function( responseText ) {
// Save response for use in complete callback
response = arguments;
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append( responseText.replace( rscript, "" ) )
// Locate the specified elements
.find( selector ) :
// If not, just inject the full result
responseText );
});
return this;
};
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
jQuery.fn[ o ] = function( f ){
return this.on( o, f );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
};
});
jQuery.extend({
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
if ( settings ) {
// Building a settings object
ajaxExtend( target, jQuery.ajaxSettings );
} else {
// Extending ajaxSettings
settings = target;
target = jQuery.ajaxSettings;
}
ajaxExtend( target, settings );
return target;
},
ajaxSettings: {
url: ajaxLocation,
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
processData: true,
async: true,
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
throws: false,
traditional: false,
headers: {},
*/
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
"*": allTypes
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// List of data converters
// 1) key format is "source_type destination_type" (a single space in-between)
// 2) the catchall symbol "*" can be used for source_type
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
context: true,
url: true
}
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // ifModified key
ifModifiedKey,
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node or a jQuery collection
globalEventContext = callbackContext !== s &&
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// The jqXHR state
state = 0,
// Default abort message
strAbort = "canceled",
// Fake xhr
jqXHR = {
readyState: 0,
// Caches the header
setRequestHeader: function( name, value ) {
if ( !state ) {
var lname = name.toLowerCase();
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match === undefined ? null : match;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Cancel the request
abort: function( statusText ) {
statusText = statusText || strAbort;
if ( transport ) {
transport.abort( statusText );
}
done( 0, statusText );
return this;
}
};
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
function done( status, nativeStatusText, responses, headers ) {
var isSuccess, success, error, response, modified,
statusText = nativeStatusText;
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
// Get response data
if ( responses ) {
response = ajaxHandleResponses( s, jqXHR, responses );
}
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
modified = jqXHR.getResponseHeader("Last-Modified");
if ( modified ) {
jQuery.lastModified[ ifModifiedKey ] = modified;
}
modified = jqXHR.getResponseHeader("Etag");
if ( modified ) {
jQuery.etag[ ifModifiedKey ] = modified;
}
}
// If not modified
if ( status === 304 ) {
statusText = "notmodified";
isSuccess = true;
// If we have data
} else {
isSuccess = ajaxConvert( s, response );
statusText = isSuccess.state;
success = isSuccess.data;
error = isSuccess.error;
isSuccess = !error;
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( !statusText || status ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = ( nativeStatusText || statusText ) + "";
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
// Attach deferreds
deferred.promise( jqXHR );
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
jqXHR.complete = completeDeferred.add;
// Status-dependent callbacks
jqXHR.statusCode = function( map ) {
if ( map ) {
var tmp;
if ( state < 2 ) {
for ( tmp in map ) {
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
}
} else {
tmp = map[ jqXHR.status ];
jqXHR.always( tmp );
}
}
return this;
};
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// We also use the url parameter if available
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
// A cross-domain request is in order when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefilter, stop there
if ( state === 2 ) {
return jqXHR;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
ifModifiedKey = s.url;
// Add anti-cache in url if needed
if ( s.cache === false ) {
var ts = jQuery.now(),
// try replacing _= if it is there
ret = s.url.replace( rts, "$1_=" + ts );
// if nothing was replaced, add timestamp to the end
s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
ifModifiedKey = ifModifiedKey || s.url;
if ( jQuery.lastModified[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
}
if ( jQuery.etag[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
}
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already and return
return jqXHR.abort();
}
// aborting is no longer a cancellation
strAbort = "abort";
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout( function(){
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
}
return jqXHR;
},
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var ct, type, finalDataType, firstDataType,
contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields;
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
var conv, conv2, current, tmp,
// Work with a copy of dataTypes in case we need to modify it for conversion
dataTypes = s.dataTypes.slice(),
prev = dataTypes[ 0 ],
converters = {},
i = 0;
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
// Create converters map with lowercased keys
if ( dataTypes[ 1 ] ) {
for ( conv in s.converters ) {
converters[ conv.toLowerCase() ] = s.converters[ conv ];
}
}
// Convert to each sequential dataType, tolerating list modification
for ( ; (current = dataTypes[++i]); ) {
// There's only work to do if current dataType is non-auto
if ( current !== "*" ) {
// Convert response if prev dataType is non-auto and differs from current
if ( prev !== "*" && prev !== current ) {
// Seek a direct converter
conv = converters[ prev + " " + current ] || converters[ "* " + current ];
// If none found, seek a pair
if ( !conv ) {
for ( conv2 in converters ) {
// If conv2 outputs current
tmp = conv2.split(" ");
if ( tmp[ 1 ] === current ) {
// If prev can be converted to accepted input
conv = converters[ prev + " " + tmp[ 0 ] ] ||
converters[ "* " + tmp[ 0 ] ];
if ( conv ) {
// Condense equivalence converters
if ( conv === true ) {
conv = converters[ conv2 ];
// Otherwise, insert the intermediate dataType
} else if ( converters[ conv2 ] !== true ) {
current = tmp[ 0 ];
dataTypes.splice( i--, 0, current );
}
break;
}
}
}
}
// Apply converter (if not an equivalence)
if ( conv !== true ) {
// Unless errors are allowed to bubble, catch and return them
if ( conv && s["throws"] ) {
response = conv( response );
} else {
try {
response = conv( response );
} catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current };
}
}
}
}
// Update prev for next iteration
prev = current;
}
}
return { state: "success", data: response };
}
var oldCallbacks = [],
rquestion = /\?/,
rjsonp = /(=)\?(?=&|$)|\?\?/,
nonce = jQuery.now();
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
this[ callback ] = true;
return callback;
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer,
data = s.data,
url = s.url,
hasCallback = s.jsonp !== false,
replaceInUrl = hasCallback && rjsonp.test( url ),
replaceInData = hasCallback && !replaceInUrl && typeof data === "string" &&
!( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
rjsonp.test( data );
// Handle iff the expected data type is "jsonp" or we have a parameter to set
if ( s.dataTypes[ 0 ] === "jsonp" || replaceInUrl || replaceInData ) {
// Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
s.jsonpCallback() :
s.jsonpCallback;
overwritten = window[ callbackName ];
// Insert callback into url or form data
if ( replaceInUrl ) {
s.url = url.replace( rjsonp, "$1" + callbackName );
} else if ( replaceInData ) {
s.data = data.replace( rjsonp, "$1" + callbackName );
} else if ( hasCallback ) {
s.url += ( rquestion.test( url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
}
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( callbackName + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Install callback
window[ callbackName ] = function() {
responseContainer = arguments;
};
// Clean-up function (fires after converters)
jqXHR.always(function() {
// Restore preexisting value
window[ callbackName ] = overwritten;
// Save back as free
if ( s[ callbackName ] ) {
// make sure that re-using the options doesn't screw things around
s.jsonpCallback = originalSettings.jsonpCallback;
// save the callback name for future use
oldCallbacks.push( callbackName );
}
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] );
}
responseContainer = overwritten = undefined;
});
// Delegate to script
return "script";
}
});
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript|ecmascript/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = "async";
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( head && script.parentNode ) {
head.removeChild( script );
}
// Dereference the script
script = undefined;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( 0, 1 );
}
}
};
}
});
var xhrCallbacks,
// #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject ? function() {
// Abort all pending requests
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( 0, 1 );
}
} : false,
xhrId = 0;
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
(function( xhr ) {
jQuery.extend( jQuery.support, {
ajax: !!xhr,
cors: !!xhr && ( "withCredentials" in xhr )
});
})( jQuery.ajaxSettings.xhr() );
// Create transport if the browser can provide an xhr
if ( jQuery.support.ajax ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var handle, i,
xhr = s.xhr();
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( _ ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status,
statusText,
responseHeaders,
responses,
xml;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occurred
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
// When requesting binary data, IE6-9 will throw an exception
// on any attempt to access responseText (#11426)
try {
responses.text = xhr.responseText;
} catch( e ) {
}
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
if ( !s.async ) {
// if we're in sync mode we fire the callback
callback();
} else if ( xhr.readyState === 4 ) {
// (IE6 & IE7) if it's in cache and has been
// retrieved directly we need to fire the callback
setTimeout( callback, 0 );
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback(0,1);
}
}
};
}
});
}
var fxNow, timerId,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = new RegExp( "^(?:([-+])=|)(" + core_pnum + ")([a-z%]*)$", "i" ),
rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ],
tweeners = {
"*": [function( prop, value ) {
var end, unit,
tween = this.createTween( prop, value ),
parts = rfxnum.exec( value ),
target = tween.cur(),
start = +target || 0,
scale = 1,
maxIterations = 20;
if ( parts ) {
end = +parts[2];
unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" && start ) {
// Iteratively approximate from a nonzero starting point
// Prefer the current property, because this process will be trivial if it uses the same units
// Fallback to end or a simple constant
start = jQuery.css( tween.elem, prop, true ) || end || 1;
do {
// If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply
start = start / scale;
jQuery.style( tween.elem, prop, start + unit );
// Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );
}
tween.unit = unit;
tween.start = start;
// If a +=/-= token was provided, we're doing a relative animation
tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;
}
return tween;
}]
};
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout(function() {
fxNow = undefined;
}, 0 );
return ( fxNow = jQuery.now() );
}
function createTweens( animation, props ) {
jQuery.each( props, function( prop, value ) {
var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ),
index = 0,
length = collection.length;
for ( ; index < length; index++ ) {
if ( collection[ index ].call( animation, prop, value ) ) {
// we're done with this property
return;
}
}
});
}
function Animation( elem, properties, options ) {
var result,
index = 0,
tweenerIndex = 0,
length = animationPrefilters.length,
deferred = jQuery.Deferred().always( function() {
// don't match elem in the :animated selector
delete tick.elem;
}),
tick = function() {
var currentTime = fxNow || createFxNow(),
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
// archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497)
temp = remaining / animation.duration || 0,
percent = 1 - temp,
index = 0,
length = animation.tweens.length;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( percent );
}
deferred.notifyWith( elem, [ animation, percent, remaining ]);
if ( percent < 1 && length ) {
return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
}
},
animation = deferred.promise({
elem: elem,
props: jQuery.extend( {}, properties ),
opts: jQuery.extend( true, { specialEasing: {} }, options ),
originalProperties: properties,
originalOptions: options,
startTime: fxNow || createFxNow(),
duration: options.duration,
tweens: [],
createTween: function( prop, end, easing ) {
var tween = jQuery.Tween( elem, animation.opts, prop, end,
animation.opts.specialEasing[ prop ] || animation.opts.easing );
animation.tweens.push( tween );
return tween;
},
stop: function( gotoEnd ) {
var index = 0,
// if we are going to the end, we want to run all the tweens
// otherwise we skip this part
length = gotoEnd ? animation.tweens.length : 0;
for ( ; index < length ; index++ ) {
animation.tweens[ index ].run( 1 );
}
// resolve when we played the last frame
// otherwise, reject
if ( gotoEnd ) {
deferred.resolveWith( elem, [ animation, gotoEnd ] );
} else {
deferred.rejectWith( elem, [ animation, gotoEnd ] );
}
return this;
}
}),
props = animation.props;
propFilter( props, animation.opts.specialEasing );
for ( ; index < length ; index++ ) {
result = animationPrefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) {
return result;
}
}
createTweens( animation, props );
if ( jQuery.isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation );
}
jQuery.fx.timer(
jQuery.extend( tick, {
anim: animation,
queue: animation.opts.queue,
elem: elem
})
);
// attach callbacks from options
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
}
function propFilter( props, specialEasing ) {
var index, name, easing, value, hooks;
// camelCase, specialEasing and expand cssHook pass
for ( index in props ) {
name = jQuery.camelCase( index );
easing = specialEasing[ name ];
value = props[ index ];
if ( jQuery.isArray( value ) ) {
easing = value[ 1 ];
value = props[ index ] = value[ 0 ];
}
if ( index !== name ) {
props[ name ] = value;
delete props[ index ];
}
hooks = jQuery.cssHooks[ name ];
if ( hooks && "expand" in hooks ) {
value = hooks.expand( value );
delete props[ name ];
// not quite $.extend, this wont overwrite keys already present.
// also - reusing 'index' from above because we have the correct "name"
for ( index in value ) {
if ( !( index in props ) ) {
props[ index ] = value[ index ];
specialEasing[ index ] = easing;
}
}
} else {
specialEasing[ name ] = easing;
}
}
}
jQuery.Animation = jQuery.extend( Animation, {
tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) {
callback = props;
props = [ "*" ];
} else {
props = props.split(" ");
}
var prop,
index = 0,
length = props.length;
for ( ; index < length ; index++ ) {
prop = props[ index ];
tweeners[ prop ] = tweeners[ prop ] || [];
tweeners[ prop ].unshift( callback );
}
},
prefilter: function( callback, prepend ) {
if ( prepend ) {
animationPrefilters.unshift( callback );
} else {
animationPrefilters.push( callback );
}
}
});
function defaultPrefilter( elem, props, opts ) {
var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
anim = this,
style = elem.style,
orig = {},
handled = [],
hidden = elem.nodeType && isHidden( elem );
// handle queue: false promises
if ( !opts.queue ) {
hooks = jQuery._queueHooks( elem, "fx" );
if ( hooks.unqueued == null ) {
hooks.unqueued = 0;
oldfire = hooks.empty.fire;
hooks.empty.fire = function() {
if ( !hooks.unqueued ) {
oldfire();
}
};
}
hooks.unqueued++;
anim.always(function() {
// doing this makes sure that the complete handler will be called
// before this completes
anim.always(function() {
hooks.unqueued--;
if ( !jQuery.queue( elem, "fx" ).length ) {
hooks.empty.fire();
}
});
});
}
// height/width overflow pass
if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( elem, "display" ) === "inline" &&
jQuery.css( elem, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) {
style.display = "inline-block";
} else {
style.zoom = 1;
}
}
}
if ( opts.overflow ) {
style.overflow = "hidden";
if ( !jQuery.support.shrinkWrapBlocks ) {
anim.done(function() {
style.overflow = opts.overflow[ 0 ];
style.overflowX = opts.overflow[ 1 ];
style.overflowY = opts.overflow[ 2 ];
});
}
}
// show/hide pass
for ( index in props ) {
value = props[ index ];
if ( rfxtypes.exec( value ) ) {
delete props[ index ];
toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) {
continue;
}
handled.push( index );
}
}
length = handled.length;
if ( length ) {
dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} );
if ( "hidden" in dataShow ) {
hidden = dataShow.hidden;
}
// store state if its toggle - enables .stop().toggle() to "reverse"
if ( toggle ) {
dataShow.hidden = !hidden;
}
if ( hidden ) {
jQuery( elem ).show();
} else {
anim.done(function() {
jQuery( elem ).hide();
});
}
anim.done(function() {
var prop;
jQuery.removeData( elem, "fxshow", true );
for ( prop in orig ) {
jQuery.style( elem, prop, orig[ prop ] );
}
});
for ( index = 0 ; index < length ; index++ ) {
prop = handled[ index ];
tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );
orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );
if ( !( prop in dataShow ) ) {
dataShow[ prop ] = tween.start;
if ( hidden ) {
tween.end = tween.start;
tween.start = prop === "width" || prop === "height" ? 1 : 0;
}
}
}
}
}
function Tween( elem, options, prop, end, easing ) {
return new Tween.prototype.init( elem, options, prop, end, easing );
}
jQuery.Tween = Tween;
Tween.prototype = {
constructor: Tween,
init: function( elem, options, prop, end, easing, unit ) {
this.elem = elem;
this.prop = prop;
this.easing = easing || "swing";
this.options = options;
this.start = this.now = this.cur();
this.end = end;
this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
},
cur: function() {
var hooks = Tween.propHooks[ this.prop ];
return hooks && hooks.get ?
hooks.get( this ) :
Tween.propHooks._default.get( this );
},
run: function( percent ) {
var eased,
hooks = Tween.propHooks[ this.prop ];
if ( this.options.duration ) {
this.pos = eased = jQuery.easing[ this.easing ](
percent, this.options.duration * percent, 0, 1, this.options.duration
);
} else {
this.pos = eased = percent;
}
this.now = ( this.end - this.start ) * eased + this.start;
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
if ( hooks && hooks.set ) {
hooks.set( this );
} else {
Tween.propHooks._default.set( this );
}
return this;
}
};
Tween.prototype.init.prototype = Tween.prototype;
Tween.propHooks = {
_default: {
get: function( tween ) {
var result;
if ( tween.elem[ tween.prop ] != null &&
(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {
return tween.elem[ tween.prop ];
}
// passing any value as a 4th parameter to .css will automatically
// attempt a parseFloat and fallback to a string if the parse fails
// so, simple values such as "10px" are parsed to Float.
// complex values such as "rotate(1rad)" are returned as is.
result = jQuery.css( tween.elem, tween.prop, false, "" );
// Empty strings, null, undefined and "auto" are converted to 0.
return !result || result === "auto" ? 0 : result;
},
set: function( tween ) {
// use step hook for back compat - use cssHook if its there - use .style if its
// available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else {
tween.elem[ tween.prop ] = tween.now;
}
}
}
};
// Remove in 2.0 - this supports IE8's panic based approach
// to setting things on disconnected nodes
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
set: function( tween ) {
if ( tween.elem.nodeType && tween.elem.parentNode ) {
tween.elem[ tween.prop ] = tween.now;
}
}
};
jQuery.each([ "toggle", "show", "hide" ], function( i, name ) {
var cssFn = jQuery.fn[ name ];
jQuery.fn[ name ] = function( speed, easing, callback ) {
return speed == null || typeof speed === "boolean" ||
// special check for .toggle( handler, handler, ... )
( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?
cssFn.apply( this, arguments ) :
this.animate( genFx( name, true ), speed, easing, callback );
};
});
jQuery.fn.extend({
fadeTo: function( speed, to, easing, callback ) {
// show any hidden elements after setting opacity to 0
return this.filter( isHidden ).css( "opacity", 0 ).show()
// animate to the value specified
.end().animate({ opacity: to }, speed, easing, callback );
},
animate: function( prop, speed, easing, callback ) {
var empty = jQuery.isEmptyObject( prop ),
optall = jQuery.speed( speed, easing, callback ),
doAnimation = function() {
// Operate on a copy of prop so per-property easing won't be lost
var anim = Animation( this, jQuery.extend( {}, prop ), optall );
// Empty animations resolve immediately
if ( empty ) {
anim.stop( true );
}
};
return empty || optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
var stopQueue = function( hooks ) {
var stop = hooks.stop;
delete hooks.stop;
stop( gotoEnd );
};
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var dequeue = true,
index = type != null && type + "queueHooks",
timers = jQuery.timers,
data = jQuery._data( this );
if ( index ) {
if ( data[ index ] && data[ index ].stop ) {
stopQueue( data[ index ] );
}
} else {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
stopQueue( data[ index ] );
}
}
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
timers[ index ].anim.stop( gotoEnd );
dequeue = false;
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( dequeue || !gotoEnd ) {
jQuery.dequeue( this, type );
}
});
}
});
// Generate parameters to create a standard animation
function genFx( type, includeWidth ) {
var which,
attrs = { height: type },
i = 0;
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth? 1 : 0;
for( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
if ( includeWidth ) {
attrs.opacity = attrs.width = type;
}
return attrs;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx("show"),
slideUp: genFx("hide"),
slideToggle: genFx("toggle"),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.speed = function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function() {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
}
};
return opt;
};
jQuery.easing = {
linear: function( p ) {
return p;
},
swing: function( p ) {
return 0.5 - Math.cos( p*Math.PI ) / 2;
}
};
jQuery.timers = [];
jQuery.fx = Tween.prototype.init;
jQuery.fx.tick = function() {
var timer,
timers = jQuery.timers,
i = 0;
fxNow = jQuery.now();
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
fxNow = undefined;
};
jQuery.fx.timer = function( timer ) {
if ( timer() && jQuery.timers.push( timer ) && !timerId ) {
timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );
}
};
jQuery.fx.interval = 13;
jQuery.fx.stop = function() {
clearInterval( timerId );
timerId = null;
};
jQuery.fx.speeds = {
slow: 600,
fast: 200,
// Default speed
_default: 400
};
// Back Compat <1.8 extension point
jQuery.fx.step = {};
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
var rroot = /^(?:body|html)$/i;
jQuery.fn.offset = function( options ) {
if ( arguments.length ) {
return options === undefined ?
this :
this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
var docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft,
box = { top: 0, left: 0 },
elem = this[ 0 ],
doc = elem && elem.ownerDocument;
if ( !doc ) {
return;
}
if ( (body = doc.body) === elem ) {
return jQuery.offset.bodyOffset( elem );
}
docElem = doc.documentElement;
// Make sure it's not a disconnected DOM node
if ( !jQuery.contains( docElem, elem ) ) {
return box;
}
// If we don't have gBCR, just use 0,0 rather than error
// BlackBerry 5, iOS 3 (original iPhone)
if ( typeof elem.getBoundingClientRect !== "undefined" ) {
box = elem.getBoundingClientRect();
}
win = getWindow( doc );
clientTop = docElem.clientTop || body.clientTop || 0;
clientLeft = docElem.clientLeft || body.clientLeft || 0;
scrollTop = win.pageYOffset || docElem.scrollTop;
scrollLeft = win.pageXOffset || docElem.scrollLeft;
return {
top: box.top + scrollTop - clientTop,
left: box.left + scrollLeft - clientLeft
};
};
jQuery.offset = {
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return;
}
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent || document.body;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
var top = /Y/.test( prop );
jQuery.fn[ method ] = function( val ) {
return jQuery.access( this, function( elem, method, val ) {
var win = getWindow( elem );
if ( val === undefined ) {
return win ? (prop in win) ? win[ prop ] :
win.document.documentElement[ method ] :
elem[ method ];
}
if ( win ) {
win.scrollTo(
!top ? val : jQuery( win ).scrollLeft(),
top ? val : jQuery( win ).scrollTop()
);
} else {
elem[ method ] = val;
}
}, method, val, arguments.length, null );
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
return jQuery.access( this, function( elem, type, value ) {
var doc;
if ( jQuery.isWindow( elem ) ) {
// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there
// isn't a whole lot we can do. See pull request at this URL for discussion:
// https://github.com/jquery/jquery/pull/764
return elem.document.documentElement[ "client" + name ];
}
// Get document width or height
if ( elem.nodeType === 9 ) {
doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.
return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ],
doc[ "client" + name ]
);
}
return value === undefined ?
// Get width or height on the element, requesting but not forcing parseFloat
jQuery.css( elem, type, value, extra ) :
// Set width or height on the element
jQuery.style( elem, type, value, extra );
}, type, chainable ? margin : undefined, chainable, null );
};
});
});
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( window );
/*! =========================================================
* bootstrap-modal.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#modals
* =========================================================
* Twitter, Inc. require the following notice to accompany Bootstrap:
*
* Copyright (c) 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work
* except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or 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.
*
* ========================================================= */
!function ($) {
"use strict"; // jshint ;_;
/* MODAL CLASS DEFINITION
* ====================== */
var Modal = function (element, options) {
this.options = options
this.$element = $(element)
.delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
this.options.remote && this.$element.find('.modal-body').load(this.options.remote)
}
Modal.prototype = {
constructor: Modal
, toggle: function () {
return this[!this.isShown ? 'show' : 'hide']()
}
, show: function () {
var that = this
, e = $.Event('show')
this.$element.trigger(e)
if (this.isShown || e.isDefaultPrevented()) return
this.isShown = true
this.escape()
this.backdrop(function () {
var transition = $.support.transition && that.$element.hasClass('fade')
if (!that.$element.parent().length) {
that.$element.appendTo(document.body) //don't move modals dom position
}
that.$element
.show()
if (transition) {
that.$element[0].offsetWidth // force reflow
}
that.$element
.addClass('in')
.attr('aria-hidden', false)
that.enforceFocus()
transition ?
that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) :
that.$element.focus().trigger('shown')
})
}
, hide: function (e) {
e && e.preventDefault()
var that = this
e = $.Event('hide')
this.$element.trigger(e)
if (!this.isShown || e.isDefaultPrevented()) return
this.isShown = false
this.escape()
$(document).off('focusin.modal')
this.$element
.removeClass('in')
.attr('aria-hidden', true)
$.support.transition && this.$element.hasClass('fade') ?
this.hideWithTransition() :
this.hideModal()
}
, enforceFocus: function () {
var that = this
$(document).on('focusin.modal', function (e) {
if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {
that.$element.focus()
}
})
}
, escape: function () {
var that = this
if (this.isShown && this.options.keyboard) {
this.$element.on('keyup.dismiss.modal', function ( e ) {
e.which == 27 && that.hide()
})
} else if (!this.isShown) {
this.$element.off('keyup.dismiss.modal')
}
}
, hideWithTransition: function () {
var that = this
, timeout = setTimeout(function () {
that.$element.off($.support.transition.end)
that.hideModal()
}, 500)
this.$element.one($.support.transition.end, function () {
clearTimeout(timeout)
that.hideModal()
})
}
, hideModal: function (that) {
this.$element
.hide()
.trigger('hidden')
this.backdrop()
}
, removeBackdrop: function () {
this.$backdrop.remove()
this.$backdrop = null
}
, backdrop: function (callback) {
var that = this
, animate = this.$element.hasClass('fade') ? 'fade' : ''
if (this.isShown && this.options.backdrop) {
var doAnimate = $.support.transition && animate
this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
.appendTo(document.body)
this.$backdrop.click(
this.options.backdrop == 'static' ?
$.proxy(this.$element[0].focus, this.$element[0])
: $.proxy(this.hide, this)
)
if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
this.$backdrop.addClass('in')
doAnimate ?
this.$backdrop.one($.support.transition.end, callback) :
callback()
} else if (!this.isShown && this.$backdrop) {
this.$backdrop.removeClass('in')
$.support.transition && this.$element.hasClass('fade')?
this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) :
this.removeBackdrop()
} else if (callback) {
callback()
}
}
}
/* MODAL PLUGIN DEFINITION
* ======================= */
var old = $.fn.modal
$.fn.modal = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('modal')
, options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
if (!data) $this.data('modal', (data = new Modal(this, options)))
if (typeof option == 'string') data[option]()
else if (options.show) data.show()
})
}
$.fn.modal.defaults = {
backdrop: true
, keyboard: true
, show: true
}
$.fn.modal.Constructor = Modal
/* MODAL NO CONFLICT
* ================= */
$.fn.modal.noConflict = function () {
$.fn.modal = old
return this
}
/* MODAL DATA-API
* ============== */
$(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) {
var $this = $(this)
, href = $this.attr('href')
, $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7
, option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data())
e.preventDefault()
$target
.modal(option)
.one('hide', function () {
$this.focus()
})
})
}(window.jQuery);
/*!
* This file creates $ and jQuery variables within the F2 closure scope
*/
var $, jQuery = $ = window.jQuery.noConflict(true);
/*!
* Hij1nx requires the following notice to accompany EventEmitter:
*
* Copyright (c) 2011 hij1nx
*
* http://www.twitter.com/hij1nx
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
* documentation files (the 'Software'), to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
!function(exports, undefined) {
var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {
return Object.prototype.toString.call(obj) === "[object Array]";
};
var defaultMaxListeners = 10;
function init() {
this._events = new Object;
}
function configure(conf) {
if (conf) {
conf.delimiter && (this.delimiter = conf.delimiter);
conf.wildcard && (this.wildcard = conf.wildcard);
if (this.wildcard) {
this.listenerTree = new Object;
}
}
}
function EventEmitter(conf) {
this._events = new Object;
configure.call(this, conf);
}
//
// Attention, function return type now is array, always !
// It has zero elements if no any matches found and one or more
// elements (leafs) if there are matches
//
function searchListenerTree(handlers, type, tree, i) {
if (!tree) {
return [];
}
var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,
typeLength = type.length, currentType = type[i], nextType = type[i+1];
if (i === typeLength && tree._listeners) {
//
// If at the end of the event(s) list and the tree has listeners
// invoke those listeners.
//
if (typeof tree._listeners === 'function') {
handlers && handlers.push(tree._listeners);
return [tree];
} else {
for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {
handlers && handlers.push(tree._listeners[leaf]);
}
return [tree];
}
}
if ((currentType === '*' || currentType === '**') || tree[currentType]) {
//
// If the event emitted is '*' at this part
// or there is a concrete match at this patch
//
if (currentType === '*') {
for (branch in tree) {
if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1));
}
}
return listeners;
} else if(currentType === '**') {
endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*'));
if(endReached && tree._listeners) {
// The next element has a _listeners, add it to the handlers.
listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength));
}
for (branch in tree) {
if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
if(branch === '*' || branch === '**') {
if(tree[branch]._listeners && !endReached) {
listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength));
}
listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
} else if(branch === nextType) {
listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2));
} else {
// No match on this one, shift into the tree but not in the type array.
listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
}
}
}
return listeners;
}
listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1));
}
xTree = tree['*'];
if (xTree) {
//
// If the listener tree will allow any match for this part,
// then recursively explore all branches of the tree
//
searchListenerTree(handlers, type, xTree, i+1);
}
xxTree = tree['**'];
if(xxTree) {
if(i < typeLength) {
if(xxTree._listeners) {
// If we have a listener on a '**', it will catch all, so add its handler.
searchListenerTree(handlers, type, xxTree, typeLength);
}
// Build arrays of matching next branches and others.
for(branch in xxTree) {
if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) {
if(branch === nextType) {
// We know the next element will match, so jump twice.
searchListenerTree(handlers, type, xxTree[branch], i+2);
} else if(branch === currentType) {
// Current node matches, move into the tree.
searchListenerTree(handlers, type, xxTree[branch], i+1);
} else {
isolatedBranch = {};
isolatedBranch[branch] = xxTree[branch];
searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1);
}
}
}
} else if(xxTree._listeners) {
// We have reached the end and still on a '**'
searchListenerTree(handlers, type, xxTree, typeLength);
} else if(xxTree['*'] && xxTree['*']._listeners) {
searchListenerTree(handlers, type, xxTree['*'], typeLength);
}
}
return listeners;
}
function growListenerTree(type, listener) {
type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
//
// Looks for two consecutive '**', if so, don't add the event at all.
//
for(var i = 0, len = type.length; i+1 < len; i++) {
if(type[i] === '**' && type[i+1] === '**') {
return;
}
}
var tree = this.listenerTree;
var name = type.shift();
while (name) {
if (!tree[name]) {
tree[name] = new Object;
}
tree = tree[name];
if (type.length === 0) {
if (!tree._listeners) {
tree._listeners = listener;
}
else if(typeof tree._listeners === 'function') {
tree._listeners = [tree._listeners, listener];
}
else if (isArray(tree._listeners)) {
tree._listeners.push(listener);
if (!tree._listeners.warned) {
var m = defaultMaxListeners;
if (typeof this._events.maxListeners !== 'undefined') {
m = this._events.maxListeners;
}
if (m > 0 && tree._listeners.length > m) {
tree._listeners.warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
tree._listeners.length);
console.trace();
}
}
}
return true;
}
name = type.shift();
}
return true;
};
// By default EventEmitters will print a warning if more than
// 10 listeners are added to it. This is a useful default which
// helps finding memory leaks.
//
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.delimiter = '.';
EventEmitter.prototype.setMaxListeners = function(n) {
this._events || init.call(this);
this._events.maxListeners = n;
};
EventEmitter.prototype.event = '';
EventEmitter.prototype.once = function(event, fn) {
this.many(event, 1, fn);
return this;
};
EventEmitter.prototype.many = function(event, ttl, fn) {
var self = this;
if (typeof fn !== 'function') {
throw new Error('many only accepts instances of Function');
}
function listener() {
if (--ttl === 0) {
self.off(event, listener);
}
fn.apply(this, arguments);
};
listener._origin = fn;
this.on(event, listener);
return self;
};
EventEmitter.prototype.emit = function() {
this._events || init.call(this);
var type = arguments[0];
if (type === 'newListener') {
if (!this._events.newListener) { return false; }
}
// Loop through the *_all* functions and invoke them.
if (this._all) {
var l = arguments.length;
var args = new Array(l - 1);
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
for (i = 0, l = this._all.length; i < l; i++) {
this.event = type;
this._all[i].apply(this, args);
}
}
// If there is no 'error' event listener then throw.
if (type === 'error') {
if (!this._all &&
!this._events.error &&
!(this.wildcard && this.listenerTree.error)) {
if (arguments[1] instanceof Error) {
throw arguments[1]; // Unhandled 'error' event
} else {
throw new Error("Uncaught, unspecified 'error' event.");
}
return false;
}
}
var handler;
if(this.wildcard) {
handler = [];
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
}
else {
handler = this._events[type];
}
if (typeof handler === 'function') {
this.event = type;
if (arguments.length === 1) {
handler.call(this);
}
else if (arguments.length > 1)
switch (arguments.length) {
case 2:
handler.call(this, arguments[1]);
break;
case 3:
handler.call(this, arguments[1], arguments[2]);
break;
// slower
default:
var l = arguments.length;
var args = new Array(l - 1);
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
handler.apply(this, args);
}
return true;
}
else if (handler) {
var l = arguments.length;
var args = new Array(l - 1);
for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
var listeners = handler.slice();
for (var i = 0, l = listeners.length; i < l; i++) {
this.event = type;
listeners[i].apply(this, args);
}
return (listeners.length > 0) || this._all;
}
else {
return this._all;
}
};
EventEmitter.prototype.on = function(type, listener) {
if (typeof type === 'function') {
this.onAny(type);
return this;
}
if (typeof listener !== 'function') {
throw new Error('on only accepts instances of Function');
}
this._events || init.call(this);
// To avoid recursion in the case that type == "newListeners"! Before
// adding it to the listeners, first emit "newListeners".
this.emit('newListener', type, listener);
if(this.wildcard) {
growListenerTree.call(this, type, listener);
return this;
}
if (!this._events[type]) {
// Optimize the case of one listener. Don't need the extra array object.
this._events[type] = listener;
}
else if(typeof this._events[type] === 'function') {
// Adding the second element, need to change to array.
this._events[type] = [this._events[type], listener];
}
else if (isArray(this._events[type])) {
// If we've already got an array, just append.
this._events[type].push(listener);
// Check for listener leak
if (!this._events[type].warned) {
var m = defaultMaxListeners;
if (typeof this._events.maxListeners !== 'undefined') {
m = this._events.maxListeners;
}
if (m > 0 && this._events[type].length > m) {
this._events[type].warned = true;
console.error('(node) warning: possible EventEmitter memory ' +
'leak detected. %d listeners added. ' +
'Use emitter.setMaxListeners() to increase limit.',
this._events[type].length);
console.trace();
}
}
}
return this;
};
EventEmitter.prototype.onAny = function(fn) {
if(!this._all) {
this._all = [];
}
if (typeof fn !== 'function') {
throw new Error('onAny only accepts instances of Function');
}
// Add the function to the event listener collection.
this._all.push(fn);
return this;
};
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
EventEmitter.prototype.off = function(type, listener) {
if (typeof listener !== 'function') {
throw new Error('removeListener only takes instances of Function');
}
var handlers,leafs=[];
if(this.wildcard) {
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
}
else {
// does not use listeners(), so no side effect of creating _events[type]
if (!this._events[type]) return this;
handlers = this._events[type];
leafs.push({_listeners:handlers});
}
for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
var leaf = leafs[iLeaf];
handlers = leaf._listeners;
if (isArray(handlers)) {
var position = -1;
for (var i = 0, length = handlers.length; i < length; i++) {
if (handlers[i] === listener ||
(handlers[i].listener && handlers[i].listener === listener) ||
(handlers[i]._origin && handlers[i]._origin === listener)) {
position = i;
break;
}
}
if (position < 0) {
return this;
}
if(this.wildcard) {
leaf._listeners.splice(position, 1)
}
else {
this._events[type].splice(position, 1);
}
if (handlers.length === 0) {
if(this.wildcard) {
delete leaf._listeners;
}
else {
delete this._events[type];
}
}
}
else if (handlers === listener ||
(handlers.listener && handlers.listener === listener) ||
(handlers._origin && handlers._origin === listener)) {
if(this.wildcard) {
delete leaf._listeners;
}
else {
delete this._events[type];
}
}
}
return this;
};
EventEmitter.prototype.offAny = function(fn) {
var i = 0, l = 0, fns;
if (fn && this._all && this._all.length > 0) {
fns = this._all;
for(i = 0, l = fns.length; i < l; i++) {
if(fn === fns[i]) {
fns.splice(i, 1);
return this;
}
}
} else {
this._all = [];
}
return this;
};
EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
EventEmitter.prototype.removeAllListeners = function(type) {
if (arguments.length === 0) {
!this._events || init.call(this);
return this;
}
if(this.wildcard) {
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
var leaf = leafs[iLeaf];
leaf._listeners = null;
}
}
else {
if (!this._events[type]) return this;
this._events[type] = null;
}
return this;
};
EventEmitter.prototype.listeners = function(type) {
if(this.wildcard) {
var handlers = [];
var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
searchListenerTree.call(this, handlers, ns, this.listenerTree, 0);
return handlers;
}
this._events || init.call(this);
if (!this._events[type]) this._events[type] = [];
if (!isArray(this._events[type])) {
this._events[type] = [this._events[type]];
}
return this._events[type];
};
EventEmitter.prototype.listenersAny = function() {
if(this._all) {
return this._all;
}
else {
return [];
}
};
// if (typeof define === 'function' && define.amd) {
// define('EventEmitter2', [], function() {
// return EventEmitter;
// });
// } else {
exports.EventEmitter2 = EventEmitter;
// }
}(typeof process !== 'undefined' && typeof process.title !== 'undefined' && typeof exports !== 'undefined' ? exports : window);
/*!
* Øyvind Sean Kinsey and others require the following notice to accompany easyXDM:
*
* http://easyxdm.net/
* Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
(function (window, document, location, setTimeout, decodeURIComponent, encodeURIComponent) {
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global JSON, XMLHttpRequest, window, escape, unescape, ActiveXObject */
var global = this;
var channelId = Math.floor(Math.random() * 10000); // randomize the initial id in case of multiple closures loaded
var emptyFn = Function.prototype;
var reURI = /^((http.?:)\/\/([^:\/\s]+)(:\d+)*)/; // returns groups for protocol (2), domain (3) and port (4)
var reParent = /[\-\w]+\/\.\.\//; // matches a foo/../ expression
var reDoubleSlash = /([^:])\/\//g; // matches // anywhere but in the protocol
var namespace = ""; // stores namespace under which easyXDM object is stored on the page (empty if object is global)
var easyXDM = {};
var _easyXDM = window.easyXDM; // map over global easyXDM in case of overwrite
var IFRAME_PREFIX = "easyXDM_";
var HAS_NAME_PROPERTY_BUG;
var useHash = false; // whether to use the hash over the query
var flashVersion; // will be set if using flash
var HAS_FLASH_THROTTLED_BUG;
// http://peter.michaux.ca/articles/feature-detection-state-of-the-art-browser-scripting
function isHostMethod(object, property){
var t = typeof object[property];
return t == 'function' ||
(!!(t == 'object' && object[property])) ||
t == 'unknown';
}
function isHostObject(object, property){
return !!(typeof(object[property]) == 'object' && object[property]);
}
// end
// http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
function isArray(o){
return Object.prototype.toString.call(o) === '[object Array]';
}
// end
function hasFlash(){
try {
var activeX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
flashVersion = Array.prototype.slice.call(activeX.GetVariable("$version").match(/(\d+),(\d+),(\d+),(\d+)/), 1);
HAS_FLASH_THROTTLED_BUG = parseInt(flashVersion[0], 10) > 9 && parseInt(flashVersion[1], 10) > 0;
activeX = null;
return true;
}
catch (notSupportedException) {
return false;
}
}
/*
* Cross Browser implementation for adding and removing event listeners.
*/
var on, un;
if (isHostMethod(window, "addEventListener")) {
on = function(target, type, listener){
target.addEventListener(type, listener, false);
};
un = function(target, type, listener){
target.removeEventListener(type, listener, false);
};
}
else if (isHostMethod(window, "attachEvent")) {
on = function(object, sEvent, fpNotify){
object.attachEvent("on" + sEvent, fpNotify);
};
un = function(object, sEvent, fpNotify){
object.detachEvent("on" + sEvent, fpNotify);
};
}
else {
throw new Error("Browser not supported");
}
/*
* Cross Browser implementation of DOMContentLoaded.
*/
var domIsReady = false, domReadyQueue = [], readyState;
if ("readyState" in document) {
// If browser is WebKit-powered, check for both 'loaded' (legacy browsers) and
// 'interactive' (HTML5 specs, recent WebKit builds) states.
// https://bugs.webkit.org/show_bug.cgi?id=45119
readyState = document.readyState;
domIsReady = readyState == "complete" || (~ navigator.userAgent.indexOf('AppleWebKit/') && (readyState == "loaded" || readyState == "interactive"));
}
else {
// If readyState is not supported in the browser, then in order to be able to fire whenReady functions apropriately
// when added dynamically _after_ DOM load, we have to deduce wether the DOM is ready or not.
// We only need a body to add elements to, so the existence of document.body is enough for us.
domIsReady = !!document.body;
}
function dom_onReady(){
if (domIsReady) {
return;
}
domIsReady = true;
for (var i = 0; i < domReadyQueue.length; i++) {
domReadyQueue[i]();
}
domReadyQueue.length = 0;
}
if (!domIsReady) {
if (isHostMethod(window, "addEventListener")) {
on(document, "DOMContentLoaded", dom_onReady);
}
else {
on(document, "readystatechange", function(){
if (document.readyState == "complete") {
dom_onReady();
}
});
if (document.documentElement.doScroll && window === top) {
var doScrollCheck = function(){
if (domIsReady) {
return;
}
// http://javascript.nwbox.com/IEContentLoaded/
try {
document.documentElement.doScroll("left");
}
catch (e) {
setTimeout(doScrollCheck, 1);
return;
}
dom_onReady();
};
doScrollCheck();
}
}
// A fallback to window.onload, that will always work
on(window, "load", dom_onReady);
}
/**
* This will add a function to the queue of functions to be run once the DOM reaches a ready state.
* If functions are added after this event then they will be executed immediately.
* @param {function} fn The function to add
* @param {Object} scope An optional scope for the function to be called with.
*/
function whenReady(fn, scope){
if (domIsReady) {
fn.call(scope);
return;
}
domReadyQueue.push(function(){
fn.call(scope);
});
}
/**
* Returns an instance of easyXDM from the parent window with
* respect to the namespace.
*
* @return An instance of easyXDM (in the parent window)
*/
function getParentObject(){
var obj = parent;
if (namespace !== "") {
for (var i = 0, ii = namespace.split("."); i < ii.length; i++) {
obj = obj[ii[i]];
}
}
return obj.easyXDM;
}
/**
* Removes easyXDM variable from the global scope. It also returns control
* of the easyXDM variable to whatever code used it before.
*
* @param {String} ns A string representation of an object that will hold
* an instance of easyXDM.
* @return An instance of easyXDM
*/
function noConflict(ns){
window.easyXDM = _easyXDM;
namespace = ns;
if (namespace) {
IFRAME_PREFIX = "easyXDM_" + namespace.replace(".", "_") + "_";
}
return easyXDM;
}
/*
* Methods for working with URLs
*/
/**
* Get the domain name from a url.
* @param {String} url The url to extract the domain from.
* @return The domain part of the url.
* @type {String}
*/
function getDomainName(url){
return url.match(reURI)[3];
}
/**
* Get the port for a given URL, or "" if none
* @param {String} url The url to extract the port from.
* @return The port part of the url.
* @type {String}
*/
function getPort(url){
return url.match(reURI)[4] || "";
}
/**
* Returns a string containing the schema, domain and if present the port
* @param {String} url The url to extract the location from
* @return {String} The location part of the url
*/
function getLocation(url){
var m = url.toLowerCase().match(reURI);
var proto = m[2], domain = m[3], port = m[4] || "";
if ((proto == "http:" && port == ":80") || (proto == "https:" && port == ":443")) {
port = "";
}
return proto + "//" + domain + port;
}
/**
* Resolves a relative url into an absolute one.
* @param {String} url The path to resolve.
* @return {String} The resolved url.
*/
function resolveUrl(url){
// replace all // except the one in proto with /
url = url.replace(reDoubleSlash, "$1/");
// If the url is a valid url we do nothing
if (!url.match(/^(http||https):\/\//)) {
// If this is a relative path
var path = (url.substring(0, 1) === "/") ? "" : location.pathname;
if (path.substring(path.length - 1) !== "/") {
path = path.substring(0, path.lastIndexOf("/") + 1);
}
url = location.protocol + "//" + location.host + path + url;
}
// reduce all 'xyz/../' to just ''
while (reParent.test(url)) {
url = url.replace(reParent, "");
}
return url;
}
/**
* Appends the parameters to the given url.<br/>
* The base url can contain existing query parameters.
* @param {String} url The base url.
* @param {Object} parameters The parameters to add.
* @return {String} A new valid url with the parameters appended.
*/
function appendQueryParameters(url, parameters){
var hash = "", indexOf = url.indexOf("#");
if (indexOf !== -1) {
hash = url.substring(indexOf);
url = url.substring(0, indexOf);
}
var q = [];
for (var key in parameters) {
if (parameters.hasOwnProperty(key)) {
q.push(key + "=" + encodeURIComponent(parameters[key]));
}
}
return url + (useHash ? "#" : (url.indexOf("?") == -1 ? "?" : "&")) + q.join("&") + hash;
}
// build the query object either from location.query, if it contains the xdm_e argument, or from location.hash
var query = (function(input){
input = input.substring(1).split("&");
var data = {}, pair, i = input.length;
while (i--) {
pair = input[i].split("=");
data[pair[0]] = decodeURIComponent(pair[1]);
}
return data;
}(/xdm_e=/.test(location.search) ? location.search : location.hash));
/*
* Helper methods
*/
/**
* Helper for checking if a variable/property is undefined
* @param {Object} v The variable to test
* @return {Boolean} True if the passed variable is undefined
*/
function undef(v){
return typeof v === "undefined";
}
/**
* A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
* @return {JSON} A valid JSON conforming object, or null if not found.
*/
var getJSON = function(){
var cached = {};
var obj = {
a: [1, 2, 3]
}, json = "{\"a\":[1,2,3]}";
if (typeof JSON != "undefined" && typeof JSON.stringify === "function" && JSON.stringify(obj).replace((/\s/g), "") === json) {
// this is a working JSON instance
return JSON;
}
if (Object.toJSON) {
if (Object.toJSON(obj).replace((/\s/g), "") === json) {
// this is a working stringify method
cached.stringify = Object.toJSON;
}
}
if (typeof String.prototype.evalJSON === "function") {
obj = json.evalJSON();
if (obj.a && obj.a.length === 3 && obj.a[2] === 3) {
// this is a working parse method
cached.parse = function(str){
return str.evalJSON();
};
}
}
if (cached.stringify && cached.parse) {
// Only memoize the result if we have valid instance
getJSON = function(){
return cached;
};
return cached;
}
return null;
};
/**
* Applies properties from the source object to the target object.<br/>
* @param {Object} target The target of the properties.
* @param {Object} source The source of the properties.
* @param {Boolean} noOverwrite Set to True to only set non-existing properties.
*/
function apply(destination, source, noOverwrite){
var member;
for (var prop in source) {
if (source.hasOwnProperty(prop)) {
if (prop in destination) {
member = source[prop];
if (typeof member === "object") {
apply(destination[prop], member, noOverwrite);
}
else if (!noOverwrite) {
destination[prop] = source[prop];
}
}
else {
destination[prop] = source[prop];
}
}
}
return destination;
}
// This tests for the bug in IE where setting the [name] property using javascript causes the value to be redirected into [submitName].
function testForNamePropertyBug(){
var form = document.body.appendChild(document.createElement("form")), input = form.appendChild(document.createElement("input"));
input.name = IFRAME_PREFIX + "TEST" + channelId; // append channelId in order to avoid caching issues
HAS_NAME_PROPERTY_BUG = input !== form.elements[input.name];
document.body.removeChild(form);
}
/**
* Creates a frame and appends it to the DOM.
* @param config {object} This object can have the following properties
* <ul>
* <li> {object} prop The properties that should be set on the frame. This should include the 'src' property.</li>
* <li> {object} attr The attributes that should be set on the frame.</li>
* <li> {DOMElement} container Its parent element (Optional).</li>
* <li> {function} onLoad A method that should be called with the frames contentWindow as argument when the frame is fully loaded. (Optional)</li>
* </ul>
* @return The frames DOMElement
* @type DOMElement
*/
function createFrame(config){
if (undef(HAS_NAME_PROPERTY_BUG)) {
testForNamePropertyBug();
}
var frame;
// This is to work around the problems in IE6/7 with setting the name property.
// Internally this is set as 'submitName' instead when using 'iframe.name = ...'
// This is not required by easyXDM itself, but is to facilitate other use cases
if (HAS_NAME_PROPERTY_BUG) {
frame = document.createElement("<iframe name=\"" + config.props.name + "\"/>");
}
else {
frame = document.createElement("IFRAME");
frame.name = config.props.name;
}
frame.id = frame.name = config.props.name;
delete config.props.name;
if (config.onLoad) {
on(frame, "load", config.onLoad);
}
if (typeof config.container == "string") {
config.container = document.getElementById(config.container);
}
if (!config.container) {
// This needs to be hidden like this, simply setting display:none and the like will cause failures in some browsers.
apply(frame.style, {
position: "absolute",
top: "-2000px"
});
config.container = document.body;
}
// HACK for some reason, IE needs the source set
// after the frame has been appended into the DOM
// so remove the src, and set it afterwards
var src = config.props.src;
delete config.props.src;
// transfer properties to the frame
apply(frame, config.props);
frame.border = frame.frameBorder = 0;
frame.allowTransparency = true;
config.container.appendChild(frame);
// HACK see above
frame.src = src;
config.props.src = src;
return frame;
}
/**
* Check whether a domain is allowed using an Access Control List.
* The ACL can contain * and ? as wildcards, or can be regular expressions.
* If regular expressions they need to begin with ^ and end with $.
* @param {Array/String} acl The list of allowed domains
* @param {String} domain The domain to test.
* @return {Boolean} True if the domain is allowed, false if not.
*/
function checkAcl(acl, domain){
// normalize into an array
if (typeof acl == "string") {
acl = [acl];
}
var re, i = acl.length;
while (i--) {
re = acl[i];
re = new RegExp(re.substr(0, 1) == "^" ? re : ("^" + re.replace(/(\*)/g, ".$1").replace(/\?/g, ".") + "$"));
if (re.test(domain)) {
return true;
}
}
return false;
}
/*
* Functions related to stacks
*/
/**
* Prepares an array of stack-elements suitable for the current configuration
* @param {Object} config The Transports configuration. See easyXDM.Socket for more.
* @return {Array} An array of stack-elements with the TransportElement at index 0.
*/
function prepareTransportStack(config){
var protocol = config.protocol, stackEls;
config.isHost = config.isHost || undef(query.xdm_p);
useHash = config.hash || false;
if (!config.props) {
config.props = {};
}
if (!config.isHost) {
config.channel = query.xdm_c;
config.secret = query.xdm_s;
config.remote = query.xdm_e;
protocol = query.xdm_p;
if (config.acl && !checkAcl(config.acl, config.remote)) {
throw new Error("Access denied for " + config.remote);
}
}
else {
config.remote = resolveUrl(config.remote);
config.channel = config.channel || "default" + channelId++;
config.secret = Math.random().toString(16).substring(2);
if (undef(protocol)) {
if (getLocation(location.href) == getLocation(config.remote)) {
/*
* Both documents has the same origin, lets use direct access.
*/
protocol = "4";
}
else if (isHostMethod(window, "postMessage") || isHostMethod(document, "postMessage")) {
/*
* This is supported in IE8+, Firefox 3+, Opera 9+, Chrome 2+ and Safari 4+
*/
protocol = "1";
}
else if (config.swf && isHostMethod(window, "ActiveXObject") && hasFlash()) {
/*
* The Flash transport superseedes the NixTransport as the NixTransport has been blocked by MS
*/
protocol = "6";
}
else if (navigator.product === "Gecko" && "frameElement" in window && navigator.userAgent.indexOf('WebKit') == -1) {
/*
* This is supported in Gecko (Firefox 1+)
*/
protocol = "5";
}
else if (config.remoteHelper) {
/*
* This is supported in all browsers that retains the value of window.name when
* navigating from one domain to another, and where parent.frames[foo] can be used
* to get access to a frame from the same domain
*/
config.remoteHelper = resolveUrl(config.remoteHelper);
protocol = "2";
}
else {
/*
* This is supported in all browsers where [window].location is writable for all
* The resize event will be used if resize is supported and the iframe is not put
* into a container, else polling will be used.
*/
protocol = "0";
}
}
}
config.protocol = protocol; // for conditional branching
switch (protocol) {
case "0":// 0 = HashTransport
apply(config, {
interval: 100,
delay: 2000,
useResize: true,
useParent: false,
usePolling: false
}, true);
if (config.isHost) {
if (!config.local) {
// If no local is set then we need to find an image hosted on the current domain
var domain = location.protocol + "//" + location.host, images = document.body.getElementsByTagName("img"), image;
var i = images.length;
while (i--) {
image = images[i];
if (image.src.substring(0, domain.length) === domain) {
config.local = image.src;
break;
}
}
if (!config.local) {
// If no local was set, and we are unable to find a suitable file, then we resort to using the current window
config.local = window;
}
}
var parameters = {
xdm_c: config.channel,
xdm_p: 0
};
if (config.local === window) {
// We are using the current window to listen to
config.usePolling = true;
config.useParent = true;
config.local = location.protocol + "//" + location.host + location.pathname + location.search;
parameters.xdm_e = config.local;
parameters.xdm_pa = 1; // use parent
}
else {
parameters.xdm_e = resolveUrl(config.local);
}
if (config.container) {
config.useResize = false;
parameters.xdm_po = 1; // use polling
}
config.remote = appendQueryParameters(config.remote, parameters);
}
else {
apply(config, {
channel: query.xdm_c,
remote: query.xdm_e,
useParent: !undef(query.xdm_pa),
usePolling: !undef(query.xdm_po),
useResize: config.useParent ? false : config.useResize
});
}
stackEls = [new easyXDM.stack.HashTransport(config), new easyXDM.stack.ReliableBehavior({}), new easyXDM.stack.QueueBehavior({
encode: true,
maxLength: 4000 - config.remote.length
}), new easyXDM.stack.VerifyBehavior({
initiate: config.isHost
})];
break;
case "1":
stackEls = [new easyXDM.stack.PostMessageTransport(config)];
break;
case "2":
stackEls = [new easyXDM.stack.NameTransport(config), new easyXDM.stack.QueueBehavior(), new easyXDM.stack.VerifyBehavior({
initiate: config.isHost
})];
break;
case "3":
stackEls = [new easyXDM.stack.NixTransport(config)];
break;
case "4":
stackEls = [new easyXDM.stack.SameOriginTransport(config)];
break;
case "5":
stackEls = [new easyXDM.stack.FrameElementTransport(config)];
break;
case "6":
if (!flashVersion) {
hasFlash();
}
stackEls = [new easyXDM.stack.FlashTransport(config)];
break;
}
// this behavior is responsible for buffering outgoing messages, and for performing lazy initialization
stackEls.push(new easyXDM.stack.QueueBehavior({
lazy: config.lazy,
remove: true
}));
return stackEls;
}
/**
* Chains all the separate stack elements into a single usable stack.<br/>
* If an element is missing a necessary method then it will have a pass-through method applied.
* @param {Array} stackElements An array of stack elements to be linked.
* @return {easyXDM.stack.StackElement} The last element in the chain.
*/
function chainStack(stackElements){
var stackEl, defaults = {
incoming: function(message, origin){
this.up.incoming(message, origin);
},
outgoing: function(message, recipient){
this.down.outgoing(message, recipient);
},
callback: function(success){
this.up.callback(success);
},
init: function(){
this.down.init();
},
destroy: function(){
this.down.destroy();
}
};
for (var i = 0, len = stackElements.length; i < len; i++) {
stackEl = stackElements[i];
apply(stackEl, defaults, true);
if (i !== 0) {
stackEl.down = stackElements[i - 1];
}
if (i !== len - 1) {
stackEl.up = stackElements[i + 1];
}
}
return stackEl;
}
/**
* This will remove a stackelement from its stack while leaving the stack functional.
* @param {Object} element The elment to remove from the stack.
*/
function removeFromStack(element){
element.up.down = element.down;
element.down.up = element.up;
element.up = element.down = null;
}
/*
* Export the main object and any other methods applicable
*/
/**
* @class easyXDM
* A javascript library providing cross-browser, cross-domain messaging/RPC.
* @version 2.4.15.118
* @singleton
*/
apply(easyXDM, {
/**
* The version of the library
* @type {string}
*/
version: "2.4.15.118",
/**
* This is a map containing all the query parameters passed to the document.
* All the values has been decoded using decodeURIComponent.
* @type {object}
*/
query: query,
/**
* @private
*/
stack: {},
/**
* Applies properties from the source object to the target object.<br/>
* @param {object} target The target of the properties.
* @param {object} source The source of the properties.
* @param {boolean} noOverwrite Set to True to only set non-existing properties.
*/
apply: apply,
/**
* A safe implementation of HTML5 JSON. Feature testing is used to make sure the implementation works.
* @return {JSON} A valid JSON conforming object, or null if not found.
*/
getJSONObject: getJSON,
/**
* This will add a function to the queue of functions to be run once the DOM reaches a ready state.
* If functions are added after this event then they will be executed immediately.
* @param {function} fn The function to add
* @param {object} scope An optional scope for the function to be called with.
*/
whenReady: whenReady,
/**
* Removes easyXDM variable from the global scope. It also returns control
* of the easyXDM variable to whatever code used it before.
*
* @param {String} ns A string representation of an object that will hold
* an instance of easyXDM.
* @return An instance of easyXDM
*/
noConflict: noConflict
});
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global console, _FirebugCommandLine, easyXDM, window, escape, unescape, isHostObject, undef, _trace, domIsReady, emptyFn, namespace */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, isHostObject, isHostMethod, un, on, createFrame, debug */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.DomHelper
* Contains methods for dealing with the DOM
* @singleton
*/
easyXDM.DomHelper = {
/**
* Provides a consistent interface for adding eventhandlers
* @param {Object} target The target to add the event to
* @param {String} type The name of the event
* @param {Function} listener The listener
*/
on: on,
/**
* Provides a consistent interface for removing eventhandlers
* @param {Object} target The target to remove the event from
* @param {String} type The name of the event
* @param {Function} listener The listener
*/
un: un,
/**
* Checks for the presence of the JSON object.
* If it is not present it will use the supplied path to load the JSON2 library.
* This should be called in the documents head right after the easyXDM script tag.
* http://json.org/json2.js
* @param {String} path A valid path to json2.js
*/
requiresJSON: function(path){
if (!isHostObject(window, "JSON")) {
// we need to encode the < in order to avoid an illegal token error
// when the script is inlined in a document.
document.write('<' + 'script type="text/javascript" src="' + path + '"><' + '/script>');
}
}
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, debug */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
(function(){
// The map containing the stored functions
var _map = {};
/**
* @class easyXDM.Fn
* This contains methods related to function handling, such as storing callbacks.
* @singleton
* @namespace easyXDM
*/
easyXDM.Fn = {
/**
* Stores a function using the given name for reference
* @param {String} name The name that the function should be referred by
* @param {Function} fn The function to store
* @namespace easyXDM.fn
*/
set: function(name, fn){
_map[name] = fn;
},
/**
* Retrieves the function referred to by the given name
* @param {String} name The name of the function to retrieve
* @param {Boolean} del If the function should be deleted after retrieval
* @return {Function} The stored function
* @namespace easyXDM.fn
*/
get: function(name, del){
var fn = _map[name];
if (del) {
delete _map[name];
}
return fn;
}
};
}());
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, chainStack, prepareTransportStack, getLocation, debug */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.Socket
* This class creates a transport channel between two domains that is usable for sending and receiving string-based messages.<br/>
* The channel is reliable, supports queueing, and ensures that the message originates from the expected domain.<br/>
* Internally different stacks will be used depending on the browsers features and the available parameters.
* <h2>How to set up</h2>
* Setting up the provider:
* <pre><code>
* var socket = new easyXDM.Socket({
* local: "name.html",
* onReady: function(){
* // you need to wait for the onReady callback before using the socket
* socket.postMessage("foo-message");
* },
* onMessage: function(message, origin) {
* alert("received " + message + " from " + origin);
* }
* });
* </code></pre>
* Setting up the consumer:
* <pre><code>
* var socket = new easyXDM.Socket({
* remote: "http://remotedomain/page.html",
* remoteHelper: "http://remotedomain/name.html",
* onReady: function(){
* // you need to wait for the onReady callback before using the socket
* socket.postMessage("foo-message");
* },
* onMessage: function(message, origin) {
* alert("received " + message + " from " + origin);
* }
* });
* </code></pre>
* If you are unable to upload the <code>name.html</code> file to the consumers domain then remove the <code>remoteHelper</code> property
* and easyXDM will fall back to using the HashTransport instead of the NameTransport when not able to use any of the primary transports.
* @namespace easyXDM
* @constructor
* @cfg {String/Window} local The url to the local name.html document, a local static file, or a reference to the local window.
* @cfg {Boolean} lazy (Consumer only) Set this to true if you want easyXDM to defer creating the transport until really needed.
* @cfg {String} remote (Consumer only) The url to the providers document.
* @cfg {String} remoteHelper (Consumer only) The url to the remote name.html file. This is to support NameTransport as a fallback. Optional.
* @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window. Optional, defaults to 2000.
* @cfg {Number} interval The interval used when polling for messages. Optional, defaults to 300.
* @cfg {String} channel (Consumer only) The name of the channel to use. Can be used to set consistent iframe names. Must be unique. Optional.
* @cfg {Function} onMessage The method that should handle incoming messages.<br/> This method should accept two arguments, the message as a string, and the origin as a string. Optional.
* @cfg {Function} onReady A method that should be called when the transport is ready. Optional.
* @cfg {DOMElement|String} container (Consumer only) The element, or the id of the element that the primary iframe should be inserted into. If not set then the iframe will be positioned off-screen. Optional.
* @cfg {Array/String} acl (Provider only) Here you can specify which '[protocol]://[domain]' patterns that should be allowed to act as the consumer towards this provider.<br/>
* This can contain the wildcards ? and *. Examples are 'http://example.com', '*.foo.com' and '*dom?.com'. If you want to use reqular expressions then you pattern needs to start with ^ and end with $.
* If none of the patterns match an Error will be thrown.
* @cfg {Object} props (Consumer only) Additional properties that should be applied to the iframe. This can also contain nested objects e.g: <code>{style:{width:"100px", height:"100px"}}</code>.
* Properties such as 'name' and 'src' will be overrided. Optional.
*/
easyXDM.Socket = function(config){
// create the stack
var stack = chainStack(prepareTransportStack(config).concat([{
incoming: function(message, origin){
config.onMessage(message, origin);
},
callback: function(success){
if (config.onReady) {
config.onReady(success);
}
}
}])), recipient = getLocation(config.remote);
// set the origin
this.origin = getLocation(config.remote);
/**
* Initiates the destruction of the stack.
*/
this.destroy = function(){
stack.destroy();
};
/**
* Posts a message to the remote end of the channel
* @param {String} message The message to send
*/
this.postMessage = function(message){
stack.outgoing(message, recipient);
};
stack.init();
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, undef,, chainStack, prepareTransportStack, debug, getLocation */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.Rpc
* Creates a proxy object that can be used to call methods implemented on the remote end of the channel, and also to provide the implementation
* of methods to be called from the remote end.<br/>
* The instantiated object will have methods matching those specified in <code>config.remote</code>.<br/>
* This requires the JSON object present in the document, either natively, using json.org's json2 or as a wrapper around library spesific methods.
* <h2>How to set up</h2>
* <pre><code>
* var rpc = new easyXDM.Rpc({
* // this configuration is equal to that used by the Socket.
* remote: "http://remotedomain/...",
* onReady: function(){
* // you need to wait for the onReady callback before using the proxy
* rpc.foo(...
* }
* },{
* local: {..},
* remote: {..}
* });
* </code></pre>
*
* <h2>Exposing functions (procedures)</h2>
* <pre><code>
* var rpc = new easyXDM.Rpc({
* ...
* },{
* local: {
* nameOfMethod: {
* method: function(arg1, arg2, success, error){
* ...
* }
* },
* // with shorthand notation
* nameOfAnotherMethod: function(arg1, arg2, success, error){
* }
* },
* remote: {...}
* });
* </code></pre>
* The function referenced by [method] will receive the passed arguments followed by the callback functions <code>success</code> and <code>error</code>.<br/>
* To send a successfull result back you can use
* <pre><code>
* return foo;
* </pre></code>
* or
* <pre><code>
* success(foo);
* </pre></code>
* To return an error you can use
* <pre><code>
* throw new Error("foo error");
* </code></pre>
* or
* <pre><code>
* error("foo error");
* </code></pre>
*
* <h2>Defining remotely exposed methods (procedures/notifications)</h2>
* The definition of the remote end is quite similar:
* <pre><code>
* var rpc = new easyXDM.Rpc({
* ...
* },{
* local: {...},
* remote: {
* nameOfMethod: {}
* }
* });
* </code></pre>
* To call a remote method use
* <pre><code>
* rpc.nameOfMethod("arg1", "arg2", function(value) {
* alert("success: " + value);
* }, function(message) {
* alert("error: " + message + );
* });
* </code></pre>
* Both the <code>success</code> and <code>errror</code> callbacks are optional.<br/>
* When called with no callback a JSON-RPC 2.0 notification will be executed.
* Be aware that you will not be notified of any errors with this method.
* <br/>
* <h2>Specifying a custom serializer</h2>
* If you do not want to use the JSON2 library for non-native JSON support, but instead capabilities provided by some other library
* then you can specify a custom serializer using <code>serializer: foo</code>
* <pre><code>
* var rpc = new easyXDM.Rpc({
* ...
* },{
* local: {...},
* remote: {...},
* serializer : {
* parse: function(string){ ... },
* stringify: function(object) {...}
* }
* });
* </code></pre>
* If <code>serializer</code> is set then the class will not attempt to use the native implementation.
* @namespace easyXDM
* @constructor
* @param {Object} config The underlying transports configuration. See easyXDM.Socket for available parameters.
* @param {Object} jsonRpcConfig The description of the interface to implement.
*/
easyXDM.Rpc = function(config, jsonRpcConfig){
// expand shorthand notation
if (jsonRpcConfig.local) {
for (var method in jsonRpcConfig.local) {
if (jsonRpcConfig.local.hasOwnProperty(method)) {
var member = jsonRpcConfig.local[method];
if (typeof member === "function") {
jsonRpcConfig.local[method] = {
method: member
};
}
}
}
}
// create the stack
var stack = chainStack(prepareTransportStack(config).concat([new easyXDM.stack.RpcBehavior(this, jsonRpcConfig), {
callback: function(success){
if (config.onReady) {
config.onReady(success);
}
}
}]));
// set the origin
this.origin = getLocation(config.remote);
/**
* Initiates the destruction of the stack.
*/
this.destroy = function(){
stack.destroy();
};
stack.init();
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, getParentObject, IFRAME_PREFIX*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.SameOriginTransport
* SameOriginTransport is a transport class that can be used when both domains have the same origin.<br/>
* This can be useful for testing and for when the main application supports both internal and external sources.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String} remote The remote document to communicate with.
*/
easyXDM.stack.SameOriginTransport = function(config){
var pub, frame, send, targetOrigin;
return (pub = {
outgoing: function(message, domain, fn){
send(message);
if (fn) {
fn();
}
},
destroy: function(){
if (frame) {
frame.parentNode.removeChild(frame);
frame = null;
}
},
onDOMReady: function(){
targetOrigin = getLocation(config.remote);
if (config.isHost) {
// set up the iframe
apply(config.props, {
src: appendQueryParameters(config.remote, {
xdm_e: location.protocol + "//" + location.host + location.pathname,
xdm_c: config.channel,
xdm_p: 4 // 4 = SameOriginTransport
}),
name: IFRAME_PREFIX + config.channel + "_provider"
});
frame = createFrame(config);
easyXDM.Fn.set(config.channel, function(sendFn){
send = sendFn;
setTimeout(function(){
pub.up.callback(true);
}, 0);
return function(msg){
pub.up.incoming(msg, targetOrigin);
};
});
}
else {
send = getParentObject().Fn.get(config.channel, true)(function(msg){
pub.up.incoming(msg, targetOrigin);
});
setTimeout(function(){
pub.up.callback(true);
}, 0);
}
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global global, easyXDM, window, getLocation, appendQueryParameters, createFrame, debug, apply, whenReady, IFRAME_PREFIX, namespace, resolveUrl, getDomainName, HAS_FLASH_THROTTLED_BUG, getPort, query*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.FlashTransport
* FlashTransport is a transport class that uses an SWF with LocalConnection to pass messages back and forth.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String} remote The remote domain to communicate with.
* @cfg {String} secret the pre-shared secret used to secure the communication.
* @cfg {String} swf The path to the swf file
* @cfg {Boolean} swfNoThrottle Set this to true if you want to take steps to avoid beeing throttled when hidden.
* @cfg {String || DOMElement} swfContainer Set this if you want to control where the swf is placed
*/
easyXDM.stack.FlashTransport = function(config){
var pub, // the public interface
frame, send, targetOrigin, swf, swfContainer;
function onMessage(message, origin){
setTimeout(function(){
pub.up.incoming(message, targetOrigin);
}, 0);
}
/**
* This method adds the SWF to the DOM and prepares the initialization of the channel
*/
function addSwf(domain){
// the differentiating query argument is needed in Flash9 to avoid a caching issue where LocalConnection would throw an error.
var url = config.swf + "?host=" + config.isHost;
var id = "easyXDM_swf_" + Math.floor(Math.random() * 10000);
// prepare the init function that will fire once the swf is ready
easyXDM.Fn.set("flash_loaded" + domain.replace(/[\-.]/g, "_"), function(){
easyXDM.stack.FlashTransport[domain].swf = swf = swfContainer.firstChild;
var queue = easyXDM.stack.FlashTransport[domain].queue;
for (var i = 0; i < queue.length; i++) {
queue[i]();
}
queue.length = 0;
});
if (config.swfContainer) {
swfContainer = (typeof config.swfContainer == "string") ? document.getElementById(config.swfContainer) : config.swfContainer;
}
else {
// create the container that will hold the swf
swfContainer = document.createElement('div');
// http://bugs.adobe.com/jira/browse/FP-4796
// http://tech.groups.yahoo.com/group/flexcoders/message/162365
// https://groups.google.com/forum/#!topic/easyxdm/mJZJhWagoLc
apply(swfContainer.style, HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle ? {
height: "20px",
width: "20px",
position: "fixed",
right: 0,
top: 0
} : {
height: "1px",
width: "1px",
position: "absolute",
overflow: "hidden",
right: 0,
top: 0
});
document.body.appendChild(swfContainer);
}
// create the object/embed
var flashVars = "callback=flash_loaded" + domain.replace(/[\-.]/g, "_") + "&proto=" + global.location.protocol + "&domain=" + getDomainName(global.location.href) + "&port=" + getPort(global.location.href) + "&ns=" + namespace;
swfContainer.innerHTML = "<object height='20' width='20' type='application/x-shockwave-flash' id='" + id + "' data='" + url + "'>" +
"<param name='allowScriptAccess' value='always'></param>" +
"<param name='wmode' value='transparent'>" +
"<param name='movie' value='" +
url +
"'></param>" +
"<param name='flashvars' value='" +
flashVars +
"'></param>" +
"<embed type='application/x-shockwave-flash' FlashVars='" +
flashVars +
"' allowScriptAccess='always' wmode='transparent' src='" +
url +
"' height='1' width='1'></embed>" +
"</object>";
}
return (pub = {
outgoing: function(message, domain, fn){
swf.postMessage(config.channel, message.toString());
if (fn) {
fn();
}
},
destroy: function(){
try {
swf.destroyChannel(config.channel);
}
catch (e) {
}
swf = null;
if (frame) {
frame.parentNode.removeChild(frame);
frame = null;
}
},
onDOMReady: function(){
targetOrigin = config.remote;
// Prepare the code that will be run after the swf has been intialized
easyXDM.Fn.set("flash_" + config.channel + "_init", function(){
setTimeout(function(){
pub.up.callback(true);
});
});
// set up the omMessage handler
easyXDM.Fn.set("flash_" + config.channel + "_onMessage", onMessage);
config.swf = resolveUrl(config.swf); // reports have been made of requests gone rogue when using relative paths
var swfdomain = getDomainName(config.swf);
var fn = function(){
// set init to true in case the fn was called was invoked from a separate instance
easyXDM.stack.FlashTransport[swfdomain].init = true;
swf = easyXDM.stack.FlashTransport[swfdomain].swf;
// create the channel
swf.createChannel(config.channel, config.secret, getLocation(config.remote), config.isHost);
if (config.isHost) {
// if Flash is going to be throttled and we want to avoid this
if (HAS_FLASH_THROTTLED_BUG && config.swfNoThrottle) {
apply(config.props, {
position: "fixed",
right: 0,
top: 0,
height: "20px",
width: "20px"
});
}
// set up the iframe
apply(config.props, {
src: appendQueryParameters(config.remote, {
xdm_e: getLocation(location.href),
xdm_c: config.channel,
xdm_p: 6, // 6 = FlashTransport
xdm_s: config.secret
}),
name: IFRAME_PREFIX + config.channel + "_provider"
});
frame = createFrame(config);
}
};
if (easyXDM.stack.FlashTransport[swfdomain] && easyXDM.stack.FlashTransport[swfdomain].init) {
// if the swf is in place and we are the consumer
fn();
}
else {
// if the swf does not yet exist
if (!easyXDM.stack.FlashTransport[swfdomain]) {
// add the queue to hold the init fn's
easyXDM.stack.FlashTransport[swfdomain] = {
queue: [fn]
};
addSwf(swfdomain);
}
else {
easyXDM.stack.FlashTransport[swfdomain].queue.push(fn);
}
}
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.PostMessageTransport
* PostMessageTransport is a transport class that uses HTML5 postMessage for communication.<br/>
* <a href="http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms644944(VS.85).aspx</a><br/>
* <a href="https://developer.mozilla.org/en/DOM/window.postMessage">https://developer.mozilla.org/en/DOM/window.postMessage</a>
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String} remote The remote domain to communicate with.
*/
easyXDM.stack.PostMessageTransport = function(config){
var pub, // the public interface
frame, // the remote frame, if any
callerWindow, // the window that we will call with
targetOrigin; // the domain to communicate with
/**
* Resolves the origin from the event object
* @private
* @param {Object} event The messageevent
* @return {String} The scheme, host and port of the origin
*/
function _getOrigin(event){
if (event.origin) {
// This is the HTML5 property
return getLocation(event.origin);
}
if (event.uri) {
// From earlier implementations
return getLocation(event.uri);
}
if (event.domain) {
// This is the last option and will fail if the
// origin is not using the same schema as we are
return location.protocol + "//" + event.domain;
}
throw "Unable to retrieve the origin of the event";
}
/**
* This is the main implementation for the onMessage event.<br/>
* It checks the validity of the origin and passes the message on if appropriate.
* @private
* @param {Object} event The messageevent
*/
function _window_onMessage(event){
var origin = _getOrigin(event);
if (origin == targetOrigin && event.data.substring(0, config.channel.length + 1) == config.channel + " ") {
pub.up.incoming(event.data.substring(config.channel.length + 1), origin);
}
}
return (pub = {
outgoing: function(message, domain, fn){
callerWindow.postMessage(config.channel + " " + message, domain || targetOrigin);
if (fn) {
fn();
}
},
destroy: function(){
un(window, "message", _window_onMessage);
if (frame) {
callerWindow = null;
frame.parentNode.removeChild(frame);
frame = null;
}
},
onDOMReady: function(){
targetOrigin = getLocation(config.remote);
if (config.isHost) {
// add the event handler for listening
var waitForReady = function(event){
if (event.data == config.channel + "-ready") {
// replace the eventlistener
callerWindow = ("postMessage" in frame.contentWindow) ? frame.contentWindow : frame.contentWindow.document;
un(window, "message", waitForReady);
on(window, "message", _window_onMessage);
setTimeout(function(){
pub.up.callback(true);
}, 0);
}
};
on(window, "message", waitForReady);
// set up the iframe
apply(config.props, {
src: appendQueryParameters(config.remote, {
xdm_e: getLocation(location.href),
xdm_c: config.channel,
xdm_p: 1 // 1 = PostMessage
}),
name: IFRAME_PREFIX + config.channel + "_provider"
});
frame = createFrame(config);
}
else {
// add the event handler for listening
on(window, "message", _window_onMessage);
callerWindow = ("postMessage" in window.parent) ? window.parent : window.parent.document;
callerWindow.postMessage(config.channel + "-ready", targetOrigin);
setTimeout(function(){
pub.up.callback(true);
}, 0);
}
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, getLocation, appendQueryParameters, createFrame, debug, apply, query, whenReady, IFRAME_PREFIX*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.FrameElementTransport
* FrameElementTransport is a transport class that can be used with Gecko-browser as these allow passing variables using the frameElement property.<br/>
* Security is maintained as Gecho uses Lexical Authorization to determine under which scope a function is running.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String} remote The remote document to communicate with.
*/
easyXDM.stack.FrameElementTransport = function(config){
var pub, frame, send, targetOrigin;
return (pub = {
outgoing: function(message, domain, fn){
send.call(this, message);
if (fn) {
fn();
}
},
destroy: function(){
if (frame) {
frame.parentNode.removeChild(frame);
frame = null;
}
},
onDOMReady: function(){
targetOrigin = getLocation(config.remote);
if (config.isHost) {
// set up the iframe
apply(config.props, {
src: appendQueryParameters(config.remote, {
xdm_e: getLocation(location.href),
xdm_c: config.channel,
xdm_p: 5 // 5 = FrameElementTransport
}),
name: IFRAME_PREFIX + config.channel + "_provider"
});
frame = createFrame(config);
frame.fn = function(sendFn){
delete frame.fn;
send = sendFn;
setTimeout(function(){
pub.up.callback(true);
}, 0);
// remove the function so that it cannot be used to overwrite the send function later on
return function(msg){
pub.up.incoming(msg, targetOrigin);
};
};
}
else {
// This is to mitigate origin-spoofing
if (document.referrer && getLocation(document.referrer) != query.xdm_e) {
window.top.location = query.xdm_e;
}
send = window.frameElement.fn(function(msg){
pub.up.incoming(msg, targetOrigin);
});
pub.up.callback(true);
}
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, undef, getLocation, appendQueryParameters, resolveUrl, createFrame, debug, un, apply, whenReady, IFRAME_PREFIX*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.NameTransport
* NameTransport uses the window.name property to relay data.
* The <code>local</code> parameter needs to be set on both the consumer and provider,<br/>
* and the <code>remoteHelper</code> parameter needs to be set on the consumer.
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String} remoteHelper The url to the remote instance of hash.html - this is only needed for the host.
* @namespace easyXDM.stack
*/
easyXDM.stack.NameTransport = function(config){
var pub; // the public interface
var isHost, callerWindow, remoteWindow, readyCount, callback, remoteOrigin, remoteUrl;
function _sendMessage(message){
var url = config.remoteHelper + (isHost ? "#_3" : "#_2") + config.channel;
callerWindow.contentWindow.sendMessage(message, url);
}
function _onReady(){
if (isHost) {
if (++readyCount === 2 || !isHost) {
pub.up.callback(true);
}
}
else {
_sendMessage("ready");
pub.up.callback(true);
}
}
function _onMessage(message){
pub.up.incoming(message, remoteOrigin);
}
function _onLoad(){
if (callback) {
setTimeout(function(){
callback(true);
}, 0);
}
}
return (pub = {
outgoing: function(message, domain, fn){
callback = fn;
_sendMessage(message);
},
destroy: function(){
callerWindow.parentNode.removeChild(callerWindow);
callerWindow = null;
if (isHost) {
remoteWindow.parentNode.removeChild(remoteWindow);
remoteWindow = null;
}
},
onDOMReady: function(){
isHost = config.isHost;
readyCount = 0;
remoteOrigin = getLocation(config.remote);
config.local = resolveUrl(config.local);
if (isHost) {
// Register the callback
easyXDM.Fn.set(config.channel, function(message){
if (isHost && message === "ready") {
// Replace the handler
easyXDM.Fn.set(config.channel, _onMessage);
_onReady();
}
});
// Set up the frame that points to the remote instance
remoteUrl = appendQueryParameters(config.remote, {
xdm_e: config.local,
xdm_c: config.channel,
xdm_p: 2
});
apply(config.props, {
src: remoteUrl + '#' + config.channel,
name: IFRAME_PREFIX + config.channel + "_provider"
});
remoteWindow = createFrame(config);
}
else {
config.remoteHelper = config.remote;
easyXDM.Fn.set(config.channel, _onMessage);
}
// Set up the iframe that will be used for the transport
callerWindow = createFrame({
props: {
src: config.local + "#_4" + config.channel
},
onLoad: function onLoad(){
// Remove the handler
var w = callerWindow || this;
un(w, "load", onLoad);
easyXDM.Fn.set(config.channel + "_load", _onLoad);
(function test(){
if (typeof w.contentWindow.sendMessage == "function") {
_onReady();
}
else {
setTimeout(test, 50);
}
}());
}
});
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, getLocation, createFrame, debug, un, on, apply, whenReady, IFRAME_PREFIX*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.HashTransport
* HashTransport is a transport class that uses the IFrame URL Technique for communication.<br/>
* <a href="http://msdn.microsoft.com/en-us/library/bb735305.aspx">http://msdn.microsoft.com/en-us/library/bb735305.aspx</a><br/>
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The transports configuration.
* @cfg {String/Window} local The url to the local file used for proxying messages, or the local window.
* @cfg {Number} delay The number of milliseconds easyXDM should try to get a reference to the local window.
* @cfg {Number} interval The interval used when polling for messages.
*/
easyXDM.stack.HashTransport = function(config){
var pub;
var me = this, isHost, _timer, pollInterval, _lastMsg, _msgNr, _listenerWindow, _callerWindow;
var useParent, _remoteOrigin;
function _sendMessage(message){
if (!_callerWindow) {
return;
}
var url = config.remote + "#" + (_msgNr++) + "_" + message;
((isHost || !useParent) ? _callerWindow.contentWindow : _callerWindow).location = url;
}
function _handleHash(hash){
_lastMsg = hash;
pub.up.incoming(_lastMsg.substring(_lastMsg.indexOf("_") + 1), _remoteOrigin);
}
/**
* Checks location.hash for a new message and relays this to the receiver.
* @private
*/
function _pollHash(){
if (!_listenerWindow) {
return;
}
var href = _listenerWindow.location.href, hash = "", indexOf = href.indexOf("#");
if (indexOf != -1) {
hash = href.substring(indexOf);
}
if (hash && hash != _lastMsg) {
_handleHash(hash);
}
}
function _attachListeners(){
_timer = setInterval(_pollHash, pollInterval);
}
return (pub = {
outgoing: function(message, domain){
_sendMessage(message);
},
destroy: function(){
window.clearInterval(_timer);
if (isHost || !useParent) {
_callerWindow.parentNode.removeChild(_callerWindow);
}
_callerWindow = null;
},
onDOMReady: function(){
isHost = config.isHost;
pollInterval = config.interval;
_lastMsg = "#" + config.channel;
_msgNr = 0;
useParent = config.useParent;
_remoteOrigin = getLocation(config.remote);
if (isHost) {
config.props = {
src: config.remote,
name: IFRAME_PREFIX + config.channel + "_provider"
};
if (useParent) {
config.onLoad = function(){
_listenerWindow = window;
_attachListeners();
pub.up.callback(true);
};
}
else {
var tries = 0, max = config.delay / 50;
(function getRef(){
if (++tries > max) {
throw new Error("Unable to reference listenerwindow");
}
try {
_listenerWindow = _callerWindow.contentWindow.frames[IFRAME_PREFIX + config.channel + "_consumer"];
}
catch (ex) {
}
if (_listenerWindow) {
_attachListeners();
pub.up.callback(true);
}
else {
setTimeout(getRef, 50);
}
}());
}
_callerWindow = createFrame(config);
}
else {
_listenerWindow = window;
_attachListeners();
if (useParent) {
_callerWindow = parent;
pub.up.callback(true);
}
else {
apply(config, {
props: {
src: config.remote + "#" + config.channel + new Date(),
name: IFRAME_PREFIX + config.channel + "_consumer"
},
onLoad: function(){
pub.up.callback(true);
}
});
_callerWindow = createFrame(config);
}
}
},
init: function(){
whenReady(pub.onDOMReady, pub);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, debug */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.ReliableBehavior
* This is a behavior that tries to make the underlying transport reliable by using acknowledgements.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The behaviors configuration.
*/
easyXDM.stack.ReliableBehavior = function(config){
var pub, // the public interface
callback; // the callback to execute when we have a confirmed success/failure
var idOut = 0, idIn = 0, currentMessage = "";
return (pub = {
incoming: function(message, origin){
var indexOf = message.indexOf("_"), ack = message.substring(0, indexOf).split(",");
message = message.substring(indexOf + 1);
if (ack[0] == idOut) {
currentMessage = "";
if (callback) {
callback(true);
}
}
if (message.length > 0) {
pub.down.outgoing(ack[1] + "," + idOut + "_" + currentMessage, origin);
if (idIn != ack[1]) {
idIn = ack[1];
pub.up.incoming(message, origin);
}
}
},
outgoing: function(message, origin, fn){
currentMessage = message;
callback = fn;
pub.down.outgoing(idIn + "," + (++idOut) + "_" + message, origin);
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, debug, undef, removeFromStack*/
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.QueueBehavior
* This is a behavior that enables queueing of messages. <br/>
* It will buffer incoming messages and dispach these as fast as the underlying transport allows.
* This will also fragment/defragment messages so that the outgoing message is never bigger than the
* set length.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The behaviors configuration. Optional.
* @cfg {Number} maxLength The maximum length of each outgoing message. Set this to enable fragmentation.
*/
easyXDM.stack.QueueBehavior = function(config){
var pub, queue = [], waiting = true, incoming = "", destroying, maxLength = 0, lazy = false, doFragment = false;
function dispatch(){
if (config.remove && queue.length === 0) {
removeFromStack(pub);
return;
}
if (waiting || queue.length === 0 || destroying) {
return;
}
waiting = true;
var message = queue.shift();
pub.down.outgoing(message.data, message.origin, function(success){
waiting = false;
if (message.callback) {
setTimeout(function(){
message.callback(success);
}, 0);
}
dispatch();
});
}
return (pub = {
init: function(){
if (undef(config)) {
config = {};
}
if (config.maxLength) {
maxLength = config.maxLength;
doFragment = true;
}
if (config.lazy) {
lazy = true;
}
else {
pub.down.init();
}
},
callback: function(success){
waiting = false;
var up = pub.up; // in case dispatch calls removeFromStack
dispatch();
up.callback(success);
},
incoming: function(message, origin){
if (doFragment) {
var indexOf = message.indexOf("_"), seq = parseInt(message.substring(0, indexOf), 10);
incoming += message.substring(indexOf + 1);
if (seq === 0) {
if (config.encode) {
incoming = decodeURIComponent(incoming);
}
pub.up.incoming(incoming, origin);
incoming = "";
}
}
else {
pub.up.incoming(message, origin);
}
},
outgoing: function(message, origin, fn){
if (config.encode) {
message = encodeURIComponent(message);
}
var fragments = [], fragment;
if (doFragment) {
// fragment into chunks
while (message.length !== 0) {
fragment = message.substring(0, maxLength);
message = message.substring(fragment.length);
fragments.push(fragment);
}
// enqueue the chunks
while ((fragment = fragments.shift())) {
queue.push({
data: fragments.length + "_" + fragment,
origin: origin,
callback: fragments.length === 0 ? fn : null
});
}
}
else {
queue.push({
data: message,
origin: origin,
callback: fn
});
}
if (lazy) {
pub.down.init();
}
else {
dispatch();
}
},
destroy: function(){
destroying = true;
pub.down.destroy();
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, undef, debug */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.VerifyBehavior
* This behavior will verify that communication with the remote end is possible, and will also sign all outgoing,
* and verify all incoming messages. This removes the risk of someone hijacking the iframe to send malicious messages.
* @namespace easyXDM.stack
* @constructor
* @param {Object} config The behaviors configuration.
* @cfg {Boolean} initiate If the verification should be initiated from this end.
*/
easyXDM.stack.VerifyBehavior = function(config){
var pub, mySecret, theirSecret, verified = false;
function startVerification(){
mySecret = Math.random().toString(16).substring(2);
pub.down.outgoing(mySecret);
}
return (pub = {
incoming: function(message, origin){
var indexOf = message.indexOf("_");
if (indexOf === -1) {
if (message === mySecret) {
pub.up.callback(true);
}
else if (!theirSecret) {
theirSecret = message;
if (!config.initiate) {
startVerification();
}
pub.down.outgoing(message);
}
}
else {
if (message.substring(0, indexOf) === theirSecret) {
pub.up.incoming(message.substring(indexOf + 1), origin);
}
}
},
outgoing: function(message, origin, fn){
pub.down.outgoing(mySecret + "_" + message, origin, fn);
},
callback: function(success){
if (config.initiate) {
startVerification();
}
}
});
};
/*jslint evil: true, browser: true, immed: true, passfail: true, undef: true, newcap: true*/
/*global easyXDM, window, escape, unescape, undef, getJSON, debug, emptyFn, isArray */
//
// easyXDM
// http://easyxdm.net/
// Copyright(c) 2009-2011, Øyvind Sean Kinsey, oyvind@kinsey.no.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
/**
* @class easyXDM.stack.RpcBehavior
* This uses JSON-RPC 2.0 to expose local methods and to invoke remote methods and have responses returned over the the string based transport stack.<br/>
* Exposed methods can return values synchronous, asyncronous, or bet set up to not return anything.
* @namespace easyXDM.stack
* @constructor
* @param {Object} proxy The object to apply the methods to.
* @param {Object} config The definition of the local and remote interface to implement.
* @cfg {Object} local The local interface to expose.
* @cfg {Object} remote The remote methods to expose through the proxy.
* @cfg {Object} serializer The serializer to use for serializing and deserializing the JSON. Should be compatible with the HTML5 JSON object. Optional, will default to JSON.
*/
easyXDM.stack.RpcBehavior = function(proxy, config){
var pub, serializer = config.serializer || getJSON();
var _callbackCounter = 0, _callbacks = {};
/**
* Serializes and sends the message
* @private
* @param {Object} data The JSON-RPC message to be sent. The jsonrpc property will be added.
*/
function _send(data){
data.jsonrpc = "2.0";
pub.down.outgoing(serializer.stringify(data));
}
/**
* Creates a method that implements the given definition
* @private
* @param {Object} The method configuration
* @param {String} method The name of the method
* @return {Function} A stub capable of proxying the requested method call
*/
function _createMethod(definition, method){
var slice = Array.prototype.slice;
return function(){
var l = arguments.length, callback, message = {
method: method
};
if (l > 0 && typeof arguments[l - 1] === "function") {
//with callback, procedure
if (l > 1 && typeof arguments[l - 2] === "function") {
// two callbacks, success and error
callback = {
success: arguments[l - 2],
error: arguments[l - 1]
};
message.params = slice.call(arguments, 0, l - 2);
}
else {
// single callback, success
callback = {
success: arguments[l - 1]
};
message.params = slice.call(arguments, 0, l - 1);
}
_callbacks["" + (++_callbackCounter)] = callback;
message.id = _callbackCounter;
}
else {
// no callbacks, a notification
message.params = slice.call(arguments, 0);
}
if (definition.namedParams && message.params.length === 1) {
message.params = message.params[0];
}
// Send the method request
_send(message);
};
}
/**
* Executes the exposed method
* @private
* @param {String} method The name of the method
* @param {Number} id The callback id to use
* @param {Function} method The exposed implementation
* @param {Array} params The parameters supplied by the remote end
*/
function _executeMethod(method, id, fn, params){
if (!fn) {
if (id) {
_send({
id: id,
error: {
code: -32601,
message: "Procedure not found."
}
});
}
return;
}
var success, error;
if (id) {
success = function(result){
success = emptyFn;
_send({
id: id,
result: result
});
};
error = function(message, data){
error = emptyFn;
var msg = {
id: id,
error: {
code: -32099,
message: message
}
};
if (data) {
msg.error.data = data;
}
_send(msg);
};
}
else {
success = error = emptyFn;
}
// Call local method
if (!isArray(params)) {
params = [params];
}
try {
var result = fn.method.apply(fn.scope, params.concat([success, error]));
if (!undef(result)) {
success(result);
}
}
catch (ex1) {
error(ex1.message);
}
}
return (pub = {
incoming: function(message, origin){
var data = serializer.parse(message);
if (data.method) {
// A method call from the remote end
if (config.handle) {
config.handle(data, _send);
}
else {
_executeMethod(data.method, data.id, config.local[data.method], data.params);
}
}
else {
// A method response from the other end
var callback = _callbacks[data.id];
if (data.error) {
if (callback.error) {
callback.error(data.error);
}
}
else if (callback.success) {
callback.success(data.result);
}
delete _callbacks[data.id];
}
},
init: function(){
if (config.remote) {
// Implement the remote sides exposed methods
for (var method in config.remote) {
if (config.remote.hasOwnProperty(method)) {
proxy[method] = _createMethod(config.remote[method], method);
}
}
}
pub.down.init();
},
destroy: function(){
for (var method in config.remote) {
if (config.remote.hasOwnProperty(method) && proxy.hasOwnProperty(method)) {
delete proxy[method];
}
}
pub.down.destroy();
}
});
};
global.easyXDM = easyXDM;
})(window, document, location, window.setTimeout, decodeURIComponent, encodeURIComponent);
/*!
* F2 v1.3.2 11-18-2013
* Copyright (c) 2013 Markit On Demand, Inc. http://www.openf2.org
*
* "F2" is 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.
*
* Please note that F2 ("Software") may contain third party material that Markit
* On Demand Inc. has a license to use and include within the Software (the
* "Third Party Material"). A list of the software comprising the Third Party Material
* and the terms and conditions under which such Third Party Material is distributed
* are reproduced in the ThirdPartyMaterial.md file available at:
*
* https://github.com/OpenF2/F2/blob/master/ThirdPartyMaterial.md
*
* The inclusion of the Third Party Material in the Software does not grant, provide
* nor result in you having acquiring any rights whatsoever, other than as stipulated
* in the terms and conditions related to the specific Third Party Material, if any.
*
*/
var F2;
/**
* Open F2
* @module f2
* @main f2
*/
F2 = (function() {
/**
* Abosolutizes a relative URL
* @method _absolutizeURI
* @private
* @param {e.g., location.href} base
* @param {URL to absolutize} href
* @returns {string} URL
* Source: https://gist.github.com/Yaffle/1088850
* Tests: http://skew.org/uri/uri_tests.html
*/
var _absolutizeURI = function(base, href) {// RFC 3986
function removeDotSegments(input) {
var output = [];
input.replace(/^(\.\.?(\/|$))+/, '')
.replace(/\/(\.(\/|$))+/g, '/')
.replace(/\/\.\.$/, '/../')
.replace(/\/?[^\/]*/g, function (p) {
if (p === '/..') {
output.pop();
} else {
output.push(p);
}
});
return output.join('').replace(/^\//, input.charAt(0) === '/' ? '/' : '');
}
href = _parseURI(href || '');
base = _parseURI(base || '');
return !href || !base ? null : (href.protocol || base.protocol) +
(href.protocol || href.authority ? href.authority : base.authority) +
removeDotSegments(href.protocol || href.authority || href.pathname.charAt(0) === '/' ? href.pathname : (href.pathname ? ((base.authority && !base.pathname ? '/' : '') + base.pathname.slice(0, base.pathname.lastIndexOf('/') + 1) + href.pathname) : base.pathname)) +
(href.protocol || href.authority || href.pathname ? href.search : (href.search || base.search)) +
href.hash;
};
/**
* Parses URI
* @method _parseURI
* @private
* @param {The URL to parse} url
* @returns {Parsed URL} string
* Source: https://gist.github.com/Yaffle/1088850
* Tests: http://skew.org/uri/uri_tests.html
*/
var _parseURI = function(url) {
var m = String(url).replace(/^\s+|\s+$/g, '').match(/^([^:\/?#]+:)?(\/\/(?:[^:@]*(?::[^:@]*)?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
// authority = '//' + user + ':' + pass '@' + hostname + ':' port
return (m ? {
href : m[0] || '',
protocol : m[1] || '',
authority: m[2] || '',
host : m[3] || '',
hostname : m[4] || '',
port : m[5] || '',
pathname : m[6] || '',
search : m[7] || '',
hash : m[8] || ''
} : null);
};
return {
/**
* A function to pass into F2.stringify which will prevent circular
* reference errors when serializing objects
* @method appConfigReplacer
*/
appConfigReplacer: function(key, value) {
if (key == 'root' || key == 'ui' || key == 'height') {
return undefined;
} else {
return value;
}
},
/**
* The apps namespace is a place for app developers to put the javascript
* class that is used to initialize their app. The javascript classes should
* be namepaced with the {{#crossLink "F2.AppConfig"}}{{/crossLink}}.appId.
* It is recommended that the code be placed in a closure to help keep the
* global namespace clean.
*
* If the class has an 'init' function, that function will be called
* automatically by F2.
* @property Apps
* @type object
* @example
* F2.Apps["com_example_helloworld"] = (function() {
* var App_Class = function(appConfig, appContent, root) {
* this._app = appConfig; // the F2.AppConfig object
* this._appContent = appContent // the F2.AppManifest.AppContent object
* this.$root = $(root); // the root DOM Element that contains this app
* }
*
* App_Class.prototype.init = function() {
* // perform init actions
* }
*
* return App_Class;
* })();
* @example
* F2.Apps["com_example_helloworld"] = function(appConfig, appContent, root) {
* return {
* init:function() {
* // perform init actions
* }
* };
* };
* @for F2
*/
Apps: {},
/**
* Creates a namespace on F2 and copies the contents of an object into
* that namespace optionally overwriting existing properties.
* @method extend
* @param {string} ns The namespace to create. Pass a falsy value to
* add properties to the F2 namespace directly.
* @param {object} obj The object to copy into the namespace.
* @param {bool} overwrite True if object properties should be overwritten
* @return {object} The created object
*/
extend: function (ns, obj, overwrite) {
var isFunc = typeof obj === 'function';
var parts = ns ? ns.split('.') : [];
var parent = this;
obj = obj || {};
// ignore leading global
if (parts[0] === 'F2') {
parts = parts.slice(1);
}
// create namespaces
for (var i = 0, len = parts.length; i < len; i++) {
if (!parent[parts[i]]) {
parent[parts[i]] = isFunc && i + 1 == len ? obj : {};
}
parent = parent[parts[i]];
}
// copy object into namespace
if (!isFunc) {
for (var prop in obj) {
if (typeof parent[prop] === 'undefined' || overwrite) {
parent[prop] = obj[prop];
}
}
}
return parent;
},
/**
* Generates a somewhat random id
* @method guid
* @return {string} A random id
* @for F2
*/
guid: function() {
var S4 = function() {
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
};
return (S4()+S4()+'-'+S4()+'-'+S4()+'-'+S4()+'-'+S4()+S4()+S4());
},
/**
* Search for a value within an array.
* @method inArray
* @param {object} value The value to search for
* @param {Array} array The array to search
* @return {bool} True if the item is in the array
*/
inArray: function(value, array) {
return jQuery.inArray(value, array) > -1;
},
/**
* Tests a URL to see if it's on the same domain (local) or not
* @method isLocalRequest
* @param {URL to test} url
* @returns {bool} Whether the URL is local or not
* Derived from: https://github.com/jquery/jquery/blob/master/src/ajax.js
*/
isLocalRequest: function(url){
var rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,
urlLower = url.toLowerCase(),
parts = rurl.exec( urlLower ),
ajaxLocation,
ajaxLocParts;
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement('a');
ajaxLocation.href = '';
ajaxLocation = ajaxLocation.href;
}
ajaxLocation = ajaxLocation.toLowerCase();
// uh oh, the url must be relative
// make it fully qualified and re-regex url
if (!parts){
urlLower = _absolutizeURI(ajaxLocation,urlLower).toLowerCase();
parts = rurl.exec( urlLower );
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation ) || [];
// do hostname and protocol and port of manifest URL match location.href? (a "local" request on the same domain)
var matched = !(parts &&
(parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] ||
(parts[ 3 ] || (parts[ 1 ] === 'http:' ? '80' : '443')) !==
(ajaxLocParts[ 3 ] || (ajaxLocParts[ 1 ] === 'http:' ? '80' : '443'))));
return matched;
},
/**
* Utility method to determine whether or not the argument passed in is or is not a native dom node.
* @method isNativeDOMNode
* @param {object} testObject The object you want to check as native dom node.
* @return {bool} Returns true if the object passed is a native dom node.
*/
isNativeDOMNode: function(testObject) {
var bIsNode = (
typeof Node === 'object' ? testObject instanceof Node :
testObject && typeof testObject === 'object' && typeof testObject.nodeType === 'number' && typeof testObject.nodeName === 'string'
);
var bIsElement = (
typeof HTMLElement === 'object' ? testObject instanceof HTMLElement : //DOM2
testObject && typeof testObject === 'object' && testObject.nodeType === 1 && typeof testObject.nodeName === 'string'
);
return (bIsNode || bIsElement);
},
/**
* A utility logging function to write messages or objects to the browser console. This is a proxy for the [`console` API](https://developers.google.com/chrome-developer-tools/docs/console).
* @method log
* @param {object|string} Object/Method An object to be logged _or_ a `console` API method name, such as `warn` or `error`. All of the console method names are [detailed in the Chrome docs](https://developers.google.com/chrome-developer-tools/docs/console-api).
* @param {object} [obj2]* An object to be logged
* @example
//Pass any object (string, int, array, object, bool) to .log()
F2.log('foo');
F2.log(myArray);
//Use a console method name as the first argument.
F2.log('error', err);
F2.log('info', 'The session ID is ' + sessionId);
* Some code derived from [HTML5 Boilerplate console plugin](https://github.com/h5bp/html5-boilerplate/blob/master/js/plugins.js)
*/
log: function() {
var _log;
var _logMethod = 'log';
var method;
var noop = function () { };
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
var length = methods.length;
var console = (window.console = window.console || {});
var args;
while (length--) {
method = methods[length];
// Only stub undefined methods.
if (!console[method]) {
console[method] = noop;
}
//if first arg is a console function, use it.
//defaults to console.log()
if (arguments && arguments.length > 1 && arguments[0] == method){
_logMethod = method;
//remove console func from args
args = Array.prototype.slice.call(arguments, 1);
}
}
if (Function.prototype.bind) {
_log = Function.prototype.bind.call(console[_logMethod], console);
} else {
_log = function() {
Function.prototype.apply.call(console[_logMethod], console, (args || arguments));
};
}
_log.apply(this, (args || arguments));
},
/**
* Wrapper to convert a JSON string to an object
* @method parse
* @param {string} str The JSON string to convert
* @return {object} The parsed object
*/
parse: function(str) {
return JSON.parse(str);
},
/**
* Wrapper to convert an object to JSON
*
* **Note: When using F2.stringify on an F2.AppConfig object, it is
* recommended to pass F2.appConfigReplacer as the replacer function in
* order to prevent circular serialization errors.**
* @method stringify
* @param {object} value The object to convert
* @param {function|Array} replacer An optional parameter that determines
* how object values are stringified for objects. It can be a function or an
* array of strings.
* @param {int|string} space An optional parameter that specifies the
* indentation of nested structures. If it is omitted, the text will be
* packed without extra whitespace. If it is a number, it will specify the
* number of spaces to indent at each level. If it is a string (such as '\t'
* or ' '), it contains the characters used to indent at each level.
* @return {string} The JSON string
*/
stringify: function(value, replacer, space) {
return JSON.stringify(value, replacer, space);
},
/**
* Function to get the F2 version number
* @method version
* @return {string} F2 version number
*/
version: function() { return '1.3.2'; }
};
})();
/**
* The new `AppHandlers` functionality provides Container Developers a higher level of control over configuring app rendering and interaction.
*
*<p class="alert alert-block alert-warning">
*The addition of `F2.AppHandlers` replaces the previous {{#crossLink "F2.ContainerConfig"}}{{/crossLink}} properties `beforeAppRender`, `appRender`, and `afterAppRender`. These methods were deprecated—but not removed—in version 1.2. They will be permanently removed in a future version of F2.
*</p>
*
*<p class="alert alert-block alert-info">
*Starting with F2 version 1.2, `AppHandlers` is the preferred method for Container Developers to manage app layout.
*</p>
*
* ### Order of Execution
*
* **App Rendering**
*
* 0. {{#crossLink "F2/registerApps"}}F2.registerApps(){{/crossLink}} method is called by the Container Developer and the following methods are run for *each* {{#crossLink "F2.AppConfig"}}{{/crossLink}} passed.
* 1. **'appCreateRoot'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_CREATE\_ROOT*) handlers are fired in the order they were attached.
* 2. **'appRenderBefore'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER\_BEFORE*) handlers are fired in the order they were attached.
* 3. Each app's `manifestUrl` is requested asynchronously; on success the following methods are fired.
* 3. **'appRender'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER*) handlers are fired in the order they were attached.
* 4. **'appRenderAfter'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_RENDER\_AFTER*) handlers are fired in the order they were attached.
*
*
* **App Removal**
* 0. {{#crossLink "F2/removeApp"}}F2.removeApp(){{/crossLink}} with a specific {{#crossLink "F2.AppConfig/instanceId "}}{{/crossLink}} or {{#crossLink "F2/removeAllApps"}}F2.removeAllApps(){{/crossLink}} method is called by the Container Developer and the following methods are run.
* 1. **'appDestroyBefore'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY\_BEFORE*) handlers are fired in the order they were attached.
* 2. **'appDestroy'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY*) handlers are fired in the order they were attached.
* 3. **'appDestroyAfter'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_DESTROY\_AFTER*) handlers are fired in the order they were attached.
*
* **Error Handling**
* 0. **'appScriptLoadFailed'** (*{{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.APP\_SCRIPT\_LOAD\_FAILED*) handlers are fired in the order they were attached.
*
* @class F2.AppHandlers
*/
F2.extend('AppHandlers', (function() {
// the hidden token that we will check against every time someone tries to add, remove, fire handler
var _ct = F2.guid();
var _f2t = F2.guid();
var _handlerCollection = {
appCreateRoot: [],
appRenderBefore: [],
appDestroyBefore: [],
appRenderAfter: [],
appDestroyAfter: [],
appRender: [],
appDestroy: [],
appScriptLoadFailed: []
};
var _defaultMethods = {
appRender: function(appConfig, appHtml)
{
var $root = null;
// if no app root is defined use the app's outer most node
if(!F2.isNativeDOMNode(appConfig.root))
{
appConfig.root = jQuery(appHtml).get(0);
// get a handle on the root in jQuery
$root = jQuery(appConfig.root);
}
else
{
// get a handle on the root in jQuery
$root = jQuery(appConfig.root);
// append the app html to the root
$root.append(appHtml);
}
// append the root to the body by default.
jQuery('body').append($root);
},
appDestroy: function(appInstance)
{
// call the apps destroy method, if it has one
if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function')
{
appInstance.app.destroy();
}
// warn the Container and App Developer that even though they have a destroy method it hasn't been
else if(appInstance && appInstance.app && appInstance.app.destroy)
{
F2.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.');
}
// fade out and remove the root
jQuery(appInstance.config.root).fadeOut(500, function() {
jQuery(this).remove();
});
}
};
var _createHandler = function(token, sNamespace, func_or_element, bDomNodeAppropriate)
{
// will throw an exception and stop execution if the token is invalid
_validateToken(token);
// create handler structure. Not all arguments properties will be populated/used.
var handler = {
func: (typeof(func_or_element)) ? func_or_element : null,
namespace: sNamespace,
domNode: (F2.isNativeDOMNode(func_or_element)) ? func_or_element : null
};
if(!handler.func && !handler.domNode)
{
throw ('Invalid or null argument passed. Handler will not be added to collection. A valid dom element or callback function is required.');
}
if(handler.domNode && !bDomNodeAppropriate)
{
throw ('Invalid argument passed. Handler will not be added to collection. A callback function is required for this event type.');
}
return handler;
};
var _validateToken = function(sToken)
{
// check token against F2 and container
if(_ct != sToken && _f2t != sToken) { throw ('Invalid token passed. Please verify that you have correctly received and stored token from F2.AppHandlers.getToken().'); }
};
var _removeHandler = function(sToken, eventKey, sNamespace)
{
// will throw an exception and stop execution if the token is invalid
_validateToken(sToken);
if(!sNamespace && !eventKey)
{
return;
}
// remove by event key
else if(!sNamespace && eventKey)
{
_handlerCollection[eventKey] = [];
}
// remove by namespace only
else if(sNamespace && !eventKey)
{
sNamespace = sNamespace.toLowerCase();
for(var currentEventKey in _handlerCollection)
{
var eventCollection = _handlerCollection[currentEventKey];
var newEvents = [];
for(var i = 0, ec = eventCollection.length; i < ec; i++)
{
var currentEventHandler = eventCollection[i];
if(currentEventHandler)
{
if(!currentEventHandler.namespace || currentEventHandler.namespace.toLowerCase() != sNamespace)
{
newEvents.push(currentEventHandler);
}
}
}
eventCollection = newEvents;
}
}
else if(sNamespace && _handlerCollection[eventKey])
{
sNamespace = sNamespace.toLowerCase();
var newHandlerCollection = [];
for(var iCounter = 0, hc = _handlerCollection[eventKey].length; iCounter < hc; iCounter++)
{
var currentHandler = _handlerCollection[eventKey][iCounter];
if(currentHandler)
{
if(!currentHandler.namespace || currentHandler.namespace.toLowerCase() != sNamespace)
{
newHandlerCollection.push(currentHandler);
}
}
}
_handlerCollection[eventKey] = newHandlerCollection;
}
};
return {
/**
* Allows Container Developer to retrieve a unique token which must be passed to
* all `on` and `off` methods. This function will self destruct and can only be called
* one time. Container Developers must store the return value inside of a closure.
* @method getToken
**/
getToken: function()
{
// delete this method for security that way only the container has access to the token 1 time.
// kind of Ethan Hunt-ish, this message will self destruct immediately.
delete this.getToken;
// return the token, which we validate against.
return _ct;
},
/**
* Allows F2 to get a token internally. Token is required to call {{#crossLink "F2.AppHandlers/\_\_trigger:method"}}{{/crossLink}}.
* This function will self destruct to eliminate other sources from using the {{#crossLink "F2.AppHandlers/\_\_trigger:method"}}{{/crossLink}}
* and additional internal methods.
* @method __f2GetToken
* @private
**/
__f2GetToken: function()
{
// delete this method for security that way only the F2 internally has access to the token 1 time.
// kind of Ethan Hunt-ish, this message will self destruct immediately.
delete this.__f2GetToken;
// return the token, which we validate against.
return _f2t;
},
/**
* Allows F2 to trigger specific events internally.
* @method __trigger
* @private
* @chainable
* @param {String} token The token received from {{#crossLink "F2.AppHandlers/\_\_f2GetToken:method"}}{{/crossLink}}.
* @param {String} eventKey The event to fire. The complete list of event keys is available in {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
**/
__trigger: function(token, eventKey) // additional arguments will likely be passed
{
// will throw an exception and stop execution if the token is invalid
if(token != _f2t)
{
throw ('Token passed is invalid. Only F2 is allowed to call F2.AppHandlers.__trigger().');
}
if(_handlerCollection && _handlerCollection[eventKey])
{
// create a collection of arguments that are safe to pass to the callback.
var passableArgs = [];
// populate that collection with all arguments except token and eventKey
for(var i = 2, j = arguments.length; i < j; i++)
{
passableArgs.push(arguments[i]);
}
if(_handlerCollection[eventKey].length === 0 && _defaultMethods[eventKey])
{
_defaultMethods[eventKey].apply(F2, passableArgs);
return this;
}
else if(_handlerCollection[eventKey].length === 0 && !_handlerCollection[eventKey])
{
return this;
}
// fire all event listeners in the order that they were added.
for(var iCounter = 0, hcl = _handlerCollection[eventKey].length; iCounter < hcl; iCounter++)
{
var handler = _handlerCollection[eventKey][iCounter];
// appRender where root is already defined
if (handler.domNode && arguments[2] && arguments[2].root && arguments[3])
{
var $appRoot = jQuery(arguments[2].root).append(arguments[3]);
jQuery(handler.domNode).append($appRoot);
}
else if (handler.domNode && arguments[2] && !arguments[2].root && arguments[3])
{
// set the root to the actual HTML of the app
arguments[2].root = jQuery(arguments[3]).get(0);
// appends the root to the dom node specified
jQuery(handler.domNode).append(arguments[2].root);
}
else
{
handler.func.apply(F2, passableArgs);
}
}
}
else
{
throw ('Invalid EventKey passed. Check your inputs and try again.');
}
return this;
},
/**
* Allows Container Developer to easily tell all apps to render in a specific location. Only valid for eventType `appRender`.
* @method on
* @chainable
* @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}.
* @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. The namespace is useful for removal
* purposes. At this time it does not affect when an event is fired. Complete list of event keys available in
* {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
* @params {HTMLElement} element Specific DOM element to which app gets appended.
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* 'appRender',
* document.getElementById('my_app')
* );
*
* Or:
* @example
* F2.AppHandlers.on(
* _token,
* 'appRender.myNamespace',
* document.getElementById('my_app')
* );
**/
/**
* Allows Container Developer to add listener method that will be triggered when a specific event occurs.
* @method on
* @chainable
* @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}.
* @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. The namespace is useful for removal
* purposes. At this time it does not affect when an event is fired. Complete list of event keys available in
* {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
* @params {Function} listener A function that will be triggered when a specific event occurs. For detailed argument definition refer to {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* 'appRenderBefore'
* function() { F2.log('before app rendered!'); }
* );
*
* Or:
* @example
* F2.AppHandlers.on(
* _token,
* 'appRenderBefore.myNamespace',
* function() { F2.log('before app rendered!'); }
* );
**/
on: function(token, eventKey, func_or_element)
{
var sNamespace = null;
if(!eventKey)
{
throw ('eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.');
}
// we need to check the key for a namespace
if(eventKey.indexOf('.') > -1)
{
var arData = eventKey.split('.');
eventKey = arData[0];
sNamespace = arData[1];
}
if(_handlerCollection && _handlerCollection[eventKey])
{
_handlerCollection[eventKey].push(
_createHandler(
token,
sNamespace,
func_or_element,
(eventKey == 'appRender')
)
);
}
else
{
throw ('Invalid EventKey passed. Check your inputs and try again.');
}
return this;
},
/**
* Allows Container Developer to remove listener methods for specific events
* @method off
* @chainable
* @param {String} token The token received from {{#crossLink "F2.AppHandlers/getToken:method"}}{{/crossLink}}.
* @param {String} eventKey{.namespace} The event key used to determine which event to attach the listener to. If no namespace is provided all
* listeners for the specified event type will be removed.
* Complete list available in {{#crossLink "F2.Constants.AppHandlers"}}{{/crossLink}}.
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.off(_token,'appRenderBefore');
*
**/
off: function(token, eventKey)
{
var sNamespace = null;
if(!eventKey)
{
throw ('eventKey must be of type string and not null. For available appHandlers check F2.Constants.AppHandlers.');
}
// we need to check the key for a namespace
if(eventKey.indexOf('.') > -1)
{
var arData = eventKey.split('.');
eventKey = arData[0];
sNamespace = arData[1];
}
if(_handlerCollection && _handlerCollection[eventKey])
{
_removeHandler(
token,
eventKey,
sNamespace
);
}
else
{
throw ('Invalid EventKey passed. Check your inputs and try again.');
}
return this;
}
};
})());
F2.extend('Constants', {
/**
* A convenient collection of all available appHandler events.
* @class F2.Constants.AppHandlers
**/
AppHandlers: (function()
{
return {
/**
* Equivalent to `appCreateRoot`. Identifies the create root method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} )
* @property APP_CREATE_ROOT
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_CREATE_ROOT,
* function(appConfig)
* {
* // If you want to create a custom root. By default F2 uses the app's outermost HTML element.
* // the app's html is not available until after the manifest is retrieved so this logic occurs in F2.Constants.AppHandlers.APP_RENDER
* appConfig.root = jQuery('<section></section>').get(0);
* }
* );
*/
APP_CREATE_ROOT: 'appCreateRoot',
/**
* Equivalent to `appRenderBefore`. Identifies the before app render method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} )
* @property APP_RENDER_BEFORE
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_RENDER_BEFORE,
* function(appConfig)
* {
* F2.log(appConfig);
* }
* );
*/
APP_RENDER_BEFORE: 'appRenderBefore',
/**
* Equivalent to `appRender`. Identifies the app render method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}}, [appHtml](../../app-development.html#app-design) )
* @property APP_RENDER
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_RENDER,
* function(appConfig, appHtml)
* {
* var $root = null;
*
* // if no app root is defined use the app's outer most node
* if(!F2.isNativeDOMNode(appConfig.root))
* {
* appConfig.root = jQuery(appHtml).get(0);
* // get a handle on the root in jQuery
* $root = jQuery(appConfig.root);
* }
* else
* {
* // get a handle on the root in jQuery
* $root = jQuery(appConfig.root);
*
* // append the app html to the root
* $root.append(appHtml);
* }
*
* // append the root to the body by default.
* jQuery('body').append($root);
* }
* );
*/
APP_RENDER: 'appRender',
/**
* Equivalent to `appRenderAfter`. Identifies the after app render method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}} )
* @property APP_RENDER_AFTER
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_RENDER_AFTER,
* function(appConfig)
* {
* F2.log(appConfig);
* }
* );
*/
APP_RENDER_AFTER: 'appRenderAfter',
/**
* Equivalent to `appDestroyBefore`. Identifies the before app destroy method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( appInstance )
* @property APP_DESTROY_BEFORE
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_DESTROY_BEFORE,
* function(appInstance)
* {
* F2.log(appInstance);
* }
* );
*/
APP_DESTROY_BEFORE: 'appDestroyBefore',
/**
* Equivalent to `appDestroy`. Identifies the app destroy method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( appInstance )
* @property APP_DESTROY
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_DESTROY,
* function(appInstance)
* {
* // call the apps destroy method, if it has one
* if(appInstance && appInstance.app && appInstance.app.destroy && typeof(appInstance.app.destroy) == 'function')
* {
* appInstance.app.destroy();
* }
* else if(appInstance && appInstance.app && appInstance.app.destroy)
* {
* F2.log(appInstance.config.appId + ' has a destroy property, but destroy is not of type function and as such will not be executed.');
* }
*
* // fade out and remove the root
* jQuery(appInstance.config.root).fadeOut(500, function() {
* jQuery(this).remove();
* });
* }
* );
*/
APP_DESTROY: 'appDestroy',
/**
* Equivalent to `appDestroyAfter`. Identifies the after app destroy method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( appInstance )
* @property APP_DESTROY_AFTER
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_DESTROY_AFTER,
* function(appInstance)
* {
* F2.log(appInstance);
* }
* );
*/
APP_DESTROY_AFTER: 'appDestroyAfter',
/**
* Equivalent to `appScriptLoadFailed`. Identifies the app script load failed method for use in AppHandlers.on/off.
* When bound using {{#crossLink "F2.AppHandlers/on"}}F2.AppHandlers.on(){{/crossLink}} the listener function passed will receive the
* following argument(s): ( {{#crossLink "F2.AppConfig"}}appConfig{{/crossLink}}, scriptInfo )
* @property APP_SCRIPT_LOAD_FAILED
* @type string
* @static
* @final
* @example
* var _token = F2.AppHandlers.getToken();
* F2.AppHandlers.on(
* _token,
* F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,
* function(appConfig, scriptInfo)
* {
* F2.log(appConfig.appId);
* }
* );
*/
APP_SCRIPT_LOAD_FAILED: 'appScriptLoadFailed'
};
})()
});
/**
* Class stubs for documentation purposes
* @main F2
*/
F2.extend('', {
/**
* The App Class is an optional class that can be namespaced onto the
* {{#crossLink "F2\Apps"}}{{/crossLink}} namespace. The
* [F2 Docs](../../app-development.html#app-class)
* has more information on the usage of the App Class.
* @class F2.App
* @constructor
* @param {F2.AppConfig} appConfig The F2.AppConfig object for the app
* @param {F2.AppManifest.AppContent} appContent The F2.AppManifest.AppContent
* object
* @param {Element} root The root DOM Element for the app
*/
App: function(appConfig, appContent, root) {
return {
/**
* An optional init function that will automatically be called when
* F2.{{#crossLink "F2\registerApps"}}{{/crossLink}} is called.
* @method init
* @optional
*/
init:function() {}
};
},
/**
* The AppConfig object represents an app's meta data
* @class F2.AppConfig
*/
AppConfig: {
/**
* The unique ID of the app. More information can be found
* [here](../../app-development.html#f2-appid)
* @property appId
* @type string
* @required
*/
appId: '',
/**
* An object that represents the context of an app
* @property context
* @type object
*/
context: {},
/**
* True if the app should be requested in a single request with other apps.
* @property enableBatchRequests
* @type bool
* @default false
*/
enableBatchRequests: false,
/**
* The height of the app. The initial height will be pulled from
* the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object, but later
* modified by calling
* F2.UI.{{#crossLink "F2.UI/updateHeight"}}{{/crossLink}}. This is used
* for secure apps to be able to set the initial height of the iframe.
* @property height
* @type int
*/
height: 0,
/**
* The unique runtime ID of the app.
*
* **This property is populated during the
* F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process**
* @property instanceId
* @type string
*/
instanceId: '',
/**
* True if the app will be loaded in an iframe. This property
* will be true if the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object
* sets isSecure = true. It will also be true if the
* [container](../../container-development.html) has made the decision to
* run apps in iframes.
* @property isSecure
* @type bool
* @default false
*/
isSecure: false,
/**
* The url to retrieve the {{#crossLink "F2.AppManifest"}}{{/crossLink}}
* object.
* @property manifestUrl
* @type string
* @required
*/
manifestUrl: '',
/**
* The recommended maximum width in pixels that this app should be run.
* **It is up to the [container](../../container-development.html) to
* implement the logic to prevent an app from being run when the maxWidth
* requirements are not met.**
* @property maxWidth
* @type int
*/
maxWidth: 0,
/**
* The recommended minimum grid size that this app should be run. This
* value corresponds to the 12-grid system that is used by the
* [container](../../container-development.html). This property should be
* set by apps that require a certain number of columns in their layout.
* @property minGridSize
* @type int
* @default 4
*/
minGridSize: 4,
/**
* The recommended minimum width in pixels that this app should be run. **It
* is up to the [container](../../container-development.html) to implement
* the logic to prevent an app from being run when the minWidth requirements
* are not met.
* @property minWidth
* @type int
* @default 300
*/
minWidth: 300,
/**
* The name of the app
* @property name
* @type string
* @required
*/
name: '',
/**
* The root DOM element that contains the app
*
* **This property is populated during the
* F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process**
* @property root
* @type Element
*/
root: undefined,
/**
* The instance of F2.UI providing easy access to F2.UI methods
*
* **This property is populated during the
* F2.{{#crossLink "F2/registerApps"}}{{/crossLink}} process**
* @property ui
* @type F2.UI
*/
ui: undefined,
/**
* The views that this app supports. Available views
* are defined in {{#crossLink "F2.Constants.Views"}}{{/crossLink}}. The
* presence of a view can be checked via
* F2.{{#crossLink "F2/inArray"}}{{/crossLink}}:
*
* F2.inArray(F2.Constants.Views.SETTINGS, app.views)
*
* @property views
* @type Array
*/
views: []
},
/**
* The assets needed to render an app on the page
* @class F2.AppManifest
*/
AppManifest: {
/**
* The array of {{#crossLink "F2.AppManifest.AppContent"}}{{/crossLink}}
* objects
* @property apps
* @type Array
* @required
*/
apps: [],
/**
* Any inline javascript tha should initially be run
* @property inlineScripts
* @type Array
* @optional
*/
inlineScripts: [],
/**
* Urls to javascript files required by the app
* @property scripts
* @type Array
* @optional
*/
scripts: [],
/**
* Urls to CSS files required by the app
* @property styles
* @type Array
* @optional
*/
styles: []
},
/**
* The AppContent object
* @class F2.AppManifest.AppContent
**/
AppContent: {
/**
* Arbitrary data to be passed along with the app
* @property data
* @type object
* @optional
*/
data: {},
/**
* The string of HTML representing the app
* @property html
* @type string
* @required
*/
html: '',
/**
* A status message
* @property status
* @type string
* @optional
*/
status: ''
},
/**
* An object containing configuration information for the
* [container](../../container-development.html)
* @class F2.ContainerConfig
*/
ContainerConfig: {
/**
* Allows the [container](../../container-development.html) to override how
* an app's html is inserted into the page. The function should accept an
* {{#crossLink "F2.AppConfig"}}{{/crossLink}} object and also a string of
* html
* @method afterAppRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {string} html The string of html representing the app
* @return {Element} The DOM Element surrounding the app
*/
afterAppRender: function(appConfig, html) {},
/**
* Allows the [container](../../container-development.html) to wrap an app
* in extra html. The function should accept an
* {{#crossLink "F2.AppConfig"}}{{/crossLink}} object and also a string of
* html. The extra html can provide links to edit app settings and remove an
* app from the container. See
* {{#crossLink "F2.Constants.Css"}}{{/crossLink}} for CSS classes that
* should be applied to elements.
* @method appRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {string} html The string of html representing the app
*/
appRender: function(appConfig, html) {},
/**
* Allows the container to render html for an app before the AppManifest for
* an app has loaded. This can be useful if the design calls for loading
* icons to appear for each app before each app is loaded and rendered to
* the page.
* @method beforeAppRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @return {Element} The DOM Element surrounding the app
*/
beforeAppRender: function(appConfig) {},
/**
* True to enable debug mode in F2.js. Adds additional logging, resource cache busting, etc.
* @property debugMode
* @type bool
* @default false
*/
debugMode: false,
/**
* Milliseconds before F2 fires callback on script resource load errors. Due to issue with the way Internet Explorer attaches load events to script elements, the error event doesn't fire.
* @property scriptErrorTimeout
* @type milliseconds
* @default 7000 (7 seconds)
*/
scriptErrorTimeout: 7000,
/**
* Tells the container that it is currently running within
* a secure app page
* @property isSecureAppPage
* @type bool
*/
isSecureAppPage: false,
/**
* Allows the container to specify which page is used when
* loading a secure app. The page must reside on a different domain than the
* container
* @property secureAppPagePath
* @type string
* @for F2.ContainerConfig
*/
secureAppPagePath: '',
/**
* Specifies what views a container will provide buttons
* or links to. Generally, the views will be switched via buttons or links
* in the app's header.
* @property supportedViews
* @type Array
* @required
*/
supportedViews: [],
/**
* An object containing configuration defaults for F2.UI
* @class F2.ContainerConfig.UI
*/
UI: {
/**
* An object containing configuration defaults for the
* F2.UI.{{#crossLink "F2.UI/showMask"}}{{/crossLink}} and
* F2.UI.{{#crossLink "F2.UI/hideMask"}}{{/crossLink}} methods.
* @class F2.ContainerConfig.UI.Mask
*/
Mask: {
/**
* The backround color of the overlay
* @property backgroundColor
* @type string
* @default #FFF
*/
backgroundColor: '#FFF',
/**
* The path to the loading icon
* @property loadingIcon
* @type string
*/
loadingIcon: '',
/**
* The opacity of the background overlay
* @property opacity
* @type int
* @default 0.6
*/
opacity: 0.6,
/**
* Do not use inline styles for mask functinality. Instead classes will
* be applied to the elements and it is up to the container provider to
* implement the class definitions.
* @property useClasses
* @type bool
* @default false
*/
useClasses: false,
/**
* The z-index to use for the overlay
* @property zIndex
* @type int
* @default 2
*/
zIndex: 2
}
},
/**
* Allows the container to fully override how the AppManifest request is
* made inside of F2.
*
* @method xhr
* @param {string} url The manifest url
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}}
* objects
* @param {function} success The function to be called if the request
* succeeds
* @param {function} error The function to be called if the request fails
* @param {function} complete The function to be called when the request
* finishes (after success and error callbacks have been executed)
* @return {XMLHttpRequest} The XMLHttpRequest object (or an object that has
* an `abort` function (such as the jqXHR object in jQuery) to abort the
* request)
*
* @example
* F2.init({
* xhr: function(url, appConfigs, success, error, complete) {
* $.ajax({
* url: url,
* type: 'POST',
* data: {
* params: F2.stringify(appConfigs, F2.appConfigReplacer)
* },
* jsonp: false, // do not put 'callback=' in the query string
* jsonpCallback: F2.Constants.JSONP_CALLBACK + appConfigs[0].appId, // Unique function name
* dataType: 'json',
* success: function(appManifest) {
* // custom success logic
* success(appManifest); // fire success callback
* },
* error: function() {
* // custom error logic
* error(); // fire error callback
* },
* complete: function() {
* // custom complete logic
* complete(); // fire complete callback
* }
* });
* }
* });
*
* @for F2.ContainerConfig
*/
//xhr: function(url, appConfigs, success, error, complete) {},
/**
* Allows the container to override individual parts of the AppManifest
* request. See properties and methods with the `xhr.` prefix.
* @property xhr
* @type Object
*
* @example
* F2.init({
* xhr: {
* url: function(url, appConfigs) {
* return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url);
* }
* }
* });
*/
xhr: {
/**
* Allows the container to override the request data type (JSON or JSONP)
* that is used for the request
* @method xhr.dataType
* @param {string} url The manifest url
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}}
* objects
* @return {string} The request data type that should be used
*
* @example
* F2.init({
* xhr: {
* dataType: function(url) {
* return F2.isLocalRequest(url) ? 'json' : 'jsonp';
* },
* type: function(url) {
* return F2.isLocalRequest(url) ? 'POST' : 'GET';
* }
* }
* });
*/
dataType: function(url, appConfigs) {},
/**
* Allows the container to override the request method that is used (just
* like the `type` parameter to `jQuery.ajax()`.
* @method xhr.type
* @param {string} url The manifest url
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}}
* objects
* @return {string} The request method that should be used
*
* @example
* F2.init({
* xhr: {
* dataType: function(url) {
* return F2.isLocalRequest(url) ? 'json' : 'jsonp';
* },
* type: function(url) {
* return F2.isLocalRequest(url) ? 'POST' : 'GET';
* }
* }
* });
*/
type: function(url, appConfigs) {},
/**
* Allows the container to override the url that is used to request an
* app's F2.{{#crossLink "F2.AppManifest"}}{{/crossLink}}
* @method xhr.url
* @param {string} url The manifest url
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}}
* objects
* @return {string} The url that should be used for the request
*
* @example
* F2.init({
* xhr: {
* url: function(url, appConfigs) {
* return 'http://example.com/proxy.php?url=' + encocdeURIComponent(url);
* }
* }
* });
*/
url: function(url, appConfigs) {}
}
}
});
/**
* Constants used throughout the Open Financial Framework
* @class F2.Constants
* @static
*/
F2.extend('Constants', {
/**
* CSS class constants
* @class F2.Constants.Css
*/
Css: (function() {
/** @private */
var _PREFIX = 'f2-';
return {
/**
* The APP class should be applied to the DOM Element that surrounds the
* entire app, including any extra html that surrounds the APP\_CONTAINER
* that is inserted by the container. See the
* {{#crossLink "F2.ContainerConfig"}}{{/crossLink}} object.
* @property APP
* @type string
* @static
* @final
*/
APP: _PREFIX + 'app',
/**
* The APP\_CONTAINER class should be applied to the outermost DOM Element
* of the app.
* @property APP_CONTAINER
* @type string
* @static
* @final
*/
APP_CONTAINER: _PREFIX + 'app-container',
/**
* The APP\_TITLE class should be applied to the DOM Element that contains
* the title for an app. If this class is not present, then
* F2.UI.{{#crossLink "F2.UI/setTitle"}}{{/crossLink}} will not function.
* @property APP_TITLE
* @type string
* @static
* @final
*/
APP_TITLE: _PREFIX + 'app-title',
/**
* The APP\_VIEW class should be applied to the DOM Element that contains
* a view for an app. The DOM Element should also have a
* {{#crossLink "F2.Constants.Views"}}{{/crossLink}}.DATA_ATTRIBUTE
* attribute that specifies which
* {{#crossLink "F2.Constants.Views"}}{{/crossLink}} it is.
* @property APP_VIEW
* @type string
* @static
* @final
*/
APP_VIEW: _PREFIX + 'app-view',
/**
* APP\_VIEW\_TRIGGER class should be applied to the DOM Elements that
* trigger an
* {{#crossLink "F2.Constants.Events"}}{{/crossLink}}.APP\_VIEW\_CHANGE
* event. The DOM Element should also have a
* {{#crossLink "F2.Constants.Views"}}{{/crossLink}}.DATA_ATTRIBUTE
* attribute that specifies which
* {{#crossLink "F2.Constants.Views"}}{{/crossLink}} it will trigger.
* @property APP_VIEW_TRIGGER
* @type string
* @static
* @final
*/
APP_VIEW_TRIGGER: _PREFIX + 'app-view-trigger',
/**
* The MASK class is applied to the overlay element that is created
* when the F2.UI.{{#crossLink "F2.UI/showMask"}}{{/crossLink}} method is
* fired.
* @property MASK
* @type string
* @static
* @final
*/
MASK: _PREFIX + 'mask',
/**
* The MASK_CONTAINER class is applied to the Element that is passed into
* the F2.UI.{{#crossLink "F2.UI/showMask"}}{{/crossLink}} method.
* @property MASK_CONTAINER
* @type string
* @static
* @final
*/
MASK_CONTAINER: _PREFIX + 'mask-container'
};
})(),
/**
* Events constants
* @class F2.Constants.Events
*/
Events: (function() {
/** @private */
var _APP_EVENT_PREFIX = 'App.';
/** @private */
var _CONTAINER_EVENT_PREFIX = 'Container.';
return {
/**
* The APP\_SYMBOL\_CHANGE event is fired when the symbol is changed in an
* app. It is up to the app developer to fire this event.
* Returns an object with the symbol and company name:
*
* { symbol: 'MSFT', name: 'Microsoft Corp (NASDAQ)' }
*
* @property APP_SYMBOL_CHANGE
* @type string
* @static
* @final
*/
APP_SYMBOL_CHANGE: _APP_EVENT_PREFIX + 'symbolChange',
/**
* The APP\_WIDTH\_CHANGE event will be fired by the container when the
* width of an app is changed. The app's instanceId should be concatenated
* to this constant.
* Returns an object with the gridSize and width in pixels:
*
* { gridSize:8, width:620 }
*
* @property APP_WIDTH_CHANGE
* @type string
* @static
* @final
*/
APP_WIDTH_CHANGE: _APP_EVENT_PREFIX + 'widthChange.',
/**
* The CONTAINER\_SYMBOL\_CHANGE event is fired when the symbol is changed
* at the container level. This event should only be fired by the
* container or container provider.
* Returns an object with the symbol and company name:
*
* { symbol: 'MSFT', name: 'Microsoft Corp (NASDAQ)' }
*
* @property CONTAINER_SYMBOL_CHANGE
* @type string
* @static
* @final
*/
CONTAINER_SYMBOL_CHANGE: _CONTAINER_EVENT_PREFIX + 'symbolChange',
/**
* The CONTAINER\_WIDTH\_CHANGE event will be fired by the container when
* the width of the container has changed.
* @property CONTAINER_WIDTH_CHANGE
* @type string
* @static
* @final
*/
CONTAINER_WIDTH_CHANGE: _CONTAINER_EVENT_PREFIX + 'widthChange'
};
})(),
JSONP_CALLBACK: 'F2_jsonpCallback_',
/**
* Constants for use with cross-domain sockets
* @class F2.Constants.Sockets
* @protected
*/
Sockets: {
/**
* The EVENT message is sent whenever
* F2.Events.{{#crossLink "F2.Events/emit"}}{{/crossLink}} is fired
* @property EVENT
* @type string
* @static
* @final
*/
EVENT: '__event__',
/**
* The LOAD message is sent when an iframe socket initially loads.
* Returns a JSON string that represents:
*
* [ App, AppManifest]
*
* @property LOAD
* @type string
* @static
* @final
*/
LOAD: '__socketLoad__',
/**
* The RPC message is sent when a method is passed up from within a secure
* app page.
* @property RPC
* @type string
* @static
* @final
*/
RPC: '__rpc__',
/**
* The RPC\_CALLBACK message is sent when a call back from an RPC method is
* fired.
* @property RPC_CALLBACK
* @type string
* @static
* @final
*/
RPC_CALLBACK: '__rpcCallback__',
/**
* The UI\_RPC message is sent when a UI method called.
* @property UI_RPC
* @type string
* @static
* @final
*/
UI_RPC: '__uiRpc__'
},
/**
* The available view types to apps. The view should be specified by applying
* the {{#crossLink "F2.Constants.Css"}}{{/crossLink}}.APP\_VIEW class to the
* containing DOM Element. A DATA\_ATTRIBUTE attribute should be added to the
* Element as well which defines what view type is represented.
* The `hide` class can be applied to views that should be hidden by default.
* @class F2.Constants.Views
*/
Views: {
/**
* The DATA_ATTRIBUTE should be placed on the DOM Element that contains the
* view.
* @property DATA_ATTRIBUTE
* @type string
* @static
* @final
*/
DATA_ATTRIBUTE: 'data-f2-view',
/**
* The ABOUT view gives details about the app.
* @property ABOUT
* @type string
* @static
* @final
*/
ABOUT: 'about',
/**
* The HELP view provides users with help information for using an app.
* @property HELP
* @type string
* @static
* @final
*/
HELP: 'help',
/**
* The HOME view is the main view for an app. This view should always
* be provided by an app.
* @property HOME
* @type string
* @static
* @final
*/
HOME: 'home',
/**
* The REMOVE view is a special view that handles the removal of an app
* from the container.
* @property REMOVE
* @type string
* @static
* @final
*/
REMOVE: 'remove',
/**
* The SETTINGS view provides users the ability to modify advanced settings
* for an app.
* @property SETTINGS
* @type string
* @static
* @final
*/
SETTINGS: 'settings'
}
});
/**
* Handles [Context](../../app-development.html#context) passing from
* containers to apps and apps to apps.
* @class F2.Events
*/
F2.extend('Events', (function() {
// init EventEmitter
var _events = new EventEmitter2({
wildcard:true
});
// unlimited listeners, set to > 0 for debugging
_events.setMaxListeners(0);
return {
/**
* Same as F2.Events.emit except that it will not send the event
* to all sockets.
* @method _socketEmit
* @private
* @param {string} event The event name
* @param {object} [arg]* The arguments to be passed
*/
_socketEmit: function() {
return EventEmitter2.prototype.emit.apply(_events, [].slice.call(arguments));
},
/**
* Execute each of the listeners that may be listening for the specified
* event name in order with the list of arguments.
* @method emit
* @param {string} event The event name
* @param {object} [arg]* The arguments to be passed
*/
emit: function() {
F2.Rpc.broadcast(F2.Constants.Sockets.EVENT, [].slice.call(arguments));
return EventEmitter2.prototype.emit.apply(_events, [].slice.call(arguments));
},
/**
* Adds a listener that will execute n times for the event before being
* removed. The listener is invoked only the first time the event is
* fired, after which it is removed.
* @method many
* @param {string} event The event name
* @param {int} timesToListen The number of times to execute the event
* before being removed
* @param {function} listener The function to be fired when the event is
* emitted
*/
many: function(event, timesToListen, listener) {
return _events.many(event, timesToListen, listener);
},
/**
* Remove a listener for the specified event.
* @method off
* @param {string} event The event name
* @param {function} listener The function that will be removed
*/
off: function(event, listener) {
return _events.off(event, listener);
},
/**
* Adds a listener for the specified event
* @method on
* @param {string} event The event name
* @param {function} listener The function to be fired when the event is
* emitted
*/
on: function(event, listener){
return _events.on(event, listener);
},
/**
* Adds a one time listener for the event. The listener is invoked only
* the first time the event is fired, after which it is removed.
* @method once
* @param {string} event The event name
* @param {function} listener The function to be fired when the event is
* emitted
*/
once: function(event, listener) {
return _events.once(event, listener);
}
};
})());
/**
* Handles socket communication between the container and secure apps
* @class F2.Rpc
*/
F2.extend('Rpc', (function(){
var _callbacks = {};
var _secureAppPagePath = '';
var _apps = {};
var _rEvents = new RegExp('^' + F2.Constants.Sockets.EVENT);
var _rRpc = new RegExp('^' + F2.Constants.Sockets.RPC);
var _rRpcCallback = new RegExp('^' + F2.Constants.Sockets.RPC_CALLBACK);
var _rSocketLoad = new RegExp('^' + F2.Constants.Sockets.LOAD);
var _rUiCall = new RegExp('^' + F2.Constants.Sockets.UI_RPC);
/**
* Creates a socket connection from the app to the container using
* <a href="http://easyxdm.net" target="_blank">easyXDM</a>.
* @method _createAppToContainerSocket
* @private
*/
var _createAppToContainerSocket = function() {
var appConfig; // socket closure
var isLoaded = false;
// its possible for messages to be received before the socket load event has
// happened. We'll save off these messages and replay them once the socket
// is ready
var messagePlayback = [];
var socket = new easyXDM.Socket({
onMessage: function(message, origin){
// handle Socket Load
if (!isLoaded && _rSocketLoad.test(message)) {
message = message.replace(_rSocketLoad, '');
var appParts = F2.parse(message);
// make sure we have the AppConfig and AppManifest
if (appParts.length == 2) {
appConfig = appParts[0];
// save socket
_apps[appConfig.instanceId] = {
config:appConfig,
socket:socket
};
// register app
F2.registerApps([appConfig], [appParts[1]]);
// socket message playback
jQuery.each(messagePlayback, function(i, e) {
_onMessage(appConfig, message, origin);
});
isLoaded = true;
}
} else if (isLoaded) {
// pass everyting else to _onMessage
_onMessage(appConfig, message, origin);
} else {
//F2.log('socket not ready, queuing message', message);
messagePlayback.push(message);
}
}
});
};
/**
* Creates a socket connection from the container to the app using
* <a href="http://easyxdm.net" target="_blank">easyXDM</a>.
* @method _createContainerToAppSocket
* @private
* @param {appConfig} appConfig The F2.AppConfig object
* @param {F2.AppManifest} appManifest The F2.AppManifest object
*/
var _createContainerToAppSocket = function(appConfig, appManifest) {
var container = jQuery(appConfig.root);
if (!container.is('.' + F2.Constants.Css.APP_CONTAINER)) {
container.find('.' + F2.Constants.Css.APP_CONTAINER);
}
if (!container.length) {
F2.log('Unable to locate app in order to establish secure connection.');
return;
}
var iframeProps = {
scrolling:'no',
style:{
width:'100%'
}
};
if (appConfig.height) {
iframeProps.style.height = appConfig.height + 'px';
}
var socket = new easyXDM.Socket({
remote: _secureAppPagePath,
container: container.get(0),
props:iframeProps,
onMessage: function(message, origin) {
// pass everything to _onMessage
_onMessage(appConfig, message, origin);
},
onReady: function() {
socket.postMessage(F2.Constants.Sockets.LOAD + F2.stringify([appConfig, appManifest], F2.appConfigReplacer));
}
});
return socket;
};
/**
* @method _createRpcCallback
* @private
* @param {string} instanceId The app's Instance ID
* @param {function} callbackId The callback ID
* @return {function} A function to make the RPC call
*/
var _createRpcCallback = function(instanceId, callbackId) {
return function() {
F2.Rpc.call(
instanceId,
F2.Constants.Sockets.RPC_CALLBACK,
callbackId,
[].slice.call(arguments).slice(2)
);
};
};
/**
* Handles messages that come across the sockets
* @method _onMessage
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {string} message The socket message
* @param {string} origin The originator
*/
var _onMessage = function(appConfig, message, origin) {
var obj, func;
function parseFunction(parent, functionName) {
var path = String(functionName).split('.');
for (var i = 0; i < path.length; i++) {
if (parent[path[i]] === undefined) {
parent = undefined;
break;
}
parent = parent[path[i]];
}
return parent;
}
function parseMessage(regEx, message, instanceId) {
var o = F2.parse(message.replace(regEx, ''));
// if obj.callbacks
// for each callback
// for each params
// if callback matches param
// replace param with _createRpcCallback(app.instanceId, callback)
if (o.params && o.params.length && o.callbacks && o.callbacks.length) {
jQuery.each(o.callbacks, function(i, c) {
jQuery.each(o.params, function(i, p) {
if (c == p) {
o.params[i] = _createRpcCallback(instanceId, c);
}
});
});
}
return o;
}
// handle UI Call
if (_rUiCall.test(message)) {
obj = parseMessage(_rUiCall, message, appConfig.instanceId);
func = parseFunction(appConfig.ui, obj.functionName);
// if we found the function, call it
if (func !== undefined) {
func.apply(appConfig.ui, obj.params);
} else {
F2.log('Unable to locate UI RPC function: ' + obj.functionName);
}
// handle RPC
} else if (_rRpc.test(message)) {
obj = parseMessage(_rRpc, message, appConfig.instanceId);
func = parseFunction(window, obj.functionName);
if (func !== undefined) {
func.apply(func, obj.params);
} else {
F2.log('Unable to locate RPC function: ' + obj.functionName);
}
// handle RPC Callback
} else if (_rRpcCallback.test(message)) {
obj = parseMessage(_rRpcCallback, message, appConfig.instanceId);
if (_callbacks[obj.functionName] !== undefined) {
_callbacks[obj.functionName].apply(_callbacks[obj.functionName], obj.params);
delete _callbacks[obj.functionName];
}
// handle Events
} else if (_rEvents.test(message)) {
obj = parseMessage(_rEvents, message, appConfig.instanceId);
F2.Events._socketEmit.apply(F2.Events, obj);
}
};
/**
* Registers a callback function
* @method _registerCallback
* @private
* @param {function} callback The callback function
* @return {string} The callback ID
*/
var _registerCallback = function(callback) {
var callbackId = F2.guid();
_callbacks[callbackId] = callback;
return callbackId;
};
return {
/**
* Broadcast an RPC function to all sockets
* @method broadcast
* @param {string} messageType The message type
* @param {Array} params The parameters to broadcast
*/
broadcast: function(messageType, params) {
// check valid messageType
var message = messageType + F2.stringify(params);
jQuery.each(_apps, function(i, a) {
a.socket.postMessage(message);
});
},
/**
* Calls a remote function
* @method call
* @param {string} instanceId The app's Instance ID
* @param {string} messageType The message type
* @param {string} functionName The name of the remote function
* @param {Array} params An array of parameters to pass to the remote
* function. Any functions found within the params will be treated as a
* callback function.
*/
call: function(instanceId, messageType, functionName, params) {
// loop through params and find functions and convert them to callbacks
var callbacks = [];
jQuery.each(params, function(i, e) {
if (typeof e === 'function') {
var cid = _registerCallback(e);
params[i] = cid;
callbacks.push(cid);
}
});
// check valid messageType
_apps[instanceId].socket.postMessage(
messageType + F2.stringify({
functionName:functionName,
params:params,
callbacks:callbacks
})
);
},
/**
* Init function which tells F2.Rpc whether it is running at the container-
* level or the app-level. This method is generally called by
* F2.{{#crossLink "F2/init"}}{{/crossLink}}
* @method init
* @param {string} [secureAppPagePath] The
* {{#crossLink "F2.ContainerConfig"}}{{/crossLink}}.secureAppPagePath
* property
*/
init: function(secureAppPagePath) {
_secureAppPagePath = secureAppPagePath;
if (!_secureAppPagePath) {
_createAppToContainerSocket();
}
},
/**
* Determines whether the Instance ID is considered to be 'remote'. This is
* determined by checking if 1) the app has an open socket and 2) whether
* F2.Rpc is running inside of an iframe
* @method isRemote
* @param {string} instanceId The Instance ID
* @return {bool} True if there is an open socket
*/
isRemote: function(instanceId) {
return (
// we have an app
_apps[instanceId] !== undefined &&
// the app is secure
_apps[instanceId].config.isSecure &&
// we can't access the iframe
jQuery(_apps[instanceId].config.root).find('iframe').length === 0
);
},
/**
* Creates a container-to-app or app-to-container socket for communication
* @method register
* @param {F2.AppConfig} [appConfig] The F2.AppConfig object
* @param {F2.AppManifest} [appManifest] The F2.AppManifest object
*/
register: function(appConfig, appManifest) {
if (!!appConfig && !!appManifest) {
_apps[appConfig.instanceId] = {
config:appConfig,
socket:_createContainerToAppSocket(appConfig, appManifest)
};
} else {
F2.log('Unable to register socket connection. Please check container configuration.');
}
}
};
})());
F2.extend('UI', (function(){
var _containerConfig;
/**
* UI helper methods
* @class F2.UI
* @constructor
* @param {F2.AppConfig} appConfig The F2.AppConfig object
*/
var UI_Class = function(appConfig) {
var _appConfig = appConfig;
var $root = jQuery(appConfig.root);
var _updateHeight = function(height) {
height = height || jQuery(_appConfig.root).outerHeight();
if (F2.Rpc.isRemote(_appConfig.instanceId)) {
F2.Rpc.call(
_appConfig.instanceId,
F2.Constants.Sockets.UI_RPC,
'updateHeight',
[
height
]
);
} else {
_appConfig.height = height;
$root.find('iframe').height(_appConfig.height);
}
};
return {
/**
* Removes a overlay from an Element on the page
* @method hideMask
* @param {string|Element} selector The Element or selector to an Element
* that currently contains the loader
*/
hideMask: function(selector) {
F2.UI.hideMask(_appConfig.instanceId, selector);
},
/**
* Helper methods for creating and using Modals
* @class F2.UI.Modals
* @for F2.UI
*/
Modals: (function(){
var _renderAlert = function(message) {
return [
'<div class="modal">',
'<header class="modal-header">',
'<h3>Alert!</h3>',
'</header>',
'<div class="modal-body">',
'<p>',
message,
'</p>',
'</div>',
'<div class="modal-footer">',
'<button class="btn btn-primary btn-ok">OK</button>',
'</div>',
'</div>'
].join('');
};
var _renderConfirm = function(message) {
return [
'<div class="modal">',
'<header class="modal-header">',
'<h3>Confirm</h3>',
'</header>',
'<div class="modal-body">',
'<p>',
message,
'</p>',
'</div>',
'<div class="modal-footer">',
'<button type="button" class="btn btn-primary btn-ok">OK</button>',
'<button type="button" class="btn btn-cancel">Cancel</button">',
'</div>',
'</div>'
].join('');
};
return {
/**
* Display an alert message on the page
* @method alert
* @param {string} message The message to be displayed
* @param {function} [callback] The callback to be fired when the user
* closes the dialog
* @for F2.UI.Modals
*/
alert: function(message, callback) {
if (!F2.isInit()) {
F2.log('F2.init() must be called before F2.UI.Modals.alert()');
return;
}
if (F2.Rpc.isRemote(_appConfig.instanceId)) {
F2.Rpc.call(
_appConfig.instanceId,
F2.Constants.Sockets.UI_RPC,
'Modals.alert',
[].slice.call(arguments)
);
} else {
// display the alert
jQuery(_renderAlert(message))
.on('show', function() {
var modal = this;
jQuery(modal).find('.btn-primary').on('click', function() {
jQuery(modal).modal('hide').remove();
(callback || jQuery.noop)();
});
})
.modal({backdrop:true});
}
},
/**
* Display a confirm message on the page
* @method confirm
* @param {string} message The message to be displayed
* @param {function} okCallback The function that will be called when the OK
* button is pressed
* @param {function} cancelCallback The function that will be called when
* the Cancel button is pressed
* @for F2.UI.Modals
*/
confirm: function(message, okCallback, cancelCallback) {
if (!F2.isInit()) {
F2.log('F2.init() must be called before F2.UI.Modals.confirm()');
return;
}
if (F2.Rpc.isRemote(_appConfig.instanceId)) {
F2.Rpc.call(
_appConfig.instanceId,
F2.Constants.Sockets.UI_RPC,
'Modals.confirm',
[].slice.call(arguments)
);
} else {
// display the alert
jQuery(_renderConfirm(message))
.on('show', function() {
var modal = this;
jQuery(modal).find('.btn-ok').on('click', function() {
jQuery(modal).modal('hide').remove();
(okCallback || jQuery.noop)();
});
jQuery(modal).find('.btn-cancel').on('click', function() {
jQuery(modal).modal('hide').remove();
(cancelCallback || jQuery.noop)();
});
})
.modal({backdrop:true});
}
}
};
})(),
/**
* Sets the title of the app as shown in the browser. Depending on the
* container HTML, this method may do nothing if the container has not been
* configured properly or else the container provider does not allow Title's
* to be set.
* @method setTitle
* @params {string} title The title of the app
* @for F2.UI
*/
setTitle: function(title) {
if (F2.Rpc.isRemote(_appConfig.instanceId)) {
F2.Rpc.call(
_appConfig.instanceId,
F2.Constants.Sockets.UI_RPC,
'setTitle',
[
title
]
);
} else {
jQuery(_appConfig.root).find('.' + F2.Constants.Css.APP_TITLE).text(title);
}
},
/**
* Display an ovarlay over an Element on the page
* @method showMask
* @param {string|Element} selector The Element or selector to an Element
* over which to display the loader
* @param {bool} showLoading Display a loading icon
*/
showMask: function(selector, showLoader) {
F2.UI.showMask(_appConfig.instanceId, selector, showLoader);
},
/**
* For secure apps, this method updates the size of the iframe that
* contains the app. **Note: It is recommended that app developers call
* this method anytime Elements are added or removed from the DOM**
* @method updateHeight
* @params {int} height The height of the app
*/
updateHeight: _updateHeight,
/**
* Helper methods for creating and using Views
* @class F2.UI.Views
* @for F2.UI
*/
Views: (function(){
var _events = new EventEmitter2();
var _rValidEvents = /change/i;
// unlimited listeners, set to > 0 for debugging
_events.setMaxListeners(0);
var _isValid = function(eventName) {
if (_rValidEvents.test(eventName)) {
return true;
} else {
F2.log('"' + eventName + '" is not a valid F2.UI.Views event name');
return false;
}
};
return {
/**
* Change the current view for the app or add an event listener
* @method change
* @param {string|function} [input] If a string is passed in, the view
* will be changed for the app. If a function is passed in, a change
* event listener will be added.
* @for F2.UI.Views
*/
change: function(input) {
if (typeof input === 'function') {
this.on('change', input);
} else if (typeof input === 'string') {
if (_appConfig.isSecure && !F2.Rpc.isRemote(_appConfig.instanceId)) {
F2.Rpc.call(
_appConfig.instanceId,
F2.Constants.Sockets.UI_RPC,
'Views.change',
[].slice.call(arguments)
);
} else if (F2.inArray(input, _appConfig.views)) {
jQuery('.' + F2.Constants.Css.APP_VIEW, $root)
.addClass('hide')
.filter('[data-f2-view="' + input + '"]', $root)
.removeClass('hide');
_updateHeight();
_events.emit('change', input);
}
}
},
/**
* Removes a view event listener
* @method off
* @param {string} event The event name
* @param {function} listener The function that will be removed
* @for F2.UI.Views
*/
off: function(event, listener) {
if (_isValid(event)) {
_events.off(event, listener);
}
},
/**
* Adds a view event listener
* @method on
* @param {string} event The event name
* @param {function} listener The function to be fired when the event is
* emitted
* @for F2.UI.Views
*/
on: function(event, listener) {
if (_isValid(event)) {
_events.on(event, listener);
}
}
};
})()
};
};
/**
* Removes a overlay from an Element on the page
* @method hideMask
* @static
* @param {string} instanceId The Instance ID of the app
* @param {string|Element} selector The Element or selector to an Element
* that currently contains the loader
* @for F2.UI
*/
UI_Class.hideMask = function(instanceId, selector) {
if (!F2.isInit()) {
F2.log('F2.init() must be called before F2.UI.hideMask()');
return;
}
if (F2.Rpc.isRemote(instanceId) && !jQuery(selector).is('.' + F2.Constants.Css.APP)) {
F2.Rpc.call(
instanceId,
F2.Constants.Sockets.RPC,
'F2.UI.hideMask',
[
instanceId,
// must only pass the selector argument. if we pass an Element there
// will be F2.stringify() errors
jQuery(selector).selector
]
);
} else {
var container = jQuery(selector);
container.find('> .' + F2.Constants.Css.MASK).remove();
container.removeClass(F2.Constants.Css.MASK_CONTAINER);
// if the element contains this data property, we need to reset static
// position
if (container.data(F2.Constants.Css.MASK_CONTAINER)) {
container.css({'position':'static'});
}
}
};
/**
*
* @method init
* @static
* @param {F2.ContainerConfig} containerConfig The F2.ContainerConfig object
*/
UI_Class.init = function(containerConfig) {
_containerConfig = containerConfig;
// set defaults
_containerConfig.UI = jQuery.extend(true, {}, F2.ContainerConfig.UI, _containerConfig.UI || {});
};
/**
* Display an ovarlay over an Element on the page
* @method showMask
* @static
* @param {string} instanceId The Instance ID of the app
* @param {string|Element} selector The Element or selector to an Element
* over which to display the loader
* @param {bool} showLoading Display a loading icon
*/
UI_Class.showMask = function(instanceId, selector, showLoading) {
if (!F2.isInit()) {
F2.log('F2.init() must be called before F2.UI.showMask()');
return;
}
if (F2.Rpc.isRemote(instanceId) && jQuery(selector).is('.' + F2.Constants.Css.APP)) {
F2.Rpc.call(
instanceId,
F2.Constants.Sockets.RPC,
'F2.UI.showMask',
[
instanceId,
// must only pass the selector argument. if we pass an Element there
// will be F2.stringify() errors
jQuery(selector).selector,
showLoading
]
);
} else {
if (showLoading && !_containerConfig.UI.Mask.loadingIcon) {
F2.log('Unable to display loading icon. Please set F2.ContainerConfig.UI.Mask.loadingIcon when calling F2.init();');
}
var container = jQuery(selector).addClass(F2.Constants.Css.MASK_CONTAINER);
var mask = jQuery('<div>')
.height('100%' /*container.outerHeight()*/)
.width('100%' /*container.outerWidth()*/)
.addClass(F2.Constants.Css.MASK);
// set inline styles if useClasses is false
if (!_containerConfig.UI.Mask.useClasses) {
mask.css({
'background-color':_containerConfig.UI.Mask.backgroundColor,
'background-image': !!_containerConfig.UI.Mask.loadingIcon ? ('url(' + _containerConfig.UI.Mask.loadingIcon + ')') : '',
'background-position':'50% 50%',
'background-repeat':'no-repeat',
'display':'block',
'left':0,
'min-height':30,
'padding':0,
'position':'absolute',
'top':0,
'z-index':_containerConfig.UI.Mask.zIndex,
'filter':'alpha(opacity=' + (_containerConfig.UI.Mask.opacity * 100) + ')',
'opacity':_containerConfig.UI.Mask.opacity
});
}
// only set the position if the container is currently static
if (container.css('position') === 'static') {
container.css({'position':'relative'});
// setting this data property tells hideMask to set the position
// back to static
container.data(F2.Constants.Css.MASK_CONTAINER, true);
}
// add the mask to the container
container.append(mask);
}
};
return UI_Class;
})());
/**
* Root namespace of the F2 SDK
* @module f2
* @class F2
*/
F2.extend('', (function(){
var _apps = {};
var _config = false;
var _bUsesAppHandlers = false;
var _sAppHandlerToken = F2.AppHandlers.__f2GetToken();
/**
* Appends the app's html to the DOM
* @method _afterAppRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {string} html The string of html
* @return {Element} The DOM Element that contains the app
*/
var _afterAppRender = function(appConfig, html) {
var handler = _config.afterAppRender || function(appConfig, html) {
return jQuery(html).appendTo('body');
};
var appContainer = handler(appConfig, html);
if (!!_config.afterAppRender && !appContainer) {
F2.log('F2.ContainerConfig.afterAppRender() must return the DOM Element that contains the app');
return;
} else {
// apply APP class and Instance ID
jQuery(appContainer).addClass(F2.Constants.Css.APP);
return appContainer.get(0);
}
};
/**
* Renders the html for an app.
* @method _appRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {string} html The string of html
*/
var _appRender = function(appConfig, html) {
// apply APP_CONTAINER class
html = _outerHtml(jQuery(html).addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appConfig.appId));
// optionally apply wrapper html
if (_config.appRender) {
html = _config.appRender(appConfig, html);
}
// apply APP class and instanceId
return _outerHtml(html);
};
/**
* Rendering hook to allow containers to render some html prior to an app
* loading
* @method _beforeAppRender
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @return {Element} The DOM Element surrounding the app
*/
var _beforeAppRender = function(appConfig) {
var handler = _config.beforeAppRender || jQuery.noop;
return handler(appConfig);
};
/**
* Handler to inform the container that a script failed to load
* @method _onScriptLoadFailure
* @deprecated This has been replaced with {{#crossLink "F2.AppHandlers"}}{{/crossLink}} and will be removed in v2.0
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param scriptInfo The path of the script that failed to load or the exception info
* for the inline script that failed to execute
*/
var _appScriptLoadFailed = function(appConfig, scriptInfo) {
var handler = _config.appScriptLoadFailed || jQuery.noop;
return handler(appConfig, scriptInfo);
};
/**
* Adds properties to the AppConfig object
* @method _createAppConfig
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @return {F2.AppConfig} The new F2.AppConfig object, prepopulated with
* necessary properties
*/
var _createAppConfig = function(appConfig) {
// make a copy of the app config to ensure that the original is not modified
appConfig = jQuery.extend(true, {}, appConfig);
// create the instanceId for the app
appConfig.instanceId = appConfig.instanceId || F2.guid();
// default the views if not provided
appConfig.views = appConfig.views || [];
if (!F2.inArray(F2.Constants.Views.HOME, appConfig.views)) {
appConfig.views.push(F2.Constants.Views.HOME);
}
return appConfig;
};
/**
* Adds properties to the ContainerConfig object to take advantage of defaults
* @method _hydrateContainerConfig
* @private
* @param {F2.ContainerConfig} containerConfig The F2.ContainerConfig object
*/
var _hydrateContainerConfig = function(containerConfig) {
if (!containerConfig.scriptErrorTimeout){
containerConfig.scriptErrorTimeout = F2.ContainerConfig.scriptErrorTimeout;
}
if (containerConfig.debugMode !== true){
containerConfig.debugMode = F2.ContainerConfig.debugMode;
}
};
/**
* Attach app events
* @method _initAppEvents
* @private
*/
var _initAppEvents = function (appConfig) {
jQuery(appConfig.root).on('click', '.' + F2.Constants.Css.APP_VIEW_TRIGGER + '[' + F2.Constants.Views.DATA_ATTRIBUTE + ']', function(event) {
event.preventDefault();
var view = jQuery(this).attr(F2.Constants.Views.DATA_ATTRIBUTE).toLowerCase();
// handle the special REMOVE view
if (view == F2.Constants.Views.REMOVE) {
F2.removeApp(appConfig.instanceId);
} else {
appConfig.ui.Views.change(view);
}
});
};
/**
* Attach container Events
* @method _initContainerEvents
* @private
*/
var _initContainerEvents = function() {
var resizeTimeout;
var resizeHandler = function() {
F2.Events.emit(F2.Constants.Events.CONTAINER_WIDTH_CHANGE);
};
jQuery(window).on('resize', function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(resizeHandler, 100);
});
};
/**
* Has the container been init?
* @method _isInit
* @private
* @return {bool} True if the container has been init
*/
var _isInit = function() {
return !!_config;
};
/**
* Instantiates each app from it's appConfig and stores that in a local private collection
* @method _createAppInstance
* @private
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}} objects
*/
var _createAppInstance = function(appConfig, appContent){
// instantiate F2.UI
appConfig.ui = new F2.UI(appConfig);
// instantiate F2.App
if (F2.Apps[appConfig.appId] !== undefined) {
if (typeof F2.Apps[appConfig.appId] === 'function') {
// IE
setTimeout(function() {
_apps[appConfig.instanceId].app = new F2.Apps[appConfig.appId](appConfig, appContent, appConfig.root);
if (_apps[appConfig.instanceId].app['init'] !== undefined) {
_apps[appConfig.instanceId].app.init();
}
}, 0);
} else {
F2.log('app initialization class is defined but not a function. (' + appConfig.appId + ')');
}
}
};
/**
* Loads the app's html/css/javascript
* @method loadApp
* @private
* @param {Array} appConfigs An array of
* {{#crossLink "F2.AppConfig"}}{{/crossLink}} objects
* @param {F2.AppManifest} [appManifest] The AppManifest object
*/
var _loadApps = function(appConfigs, appManifest) {
appConfigs = [].concat(appConfigs);
// check for secure app
if (appConfigs.length == 1 && appConfigs[0].isSecure && !_config.isSecureAppPage) {
_loadSecureApp(appConfigs[0], appManifest);
return;
}
// check that the number of apps in manifest matches the number requested
if (appConfigs.length != appManifest.apps.length) {
F2.log('The number of apps defined in the AppManifest do not match the number requested.', appManifest);
return;
}
var scripts = appManifest.scripts || [];
var styles = appManifest.styles || [];
var inlines = appManifest.inlineScripts || [];
var scriptCount = scripts.length;
var scriptsLoaded = 0;
// check for IE10+ so that we don't rely on onreadystatechange
var readyStates = 'addEventListener' in window ? {} : { 'loaded': true, 'complete': true };
var appInit = function() {
jQuery.each(appConfigs, function(i, a) {
_createAppInstance(a, appManifest.apps[i]);
});
};
var _error = function(e){
//log and emit event for the failed (400,500) scripts
setTimeout(function(){
var evtData = {
src: e.target.src,
appId: appConfigs[0].appId
};
//send error to console
F2.log('Script defined in \'' + evtData.appId + '\' failed to load \'' + evtData.src + '\'');
//emit event
F2.Events.emit('RESOURCE_FAILED_TO_LOAD', evtData);
if(!_bUsesAppHandlers) {
_appScriptLoadFailed(appConfigs[0],evtData.src);
}
else {
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,
appConfigs[0],
evtData.src
);
}
}, _config.scriptErrorTimeout);//defaults to 7000
};
//eval inlines
var evalInlines = function(){
jQuery.each(inlines, function(i, e) {
try {
eval(e);
} catch (exception) {
F2.log('Error loading inline script: ' + exception + '\n\n' + e);
if(!_bUsesAppHandlers) {
_appScriptLoadFailed(appConfigs[0],exception);
}
else {
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_SCRIPT_LOAD_FAILED,
appConfigs[0],
exception
);
}
}
});
};
// load styles, see #101
var stylesFragment = null,
useCreateStyleSheet = !!document.createStyleSheet;
jQuery.each(styles, function(i, e) {
if (useCreateStyleSheet) {
document.createStyleSheet(e);
} else {
stylesFragment = stylesFragment || [];
stylesFragment.push('<link rel="stylesheet" type="text/css" href="' + e + '"/>');
}
});
if (stylesFragment){
jQuery('head').append(stylesFragment.join(''));
}
// load html
jQuery.each(appManifest.apps, function(i, a) {
if(!_bUsesAppHandlers) {
// load html and save the root node
appConfigs[i].root = _afterAppRender(appConfigs[i], _appRender(appConfigs[i], a.html));
} else {
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_RENDER,
appConfigs[i], // the app config
_outerHtml(a.html)
);
var appId = appConfigs[i].appId;
if (!appConfigs[i].root) {
throw('Root for ' +appId+ ' must be a native DOM element and cannot be null or undefined. Check your AppHandler callbacks to ensure you have set App root to a native DOM element.');
}
var $root = jQuery(appConfigs[i].root);
if ($root.parents('body:first').length === 0) {
throw('App root for ' +appId+ ' was not appended to the DOM. Check your AppHandler callbacks to ensure you have rendered the app root to the DOM.');
}
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_RENDER_AFTER,
appConfigs[i] // the app config
);
if(!F2.isNativeDOMNode(appConfigs[i].root)) {
throw('App root for ' +appId+ ' must be a native DOM element. Check your AppHandler callbacks to ensure you have set app root to a native DOM element.');
}
$root.addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appId);
}
// init events
_initAppEvents(appConfigs[i]);
});
// load scripts and eval inlines once complete
jQuery.each(scripts, function(i, e) {
var doc = document,
script = doc.createElement('script'),
resourceUrl = e;
//if in debugMode, add cache buster to each script URL
if (_config.debugMode){
resourceUrl += '?cachebuster=' + new Date().getTime();
}
//scripts needed to be loaded in order they're defined in the AppManifest
script.async = false;
//add other attrs
script.src = resourceUrl;
script.type = 'text/javascript';
script.charset = 'utf-8';
script.onerror = _error;
// use a closure for the load event so that we can dereference the original script
script.onload = script.onreadystatechange = function(e){
e = e || window.event; // older IE
if (e.type == 'load' || readyStates[script.readyState]) {
//done, cleanup
script.onload = script.onreadystatechange = script.onerror = null;
// dereference script
script = null;
//are we done loading all scripts for this app?
if (++scriptsLoaded == scriptCount) {
evalInlines();
appInit();
}
}
};
doc.body.appendChild(script);
});
// if no scripts were to be processed, fire the appInit event
if (!scriptCount) {
evalInlines();
appInit();
}
};
/**
* Loads the app's html/css/javascript into an iframe
* @method loadSecureApp
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @param {F2.AppManifest} appManifest The app's html/css/js to be loaded into the
* page.
*/
var _loadSecureApp = function(appConfig, appManifest) {
// make sure the container is configured for secure apps
if (_config.secureAppPagePath) {
if(!_bUsesAppHandlers) {
// create the html container for the iframe
appConfig.root = _afterAppRender(appConfig, _appRender(appConfig, '<div></div>'));
} else {
var $root = jQuery(appConfig.root);
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_RENDER,
appConfig, // the app config
appManifest.html
);
if ($root.parents('body:first').length === 0) {
throw('App was never rendered on the page. Please check your AppHandler callbacks to ensure you have rendered the app root to the DOM.');
}
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_RENDER_AFTER,
appConfig // the app config
);
if (!appConfig.root) {
throw('App Root must be a native dom node and can not be null or undefined. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.');
}
if (!F2.isNativeDOMNode(appConfig.root)) {
throw('App Root must be a native dom node. Please check your AppHandler callbacks to ensure you have set App Root to a native dom node.');
}
jQuery(appConfig.root).addClass(F2.Constants.Css.APP_CONTAINER + ' ' + appConfig.appId);
}
// instantiate F2.UI
appConfig.ui = new F2.UI(appConfig);
// init events
_initAppEvents(appConfig);
// create RPC socket
F2.Rpc.register(appConfig, appManifest);
} else {
F2.log('Unable to load secure app: "secureAppPagePath" is not defined in F2.ContainerConfig.');
}
};
var _outerHtml = function(html) {
return jQuery('<div></div>').append(html).html();
};
/**
* Checks if the app is valid
* @method _validateApp
* @private
* @param {F2.AppConfig} appConfig The F2.AppConfig object
* @returns {bool} True if the app is valid
*/
var _validateApp = function(appConfig) {
// check for valid app configurations
if (!appConfig.appId) {
F2.log('"appId" missing from app object');
return false;
} else if (!appConfig.root && !appConfig.manifestUrl) {
F2.log('"manifestUrl" missing from app object');
return false;
}
return true;
};
/**
* Checks if the ContainerConfig is valid
* @method _validateContainerConfig
* @private
* @returns {bool} True if the config is valid
*/
var _validateContainerConfig = function() {
if (_config) {
if (_config.xhr) {
if (!(typeof _config.xhr === 'function' || typeof _config.xhr === 'object')) {
throw('ContainerConfig.xhr should be a function or an object');
}
if (_config.xhr.dataType && typeof _config.xhr.dataType !== 'function') {
throw('ContainerConfig.xhr.dataType should be a function');
}
if (_config.xhr.type && typeof _config.xhr.type !== 'function') {
throw('ContainerConfig.xhr.type should be a function');
}
if (_config.xhr.url && typeof _config.xhr.url !== 'function') {
throw('ContainerConfig.xhr.url should be a function');
}
}
}
return true;
};
return {
/**
* Gets the current list of apps in the container
* @method getContainerState
* @returns {Array} An array of objects containing the appId
*/
getContainerState: function() {
if (!_isInit()) {
F2.log('F2.init() must be called before F2.getContainerState()');
return;
}
return jQuery.map(_apps, function(app) {
return { appId: app.config.appId };
});
},
/**
* Initializes the container. This method must be called before performing
* any other actions in the container.
* @method init
* @param {F2.ContainerConfig} config The configuration object
*/
init: function(config) {
_config = config || {};
_validateContainerConfig();
_hydrateContainerConfig(_config);
// dictates whether we use the old logic or the new logic.
// TODO: Remove in v2.0
_bUsesAppHandlers = (!_config.beforeAppRender && !_config.appRender && !_config.afterAppRender && !_config.appScriptLoadFailed);
// only establish RPC connection if the container supports the secure app page
if (!!_config.secureAppPagePath || _config.isSecureAppPage) {
F2.Rpc.init(!!_config.secureAppPagePath ? _config.secureAppPagePath : false);
}
F2.UI.init(_config);
if (!_config.isSecureAppPage) {
_initContainerEvents();
}
},
/**
* Has the container been init?
* @method isInit
* @return {bool} True if the container has been init
*/
isInit: _isInit,
/**
* Begins the loading process for all apps and/or initialization process for pre-loaded apps.
* The app will be passed the {{#crossLink "F2.AppConfig"}}{{/crossLink}} object which will
* contain the app's unique instanceId within the container. If the
* {{#crossLink "F2.AppConfig"}}{{/crossLink}}.root property is populated the app is considered
* to be a pre-loaded app and will be handled accordingly. Optionally, the
* {{#crossLink "F2.AppManifest"}}{{/crossLink}} can be passed in and those
* assets will be used instead of making a request.
* @method registerApps
* @param {Array} appConfigs An array of {{#crossLink "F2.AppConfig"}}{{/crossLink}}
* objects
* @param {Array} [appManifests] An array of
* {{#crossLink "F2.AppManifest"}}{{/crossLink}}
* objects. This array must be the same length as the apps array that is
* objects. This array must be the same length as the apps array that is
* passed in. This can be useful if apps are loaded on the server-side and
* passed down to the client.
* @example
* Traditional App requests.
*
* // Traditional f2 app configs
* var arConfigs = [
* {
* appId: 'com_externaldomain_example_app',
* context: {},
* manifestUrl: 'http://www.externaldomain.com/F2/AppManifest'
* },
* {
* appId: 'com_externaldomain_example_app',
* context: {},
* manifestUrl: 'http://www.externaldomain.com/F2/AppManifest'
* },
* {
* appId: 'com_externaldomain_example_app2',
* context: {},
* manifestUrl: 'http://www.externaldomain.com/F2/AppManifest'
* }
* ];
*
* F2.init();
* F2.registerApps(arConfigs);
*
* @example
* Pre-loaded and tradition apps mixed.
*
* // Pre-loaded apps and traditional f2 app configs
* // you can preload the same app multiple times as long as you have a unique root for each
* var arConfigs = [
* {
* appId: 'com_mydomain_example_app',
* context: {},
* root: 'div#example-app-1',
* manifestUrl: ''
* },
* {
* appId: 'com_mydomain_example_app',
* context: {},
* root: 'div#example-app-2',
* manifestUrl: ''
* },
* {
* appId: 'com_externaldomain_example_app',
* context: {},
* manifestUrl: 'http://www.externaldomain.com/F2/AppManifest'
* }
* ];
*
* F2.init();
* F2.registerApps(arConfigs);
*
* @example
* Apps with predefined manifests.
*
* // Traditional f2 app configs
* var arConfigs = [
* {appId: 'com_externaldomain_example_app', context: {}},
* {appId: 'com_externaldomain_example_app', context: {}},
* {appId: 'com_externaldomain_example_app2', context: {}}
* ];
*
* // Pre requested manifest responses
* var arManifests = [
* {
* apps: ['<div>Example App!</div>'],
* inlineScripts: [],
* scripts: ['http://www.domain.com/js/AppClass.js'],
* styles: ['http://www.domain.com/css/AppStyles.css']
* },
* {
* apps: ['<div>Example App!</div>'],
* inlineScripts: [],
* scripts: ['http://www.domain.com/js/AppClass.js'],
* styles: ['http://www.domain.com/css/AppStyles.css']
* },
* {
* apps: ['<div>Example App 2!</div>'],
* inlineScripts: [],
* scripts: ['http://www.domain.com/js/App2Class.js'],
* styles: ['http://www.domain.com/css/App2Styles.css']
* }
* ];
*
* F2.init();
* F2.registerApps(arConfigs, arManifests);
*/
registerApps: function(appConfigs, appManifests) {
if (!_isInit()) {
F2.log('F2.init() must be called before F2.registerApps()');
return;
} else if (!appConfigs) {
F2.log('At least one AppConfig must be passed when calling F2.registerApps()');
return;
}
var appStack = [];
var batches = {};
var callbackStack = {};
var haveManifests = false;
appConfigs = [].concat(appConfigs);
appManifests = [].concat(appManifests || []);
haveManifests = !!appManifests.length;
// appConfigs must have a length
if (!appConfigs.length) {
F2.log('At least one AppConfig must be passed when calling F2.registerApps()');
return;
// ensure that the array of apps and manifests are qual
} else if (appConfigs.length && haveManifests && appConfigs.length != appManifests.length) {
F2.log('The length of "apps" does not equal the length of "appManifests"');
return;
}
// validate each app and assign it an instanceId
// then determine which apps can be batched together
jQuery.each(appConfigs, function(i, a) {
// add properties and methods
a = _createAppConfig(a);
// Will set to itself, for preloaded apps, or set to null for apps that aren't already
// on the page.
a.root = a.root || null;
// we validate the app after setting the root property because pre-load apps do no require
// manifest url
if (!_validateApp(a)) {
return; // move to the next app
}
// save app
_apps[a.instanceId] = { config:a };
// If the root property is defined then this app is considered to be preloaded and we will
// run it through that logic.
if(a.root)
{
if((!a.root && typeof(a.root) != 'string') && !F2.isNativeDOMNode(a.root))
{
F2.log('AppConfig invalid for pre-load, not a valid string and not dom node');
F2.log('AppConfig instance:', a);
throw('Preloaded appConfig.root property must be a native dom node or a string representing a sizzle selector. Please check your inputs and try again.');
}
else if(jQuery(a.root).length != 1)
{
F2.log('AppConfig invalid for pre-load, root not unique');
F2.log('AppConfig instance:', a);
F2.log('Number of dom node instances:', jQuery(a.root).length);
throw('Preloaded appConfig.root property must map to a unique dom node. Please check your inputs and try again.');
}
// instantiate F2.App
_createAppInstance(a);
// init events
_initAppEvents(a);
// Continue on in the .each loop, no need to continue because the app is on the page
// the js in initialized, and it is ready to role.
return; // equivalent to continue in .each
}
if(!_bUsesAppHandlers)
{
// fire beforeAppRender
a.root = _beforeAppRender(a);
}
else
{
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_CREATE_ROOT,
a // the app config
);
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_RENDER_BEFORE,
a // the app config
);
}
// if we have the manifest, go ahead and load the app
if (haveManifests) {
_loadApps(a, appManifests[i]);
} else {
// check if this app can be batched
if (a.enableBatchRequests && !a.isSecure) {
batches[a.manifestUrl.toLowerCase()] = batches[a.manifestUrl.toLowerCase()] || [];
batches[a.manifestUrl.toLowerCase()].push(a);
} else {
appStack.push({
apps:[a],
url:a.manifestUrl
});
}
}
});
// we don't have the manifests, go ahead and load them
if (!haveManifests) {
// add the batches to the appStack
jQuery.each(batches, function(i, b) {
appStack.push({ url:i, apps:b });
});
// if an app is being loaded more than once on the page, there is the
// potential that the jsonp callback will be clobbered if the request
// for the AppManifest for the app comes back at the same time as
// another request for the same app. We'll create a callbackStack
// that will ensure that requests for the same app are loaded in order
// rather than at the same time
jQuery.each(appStack, function(i, req) {
// define the callback function based on the first app's App ID
var jsonpCallback = F2.Constants.JSONP_CALLBACK + req.apps[0].appId;
// push the request onto the callback stack
callbackStack[jsonpCallback] = callbackStack[jsonpCallback] || [];
callbackStack[jsonpCallback].push(req);
});
// loop through each item in the callback stack and make the request
// for the AppManifest. When the request is complete, pop the next
// request off the stack and make the request.
jQuery.each(callbackStack, function(i, requests) {
var manifestRequest = function(jsonpCallback, req) {
if (!req) { return; }
// setup defaults and callbacks
var url = req.url,
type = 'GET',
dataType = 'jsonp',
completeFunc = function() {
manifestRequest(i, requests.pop());
},
errorFunc = function() {
jQuery.each(req.apps, function(idx,item){
F2.log('Removed failed ' +item.name+ ' app', item);
F2.removeApp(item.instanceId);
});
},
successFunc = function(appManifest) {
_loadApps(req.apps, appManifest);
};
// optionally fire xhr overrides
if (_config.xhr && _config.xhr.dataType) {
dataType = _config.xhr.dataType(req.url, req.apps);
if (typeof dataType !== 'string') {
throw('ContainerConfig.xhr.dataType should return a string');
}
}
if (_config.xhr && _config.xhr.type) {
type = _config.xhr.type(req.url, req.apps);
if (typeof type !== 'string') {
throw('ContainerConfig.xhr.type should return a string');
}
}
if (_config.xhr && _config.xhr.url) {
url = _config.xhr.url(req.url, req.apps);
if (typeof url !== 'string') {
throw('ContainerConfig.xhr.url should return a string');
}
}
// setup the default request function if an override is not present
var requestFunc = _config.xhr;
if (typeof requestFunc !== 'function') {
requestFunc = function(url, appConfigs, successCallback, errorCallback, completeCallback) {
jQuery.ajax({
url: url,
type: type,
data: {
params: F2.stringify(req.apps, F2.appConfigReplacer)
},
jsonp: false, // do not put 'callback=' in the query string
jsonpCallback: jsonpCallback, // Unique function name
dataType: dataType,
success: successCallback,
error: function(jqxhr, settings, exception) {
F2.log('Failed to load app(s)', exception.toString(), req.apps);
errorCallback();
},
complete: completeCallback
});
};
}
requestFunc(url, req.apps, successFunc, errorFunc, completeFunc);
};
manifestRequest(i, requests.pop());
});
}
},
/**
* Removes all apps from the container
* @method removeAllApps
*/
removeAllApps: function() {
if (!_isInit()) {
F2.log('F2.init() must be called before F2.removeAllApps()');
return;
}
jQuery.each(_apps, function(i, a) {
F2.removeApp(a.config.instanceId);
});
},
/**
* Removes an app from the container
* @method removeApp
* @param {string} instanceId The app's instanceId
*/
removeApp: function(instanceId) {
if (!_isInit()) {
F2.log('F2.init() must be called before F2.removeApp()');
return;
}
if (_apps[instanceId]) {
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_DESTROY_BEFORE,
_apps[instanceId] // the app instance
);
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_DESTROY,
_apps[instanceId] // the app instance
);
F2.AppHandlers.__trigger(
_sAppHandlerToken,
F2.Constants.AppHandlers.APP_DESTROY_AFTER,
_apps[instanceId] // the app instance
);
delete _apps[instanceId];
}
}
};
})());
exports.F2 = F2;
if (typeof define !== 'undefined' && define.amd) {
define(function() {
return F2;
});
}
})(typeof exports !== 'undefined' ? exports : window); |
app/javascript/mastodon/features/explore/links.js | cobodo/mastodon | import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Story from './components/story';
import LoadingIndicator from 'mastodon/components/loading_indicator';
import { connect } from 'react-redux';
import { fetchTrendingLinks } from 'mastodon/actions/trends';
const mapStateToProps = state => ({
links: state.getIn(['trends', 'links', 'items']),
isLoading: state.getIn(['trends', 'links', 'isLoading']),
});
export default @connect(mapStateToProps)
class Links extends React.PureComponent {
static propTypes = {
links: ImmutablePropTypes.list,
isLoading: PropTypes.bool,
dispatch: PropTypes.func.isRequired,
};
componentDidMount () {
const { dispatch } = this.props;
dispatch(fetchTrendingLinks());
}
render () {
const { isLoading, links } = this.props;
return (
<div className='explore__links'>
{isLoading ? (<LoadingIndicator />) : links.map(link => (
<Story
key={link.get('id')}
url={link.get('url')}
title={link.get('title')}
publisher={link.get('provider_name')}
sharedTimes={link.getIn(['history', 0, 'accounts']) * 1 + link.getIn(['history', 1, 'accounts']) * 1}
thumbnail={link.get('image')}
blurhash={link.get('blurhash')}
/>
))}
</div>
);
}
}
|
src/MenuItem.js | chilts/react-bootstrap | import React from 'react';
import classnames from 'classnames';
import CustomPropTypes from './utils/CustomPropTypes';
import SafeAnchor from './SafeAnchor';
export default class MenuItem extends React.Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
}
handleClick(event) {
if (!this.props.href || this.props.disabled) {
event.preventDefault();
}
if (this.props.disabled) {
return;
}
if (this.props.onSelect) {
this.props.onSelect(event, this.props.eventKey);
}
}
render() {
if (this.props.divider) {
return <li role="separator" className="divider" />;
}
if (this.props.header) {
return (
<li role="heading" className="dropdown-header">{this.props.children}</li>
);
}
const classes = {
disabled: this.props.disabled
};
return (
<li role="presentation"
className={classnames(this.props.className, classes)}
style={this.props.style}
>
<SafeAnchor
role="menuitem"
tabIndex="-1"
id={this.props.id}
target={this.props.target}
title={this.props.title}
href={this.props.href || ''}
onKeyDown={this.props.onKeyDown}
onClick={this.handleClick}>
{this.props.children}
</SafeAnchor>
</li>
);
}
}
MenuItem.propTypes = {
disabled: React.PropTypes.bool,
divider: CustomPropTypes.all([
React.PropTypes.bool,
function(props, propName, componentName) {
if (props.divider && props.children) {
return new Error('Children will not be rendered for dividers');
}
}
]),
eventKey: React.PropTypes.oneOfType([
React.PropTypes.number,
React.PropTypes.string
]),
header: React.PropTypes.bool,
href: React.PropTypes.string,
target: React.PropTypes.string,
title: React.PropTypes.string,
onKeyDown: React.PropTypes.func,
onSelect: React.PropTypes.func,
id: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number
])
};
MenuItem.defaultProps = {
divider: false,
disabled: false,
header: false
};
|
examples/official-storybook/stories/addon-backgrounds.stories.js | kadirahq/react-storybook | import React from 'react';
import BaseButton from '../components/BaseButton';
export default {
title: 'Addons/Backgrounds',
parameters: {
backgrounds: {
default: 'dark',
values: [
{ name: 'white', value: '#ffffff' },
{ name: 'light', value: '#eeeeee' },
{ name: 'gray', value: '#cccccc' },
{ name: 'dark', value: '#222222' },
{ name: 'black', value: '#000000' },
],
},
},
};
const Template = (args) => <BaseButton {...args} />;
export const Story1 = Template.bind({});
Story1.args = {
label: 'You should be able to switch backgrounds for this story',
};
export const Story2 = Template.bind({});
Story2.args = {
label: 'This one too!',
};
export const Overridden = Template.bind({});
Overridden.args = {
label: 'This one should have different backgrounds',
};
Overridden.parameters = {
backgrounds: {
default: 'blue',
values: [
{ name: 'pink', value: 'hotpink' },
{ name: 'blue', value: 'deepskyblue' },
],
},
};
export const WithGradient = Template.bind({});
WithGradient.args = {
label: 'This one should have a nice gradient',
};
WithGradient.parameters = {
backgrounds: {
default: 'gradient',
values: [
{
name: 'gradient',
value:
'linear-gradient(90deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%)',
},
],
},
};
export const WithImage = Template.bind({});
WithImage.args = {
label: 'This one should have an image background',
};
WithImage.parameters = {
backgrounds: {
default: 'space',
values: [
{
name: 'space',
value: 'url(https://cdn.pixabay.com/photo/2017/08/30/01/05/milky-way-2695569_960_720.jpg)',
},
],
},
};
export const DisabledBackgrounds = Template.bind({});
DisabledBackgrounds.args = {
label: 'This one should not use backgrounds',
};
DisabledBackgrounds.parameters = {
backgrounds: { disable: true },
};
export const DisabledGrid = Template.bind({});
DisabledGrid.args = {
label: 'This one should not use grid',
};
DisabledGrid.parameters = {
backgrounds: {
grid: { disable: true },
},
};
export const GridCellProperties = Template.bind({});
GridCellProperties.args = {
label: 'This one should have different grid properties',
};
GridCellProperties.parameters = {
backgrounds: {
grid: {
cellSize: 10,
cellAmount: 4,
opacity: 0.2,
},
},
};
export const AlignedGridWhenFullScreen = Template.bind({});
AlignedGridWhenFullScreen.args = {
label: 'Grid should have an offset of 0 when in fullscreen',
};
AlignedGridWhenFullScreen.parameters = {
layout: 'fullscreen',
};
|
jenkins-design-language/src/js/components/material-ui/svg-icons/maps/local-pharmacy.js | alvarolobato/blueocean-plugin | import React from 'react';
import SvgIcon from '../../SvgIcon';
const MapsLocalPharmacy = (props) => (
<SvgIcon {...props}>
<path d="M21 5h-2.64l1.14-3.14L17.15 1l-1.46 4H3v2l2 6-2 6v2h18v-2l-2-6 2-6V5zm-5 9h-3v3h-2v-3H8v-2h3V9h2v3h3v2z"/>
</SvgIcon>
);
MapsLocalPharmacy.displayName = 'MapsLocalPharmacy';
MapsLocalPharmacy.muiName = 'SvgIcon';
export default MapsLocalPharmacy;
|
ajax/libs/material-ui/5.0.0-alpha.11/CircularProgress/CircularProgress.min.js | cdnjs/cdnjs | "use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.styles=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),React=_interopRequireWildcard(require("react")),_propTypes=_interopRequireDefault(require("prop-types")),_clsx=_interopRequireDefault(require("clsx")),_utils=require("@material-ui/utils"),_withStyles=_interopRequireDefault(require("../styles/withStyles")),_capitalize=_interopRequireDefault(require("../utils/capitalize")),SIZE=44,styles=function(e){return{root:{display:"inline-block"},determinate:{transition:e.transitions.create("transform")},indeterminate:{animation:"$circular-rotate 1.4s linear infinite"},colorPrimary:{color:e.palette.primary.main},colorSecondary:{color:e.palette.secondary.main},svg:{display:"block"},circle:{stroke:"currentColor"},circleDeterminate:{transition:e.transitions.create("stroke-dashoffset")},circleIndeterminate:{animation:"$circular-dash 1.4s ease-in-out infinite",strokeDasharray:"80px, 200px",strokeDashoffset:"0px"},"@keyframes circular-rotate":{"0%":{transformOrigin:"50% 50%"},"100%":{transform:"rotate(360deg)"}},"@keyframes circular-dash":{"0%":{strokeDasharray:"1px, 200px",strokeDashoffset:"0px"},"50%":{strokeDasharray:"100px, 200px",strokeDashoffset:"-15px"},"100%":{strokeDasharray:"100px, 200px",strokeDashoffset:"-125px"}},circleDisableShrink:{animation:"none"}}};exports.styles=styles;var CircularProgress=React.forwardRef(function(e,r){var t,a=e.classes,i=e.className,s=e.color,o=void 0===s?"primary":s,l=e.disableShrink,n=void 0!==l&&l,c=e.size,p=void 0===c?40:c,u=e.style,d=e.thickness,f=void 0===d?3.6:d,h=e.value,m=void 0===h?0:h,y=e.variant,_=void 0===y?"indeterminate":y,v=(0,_objectWithoutProperties2.default)(e,["classes","className","color","disableShrink","size","style","thickness","value","variant"]),x={},b={},k={};return"determinate"===_&&(t=2*Math.PI*((SIZE-f)/2),x.strokeDasharray=t.toFixed(3),k["aria-valuenow"]=Math.round(m),x.strokeDashoffset="".concat(((100-m)/100*t).toFixed(3),"px"),b.transform="rotate(-90deg)"),React.createElement("div",(0,_extends2.default)({className:(0,_clsx.default)(a.root,i,"determinate"===_?a.determinate:a.indeterminate,"inherit"!==o&&a["color".concat((0,_capitalize.default)(o))]),style:(0,_extends2.default)({width:p,height:p},b,u),ref:r,role:"progressbar"},k,v),React.createElement("svg",{className:a.svg,viewBox:"".concat(SIZE/2," ").concat(SIZE/2," ").concat(SIZE," ").concat(SIZE)},React.createElement("circle",{className:(0,_clsx.default)(a.circle,"determinate"===_?a.circleDeterminate:a.circleIndeterminate,n&&a.circleDisableShrink),style:x,cx:SIZE,cy:SIZE,r:(SIZE-f)/2,fill:"none",strokeWidth:f})))});"production"!==process.env.NODE_ENV&&(CircularProgress.propTypes={classes:_propTypes.default.object,className:_propTypes.default.string,color:_propTypes.default.oneOf(["inherit","primary","secondary"]),disableShrink:(0,_utils.chainPropTypes)(_propTypes.default.bool,function(e){return e.disableShrink&&e.variant&&"indeterminate"!==e.variant?new Error("Material-UI: You have provided the `disableShrink` prop with a variant other than `indeterminate`. This will have no effect."):null}),size:_propTypes.default.oneOfType([_propTypes.default.number,_propTypes.default.string]),style:_propTypes.default.object,thickness:_propTypes.default.number,value:_propTypes.default.number,variant:_propTypes.default.oneOf(["determinate","indeterminate"])});var _default=(0,_withStyles.default)(styles,{name:"MuiCircularProgress",flip:!1})(CircularProgress);exports.default=_default; |
src/containers/Articles/ArticlesPage/ArticlesPage.js | ReactPoland/react-community | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { push } from 'react-router-redux';
import permission from 'utils/privileges';
// COMPONENTS
import ArticlesList from './ArticlesList';
// LAYOUT
import Grid from 'react-bootstrap/lib/Grid';
import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col';
import FloatingActionButton from 'material-ui/FloatingActionButton';
import ContentAdd from 'material-ui/svg-icons/content/add';
const mappedState = ({ auth, articles }) => ({
loggedIn: auth.loggedIn,
articles: articles.all,
permissions: permission(auth.user)
});
const mappedActions = { redirect: push };
@connect(mappedState, mappedActions)
export default class ArticlesPage extends Component {
static propTypes = {
articles: PropTypes.array.isRequired,
redirect: PropTypes.func.isRequired,
loggedIn: PropTypes.bool.isRequired,
permissions: PropTypes.object.isRequired
}
redirectToArticle = (article) => {
this.props.redirect(`/article/${article.id}/${article.slug}`);
}
render() {
const { articles, loggedIn, permissions } = this.props;
// TODO: move to a separate component - rk
const AddArticleButton = (
<FloatingActionButton
style={{
position: 'fixed',
right: 40,
bottom: 40,
zIndex: 1000
}}
onClick={() => this.props.redirect('/articles/add')}
>
<ContentAdd />
</FloatingActionButton>
);
return (
<Grid style={{ position: 'relative', height: '100%' }}>
{loggedIn && permissions.isStaff && AddArticleButton}
<Row>
<Col xs={12}>
<h1>Articles</h1>
<ArticlesList
articles={articles}
onListItemClick={this.redirectToArticle}
/>
</Col>
</Row>
</Grid>
);
}
}
|
site/js/jquery-1.9.1.min.js | fosfozol/w2ui | /*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window); |
examples/counter/index.js | quamen/redux | import React from 'react';
import { Provider } from 'react-redux';
import App from './containers/App';
import configureStore from './store/configureStore';
const store = configureStore();
React.render(
<Provider store={store}>
{() => <App />}
</Provider>,
document.getElementById('root')
);
|
06-testing-redux/src/App.js | dtanzer/react-basic-examples | import React, { Component } from 'react';
import { GreeterContainer } from './Greeter'
class App extends Component {
render() {
return (
<GreeterContainer />
);
}
}
export default App;
|
docs/src/app/components/pages/components/Drawer/ExampleUndocked.js | barakmitz/material-ui | import React from 'react';
import Drawer from 'material-ui/Drawer';
import MenuItem from 'material-ui/MenuItem';
import RaisedButton from 'material-ui/RaisedButton';
export default class DrawerUndockedExample extends React.Component {
constructor(props) {
super(props);
this.state = {open: false};
}
handleToggle = () => this.setState({open: !this.state.open});
handleClose = () => this.setState({open: false});
render() {
return (
<div>
<RaisedButton
label="Open Drawer"
onTouchTap={this.handleToggle}
/>
<Drawer
docked={false}
width={200}
open={this.state.open}
onRequestChange={(open) => this.setState({open})}
>
<MenuItem onTouchTap={this.handleClose}>Menu Item</MenuItem>
<MenuItem onTouchTap={this.handleClose}>Menu Item 2</MenuItem>
</Drawer>
</div>
);
}
}
|
src/components/common/svg-icons/av/games.js | abzfarah/Pearson.NAPLAN.GnomeH | import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvGames = (props) => (
<SvgIcon {...props}>
<path d="M15 7.5V2H9v5.5l3 3 3-3zM7.5 9H2v6h5.5l3-3-3-3zM9 16.5V22h6v-5.5l-3-3-3 3zM16.5 9l-3 3 3 3H22V9h-5.5z"/>
</SvgIcon>
);
AvGames = pure(AvGames);
AvGames.displayName = 'AvGames';
AvGames.muiName = 'SvgIcon';
export default AvGames;
|
src/pages/merci.js | vitorbarbosa19/ziro-online | import React from 'react'
import BrandGallery from '../components/BrandGallery'
export default () => (
<BrandGallery brand='Merci' />
)
|
src/main.js | markwang2764/react-ant |
import 'antd/lib/style/index.less';
import 'antd/lib/style/components.less';
import './style.less';
import React from 'react';
import ReactDOM from 'react-dom';
import Routes from './routes/index';
ReactDOM.render(<Routes />, document.getElementById('app'));
|
src/main.js | hrnik/roofbar | import React from 'react'
import ReactDOM from 'react-dom'
import createStore from './store/createStore'
import AppContainer from './containers/AppContainer'
import './arrayinlcudespf.js'
// ========================================================
// Store Instantiation
// ========================================================
const initialState = window.__INITIAL_STATE__
const store = createStore(initialState)
// ========================================================
// Render Setup
// ========================================================
const MOUNT_NODE = document.getElementById('root')
let render = () => {
const routes = require('./routes/index').default(store)
ReactDOM.render(<AppContainer store={store} routes={routes} />, MOUNT_NODE)
}
// This code is excluded from production bundle
if (__DEV__) {
if (module.hot) {
// Development render functions
const renderApp = render
const renderError = error => {
const RedBox = require('redbox-react').default
ReactDOM.render(<RedBox error={error} />, MOUNT_NODE)
}
// Wrap render in try/catch
render = () => {
try {
renderApp()
} catch (error) {
console.error(error)
renderError(error)
}
}
// Setup hot module replacement
module.hot.accept('./routes/index', () =>
setImmediate(() => {
ReactDOM.unmountComponentAtNode(MOUNT_NODE)
render()
})
)
}
} else {
Raven.config('https://6da2f7d95df94c1b958748563f2435bd@sentry.io/177640').install()
}
// This is the "Offline page" service worker
// Add this below content to your HTML page, or add the js file to your page at the very top to register sercie worker
if (navigator && navigator.serviceWorker) {
// Register the ServiceWorker
navigator.serviceWorker
.register('service-worker.js', {
scope: './'
})
.then(function (reg) {
console.log('Service worker has been registered for scope:' + reg.scope)
})
} else {
console.log('SW active service worker found, no need to register')
}
// ========================================================
// Go!
// ========================================================
render()
|
src/screens/tab-based/post-list.js | Clip-sub/CSClient-RN | /**
* @flow
*/
'use strict';
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { View, Text, FlatList, StyleSheet } from 'react-native';
// import { getPosts, clearPosts } from '../actions/actions-posts';
//import { PostMenuBar } from './post-menu-bar';
//import { ItemPostCard } from '../../components/post-listing/item-post-card';
import { ItemPostGrid } from '../../components/post-listing/item-post-grid';
import { ItemPostCard } from '../../components/post-listing/item-post-card';
import { apiPosts } from '../../api/api-posts';
export class PostList extends Component {
static propTypes = {
postItems: PropTypes.arrayOf(PropTypes.object),
status: PropTypes.oneOf(['loading', 'error', 'loaded']),
viewMode: PropTypes.oneOf(['list', 'grid']),
};
static defaultProps = {
status: 'loading',
viewMode: 'grid',
};
static navigatorStyle = {
navBarSubtitleFontSize: 10,
drawUnderNavBar: false,
navBarTranslucent: true,
navBarBlur: true,
};
static navigatorButtons = {
leftButtons: [
{
title: 'Profile',
icon: require('../../assets/header/ic_person_outline.png'),
id: 'profile',
},
],
};
constructor(props) {
super(props);
this.page = 1;
this.state = {
posts: [],
};
this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
}
componentDidMount() {
apiPosts
.listPosts({ page: this.page })
.then(resp => {
console.log(resp);
this.setState({ posts: resp });
})
.catch(e => console.log(e));
}
onNavigatorEvent(event) {
if (event.type === 'NavBarButtonPress') {
if (event.id === 'profile') {
this.props.navigator.showModal({
screen: 'screens.Profile',
});
}
}
}
onEndReached = () => {
/*const { getPosts, posts } = this.props;
const { loading, page, totalPages, args } = posts;
if (!loading && page < totalPages) {
console.log(posts);
return getPosts(page + 1, args);
}*/
};
//renderPostMenuBar = () => <PostMenuBar {...this.props} />;
//renderLoadingIndicator = () => <Spinner color="red" />;
render() {
const { posts } = this.state;
return (
<View style={styles.container}>
<FlatList
data={posts}
keyExtractor={item => item.id}
renderItem={({ item }) => <ItemPostCard post={item} />}
onEndReached={this.onEndReached}
onEndReachedThreshold={3}
numColumns={1}
style={{ alignSelf: 'stretch' }}
ListFooterComponent={this.renderLoadingIndicator}
/>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
backgroundColor: '#fff',
},
columnWrapper: {
marginTop: 6,
flexWrap: 'wrap',
justifyContent: 'space-between',
},
});
|
docs/src/CodeExample.js | bvasko/react-bootstrap | import React from 'react';
export default class CodeExample extends React.Component {
render() {
return (
<pre className="cm-s-solarized cm-s-light">
<code>
{this.props.codeText}
</code>
</pre>
);
}
componentDidMount() {
if (CodeMirror === undefined) {
return;
}
CodeMirror.runMode(
this.props.codeText,
this.props.mode,
React.findDOMNode(this).children[0]
);
}
}
|
packages/react-scripts/fixtures/kitchensink/src/features/env/NodePath.js | dsopel94/create-react-app | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import load from 'absoluteLoad';
export default class extends Component {
static propTypes = {
onReady: PropTypes.func.isRequired,
};
constructor(props) {
super(props);
this.state = { users: [] };
}
async componentDidMount() {
const users = load();
this.setState({ users });
}
componentDidUpdate() {
this.props.onReady();
}
render() {
return (
<div id="feature-node-path">
{this.state.users.map(user => <div key={user.id}>{user.name}</div>)}
</div>
);
}
}
|
components/mainLayout.js | batusai513/next-saga-boilerplate | import React from 'react';
import P from 'prop-types';
import Header from './header';
export default function MainLayout({ children }) {
return (
<div>
<Header />
{children}
</div>
);
}
MainLayout.propTypes = {
children: P.node.isRequired,
};
|
pages/getting-started/page-layout-examples/blog.js | Kagami/material-ui | import 'docs/src/modules/components/bootstrap';
// --- Post bootstrap -----
import React from 'react';
import AppTheme from 'docs/src/modules/components/AppTheme';
import Blog from 'docs/src/pages/getting-started/page-layout-examples/blog/Blog';
function Page() {
return (
<AppTheme
title="Blog page layout example - Material-UI"
description="An example layout for creating a blog or newsletter."
>
<Blog />
</AppTheme>
);
}
export default Page;
|
techCurriculum/ui/solutions/4.3/src/App.js | tadas412/EngineeringEssentials | /**
* Copyright 2017 Goldman Sachs.
* 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 React from 'react';
import Title from './components/Title';
import Card from './components/Card';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
cards: [
{
author: 'John Smith',
text: 'React is so cool!'
},
{
author: 'Jane Doe',
text: 'I use React for all my projects!'
}
]
};
}
render() {
const cards = this.state.cards.map((card, index) => (
<Card author={card.author}
text={card.text}
key={index} />
));
return (
<div>
<Title />
{ cards }
</div>
);
}
}
export default App;
|
blueprints/form/files/__root__/forms/__name__Form/__name__Form.js | stefanosKarantin/stefanos-react-prj | import React from 'react'
import { reduxForm } from 'redux-form'
export const fields = []
const validate = (values) => {
const errors = {}
return errors
}
type Props = {
handleSubmit: Function,
fields: Object,
}
export class <%= pascalEntityName %> extends React.Component {
props: Props;
defaultProps = {
fields: {},
}
render() {
const { fields, handleSubmit } = this.props
return (
<form onSubmit={handleSubmit}>
</form>
)
}
}
<%= pascalEntityName %> = reduxForm({
form: '<%= pascalEntityName %>',
fields,
validate
})(<%= pascalEntityName %>)
export default <%= pascalEntityName %>
|
ajax/libs/rxjs/2.1.1/rx.js | idleberg/cdnjs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
(function (window, undefined) {
var freeExports = typeof exports == 'object' && exports &&
(typeof global == 'object' && global && global == global.global && (window = global), exports);
/**
* @name Rx
* @type Object
*/
var Rx = { Internals: {} };
// Defaults
function noop() { }
function identity(x) { return x; }
function defaultNow() { return new Date().getTime(); }
function defaultComparer(x, y) { return x === y; }
function defaultSubComparer(x, y) { return x - y; }
function defaultKeySerializer(x) { return x.toString(); }
function defaultError(err) { throw err; }
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed() {
if (this.isDisposed) {
throw new Error(objectDisposed);
}
}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
/** @private */
var inherits = this.inherits = Rx.Internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
/** @private */
var addProperties = Rx.Internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.Internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
// Collection polyfills
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// Utilities
if (!Function.prototype.bind) {
Function.prototype.bind = function (that) {
var target = this,
args = slice.call(arguments, 1);
var bound = function () {
if (this instanceof bound) {
function F() { }
F.prototype = target.prototype;
var self = new F();
var result = target.apply(self, args.concat(slice.call(arguments)));
if (Object(result) === result) {
return result;
}
return self;
} else {
return target.apply(that, args.concat(slice.call(arguments)));
}
};
return bound;
};
}
var boxedString = Object("a"),
splitString = boxedString[0] != "a" || !(0 in boxedString);
if (!Array.prototype.every) {
Array.prototype.every = function every(fun /*, thisp */) {
var object = Object(this),
self = splitString && {}.toString.call(this) == "[object String]" ?
this.split("") :
object,
length = self.length >>> 0,
thisp = arguments[1];
if ({}.toString.call(fun) != "[object Function]") {
throw new TypeError(fun + " is not a function");
}
for (var i = 0; i < length; i++) {
if (i in self && !fun.call(thisp, self[i], i, object)) {
return false;
}
}
return true;
};
}
if (!Array.prototype.map) {
Array.prototype.map = function map(fun /*, thisp*/) {
var object = Object(this),
self = splitString && {}.toString.call(this) == "[object String]" ?
this.split("") :
object,
length = self.length >>> 0,
result = Array(length),
thisp = arguments[1];
if ({}.toString.call(fun) != "[object Function]") {
throw new TypeError(fun + " is not a function");
}
for (var i = 0; i < length; i++) {
if (i in self)
result[i] = fun.call(thisp, self[i], i, object);
}
return result;
};
}
if (!Array.prototype.filter) {
Array.prototype.filter = function (predicate) {
var results = [], item, t = new Object(this);
for (var i = 0, len = t.length >>> 0; i < len; i++) {
item = t[i];
if (i in t && predicate.call(arguments[1], item, i, t)) {
results.push(item);
}
}
return results;
};
}
if (!Array.isArray) {
Array.isArray = function (arg) {
return Object.prototype.toString.call(arg) == '[object Array]';
};
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function indexOf(searchElement) {
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 1) {
n = Number(arguments[1]);
if (n != n) {
n = 0;
} else if (n != 0 && n != Infinity && n != -Infinity) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
};
}
// Collections
var IndexedItem = function (id, value) {
this.id = id;
this.value = value;
};
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
if (c === 0) {
c = this.id - other.id;
}
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) {
return;
}
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) {
return;
}
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
if (index === undefined) {
index = 0;
}
if (index >= this.length || index < 0) {
return;
}
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () {
return this.items[0].value;
};
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
delete this.items[this.length];
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
*
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);
this.isDisposed = false;
this.length = this.disposables.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
*
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
*
* @memberOf CompositeDisposable#
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*
* @memberOf CompositeDisposable#
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable.
*
* @memberOf CompositeDisposable#
*/
CompositeDisposablePrototype.clear = function () {
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
};
/**
* Determines whether the CompositeDisposable contains a specific disposable.
*
* @memberOf CompositeDisposable#
* @param {Mixed} item Disposable to search for.
* @returns {Boolean} true if the disposable was found; otherwise, false.
*/
CompositeDisposablePrototype.contains = function (item) {
return this.disposables.indexOf(item) !== -1;
};
/**
* Converts the existing CompositeDisposable to an array of disposables
*
* @memberOf CompositeDisposable#
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action;
};
/**
* Performs the task of cleaning up resources.
*
* @memberOf Disposable#
*/
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
*
* @static
* @memberOf Disposable
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*
* @static
* @memberOf Disposable
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
/**
* Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
* If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error.
*
* @constructor
*/
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {
this.isDisposed = false;
this.current = null;
};
var SingleAssignmentDisposablePrototype = SingleAssignmentDisposable.prototype;
/**
* Gets or sets the underlying disposable. After disposal, the result of getting this method is undefined.
*
* @memberOf SingleAssignmentDisposable#
* @param {Disposable} [value] The new underlying disposable.
* @returns {Disposable} The underlying disposable.
*/
SingleAssignmentDisposablePrototype.disposable = function (value) {
return !value ? this.getDisposable() : this.setDisposable(value);
};
/**
* Gets the underlying disposable. After disposal, the result of getting this method is undefined.
*
* @memberOf SingleAssignmentDisposable#
* @returns {Disposable} The underlying disposable.
*/
SingleAssignmentDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
*
* @memberOf SingleAssignmentDisposable#
* @param {Disposable} value The new underlying disposable.
*/
SingleAssignmentDisposablePrototype.setDisposable = function (value) {
if (this.current) {
throw new Error('Disposable has already been assigned');
}
var shouldDispose = this.isDisposed;
if (!shouldDispose) {
this.current = value;
}
if (shouldDispose && value) {
value.dispose();
}
};
/**
* Disposes the underlying disposable.
*
* @memberOf SingleAssignmentDisposable#
*/
SingleAssignmentDisposablePrototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
if (old) {
old.dispose();
}
};
/**
* Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.
*
* @constructor
*/
var SerialDisposable = Rx.SerialDisposable = function () {
this.isDisposed = false;
this.current = null;
};
/**
* Gets the underlying disposable.
* @return The underlying disposable</returns>
*/
SerialDisposable.prototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
*
* @memberOf SerialDisposable#
* @param {Disposable} value The new underlying disposable.
*/
SerialDisposable.prototype.setDisposable = function (value) {
var shouldDispose = this.isDisposed, old;
if (!shouldDispose) {
old = this.current;
this.current = value;
}
if (old) {
old.dispose();
}
if (shouldDispose && value) {
value.dispose();
}
};
/**
* Gets or sets the underlying disposable.
* If the SerialDisposable has already been disposed, assignment to this property causes immediate disposal of the given disposable object. Assigning this property disposes the previous disposable object.
*
* @memberOf SerialDisposable#
* @param {Disposable} [value] The new underlying disposable.
* @returns {Disposable} The underlying disposable.
*/
SerialDisposable.prototype.disposable = function (value) {
if (!value) {
return this.getDisposable();
} else {
this.setDisposable(value);
}
};
/**
* Disposes the underlying disposable as well as all future replacements.
*
* @memberOf SerialDisposable#
*/
SerialDisposable.prototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
if (old) {
old.dispose();
}
};
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
/**
* @constructor
* @private
*/
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
/** @private */
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed) {
if (!this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
*
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*
* @memberOf RefCountDisposable#
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
if (!this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
*
* @memberOf RefCountDisposable#
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.H
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
/**
* @constructor
* @private
*/
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler, this.disposable = disposable, this.isDisposed = false;
}
/**
* @private
* @memberOf ScheduledDisposable#
*/
ScheduledDisposable.prototype.dispose = function () {
var parent = this;
this.scheduler.schedule(function () {
if (!parent.isDisposed) {
parent.isDisposed = true;
parent.disposable.dispose();
}
});
};
/**
* @private
* @constructor
*/
function ScheduledItem(scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.invoke = function () {
this.disposable.disposable(this.invokeCore());
};
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
/**
* @private
* @memberOf ScheduledItem#
*/
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
/**
* @constructor
* @private
*/
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
*
* @memberOf Scheduler#
* @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.
* @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.
*/
schedulerProto.catchException = function (handler) {
return new CatchScheduler(this, handler);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
*
* @memberOf Scheduler#
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
schedulerProto.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, function () {
action();
});
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
*
* @memberOf Scheduler#
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
schedulerProto.schedulePeriodicWithState = function (state, period, action) {
var s = state, id = window.setInterval(function () {
s = action(s);
}, period);
return disposableCreate(function () {
window.clearInterval(id);
});
};
/**
* Schedules an action to be executed.
*
* @memberOf Scheduler#
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
*
* @memberOf Scheduler#
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
*
* @memberOf Scheduler#
* @param {Function} action Action to execute.
* @param {Number}dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
*
* @memberOf Scheduler#
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
*
* @memberOf Scheduler#
* @param {Function} action Action to execute.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
*
* @memberOf Scheduler#
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/**
* Schedules an action to be executed recursively.
*
* @memberOf Scheduler#
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () {
self(_action);
});
});
};
/**
* Schedules an action to be executed recursively.
*
* @memberOf Scheduler#
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState({ first: state, second: action }, function (s, p) {
return invokeRecImmediate(s, p);
});
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
*
* @memberOf Scheduler
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, function (_action, self) {
_action(function (dt) {
self(_action, dt);
});
});
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
*
* @memberOf Scheduler
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
*
* @memberOf Scheduler
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, function (_action, self) {
_action(function (dt) {
self(_action, dt);
});
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
*
* @memberOf Scheduler
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
*
* @static
* @memberOf Scheduler
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
if (timeSpan < 0) {
timeSpan = 0;
}
return timeSpan;
};
return Scheduler;
}());
var schedulerNoBlockError = 'Scheduler is not allowed to block the thread';
/**
* Gets a scheduler that schedules work immediately on the current thread.
*
* @memberOf Scheduler
*/
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) {
return action(this, state);
}
function scheduleRelative(state, dueTime, action) {
if (dueTime > 0) throw new Error(schedulerNoBlockError);
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
/**
* @private
* @constructor
*/
function Trampoline() {
queue = new PriorityQueue(4);
}
/**
* @private
* @memberOf Trampoline
*/
Trampoline.prototype.dispose = function () {
queue = null;
};
/**
* @private
* @memberOf Trampoline
*/
Trampoline.prototype.run = function () {
var item;
while (queue.length > 0) {
item = queue.dequeue();
if (!item.isCancelled()) {
while (item.dueTime - Scheduler.now() > 0) {
}
if (!item.isCancelled()) {
item.invoke();
}
}
}
};
function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + Scheduler.normalize(dueTime),
si = new ScheduledItem(this, state, action, dt),
t;
if (!queue) {
t = new Trampoline();
try {
queue.enqueue(si);
t.run();
} catch (e) {
throw e;
} finally {
t.dispose();
}
} else {
queue.enqueue(si);
}
return si.disposable;
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
currentScheduler.scheduleRequired = function () { return queue === null; };
currentScheduler.ensureTrampoline = function (action) {
if (queue === null) {
return this.schedule(action);
} else {
return action();
}
};
return currentScheduler;
}());
/**
* @private
*/
var SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
/**
* @constructor
* @private
*/
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
/** Provides a set of extension methods for virtual time scheduling. */
Rx.VirtualTimeScheduler = (function (_super) {
function localNow() {
return this.toDateTimeOffset(this.clock);
}
function scheduleNow(state, action) {
return this.scheduleAbsoluteWithState(state, this.clock, action);
}
function scheduleRelative(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime), action);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleRelativeWithState(state, this.toRelative(dueTime - this.now()), action);
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
inherits(VirtualTimeScheduler, _super);
/**
* Creates a new virtual time scheduler with the specified initial clock value and absolute time comparer.
*
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function VirtualTimeScheduler(initialClock, comparer) {
this.clock = initialClock;
this.comparer = comparer;
this.isEnabled = false;
this.queue = new PriorityQueue(1024);
_super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
var VirtualTimeSchedulerPrototype = VirtualTimeScheduler.prototype;
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be emulated using recursive scheduling.
*
* @memberOf VirtualTimeScheduler#
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
VirtualTimeSchedulerPrototype.schedulePeriodicWithState = function (state, period, action) {
var s = new SchedulePeriodicRecursive(this, state, period, action);
return s.start();
};
/**
* Schedules an action to be executed after dueTime.
*
* @memberOf VirtualTimeScheduler#
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelativeWithState = function (state, dueTime, action) {
var runAt = this.add(this.clock, dueTime);
return this.scheduleAbsoluteWithState(state, runAt, action);
};
/**
* Schedules an action to be executed at dueTime.
*
* @memberOf VirtualTimeScheduler#
* @param {Number} dueTime Relative time after which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleRelative = function (dueTime, action) {
return this.scheduleRelativeWithState(action, dueTime, invokeAction);
};
/**
* Starts the virtual time scheduler.
*
* @memberOf VirtualTimeScheduler#
*/
VirtualTimeSchedulerPrototype.start = function () {
var next;
if (!this.isEnabled) {
this.isEnabled = true;
do {
next = this.getNext();
if (next !== null) {
if (this.comparer(next.dueTime, this.clock) > 0) {
this.clock = next.dueTime;
}
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled);
}
};
/**
* Stops the virtual time scheduler.
*
* @memberOf VirtualTimeScheduler#
*/
VirtualTimeSchedulerPrototype.stop = function () {
this.isEnabled = false;
};
/**
* Advances the scheduler's clock to the specified time, running all work till that point.
*
* @param {Number} time Absolute time to advance the scheduler's clock to.
*/
VirtualTimeSchedulerPrototype.advanceTo = function (time) {
var next;
var dueToClock = this.comparer(this.clock, time);
if (this.comparer(this.clock, time) > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
if (!this.isEnabled) {
this.isEnabled = true;
do {
next = this.getNext();
if (next !== null && this.comparer(next.dueTime, time) <= 0) {
if (this.comparer(next.dueTime, this.clock) > 0) {
this.clock = next.dueTime;
}
next.invoke();
} else {
this.isEnabled = false;
}
} while (this.isEnabled)
this.clock = time;
}
};
/**
* Advances the scheduler's clock by the specified relative time, running all work scheduled for that timespan.
*
* @memberOf VirtualTimeScheduler#
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.advanceBy = function (time) {
var dt = this.add(this.clock, time);
var dueToClock = this.comparer(this.clock, dt);
if (dueToClock > 0) {
throw new Error(argumentOutOfRange);
}
if (dueToClock === 0) {
return;
}
return this.advanceTo(dt);
};
/**
* Advances the scheduler's clock by the specified relative time.
*
* @memberOf VirtualTimeScheduler#
* @param {Number} time Relative time to advance the scheduler's clock by.
*/
VirtualTimeSchedulerPrototype.sleep = function (time) {
var dt = this.add(this.clock, time);
if (this.comparer(this.clock, dt) >= 0) {
throw new Error(argumentOutOfRange);
}
this.clock = dt;
};
/**
* Gets the next scheduled item to be executed.
*
* @memberOf VirtualTimeScheduler#
* @returns {ScheduledItem} The next scheduled item.
*/
VirtualTimeSchedulerPrototype.getNext = function () {
var next;
while (this.queue.length > 0) {
next = this.queue.peek();
if (next.isCancelled()) {
this.queue.dequeue();
} else {
return next;
}
}
return null;
};
/**
* Schedules an action to be executed at dueTime.
*
* @memberOf VirtualTimeScheduler#
* @param {Scheduler} scheduler Scheduler to execute the action on.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsolute = function (dueTime, action) {
return this.scheduleAbsoluteWithState(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
*
* @memberOf VirtualTimeScheduler#
* @param {Mixed} state State passed to the action to be executed.
* @param {Number} dueTime Absolute time at which to execute the action.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
VirtualTimeSchedulerPrototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
var self = this,
run = function (scheduler, state1) {
self.queue.remove(si);
return action(scheduler, state1);
},
si = new ScheduledItem(self, state, run, dueTime, self.comparer);
self.queue.enqueue(si);
return si.disposable;
}
return VirtualTimeScheduler;
}(Scheduler));
/** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */
Rx.HistoricalScheduler = (function (_super) {
inherits(HistoricalScheduler, _super);
/**
* Creates a new historical scheduler with the specified initial clock value.
*
* @constructor
* @param {Number} initialClock Initial value for the clock.
* @param {Function} comparer Comparer to determine causality of events based on absolute time.
*/
function HistoricalScheduler(initialClock, comparer) {
var clock = initialClock == null ? 0 : initialClock;
var cmp = comparer || defaultSubComparer;
_super.call(this, clock, cmp);
}
var HistoricalSchedulerProto = HistoricalScheduler.prototype;
/**
* Adds a relative time value to an absolute time value.
*
* @memberOf HistoricalScheduler
* @param {Number} absolute Absolute virtual time value.
* @param {Number} relative Relative virtual time value to add.
* @return {Number} Resulting absolute virtual time sum value.
*/
HistoricalSchedulerProto.add = function (absolute, relative) {
return absolute + relative;
};
/**
* @private
* @memberOf HistoricalScheduler
*/
HistoricalSchedulerProto.toDateTimeOffset = function (absolute) {
return new Date(absolute).getTime();
};
/**
* Converts the TimeSpan value to a relative virtual time value.
*
* @memberOf HistoricalScheduler
* @param {Number} timeSpan TimeSpan value to convert.
* @return {Number} Corresponding relative virtual time value.
*/
HistoricalSchedulerProto.toRelative = function (timeSpan) {
return timeSpan;
};
return HistoricalScheduler;
}(Rx.VirtualTimeScheduler));
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*
* @memberOf Scheduler
*/
var timeoutScheduler = Scheduler.timeout = (function () {
function postMessageSupported () {
// Ensure not in a worker
if (!window.postMessage || window.importScripts) { return false; }
var isAsync = false,
oldHandler = window.onmessage;
// Test for async
window.onmessage = function () { isAsync = true; };
window.postMessage('','*');
window.onmessage = oldHandler;
return isAsync;
}
var scheduleMethod, clearMethod = noop;
if (typeof window.process !== 'undefined' && typeof window.process === '[object process]') {
scheduleMethod = window.process.nextTick;
} else if (typeof window.setImmediate === 'function') {
scheduleMethod = window.setImmediate;
clearMethod = window.clearImmediate;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (window.addEventListener) {
window.addEventListener('message', onGlobalPostMessage, false);
} else {
window.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
window.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!window.MessageChannel) {
scheduleMethod = function (action) {
var channel = new window.MessageChannel();
channel.port1.onmessage = function (event) {
action();
};
channel.port2.postMessage();
};
} else if ('document' in window && 'onreadystatechange' in window.document.createElement('script')) {
var scriptElement = window.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
window.document.documentElement.appendChild(scriptElement);
} else {
scheduleMethod = function (action) { return window.setTimeout(action, 0); };
clearMethod = window.clearTimeout;
}
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = window.setTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
window.clearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
/** @private */
var CatchScheduler = (function (_super) {
function localNow() {
return this._scheduler.now();
}
function scheduleNow(state, action) {
return this._scheduler.scheduleWithState(state, this._wrap(action));
}
function scheduleRelative(state, dueTime, action) {
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action));
}
function scheduleAbsolute(state, dueTime, action) {
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action));
}
inherits(CatchScheduler, _super);
/** @private */
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
_super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
/** @private */
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
/** @private */
CatchScheduler.prototype._wrap = function (action) {
var parent = this;
return function (self, state) {
try {
return action(parent._getRecursiveWrapper(self), state);
} catch (e) {
if (!parent._handler(e)) { throw e; }
return disposableEmpty;
}
};
};
/** @private */
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {
if (!this._recursiveOriginal !== scheduler) {
this._recursiveOriginal = scheduler;
var wrapper = this._clone(scheduler);
wrapper._recursiveOriginal = scheduler;
wrapper._recursiveWrapper = wrapper;
this._recursiveWrapper = wrapper;
}
return this._recursiveWrapper;
};
/** @private */
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var self = this, failed = false, d = new SingleAssignmentDisposable();
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) {
if (failed) { return null; }
try {
return action(state1);
} catch (e) {
failed = true;
if (!self._handler(e)) { throw e; }
d.dispose();
return null;
}
}));
return d;
};
return CatchScheduler;
}(Scheduler));
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {
this.hasValue = hasValue == null ? false : hasValue;
this.kind = kind;
}
var NotificationPrototype = Notification.prototype;
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
NotificationPrototype.accept = function (observerOrOnNext, onError, onCompleted) {
if (arguments.length === 1 && typeof observerOrOnNext === 'object') {
return this._acceptObservable(observerOrOnNext);
}
return this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notification
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
NotificationPrototype.toObservable = function (scheduler) {
var notification = this;
scheduler = scheduler || immediateScheduler;
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
notification._acceptObservable(observer);
if (notification.kind === 'N') {
observer.onCompleted();
}
});
});
};
NotificationPrototype.equals = function (other) {
var otherString = other == null ? '' : other.toString();
return this.toString() === otherString;
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
*
* @static
* @memberOf Notification
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept (onNext) {
return onNext(this.value);
}
function _acceptObservable(observer) {
return observer.onNext(this.value);
}
function toString () {
return 'OnNext(' + this.value + ')';
}
return function (value) {
var notification = new Notification('N', true);
notification.value = value;
notification._accept = _accept.bind(notification);
notification._acceptObservable = _acceptObservable.bind(notification);
notification.toString = toString.bind(notification);
return notification;
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
*
* @static s
* @memberOf Notification
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) {
return onError(this.exception);
}
function _acceptObservable(observer) {
return observer.onError(this.exception);
}
function toString () {
return 'OnError(' + this.exception + ')';
}
return function (exception) {
var notification = new Notification('E');
notification.exception = exception;
notification._accept = _accept.bind(notification);
notification._acceptObservable = _acceptObservable.bind(notification);
notification.toString = toString.bind(notification);
return notification;
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
*
* @static
* @memberOf Notification
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) {
return onCompleted();
}
function _acceptObservable(observer) {
return observer.onCompleted();
}
function toString () {
return 'OnCompleted()';
}
return function () {
var notification = new Notification('C');
notification._accept = _accept.bind(notification);
notification._acceptObservable = _acceptObservable.bind(notification);
notification.toString = toString.bind(notification);
return notification;
};
}());
/**
* @constructor
* @private
*/
var Enumerator = Rx.Internals.Enumerator = function (moveNext, getCurrent, dispose) {
this.moveNext = moveNext;
this.getCurrent = getCurrent;
this.dispose = dispose;
};
/**
* @static
* @memberOf Enumerator
* @private
*/
var enumeratorCreate = Enumerator.create = function (moveNext, getCurrent, dispose) {
var done = false;
dispose || (dispose = noop);
return new Enumerator(function () {
if (done) {
return false;
}
var result = moveNext();
if (!result) {
done = true;
dispose();
}
return result;
}, function () { return getCurrent(); }, function () {
if (!done) {
dispose();
done = true;
}
});
};
/** @private */
var Enumerable = Rx.Internals.Enumerable = (function () {
/**
* @constructor
* @private
*/
function Enumerable(getEnumerator) {
this.getEnumerator = getEnumerator;
}
/**
* @private
* @memberOf Enumerable#
*/
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e = sources.getEnumerator(), isDisposed = false, subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, ex, hasNext = false;
if (!isDisposed) {
try {
hasNext = e.moveNext();
if (hasNext) {
current = e.getCurrent();
} else {
e.dispose();
}
} catch (exception) {
ex = exception;
e.dispose();
}
} else {
return;
}
if (ex) {
observer.onError(ex);
return;
}
if (!hasNext) {
observer.onCompleted();
return;
}
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () { self(); })
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
e.dispose();
}));
});
};
/**
* @private
* @memberOf Enumerable#
*/
Enumerable.prototype.catchException = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e = sources.getEnumerator(), isDisposed = false, lastException;
var subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, ex, hasNext;
hasNext = false;
if (!isDisposed) {
try {
hasNext = e.moveNext();
if (hasNext) {
current = e.getCurrent();
}
} catch (exception) {
ex = exception;
}
} else {
return;
}
if (ex) {
observer.onError(ex);
return;
}
if (!hasNext) {
if (lastException) {
observer.onError(lastException);
} else {
observer.onCompleted();
}
return;
}
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(
observer.onNext.bind(observer),
function (exn) {
lastException = exn;
self();
},
observer.onCompleted.bind(observer)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
return Enumerable;
}());
/**
* @static
* @private
* @memberOf Enumerable
*/
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount === undefined) {
repeatCount = -1;
}
return new Enumerable(function () {
var current, left = repeatCount;
return enumeratorCreate(function () {
if (left === 0) {
return false;
}
if (left > 0) {
left--;
}
current = value;
return true;
}, function () { return current; });
});
};
/**
* @static
* @private
* @memberOf Enumerable
*/
var enumerableFor = Enumerable.forEach = function (source, selector) {
selector || (selector = identity);
return new Enumerable(function () {
var current, index = -1;
return enumeratorCreate(
function () {
if (++index < source.length) {
current = selector(source[index], index);
return true;
}
return false;
},
function () { return current; }
);
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
*
* @param observer Observer object.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) {
return n.accept(observer);
};
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
* If a violation is detected, an Error is thrown from the offending observer method call.
*
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/
Observer.prototype.checked = function () { return new CheckedObserver(this); };
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
*
* @static
* @memberOf Observer
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler) {
return new AnonymousObserver(function (x) {
return handler(notificationCreateOnNext(x));
}, function (exception) {
return handler(notificationCreateOnError(exception));
}, function () {
return handler(notificationCreateOnCompleted());
});
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.Internals.AbstractObserver = (function (_super) {
inherits(AbstractObserver, _super);
/**
* Creates a new observer in a non-stopped state.
*
* @constructor
*/
function AbstractObserver() {
this.isStopped = false;
_super.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
*
* @memberOf AbstractObserver
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) {
this.next(value);
}
};
/**
* Notifies the observer that an exception has occurred.
*
* @memberOf AbstractObserver
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function () {
if (!this.isStopped) {
this.isStopped = true;
this.error(true);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (_super) {
inherits(AnonymousObserver, _super);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
*
* @constructor
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
_super.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
*
* @memberOf AnonymousObserver
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
*
* @memberOf AnonymousObserver
* @param {Any{ error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (exception) {
this._onError(exception);
};
/**
* Calls the onCompleted action.
*
* @memberOf AnonymousObserver
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var CheckedObserver = (function (_super) {
inherits(CheckedObserver, _super);
function CheckedObserver(observer) {
_super.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
try {
this._observer.onNext(value);
} catch (e) {
throw e;
} finally {
this._state = 0;
}
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
try {
this._observer.onError(err);
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
try {
this._observer.onCompleted();
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
/** @private */
var ScheduledObserver = Rx.Internals.ScheduledObserver = (function (_super) {
inherits(ScheduledObserver, _super);
function ScheduledObserver(scheduler, observer) {
_super.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
/** @private */
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () {
self.observer.onNext(value);
});
};
/** @private */
ScheduledObserver.prototype.error = function (exception) {
var self = this;
this.queue.push(function () {
self.observer.onError(exception);
});
};
/** @private */
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () {
self.observer.onCompleted();
});
};
/** @private */
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
/** @private */
ScheduledObserver.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
/** @private */
var ObserveOnObserver = (function (_super) {
inherits(ObserveOnObserver, _super);
/** @private */
function ObserveOnObserver() {
_super.apply(this, arguments);
}
/** @private */
ObserveOnObserver.prototype.next = function (value) {
_super.prototype.next.call(this, value);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.error = function (e) {
_super.prototype.error.call(this, e);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.completed = function () {
_super.prototype.completed.call(this);
this.ensureActive();
};
return ObserveOnObserver;
})(ScheduledObserver);
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
/**
* @constructor
* @private
*/
function Observable(subscribe) {
this._subscribe = subscribe;
}
observableProto = Observable.prototype;
observableProto.finalValue = function () {
var source = this;
return new AnonymousObservable(function (observer) {
var hasValue = false, value;
return source.subscribe(function (x) {
hasValue = true;
value = x;
}, observer.onError.bind(observer), function () {
if (!hasValue) {
observer.onError(new Error(sequenceContainsNoElements));
} else {
observer.onNext(value);
observer.onCompleted();
}
});
});
};
/**
* Subscribes an observer to the observable sequence.
*
* @example
* 1 - source.subscribe();
* 2 - source.subscribe(observer);
* 3 - source.subscribe(function (x) { console.log(x); });
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
var subscriber;
if (typeof observerOrOnNext === 'object') {
subscriber = observerOrOnNext;
} else {
subscriber = observerCreate(observerOrOnNext, onError, onCompleted);
}
return this._subscribe(subscriber);
};
/**
* Creates a list from an observable sequence.
*
* @memberOf Observable
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
function accumulator(list, i) {
var newList = list.slice(0);
newList.push(i);
return newList;
}
return this.scan([], accumulator).startWith([]).finalValue();
}
return Observable;
})();
/**
* Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
*
* @example
* 1 - res = Rx.Observable.start(function () { console.log('hello'); });
* 2 - res = Rx.Observable.start(function () { console.log('hello'); }, Rx.Scheduler.timeout);
* 2 - res = Rx.Observable.start(function () { this.log('hello'); }, Rx.Scheduler.timeout, console);
*
* @param {Function} func Function to run asynchronously.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Observable} An observable sequence exposing the function's result value, or an exception.
*
* Remarks
* * The function is called immediately, not during the subscription of the resulting sequence.
* * Multiple subscriptions to the resulting sequence can observe the function's result.
*/
Observable.start = function (func, scheduler, context) {
return observableToAsync(func, scheduler)();
};
/**
* Converts the function into an asynchronous function. Each invocation of the resulting asynchronous function causes an invocation of the original synchronous function on the specified scheduler.
*
* @example
* 1 - res = Rx.Observable.toAsync(function (x, y) { return x + y; })(4, 3);
* 2 - res = Rx.Observable.toAsync(function (x, y) { return x + y; }, Rx.Scheduler.timeout)(4, 3);
* 2 - res = Rx.Observable.toAsync(function (x) { this.log(x); }, Rx.Scheduler.timeout, console)('hello');
*
* @param function Function to convert to an asynchronous function.
* @param {Scheduler} [scheduler] Scheduler to run the function on. If not specified, defaults to Scheduler.timeout.
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
* @returns {Function} Asynchronous function.
*/
var observableToAsync = Observable.toAsync = function (func, scheduler, context) {
scheduler || (scheduler = timeoutScheduler);
return function () {
var args = slice.call(arguments, 0), subject = new AsyncSubject();
scheduler.schedule(function () {
var result;
try {
result = func.apply(context, args);
} catch (e) {
subject.onError(e);
return;
}
subject.onNext(result);
subject.onCompleted();
});
return subject.asObservable();
};
};
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
});
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* 1 - res = Rx.Observable.create(function (observer) { return function () { } );
*
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = function (subscribe) {
return new AnonymousObservable(function (o) {
return disposableCreate(subscribe(o));
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* 1 - res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* @static
* @memberOf Observable
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.createWithDisposable = function (subscribe) {
return new AnonymousObservable(subscribe);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* 1 - res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @static
* @memberOf Observable
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* 1 - res = Rx.Observable.empty();
* 2 - res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
*
* @example
* 1 - res = Rx.Observable.fromArray([1,2,3]);
* 2 - res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0;
return scheduler.scheduleRecursive(function (self) {
if (count < array.length) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* 1 - res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* 2 - res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var first = true, state = initialState;
return scheduler.scheduleRecursive(function (self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
}
} catch (exception) {
observer.onError(exception);
return;
}
if (hasResult) {
observer.onNext(result);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
*
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
*
* @example
* 1 - res = Rx.Observable.range(0, 10);
* 2 - res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < count) {
observer.onNext(start + i);
self(i + 1);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* 1 - res = Rx.Observable.repeat(42);
* 2 - res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
scheduler || (scheduler = currentThreadScheduler);
if (repeatCount == undefined) {
repeatCount = -1;
}
return observableReturn(value, scheduler).repeat(repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
*
* @example
* 1 - res = Rx.Observable.returnValue(42);
* 2 - res = Rx.Observable.returnValue(42, Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable.returnValue = function (value, scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single OnError message.
*
* @example
* 1 - res = Rx.Observable.throwException(new Error('Error'));
* 2 - res = Rx.Observable.throwException(new Error('Error'), Rx.Scheduler.timeout);
* @static
* @memberOf Observable
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable.throwException = function (exception, scheduler) {
scheduler || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(exception);
});
});
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
*
* @example
* 1 - res = Rx.Observable.using(function () { return new AsyncSubject(); }, function (s) { return s; });
* @static
* @memberOf Observable
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new AnonymousObservable(function (observer) {
var disposable = disposableEmpty, resource, source;
try {
resource = resourceFactory();
if (resource) {
disposable = resource;
}
source = observableFactory(resource);
} catch (exception) {
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
}
return new CompositeDisposable(source.subscribe(observer), disposable);
});
};
/**
* Propagates the observable sequence that reacts first.
*
* @memberOf Observable#
* @param {Observable} rightSource Second observable sequence.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/
observableProto.amb = function (rightSource) {
var leftSource = this;
return new AnonymousObservable(function (observer) {
var choice,
leftChoice = 'L', rightChoice = 'R',
leftSubscription = new SingleAssignmentDisposable(),
rightSubscription = new SingleAssignmentDisposable();
function choiceL() {
if (!choice) {
choice = leftChoice;
rightSubscription.dispose();
}
}
function choiceR() {
if (!choice) {
choice = rightChoice;
leftSubscription.dispose();
}
}
leftSubscription.setDisposable(leftSource.subscribe(function (left) {
choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
}));
rightSubscription.setDisposable(rightSource.subscribe(function (right) {
choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
}));
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Propagates the observable sequence that reacts first.
*
* @example
* E.g. winner = Rx.Observable.amb(xs, ys, zs);
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(),
items = argsOrArray(arguments, 0);
function func(previous, current) {
return previous.amb(current);
}
for (var i = 0, len = items.length; i < len; i++) {
acc = func(acc, items[i]);
}
return acc;
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
try {
result = handler(exception);
} catch (ex) {
observer.onError(ex);
return;
}
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
return subscription;
});
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @memberOf Observable#
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto.catchException = function (handlerOrSecond) {
if (typeof handlerOrSecond === 'function') {
return observableCatchHandler(this, handlerOrSecond);
}
return observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.catchException(xs, ys, zs);
* 2 - res = Rx.Observable.catchException([xs, ys, zs]);
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchException = function () {
var items = argsOrArray(arguments, 0);
return enumerableFor(items).catchException();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @memberOf Observable#
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var args = slice.call(arguments);
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(function (x) { return x; }))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(function (x) { return x; })) {
observer.onCompleted();
}
}
function done (i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(args[i].subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
* @memberOf Observable#
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
var items = slice.call(arguments, 0);
items.unshift(this);
return observableConcat.apply(this, items);
};
/**
* Concatenates all the observable sequences.
*
* @example
* 1 - res = Rx.Observable.concat(xs, ys, zs);
* 2 - res = Rx.Observable.concat([xs, ys, zs]);
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var sources = argsOrArray(arguments, 0);
return enumerableFor(sources).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
*
* @memberOf Observable#
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatObservable = observableProto.concatAll =function () {
return this.merge(1);
};
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @memberOf Observable#
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
if (typeof maxConcurrentOrOther !== 'number') {
return observableMerge(this, maxConcurrentOrOther);
}
var sources = this;
return new AnonymousObservable(function (observer) {
var activeCount = 0,
group = new CompositeDisposable(),
isStopped = false,
q = [],
subscribe = function (xs) {
var subscription = new SingleAssignmentDisposable();
group.add(subscription);
subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
var s;
group.remove(subscription);
if (q.length > 0) {
s = q.shift();
subscribe(s);
} else {
activeCount--;
if (isStopped && activeCount === 0) {
observer.onCompleted();
}
}
}));
};
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, observer.onError.bind(observer), function () {
isStopped = true;
if (activeCount === 0) {
observer.onCompleted();
}
}));
return group;
});
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
*
* @static
* @memberOf Observable
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources;
if (!arguments[0]) {
scheduler = immediateScheduler;
sources = slice.call(arguments, 1);
} else if (arguments[0].now) {
scheduler = arguments[0];
sources = slice.call(arguments, 1);
} else {
scheduler = immediateScheduler;
sources = slice.call(arguments, 0);
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableFromArray(sources, scheduler).mergeObservable();
};
/**
* Merges an observable sequence of observable sequences into an observable sequence.
*
* @memberOf Observable#
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeObservable = observableProto.mergeAll =function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable(),
isStopped = false,
m = new SingleAssignmentDisposable();
group.add(m);
m.setDisposable(sources.subscribe(function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
innerSubscription.setDisposable(innerSource.subscribe(function (x) {
observer.onNext(x);
}, observer.onError.bind(observer), function () {
group.remove(innerSubscription);
if (isStopped && group.length === 1) {
observer.onCompleted();
}
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (group.length === 1) {
observer.onCompleted();
}
}));
return group;
});
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @memberOf Observable
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) {
throw new Error('Second observable is required');
}
return onErrorResumeNext([this, second]);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
* @static
* @memberOf Observable
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), function () {
self();
}, function () {
self();
}));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
*
* @memberOf Observable#
* @param {Observable} other The observable sequence that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
if (isOpen) {
observer.onNext(left);
}
}, observer.onError.bind(observer), function () {
if (isOpen) {
observer.onCompleted();
}
}));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, observer.onError.bind(observer), function () {
rightSubscription.dispose();
}));
return disposables;
});
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
*
* @memberOf Observable#
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
d.setDisposable(innerSource.subscribe(function (x) {
if (latest === id) {
observer.onNext(x);
}
}, function (e) {
if (latest === id) {
observer.onError(e);
}
}, function () {
if (latest === id) {
hasLatest = false;
if (isStopped) {
observer.onCompleted();
}
}
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (!hasLatest) {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, innerSubscription);
});
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
*
* @memberOf Observable#
* @param {Observable} other Observable sequence that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(
source.subscribe(observer),
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
);
});
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @memberOf Observable#
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) {
return zipArray.apply(this, arguments);
}
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
sources.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
var next = function (i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(function (x) { return x; })) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
*
* @static
* @memberOf Observable
* @param {Array} sources Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function (sources, resultSelector) {
var first = sources[0],
rest = sources.slice(1);
rest.push(resultSelector);
return first.zip.apply(first, rest);
};
/**
* Hides the identity of an observable sequence.
*
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(observer);
});
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
*
* @example
* 1 - xs.bufferWithCount(10);
* 2 - xs.bufferWithCount(10, 1);
*
* @memberOf Observable#
* @param {Number} count Length of each buffer.
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithCount = function (count, skip) {
if (skip === undefined) {
skip = count;
}
return this.windowWithCount(count, skip).selectMany(function (x) {
return x.toArray();
}).where(function (x) {
return x.length > 0;
});
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
*
* @memberOf Observable#
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
return x.accept(observer);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* 1 - var obs = observable.distinctUntilChanged();
* 2 - var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* 3 - var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @memberOf Observable#
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
keySelector || (keySelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var comparerEquals = false, key;
try {
key = keySelector(value);
} catch (exception) {
observer.onError(exception);
return;
}
if (hasCurrentKey) {
try {
comparerEquals = comparer(currentKey, key);
} catch (exception) {
observer.onError(exception);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
*
* @example
* 1 - observable.doAction(observer);
* 2 - observable.doAction(onNext);
* 3 - observable.doAction(onNext, onError);
* 4 - observable.doAction(onNext, onError, onCompleted);
*
* @memberOf Observable#
* @param {Mixed} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
var source = this, onNextFunc;
if (typeof observerOrOnNext === 'function') {
onNextFunc = observerOrOnNext;
} else {
onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext);
onError = observerOrOnNext.onError.bind(observerOrOnNext);
onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext);
}
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
onNextFunc(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (exception) {
if (!onError) {
observer.onError(exception);
} else {
try {
onError(exception);
} catch (e) {
observer.onError(e);
}
observer.onError(exception);
}
}, function () {
if (!onCompleted) {
observer.onCompleted();
} else {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
}
});
});
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
*
* @example
* 1 - obs = observable.finallyAction(function () { console.log('sequence ended'; });
*
* @memberOf Observable#
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto.finallyAction = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription = source.subscribe(observer);
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
});
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
*
* @memberOf Observable#
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
*
* @memberOf Observable#
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (exception) {
observer.onNext(notificationCreateOnError(exception));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
});
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
*
* @example
* 1 - repeated = source.repeat();
* 2 - repeated = source.repeat(42);
*
* @memberOf Observable#
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
*
* @example
* 1 - retried = retry.repeat();
* 2 - retried = retry.repeat(42);
*
* @memberOf Observable#
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchException();
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
*
* 1 - scanned = source.scan(function (acc, x) { return acc + x; });
* 2 - scanned = source.scan(0, function (acc, x) { return acc + x; });
*
* @memberOf Observable#
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var seed, hasSeed = false, accumulator;
if (arguments.length === 2) {
seed = arguments[0];
accumulator = arguments[1];
hasSeed = true;
} else {
accumulator = arguments[0];
}
var source = this;
return observableDefer(function () {
var hasAccumulation = false, accumulation;
return source.select(function (x) {
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
return accumulation;
});
});
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
*
* @memberOf Observable#
* @description
* This operator accumulates a queue with a length enough to store the first <paramref name="count"/> elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
observer.onNext(q.shift());
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
*
* 1 - source.startWith(1, 2, 3);
* 2 - source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
*
* @memberOf Observable#
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (arguments.length > 0 && arguments[0] != null && arguments[0].now !== undefined) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
values = slice.call(arguments, start);
return enumerableFor([observableFromArray(values, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence, using an optional scheduler to drain the queue.
*
* @example
* 1 - obs = source.takeLast(5);
* 2 - obs = source.takeLast(5, Rx.Scheduler.timeout);
*
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
*
* @memberOf Observable#
* @param {Number} count Number of elements to take from the end of the source sequence.
* @param {Scheduler} [scheduler] Scheduler used to drain the queue upon completion of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count, scheduler) {
return this.takeLastBuffer(count).selectMany(function (xs) { return observableFromArray(xs, scheduler); });
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
*
* @memberOf Observable#
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
q.shift();
}
}, observer.onError.bind(observer), function () {
observer.onNext(q);
observer.onCompleted();
});
});
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* 1 - xs.windowWithCount(10);
* 2 - xs.windowWithCount(10, 1);
*
* @memberOf Observable#
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
if (count <= 0) {
throw new Error(argumentOutOfRange);
}
if (skip == null) {
skip = count;
}
if (skip <= 0) {
throw new Error(argumentOutOfRange);
}
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [],
createWindow = function () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
};
createWindow();
m.setDisposable(source.subscribe(function (x) {
var s;
for (var i = 0, len = q.length; i < len; i++) {
q[i].onNext(x);
}
var c = n - count + 1;
if (c >= 0 && c % skip === 0) {
s = q.shift();
s.onCompleted();
}
n++;
if (n % skip === 0) {
createWindow();
}
}, function (exception) {
while (q.length > 0) {
q.shift().onError(exception);
}
observer.onError(exception);
}, function () {
while (q.length > 0) {
q.shift().onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
});
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* 1 - obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
if (defaultValue === undefined) {
defaultValue = null;
}
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
}, observer.onError.bind(observer), function () {
if (!found) {
observer.onNext(defaultValue);
}
observer.onCompleted();
});
});
};
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* 1 - obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (x) { return x.toString(); });
*
* @memberOf Observable#
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, keySerializer) {
var source = this;
keySelector || (keySelector = identity);
keySerializer || (keySerializer = defaultKeySerializer);
return new AnonymousObservable(function (observer) {
var hashSet = {};
return source.subscribe(function (x) {
var key, serializedKey, otherKey, hasMatch = false;
try {
key = keySelector(x);
serializedKey = keySerializer(key);
} catch (exception) {
observer.onError(exception);
return;
}
for (otherKey in hashSet) {
if (serializedKey === otherKey) {
hasMatch = true;
break;
}
}
if (!hasMatch) {
hashSet[serializedKey] = null;
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Groups the elements of an observable sequence according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
*
* @example
* 1 - observable.groupBy(function (x) { return x.id; });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function (x) { return x.toString(); });
*
* @memberOf Observable#
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} [elementSelector] A function to map each source element to an element in an observable group.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @returns {Observable} A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
*/
observableProto.groupBy = function (keySelector, elementSelector, keySerializer) {
return this.groupByUntil(keySelector, elementSelector, function () {
return observableNever();
}, keySerializer);
};
/**
* Groups the elements of an observable sequence according to a specified key selector function.
* A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
* key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
*
* @example
* 1 - observable.groupByUntil(function (x) { return x.id; }, null, function () { return Rx.Observable.never(); });
* 2 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); });
* 3 - observable.groupBy(function (x) { return x.id; }), function (x) { return x.name; }, function () { return Rx.Observable.never(); }, function (x) { return x.toString(); });
*
* @memberOf Observable#
* @param {Function} keySelector A function to extract the key for each element.
* @param {Function} durationSelector A function to signal the expiration of a group.
* @param {Function} [keySerializer] Used to serialize the given object into a string for object comparison.
* @returns {Observable}
* A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
* If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
*
*/
observableProto.groupByUntil = function (keySelector, elementSelector, durationSelector, keySerializer) {
var source = this;
elementSelector || (elementSelector = identity);
keySerializer || (keySerializer = defaultKeySerializer);
return new AnonymousObservable(function (observer) {
var map = {},
groupDisposable = new CompositeDisposable(),
refCountDisposable = new RefCountDisposable(groupDisposable);
groupDisposable.add(source.subscribe(function (x) {
var duration, durationGroup, element, expire, fireNewMapEntry, group, key, serializedKey, md, writer, w;
try {
key = keySelector(x);
serializedKey = keySerializer(key);
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
fireNewMapEntry = false;
try {
writer = map[serializedKey];
if (!writer) {
writer = new Subject();
map[serializedKey] = writer;
fireNewMapEntry = true;
}
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
if (fireNewMapEntry) {
group = new GroupedObservable(key, writer, refCountDisposable);
durationGroup = new GroupedObservable(key, writer);
try {
duration = durationSelector(durationGroup);
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
observer.onNext(group);
md = new SingleAssignmentDisposable();
groupDisposable.add(md);
expire = function () {
if (serializedKey in map) {
delete map[serializedKey];
writer.onCompleted();
}
groupDisposable.remove(md);
};
md.setDisposable(duration.take(1).subscribe(noop, function (exn) {
for (w in map) {
map[w].onError(exn);
}
observer.onError(exn);
}, function () {
expire();
}));
}
try {
element = elementSelector(x);
} catch (e) {
for (w in map) {
map[w].onError(e);
}
observer.onError(e);
return;
}
writer.onNext(element);
}, function (ex) {
for (var w in map) {
map[w].onError(ex);
}
observer.onError(ex);
}, function () {
for (var w in map) {
map[w].onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
});
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
*
* @example
* source.select(function (value, index) { return value * value + index; });
*
* @memberOf Observable#
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = function (selector, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var result;
try {
result = selector.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
observer.onNext(result);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
observableProto.map = observableProto.select;
function selectMany(selector) {
return this.select(selector).mergeObservable();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* 1 - source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* 1 - source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* 1 - source.selectMany(Rx.Observable.fromArray([1,2,3]));
*
* @memberOf Observable#
* @param selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector) {
if (resultSelector) {
return this.selectMany(function (x) {
return selector(x).select(function (y) {
return resultSelector(x, y);
});
});
}
if (typeof selector === 'function') {
return selectMany.call(this, selector);
}
return selectMany.call(this, function () {
return selector;
});
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
*
* @memberOf Observable#
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining <= 0) {
observer.onNext(x);
} else {
remaining--;
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* 1 - source.skipWhile(function (value) { return value < 10; });
* 1 - source.skipWhile(function (value, index) { return value < 10 || index < 10; });
*
* @memberOf Observable#
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !predicate(x, i++);
} catch (e) {
observer.onError(e);
return;
}
}
if (running) {
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* 1 - source.take(5);
* 2 - source.take(0, Rx.Scheduler.timeout);
*
* @memberOf Observable#
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
if (count === 0) {
return observableEmpty(scheduler);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining > 0) {
remaining--;
observer.onNext(x);
if (remaining === 0) {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
*
* @example
* 1 - source.takeWhile(function (value) { return value < 10; });
* 1 - source.takeWhile(function (value, index) { return value < 10 || index < 10; });
*
* @memberOf Observable#
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate(x, i++);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
*
* @example
* 1 - source.where(function (value) { return value < 10; });
* 1 - source.where(function (value, index) { return value < 10 || index < 10; });
*
* @memberOf Observable#
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = function (predicate, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
if (shouldRun) {
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
observableProto.filter = observableProto.where;
/** @private */
var AnonymousObservable = Rx.Internals.AnonymousObservable = (function (_super) {
inherits(AnonymousObservable, _super);
/**
* @private
* @constructor
*/
function AnonymousObservable(subscribe) {
function s(observer) {
var autoDetachObserver = new AutoDetachObserver(observer);
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.schedule(function () {
try {
autoDetachObserver.disposable(subscribe(autoDetachObserver));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
});
} else {
try {
autoDetachObserver.disposable(subscribe(autoDetachObserver));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
}
return autoDetachObserver;
}
_super.call(this, s);
}
return AnonymousObservable;
}(Observable));
/** @private */
var AutoDetachObserver = (function (_super) {
inherits(AutoDetachObserver, _super);
/**
* @private
* @constructor
*/
function AutoDetachObserver(observer) {
_super.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
if (!noError) {
this.dispose();
}
}
};
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.error = function (exn) {
try {
this.observer.onError(exn);
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.disposable = function (value) {
return this.m.disposable(value);
};
/**
* @private
* @memberOf AutoDetachObserver#
*/
AutoDetachObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
/** @private */
var GroupedObservable = (function (_super) {
inherits(GroupedObservable, _super);
function subscribe(observer) {
return this.underlyingObservable.subscribe(observer);
}
/**
* @constructor
* @private
*/
function GroupedObservable(key, underlyingObservable, mergedDisposable) {
_super.call(this, subscribe);
this.key = key;
this.underlyingObservable = !mergedDisposable ?
underlyingObservable :
new AnonymousObservable(function (observer) {
return new CompositeDisposable(mergedDisposable.getDisposable(), underlyingObservable.subscribe(observer));
});
}
return GroupedObservable;
}(Observable));
/** @private */
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.exception) {
observer.onError(this.exception);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, _super);
/**
* Creates a subject.
*
* @constructor
*/
function Subject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
}
addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
*
* @memberOf ReplaySubject#
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*
* @memberOf ReplaySubject#
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
*
* @memberOf ReplaySubject#
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
*
* @memberOf ReplaySubject#
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*
* @memberOf ReplaySubject#
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
*
* @static
* @memberOf Subject
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
var ex = this.exception;
var hv = this.hasValue;
var v = this.value;
if (ex) {
observer.onError(ex);
} else if (hv) {
observer.onNext(v);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, _super);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
*
* @constructor
*/
function AsyncSubject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.value = null,
this.hasValue = false,
this.observers = [],
this.exception = null;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
*
* @memberOf AsyncSubject#
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*
* @memberOf AsyncSubject#
*/
onCompleted: function () {
var o, i, len;
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
var v = this.value;
var hv = this.hasValue;
if (hv) {
for (i = 0, len = os.length; i < len; i++) {
o = os[i];
o.onNext(v);
o.onCompleted();
}
} else {
for (i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
*
* @memberOf AsyncSubject#
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
*
* @memberOf AsyncSubject#
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
this.value = value;
this.hasValue = true;
}
},
/**
* Unsubscribe all observers and release resources.
*
* @memberOf AsyncSubject#
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
/** @private */
var AnonymousSubject = (function (_super) {
inherits(AnonymousSubject, _super);
function subscribe(observer) {
return this.observable.subscribe(observer);
}
/**
* @private
* @constructor
*/
function AnonymousSubject(observer, observable) {
_super.call(this, subscribe);
this.observer = observer;
this.observable = observable;
}
addProperties(AnonymousSubject.prototype, Observer, {
/**
* @private
* @memberOf AnonymousSubject#
*/
onCompleted: function () {
this.observer.onCompleted();
},
/**
* @private
* @memberOf AnonymousSubject#
*/
onError: function (exception) {
this.observer.onError(exception);
},
/**
* @private
* @memberOf AnonymousSubject#
*/
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
// Check for AMD
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
window.Rx = Rx;
return define(function () {
return Rx;
});
} else if (freeExports) {
if (typeof module == 'object' && module && module.exports == freeExports) {
module.exports = Rx;
} else {
freeExports = Rx;
}
} else {
window.Rx = Rx;
}
}(this)); |
public/components/settings/api/api-is-down.js | wazuh/wazuh-kibana-app | /*
* Wazuh app - React component for the adding an API entry form.
*
* Copyright (C) 2015-2022 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {
EuiFlexGroup,
EuiFlexItem,
EuiCodeBlock,
EuiText,
EuiSpacer,
EuiCode,
EuiButton,
EuiButtonEmpty,
EuiSteps,
EuiBasicTable,
EuiHealth,
EuiCallOut,
EuiLoadingSpinner,
EuiToolTip,
EuiButtonIcon,
EuiPanel
} from '@elastic/eui';
import { withErrorBoundary } from '../../common/hocs';
import {
UI_ERROR_SEVERITIES,
} from '../../../react-services/error-orchestrator/types';
import { UI_LOGGER_LEVELS, PLUGIN_PLATFORM_NAME } from '../../../../common/constants';
import { getErrorOrchestrator } from '../../../react-services/common-services';
import { getPluginDataPath } from '../../../../common/plugin';
export const ApiIsDown = withErrorBoundary (class ApiIsDown extends Component {
constructor(props) {
super(props);
this.state = {
status: 'incomplete',
fetchingData: false,
apiEntries: [],
refreshingEntries: false
};
}
componentDidMount() {
this.setState({
apiEntries: [...this.props.apiEntries]
});
}
/**
* Checks again the connection in order to know the state of the API entries
*/
async checkConnection() {
try {
let status = 'complete';
this.setState({ error: false });
const hosts = await this.props.getHosts();
this.setState({
fetchingData: true,
refreshingEntries: true,
apiEntries: hosts
});
const entries = this.state.apiEntries;
let numErr = 0;
for (let idx in entries) {
const entry = entries[idx];
try {
const data = await this.props.testApi(entry, true); // token refresh is forced
const clusterInfo = data.data || {};
const id = entries[idx].id;
entries[idx].status = 'online';
entries[idx].cluster_info = clusterInfo;
//Updates the cluster info in the registry
await this.props.updateClusterInfoInRegistry(id, clusterInfo);
this.props.setDefault(entry);
} catch (error) {
numErr = numErr + 1;
const code = ((error || {}).data || {}).code;
const downReason = typeof error === 'string' ? error :
(error || {}).message || ((error || {}).data || {}).message || 'Wazuh is not reachable';
const status = code === 3099 ? 'down' : 'unknown';
entries[idx].status = { status, downReason };
}
}
if (numErr) {
status = numErr >= entries.length ? 'danger' : 'warning';
}
this.setState({
apiEntries: entries,
fetchingData: false,
status: status,
refreshingEntries: false
});
} catch (error) {
if (
error &&
error.data &&
error.data.message &&
error.data.code === 2001
) {
this.setState({ error: error.data.message, status: 'danger' });
}
const options = {
context: `${ApiIsDown.name}.checkConnection`,
level: UI_LOGGER_LEVELS.ERROR,
severity: UI_ERROR_SEVERITIES.UI,
store: true,
error: {
error: error,
message: error.message || error,
title: error.message || error,
},
};
getErrorOrchestrator().handleError(options);
}
}
render() {
const apiExample = `# Example Wazuh API configuration
hosts:
- production:
url: https://172.16.1.2
port: 55000
username: wazuh-wui
password: wazuh-wui
run_as: false
`;
const checkConnectionChildren = (
<div>
<EuiText>
Check that the {PLUGIN_PLATFORM_NAME} server can reach the configured Wazuh API(s).
</EuiText>
<EuiSpacer />
<EuiButton
onClick={async () => await this.checkConnection()}
isLoading={this.state.fetchingData}
>
Check connection
</EuiButton>
{this.state.status !== 'danger' &&
this.state.status !== 'incomplete' && (
<EuiButtonEmpty onClick={() => this.props.closeApiIsDown()}>
Close
</EuiButtonEmpty>
)}
<EuiSpacer />
<EuiText>Already configured Wazuh API(s)</EuiText>
<EuiSpacer />
{(!this.state.error && (
<EuiBasicTable
loading={this.state.refreshingEntries}
items={this.state.apiEntries}
columns={[
{ field: 'id', name: 'ID' },
{ field: 'url', name: 'Host' },
{ field: 'port', name: 'Port' },
{
field: 'status',
name: 'Status',
render: item => {
if (item) {
return item === 'online' ? (
<EuiHealth color="success">Online</EuiHealth>
) : item.status === 'down' ? (
<span>
<EuiHealth color="warning">Warning</EuiHealth>
<EuiToolTip position="top" content={item.downReason}>
<EuiButtonIcon
color="primary"
style={{ marginTop: '-12px' }}
iconType="questionInCircle"
aria-label="Info about the error"
onClick={() =>
this.props.copyToClipBoard(item.downReason)
}
/>
</EuiToolTip>
</span>
) : (
<span>
<EuiHealth color="danger">Offline</EuiHealth>
<EuiToolTip position="top" content={item.downReason}>
<EuiButtonIcon
color="primary"
style={{ marginTop: '-12px' }}
iconType="questionInCircle"
aria-label="Info about the error"
onClick={() =>
this.props.copyToClipBoard(item.downReason)
}
/>
</EuiToolTip>
</span>
);
} else {
return (
<span>
<EuiLoadingSpinner size="s" />
<span> Checking</span>
</span>
);
}
}
}
]}
/>
)) || (
<EuiCallOut
color="danger"
iconType="cross"
title={this.state.error}
/>
)}
</div>
);
const steps = [
{
title: 'Check the Wazuh API service status',
children: (
<div>
<EuiText>For Systemd</EuiText>
<EuiSpacer />
<EuiCode>$ sudo systemctl status wazuh-manager</EuiCode>
<EuiSpacer />
<EuiText>For SysV Init</EuiText>
<EuiSpacer />
<EuiCode>$ sudo service wazuh-manager status</EuiCode>
</div>
)
},
{
title: 'Check the configuration',
children: (
<div>
<EuiText>
Review the settings in the{' '}
<EuiCode>
{getPluginDataPath('config/wazuh.yml')}
</EuiCode>{' '}
file.
</EuiText>
<EuiSpacer />
<EuiCodeBlock language="yaml">{apiExample}</EuiCodeBlock>
</div>
)
},
{
title: 'Test the configuration',
children: checkConnectionChildren,
status: this.state.status
}
];
return (
<EuiFlexGroup>
<EuiFlexItem />
<EuiFlexItem className="min-guide-width">
<EuiPanel>
<EuiText>
<h2>Wazuh API seems to be down</h2>
</EuiText>
<EuiSpacer />
<EuiSteps firstStepNumber={1} steps={steps} />
</EuiPanel>
</EuiFlexItem>
<EuiFlexItem />
</EuiFlexGroup>
);
}
});
ApiIsDown.propTypes = {
apiEntries: PropTypes.array,
checkManager: PropTypes.func,
setDefault: PropTypes.func,
closeApiIsDown: PropTypes.func,
updateClusterInfoInRegistry: PropTypes.func,
getHosts: PropTypes.func,
copyToClipboard: PropTypes.func
};
|
geonode/contrib/monitoring/frontend/src/pages/software-performance/index.js | timlinux/geonode | import React from 'react';
import Header from '../../components/organisms/header';
import GeonodeAnalytics from '../../components/organisms/geonode-analytics';
import GeonodeLayersAnalytics from '../../components/organisms/geonode-layers-analytics';
import WSAnalytics from '../../components/organisms/ws-analytics';
import WSLayersAnalytics from '../../components/organisms/ws-layers-analytics';
import styles from './styles';
class SWPerf extends React.Component {
render() {
return (
<div style={styles.root}>
<Header back="/" />
<div style={styles.analytics}>
<GeonodeAnalytics />
<WSAnalytics />
</div>
<div style={styles.analytics}>
<GeonodeLayersAnalytics />
<WSLayersAnalytics />
</div>
</div>
);
}
}
export default SWPerf;
|
src/common/NotFound.js | FredBoat/fredboat.com | import React, { Component } from 'react';
import "./css/NotFound.css";
const messages = [
"Lost at sea...",
"Wait. Where is the water?",
"Where'd the music go?"
];
function chosenMessage(message) {
return messages[Math.floor(Math.random() * messages.length)]
}
class NotFound extends Component
{
render() {
return(
<div className="not-found-contents">
<h1>Error 404</h1>
<p>{chosenMessage()}</p>
</div>
)
}
}
export default NotFound;
|
src/destinations/Bootstrap.js | RoyalIcing/gateau | import R from 'ramda'
import React from 'react'
import seeds, { Seed } from 'react-seeds'
import rgba from 'react-sow/rgba'
import * as assets from './assets'
import * as Vanilla from './Vanilla'
import { renderTreeUsing } from './render'
const buttonTagsToClass = R.uncurryN(3, (resolveContent, contentIsTrue) => R.converge(
R.unapply(R.join(' ')), [
R.always('btn'),
R.cond([
[ contentIsTrue('primary'), R.always('btn-primary') ],
//[ contentIsTrue('link'), R.always('btn-link') ],
[ R.T, R.always('btn-default') ]
]),
R.cond([
[ contentIsTrue('large'), R.always('btn-lg') ],
[ contentIsTrue('small'), R.always('btn-sm') ],
[ contentIsTrue('extrasmall'), R.always('btn-xs') ],
[ R.T, R.always('') ]
])
]
))
export const button = (tags, mentions, texts, children, Element, resolveContent) => {
const contentIsTrue = R.propSatisfies((value) => resolveContent(value, { single: true }) == true)
let Component = 'button'
let url
if (R.has('link', tags)) {
Component = 'a'
url = resolveContent(tags.link)
}
let onClick
if (R.has('toggle', tags)) {
onClick = () => {
resolveContent(tags.toggle, { alter: R.not })
}
}
return (
<Component
href={ url }
{ ...seeds({
alignSelf: 'center',
margin: { bottom: '0.5rem' },
maxWidth: '20em'
}) }
className={ buttonTagsToClass(resolveContent, contentIsTrue, tags) }
children={ texts }
onClick={ onClick }
/>
)
}
export const cta = button
const panelTagsToClass = R.uncurryN(3, (resolveContent, contentIsTrue) => R.converge(
R.unapply(R.join(' ')), [
R.always('panel'),
R.cond([
[ contentIsTrue('primary'), R.always('panel-primary') ],
[ contentIsTrue('success'), R.always('panel-success') ],
[ contentIsTrue('info'), R.always('panel-info') ],
[ contentIsTrue('warning'), R.always('panel-warning') ],
[ contentIsTrue('danger'), R.always('panel-danger') ],
[ R.T, R.always('panel-default') ]
])
]
))
export const panel = (tags, mentions, texts, children, Element, resolveContent) => {
const contentIsTrue = R.propSatisfies((value) => resolveContent(value, true) == true)
return (
<Seed Component='div'
className={ panelTagsToClass(resolveContent, contentIsTrue, tags) }
alignSelf='center'
margin={{ bottom: '0.5rem' }}
maxWidth='20em'
>
<div className='panel-heading'>
<h2 className='panel-title' children={ texts } />
</div>
<div className='panel-body'>
{
children.map((element, index) => (
<Element { ...element } key={ index } />
))
}
</div>
</Seed>
)
}
const elementRendererForTags = Vanilla.extendTagConds([
[ R.has('field'), R.curry(Vanilla.makeField({ wrapInDiv: true, wrapperClassName: 'form-group', inputClassName: 'form-control' })) ],
[ R.has('card'), R.curry(panel) ],
[ R.has('panel'), R.curry(panel) ],
[ R.has('button'), R.curry(button) ],
[ R.has('cta'), R.curry(cta) ]
])
export const Preview = renderTreeUsing({ elementRendererForTags })
export const title = 'Bootstrap 3'
export function head() {
return [
<link key='css'
rel='stylesheet' type='text/css'
href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'
/>,
<script key='js'
src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js'
/>
]
}
|
src/Input/Input.spec.js | dsslimshaddy/material-ui | // @flow weak
import React from 'react';
import { assert } from 'chai';
import { spy } from 'sinon';
import { createShallow, createMount, getClasses } from '../test-utils';
import Textarea from './Textarea';
import Input, { hasValue, isDirty } from './Input';
describe('<Input />', () => {
let shallow;
let classes;
let mount;
before(() => {
shallow = createShallow({ dive: true });
mount = createMount();
classes = getClasses(<Input />);
});
after(() => {
mount.cleanUp();
});
it('should render a <div />', () => {
const wrapper = shallow(<Input />);
assert.strictEqual(wrapper.name(), 'div');
assert.strictEqual(wrapper.hasClass(classes.root), true);
assert.strictEqual(wrapper.hasClass(classes.inkbar), true, 'should have the inkbar class');
assert.strictEqual(
wrapper.hasClass(classes.underline),
true,
'should have the underline class',
);
});
it('should render an <input /> inside the div', () => {
const wrapper = shallow(<Input />);
const input = wrapper.find('input');
assert.strictEqual(input.name(), 'input');
assert.strictEqual(input.props().type, 'text', 'should pass the text type prop');
assert.strictEqual(input.hasClass(classes.input), true, 'should have the input class');
assert.strictEqual(input.prop('aria-required'), undefined);
});
it('should render an <Textarea /> when passed the multiline prop', () => {
const wrapper = shallow(<Input multiline />);
assert.strictEqual(wrapper.find(Textarea).length, 1);
});
it('should render an <textarea /> when passed the multiline and rows props', () => {
const wrapper = shallow(<Input multiline rows="4" />);
assert.strictEqual(wrapper.find('textarea').length, 1);
});
it('should render a disabled <input />', () => {
const wrapper = shallow(<Input disabled />);
const input = wrapper.find('input');
assert.strictEqual(input.name(), 'input');
assert.strictEqual(input.hasClass(classes.input), true, 'should have the input class');
assert.strictEqual(
input.hasClass(classes.inputDisabled),
true,
'should have the disabled class',
);
});
it('should disabled the underline', () => {
const wrapper = shallow(<Input disableUnderline />);
const input = wrapper.find('input');
assert.strictEqual(wrapper.hasClass(classes.inkbar), false, 'should not have the inkbar class');
assert.strictEqual(input.name(), 'input');
assert.strictEqual(input.hasClass(classes.input), true, 'should have the input class');
assert.strictEqual(
input.hasClass(classes.underline),
false,
'should not have the underline class',
);
});
it('should fire event callbacks', () => {
const events = ['onChange', 'onFocus', 'onBlur', 'onKeyUp', 'onKeyDown'];
const handlers = events.reduce((result, n) => {
result[n] = spy();
return result;
}, {});
const wrapper = shallow(<Input {...handlers} />);
events.forEach(n => {
const event = n.charAt(2).toLowerCase() + n.slice(3);
wrapper.find('input').simulate(event);
assert.strictEqual(handlers[n].callCount, 1, `should have called the ${n} handler`);
});
});
describe('controlled', () => {
['', 0].forEach(value => {
describe(`${typeof value} value`, () => {
let wrapper;
let handleDirty;
let handleClean;
before(() => {
handleClean = spy();
handleDirty = spy();
wrapper = shallow(<Input value={value} onDirty={handleDirty} onClean={handleClean} />);
});
it('should check that the component is controlled', () => {
const instance = wrapper.instance();
assert.strictEqual(instance.isControlled(), true, 'isControlled() should return true');
});
// don't test number because zero is a dirty state, whereas '' is not
if (typeof value !== 'number') {
it('should have called the handleClean callback', () => {
assert.strictEqual(handleClean.callCount, 1, 'should have called the onClean cb');
});
it('should fire the onDirty callback when dirtied', () => {
assert.strictEqual(
handleDirty.callCount,
0,
'should not have called the onDirty cb yet',
);
wrapper.setProps({ value: typeof value === 'number' ? 2 : 'hello' });
assert.strictEqual(handleDirty.callCount, 1, 'should have called the onDirty cb');
});
it('should fire the onClean callback when dirtied', () => {
assert.strictEqual(
handleClean.callCount,
1,
'should have called the onClean cb once already',
);
wrapper.setProps({ value });
assert.strictEqual(handleClean.callCount, 2, 'should have called the onClean cb again');
});
}
});
});
});
describe('prop: component', () => {
it('should accept any component', () => {
const wrapper = shallow(<Input component="span" />);
assert.strictEqual(wrapper.find('span').length, 1);
});
});
/**
* Note the initial callback when
* uncontrolled only fires for a full mount
*/
describe('uncontrolled', () => {
let wrapper;
let handleDirty;
let handleClean;
before(() => {
handleClean = spy();
handleDirty = spy();
wrapper = mount(
<Input.Naked
classes={{}}
onDirty={handleDirty}
defaultValue="hell"
onClean={handleClean}
/>,
);
});
it('should check that the component is uncontrolled', () => {
const instance = wrapper.instance();
assert.strictEqual(instance.isControlled(), false, 'isControlled() should return false');
});
it('should fire the onDirty callback when dirtied', () => {
assert.strictEqual(handleDirty.callCount, 1, 'should not have called the onDirty cb yet');
wrapper.instance().input.value = 'hello';
wrapper.find('input').simulate('change');
assert.strictEqual(handleDirty.callCount, 2, 'should have called the onDirty cb');
});
it('should fire the onClean callback when cleaned', () => {
// Because of shallow() this hasn't fired since there is no mounting
assert.strictEqual(handleClean.callCount, 0, 'should not have called the onClean cb yet');
wrapper.instance().input.value = '';
wrapper.find('input').simulate('change');
assert.strictEqual(handleClean.callCount, 1, 'should have called the onClean cb');
});
});
describe('with muiFormControl context', () => {
let wrapper;
let muiFormControl;
function setFormControlContext(muiFormControlContext) {
muiFormControl = muiFormControlContext;
wrapper.setContext({ ...wrapper.context(), muiFormControl });
}
beforeEach(() => {
wrapper = shallow(<Input />);
});
it('should have the formControl class', () => {
setFormControlContext({});
assert.strictEqual(wrapper.hasClass(classes.formControl), true);
});
describe('callbacks', () => {
let handleDirty;
let handleClean;
beforeEach(() => {
handleDirty = spy();
handleClean = spy();
// Mock the input ref
wrapper.setProps({
onDirty: handleDirty,
onClean: handleClean,
});
wrapper.instance().input = { value: '' };
setFormControlContext({
onDirty: spy(),
onClean: spy(),
});
});
it('should fire the onDirty muiFormControl and props callback when dirtied', () => {
wrapper.instance().input.value = 'hello';
wrapper.find('input').simulate('change');
assert.strictEqual(handleDirty.callCount, 1, 'should have called the onDirty props cb');
assert.strictEqual(
muiFormControl.onDirty.callCount,
1,
'should have called the onDirty muiFormControl cb',
);
});
it('should fire the onClean muiFormControl and props callback when cleaned', () => {
wrapper.instance().input.value = '';
wrapper.find('input').simulate('change');
assert.strictEqual(handleClean.callCount, 1, 'should have called the onClean props cb');
assert.strictEqual(
muiFormControl.onClean.callCount,
1,
'should have called the onClean muiFormControl cb',
);
});
});
describe('error', () => {
beforeEach(() => {
setFormControlContext({ error: true });
});
it('should have the error class', () => {
assert.strictEqual(wrapper.hasClass(classes.error), true);
});
it('should be overridden by props', () => {
assert.strictEqual(wrapper.hasClass(classes.error), true);
wrapper.setProps({ error: false });
assert.strictEqual(wrapper.hasClass(classes.error), false);
wrapper.setProps({ error: true });
assert.strictEqual(wrapper.hasClass(classes.error), true);
});
});
describe('margin', () => {
describe('context margin: dense', () => {
beforeEach(() => {
setFormControlContext({ margin: 'dense' });
});
it('should have the inputDense class', () => {
assert.strictEqual(wrapper.find('input').hasClass(classes.inputDense), true);
});
});
it('should be overridden by props', () => {
assert.strictEqual(wrapper.find('input').hasClass(classes.inputDense), false);
wrapper.setProps({ margin: 'dense' });
assert.strictEqual(wrapper.find('input').hasClass(classes.inputDense), true);
});
});
describe('required', () => {
it('should have the aria-required prop with value true', () => {
setFormControlContext({ required: true });
const input = wrapper.find('input');
assert.strictEqual(input.prop('aria-required'), true);
});
});
});
describe('componentDidMount', () => {
let wrapper;
let instance;
before(() => {
wrapper = mount(<Input.Naked classes={classes} />);
instance = wrapper.instance();
});
beforeEach(() => {
instance.checkDirty = spy();
});
it('should not call checkDirty if controlled', () => {
instance.isControlled = () => true;
instance.componentDidMount();
assert.strictEqual(instance.checkDirty.callCount, 0);
});
it('should call checkDirty if controlled', () => {
instance.isControlled = () => false;
instance.componentDidMount();
assert.strictEqual(instance.checkDirty.callCount, 1);
});
it('should call checkDirty with input value', () => {
instance.isControlled = () => false;
instance.input = 'woofinput';
instance.componentDidMount();
assert.strictEqual(instance.checkDirty.calledWith(instance.input), true);
});
it('should call or not call checkDirty consistently', () => {
instance.isControlled = () => true;
instance.componentDidMount();
assert.strictEqual(instance.checkDirty.callCount, 0);
instance.isControlled = () => false;
instance.componentDidMount();
assert.strictEqual(instance.checkDirty.callCount, 1);
instance.isControlled = () => true;
instance.componentDidMount();
assert.strictEqual(instance.checkDirty.callCount, 1);
});
});
describe('mount', () => {
it('should be able to access the native input', () => {
const handleRef = spy();
mount(<Input inputRef={handleRef} />);
assert.strictEqual(handleRef.callCount, 1);
});
it('should be able to access the native textarea', () => {
const handleRef = spy();
mount(<Input multiline inputRef={handleRef} />);
assert.strictEqual(handleRef.callCount, 1);
});
});
describe('hasValue', () => {
['', 0].forEach(value => {
it(`is true for ${value}`, () => {
assert.strictEqual(hasValue(value), true);
});
});
[null, undefined].forEach(value => {
it(`is false for ${value}`, () => {
assert.strictEqual(hasValue(value), false);
});
});
});
describe('isDirty', () => {
[' ', 0].forEach(value => {
it(`is true for value ${value}`, () => {
assert.strictEqual(isDirty({ value }), true);
});
it(`is true for SSR defaultValue ${value}`, () => {
assert.strictEqual(isDirty({ defaultValue: value }, true), true);
});
});
[null, undefined, ''].forEach(value => {
it(`is false for value ${value}`, () => {
assert.strictEqual(isDirty({ value }), false);
});
it(`is false for SSR defaultValue ${value}`, () => {
assert.strictEqual(isDirty({ defaultValue: value }, true), false);
});
});
});
});
|
HTML/前端/my-react-app-spring-boot-yao/src/hello.js | xiaoxiaoyao/PythonApplication1 | import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
); |
src/views/Comment/CommentGroup.js | shengnian/shengnian-ui-react | import cx from 'classnames'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React from 'react'
import {
childrenUtils,
customPropTypes,
getElementType,
getUnhandledProps,
META,
SUI,
useKeyOnly,
} from '../../lib'
/**
* Comments can be grouped.
*/
function CommentGroup(props) {
const {
className,
children,
collapsed,
content,
minimal,
size,
threaded,
} = props
const classes = cx(
'ui',
size,
useKeyOnly(collapsed, 'collapsed'),
useKeyOnly(minimal, 'minimal'),
useKeyOnly(threaded, 'threaded'),
'comments',
className,
)
const rest = getUnhandledProps(CommentGroup, props)
const ElementType = getElementType(CommentGroup, props)
return (
<ElementType {...rest} className={classes}>
{childrenUtils.isNil(children) ? content : children}
</ElementType>
)
}
CommentGroup._meta = {
name: 'CommentGroup',
parent: 'Comment',
type: META.TYPES.VIEW,
}
CommentGroup.propTypes = {
/** An element type to render as (string or function). */
as: customPropTypes.as,
/** Primary content. */
children: PropTypes.node,
/** Additional classes. */
className: PropTypes.string,
/** Comments can be collapsed, or hidden from view. */
collapsed: PropTypes.bool,
/** Shorthand for primary content. */
content: customPropTypes.contentShorthand,
/** Comments can hide extra information unless a user shows intent to interact with a comment. */
minimal: PropTypes.bool,
/** Comments can have different sizes. */
size: PropTypes.oneOf(_.without(SUI.SIZES, 'medium')),
/** A comment list can be threaded to showing the relationship between conversations. */
threaded: PropTypes.bool,
}
export default CommentGroup
|
ajax/libs/react-bootstrap/0.27.1/react-bootstrap.min.js | hanbyul-here/cdnjs | !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.ReactBootstrap=t(require("react"),require("react-dom")):e.ReactBootstrap=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var r=n(2)["default"],o=n(76)["default"];t.__esModule=!0;var s=n(35),a=r(s),i=n(11),l=r(i),u=n(9),p=r(u),d=n(108),f=r(d);t.Accordion=f["default"];var c=n(109),h=r(c);t.Affix=h["default"];var m=n(54),v=r(m);t.AffixMixin=v["default"];var y=n(110),g=r(y);t.Alert=g["default"];var b=n(111),T=r(b);t.Badge=T["default"];var P=n(7),x=r(P);t.BootstrapMixin=x["default"];var E=n(112),C=r(E);t.Breadcrumb=C["default"];var _=n(113),N=r(_);t.BreadcrumbItem=N["default"];var O=n(24),w=r(O);t.Button=w["default"];var S=n(55),k=r(S);t.ButtonGroup=k["default"];var M=n(56),D=r(M);t.ButtonInput=D["default"];var I=n(114),A=r(I);t.ButtonToolbar=A["default"];var R=n(115),j=r(R);t.Carousel=j["default"];var K=n(116),L=r(K);t.CarouselItem=L["default"];var B=n(57),F=r(B);t.Col=F["default"];var H=n(117),W=r(H);t.CollapsibleNav=W["default"];var U=n(26),V=r(U);t.Dropdown=V["default"];var q=n(118),z=r(q);t.DropdownButton=z["default"];var G=n(33),Y=r(G);t.Glyphicon=Y["default"];var $=n(61),X=r($);t.Grid=X["default"];var Z=n(121),J=r(Z);t.Image=J["default"];var Q=n(122),ee=r(Q);t.Input=ee["default"];var te=n(62),ne=r(te);t.Interpolate=ne["default"];var re=n(123),oe=r(re);t.Jumbotron=oe["default"];var se=n(124),ae=r(se);t.Label=ae["default"];var ie=n(125),le=r(ie);t.ListGroup=le["default"];var ue=n(63),pe=r(ue);t.ListGroupItem=pe["default"];var de=n(126),fe=r(de);t.MenuItem=fe["default"];var ce=n(127),he=r(ce);t.Modal=he["default"];var me=n(64),ve=r(me);t.ModalBody=ve["default"];var ye=n(65),ge=r(ye);t.ModalFooter=ge["default"];var be=n(66),Te=r(be);t.ModalHeader=Te["default"];var Pe=n(67),xe=r(Pe);t.ModalTitle=xe["default"];var Ee=n(68),Ce=r(Ee);t.Nav=Ce["default"];var _e=n(130),Ne=r(_e);t.Navbar=Ne["default"];var Oe=n(69),we=r(Oe);t.NavBrand=we["default"];var Se=n(129),ke=r(Se);t.NavDropdown=ke["default"];var Me=n(70),De=r(Me);t.NavItem=De["default"];var Ie=n(71),Ae=r(Ie);t.Overlay=Ae["default"];var Re=n(131),je=r(Re);t.OverlayTrigger=je["default"];var Ke=n(132),Le=r(Ke);t.PageHeader=Le["default"];var Be=n(133),Fe=r(Be);t.PageItem=Fe["default"];var He=n(134),We=r(He);t.Pager=We["default"];var Ue=n(135),Ve=r(Ue);t.Pagination=Ve["default"];var qe=n(137),ze=r(qe);t.Panel=ze["default"];var Ge=n(72),Ye=r(Ge);t.PanelGroup=Ye["default"];var $e=n(138),Xe=r($e);t.Popover=Xe["default"];var Ze=n(139),Je=r(Ze);t.ProgressBar=Je["default"];var Qe=n(140),et=r(Qe);t.ResponsiveEmbed=et["default"];var tt=n(141),nt=r(tt);t.Row=nt["default"];var rt=n(14),ot=r(rt);t.SafeAnchor=ot["default"];var st=n(142),at=r(st);t.SplitButton=at["default"];var it=r(st);t.SplitButton=it["default"];var lt=n(27),ut=r(lt);t.styleMaps=ut["default"];var pt=n(144),dt=r(pt);t.SubNav=dt["default"];var ft=n(145),ct=r(ft);t.Tab=ct["default"];var ht=n(146),mt=r(ht);t.Table=mt["default"];var vt=n(147),yt=r(vt);t.Tabs=yt["default"];var gt=n(148),bt=r(gt);t.Thumbnail=bt["default"];var Tt=n(149),Pt=r(Tt);t.Tooltip=Pt["default"];var xt=n(150),Et=r(xt);t.Well=Et["default"];var Ct=n(25),_t=r(Ct);t.Collapse=_t["default"];var Nt=n(32),Ot=r(Nt);t.Fade=Ot["default"];var wt=n(59),St=o(wt);t.FormControls=St;var kt={childrenValueInputValidation:a["default"],createChainedFunction:l["default"],ValidComponentChildren:p["default"]};t.utils=kt},function(t,n){t.exports=e},function(e,t){"use strict";t["default"]=function(e){return e&&e.__esModule?e:{"default":e}},t.__esModule=!0},function(e,t,n){"use strict";var r=n(155)["default"];t["default"]=r||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},t.__esModule=!0},function(e,t,n){var r;/*!
Copyright (c) 2015 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function o(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];if(n){var r=typeof n;if("string"===r||"number"===r)e+=" "+n;else if(Array.isArray(n))e+=" "+o.apply(null,n);else if("object"===r)for(var a in n)s.call(n,a)&&n[a]&&(e+=" "+a)}}return e.substr(1)}var s={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=o:(r=function(){return o}.call(t,n,t,e),!(void 0!==r&&(e.exports=r)))}()},function(e,t){"use strict";t["default"]=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},t.__esModule=!0},function(e,t,n){"use strict";var r=n(156)["default"],o=n(158)["default"];t["default"]=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=r(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(o?o(e,t):e.__proto__=t)},t.__esModule=!0},function(e,t,n){"use strict";var r=n(2)["default"];t.__esModule=!0;var o=n(1),s=r(o),a=n(27),i=r(a),l=n(236),u=r(l),p={propTypes:{bsClass:u["default"](i["default"].CLASSES),bsStyle:s["default"].PropTypes.oneOf(i["default"].STYLES),bsSize:u["default"](i["default"].SIZES)},getBsClassSet:function(){var e={},t=this.props.bsClass&&i["default"].CLASSES[this.props.bsClass];if(t){e[t]=!0;var n=t+"-",r=this.props.bsSize&&i["default"].SIZES[this.props.bsSize];r&&(e[n+r]=!0),this.props.bsStyle&&(i["default"].STYLES.indexOf(this.props.bsStyle)>=0?e[n+this.props.bsStyle]=!0:e[this.props.bsStyle]=!0)}return e},prefixClass:function(e){return i["default"].CLASSES[this.props.bsClass]+"-"+e}};t["default"]=p,e.exports=t["default"]},function(e,t){"use strict";t["default"]=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n},t.__esModule=!0},function(e,t,n){"use strict";function r(e,t,n){var r=0;return d["default"].Children.map(e,function(e){if(d["default"].isValidElement(e)){var o=r;return r++,t.call(n,e,o)}return e})}function o(e,t,n){var r=0;return d["default"].Children.forEach(e,function(e){d["default"].isValidElement(e)&&(t.call(n,e,r),r++)})}function s(e){var t=0;return d["default"].Children.forEach(e,function(e){d["default"].isValidElement(e)&&t++}),t}function a(e){var t=!1;return d["default"].Children.forEach(e,function(e){!t&&d["default"].isValidElement(e)&&(t=!0)}),t}function i(e,t){var n=void 0;return o(e,function(r,o){!n&&t(r,o,e)&&(n=r)}),n}function l(e,t,n){var r=0,o=[];return d["default"].Children.forEach(e,function(e){d["default"].isValidElement(e)&&(t.call(n,e,r)&&o.push(e),r++)}),o}var u=n(2)["default"];t.__esModule=!0;var p=n(1),d=u(p);t["default"]={map:r,forEach:o,numberOf:s,find:i,findValidComponents:l,hasValidComponent:a},e.exports=t["default"]},function(e,n){e.exports=t},function(e,t){"use strict";function n(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return t.filter(function(e){return null!=e}).reduce(function(e,t){if("function"!=typeof t)throw new Error("Invalid Argument Type, must only provide functions, undefined, or null.");return null===e?t:function(){for(var n=arguments.length,r=Array(n),o=0;n>o;o++)r[o]=arguments[o];e.apply(this,r),t.apply(this,r)}},null)}t.__esModule=!0,t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){var r=i.errMsg(e,t,n,". Expected an Element `type`");if("function"!=typeof e[t]){if(a["default"].isValidElement(e[t]))return new Error(r+", not an actual Element");if("string"!=typeof e[t])return new Error(r+" such as a tag name or return value of React.createClass(...)")}}t.__esModule=!0;var s=n(1),a=r(s),i=n(51);t["default"]=i.createChainableTypeChecker(o),e.exports=t["default"]},function(e,t,n){function r(e){if(a.unindexedChars&&s(e)){for(var t=-1,n=e.length,r=Object(e);++t<n;)r[t]=e.charAt(t);return r}return o(e)?e:Object(e)}var o=n(16),s=n(46),a=n(49);e.exports=r},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(11),p=a(u),d=function(e){function t(n){o(this,t),e.call(this,n),this.handleClick=this.handleClick.bind(this)}return r(t,e),t.prototype.handleClick=function(e){void 0===this.props.href&&e.preventDefault()},t.prototype.render=function(){return l["default"].createElement("a",s({role:this.props.href?void 0:"button"},this.props,{onClick:p["default"](this.props.onClick,this.handleClick),href:this.props.href||""}))},t}(l["default"].Component);t["default"]=d,d.propTypes={href:l["default"].PropTypes.string,onClick:l["default"].PropTypes.func},e.exports=t["default"]},function(e,t,n){var r=n(30),o=n(21),s=n(17),a="[object Array]",i=Object.prototype,l=i.toString,u=r(Array,"isArray"),p=u||function(e){return s(e)&&o(e.length)&&l.call(e)==a};e.exports=p},function(e,t){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=n},function(e,t){function n(e){return!!e&&"object"==typeof e}e.exports=n},function(e,t){var n=e.exports={version:"1.2.1"};"number"==typeof __e&&(__e=n)},function(e,t){"use strict";function n(e){return e&&e.ownerDocument||document}t.__esModule=!0,t["default"]=n,e.exports=t["default"]},function(e,t){"use strict";e.exports=!("undefined"==typeof window||!window.document||!window.document.createElement)},function(e,t){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&r>=e}var r=9007199254740991;e.exports=n},function(e,t,n){var r,o,s;!function(n,a){o=[t],r=a,s="function"==typeof r?r.apply(t,o):r,!(void 0!==s&&(e.exports=s))}(this,function(e){var t=e;t.interopRequireDefault=function(e){return e&&e.__esModule?e:{"default":e}},t._extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}})},function(e,t,n){"use strict";var r=function(){};e.exports=r},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=n(12),f=o(d),c=n(56),h=o(c),m=a["default"].createClass({displayName:"Button",mixins:[p["default"]],propTypes:{active:a["default"].PropTypes.bool,disabled:a["default"].PropTypes.bool,block:a["default"].PropTypes.bool,navItem:a["default"].PropTypes.bool,navDropdown:a["default"].PropTypes.bool,componentClass:f["default"],href:a["default"].PropTypes.string,target:a["default"].PropTypes.string,type:a["default"].PropTypes.oneOf(h["default"].types)},getDefaultProps:function(){return{active:!1,block:!1,bsClass:"button",bsStyle:"default",disabled:!1,navItem:!1,navDropdown:!1}},render:function(){var e=this.props.navDropdown?{}:this.getBsClassSet(),t=void 0;return e=r({active:this.props.active,"btn-block":this.props.block},e),this.props.navItem?this.renderNavItem(e):(t=this.props.href||this.props.target||this.props.navDropdown?"renderAnchor":"renderButton",this[t](e))},renderAnchor:function(e){var t=this.props.componentClass||"a",n=this.props.href||"#";return e.disabled=this.props.disabled,a["default"].createElement(t,r({},this.props,{href:n,className:l["default"](this.props.className,e),role:"button"}),this.props.children)},renderButton:function(e){var t=this.props.componentClass||"button";return a["default"].createElement(t,r({},this.props,{type:this.props.type||"button",className:l["default"](this.props.className,e)}),this.props.children)},renderNavItem:function(e){var t={active:this.props.active};return a["default"].createElement("li",{className:l["default"](t)},this.renderAnchor(e))}});t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){var n=t["offset"+g(e)],r=T[e];return n+parseInt(u["default"](t,r[0]),10)+parseInt(u["default"](t,r[1]),10)}var o=n(6)["default"],s=n(5)["default"],a=n(3)["default"],i=n(2)["default"];t.__esModule=!0;var l=n(41),u=i(l),p=n(1),d=i(p),f=n(103),c=i(f),h=n(52),m=i(h),v=n(11),y=i(v),g=function(e){return e[0].toUpperCase()+e.substr(1)},b=function(e){return e.offsetHeight},T={height:["marginTop","marginBottom"],width:["marginLeft","marginRight"]},P=function(e){function t(n,r){s(this,t),e.call(this,n,r),this.onEnterListener=this.handleEnter.bind(this),this.onEnteringListener=this.handleEntering.bind(this),this.onEnteredListener=this.handleEntered.bind(this),this.onExitListener=this.handleExit.bind(this),this.onExitingListener=this.handleExiting.bind(this)}return o(t,e),t.prototype.render=function(){var e=y["default"](this.onEnterListener,this.props.onEnter),t=y["default"](this.onEnteringListener,this.props.onEntering),n=y["default"](this.onEnteredListener,this.props.onEntered),r=y["default"](this.onExitListener,this.props.onExit),o=y["default"](this.onExitingListener,this.props.onExiting);return d["default"].createElement(c["default"],a({ref:"transition"},this.props,{"aria-expanded":this.props.role?this.props["in"]:null,className:"width"===this._dimension()?"width":"",exitedClassName:"collapse",exitingClassName:"collapsing",enteredClassName:"collapse in",enteringClassName:"collapsing",onEnter:e,onEntering:t,onEntered:n,onExit:r,onExiting:o,onExited:this.props.onExited}),this.props.children)},t.prototype.handleEnter=function(e){var t=this._dimension();e.style[t]="0"},t.prototype.handleEntering=function(e){var t=this._dimension();e.style[t]=this._getScrollDimensionValue(e,t)},t.prototype.handleEntered=function(e){var t=this._dimension();e.style[t]=null},t.prototype.handleExit=function(e){var t=this._dimension();e.style[t]=this.props.getDimensionValue(t,e)+"px"},t.prototype.handleExiting=function(e){var t=this._dimension();b(e),e.style[t]="0"},t.prototype._dimension=function(){return"function"==typeof this.props.dimension?this.props.dimension():this.props.dimension},t.prototype._getTransitionInstance=function(){return this.refs.transition},t.prototype._getScrollDimensionValue=function(e,t){return e["scroll"+g(t)]+"px"},t}(d["default"].Component);P.propTypes={"in":d["default"].PropTypes.bool,unmountOnExit:d["default"].PropTypes.bool,transitionAppear:d["default"].PropTypes.bool,timeout:d["default"].PropTypes.number,duration:m["default"](d["default"].PropTypes.number,"Use `timeout`."),onEnter:d["default"].PropTypes.func,onEntering:d["default"].PropTypes.func,onEntered:d["default"].PropTypes.func,onExit:d["default"].PropTypes.func,onExiting:d["default"].PropTypes.func,onExited:d["default"].PropTypes.func,dimension:d["default"].PropTypes.oneOfType([d["default"].PropTypes.oneOf(["height","width"]),d["default"].PropTypes.func]),getDimensionValue:d["default"].PropTypes.func,role:d["default"].PropTypes.string},P.defaultProps={"in":!1,timeout:300,unmountOnExit:!1,transitionAppear:!1,dimension:"height",getDimensionValue:r},t["default"]=P,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(4),l=a(i),u=n(80),p=a(u),d=n(29),f=a(d),c=n(42),h=a(c),m=n(192),v=a(m),y=n(99),g=a(y),b=n(1),T=a(b),P=n(10),x=a(P),E=n(50),C=a(E),_=n(12),N=a(_),O=n(53),w=a(O),S=n(238),k=a(S),M=n(55),D=a(M),I=n(119),A=a(I),R=n(58),j=a(R),K=n(11),L=a(K),B=n(151),F=a(B),H=n(9),W=a(H),U="toggle-btn",V=j["default"].defaultProps.bsRole,q=A["default"].defaultProps.bsRole,z=function(e){function t(n){o(this,t),e.call(this,n),this.Toggle=j["default"],this.toggleOpen=this.toggleOpen.bind(this),this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleClose=this.handleClose.bind(this),this.extractChildren=this.extractChildren.bind(this),this.refineMenu=this.refineMenu.bind(this),this.refineToggle=this.refineToggle.bind(this),this.childExtractors=[{key:"toggle",matches:function(e){return e.props.bsRole===V},refine:this.refineToggle},{key:"menu",exclusive:!0,matches:function(e){return e.props.bsRole===q},refine:this.refineMenu}],this.state={},this.lastOpenEventType=null}return r(t,e),t.prototype.componentDidMount=function(){this.focusNextOnOpen()},t.prototype.componentWillUpdate=function(e){!e.open&&this.props.open&&(this._focusInDropdown=f["default"](x["default"].findDOMNode(this.refs.menu),p["default"](document)))},t.prototype.componentDidUpdate=function(e){this.props.open&&!e.open&&this.focusNextOnOpen(),!this.props.open&&e.open&&this._focusInDropdown&&(this._focusInDropdown=!1,this.focus())},t.prototype.render=function(){var e=this.extractChildren(),t=this.props.componentClass,n=g["default"](this.props,["id","role"]),r={open:this.props.open,disabled:this.props.disabled,dropdown:!this.props.dropup,dropup:this.props.dropup};return T["default"].createElement(t,s({},n,{tabIndex:"-1",className:l["default"](this.props.className,r)}),e)},t.prototype.toggleOpen=function(){var e=arguments.length<=0||void 0===arguments[0]?null:arguments[0],t=!this.props.open;t&&(this.lastOpenEventType=e),this.props.onToggle&&this.props.onToggle(t)},t.prototype.handleClick=function(){this.props.disabled||this.toggleOpen("click")},t.prototype.handleKeyDown=function(e){if(!this.props.disabled)switch(e.keyCode){case h["default"].codes.down:this.props.open?this.refs.menu.focusNext&&this.refs.menu.focusNext():this.toggleOpen("keydown"),e.preventDefault();break;case h["default"].codes.esc:case h["default"].codes.tab:this.handleClose(e)}},t.prototype.handleClose=function(){this.props.open&&this.toggleOpen()},t.prototype.focusNextOnOpen=function(){var e=this.refs.menu;e.focusNext&&("keydown"===this.lastOpenEventType||"menuitem"===this.props.role)&&e.focusNext()},t.prototype.focus=function(){var e=x["default"].findDOMNode(this.refs[U]);e&&e.focus&&e.focus()},t.prototype.extractChildren=function(){var e=this,t=!!this.props.open,n={};return W["default"].map(this.props.children,function(r){var o=v["default"](e.childExtractors,function(e){return e.matches(r)});if(o){if(n[o.key])return!1;n[o.key]=o.exclusive,r=o.refine(r,t)}return r})},t.prototype.refineMenu=function(e,t){var n={ref:"menu",open:t,labelledBy:this.props.id,pullRight:this.props.pullRight};return n.onClose=L["default"](e.props.onClose,this.props.onClose,this.handleClose),n.onSelect=L["default"](e.props.onSelect,this.props.onSelect,this.handleClose),b.cloneElement(e,n,e.props.children)},t.prototype.refineToggle=function(e,t){var n={open:t,id:this.props.id,ref:U,role:this.props.role};return n.onClick=L["default"](e.props.onClick,this.handleClick),n.onKeyDown=L["default"](e.props.onKeyDown,this.handleKeyDown),b.cloneElement(e,n,e.props.children)},t}(T["default"].Component);z.Toggle=j["default"],z.TOGGLE_REF=U,z.TOGGLE_ROLE=V,z.MENU_ROLE=q,z.defaultProps={componentClass:D["default"],alwaysFocusNextOnOpen:!1},z.propTypes={dropup:T["default"].PropTypes.bool,id:w["default"](T["default"].PropTypes.oneOfType([T["default"].PropTypes.string,T["default"].PropTypes.number])),componentClass:N["default"],children:C["default"](F["default"].requiredRoles(V,q),F["default"].exclusiveRoles(q)),disabled:T["default"].PropTypes.bool,pullRight:T["default"].PropTypes.bool,open:T["default"].PropTypes.bool,onClose:T["default"].PropTypes.func,onToggle:T["default"].PropTypes.func,onSelect:T["default"].PropTypes.func,role:T["default"].PropTypes.string},z=k["default"](z,{open:"onToggle"}),z.Toggle=j["default"],z.Menu=A["default"],t["default"]=z,e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0;var n={CLASSES:{alert:"alert",button:"btn","button-group":"btn-group","button-toolbar":"btn-toolbar",column:"col","input-group":"input-group",form:"form",glyphicon:"glyphicon",label:"label",thumbnail:"thumbnail","list-group-item":"list-group-item",panel:"panel","panel-group":"panel-group",pagination:"pagination","progress-bar":"progress-bar",nav:"nav",navbar:"navbar",modal:"modal",row:"row",well:"well"},STYLES:["default","primary","success","info","warning","danger","link","inline","tabs","pills"],addStyle:function(e){n.STYLES.push(e)},SIZES:{large:"lg",medium:"md",small:"sm",xsmall:"xs",lg:"lg",md:"md",sm:"sm",xs:"xs"},GRID_COLUMNS:12};t["default"]=n,e.exports=t["default"]},function(e,t,n){e.exports={"default":n(162),__esModule:!0}},function(e,t,n){"use strict";var r=n(20),o=function(){var e=r&&document.documentElement;return e&&e.contains?function(e,t){return e.contains(t)}:e&&e.compareDocumentPosition?function(e,t){return e===t||!!(16&e.compareDocumentPosition(t))}:function(e,t){if(t)do if(t===e)return!0;while(t=t.parentNode);return!1}}();e.exports=o},function(e,t,n){function r(e,t){var n=null==e?void 0:e[t];return o(n)?n:void 0}var o=n(225);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(10),s=r(o),a=n(19),i=r(a);t["default"]=function(e){return i["default"](s["default"].findDOMNode(e))},e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(103),p=a(u),d=n(52),f=a(d),c=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){var e=this.props.timeout||this.props.duration;return l["default"].createElement(p["default"],s({},this.props,{timeout:e,className:"fade",enteredClassName:"in",enteringClassName:"in"}),this.props.children)},t}(l["default"].Component);c.propTypes={"in":l["default"].PropTypes.bool,unmountOnExit:l["default"].PropTypes.bool,transitionAppear:l["default"].PropTypes.bool,timeout:l["default"].PropTypes.number,duration:f["default"](l["default"].PropTypes.number,"Use `timeout`."),onEnter:l["default"].PropTypes.func,onEntering:l["default"].PropTypes.func,onEntered:l["default"].PropTypes.func,onExit:l["default"].PropTypes.func,onExiting:l["default"].PropTypes.func,onExited:l["default"].PropTypes.func},c.defaultProps={"in":!1,timeout:300,unmountOnExit:!1,transitionAppear:!1},t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=a["default"].createClass({displayName:"Glyphicon",propTypes:{bsClass:a["default"].PropTypes.string,glyph:a["default"].PropTypes.string.isRequired,formControlFeedback:a["default"].PropTypes.bool},getDefaultProps:function(){return{bsClass:"glyphicon",formControlFeedback:!1}},render:function(){var e,t=l["default"](this.props.className,(e={},e[this.props.bsClass]=!0,e["glyphicon-"+this.props.glyph]=!0,e["form-control-feedback"]=this.props.formControlFeedback,e));return a["default"].createElement("span",r({},this.props,{className:t}),this.props.children)}});t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(4),l=a(i),u=n(1),p=a(u),d=n(60),f=a(d),c=n(33),h=a(c),m=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.getInputDOMNode=function(){return this.refs.input},t.prototype.getValue=function(){if("static"===this.props.type)return this.props.value;if(this.props.type)return"select"===this.props.type&&this.props.multiple?this.getSelectedOptions():this.getInputDOMNode().value;throw new Error("Cannot use getValue without specifying input type.")},t.prototype.getChecked=function(){return this.getInputDOMNode().checked},t.prototype.getSelectedOptions=function(){var e=[];return Array.prototype.forEach.call(this.getInputDOMNode().getElementsByTagName("option"),function(t){if(t.selected){var n=t.getAttribute("value")||t.innerHtml;e.push(n)}}),e},t.prototype.isCheckboxOrRadio=function(){return"checkbox"===this.props.type||"radio"===this.props.type},t.prototype.isFile=function(){return"file"===this.props.type},t.prototype.renderInputGroup=function(e){var t=this.props.addonBefore?p["default"].createElement("span",{className:"input-group-addon",key:"addonBefore"},this.props.addonBefore):null,n=this.props.addonAfter?p["default"].createElement("span",{className:"input-group-addon",key:"addonAfter"},this.props.addonAfter):null,r=this.props.buttonBefore?p["default"].createElement("span",{className:"input-group-btn"},this.props.buttonBefore):null,o=this.props.buttonAfter?p["default"].createElement("span",{className:"input-group-btn"},this.props.buttonAfter):null,s=void 0;switch(this.props.bsSize){case"small":s="input-group-sm";break;case"large":s="input-group-lg"}return t||n||r||o?p["default"].createElement("div",{className:l["default"](s,"input-group"),key:"input-group"},t,r,e,n,o):e},t.prototype.renderIcon=function(){if(!this.props.hasFeedback)return null;if(this.props.feedbackIcon)return p["default"].cloneElement(this.props.feedbackIcon,{formControlFeedback:!0});switch(this.props.bsStyle){case"success":return p["default"].createElement(h["default"],{formControlFeedback:!0,glyph:"ok",key:"icon"});case"warning":return p["default"].createElement(h["default"],{formControlFeedback:!0,glyph:"warning-sign",key:"icon"});case"error":return p["default"].createElement(h["default"],{formControlFeedback:!0,glyph:"remove",key:"icon"});default:return p["default"].createElement("span",{className:"form-control-feedback",key:"icon"})}},t.prototype.renderHelp=function(){return this.props.help?p["default"].createElement("span",{className:"help-block",key:"help"},this.props.help):null},t.prototype.renderCheckboxAndRadioWrapper=function(e){var t={checkbox:"checkbox"===this.props.type,radio:"radio"===this.props.type};return p["default"].createElement("div",{className:l["default"](t),key:"checkboxRadioWrapper"},e)},t.prototype.renderWrapper=function(e){return this.props.wrapperClassName?p["default"].createElement("div",{className:this.props.wrapperClassName,key:"wrapper"},e):e},t.prototype.renderLabel=function(e){var t={"control-label":!this.isCheckboxOrRadio()};return t[this.props.labelClassName]=this.props.labelClassName,this.props.label?p["default"].createElement("label",{htmlFor:this.props.id,className:l["default"](t),key:"label"},e,this.props.label):e},t.prototype.renderInput=function(){if(!this.props.type)return this.props.children;switch(this.props.type){case"select":return p["default"].createElement("select",s({},this.props,{className:l["default"](this.props.className,"form-control"),ref:"input",key:"input"}),this.props.children);case"textarea":return p["default"].createElement("textarea",s({},this.props,{className:l["default"](this.props.className,"form-control"),ref:"input",key:"input"}));case"static":return p["default"].createElement("p",s({},this.props,{className:l["default"](this.props.className,"form-control-static"),ref:"input",key:"input"}),this.props.value);default:var e=this.isCheckboxOrRadio()||this.isFile()?"":"form-control";return p["default"].createElement("input",s({},this.props,{className:l["default"](this.props.className,e),ref:"input",key:"input"}))}},t.prototype.renderFormGroup=function(e){return p["default"].createElement(f["default"],this.props,e)},t.prototype.renderChildren=function(){return this.isCheckboxOrRadio()?this.renderWrapper([this.renderCheckboxAndRadioWrapper(this.renderLabel(this.renderInput())),this.renderHelp()]):[this.renderLabel(),this.renderWrapper([this.renderInputGroup(this.renderInput()),this.renderIcon(),this.renderHelp()])]},t.prototype.render=function(){var e=this.renderChildren();return this.renderFormGroup(e)},t}(p["default"].Component);m.propTypes={type:p["default"].PropTypes.string,label:p["default"].PropTypes.node,help:p["default"].PropTypes.node,addonBefore:p["default"].PropTypes.node,addonAfter:p["default"].PropTypes.node,buttonBefore:p["default"].PropTypes.node,buttonAfter:p["default"].PropTypes.node,bsSize:p["default"].PropTypes.oneOf(["small","medium","large"]),bsStyle:p["default"].PropTypes.oneOf(["success","warning","error"]),hasFeedback:p["default"].PropTypes.bool,feedbackIcon:p["default"].PropTypes.node,id:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.number]),groupClassName:p["default"].PropTypes.string,wrapperClassName:p["default"].PropTypes.string,labelClassName:p["default"].PropTypes.string,multiple:p["default"].PropTypes.bool,disabled:p["default"].PropTypes.bool,value:p["default"].PropTypes.any},m.defaultProps={disabled:!1,hasFeedback:!1,multiple:!1},t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t,n){var r=l["default"]("children","value")(e,t,n);return r||(r=a["default"].PropTypes.node(e,t,n)),r}var o=n(2)["default"];t.__esModule=!0,t["default"]=r;var s=n(1),a=o(s),i=n(107),l=o(i);e.exports=t["default"]},function(e,t,n){var r=n(171),o=n(18),s="prototype",a=function(e,t){return function(){return e.apply(t,arguments)}},i=function(e,t,n){var l,u,p,d,f=e&i.G,c=e&i.P,h=f?r:e&i.S?r[t]:(r[t]||{})[s],m=f?o:o[t]||(o[t]={});f&&(n=t);for(l in n)u=!(e&i.F)&&h&&l in h,u&&l in m||(p=u?h[l]:n[l],f&&"function"!=typeof h[l]?d=n[l]:e&i.B&&u?d=a(p,r):e&i.W&&h[l]==p?!function(e){d=function(t){return this instanceof e?new e(t):e(t)},d[s]=e[s]}(p):d=c&&"function"==typeof p?a(Function.call,p):p,m[l]=d,c&&((m[s]||(m[s]={}))[l]=p))};i.F=1,i.G=2,i.S=4,i.P=8,i.B=16,i.W=32,e.exports=i},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t){var n=Object;e.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},function(e,t){"use strict";e.exports=function(e){return e===e.window?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}},function(e,t,n){"use strict";var r=n(29),o=n(39),s=n(19);e.exports=function(e){var t=s(e),n=o(t),a=t&&t.documentElement,i={top:0,left:0,height:0,width:0};if(t)return r(a,e)?(void 0!==e.getBoundingClientRect&&(i=e.getBoundingClientRect()),(i.width||i.height)&&(i={top:i.top+(n.pageYOffset||a.scrollTop)-(a.clientTop||0),left:i.left+(n.pageXOffset||a.scrollLeft)-(a.clientLeft||0),width:(null==i.width?e.offsetWidth:i.width)||0,height:(null==i.height?e.offsetHeight:i.height)||0}),i):i}},function(e,t,n){"use strict";var r=n(83),o=n(189),s=n(184),a=n(185),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var l="",u=t;if("string"==typeof t){if(void 0===n)return e.style[r(t)]||s(e).getPropertyValue(o(t));(u={})[t]=n}for(var p in u)i.call(u,p)&&(u[p]||0===u[p]?l+=o(p)+":"+u[p]+";":a(e,o(p)));e.style.cssText+=";"+l}},function(e,t){t=e.exports=function(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return s[e];var o=String(e),a=n[o.toLowerCase()];if(a)return a;var a=r[o.toLowerCase()];return a?a:1===o.length?o.charCodeAt(0):void 0};var n=t.code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,"delete":46,command:91,"right click":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,"break":19,caps:20,"return":13,escape:27,spc:32,pgup:33,pgdn:33,ins:45,del:46,cmd:91};/*!
* Programatically add the following
*/
for(o=97;123>o;o++)n[String.fromCharCode(o)]=o-32;for(var o=48;58>o;o++)n[o-48]=o;for(o=1;13>o;o++)n["f"+o]=o+111;for(o=0;10>o;o++)n["numpad "+o]=o+96;var s=t.names=t.title={};for(o in n)s[n[o]]=o;for(var a in r)n[a]=r[a]},function(e,t,n){function r(e,t,n){if("function"!=typeof e)return o;if(void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,o){return e.call(t,n,r,o)};case 4:return function(n,r,o,s){return e.call(t,n,r,o,s)};case 5:return function(n,r,o,s,a){return e.call(t,n,r,o,s,a)}}return function(){return e.apply(t,arguments)}}var o=n(100);e.exports=r},function(e,t,n){function r(e){return null!=e&&s(o(e))}var o=n(90),s=n(21);e.exports=r},function(e,t,n){function r(e){return s(e)&&o(e)&&i.call(e,"callee")&&!l.call(e,"callee")}var o=n(44),s=n(17),a=Object.prototype,i=a.hasOwnProperty,l=a.propertyIsEnumerable;e.exports=r},function(e,t,n){function r(e){return"string"==typeof e||o(e)&&i.call(e)==s}var o=n(17),s="[object String]",a=Object.prototype,i=a.toString;e.exports=r},function(e,t,n){var r=n(30),o=n(44),s=n(16),a=n(224),i=n(49),l=r(Object,"keys"),u=l?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||("function"==typeof e?i.enumPrototypes:o(e))?a(e):s(e)?l(e):[]}:a;e.exports=u},function(e,t,n){function r(e){if(null==e)return[];p(e)||(e=Object(e));var t=e.length;t=t&&u(t)&&(a(e)||s(e)||d(e))&&t||0;for(var n=e.constructor,r=-1,o=i(n)&&n.prototype||C,c=o===e,h=Array(t),m=t>0,y=f.enumErrorProps&&(e===E||e instanceof Error),g=f.enumPrototypes&&i(e);++r<t;)h[r]=r+"";for(var T in e)g&&"prototype"==T||y&&("message"==T||"name"==T)||m&&l(T,t)||"constructor"==T&&(c||!N.call(e,T))||h.push(T);if(f.nonEnumShadows&&e!==C){var S=e===_?P:e===E?v:O.call(e),k=w[S]||w[b];for(S==b&&(o=C),t=x.length;t--;){T=x[t];var M=k[T];c&&M||(M?!N.call(e,T):e[T]===o[T])||h.push(T)}}return h}var o=n(194),s=n(45),a=n(15),i=n(98),l=n(92),u=n(21),p=n(16),d=n(46),f=n(49),c="[object Array]",h="[object Boolean]",m="[object Date]",v="[object Error]",y="[object Function]",g="[object Number]",b="[object Object]",T="[object RegExp]",P="[object String]",x=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],E=Error.prototype,C=Object.prototype,_=String.prototype,N=C.hasOwnProperty,O=C.toString,w={};w[c]=w[m]=w[g]={constructor:!0,toLocaleString:!0,toString:!0,valueOf:!0},w[h]=w[P]={constructor:!0,toString:!0,valueOf:!0},w[v]=w[y]=w[T]={constructor:!0,toString:!0},w[b]={constructor:!0},o(x,function(e){for(var t in w)if(N.call(w,t)){var n=w[t];n[e]=N.call(n,e)}}),e.exports=r},function(e,t){var n=Array.prototype,r=Error.prototype,o=Object.prototype,s=o.propertyIsEnumerable,a=n.splice,i={};!function(e){var t=function(){this.x=e},n={0:e,length:e},o=[];t.prototype={valueOf:e,y:e};for(var l in new t)o.push(l);i.enumErrorProps=s.call(r,"message")||s.call(r,"name"),i.enumPrototypes=s.call(t,"prototype"),i.nonEnumShadows=!/valueOf/.test(o),i.ownLast="x"!=o[0],i.spliceObjects=(a.call(n,0,1),!n[0]),i.unindexedChars="x"[0]+Object("x")[0]!="xx"}(1,0),e.exports=i},function(e,t){"use strict";function n(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];if(void 0===t)throw new Error("No validations provided");if(t.some(function(e){return"function"!=typeof e}))throw new Error("Invalid arguments, must be functions");if(0===t.length)throw new Error("No validations provided");return function(e,n,r){for(var o=0;o<t.length;o++){var s=t[o](e,n,r);if(void 0!==s&&null!==s)return s}}}t.__esModule=!0,t["default"]=n,e.exports=t["default"]},function(e,t){"use strict";function n(e,t,n,r){return"Invalid prop '"+t+"' of value '"+e[t]+"'"+(" supplied to '"+n+"'"+r)}function r(e){function t(t,n,r,o){return o=o||"<<anonymous>>",null!=n[r]?e(n,r,o):t?new Error("Required prop '"+r+"' was not specified in '"+o+"'."):void 0}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}t.__esModule=!0,t.errMsg=n,t.createChainableTypeChecker=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){return function(n,r,o){return null!=n[r]&&a["default"](!1,'"'+r+'" property of "'+o+'" has been deprecated.\n'+t),e(n,r,o)}}t.__esModule=!0,t["default"]=o;var s=n(23),a=r(s);e.exports=t["default"]},function(e,t){"use strict";function n(e){return function(t,n,r){return null==t[n]?new Error("The prop '"+n+"' is required to make '"+r+"' accessible for users using assistive technologies such as screen readers"):e(t,n,r)}}t.__esModule=!0,t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(2)["default"];t.__esModule=!0;var o=n(1),s=r(o),a=n(10),i=r(a),l=n(75),u=r(l),p=n(40),d=r(p),f=n(73),c=r(f),h={propTypes:{offset:s["default"].PropTypes.number,offsetTop:s["default"].PropTypes.number,offsetBottom:s["default"].PropTypes.number},getInitialState:function(){return{affixClass:"affix-top"}},getPinnedOffset:function(e){return this.pinnedOffset?this.pinnedOffset:(e.className=e.className.replace(/affix-top|affix-bottom|affix/,""),e.className+=e.className.length?" affix":"affix",this.pinnedOffset=d["default"](e).top-window.pageYOffset,this.pinnedOffset)},checkPosition:function(){var e=void 0,t=void 0,n=void 0,r=void 0,o=void 0,s=void 0,a=void 0,l=void 0,p=void 0;this.isMounted()&&(e=i["default"].findDOMNode(this),t=u["default"].getDocumentHeight(),n=window.pageYOffset,r=d["default"](e),"top"===this.affixed&&(r.top+=n),o=null!=this.props.offsetTop?this.props.offsetTop:this.props.offset,s=null!=this.props.offsetBottom?this.props.offsetBottom:this.props.offset,(null!=o||null!=s)&&(null==o&&(o=0),null==s&&(s=0),a=null!=this.unpin&&n+this.unpin<=r.top?!1:null!=s&&r.top+e.offsetHeight>=t-s?"bottom":null!=o&&o>=n?"top":!1,this.affixed!==a&&(null!=this.unpin&&(e.style.top=""),l="affix"+(a?"-"+a:""),this.affixed=a,this.unpin="bottom"===a?this.getPinnedOffset(e):null,"bottom"===a&&(e.className=e.className.replace(/affix-top|affix-bottom|affix/,"affix-bottom"),p=t-s-e.offsetHeight-d["default"](e).top),this.setState({affixClass:l,affixPositionTop:p}))))},checkPositionWithEventLoop:function(){setTimeout(this.checkPosition,0)},componentDidMount:function(){this._onWindowScrollListener=c["default"].listen(window,"scroll",this.checkPosition),this._onDocumentClickListener=c["default"].listen(u["default"].ownerDocument(this),"click",this.checkPositionWithEventLoop)},componentWillUnmount:function(){this._onWindowScrollListener&&this._onWindowScrollListener.remove(),this._onDocumentClickListener&&this._onDocumentClickListener.remove()},componentDidUpdate:function(e,t){t.affixClass===this.state.affixClass&&this.checkPositionWithEventLoop()}};t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=n(50),f=o(d),c=a["default"].createClass({displayName:"ButtonGroup",mixins:[p["default"]],propTypes:{vertical:a["default"].PropTypes.bool,justified:a["default"].PropTypes.bool,block:f["default"](a["default"].PropTypes.bool,function(e){return e.block&&!e.vertical?new Error("The block property requires the vertical property to be set to have any effect"):void 0})},getDefaultProps:function(){return{block:!1,bsClass:"button-group",justified:!1,vertical:!1}},render:function(){var e=this.getBsClassSet();return e["btn-group"]=!this.props.vertical,e["btn-group-vertical"]=this.props.vertical,e["btn-group-justified"]=this.props.justified,e["btn-block"]=this.props.block,a["default"].createElement("div",r({},this.props,{className:l["default"](this.props.className,e)}),this.props.children)}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(8)["default"],a=n(3)["default"],i=n(2)["default"];t.__esModule=!0;var l=n(1),u=i(l),p=n(24),d=i(p),f=n(60),c=i(f),h=n(34),m=i(h),v=n(35),y=i(v),g=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.renderFormGroup=function(e){var t=this.props,n=(t.bsStyle,t.value,s(t,["bsStyle","value"]));return u["default"].createElement(c["default"],n,e)},t.prototype.renderInput=function(){var e=this.props,t=e.children,n=e.value,r=s(e,["children","value"]),o=t?t:n;return u["default"].createElement(d["default"],a({},r,{componentClass:"input",ref:"input",key:"input",value:o}))},t}(m["default"]);g.types=["button","reset","submit"],g.defaultProps={type:"button"},g.propTypes={type:u["default"].PropTypes.oneOf(g.types),bsStyle:function(){return null},children:y["default"],value:y["default"]},t["default"]=g,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(28)["default"],s=n(2)["default"];t.__esModule=!0;var a=n(1),i=s(a),l=n(4),u=s(l),p=n(27),d=s(p),f=n(12),c=s(f),h=i["default"].createClass({displayName:"Col",propTypes:{xs:i["default"].PropTypes.number,sm:i["default"].PropTypes.number,md:i["default"].PropTypes.number,lg:i["default"].PropTypes.number,xsOffset:i["default"].PropTypes.number,smOffset:i["default"].PropTypes.number,mdOffset:i["default"].PropTypes.number,lgOffset:i["default"].PropTypes.number,xsPush:i["default"].PropTypes.number,smPush:i["default"].PropTypes.number,mdPush:i["default"].PropTypes.number,lgPush:i["default"].PropTypes.number,xsPull:i["default"].PropTypes.number,smPull:i["default"].PropTypes.number,mdPull:i["default"].PropTypes.number,lgPull:i["default"].PropTypes.number,componentClass:c["default"]},getDefaultProps:function(){return{componentClass:"div"}},render:function(){var e=this,t=this.props.componentClass,n={};return o(d["default"].SIZES).forEach(function(t){var r=d["default"].SIZES[t],o=r,s=r+"-";e.props[o]&&(n["col-"+s+e.props[o]]=!0),o=r+"Offset",s=r+"-offset-",e.props[o]>=0&&(n["col-"+s+e.props[o]]=!0),o=r+"Push",s=r+"-push-",e.props[o]>=0&&(n["col-"+s+e.props[o]]=!0),o=r+"Pull",s=r+"-pull-",e.props[o]>=0&&(n["col-"+s+e.props[o]]=!0)},this),i["default"].createElement(t,r({},this.props,{className:u["default"](this.props.className,n)}),this.props.children)}});t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(4),p=a(u),d=n(24),f=a(d),c=n(107),h=a(c),m=n(14),v=a(m),y=l["default"].createElement("span",null," ",l["default"].createElement("span",{className:"caret"})),g=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){var e=this.props.noCaret?null:y,t={"dropdown-toggle":!0},n=this.props.useAnchor?v["default"]:f["default"];return l["default"].createElement(n,s({},this.props,{className:p["default"](t,this.props.className),type:"button","aria-haspopup":!0,"aria-expanded":this.props.open}),this.props.title||this.props.children,e)},t}(l["default"].Component);t["default"]=g;var b=h["default"]("title","children");g.defaultProps={open:!1,useAnchor:!1,bsRole:"toggle"},g.propTypes={bsRole:l["default"].PropTypes.string,children:b,noCaret:l["default"].PropTypes.bool,open:l["default"].PropTypes.bool,title:b,useAnchor:l["default"].PropTypes.bool},g.isToggle=!0,g.titleProp="title",g.onClickProp="onClick",e.exports=t["default"]},function(e,t,n){"use strict";var r=n(2)["default"];t.__esModule=!0;var o=n(120),s=r(o);t.Static=s["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(2)["default"];t.__esModule=!0;var a=n(1),i=s(a),l=n(4),u=s(l),p=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){var e={"form-group":!this.props.standalone,"form-group-lg":!this.props.standalone&&"large"===this.props.bsSize,"form-group-sm":!this.props.standalone&&"small"===this.props.bsSize,"has-feedback":this.props.hasFeedback,"has-success":"success"===this.props.bsStyle,"has-warning":"warning"===this.props.bsStyle,"has-error":"error"===this.props.bsStyle};return i["default"].createElement("div",{className:u["default"](e,this.props.groupClassName)},this.props.children)},t}(i["default"].Component);p.defaultProps={hasFeedback:!1,standalone:!1},p.propTypes={standalone:i["default"].PropTypes.bool,hasFeedback:i["default"].PropTypes.bool,bsSize:function(e){return e.standalone&&void 0!==e.bsSize?new Error("bsSize will not be used when `standalone` is set."):i["default"].PropTypes.oneOf(["small","medium","large"]).apply(null,arguments)},bsStyle:i["default"].PropTypes.oneOf(["success","warning","error"]),groupClassName:i["default"].PropTypes.string},t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(12),p=o(u),d=a["default"].createClass({displayName:"Grid",propTypes:{fluid:a["default"].PropTypes.bool,componentClass:p["default"]},getDefaultProps:function(){return{componentClass:"div",fluid:!1}},render:function(){var e=this.props.componentClass,t=this.props.fluid?"container-fluid":"container";return a["default"].createElement(e,r({},this.props,{className:l["default"](this.props.className,t)}),this.props.children)}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(9),l=o(i),u=/\%\((.+?)\)s/,p=a["default"].createClass({displayName:"Interpolate",propTypes:{component:a["default"].PropTypes.node,format:a["default"].PropTypes.string,unsafe:a["default"].PropTypes.bool},getDefaultProps:function(){return{component:"span",unsafe:!1}},render:function(){var e=l["default"].hasValidComponent(this.props.children)||"string"==typeof this.props.children?this.props.children:this.props.format,t=this.props.component,n=this.props.unsafe===!0,o=r({},this.props);if(delete o.children,delete o.format,delete o.component,delete o.unsafe,n){var s=e.split(u).reduce(function(e,t,n){var r=void 0;if(n%2===0?r=t:(r=o[t],delete o[t]),a["default"].isValidElement(r))throw new Error("cannot interpolate a React component into unsafe text");return e+=r},"");return o.dangerouslySetInnerHTML={__html:s},a["default"].createElement(t,o)}var i=e.split(u).reduce(function(e,t,n){var r=void 0;if(n%2===0){if(0===t.length)return e;r=t}else r=o[t],delete o[t];return e.push(r),e},[]);return a["default"].createElement(t,o,i)}});t["default"]=p,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(7),l=o(i),u=n(4),p=o(u),d=a["default"].createClass({displayName:"ListGroupItem",mixins:[l["default"]],propTypes:{bsStyle:a["default"].PropTypes.oneOf(["danger","info","success","warning"]),className:a["default"].PropTypes.string,active:a["default"].PropTypes.any,disabled:a["default"].PropTypes.any,header:a["default"].PropTypes.node,listItem:a["default"].PropTypes.bool,onClick:a["default"].PropTypes.func,href:a["default"].PropTypes.string},getDefaultProps:function(){return{bsClass:"list-group-item",listItem:!1}},render:function(){var e=this.getBsClassSet();return e.active=this.props.active,e.disabled=this.props.disabled,this.props.href?this.renderAnchor(e):this.props.onClick?this.renderButton(e):this.props.listItem?this.renderLi(e):this.renderSpan(e)},renderLi:function(e){return a["default"].createElement("li",r({},this.props,{className:p["default"](this.props.className,e)}),this.props.header?this.renderStructuredContent():this.props.children)},renderAnchor:function(e){return a["default"].createElement("a",r({},this.props,{className:p["default"](this.props.className,e)}),this.props.header?this.renderStructuredContent():this.props.children)},renderButton:function(e){return a["default"].createElement("button",r({type:"button"},this.props,{className:p["default"](this.props.className,e)}),this.props.header?this.renderStructuredContent():this.props.children)},renderSpan:function(e){return a["default"].createElement("span",r({},this.props,{className:p["default"](this.props.className,e)}),this.props.header?this.renderStructuredContent():this.props.children)},renderStructuredContent:function(){var e=void 0;e=a["default"].isValidElement(this.props.header)?s.cloneElement(this.props.header,{key:"header",className:p["default"](this.props.header.props.className,"list-group-item-heading")}):a["default"].createElement("h4",{key:"header",className:"list-group-item-heading"},this.props.header);var t=a["default"].createElement("p",{key:"content",className:"list-group-item-text"},this.props.children);return[e,t]}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(4),p=a(u),d=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){return l["default"].createElement("div",s({},this.props,{className:p["default"](this.props.className,this.props.modalClassName)}),this.props.children)},t}(l["default"].Component);d.propTypes={modalClassName:l["default"].PropTypes.string},d.defaultProps={modalClassName:"modal-body"},t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(4),p=a(u),d=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){return l["default"].createElement("div",s({},this.props,{className:p["default"](this.props.className,this.props.modalClassName)}),this.props.children)},t}(l["default"].Component);d.propTypes={modalClassName:l["default"].PropTypes.string},d.defaultProps={modalClassName:"modal-footer"},t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(4),p=a(u),d=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){return l["default"].createElement("div",s({},this.props,{className:p["default"](this.props.className,this.props.modalClassName)}),this.props.closeButton&&l["default"].createElement("button",{className:"close",onClick:this.props.onHide},l["default"].createElement("span",{"aria-hidden":"true"},"×")),this.props.children)},t}(l["default"].Component);d.__isModalHeader=!0,d.propTypes={"aria-label":l["default"].PropTypes.string,modalClassName:l["default"].PropTypes.string,closeButton:l["default"].PropTypes.bool,onHide:l["default"].PropTypes.func},d.defaultProps={"aria-label":"Close",modalClassName:"modal-header",closeButton:!1},t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(4),p=a(u),d=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){return l["default"].createElement("h4",s({},this.props,{className:p["default"](this.props.className,this.props.modalClassName)}),this.props.children)},t}(l["default"].Component);d.propTypes={modalClassName:l["default"].PropTypes.string},d.defaultProps={modalClassName:"modal-title"},t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(7),l=o(i),u=n(25),p=o(u),d=n(4),f=o(d),c=n(9),h=o(c),m=n(11),v=o(m),y=a["default"].createClass({displayName:"Nav",mixins:[l["default"]],propTypes:{activeHref:a["default"].PropTypes.string,activeKey:a["default"].PropTypes.any,bsStyle:a["default"].PropTypes.oneOf(["tabs","pills"]),stacked:a["default"].PropTypes.bool,justified:a["default"].PropTypes.bool,onSelect:a["default"].PropTypes.func,collapsible:a["default"].PropTypes.bool,className:a["default"].PropTypes.string,id:a["default"].PropTypes.oneOfType([a["default"].PropTypes.string,a["default"].PropTypes.number]),ulClassName:a["default"].PropTypes.string,ulId:a["default"].PropTypes.string,expanded:a["default"].PropTypes.bool,navbar:a["default"].PropTypes.bool,eventKey:a["default"].PropTypes.any,pullRight:a["default"].PropTypes.bool,right:a["default"].PropTypes.bool},getDefaultProps:function(){return{bsClass:"nav",collapsible:!1,expanded:!0,justified:!1,navbar:!1,pullRight:!1,right:!1,stacked:!1}},render:function(){var e=this.props.collapsible?"navbar-collapse":null;return this.props.navbar&&!this.props.collapsible?this.renderUl():a["default"].createElement(p["default"],{"in":this.props.expanded},a["default"].createElement("nav",r({},this.props,{className:f["default"](this.props.className,e)}),this.renderUl()))},renderUl:function(){var e=this.getBsClassSet();return e["nav-stacked"]=this.props.stacked,e["nav-justified"]=this.props.justified,e["navbar-nav"]=this.props.navbar,e["pull-right"]=this.props.pullRight,e["navbar-right"]=this.props.right,a["default"].createElement("ul",r({},this.props,{role:"tabs"===this.props.bsStyle?"tablist":null,className:f["default"](this.props.ulClassName,e),id:this.props.ulId,ref:"ul"}),h["default"].map(this.props.children,this.renderNavItem))},getChildActiveProp:function(e){return e.props.active?!0:null!=this.props.activeKey&&e.props.eventKey===this.props.activeKey?!0:null!=this.props.activeHref&&e.props.href===this.props.activeHref?!0:e.props.active},renderNavItem:function(e,t){return s.cloneElement(e,{role:"tabs"===this.props.bsStyle?"tab":null,active:this.getChildActiveProp(e),activeKey:this.props.activeKey,activeHref:this.props.activeHref,onSelect:v["default"](e.props.onSelect,this.props.onSelect),key:e.key?e.key:t,navItem:!0})}});t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(8)["default"],a=n(3)["default"],i=n(2)["default"];t.__esModule=!0;var l=n(4),u=i(l),p=n(1),d=i(p),f=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){var e=this.props,t=e.className,n=e.children,r=s(e,["className","children"]);return d["default"].isValidElement(n)?d["default"].cloneElement(n,{className:u["default"](n.props.className,t,"navbar-brand")}):d["default"].createElement("span",a({},r,{className:u["default"](t,"navbar-brand")}),n)},t}(d["default"].Component);f.propTypes={bsRole:d["default"].PropTypes.string},f.defaultProps={bsRole:"brand"},t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(8)["default"],o=n(3)["default"],s=n(2)["default"];t.__esModule=!0;var a=n(1),i=s(a),l=n(4),u=s(l),p=n(7),d=s(p),f=n(14),c=s(f),h=i["default"].createClass({displayName:"NavItem",mixins:[d["default"]],propTypes:{linkId:i["default"].PropTypes.string,onSelect:i["default"].PropTypes.func,active:i["default"].PropTypes.bool,disabled:i["default"].PropTypes.bool,href:i["default"].PropTypes.string,role:i["default"].PropTypes.string,title:i["default"].PropTypes.node,eventKey:i["default"].PropTypes.any,target:i["default"].PropTypes.string,"aria-controls":i["default"].PropTypes.string},getDefaultProps:function(){return{active:!1,disabled:!1}},render:function(){var e=this.props,t=e.role,n=e.linkId,s=e.disabled,a=e.active,l=e.href,p=e.title,d=e.target,f=e.children,h=e.tabIndex,m=e["aria-controls"],v=r(e,["role","linkId","disabled","active","href","title","target","children","tabIndex","aria-controls"]),y={active:a,disabled:s},g={role:t,href:l,title:p,target:d,tabIndex:h,id:n,onClick:this.handleClick};return t||"#"!==l||(g.role="button"),i["default"].createElement("li",o({},v,{role:"presentation",className:u["default"](v.className,y)}),i["default"].createElement(c["default"],o({},g,{"aria-selected":a,"aria-controls":m}),f))},handleClick:function(e){this.props.onSelect&&(e.preventDefault(),this.props.disabled||this.props.onSelect(this.props.eventKey,this.props.href,this.props.target))}});t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(8)["default"],i=n(2)["default"];t.__esModule=!0;var l=n(1),u=i(l),p=n(230),d=i(p),f=n(12),c=i(f),h=n(32),m=i(h),v=n(4),y=i(v),g=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){var e=this.props,t=e.children,n=e.animation,r=a(e,["children","animation"]);return n===!0&&(n=m["default"]),n||(t=l.cloneElement(t,{className:y["default"]("in",t.props.className)})),u["default"].createElement(d["default"],s({},r,{transition:n}),t)},t}(u["default"].Component);g.propTypes=s({},d["default"].propTypes,{show:u["default"].PropTypes.bool,rootClose:u["default"].PropTypes.bool,onHide:u["default"].PropTypes.func,animation:u["default"].PropTypes.oneOfType([u["default"].PropTypes.bool,c["default"]]),onEnter:u["default"].PropTypes.func,onEntering:u["default"].PropTypes.func,onEntered:u["default"].PropTypes.func,onExit:u["default"].PropTypes.func,onExiting:u["default"].PropTypes.func,onExited:u["default"].PropTypes.func}),g.defaultProps={animation:m["default"],rootClose:!1,show:!1},t["default"]=g,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(8)["default"],o=n(3)["default"],s=n(2)["default"];t.__esModule=!0;var a=n(1),i=s(a),l=n(4),u=s(l),p=n(7),d=s(p),f=n(9),c=s(f),h=i["default"].createClass({displayName:"PanelGroup",mixins:[d["default"]],propTypes:{accordion:i["default"].PropTypes.bool,activeKey:i["default"].PropTypes.any,className:i["default"].PropTypes.string,children:i["default"].PropTypes.node,defaultActiveKey:i["default"].PropTypes.any,onSelect:i["default"].PropTypes.func},getDefaultProps:function(){return{accordion:!1,bsClass:"panel-group"}},getInitialState:function(){var e=this.props.defaultActiveKey;return{activeKey:e}},render:function(){var e=this.getBsClassSet(),t=this.props,n=t.className,s=r(t,["className"]);return this.props.accordion&&(s.role="tablist"),i["default"].createElement("div",o({},s,{className:u["default"](n,e),onSelect:null}),c["default"].map(s.children,this.renderPanel))},renderPanel:function(e,t){var n=null!=this.props.activeKey?this.props.activeKey:this.state.activeKey,r={bsStyle:e.props.bsStyle||this.props.bsStyle,key:e.key?e.key:t,ref:e.ref};return this.props.accordion&&(r.headerRole="tab",r.panelRole="tabpanel",r.collapsible=!0,r.expanded=e.props.eventKey===n,r.onSelect=this.handleSelect),a.cloneElement(e,r)},shouldComponentUpdate:function(){return!this._isChanging},handleSelect:function(e,t){e.preventDefault(),this.props.onSelect&&(this._isChanging=!0,this.props.onSelect(t),this._isChanging=!1),this.state.activeKey===t&&(t=null),this.setState({activeKey:t})}});t["default"]=h,e.exports=t["default"]},function(e,t){"use strict";t.__esModule=!0;var n={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0}};t["default"]=n,e.exports=t["default"]},function(e,t){"use strict";function n(){var e=document.createElement("div"),t=e.style;"AnimationEvent"in window||delete a.animationend.animation,"TransitionEvent"in window||delete a.transitionend.transition;for(var n in a){var r=a[n];for(var o in r)if(o in t){i.push(r[o]);break}}}function r(e,t,n){e.addEventListener(t,n,!1)}function o(e,t,n){e.removeEventListener(t,n,!1)}t.__esModule=!0;var s=!("undefined"==typeof window||!window.document||!window.document.createElement),a={transitionend:{transition:"transitionend",WebkitTransition:"webkitTransitionEnd",MozTransition:"mozTransitionEnd",OTransition:"oTransitionEnd",msTransition:"MSTransitionEnd"},animationend:{animation:"animationend",WebkitAnimation:"webkitAnimationEnd",MozAnimation:"mozAnimationEnd",OAnimation:"oAnimationEnd",msAnimation:"MSAnimationEnd"}},i=[];s&&n();var l={addEndEventListener:function(e,t){return 0===i.length?void window.setTimeout(t,0):void i.forEach(function(n){r(e,n,t)})},removeEndEventListener:function(e,t){0!==i.length&&i.forEach(function(n){o(e,n,t)})}};t["default"]=l,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){var t=u["default"].findDOMNode(e);return d["default"](t&&t.ownerDocument||document)}function o(e){var t=r(e);return c["default"](t)}function s(){return Math.max(document.documentElement.offsetHeight,document.height,document.body.scrollHeight,document.body.offsetHeight)}function a(e){var t={width:e.offsetWidth||0,height:e.offsetHeight||0};if("undefined"!=typeof e.getBoundingClientRect){var n=e.getBoundingClientRect(),r=n.width,o=n.height;t.width=r||t.width,t.height=o||t.height}return t}var i=n(2)["default"];t.__esModule=!0;var l=n(10),u=i(l),p=n(19),d=i(p),f=n(180),c=i(f);t["default"]={ownerWindow:o,ownerDocument:r,getDocumentHeight:s,getSize:a},e.exports=t["default"]},function(e,t){"use strict";t["default"]=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t},t.__esModule=!0},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t,n){e.exports=function(e,t){var r=n(36),o=(n(18).Object||{})[e]||Object[e],s={};s[e]=t(o),r(r.S+r.F*n(77)(function(){o(1)}),"Object",s)}},function(e,t,n){var r=n(169);e.exports=function(e){return Object(r(e))}},function(e,t,n){"use strict";function r(){var e=void 0===arguments[0]?document:arguments[0];try{return e.activeElement}catch(t){}}var o=n(22);t.__esModule=!0,t["default"]=r;var s=n(19);o.interopRequireDefault(s);e.exports=t["default"]},function(e,t,n){"use strict";var r=n(20),o=function(){};r&&(o=function(){return document.addEventListener?function(e,t,n,r){return e.addEventListener(t,n,r||!1)}:document.attachEvent?function(e,t,n){return e.attachEvent("on"+t,n)}:void 0}()),e.exports=o},function(e,t,n){"use strict";var r=n(39);e.exports=function(e,t){var n=r(e);return void 0===t?n?"pageYOffset"in n?n.pageYOffset:n.document.documentElement.scrollTop:e.scrollTop:void(n?n.scrollTo("pageXOffset"in n?n.pageXOffset:n.document.documentElement.scrollLeft,t):e.scrollTop=t)}},function(e,t,n){"use strict";var r=n(187),o=/^-ms-/;e.exports=function(e){return r(e.replace(o,"ms-"))}},function(e,t){function n(e,t){if("function"!=typeof e)throw new TypeError(r);return t=o(void 0===t?e.length-1:+t||0,0),function(){for(var n=arguments,r=-1,s=o(n.length-t,0),a=Array(s);++r<s;)a[r]=n[t+r];switch(t){case 0:return e.call(this,a);case 1:return e.call(this,n[0],a);case 2:return e.call(this,n[0],n[1],a)}var i=Array(t+1);for(r=-1;++r<t;)i[r]=n[r];return i[t]=a,e.apply(this,i)}}var r="Expected a function",o=Math.max;e.exports=n},function(e,t,n){function r(e,t,n,u){u||(u=[]);for(var p=-1,d=e.length;++p<d;){var f=e[p];l(f)&&i(f)&&(n||a(f)||s(f))?t?r(f,t,n,u):o(u,f):n||(u[u.length]=f)}return u}var o=n(196),s=n(45),a=n(15),i=n(44),l=n(17);e.exports=r},function(e,t,n){var r=n(216),o=r();e.exports=o},function(e,t,n){function r(e,t,n){if(null!=e){e=o(e),void 0!==n&&n in e&&(t=[n]);for(var r=0,s=t.length;null!=e&&s>r;)e=o(e)[t[r++]];return r&&r==s?e:void 0}}var o=n(13);e.exports=r},function(e,t,n){function r(e,t,n,i,l,u){return e===t?!0:null==e||null==t||!s(e)&&!a(t)?e!==e&&t!==t:o(e,t,r,n,i,l,u)}var o=n(206),s=n(16),a=n(17);e.exports=r},function(e,t,n){function r(e){return function(t){return null==t?void 0:o(t)[e]}}var o=n(13);e.exports=r},function(e,t,n){var r=n(89),o=r("length");e.exports=o},function(e,t){var n=function(){try{Object({toString:0}+"")}catch(e){return function(){return!1}}return function(e){return"function"!=typeof e.toString&&"string"==typeof(e+"")}}();e.exports=n},function(e,t){function n(e,t){return e="number"==typeof e||r.test(e)?+e:-1,t=null==t?o:t,e>-1&&e%1==0&&t>e}var r=/^\d+$/,o=9007199254740991;e.exports=n},function(e,t,n){function r(e,t){var n=typeof e;if("string"==n&&i.test(e)||"number"==n)return!0;if(o(e))return!1;var r=!a.test(e);return r||null!=t&&e in s(t)}var o=n(15),s=n(13),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,i=/^\w*$/;e.exports=r},function(e,t,n){function r(e){return e===e&&!o(e)}var o=n(16);e.exports=r},function(e,t,n){function r(e,t){e=o(e);for(var n=-1,r=t.length,s={};++n<r;){var a=t[n];a in e&&(s[a]=e[a])}return s}var o=n(13);e.exports=r},function(e,t,n){function r(e,t){var n={};return o(e,function(e,r,o){
t(e,r,o)&&(n[r]=e)}),n}var o=n(203);e.exports=r},function(e,t,n){function r(e){if(s(e))return e;var t=[];return o(e).replace(a,function(e,n,r,o){t.push(r?o.replace(i,"$1"):n||e)}),t}var o=n(212),s=n(15),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,i=/\\(\\)?/g;e.exports=r},function(e,t,n){function r(e){return o(e)&&i.call(e)==s}var o=n(16),s="[object Function]",a=Object.prototype,i=a.toString;e.exports=r},function(e,t,n){var r=n(195),o=n(199),s=n(85),a=n(43),i=n(48),l=n(95),u=n(96),p=n(84),d=p(function(e,t){if(null==e)return{};if("function"!=typeof t[0]){var t=r(s(t),String);return l(e,o(i(e),t))}var n=a(t[0],t[1],3);return u(e,function(e,t,r){return!n(e,t,r)})});e.exports=d},function(e,t){function n(e){return e}e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(1),s=r(o),a=n(10),i=r(a),l=n(106),u=r(l),p=n(31),d=r(p),f=n(104),c=r(f),h=s["default"].createClass({displayName:"Portal",propTypes:{container:s["default"].PropTypes.oneOfType([u["default"],s["default"].PropTypes.func])},componentDidMount:function(){this._renderOverlay()},componentDidUpdate:function(){this._renderOverlay()},componentWillUnmount:function(){this._unrenderOverlay(),this._unmountOverlayTarget()},_mountOverlayTarget:function(){this._overlayTarget||(this._overlayTarget=document.createElement("div"),this.getContainerDOMNode().appendChild(this._overlayTarget))},_unmountOverlayTarget:function(){this._overlayTarget&&(this.getContainerDOMNode().removeChild(this._overlayTarget),this._overlayTarget=null)},_renderOverlay:function(){var e=this.props.children?s["default"].Children.only(this.props.children):null;null!==e?(this._mountOverlayTarget(),this._overlayInstance=i["default"].unstable_renderSubtreeIntoContainer(this,e,this._overlayTarget)):(this._unrenderOverlay(),this._unmountOverlayTarget())},_unrenderOverlay:function(){this._overlayTarget&&(i["default"].unmountComponentAtNode(this._overlayTarget),this._overlayInstance=null)},render:function(){return null},getMountNode:function(){return this._overlayTarget},getOverlayDOMNode:function(){if(!this.isMounted())throw new Error("getOverlayDOMNode(): A component must be mounted to have a DOM node.");return this._overlayInstance?this._overlayInstance.getWrappedDOMNode?this._overlayInstance.getWrappedDOMNode():i["default"].findDOMNode(this._overlayInstance):null},getContainerDOMNode:function(){return c["default"](this.props.container,d["default"](this).body)}});t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}function a(){var e=y+"_"+g++;return{id:e,suppressRootClose:function(t){t.nativeEvent[e]=!0}}}t.__esModule=!0;var i=n(1),l=r(i),u=n(10),p=r(u),d=n(232),f=r(d),c=n(233),h=r(c),m=n(31),v=r(m),y="__click_was_inside",g=0,b=function(e){function t(n){o(this,t),e.call(this,n),this.handleDocumentClick=this.handleDocumentClick.bind(this),this.handleDocumentKeyUp=this.handleDocumentKeyUp.bind(this);var r=a(),s=r.id,i=r.suppressRootClose;this._suppressRootId=s,this._suppressRootCloseHandler=i}return s(t,e),t.prototype.bindRootCloseHandlers=function(){var e=v["default"](this);this._onDocumentClickListener=f["default"](e,"click",this.handleDocumentClick),this._onDocumentKeyupListener=f["default"](e,"keyup",this.handleDocumentKeyUp)},t.prototype.handleDocumentClick=function(e){e[this._suppressRootId]||this.props.onRootClose()},t.prototype.handleDocumentKeyUp=function(e){27===e.keyCode&&this.props.onRootClose()},t.prototype.unbindRootCloseHandlers=function(){this._onDocumentClickListener&&this._onDocumentClickListener.remove(),this._onDocumentKeyupListener&&this._onDocumentKeyupListener.remove()},t.prototype.componentDidMount=function(){this.bindRootCloseHandlers()},t.prototype.render=function(){var e=this.props,t=e.noWrap,n=e.children,r=l["default"].Children.only(n);return t?l["default"].cloneElement(r,{onClick:h["default"](this._suppressRootCloseHandler,r.props.onClick)}):l["default"].createElement("div",{onClick:this._suppressRootCloseHandler},r)},t.prototype.getWrappedDOMNode=function(){var e=p["default"].findDOMNode(this);return this.props.noWrap?e:e.firstChild},t.prototype.componentWillUnmount=function(){this.unbindRootCloseHandlers()},t}(l["default"].Component);t["default"]=b,b.displayName="RootCloseWrapper",b.propTypes={onRootClose:l["default"].PropTypes.func.isRequired,noWrap:l["default"].PropTypes.bool},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}function i(){}t.__esModule=!0;var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(1),p=r(u),d=n(10),f=r(d),c=n(186),h=r(c),m=n(81),v=r(m),y=n(4),g=r(y),b=h["default"].end,T=0;t.UNMOUNTED=T;var P=1;t.EXITED=P;var x=2;t.ENTERING=x;var E=3;t.ENTERED=E;var C=4;t.EXITING=C;var _=function(e){function t(n,r){s(this,t),e.call(this,n,r);var o=void 0;o=n["in"]?n.transitionAppear?P:E:n.unmountOnExit?T:P,this.state={status:o},this.nextCallback=null}return a(t,e),t.prototype.componentDidMount=function(){this.props.transitionAppear&&this.props["in"]&&this.performEnter(this.props)},t.prototype.componentWillReceiveProps=function(e){var t=this.state.status;e["in"]?t===C?this.performEnter(e):this.props.unmountOnExit?t===T&&this.setState({status:P}):t===P&&this.performEnter(e):(t===x||t===E)&&this.performExit(e)},t.prototype.componentDidUpdate=function(){this.props.unmountOnExit&&this.state.status===P&&(this.props["in"]?this.performEnter(this.props):this.setState({status:T}))},t.prototype.componentWillUnmount=function(){this.cancelNextCallback()},t.prototype.performEnter=function(e){var t=this;this.cancelNextCallback();var n=f["default"].findDOMNode(this);e.onEnter(n),this.safeSetState({status:x},function(){t.props.onEntering(n),t.onTransitionEnd(n,function(){t.safeSetState({status:E},function(){t.props.onEntered(n)})})})},t.prototype.performExit=function(e){var t=this;this.cancelNextCallback();var n=f["default"].findDOMNode(this);e.onExit(n),this.safeSetState({status:C},function(){t.props.onExiting(n),t.onTransitionEnd(n,function(){t.safeSetState({status:P},function(){t.props.onExited(n)})})})},t.prototype.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},t.prototype.safeSetState=function(e,t){this.setState(e,this.setNextCallback(t))},t.prototype.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},t.prototype.onTransitionEnd=function(e,t){this.setNextCallback(t),e?(v["default"](e,b,this.nextCallback),setTimeout(this.nextCallback,this.props.timeout)):setTimeout(this.nextCallback,0)},t.prototype.render=function(){var e=this.state.status;if(e===T)return null;var n=this.props,r=n.children,s=n.className,a=o(n,["children","className"]);Object.keys(t.propTypes).forEach(function(e){return delete a[e]});var i=void 0;e===P?i=this.props.exitedClassName:e===x?i=this.props.enteringClassName:e===E?i=this.props.enteredClassName:e===C&&(i=this.props.exitingClassName);var u=p["default"].Children.only(r);return p["default"].cloneElement(u,l({},a,{className:g["default"](u.props.className,s,i)}))},t}(p["default"].Component);_.propTypes={"in":p["default"].PropTypes.bool,unmountOnExit:p["default"].PropTypes.bool,transitionAppear:p["default"].PropTypes.bool,timeout:p["default"].PropTypes.number,exitedClassName:p["default"].PropTypes.string,exitingClassName:p["default"].PropTypes.string,enteredClassName:p["default"].PropTypes.string,enteringClassName:p["default"].PropTypes.string,onEnter:p["default"].PropTypes.func,onEntering:p["default"].PropTypes.func,onEntered:p["default"].PropTypes.func,onExit:p["default"].PropTypes.func,onExiting:p["default"].PropTypes.func,onExited:p["default"].PropTypes.func},_.displayName="Transition",_.defaultProps={"in":!1,unmountOnExit:!1,transitionAppear:!1,timeout:5e3,onEnter:i,onEntering:i,onEntered:i,onExit:i,onExiting:i,onExited:i},t["default"]=_},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){return e="function"==typeof e?e():e,a["default"].findDOMNode(e)||t}t.__esModule=!0,t["default"]=o;var s=n(10),a=r(s);e.exports=t["default"]},function(e,t){"use strict";function n(e,t,n,r){return"Invalid prop '"+t+"' of value '"+e[t]+"'"+(" supplied to '"+n+"'"+r)}function r(e){function t(t,n,r,o){return o=o||"<<anonymous>>",null!=n[r]?e(n,r,o):t?new Error("Required prop '"+r+"' was not specified in '"+o+"'."):void 0}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}t.__esModule=!0,t.errMsg=n,t.createChainableTypeChecker=r},function(e,t,n){"use strict";function r(e,t,n){return"object"!=typeof e[t]||"function"!=typeof e[t].render&&1!==e[t].nodeType?new Error(o.errMsg(e,t,n,", expected a DOM element or an object that has a `render` method")):void 0}t.__esModule=!0;var o=n(105);t["default"]=o.createChainableTypeChecker(r),e.exports=t["default"]},function(e,t){"use strict";function n(){function e(e,t,r){var o=n.map(function(t){return e[t]}).reduce(function(e,t){return e+(void 0!==t?1:0)},0);if(o>1){var s=n[0],a=n.slice(1),i=a.join(", ")+" and "+s;return new Error("Invalid prop '"+t+"', only one of the following may be provided: "+i)}}for(var t=arguments.length,n=Array(t),r=0;t>r;r++)n[r]=arguments[r];return e}t.__esModule=!0,t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(72),l=o(i),u=a["default"].createClass({displayName:"Accordion",render:function(){return a["default"].createElement(l["default"],r({},this.props,{accordion:!0}),this.props.children)}});t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(54),p=o(u),d=a["default"].createClass({displayName:"Affix",mixins:[p["default"]],render:function(){var e=r({top:this.state.affixPositionTop},this.props.style);return a["default"].createElement("div",r({},this.props,{className:l["default"](this.props.className,this.state.affixClass),style:e}),this.props.children)}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=a["default"].createClass({displayName:"Alert",mixins:[p["default"]],propTypes:{onDismiss:a["default"].PropTypes.func,dismissAfter:a["default"].PropTypes.number,closeLabel:a["default"].PropTypes.string},getDefaultProps:function(){return{bsClass:"alert",bsStyle:"info",closeLabel:"Close Alert"}},renderDismissButton:function(){return a["default"].createElement("button",{type:"button",className:"close",onClick:this.props.onDismiss,"aria-hidden":"true"},a["default"].createElement("span",null,"×"))},renderSrOnlyDismissButton:function(){return a["default"].createElement("button",{type:"button",className:"close sr-only",onClick:this.props.onDismiss},this.props.closeLabel)},render:function(){var e=this.getBsClassSet(),t=!!this.props.onDismiss;return e["alert-dismissable"]=t,a["default"].createElement("div",r({},this.props,{role:"alert",className:l["default"](this.props.className,e)}),t?this.renderDismissButton():null,this.props.children,t?this.renderSrOnlyDismissButton():null)},componentDidMount:function(){this.props.dismissAfter&&this.props.onDismiss&&(this.dismissTimer=setTimeout(this.props.onDismiss,this.props.dismissAfter))},componentWillUnmount:function(){clearTimeout(this.dismissTimer)}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(9),l=o(i),u=n(4),p=o(u),d=a["default"].createClass({displayName:"Badge",propTypes:{pullRight:a["default"].PropTypes.bool},getDefaultProps:function(){return{pullRight:!1}},hasContent:function(){return l["default"].hasValidComponent(this.props.children)||a["default"].Children.count(this.props.children)>1||"string"==typeof this.props.children||"number"==typeof this.props.children},render:function(){var e={"pull-right":this.props.pullRight,badge:this.hasContent()};return a["default"].createElement("span",r({},this.props,{className:p["default"](this.props.className,e)}),this.props.children)}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(8)["default"],o=n(3)["default"],s=n(2)["default"];t.__esModule=!0;var a=n(1),i=s(a),l=n(4),u=s(l),p=n(9),d=s(p),f=i["default"].createClass({displayName:"Breadcrumb",propTypes:{bsClass:i["default"].PropTypes.string},getDefaultProps:function(){return{bsClass:"breadcrumb"}},render:function(){var e=this.props,t=e.className,n=r(e,["className"]);return i["default"].createElement("ol",o({},n,{role:"navigation","aria-label":"breadcrumbs",className:u["default"](t,this.props.bsClass)}),d["default"].map(this.props.children,this.renderBreadcrumbItem))},renderBreadcrumbItem:function(e,t){return a.cloneElement(e,{key:e.key?e.key:t})}});t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(8)["default"],o=n(3)["default"],s=n(2)["default"];t.__esModule=!0;var a=n(4),i=s(a),l=n(1),u=s(l),p=n(23),d=s(p),f=n(14),c=s(f),h=u["default"].createClass({displayName:"BreadcrumbItem",propTypes:{active:u["default"].PropTypes.bool,id:u["default"].PropTypes.oneOfType([u["default"].PropTypes.string,u["default"].PropTypes.number]),linkId:u["default"].PropTypes.oneOfType([u["default"].PropTypes.string,u["default"].PropTypes.number]),href:u["default"].PropTypes.string,title:u["default"].PropTypes.node,target:u["default"].PropTypes.string},getDefaultProps:function(){return{active:!1}},render:function(){var e=this.props,t=e.active,n=e.className,s=e.id,a=e.linkId,l=e.children,p=e.href,f=e.title,h=e.target,m=r(e,["active","className","id","linkId","children","href","title","target"]);d["default"](!(p&&t),"[react-bootstrap] `href` and `active` properties cannot be set at the same time");var v={href:p,title:f,target:h,id:a};return u["default"].createElement("li",{id:s,className:i["default"](n,{active:t})},t?u["default"].createElement("span",m,l):u["default"].createElement(c["default"],o({},m,v),l))}});t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=a["default"].createClass({displayName:"ButtonToolbar",mixins:[p["default"]],getDefaultProps:function(){return{bsClass:"button-toolbar"}},render:function(){var e=this.getBsClassSet();return a["default"].createElement("div",r({},this.props,{role:"toolbar",className:l["default"](this.props.className,e)}),this.props.children)}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=n(9),f=o(d),c=n(33),h=o(c),m=a["default"].createClass({displayName:"Carousel",mixins:[p["default"]],propTypes:{slide:a["default"].PropTypes.bool,indicators:a["default"].PropTypes.bool,interval:a["default"].PropTypes.number,controls:a["default"].PropTypes.bool,pauseOnHover:a["default"].PropTypes.bool,wrap:a["default"].PropTypes.bool,onSelect:a["default"].PropTypes.func,onSlideEnd:a["default"].PropTypes.func,activeIndex:a["default"].PropTypes.number,defaultActiveIndex:a["default"].PropTypes.number,direction:a["default"].PropTypes.oneOf(["prev","next"]),prevIcon:a["default"].PropTypes.node,nextIcon:a["default"].PropTypes.node},getDefaultProps:function(){return{slide:!0,interval:5e3,pauseOnHover:!0,wrap:!0,indicators:!0,controls:!0,prevIcon:a["default"].createElement(h["default"],{glyph:"chevron-left"}),nextIcon:a["default"].createElement(h["default"],{glyph:"chevron-right"})}},getInitialState:function(){return{activeIndex:null==this.props.defaultActiveIndex?0:this.props.defaultActiveIndex,previousActiveIndex:null,direction:null}},getDirection:function(e,t){return e===t?null:e>t?"prev":"next"},componentWillReceiveProps:function(e){var t=this.getActiveIndex();null!=e.activeIndex&&e.activeIndex!==t&&(clearTimeout(this.timeout),this.setState({previousActiveIndex:t,direction:null!=e.direction?e.direction:this.getDirection(t,e.activeIndex)}))},componentDidMount:function(){this.waitForNext()},componentWillUnmount:function(){clearTimeout(this.timeout)},next:function(e){e&&e.preventDefault();var t=this.getActiveIndex()+1,n=f["default"].numberOf(this.props.children);if(t>n-1){if(!this.props.wrap)return;t=0}this.handleSelect(t,"next")},prev:function(e){e&&e.preventDefault();var t=this.getActiveIndex()-1;if(0>t){if(!this.props.wrap)return;t=f["default"].numberOf(this.props.children)-1}this.handleSelect(t,"prev")},pause:function(){this.isPaused=!0,clearTimeout(this.timeout)},play:function(){this.isPaused=!1,this.waitForNext()},waitForNext:function(){!this.isPaused&&this.props.slide&&this.props.interval&&null==this.props.activeIndex&&(this.timeout=setTimeout(this.next,this.props.interval))},handleMouseOver:function(){this.props.pauseOnHover&&this.pause()},handleMouseOut:function(){this.isPaused&&this.play()},render:function(){var e={carousel:!0,slide:this.props.slide};return a["default"].createElement("div",r({},this.props,{className:l["default"](this.props.className,e),onMouseOver:this.handleMouseOver,onMouseOut:this.handleMouseOut}),this.props.indicators?this.renderIndicators():null,a["default"].createElement("div",{className:"carousel-inner",ref:"inner"},f["default"].map(this.props.children,this.renderItem)),this.props.controls?this.renderControls():null)},renderPrev:function(){return a["default"].createElement("a",{className:"left carousel-control",href:"#prev",key:0,onClick:this.prev},this.props.prevIcon)},renderNext:function(){return a["default"].createElement("a",{className:"right carousel-control",href:"#next",key:1,onClick:this.next},this.props.nextIcon)},renderControls:function(){if(!this.props.wrap){var e=this.getActiveIndex(),t=f["default"].numberOf(this.props.children);return[0!==e?this.renderPrev():null,e!==t-1?this.renderNext():null]}return[this.renderPrev(),this.renderNext()]},renderIndicator:function(e,t){var n=t===this.getActiveIndex()?"active":null;return a["default"].createElement("li",{key:t,className:n,onClick:this.handleSelect.bind(this,t,null)})},renderIndicators:function(){var e=this,t=[];return f["default"].forEach(this.props.children,function(n,r){t.push(e.renderIndicator(n,r)," ")},this),a["default"].createElement("ol",{className:"carousel-indicators"},t)},getActiveIndex:function(){return null!=this.props.activeIndex?this.props.activeIndex:this.state.activeIndex},handleItemAnimateOutEnd:function(){var e=this;this.setState({previousActiveIndex:null,direction:null},function(){e.waitForNext(),e.props.onSlideEnd&&e.props.onSlideEnd()})},renderItem:function(e,t){var n=this.getActiveIndex(),r=t===n,o=null!=this.state.previousActiveIndex&&this.state.previousActiveIndex===t&&this.props.slide;return s.cloneElement(e,{active:r,ref:e.ref,key:e.key?e.key:t,index:t,animateOut:o,animateIn:r&&null!=this.state.previousActiveIndex&&this.props.slide,direction:this.state.direction,onAnimateOutEnd:o?this.handleItemAnimateOutEnd:null})},handleSelect:function(e,t){if(clearTimeout(this.timeout),this.isMounted()){var n=this.getActiveIndex();if(t=t||this.getDirection(n,e),this.props.onSelect&&this.props.onSelect(e,t),null==this.props.activeIndex&&e!==n){if(null!=this.state.previousActiveIndex)return;this.setState({activeIndex:e,previousActiveIndex:n,direction:t})}}}});t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(4),a=o(s),i=n(1),l=o(i),u=n(10),p=o(u),d=n(74),f=o(d),c=l["default"].createClass({displayName:"CarouselItem",propTypes:{direction:l["default"].PropTypes.oneOf(["prev","next"]),onAnimateOutEnd:l["default"].PropTypes.func,active:l["default"].PropTypes.bool,animateIn:l["default"].PropTypes.bool,animateOut:l["default"].PropTypes.bool,caption:l["default"].PropTypes.node,index:l["default"].PropTypes.number},getInitialState:function(){return{direction:null}},getDefaultProps:function(){return{active:!1,animateIn:!1,animateOut:!1}},handleAnimateOutEnd:function(){this.props.onAnimateOutEnd&&this.isMounted()&&this.props.onAnimateOutEnd(this.props.index)},componentWillReceiveProps:function(e){this.props.active!==e.active&&this.setState({direction:null})},componentDidUpdate:function(e){!this.props.active&&e.active&&f["default"].addEndEventListener(p["default"].findDOMNode(this),this.handleAnimateOutEnd),this.props.active!==e.active&&setTimeout(this.startAnimation,20)},startAnimation:function(){this.isMounted()&&this.setState({direction:"prev"===this.props.direction?"right":"left"})},render:function(){var e={item:!0,active:this.props.active&&!this.props.animateIn||this.props.animateOut,next:this.props.active&&this.props.animateIn&&"next"===this.props.direction,prev:this.props.active&&this.props.animateIn&&"prev"===this.props.direction};return this.state.direction&&(this.props.animateIn||this.props.animateOut)&&(e[this.state.direction]=!0),l["default"].createElement("div",r({},this.props,{className:a["default"](this.props.className,e)}),this.props.children,this.props.caption?this.renderCaption():null)},renderCaption:function(){return l["default"].createElement("div",{className:"carousel-caption"},this.props.caption)}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(2)["default"];t.__esModule=!0;var o=n(1),s=r(o),a=n(7),i=r(a),l=n(25),u=r(l),p=n(4),d=r(p),f=n(9),c=r(f),h=n(11),m=r(h),v=s["default"].createClass({displayName:"CollapsibleNav",mixins:[i["default"]],propTypes:{onSelect:s["default"].PropTypes.func,activeHref:s["default"].PropTypes.string,activeKey:s["default"].PropTypes.any,collapsible:s["default"].PropTypes.bool,expanded:s["default"].PropTypes.bool,eventKey:s["default"].PropTypes.any},getDefaultProps:function(){return{collapsible:!1,expanded:!1}},render:function(){var e=this.props.collapsible?"navbar-collapse":null,t=this.props.collapsible?this.renderCollapsibleNavChildren:this.renderChildren,n=s["default"].createElement("div",{eventKey:this.props.eventKey,className:d["default"](this.props.className,e)},c["default"].map(this.props.children,t));return this.props.collapsible?s["default"].createElement(u["default"],{"in":this.props.expanded},n):n},getChildActiveProp:function(e){return e.props.active?!0:null!=this.props.activeKey&&e.props.eventKey===this.props.activeKey?!0:null!=this.props.activeHref&&e.props.href===this.props.activeHref?!0:e.props.active},renderChildren:function(e,t){var n=e.key?e.key:t;return o.cloneElement(e,{activeKey:this.props.activeKey,activeHref:this.props.activeHref,ref:"nocollapse_"+n,key:n,navItem:!0})},renderCollapsibleNavChildren:function(e,t){var n=e.key?e.key:t;return o.cloneElement(e,{active:this.getChildActiveProp(e),activeKey:this.props.activeKey,activeHref:this.props.activeHref,onSelect:m["default"](e.props.onSelect,this.props.onSelect),ref:"collapsible_"+n,key:n,navItem:!0})}});t["default"]=v,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(8)["default"],i=n(2)["default"];t.__esModule=!0;var l=n(1),u=i(l),p=n(7),d=i(p),f=n(26),c=i(f),h=n(99),m=i(h),v=function(e){function t(n){o(this,t),e.call(this,n)}return r(t,e),t.prototype.render=function(){var e=this.props,t=e.title,n=a(e,["title"]),r=m["default"](n,c["default"].ControlledComponent.propTypes);return u["default"].createElement(c["default"],n,u["default"].createElement(c["default"].Toggle,r,t),u["default"].createElement(c["default"].Menu,null,this.props.children))},t}(u["default"].Component);v.propTypes=s({noCaret:u["default"].PropTypes.bool,title:u["default"].PropTypes.node.isRequired},c["default"].propTypes,d["default"].propTypes),v.defaultProps={pullRight:!1,dropup:!1,navItem:!1,noCaret:!1},t["default"]=v,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(8)["default"],a=n(3)["default"],i=n(2)["default"];t.__esModule=!0;var l=n(4),u=i(l),p=n(42),d=i(p),f=n(1),c=i(f),h=n(10),m=i(h),v=n(102),y=i(v),g=n(9),b=i(g),T=n(11),P=i(T),x=function(e){function t(n){o(this,t),e.call(this,n),this.focusNext=this.focusNext.bind(this),this.focusPrevious=this.focusPrevious.bind(this),this.getFocusableMenuItems=this.getFocusableMenuItems.bind(this),this.getItemsAndActiveIndex=this.getItemsAndActiveIndex.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}return r(t,e),t.prototype.handleKeyDown=function(e){switch(e.keyCode){case d["default"].codes.down:this.focusNext(),e.preventDefault();break;case d["default"].codes.up:this.focusPrevious(),e.preventDefault();break;case d["default"].codes.esc:case d["default"].codes.tab:this.props.onClose(e)}},t.prototype.focusNext=function(){var e=this.getItemsAndActiveIndex(),t=e.items,n=e.activeItemIndex;return 0!==t.length?n===t.length-1?void t[0].focus():void t[n+1].focus():void 0},t.prototype.focusPrevious=function(){var e=this.getItemsAndActiveIndex(),t=e.items,n=e.activeItemIndex;return 0===n?void t[t.length-1].focus():void t[n-1].focus()},t.prototype.getItemsAndActiveIndex=function(){var e=this.getFocusableMenuItems(),t=document.activeElement,n=e.indexOf(t);return{items:e,activeItemIndex:n}},t.prototype.getFocusableMenuItems=function(){var e=m["default"].findDOMNode(this);return void 0===e?[]:[].slice.call(e.querySelectorAll('[tabIndex="-1"]'),0)},t.prototype.render=function(){var e=this,t=this.props,n=t.children,r=t.onSelect,o=t.pullRight,i=t.className,l=t.labelledBy,p=t.open,d=t.onClose,f=s(t,["children","onSelect","pullRight","className","labelledBy","open","onClose"]),h=b["default"].map(n,function(t){var n=t.props||{};return c["default"].cloneElement(t,{onKeyDown:P["default"](n.onKeyDown,e.handleKeyDown),onSelect:P["default"](n.onSelect,r)},n.children)}),m={"dropdown-menu":!0,"dropdown-menu-right":o},v=c["default"].createElement("ul",a({className:u["default"](i,m),role:"menu","aria-labelledby":l},f),h);return p&&(v=c["default"].createElement(y["default"],{noWrap:!0,onRootClose:d},v)),v},t}(c["default"].Component);x.defaultProps={bsRole:"menu",pullRight:!1},x.propTypes={open:c["default"].PropTypes.bool,pullRight:c["default"].PropTypes.bool,onClose:c["default"].PropTypes.func,labelledBy:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.number]),onSelect:c["default"].PropTypes.func},t["default"]=x,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(4),p=a(u),d=n(34),f=a(d),c=n(35),h=a(c),m=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.getValue=function(){var e=this.props,t=e.children,n=e.value;return t?t:n},t.prototype.renderInput=function(){return l["default"].createElement("p",s({},this.props,{className:p["default"](this.props.className,"form-control-static"),ref:"input",key:"input"}),this.getValue())},t}(f["default"]);m.propTypes={value:h["default"],children:h["default"]},t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=a["default"].createClass({displayName:"Image",propTypes:{responsive:a["default"].PropTypes.bool,rounded:a["default"].PropTypes.bool,circle:a["default"].PropTypes.bool,thumbnail:a["default"].PropTypes.bool},getDefaultProps:function(){return{responsive:!1,rounded:!1,circle:!1,thumbnail:!1}},render:function(){var e={"img-responsive":this.props.responsive,"img-rounded":this.props.rounded,"img-circle":this.props.circle,"img-thumbnail":this.props.thumbnail};return a["default"].createElement("img",r({},this.props,{className:l["default"](this.props.className,e)}))}});t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(2)["default"],a=n(76)["default"];t.__esModule=!0;var i=n(1),l=s(i),u=n(34),p=s(u),d=n(59),f=a(d),c=n(154),h=s(c),m=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){return"static"===this.props.type?(h["default"]("Input type=static","FormControls.Static"),l["default"].createElement(f.Static,this.props)):e.prototype.render.call(this)},t}(p["default"]);m.propTypes={type:l["default"].PropTypes.string},t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(12),p=o(u),d=a["default"].createClass({displayName:"Jumbotron",propTypes:{componentClass:p["default"]},getDefaultProps:function(){return{componentClass:"div"}},render:function(){var e=this.props.componentClass;return a["default"].createElement(e,r({},this.props,{className:l["default"](this.props.className,"jumbotron")}),this.props.children)}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=a["default"].createClass({displayName:"Label",mixins:[p["default"]],getDefaultProps:function(){return{bsClass:"label",bsStyle:"default"}},render:function(){var e=this.getBsClassSet();return a["default"].createElement("span",r({},this.props,{className:l["default"](this.props.className,e)}),this.props.children)}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(63),p=a(u),d=n(4),f=a(d),c=n(9),h=a(c),m=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){var e=this,t=h["default"].map(this.props.children,function(e,t){return i.cloneElement(e,{key:e.key?e.key:t})});if(this.areCustomChildren(t)){var n=this.props.componentClass;return l["default"].createElement(n,s({},this.props,{className:f["default"](this.props.className,"list-group")}),t)}var r=!1;return this.props.children?h["default"].forEach(this.props.children,function(t){e.isAnchorOrButton(t.props)&&(r=!0)}):r=!0,r?this.renderDiv(t):this.renderUL(t)},t.prototype.isAnchorOrButton=function(e){return e.href||e.onClick},t.prototype.areCustomChildren=function(e){var t=!1;return h["default"].forEach(e,function(e){e.type!==p["default"]&&(t=!0)},this),t},t.prototype.renderUL=function(e){var t=h["default"].map(e,function(e){return i.cloneElement(e,{listItem:!0})});return l["default"].createElement("ul",s({},this.props,{className:f["default"](this.props.className,"list-group")}),t)},t.prototype.renderDiv=function(e){return l["default"].createElement("div",s({},this.props,{className:f["default"](this.props.className,"list-group")}),e)},t}(l["default"].Component);m.defaultProps={componentClass:"div"},m.propTypes={className:l["default"].PropTypes.string,componentClass:l["default"].PropTypes.oneOf(["ul","div"]),id:l["default"].PropTypes.oneOfType([l["default"].PropTypes.string,l["default"].PropTypes.number])},
t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(2)["default"];t.__esModule=!0;var a=n(1),i=s(a),l=n(4),u=s(l),p=n(50),d=s(p),f=n(14),c=s(f),h=function(e){function t(n){o(this,t),e.call(this,n),this.handleClick=this.handleClick.bind(this)}return r(t,e),t.prototype.handleClick=function(e){(!this.props.href||this.props.disabled)&&e.preventDefault(),this.props.disabled||this.props.onSelect&&this.props.onSelect(e,this.props.eventKey)},t.prototype.render=function(){if(this.props.divider)return i["default"].createElement("li",{role:"separator",className:"divider"});if(this.props.header)return i["default"].createElement("li",{role:"heading",className:"dropdown-header"},this.props.children);var e={disabled:this.props.disabled,active:this.props.active};return i["default"].createElement("li",{role:"presentation",className:u["default"](this.props.className,e),style:this.props.style},i["default"].createElement(c["default"],{role:"menuitem",tabIndex:"-1",id:this.props.id,target:this.props.target,title:this.props.title,href:this.props.href||"",onKeyDown:this.props.onKeyDown,onClick:this.handleClick},this.props.children))},t}(i["default"].Component);t["default"]=h,h.propTypes={active:i["default"].PropTypes.bool,disabled:i["default"].PropTypes.bool,divider:d["default"](i["default"].PropTypes.bool,function(e){return e.divider&&e.children?new Error("Children will not be rendered for dividers"):void 0}),eventKey:i["default"].PropTypes.oneOfType([i["default"].PropTypes.number,i["default"].PropTypes.string]),header:i["default"].PropTypes.bool,href:i["default"].PropTypes.string,target:i["default"].PropTypes.string,title:i["default"].PropTypes.string,onKeyDown:i["default"].PropTypes.func,onSelect:i["default"].PropTypes.func,id:i["default"].PropTypes.oneOfType([i["default"].PropTypes.string,i["default"].PropTypes.number])},h.defaultProps={divider:!1,disabled:!1,header:!1},e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){var n=g["default"].ownerDocument(t);return e===n.body||e===n.documentElement?n.documentElement.clientHeight:e.clientHeight}function o(e){return e.props.container&&v["default"].findDOMNode(e.props.container)||g["default"].ownerDocument(e).body}function s(e,t){var n=g["default"].ownerDocument(e),r=!n.addEventListener,o=void 0;return G&&G.remove(),r?(document.attachEvent("onfocusin",t),o=function(){return document.detachEvent("onfocusin",t)}):(document.addEventListener("focus",t,!0),o=function(){return document.removeEventListener("focus",t,!0)}),G={remove:o}}var a=n(3)["default"],i=n(8)["default"],l=n(157)["default"],u=n(28)["default"],p=n(2)["default"];t.__esModule=!0;var d=n(4),f=p(d),c=n(1),h=p(c),m=n(10),v=p(m),y=n(75),g=p(y),b=n(190),T=p(b),P=n(73),x=p(P),E=n(11),C=p(E),_=n(12),N=p(_),O=n(20),w=p(O),S=n(29),k=p(S),M=n(80),D=p(M),I=n(101),A=p(I),R=n(32),j=p(R),K=n(128),L=p(K),B=n(64),F=p(B),H=n(66),W=p(H),U=n(67),V=p(U),q=n(65),z=p(q),G=void 0,Y=h["default"].createClass({displayName:"Modal",propTypes:a({},A["default"].propTypes,L["default"].propTypes,{backdrop:h["default"].PropTypes.oneOf(["static",!0,!1]),keyboard:h["default"].PropTypes.bool,animation:h["default"].PropTypes.bool,dialogComponent:N["default"],autoFocus:h["default"].PropTypes.bool,enforceFocus:h["default"].PropTypes.bool,bsStyle:h["default"].PropTypes.string,show:h["default"].PropTypes.bool}),getDefaultProps:function(){return{bsClass:"modal",dialogComponent:L["default"],show:!1,animation:!0,backdrop:!0,keyboard:!0,autoFocus:!0,enforceFocus:!0}},getInitialState:function(){return{exited:!this.props.show}},render:function(){var e=this.props,t=(e.children,e.animation),n=e.backdrop,r=i(e,["children","animation","backdrop"]),o=r.onExit,s=r.onExiting,l=r.onEnter,u=r.onEntering,p=r.onEntered,d=!!r.show,c=r.dialogComponent,m=d||t&&!this.state.exited;if(!m)return null;var v=h["default"].createElement(c,a({},r,{ref:this._setDialogRef,className:f["default"](this.props.className,{"in":d&&!t}),onClick:n===!0?this.handleBackdropClick:null}),this.renderContent());return t&&(v=h["default"].createElement(j["default"],{transitionAppear:!0,unmountOnExit:!0,"in":d,timeout:Y.TRANSITION_DURATION,onExit:o,onExiting:s,onExited:this.handleHidden,onEnter:l,onEntering:u,onEntered:p},v)),n&&(v=this.renderBackdrop(v)),h["default"].createElement(A["default"],{container:r.container},v)},renderContent:function(){var e=this;return h["default"].Children.map(this.props.children,function(t){return t&&t.type&&t.type.__isModalHeader?c.cloneElement(t,{onHide:C["default"](e.props.onHide,t.props.onHide)}):t})},renderBackdrop:function(e){var t=this.props,n=t.animation,r=t.bsClass,o=Y.BACKDROP_TRANSITION_DURATION,s=this.props.backdrop===!0?this.handleBackdropClick:null,a=h["default"].createElement("div",{ref:"backdrop",className:f["default"](r+"-backdrop",{"in":this.props.show&&!n}),onClick:s});return h["default"].createElement("div",{ref:"modal"},n?h["default"].createElement(j["default"],{transitionAppear:!0,"in":this.props.show,timeout:o},a):a,e)},_setDialogRef:function(e){l(this.refs)&&!u(this.refs).length&&(this.refs={}),this.refs.dialog=e,this.props.backdrop||(this.refs.modal=e)},componentWillReceiveProps:function(e){e.show?this.setState({exited:!1}):e.animation||this.setState({exited:!0})},componentWillUpdate:function(e){e.show&&this.checkForFocus()},componentDidMount:function(){this.props.show&&this.onShow()},componentDidUpdate:function(e){var t=this.props.animation;!e.show||this.props.show||t?!e.show&&this.props.show&&this.onShow():this.onHide()},componentWillUnmount:function(){this.props.show&&this.onHide()},onShow:function(){var e=this,t=g["default"].ownerDocument(this),n=g["default"].ownerWindow(this);this._onDocumentKeyupListener=x["default"].listen(t,"keyup",this.handleDocumentKeyUp),this._onWindowResizeListener=x["default"].listen(n,"resize",this.handleWindowResize),this.props.enforceFocus&&(this._onFocusinListener=s(this,this.enforceFocus));var a=o(this);a.className+=a.className.length?" modal-open":"modal-open",this._containerIsOverflowing=a.scrollHeight>r(a,this),this._originalPadding=a.style.paddingRight,this._containerIsOverflowing&&(a.style.paddingRight=parseInt(this._originalPadding||0,10)+T["default"]()+"px"),this.setState(this._getStyles(),function(){return e.focusModalContent()})},onHide:function(){this._onDocumentKeyupListener.remove(),this._onWindowResizeListener.remove(),this._onFocusinListener&&this._onFocusinListener.remove();var e=o(this);e.style.paddingRight=this._originalPadding,e.className=e.className.replace(/ ?modal-open/,""),this.restoreLastFocus()},handleHidden:function(){if(this.setState({exited:!0}),this.onHide(),this.props.onExited){var e;(e=this.props).onExited.apply(e,arguments)}},handleBackdropClick:function(e){e.target===e.currentTarget&&this.props.onHide()},handleDocumentKeyUp:function(e){this.props.keyboard&&27===e.keyCode&&this.props.onHide()},handleWindowResize:function(){this.setState(this._getStyles())},checkForFocus:function(){w["default"]&&(this.lastFocus=D["default"](document))},focusModalContent:function(){var e=v["default"].findDOMNode(this.refs.dialog),t=D["default"](g["default"].ownerDocument(this)),n=t&&k["default"](e,t);e&&this.props.autoFocus&&!n&&(this.lastFocus=t,e.focus())},restoreLastFocus:function(){this.lastFocus&&this.lastFocus.focus&&(this.lastFocus.focus(),this.lastFocus=null)},enforceFocus:function(){if(this.isMounted()){var e=D["default"](g["default"].ownerDocument(this)),t=v["default"].findDOMNode(this.refs.dialog);t&&t!==e&&!k["default"](t,e)&&t.focus()}},_getStyles:function(){if(!w["default"])return{};var e=v["default"].findDOMNode(this.refs.modal),t=e.scrollHeight,n=o(this),s=this._containerIsOverflowing,a=t>r(n,this);return{dialogStyles:{paddingRight:s&&!a?T["default"]():void 0,paddingLeft:!s&&a?T["default"]():void 0}}}});Y.Body=F["default"],Y.Header=W["default"],Y.Title=V["default"],Y.Footer=z["default"],Y.Dialog=L["default"],Y.TRANSITION_DURATION=300,Y.BACKDROP_TRANSITION_DURATION=150,t["default"]=Y,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=a["default"].createClass({displayName:"ModalDialog",mixins:[p["default"]],propTypes:{onHide:a["default"].PropTypes.func.isRequired,dialogClassName:a["default"].PropTypes.string},getDefaultProps:function(){return{bsClass:"modal",closeButton:!0}},render:function(){var e=r({display:"block"},this.props.style),t=this.props.bsClass,n=this.getBsClassSet();return delete n.modal,n[t+"-dialog"]=!0,a["default"].createElement("div",r({},this.props,{title:null,tabIndex:"-1",role:"dialog",style:e,className:l["default"](this.props.className,t)}),a["default"].createElement("div",{className:l["default"](this.props.dialogClassName,n)},a["default"].createElement("div",{className:t+"-content",role:"document"},this.props.children)))}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(8)["default"],i=n(2)["default"];t.__esModule=!0;var l=n(1),u=i(l),p=n(26),d=i(p),f=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){var e=this.props,t=e.children,n=e.title,r=e.noCaret,o=a(e,["children","title","noCaret"]);return u["default"].createElement(d["default"],s({},o,{componentClass:"li"}),u["default"].createElement(d["default"].Toggle,{useAnchor:!0,disabled:o.disabled,noCaret:r},n),u["default"].createElement(d["default"].Menu,null,t))},t}(u["default"].Component);f.propTypes=s({noCaret:u["default"].PropTypes.bool,title:u["default"].PropTypes.node.isRequired},d["default"].propTypes),t["default"]=f,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(8)["default"],o=n(3)["default"],s=n(2)["default"];t.__esModule=!0;var a=n(4),i=s(a),l=n(1),u=s(l),p=n(52),d=s(p),f=n(12),c=s(f),h=n(7),m=s(h),v=n(61),y=s(v),g=n(69),b=s(g),T=n(11),P=s(T),x=n(9),E=s(x),C=u["default"].createClass({displayName:"Navbar",mixins:[m["default"]],propTypes:{fixedTop:u["default"].PropTypes.bool,fixedBottom:u["default"].PropTypes.bool,staticTop:u["default"].PropTypes.bool,inverse:u["default"].PropTypes.bool,fluid:u["default"].PropTypes.bool,role:u["default"].PropTypes.string,componentClass:c["default"],brand:d["default"](u["default"].PropTypes.node,"Use the `NavBrand` component."),toggleButton:u["default"].PropTypes.node,toggleNavKey:u["default"].PropTypes.oneOfType([u["default"].PropTypes.string,u["default"].PropTypes.number]),onToggle:u["default"].PropTypes.func,navExpanded:u["default"].PropTypes.bool,defaultNavExpanded:u["default"].PropTypes.bool},getDefaultProps:function(){return{bsClass:"navbar",bsStyle:"default",role:"navigation",componentClass:"nav",fixedTop:!1,fixedBottom:!1,staticTop:!1,inverse:!1,fluid:!1,defaultNavExpanded:!1}},getInitialState:function(){return{navExpanded:this.props.defaultNavExpanded}},shouldComponentUpdate:function(){return!this._isChanging},handleToggle:function(){this.props.onToggle&&(this._isChanging=!0,this.props.onToggle(),this._isChanging=!1),this.setState({navExpanded:!this.state.navExpanded})},isNavExpanded:function(){return null!=this.props.navExpanded?this.props.navExpanded:this.state.navExpanded},hasNavBrandChild:function(){return E["default"].findValidComponents(this.props.children,function(e){return"brand"===e.props.bsRole}).length>0},render:function(){var e=this.props,t=e.brand,n=e.toggleButton,s=e.toggleNavKey,a=e.fixedTop,l=e.fixedBottom,p=e.staticTop,d=e.inverse,f=e.componentClass,c=e.fluid,h=e.className,m=e.children,v=r(e,["brand","toggleButton","toggleNavKey","fixedTop","fixedBottom","staticTop","inverse","componentClass","fluid","className","children"]),g=this.getBsClassSet();g["navbar-fixed-top"]=a,g["navbar-fixed-bottom"]=l,g["navbar-static-top"]=p,g["navbar-inverse"]=d;var b=(t||n||null!=s)&&!this.hasNavBrandChild();return u["default"].createElement(f,o({},v,{className:i["default"](h,g)}),u["default"].createElement(y["default"],{fluid:c},b?this.renderBrandHeader():null,E["default"].map(m,this.renderChild)))},renderBrandHeader:function(){var e=this.props.brand;return e&&(e=u["default"].createElement(b["default"],null,e)),this.renderHeader(e)},renderHeader:function(e){var t=this.props.toggleButton||null!=this.props.toggleNavKey;return u["default"].createElement("div",{className:"navbar-header"},e,t?this.renderToggleButton():null)},renderChild:function(e,t){var n=null!=e.key?e.key:t;if("brand"===e.props.bsRole)return u["default"].cloneElement(this.renderHeader(e),{key:n});var r=this.props.toggleNavKey,o=null!=r&&r===e.props.eventKey;return u["default"].cloneElement(e,{navbar:!0,collapsible:o,expanded:o&&this.isNavExpanded(),key:n})},renderToggleButton:function(){var e=this.props.toggleButton;if(u["default"].isValidElement(e))return u["default"].cloneElement(e,{className:i["default"](e.props.className,"navbar-toggle"),onClick:P["default"](this.handleToggle,e.props.onClick)});var t=void 0;return t=null!=e?e:[u["default"].createElement("span",{className:"sr-only",key:0},"Toggle navigation"),u["default"].createElement("span",{className:"icon-bar",key:1}),u["default"].createElement("span",{className:"icon-bar",key:2}),u["default"].createElement("span",{className:"icon-bar",key:3})],u["default"].createElement("button",{type:"button",onClick:this.handleToggle,className:"navbar-toggle"},t)}});t["default"]=C,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t){return Array.isArray(t)?t.indexOf(e)>=0:e===t}var o=n(3)["default"],s=n(28)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(29),l=a(i),u=n(228),p=a(u),d=n(1),f=a(d),c=n(10),h=a(c),m=n(23),v=a(m),y=n(71),g=a(y),b=n(11),T=a(b),P=f["default"].createClass({displayName:"OverlayTrigger",propTypes:o({},g["default"].propTypes,{trigger:f["default"].PropTypes.oneOfType([f["default"].PropTypes.oneOf(["click","hover","focus"]),f["default"].PropTypes.arrayOf(f["default"].PropTypes.oneOf(["click","hover","focus"]))]),delay:f["default"].PropTypes.number,delayShow:f["default"].PropTypes.number,delayHide:f["default"].PropTypes.number,defaultOverlayShown:f["default"].PropTypes.bool,overlay:f["default"].PropTypes.node.isRequired,onBlur:f["default"].PropTypes.func,onClick:f["default"].PropTypes.func,onFocus:f["default"].PropTypes.func,onMouseEnter:f["default"].PropTypes.func,onMouseLeave:f["default"].PropTypes.func,target:function(){},onHide:function(){},show:function(){}}),getDefaultProps:function(){return{defaultOverlayShown:!1,trigger:["hover","focus"]}},getInitialState:function(){return{isOverlayShown:this.props.defaultOverlayShown}},show:function(){this.setState({isOverlayShown:!0})},hide:function(){this.setState({isOverlayShown:!1})},toggle:function(){this.state.isOverlayShown?this.hide():this.show()},componentWillMount:function(){this.handleMouseOver=this.handleMouseOverOut.bind(null,this.handleDelayedShow),this.handleMouseOut=this.handleMouseOverOut.bind(null,this.handleDelayedHide)},componentDidMount:function(){this._mountNode=document.createElement("div"),this.renderOverlay()},renderOverlay:function(){h["default"].unstable_renderSubtreeIntoContainer(this,this._overlay,this._mountNode)},componentWillUnmount:function(){h["default"].unmountComponentAtNode(this._mountNode),this._mountNode=null,clearTimeout(this._hoverDelay)},componentDidUpdate:function(){this._mountNode&&this.renderOverlay()},getOverlayTarget:function(){return h["default"].findDOMNode(this)},getOverlay:function(){var e=o({},p["default"](this.props,s(g["default"].propTypes)),{show:this.state.isOverlayShown,onHide:this.hide,target:this.getOverlayTarget,onExit:this.props.onExit,onExiting:this.props.onExiting,onExited:this.props.onExited,onEnter:this.props.onEnter,onEntering:this.props.onEntering,onEntered:this.props.onEntered}),t=d.cloneElement(this.props.overlay,{placement:e.placement,container:e.container});return f["default"].createElement(g["default"],e,t)},render:function(){var e=f["default"].Children.only(this.props.children),t=e.props,n={"aria-describedby":this.props.overlay.props.id};return this._overlay=this.getOverlay(),n.onClick=T["default"](t.onClick,this.props.onClick),r("click",this.props.trigger)&&(n.onClick=T["default"](this.toggle,n.onClick)),r("hover",this.props.trigger)&&(v["default"](!("hover"===this.props.trigger),'[react-bootstrap] Specifying only the `"hover"` trigger limits the visibilty of the overlay to just mouse users. Consider also including the `"focus"` trigger so that touch and keyboard only users can see the overlay as well.'),n.onMouseOver=T["default"](this.handleMouseOver,this.props.onMouseOver,t.onMouseOver),n.onMouseOut=T["default"](this.handleMouseOut,this.props.onMouseOut,t.onMouseOut)),r("focus",this.props.trigger)&&(n.onFocus=T["default"](this.handleDelayedShow,this.props.onFocus,t.onFocus),n.onBlur=T["default"](this.handleDelayedHide,this.props.onBlur,t.onBlur)),d.cloneElement(e,n)},handleDelayedShow:function(){var e=this;if(null!=this._hoverDelay)return clearTimeout(this._hoverDelay),void(this._hoverDelay=null);var t=null!=this.props.delayShow?this.props.delayShow:this.props.delay;return t?void(this._hoverDelay=setTimeout(function(){e._hoverDelay=null,e.show()},t)):void this.show()},handleDelayedHide:function(){var e=this;if(null!=this._hoverDelay)return clearTimeout(this._hoverDelay),void(this._hoverDelay=null);var t=null!=this.props.delayHide?this.props.delayHide:this.props.delay;return t?void(this._hoverDelay=setTimeout(function(){e._hoverDelay=null,e.hide()},t)):void this.hide()},handleMouseOverOut:function(e,t){var n=t.currentTarget,r=t.relatedTarget||t.nativeEvent.toElement;(!r||r!==n&&!l["default"](n,r))&&e(t)}});t["default"]=P,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=a["default"].createClass({displayName:"PageHeader",render:function(){return a["default"].createElement("div",r({},this.props,{className:l["default"](this.props.className,"page-header")}),a["default"].createElement("h1",null,this.props.children))}});t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(14),p=o(u),d=a["default"].createClass({displayName:"PageItem",propTypes:{href:a["default"].PropTypes.string,target:a["default"].PropTypes.string,title:a["default"].PropTypes.string,disabled:a["default"].PropTypes.bool,previous:a["default"].PropTypes.bool,next:a["default"].PropTypes.bool,onSelect:a["default"].PropTypes.func,eventKey:a["default"].PropTypes.any},getDefaultProps:function(){return{disabled:!1,previous:!1,next:!1}},render:function(){var e={disabled:this.props.disabled,previous:this.props.previous,next:this.props.next};return a["default"].createElement("li",r({},this.props,{className:l["default"](this.props.className,e)}),a["default"].createElement(p["default"],{href:this.props.href,title:this.props.title,target:this.props.target,onClick:this.handleSelect},this.props.children))},handleSelect:function(e){(this.props.onSelect||this.props.disabled)&&(e.preventDefault(),this.props.disabled||this.props.onSelect(this.props.eventKey,this.props.href,this.props.target))}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(9),p=o(u),d=n(11),f=o(d),c=a["default"].createClass({displayName:"Pager",propTypes:{onSelect:a["default"].PropTypes.func},render:function(){return a["default"].createElement("ul",r({},this.props,{className:l["default"](this.props.className,"pager")}),p["default"].map(this.props.children,this.renderPageItem))},renderPageItem:function(e,t){return s.cloneElement(e,{onSelect:f["default"](e.props.onSelect,this.props.onSelect),key:e.key?e.key:t})}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=n(136),f=o(d),c=n(12),h=o(c),m=n(14),v=o(m),y=a["default"].createClass({displayName:"Pagination",mixins:[p["default"]],propTypes:{activePage:a["default"].PropTypes.number,items:a["default"].PropTypes.number,maxButtons:a["default"].PropTypes.number,ellipsis:a["default"].PropTypes.bool,first:a["default"].PropTypes.bool,last:a["default"].PropTypes.bool,prev:a["default"].PropTypes.bool,next:a["default"].PropTypes.bool,onSelect:a["default"].PropTypes.func,buttonComponentClass:h["default"]},getDefaultProps:function(){return{activePage:1,items:1,maxButtons:0,first:!1,last:!1,prev:!1,next:!1,ellipsis:!0,buttonComponentClass:v["default"],bsClass:"pagination"}},renderPageButtons:function(){var e=[],t=void 0,n=void 0,r=void 0,o=this.props,s=o.maxButtons,i=o.activePage,l=o.items,u=o.onSelect,p=o.ellipsis,d=o.buttonComponentClass;if(s){var c=i-parseInt(s/2,10);t=c>1?c:1,r=l>=t+s,r?n=t+s-1:(n=l,t=l-s+1,1>t&&(t=1))}else t=1,n=l;for(var h=t;n>=h;h++)e.push(a["default"].createElement(f["default"],{key:h,eventKey:h,active:h===i,onSelect:u,buttonComponentClass:d},h));return s&&r&&p&&e.push(a["default"].createElement(f["default"],{key:"ellipsis",disabled:!0,buttonComponentClass:d},a["default"].createElement("span",{"aria-label":"More"},"..."))),e},renderPrev:function(){return this.props.prev?a["default"].createElement(f["default"],{key:"prev",eventKey:this.props.activePage-1,disabled:1===this.props.activePage,onSelect:this.props.onSelect,buttonComponentClass:this.props.buttonComponentClass},a["default"].createElement("span",{"aria-label":"Previous"},"‹")):null},renderNext:function(){return this.props.next?a["default"].createElement(f["default"],{key:"next",eventKey:this.props.activePage+1,disabled:this.props.activePage>=this.props.items,onSelect:this.props.onSelect,buttonComponentClass:this.props.buttonComponentClass},a["default"].createElement("span",{"aria-label":"Next"},"›")):null},renderFirst:function(){return this.props.first?a["default"].createElement(f["default"],{key:"first",eventKey:1,disabled:1===this.props.activePage,onSelect:this.props.onSelect,buttonComponentClass:this.props.buttonComponentClass},a["default"].createElement("span",{"aria-label":"First"},"«")):null},renderLast:function(){return this.props.last?a["default"].createElement(f["default"],{key:"last",eventKey:this.props.items,disabled:this.props.activePage>=this.props.items,onSelect:this.props.onSelect,buttonComponentClass:this.props.buttonComponentClass},a["default"].createElement("span",{"aria-label":"Last"},"»")):null},render:function(){return a["default"].createElement("ul",r({},this.props,{className:l["default"](this.props.className,this.getBsClassSet())}),this.renderFirst(),this.renderPrev(),this.renderPageButtons(),this.renderNext(),this.renderLast())}});t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(8)["default"],s=n(2)["default"];t.__esModule=!0;var a=n(1),i=s(a),l=n(4),u=s(l),p=n(7),d=s(p),f=n(153),c=s(f),h=n(12),m=s(h),v=i["default"].createClass({displayName:"PaginationButton",mixins:[d["default"]],propTypes:{className:i["default"].PropTypes.string,eventKey:i["default"].PropTypes.oneOfType([i["default"].PropTypes.string,i["default"].PropTypes.number]),onSelect:i["default"].PropTypes.func,disabled:i["default"].PropTypes.bool,active:i["default"].PropTypes.bool,buttonComponentClass:m["default"]},getDefaultProps:function(){return{active:!1,disabled:!1}},handleClick:function(e){if(!this.props.disabled&&this.props.onSelect){var t=c["default"](this.props.eventKey);this.props.onSelect(e,t)}},render:function(){var e=r({active:this.props.active,disabled:this.props.disabled},this.getBsClassSet()),t=this.props,n=t.className,s=o(t,["className"]),a=this.props.buttonComponentClass;return i["default"].createElement("li",{className:u["default"](n,e)},i["default"].createElement(a,r({},s,{onClick:this.handleClick})))}});t["default"]=v,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(8)["default"],o=n(3)["default"],s=n(2)["default"];t.__esModule=!0;var a=n(1),i=s(a),l=n(4),u=s(l),p=n(7),d=s(p),f=n(25),c=s(f),h=i["default"].createClass({displayName:"Panel",mixins:[d["default"]],propTypes:{collapsible:i["default"].PropTypes.bool,onSelect:i["default"].PropTypes.func,header:i["default"].PropTypes.node,id:i["default"].PropTypes.oneOfType([i["default"].PropTypes.string,i["default"].PropTypes.number]),footer:i["default"].PropTypes.node,defaultExpanded:i["default"].PropTypes.bool,expanded:i["default"].PropTypes.bool,eventKey:i["default"].PropTypes.any,headerRole:i["default"].PropTypes.string,panelRole:i["default"].PropTypes.string},getDefaultProps:function(){return{bsClass:"panel",bsStyle:"default",defaultExpanded:!1}},getInitialState:function(){return{expanded:this.props.defaultExpanded}},handleSelect:function(e){e.selected=!0,this.props.onSelect?this.props.onSelect(e,this.props.eventKey):e.preventDefault(),e.selected&&this.handleToggle()},handleToggle:function(){this.setState({expanded:!this.state.expanded})},isExpanded:function(){return null!=this.props.expanded?this.props.expanded:this.state.expanded},render:function(){var e=this.props,t=e.headerRole,n=e.panelRole,s=r(e,["headerRole","panelRole"]);return i["default"].createElement("div",o({},s,{className:u["default"](this.props.className,this.getBsClassSet()),id:this.props.collapsible?null:this.props.id,onSelect:null}),this.renderHeading(t),this.props.collapsible?this.renderCollapsibleBody(n):this.renderBody(),this.renderFooter())},renderCollapsibleBody:function(e){var t={className:this.prefixClass("collapse"),id:this.props.id,ref:"panel","aria-hidden":!this.isExpanded()};return e&&(t.role=e),i["default"].createElement(c["default"],{"in":this.isExpanded()},i["default"].createElement("div",t,this.renderBody()))},renderBody:function(){function e(){return{key:u.length}}function t(t){u.push(a.cloneElement(t,e()))}function n(t){u.push(i["default"].createElement("div",o({className:d},e()),t))}function r(){0!==p.length&&(n(p),p=[])}var s=this,l=this.props.children,u=[],p=[],d=this.prefixClass("body");return Array.isArray(l)&&0!==l.length?(l.forEach(function(e){s.shouldRenderFill(e)?(r(),t(e)):p.push(e)}),r()):this.shouldRenderFill(l)?t(l):n(l),u},shouldRenderFill:function(e){return i["default"].isValidElement(e)&&null!=e.props.fill},renderHeading:function(e){var t=this.props.header;if(!t)return null;if(!i["default"].isValidElement(t)||Array.isArray(t))t=this.props.collapsible?this.renderCollapsibleTitle(t,e):t;else{var n=u["default"](this.prefixClass("title"),t.props.className);t=this.props.collapsible?a.cloneElement(t,{className:n,children:this.renderAnchor(t.props.children,e)}):a.cloneElement(t,{className:n})}return i["default"].createElement("div",{className:this.prefixClass("heading")},t)},renderAnchor:function(e,t){return i["default"].createElement("a",{href:"#"+(this.props.id||""),"aria-controls":this.props.collapsible?this.props.id:null,className:this.isExpanded()?null:"collapsed","aria-expanded":this.isExpanded(),"aria-selected":this.isExpanded(),onClick:this.handleSelect,role:t},e)},renderCollapsibleTitle:function(e,t){return i["default"].createElement("h4",{className:this.prefixClass("title"),role:"presentation"},this.renderAnchor(e,t))},renderFooter:function(){return this.props.footer?i["default"].createElement("div",{className:this.prefixClass("footer")},this.props.footer):null}});t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=n(53),f=o(d),c=a["default"].createClass({displayName:"Popover",mixins:[p["default"]],propTypes:{id:f["default"](a["default"].PropTypes.oneOfType([a["default"].PropTypes.string,a["default"].PropTypes.number])),placement:a["default"].PropTypes.oneOf(["top","right","bottom","left"]),positionLeft:a["default"].PropTypes.number,positionTop:a["default"].PropTypes.number,arrowOffsetLeft:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.string]),arrowOffsetTop:a["default"].PropTypes.oneOfType([a["default"].PropTypes.number,a["default"].PropTypes.string]),title:a["default"].PropTypes.node},getDefaultProps:function(){return{placement:"right"}},render:function(){var e,t=(e={popover:!0},e[this.props.placement]=!0,e),n=r({left:this.props.positionLeft,top:this.props.positionTop,display:"block"},this.props.style),o={left:this.props.arrowOffsetLeft,top:this.props.arrowOffsetTop};return a["default"].createElement("div",r({role:"tooltip"},this.props,{className:l["default"](this.props.className,t),style:n,title:null}),a["default"].createElement("div",{className:"arrow",style:o}),this.props.title?this.renderTitle():null,a["default"].createElement("div",{className:"popover-content"},this.props.children))},renderTitle:function(){return a["default"].createElement("h3",{className:"popover-title"},this.props.title)}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t,n){if(e[t]){var r=function(){var r=void 0,o=void 0;return l["default"].Children.forEach(e[t],function(e){e.type!==y&&(o=e.type.displayName?e.type.displayName:e.type,r=new Error("Children of "+n+" can contain only ProgressBar components. Found "+o))}),{v:r}}();if("object"==typeof r)return r.v}}var o=n(3)["default"],s=n(8)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(62),p=a(u),d=n(7),f=a(d),c=n(4),h=a(c),m=n(9),v=a(m),y=l["default"].createClass({displayName:"ProgressBar",propTypes:{min:i.PropTypes.number,now:i.PropTypes.number,max:i.PropTypes.number,label:i.PropTypes.node,srOnly:i.PropTypes.bool,striped:i.PropTypes.bool,active:i.PropTypes.bool,children:r,className:l["default"].PropTypes.string,interpolateClass:i.PropTypes.node,isChild:i.PropTypes.bool},mixins:[f["default"]],getDefaultProps:function(){return{bsClass:"progress-bar",min:0,max:100,active:!1,isChild:!1,srOnly:!1,striped:!1}},getPercentage:function(e,t,n){var r=1e3;return Math.round((e-t)/(n-t)*100*r)/r},render:function(){if(this.props.isChild)return this.renderProgressBar();var e=void 0;return e=this.props.children?v["default"].map(this.props.children,this.renderChildBar):this.renderProgressBar(),l["default"].createElement("div",o({},this.props,{className:h["default"](this.props.className,"progress"),min:null,max:null,label:null,"aria-valuetext":null}),e)},renderChildBar:function(e,t){return i.cloneElement(e,{isChild:!0,key:e.key?e.key:t})},renderProgressBar:function(){var e=this.props,t=e.className,n=e.label,r=e.now,a=e.min,i=e.max,u=s(e,["className","label","now","min","max"]),p=this.getPercentage(r,a,i);"string"==typeof n&&(n=this.renderLabel(p)),this.props.srOnly&&(n=l["default"].createElement("span",{className:"sr-only"},n));var d=h["default"](t,this.getBsClassSet(),{active:this.props.active,"progress-bar-striped":this.props.active||this.props.striped});return l["default"].createElement("div",o({},u,{className:d,role:"progressbar",style:{width:p+"%"},"aria-valuenow":this.props.now,"aria-valuemin":this.props.min,"aria-valuemax":this.props.max}),n)},renderLabel:function(e){var t=this.props.interpolateClass||p["default"];return l["default"].createElement(t,{now:this.props.now,min:this.props.min,max:this.props.max,percent:e,bsStyle:this.props.bsStyle},this.props.label)}});t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(8)["default"],i=n(2)["default"];t.__esModule=!0;var l=n(4),u=i(l),p=n(1),d=i(p),f=n(23),c=i(f),h=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){var e=this.props,t=e.bsClass,n=e.className,r=e.a16by9,o=e.a4by3,i=a(e,["bsClass","className","a16by9","a4by3"]);c["default"](!(!r&&!o),"`a16by9` or `a4by3` attribute must be set."),c["default"](!(r&&o),"Either `a16by9` or `a4by3` attribute can be set. Not both.");var l={"embed-responsive-16by9":r,"embed-responsive-4by3":o};return d["default"].createElement("div",{className:u["default"](t,l)
},p.cloneElement(this.props.children,s({},i,{className:u["default"](n,"embed-responsive-item")})))},t}(d["default"].Component);h.defaultProps={bsClass:"embed-responsive",a16by9:!1,a4by3:!1},h.propTypes={bsClass:p.PropTypes.string,children:p.PropTypes.element.isRequired,a16by9:p.PropTypes.bool,a4by3:p.PropTypes.bool},t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(12),p=o(u),d=a["default"].createClass({displayName:"Row",propTypes:{componentClass:p["default"]},getDefaultProps:function(){return{componentClass:"div"}},render:function(){var e=this.props.componentClass;return a["default"].createElement(e,r({},this.props,{className:l["default"](this.props.className,"row")}),this.props.children)}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(8)["default"],i=n(2)["default"];t.__esModule=!0;var l=n(1),u=i(l),p=n(7),d=i(p),f=n(24),c=i(f),h=n(26),m=i(h),v=n(143),y=i(v),g=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){var e=this.props,t=e.children,n=e.title,r=e.onClick,o=e.target,s=e.href,i=e.bsStyle,l=a(e,["children","title","onClick","target","href","bsStyle"]),p=l.disabled,d=u["default"].createElement(c["default"],{onClick:r,bsStyle:i,disabled:p,target:o,href:s},n);return u["default"].createElement(m["default"],l,d,u["default"].createElement(y["default"],{"aria-label":n,bsStyle:i,disabled:p}),u["default"].createElement(m["default"].Menu,null,t))},t}(u["default"].Component);g.propTypes=s({},m["default"].propTypes,d["default"].propTypes,{onClick:function(){},target:u["default"].PropTypes.string,href:u["default"].PropTypes.string,title:u["default"].PropTypes.node.isRequired}),g.defaultProps={disabled:!1,dropup:!1,pullRight:!1},g.Toggle=y["default"],t["default"]=g,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(1),l=a(i),u=n(58),p=a(u),d=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){return l["default"].createElement(p["default"],s({},this.props,{useAnchor:!1,noCaret:!1}))},t}(l["default"].Component);t["default"]=d,d.defaultProps=p["default"].defaultProps,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(9),p=o(u),d=n(11),f=o(d),c=n(7),h=o(c),m=n(14),v=o(m),y=a["default"].createClass({displayName:"SubNav",mixins:[h["default"]],propTypes:{onSelect:a["default"].PropTypes.func,active:a["default"].PropTypes.bool,activeHref:a["default"].PropTypes.string,activeKey:a["default"].PropTypes.any,disabled:a["default"].PropTypes.bool,eventKey:a["default"].PropTypes.any,href:a["default"].PropTypes.string,title:a["default"].PropTypes.string,text:a["default"].PropTypes.node,target:a["default"].PropTypes.string},getDefaultProps:function(){return{bsClass:"nav",active:!1,disabled:!1}},handleClick:function(e){this.props.onSelect&&(e.preventDefault(),this.props.disabled||this.props.onSelect(this.props.eventKey,this.props.href,this.props.target))},isActive:function(){return this.isChildActive(this)},isChildActive:function(e){var t=this;if(e.props.active)return!0;if(null!=this.props.activeKey&&this.props.activeKey===e.props.eventKey)return!0;if(null!=this.props.activeHref&&this.props.activeHref===e.props.href)return!0;if(e.props.children){var n=!1;return p["default"].forEach(e.props.children,function(e){t.isChildActive(e)&&(n=!0)},this),n}return!1},getChildActiveProp:function(e){return e.props.active?!0:null!=this.props.activeKey&&e.props.eventKey===this.props.activeKey?!0:null!=this.props.activeHref&&e.props.href===this.props.activeHref?!0:e.props.active},render:function(){var e={active:this.isActive(),disabled:this.props.disabled};return a["default"].createElement("li",r({},this.props,{className:l["default"](this.props.className,e)}),a["default"].createElement(v["default"],{href:this.props.href,title:this.props.title,target:this.props.target,onClick:this.handleClick},this.props.text),a["default"].createElement("ul",{className:"nav"},p["default"].map(this.props.children,this.renderNavItem)))},renderNavItem:function(e,t){return s.cloneElement(e,{active:this.getChildActiveProp(e),onSelect:f["default"](e.props.onSelect,this.props.onSelect),key:e.key?e.key:t})}});t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(4),a=o(s),i=n(1),l=o(i),u=n(10),p=o(u),d=n(74),f=o(d),c=l["default"].createClass({displayName:"Tab",propTypes:{active:l["default"].PropTypes.bool,animation:l["default"].PropTypes.bool,onAnimateOutEnd:l["default"].PropTypes.func,disabled:l["default"].PropTypes.bool,title:l["default"].PropTypes.node,tabClassName:l["default"].PropTypes.string},getDefaultProps:function(){return{animation:!0}},getInitialState:function(){return{animateIn:!1,animateOut:!1}},componentWillReceiveProps:function(e){this.props.animation&&(this.state.animateIn||!e.active||this.props.active?this.state.animateOut||e.active||!this.props.active||this.setState({animateOut:!0}):this.setState({animateIn:!0}))},componentDidUpdate:function(){this.state.animateIn&&setTimeout(this.startAnimateIn,0),this.state.animateOut&&f["default"].addEndEventListener(p["default"].findDOMNode(this),this.stopAnimateOut)},startAnimateIn:function(){this.isMounted()&&this.setState({animateIn:!1})},stopAnimateOut:function(){this.isMounted()&&(this.setState({animateOut:!1}),this.props.onAnimateOutEnd&&this.props.onAnimateOutEnd())},render:function(){var e={"tab-pane":!0,fade:!0,active:this.props.active||this.state.animateOut,"in":this.props.active&&!this.state.animateIn};return l["default"].createElement("div",r({},this.props,{title:void 0,role:"tabpanel","aria-hidden":!this.props.active,className:a["default"](this.props.className,e)}),this.props.children)}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=a["default"].createClass({displayName:"Table",propTypes:{striped:a["default"].PropTypes.bool,bordered:a["default"].PropTypes.bool,condensed:a["default"].PropTypes.bool,hover:a["default"].PropTypes.bool,responsive:a["default"].PropTypes.bool},getDefaultProps:function(){return{bordered:!1,condensed:!1,hover:!1,responsive:!1,striped:!1}},render:function(){var e={table:!0,"table-striped":this.props.striped,"table-bordered":this.props.bordered,"table-condensed":this.props.condensed,"table-hover":this.props.hover},t=a["default"].createElement("table",r({},this.props,{className:l["default"](this.props.className,e)}),this.props.children);return this.props.responsive?a["default"].createElement("div",{className:"table-responsive"},t):t}});t["default"]=u,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){var t=void 0;return w["default"].forEach(e,function(e){null==t&&(t=e.props.eventKey)}),t}function o(e,t,n,r){function o(){var t=n.indexOf(i);return i=r?n[Math.min(s,t+1)]:n[Math.max(0,t-1)],M(e,function(e){return e.props.eventKey===i})}for(var s=n.length-1,a=n[r?Math.max(s,0):0],i=t,l=o();l.props.eventKey!==a&&l.props.disabled;)l=o();return l.props.disabled?t:l.props.eventKey}var s=n(3)["default"],a=n(8)["default"],i=n(28)["default"],l=n(2)["default"];t.__esModule=!0;var u=n(4),p=l(u),d=n(1),f=l(d),c=n(10),h=l(c),m=n(57),v=l(m),y=n(68),g=l(y),b=n(70),T=l(b),P=n(27),x=l(P),E=n(42),C=l(E),_=n(11),N=l(_),O=n(9),w=l(O),S=function(e,t){return t.props.id?t.props.id:e.id&&e.id+"___pane___"+t.props.eventKey},k=function(e,t){return t.props.id?t.props.id+"___tab":e.id&&e.id+"___tab___"+t.props.eventKey},M=w["default"].find,D=f["default"].createClass({displayName:"Tabs",propTypes:{activeKey:f["default"].PropTypes.any,defaultActiveKey:f["default"].PropTypes.any,bsStyle:f["default"].PropTypes.oneOf(["tabs","pills"]),animation:f["default"].PropTypes.bool,id:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.number]),onSelect:f["default"].PropTypes.func,position:f["default"].PropTypes.oneOf(["top","left","right"]),tabWidth:f["default"].PropTypes.oneOfType([f["default"].PropTypes.number,f["default"].PropTypes.object]),paneWidth:f["default"].PropTypes.oneOfType([f["default"].PropTypes.number,f["default"].PropTypes.object]),standalone:f["default"].PropTypes.bool},getDefaultProps:function(){return{animation:!0,tabWidth:2,position:"top",standalone:!1}},getInitialState:function(){var e=null!=this.props.defaultActiveKey?this.props.defaultActiveKey:r(this.props.children);return{activeKey:e,previousActiveKey:null}},componentWillReceiveProps:function(e){var t=this;null!=e.activeKey&&e.activeKey!==this.props.activeKey&&!function(){var n=t.props.activeKey;f["default"].Children.forEach(e.children,function(e){return f["default"].isValidElement(e)&&e.props.eventKey===n?void t.setState({previousActiveKey:n}):void 0})}()},componentDidUpdate:function(){var e=this._tabs,t=this._eventKeys().indexOf(this.getActiveKey());if(this._needsRefocus&&(this._needsRefocus=!1,e&&-1!==t)){var n=h["default"].findDOMNode(e[t]);n&&n.firstChild.focus()}},handlePaneAnimateOutEnd:function(){this.setState({previousActiveKey:null})},render:function(){var e=this.props,t=e.id,n=e.className,r=e.style,o=e.position,i=e.bsStyle,l=e.tabWidth,u=e.paneWidth,d=e.standalone,c=e.children,h=a(e,["id","className","style","position","bsStyle","tabWidth","paneWidth","standalone","children"]),m="left"===o||"right"===o;null==i&&(i=m?"pills":"tabs");var y={id:t,className:n,style:r},b=s({},h,{bsStyle:i,stacked:m,activeKey:this.getActiveKey(),onSelect:this.handleSelect,ref:"tabs",role:"tablist"}),T=w["default"].map(c,this.renderTab),P={className:"tab-content",ref:"panes"},x=w["default"].map(c,this.renderPane);if(m){d||(y.className=p["default"](y.className,"clearfix"));var E=this.getColProps({tabWidth:l,paneWidth:u}),C=E.tabsColProps,_=E.panesColProps,N=f["default"].createElement(v["default"],s({componentClass:g["default"]},b,C),T),O=f["default"].createElement(v["default"],s({},P,_),x);return"left"===o?f["default"].createElement("div",y,N,O):f["default"].createElement("div",y,O,N)}return f["default"].createElement("div",y,f["default"].createElement(g["default"],b,T),f["default"].createElement("div",P,x))},getActiveKey:function(){return void 0!==this.props.activeKey?this.props.activeKey:this.state.activeKey},renderPane:function(e,t){var n=this.state.previousActiveKey,r=e.props.eventKey===this.getActiveKey(),o=null==n,s=null!=n&&e.props.eventKey===n;return d.cloneElement(e,{active:r&&(o||!this.props.animation),id:S(this.props,e),"aria-labelledby":k(this.props,e),key:e.key?e.key:t,animation:this.props.animation,onAnimateOutEnd:s?this.handlePaneAnimateOutEnd:null})},renderTab:function(e,t){var n=this;if(null==e.props.title)return null;var r=e.props,o=r.eventKey,s=r.title,a=r.disabled,i=r.onKeyDown,l=r.tabClassName,u=r.tabIndex,p=void 0===u?0:u,d=this.getActiveKey()===o;return f["default"].createElement(T["default"],{linkId:k(this.props,e),ref:function(e){return(n._tabs||(n._tabs=[]))[t]=e},"aria-controls":S(this.props,e),onKeyDown:N["default"](this.handleKeyDown,i),eventKey:o,tabIndex:d?p:-1,disabled:a,className:l},s)},getColProps:function(e){var t=e.tabWidth,n=e.paneWidth,r=void 0;r=t instanceof Object?t:{xs:t};var o=void 0;return null==n?(o={},i(r).forEach(function(e){o[e]=x["default"].GRID_COLUMNS-r[e]})):o=n instanceof Object?n:{xs:n},{tabsColProps:r,panesColProps:o}},shouldComponentUpdate:function(){return!this._isChanging},handleSelect:function(e){if(this.props.onSelect)return this._isChanging=!0,this.props.onSelect(e),void(this._isChanging=!1);var t=this.getActiveKey();e!==t&&this.setState({activeKey:e,previousActiveKey:t})},handleKeyDown:function(e){var t=this._eventKeys(),n=this.getActiveKey()||t[0],r=void 0;switch(e.keyCode){case C["default"].codes.left:case C["default"].codes.up:r=o(this.props.children,n,t,!1),r&&r!==n&&(e.preventDefault(),this.handleSelect(r),this._needsRefocus=!0);break;case C["default"].codes.right:case C["default"].codes.down:r=o(this.props.children,n,t,!0),r&&r!==n&&(e.preventDefault(),this.handleSelect(r),this._needsRefocus=!0)}},_eventKeys:function(){var e=[];return w["default"].forEach(this.props.children,function(t){var n=t.props.eventKey;return e.push(n)}),e}});t["default"]=D,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=n(14),f=o(d),c=a["default"].createClass({displayName:"Thumbnail",mixins:[p["default"]],propTypes:{alt:a["default"].PropTypes.string,href:a["default"].PropTypes.string,src:a["default"].PropTypes.string},getDefaultProps:function(){return{bsClass:"thumbnail"}},render:function(){var e=this.getBsClassSet();return this.props.href?a["default"].createElement(f["default"],r({},this.props,{href:this.props.href,className:l["default"](this.props.className,e)}),a["default"].createElement("img",{src:this.props.src,alt:this.props.alt})):this.props.children?a["default"].createElement("div",r({},this.props,{className:l["default"](this.props.className,e)}),a["default"].createElement("img",{src:this.props.src,alt:this.props.alt}),a["default"].createElement("div",{className:"caption"},this.props.children)):a["default"].createElement("div",r({},this.props,{className:l["default"](this.props.className,e)}),a["default"].createElement("img",{src:this.props.src,alt:this.props.alt}))}});t["default"]=c,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(6)["default"],o=n(5)["default"],s=n(3)["default"],a=n(8)["default"],i=n(2)["default"];t.__esModule=!0;var l=n(4),u=i(l),p=n(1),d=i(p),f=n(53),c=i(f),h=function(e){function t(){o(this,t),e.apply(this,arguments)}return r(t,e),t.prototype.render=function(){var e=this.props,t=e.placement,n=e.positionLeft,r=e.positionTop,o=e.arrowOffsetLeft,i=e.arrowOffsetTop,l=e.className,p=e.style,f=e.children,c=a(e,["placement","positionLeft","positionTop","arrowOffsetLeft","arrowOffsetTop","className","style","children"]);return d["default"].createElement("div",s({role:"tooltip"},c,{className:u["default"](l,"tooltip",t),style:s({left:n,top:r},p)}),d["default"].createElement("div",{className:"tooltip-arrow",style:{left:o,top:i}}),d["default"].createElement("div",{className:"tooltip-inner"},f))},t}(d["default"].Component);t["default"]=h,h.propTypes={id:c["default"](d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.number])),placement:d["default"].PropTypes.oneOf(["top","right","bottom","left"]),positionLeft:d["default"].PropTypes.number,positionTop:d["default"].PropTypes.number,arrowOffsetLeft:d["default"].PropTypes.oneOfType([d["default"].PropTypes.number,d["default"].PropTypes.string]),arrowOffsetTop:d["default"].PropTypes.oneOfType([d["default"].PropTypes.number,d["default"].PropTypes.string])},h.defaultProps={placement:"right"},e.exports=t["default"]},function(e,t,n){"use strict";var r=n(3)["default"],o=n(2)["default"];t.__esModule=!0;var s=n(1),a=o(s),i=n(4),l=o(i),u=n(7),p=o(u),d=a["default"].createClass({displayName:"Well",mixins:[p["default"]],getDefaultProps:function(){return{bsClass:"well"}},render:function(){var e=this.getBsClassSet();return a["default"].createElement("div",r({},this.props,{className:l["default"](this.props.className,e)}),this.props.children)}});t["default"]=d,e.exports=t["default"]},function(e,t,n){"use strict";var r=n(2)["default"];t.__esModule=!0;var o=n(51),s=n(152),a=r(s);t["default"]={requiredRoles:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return o.createChainableTypeChecker(function(e,n,r){var o=void 0,s=a["default"](e.children),i=function(e,t){return e===t.props.bsRole};return t.every(function(e){return s.some(function(t){return i(e,t)})?!0:(o=e,!1)}),o?new Error("(children) "+r+" - Missing a required child with bsRole: "+o+". "+(r+" must have at least one child of each of the following bsRoles: "+t.join(", "))):void 0})},exclusiveRoles:function(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return o.createChainableTypeChecker(function(e,n,r){var o=a["default"](e.children),s=void 0;return t.every(function(e){var t=o.filter(function(t){return t.props.bsRole===e});return t.length>1?(s=e,!1):!0}),s?new Error("(children) "+r+" - Duplicate children detected of bsRole: "+s+". Only one child each allowed with the following bsRoles: "+t.join(", ")):void 0})}},e.exports=t["default"]},function(e,t,n){"use strict";function r(e){var t=[];return void 0===e?t:(a["default"].forEach(e,function(e){t.push(e)}),t)}var o=n(2)["default"];t.__esModule=!0,t["default"]=r;var s=n(9),a=o(s);e.exports=t["default"]},function(e,t){"use strict";function n(e){var t=!1;return{eventKey:e,preventSelection:function(){t=!0},isSelectionPrevented:function(){return t}}}t.__esModule=!0,t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t,n){var r=void 0;"object"==typeof e?r=e.message:(r=e+" is deprecated. Use "+t+" instead.",n&&(r+="\nYou can read more about it at "+n)),u[r]||(l["default"](!1,r),u[r]=!0)}var o=n(6)["default"],s=n(5)["default"],a=n(2)["default"];t.__esModule=!0;var i=n(23),l=a(i),u={};r.wrapper=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),a=1;t>a;a++)n[a-1]=arguments[a];return function(e){function t(){s(this,t),e.apply(this,arguments)}return o(t,e),t.prototype.componentWillMount=function(){if(r.apply(void 0,n),e.prototype.componentWillMount){for(var t,o=arguments.length,s=Array(o),a=0;o>a;a++)s[a]=arguments[a];(t=e.prototype.componentWillMount).call.apply(t,[this].concat(s))}},t}(e)},t["default"]=r,e.exports=t["default"]},function(e,t,n){e.exports={"default":n(159),__esModule:!0}},function(e,t,n){e.exports={"default":n(160),__esModule:!0}},function(e,t,n){e.exports={"default":n(161),__esModule:!0}},function(e,t,n){e.exports={"default":n(163),__esModule:!0}},function(e,t,n){n(175),e.exports=n(18).Object.assign},function(e,t,n){var r=n(38);e.exports=function(e,t){return r.create(e,t)}},function(e,t,n){n(176),e.exports=n(18).Object.isFrozen},function(e,t,n){n(177),e.exports=n(18).Object.keys},function(e,t,n){n(178),e.exports=n(18).Object.setPrototypeOf},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(37);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var r=n(79),o=n(173),s=n(170),a=n(172);e.exports=n(77)(function(){var e=Object.assign,t={},n={},r=Symbol(),o="abcdefghijklmnopqrst";return t[r]=7,o.split("").forEach(function(e){n[e]=e}),7!=e({},t)[r]||Object.keys(e({},n)).join("")!=o})?function(e,t){for(var n=r(e),i=arguments.length,l=1;i>l;)for(var u,p=o(arguments[l++]),d=s(p),f=d.length,c=0;f>c;)a(p,u=d[c++])&&(n[u]=p[u]);return n}:Object.assign},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){var r=n(164);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},function(e,t,n){var r=n(38);e.exports=function(e){var t=r.getKeys(e),n=r.getSymbols;if(n)for(var o,s=n(e),a=r.isEnum,i=0;s.length>i;)a.call(e,o=s[i++])&&t.push(o);return t}},function(e,t){var n="undefined",r=e.exports=typeof window!=n&&window.Math==Math?window:typeof self!=n&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){var r=n(167);e.exports=0 in Object("z")?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},function(e,t,n){var r=n(38).getDesc,o=n(37),s=n(165),a=function(e,t){if(s(e),!o(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};e.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,o){try{o=n(168)(Function.call,r(Object.prototype,"__proto__").set,2),o(e,[]),t=!(e instanceof Array)}catch(s){t=!0}return function(e,n){return a(e,n),t?e.__proto__=n:o(e,n),e}}({},!1):void 0),check:a}},function(e,t,n){var r=n(36);r(r.S+r.F,"Object",{assign:n(166)})},function(e,t,n){var r=n(37);n(78)("isFrozen",function(e){return function(t){return r(t)?e?e(t):!1:!0}})},function(e,t,n){var r=n(79);n(78)("keys",function(e){return function(t){return e(r(t))}})},function(e,t,n){var r=n(36);r(r.S,"Object",{setPrototypeOf:n(174).set})},function(e,t,n){"use strict";var r=n(20),o=function(){};r&&(o=function(){return document.addEventListener?function(e,t,n,r){return e.removeEventListener(t,n,r||!1)}:document.attachEvent?function(e,t,n){return e.detachEvent("on"+t,n)}:void 0}()),e.exports=o},function(e,t,n){"use strict";function r(e){var t=a["default"](e);return t&&t.defaultView||t.parentWindow}var o=n(22);t.__esModule=!0,t["default"]=r;var s=n(19),a=o.interopRequireDefault(s);e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e.nodeName&&e.nodeName.toLowerCase()}function o(e){for(var t=i["default"](e),n=e&&e.offsetParent;n&&"html"!==r(e)&&"static"===u["default"](n,"position");)n=n.offsetParent;return n||t.documentElement}var s=n(22);t.__esModule=!0,t["default"]=o;var a=n(19),i=s.interopRequireDefault(a),l=n(41),u=s.interopRequireDefault(l);e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e.nodeName&&e.nodeName.toLowerCase()}function o(e,t){var n,o={top:0,left:0};return"fixed"===m["default"](e,"position")?n=e.getBoundingClientRect():(t=t||u["default"](e),n=i["default"](e),"html"!==r(t)&&(o=i["default"](t)),o.top+=parseInt(m["default"](t,"borderTopWidth"),10)-d["default"](t)||0,o.left+=parseInt(m["default"](t,"borderLeftWidth"),10)-c["default"](t)||0),s._extends({},n,{top:n.top-o.top-(parseInt(m["default"](e,"marginTop"),10)||0),left:n.left-o.left-(parseInt(m["default"](e,"marginLeft"),10)||0)})}var s=n(22);t.__esModule=!0,t["default"]=o;var a=n(40),i=s.interopRequireDefault(a),l=n(181),u=s.interopRequireDefault(l),p=n(82),d=s.interopRequireDefault(p),f=n(183),c=s.interopRequireDefault(f),h=n(41),m=s.interopRequireDefault(h);e.exports=t["default"]},function(e,t,n){"use strict";var r=n(39);e.exports=function(e,t){var n=r(e);return void 0===t?n?"pageXOffset"in n?n.pageXOffset:n.document.documentElement.scrollLeft:e.scrollLeft:void(n?n.scrollTo(t,"pageYOffset"in n?n.pageYOffset:n.document.documentElement.scrollTop):e.scrollLeft=t)}},function(e,t,n){"use strict";var r=n(22),o=n(83),s=r.interopRequireDefault(o),a=/^(top|right|bottom|left)$/,i=/^([+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|))(?!px)[a-z%]+$/i;e.exports=function(e){if(!e)throw new TypeError("No Element passed to `getComputedStyle()`");var t=e.ownerDocument;return"defaultView"in t?t.defaultView.opener?e.ownerDocument.defaultView.getComputedStyle(e,null):window.getComputedStyle(e,null):{getPropertyValue:function(t){var n=e.style;t=s["default"](t),"float"==t&&(t="styleFloat");var r=e.currentStyle[t]||null;if(null==r&&n&&n[t]&&(r=n[t]),i.test(r)&&!a.test(t)){var o=n.left,l=e.runtimeStyle,u=l&&l.left;u&&(l.left=e.currentStyle.left),n.left="fontSize"===t?"1em":r,r=n.pixelLeft+"px",n.left=o,u&&(l.left=u)}return r}}}},function(e,t){"use strict";e.exports=function(e,t){return"removeProperty"in e.style?e.style.removeProperty(t):e.style.removeAttribute(t)}},function(e,t,n){"use strict";function r(){var e,t="",n={O:"otransitionend",Moz:"transitionend",Webkit:"webkitTransitionEnd",ms:"MSTransitionEnd"},r=document.createElement("div");for(var o in n)if(u.call(n,o)&&void 0!==r.style[o+"TransitionProperty"]){t="-"+o.toLowerCase()+"-",e=n[o];break}return e||void 0===r.style.transitionProperty||(e="transitionend"),{end:e,prefix:t}}var o,s,a,i,l=n(20),u=Object.prototype.hasOwnProperty,p="transform",d={};l&&(d=r(),p=d.prefix+p,a=d.prefix+"transition-property",s=d.prefix+"transition-duration",i=d.prefix+"transition-delay",o=d.prefix+"transition-timing-function"),e.exports={transform:p,end:d.end,property:a,timing:o,delay:i,duration:s}},function(e,t){"use strict";var n=/-(.)/g;e.exports=function(e){return e.replace(n,function(e,t){return t.toUpperCase()})}},function(e,t){"use strict";var n=/([A-Z])/g;e.exports=function(e){return e.replace(n,"-$1").toLowerCase()}},function(e,t,n){"use strict";var r=n(188),o=/^ms-/;e.exports=function(e){return r(e).replace(o,"-ms-")}},function(e,t,n){"use strict";var r,o=n(20);e.exports=function(e){if((!r||e)&&o){var t=document.createElement("div");t.style.position="absolute",t.style.top="-9999px",t.style.width="50px",t.style.height="50px",t.style.overflow="scroll",document.body.appendChild(t),r=t.offsetWidth-t.clientWidth,document.body.removeChild(t)}return r}},function(e,t){function n(e){var t=e?e.length:0;return t?e[t-1]:void 0}e.exports=n},function(e,t,n){var r=n(200),o=n(218),s=o(r);e.exports=s},function(e,t,n){(function(t){function r(e){var t=e?e.length:0;for(this.data={hash:i(null),set:new a};t--;)this.push(e[t])}var o=n(214),s=n(30),a=s(t,"Set"),i=s(Object,"create");r.prototype.push=o,e.exports=r}).call(t,function(){return this}())},function(e,t){function n(e,t){for(var n=-1,r=e.length;++n<r&&t(e[n],n,e)!==!1;);return e}e.exports=n},function(e,t){function n(e,t){for(var n=-1,r=e.length,o=Array(r);++n<r;)o[n]=t(e[n],n,e);return o}e.exports=n},function(e,t){function n(e,t){for(var n=-1,r=t.length,o=e.length;++n<r;)e[o+n]=t[n];return e}e.exports=n},function(e,t){function n(e,t){for(var n=-1,r=e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}e.exports=n},function(e,t,n){function r(e,t,n){var r=typeof e;return"function"==r?void 0===t?e:a(e,t,n):null==e?i:"object"==r?o(e):void 0===t?l(e):s(e,t)}var o=n(208),s=n(209),a=n(43),i=n(100),l=n(229);e.exports=r},function(e,t,n){function r(e,t){var n=e?e.length:0,r=[];if(!n)return r;var l=-1,u=o,p=!0,d=p&&t.length>=i?a(t):null,f=t.length;d&&(u=s,p=!1,t=d);e:for(;++l<n;){var c=e[l];if(p&&c===c){for(var h=f;h--;)if(t[h]===c)continue e;r.push(c)}else u(t,c,0)<0&&r.push(c)}return r}var o=n(205),s=n(213),a=n(217),i=200;e.exports=r},function(e,t,n){var r=n(204),o=n(215),s=o(r);e.exports=s},function(e,t){function n(e,t,n,r){var o;return n(e,function(e,n,s){return t(e,n,s)?(o=r?n:e,!1):void 0}),o}e.exports=n},function(e,t){function n(e,t,n){for(var r=e.length,o=n?r:-1;n?o--:++o<r;)if(t(e[o],o,e))return o;return-1}e.exports=n},function(e,t,n){function r(e,t){return o(e,t,s)}var o=n(86),s=n(48);e.exports=r},function(e,t,n){function r(e,t){return o(e,t,s)}var o=n(86),s=n(47);e.exports=r},function(e,t,n){function r(e,t,n){if(t!==t)return o(e,n);for(var r=n-1,s=e.length;++r<s;)if(e[r]===t)return r;return-1}var o=n(223);e.exports=r},function(e,t,n){function r(e,t,n,r,c,v,y){var g=i(e),b=i(t),T=d,P=d;g||(T=m.call(e),T==p?T=f:T!=f&&(g=u(e))),b||(P=m.call(t),P==p?P=f:P!=f&&(b=u(t)));var x=T==f&&!l(e),E=P==f&&!l(t),C=T==P;if(C&&!g&&!x)return s(e,t,T);if(!c){var _=x&&h.call(e,"__wrapped__"),N=E&&h.call(t,"__wrapped__");if(_||N)return n(_?e.value():e,N?t.value():t,r,c,v,y)}if(!C)return!1;v||(v=[]),y||(y=[]);for(var O=v.length;O--;)if(v[O]==e)return y[O]==t;v.push(e),y.push(t);var w=(g?o:a)(e,t,n,r,c,v,y);return v.pop(),y.pop(),w}var o=n(219),s=n(220),a=n(221),i=n(15),l=n(91),u=n(226),p="[object Arguments]",d="[object Array]",f="[object Object]",c=Object.prototype,h=c.hasOwnProperty,m=c.toString;e.exports=r},function(e,t,n){function r(e,t,n){var r=t.length,a=r,i=!n;if(null==e)return!a;for(e=s(e);r--;){var l=t[r];if(i&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++r<a;){l=t[r];var u=l[0],p=e[u],d=l[1];if(i&&l[2]){if(void 0===p&&!(u in e))return!1}else{var f=n?n(p,d,u):void 0;if(!(void 0===f?o(d,p,n,!0):f))return!1}}return!0}var o=n(88),s=n(13);e.exports=r},function(e,t,n){function r(e){var t=s(e);if(1==t.length&&t[0][2]){var n=t[0][0],r=t[0][1];return function(e){return null==e?!1:(e=a(e),e[n]===r&&(void 0!==r||n in e))}}return function(e){return o(e,t)}}var o=n(207),s=n(222),a=n(13);e.exports=r},function(e,t,n){function r(e,t){var n=i(e),r=l(e)&&u(t),c=e+"";return e=f(e),function(i){if(null==i)return!1;var l=c;if(i=d(i),(n||!r)&&!(l in i)){if(i=1==e.length?i:o(i,a(e,0,-1)),null==i)return!1;l=p(e),i=d(i)}return i[l]===t?void 0!==t||l in i:s(t,i[l],void 0,!0)}}var o=n(87),s=n(88),a=n(211),i=n(15),l=n(93),u=n(94),p=n(191),d=n(13),f=n(97);e.exports=r},function(e,t,n){function r(e){var t=e+"";return e=s(e),function(n){return o(n,e,t)}}var o=n(87),s=n(97);e.exports=r},function(e,t){function n(e,t,n){var r=-1,o=e.length;t=null==t?0:+t||0,0>t&&(t=-t>o?0:o+t),n=void 0===n||n>o?o:+n||0,0>n&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var s=Array(o);++r<o;)s[r]=e[r+t];return s}e.exports=n},function(e,t){function n(e){return null==e?"":e+""}e.exports=n},function(e,t,n){function r(e,t){var n=e.data,r="string"==typeof t||o(t)?n.set.has(t):n.hash[t];return r?0:-1}var o=n(16);e.exports=r},function(e,t,n){function r(e){var t=this.data;"string"==typeof e||o(e)?t.set.add(e):t.hash[e]=!0}var o=n(16);e.exports=r},function(e,t,n){function r(e,t){return function(n,r){var i=n?o(n):0;if(!s(i))return e(n,r);for(var l=t?i:-1,u=a(n);(t?l--:++l<i)&&r(u[l],l,u)!==!1;);return n}}var o=n(90),s=n(21),a=n(13);e.exports=r},function(e,t,n){function r(e){return function(t,n,r){for(var s=o(t),a=r(t),i=a.length,l=e?i:-1;e?l--:++l<i;){var u=a[l];if(n(s[u],u,s)===!1)break}return t}}var o=n(13);e.exports=r},function(e,t,n){(function(t){function r(e){return i&&a?new o(e):null}var o=n(193),s=n(30),a=s(t,"Set"),i=s(Object,"create");e.exports=r}).call(t,function(){return this}())},function(e,t,n){function r(e,t){return function(n,r,l){if(r=o(r,l,3),i(n)){var u=a(n,r,t);return u>-1?n[u]:void 0}return s(n,r,e)}}var o=n(198),s=n(201),a=n(202),i=n(15);e.exports=r},function(e,t,n){function r(e,t,n,r,s,a,i){var l=-1,u=e.length,p=t.length;if(u!=p&&!(s&&p>u))return!1;for(;++l<u;){var d=e[l],f=t[l],c=r?r(s?f:d,s?d:f,l):void 0;if(void 0!==c){if(c)continue;return!1}if(s){if(!o(t,function(e){return d===e||n(d,e,r,s,a,i)}))return!1}else if(d!==f&&!n(d,f,r,s,a,i))return!1}return!0}var o=n(197);e.exports=r},function(e,t){function n(e,t,n){switch(n){case r:case o:return+e==+t;case s:return e.name==t.name&&e.message==t.message;case a:return e!=+e?t!=+t:e==+t;case i:case l:return e==t+""}return!1}var r="[object Boolean]",o="[object Date]",s="[object Error]",a="[object Number]",i="[object RegExp]",l="[object String]";e.exports=n},function(e,t,n){function r(e,t,n,r,s,i,l){var u=o(e),p=u.length,d=o(t),f=d.length;if(p!=f&&!s)return!1;for(var c=p;c--;){var h=u[c];if(!(s?h in t:a.call(t,h)))return!1}for(var m=s;++c<p;){h=u[c];var v=e[h],y=t[h],g=r?r(s?y:v,s?v:y,h):void 0;if(!(void 0===g?n(v,y,r,s,i,l):g))return!1;m||(m="constructor"==h)}if(!m){var b=e.constructor,T=t.constructor;if(b!=T&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof T&&T instanceof T))return!1}return!0}var o=n(47),s=Object.prototype,a=s.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){for(var t=s(e),n=t.length;n--;)t[n][2]=o(t[n][1]);return t}var o=n(94),s=n(227);e.exports=r},function(e,t){function n(e,t,n){for(var r=e.length,o=t+(n?0:-1);n?o--:++o<r;){var s=e[o];if(s!==s)return o}return-1}e.exports=n},function(e,t,n){function r(e){for(var t=u(e),n=t.length,r=n&&e.length,p=!!r&&i(r)&&(s(e)||o(e)||l(e)),f=-1,c=[];++f<n;){var h=t[f];(p&&a(h,r)||d.call(e,h))&&c.push(h)}return c}var o=n(45),s=n(15),a=n(92),i=n(21),l=n(46),u=n(48),p=Object.prototype,d=p.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){return null==e?!1:o(e)?d.test(u.call(e)):a(e)&&(s(e)?d:i).test(e)}var o=n(98),s=n(91),a=n(17),i=/^\[object .+?Constructor\]$/,l=Object.prototype,u=Function.prototype.toString,p=l.hasOwnProperty,d=RegExp("^"+u.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");
e.exports=r},function(e,t,n){function r(e){return s(e)&&o(e.length)&&!!S[M.call(e)]}var o=n(21),s=n(17),a="[object Arguments]",i="[object Array]",l="[object Boolean]",u="[object Date]",p="[object Error]",d="[object Function]",f="[object Map]",c="[object Number]",h="[object Object]",m="[object RegExp]",v="[object Set]",y="[object String]",g="[object WeakMap]",b="[object ArrayBuffer]",T="[object Float32Array]",P="[object Float64Array]",x="[object Int8Array]",E="[object Int16Array]",C="[object Int32Array]",_="[object Uint8Array]",N="[object Uint8ClampedArray]",O="[object Uint16Array]",w="[object Uint32Array]",S={};S[T]=S[P]=S[x]=S[E]=S[C]=S[_]=S[N]=S[O]=S[w]=!0,S[a]=S[i]=S[b]=S[l]=S[u]=S[p]=S[d]=S[f]=S[c]=S[h]=S[m]=S[v]=S[y]=S[g]=!1;var k=Object.prototype,M=k.toString;e.exports=r},function(e,t,n){function r(e){e=s(e);for(var t=-1,n=o(e),r=n.length,a=Array(r);++t<r;){var i=n[t];a[t]=[i,e[i]]}return a}var o=n(47),s=n(13);e.exports=r},function(e,t,n){var r=n(85),o=n(43),s=n(95),a=n(96),i=n(84),l=i(function(e,t){return null==e?{}:"function"==typeof t[0]?a(e,o(t[0],t[1],3)):s(e,r(t))});e.exports=l},function(e,t,n){function r(e){return a(e)?o(e):s(e)}var o=n(89),s=n(210),a=n(93);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=n(1),u=r(l),p=n(101),d=r(p),f=n(231),c=r(f),h=n(102),m=r(h),v=n(235),y=r(v),g=function(e){function t(n,r){s(this,t),e.call(this,n,r),this.state={exited:!n.show},this.onHiddenListener=this.handleHidden.bind(this)}return a(t,e),t.prototype.componentWillReceiveProps=function(e){e.show?this.setState({exited:!1}):e.transition||this.setState({exited:!0})},t.prototype.render=function(){var e=this.props,t=e.container,n=e.containerPadding,r=e.target,s=e.placement,a=e.rootClose,i=e.children,l=e.transition,p=o(e,["container","containerPadding","target","placement","rootClose","children","transition"]),f=p.show||l&&!this.state.exited;if(!f)return null;var h=i;if(h=u["default"].createElement(c["default"],{container:t,containerPadding:n,target:r,placement:s},h),l){var v=p.onExit,y=p.onExiting,g=p.onEnter,b=p.onEntering,T=p.onEntered;h=u["default"].createElement(l,{"in":p.show,transitionAppear:!0,onExit:v,onExiting:y,onExited:this.onHiddenListener,onEnter:g,onEntering:b,onEntered:T},h)}return a&&(h=u["default"].createElement(m["default"],{onRootClose:p.onHide},h)),u["default"].createElement(d["default"],{container:t},h)},t.prototype.handleHidden=function(){if(this.setState({exited:!0}),this.props.onExited){var e;(e=this.props).onExited.apply(e,arguments)}},t}(u["default"].Component);g.propTypes=i({},d["default"].propTypes,c["default"].propTypes,{show:u["default"].PropTypes.bool,rootClose:u["default"].PropTypes.bool,onHide:u["default"].PropTypes.func,transition:y["default"],onEnter:u["default"].PropTypes.func,onEntering:u["default"].PropTypes.func,onEntered:u["default"].PropTypes.func,onExit:u["default"].PropTypes.func,onExiting:u["default"].PropTypes.func,onExited:u["default"].PropTypes.func}),t["default"]=g,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(e.__proto__=t)}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=n(1),u=r(l),p=n(10),d=r(p),f=n(4),c=r(f),h=n(31),m=r(h),v=n(104),y=r(v),g=n(234),b=n(106),T=r(b),P=function(e){function t(n,r){s(this,t),e.call(this,n,r),this.state={positionLeft:null,positionTop:null,arrowOffsetLeft:null,arrowOffsetTop:null},this._needsFlush=!1,this._lastTarget=null}return a(t,e),t.prototype.componentDidMount=function(){this.updatePosition()},t.prototype.componentWillReceiveProps=function(){this._needsFlush=!0},t.prototype.componentDidUpdate=function(e){this._needsFlush&&(this._needsFlush=!1,this.updatePosition(e.placement!==this.props.placement))},t.prototype.componentWillUnmount=function(){this._lastTarget=null},t.prototype.render=function(){var e=this.props,t=e.children,n=e.className,r=o(e,["children","className"]),s=this.state,a=s.positionLeft,p=s.positionTop,d=o(s,["positionLeft","positionTop"]),f=u["default"].Children.only(t);return l.cloneElement(f,i({},r,d,{positionLeft:a,positionTop:p,className:c["default"](n,f.props.className),style:i({},f.props.style,{left:a,top:p})}))},t.prototype.getTargetSafe=function(){if(!this.props.target)return null;var e=this.props.target(this.props);return e?e:null},t.prototype.updatePosition=function(e){var t=this.getTargetSafe();if(t!==this._lastTarget||e){if(this._lastTarget=t,!t)return void this.setState({positionLeft:null,positionTop:null,arrowOffsetLeft:null,arrowOffsetTop:null});var n=d["default"].findDOMNode(this),r=y["default"](this.props.container,m["default"](this).body);this.setState(g.calcOverlayPosition(this.props.placement,n,t,r,this.props.containerPadding))}},t}(u["default"].Component);P.propTypes={target:u["default"].PropTypes.func,container:T["default"],containerPadding:u["default"].PropTypes.number,placement:u["default"].PropTypes.oneOf(["top","right","bottom","left"])},P.displayName="Position",P.defaultProps={containerPadding:0,placement:"right"},t["default"]=P,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var o=n(81),s=r(o),a=n(179),i=r(a);t["default"]=function(e,t,n){return s["default"](e,t,n),{remove:function(){i["default"](e,t,n)}}},e.exports=t["default"]},function(e,t){"use strict";function n(){for(var e=arguments.length,t=Array(e),n=0;e>n;n++)t[n]=arguments[n];return t.filter(function(e){return null!=e}).reduce(function(e,t){if("function"!=typeof t)throw new Error("Invalid Argument Type, must only provide functions, undefined, or null.");return null===e?t:function(){for(var n=arguments.length,r=Array(n),o=0;n>o;o++)r[o]=arguments[o];e.apply(this,r),t.apply(this,r)}},null)}t.__esModule=!0,t["default"]=n,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n,r){var o=h.getContainerDimensions(n),s=o.scroll,a=o.height,i=e-r-s,l=e+r-s+t;return 0>i?-i:l>a?a-l:0}function s(e,t,n,r){var o=h.getContainerDimensions(n),s=o.width,a=e-r,i=e+r+t;return 0>a?-a:i>s?s-i:0}t.__esModule=!0;var a=n(31),i=r(a),l=n(40),u=r(l),p=n(182),d=r(p),f=n(82),c=r(f),h={getContainerDimensions:function(e){var t=void 0,n=void 0,r=void 0;if("BODY"===e.tagName)t=window.innerWidth,n=window.innerHeight,r=c["default"](i["default"](e).documentElement)||c["default"](e);else{var o=u["default"](e);t=o.width,n=o.height,r=c["default"](e)}return{width:t,height:n,scroll:r}},getPosition:function(e,t){var n="BODY"===t.tagName?u["default"](e):d["default"](e,t);return n},calcOverlayPosition:function(e,t,n,r,a){var i=h.getPosition(n,r),l=u["default"](t),p=l.height,d=l.width,f=void 0,c=void 0,m=void 0,v=void 0;if("left"===e||"right"===e){c=i.top+(i.height-p)/2,f="left"===e?i.left-d:i.left+i.width;var y=o(c,p,r,a);c+=y,v=50*(1-2*y/p)+"%",m=void 0}else{if("top"!==e&&"bottom"!==e)throw new Error('calcOverlayPosition(): No such placement of "'+e+'" found.');f=i.left+(i.width-d)/2,c="top"===e?i.top-p:i.top+i.height;var g=s(f,d,r,a);f+=g,m=50*(1-2*g/d)+"%",v=void 0}return{positionLeft:f,positionTop:c,arrowOffsetLeft:m,arrowOffsetTop:v}}};t["default"]=h,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){var r=i.errMsg(e,t,n,". Expected an Element `type`");if("function"!=typeof e[t]){if(a["default"].isValidElement(e[t]))return new Error(r+", not an actual Element");if("string"!=typeof e[t])return new Error(r+" such as a tag name or return value of React.createClass(...)")}}t.__esModule=!0;var s=n(1),a=r(s),i=n(105);t["default"]=i.createChainableTypeChecker(o),e.exports=t["default"]},function(e,t,n){"use strict";function r(e){function t(t,n,r){var s=t[n];if(!e.hasOwnProperty(s)){var a=JSON.stringify(Object.keys(e));return new Error(o.errMsg(t,n,r,", expected one of "+a+"."))}}return o.createChainableTypeChecker(t)}t.__esModule=!0,t["default"]=r;var o=n(51);e.exports=t["default"]},function(e,t,n){"use strict";function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}function o(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){function n(n,r){function o(e,n){var o=d.getLinkName(e),s=this.props[r[e]];o&&a(this.props,o)&&!s&&(s=this.props[o].requestChange);for(var i=arguments.length,l=Array(i>2?i-2:0),u=2;i>u;u++)l[u-2]=arguments[u];t(this,e,s,n,l)}function a(e,t){return void 0!==e[t]}var l,p=arguments.length<=2||void 0===arguments[2]?[]:arguments[2],f=n.displayName||n.name||"Component",c=d.getType(n).propTypes;l=d.uncontrolledPropTypes(r,c,f),p=d.transform(p,function(e,t){e[t]=function(){var e;return(e=this.refs.inner)[t].apply(e,arguments)}},{});var h=u["default"].createClass(i({displayName:"Uncontrolled("+f+")",mixins:e,propTypes:l},p,{componentWillMount:function(){var e=this.props,t=Object.keys(r);this._values=d.transform(t,function(t,n){t[n]=e[d.defaultKey(n)]},{})},componentWillReceiveProps:function(e){var t=this,n=this.props,o=Object.keys(r);o.forEach(function(r){void 0===d.getValue(e,r)&&void 0!==d.getValue(n,r)&&(t._values[r]=e[d.defaultKey(r)])})},render:function(){var e=this,t={},l=this.props,p=(l.valueLink,l.checkedLink,s(l,["valueLink","checkedLink"]));return d.each(r,function(n,r){var s=d.getLinkName(r),i=e.props[r];s&&!a(e.props,r)&&a(e.props,s)&&(i=e.props[s].value),t[r]=void 0!==i?i:e._values[r],t[n]=o.bind(e,r)}),t=i({},p,t,{ref:"inner"}),u["default"].createElement(n,t)}}));return h.ControlledComponent=n,h}return n}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t["default"]=a;var l=n(1),u=o(l),p=n(240),d=r(p);e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n,r,o){n&&(e._notifying=!0,n.call.apply(n,[e,r].concat(o)),e._notifying=!1),e._values[t]=r,e.forceUpdate()}t.__esModule=!0;var s=n(237),a=r(s),i={shouldComponentUpdate:function(){return!this._notifying}};t["default"]=a["default"]([i],o),e.exports=t["default"]},function(e,t,n){"use strict";var r=function(e,t,n,r,o,s,a,i){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,o,s,a,i],p=0;l=new Error("Invariant Violation: "+t.replace(/%s/g,function(){return u[p++]}))}throw l.framesToPop=1,l}};e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return function(r,o){return void 0!==r[o]?r[e]?t&&t(r,o,n):new Error("You have provided a `"+o+"` prop to `"+n+"` without an `"+e+"` handler. This will render a read-only field. If the field should be mutable use `"+p(o)+"`. Otherwise, set `"+e+"`"):void 0}}function s(e,t,n){var r={};return r}function a(e){return 0===g[0]&&g[1]>=13?e:e.type}function i(e,t){var n=u(t);return n&&!l(e,t)&&l(e,n)?e[n].value:e[t]}function l(e,t){return void 0!==e[t]}function u(e){return"value"===e?"valueLink":"checked"===e?"checkedLink":null}function p(e){return"default"+e.charAt(0).toUpperCase()+e.substr(1)}function d(e,t,n){return function(){for(var r=arguments.length,o=Array(r),s=0;r>s;s++)o[s]=arguments[s];t&&t.call.apply(t,[e].concat(o)),n&&n.call.apply(n,[e].concat(o))}}function f(e,t,n){return c(e,t.bind(null,n=n||(Array.isArray(e)?[]:{}))),n}function c(e,t,n){if(Array.isArray(e))return e.forEach(t,n);for(var r in e)h(e,r)&&t.call(n,e[r],r,e)}function h(e,t){return e?Object.prototype.hasOwnProperty.call(e,t):!1}t.__esModule=!0,t.customPropType=o,t.uncontrolledPropTypes=s,t.getType=a,t.getValue=i,t.getLinkName=u,t.defaultKey=p,t.chain=d,t.transform=f,t.each=c,t.has=h;var m=n(1),v=r(m),y=n(239),g=(r(y),v["default"].version.split(".").map(parseFloat));t.version=g}])});
//# sourceMappingURL=react-bootstrap.min.js.map |
wrappers/toml.js | umbchackers/innovategood | import React from 'react'
import toml from 'toml-js'
import Helmet from 'react-helmet'
import { config } from 'config'
module.exports = React.createClass({
propTypes () {
return {
route: React.PropTypes.object,
}
},
render () {
const data = this.props.route.page.data
return (
<div>
<Helmet
title={`${config.siteTitle} | ${data.title}`}
/>
<h1>{data.title}</h1>
<p>Raw view of toml file</p>
<pre dangerouslySetInnerHTML={{ __html: toml.dump(data) }} />
</div>
)
},
})
|
ajax/libs/vue/2.2.2/vue.runtime.esm.js | him2him2/cdnjs | /*!
* Vue.js v2.2.2
* (c) 2014-2017 Evan You
* Released under the MIT License.
*/
/* */
/**
* Convert a value to a string that is actually rendered.
*/
function _toString (val) {
return val == null
? ''
: typeof val === 'object'
? JSON.stringify(val, null, 2)
: String(val)
}
/**
* Convert a input value to a number for persistence.
* If the conversion fails, return original string.
*/
function toNumber (val) {
var n = parseFloat(val);
return isNaN(n) ? val : n
}
/**
* Make a map and return a function for checking if a key
* is in that map.
*/
function makeMap (
str,
expectsLowerCase
) {
var map = Object.create(null);
var list = str.split(',');
for (var i = 0; i < list.length; i++) {
map[list[i]] = true;
}
return expectsLowerCase
? function (val) { return map[val.toLowerCase()]; }
: function (val) { return map[val]; }
}
/**
* Check if a tag is a built-in tag.
*/
var isBuiltInTag = makeMap('slot,component', true);
/**
* Remove an item from an array
*/
function remove (arr, item) {
if (arr.length) {
var index = arr.indexOf(item);
if (index > -1) {
return arr.splice(index, 1)
}
}
}
/**
* Check whether the object has the property.
*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwn (obj, key) {
return hasOwnProperty.call(obj, key)
}
/**
* Check if value is primitive
*/
function isPrimitive (value) {
return typeof value === 'string' || typeof value === 'number'
}
/**
* Create a cached version of a pure function.
*/
function cached (fn) {
var cache = Object.create(null);
return (function cachedFn (str) {
var hit = cache[str];
return hit || (cache[str] = fn(str))
})
}
/**
* Camelize a hyphen-delimited string.
*/
var camelizeRE = /-(\w)/g;
var camelize = cached(function (str) {
return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
});
/**
* Capitalize a string.
*/
var capitalize = cached(function (str) {
return str.charAt(0).toUpperCase() + str.slice(1)
});
/**
* Hyphenate a camelCase string.
*/
var hyphenateRE = /([^-])([A-Z])/g;
var hyphenate = cached(function (str) {
return str
.replace(hyphenateRE, '$1-$2')
.replace(hyphenateRE, '$1-$2')
.toLowerCase()
});
/**
* Simple bind, faster than native
*/
function bind (fn, ctx) {
function boundFn (a) {
var l = arguments.length;
return l
? l > 1
? fn.apply(ctx, arguments)
: fn.call(ctx, a)
: fn.call(ctx)
}
// record original fn length
boundFn._length = fn.length;
return boundFn
}
/**
* Convert an Array-like object to a real Array.
*/
function toArray (list, start) {
start = start || 0;
var i = list.length - start;
var ret = new Array(i);
while (i--) {
ret[i] = list[i + start];
}
return ret
}
/**
* Mix properties into target object.
*/
function extend (to, _from) {
for (var key in _from) {
to[key] = _from[key];
}
return to
}
/**
* Quick object check - this is primarily used to tell
* Objects from primitive values when we know the value
* is a JSON-compliant type.
*/
function isObject (obj) {
return obj !== null && typeof obj === 'object'
}
/**
* Strict object type check. Only returns true
* for plain JavaScript objects.
*/
var toString = Object.prototype.toString;
var OBJECT_STRING = '[object Object]';
function isPlainObject (obj) {
return toString.call(obj) === OBJECT_STRING
}
/**
* Merge an Array of Objects into a single Object.
*/
function toObject (arr) {
var res = {};
for (var i = 0; i < arr.length; i++) {
if (arr[i]) {
extend(res, arr[i]);
}
}
return res
}
/**
* Perform no operation.
*/
function noop () {}
/**
* Always return false.
*/
var no = function () { return false; };
/**
* Return same value
*/
var identity = function (_) { return _; };
/**
* Generate a static keys string from compiler modules.
*/
/**
* Check if two values are loosely equal - that is,
* if they are plain objects, do they have the same shape?
*/
function looseEqual (a, b) {
var isObjectA = isObject(a);
var isObjectB = isObject(b);
if (isObjectA && isObjectB) {
try {
return JSON.stringify(a) === JSON.stringify(b)
} catch (e) {
// possible circular reference
return a === b
}
} else if (!isObjectA && !isObjectB) {
return String(a) === String(b)
} else {
return false
}
}
function looseIndexOf (arr, val) {
for (var i = 0; i < arr.length; i++) {
if (looseEqual(arr[i], val)) { return i }
}
return -1
}
/**
* Ensure a function is called only once.
*/
function once (fn) {
var called = false;
return function () {
if (!called) {
called = true;
fn();
}
}
}
/* */
var config = {
/**
* Option merge strategies (used in core/util/options)
*/
optionMergeStrategies: Object.create(null),
/**
* Whether to suppress warnings.
*/
silent: false,
/**
* Show production mode tip message on boot?
*/
productionTip: process.env.NODE_ENV !== 'production',
/**
* Whether to enable devtools
*/
devtools: process.env.NODE_ENV !== 'production',
/**
* Whether to record perf
*/
performance: process.env.NODE_ENV !== 'production',
/**
* Error handler for watcher errors
*/
errorHandler: null,
/**
* Ignore certain custom elements
*/
ignoredElements: [],
/**
* Custom user key aliases for v-on
*/
keyCodes: Object.create(null),
/**
* Check if a tag is reserved so that it cannot be registered as a
* component. This is platform-dependent and may be overwritten.
*/
isReservedTag: no,
/**
* Check if a tag is an unknown element.
* Platform-dependent.
*/
isUnknownElement: no,
/**
* Get the namespace of an element
*/
getTagNamespace: noop,
/**
* Parse the real tag name for the specific platform.
*/
parsePlatformTagName: identity,
/**
* Check if an attribute must be bound using property, e.g. value
* Platform-dependent.
*/
mustUseProp: no,
/**
* List of asset types that a component can own.
*/
_assetTypes: [
'component',
'directive',
'filter'
],
/**
* List of lifecycle hooks.
*/
_lifecycleHooks: [
'beforeCreate',
'created',
'beforeMount',
'mounted',
'beforeUpdate',
'updated',
'beforeDestroy',
'destroyed',
'activated',
'deactivated'
],
/**
* Max circular updates allowed in a scheduler flush cycle.
*/
_maxUpdateCount: 100
};
/* */
/* globals MutationObserver */
// can we use __proto__?
var hasProto = '__proto__' in {};
// Browser environment sniffing
var inBrowser = typeof window !== 'undefined';
var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && /msie|trident/.test(UA);
var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isEdge = UA && UA.indexOf('edge/') > 0;
var isAndroid = UA && UA.indexOf('android') > 0;
var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
// this needs to be lazy-evaled because vue may be required before
// vue-server-renderer can set VUE_ENV
var _isServer;
var isServerRendering = function () {
if (_isServer === undefined) {
/* istanbul ignore if */
if (!inBrowser && typeof global !== 'undefined') {
// detect presence of vue-server-renderer and avoid
// Webpack shimming the process
_isServer = global['process'].env.VUE_ENV === 'server';
} else {
_isServer = false;
}
}
return _isServer
};
// detect devtools
var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
/* istanbul ignore next */
function isNative (Ctor) {
return /native code/.test(Ctor.toString())
}
var hasSymbol =
typeof Symbol !== 'undefined' && isNative(Symbol) &&
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys);
/**
* Defer a task to execute it asynchronously.
*/
var nextTick = (function () {
var callbacks = [];
var pending = false;
var timerFunc;
function nextTickHandler () {
pending = false;
var copies = callbacks.slice(0);
callbacks.length = 0;
for (var i = 0; i < copies.length; i++) {
copies[i]();
}
}
// the nextTick behavior leverages the microtask queue, which can be accessed
// via either native Promise.then or MutationObserver.
// MutationObserver has wider support, however it is seriously bugged in
// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
// completely stops working after triggering a few times... so, if native
// Promise is available, we will use it:
/* istanbul ignore if */
if (typeof Promise !== 'undefined' && isNative(Promise)) {
var p = Promise.resolve();
var logError = function (err) { console.error(err); };
timerFunc = function () {
p.then(nextTickHandler).catch(logError);
// in problematic UIWebViews, Promise.then doesn't completely break, but
// it can get stuck in a weird state where callbacks are pushed into the
// microtask queue but the queue isn't being flushed, until the browser
// needs to do some other work, e.g. handle a timer. Therefore we can
// "force" the microtask queue to be flushed by adding an empty timer.
if (isIOS) { setTimeout(noop); }
};
} else if (typeof MutationObserver !== 'undefined' && (
isNative(MutationObserver) ||
// PhantomJS and iOS 7.x
MutationObserver.toString() === '[object MutationObserverConstructor]'
)) {
// use MutationObserver where native Promise is not available,
// e.g. PhantomJS IE11, iOS7, Android 4.4
var counter = 1;
var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(String(counter));
observer.observe(textNode, {
characterData: true
});
timerFunc = function () {
counter = (counter + 1) % 2;
textNode.data = String(counter);
};
} else {
// fallback to setTimeout
/* istanbul ignore next */
timerFunc = function () {
setTimeout(nextTickHandler, 0);
};
}
return function queueNextTick (cb, ctx) {
var _resolve;
callbacks.push(function () {
if (cb) { cb.call(ctx); }
if (_resolve) { _resolve(ctx); }
});
if (!pending) {
pending = true;
timerFunc();
}
if (!cb && typeof Promise !== 'undefined') {
return new Promise(function (resolve) {
_resolve = resolve;
})
}
}
})();
var _Set;
/* istanbul ignore if */
if (typeof Set !== 'undefined' && isNative(Set)) {
// use native Set when available.
_Set = Set;
} else {
// a non-standard Set polyfill that only works with primitive keys.
_Set = (function () {
function Set () {
this.set = Object.create(null);
}
Set.prototype.has = function has (key) {
return this.set[key] === true
};
Set.prototype.add = function add (key) {
this.set[key] = true;
};
Set.prototype.clear = function clear () {
this.set = Object.create(null);
};
return Set;
}());
}
var perf;
if (process.env.NODE_ENV !== 'production') {
perf = inBrowser && window.performance;
if (perf && (!perf.mark || !perf.measure)) {
perf = undefined;
}
}
/* */
var emptyObject = Object.freeze({});
/**
* Check if a string starts with $ or _
*/
function isReserved (str) {
var c = (str + '').charCodeAt(0);
return c === 0x24 || c === 0x5F
}
/**
* Define a property.
*/
function def (obj, key, val, enumerable) {
Object.defineProperty(obj, key, {
value: val,
enumerable: !!enumerable,
writable: true,
configurable: true
});
}
/**
* Parse simple path.
*/
var bailRE = /[^\w.$]/;
function parsePath (path) {
if (bailRE.test(path)) {
return
}
var segments = path.split('.');
return function (obj) {
for (var i = 0; i < segments.length; i++) {
if (!obj) { return }
obj = obj[segments[i]];
}
return obj
}
}
var warn = noop;
var tip = noop;
var formatComponentName;
if (process.env.NODE_ENV !== 'production') {
var hasConsole = typeof console !== 'undefined';
var classifyRE = /(?:^|[-_])(\w)/g;
var classify = function (str) { return str
.replace(classifyRE, function (c) { return c.toUpperCase(); })
.replace(/[-_]/g, ''); };
warn = function (msg, vm) {
if (hasConsole && (!config.silent)) {
console.error("[Vue warn]: " + msg + " " + (
vm ? formatLocation(formatComponentName(vm)) : ''
));
}
};
tip = function (msg, vm) {
if (hasConsole && (!config.silent)) {
console.warn("[Vue tip]: " + msg + " " + (
vm ? formatLocation(formatComponentName(vm)) : ''
));
}
};
formatComponentName = function (vm, includeFile) {
if (vm.$root === vm) {
return '<Root>'
}
var name = vm._isVue
? vm.$options.name || vm.$options._componentTag
: vm.name;
var file = vm._isVue && vm.$options.__file;
if (!name && file) {
var match = file.match(/([^/\\]+)\.vue$/);
name = match && match[1];
}
return (
(name ? ("<" + (classify(name)) + ">") : "<Anonymous>") +
(file && includeFile !== false ? (" at " + file) : '')
)
};
var formatLocation = function (str) {
if (str === "<Anonymous>") {
str += " - use the \"name\" option for better debugging messages.";
}
return ("\n(found in " + str + ")")
};
}
/* */
var uid$1 = 0;
/**
* A dep is an observable that can have multiple
* directives subscribing to it.
*/
var Dep = function Dep () {
this.id = uid$1++;
this.subs = [];
};
Dep.prototype.addSub = function addSub (sub) {
this.subs.push(sub);
};
Dep.prototype.removeSub = function removeSub (sub) {
remove(this.subs, sub);
};
Dep.prototype.depend = function depend () {
if (Dep.target) {
Dep.target.addDep(this);
}
};
Dep.prototype.notify = function notify () {
// stabilize the subscriber list first
var subs = this.subs.slice();
for (var i = 0, l = subs.length; i < l; i++) {
subs[i].update();
}
};
// the current target watcher being evaluated.
// this is globally unique because there could be only one
// watcher being evaluated at any time.
Dep.target = null;
var targetStack = [];
function pushTarget (_target) {
if (Dep.target) { targetStack.push(Dep.target); }
Dep.target = _target;
}
function popTarget () {
Dep.target = targetStack.pop();
}
/*
* not type checking this file because flow doesn't play well with
* dynamically accessing methods on Array prototype
*/
var arrayProto = Array.prototype;
var arrayMethods = Object.create(arrayProto);[
'push',
'pop',
'shift',
'unshift',
'splice',
'sort',
'reverse'
]
.forEach(function (method) {
// cache original method
var original = arrayProto[method];
def(arrayMethods, method, function mutator () {
var arguments$1 = arguments;
// avoid leaking arguments:
// http://jsperf.com/closure-with-arguments
var i = arguments.length;
var args = new Array(i);
while (i--) {
args[i] = arguments$1[i];
}
var result = original.apply(this, args);
var ob = this.__ob__;
var inserted;
switch (method) {
case 'push':
inserted = args;
break
case 'unshift':
inserted = args;
break
case 'splice':
inserted = args.slice(2);
break
}
if (inserted) { ob.observeArray(inserted); }
// notify change
ob.dep.notify();
return result
});
});
/* */
var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
/**
* By default, when a reactive property is set, the new value is
* also converted to become reactive. However when passing down props,
* we don't want to force conversion because the value may be a nested value
* under a frozen data structure. Converting it would defeat the optimization.
*/
var observerState = {
shouldConvert: true,
isSettingProps: false
};
/**
* Observer class that are attached to each observed
* object. Once attached, the observer converts target
* object's property keys into getter/setters that
* collect dependencies and dispatches updates.
*/
var Observer = function Observer (value) {
this.value = value;
this.dep = new Dep();
this.vmCount = 0;
def(value, '__ob__', this);
if (Array.isArray(value)) {
var augment = hasProto
? protoAugment
: copyAugment;
augment(value, arrayMethods, arrayKeys);
this.observeArray(value);
} else {
this.walk(value);
}
};
/**
* Walk through each property and convert them into
* getter/setters. This method should only be called when
* value type is Object.
*/
Observer.prototype.walk = function walk (obj) {
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
defineReactive$$1(obj, keys[i], obj[keys[i]]);
}
};
/**
* Observe a list of Array items.
*/
Observer.prototype.observeArray = function observeArray (items) {
for (var i = 0, l = items.length; i < l; i++) {
observe(items[i]);
}
};
// helpers
/**
* Augment an target Object or Array by intercepting
* the prototype chain using __proto__
*/
function protoAugment (target, src) {
/* eslint-disable no-proto */
target.__proto__ = src;
/* eslint-enable no-proto */
}
/**
* Augment an target Object or Array by defining
* hidden properties.
*/
/* istanbul ignore next */
function copyAugment (target, src, keys) {
for (var i = 0, l = keys.length; i < l; i++) {
var key = keys[i];
def(target, key, src[key]);
}
}
/**
* Attempt to create an observer instance for a value,
* returns the new observer if successfully observed,
* or the existing observer if the value already has one.
*/
function observe (value, asRootData) {
if (!isObject(value)) {
return
}
var ob;
if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
ob = value.__ob__;
} else if (
observerState.shouldConvert &&
!isServerRendering() &&
(Array.isArray(value) || isPlainObject(value)) &&
Object.isExtensible(value) &&
!value._isVue
) {
ob = new Observer(value);
}
if (asRootData && ob) {
ob.vmCount++;
}
return ob
}
/**
* Define a reactive property on an Object.
*/
function defineReactive$$1 (
obj,
key,
val,
customSetter
) {
var dep = new Dep();
var property = Object.getOwnPropertyDescriptor(obj, key);
if (property && property.configurable === false) {
return
}
// cater for pre-defined getter/setters
var getter = property && property.get;
var setter = property && property.set;
var childOb = observe(val);
Object.defineProperty(obj, key, {
enumerable: true,
configurable: true,
get: function reactiveGetter () {
var value = getter ? getter.call(obj) : val;
if (Dep.target) {
dep.depend();
if (childOb) {
childOb.dep.depend();
}
if (Array.isArray(value)) {
dependArray(value);
}
}
return value
},
set: function reactiveSetter (newVal) {
var value = getter ? getter.call(obj) : val;
/* eslint-disable no-self-compare */
if (newVal === value || (newVal !== newVal && value !== value)) {
return
}
/* eslint-enable no-self-compare */
if (process.env.NODE_ENV !== 'production' && customSetter) {
customSetter();
}
if (setter) {
setter.call(obj, newVal);
} else {
val = newVal;
}
childOb = observe(newVal);
dep.notify();
}
});
}
/**
* Set a property on an object. Adds the new property and
* triggers change notification if the property doesn't
* already exist.
*/
function set (target, key, val) {
if (Array.isArray(target)) {
target.length = Math.max(target.length, key);
target.splice(key, 1, val);
return val
}
if (hasOwn(target, key)) {
target[key] = val;
return val
}
var ob = target.__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid adding reactive properties to a Vue instance or its root $data ' +
'at runtime - declare it upfront in the data option.'
);
return val
}
if (!ob) {
target[key] = val;
return val
}
defineReactive$$1(ob.value, key, val);
ob.dep.notify();
return val
}
/**
* Delete a property and trigger change if necessary.
*/
function del (target, key) {
if (Array.isArray(target)) {
target.splice(key, 1);
return
}
var ob = target.__ob__;
if (target._isVue || (ob && ob.vmCount)) {
process.env.NODE_ENV !== 'production' && warn(
'Avoid deleting properties on a Vue instance or its root $data ' +
'- just set it to null.'
);
return
}
if (!hasOwn(target, key)) {
return
}
delete target[key];
if (!ob) {
return
}
ob.dep.notify();
}
/**
* Collect dependencies on array elements when the array is touched, since
* we cannot intercept array element access like property getters.
*/
function dependArray (value) {
for (var e = (void 0), i = 0, l = value.length; i < l; i++) {
e = value[i];
e && e.__ob__ && e.__ob__.dep.depend();
if (Array.isArray(e)) {
dependArray(e);
}
}
}
/* */
/**
* Option overwriting strategies are functions that handle
* how to merge a parent option value and a child option
* value into the final value.
*/
var strats = config.optionMergeStrategies;
/**
* Options with restrictions
*/
if (process.env.NODE_ENV !== 'production') {
strats.el = strats.propsData = function (parent, child, vm, key) {
if (!vm) {
warn(
"option \"" + key + "\" can only be used during instance " +
'creation with the `new` keyword.'
);
}
return defaultStrat(parent, child)
};
}
/**
* Helper that recursively merges two data objects together.
*/
function mergeData (to, from) {
if (!from) { return to }
var key, toVal, fromVal;
var keys = Object.keys(from);
for (var i = 0; i < keys.length; i++) {
key = keys[i];
toVal = to[key];
fromVal = from[key];
if (!hasOwn(to, key)) {
set(to, key, fromVal);
} else if (isPlainObject(toVal) && isPlainObject(fromVal)) {
mergeData(toVal, fromVal);
}
}
return to
}
/**
* Data
*/
strats.data = function (
parentVal,
childVal,
vm
) {
if (!vm) {
// in a Vue.extend merge, both should be functions
if (!childVal) {
return parentVal
}
if (typeof childVal !== 'function') {
process.env.NODE_ENV !== 'production' && warn(
'The "data" option should be a function ' +
'that returns a per-instance value in component ' +
'definitions.',
vm
);
return parentVal
}
if (!parentVal) {
return childVal
}
// when parentVal & childVal are both present,
// we need to return a function that returns the
// merged result of both functions... no need to
// check if parentVal is a function here because
// it has to be a function to pass previous merges.
return function mergedDataFn () {
return mergeData(
childVal.call(this),
parentVal.call(this)
)
}
} else if (parentVal || childVal) {
return function mergedInstanceDataFn () {
// instance merge
var instanceData = typeof childVal === 'function'
? childVal.call(vm)
: childVal;
var defaultData = typeof parentVal === 'function'
? parentVal.call(vm)
: undefined;
if (instanceData) {
return mergeData(instanceData, defaultData)
} else {
return defaultData
}
}
}
};
/**
* Hooks and props are merged as arrays.
*/
function mergeHook (
parentVal,
childVal
) {
return childVal
? parentVal
? parentVal.concat(childVal)
: Array.isArray(childVal)
? childVal
: [childVal]
: parentVal
}
config._lifecycleHooks.forEach(function (hook) {
strats[hook] = mergeHook;
});
/**
* Assets
*
* When a vm is present (instance creation), we need to do
* a three-way merge between constructor options, instance
* options and parent options.
*/
function mergeAssets (parentVal, childVal) {
var res = Object.create(parentVal || null);
return childVal
? extend(res, childVal)
: res
}
config._assetTypes.forEach(function (type) {
strats[type + 's'] = mergeAssets;
});
/**
* Watchers.
*
* Watchers hashes should not overwrite one
* another, so we merge them as arrays.
*/
strats.watch = function (parentVal, childVal) {
/* istanbul ignore if */
if (!childVal) { return Object.create(parentVal || null) }
if (!parentVal) { return childVal }
var ret = {};
extend(ret, parentVal);
for (var key in childVal) {
var parent = ret[key];
var child = childVal[key];
if (parent && !Array.isArray(parent)) {
parent = [parent];
}
ret[key] = parent
? parent.concat(child)
: [child];
}
return ret
};
/**
* Other object hashes.
*/
strats.props =
strats.methods =
strats.computed = function (parentVal, childVal) {
if (!childVal) { return Object.create(parentVal || null) }
if (!parentVal) { return childVal }
var ret = Object.create(null);
extend(ret, parentVal);
extend(ret, childVal);
return ret
};
/**
* Default strategy.
*/
var defaultStrat = function (parentVal, childVal) {
return childVal === undefined
? parentVal
: childVal
};
/**
* Validate component names
*/
function checkComponents (options) {
for (var key in options.components) {
var lower = key.toLowerCase();
if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + key
);
}
}
}
/**
* Ensure all props option syntax are normalized into the
* Object-based format.
*/
function normalizeProps (options) {
var props = options.props;
if (!props) { return }
var res = {};
var i, val, name;
if (Array.isArray(props)) {
i = props.length;
while (i--) {
val = props[i];
if (typeof val === 'string') {
name = camelize(val);
res[name] = { type: null };
} else if (process.env.NODE_ENV !== 'production') {
warn('props must be strings when using array syntax.');
}
}
} else if (isPlainObject(props)) {
for (var key in props) {
val = props[key];
name = camelize(key);
res[name] = isPlainObject(val)
? val
: { type: val };
}
}
options.props = res;
}
/**
* Normalize raw function directives into object format.
*/
function normalizeDirectives (options) {
var dirs = options.directives;
if (dirs) {
for (var key in dirs) {
var def = dirs[key];
if (typeof def === 'function') {
dirs[key] = { bind: def, update: def };
}
}
}
}
/**
* Merge two option objects into a new one.
* Core utility used in both instantiation and inheritance.
*/
function mergeOptions (
parent,
child,
vm
) {
if (process.env.NODE_ENV !== 'production') {
checkComponents(child);
}
normalizeProps(child);
normalizeDirectives(child);
var extendsFrom = child.extends;
if (extendsFrom) {
parent = typeof extendsFrom === 'function'
? mergeOptions(parent, extendsFrom.options, vm)
: mergeOptions(parent, extendsFrom, vm);
}
if (child.mixins) {
for (var i = 0, l = child.mixins.length; i < l; i++) {
var mixin = child.mixins[i];
if (mixin.prototype instanceof Vue$2) {
mixin = mixin.options;
}
parent = mergeOptions(parent, mixin, vm);
}
}
var options = {};
var key;
for (key in parent) {
mergeField(key);
}
for (key in child) {
if (!hasOwn(parent, key)) {
mergeField(key);
}
}
function mergeField (key) {
var strat = strats[key] || defaultStrat;
options[key] = strat(parent[key], child[key], vm, key);
}
return options
}
/**
* Resolve an asset.
* This function is used because child instances need access
* to assets defined in its ancestor chain.
*/
function resolveAsset (
options,
type,
id,
warnMissing
) {
/* istanbul ignore if */
if (typeof id !== 'string') {
return
}
var assets = options[type];
// check local registration variations first
if (hasOwn(assets, id)) { return assets[id] }
var camelizedId = camelize(id);
if (hasOwn(assets, camelizedId)) { return assets[camelizedId] }
var PascalCaseId = capitalize(camelizedId);
if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] }
// fallback to prototype chain
var res = assets[id] || assets[camelizedId] || assets[PascalCaseId];
if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
warn(
'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
options
);
}
return res
}
/* */
function validateProp (
key,
propOptions,
propsData,
vm
) {
var prop = propOptions[key];
var absent = !hasOwn(propsData, key);
var value = propsData[key];
// handle boolean props
if (isType(Boolean, prop.type)) {
if (absent && !hasOwn(prop, 'default')) {
value = false;
} else if (!isType(String, prop.type) && (value === '' || value === hyphenate(key))) {
value = true;
}
}
// check default value
if (value === undefined) {
value = getPropDefaultValue(vm, prop, key);
// since the default value is a fresh copy,
// make sure to observe it.
var prevShouldConvert = observerState.shouldConvert;
observerState.shouldConvert = true;
observe(value);
observerState.shouldConvert = prevShouldConvert;
}
if (process.env.NODE_ENV !== 'production') {
assertProp(prop, key, value, vm, absent);
}
return value
}
/**
* Get the default value of a prop.
*/
function getPropDefaultValue (vm, prop, key) {
// no default, return undefined
if (!hasOwn(prop, 'default')) {
return undefined
}
var def = prop.default;
// warn against non-factory defaults for Object & Array
if (process.env.NODE_ENV !== 'production' && isObject(def)) {
warn(
'Invalid default value for prop "' + key + '": ' +
'Props with type Object/Array must use a factory function ' +
'to return the default value.',
vm
);
}
// the raw prop value was also undefined from previous render,
// return previous default value to avoid unnecessary watcher trigger
if (vm && vm.$options.propsData &&
vm.$options.propsData[key] === undefined &&
vm._props[key] !== undefined) {
return vm._props[key]
}
// call factory function for non-Function types
// a value is Function if its prototype is function even across different execution context
return typeof def === 'function' && getType(prop.type) !== 'Function'
? def.call(vm)
: def
}
/**
* Assert whether a prop is valid.
*/
function assertProp (
prop,
name,
value,
vm,
absent
) {
if (prop.required && absent) {
warn(
'Missing required prop: "' + name + '"',
vm
);
return
}
if (value == null && !prop.required) {
return
}
var type = prop.type;
var valid = !type || type === true;
var expectedTypes = [];
if (type) {
if (!Array.isArray(type)) {
type = [type];
}
for (var i = 0; i < type.length && !valid; i++) {
var assertedType = assertType(value, type[i]);
expectedTypes.push(assertedType.expectedType || '');
valid = assertedType.valid;
}
}
if (!valid) {
warn(
'Invalid prop: type check failed for prop "' + name + '".' +
' Expected ' + expectedTypes.map(capitalize).join(', ') +
', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
vm
);
return
}
var validator = prop.validator;
if (validator) {
if (!validator(value)) {
warn(
'Invalid prop: custom validator check failed for prop "' + name + '".',
vm
);
}
}
}
/**
* Assert the type of a value
*/
function assertType (value, type) {
var valid;
var expectedType = getType(type);
if (expectedType === 'String') {
valid = typeof value === (expectedType = 'string');
} else if (expectedType === 'Number') {
valid = typeof value === (expectedType = 'number');
} else if (expectedType === 'Boolean') {
valid = typeof value === (expectedType = 'boolean');
} else if (expectedType === 'Function') {
valid = typeof value === (expectedType = 'function');
} else if (expectedType === 'Object') {
valid = isPlainObject(value);
} else if (expectedType === 'Array') {
valid = Array.isArray(value);
} else {
valid = value instanceof type;
}
return {
valid: valid,
expectedType: expectedType
}
}
/**
* Use function string name to check built-in types,
* because a simple equality check will fail when running
* across different vms / iframes.
*/
function getType (fn) {
var match = fn && fn.toString().match(/^\s*function (\w+)/);
return match && match[1]
}
function isType (type, fn) {
if (!Array.isArray(fn)) {
return getType(fn) === getType(type)
}
for (var i = 0, len = fn.length; i < len; i++) {
if (getType(fn[i]) === getType(type)) {
return true
}
}
/* istanbul ignore next */
return false
}
function handleError (err, vm, info) {
if (config.errorHandler) {
config.errorHandler.call(null, err, vm, info);
} else {
if (process.env.NODE_ENV !== 'production') {
warn(("Error in " + info + ":"), vm);
}
/* istanbul ignore else */
if (inBrowser && typeof console !== 'undefined') {
console.error(err);
} else {
throw err
}
}
}
/* not type checking this file because flow doesn't play well with Proxy */
var initProxy;
if (process.env.NODE_ENV !== 'production') {
var allowedGlobals = makeMap(
'Infinity,undefined,NaN,isFinite,isNaN,' +
'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
'require' // for Webpack/Browserify
);
var warnNonPresent = function (target, key) {
warn(
"Property or method \"" + key + "\" is not defined on the instance but " +
"referenced during render. Make sure to declare reactive data " +
"properties in the data option.",
target
);
};
var hasProxy =
typeof Proxy !== 'undefined' &&
Proxy.toString().match(/native code/);
if (hasProxy) {
var isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta');
config.keyCodes = new Proxy(config.keyCodes, {
set: function set (target, key, value) {
if (isBuiltInModifier(key)) {
warn(("Avoid overwriting built-in modifier in config.keyCodes: ." + key));
return false
} else {
target[key] = value;
return true
}
}
});
}
var hasHandler = {
has: function has (target, key) {
var has = key in target;
var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
if (!has && !isAllowed) {
warnNonPresent(target, key);
}
return has || !isAllowed
}
};
var getHandler = {
get: function get (target, key) {
if (typeof key === 'string' && !(key in target)) {
warnNonPresent(target, key);
}
return target[key]
}
};
initProxy = function initProxy (vm) {
if (hasProxy) {
// determine which proxy handler to use
var options = vm.$options;
var handlers = options.render && options.render._withStripped
? getHandler
: hasHandler;
vm._renderProxy = new Proxy(vm, handlers);
} else {
vm._renderProxy = vm;
}
};
}
/* */
var VNode = function VNode (
tag,
data,
children,
text,
elm,
context,
componentOptions
) {
this.tag = tag;
this.data = data;
this.children = children;
this.text = text;
this.elm = elm;
this.ns = undefined;
this.context = context;
this.functionalContext = undefined;
this.key = data && data.key;
this.componentOptions = componentOptions;
this.componentInstance = undefined;
this.parent = undefined;
this.raw = false;
this.isStatic = false;
this.isRootInsert = true;
this.isComment = false;
this.isCloned = false;
this.isOnce = false;
};
var prototypeAccessors = { child: {} };
// DEPRECATED: alias for componentInstance for backwards compat.
/* istanbul ignore next */
prototypeAccessors.child.get = function () {
return this.componentInstance
};
Object.defineProperties( VNode.prototype, prototypeAccessors );
var createEmptyVNode = function () {
var node = new VNode();
node.text = '';
node.isComment = true;
return node
};
function createTextVNode (val) {
return new VNode(undefined, undefined, undefined, String(val))
}
// optimized shallow clone
// used for static nodes and slot nodes because they may be reused across
// multiple renders, cloning them avoids errors when DOM manipulations rely
// on their elm reference.
function cloneVNode (vnode) {
var cloned = new VNode(
vnode.tag,
vnode.data,
vnode.children,
vnode.text,
vnode.elm,
vnode.context,
vnode.componentOptions
);
cloned.ns = vnode.ns;
cloned.isStatic = vnode.isStatic;
cloned.key = vnode.key;
cloned.isCloned = true;
return cloned
}
function cloneVNodes (vnodes) {
var len = vnodes.length;
var res = new Array(len);
for (var i = 0; i < len; i++) {
res[i] = cloneVNode(vnodes[i]);
}
return res
}
/* */
var normalizeEvent = cached(function (name) {
var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first
name = once$$1 ? name.slice(1) : name;
var capture = name.charAt(0) === '!';
name = capture ? name.slice(1) : name;
return {
name: name,
once: once$$1,
capture: capture
}
});
function createFnInvoker (fns) {
function invoker () {
var arguments$1 = arguments;
var fns = invoker.fns;
if (Array.isArray(fns)) {
for (var i = 0; i < fns.length; i++) {
fns[i].apply(null, arguments$1);
}
} else {
// return handler return value for single handlers
return fns.apply(null, arguments)
}
}
invoker.fns = fns;
return invoker
}
function updateListeners (
on,
oldOn,
add,
remove$$1,
vm
) {
var name, cur, old, event;
for (name in on) {
cur = on[name];
old = oldOn[name];
event = normalizeEvent(name);
if (!cur) {
process.env.NODE_ENV !== 'production' && warn(
"Invalid handler for event \"" + (event.name) + "\": got " + String(cur),
vm
);
} else if (!old) {
if (!cur.fns) {
cur = on[name] = createFnInvoker(cur);
}
add(event.name, cur, event.once, event.capture);
} else if (cur !== old) {
old.fns = cur;
on[name] = old;
}
}
for (name in oldOn) {
if (!on[name]) {
event = normalizeEvent(name);
remove$$1(event.name, oldOn[name], event.capture);
}
}
}
/* */
function mergeVNodeHook (def, hookKey, hook) {
var invoker;
var oldHook = def[hookKey];
function wrappedHook () {
hook.apply(this, arguments);
// important: remove merged hook to ensure it's called only once
// and prevent memory leak
remove(invoker.fns, wrappedHook);
}
if (!oldHook) {
// no existing hook
invoker = createFnInvoker([wrappedHook]);
} else {
/* istanbul ignore if */
if (oldHook.fns && oldHook.merged) {
// already a merged invoker
invoker = oldHook;
invoker.fns.push(wrappedHook);
} else {
// existing plain hook
invoker = createFnInvoker([oldHook, wrappedHook]);
}
}
invoker.merged = true;
def[hookKey] = invoker;
}
/* */
// The template compiler attempts to minimize the need for normalization by
// statically analyzing the template at compile time.
//
// For plain HTML markup, normalization can be completely skipped because the
// generated render function is guaranteed to return Array<VNode>. There are
// two cases where extra normalization is needed:
// 1. When the children contains components - because a functional component
// may return an Array instead of a single root. In this case, just a simple
// normalization is needed - if any child is an Array, we flatten the whole
// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep
// because functional components already normalize their own children.
function simpleNormalizeChildren (children) {
for (var i = 0; i < children.length; i++) {
if (Array.isArray(children[i])) {
return Array.prototype.concat.apply([], children)
}
}
return children
}
// 2. When the children contains constructs that always generated nested Arrays,
// e.g. <template>, <slot>, v-for, or when the children is provided by user
// with hand-written render functions / JSX. In such cases a full normalization
// is needed to cater to all possible types of children values.
function normalizeChildren (children) {
return isPrimitive(children)
? [createTextVNode(children)]
: Array.isArray(children)
? normalizeArrayChildren(children)
: undefined
}
function normalizeArrayChildren (children, nestedIndex) {
var res = [];
var i, c, last;
for (i = 0; i < children.length; i++) {
c = children[i];
if (c == null || typeof c === 'boolean') { continue }
last = res[res.length - 1];
// nested
if (Array.isArray(c)) {
res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
} else if (isPrimitive(c)) {
if (last && last.text) {
last.text += String(c);
} else if (c !== '') {
// convert primitive to vnode
res.push(createTextVNode(c));
}
} else {
if (c.text && last && last.text) {
res[res.length - 1] = createTextVNode(last.text + c.text);
} else {
// default key for nested array children (likely generated by v-for)
if (c.tag && c.key == null && nestedIndex != null) {
c.key = "__vlist" + nestedIndex + "_" + i + "__";
}
res.push(c);
}
}
}
return res
}
/* */
function getFirstComponentChild (children) {
return children && children.filter(function (c) { return c && c.componentOptions; })[0]
}
/* */
function initEvents (vm) {
vm._events = Object.create(null);
vm._hasHookEvent = false;
// init parent attached events
var listeners = vm.$options._parentListeners;
if (listeners) {
updateComponentListeners(vm, listeners);
}
}
var target;
function add (event, fn, once$$1) {
if (once$$1) {
target.$once(event, fn);
} else {
target.$on(event, fn);
}
}
function remove$1 (event, fn) {
target.$off(event, fn);
}
function updateComponentListeners (
vm,
listeners,
oldListeners
) {
target = vm;
updateListeners(listeners, oldListeners || {}, add, remove$1, vm);
}
function eventsMixin (Vue) {
var hookRE = /^hook:/;
Vue.prototype.$on = function (event, fn) {
var this$1 = this;
var vm = this;
if (Array.isArray(event)) {
for (var i = 0, l = event.length; i < l; i++) {
this$1.$on(event[i], fn);
}
} else {
(vm._events[event] || (vm._events[event] = [])).push(fn);
// optimize hook:event cost by using a boolean flag marked at registration
// instead of a hash lookup
if (hookRE.test(event)) {
vm._hasHookEvent = true;
}
}
return vm
};
Vue.prototype.$once = function (event, fn) {
var vm = this;
function on () {
vm.$off(event, on);
fn.apply(vm, arguments);
}
on.fn = fn;
vm.$on(event, on);
return vm
};
Vue.prototype.$off = function (event, fn) {
var this$1 = this;
var vm = this;
// all
if (!arguments.length) {
vm._events = Object.create(null);
return vm
}
// array of events
if (Array.isArray(event)) {
for (var i$1 = 0, l = event.length; i$1 < l; i$1++) {
this$1.$off(event[i$1], fn);
}
return vm
}
// specific event
var cbs = vm._events[event];
if (!cbs) {
return vm
}
if (arguments.length === 1) {
vm._events[event] = null;
return vm
}
// specific handler
var cb;
var i = cbs.length;
while (i--) {
cb = cbs[i];
if (cb === fn || cb.fn === fn) {
cbs.splice(i, 1);
break
}
}
return vm
};
Vue.prototype.$emit = function (event) {
var vm = this;
var cbs = vm._events[event];
if (cbs) {
cbs = cbs.length > 1 ? toArray(cbs) : cbs;
var args = toArray(arguments, 1);
for (var i = 0, l = cbs.length; i < l; i++) {
cbs[i].apply(vm, args);
}
}
return vm
};
}
/* */
/**
* Runtime helper for resolving raw children VNodes into a slot object.
*/
function resolveSlots (
children,
context
) {
var slots = {};
if (!children) {
return slots
}
var defaultSlot = [];
var name, child;
for (var i = 0, l = children.length; i < l; i++) {
child = children[i];
// named slots should only be respected if the vnode was rendered in the
// same context.
if ((child.context === context || child.functionalContext === context) &&
child.data && (name = child.data.slot)) {
var slot = (slots[name] || (slots[name] = []));
if (child.tag === 'template') {
slot.push.apply(slot, child.children);
} else {
slot.push(child);
}
} else {
defaultSlot.push(child);
}
}
// ignore whitespace
if (!defaultSlot.every(isWhitespace)) {
slots.default = defaultSlot;
}
return slots
}
function isWhitespace (node) {
return node.isComment || node.text === ' '
}
function resolveScopedSlots (
fns
) {
var res = {};
for (var i = 0; i < fns.length; i++) {
res[fns[i][0]] = fns[i][1];
}
return res
}
/* */
var activeInstance = null;
function initLifecycle (vm) {
var options = vm.$options;
// locate first non-abstract parent
var parent = options.parent;
if (parent && !options.abstract) {
while (parent.$options.abstract && parent.$parent) {
parent = parent.$parent;
}
parent.$children.push(vm);
}
vm.$parent = parent;
vm.$root = parent ? parent.$root : vm;
vm.$children = [];
vm.$refs = {};
vm._watcher = null;
vm._inactive = null;
vm._directInactive = false;
vm._isMounted = false;
vm._isDestroyed = false;
vm._isBeingDestroyed = false;
}
function lifecycleMixin (Vue) {
Vue.prototype._update = function (vnode, hydrating) {
var vm = this;
if (vm._isMounted) {
callHook(vm, 'beforeUpdate');
}
var prevEl = vm.$el;
var prevVnode = vm._vnode;
var prevActiveInstance = activeInstance;
activeInstance = vm;
vm._vnode = vnode;
// Vue.prototype.__patch__ is injected in entry points
// based on the rendering backend used.
if (!prevVnode) {
// initial render
vm.$el = vm.__patch__(
vm.$el, vnode, hydrating, false /* removeOnly */,
vm.$options._parentElm,
vm.$options._refElm
);
} else {
// updates
vm.$el = vm.__patch__(prevVnode, vnode);
}
activeInstance = prevActiveInstance;
// update __vue__ reference
if (prevEl) {
prevEl.__vue__ = null;
}
if (vm.$el) {
vm.$el.__vue__ = vm;
}
// if parent is an HOC, update its $el as well
if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
vm.$parent.$el = vm.$el;
}
// updated hook is called by the scheduler to ensure that children are
// updated in a parent's updated hook.
};
Vue.prototype.$forceUpdate = function () {
var vm = this;
if (vm._watcher) {
vm._watcher.update();
}
};
Vue.prototype.$destroy = function () {
var vm = this;
if (vm._isBeingDestroyed) {
return
}
callHook(vm, 'beforeDestroy');
vm._isBeingDestroyed = true;
// remove self from parent
var parent = vm.$parent;
if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
remove(parent.$children, vm);
}
// teardown watchers
if (vm._watcher) {
vm._watcher.teardown();
}
var i = vm._watchers.length;
while (i--) {
vm._watchers[i].teardown();
}
// remove reference from data ob
// frozen object may not have observer.
if (vm._data.__ob__) {
vm._data.__ob__.vmCount--;
}
// call the last hook...
vm._isDestroyed = true;
callHook(vm, 'destroyed');
// turn off all instance listeners.
vm.$off();
// remove __vue__ reference
if (vm.$el) {
vm.$el.__vue__ = null;
}
// invoke destroy hooks on current rendered tree
vm.__patch__(vm._vnode, null);
};
}
function mountComponent (
vm,
el,
hydrating
) {
vm.$el = el;
if (!vm.$options.render) {
vm.$options.render = createEmptyVNode;
if (process.env.NODE_ENV !== 'production') {
/* istanbul ignore if */
if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
vm.$options.el || el) {
warn(
'You are using the runtime-only build of Vue where the template ' +
'compiler is not available. Either pre-compile the templates into ' +
'render functions, or use the compiler-included build.',
vm
);
} else {
warn(
'Failed to mount component: template or render function not defined.',
vm
);
}
}
}
callHook(vm, 'beforeMount');
var updateComponent;
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && perf) {
updateComponent = function () {
var name = vm._name;
var startTag = "start " + name;
var endTag = "end " + name;
perf.mark(startTag);
var vnode = vm._render();
perf.mark(endTag);
perf.measure((name + " render"), startTag, endTag);
perf.mark(startTag);
vm._update(vnode, hydrating);
perf.mark(endTag);
perf.measure((name + " patch"), startTag, endTag);
};
} else {
updateComponent = function () {
vm._update(vm._render(), hydrating);
};
}
vm._watcher = new Watcher(vm, updateComponent, noop);
hydrating = false;
// manually mounted instance, call mounted on self
// mounted is called for render-created child components in its inserted hook
if (vm.$vnode == null) {
vm._isMounted = true;
callHook(vm, 'mounted');
}
return vm
}
function updateChildComponent (
vm,
propsData,
listeners,
parentVnode,
renderChildren
) {
// determine whether component has slot children
// we need to do this before overwriting $options._renderChildren
var hasChildren = !!(
renderChildren || // has new static slots
vm.$options._renderChildren || // has old static slots
parentVnode.data.scopedSlots || // has new scoped slots
vm.$scopedSlots !== emptyObject // has old scoped slots
);
vm.$options._parentVnode = parentVnode;
vm.$vnode = parentVnode; // update vm's placeholder node without re-render
if (vm._vnode) { // update child tree's parent
vm._vnode.parent = parentVnode;
}
vm.$options._renderChildren = renderChildren;
// update props
if (propsData && vm.$options.props) {
observerState.shouldConvert = false;
if (process.env.NODE_ENV !== 'production') {
observerState.isSettingProps = true;
}
var props = vm._props;
var propKeys = vm.$options._propKeys || [];
for (var i = 0; i < propKeys.length; i++) {
var key = propKeys[i];
props[key] = validateProp(key, vm.$options.props, propsData, vm);
}
observerState.shouldConvert = true;
if (process.env.NODE_ENV !== 'production') {
observerState.isSettingProps = false;
}
// keep a copy of raw propsData
vm.$options.propsData = propsData;
}
// update listeners
if (listeners) {
var oldListeners = vm.$options._parentListeners;
vm.$options._parentListeners = listeners;
updateComponentListeners(vm, listeners, oldListeners);
}
// resolve slots + force update if has children
if (hasChildren) {
vm.$slots = resolveSlots(renderChildren, parentVnode.context);
vm.$forceUpdate();
}
}
function isInInactiveTree (vm) {
while (vm && (vm = vm.$parent)) {
if (vm._inactive) { return true }
}
return false
}
function activateChildComponent (vm, direct) {
if (direct) {
vm._directInactive = false;
if (isInInactiveTree(vm)) {
return
}
} else if (vm._directInactive) {
return
}
if (vm._inactive || vm._inactive == null) {
vm._inactive = false;
for (var i = 0; i < vm.$children.length; i++) {
activateChildComponent(vm.$children[i]);
}
callHook(vm, 'activated');
}
}
function deactivateChildComponent (vm, direct) {
if (direct) {
vm._directInactive = true;
if (isInInactiveTree(vm)) {
return
}
}
if (!vm._inactive) {
vm._inactive = true;
for (var i = 0; i < vm.$children.length; i++) {
deactivateChildComponent(vm.$children[i]);
}
callHook(vm, 'deactivated');
}
}
function callHook (vm, hook) {
var handlers = vm.$options[hook];
if (handlers) {
for (var i = 0, j = handlers.length; i < j; i++) {
try {
handlers[i].call(vm);
} catch (e) {
handleError(e, vm, (hook + " hook"));
}
}
}
if (vm._hasHookEvent) {
vm.$emit('hook:' + hook);
}
}
/* */
var queue = [];
var has = {};
var circular = {};
var waiting = false;
var flushing = false;
var index = 0;
/**
* Reset the scheduler's state.
*/
function resetSchedulerState () {
queue.length = 0;
has = {};
if (process.env.NODE_ENV !== 'production') {
circular = {};
}
waiting = flushing = false;
}
/**
* Flush both queues and run the watchers.
*/
function flushSchedulerQueue () {
flushing = true;
var watcher, id, vm;
// Sort queue before flush.
// This ensures that:
// 1. Components are updated from parent to child. (because parent is always
// created before the child)
// 2. A component's user watchers are run before its render watcher (because
// user watchers are created before the render watcher)
// 3. If a component is destroyed during a parent component's watcher run,
// its watchers can be skipped.
queue.sort(function (a, b) { return a.id - b.id; });
// do not cache length because more watchers might be pushed
// as we run existing watchers
for (index = 0; index < queue.length; index++) {
watcher = queue[index];
id = watcher.id;
has[id] = null;
watcher.run();
// in dev build, check and stop circular updates.
if (process.env.NODE_ENV !== 'production' && has[id] != null) {
circular[id] = (circular[id] || 0) + 1;
if (circular[id] > config._maxUpdateCount) {
warn(
'You may have an infinite update loop ' + (
watcher.user
? ("in watcher with expression \"" + (watcher.expression) + "\"")
: "in a component render function."
),
watcher.vm
);
break
}
}
}
// call updated hooks
index = queue.length;
while (index--) {
watcher = queue[index];
vm = watcher.vm;
if (vm._watcher === watcher && vm._isMounted) {
callHook(vm, 'updated');
}
}
// devtool hook
/* istanbul ignore if */
if (devtools && config.devtools) {
devtools.emit('flush');
}
resetSchedulerState();
}
/**
* Push a watcher into the watcher queue.
* Jobs with duplicate IDs will be skipped unless it's
* pushed when the queue is being flushed.
*/
function queueWatcher (watcher) {
var id = watcher.id;
if (has[id] == null) {
has[id] = true;
if (!flushing) {
queue.push(watcher);
} else {
// if already flushing, splice the watcher based on its id
// if already past its id, it will be run next immediately.
var i = queue.length - 1;
while (i >= 0 && queue[i].id > watcher.id) {
i--;
}
queue.splice(Math.max(i, index) + 1, 0, watcher);
}
// queue the flush
if (!waiting) {
waiting = true;
nextTick(flushSchedulerQueue);
}
}
}
/* */
var uid$2 = 0;
/**
* A watcher parses an expression, collects dependencies,
* and fires callback when the expression value changes.
* This is used for both the $watch() api and directives.
*/
var Watcher = function Watcher (
vm,
expOrFn,
cb,
options
) {
this.vm = vm;
vm._watchers.push(this);
// options
if (options) {
this.deep = !!options.deep;
this.user = !!options.user;
this.lazy = !!options.lazy;
this.sync = !!options.sync;
} else {
this.deep = this.user = this.lazy = this.sync = false;
}
this.cb = cb;
this.id = ++uid$2; // uid for batching
this.active = true;
this.dirty = this.lazy; // for lazy watchers
this.deps = [];
this.newDeps = [];
this.depIds = new _Set();
this.newDepIds = new _Set();
this.expression = process.env.NODE_ENV !== 'production'
? expOrFn.toString()
: '';
// parse expression for getter
if (typeof expOrFn === 'function') {
this.getter = expOrFn;
} else {
this.getter = parsePath(expOrFn);
if (!this.getter) {
this.getter = function () {};
process.env.NODE_ENV !== 'production' && warn(
"Failed watching path: \"" + expOrFn + "\" " +
'Watcher only accepts simple dot-delimited paths. ' +
'For full control, use a function instead.',
vm
);
}
}
this.value = this.lazy
? undefined
: this.get();
};
/**
* Evaluate the getter, and re-collect dependencies.
*/
Watcher.prototype.get = function get () {
pushTarget(this);
var value;
var vm = this.vm;
if (this.user) {
try {
value = this.getter.call(vm, vm);
} catch (e) {
handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
}
} else {
value = this.getter.call(vm, vm);
}
// "touch" every property so they are all tracked as
// dependencies for deep watching
if (this.deep) {
traverse(value);
}
popTarget();
this.cleanupDeps();
return value
};
/**
* Add a dependency to this directive.
*/
Watcher.prototype.addDep = function addDep (dep) {
var id = dep.id;
if (!this.newDepIds.has(id)) {
this.newDepIds.add(id);
this.newDeps.push(dep);
if (!this.depIds.has(id)) {
dep.addSub(this);
}
}
};
/**
* Clean up for dependency collection.
*/
Watcher.prototype.cleanupDeps = function cleanupDeps () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
var dep = this$1.deps[i];
if (!this$1.newDepIds.has(dep.id)) {
dep.removeSub(this$1);
}
}
var tmp = this.depIds;
this.depIds = this.newDepIds;
this.newDepIds = tmp;
this.newDepIds.clear();
tmp = this.deps;
this.deps = this.newDeps;
this.newDeps = tmp;
this.newDeps.length = 0;
};
/**
* Subscriber interface.
* Will be called when a dependency changes.
*/
Watcher.prototype.update = function update () {
/* istanbul ignore else */
if (this.lazy) {
this.dirty = true;
} else if (this.sync) {
this.run();
} else {
queueWatcher(this);
}
};
/**
* Scheduler job interface.
* Will be called by the scheduler.
*/
Watcher.prototype.run = function run () {
if (this.active) {
var value = this.get();
if (
value !== this.value ||
// Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may
// have mutated.
isObject(value) ||
this.deep
) {
// set new value
var oldValue = this.value;
this.value = value;
if (this.user) {
try {
this.cb.call(this.vm, value, oldValue);
} catch (e) {
handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
}
} else {
this.cb.call(this.vm, value, oldValue);
}
}
}
};
/**
* Evaluate the value of the watcher.
* This only gets called for lazy watchers.
*/
Watcher.prototype.evaluate = function evaluate () {
this.value = this.get();
this.dirty = false;
};
/**
* Depend on all deps collected by this watcher.
*/
Watcher.prototype.depend = function depend () {
var this$1 = this;
var i = this.deps.length;
while (i--) {
this$1.deps[i].depend();
}
};
/**
* Remove self from all dependencies' subscriber list.
*/
Watcher.prototype.teardown = function teardown () {
var this$1 = this;
if (this.active) {
// remove self from vm's watcher list
// this is a somewhat expensive operation so we skip it
// if the vm is being destroyed.
if (!this.vm._isBeingDestroyed) {
remove(this.vm._watchers, this);
}
var i = this.deps.length;
while (i--) {
this$1.deps[i].removeSub(this$1);
}
this.active = false;
}
};
/**
* Recursively traverse an object to evoke all converted
* getters, so that every nested property inside the object
* is collected as a "deep" dependency.
*/
var seenObjects = new _Set();
function traverse (val) {
seenObjects.clear();
_traverse(val, seenObjects);
}
function _traverse (val, seen) {
var i, keys;
var isA = Array.isArray(val);
if ((!isA && !isObject(val)) || !Object.isExtensible(val)) {
return
}
if (val.__ob__) {
var depId = val.__ob__.dep.id;
if (seen.has(depId)) {
return
}
seen.add(depId);
}
if (isA) {
i = val.length;
while (i--) { _traverse(val[i], seen); }
} else {
keys = Object.keys(val);
i = keys.length;
while (i--) { _traverse(val[keys[i]], seen); }
}
}
/* */
var sharedPropertyDefinition = {
enumerable: true,
configurable: true,
get: noop,
set: noop
};
function proxy (target, sourceKey, key) {
sharedPropertyDefinition.get = function proxyGetter () {
return this[sourceKey][key]
};
sharedPropertyDefinition.set = function proxySetter (val) {
this[sourceKey][key] = val;
};
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function initState (vm) {
vm._watchers = [];
var opts = vm.$options;
if (opts.props) { initProps(vm, opts.props); }
if (opts.methods) { initMethods(vm, opts.methods); }
if (opts.data) {
initData(vm);
} else {
observe(vm._data = {}, true /* asRootData */);
}
if (opts.computed) { initComputed(vm, opts.computed); }
if (opts.watch) { initWatch(vm, opts.watch); }
}
var isReservedProp = { key: 1, ref: 1, slot: 1 };
function initProps (vm, propsOptions) {
var propsData = vm.$options.propsData || {};
var props = vm._props = {};
// cache prop keys so that future props updates can iterate using Array
// instead of dynamic object key enumeration.
var keys = vm.$options._propKeys = [];
var isRoot = !vm.$parent;
// root instance props should be converted
observerState.shouldConvert = isRoot;
var loop = function ( key ) {
keys.push(key);
var value = validateProp(key, propsOptions, propsData, vm);
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
if (isReservedProp[key]) {
warn(
("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
vm
);
}
defineReactive$$1(props, key, value, function () {
if (vm.$parent && !observerState.isSettingProps) {
warn(
"Avoid mutating a prop directly since the value will be " +
"overwritten whenever the parent component re-renders. " +
"Instead, use a data or computed property based on the prop's " +
"value. Prop being mutated: \"" + key + "\"",
vm
);
}
});
} else {
defineReactive$$1(props, key, value);
}
// static props are already proxied on the component's prototype
// during Vue.extend(). We only need to proxy props defined at
// instantiation here.
if (!(key in vm)) {
proxy(vm, "_props", key);
}
};
for (var key in propsOptions) loop( key );
observerState.shouldConvert = true;
}
function initData (vm) {
var data = vm.$options.data;
data = vm._data = typeof data === 'function'
? data.call(vm)
: data || {};
if (!isPlainObject(data)) {
data = {};
process.env.NODE_ENV !== 'production' && warn(
'data functions should return an object:\n' +
'https://vuejs.org/v2/guide/components.html#data-Must-Be-a-Function',
vm
);
}
// proxy data on instance
var keys = Object.keys(data);
var props = vm.$options.props;
var i = keys.length;
while (i--) {
if (props && hasOwn(props, keys[i])) {
process.env.NODE_ENV !== 'production' && warn(
"The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
"Use prop default value instead.",
vm
);
} else if (!isReserved(keys[i])) {
proxy(vm, "_data", keys[i]);
}
}
// observe data
observe(data, true /* asRootData */);
}
var computedWatcherOptions = { lazy: true };
function initComputed (vm, computed) {
var watchers = vm._computedWatchers = Object.create(null);
for (var key in computed) {
var userDef = computed[key];
var getter = typeof userDef === 'function' ? userDef : userDef.get;
// create internal watcher for the computed property.
watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);
// component-defined computed properties are already defined on the
// component prototype. We only need to define computed properties defined
// at instantiation here.
if (!(key in vm)) {
defineComputed(vm, key, userDef);
}
}
}
function defineComputed (target, key, userDef) {
if (typeof userDef === 'function') {
sharedPropertyDefinition.get = createComputedGetter(key);
sharedPropertyDefinition.set = noop;
} else {
sharedPropertyDefinition.get = userDef.get
? userDef.cache !== false
? createComputedGetter(key)
: userDef.get
: noop;
sharedPropertyDefinition.set = userDef.set
? userDef.set
: noop;
}
Object.defineProperty(target, key, sharedPropertyDefinition);
}
function createComputedGetter (key) {
return function computedGetter () {
var watcher = this._computedWatchers && this._computedWatchers[key];
if (watcher) {
if (watcher.dirty) {
watcher.evaluate();
}
if (Dep.target) {
watcher.depend();
}
return watcher.value
}
}
}
function initMethods (vm, methods) {
var props = vm.$options.props;
for (var key in methods) {
vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
if (process.env.NODE_ENV !== 'production') {
if (methods[key] == null) {
warn(
"method \"" + key + "\" has an undefined value in the component definition. " +
"Did you reference the function correctly?",
vm
);
}
if (props && hasOwn(props, key)) {
warn(
("method \"" + key + "\" has already been defined as a prop."),
vm
);
}
}
}
}
function initWatch (vm, watch) {
for (var key in watch) {
var handler = watch[key];
if (Array.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
createWatcher(vm, key, handler[i]);
}
} else {
createWatcher(vm, key, handler);
}
}
}
function createWatcher (vm, key, handler) {
var options;
if (isPlainObject(handler)) {
options = handler;
handler = handler.handler;
}
if (typeof handler === 'string') {
handler = vm[handler];
}
vm.$watch(key, handler, options);
}
function stateMixin (Vue) {
// flow somehow has problems with directly declared definition object
// when using Object.defineProperty, so we have to procedurally build up
// the object here.
var dataDef = {};
dataDef.get = function () { return this._data };
var propsDef = {};
propsDef.get = function () { return this._props };
if (process.env.NODE_ENV !== 'production') {
dataDef.set = function (newData) {
warn(
'Avoid replacing instance root $data. ' +
'Use nested data properties instead.',
this
);
};
propsDef.set = function () {
warn("$props is readonly.", this);
};
}
Object.defineProperty(Vue.prototype, '$data', dataDef);
Object.defineProperty(Vue.prototype, '$props', propsDef);
Vue.prototype.$set = set;
Vue.prototype.$delete = del;
Vue.prototype.$watch = function (
expOrFn,
cb,
options
) {
var vm = this;
options = options || {};
options.user = true;
var watcher = new Watcher(vm, expOrFn, cb, options);
if (options.immediate) {
cb.call(vm, watcher.value);
}
return function unwatchFn () {
watcher.teardown();
}
};
}
/* */
var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy };
var hooksToMerge = Object.keys(hooks);
function createComponent (
Ctor,
data,
context,
children,
tag
) {
if (!Ctor) {
return
}
var baseCtor = context.$options._base;
if (isObject(Ctor)) {
Ctor = baseCtor.extend(Ctor);
}
if (typeof Ctor !== 'function') {
if (process.env.NODE_ENV !== 'production') {
warn(("Invalid Component definition: " + (String(Ctor))), context);
}
return
}
// async component
if (!Ctor.cid) {
if (Ctor.resolved) {
Ctor = Ctor.resolved;
} else {
Ctor = resolveAsyncComponent(Ctor, baseCtor, function () {
// it's ok to queue this on every render because
// $forceUpdate is buffered by the scheduler.
context.$forceUpdate();
});
if (!Ctor) {
// return nothing if this is indeed an async component
// wait for the callback to trigger parent update.
return
}
}
}
// resolve constructor options in case global mixins are applied after
// component constructor creation
resolveConstructorOptions(Ctor);
data = data || {};
// transform component v-model data into props & events
if (data.model) {
transformModel(Ctor.options, data);
}
// extract props
var propsData = extractProps(data, Ctor);
// functional component
if (Ctor.options.functional) {
return createFunctionalComponent(Ctor, propsData, data, context, children)
}
// extract listeners, since these needs to be treated as
// child component listeners instead of DOM listeners
var listeners = data.on;
// replace with listeners with .native modifier
data.on = data.nativeOn;
if (Ctor.options.abstract) {
// abstract components do not keep anything
// other than props & listeners
data = {};
}
// merge component management hooks onto the placeholder node
mergeHooks(data);
// return a placeholder vnode
var name = Ctor.options.name || tag;
var vnode = new VNode(
("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
data, undefined, undefined, undefined, context,
{ Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
);
return vnode
}
function createFunctionalComponent (
Ctor,
propsData,
data,
context,
children
) {
var props = {};
var propOptions = Ctor.options.props;
if (propOptions) {
for (var key in propOptions) {
props[key] = validateProp(key, propOptions, propsData);
}
}
// ensure the createElement function in functional components
// gets a unique context - this is necessary for correct named slot check
var _context = Object.create(context);
var h = function (a, b, c, d) { return createElement(_context, a, b, c, d, true); };
var vnode = Ctor.options.render.call(null, h, {
props: props,
data: data,
parent: context,
children: children,
slots: function () { return resolveSlots(children, context); }
});
if (vnode instanceof VNode) {
vnode.functionalContext = context;
if (data.slot) {
(vnode.data || (vnode.data = {})).slot = data.slot;
}
}
return vnode
}
function createComponentInstanceForVnode (
vnode, // we know it's MountedComponentVNode but flow doesn't
parent, // activeInstance in lifecycle state
parentElm,
refElm
) {
var vnodeComponentOptions = vnode.componentOptions;
var options = {
_isComponent: true,
parent: parent,
propsData: vnodeComponentOptions.propsData,
_componentTag: vnodeComponentOptions.tag,
_parentVnode: vnode,
_parentListeners: vnodeComponentOptions.listeners,
_renderChildren: vnodeComponentOptions.children,
_parentElm: parentElm || null,
_refElm: refElm || null
};
// check inline-template render functions
var inlineTemplate = vnode.data.inlineTemplate;
if (inlineTemplate) {
options.render = inlineTemplate.render;
options.staticRenderFns = inlineTemplate.staticRenderFns;
}
return new vnodeComponentOptions.Ctor(options)
}
function init (
vnode,
hydrating,
parentElm,
refElm
) {
if (!vnode.componentInstance || vnode.componentInstance._isDestroyed) {
var child = vnode.componentInstance = createComponentInstanceForVnode(
vnode,
activeInstance,
parentElm,
refElm
);
child.$mount(hydrating ? vnode.elm : undefined, hydrating);
} else if (vnode.data.keepAlive) {
// kept-alive components, treat as a patch
var mountedNode = vnode; // work around flow
prepatch(mountedNode, mountedNode);
}
}
function prepatch (
oldVnode,
vnode
) {
var options = vnode.componentOptions;
var child = vnode.componentInstance = oldVnode.componentInstance;
updateChildComponent(
child,
options.propsData, // updated props
options.listeners, // updated listeners
vnode, // new parent vnode
options.children // new children
);
}
function insert (vnode) {
if (!vnode.componentInstance._isMounted) {
vnode.componentInstance._isMounted = true;
callHook(vnode.componentInstance, 'mounted');
}
if (vnode.data.keepAlive) {
activateChildComponent(vnode.componentInstance, true /* direct */);
}
}
function destroy (vnode) {
if (!vnode.componentInstance._isDestroyed) {
if (!vnode.data.keepAlive) {
vnode.componentInstance.$destroy();
} else {
deactivateChildComponent(vnode.componentInstance, true /* direct */);
}
}
}
function resolveAsyncComponent (
factory,
baseCtor,
cb
) {
if (factory.requested) {
// pool callbacks
factory.pendingCallbacks.push(cb);
} else {
factory.requested = true;
var cbs = factory.pendingCallbacks = [cb];
var sync = true;
var resolve = function (res) {
if (isObject(res)) {
res = baseCtor.extend(res);
}
// cache resolved
factory.resolved = res;
// invoke callbacks only if this is not a synchronous resolve
// (async resolves are shimmed as synchronous during SSR)
if (!sync) {
for (var i = 0, l = cbs.length; i < l; i++) {
cbs[i](res);
}
}
};
var reject = function (reason) {
process.env.NODE_ENV !== 'production' && warn(
"Failed to resolve async component: " + (String(factory)) +
(reason ? ("\nReason: " + reason) : '')
);
};
var res = factory(resolve, reject);
// handle promise
if (res && typeof res.then === 'function' && !factory.resolved) {
res.then(resolve, reject);
}
sync = false;
// return in case resolved synchronously
return factory.resolved
}
}
function extractProps (data, Ctor) {
// we are only extracting raw values here.
// validation and default values are handled in the child
// component itself.
var propOptions = Ctor.options.props;
if (!propOptions) {
return
}
var res = {};
var attrs = data.attrs;
var props = data.props;
var domProps = data.domProps;
if (attrs || props || domProps) {
for (var key in propOptions) {
var altKey = hyphenate(key);
checkProp(res, props, key, altKey, true) ||
checkProp(res, attrs, key, altKey) ||
checkProp(res, domProps, key, altKey);
}
}
return res
}
function checkProp (
res,
hash,
key,
altKey,
preserve
) {
if (hash) {
if (hasOwn(hash, key)) {
res[key] = hash[key];
if (!preserve) {
delete hash[key];
}
return true
} else if (hasOwn(hash, altKey)) {
res[key] = hash[altKey];
if (!preserve) {
delete hash[altKey];
}
return true
}
}
return false
}
function mergeHooks (data) {
if (!data.hook) {
data.hook = {};
}
for (var i = 0; i < hooksToMerge.length; i++) {
var key = hooksToMerge[i];
var fromParent = data.hook[key];
var ours = hooks[key];
data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
}
}
function mergeHook$1 (one, two) {
return function (a, b, c, d) {
one(a, b, c, d);
two(a, b, c, d);
}
}
// transform component v-model info (value and callback) into
// prop and event handler respectively.
function transformModel (options, data) {
var prop = (options.model && options.model.prop) || 'value';
var event = (options.model && options.model.event) || 'input';(data.props || (data.props = {}))[prop] = data.model.value;
var on = data.on || (data.on = {});
if (on[event]) {
on[event] = [data.model.callback].concat(on[event]);
} else {
on[event] = data.model.callback;
}
}
/* */
var SIMPLE_NORMALIZE = 1;
var ALWAYS_NORMALIZE = 2;
// wrapper function for providing a more flexible interface
// without getting yelled at by flow
function createElement (
context,
tag,
data,
children,
normalizationType,
alwaysNormalize
) {
if (Array.isArray(data) || isPrimitive(data)) {
normalizationType = children;
children = data;
data = undefined;
}
if (alwaysNormalize) { normalizationType = ALWAYS_NORMALIZE; }
return _createElement(context, tag, data, children, normalizationType)
}
function _createElement (
context,
tag,
data,
children,
normalizationType
) {
if (data && data.__ob__) {
process.env.NODE_ENV !== 'production' && warn(
"Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
'Always create fresh vnode data objects in each render!',
context
);
return createEmptyVNode()
}
if (!tag) {
// in case of component :is set to falsy value
return createEmptyVNode()
}
// support single function children as default scoped slot
if (Array.isArray(children) &&
typeof children[0] === 'function') {
data = data || {};
data.scopedSlots = { default: children[0] };
children.length = 0;
}
if (normalizationType === ALWAYS_NORMALIZE) {
children = normalizeChildren(children);
} else if (normalizationType === SIMPLE_NORMALIZE) {
children = simpleNormalizeChildren(children);
}
var vnode, ns;
if (typeof tag === 'string') {
var Ctor;
ns = config.getTagNamespace(tag);
if (config.isReservedTag(tag)) {
// platform built-in elements
vnode = new VNode(
config.parsePlatformTagName(tag), data, children,
undefined, undefined, context
);
} else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
// component
vnode = createComponent(Ctor, data, context, children, tag);
} else {
// unknown or unlisted namespaced elements
// check at runtime because it may get assigned a namespace when its
// parent normalizes children
vnode = new VNode(
tag, data, children,
undefined, undefined, context
);
}
} else {
// direct component options / constructor
vnode = createComponent(tag, data, context, children);
}
if (vnode) {
if (ns) { applyNS(vnode, ns); }
return vnode
} else {
return createEmptyVNode()
}
}
function applyNS (vnode, ns) {
vnode.ns = ns;
if (vnode.tag === 'foreignObject') {
// use default namespace inside foreignObject
return
}
if (vnode.children) {
for (var i = 0, l = vnode.children.length; i < l; i++) {
var child = vnode.children[i];
if (child.tag && !child.ns) {
applyNS(child, ns);
}
}
}
}
/* */
/**
* Runtime helper for rendering v-for lists.
*/
function renderList (
val,
render
) {
var ret, i, l, keys, key;
if (Array.isArray(val) || typeof val === 'string') {
ret = new Array(val.length);
for (i = 0, l = val.length; i < l; i++) {
ret[i] = render(val[i], i);
}
} else if (typeof val === 'number') {
ret = new Array(val);
for (i = 0; i < val; i++) {
ret[i] = render(i + 1, i);
}
} else if (isObject(val)) {
keys = Object.keys(val);
ret = new Array(keys.length);
for (i = 0, l = keys.length; i < l; i++) {
key = keys[i];
ret[i] = render(val[key], key, i);
}
}
return ret
}
/* */
/**
* Runtime helper for rendering <slot>
*/
function renderSlot (
name,
fallback,
props,
bindObject
) {
var scopedSlotFn = this.$scopedSlots[name];
if (scopedSlotFn) { // scoped slot
props = props || {};
if (bindObject) {
extend(props, bindObject);
}
return scopedSlotFn(props) || fallback
} else {
var slotNodes = this.$slots[name];
// warn duplicate slot usage
if (slotNodes && process.env.NODE_ENV !== 'production') {
slotNodes._rendered && warn(
"Duplicate presence of slot \"" + name + "\" found in the same render tree " +
"- this will likely cause render errors.",
this
);
slotNodes._rendered = true;
}
return slotNodes || fallback
}
}
/* */
/**
* Runtime helper for resolving filters
*/
function resolveFilter (id) {
return resolveAsset(this.$options, 'filters', id, true) || identity
}
/* */
/**
* Runtime helper for checking keyCodes from config.
*/
function checkKeyCodes (
eventKeyCode,
key,
builtInAlias
) {
var keyCodes = config.keyCodes[key] || builtInAlias;
if (Array.isArray(keyCodes)) {
return keyCodes.indexOf(eventKeyCode) === -1
} else {
return keyCodes !== eventKeyCode
}
}
/* */
/**
* Runtime helper for merging v-bind="object" into a VNode's data.
*/
function bindObjectProps (
data,
tag,
value,
asProp
) {
if (value) {
if (!isObject(value)) {
process.env.NODE_ENV !== 'production' && warn(
'v-bind without argument expects an Object or Array value',
this
);
} else {
if (Array.isArray(value)) {
value = toObject(value);
}
for (var key in value) {
if (key === 'class' || key === 'style') {
data[key] = value[key];
} else {
var type = data.attrs && data.attrs.type;
var hash = asProp || config.mustUseProp(tag, type, key)
? data.domProps || (data.domProps = {})
: data.attrs || (data.attrs = {});
hash[key] = value[key];
}
}
}
}
return data
}
/* */
/**
* Runtime helper for rendering static trees.
*/
function renderStatic (
index,
isInFor
) {
var tree = this._staticTrees[index];
// if has already-rendered static tree and not inside v-for,
// we can reuse the same tree by doing a shallow clone.
if (tree && !isInFor) {
return Array.isArray(tree)
? cloneVNodes(tree)
: cloneVNode(tree)
}
// otherwise, render a fresh tree.
tree = this._staticTrees[index] =
this.$options.staticRenderFns[index].call(this._renderProxy);
markStatic(tree, ("__static__" + index), false);
return tree
}
/**
* Runtime helper for v-once.
* Effectively it means marking the node as static with a unique key.
*/
function markOnce (
tree,
index,
key
) {
markStatic(tree, ("__once__" + index + (key ? ("_" + key) : "")), true);
return tree
}
function markStatic (
tree,
key,
isOnce
) {
if (Array.isArray(tree)) {
for (var i = 0; i < tree.length; i++) {
if (tree[i] && typeof tree[i] !== 'string') {
markStaticNode(tree[i], (key + "_" + i), isOnce);
}
}
} else {
markStaticNode(tree, key, isOnce);
}
}
function markStaticNode (node, key, isOnce) {
node.isStatic = true;
node.key = key;
node.isOnce = isOnce;
}
/* */
function initRender (vm) {
vm.$vnode = null; // the placeholder node in parent tree
vm._vnode = null; // the root of the child tree
vm._staticTrees = null;
var parentVnode = vm.$options._parentVnode;
var renderContext = parentVnode && parentVnode.context;
vm.$slots = resolveSlots(vm.$options._renderChildren, renderContext);
vm.$scopedSlots = emptyObject;
// bind the createElement fn to this instance
// so that we get proper render context inside it.
// args order: tag, data, children, normalizationType, alwaysNormalize
// internal version is used by render functions compiled from templates
vm._c = function (a, b, c, d) { return createElement(vm, a, b, c, d, false); };
// normalization is always applied for the public version, used in
// user-written render functions.
vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
}
function renderMixin (Vue) {
Vue.prototype.$nextTick = function (fn) {
return nextTick(fn, this)
};
Vue.prototype._render = function () {
var vm = this;
var ref = vm.$options;
var render = ref.render;
var staticRenderFns = ref.staticRenderFns;
var _parentVnode = ref._parentVnode;
if (vm._isMounted) {
// clone slot nodes on re-renders
for (var key in vm.$slots) {
vm.$slots[key] = cloneVNodes(vm.$slots[key]);
}
}
vm.$scopedSlots = (_parentVnode && _parentVnode.data.scopedSlots) || emptyObject;
if (staticRenderFns && !vm._staticTrees) {
vm._staticTrees = [];
}
// set parent vnode. this allows render functions to have access
// to the data on the placeholder node.
vm.$vnode = _parentVnode;
// render self
var vnode;
try {
vnode = render.call(vm._renderProxy, vm.$createElement);
} catch (e) {
handleError(e, vm, "render function");
// return error render result,
// or previous vnode to prevent render error causing blank component
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
vnode = vm.$options.renderError
? vm.$options.renderError.call(vm._renderProxy, vm.$createElement, e)
: vm._vnode;
} else {
vnode = vm._vnode;
}
}
// return empty vnode in case the render function errored out
if (!(vnode instanceof VNode)) {
if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
warn(
'Multiple root nodes returned from render function. Render function ' +
'should return a single root node.',
vm
);
}
vnode = createEmptyVNode();
}
// set parent
vnode.parent = _parentVnode;
return vnode
};
// internal render helpers.
// these are exposed on the instance prototype to reduce generated render
// code size.
Vue.prototype._o = markOnce;
Vue.prototype._n = toNumber;
Vue.prototype._s = _toString;
Vue.prototype._l = renderList;
Vue.prototype._t = renderSlot;
Vue.prototype._q = looseEqual;
Vue.prototype._i = looseIndexOf;
Vue.prototype._m = renderStatic;
Vue.prototype._f = resolveFilter;
Vue.prototype._k = checkKeyCodes;
Vue.prototype._b = bindObjectProps;
Vue.prototype._v = createTextVNode;
Vue.prototype._e = createEmptyVNode;
Vue.prototype._u = resolveScopedSlots;
}
/* */
function initProvide (vm) {
var provide = vm.$options.provide;
if (provide) {
vm._provided = typeof provide === 'function'
? provide.call(vm)
: provide;
}
}
function initInjections (vm) {
var inject = vm.$options.inject;
if (inject) {
// inject is :any because flow is not smart enough to figure out cached
// isArray here
var isArray = Array.isArray(inject);
var keys = isArray
? inject
: hasSymbol
? Reflect.ownKeys(inject)
: Object.keys(inject);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
var provideKey = isArray ? key : inject[key];
var source = vm;
while (source) {
if (source._provided && provideKey in source._provided) {
vm[key] = source._provided[provideKey];
break
}
source = source.$parent;
}
}
}
}
/* */
var uid = 0;
function initMixin (Vue) {
Vue.prototype._init = function (options) {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && perf) {
perf.mark('init');
}
var vm = this;
// a uid
vm._uid = uid++;
// a flag to avoid this being observed
vm._isVue = true;
// merge options
if (options && options._isComponent) {
// optimize internal component instantiation
// since dynamic options merging is pretty slow, and none of the
// internal component options needs special treatment.
initInternalComponent(vm, options);
} else {
vm.$options = mergeOptions(
resolveConstructorOptions(vm.constructor),
options || {},
vm
);
}
/* istanbul ignore else */
if (process.env.NODE_ENV !== 'production') {
initProxy(vm);
} else {
vm._renderProxy = vm;
}
// expose real self
vm._self = vm;
initLifecycle(vm);
initEvents(vm);
initRender(vm);
callHook(vm, 'beforeCreate');
initInjections(vm); // resolve injections before data/props
initState(vm);
initProvide(vm); // resolve provide after data/props
callHook(vm, 'created');
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && config.performance && perf) {
vm._name = formatComponentName(vm, false);
perf.mark('init end');
perf.measure(((vm._name) + " init"), 'init', 'init end');
}
if (vm.$options.el) {
vm.$mount(vm.$options.el);
}
};
}
function initInternalComponent (vm, options) {
var opts = vm.$options = Object.create(vm.constructor.options);
// doing this because it's faster than dynamic enumeration.
opts.parent = options.parent;
opts.propsData = options.propsData;
opts._parentVnode = options._parentVnode;
opts._parentListeners = options._parentListeners;
opts._renderChildren = options._renderChildren;
opts._componentTag = options._componentTag;
opts._parentElm = options._parentElm;
opts._refElm = options._refElm;
if (options.render) {
opts.render = options.render;
opts.staticRenderFns = options.staticRenderFns;
}
}
function resolveConstructorOptions (Ctor) {
var options = Ctor.options;
if (Ctor.super) {
var superOptions = resolveConstructorOptions(Ctor.super);
var cachedSuperOptions = Ctor.superOptions;
if (superOptions !== cachedSuperOptions) {
// super option changed,
// need to resolve new options.
Ctor.superOptions = superOptions;
// check if there are any late-modified/attached options (#4976)
var modifiedOptions = resolveModifiedOptions(Ctor);
// update base extend options
if (modifiedOptions) {
extend(Ctor.extendOptions, modifiedOptions);
}
options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
if (options.name) {
options.components[options.name] = Ctor;
}
}
}
return options
}
function resolveModifiedOptions (Ctor) {
var modified;
var latest = Ctor.options;
var sealed = Ctor.sealedOptions;
for (var key in latest) {
if (latest[key] !== sealed[key]) {
if (!modified) { modified = {}; }
modified[key] = dedupe(latest[key], sealed[key]);
}
}
return modified
}
function dedupe (latest, sealed) {
// compare latest and sealed to ensure lifecycle hooks won't be duplicated
// between merges
if (Array.isArray(latest)) {
var res = [];
sealed = Array.isArray(sealed) ? sealed : [sealed];
for (var i = 0; i < latest.length; i++) {
if (sealed.indexOf(latest[i]) < 0) {
res.push(latest[i]);
}
}
return res
} else {
return latest
}
}
function Vue$2 (options) {
if (process.env.NODE_ENV !== 'production' &&
!(this instanceof Vue$2)) {
warn('Vue is a constructor and should be called with the `new` keyword');
}
this._init(options);
}
initMixin(Vue$2);
stateMixin(Vue$2);
eventsMixin(Vue$2);
lifecycleMixin(Vue$2);
renderMixin(Vue$2);
/* */
function initUse (Vue) {
Vue.use = function (plugin) {
/* istanbul ignore if */
if (plugin.installed) {
return
}
// additional parameters
var args = toArray(arguments, 1);
args.unshift(this);
if (typeof plugin.install === 'function') {
plugin.install.apply(plugin, args);
} else if (typeof plugin === 'function') {
plugin.apply(null, args);
}
plugin.installed = true;
return this
};
}
/* */
function initMixin$1 (Vue) {
Vue.mixin = function (mixin) {
this.options = mergeOptions(this.options, mixin);
};
}
/* */
function initExtend (Vue) {
/**
* Each instance constructor, including Vue, has a unique
* cid. This enables us to create wrapped "child
* constructors" for prototypal inheritance and cache them.
*/
Vue.cid = 0;
var cid = 1;
/**
* Class inheritance
*/
Vue.extend = function (extendOptions) {
extendOptions = extendOptions || {};
var Super = this;
var SuperId = Super.cid;
var cachedCtors = extendOptions._Ctor || (extendOptions._Ctor = {});
if (cachedCtors[SuperId]) {
return cachedCtors[SuperId]
}
var name = extendOptions.name || Super.options.name;
if (process.env.NODE_ENV !== 'production') {
if (!/^[a-zA-Z][\w-]*$/.test(name)) {
warn(
'Invalid component name: "' + name + '". Component names ' +
'can only contain alphanumeric characters and the hyphen, ' +
'and must start with a letter.'
);
}
}
var Sub = function VueComponent (options) {
this._init(options);
};
Sub.prototype = Object.create(Super.prototype);
Sub.prototype.constructor = Sub;
Sub.cid = cid++;
Sub.options = mergeOptions(
Super.options,
extendOptions
);
Sub['super'] = Super;
// For props and computed properties, we define the proxy getters on
// the Vue instances at extension time, on the extended prototype. This
// avoids Object.defineProperty calls for each instance created.
if (Sub.options.props) {
initProps$1(Sub);
}
if (Sub.options.computed) {
initComputed$1(Sub);
}
// allow further extension/mixin/plugin usage
Sub.extend = Super.extend;
Sub.mixin = Super.mixin;
Sub.use = Super.use;
// create asset registers, so extended classes
// can have their private assets too.
config._assetTypes.forEach(function (type) {
Sub[type] = Super[type];
});
// enable recursive self-lookup
if (name) {
Sub.options.components[name] = Sub;
}
// keep a reference to the super options at extension time.
// later at instantiation we can check if Super's options have
// been updated.
Sub.superOptions = Super.options;
Sub.extendOptions = extendOptions;
Sub.sealedOptions = extend({}, Sub.options);
// cache constructor
cachedCtors[SuperId] = Sub;
return Sub
};
}
function initProps$1 (Comp) {
var props = Comp.options.props;
for (var key in props) {
proxy(Comp.prototype, "_props", key);
}
}
function initComputed$1 (Comp) {
var computed = Comp.options.computed;
for (var key in computed) {
defineComputed(Comp.prototype, key, computed[key]);
}
}
/* */
function initAssetRegisters (Vue) {
/**
* Create asset registration methods.
*/
config._assetTypes.forEach(function (type) {
Vue[type] = function (
id,
definition
) {
if (!definition) {
return this.options[type + 's'][id]
} else {
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production') {
if (type === 'component' && config.isReservedTag(id)) {
warn(
'Do not use built-in or reserved HTML elements as component ' +
'id: ' + id
);
}
}
if (type === 'component' && isPlainObject(definition)) {
definition.name = definition.name || id;
definition = this.options._base.extend(definition);
}
if (type === 'directive' && typeof definition === 'function') {
definition = { bind: definition, update: definition };
}
this.options[type + 's'][id] = definition;
return definition
}
};
});
}
/* */
var patternTypes = [String, RegExp];
function getComponentName (opts) {
return opts && (opts.Ctor.options.name || opts.tag)
}
function matches (pattern, name) {
if (typeof pattern === 'string') {
return pattern.split(',').indexOf(name) > -1
} else if (pattern instanceof RegExp) {
return pattern.test(name)
}
/* istanbul ignore next */
return false
}
function pruneCache (cache, filter) {
for (var key in cache) {
var cachedNode = cache[key];
if (cachedNode) {
var name = getComponentName(cachedNode.componentOptions);
if (name && !filter(name)) {
pruneCacheEntry(cachedNode);
cache[key] = null;
}
}
}
}
function pruneCacheEntry (vnode) {
if (vnode) {
if (!vnode.componentInstance._inactive) {
callHook(vnode.componentInstance, 'deactivated');
}
vnode.componentInstance.$destroy();
}
}
var KeepAlive = {
name: 'keep-alive',
abstract: true,
props: {
include: patternTypes,
exclude: patternTypes
},
created: function created () {
this.cache = Object.create(null);
},
destroyed: function destroyed () {
var this$1 = this;
for (var key in this$1.cache) {
pruneCacheEntry(this$1.cache[key]);
}
},
watch: {
include: function include (val) {
pruneCache(this.cache, function (name) { return matches(val, name); });
},
exclude: function exclude (val) {
pruneCache(this.cache, function (name) { return !matches(val, name); });
}
},
render: function render () {
var vnode = getFirstComponentChild(this.$slots.default);
var componentOptions = vnode && vnode.componentOptions;
if (componentOptions) {
// check pattern
var name = getComponentName(componentOptions);
if (name && (
(this.include && !matches(this.include, name)) ||
(this.exclude && matches(this.exclude, name))
)) {
return vnode
}
var key = vnode.key == null
// same constructor may get registered as different local components
// so cid alone is not enough (#3269)
? componentOptions.Ctor.cid + (componentOptions.tag ? ("::" + (componentOptions.tag)) : '')
: vnode.key;
if (this.cache[key]) {
vnode.componentInstance = this.cache[key].componentInstance;
} else {
this.cache[key] = vnode;
}
vnode.data.keepAlive = true;
}
return vnode
}
};
var builtInComponents = {
KeepAlive: KeepAlive
};
/* */
function initGlobalAPI (Vue) {
// config
var configDef = {};
configDef.get = function () { return config; };
if (process.env.NODE_ENV !== 'production') {
configDef.set = function () {
warn(
'Do not replace the Vue.config object, set individual fields instead.'
);
};
}
Object.defineProperty(Vue, 'config', configDef);
// exposed util methods.
// NOTE: these are not considered part of the public API - avoid relying on
// them unless you are aware of the risk.
Vue.util = {
warn: warn,
extend: extend,
mergeOptions: mergeOptions,
defineReactive: defineReactive$$1
};
Vue.set = set;
Vue.delete = del;
Vue.nextTick = nextTick;
Vue.options = Object.create(null);
config._assetTypes.forEach(function (type) {
Vue.options[type + 's'] = Object.create(null);
});
// this is used to identify the "base" constructor to extend all plain-object
// components with in Weex's multi-instance scenarios.
Vue.options._base = Vue;
extend(Vue.options.components, builtInComponents);
initUse(Vue);
initMixin$1(Vue);
initExtend(Vue);
initAssetRegisters(Vue);
}
initGlobalAPI(Vue$2);
Object.defineProperty(Vue$2.prototype, '$isServer', {
get: isServerRendering
});
Vue$2.version = '2.2.2';
/* */
// attributes that should be using props for binding
var acceptValue = makeMap('input,textarea,option,select');
var mustUseProp = function (tag, type, attr) {
return (
(attr === 'value' && acceptValue(tag)) && type !== 'button' ||
(attr === 'selected' && tag === 'option') ||
(attr === 'checked' && tag === 'input') ||
(attr === 'muted' && tag === 'video')
)
};
var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
var isBooleanAttr = makeMap(
'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
'required,reversed,scoped,seamless,selected,sortable,translate,' +
'truespeed,typemustmatch,visible'
);
var xlinkNS = 'http://www.w3.org/1999/xlink';
var isXlink = function (name) {
return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
};
var getXlinkProp = function (name) {
return isXlink(name) ? name.slice(6, name.length) : ''
};
var isFalsyAttrValue = function (val) {
return val == null || val === false
};
/* */
function genClassForVnode (vnode) {
var data = vnode.data;
var parentNode = vnode;
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data) {
data = mergeClassData(childNode.data, data);
}
}
while ((parentNode = parentNode.parent)) {
if (parentNode.data) {
data = mergeClassData(data, parentNode.data);
}
}
return genClassFromData(data)
}
function mergeClassData (child, parent) {
return {
staticClass: concat(child.staticClass, parent.staticClass),
class: child.class
? [child.class, parent.class]
: parent.class
}
}
function genClassFromData (data) {
var dynamicClass = data.class;
var staticClass = data.staticClass;
if (staticClass || dynamicClass) {
return concat(staticClass, stringifyClass(dynamicClass))
}
/* istanbul ignore next */
return ''
}
function concat (a, b) {
return a ? b ? (a + ' ' + b) : a : (b || '')
}
function stringifyClass (value) {
var res = '';
if (!value) {
return res
}
if (typeof value === 'string') {
return value
}
if (Array.isArray(value)) {
var stringified;
for (var i = 0, l = value.length; i < l; i++) {
if (value[i]) {
if ((stringified = stringifyClass(value[i]))) {
res += stringified + ' ';
}
}
}
return res.slice(0, -1)
}
if (isObject(value)) {
for (var key in value) {
if (value[key]) { res += key + ' '; }
}
return res.slice(0, -1)
}
/* istanbul ignore next */
return res
}
/* */
var namespaceMap = {
svg: 'http://www.w3.org/2000/svg',
math: 'http://www.w3.org/1998/Math/MathML'
};
var isHTMLTag = makeMap(
'html,body,base,head,link,meta,style,title,' +
'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
'embed,object,param,source,canvas,script,noscript,del,ins,' +
'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
'output,progress,select,textarea,' +
'details,dialog,menu,menuitem,summary,' +
'content,element,shadow,template'
);
// this map is intentionally selective, only covering SVG elements that may
// contain child elements.
var isSVG = makeMap(
'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
true
);
var isReservedTag = function (tag) {
return isHTMLTag(tag) || isSVG(tag)
};
function getTagNamespace (tag) {
if (isSVG(tag)) {
return 'svg'
}
// basic support for MathML
// note it doesn't support other MathML elements being component roots
if (tag === 'math') {
return 'math'
}
}
var unknownElementCache = Object.create(null);
function isUnknownElement (tag) {
/* istanbul ignore if */
if (!inBrowser) {
return true
}
if (isReservedTag(tag)) {
return false
}
tag = tag.toLowerCase();
/* istanbul ignore if */
if (unknownElementCache[tag] != null) {
return unknownElementCache[tag]
}
var el = document.createElement(tag);
if (tag.indexOf('-') > -1) {
// http://stackoverflow.com/a/28210364/1070244
return (unknownElementCache[tag] = (
el.constructor === window.HTMLUnknownElement ||
el.constructor === window.HTMLElement
))
} else {
return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
}
}
/* */
/**
* Query an element selector if it's not an element already.
*/
function query (el) {
if (typeof el === 'string') {
var selected = document.querySelector(el);
if (!selected) {
process.env.NODE_ENV !== 'production' && warn(
'Cannot find element: ' + el
);
return document.createElement('div')
}
return selected
} else {
return el
}
}
/* */
function createElement$1 (tagName, vnode) {
var elm = document.createElement(tagName);
if (tagName !== 'select') {
return elm
}
// false or null will remove the attribute but undefined will not
if (vnode.data && vnode.data.attrs && vnode.data.attrs.multiple !== undefined) {
elm.setAttribute('multiple', 'multiple');
}
return elm
}
function createElementNS (namespace, tagName) {
return document.createElementNS(namespaceMap[namespace], tagName)
}
function createTextNode (text) {
return document.createTextNode(text)
}
function createComment (text) {
return document.createComment(text)
}
function insertBefore (parentNode, newNode, referenceNode) {
parentNode.insertBefore(newNode, referenceNode);
}
function removeChild (node, child) {
node.removeChild(child);
}
function appendChild (node, child) {
node.appendChild(child);
}
function parentNode (node) {
return node.parentNode
}
function nextSibling (node) {
return node.nextSibling
}
function tagName (node) {
return node.tagName
}
function setTextContent (node, text) {
node.textContent = text;
}
function setAttribute (node, key, val) {
node.setAttribute(key, val);
}
var nodeOps = Object.freeze({
createElement: createElement$1,
createElementNS: createElementNS,
createTextNode: createTextNode,
createComment: createComment,
insertBefore: insertBefore,
removeChild: removeChild,
appendChild: appendChild,
parentNode: parentNode,
nextSibling: nextSibling,
tagName: tagName,
setTextContent: setTextContent,
setAttribute: setAttribute
});
/* */
var ref = {
create: function create (_, vnode) {
registerRef(vnode);
},
update: function update (oldVnode, vnode) {
if (oldVnode.data.ref !== vnode.data.ref) {
registerRef(oldVnode, true);
registerRef(vnode);
}
},
destroy: function destroy (vnode) {
registerRef(vnode, true);
}
};
function registerRef (vnode, isRemoval) {
var key = vnode.data.ref;
if (!key) { return }
var vm = vnode.context;
var ref = vnode.componentInstance || vnode.elm;
var refs = vm.$refs;
if (isRemoval) {
if (Array.isArray(refs[key])) {
remove(refs[key], ref);
} else if (refs[key] === ref) {
refs[key] = undefined;
}
} else {
if (vnode.data.refInFor) {
if (Array.isArray(refs[key]) && refs[key].indexOf(ref) < 0) {
refs[key].push(ref);
} else {
refs[key] = [ref];
}
} else {
refs[key] = ref;
}
}
}
/**
* Virtual DOM patching algorithm based on Snabbdom by
* Simon Friis Vindum (@paldepind)
* Licensed under the MIT License
* https://github.com/paldepind/snabbdom/blob/master/LICENSE
*
* modified by Evan You (@yyx990803)
*
/*
* Not type-checking this because this file is perf-critical and the cost
* of making flow understand it is not worth it.
*/
var emptyNode = new VNode('', {}, []);
var hooks$1 = ['create', 'activate', 'update', 'remove', 'destroy'];
function isUndef (s) {
return s == null
}
function isDef (s) {
return s != null
}
function sameVnode (vnode1, vnode2) {
return (
vnode1.key === vnode2.key &&
vnode1.tag === vnode2.tag &&
vnode1.isComment === vnode2.isComment &&
!vnode1.data === !vnode2.data
)
}
function createKeyToOldIdx (children, beginIdx, endIdx) {
var i, key;
var map = {};
for (i = beginIdx; i <= endIdx; ++i) {
key = children[i].key;
if (isDef(key)) { map[key] = i; }
}
return map
}
function createPatchFunction (backend) {
var i, j;
var cbs = {};
var modules = backend.modules;
var nodeOps = backend.nodeOps;
for (i = 0; i < hooks$1.length; ++i) {
cbs[hooks$1[i]] = [];
for (j = 0; j < modules.length; ++j) {
if (modules[j][hooks$1[i]] !== undefined) { cbs[hooks$1[i]].push(modules[j][hooks$1[i]]); }
}
}
function emptyNodeAt (elm) {
return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
}
function createRmCb (childElm, listeners) {
function remove$$1 () {
if (--remove$$1.listeners === 0) {
removeNode(childElm);
}
}
remove$$1.listeners = listeners;
return remove$$1
}
function removeNode (el) {
var parent = nodeOps.parentNode(el);
// element may have already been removed due to v-html / v-text
if (parent) {
nodeOps.removeChild(parent, el);
}
}
var inPre = 0;
function createElm (vnode, insertedVnodeQueue, parentElm, refElm, nested) {
vnode.isRootInsert = !nested; // for transition enter check
if (createComponent(vnode, insertedVnodeQueue, parentElm, refElm)) {
return
}
var data = vnode.data;
var children = vnode.children;
var tag = vnode.tag;
if (isDef(tag)) {
if (process.env.NODE_ENV !== 'production') {
if (data && data.pre) {
inPre++;
}
if (
!inPre &&
!vnode.ns &&
!(config.ignoredElements.length && config.ignoredElements.indexOf(tag) > -1) &&
config.isUnknownElement(tag)
) {
warn(
'Unknown custom element: <' + tag + '> - did you ' +
'register the component correctly? For recursive components, ' +
'make sure to provide the "name" option.',
vnode.context
);
}
}
vnode.elm = vnode.ns
? nodeOps.createElementNS(vnode.ns, tag)
: nodeOps.createElement(tag, vnode);
setScope(vnode);
/* istanbul ignore if */
{
createChildren(vnode, children, insertedVnodeQueue);
if (isDef(data)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
}
insert(parentElm, vnode.elm, refElm);
}
if (process.env.NODE_ENV !== 'production' && data && data.pre) {
inPre--;
}
} else if (vnode.isComment) {
vnode.elm = nodeOps.createComment(vnode.text);
insert(parentElm, vnode.elm, refElm);
} else {
vnode.elm = nodeOps.createTextNode(vnode.text);
insert(parentElm, vnode.elm, refElm);
}
}
function createComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
var i = vnode.data;
if (isDef(i)) {
var isReactivated = isDef(vnode.componentInstance) && i.keepAlive;
if (isDef(i = i.hook) && isDef(i = i.init)) {
i(vnode, false /* hydrating */, parentElm, refElm);
}
// after calling the init hook, if the vnode is a child component
// it should've created a child instance and mounted it. the child
// component also has set the placeholder vnode's elm.
// in that case we can just return the element and be done.
if (isDef(vnode.componentInstance)) {
initComponent(vnode, insertedVnodeQueue);
if (isReactivated) {
reactivateComponent(vnode, insertedVnodeQueue, parentElm, refElm);
}
return true
}
}
}
function initComponent (vnode, insertedVnodeQueue) {
if (vnode.data.pendingInsert) {
insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
}
vnode.elm = vnode.componentInstance.$el;
if (isPatchable(vnode)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
setScope(vnode);
} else {
// empty component root.
// skip all element-related modules except for ref (#3455)
registerRef(vnode);
// make sure to invoke the insert hook
insertedVnodeQueue.push(vnode);
}
}
function reactivateComponent (vnode, insertedVnodeQueue, parentElm, refElm) {
var i;
// hack for #4339: a reactivated component with inner transition
// does not trigger because the inner node's created hooks are not called
// again. It's not ideal to involve module-specific logic in here but
// there doesn't seem to be a better way to do it.
var innerNode = vnode;
while (innerNode.componentInstance) {
innerNode = innerNode.componentInstance._vnode;
if (isDef(i = innerNode.data) && isDef(i = i.transition)) {
for (i = 0; i < cbs.activate.length; ++i) {
cbs.activate[i](emptyNode, innerNode);
}
insertedVnodeQueue.push(innerNode);
break
}
}
// unlike a newly created component,
// a reactivated keep-alive component doesn't insert itself
insert(parentElm, vnode.elm, refElm);
}
function insert (parent, elm, ref) {
if (parent) {
if (ref) {
nodeOps.insertBefore(parent, elm, ref);
} else {
nodeOps.appendChild(parent, elm);
}
}
}
function createChildren (vnode, children, insertedVnodeQueue) {
if (Array.isArray(children)) {
for (var i = 0; i < children.length; ++i) {
createElm(children[i], insertedVnodeQueue, vnode.elm, null, true);
}
} else if (isPrimitive(vnode.text)) {
nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
}
}
function isPatchable (vnode) {
while (vnode.componentInstance) {
vnode = vnode.componentInstance._vnode;
}
return isDef(vnode.tag)
}
function invokeCreateHooks (vnode, insertedVnodeQueue) {
for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
cbs.create[i$1](emptyNode, vnode);
}
i = vnode.data.hook; // Reuse variable
if (isDef(i)) {
if (i.create) { i.create(emptyNode, vnode); }
if (i.insert) { insertedVnodeQueue.push(vnode); }
}
}
// set scope id attribute for scoped CSS.
// this is implemented as a special case to avoid the overhead
// of going through the normal attribute patching process.
function setScope (vnode) {
var i;
var ancestor = vnode;
while (ancestor) {
if (isDef(i = ancestor.context) && isDef(i = i.$options._scopeId)) {
nodeOps.setAttribute(vnode.elm, i, '');
}
ancestor = ancestor.parent;
}
// for slot content they should also get the scopeId from the host instance.
if (isDef(i = activeInstance) &&
i !== vnode.context &&
isDef(i = i.$options._scopeId)) {
nodeOps.setAttribute(vnode.elm, i, '');
}
}
function addVnodes (parentElm, refElm, vnodes, startIdx, endIdx, insertedVnodeQueue) {
for (; startIdx <= endIdx; ++startIdx) {
createElm(vnodes[startIdx], insertedVnodeQueue, parentElm, refElm);
}
}
function invokeDestroyHook (vnode) {
var i, j;
var data = vnode.data;
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
}
if (isDef(i = vnode.children)) {
for (j = 0; j < vnode.children.length; ++j) {
invokeDestroyHook(vnode.children[j]);
}
}
}
function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
for (; startIdx <= endIdx; ++startIdx) {
var ch = vnodes[startIdx];
if (isDef(ch)) {
if (isDef(ch.tag)) {
removeAndInvokeRemoveHook(ch);
invokeDestroyHook(ch);
} else { // Text node
removeNode(ch.elm);
}
}
}
}
function removeAndInvokeRemoveHook (vnode, rm) {
if (rm || isDef(vnode.data)) {
var listeners = cbs.remove.length + 1;
if (!rm) {
// directly removing
rm = createRmCb(vnode.elm, listeners);
} else {
// we have a recursively passed down rm callback
// increase the listeners count
rm.listeners += listeners;
}
// recursively invoke hooks on child component root node
if (isDef(i = vnode.componentInstance) && isDef(i = i._vnode) && isDef(i.data)) {
removeAndInvokeRemoveHook(i, rm);
}
for (i = 0; i < cbs.remove.length; ++i) {
cbs.remove[i](vnode, rm);
}
if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
i(vnode, rm);
} else {
rm();
}
} else {
removeNode(vnode.elm);
}
}
function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
var oldStartIdx = 0;
var newStartIdx = 0;
var oldEndIdx = oldCh.length - 1;
var oldStartVnode = oldCh[0];
var oldEndVnode = oldCh[oldEndIdx];
var newEndIdx = newCh.length - 1;
var newStartVnode = newCh[0];
var newEndVnode = newCh[newEndIdx];
var oldKeyToIdx, idxInOld, elmToMove, refElm;
// removeOnly is a special flag used only by <transition-group>
// to ensure removed elements stay in correct relative positions
// during leaving transitions
var canMove = !removeOnly;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (isUndef(oldStartVnode)) {
oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
} else if (isUndef(oldEndVnode)) {
oldEndVnode = oldCh[--oldEndIdx];
} else if (sameVnode(oldStartVnode, newStartVnode)) {
patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
} else if (sameVnode(oldEndVnode, newEndVnode)) {
patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
} else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
} else {
if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
if (isUndef(idxInOld)) { // New element
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
} else {
elmToMove = oldCh[idxInOld];
/* istanbul ignore if */
if (process.env.NODE_ENV !== 'production' && !elmToMove) {
warn(
'It seems there are duplicate keys that is causing an update error. ' +
'Make sure each v-for item has a unique key.'
);
}
if (sameVnode(elmToMove, newStartVnode)) {
patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
oldCh[idxInOld] = undefined;
canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
} else {
// same key but different element. treat as new element
createElm(newStartVnode, insertedVnodeQueue, parentElm, oldStartVnode.elm);
newStartVnode = newCh[++newStartIdx];
}
}
}
}
if (oldStartIdx > oldEndIdx) {
refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
} else if (newStartIdx > newEndIdx) {
removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
}
}
function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
if (oldVnode === vnode) {
return
}
// reuse element for static trees.
// note we only do this if the vnode is cloned -
// if the new node is not cloned it means the render functions have been
// reset by the hot-reload-api and we need to do a proper re-render.
if (vnode.isStatic &&
oldVnode.isStatic &&
vnode.key === oldVnode.key &&
(vnode.isCloned || vnode.isOnce)) {
vnode.elm = oldVnode.elm;
vnode.componentInstance = oldVnode.componentInstance;
return
}
var i;
var data = vnode.data;
var hasData = isDef(data);
if (hasData && isDef(i = data.hook) && isDef(i = i.prepatch)) {
i(oldVnode, vnode);
}
var elm = vnode.elm = oldVnode.elm;
var oldCh = oldVnode.children;
var ch = vnode.children;
if (hasData && isPatchable(vnode)) {
for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
}
if (isUndef(vnode.text)) {
if (isDef(oldCh) && isDef(ch)) {
if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
} else if (isDef(ch)) {
if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
} else if (isDef(oldCh)) {
removeVnodes(elm, oldCh, 0, oldCh.length - 1);
} else if (isDef(oldVnode.text)) {
nodeOps.setTextContent(elm, '');
}
} else if (oldVnode.text !== vnode.text) {
nodeOps.setTextContent(elm, vnode.text);
}
if (hasData) {
if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
}
}
function invokeInsertHook (vnode, queue, initial) {
// delay insert hooks for component root nodes, invoke them after the
// element is really inserted
if (initial && vnode.parent) {
vnode.parent.data.pendingInsert = queue;
} else {
for (var i = 0; i < queue.length; ++i) {
queue[i].data.hook.insert(queue[i]);
}
}
}
var bailed = false;
// list of modules that can skip create hook during hydration because they
// are already rendered on the client or has no need for initialization
var isRenderedModule = makeMap('attrs,style,class,staticClass,staticStyle,key');
// Note: this is a browser-only function so we can assume elms are DOM nodes.
function hydrate (elm, vnode, insertedVnodeQueue) {
if (process.env.NODE_ENV !== 'production') {
if (!assertNodeMatch(elm, vnode)) {
return false
}
}
vnode.elm = elm;
var tag = vnode.tag;
var data = vnode.data;
var children = vnode.children;
if (isDef(data)) {
if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
if (isDef(i = vnode.componentInstance)) {
// child component. it should have hydrated its own tree.
initComponent(vnode, insertedVnodeQueue);
return true
}
}
if (isDef(tag)) {
if (isDef(children)) {
// empty element, allow client to pick up and populate children
if (!elm.hasChildNodes()) {
createChildren(vnode, children, insertedVnodeQueue);
} else {
var childrenMatch = true;
var childNode = elm.firstChild;
for (var i$1 = 0; i$1 < children.length; i$1++) {
if (!childNode || !hydrate(childNode, children[i$1], insertedVnodeQueue)) {
childrenMatch = false;
break
}
childNode = childNode.nextSibling;
}
// if childNode is not null, it means the actual childNodes list is
// longer than the virtual children list.
if (!childrenMatch || childNode) {
if (process.env.NODE_ENV !== 'production' &&
typeof console !== 'undefined' &&
!bailed) {
bailed = true;
console.warn('Parent: ', elm);
console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
}
return false
}
}
}
if (isDef(data)) {
for (var key in data) {
if (!isRenderedModule(key)) {
invokeCreateHooks(vnode, insertedVnodeQueue);
break
}
}
}
} else if (elm.data !== vnode.text) {
elm.data = vnode.text;
}
return true
}
function assertNodeMatch (node, vnode) {
if (vnode.tag) {
return (
vnode.tag.indexOf('vue-component') === 0 ||
vnode.tag.toLowerCase() === (node.tagName && node.tagName.toLowerCase())
)
} else {
return node.nodeType === (vnode.isComment ? 8 : 3)
}
}
return function patch (oldVnode, vnode, hydrating, removeOnly, parentElm, refElm) {
if (!vnode) {
if (oldVnode) { invokeDestroyHook(oldVnode); }
return
}
var isInitialPatch = false;
var insertedVnodeQueue = [];
if (!oldVnode) {
// empty mount (likely as component), create new root element
isInitialPatch = true;
createElm(vnode, insertedVnodeQueue, parentElm, refElm);
} else {
var isRealElement = isDef(oldVnode.nodeType);
if (!isRealElement && sameVnode(oldVnode, vnode)) {
// patch existing root node
patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
} else {
if (isRealElement) {
// mounting to a real element
// check if this is server-rendered content and if we can perform
// a successful hydration.
if (oldVnode.nodeType === 1 && oldVnode.hasAttribute('server-rendered')) {
oldVnode.removeAttribute('server-rendered');
hydrating = true;
}
if (hydrating) {
if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
invokeInsertHook(vnode, insertedVnodeQueue, true);
return oldVnode
} else if (process.env.NODE_ENV !== 'production') {
warn(
'The client-side rendered virtual DOM tree is not matching ' +
'server-rendered content. This is likely caused by incorrect ' +
'HTML markup, for example nesting block-level elements inside ' +
'<p>, or missing <tbody>. Bailing hydration and performing ' +
'full client-side render.'
);
}
}
// either not server-rendered, or hydration failed.
// create an empty node and replace it
oldVnode = emptyNodeAt(oldVnode);
}
// replacing existing element
var oldElm = oldVnode.elm;
var parentElm$1 = nodeOps.parentNode(oldElm);
createElm(
vnode,
insertedVnodeQueue,
// extremely rare edge case: do not insert if old element is in a
// leaving transition. Only happens when combining transition +
// keep-alive + HOCs. (#4590)
oldElm._leaveCb ? null : parentElm$1,
nodeOps.nextSibling(oldElm)
);
if (vnode.parent) {
// component root element replaced.
// update parent placeholder node element, recursively
var ancestor = vnode.parent;
while (ancestor) {
ancestor.elm = vnode.elm;
ancestor = ancestor.parent;
}
if (isPatchable(vnode)) {
for (var i = 0; i < cbs.create.length; ++i) {
cbs.create[i](emptyNode, vnode.parent);
}
}
}
if (parentElm$1 !== null) {
removeVnodes(parentElm$1, [oldVnode], 0, 0);
} else if (isDef(oldVnode.tag)) {
invokeDestroyHook(oldVnode);
}
}
}
invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
return vnode.elm
}
}
/* */
var directives = {
create: updateDirectives,
update: updateDirectives,
destroy: function unbindDirectives (vnode) {
updateDirectives(vnode, emptyNode);
}
};
function updateDirectives (oldVnode, vnode) {
if (oldVnode.data.directives || vnode.data.directives) {
_update(oldVnode, vnode);
}
}
function _update (oldVnode, vnode) {
var isCreate = oldVnode === emptyNode;
var isDestroy = vnode === emptyNode;
var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
var dirsWithInsert = [];
var dirsWithPostpatch = [];
var key, oldDir, dir;
for (key in newDirs) {
oldDir = oldDirs[key];
dir = newDirs[key];
if (!oldDir) {
// new directive, bind
callHook$1(dir, 'bind', vnode, oldVnode);
if (dir.def && dir.def.inserted) {
dirsWithInsert.push(dir);
}
} else {
// existing directive, update
dir.oldValue = oldDir.value;
callHook$1(dir, 'update', vnode, oldVnode);
if (dir.def && dir.def.componentUpdated) {
dirsWithPostpatch.push(dir);
}
}
}
if (dirsWithInsert.length) {
var callInsert = function () {
for (var i = 0; i < dirsWithInsert.length; i++) {
callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);
}
};
if (isCreate) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert);
} else {
callInsert();
}
}
if (dirsWithPostpatch.length) {
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
for (var i = 0; i < dirsWithPostpatch.length; i++) {
callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);
}
});
}
if (!isCreate) {
for (key in oldDirs) {
if (!newDirs[key]) {
// no longer present, unbind
callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);
}
}
}
}
var emptyModifiers = Object.create(null);
function normalizeDirectives$1 (
dirs,
vm
) {
var res = Object.create(null);
if (!dirs) {
return res
}
var i, dir;
for (i = 0; i < dirs.length; i++) {
dir = dirs[i];
if (!dir.modifiers) {
dir.modifiers = emptyModifiers;
}
res[getRawDirName(dir)] = dir;
dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
}
return res
}
function getRawDirName (dir) {
return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
}
function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {
var fn = dir.def && dir.def[hook];
if (fn) {
fn(vnode.elm, dir, vnode, oldVnode, isDestroy);
}
}
var baseModules = [
ref,
directives
];
/* */
function updateAttrs (oldVnode, vnode) {
if (!oldVnode.data.attrs && !vnode.data.attrs) {
return
}
var key, cur, old;
var elm = vnode.elm;
var oldAttrs = oldVnode.data.attrs || {};
var attrs = vnode.data.attrs || {};
// clone observed objects, as the user probably wants to mutate it
if (attrs.__ob__) {
attrs = vnode.data.attrs = extend({}, attrs);
}
for (key in attrs) {
cur = attrs[key];
old = oldAttrs[key];
if (old !== cur) {
setAttr(elm, key, cur);
}
}
// #4391: in IE9, setting type can reset value for input[type=radio]
/* istanbul ignore if */
if (isIE9 && attrs.value !== oldAttrs.value) {
setAttr(elm, 'value', attrs.value);
}
for (key in oldAttrs) {
if (attrs[key] == null) {
if (isXlink(key)) {
elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
} else if (!isEnumeratedAttr(key)) {
elm.removeAttribute(key);
}
}
}
}
function setAttr (el, key, value) {
if (isBooleanAttr(key)) {
// set attribute for blank value
// e.g. <option disabled>Select one</option>
if (isFalsyAttrValue(value)) {
el.removeAttribute(key);
} else {
el.setAttribute(key, key);
}
} else if (isEnumeratedAttr(key)) {
el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
} else if (isXlink(key)) {
if (isFalsyAttrValue(value)) {
el.removeAttributeNS(xlinkNS, getXlinkProp(key));
} else {
el.setAttributeNS(xlinkNS, key, value);
}
} else {
if (isFalsyAttrValue(value)) {
el.removeAttribute(key);
} else {
el.setAttribute(key, value);
}
}
}
var attrs = {
create: updateAttrs,
update: updateAttrs
};
/* */
function updateClass (oldVnode, vnode) {
var el = vnode.elm;
var data = vnode.data;
var oldData = oldVnode.data;
if (!data.staticClass && !data.class &&
(!oldData || (!oldData.staticClass && !oldData.class))) {
return
}
var cls = genClassForVnode(vnode);
// handle transition classes
var transitionClass = el._transitionClasses;
if (transitionClass) {
cls = concat(cls, stringifyClass(transitionClass));
}
// set the class
if (cls !== el._prevClass) {
el.setAttribute('class', cls);
el._prevClass = cls;
}
}
var klass = {
create: updateClass,
update: updateClass
};
/* */
var validDivisionCharRE = /[\w).+\-_$\]]/;
function wrapFilter (exp, filter) {
var i = filter.indexOf('(');
if (i < 0) {
// _f: resolveFilter
return ("_f(\"" + filter + "\")(" + exp + ")")
} else {
var name = filter.slice(0, i);
var args = filter.slice(i + 1);
return ("_f(\"" + name + "\")(" + exp + "," + args)
}
}
/* */
/* */
/**
* Cross-platform code generation for component v-model
*/
/**
* Cross-platform codegen helper for generating v-model value assignment code.
*/
/**
* parse directive model to do the array update transform. a[idx] = val => $$a.splice($$idx, 1, val)
*
* for loop possible cases:
*
* - test
* - test[idx]
* - test[test1[idx]]
* - test["a"][idx]
* - xxx.test[a[a].test1[idx]]
* - test.xxx.a["asa"][test1[idx]]
*
*/
var str;
var index$1;
/* */
// in some cases, the event used has to be determined at runtime
// so we used some reserved tokens during compile.
var RANGE_TOKEN = '__r';
var CHECKBOX_RADIO_TOKEN = '__c';
/* */
// normalize v-model event tokens that can only be determined at runtime.
// it's important to place the event as the first in the array because
// the whole point is ensuring the v-model callback gets called before
// user-attached handlers.
function normalizeEvents (on) {
var event;
/* istanbul ignore if */
if (on[RANGE_TOKEN]) {
// IE input[type=range] only supports `change` event
event = isIE ? 'change' : 'input';
on[event] = [].concat(on[RANGE_TOKEN], on[event] || []);
delete on[RANGE_TOKEN];
}
if (on[CHECKBOX_RADIO_TOKEN]) {
// Chrome fires microtasks in between click/change, leads to #4521
event = isChrome ? 'click' : 'change';
on[event] = [].concat(on[CHECKBOX_RADIO_TOKEN], on[event] || []);
delete on[CHECKBOX_RADIO_TOKEN];
}
}
var target$1;
function add$1 (
event,
handler,
once,
capture
) {
if (once) {
var oldHandler = handler;
var _target = target$1; // save current target element in closure
handler = function (ev) {
var res = arguments.length === 1
? oldHandler(ev)
: oldHandler.apply(null, arguments);
if (res !== null) {
remove$2(event, handler, capture, _target);
}
};
}
target$1.addEventListener(event, handler, capture);
}
function remove$2 (
event,
handler,
capture,
_target
) {
(_target || target$1).removeEventListener(event, handler, capture);
}
function updateDOMListeners (oldVnode, vnode) {
if (!oldVnode.data.on && !vnode.data.on) {
return
}
var on = vnode.data.on || {};
var oldOn = oldVnode.data.on || {};
target$1 = vnode.elm;
normalizeEvents(on);
updateListeners(on, oldOn, add$1, remove$2, vnode.context);
}
var events = {
create: updateDOMListeners,
update: updateDOMListeners
};
/* */
function updateDOMProps (oldVnode, vnode) {
if (!oldVnode.data.domProps && !vnode.data.domProps) {
return
}
var key, cur;
var elm = vnode.elm;
var oldProps = oldVnode.data.domProps || {};
var props = vnode.data.domProps || {};
// clone observed objects, as the user probably wants to mutate it
if (props.__ob__) {
props = vnode.data.domProps = extend({}, props);
}
for (key in oldProps) {
if (props[key] == null) {
elm[key] = '';
}
}
for (key in props) {
cur = props[key];
// ignore children if the node has textContent or innerHTML,
// as these will throw away existing DOM nodes and cause removal errors
// on subsequent patches (#3360)
if (key === 'textContent' || key === 'innerHTML') {
if (vnode.children) { vnode.children.length = 0; }
if (cur === oldProps[key]) { continue }
}
if (key === 'value') {
// store value as _value as well since
// non-string values will be stringified
elm._value = cur;
// avoid resetting cursor position when value is the same
var strCur = cur == null ? '' : String(cur);
if (shouldUpdateValue(elm, vnode, strCur)) {
elm.value = strCur;
}
} else {
elm[key] = cur;
}
}
}
// check platforms/web/util/attrs.js acceptValue
function shouldUpdateValue (
elm,
vnode,
checkVal
) {
return (!elm.composing && (
vnode.tag === 'option' ||
isDirty(elm, checkVal) ||
isInputChanged(elm, checkVal)
))
}
function isDirty (elm, checkVal) {
// return true when textbox (.number and .trim) loses focus and its value is not equal to the updated value
return document.activeElement !== elm && elm.value !== checkVal
}
function isInputChanged (elm, newVal) {
var value = elm.value;
var modifiers = elm._vModifiers; // injected by v-model runtime
if ((modifiers && modifiers.number) || elm.type === 'number') {
return toNumber(value) !== toNumber(newVal)
}
if (modifiers && modifiers.trim) {
return value.trim() !== newVal.trim()
}
return value !== newVal
}
var domProps = {
create: updateDOMProps,
update: updateDOMProps
};
/* */
var parseStyleText = cached(function (cssText) {
var res = {};
var listDelimiter = /;(?![^(]*\))/g;
var propertyDelimiter = /:(.+)/;
cssText.split(listDelimiter).forEach(function (item) {
if (item) {
var tmp = item.split(propertyDelimiter);
tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim());
}
});
return res
});
// merge static and dynamic style data on the same vnode
function normalizeStyleData (data) {
var style = normalizeStyleBinding(data.style);
// static style is pre-processed into an object during compilation
// and is always a fresh object, so it's safe to merge into it
return data.staticStyle
? extend(data.staticStyle, style)
: style
}
// normalize possible array / string values into Object
function normalizeStyleBinding (bindingStyle) {
if (Array.isArray(bindingStyle)) {
return toObject(bindingStyle)
}
if (typeof bindingStyle === 'string') {
return parseStyleText(bindingStyle)
}
return bindingStyle
}
/**
* parent component style should be after child's
* so that parent component's style could override it
*/
function getStyle (vnode, checkChild) {
var res = {};
var styleData;
if (checkChild) {
var childNode = vnode;
while (childNode.componentInstance) {
childNode = childNode.componentInstance._vnode;
if (childNode.data && (styleData = normalizeStyleData(childNode.data))) {
extend(res, styleData);
}
}
}
if ((styleData = normalizeStyleData(vnode.data))) {
extend(res, styleData);
}
var parentNode = vnode;
while ((parentNode = parentNode.parent)) {
if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) {
extend(res, styleData);
}
}
return res
}
/* */
var cssVarRE = /^--/;
var importantRE = /\s*!important$/;
var setProp = function (el, name, val) {
/* istanbul ignore if */
if (cssVarRE.test(name)) {
el.style.setProperty(name, val);
} else if (importantRE.test(val)) {
el.style.setProperty(name, val.replace(importantRE, ''), 'important');
} else {
el.style[normalize(name)] = val;
}
};
var prefixes = ['Webkit', 'Moz', 'ms'];
var testEl;
var normalize = cached(function (prop) {
testEl = testEl || document.createElement('div');
prop = camelize(prop);
if (prop !== 'filter' && (prop in testEl.style)) {
return prop
}
var upper = prop.charAt(0).toUpperCase() + prop.slice(1);
for (var i = 0; i < prefixes.length; i++) {
var prefixed = prefixes[i] + upper;
if (prefixed in testEl.style) {
return prefixed
}
}
});
function updateStyle (oldVnode, vnode) {
var data = vnode.data;
var oldData = oldVnode.data;
if (!data.staticStyle && !data.style &&
!oldData.staticStyle && !oldData.style) {
return
}
var cur, name;
var el = vnode.elm;
var oldStaticStyle = oldVnode.data.staticStyle;
var oldStyleBinding = oldVnode.data.style || {};
// if static style exists, stylebinding already merged into it when doing normalizeStyleData
var oldStyle = oldStaticStyle || oldStyleBinding;
var style = normalizeStyleBinding(vnode.data.style) || {};
vnode.data.style = style.__ob__ ? extend({}, style) : style;
var newStyle = getStyle(vnode, true);
for (name in oldStyle) {
if (newStyle[name] == null) {
setProp(el, name, '');
}
}
for (name in newStyle) {
cur = newStyle[name];
if (cur !== oldStyle[name]) {
// ie9 setting to null has no effect, must use empty string
setProp(el, name, cur == null ? '' : cur);
}
}
}
var style = {
create: updateStyle,
update: updateStyle
};
/* */
/**
* Add class with compatibility for SVG since classList is not supported on
* SVG elements in IE
*/
function addClass (el, cls) {
/* istanbul ignore if */
if (!cls || !(cls = cls.trim())) {
return
}
/* istanbul ignore else */
if (el.classList) {
if (cls.indexOf(' ') > -1) {
cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
} else {
el.classList.add(cls);
}
} else {
var cur = " " + (el.getAttribute('class') || '') + " ";
if (cur.indexOf(' ' + cls + ' ') < 0) {
el.setAttribute('class', (cur + cls).trim());
}
}
}
/**
* Remove class with compatibility for SVG since classList is not supported on
* SVG elements in IE
*/
function removeClass (el, cls) {
/* istanbul ignore if */
if (!cls || !(cls = cls.trim())) {
return
}
/* istanbul ignore else */
if (el.classList) {
if (cls.indexOf(' ') > -1) {
cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
} else {
el.classList.remove(cls);
}
} else {
var cur = " " + (el.getAttribute('class') || '') + " ";
var tar = ' ' + cls + ' ';
while (cur.indexOf(tar) >= 0) {
cur = cur.replace(tar, ' ');
}
el.setAttribute('class', cur.trim());
}
}
/* */
function resolveTransition (def$$1) {
if (!def$$1) {
return
}
/* istanbul ignore else */
if (typeof def$$1 === 'object') {
var res = {};
if (def$$1.css !== false) {
extend(res, autoCssTransition(def$$1.name || 'v'));
}
extend(res, def$$1);
return res
} else if (typeof def$$1 === 'string') {
return autoCssTransition(def$$1)
}
}
var autoCssTransition = cached(function (name) {
return {
enterClass: (name + "-enter"),
enterToClass: (name + "-enter-to"),
enterActiveClass: (name + "-enter-active"),
leaveClass: (name + "-leave"),
leaveToClass: (name + "-leave-to"),
leaveActiveClass: (name + "-leave-active")
}
});
var hasTransition = inBrowser && !isIE9;
var TRANSITION = 'transition';
var ANIMATION = 'animation';
// Transition property/event sniffing
var transitionProp = 'transition';
var transitionEndEvent = 'transitionend';
var animationProp = 'animation';
var animationEndEvent = 'animationend';
if (hasTransition) {
/* istanbul ignore if */
if (window.ontransitionend === undefined &&
window.onwebkittransitionend !== undefined) {
transitionProp = 'WebkitTransition';
transitionEndEvent = 'webkitTransitionEnd';
}
if (window.onanimationend === undefined &&
window.onwebkitanimationend !== undefined) {
animationProp = 'WebkitAnimation';
animationEndEvent = 'webkitAnimationEnd';
}
}
// binding to window is necessary to make hot reload work in IE in strict mode
var raf = inBrowser && window.requestAnimationFrame
? window.requestAnimationFrame.bind(window)
: setTimeout;
function nextFrame (fn) {
raf(function () {
raf(fn);
});
}
function addTransitionClass (el, cls) {
(el._transitionClasses || (el._transitionClasses = [])).push(cls);
addClass(el, cls);
}
function removeTransitionClass (el, cls) {
if (el._transitionClasses) {
remove(el._transitionClasses, cls);
}
removeClass(el, cls);
}
function whenTransitionEnds (
el,
expectedType,
cb
) {
var ref = getTransitionInfo(el, expectedType);
var type = ref.type;
var timeout = ref.timeout;
var propCount = ref.propCount;
if (!type) { return cb() }
var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
var ended = 0;
var end = function () {
el.removeEventListener(event, onEnd);
cb();
};
var onEnd = function (e) {
if (e.target === el) {
if (++ended >= propCount) {
end();
}
}
};
setTimeout(function () {
if (ended < propCount) {
end();
}
}, timeout + 1);
el.addEventListener(event, onEnd);
}
var transformRE = /\b(transform|all)(,|$)/;
function getTransitionInfo (el, expectedType) {
var styles = window.getComputedStyle(el);
var transitionDelays = styles[transitionProp + 'Delay'].split(', ');
var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
var transitionTimeout = getTimeout(transitionDelays, transitionDurations);
var animationDelays = styles[animationProp + 'Delay'].split(', ');
var animationDurations = styles[animationProp + 'Duration'].split(', ');
var animationTimeout = getTimeout(animationDelays, animationDurations);
var type;
var timeout = 0;
var propCount = 0;
/* istanbul ignore if */
if (expectedType === TRANSITION) {
if (transitionTimeout > 0) {
type = TRANSITION;
timeout = transitionTimeout;
propCount = transitionDurations.length;
}
} else if (expectedType === ANIMATION) {
if (animationTimeout > 0) {
type = ANIMATION;
timeout = animationTimeout;
propCount = animationDurations.length;
}
} else {
timeout = Math.max(transitionTimeout, animationTimeout);
type = timeout > 0
? transitionTimeout > animationTimeout
? TRANSITION
: ANIMATION
: null;
propCount = type
? type === TRANSITION
? transitionDurations.length
: animationDurations.length
: 0;
}
var hasTransform =
type === TRANSITION &&
transformRE.test(styles[transitionProp + 'Property']);
return {
type: type,
timeout: timeout,
propCount: propCount,
hasTransform: hasTransform
}
}
function getTimeout (delays, durations) {
/* istanbul ignore next */
while (delays.length < durations.length) {
delays = delays.concat(delays);
}
return Math.max.apply(null, durations.map(function (d, i) {
return toMs(d) + toMs(delays[i])
}))
}
function toMs (s) {
return Number(s.slice(0, -1)) * 1000
}
/* */
function enter (vnode, toggleDisplay) {
var el = vnode.elm;
// call leave callback now
if (el._leaveCb) {
el._leaveCb.cancelled = true;
el._leaveCb();
}
var data = resolveTransition(vnode.data.transition);
if (!data) {
return
}
/* istanbul ignore if */
if (el._enterCb || el.nodeType !== 1) {
return
}
var css = data.css;
var type = data.type;
var enterClass = data.enterClass;
var enterToClass = data.enterToClass;
var enterActiveClass = data.enterActiveClass;
var appearClass = data.appearClass;
var appearToClass = data.appearToClass;
var appearActiveClass = data.appearActiveClass;
var beforeEnter = data.beforeEnter;
var enter = data.enter;
var afterEnter = data.afterEnter;
var enterCancelled = data.enterCancelled;
var beforeAppear = data.beforeAppear;
var appear = data.appear;
var afterAppear = data.afterAppear;
var appearCancelled = data.appearCancelled;
var duration = data.duration;
// activeInstance will always be the <transition> component managing this
// transition. One edge case to check is when the <transition> is placed
// as the root node of a child component. In that case we need to check
// <transition>'s parent for appear check.
var context = activeInstance;
var transitionNode = activeInstance.$vnode;
while (transitionNode && transitionNode.parent) {
transitionNode = transitionNode.parent;
context = transitionNode.context;
}
var isAppear = !context._isMounted || !vnode.isRootInsert;
if (isAppear && !appear && appear !== '') {
return
}
var startClass = isAppear && appearClass
? appearClass
: enterClass;
var activeClass = isAppear && appearActiveClass
? appearActiveClass
: enterActiveClass;
var toClass = isAppear && appearToClass
? appearToClass
: enterToClass;
var beforeEnterHook = isAppear
? (beforeAppear || beforeEnter)
: beforeEnter;
var enterHook = isAppear
? (typeof appear === 'function' ? appear : enter)
: enter;
var afterEnterHook = isAppear
? (afterAppear || afterEnter)
: afterEnter;
var enterCancelledHook = isAppear
? (appearCancelled || enterCancelled)
: enterCancelled;
var explicitEnterDuration = toNumber(
isObject(duration)
? duration.enter
: duration
);
if (process.env.NODE_ENV !== 'production' && explicitEnterDuration != null) {
checkDuration(explicitEnterDuration, 'enter', vnode);
}
var expectsCSS = css !== false && !isIE9;
var userWantsControl = getHookArgumentsLength(enterHook);
var cb = el._enterCb = once(function () {
if (expectsCSS) {
removeTransitionClass(el, toClass);
removeTransitionClass(el, activeClass);
}
if (cb.cancelled) {
if (expectsCSS) {
removeTransitionClass(el, startClass);
}
enterCancelledHook && enterCancelledHook(el);
} else {
afterEnterHook && afterEnterHook(el);
}
el._enterCb = null;
});
if (!vnode.data.show) {
// remove pending leave element on enter by injecting an insert hook
mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
var parent = el.parentNode;
var pendingNode = parent && parent._pending && parent._pending[vnode.key];
if (pendingNode &&
pendingNode.tag === vnode.tag &&
pendingNode.elm._leaveCb) {
pendingNode.elm._leaveCb();
}
enterHook && enterHook(el, cb);
});
}
// start enter transition
beforeEnterHook && beforeEnterHook(el);
if (expectsCSS) {
addTransitionClass(el, startClass);
addTransitionClass(el, activeClass);
nextFrame(function () {
addTransitionClass(el, toClass);
removeTransitionClass(el, startClass);
if (!cb.cancelled && !userWantsControl) {
if (isValidDuration(explicitEnterDuration)) {
setTimeout(cb, explicitEnterDuration);
} else {
whenTransitionEnds(el, type, cb);
}
}
});
}
if (vnode.data.show) {
toggleDisplay && toggleDisplay();
enterHook && enterHook(el, cb);
}
if (!expectsCSS && !userWantsControl) {
cb();
}
}
function leave (vnode, rm) {
var el = vnode.elm;
// call enter callback now
if (el._enterCb) {
el._enterCb.cancelled = true;
el._enterCb();
}
var data = resolveTransition(vnode.data.transition);
if (!data) {
return rm()
}
/* istanbul ignore if */
if (el._leaveCb || el.nodeType !== 1) {
return
}
var css = data.css;
var type = data.type;
var leaveClass = data.leaveClass;
var leaveToClass = data.leaveToClass;
var leaveActiveClass = data.leaveActiveClass;
var beforeLeave = data.beforeLeave;
var leave = data.leave;
var afterLeave = data.afterLeave;
var leaveCancelled = data.leaveCancelled;
var delayLeave = data.delayLeave;
var duration = data.duration;
var expectsCSS = css !== false && !isIE9;
var userWantsControl = getHookArgumentsLength(leave);
var explicitLeaveDuration = toNumber(
isObject(duration)
? duration.leave
: duration
);
if (process.env.NODE_ENV !== 'production' && explicitLeaveDuration != null) {
checkDuration(explicitLeaveDuration, 'leave', vnode);
}
var cb = el._leaveCb = once(function () {
if (el.parentNode && el.parentNode._pending) {
el.parentNode._pending[vnode.key] = null;
}
if (expectsCSS) {
removeTransitionClass(el, leaveToClass);
removeTransitionClass(el, leaveActiveClass);
}
if (cb.cancelled) {
if (expectsCSS) {
removeTransitionClass(el, leaveClass);
}
leaveCancelled && leaveCancelled(el);
} else {
rm();
afterLeave && afterLeave(el);
}
el._leaveCb = null;
});
if (delayLeave) {
delayLeave(performLeave);
} else {
performLeave();
}
function performLeave () {
// the delayed leave may have already been cancelled
if (cb.cancelled) {
return
}
// record leaving element
if (!vnode.data.show) {
(el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
}
beforeLeave && beforeLeave(el);
if (expectsCSS) {
addTransitionClass(el, leaveClass);
addTransitionClass(el, leaveActiveClass);
nextFrame(function () {
addTransitionClass(el, leaveToClass);
removeTransitionClass(el, leaveClass);
if (!cb.cancelled && !userWantsControl) {
if (isValidDuration(explicitLeaveDuration)) {
setTimeout(cb, explicitLeaveDuration);
} else {
whenTransitionEnds(el, type, cb);
}
}
});
}
leave && leave(el, cb);
if (!expectsCSS && !userWantsControl) {
cb();
}
}
}
// only used in dev mode
function checkDuration (val, name, vnode) {
if (typeof val !== 'number') {
warn(
"<transition> explicit " + name + " duration is not a valid number - " +
"got " + (JSON.stringify(val)) + ".",
vnode.context
);
} else if (isNaN(val)) {
warn(
"<transition> explicit " + name + " duration is NaN - " +
'the duration expression might be incorrect.',
vnode.context
);
}
}
function isValidDuration (val) {
return typeof val === 'number' && !isNaN(val)
}
/**
* Normalize a transition hook's argument length. The hook may be:
* - a merged hook (invoker) with the original in .fns
* - a wrapped component method (check ._length)
* - a plain function (.length)
*/
function getHookArgumentsLength (fn) {
if (!fn) { return false }
var invokerFns = fn.fns;
if (invokerFns) {
// invoker
return getHookArgumentsLength(
Array.isArray(invokerFns)
? invokerFns[0]
: invokerFns
)
} else {
return (fn._length || fn.length) > 1
}
}
function _enter (_, vnode) {
if (!vnode.data.show) {
enter(vnode);
}
}
var transition = inBrowser ? {
create: _enter,
activate: _enter,
remove: function remove$$1 (vnode, rm) {
/* istanbul ignore else */
if (!vnode.data.show) {
leave(vnode, rm);
} else {
rm();
}
}
} : {};
var platformModules = [
attrs,
klass,
events,
domProps,
style,
transition
];
/* */
// the directive module should be applied last, after all
// built-in modules have been applied.
var modules = platformModules.concat(baseModules);
var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
/**
* Not type checking this file because flow doesn't like attaching
* properties to Elements.
*/
/* istanbul ignore if */
if (isIE9) {
// http://www.matts411.com/post/internet-explorer-9-oninput/
document.addEventListener('selectionchange', function () {
var el = document.activeElement;
if (el && el.vmodel) {
trigger(el, 'input');
}
});
}
var model$1 = {
inserted: function inserted (el, binding, vnode) {
if (vnode.tag === 'select') {
var cb = function () {
setSelected(el, binding, vnode.context);
};
cb();
/* istanbul ignore if */
if (isIE || isEdge) {
setTimeout(cb, 0);
}
} else if (vnode.tag === 'textarea' || el.type === 'text') {
el._vModifiers = binding.modifiers;
if (!binding.modifiers.lazy) {
if (!isAndroid) {
el.addEventListener('compositionstart', onCompositionStart);
el.addEventListener('compositionend', onCompositionEnd);
}
/* istanbul ignore if */
if (isIE9) {
el.vmodel = true;
}
}
}
},
componentUpdated: function componentUpdated (el, binding, vnode) {
if (vnode.tag === 'select') {
setSelected(el, binding, vnode.context);
// in case the options rendered by v-for have changed,
// it's possible that the value is out-of-sync with the rendered options.
// detect such cases and filter out values that no longer has a matching
// option in the DOM.
var needReset = el.multiple
? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
: binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
if (needReset) {
trigger(el, 'change');
}
}
}
};
function setSelected (el, binding, vm) {
var value = binding.value;
var isMultiple = el.multiple;
if (isMultiple && !Array.isArray(value)) {
process.env.NODE_ENV !== 'production' && warn(
"<select multiple v-model=\"" + (binding.expression) + "\"> " +
"expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
vm
);
return
}
var selected, option;
for (var i = 0, l = el.options.length; i < l; i++) {
option = el.options[i];
if (isMultiple) {
selected = looseIndexOf(value, getValue(option)) > -1;
if (option.selected !== selected) {
option.selected = selected;
}
} else {
if (looseEqual(getValue(option), value)) {
if (el.selectedIndex !== i) {
el.selectedIndex = i;
}
return
}
}
}
if (!isMultiple) {
el.selectedIndex = -1;
}
}
function hasNoMatchingOption (value, options) {
for (var i = 0, l = options.length; i < l; i++) {
if (looseEqual(getValue(options[i]), value)) {
return false
}
}
return true
}
function getValue (option) {
return '_value' in option
? option._value
: option.value
}
function onCompositionStart (e) {
e.target.composing = true;
}
function onCompositionEnd (e) {
e.target.composing = false;
trigger(e.target, 'input');
}
function trigger (el, type) {
var e = document.createEvent('HTMLEvents');
e.initEvent(type, true, true);
el.dispatchEvent(e);
}
/* */
// recursively search for possible transition defined inside the component root
function locateNode (vnode) {
return vnode.componentInstance && (!vnode.data || !vnode.data.transition)
? locateNode(vnode.componentInstance._vnode)
: vnode
}
var show = {
bind: function bind (el, ref, vnode) {
var value = ref.value;
vnode = locateNode(vnode);
var transition = vnode.data && vnode.data.transition;
var originalDisplay = el.__vOriginalDisplay =
el.style.display === 'none' ? '' : el.style.display;
if (value && transition && !isIE9) {
vnode.data.show = true;
enter(vnode, function () {
el.style.display = originalDisplay;
});
} else {
el.style.display = value ? originalDisplay : 'none';
}
},
update: function update (el, ref, vnode) {
var value = ref.value;
var oldValue = ref.oldValue;
/* istanbul ignore if */
if (value === oldValue) { return }
vnode = locateNode(vnode);
var transition = vnode.data && vnode.data.transition;
if (transition && !isIE9) {
vnode.data.show = true;
if (value) {
enter(vnode, function () {
el.style.display = el.__vOriginalDisplay;
});
} else {
leave(vnode, function () {
el.style.display = 'none';
});
}
} else {
el.style.display = value ? el.__vOriginalDisplay : 'none';
}
},
unbind: function unbind (
el,
binding,
vnode,
oldVnode,
isDestroy
) {
if (!isDestroy) {
el.style.display = el.__vOriginalDisplay;
}
}
};
var platformDirectives = {
model: model$1,
show: show
};
/* */
// Provides transition support for a single element/component.
// supports transition mode (out-in / in-out)
var transitionProps = {
name: String,
appear: Boolean,
css: Boolean,
mode: String,
type: String,
enterClass: String,
leaveClass: String,
enterToClass: String,
leaveToClass: String,
enterActiveClass: String,
leaveActiveClass: String,
appearClass: String,
appearActiveClass: String,
appearToClass: String,
duration: [Number, String, Object]
};
// in case the child is also an abstract component, e.g. <keep-alive>
// we want to recursively retrieve the real component to be rendered
function getRealChild (vnode) {
var compOptions = vnode && vnode.componentOptions;
if (compOptions && compOptions.Ctor.options.abstract) {
return getRealChild(getFirstComponentChild(compOptions.children))
} else {
return vnode
}
}
function extractTransitionData (comp) {
var data = {};
var options = comp.$options;
// props
for (var key in options.propsData) {
data[key] = comp[key];
}
// events.
// extract listeners and pass them directly to the transition methods
var listeners = options._parentListeners;
for (var key$1 in listeners) {
data[camelize(key$1)] = listeners[key$1];
}
return data
}
function placeholder (h, rawChild) {
return /\d-keep-alive$/.test(rawChild.tag)
? h('keep-alive')
: null
}
function hasParentTransition (vnode) {
while ((vnode = vnode.parent)) {
if (vnode.data.transition) {
return true
}
}
}
function isSameChild (child, oldChild) {
return oldChild.key === child.key && oldChild.tag === child.tag
}
var Transition = {
name: 'transition',
props: transitionProps,
abstract: true,
render: function render (h) {
var this$1 = this;
var children = this.$slots.default;
if (!children) {
return
}
// filter out text nodes (possible whitespaces)
children = children.filter(function (c) { return c.tag; });
/* istanbul ignore if */
if (!children.length) {
return
}
// warn multiple elements
if (process.env.NODE_ENV !== 'production' && children.length > 1) {
warn(
'<transition> can only be used on a single element. Use ' +
'<transition-group> for lists.',
this.$parent
);
}
var mode = this.mode;
// warn invalid mode
if (process.env.NODE_ENV !== 'production' &&
mode && mode !== 'in-out' && mode !== 'out-in') {
warn(
'invalid <transition> mode: ' + mode,
this.$parent
);
}
var rawChild = children[0];
// if this is a component root node and the component's
// parent container node also has transition, skip.
if (hasParentTransition(this.$vnode)) {
return rawChild
}
// apply transition data to child
// use getRealChild() to ignore abstract components e.g. keep-alive
var child = getRealChild(rawChild);
/* istanbul ignore if */
if (!child) {
return rawChild
}
if (this._leaving) {
return placeholder(h, rawChild)
}
// ensure a key that is unique to the vnode type and to this transition
// component instance. This key will be used to remove pending leaving nodes
// during entering.
var id = "__transition-" + (this._uid) + "-";
child.key = child.key == null
? id + child.tag
: isPrimitive(child.key)
? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
: child.key;
var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
var oldRawChild = this._vnode;
var oldChild = getRealChild(oldRawChild);
// mark v-show
// so that the transition module can hand over the control to the directive
if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
child.data.show = true;
}
if (oldChild && oldChild.data && !isSameChild(child, oldChild)) {
// replace old child transition data with fresh one
// important for dynamic transitions!
var oldData = oldChild && (oldChild.data.transition = extend({}, data));
// handle transition mode
if (mode === 'out-in') {
// return placeholder node and queue update when leave finishes
this._leaving = true;
mergeVNodeHook(oldData, 'afterLeave', function () {
this$1._leaving = false;
this$1.$forceUpdate();
});
return placeholder(h, rawChild)
} else if (mode === 'in-out') {
var delayedLeave;
var performLeave = function () { delayedLeave(); };
mergeVNodeHook(data, 'afterEnter', performLeave);
mergeVNodeHook(data, 'enterCancelled', performLeave);
mergeVNodeHook(oldData, 'delayLeave', function (leave) { delayedLeave = leave; });
}
}
return rawChild
}
};
/* */
// Provides transition support for list items.
// supports move transitions using the FLIP technique.
// Because the vdom's children update algorithm is "unstable" - i.e.
// it doesn't guarantee the relative positioning of removed elements,
// we force transition-group to update its children into two passes:
// in the first pass, we remove all nodes that need to be removed,
// triggering their leaving transition; in the second pass, we insert/move
// into the final desired state. This way in the second pass removed
// nodes will remain where they should be.
var props = extend({
tag: String,
moveClass: String
}, transitionProps);
delete props.mode;
var TransitionGroup = {
props: props,
render: function render (h) {
var tag = this.tag || this.$vnode.data.tag || 'span';
var map = Object.create(null);
var prevChildren = this.prevChildren = this.children;
var rawChildren = this.$slots.default || [];
var children = this.children = [];
var transitionData = extractTransitionData(this);
for (var i = 0; i < rawChildren.length; i++) {
var c = rawChildren[i];
if (c.tag) {
if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
children.push(c);
map[c.key] = c
;(c.data || (c.data = {})).transition = transitionData;
} else if (process.env.NODE_ENV !== 'production') {
var opts = c.componentOptions;
var name = opts ? (opts.Ctor.options.name || opts.tag || '') : c.tag;
warn(("<transition-group> children must be keyed: <" + name + ">"));
}
}
}
if (prevChildren) {
var kept = [];
var removed = [];
for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
var c$1 = prevChildren[i$1];
c$1.data.transition = transitionData;
c$1.data.pos = c$1.elm.getBoundingClientRect();
if (map[c$1.key]) {
kept.push(c$1);
} else {
removed.push(c$1);
}
}
this.kept = h(tag, null, kept);
this.removed = removed;
}
return h(tag, null, children)
},
beforeUpdate: function beforeUpdate () {
// force removing pass
this.__patch__(
this._vnode,
this.kept,
false, // hydrating
true // removeOnly (!important, avoids unnecessary moves)
);
this._vnode = this.kept;
},
updated: function updated () {
var children = this.prevChildren;
var moveClass = this.moveClass || ((this.name || 'v') + '-move');
if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
return
}
// we divide the work into three loops to avoid mixing DOM reads and writes
// in each iteration - which helps prevent layout thrashing.
children.forEach(callPendingCbs);
children.forEach(recordPosition);
children.forEach(applyTranslation);
// force reflow to put everything in position
var body = document.body;
var f = body.offsetHeight; // eslint-disable-line
children.forEach(function (c) {
if (c.data.moved) {
var el = c.elm;
var s = el.style;
addTransitionClass(el, moveClass);
s.transform = s.WebkitTransform = s.transitionDuration = '';
el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
if (!e || /transform$/.test(e.propertyName)) {
el.removeEventListener(transitionEndEvent, cb);
el._moveCb = null;
removeTransitionClass(el, moveClass);
}
});
}
});
},
methods: {
hasMove: function hasMove (el, moveClass) {
/* istanbul ignore if */
if (!hasTransition) {
return false
}
if (this._hasMove != null) {
return this._hasMove
}
// Detect whether an element with the move class applied has
// CSS transitions. Since the element may be inside an entering
// transition at this very moment, we make a clone of it and remove
// all other transition classes applied to ensure only the move class
// is applied.
var clone = el.cloneNode();
if (el._transitionClasses) {
el._transitionClasses.forEach(function (cls) { removeClass(clone, cls); });
}
addClass(clone, moveClass);
clone.style.display = 'none';
this.$el.appendChild(clone);
var info = getTransitionInfo(clone);
this.$el.removeChild(clone);
return (this._hasMove = info.hasTransform)
}
}
};
function callPendingCbs (c) {
/* istanbul ignore if */
if (c.elm._moveCb) {
c.elm._moveCb();
}
/* istanbul ignore if */
if (c.elm._enterCb) {
c.elm._enterCb();
}
}
function recordPosition (c) {
c.data.newPos = c.elm.getBoundingClientRect();
}
function applyTranslation (c) {
var oldPos = c.data.pos;
var newPos = c.data.newPos;
var dx = oldPos.left - newPos.left;
var dy = oldPos.top - newPos.top;
if (dx || dy) {
c.data.moved = true;
var s = c.elm.style;
s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
s.transitionDuration = '0s';
}
}
var platformComponents = {
Transition: Transition,
TransitionGroup: TransitionGroup
};
/* */
// install platform specific utils
Vue$2.config.mustUseProp = mustUseProp;
Vue$2.config.isReservedTag = isReservedTag;
Vue$2.config.getTagNamespace = getTagNamespace;
Vue$2.config.isUnknownElement = isUnknownElement;
// install platform runtime directives & components
extend(Vue$2.options.directives, platformDirectives);
extend(Vue$2.options.components, platformComponents);
// install platform patch function
Vue$2.prototype.__patch__ = inBrowser ? patch : noop;
// public mount method
Vue$2.prototype.$mount = function (
el,
hydrating
) {
el = el && inBrowser ? query(el) : undefined;
return mountComponent(this, el, hydrating)
};
// devtools global hook
/* istanbul ignore next */
setTimeout(function () {
if (config.devtools) {
if (devtools) {
devtools.emit('init', Vue$2);
} else if (process.env.NODE_ENV !== 'production' && isChrome) {
console[console.info ? 'info' : 'log'](
'Download the Vue Devtools extension for a better development experience:\n' +
'https://github.com/vuejs/vue-devtools'
);
}
}
if (process.env.NODE_ENV !== 'production' &&
config.productionTip !== false &&
inBrowser && typeof console !== 'undefined') {
console[console.info ? 'info' : 'log'](
"You are running Vue in development mode.\n" +
"Make sure to turn on production mode when deploying for production.\n" +
"See more tips at https://vuejs.org/guide/deployment.html"
);
}
}, 0);
export default Vue$2;
|
ajax/libs/react-highcharts/7.0.0/index.src.js | menuka94/cdnjs | (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("react"));
else if(typeof define === 'function' && define.amd)
define(["react"], factory);
else if(typeof exports === 'object')
exports["index"] = factory(require("react"));
else
root["index"] = factory(root["react"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_3__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var chartFactory = __webpack_require__(2);
module.exports = chartFactory(Highcharts, 'Chart');
/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _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; };
if (typeof Highcharts === 'undefined') {
throw Error('Starting with version 3 of react-highcharts, Highcharts is not bundled by default. ' + ' please include highcharts. ');
}
(function (React) {
if (!React) {
React = __webpack_require__(3);
if (!React) {
throw Error("react-highcharts does not include React");
}
}
module.exports = function (Highcharts, chartType) {
var displayName = 'Highcharts' + chartType;
var result = React.createClass({
displayName: displayName,
propTypes: {
config: React.PropTypes.object.isRequired,
isPureConfig: React.PropTypes.bool
},
renderChart: function renderChart(config) {
if (!config) {
throw new Error('Config must be specified for the ' + displayName + ' component');
}
var chartConfig = config.chart;
this.chart = new Highcharts[chartType](_extends({}, config, {
chart: _extends({}, chartConfig, {
renderTo: this.refs.chart
})
}));
},
shouldComponentUpdate: function shouldComponentUpdate(nextProps) {
if (!this.props.isPureConfig || !(this.props.config === nextProps.config)) {
this.renderChart(nextProps.config);
}
return true;
},
getChart: function getChart() {
if (!this.chart) {
throw new Error('getChart() should not be called before the component is mounted');
}
return this.chart;
},
componentDidMount: function componentDidMount() {
this.renderChart(this.props.config);
},
render: function render() {
var props = this.props;
props = _extends({}, props, {
ref: 'chart'
});
return React.createElement('div', props);
}
});
result.Highcharts = Highcharts;
return result;
};
})(typeof React !== 'undefined' && React);
/***/ },
/* 3 */
/***/ function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
/***/ }
/******/ ])
});
; |
frontend/src/Settings/DownloadClients/DownloadClients/AddDownloadClientModalContent.js | lidarr/Lidarr | import PropTypes from 'prop-types';
import React, { Component } from 'react';
import Alert from 'Components/Alert';
import FieldSet from 'Components/FieldSet';
import Button from 'Components/Link/Button';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import ModalBody from 'Components/Modal/ModalBody';
import ModalContent from 'Components/Modal/ModalContent';
import ModalFooter from 'Components/Modal/ModalFooter';
import ModalHeader from 'Components/Modal/ModalHeader';
import { kinds } from 'Helpers/Props';
import AddDownloadClientItem from './AddDownloadClientItem';
import styles from './AddDownloadClientModalContent.css';
class AddDownloadClientModalContent extends Component {
//
// Render
render() {
const {
isSchemaFetching,
isSchemaPopulated,
schemaError,
usenetDownloadClients,
torrentDownloadClients,
onDownloadClientSelect,
onModalClose
} = this.props;
return (
<ModalContent onModalClose={onModalClose}>
<ModalHeader>
Add Download Client
</ModalHeader>
<ModalBody>
{
isSchemaFetching &&
<LoadingIndicator />
}
{
!isSchemaFetching && !!schemaError &&
<div>Unable to add a new downloadClient, please try again.</div>
}
{
isSchemaPopulated && !schemaError &&
<div>
<Alert kind={kinds.INFO}>
<div>Lidarr supports any downloadClient that uses the Newznab standard, as well as other downloadClients listed below.</div>
<div>For more information on the individual downloadClients, click on the info buttons.</div>
</Alert>
<FieldSet legend="Usenet">
<div className={styles.downloadClients}>
{
usenetDownloadClients.map((downloadClient) => {
return (
<AddDownloadClientItem
key={downloadClient.implementation}
implementation={downloadClient.implementation}
{...downloadClient}
onDownloadClientSelect={onDownloadClientSelect}
/>
);
})
}
</div>
</FieldSet>
<FieldSet legend="Torrents">
<div className={styles.downloadClients}>
{
torrentDownloadClients.map((downloadClient) => {
return (
<AddDownloadClientItem
key={downloadClient.implementation}
implementation={downloadClient.implementation}
{...downloadClient}
onDownloadClientSelect={onDownloadClientSelect}
/>
);
})
}
</div>
</FieldSet>
</div>
}
</ModalBody>
<ModalFooter>
<Button
onPress={onModalClose}
>
Close
</Button>
</ModalFooter>
</ModalContent>
);
}
}
AddDownloadClientModalContent.propTypes = {
isSchemaFetching: PropTypes.bool.isRequired,
isSchemaPopulated: PropTypes.bool.isRequired,
schemaError: PropTypes.object,
usenetDownloadClients: PropTypes.arrayOf(PropTypes.object).isRequired,
torrentDownloadClients: PropTypes.arrayOf(PropTypes.object).isRequired,
onDownloadClientSelect: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired
};
export default AddDownloadClientModalContent;
|
src/views/NavBar/index.js | aplee29/online-notebook-app-client | import React, { Component } from 'react';
import { Navbar, Nav, NavItem } from 'react-bootstrap';
import PropTypes from 'prop-types';
export default class NavBar extends Component {
static contextTypes = {
router: PropTypes.object
}
handleLogout = () => this.props.logout(this.context.router);
render() {
const { isAuthenticated } = this.props;
const token = localStorage.getItem('token');
return (
<div>
<Navbar inverse>
<Navbar.Header>
<Navbar.Brand>
<a href="/">Online Notebook App</a>
</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
<Navbar.Collapse>
{
(isAuthenticated && !!token) ?
<Nav>
<NavItem eventKey={1} href="/">Home</NavItem>
<NavItem eventKey={2} href="/dashboard">Dashboard</NavItem>
<NavItem eventKey={3} href="/notes/new">Create a New Note</NavItem>
<NavItem eventKey={4} onClick={this.handleLogout}>Log Out</NavItem>
</Nav>
:
<Nav>
<NavItem eventKey={1} href="/">Home</NavItem>
<NavItem eventKey={2} href="/login">Login</NavItem>
<NavItem eventKey={3} href="/signup">Signup</NavItem>
</Nav>
}
</Navbar.Collapse>
</Navbar>
</div>
)
}
}
NavBar.propTypes = {
isAuthenticated: PropTypes.bool.isRequired,
logout: PropTypes.func
};
|
app/javascript/mastodon/features/ui/util/reduced_motion.js | PlantsNetwork/mastodon | // Like react-motion's Motion, but reduces all animations to cross-fades
// for the benefit of users with motion sickness.
import React from 'react';
import Motion from 'react-motion/lib/Motion';
import PropTypes from 'prop-types';
const stylesToKeep = ['opacity', 'backgroundOpacity'];
const extractValue = (value) => {
// This is either an object with a "val" property or it's a number
return (typeof value === 'object' && value && 'val' in value) ? value.val : value;
};
class ReducedMotion extends React.Component {
static propTypes = {
defaultStyle: PropTypes.object,
style: PropTypes.object,
children: PropTypes.func,
}
render() {
const { style, defaultStyle, children } = this.props;
Object.keys(style).forEach(key => {
if (stylesToKeep.includes(key)) {
return;
}
// If it's setting an x or height or scale or some other value, we need
// to preserve the end-state value without actually animating it
style[key] = defaultStyle[key] = extractValue(style[key]);
});
return (
<Motion style={style} defaultStyle={defaultStyle}>
{children}
</Motion>
);
}
}
export default ReducedMotion;
|
ajax/libs/thorax/2.0.0rc3/thorax.min.js | NBZ4live/cdnjs | (function(e,t){"use strict";function _(e){var t=e.length,n=y.type(e);return y.isWindow(e)?!1:e.nodeType===1&&t?!0:n==="array"||n!=="function"&&(t===0||typeof t=="number"&&t>0&&t-1 in e)}function P(e){var t=D[e]={};return y.each(e.match(w)||[],function(e,n){t[n]=!0}),t}function j(e,n,r,i){if(!y.acceptData(e))return;var s,o,u=y.expando,a=typeof n=="string",l=e.nodeType,c=l?y.cache:e,h=l?e[u]:e[u]&&u;if((!h||!c[h]||!i&&!c[h].data)&&a&&r===t)return;h||(l?e[u]=h=f.pop()||y.guid++:h=u),c[h]||(c[h]={},l||(c[h].toJSON=y.noop));if(typeof n=="object"||typeof n=="function")i?c[h]=y.extend(c[h],n):c[h].data=y.extend(c[h].data,n);return s=c[h],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[y.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[y.camelCase(n)])):o=s,o}function F(e,t,n){if(!y.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?y.cache:e,a=o?e[y.expando]:y.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){y.isArray(t)?t=t.concat(y.map(t,y.camelCase)):t in r?t=[t]:(t=y.camelCase(t),t in r?t=[t]:t=t.split(" "));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?q:y.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!q(u[a]))return}o?y.cleanData([e],!0):y.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null}function I(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(B,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:H.test(r)?y.parseJSON(r):r}catch(s){}y.data(e,n,r)}else r=t}return r}function q(e){var t;for(t in e){if(t==="data"&&y.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function nt(){return!0}function rt(){return!1}function ft(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function lt(e,t,n){t=t||0;if(y.isFunction(t))return y.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return y.grep(e,function(e){return e===t===n});if(typeof t=="string"){var r=y.grep(e,function(e){return e.nodeType===1});if(ot.test(t))return y.filter(t,r,!n);t=y.filter(t,r)}return y.grep(e,function(e){return y.inArray(e,t)>=0===n})}function ct(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function At(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ot(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function Mt(e){var t=Tt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;(n=e[r])!=null;r++)y._data(n,"globalEval",!t||y._data(t[r],"globalEval"))}function Dt(e,t){if(t.nodeType!==1||!y.hasData(e))return;var n,r,i,s=y._data(e),o=y._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)y.event.add(t,n,u[n][r])}o.data&&(o.data=y.extend({},o.data))}function Pt(e,t){var n,r,i;if(t.nodeType!==1)return;n=t.nodeName.toLowerCase();if(!y.support.noCloneEvent&&t[y.expando]){r=y._data(t);for(i in r.events)y.removeEvent(t,i,r.handle);t.removeAttribute(y.expando)}if(n==="script"&&t.text!==e.text)Ot(t).text=e.text,Mt(t);else if(n==="object")t.parentNode&&(t.outerHTML=e.outerHTML),y.support.html5Clone&&e.innerHTML&&!y.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML);else if(n==="input"&&Et.test(e.type))t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value);else if(n==="option")t.defaultSelected=t.selected=e.defaultSelected;else if(n==="input"||n==="textarea")t.defaultValue=e.defaultValue}function Ht(e,n){var r,i,s=0,o=typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll(n||"*"):t;if(!o)for(o=[],r=e.childNodes||e;(i=r[s])!=null;s++)!n||y.nodeName(i,n)?o.push(i):y.merge(o,Ht(i,n));return n===t||n&&y.nodeName(e,n)?y.merge([e],o):o}function Bt(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Zt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Yt.length;while(i--){t=Yt[i]+n;if(t in e)return t}return r}function en(e,t){return e=t||e,y.css(e,"display")==="none"||!y.contains(e.ownerDocument,e)}function tn(e,t){var n,r=[],i=0,s=e.length;for(;i<s;i++){n=e[i];if(!n.style)continue;r[i]=y._data(n,"olddisplay"),t?(!r[i]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&en(n)&&(r[i]=y._data(n,"olddisplay",on(n.nodeName)))):!r[i]&&!en(n)&&y._data(n,"olddisplay",y.css(n,"display"))}for(i=0;i<s;i++){n=e[i];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?r[i]||"":"none"}return e}function nn(e,t,n){var r=Xt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function rn(e,t,n,r,i){var s=n===(r?"border":"content")?4:t==="width"?1:0,o=0;for(;s<4;s+=2)n==="margin"&&(o+=y.css(e,n+Gt[s],!0,i)),r?(n==="content"&&(o-=y.css(e,"padding"+Gt[s],!0,i)),n!=="margin"&&(o-=y.css(e,"border"+Gt[s]+"Width",!0,i))):(o+=y.css(e,"padding"+Gt[s],!0,i),n!=="padding"&&(o+=y.css(e,"border"+Gt[s]+"Width",!0,i)));return o}function sn(e,t,n){var r=!0,i=t==="width"?e.offsetWidth:e.offsetHeight,s=Ft(e),o=y.support.boxSizing&&y.css(e,"boxSizing",!1,s)==="border-box";if(i<=0||i==null){i=jt(e,t,s);if(i<0||i==null)i=e.style[t];if(Vt.test(i))return i;r=o&&(y.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+rn(e,t,n||(o?"border":"content"),r,s)+"px"}function on(e){var t=i,n=Jt[e];if(!n){n=un(e,t);if(n==="none"||!n)It=(It||y("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(It[0].contentWindow||It[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),It.detach();Jt[e]=n}return n}function un(e,t){var n=y(t.createElement(e)).appendTo(t.body),r=y.css(n[0],"display");return n.remove(),r}function pn(e,t,n,r){var i;if(y.isArray(t))y.each(t,function(t,i){n||fn.test(e)?r(e,i):pn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&y.type(t)==="object")for(i in t)pn(e+"["+i+"]",t[i],n,r);else r(e,t)}function On(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i=0,s=t.toLowerCase().match(w)||[];if(y.isFunction(n))while(r=s[i++])r[0]==="+"?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function Mn(e,t,n,r){function o(u){var a;return i[u]=!0,y.each(e[u]||[],function(e,u){var f=u(t,n,r);if(typeof f=="string"&&!s&&!i[f])return t.dataTypes.unshift(f),o(f),!1;if(s)return!(a=f)}),a}var i={},s=e===kn;return o(t.dataTypes[0])||!i["*"]&&o("*")}function _n(e,n){var r,i,s=y.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);return i&&y.extend(!0,e,i),e}function Dn(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("Content-Type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function Pn(e,t){var n,r,i,s,o={},u=0,a=e.dataTypes.slice(),f=a[0];e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(a[1])for(n in e.converters)o[n.toLowerCase()]=e.converters[n];for(;i=a[++u];)if(i!=="*"){if(f!=="*"&&f!==i){n=o[f+" "+i]||o["* "+i];if(!n)for(r in o){s=r.split(" ");if(s[1]===i){n=o[f+" "+s[0]]||o["* "+s[0]];if(n){n===!0?n=o[r]:o[r]!==!0&&(i=s[0],a.splice(u--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+f+" to "+i}}}f=i}return{state:"success",data:t}}function Rn(){try{return new e.XMLHttpRequest}catch(t){}}function Un(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function Qn(){return setTimeout(function(){zn=t}),zn=y.now()}function Gn(e,t){y.each(t,function(t,n){var r=(Kn[t]||[]).concat(Kn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Yn(e,t,n){var r,i,s=0,o=Jn.length,u=y.Deferred().always(function(){delete a.elem}),a=function(){if(i)return!1;var t=zn||Qn(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,s=1-r,o=0,a=f.tweens.length;for(;o<a;o++)f.tweens[o].run(s);return u.notifyWith(e,[f,s,n]),s<1&&a?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:y.extend({},t),opts:y.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:zn||Qn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=y.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(r),r},stop:function(t){var n=0,r=t?f.tweens.length:0;if(i)return this;i=!0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Zn(l,f.opts.specialEasing);for(;s<o;s++){r=Jn[s].call(f,e,l,f.opts);if(r)return r}return Gn(f,l),y.isFunction(f.opts.start)&&f.opts.start.call(e,f),y.fx.timer(y.extend(a,{elem:e,anim:f,queue:f.opts.queue})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Zn(e,t){var n,r,i,s,o;for(n in e){r=y.camelCase(n),i=t[r],s=e[n],y.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=y.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function er(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},v=[],m=e.nodeType&&en(e);n.queue||(l=y._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,y.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],y.css(e,"display")==="inline"&&y.css(e,"float")==="none"&&(!y.support.inlineBlockNeedsLayout||on(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",y.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Xn.exec(s)){delete t[r],a=a||s==="toggle";if(s===(m?"hide":"show"))continue;v.push(r)}}o=v.length;if(o){u=y._data(e,"fxshow")||y._data(e,"fxshow",{}),"hidden"in u&&(m=u.hidden),a&&(u.hidden=!m),m?y(e).show():h.done(function(){y(e).hide()}),h.done(function(){var t;y._removeData(e,"fxshow");for(t in d)y.style(e,t,d[t])});for(r=0;r<o;r++)i=v[r],f=h.createTween(i,m?u[i]:0),d[i]=u[i]||y.style(e,i),i in u||(u[i]=f.start,m&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function tr(e,t,n,r,i){return new tr.prototype.init(e,t,n,r,i)}function nr(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=Gt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function rr(e){return y.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.jQuery,u=e.$,a={},f=[],l="1.9.0",c=f.concat,h=f.push,p=f.slice,d=f.indexOf,v=a.toString,m=a.hasOwnProperty,g=l.trim,y=function(e,t){return new y.fn.init(e,t,n)},b=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,E=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,S=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,x=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,T=/^[\],:{}\s]*$/,N=/(?:^|:|,)(?:\s*\[)+/g,C=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,k=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,L=/^-ms-/,A=/-([\da-z])/gi,O=function(e,t){return t.toUpperCase()},M=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",M,!1),y.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",M),y.ready())};y.fn=y.prototype={jquery:l,constructor:y,init:function(e,n,r){var s,o;if(!e)return this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=S.exec(e);if(s&&(s[1]||!n)){if(s[1]){n=n instanceof y?n[0]:n,y.merge(this,y.parseHTML(s[1],n&&n.nodeType?n.ownerDocument||n:i,!0));if(x.test(s[1])&&y.isPlainObject(n))for(s in n)y.isFunction(this[s])?this[s](n[s]):this.attr(s,n[s]);return this}o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return e.nodeType?(this.context=this[0]=e,this.length=1,this):y.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),y.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return p.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e){var t=y.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return y.each(this,e,t)},ready:function(e){return y.ready.promise().done(e),this},slice:function(){return this.pushStack(p.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},map:function(e){return this.pushStack(y.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},y.fn.init.prototype=y.fn,y.extend=y.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!y.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(y.isPlainObject(i)||(s=y.isArray(i)))?(s?(s=!1,o=r&&y.isArray(r)?r:[]):o=r&&y.isPlainObject(r)?r:{},u[n]=y.extend(l,o,i)):i!==t&&(u[n]=i)}return u},y.extend({noConflict:function(t){return e.$===y&&(e.$=u),t&&e.jQuery===y&&(e.jQuery=o),y},isReady:!1,readyWait:1,holdReady:function(e){e?y.readyWait++:y.ready(!0)},ready:function(e){if(e===!0?--y.readyWait:y.isReady)return;if(!i.body)return setTimeout(y.ready);y.isReady=!0;if(e!==!0&&--y.readyWait>0)return;r.resolveWith(i,[y]),y.fn.trigger&&y(i).trigger("ready").off("ready")},isFunction:function(e){return y.type(e)==="function"},isArray:Array.isArray||function(e){return y.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):typeof e=="object"||typeof e=="function"?a[v.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||y.type(e)!=="object"||e.nodeType||y.isWindow(e))return!1;try{if(e.constructor&&!m.call(e,"constructor")&&!m.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||m.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){if(!e||typeof e!="string")return null;typeof t=="boolean"&&(n=t,t=!1),t=t||i;var r=x.exec(e),s=!n&&[];return r?[t.createElement(r[1])]:(r=y.buildFragment([e],t,s),s&&y(s).remove(),y.merge([],r.childNodes))},parseJSON:function(t){if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(t===null)return t;if(typeof t=="string"){t=y.trim(t);if(t&&T.test(t.replace(C,"@").replace(k,"]").replace(N,"")))return(new Function("return "+t))()}y.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&y.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&y.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(L,"ms-").replace(A,O)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,s=e.length,o=_(e);if(n)if(o)for(;i<s;i++){r=t.apply(e[i],n);if(r===!1)break}else for(i in e){r=t.apply(e[i],n);if(r===!1)break}else if(o)for(;i<s;i++){r=t.call(e[i],i,e[i]);if(r===!1)break}else for(i in e){r=t.call(e[i],i,e[i]);if(r===!1)break}return e},trim:g&&!g.call(" ")?function(e){return e==null?"":g.call(e)}:function(e){return e==null?"":(e+"").replace(E,"")},makeArray:function(e,t){var n=t||[];return e!=null&&(_(Object(e))?y.merge(n,typeof e=="string"?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(d)return d.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,t,n){var r,i=0,s=e.length,o=_(e),u=[];if(o)for(;i<s;i++)r=t(e[i],i,n),r!=null&&(u[u.length]=r);else for(i in e)r=t(e[i],i,n),r!=null&&(u[u.length]=r);return c.apply([],u)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),y.isFunction(e)?(i=p.call(arguments,2),s=function(){return e.apply(n||this,i.concat(p.call(arguments)))},s.guid=e.guid=e.guid||y.guid++,s):t},access:function(e,n,r,i,s,o,u){var a=0,f=e.length,l=r==null;if(y.type(r)==="object"){s=!0;for(a in r)y.access(e,n,a,r[a],!0,o,u)}else if(i!==t){s=!0,y.isFunction(i)||(u=!0),l&&(u?(n.call(e,i),n=null):(l=n,n=function(e,t,n){return l.call(y(e),n)}));if(n)for(;a<f;a++)n(e[a],r,u?i:i.call(e[a],a,n(e[a],r)))}return s?e:l?n.call(e):f?n(e[0],r):o},now:function(){return(new Date).getTime()}}),y.ready.promise=function(t){if(!r){r=y.Deferred();if(i.readyState==="complete")setTimeout(y.ready);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",M,!1),e.addEventListener("load",y.ready,!1);else{i.attachEvent("onreadystatechange",M),e.attachEvent("onload",y.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!y.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}y.ready()}}()}}return r.promise(t)},y.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){a["[object "+t+"]"]=t.toLowerCase()}),n=y(i);var D={};y.Callbacks=function(e){e=typeof e=="string"?D[e]||P(e):y.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){y.each(t,function(t,n){var i=y.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&y.each(arguments,function(e,t){var n;while((n=y.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return y.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},y.extend({Deferred:function(e){var t=[["resolve","done",y.Callbacks("once memory"),"resolved"],["reject","fail",y.Callbacks("once memory"),"rejected"],["notify","progress",y.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return y.Deferred(function(n){y.each(t,function(t,s){var o=s[0],u=y.isFunction(e[t])&&e[t];i[s[1]](function(){var e=u&&u.apply(this,arguments);e&&y.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[o+"With"](this===r?n.promise():this,u?[e]:arguments)})}),e=null}).promise()},promise:function(e){return e!=null?y.extend(e,r):r}},i={};return r.pipe=r.then,y.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=function(){return i[s[0]+"With"](this===i?r:this,arguments),this},i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=p.call(arguments),r=n.length,i=r!==1||e&&y.isFunction(e.promise)?r:0,s=i===1?e:y.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?p.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&y.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),y.support=function(){var t,n,r,s,o,u,a,f,l,c,h=i.createElement("div");h.setAttribute("className","t"),h.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=h.getElementsByTagName("*"),r=h.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=h.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:h.className!=="t",leadingWhitespace:h.firstChild.nodeType===3,tbody:!h.getElementsByTagName("tbody").length,htmlSerialize:!!h.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!u.value,optSelected:o.selected,enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete h.test}catch(p){t.deleteExpando=!1}u=i.createElement("input"),u.setAttribute("value",""),t.input=u.getAttribute("value")==="",u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","t"),u.setAttribute("name","t"),a=i.createDocumentFragment(),a.appendChild(u),t.appendChecked=u.checked,t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,h.attachEvent&&(h.attachEvent("onclick",function(){t.noCloneEvent=!1}),h.cloneNode(!0).click());for(c in{submit:!0,change:!0,focusin:!0})h.setAttribute(f="on"+c,"t"),t[c+"Bubbles"]=f in e||h.attributes[f].expando===!1;return h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle=h.style.backgroundClip==="content-box",y(function(){var n,r,s,o="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=i.getElementsByTagName("body")[0];if(!u)return;n=i.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(h),h.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=h.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",l=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=l&&s[0].offsetHeight===0,h.innerHTML="",h.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=h.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=u.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(h,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(h,null)||{width:"4px"}).width==="4px",r=h.appendChild(i.createElement("div")),r.style.cssText=h.style.cssText=o,r.style.marginRight=r.style.width="0",h.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof h.style.zoom!="undefined"&&(h.innerHTML="",h.style.cssText=o+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=h.offsetWidth===3,h.style.display="block",h.innerHTML="<div></div>",h.firstChild.style.width="5px",t.shrinkWrapBlocks=h.offsetWidth!==3,u.style.zoom=1),u.removeChild(n),n=h=s=r=null}),n=s=a=o=r=u=null,t}();var H=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;y.extend({cache:{},expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?y.cache[e[y.expando]]:e[y.expando],!!e&&!q(e)},data:function(e,t,n){return j(e,t,n,!1)},removeData:function(e,t){return F(e,t,!1)},_data:function(e,t,n){return j(e,t,n,!0)},_removeData:function(e,t){return F(e,t,!0)},acceptData:function(e){var t=e.nodeName&&y.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),y.fn.extend({data:function(e,n){var r,i,s=this[0],o=0,u=null;if(e===t){if(this.length){u=y.data(s);if(s.nodeType===1&&!y._data(s,"parsedAttrs")){r=s.attributes;for(;o<r.length;o++)i=r[o].name,i.indexOf("data-")||(i=y.camelCase(i.substring(5)),I(s,i,u[i]));y._data(s,"parsedAttrs",!0)}}return u}return typeof e=="object"?this.each(function(){y.data(this,e)}):y.access(this,function(n){if(n===t)return s?I(s,e,y.data(s,e)):null;this.each(function(){y.data(this,e,n)})},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){y.removeData(this,e)})}}),y.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=y._data(e,t),n&&(!r||y.isArray(n)?r=y._data(e,t,y.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=y.queue(e,t),r=n.length,i=n.shift(),s=y._queueHooks(e,t),o=function(){y.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),s.cur=i,i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return y._data(e,n)||y._data(e,n,{empty:y.Callbacks("once memory").add(function(){y._removeData(e,t+"queue"),y._removeData(e,n)})})}}),y.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?y.queue(this[0],e):n===t?this:this.each(function(){var t=y.queue(this,e,n);y._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&y.dequeue(this,e)})},dequeue:function(e){return this.each(function(){y.dequeue(this,e)})},delay:function(e,t){return e=y.fx?y.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=y.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=y._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var R,U,z=/[\t\r\n]/g,W=/\r/g,X=/^(?:input|select|textarea|button|object)$/i,V=/^(?:a|area)$/i,$=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,J=/^(?:checked|selected)$/i,K=y.support.getSetAttribute,Q=y.support.input;y.fn.extend({attr:function(e,t){return y.access(this,y.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){y.removeAttr(this,e)})},prop:function(e,t){return y.access(this,y.prop,e,t,arguments.length>1)},removeProp:function(e){return e=y.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o=0,u=this.length,a=typeof e=="string"&&e;if(y.isFunction(e))return this.each(function(t){y(this).addClass(e.call(this,t,this.className))});if(a){t=(e||"").match(w)||[];for(;o<u;o++){n=this[o],r=n.nodeType===1&&(n.className?(" "+n.className+" ").replace(z," "):" ");if(r){s=0;while(i=t[s++])r.indexOf(" "+i+" ")<0&&(r+=i+" ");n.className=y.trim(r)}}}return this},removeClass:function(e){var t,n,r,i,s,o=0,u=this.length,a=arguments.length===0||typeof e=="string"&&e;if(y.isFunction(e))return this.each(function(t){y(this).removeClass(e.call(this,t,this.className))});if(a){t=(e||"").match(w)||[];for(;o<u;o++){n=this[o],r=n.nodeType===1&&(n.className?(" "+n.className+" ").replace(z," "):"");if(r){s=0;while(i=t[s++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?y.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return y.isFunction(e)?this.each(function(n){y(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=y(this),u=t,a=e.match(w)||[];while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&y._data(this,"__className__",this.className),this.className=this.className||e===!1?"":y._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(z," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=y.valHooks[s.type]||y.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(W,""):r==null?"":r);return}return i=y.isFunction(e),this.each(function(r){var s,o=y(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":y.isArray(s)&&(s=y.map(s,function(e){return e==null?"":e+""})),n=y.valHooks[this.type]||y.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),y.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(y.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!y.nodeName(n.parentNode,"optgroup"))){t=y(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=y.makeArray(t);return y(e).find("option").each(function(){this.selected=y.inArray(y(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;if(typeof e.getAttribute=="undefined")return y.prop(e,n,r);o=u!==1||!y.isXMLDoc(e),o&&(n=n.toLowerCase(),s=y.attrHooks[n]||($.test(n)?U:R));if(r===t)return s&&o&&"get"in s&&(i=s.get(e,n))!==null?i:(typeof e.getAttribute!="undefined"&&(i=e.getAttribute(n)),i==null?t:i);if(r!==null)return s&&o&&"set"in s&&(i=s.set(e,r,n))!==t?i:(e.setAttribute(n,r+""),r);y.removeAttr(e,n)},removeAttr:function(e,t){var n,r,i=0,s=t&&t.match(w);if(s&&e.nodeType===1)while(n=s[i++])r=y.propFix[n]||n,$.test(n)?!K&&J.test(n)?e[y.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:y.attr(e,n,""),e.removeAttribute(K?n:r)},attrHooks:{type:{set:function(e,t){if(!y.support.radioValue&&t==="radio"&&y.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!y.isXMLDoc(e),o&&(n=y.propFix[n]||n,s=y.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):X.test(e.nodeName)||V.test(e.nodeName)&&e.href?0:t}}}}),U={get:function(e,n){var r=y.prop(e,n),i=typeof r=="boolean"&&e.getAttribute(n),s=typeof r=="boolean"?Q&&K?i!=null:J.test(n)?e[y.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return s&&s.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?y.removeAttr(e,n):Q&&K||!J.test(n)?e.setAttribute(!K&&y.propFix[n]||n,n):e[y.camelCase("default-"+n)]=e[n]=!0,n}};if(!Q||!K)y.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return y.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,t,n){if(!y.nodeName(e,"input"))return R&&R.set(e,t,n);e.defaultValue=t}};K||(R=y.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&(n==="id"||n==="name"||n==="coords"?r.value!=="":r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="",r==="value"||n===e.getAttribute(r)?n:t}},y.attrHooks.contenteditable={get:R.get,set:function(e,t,n){R.set(e,t===""?!1:t,n)}},y.each(["width","height"],function(e,t){y.attrHooks[t]=y.extend(y.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})})),y.support.hrefNormalized||(y.each(["href","src","width","height"],function(e,n){y.attrHooks[n]=y.extend(y.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r==null?t:r}})}),y.each(["href","src"],function(e,t){y.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),y.support.style||(y.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),y.support.optSelected||(y.propHooks.selected=y.extend(y.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),y.support.enctype||(y.propFix.enctype="encoding"),y.support.checkOn||y.each(["radio","checkbox"],function(){y.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),y.each(["radio","checkbox"],function(){y.valHooks[this]=y.extend(y.valHooks[this],{set:function(e,t){if(y.isArray(t))return e.checked=y.inArray(y(e).val(),t)>=0}})});var G=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|contextmenu)|click/,et=/^(?:focusinfocus|focusoutblur)$/,tt=/^([^.]*)(?:\.(.+)|)$/;y.event={global:{},add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,v,m,g=e.nodeType!==3&&e.nodeType!==8&&y._data(e);if(!g)return;r.handler&&(o=r,r=o.handler,s=o.selector),r.guid||(r.guid=y.guid++),(f=g.events)||(f=g.events={}),(u=g.handle)||(u=g.handle=function(e){return typeof y=="undefined"||!!e&&y.event.triggered===e.type?t:y.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--){a=tt.exec(n[l])||[],d=m=a[1],v=(a[2]||"").split(".").sort(),h=y.event.special[d]||{},d=(s?h.delegateType:h.bindType)||d,h=y.event.special[d]||{},c=y.extend({type:d,origType:m,data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&y.expr.match.needsContext.test(s),namespace:v.join(".")},o);if(!(p=f[d])){p=f[d]=[],p.delegateCount=0;if(!h.setup||h.setup.call(e,i,v,u)===!1)e.addEventListener?e.addEventListener(d,u,!1):e.attachEvent&&e.attachEvent("on"+d,u)}h.add&&(h.add.call(e,c),c.handler.guid||(c.handler.guid=r.guid)),s?p.splice(p.delegateCount++,0,c):p.push(c),y.event.global[d]=!0}e=null},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m=y.hasData(e)&&y._data(e);if(!m||!(a=m.events))return;t=(t||"").match(w)||[""],f=t.length;while(f--){u=tt.exec(t[f])||[],p=v=u[1],d=(u[2]||"").split(".").sort();if(!p){for(p in a)y.event.remove(e,p+t[f],n,r,!0);continue}c=y.event.special[p]||{},p=(r?c.delegateType:c.bindType)||p,h=a[p]||[],u=u[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),o=s=h.length;while(s--)l=h[s],(i||v===l.origType)&&(!n||n.guid===l.guid)&&(!u||u.test(l.namespace))&&(!r||r===l.selector||r==="**"&&l.selector)&&(h.splice(s,1),l.selector&&h.delegateCount--,c.remove&&c.remove.call(e,l));o&&!h.length&&((!c.teardown||c.teardown.call(e,d,m.handle)===!1)&&y.removeEvent(e,p,m.handle),delete a[p])}y.isEmptyObject(a)&&(delete m.handle,y._removeData(e,"events"))},trigger:function(n,r,s,o){var u,a,f,l,c,h,p,d=[s||i],v=n.type||n,m=n.namespace?n.namespace.split("."):[];a=f=s=s||i;if(s.nodeType===3||s.nodeType===8)return;if(et.test(v+y.event.triggered))return;v.indexOf(".")>=0&&(m=v.split("."),v=m.shift(),m.sort()),c=v.indexOf(":")<0&&"on"+v,n=n[y.expando]?n:new y.Event(v,typeof n=="object"&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=s),r=r==null?[n]:y.makeArray(r,[n]),p=y.event.special[v]||{};if(!o&&p.trigger&&p.trigger.apply(s,r)===!1)return;if(!o&&!p.noBubble&&!y.isWindow(s)){l=p.delegateType||v,et.test(l+v)||(a=a.parentNode);for(;a;a=a.parentNode)d.push(a),f=a;f===(s.ownerDocument||i)&&d.push(f.defaultView||f.parentWindow||e)}u=0;while((a=d[u++])&&!n.isPropagationStopped())n.type=u>1?l:p.bindType||v,h=(y._data(a,"events")||{})[n.type]&&y._data(a,"handle"),h&&h.apply(a,r),h=c&&a[c],h&&y.acceptData(a)&&h.apply&&h.apply(a,r)===!1&&n.preventDefault();n.type=v;if(!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(v!=="click"||!y.nodeName(s,"a"))&&y.acceptData(s)&&c&&s[v]&&!y.isWindow(s)){f=s[c],f&&(s[c]=null),y.event.triggered=v;try{s[v]()}catch(g){}y.event.triggered=t,f&&(s[c]=f)}return n.result},dispatch:function(e){e=y.event.fix(e);var n,r,i,s,o,u=[],a=p.call(arguments),f=(y._data(this,"events")||{})[e.type]||[],l=y.event.special[e.type]||{};a[0]=e,e.delegateTarget=this;if(l.preDispatch&&l.preDispatch.call(this,e)===!1)return;u=y.event.handlers.call(this,e,f),n=0;while((s=u[n++])&&!e.isPropagationStopped()){e.currentTarget=s.elem,r=0;while((o=s.handlers[r++])&&!e.isImmediatePropagationStopped())if(!e.namespace_re||e.namespace_re.test(o.namespace))e.handleObj=o,e.data=o.data,i=((y.event.special[o.origType]||{}).handle||o.handler).apply(s.elem,a),i!==t&&(e.result=i)===!1&&(e.preventDefault(),e.stopPropagation())}return l.postDispatch&&l.postDispatch.call(this,e),e.result},handlers:function(e,n){var r,i,s,o,u=[],a=n.delegateCount,f=e.target;if(a&&f.nodeType&&(!e.button||e.type!=="click"))for(;f!=this;f=f.parentNode||this)if(f.disabled!==!0||e.type!=="click"){i=[];for(r=0;r<a;r++)o=n[r],s=o.selector+" ",i[s]===t&&(i[s]=o.needsContext?y(s,this).index(f)>=0:y.find(s,this,null,[f]).length),i[s]&&i.push(o);i.length&&u.push({elem:f,handlers:i})}return a<n.length&&u.push({elem:this,handlers:n.slice(a)}),u},fix:function(e){if(e[y.expando])return e;var t,n,r=e,s=y.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=new y.Event(r),t=o.length;while(t--)n=o[t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){if(y.nodeName(this,"input")&&this.type==="checkbox"&&this.click)return this.click(),!1}},focus:{trigger:function(){if(this!==i.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){if(this===i.activeElement&&this.blur)return this.blur(),!1},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=y.extend(new y.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?y.event.trigger(i,null,t):y.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},y.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},y.Event=function(e,t){if(!(this instanceof y.Event))return new y.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?nt:rt):this.type=e,t&&y.extend(this,t),this.timeStamp=e&&e.timeStamp||y.now(),this[y.expando]=!0},y.Event.prototype={isDefaultPrevented:rt,isPropagationStopped:rt,isImmediatePropagationStopped:rt,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=nt;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=nt;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=nt,this.stopPropagation()}},y.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){y.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj;if(!i||i!==r&&!y.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),y.support.submitBubbles||(y.event.special.submit={setup:function(){if(y.nodeName(this,"form"))return!1;y.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=y.nodeName(n,"input")||y.nodeName(n,"button")?n.form:t;r&&!y._data(r,"submitBubbles")&&(y.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),y._data(r,"submitBubbles",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&y.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(y.nodeName(this,"form"))return!1;y.event.remove(this,"._submit")}}),y.support.changeBubbles||(y.event.special.change={setup:function(){if(G.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")y.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),y.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),y.event.simulate("change",this,e,!0)});return!1}y.event.add(this,"beforeactivate._change",function(e){var t=e.target;G.test(t.nodeName)&&!y._data(t,"changeBubbles")&&(y.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&y.event.simulate("change",this.parentNode,e,!0)}),y._data(t,"changeBubbles",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return y.event.remove(this,"._change"),!G.test(this.nodeName)}}),y.support.focusinBubbles||y.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){y.event.simulate(t,e.target,y.event.fix(e),!0)};y.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),y.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=rt;else if(!i)return this;return s===1&&(o=i,i=function(e){return y().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=y.guid++)),this.each(function(){y.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,y(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=rt),this.each(function(){y.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){y.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return y.event.trigger(e,t,n,!0)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),y.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){y.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Y.test(t)&&(y.event.fixHooks[t]=y.event.keyHooks),Z.test(t)&&(y.event.fixHooks[t]=y.event.mouseHooks)}),function(e,t){function rt(e){return J.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function st(e){return e[w]=!0,e}function ot(e){var t=c.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function ut(e,t,n,r){var i,s,o,u,a,f,h,v,m,y;(t?t.ownerDocument||t:E)!==c&&l(t),t=t||c,n=n||[];if(!e||typeof e!="string")return n;if((u=t.nodeType)!==1&&u!==9)return[];if(!p&&!r){if(i=K.exec(e))if(o=i[1]){if(u===9){s=t.getElementById(o);if(!s||!s.parentNode)return n;if(s.id===o)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(o))&&g(t,s)&&s.id===o)return n.push(s),n}else{if(i[2])return _.apply(n,D.call(t.getElementsByTagName(e),0)),n;if((o=i[3])&&S.getByClassName&&t.getElementsByClassName)return _.apply(n,D.call(t.getElementsByClassName(o),0)),n}if(S.qsa&&!d.test(e)){h=!0,v=w,m=t,y=u===9&&e;if(u===1&&t.nodeName.toLowerCase()!=="object"){f=ht(e),(h=t.getAttribute("id"))?v=h.replace(Y,"\\$&"):t.setAttribute("id",v),v="[id='"+v+"'] ",a=f.length;while(a--)f[a]=v+pt(f[a]);m=$.test(e)&&t.parentNode||t,y=f.join(",")}if(y)try{return _.apply(n,D.call(m.querySelectorAll(y),0)),n}catch(b){}finally{h||t.removeAttribute("id")}}}return Et(e.replace(R,"$1"),t,n,r)}function at(e,t){var n=e&&t&&e.nextSibling;for(;n;n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function ct(e){return st(function(t){return t=+t,st(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ht(e,t){var n,r,s,o,u,a,f,l=C[e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=U.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=z.exec(u))n=r.shift(),s.push({value:n,type:r[0].replace(R," ")}),u=u.slice(n.length);for(o in i.filter)(r=V[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(n=r.shift(),s.push({value:n,type:o,matches:r}),u=u.slice(n.length));if(!n)break}return t?u.length:u?ut.error(e):C(e,a).slice(0)}function pt(e){var t=0,n=e.length,r="";for(;t<n;t++)r+=e[t].value;return r}function dt(e,t,n){var i=t.dir,s=n&&t.dir==="parentNode",o=T++;return t.first?function(t,n,r){while(t=t[i])if(t.nodeType===1||s)return e(t,n,r)}:function(t,n,u){var a,f,l,c=x+" "+o;if(u){while(t=t[i])if(t.nodeType===1||s)if(e(t,n,u))return!0}else while(t=t[i])if(t.nodeType===1||s){l=t[w]||(t[w]={});if((f=l[i])&&f[0]===c){if((a=f[1])===!0||a===r)return a===!0}else{f=l[i]=[c],f[1]=e(t,n,u)||r;if(f[1]===!0)return!0}}}}function vt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function gt(e,t,n,r,i,s){return r&&!r[w]&&(r=gt(r)),i&&!i[w]&&(i=gt(i,s)),st(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||wt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?mt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=mt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?P.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=mt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):_.apply(o,g)})}function yt(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,l=dt(function(e){return e===t},u,!0),c=dt(function(e){return P.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==f)||((t=n).nodeType?l(e,n,r):c(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[dt(vt(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[w]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return gt(a>1&&vt(h),a>1&&pt(e.slice(0,a-1)).replace(R,"$1"),n,a<r&&yt(e.slice(a,r)),r<s&&yt(e=e.slice(r)),r<s&&pt(e))}h.push(n)}return vt(h)}function bt(e,t){var n=0,s=t.length>0,o=e.length>0,u=function(u,a,l,h,p){var d,v,m,g=[],y=0,b="0",w=u&&[],E=p!=null,S=f,T=u||o&&i.find.TAG("*",p&&a.parentNode||a),N=x+=S==null?1:Math.E;E&&(f=a!==c&&a,r=n);for(;(d=T[b])!=null;b++){if(o&&d){for(v=0;m=e[v];v++)if(m(d,a,l)){h.push(d);break}E&&(x=N,r=++n)}s&&((d=!m&&d)&&y--,u&&w.push(d))}y+=b;if(s&&b!==y){for(v=0;m=t[v];v++)m(w,g,a,l);if(u){if(y>0)while(b--)!w[b]&&!g[b]&&(g[b]=M.call(h));g=mt(g)}_.apply(h,g),E&&!u&&g.length>0&&y+t.length>1&&ut.uniqueSort(h)}return E&&(x=N,f=S),w};return s?st(u):u}function wt(e,t,n){var r=0,i=t.length;for(;r<i;r++)ut(e,t[r],n);return n}function Et(e,t,n,r){var s,o,a,f,l,c=ht(e);if(!r&&c.length===1){o=c[0]=c[0].slice(0);if(o.length>2&&(a=o[0]).type==="ID"&&t.nodeType===9&&!p&&i.relative[o[1].type]){t=i.find.ID(a.matches[0].replace(et,tt),t)[0];if(!t)return n;e=e.slice(o.shift().value.length)}for(s=V.needsContext.test(e)?-1:o.length-1;s>=0;s--){a=o[s];if(i.relative[f=a.type])break;if(l=i.find[f])if(r=l(a.matches[0].replace(et,tt),$.test(o[0].type)&&t.parentNode||t)){o.splice(s,1),e=r.length&&pt(o);if(!e)return _.apply(n,D.call(r,0)),n;break}}}return u(e,c)(r,t,p,n,$.test(e)),n}function St(){}var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,b,w="sizzle"+ -(new Date),E=e.document,S={},x=0,T=0,N=it(),C=it(),k=it(),L=typeof t,A=1<<31,O=[],M=O.pop,_=O.push,D=O.slice,P=O.indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},H="[\\x20\\t\\r\\n\\f]",B="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",j=B.replace("w","w#"),F="([*^$|!~]?=)",I="\\["+H+"*("+B+")"+H+"*(?:"+F+H+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+j+")|)|)"+H+"*\\]",q=":("+B+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+I.replace(3,8)+")*)|.*)\\)|)",R=new RegExp("^"+H+"+|((?:^|[^\\\\])(?:\\\\.)*)"+H+"+$","g"),U=new RegExp("^"+H+"*,"+H+"*"),z=new RegExp("^"+H+"*([\\x20\\t\\r\\n\\f>+~])"+H+"*"),W=new RegExp(q),X=new RegExp("^"+j+"$"),V={ID:new RegExp("^#("+B+")"),CLASS:new RegExp("^\\.("+B+")"),NAME:new RegExp("^\\[name=['\"]?("+B+")['\"]?\\]"),TAG:new RegExp("^("+B.replace("w","w*")+")"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+H+"*(even|odd|(([+-]|)(\\d*)n|)"+H+"*(?:([+-]|)"+H+"*(\\d+)|))"+H+"*\\)|)","i"),needsContext:new RegExp("^"+H+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+H+"*((?:-\\d)?\\d*)"+H+"*\\)|)(?=[^-]|$)","i")},$=/[\x20\t\r\n\f]*[+~]/,J=/\{\s*\[native code\]\s*\}/,K=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,Q=/^(?:input|select|textarea|button)$/i,G=/^h\d$/i,Y=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,n&1023|56320)};try{D.call(h.childNodes,0)[0].nodeType}catch(nt){D=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}o=ut.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},l=ut.setDocument=function(e){var n=e?e.ownerDocument||e:E;if(n===c||n.nodeType!==9||!n.documentElement)return c;c=n,h=n.documentElement,p=o(n),S.tagNameNoComments=ot(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),S.attributes=ot(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),S.getByClassName=ot(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),S.getByName=ot(function(e){e.id=w+0,e.innerHTML="<a name='"+w+"'></a><div name='"+w+"'></div>",h.insertBefore(e,h.firstChild);var t=n.getElementsByName&&n.getElementsByName(w).length===2+n.getElementsByName(w+0).length;return S.getIdNotName=!n.getElementById(w),h.removeChild(e),t}),i.attrHandle=ot(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==L&&e.firstChild.getAttribute("href")==="#"})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},S.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==L&&!p){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==L&&!p){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==L&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==L&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=S.tagNameNoComments?function(e,t){if(typeof t.getElementsByTagName!==L)return t.getElementsByTagName(e)}:function(e,t){var n,r=[],i=0,s=t.getElementsByTagName(e);if(e==="*"){for(;n=s[i];i++)n.nodeType===1&&r.push(n);return r}return s},i.find.NAME=S.getByName&&function(e,t){if(typeof t.getElementsByName!==L)return t.getElementsByName(name)},i.find.CLASS=S.getByClassName&&function(e,t){if(typeof t.getElementsByClassName!==L&&!p)return t.getElementsByClassName(e)},v=[],d=[":focus"];if(S.qsa=rt(n.querySelectorAll))ot(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||d.push("\\["+H+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||d.push(":checked")}),ot(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&d.push("[*^$]="+H+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||d.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),d.push(",.*:")});return(S.matchesSelector=rt(m=h.matchesSelector||h.mozMatchesSelector||h.webkitMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ot(function(e){S.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),v.push("!=",q)}),d=new RegExp(d.join("|")),v=new RegExp(v.join("|")),g=rt(h.contains)||h.compareDocumentPosition?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!r&&r.nodeType===1&&!!(n.contains?n.contains(r):e.compareDocumentPosition&&e.compareDocumentPosition(r)&16)}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},b=h.compareDocumentPosition?function(e,t){var r;if(e===t)return a=!0,0;if(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))return r&1||e.parentNode&&e.parentNode.nodeType===11?e===n||g(E,e)?-1:t===n||g(E,t)?1:0:r&4?-1:1;return e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,s=e.parentNode,o=t.parentNode,u=[e],f=[t];if(e===t)return a=!0,0;if(e.sourceIndex&&t.sourceIndex)return(~t.sourceIndex||A)-(g(E,e)&&~e.sourceIndex||A);if(!s||!o)return e===n?-1:t===n?1:s?-1:o?1:0;if(s===o)return at(e,t);r=e;while(r=r.parentNode)u.unshift(r);r=t;while(r=r.parentNode)f.unshift(r);while(u[i]===f[i])i++;return i?at(u[i],f[i]):u[i]===E?-1:f[i]===E?1:0},a=!1,[0,0].sort(b),S.detectDuplicates=a,c},ut.matches=function(e,t){return ut(e,null,null,t)},ut.matchesSelector=function(e,t){(e.ownerDocument||e)!==c&&l(e),t=t.replace(Z,"='$1']");if(S.matchesSelector&&!p&&(!v||!v.test(t))&&!d.test(t))try{var n=m.call(e,t);if(n||S.disconnectedMatch||e.document&&e.document.nodeType!==11)return n}catch(r){}return ut(t,c,null,[e]).length>0},ut.contains=function(e,t){return(e.ownerDocument||e)!==c&&l(e),g(e,t)},ut.attr=function(e,t){var n;return(e.ownerDocument||e)!==c&&l(e),p||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):p||S.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},ut.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ut.uniqueSort=function(e){var t,n=[],r=1,i=0;a=!S.detectDuplicates,e.sort(b);if(a){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},s=ut.getText=function(e){var t,n="",r=0,i=e.nodeType;if(!i)for(;t=e[r];r++)n+=s(t);else if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue;return n},i=ut.selectors={cacheLength:50,createPseudo:st,match:V,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1].slice(0,3)==="nth"?(e[3]||ut.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd")),e[5]=+(e[7]+e[8]||e[3]==="odd")):e[3]&&ut.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return V.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&W.test(n)&&(t=ht(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=N[e+" "];return t||(t=new RegExp("(^|"+H+")"+e+"("+H+"|$)"))&&N(e,function(e){return t.test(e.className||typeof e.getAttribute!==L&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=ut.attr(r,e);return i==null?t==="!=":t?(i+="",t==="="?i===n:t==="!="?i!==n:t==="^="?n&&i.indexOf(n)===0:t==="*="?n&&i.indexOf(n)>-1:t==="$="?n&&i.substr(i.length-n.length)===n:t==="~="?(" "+i+" ").indexOf(n)>-1:t==="|="?i===n||i.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var s=e.slice(0,3)!=="nth",o=e.slice(-4)!=="last",u=t==="of-type";return r===1&&i===0?function(e){return!!e.parentNode}:function(t,n,a){var f,l,c,h,p,d,v=s!==o?"nextSibling":"previousSibling",m=t.parentNode,g=u&&t.nodeName.toLowerCase(),y=!a&&!u;if(m){if(s){while(v){c=t;while(c=c[v])if(u?c.nodeName.toLowerCase()===g:c.nodeType===1)return!1;d=v=e==="only"&&!d&&"nextSibling"}return!0}d=[o?m.firstChild:m.lastChild];if(o&&y){l=m[w]||(m[w]={}),f=l[e]||[],p=f[0]===x&&f[1],h=f[0]===x&&f[2],c=p&&m.childNodes[p];while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if(c.nodeType===1&&++h&&c===t){l[e]=[x,p,h];break}}else if(y&&(f=(t[w]||(t[w]={}))[e])&&f[0]===x)h=f[1];else while(c=++p&&c&&c[v]||(h=p=0)||d.pop())if((u?c.nodeName.toLowerCase()===g:c.nodeType===1)&&++h){y&&((c[w]||(c[w]={}))[e]=[x,h]);if(c===t)break}return h-=i,h===r||h%r===0&&h/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||ut.error("unsupported pseudo: "+e);return r[w]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?st(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=P.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:st(function(e){var t=[],n=[],r=u(e.replace(R,"$1"));return r[w]?st(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:st(function(e){return function(t){return ut(e,t).length>0}}),contains:st(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),lang:st(function(e){return X.test(e||"")||ut.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=p?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||n.indexOf(e+"-")===0;while((t=t.parentNode)&&t.nodeType===1);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===c.activeElement&&(!c.hasFocus||c.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||e.nodeType===3||e.nodeType===4)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return G.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},text:function(e){var t;return e.nodeName.toLowerCase()==="input"&&e.type==="text"&&((t=e.getAttribute("type"))==null||t.toLowerCase()===e.type)},first:ct(function(){return[0]}),last:ct(function(e,t){return[t-1]}),eq:ct(function(e,t,n){return[n<0?n+t:n]}),even:ct(function(e,t){var n=0;for(;n<t;n+=2)e.push(n);return e}),odd:ct(function(e,t){var n=1;for(;n<t;n+=2)e.push(n);return e}),lt:ct(function(e,t,n){var r=n<0?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ct(function(e,t,n){var r=n<0?n+t:n;for(;++r<t;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=lt(n);u=ut.compile=function(e,t){var n,r=[],i=[],s=k[e+" "];if(!s){t||(t=ht(e)),n=t.length;while(n--)s=yt(t[n]),s[w]?r.push(s):i.push(s);s=k(e,bt(i,r))}return s},i.pseudos.nth=i.pseudos.eq,i.filters=St.prototype=i.pseudos,i.setFilters=new St,l(),ut.attr=y.attr,y.find=ut,y.expr=ut.selectors,y.expr[":"]=y.expr.pseudos,y.unique=ut.uniqueSort,y.text=ut.getText,y.isXMLDoc=ut.isXML,y.contains=ut.contains}(e);var it=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ot=/^.[^:#\[\.,]*$/,ut=y.expr.match.needsContext,at={children:!0,contents:!0,next:!0,prev:!0};y.fn.extend({find:function(e){var t,n,r;if(typeof e!="string")return r=this,this.pushStack(y(e).filter(function(){for(t=0;t<r.length;t++)if(y.contains(r[t],this))return!0}));n=[];for(t=0;t<this.length;t++)y.find(e,this[t],n);return n=this.pushStack(y.unique(n)),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=y(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(y.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(lt(this,e,!1))},filter:function(e){return this.pushStack(lt(this,e,!0))},is:function(e){return!!e&&(typeof e=="string"?ut.test(e)?y(e,this.context).index(this[0])>=0:y.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=ut.test(e)||typeof e!="string"?y(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:y.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return this.pushStack(s.length>1?y.unique(s):s)},index:function(e){return e?typeof e=="string"?y.inArray(this[0],y(e)):y.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?y(e,t):y.makeArray(e&&e.nodeType?[e]:e),r=y.merge(this.get(),n);return this.pushStack(y.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),y.fn.andSelf=y.fn.addBack,y.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return y.dir(e,"parentNode")},parentsUntil:function(e,t,n){return y.dir(e,"parentNode",n)},next:function(e){return ft(e,"nextSibling")},prev:function(e){return ft(e,"previousSibling")},nextAll:function(e){return y.dir(e,"nextSibling")},prevAll:function(e){return y.dir(e,"previousSibling")},nextUntil:function(e,t,n){return y.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return y.dir(e,"previousSibling",n)},siblings:function(e){return y.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return y.sibling(e.firstChild)},contents:function(e){return y.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:y.merge([],e.childNodes)}},function(e,t){y.fn[e]=function(n,r){var i=y.map(this,t,n);return it.test(e)||(r=n),r&&typeof r=="string"&&(i=y.filter(r,i)),i=this.length>1&&!at[e]?y.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),y.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?y.find.matchesSelector(t[0],e)?[t[0]]:[]:y.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!y(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",pt=/ jQuery\d+="(?:null|\d+)"/g,dt=new RegExp("<(?:"+ht+")[\\s/>]","i"),vt=/^\s+/,mt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,gt=/<([\w:]+)/,yt=/<tbody/i,bt=/<|&#?\w+;/,wt=/<(?:script|style|link)/i,Et=/^(?:checkbox|radio)$/i,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/^$|\/(?:java|ecma)script/i,Tt=/^true\/(.*)/,Nt=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Ct={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:y.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},kt=ct(i),Lt=kt.appendChild(i.createElement("div"));Ct.optgroup=Ct.option,Ct.tbody=Ct.tfoot=Ct.colgroup=Ct.caption=Ct.thead,Ct.th=Ct.td,y.fn.extend({text:function(e){return y.access(this,function(e){return e===t?y.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(y.isFunction(e))return this.each(function(t){y(this).wrapAll(e.call(this,t))});if(this[0]){var t=y(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return y.isFunction(e)?this.each(function(t){y(this).wrapInner(e.call(this,t))}):this.each(function(){var t=y(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=y.isFunction(e);return this.each(function(n){y(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){y.nodeName(this,"body")||y(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11||this.nodeType===9)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||y.filter(e,[n]).length>0)!t&&n.nodeType===1&&y.cleanData(Ht(n)),n.parentNode&&(t&&y.contains(n.ownerDocument,n)&&_t(Ht(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&y.cleanData(Ht(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&y.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return y.clone(this,e,t)})},html:function(e){return y.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(pt,""):t;if(typeof e=="string"&&!wt.test(e)&&(y.support.htmlSerialize||!dt.test(e))&&(y.support.leadingWhitespace||!vt.test(e))&&!Ct[(gt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(mt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(y.cleanData(Ht(n,!1)),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=y.isFunction(e);return!t&&typeof e!="string"&&(e=y(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;if(n&&this.nodeType===1||this.nodeType===11)y(this).remove(),t?t.parentNode.insertBefore(e,t):n.appendChild(e)})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=c.apply([],e);var i,s,o,u,a,f,l=0,h=this.length,p=this,d=h-1,v=e[0],m=y.isFunction(v);if(m||!(h<=1||typeof v!="string"||y.support.checkClone||!St.test(v)))return this.each(function(i){var s=p.eq(i);m&&(e[0]=v.call(this,i,n?s.html():t)),s.domManip(e,n,r)});if(h){i=y.buildFragment(e,this[0].ownerDocument,!1,this),s=i.firstChild,i.childNodes.length===1&&(i=s);if(s){n=n&&y.nodeName(s,"tr"),o=y.map(Ht(i,"script"),Ot),u=o.length;for(;l<h;l++)a=i,l!==d&&(a=y.clone(a,!0,!0),u&&y.merge(o,Ht(a,"script"))),r.call(n&&y.nodeName(this[l],"table")?At(this[l],"tbody"):this[l],a,l);if(u){f=o[o.length-1].ownerDocument,y.map(o,Mt);for(l=0;l<u;l++)a=o[l],xt.test(a.type||"")&&!y._data(a,"globalEval")&&y.contains(f,a)&&(a.src?y.ajax({url:a.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):y.globalEval((a.text||a.textContent||a.innerHTML||"").replace(Nt,"")))}i=s=null}}return this}}),y.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){y.fn[e]=function(e){var n,r=0,i=[],s=y(e),o=s.length-1;for(;r<=o;r++)n=r===o?this:this.clone(!0),y(s[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}}),y.extend({clone:function(e,t,n){var r,i,s,o,u,a=y.contains(e.ownerDocument,e);y.support.html5Clone||y.isXMLDoc(e)||!dt.test("<"+e.nodeName+">")?u=e.cloneNode(!0):(Lt.innerHTML=e.outerHTML,Lt.removeChild(u=Lt.firstChild));if((!y.support.noCloneEvent||!y.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!y.isXMLDoc(e)){r=Ht(u),i=Ht(e);for(o=0;(s=i[o])!=null;++o)r[o]&&Pt(s,r[o])}if(t)if(n){i=i||Ht(e),r=r||Ht(u);for(o=0;(s=i[o])!=null;o++)Dt(s,r[o])}else Dt(e,u);return r=Ht(u,"script"),r.length>0&&_t(r,!a&&Ht(e,"script")),r=i=s=null,u},buildFragment:function(e,t,n,r){var i,s,o,u,a,f,l,c=e.length,h=ct(t),p=[],d=0;for(;d<c;d++){s=e[d];if(s||s===0)if(y.type(s)==="object")y.merge(p,s.nodeType?[s]:s);else if(!bt.test(s))p.push(t.createTextNode(s));else{u=u||h.appendChild(t.createElement("div")),o=(gt.exec(s)||["",""])[1].toLowerCase(),a=Ct[o]||Ct._default,u.innerHTML=a[1]+s.replace(mt,"<$1></$2>")+a[2],l=a[0];while(l--)u=u.lastChild;!y.support.leadingWhitespace&&vt.test(s)&&p.push(t.createTextNode(vt.exec(s)[0]));if(!y.support.tbody){s=o==="table"&&!yt.test(s)?u.firstChild:a[1]==="<table>"&&!yt.test(s)?u:0,l=s&&s.childNodes.length;while(l--)y.nodeName(f=s.childNodes[l],"tbody")&&!f.childNodes.length&&s.removeChild(f)}y.merge(p,u.childNodes),u.textContent="";while(u.firstChild)u.removeChild(u.firstChild);u=h.lastChild}}u&&h.removeChild(u),y.support.appendChecked||y.grep(Ht(p,"input"),Bt),d=0;while(s=p[d++]){if(r&&y.inArray(s,r)!==-1)continue;i=y.contains(s.ownerDocument,s),u=Ht(h.appendChild(s),"script"),i&&_t(u);if(n){l=0;while(s=u[l++])xt.test(s.type||"")&&n.push(s)}}return u=null,h},cleanData:function(e,t){var n,r,i,s,o=0,u=y.expando,a=y.cache,l=y.support.deleteExpando,c=y.event.special;for(;(i=e[o])!=null;o++)if(t||y.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)c[s]?y.event.remove(i,s):y.removeEvent(i,s,n.handle);a[r]&&(delete a[r],l?delete i[u]:typeof i.removeAttribute!="undefined"?i.removeAttribute(u):i[u]=null,f.push(r))}}}});var jt,Ft,It,qt=/alpha\([^)]*\)/i,Rt=/opacity\s*=\s*([^)]*)/,Ut=/^(top|right|bottom|left)$/,zt=/^(none|table(?!-c[ea]).+)/,Wt=/^margin/,Xt=new RegExp("^("+b+")(.*)$","i"),Vt=new RegExp("^("+b+")(?!px)[a-z%]+$","i"),$t=new RegExp("^([+-])=("+b+")","i"),Jt={BODY:"block"},Kt={position:"absolute",visibility:"hidden",display:"block"},Qt={letterSpacing:0,fontWeight:400},Gt=["Top","Right","Bottom","Left"],Yt=["Webkit","O","Moz","ms"];y.fn.extend({css:function(e,n){return y.access(this,function(e,n,r){var i,s,o={},u=0;if(y.isArray(n)){i=Ft(e),s=n.length;for(;u<s;u++)o[n[u]]=y.css(e,n[u],!1,i);return o}return r!==t?y.style(e,n,r):y.css(e,n)},e,n,arguments.length>1)},show:function(){return tn(this,!0)},hide:function(){return tn(this)},toggle:function(e){var t=typeof e=="boolean";return this.each(function(){(t?e:en(this))?y(this).show():y(this).hide()})}}),y.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=jt(e,"opacity");return n===""?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":y.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=y.camelCase(n),f=e.style;n=y.cssProps[a]||(y.cssProps[a]=Zt(f,a)),u=y.cssHooks[n]||y.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=$t.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(y.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!y.cssNumber[a]&&(r+="px"),!y.support.clearCloneStyle&&r===""&&n.indexOf("background")===0&&(f[n]="inherit");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=y.camelCase(n);return n=y.cssProps[a]||(y.cssProps[a]=Zt(e.style,a)),u=y.cssHooks[n]||y.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,r)),s===t&&(s=jt(e,n,i)),s==="normal"&&n in Qt&&(s=Qt[n]),r?(o=parseFloat(s),r===!0||y.isNumeric(o)?o||0:s):s},swap:function(e,t,n,r){var i,s,o={};for(s in t)o[s]=e.style[s],e.style[s]=t[s];i=n.apply(e,r||[]);for(s in t)e.style[s]=o[s];return i}}),e.getComputedStyle?(Ft=function(t){return e.getComputedStyle(t,null)},jt=function(e,n,r){var i,s,o,u=r||Ft(e),a=u?u.getPropertyValue(n)||u[n]:t,f=e.style;return u&&(a===""&&!y.contains(e.ownerDocument,e)&&(a=y.style(e,n)),Vt.test(a)&&Wt.test(n)&&(i=f.width,s=f.minWidth,o=f.maxWidth,f.minWidth=f.maxWidth=f.width=a,a=u.width,f.width=i,f.minWidth=s,f.maxWidth=o)),a}):i.documentElement.currentStyle&&(Ft=function(e){return e.currentStyle},jt=function(e,n,r){var i,s,o,u=r||Ft(e),a=u?u[n]:t,f=e.style;return a==null&&f&&f[n]&&(a=f[n]),Vt.test(a)&&!Ut.test(n)&&(i=f.left,s=e.runtimeStyle,o=s&&s.left,o&&(s.left=e.currentStyle.left),f.left=n==="fontSize"?"1em":a,a=f.pixelLeft+"px",f.left=i,o&&(s.left=o)),a===""?"auto":a}),y.each(["height","width"],function(e,t){y.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&zt.test(y.css(e,"display"))?y.swap(e,Kt,function(){return sn(e,t,r)}):sn(e,t,r)},set:function(e,n,r){var i=r&&Ft(e);return nn(e,n,r?rn(e,t,r,y.support.boxSizing&&y.css(e,"boxSizing",!1,i)==="border-box",i):0)}}}),y.support.opacity||(y.cssHooks.opacity={get:function(e,t){return Rt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=y.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if((t>=1||t==="")&&y.trim(s.replace(qt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(t===""||r&&!r.filter)return}n.filter=qt.test(s)?s.replace(qt,i):s+" "+i}}),y(function(){y.support.reliableMarginRight||(y.cssHooks.marginRight={get:function(e,t){if(t)return y.swap(e,{display:"inline-block"},jt,[e,"marginRight"])}}),!y.support.pixelPosition&&y.fn.position&&y.each(["top","left"],function(e,t){y.cssHooks[t]={get:function(e,n){if(n)return n=jt(e,t),Vt.test(n)?y(e).position()[t]+"px":n}}})}),y.expr&&y.expr.filters&&(y.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!y.support.reliableHiddenOffsets&&(e.style&&e.style.display||y.css(e,"display"))==="none"},y.expr.filters.visible=function(e){return!y.expr.filters.hidden(e)}),y.each({margin:"",padding:"",border:"Width"},function(e,t){y.cssHooks[e+t]={expand:function(n){var r=0,i={},s=typeof n=="string"?n.split(" "):[n];for(;r<4;r++)i[e+Gt[r]+t]=s[r]||s[r-2]||s[0];return i}},Wt.test(e)||(y.cssHooks[e+t].set=nn)});var an=/%20/g,fn=/\[\]$/,ln=/\r?\n/g,cn=/^(?:submit|button|image|reset)$/i,hn=/^(?:input|select|textarea|keygen)/i;y.fn.extend({serialize:function(){return y.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=y.prop(this,"elements");return e?y.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!y(this).is(":disabled")&&hn.test(this.nodeName)&&!cn.test(e)&&(this.checked||!Et.test(e))}).map(function(e,t){var n=y(this).val();return n==null?null:y.isArray(n)?y.map(n,function(e){return{name:t.name,value:e.replace(ln,"\r\n")}}):{name:t.name,value:n.replace(ln,"\r\n")}}).get()}}),y.param=function(e,n){var r,i=[],s=function(e,t){t=y.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=y.ajaxSettings&&y.ajaxSettings.traditional);if(y.isArray(e)||e.jquery&&!y.isPlainObject(e))y.each(e,function(){s(this.name,this.value)});else for(r in e)pn(r,e[r],n,s);return i.join("&").replace(an,"+")};var dn,vn,mn=y.now(),gn=/\?/,yn=/#.*$/,bn=/([?&])_=[^&]*/,wn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,En=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Sn=/^(?:GET|HEAD)$/,xn=/^\/\//,Tn=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Nn=y.fn.load,Cn={},kn={},Ln="*/".concat("*");try{vn=s.href}catch(An){vn=i.createElement("a"),vn.href="",vn=vn.href}dn=Tn.exec(vn.toLowerCase())||[],y.fn.load=function(e,n,r){if(typeof e!="string"&&Nn)return Nn.apply(this,arguments);var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),y.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),u.length>0&&y.ajax({url:e,type:s,dataType:"html",data:n}).done(function(e){o=arguments,u.html(i?y("<div>").append(y.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){u.each(r,o||[e.responseText,t,e])}),this},y.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){y.fn[t]=function(e){return this.on(t,e)}}),y.each(["get","post"],function(e,n){y[n]=function(e,r,i,s){return y.isFunction(r)&&(s=s||i,i=r,r=t),y.ajax({url:e,type:n,dataType:s,data:r,success:i})}}),y.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:vn,type:"GET",isLocal:En.test(dn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Ln,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":y.parseJSON,"text xml":y.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,y.ajaxSettings),t):_n(y.ajaxSettings,e)},ajaxPrefilter:On(Cn),ajaxTransport:On(kn),ajax:function(e,n){function N(e,n,o,a){var l,g,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),r=t,s=a||"",x.readyState=e>0?4:0,o&&(w=Dn(c,x,o));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(y.lastModified[i]=S),S=x.getResponseHeader("etag"),S&&(y.etag[i]=S)),e===304?(l=!0,T="notmodified"):(l=Pn(c,w),T=l.state,g=l.data,b=l.error,l=!b);else{b=T;if(e||!T)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[g,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(m),m=t,f&&p.trigger(l?"ajaxSuccess":"ajaxError",[x,c,l?g:b]),v.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--y.active||y.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=y.ajaxSetup({},n),h=c.context||c,p=c.context&&(h.nodeType||h.jquery)?y(h):y.event,d=y.Deferred(),v=y.Callbacks("once memory"),m=c.statusCode||{},g={},b={},E=0,S="canceled",x={readyState:0,getResponseHeader:function(e){var t;if(E===2){if(!o){o={};while(t=wn.exec(s))o[t[1].toLowerCase()]=t[2]}t=o[e.toLowerCase()]}return t==null?null:t},getAllResponseHeaders:function(){return E===2?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return E||(e=b[n]=b[n]||e,g[e]=t),this},overrideMimeType:function(e){return E||(c.mimeType=e),this},statusCode:function(e){var t;if(e)if(E<2)for(t in e)m[t]=[m[t],e[t]];else x.always(e[x.status]);return this},abort:function(e){var t=e||S;return r&&r.abort(t),N(0,t),this}};d.promise(x).complete=v.add,x.success=x.done,x.error=x.fail,c.url=((e||c.url||vn)+"").replace(yn,"").replace(xn,dn[1]+"//"),c.type=n.method||n.type||c.method||c.type,c.dataTypes=y.trim(c.dataType||"*").toLowerCase().match(w)||[""],c.crossDomain==null&&(a=Tn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===dn[1]&&a[2]===dn[2]&&(a[3]||(a[1]==="http:"?80:443))==(dn[3]||(dn[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=y.param(c.data,c.traditional)),Mn(Cn,c,n,x);if(E===2)return x;f=c.global,f&&y.active++===0&&y.event.trigger("ajaxStart"),c.type=c.type.toUpperCase(),c.hasContent=!Sn.test(c.type),i=c.url,c.hasContent||(c.data&&(i=c.url+=(gn.test(i)?"&":"?")+c.data,delete c.data),c.cache===!1&&(c.url=bn.test(i)?i.replace(bn,"$1_="+mn++):i+(gn.test(i)?"&":"?")+"_="+mn++)),c.ifModified&&(y.lastModified[i]&&x.setRequestHeader("If-Modified-Since",y.lastModified[i]),y.etag[i]&&x.setRequestHeader("If-None-Match",y.etag[i])),(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Ln+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);r=Mn(kn,c,n,x);if(!r)N(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,r.send(g,N)}catch(T){if(!(E<2))throw T;N(-1,T)}}return x}return x.abort()},getScript:function(e,n){return y.get(e,t,n,"script")},getJSON:function(e,t,n){return y.get(e,t,n,"json")}}),y.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return y.globalEval(e),e}}}),y.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),y.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||y("head")[0]||i.documentElement;return{send:function(t,s){n=i.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){if(t||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||s(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Hn=[],Bn=/(=)\?(?=&|$)|\?\?/;y.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Hn.pop()||y.expando+"_"+mn++;return this[e]=!0,e}}),y.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.jsonp!==!1&&(Bn.test(n.url)?"url":typeof n.data=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");if(a||n.dataTypes[0]==="jsonp")return s=n.jsonpCallback=y.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,a?n[a]=n[a].replace(Bn,"$1"+s):n.jsonp!==!1&&(n.url+=(gn.test(n.url)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||y.error(s+" was not called"),u[0]},n.dataTypes[0]="json",o=e[s],e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Hn.push(s)),u&&y.isFunction(o)&&o(u[0]),u=o=t}),"script"});var jn,Fn,In=0,qn=e.ActiveXObject&&function(){var e;for(e in jn)jn[e](t,!0)};y.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Rn()||Un()}:Rn,Fn=y.ajaxSettings.xhr(),y.support.cors=!!Fn&&"withCredentials"in Fn,Fn=y.support.ajax=!!Fn,Fn&&y.ajaxTransport(function(n){if(!n.crossDomain||y.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=y.noop,qn&&delete jn[o]);if(i)a.readyState!==4&&a.abort();else{c={},u=a.status,h=a.responseXML,l=a.getAllResponseHeaders(),h&&h.documentElement&&(c.xml=h),typeof a.responseText=="string"&&(c.text=a.responseText);try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r):(o=++In,qn&&(jn||(jn={},y(e).unload(qn)),jn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var zn,Wn,Xn=/^(?:toggle|show|hide)$/,Vn=new RegExp("^(?:([+-])=|)("+b+")([a-z%]*)$","i"),$n=/queueHooks$/,Jn=[er],Kn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=Vn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(y.cssNumber[e]?"":"px");if(r!=="px"&&u){u=y.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,y.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};y.Animation=y.extend(Yn,{tweener:function(e,t){y.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Kn[n]=Kn[n]||[],Kn[n].unshift(t)},prefilter:function(e,t){t?Jn.unshift(e):Jn.push(e)}}),y.Tween=tr,tr.prototype={constructor:tr,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(y.cssNumber[n]?"":"px")},cur:function(){var e=tr.propHooks[this.prop];return e&&e.get?e.get(this):tr.propHooks._default.get(this)},run:function(e){var t,n=tr.propHooks[this.prop];return this.options.duration?this.pos=t=y.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tr.propHooks._default.set(this),this}},tr.prototype.init.prototype=tr.prototype,tr.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=y.css(e.elem,e.prop,"auto"),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){y.fx.step[e.prop]?y.fx.step[e.prop](e):e.elem.style&&(e.elem.style[y.cssProps[e.prop]]!=null||y.cssHooks[e.prop])?y.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},tr.propHooks.scrollTop=tr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},y.each(["toggle","show","hide"],function(e,t){var n=y.fn[t];y.fn[t]=function(e,r,i){return e==null||typeof e=="boolean"?n.apply(this,arguments):this.animate(nr(t,!0),e,r,i)}}),y.fn.extend({fadeTo:function(e,t,n,r){return this.filter(en).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=y.isEmptyObject(e),s=y.speed(t,n,r),o=function(){var t=Yn(this,y.extend({},e),s);o.finish=function(){t.stop(!0)},(i||y._data(this,"finish"))&&t.stop(!0)};return o.finish=o,i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=y.timers,o=y._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&$n.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&y.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=y._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],s=y.timers,o=r?r.length:0;n.finish=!0,y.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this);for(t=s.length;t--;)s[t].elem===this&&s[t].queue===e&&(s[t].anim.stop(!0),s.splice(t,1));for(t=0;t<o;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),y.each({slideDown:nr("show"),slideUp:nr("hide"),slideToggle:nr("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){y.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),y.speed=function(e,t,n){var r=e&&typeof e=="object"?y.extend({},e):{complete:n||!n&&t||y.isFunction(e)&&e,duration:e,easing:n&&t||t&&!y.isFunction(t)&&t};r.duration=y.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in y.fx.speeds?y.fx.speeds[r.duration]:y.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){y.isFunction(r.old)&&r.old.call(this),r.queue&&y.dequeue(this,r.queue)},r},y.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},y.timers=[],y.fx=tr.prototype.init,y.fx.tick=function(){var e,n=y.timers,r=0;zn=y.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||y.fx.stop(),zn=t},y.fx.timer=function(e){e()&&y.timers.push(e)&&y.fx.start()},y.fx.interval=13,y.fx.start=function(){Wn||(Wn=setInterval(y.fx.tick,y.fx.interval))},y.fx.stop=function(){clearInterval(Wn),Wn=null},y.fx.speeds={slow:600,fast:200,_default:400},y.fx.step={},y.expr&&y.expr.filters&&(y.expr.filters.animated=function(e){return y.grep(y.timers,function(t){return e===t.elem}).length}),y.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){y.offset.setOffset(this,e,t)});var n,r,i={top:0,left:0},s=this[0],o=s&&s.ownerDocument;if(!o)return;return n=o.documentElement,y.contains(n,s)?(typeof s.getBoundingClientRect!="undefined"&&(i=s.getBoundingClientRect()),r=rr(o),{top:i.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:i.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):i},y.offset={setOffset:function(e,t,n){var r=y.css(e,"position");r==="static"&&(e.style.position="relative");var i=y(e),s=i.offset(),o=y.css(e,"top"),u=y.css(e,"left"),a=(r==="absolute"||r==="fixed")&&y.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),y.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},y.fn.extend({position:function(){if(!this[0])return;var e,t,n={top:0,left:0},r=this[0];return y.css(r,"position")==="fixed"?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),y.nodeName(e[0],"html")||(n=e.offset()),n.top+=y.css(e[0],"borderTopWidth",!0),n.left+=y.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-y.css(r,"marginTop",!0),left:t.left-n.left-y.css(r,"marginLeft",!0)}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.documentElement;while(e&&!y.nodeName(e,"html")&&y.css(e,"position")==="static")e=e.offsetParent;return e||i.documentElement})}}),y.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);y.fn[e]=function(i){return y.access(this,function(e,i,s){var o=rr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?y(o).scrollLeft():s,r?s:y(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),y.each({Height:"height",Width:"width"},function(e,n){y.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){y.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return y.access(this,function(n,r,i){var s;return y.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?y.css(n,r,u):y.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=y,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return y})})(window),this.Handlebars={},function(e){e.VERSION="1.0.rc.1",e.helpers={},e.partials={},e.registerHelper=function(e,t,n){n&&(t.not=n),this.helpers[e]=t},e.registerPartial=function(e,t){this.partials[e]=t},e.registerHelper("helperMissing",function(e){if(arguments.length===2)return undefined;throw new Error("Could not find property '"+e+"'")});var t=Object.prototype.toString,n="[object Function]";e.registerHelper("blockHelperMissing",function(r,i){var s=i.inverse||function(){},o=i.fn,u="",a=t.call(r);return a===n&&(r=r.call(this)),r===!0?o(this):r===!1||r==null?s(this):a==="[object Array]"?r.length>0?e.helpers.each(r,i):s(this):o(r)}),e.K=function(){},e.createFrame=Object.create||function(t){e.K.prototype=t;var n=new e.K;return e.K.prototype=null,n},e.registerHelper("each",function(t,n){var r=n.fn,i=n.inverse,s="",o;n.data&&(o=e.createFrame(n.data));if(t&&t.length>0)for(var u=0,a=t.length;u<a;u++)o&&(o.index=u),s+=r(t[u],{data:o});else s=i(this);return s}),e.registerHelper("if",function(r,i){var s=t.call(r);return s===n&&(r=r.call(this)),!r||e.Utils.isEmpty(r)?i.inverse(this):i.fn(this)}),e.registerHelper("unless",function(t,n){var r=n.fn,i=n.inverse;return n.fn=i,n.inverse=r,e.helpers["if"].call(this,t,n)}),e.registerHelper("with",function(e,t){return t.fn(e)}),e.registerHelper("log",function(t){e.log(t)})}(this.Handlebars);var handlebars=function(){function n(){this.yy={}}var e={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,statements:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,OPEN_PARTIAL:24,params:25,hash:26,DATA:27,param:28,STRING:29,INTEGER:30,BOOLEAN:31,hashSegments:32,hashSegment:33,ID:34,EQUALS:35,pathSegments:36,SEP:37,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"OPEN_PARTIAL",27:"DATA",29:"STRING",30:"INTEGER",31:"BOOLEAN",34:"ID",35:"EQUALS",37:"SEP"},productions_:[0,[3,2],[4,3],[4,1],[4,0],[6,1],[6,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[7,2],[17,3],[17,2],[17,2],[17,1],[17,1],[25,2],[25,1],[28,1],[28,1],[28,1],[28,1],[28,1],[26,1],[32,2],[32,1],[33,3],[33,3],[33,3],[33,3],[33,3],[21,1],[36,3],[36,1]],performAction:function(t,n,r,i,s,o,u){var a=o.length-1;switch(s){case 1:return o[a-1];case 2:this.$=new i.ProgramNode(o[a-2],o[a]);break;case 3:this.$=new i.ProgramNode(o[a]);break;case 4:this.$=new i.ProgramNode([]);break;case 5:this.$=[o[a]];break;case 6:o[a-1].push(o[a]),this.$=o[a-1];break;case 7:this.$=new i.BlockNode(o[a-2],o[a-1].inverse,o[a-1],o[a]);break;case 8:this.$=new i.BlockNode(o[a-2],o[a-1],o[a-1].inverse,o[a]);break;case 9:this.$=o[a];break;case 10:this.$=o[a];break;case 11:this.$=new i.ContentNode(o[a]);break;case 12:this.$=new i.CommentNode(o[a]);break;case 13:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 14:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 15:this.$=o[a-1];break;case 16:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1]);break;case 17:this.$=new i.MustacheNode(o[a-1][0],o[a-1][1],!0);break;case 18:this.$=new i.PartialNode(o[a-1]);break;case 19:this.$=new i.PartialNode(o[a-2],o[a-1]);break;case 20:break;case 21:this.$=[[o[a-2]].concat(o[a-1]),o[a]];break;case 22:this.$=[[o[a-1]].concat(o[a]),null];break;case 23:this.$=[[o[a-1]],o[a]];break;case 24:this.$=[[o[a]],null];break;case 25:this.$=[[new i.DataNode(o[a])],null];break;case 26:o[a-1].push(o[a]),this.$=o[a-1];break;case 27:this.$=[o[a]];break;case 28:this.$=o[a];break;case 29:this.$=new i.StringNode(o[a]);break;case 30:this.$=new i.IntegerNode(o[a]);break;case 31:this.$=new i.BooleanNode(o[a]);break;case 32:this.$=new i.DataNode(o[a]);break;case 33:this.$=new i.HashNode(o[a]);break;case 34:o[a-1].push(o[a]),this.$=o[a-1];break;case 35:this.$=[o[a]];break;case 36:this.$=[o[a-2],o[a]];break;case 37:this.$=[o[a-2],new i.StringNode(o[a])];break;case 38:this.$=[o[a-2],new i.IntegerNode(o[a])];break;case 39:this.$=[o[a-2],new i.BooleanNode(o[a])];break;case 40:this.$=[o[a-2],new i.DataNode(o[a])];break;case 41:this.$=new i.IdNode(o[a]);break;case 42:o[a-2].push(o[a]),this.$=o[a-2];break;case 43:this.$=[o[a]]}},table:[{3:1,4:2,5:[2,4],6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{1:[3]},{5:[1,16]},{5:[2,3],7:17,8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,19],20:[2,3],22:[1,13],23:[1,14],24:[1,15]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],19:[2,5],20:[2,5],22:[2,5],23:[2,5],24:[2,5]},{4:20,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{4:21,6:3,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],24:[1,15]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],24:[2,9]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],24:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],24:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],24:[2,12]},{17:22,21:23,27:[1,24],34:[1,26],36:25},{17:27,21:23,27:[1,24],34:[1,26],36:25},{17:28,21:23,27:[1,24],34:[1,26],36:25},{17:29,21:23,27:[1,24],34:[1,26],36:25},{21:30,34:[1,26],36:25},{1:[2,1]},{6:31,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],24:[1,15]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],19:[2,6],20:[2,6],22:[2,6],23:[2,6],24:[2,6]},{17:22,18:[1,32],21:23,27:[1,24],34:[1,26],36:25},{10:33,20:[1,34]},{10:35,20:[1,34]},{18:[1,36]},{18:[2,24],21:41,25:37,26:38,27:[1,45],28:39,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,25]},{18:[2,41],27:[2,41],29:[2,41],30:[2,41],31:[2,41],34:[2,41],37:[1,48]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],37:[2,43]},{18:[1,49]},{18:[1,50]},{18:[1,51]},{18:[1,52],21:53,34:[1,26],36:25},{5:[2,2],8:18,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,2],22:[1,13],23:[1,14],24:[1,15]},{14:[2,20],15:[2,20],16:[2,20],19:[2,20],22:[2,20],23:[2,20],24:[2,20]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],19:[2,7],20:[2,7],22:[2,7],23:[2,7],24:[2,7]},{21:54,34:[1,26],36:25},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],24:[2,8]},{14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],24:[2,14]},{18:[2,22],21:41,26:55,27:[1,45],28:56,29:[1,42],30:[1,43],31:[1,44],32:40,33:46,34:[1,47],36:25},{18:[2,23]},{18:[2,27],27:[2,27],29:[2,27],30:[2,27],31:[2,27],34:[2,27]},{18:[2,33],33:57,34:[1,58]},{18:[2,28],27:[2,28],29:[2,28],30:[2,28],31:[2,28],34:[2,28]},{18:[2,29],27:[2,29],29:[2,29],30:[2,29],31:[2,29],34:[2,29]},{18:[2,30],27:[2,30],29:[2,30],30:[2,30],31:[2,30],34:[2,30]},{18:[2,31],27:[2,31],29:[2,31],30:[2,31],31:[2,31],34:[2,31]},{18:[2,32],27:[2,32],29:[2,32],30:[2,32],31:[2,32],34:[2,32]},{18:[2,35],34:[2,35]},{18:[2,43],27:[2,43],29:[2,43],30:[2,43],31:[2,43],34:[2,43],35:[1,59],37:[2,43]},{34:[1,60]},{14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],24:[2,13]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],24:[2,16]},{5:[2,17],14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],24:[2,17]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],24:[2,18]},{18:[1,61]},{18:[1,62]},{18:[2,21]},{18:[2,26],27:[2,26],29:[2,26],30:[2,26],31:[2,26],34:[2,26]},{18:[2,34],34:[2,34]},{35:[1,59]},{21:63,27:[1,67],29:[1,64],30:[1,65],31:[1,66],34:[1,26],36:25},{18:[2,42],27:[2,42],29:[2,42],30:[2,42],31:[2,42],34:[2,42],37:[2,42]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],24:[2,19]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],24:[2,15]},{18:[2,36],34:[2,36]},{18:[2,37],34:[2,37]},{18:[2,38],34:[2,38]},{18:[2,39],34:[2,39]},{18:[2,40],34:[2,40]}],defaultActions:{16:[2,1],24:[2,25],38:[2,23],55:[2,21]},parseError:function(t,n){throw new Error(t)},parse:function(t){function v(e){r.length=r.length-2*e,i.length=i.length-e,s.length=s.length-e}function m(){var e;return e=n.lexer.lex()||1,typeof e!="number"&&(e=n.symbols_[e]||e),e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var p=this.lexer.yylloc;s.push(p);var d=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);var g,y,b,w,E,S,x={},T,N,C,k;for(;;){b=r[r.length-1];if(this.defaultActions[b])w=this.defaultActions[b];else{if(g===null||typeof g=="undefined")g=m();w=o[b]&&o[b][g]}if(typeof w=="undefined"||!w.length||!w[0]){var L="";if(!l){k=[];for(T in o[b])this.terminals_[T]&&T>2&&k.push("'"+this.terminals_[T]+"'");this.lexer.showPosition?L="Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+k.join(", ")+", got '"+(this.terminals_[g]||g)+"'":L="Parse error on line "+(a+1)+": Unexpected "+(g==1?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(L,{text:this.lexer.match,token:this.terminals_[g]||g,line:this.lexer.yylineno,loc:p,expected:k})}}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g);switch(w[0]){case 1:r.push(g),i.push(this.lexer.yytext),s.push(this.lexer.yylloc),r.push(w[1]),g=null,y?(g=y,y=null):(f=this.lexer.yyleng,u=this.lexer.yytext,a=this.lexer.yylineno,p=this.lexer.yylloc,l>0&&l--);break;case 2:N=this.productions_[w[1]][1],x.$=i[i.length-N],x._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column},d&&(x._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]),S=this.performAction.call(x,u,f,a,this.yy,w[1],i,s);if(typeof S!="undefined")return S;N&&(r=r.slice(0,-1*N*2),i=i.slice(0,-1*N),s=s.slice(0,-1*N)),r.push(this.productions_[w[1]][0]),i.push(x.$),s.push(x._$),C=o[r[r.length-2]][r[r.length-1]],r.push(C);break;case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(t,n){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,n)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);return t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=(new Array(e.length+1)).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,t,n,r,i,s;this._more||(this.yytext="",this.match="");var o=this._currentRules();for(var u=0;u<o.length;u++){n=this._input.match(this.rules[o[u]]);if(n&&(!t||n[0].length>t[0].length)){t=n,r=u;if(!this.options.flex)break}}if(t){s=t[0].match(/(?:\r\n?|\n).*/g),s&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1);if(e)return e;return}return this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var t=this.next();return typeof t!="undefined"?t:this.lex()},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};return e.options={},e.performAction=function(t,n,r,i){var s=i;switch(r){case 0:n.yytext.slice(-1)!=="\\"&&this.begin("mu"),n.yytext.slice(-1)==="\\"&&(n.yytext=n.yytext.substr(0,n.yyleng-1),this.begin("emu"));if(n.yytext)return 14;break;case 1:return 14;case 2:return n.yytext.slice(-1)!=="\\"&&this.popState(),n.yytext.slice(-1)==="\\"&&(n.yytext=n.yytext.substr(0,n.yyleng-1)),14;case 3:return 24;case 4:return 16;case 5:return 20;case 6:return 19;case 7:return 19;case 8:return 23;case 9:return 23;case 10:return n.yytext=n.yytext.substr(3,n.yyleng-5),this.popState(),15;case 11:return 22;case 12:return 35;case 13:return 34;case 14:return 34;case 15:return 37;case 16:break;case 17:return this.popState(),18;case 18:return this.popState(),18;case 19:return n.yytext=n.yytext.substr(1,n.yyleng-2).replace(/\\"/g,'"'),29;case 20:return n.yytext=n.yytext.substr(1,n.yyleng-2).replace(/\\"/g,'"'),29;case 21:return n.yytext=n.yytext.substr(1),27;case 22:return 31;case 23:return 31;case 24:return 30;case 25:return 34;case 26:return n.yytext=n.yytext.substr(1,n.yyleng-2),34;case 27:return"INVALID";case 28:return 5}},e.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[} ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@[a-zA-Z]+)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:[0-9]+(?=[}\s]))/,/^(?:[a-zA-Z0-9_$-]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],e.conditions={mu:{rules:[3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28],inclusive:!1},emu:{rules:[2],inclusive:!1},INITIAL:{rules:[0,1,28],inclusive:!0}},e}();return e.lexer=t,n.prototype=e,e.Parser=n,new n}();typeof require!="undefined"&&typeof exports!="undefined"&&(exports.parser=handlebars,exports.Parser=handlebars.Parser,exports.parse=function(){return handlebars.parse.apply(handlebars,arguments)},exports.main=function(t){if(!t[1])throw new Error("Usage: "+t[0]+" FILE");var n,r;return typeof process!="undefined"?n=require("fs").readFileSync(require("path").resolve(t[1]),"utf8"):n=require("file").path(require("file").cwd()).join(t[1]).read({charset:"utf-8"}),exports.parser.parse(n)},typeof module!="undefined"&&require.main===module&&exports.main(typeof process!="undefined"?process.argv.slice(1):require("system").args)),Handlebars.Parser=handlebars,Handlebars.parse=function(e){return Handlebars.Parser.yy=Handlebars.AST,Handlebars.Parser.parse(e)},Handlebars.print=function(e){return(new Handlebars.PrintVisitor).accept(e)},Handlebars.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(e,t){}},Handlebars.log=function(e,t){Handlebars.logger.log(e,t)},function(){Handlebars.AST={},Handlebars.AST.ProgramNode=function(e,t){this.type="program",this.statements=e,t&&(this.inverse=new Handlebars.AST.ProgramNode(t))},Handlebars.AST.MustacheNode=function(e,t,n){this.type="mustache",this.escaped=!n,this.hash=t;var r=this.id=e[0],i=this.params=e.slice(1),s=this.eligibleHelper=r.isSimple;this.isHelper=s&&(i.length||t)},Handlebars.AST.PartialNode=function(e,t){this.type="partial",this.id=e,this.context=t};var e=function(e,t){if(e.original!==t.original)throw new Handlebars.Exception(e.original+" doesn't match "+t.original)};Handlebars.AST.BlockNode=function(t,n,r,i){e(t.id,i),this.type="block",this.mustache=t,this.program=n,this.inverse=r,this.inverse&&!this.program&&(this.isInverse=!0)},Handlebars.AST.ContentNode=function(e){this.type="content",this.string=e},Handlebars.AST.HashNode=function(e){this.type="hash",this.pairs=e},Handlebars.AST.IdNode=function(e){this.type="ID",this.original=e.join(".");var t=[],n=0;for(var r=0,i=e.length;r<i;r++){var s=e[r];s===".."?n++:s==="."||s==="this"?this.isScoped=!0:t.push(s)}this.parts=t,this.string=t.join("."),this.depth=n,this.isSimple=e.length===1&&!this.isScoped&&n===0},Handlebars.AST.DataNode=function(e){this.type="DATA",this.id=e},Handlebars.AST.StringNode=function(e){this.type="STRING",this.string=e},Handlebars.AST.IntegerNode=function(e){this.type="INTEGER",this.integer=e},Handlebars.AST.BooleanNode=function(e){this.type="BOOLEAN",this.bool=e},Handlebars.AST.CommentNode=function(e){this.type="comment",this.comment=e}}(),Handlebars.Exception=function(e){var t=Error.prototype.constructor.apply(this,arguments);for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n]);this.message=t.message},Handlebars.Exception.prototype=new Error,Handlebars.SafeString=function(e){this.string=e},Handlebars.SafeString.prototype.toString=function(){return this.string.toString()},function(){var e={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},t=/[&<>"'`]/g,n=/[&<>"'`]/,r=function(t){return e[t]||"&"};Handlebars.Utils={escapeExpression:function(e){return e instanceof Handlebars.SafeString?e.toString():e==null||e===!1?"":n.test(e)?e.replace(t,r):e},isEmpty:function(e){return typeof e=="undefined"?!0:e===null?!0:e===!1?!0:Object.prototype.toString.call(e)==="[object Array]"&&e.length===0?!0:!1}}}(),Handlebars.Compiler=function(){},Handlebars.JavaScriptCompiler=function(){},function(e,t){e.prototype={compiler:e,disassemble:function(){var e=this.opcodes,t,n=[],r,i;for(var s=0,o=e.length;s<o;s++){t=e[s];if(t.opcode==="DECLARE")n.push("DECLARE "+t.name+"="+t.value);else{r=[];for(var u=0;u<t.args.length;u++)i=t.args[u],typeof i=="string"&&(i='"'+i.replace("\n","\\n")+'"'),r.push(i);n.push(t.opcode+" "+r.join(" "))}}return n.join("\n")},guid:0,compile:function(e,t){this.children=[],this.depths={list:[]},this.options=t;var n=this.options.knownHelpers;this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0};if(n)for(var r in n)this.options.knownHelpers[r]=n[r];return this.program(e)},accept:function(e){return this[e.type](e)},program:function(e){var t=e.statements,n;this.opcodes=[];for(var r=0,i=t.length;r<i;r++)n=t[r],this[n.type](n);return this.isSimple=i===1,this.depths.list=this.depths.list.sort(function(e,t){return e-t}),this},compileProgram:function(e){var t=(new this.compiler).compile(e,this.options),n=this.guid++,r;this.usePartial=this.usePartial||t.usePartial,this.children[n]=t;for(var i=0,s=t.depths.list.length;i<s;i++){r=t.depths.list[i];if(r<2)continue;this.addDepth(r-1)}return n},block:function(e){var t=e.mustache,n=e.program,r=e.inverse;n&&(n=this.compileProgram(n)),r&&(r=this.compileProgram(r));var i=this.classifyMustache(t);i==="helper"?this.helperMustache(t,n,r):i==="simple"?(this.simpleMustache(t),this.opcode("pushProgram",n),this.opcode("pushProgram",r),this.opcode("pushLiteral","{}"),this.opcode("blockValue")):(this.ambiguousMustache(t,n,r),this.opcode("pushProgram",n),this.opcode("pushProgram",r),this.opcode("pushLiteral","{}"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(e){var t=e.pairs,n,r;this.opcode("push","{}");for(var i=0,s=t.length;i<s;i++)n=t[i],r=n[1],this.accept(r),this.opcode("assignToHash",n[0])},partial:function(e){var t=e.id;this.usePartial=!0,e.context?this.ID(e.context):this.opcode("push","depth0"),this.opcode("invokePartial",t.original),this.opcode("append")},content:function(e){this.opcode("appendContent",e.string)},mustache:function(e){var t=this.options,n=this.classifyMustache(e);n==="simple"?this.simpleMustache(e):n==="helper"?this.helperMustache(e):this.ambiguousMustache(e),e.escaped&&!t.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousMustache:function(e,t,n){var r=e.id,i=r.parts[0];this.opcode("getContext",r.depth),this.opcode("pushProgram",t),this.opcode("pushProgram",n),this.opcode("invokeAmbiguous",i)},simpleMustache:function(e,t,n){var r=e.id;r.type==="DATA"?this.DATA(r):r.parts.length?this.ID(r):(this.addDepth(r.depth),this.opcode("getContext",r.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperMustache:function(e,t,n){var r=this.setupFullMustacheParams(e,t,n),i=e.id.parts[0];if(this.options.knownHelpers[i])this.opcode("invokeKnownHelper",r.length,i);else{if(this.knownHelpersOnly)throw new Error("You specified knownHelpersOnly, but used the unknown helper "+i);this.opcode("invokeHelper",r.length,i)}},ID:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0];t?this.opcode("lookupOnContext",e.parts[0]):this.opcode("pushContext");for(var n=1,r=e.parts.length;n<r;n++)this.opcode("lookup",e.parts[n])},DATA:function(e){this.options.data=!0,this.opcode("lookupData",e.id)},STRING:function(e){this.opcode("pushString",e.string)},INTEGER:function(e){this.opcode("pushLiteral",e.integer)},BOOLEAN:function(e){this.opcode("pushLiteral",e.bool)},comment:function(){},opcode:function(e){this.opcodes.push({opcode:e,args:[].slice.call(arguments,1)})},declare:function(e,t){this.opcodes.push({opcode:"DECLARE",name:e,value:t})},addDepth:function(e){if(isNaN(e))throw new Error("EWOT");if(e===0)return;this.depths[e]||(this.depths[e]=!0,this.depths.list.push(e))},classifyMustache:function(e){var t=e.isHelper,n=e.eligibleHelper,r=this.options;if(n&&!t){var i=e.id.parts[0];r.knownHelpers[i]?t=!0:r.knownHelpersOnly&&(n=!1)}return t?"helper":n?"ambiguous":"simple"},pushParams:function(e){var t=e.length,n;while(t--)n=e[t],this.options.stringParams?(n.depth&&this.addDepth(n.depth),this.opcode("getContext",n.depth||0),this.opcode("pushStringParam",n.string)):this[n.type](n)},setupMustacheParams:function(e){var t=e.params;return this.pushParams(t),e.hash?this.hash(e.hash):this.opcode("pushLiteral","{}"),t},setupFullMustacheParams:function(e,t,n){var r=e.params;return this.pushParams(r),this.opcode("pushProgram",t),this.opcode("pushProgram",n),e.hash?this.hash(e.hash):this.opcode("pushLiteral","{}"),r}};var n=function(e){this.value=e};t.prototype={nameLookup:function(e,n,r){return/^[0-9]+$/.test(n)?e+"["+n+"]":t.isValidJavaScriptVariableName(n)?e+"."+n:e+"['"+n+"']"},appendToBuffer:function(e){return this.environment.isSimple?"return "+e+";":"buffer += "+e+";"},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(e,t,n,r){this.environment=e,this.options=t||{},Handlebars.log(Handlebars.logger.DEBUG,this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!n,this.context=n||{programs:[],aliases:{}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.registers={list:[]},this.compileStack=[],this.compileChildren(e,t);var i=e.opcodes,s;this.i=0;for(o=i.length;this.i<o;this.i++)s=i[this.i],s.opcode==="DECLARE"?this[s.name]=s.value:this[s.opcode].apply(this,s.args);return this.createFunctionContext(r)},nextOpcode:function(){var e=this.environment.opcodes,t=e[this.i+1];return e[this.i+1]},eat:function(e){this.i=this.i+1},preamble:function(){var e=[];if(!this.isChild){var t=this.namespace,n="helpers = helpers || "+t+".helpers;";this.environment.usePartial&&(n=n+" partials = partials || "+t+".partials;"),this.options.data&&(n+=" data = data || {};"),e.push(n)}else e.push("");this.environment.isSimple?e.push(""):e.push(", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=e},createFunctionContext:function(e){var t=this.stackVars.concat(this.registers.list);t.length>0&&(this.source[1]=this.source[1]+", "+t.join(", "));if(!this.isChild){var n=[];for(var r in this.context.aliases)this.source[1]=this.source[1]+", "+r+"="+this.context.aliases[r]}this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.source.push("return buffer;");var i=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var s=0,o=this.environment.depths.list.length;s<o;s++)i.push("depth"+this.environment.depths.list[s]);if(e)return i.push(this.source.join("\n ")),Function.apply(this,i);var u="function "+(this.name||"")+"("+i.join(",")+") {\n "+this.source.join("\n ")+"}";return Handlebars.log(Handlebars.logger.DEBUG,u+"\n\n"),u},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e),this.replaceStack(function(t){return e.splice(1,0,t),t+" = blockHelperMissing.call("+e.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e);var t=this.topStack();e.splice(1,0,t),this.source.push("if (!"+this.lastHelper+") { "+t+" = blockHelperMissing.call("+e.join(", ")+"); }")},appendContent:function(e){this.source.push(this.appendToBuffer(this.quotedString(e)))},append:function(){var e=this.popStack();this.source.push("if("+e+" || "+e+" === 0) { "+this.appendToBuffer(e)+" }"),this.environment.isSimple&&this.source.push("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){var e=this.nextOpcode(),t="";this.context.aliases.escapeExpression="this.escapeExpression",e&&e.opcode==="appendContent"&&(t=" + "+this.quotedString(e.args[0]),this.eat(e)),this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"+t))},getContext:function(e){this.lastContext!==e&&(this.lastContext=e)},lookupOnContext:function(e){this.pushStack(this.nameLookup("depth"+this.lastContext,e,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"',this.replaceStack(function(e){return"typeof "+e+" === functionType ? "+e+"() : "+e})},lookup:function(e){this.replaceStack(function(t){return t+" == null || "+t+" === false ? "+t+" : "+this.nameLookup(t,e,"context")})},lookupData:function(e){this.pushStack(this.nameLookup("data",e,"data"))},pushStringParam:function(e){this.pushStackLiteral("depth"+this.lastContext),this.pushString(e)},pushString:function(e){this.pushStackLiteral(this.quotedString(e))},push:function(e){this.pushStack(e)},pushLiteral:function(e){this.pushStackLiteral(e)},pushProgram:function(e){e!=null?this.pushStackLiteral(this.programExpression(e)):this.pushStackLiteral(null)},invokeHelper:function(e,t){this.context.aliases.helperMissing="helpers.helperMissing";var n=this.lastHelper=this.setupHelper(e,t);this.register("foundHelper",n.name),this.pushStack("foundHelper ? foundHelper.call("+n.callParams+") "+": helperMissing.call("+n.helperMissingParams+")")},invokeKnownHelper:function(e,t){var n=this.setupHelper(e,t);this.pushStack(n.name+".call("+n.callParams+")")},invokeAmbiguous:function(e){this.context.aliases.functionType='"function"',this.pushStackLiteral("{}");var t=this.setupHelper(0,e),n=this.lastHelper=this.nameLookup("helpers",e,"helper");this.register("foundHelper",n);var r=this.nameLookup("depth"+this.lastContext,e,"context"),i=this.nextStack();this.source.push("if (foundHelper) { "+i+" = foundHelper.call("+t.callParams+"); }"),this.source.push("else { "+i+" = "+r+"; "+i+" = typeof "+i+" === functionType ? "+i+"() : "+i+"; }")},invokePartial:function(e){var t=[this.nameLookup("partials",e,"partial"),"'"+e+"'",this.popStack(),"helpers","partials"];this.options.data&&t.push("data"),this.context.aliases.self="this",this.pushStack("self.invokePartial("+t.join(", ")+");")},assignToHash:function(e){var t=this.popStack(),n=this.topStack();this.source.push(n+"['"+e+"'] = "+t+";")},compiler:t,compileChildren:function(e,t){var n=e.children,r,i;for(var s=0,o=n.length;s<o;s++){r=n[s],i=new this.compiler,this.context.programs.push("");var u=this.context.programs.length;r.index=u,r.name="program"+u,this.context.programs[u]=i.compile(r,t,this.context)}},programExpression:function(e){this.context.aliases.self="this";if(e==null)return"self.noop";var t=this.environment.children[e],n=t.depths.list,r,i=[t.index,t.name,"data"];for(var s=0,o=n.length;s<o;s++)r=n[s],r===1?i.push("depth0"):i.push("depth"+(r-1));return n.length===0?"self.program("+i.join(", ")+")":(i.shift(),"self.programWithDepth("+i.join(", ")+")")},register:function(e,t){this.useRegister(e),this.source.push(e+" = "+t+";")},useRegister:function(e){this.registers[e]||(this.registers[e]=!0,this.registers.list.push(e))},pushStackLiteral:function(e){return this.compileStack.push(new n(e)),e},pushStack:function(e){return this.source.push(this.incrStack()+" = "+e+";"),this.compileStack.push("stack"+this.stackSlot),"stack"+this.stackSlot},replaceStack:function(e){var t=e.call(this,this.topStack());return this.source.push(this.topStack()+" = "+t+";"),"stack"+this.stackSlot},nextStack:function(e){var t=this.incrStack();return this.compileStack.push("stack"+this.stackSlot),t},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),"stack"+this.stackSlot},popStack:function(){var e=this.compileStack.pop();return e instanceof n?e.value:(this.stackSlot--,e)},topStack:function(){var e=this.compileStack[this.compileStack.length-1];return e instanceof n?e.value:e},quotedString:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r")+'"'},setupHelper:function(e,t){var n=[];this.setupParams(e,n);var r=this.nameLookup("helpers",t,"helper");return{params:n,name:r,callParams:["depth0"].concat(n).join(", "),helperMissingParams:["depth0",this.quotedString(t)].concat(n).join(", ")}},setupParams:function(e,t){var n=[],r=[],i,s,o;n.push("hash:"+this.popStack()),s=this.popStack(),o=this.popStack();if(o||s)o||(this.context.aliases.self="this",o="self.noop"),s||(this.context.aliases.self="this",s="self.noop"),n.push("inverse:"+s),n.push("fn:"+o);for(var u=0;u<e;u++)i=this.popStack(),t.push(i),this.options.stringParams&&r.push(this.popStack());return this.options.stringParams&&n.push("contexts:["+r.join(",")+"]"),this.options.data&&n.push("data:data"),t.push("{"+n.join(",")+"}"),t.join(", ")}};var r="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),i=t.RESERVED_WORDS={};for(var s=0,o=r.length;s<o;s++)i[r[s]]=!0;t.isValidJavaScriptVariableName=function(e){return!t.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(e)?!0:!1}}(Handlebars.Compiler,Handlebars.JavaScriptCompiler),Handlebars.precompile=function(e,t){t=t||{},"data"in t||(t.data=!0);var n=Handlebars.parse(e),r=(new Handlebars.Compiler).compile(n,t);return(new Handlebars.JavaScriptCompiler).compile(r,t)},Handlebars.compile=function(e,t){function r(){var n=Handlebars.parse(e),r=(new Handlebars.Compiler).compile(n,t),i=(new Handlebars.JavaScriptCompiler).compile(r,t,undefined,!0);return Handlebars.template(i)}t=t||{},"data"in t||(t.data=!0);var n;return function(e,t){return n||(n=r()),n.call(this,e,t)}},Handlebars.VM={template:function(e){var t={escapeExpression:Handlebars.Utils.escapeExpression,invokePartial:Handlebars.VM.invokePartial,programs:[],program:function(e,t,n){var r=this.programs[e];return n?(r=Handlebars.VM.program(t,n),r.program=e):r||(r=this.programs[e]=Handlebars.VM.program(t),r.program=e),r},programWithDepth:Handlebars.VM.programWithDepth,noop:Handlebars.VM.noop};return function(n,r){return r=r||{},e.call(t,Handlebars,n,r.helpers,r.partials,r.data)}},programWithDepth:function(e,t,n){var r=Array.prototype.slice.call(arguments,2);return function(n,i){return i=i||{},e.apply(this,[n,i.data||t].concat(r))}},program:function(e,t){return function(n,r){return r=r||{},e(n,r.data||t)}},noop:function(){return""},invokePartial:function(e,t,n,r,i,s){var o={helpers:r,partials:i,data:s};if(e===undefined)throw new Handlebars.Exception("The partial "+t+" could not be found");if(e instanceof Function)return e(n,o);if(!Handlebars.compile)throw new Handlebars.Exception("The partial "+t+" could not be compiled when running in runtime-only mode");return i[t]=Handlebars.compile(e,{data:s!==undefined}),i[t](n,o)}},Handlebars.template=Handlebars.VM.template,function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=r.unshift,l=i.toString,c=i.hasOwnProperty,h=r.forEach,p=r.map,d=r.reduce,v=r.reduceRight,m=r.filter,g=r.every,y=r.some,b=r.indexOf,w=r.lastIndexOf,E=Array.isArray,S=Object.keys,x=s.bind,T=function(e){if(e instanceof T)return e;if(!(this instanceof T))return new T(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=T),exports._=T):e._=T,T.VERSION="1.4.2";var N=T.each=T.forEach=function(e,t,r){if(e==null)return;if(h&&e.forEach===h)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(T.has(e,o)&&t.call(r,e[o],o,e)===n)return};T.map=T.collect=function(e,t,n){var r=[];return e==null?r:p&&e.map===p?e.map(t,n):(N(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)},T.reduce=T.foldl=T.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduce===d)return r&&(t=T.bind(t,r)),i?e.reduce(t,n):e.reduce(t);N(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},T.reduceRight=T.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(v&&e.reduceRight===v)return r&&(t=T.bind(t,r)),arguments.length>2?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=T.keys(e);s=o.length}N(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError("Reduce of empty array with no initial value");return n},T.find=T.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},T.filter=T.select=function(e,t,n){var r=[];return e==null?r:m&&e.filter===m?e.filter(t,n):(N(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},T.reject=function(e,t,n){var r=[];return e==null?r:(N(e,function(e,i,s){t.call(n,e,i,s)||(r[r.length]=e)}),r)},T.every=T.all=function(e,t,r){t||(t=T.identity);var i=!0;return e==null?i:g&&e.every===g?e.every(t,r):(N(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=T.some=T.any=function(e,t,r){t||(t=T.identity);var i=!1;return e==null?i:y&&e.some===y?e.some(t,r):(N(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};T.contains=T.include=function(e,t){var n=!1;return e==null?n:b&&e.indexOf===b?e.indexOf(t)!=-1:(n=C(e,function(e){return e===t}),n)},T.invoke=function(e,t){var n=u.call(arguments,2);return T.map(e,function(e){return(T.isFunction(t)?t:e[t]).apply(e,n)})},T.pluck=function(e,t){return T.map(e,function(e){return e[t]})},T.where=function(e,t){return T.isEmpty(t)?[]:T.filter(e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},T.max=function(e,t,n){if(!t&&T.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&T.isEmpty(e))return-Infinity;var r={computed:-Infinity};return N(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},T.min=function(e,t,n){if(!t&&T.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&T.isEmpty(e))return Infinity;var r={computed:Infinity};return N(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},T.shuffle=function(e){var t,n=0,r=[];return N(e,function(e){t=T.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return T.isFunction(e)?e:function(t){return t[e]}};T.sortBy=function(e,t,n){var r=k(t);return T.pluck(T.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t);return N(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};T.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(T.has(e,t)?e[t]:e[t]=[]).push(n)})},T.countBy=function(e,t,n){return L(e,t,n,function(e,t,n){T.has(e,t)||(e[t]=0),e[t]++})},T.sortedIndex=function(e,t,n,r){n=n==null?T.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},T.toArray=function(e){return e?e.length===+e.length?u.call(e):T.values(e):[]},T.size=function(e){return e.length===+e.length?e.length:T.keys(e).length},T.first=T.head=T.take=function(e,t,n){return t!=null&&!n?u.call(e,0,t):e[0]},T.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},T.last=function(e,t,n){return t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},T.rest=T.tail=T.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},T.compact=function(e){return T.filter(e,function(e){return!!e})};var A=function(e,t,n){return N(e,function(e){T.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};T.flatten=function(e,t){return A(e,t,[])},T.without=function(e){return T.difference(e,u.call(arguments,1))},T.uniq=T.unique=function(e,t,n,r){var i=n?T.map(e,n,r):e,s=[],o=[];return N(i,function(n,r){if(t?!r||o[o.length-1]!==n:!T.contains(o,n))o.push(n),s.push(e[r])}),s},T.union=function(){return T.uniq(a.apply(r,arguments))},T.intersection=function(e){var t=u.call(arguments,1);return T.filter(T.uniq(e),function(e){return T.every(t,function(t){return T.indexOf(t,e)>=0})})},T.difference=function(e){var t=a.apply(r,u.call(arguments,1));return T.filter(e,function(e){return!T.contains(t,e)})},T.zip=function(){var e=u.call(arguments),t=T.max(T.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=T.pluck(e,""+r);return n},T.object=function(e,t){var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},T.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=T.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(b&&e.indexOf===b)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},T.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(w&&e.lastIndexOf===w)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},T.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};T.bind=function(t,n){var r,i;if(t.bind===x&&x)return x.apply(t,u.call(arguments,1));if(!T.isFunction(t))throw new TypeError;return i=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=t.prototype;var e=new O,s=t.apply(e,i.concat(u.call(arguments)));return Object(s)===s?s:e}return t.apply(n,i.concat(u.call(arguments)))}},T.bindAll=function(e){var t=u.call(arguments,1);return t.length==0&&(t=T.functions(e)),N(t,function(t){e[t]=T.bind(e[t],e)}),e},T.memoize=function(e,t){var n={};return t||(t=T.identity),function(){var r=t.apply(this,arguments);return T.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},T.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},T.defer=function(e){return T.delay.apply(T,[e,1].concat(u.call(arguments,1)))},T.throttle=function(e,t){var n,r,i,s,o,u,a=T.debounce(function(){o=s=!1},t);return function(){n=this,r=arguments;var f=function(){i=null,o&&(u=e.apply(n,r)),a()};return i||(i=setTimeout(f,t)),s?o=!0:(s=!0,u=e.apply(n,r)),a(),u}},T.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},T.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},T.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},T.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},T.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},T.keys=S||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)T.has(e,n)&&(t[t.length]=n);return t},T.values=function(e){var t=[];for(var n in e)T.has(e,n)&&t.push(e[n]);return t},T.pairs=function(e){var t=[];for(var n in e)T.has(e,n)&&t.push([n,e[n]]);return t},T.invert=function(e){var t={};for(var n in e)T.has(e,n)&&(t[e[n]]=n);return t},T.functions=T.methods=function(e){var t=[];for(var n in e)T.isFunction(e[n])&&t.push(n);return t.sort()},T.extend=function(e){return N(u.call(arguments,1),function(t){for(var n in t)e[n]=t[n]}),e},T.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return N(n,function(n){n in e&&(t[n]=e[n])}),t},T.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)T.contains(n,i)||(t[i]=e[i]);return t},T.defaults=function(e){return N(u.call(arguments,1),function(t){for(var n in t)e[n]==null&&(e[n]=t[n])}),e},T.clone=function(e){return T.isObject(e)?T.isArray(e)?e.slice():T.extend({},e):e},T.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof T&&(e=e._wrapped),t instanceof T&&(t=t._wrapped);var i=l.call(e);if(i!=l.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=M(e[o],t[o],n,r)))break}else{var a=e.constructor,f=t.constructor;if(a!==f&&!(T.isFunction(a)&&a instanceof a&&T.isFunction(f)&&f instanceof f))return!1;for(var c in e)if(T.has(e,c)){o++;if(!(u=T.has(t,c)&&M(e[c],t[c],n,r)))break}if(u){for(c in t)if(T.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};T.isEqual=function(e,t){return M(e,t,[],[])},T.isEmpty=function(e){if(e==null)return!0;if(T.isArray(e)||T.isString(e))return e.length===0;for(var t in e)if(T.has(e,t))return!1;return!0},T.isElement=function(e){return!!e&&e.nodeType===1},T.isArray=E||function(e){return l.call(e)=="[object Array]"},T.isObject=function(e){return e===Object(e)},N(["Arguments","Function","String","Number","Date","RegExp"],function(e){T["is"+e]=function(t){return l.call(t)=="[object "+e+"]"}}),T.isArguments(arguments)||(T.isArguments=function(e){return!!e&&!!T.has(e,"callee")}),typeof /./!="function"&&(T.isFunction=function(e){return typeof e=="function"}),T.isFinite=function(e){return T.isNumber(e)&&isFinite(e)},T.isNaN=function(e){return T.isNumber(e)&&e!=+e},T.isBoolean=function(e){return e===!0||e===!1||l.call(e)=="[object Boolean]"},T.isNull=function(e){return e===null},T.isUndefined=function(e){return e===void 0},T.has=function(e,t){return c.call(e,t)},T.noConflict=function(){return e._=t,this},T.identity=function(e){return e},T.times=function(e,t,n){for(var r=0;r<e;r++)t.call(n,r)},T.random=function(e,t){return t==null&&(t=e,e=0),e+(0|Math.random()*(t-e+1))};var _={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};_.unescape=T.invert(_.escape);var D={escape:new RegExp("["+T.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+T.keys(_.unescape).join("|")+")","g")};T.each(["escape","unescape"],function(e){T[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),T.result=function(e,t){if(e==null)return null;var n=e[t];return T.isFunction(n)?n.call(e):n},T.mixin=function(e){N(T.functions(e),function(t){var n=T[t]=e[t];T.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(T,e))}})};var P=0;T.uniqueId=function(e){var t=P++;return e?e+t:t},T.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;T.template=function(e,t,n){n=T.defaults({},n,T.templateSettings);var r=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),i=0,s="__p+='";e.replace(r,function(t,n,r,o,u){s+=e.slice(i,u).replace(j,function(e){return"\\"+B[e]}),s+=n?"'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'":r?"'+\n((__t=("+r+"))==null?'':__t)+\n'":o?"';\n"+o+"\n__p+='":"",i=u+t.length}),s+="';\n",n.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(n.variable||"obj","_",s)}catch(u){throw u.source=s,u}if(t)return o(t,T);var a=function(e){return o.call(this,e,T)};return a.source="function("+(n.variable||"obj")+"){\n"+s+"}",a},T.chain=function(e){return T(e).chain()};var F=function(e){return this._chain?T(e).chain():e};T.mixin(T),N(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];T.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),N(["concat","join","slice"],function(e){var t=r[e];T.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),T.extend(T.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),function(){var e=this,t=e.Backbone,n=[],r=n.push,i=n.slice,s=n.splice,o;typeof exports!="undefined"?o=exports:o=e.Backbone={},o.VERSION="0.9.9";var u=e._;!u&&typeof require!="undefined"&&(u=require("underscore")),o.$=e.jQuery||e.Zepto||e.ender,o.noConflict=function(){return e.Backbone=t,this},o.emulateHTTP=!1,o.emulateJSON=!1;var a=/\s+/,f=function(e,t,n,r){if(!n)return!0;if(typeof n=="object")for(var i in n)e[t].apply(e,[i,n[i]].concat(r));else{if(!a.test(n))return!0;var s=n.split(a);for(var o=0,u=s.length;o<u;o++)e[t].apply(e,[s[o]].concat(r))}},l=function(e,t,n){var r,i=-1,s=t.length;switch(n.length){case 0:while(++i<s)(r=t[i]).callback.call(r.ctx);return;case 1:while(++i<s)(r=t[i]).callback.call(r.ctx,n[0]);return;case 2:while(++i<s)(r=t[i]).callback.call(r.ctx,n[0],n[1]);return;case 3:while(++i<s)(r=t[i]).callback.call(r.ctx,n[0],n[1],n[2]);return;default:while(++i<s)(r=t[i]).callback.apply(r.ctx,n)}},c=o.Events={on:function(e,t,n){if(!f(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var r=this._events[e]||(this._events[e]=[]);return r.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,n){if(!f(this,"once",e,[t,n])||!t)return this;var r=this,i=u.once(function(){r.off(e,i),t.apply(this,arguments)});return i._callback=t,this.on(e,i,n),this},off:function(e,t,n){var r,i,s,o,a,l,c,h;if(!this._events||!f(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events={},this;o=e?[e]:u.keys(this._events);for(a=0,l=o.length;a<l;a++){e=o[a];if(r=this._events[e]){s=[];if(t||n)for(c=0,h=r.length;c<h;c++)i=r[c],(t&&t!==(i.callback._callback||i.callback)||n&&n!==i.context)&&s.push(i);this._events[e]=s}}return this},trigger:function(e){if(!this._events)return this;var t=i.call(arguments,1);if(!f(this,"trigger",e,t))return this;var n=this._events[e],r=this._events.all;return n&&l(this,n,t),r&&l(this,r,arguments),this},listenTo:function(e,t,n){var r=this._listeners||(this._listeners={}),i=e._listenerId||(e._listenerId=u.uniqueId("l"));return r[i]=e,e.on(t,n||this,this),this},stopListening:function(e,t,n){var r=this._listeners;if(!r)return;if(e)e.off(t,n,this),!t&&!n&&delete r[e._listenerId];else{for(var i in r)r[i].off(null,null,this);this._listeners={}}return this}};c.bind=c.on,c.unbind=c.off,u.extend(o,c);var h=o.Model=function(e,t){var n,r=e||{};this.cid=u.uniqueId("c"),this.changed={},this.attributes={},this._changes=[],t&&t.collection&&(this.collection=t.collection),t&&t.parse&&(r=this.parse(r)),(n=u.result(this,"defaults"))&&u.defaults(r,n),this.set(r,{silent:!0}),this._currentAttributes=u.clone(this.attributes),this._previousAttributes=u.clone(this.attributes),this.initialize.apply(this,arguments)};u.extend(h.prototype,c,{changed:null,idAttribute:"id",initialize:function(){},toJSON:function(e){return u.clone(this.attributes)},sync:function(){return o.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return u.escape(this.get(e))},has:function(e){return this.get(e)!=null},set:function(e,t,n){var r,i;if(e==null)return this;u.isObject(e)?(i=e,n=t):(i={})[e]=t;var s=n&&n.silent,o=n&&n.unset;if(!this._validate(i,n))return!1;this.idAttribute in i&&(this.id=i[this.idAttribute]);var a=this.attributes;for(r in i)t=i[r],o?delete a[r]:a[r]=t,this._changes.push(r,t);return this._hasComputed=!1,s||this.change(n),this},unset:function(e,t){return this.set(e,void 0,u.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,u.extend({},e,{unset:!0}))},fetch:function(e){e=e?u.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=this,n=e.success;return e.success=function(r,i,s){if(!t.set(t.parse(r),e))return!1;n&&n(t,r,e)},this.sync("read",this,e)},save:function(e,t,n){var r,i,s;e==null||u.isObject(e)?(r=e,n=t):e!=null&&((r={})[e]=t),n=n?u.clone(n):{};if(n.wait){if(r&&!this._validate(r,n))return!1;i=u.clone(this.attributes)}var o=u.extend({},n,{silent:!0});if(r&&!this.set(r,n.wait?o:n))return!1;if(!r&&!this._validate(null,n))return!1;var a=this,f=n.success;n.success=function(e,t,i){s=!0;var o=a.parse(e);n.wait&&(o=u.extend(r||{},o));if(!a.set(o,n))return!1;f&&f(a,e,n)};var l=this.isNew()?"create":n.patch?"patch":"update";l=="patch"&&(n.attrs=r);var c=this.sync(l,this,n);return!s&&n.wait&&(this.clear(o),this.set(i,o)),c},destroy:function(e){e=e?u.clone(e):{};var t=this,n=e.success,r=function(){t.trigger("destroy",t,t.collection,e)};e.success=function(i){(e.wait||t.isNew())&&r(),n&&n(t,i,e)};if(this.isNew())return e.success(),!1;var i=this.sync("delete",this,e);return e.wait||r(),i},url:function(){var e=u.result(this,"urlRoot")||u.result(this.collection,"url")||M();return this.isNew()?e:e+(e.charAt(e.length-1)==="/"?"":"/")+encodeURIComponent(this.id)},parse:function(e){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return this.id==null},change:function(e){var t=this._changing;this._changing=!0;var n=this._computeChanges(!0);this._pending=!!n.length;for(var r=n.length-2;r>=0;r-=2)this.trigger("change:"+n[r],this,n[r+1],e);if(t)return this;while(this._pending)this._pending=!1,this.trigger("change",this,e),this._previousAttributes=u.clone(this.attributes);return this._changing=!1,this},hasChanged:function(e){return this._hasComputed||this._computeChanges(),e==null?!u.isEmpty(this.changed):u.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?u.clone(this.changed):!1;var t,n=!1,r=this._previousAttributes;for(var i in e){if(u.isEqual(r[i],t=e[i]))continue;(n||(n={}))[i]=t}return n},_computeChanges:function(e){this.changed={};var t={},n=[],r=this._currentAttributes||{},i=this._changes;for(var s=i.length-2;s>=0;s-=2){var o=i[s],u=i[s+1];if(t[o])continue;t[o]=!0;if(r[o]!==u){this.changed[o]=u;if(!e)continue;n.push(o,u),r[o]=u}}return e&&(this._changes=[]),this._hasComputed=!0,n},previous:function(e){return e==null||!this._previousAttributes?null:this._previousAttributes[e]},previousAttributes:function(){return u.clone(this._previousAttributes)},_validate:function(e,t){if(!this.validate)return!0;e=u.extend({},this.attributes,e);var n=this.validate(e,t);return n?(t&&t.error&&t.error(this,n,t),this.trigger("error",this,n,t),!1):!0}});var p=o.Collection=function(e,t){t||(t={}),t.model&&(this.model=t.model),t.comparator!==void 0&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,u.extend({silent:!0},t))};u.extend(p.prototype,c,{model:h,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return o.sync.apply(this,arguments)},add:function(e,t){var n,i,o,a,f,l,c=t&&t.at,h=(t&&t.sort)==null?!0:t.sort;e=u.isArray(e)?e.slice():[e];for(n=e.length-1;n>=0;n--){if(!(a=this._prepareModel(e[n],t))){this.trigger("error",this,e[n],t),e.splice(n,1);continue}e[n]=a,f=a.id!=null&&this._byId[a.id];if(f||this._byCid[a.cid]){t&&t.merge&&f&&(f.set(a.attributes,t),l=h),e.splice(n,1);continue}a.on("all",this._onModelEvent,this),this._byCid[a.cid]=a,a.id!=null&&(this._byId[a.id]=a)}e.length&&(l=h),this.length+=e.length,i=[c!=null?c:this.models.length,0],r.apply(i,e),s.apply(this.models,i),l&&this.comparator&&c==null&&this.sort({silent:!0});if(t&&t.silent)return this;while(a=e.shift())a.trigger("add",a,this,t);return this},remove:function(e,t){var n,r,i,s;t||(t={}),e=u.isArray(e)?e.slice():[e];for(n=0,r=e.length;n<r;n++){s=this.get(e[n]);if(!s)continue;delete this._byId[s.id],delete this._byCid[s.cid],i=this.indexOf(s),this.models.splice(i,1),this.length--,t.silent||(t.index=i,s.trigger("remove",s,this,t)),this._removeReference(s)}return this},push:function(e,t){return e=this._prepareModel(e,t),this.add(e,u.extend({at:this.length},t)),e},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return e=this._prepareModel(e,t),this.add(e,u.extend({at:0},t)),e},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(e,t){return this.models.slice(e,t)},get:function(e){return e==null?void 0:this._byId[e.id!=null?e.id:e]||this._byCid[e.cid||e]},at:function(e){return this.models[e]},where:function(e){return u.isEmpty(e)?[]:this.filter(function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},sort:function(e){if(!this.comparator)throw new Error("Cannot sort a set without a comparator");return u.isString(this.comparator)||this.comparator.length===1?this.models=this.sortBy(this.comparator,this):this.models.sort(u.bind(this.comparator,this)),(!e||!e.silent)&&this.trigger("sort",this,e),this},pluck:function(e){return u.invoke(this.models,"get",e)},update:function(e,t){var n,r,i,s,o=[],a=[],f={},l=this.model.prototype.idAttribute;t=u.extend({add:!0,merge:!0,remove:!0},t),t.parse&&(e=this.parse(e)),u.isArray(e)||(e=e?[e]:[]);if(t.add&&!t.remove)return this.add(e,t);for(r=0,i=e.length;r<i;r++)n=e[r],s=this.get(n.id||n.cid||n[l]),t.remove&&s&&(f[s.cid]=!0),(t.add&&!s||t.merge&&s)&&o.push(n);if(t.remove)for(r=0,i=this.models.length;r<i;r++)n=this.models[r],f[n.cid]||a.push(n);return a.length&&this.remove(a,t),o.length&&this.add(o,t),this},reset:function(e,t){t||(t={}),t.parse&&(e=this.parse(e));for(var n=0,r=this.models.length;n<r;n++)this._removeReference(this.models[n]);return t.previousModels=this.models,this._reset(),e&&this.add(e,u.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),this},fetch:function(e){e=e?u.clone(e):{},e.parse===void 0&&(e.parse=!0);var t=this,n=e.success;return e.success=function(r,i,s){var o=e.update?"update":"reset";t[o](r,e),n&&n(t,r,e)},this.sync("read",this,e)},create:function(e,t){var n=this;t=t?u.clone(t):{},e=this._prepareModel(e,t);if(!e)return!1;t.wait||n.add(e,t);var r=t.success;return t.success=function(e,t,i){i.wait&&n.add(e,i),r&&r(e,t,i)},e.save(null,t),e},parse:function(e){return e},clone:function(){return new this.constructor(this.models)},chain:function(){return u(this.models).chain()},_reset:function(){this.length=0,this.models=[],this._byId={},this._byCid={}},_prepareModel:function(e,t){if(e instanceof h)return e.collection||(e.collection=this),e;t||(t={}),t.collection=this;var n=new this.model(e,t);return n._validate(e,t)?n:!1},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,r){if((e==="add"||e==="remove")&&n!==this)return;e==="destroy"&&this.remove(t,r),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],t.id!=null&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments)}});var d=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","sortedIndex","toArray","size","first","head","take","initial","rest","tail","last","without","indexOf","shuffle","lastIndexOf","isEmpty"];u.each(d,function(e){p.prototype[e]=function(){var t=i.call(arguments);return t.unshift(this.models),u[e].apply(u,t)}});var v=["groupBy","countBy","sortBy"];u.each(v,function(e){p.prototype[e]=function(t,n){var r=u.isFunction(t)?t:function(e){return e.get(t)};return u[e](this.models,r,n)}});var m=o.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},g=/\((.*?)\)/g,y=/:\w+/g,b=/\*\w+/g,w=/[\-{}\[\]+?.,\\\^$|#\s]/g;u.extend(m.prototype,c,{initialize:function(){},route:function(e,t,n){return u.isRegExp(e)||(e=this._routeToRegExp(e)),n||(n=this[t]),o.history.route(e,u.bind(function(r){var i=this._extractParameters(e,r);n&&n.apply(this,i),this.trigger.apply(this,["route:"+t].concat(i)),o.history.trigger("route",this,t,i)},this)),this},navigate:function(e,t){return o.history.navigate(e,t),this},_bindRoutes:function(){if(!this.routes)return;var e,t=u.keys(this.routes);while((e=t.pop())!=null)this.route(e,this.routes[e])},_routeToRegExp:function(e){return e=e.replace(w,"\\$&").replace(g,"(?:$1)?").replace(y,"([^/]+)").replace(b,"(.*?)"),new RegExp("^"+e+"$")},_extractParameters:function(e,t){return e.exec(t).slice(1)}});var E=o.History=function(){this.handlers=[],u.bindAll(this,"checkUrl"),typeof window!="undefined"&&(this.location=window.location,this.history=window.history)},S=/^[#\/]|\s+$/g,x=/^\/+|\/+$/g,T=/msie [\w.]+/,N=/\/$/;E.started=!1,u.extend(E.prototype,c,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(e==null)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(N,"");e.indexOf(n)||(e=e.substr(n.length))}else e=this.getHash();return e.replace(S,"")},start:function(e){if(E.started)throw new Error("Backbone.history has already been started");E.started=!0,this.options=u.extend({},{root:"/"},this.options,e),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var t=this.getFragment(),n=document.documentMode,r=T.exec(navigator.userAgent.toLowerCase())&&(!n||n<=7);this.root=("/"+this.root+"/").replace(x,"/"),r&&this._wantsHashChange&&(this.iframe=o.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(t)),this._hasPushState?o.$(window).bind("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!r?o.$(window).bind("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=t;var i=this.location,s=i.pathname.replace(/[^\/]$/,"$&/")===this.root;if(this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!s)return this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0;this._wantsPushState&&this._hasPushState&&s&&i.hash&&(this.fragment=this.getHash().replace(S,""),this.history.replaceState({},document.title,this.root+this.fragment+i.search));if(!this.options.silent)return this.loadUrl()},stop:function(){o.$(window).unbind("popstate",this.checkUrl).unbind("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),E.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(e){var t=this.getFragment();t===this.fragment&&this.iframe&&(t=this.getFragment(this.getHash(this.iframe)));if(t===this.fragment)return!1;this.iframe&&this.navigate(t),this.loadUrl()||this.loadUrl(this.getHash())},loadUrl:function(e){var t=this.fragment=this.getFragment(e),n=u.any(this.handlers,function(e){if(e.route.test(t))return e.callback(t),!0});return n},navigate:function(e,t){if(!E.started)return!1;if(!t||t===!0)t={trigger:t};e=this.getFragment(e||"");if(this.fragment===e)return;this.fragment=e;var n=this.root+e;if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}t.trigger&&this.loadUrl(e)},_updateHash:function(e,t,n){if(n){var r=e.href.replace(/(javascript:|#).*$/,"");e.replace(r+"#"+t)}else e.hash="#"+t}}),o.history=new E;var C=o.View=function(e){this.cid=u.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},k=/^(\S+)\s*(.*)$/,L=["model","collection","el","id","attributes","className","tagName","events"];u.extend(C.prototype,c,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},make:function(e,t,n){var r=document.createElement(e);return t&&o.$(r).attr(t),n!=null&&o.$(r).html(n),r},setElement:function(e,t){return this.$el&&this.undelegateEvents(),this.$el=e instanceof o.$?e:o.$(e),this.el=this.$el[0],t!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=u.result(this,"events")))return;this.undelegateEvents();for(var t in e){var n=e[t];u.isFunction(n)||(n=this[e[t]]);if(!n)throw new Error('Method "'+e[t]+'" does not exist');var r=t.match(k),i=r[1],s=r[2];n=u.bind(n,this),i+=".delegateEvents"+this.cid,s===""?this.$el.bind(i,n):this.$el.delegate(s,i,n)}},undelegateEvents:function(){this.$el.unbind(".delegateEvents"+this.cid)},_configure:function(e){this.options&&(e=u.extend({},u.result(this,"options"),e)),u.extend(this,u.pick(e,L)),this.options=e},_ensureElement:function(){if(!this.el){var e=u.extend({},u.result(this,"attributes"));this.id&&(e.id=u.result(this,"id")),this.className&&(e["class"]=u.result(this,"className")),this.setElement(this.make(u.result(this,"tagName"),e),!1)}else this.setElement(u.result(this,"el"),!1)}});var A={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};o.sync=function(e,t,n){var r=A[e];u.defaults(n||(n={}),{emulateHTTP:o.emulateHTTP,emulateJSON:o.emulateJSON});var i={type:r,dataType:"json"};n.url||(i.url=u.result(t,"url")||M()),n.data==null&&t&&(e==="create"||e==="update"||e==="patch")&&(i.contentType="application/json",i.data=JSON.stringify(n.attrs||t.toJSON(n))),n.emulateJSON&&(i.contentType="application/x-www-form-urlencoded",i.data=i.data?{model:i.data}:{});if(n.emulateHTTP&&(r==="PUT"||r==="DELETE"||r==="PATCH")){i.type="POST",n.emulateJSON&&(i.data._method=r);var s=n.beforeSend;n.beforeSend=function(e){e.setRequestHeader("X-HTTP-Method-Override",r);if(s)return s.apply(this,arguments)}}i.type!=="GET"&&!n.emulateJSON&&(i.processData=!1);var a=n.success;n.success=function(e,r,i){a&&a(e,r,i),t.trigger("sync",t,e,n)};var f=n.error;n.error=function(e,r,i){f&&f(t,e,n),t.trigger("error",t,e,n)};var l=o.ajax(u.extend(i,n));return t.trigger("request",t,l,n),l},o.ajax=function(){return o.$.ajax.apply(o.$,arguments)};var O=function(e,t){var n=this,r;e&&u.has(e,"constructor")?r=e.constructor:r=function(){n.apply(this,arguments)},u.extend(r,n,t);var i=function(){this.constructor=r};return i.prototype=n.prototype,r.prototype=new i,e&&u.extend(r.prototype,e),r.__super__=n.prototype,r};h.extend=p.extend=m.extend=C.extend=E.extend=O;var M=function(){throw new Error('A "url" property or function must be specified')}}.call(this),function(){function s(){this.helpers&&_.each(this.helpers,function(e,t){var n=this;this.helpers[t]=function(){var t=_.toArray(arguments),r=_.last(t);return r.context=this,e.apply(n,t)}},this)}function o(e,t){var n=e.extend;e.extend=function(){var e=n.apply(this,arguments);return e.prototype.name&&(t[e.prototype.name]=e),e}}function u(e,t,n,r){var i=e[t],s;if(n.indexOf(".")>=0){var o=n.split(/\./);n=o.pop(),_.each(o,function(e){i=i[e]})}i&&(s=i[n]);if(!s&&!r)throw new Error(t+": "+n+" does not exist.");return s}function a(e,t){var n;_.isString(this[e])?n=i.Util.getTemplate(this[e],!0):this.name&&!_.isFunction(this[e])&&(n=i.Util.getTemplate(this.name+(t.extension||""),!0)),!n&&e==="template"&&this._defaultTemplate&&(n=this._defaultTemplate),n&&!_.isFunction(this[e])&&(this[e]=n);if(t.required&&!_.isFunction(this[e]))throw new Error("View "+(this.name||this.cid)+" requires: "+e)}function f(e,t,n){return!e||!e[t]?null:_.isFunction(e[t])?e[t].call(n||e):e[t]}function c(e){_.each(l,function(t){e[t.name]||(e[t.name]=[])})}function h(e){_.each(l,function(t){e[t.name]=[]})}function p(e,t,n,r){var i=[];_.has(e,t)&&i.push(e);var s=e;if(n)while(s=s.__parent__)_.has(s,t)&&i.push(s);else{s=s.constructor;while(s)s.prototype&&_.has(s.prototype,t)&&i.push(s.prototype),s=s.__super__&&s.__super__.constructor}var o=i.length;while(o--)_.each(f(i[o],t,e),r)}function d(e,t,n,r){if(_.isObject(n)){var i=l[t];if(i&&i.event)return v(e["_"+t+"Events"],n,r),!0}}function v(e,t,n){_.each(t,function(t,r){_.isArray(t)?_.each(t,function(t){e.push([r,t,n])}):e.push([r,t,n])})}function m(e){if(!e||!e.data)throw new Error("Handlebars template compiled without data, use: Handlebars.compile(template, {data: true})");return e.data}function y(e){e.tag&&(e.tagName=e.tag,delete e.tag),e["class"]&&(e.className=e["class"],delete e["class"])}function x(e){E.push.apply(E,e),S=new RegExp("^(nested\\s+)?("+E.join("|")+")(?:\\s|$)")}function T(e,t){return function(n){var r=$(n.target).view({helper:!1});r&&r.cid===t&&(n.originalContext=this,e(n))}}function N(e,t){e+=t.originalName;var n=t.handler,r=_.isFunction(n)?n:this[n];if(!r)throw new Error('Event "'+n+'" does not exist '+(this.name||this.cid)+":"+e);return _.bind(function(){try{r.apply(this,arguments)}catch(t){i.onException("thorax-exception: "+(this.name||this.cid)+":"+e,t)}},t.context||this)}function C(e,t,n){var r={originalName:e,handler:_.isString(t)?this[t]:t};if(e.match(S)){var i=w.exec(e);r.nested=!!i[1],r.name=i[2],r.type="DOM",r.selector=i[3]}else r.name=e,r.type="view";return r.context=n,r}function O(e){while(e._helperName&&e._helperName!=="view")e=e.parent;return e}function M(e){var t=_.pick(e,"fn","inverse","hash","data");return t.data=_.omit(e.data,"cid","view","yield"),t}function D(e,t){function n(e,t){return _.every(e,function(e,n){return t[n]===e})}return e._helperName!==t._helperName?!1:(e=e._helperOptions,t=t._helperOptions,e.args.length===t.args.length&&n(e.args,t.args)&&_.isEqual(_.keys(e.options),_.keys(t.options))&&_.every(e.options,function(r,i){if(i==="data"||i==="hash")return n(e.options[i],t.options[i]);if(i==="fn"||i==="inverse"){if(t.options[i]===r)return!0;var s=t.options[i]||{};return r&&_.has(r,"program")&&!r.depth&&s.program===r.program}return t.options[i]===r}))}function P(e,t){function n(n,r){var i=this[e],s=f(this,t.$el);return n===i?this:(i&&this.unbindDataObject(i),n?(this[e]=n,t.loading&&t.loading.call(this),this.bindDataObject(e,n,_.extend({},this.options,r)),s&&s.attr(t.cidAttrName,n.cid),n.trigger("set",n,i)):(this[e]=!1,t.change&&t.change.call(this,!1),s&&s.removeAttr(t.cidAttrName)),this.trigger("change:data-object",e,n,i),this)}t=l[e]=_.defaults({name:"_"+e+"Events",event:!0},t),t.ctor=function(){if(this[e]){var n=this[e];this[e]=null,this[t.set](n)}},i.View.prototype[t.set]=n}function H(e,t,n){var r=this;p(n,"_"+e+"Events",!0,function(e){r.listenTo(t,e[0],_.bind(j(e[1],r),e[2]||r))})}function B(e,t){e.load?e.load(function(){t&&t.success&&t.success(e)},t):e.fetch(t)}function j(e,t){return _.isFunction(e)?e:t[e]}function I(e){var t=e&&this._objectOptionsByCid[e.cid];(!t||t&&t.render)&&this.render()}function J(e){var t=e&&this._objectOptionsByCid[e.cid];(!e||t&&t.render)&&this.renderCollection&&this.renderCollection()}function K(){this.ensureRendered()}function Q(){this.itemFilter&&this.collection.forEach(function(e){G.call(this,e)},this)}function G(e){var t=this.getCollectionElement();this.itemFilter&&t.find("["+F+'="'+e.cid+'"]')[Y.call(this,e)?"show":"hide"]()}function Y(e){return this.itemFilter(e,this.collection.indexOf(e))}function Z(){var e=this.getCollectionElement();this.emptyClass&&e.removeClass(this.emptyClass),e.removeAttr(W),e.empty()}function et(){var e=this.getCollectionElement();this.emptyClass&&e.addClass(this.emptyClass),e.attr(W,!0),this.appendEmpty()}function nt(e,t,n){var r=0,i=this;this.$("select,input,textarea",e.root||this.el).each(function(){if(!e.children&&i!==$(this).view({helper:!1}))return;this.type!=="button"&&this.type!=="cancel"&&this.type!=="submit"&&this.name&&this.name!==""&&(t.call(n||this,r,this),++r)})}function rt(e,t,n,r){var i,s=e,o=t.split("["),u=n.mode;for(var a=0;a<o.length-1;++a){i=o[a].replace("]","");if(!s[i]){if(u!=="serialize")return r.call(this,!1,i);s[i]={}}s=s[i]}i=o[o.length-1].replace("]",""),r.call(this,s,i)}function it(){this.$("form").removeAttr("data-submit-wait")}function ot(e,t){t=t||{},t.target=this,this.trigger(e,t),_.each(this.children,function(n){n.trigger(e,t)})}function ut(){++this._renderCount,this.$el.attr(st,this.cid)}function at(){if(!this.$("["+st+'="'+this.cid+'"]')[0])throw new Error("No layout element found in "+(this.name||this.cid))}function ft(){return this.$("["+st+'="'+this.cid+'"]')[0]||this.el[0]||this.el}function lt(){Backbone.history||(Backbone.history=new Backbone.History),Backbone.history.on("route",ct,this),this.on("destroyed",function(){Backbone.history.off("route",ct,this)})}function ct(e){this===e&&this.trigger.apply(this,["route"].concat(Array.prototype.slice.call(arguments,1)))}function pt(e){return function(){var t=_.toArray(arguments);t.unshift(e),this.parent.trigger.apply(this.parent,t)}}function vt(e){var t=O(this);if(!this[e]){var n=t[e];n&&(this[e]=n)}}function bt(e){var t=$(e.target),n=t.view({helper:!1}),r=t.attr(mt),i=t.attr(gt),s=!1;r&&(s=n[r].call(n,e)),i&&n.trigger(i,e),t.tagName==="A"&&s===!1&&e.preventDefault()}function Et(){St(),wt=i._fastClickEventName||"click",$(document).on(wt,yt,bt)}function St(){wt&&$(document).off(wt,yt,bt)}function kt(e,t){function i(){if(n===Backbone.history.getFragment())return;r=!0,o.cancel(),t&&t()}function s(){Backbone.history.off("route",i),r||e.apply(this,arguments)}var n=Backbone.history.getFragment(),r=!1;Backbone.history.on("route",i);var o=_.bind(s,this);return o.cancel=function(){Backbone.history.off("route",i)},o}function Lt(e,t,n){if(this.isPopulated())return e(this);arguments.length===2&&!_.isFunction(t)&&_.isObject(t)&&(n=t,t=!1);var r=this,i=!1,s=kt(_.bind(e,r),function(){i=!0,r._request&&(r._aborted=!0,r._request.abort()),t&&t.call(r,!1)});this.fetch(_.defaults({success:s,error:t&&function(){i||t.apply(r,[!0].concat(_.toArray(arguments)))},complete:function(){s.cancel()}},n))}function At(e,t){e.resetQueue&&(this.fetchQueue=undefined),this.fetchQueue?this.fetchQueue.push(e):(this.fetchQueue=[e],e=_.defaults({success:Ot(this,this.fetchQueue,"success"),error:Ot(this,this.fetchQueue,"error"),complete:Ot(this,this.fetchQueue,"complete")},e),t.call(this,e))}function Ot(e,t,n){return function(){var r=arguments;_.each(t,function(e){e[n]&&e[n].apply(this,r)},this),e.fetchQueue===t&&(e.fetchQueue=undefined)}}function _t(){this.render()}$.fn.forEach||($.fn.forEach=function(e,t){$.fn.each.call(this,function(n){e.call(t||this,this,n)})});var e="data-view-name",t="data-view-cid",n="data-view-helper",r={},i=this.Thorax={VERSION:"2.0.0rc1",templatePathPrefix:"",templates:{},Views:{},onException:function(e,t){throw t}};i.View=Backbone.View.extend({constructor:function(){var e=Backbone.View.apply(this,arguments);return _.each(l,function(t){t.ctor&&t.ctor.call(this,e)},this),e},_configure:function(e){var t=this;this._objectOptionsByCid={},this._boundDataObjectsByCid={},_.each(l,function(e){t[e.name]=[]}),r[this.cid]=this,this.children={},this._renderCount=0,_.extend(this,e||{}),s.call(this),_.each(l,function(e){e.configure&&e.configure.call(this)},this)},setElement:function(){var n=Backbone.View.prototype.setElement.apply(this,arguments);return this.name&&this.$el.attr(e,this.name),this.$el.attr(t,this.cid),n},_addChild:function(e){return this.children[e.cid]=e,e.parent||(e.parent=this),this.trigger("child",e),e},_removeChild:function(e){return delete this.children[e.cid],e.parent=null,e},destroy:function(e){e=_.defaults(e||{},{children:!0}),_.each(this._boundDataObjectsByCid,this.unbindDataObject,this),this.trigger("destroyed"),delete r[this.cid],_.each(this.children,function(t){this._removeChild(t),e.children&&t.destroy()},this),this.parent&&this.parent._removeChild(this),this.remove()},render:function(e){this._previousHelpers=_.filter(this.children,function(e){return e._helperOptions});var t={};return _.each(this.children,function(e,n){e._helperOptions||(t[n]=e)}),this.children=t,_.isUndefined(e)||!_.isElement(e)&&!i.Util.is$(e)&&(!e||!e.el)&&!_.isString(e)&&!_.isFunction(e)?(a.call(this,"template",{required:!0}),e=this.renderTemplate(this.template)):_.isFunction(e)&&(e=this.renderTemplate(e)),_.each(this._previousHelpers,function(e){e.destroy(),e.parent=undefined}),this._previousHelpers=undefined,this.html(e&&e.el||e&&e.string||e),++this._renderCount,this.trigger("rendered"),e},context:function(){return _.extend({},this.model&&this.model.attributes||{})},_getContext:function(){return _.extend({},this,f(this,"context")||{})},_getData:function(e){return{view:this,cid:_.uniqueId("t"),yield:function(){return e.fn&&e.fn(e)}}},_getHelpers:function(){return this.helpers?_.extend({},Handlebars.helpers,this.helpers):Handlebars.helpers},renderTemplate:function(e,t,n){var r;return t=t||this._getContext(),_.isFunction(e)?r=e:r=i.Util.getTemplate(e,n),r?r(t,{helpers:this._getHelpers(),data:this._getData(t)}):""},ensureRendered:function(){!this._renderCount&&this.render()},appendTo:function(e){this.ensureRendered(),$(e).append(this.el),this.trigger("ready",{target:this})},html:function(e){if(_.isUndefined(e))return this.el.innerHTML;this.trigger("before:append");var t=this._replaceHTML(e);return this.trigger("append"),t},_replaceHTML:function(e){return this.el.innerHTML="",this.$el.append(e)},_anchorClick:function(e){var t=$(e.currentTarget),n=t.attr("href");return n&&(n[0]==="#"||n[0]==="/"&&n[1]!=="/")?(Backbone.history.navigate(n,{trigger:!0}),!1):!0}}),i.View.extend=function(){c(this);var e=Backbone.View.extend.apply(this,arguments);return e.__parent__=this,h(e),e},o(i.View,i.Views),$.fn.view=function(e){e=_.defaults(e||{},{helper:!0});var i="["+t+"]";e.helper||(i+=":not(["+n+"])");var s=$(this).closest(i);return s&&r[s.attr(t)]||!1};var l={},g=["id","className","tagName"];i.Util={getViewInstance:function(e,t){t=t||{};if(_.isString(e)){var n=u(i,"Views",e,!1);return n.cid?_.extend(n,t||{}):new n(t)}return _.isFunction(e)?new e(t):e},getTemplate:function(e,t){var n=i.templatePathPrefix,r;n&&e.substr(0,n.length)!==n&&(e=n+e),e=e.replace(/\.handlebars$/,""),r=i.templates[e],r||(e+=".handlebars",r=i.templates[e]);if(!r&&!t)throw new Error("templates: "+e+" does not exist.");return r},is$:function(e){return _.isObject(e)&&"length"in e},expandToken:function(e,t){if(e&&e.indexOf&&e.indexOf("{{")>=0){var n=/(?:\{?[^{]+)|(?:\{\{([^}]+)\}\})/g,r,i=[];function s(e,t){if(e.match(/^("|')/)&&e.match(/("|')$/))return e.replace(/(^("|')|('|")$)/g,"");var n=e.split("."),r=n.length;for(var i=0;t&&i<r;i++)n[i]!=="this"&&(t=t[n[i]]);return t}while(r=n.exec(e))if(r[1]){var o=r[1].split(/\s+/);if(o.length>1){var u=o.shift();o=_.map(o,function(e){return s(e,t)}),Handlebars.helpers[u]?i.push(Handlebars.helpers[u].apply(t,o)):i.push(r[0])}else i.push(s(o[0],t))}else i.push(r[0]);e=i.join("")}return e},tag:function(e,t,n){var r=_.omit(e,"tagName"),s=e.tagName||"div";return"<"+s+" "+_.map(r,function(e,t){if(_.isUndefined(e)||t==="expand-tokens")return"";var r=e;return n&&(r=i.Util.expandToken(e,n)),(t==="className"?"class":t)+'="'+Handlebars.Utils.escapeExpression(r)+'"'}).join(" ")+">"+(_.isUndefined(t)?"":t)+"</"+s+">"}},i.Mixins={},l.mixins={name:"mixins",configure:function(){_.each(this.constructor.mixins,this.mixin,this),_.each(this.mixins,this.mixin,this)}},_.extend(i.View,{mixin:function(e){c(this),this.mixins.push(e)},registerMixin:function(e,t,n){i.Mixins[e]=[t,n]}}),i.View.prototype.mixin=function(e){this._appliedMixins||(this._appliedMixins=[]);if(this._appliedMixins.indexOf(e)===-1){this._appliedMixins.push(e);if(_.isFunction(e))e.call(this);else{var t=i.Mixins[e];_.extend(this,t[1]),_.isArray(t[0])?t[0][0].apply(this,t[0][1]):t[0].apply(this,_.toArray(arguments).slice(1))}}};var b=i.View.prototype.on;l.event={name:"_events",configure:function(){var e=this;p(this.constructor,"_events",!0,function(t){e.on.apply(e,t)}),p(this,"events",!1,function(t,n){e.on(n,t,e)})}},_.extend(i.View,{on:function(e,t){return c(this),d(this,e,t)?this:(_.isObject(e)?_.each(e,function(e,t){this.on(t,e)},this):_.isArray(t)?_.each(t,function(t){this._events.push([e,t])},this):this._events.push([e,t]),this)}}),_.extend(i.View.prototype,{on:function(e,t,n){return d(this,e,t,n)?this:(_.isObject(e)&&arguments.length<3?_.each(e,function(e,n){this.on(n,e,t||this)},this):_.each(_.isArray(t)?t:[t],function(t){var r=C.call(this,e,t,n||this);r.type==="DOM"?(this._eventsToDelegate||(this._eventsToDelegate=[]),this._eventsToDelegate.push(r)):this._addEvent(r)},this),this)},delegateEvents:function(e){this.undelegateEvents(),e&&(_.isFunction(e)&&(e=e.call(this)),this._eventsToDelegate=[],this.on(e)),this._eventsToDelegate&&_.each(this._eventsToDelegate,this._addEvent,this)},_addEvent:function(e){if(e.type==="view")_.each(e.name.split(/\s+/),function(t){b.call(this,t,N.call(this,"view-event:",e))},this);else{var t=N.call(this,"dom-event:",e);e.nested||(t=T(t,this.cid));if(e.selector){var n=e.name+".delegateEvents"+this.cid;this.$el.on(n,e.selector,t)}else this.$el.on(e.name,t)}}}),i.View.on("ready",function(e){if(!this._isReady){this._isReady=!0;function t(t){t.trigger("ready",e)}_.each(this.children,t),this.on("child",t)}});var w=/^(nested\s+)?(\S+)(?:\s+(.+))?/,E=[],S;x(["mousedown","mouseup","mousemove","mouseover","mouseout","touchstart","touchend","touchmove","click","dblclick","keyup","keydown","keypress","submit","change","focus","blur"]);var k="data-view-tmp",L={},A={_ensureElement:function(){i.View.prototype._ensureElement.apply(this,arguments),this.$el.attr(n,this._helperName)},_getContext:function(){return this.parent._getContext.apply(this.parent,arguments)}};i.HelperView=i.View.extend(A),Handlebars.registerViewHelper=function(e,t,n){arguments.length===2&&(t.factory?n=t.callback:(n=t,t=i.HelperView)),Handlebars.registerHelper(e,function(){var r=_.toArray(arguments),s=r.pop(),o=m(s).view,u={template:s.fn||Handlebars.VM.noop,inverse:s.inverse,options:s.hash,declaringView:o,parent:O(o),_helperName:e,_helperOptions:{options:M(s),args:_.clone(r)}};y(s.hash),_.extend(u,_.pick(s.hash,g));var a=_.find(o._previousHelpers,function(e){return D(u,e)});if(!a){if(t.factory){a=t.factory(r,u);if(!a)return"";a._helperName=u._helperName,a._helperOptions=u._helperOptions}else a=new t(u);r.push(a),o._addChild(a),o.trigger.apply(o,["helper",e].concat(r)),o.trigger.apply(o,["helper:"+e].concat(r)),n&&n.apply(this,r)}else o._previousHelpers=_.without(o._previousHelpers,a),o.children[a.cid]=a;var f=_.pick(s.hash,g);f[k]=a.cid;var l=s.hash["expand-tokens"];return new Handlebars.SafeString(i.Util.tag(f,"",l?this:null))});var r=Handlebars.helpers[e];return r},i.View.on("append",function(e,t){(e||this.$el).find("["+k+"]").forEach(function(e){var n=e.getAttribute(k),r=this.children[n];r&&(L[n]?(r.render(L[n]),delete L[n]):r.ensureRendered(),$(e).replaceWith(r.el),t&&t(r.el))},this)}),_.extend(i.View.prototype,{bindDataObject:function(e,t,n){if(this._boundDataObjectsByCid[t.cid])return!1;this._boundDataObjectsByCid[t.cid]=t;var n=this._modifyDataObjectOptions(t,_.extend({},l[e].defaultOptions,n));this._objectOptionsByCid[t.cid]=n,H.call(this,e,t,this.constructor),H.call(this,e,t,this);var r=l[e];return r.bindCallback&&r.bindCallback.call(this,t,n),t.shouldFetch&&t.shouldFetch(n)?B(t,n):l[e].change&&l[e].change.call(this,t,n),!0},unbindDataObject:function(e){return this._boundDataObjectsByCid[e.cid]?(delete this._boundDataObjectsByCid[e.cid],this.stopListening(e),delete this._objectOptionsByCid[e.cid],!0):!1},_modifyDataObjectOptions:function(e,t){return t}});var F="data-model-cid";i.Model=Backbone.Model.extend({isEmpty:function(){return!this.isPopulated()},isPopulated:function(){var e=_.clone(this.attributes),t=f(this,"defaults")||{};for(var n in t){if(e[n]!=t[n])return!0;delete e[n]}var r=_.keys(e);return r.length>1||r.length===1&&r[0]!==this.idAttribute},shouldFetch:function(e){var t;try{t=f(this,"url")}catch(n){t=!1}return e.fetch&&!!t&&!this.isPopulated()}}),i.Models={},o(i.Model,i.Models),P("model",{set:"setModel",defaultOptions:{render:!0,fetch:!0,success:!1,errors:!0},change:I,$el:"$el",cidAttrName:F}),i.View.on({model:{error:function(e,t){this._objectOptionsByCid[e.cid].errors&&this.trigger("error",t,e)},change:function(e){I.call(this,e)}}}),$.fn.model=function(e){var t=$(this),n=t.closest("["+F+"]"),r=n&&n.attr(F);if(r){var e=e||t.view();if(e&&e.model&&e.model.cid===r)return e.model||!1;var i=t.collection(e);if(i)return i.get(r)}return!1};var q=Backbone.Collection.prototype.fetch,R=Backbone.Collection.prototype.reset,U=i.View.prototype._replaceHTML,z="data-collection-cid",W="data-collection-empty",X="data-collection-element",V=1;i.Collection=Backbone.Collection.extend({model:i.Model||Backbone.Model,initialize:function(){return this.cid=_.uniqueId("collection"),Backbone.Collection.prototype.initialize.apply(this,arguments)},isEmpty:function(){return this.length>0?!1:this.length===0&&this.isPopulated()},isPopulated:function(){return this._fetched||this.length>0||!this.length&&!f(this,"url")},shouldFetch:function(e){return e.fetch&&!!f(this,"url")&&!this.isPopulated()},fetch:function(e){e=e||{};var t=e.success;return e.success=function(e,n){e._fetched=!0,t&&t(e,n)},q.apply(this,arguments)},reset:function(e,t){return this._fetched=!!e,R.call(this,e,t)}}),i.Collections={},o(i.Collection,i.Collections),P("collection",{set:"setCollection",bindCallback:K,defaultOptions:{render:!0,fetch:!0,success:!1,errors:!0},change:J,$el:"getCollectionElement",cidAttrName:z}),i.CollectionView=i.View.extend({_defaultTemplate:Handlebars.VM.noop,_collectionSelector:"["+X+"]",_replaceHTML:function(e){if(!(this.collection&&this._objectOptionsByCid[this.collection.cid]&&this._renderCount))return U.call(this,e);var t,n=this.getCollectionElement();t=U.call(this,e),n.attr("data-view-cid")||this.getCollectionElement().replaceWith(n)},appendItem:function(e,t,n){if(!e)return;var r,i=this.getCollectionElement();n=_.defaults(n||{},{filter:!0}),t&&t.el&&(t=i.children().indexOf(t.el)+1),e.el||_.isString(e)?(r=e,e=!1):(t=t||this.collection.indexOf(e)||0,r=this.renderItem(e,t));if(r){r.cid&&this._addChild(r),_.isString(r)&&!r.match(/^\s*</m)&&(r="<div>"+r+"</div>");var s=r.el?[r.el]:_.filter($($.trim(r)),function(e){return e.nodeType===V});e&&$(s).attr(F,e.cid);var o=t>0?this.collection.at(t-1):!1;if(!o)i.prepend(s);else{var u=i.children("["+F+'="'+o.cid+'"]').last();u.after(s)}this.trigger("append",null,function(t){t.setAttribute(F,e.cid)}),!n.silent&&this.trigger("rendered:item",this,this.collection,e,s,t),n.filter&&G.call(this,e)}return r},updateItem:function(e){this.removeItem(e),this.appendItem(e)},removeItem:function(e){var n=this.getCollectionElement(),r=n.find("["+F+'="'+e.cid+'"]');if(!r.length)return!1;r.remove();var i=r.attr(t),s=this.children[i];return s&&(this._removeChild(s),s.destroy()),!0},renderCollection:function(){this.collection?(this.collection.isEmpty()?et.call(this):(Z.call(this),this.collection.forEach(function(e,t){this.appendItem(e,t)},this)),this.trigger("rendered:collection",this,this.collection),Q.call(this)):et.call(this)},emptyClass:"empty",renderEmpty:function(){!this.emptyTemplate&&!this.emptyView&&a.call(this,"emptyTemplate",{extension:"-empty",required:!1});if(this.emptyView){var e={};this.emptyTemplate&&(e.template=this.emptyTemplate);var t=i.Util.getViewInstance(this.emptyView,e);return t.ensureRendered(),t}return this.emptyTemplate&&this.renderTemplate(this.emptyTemplate)},renderItem:function(e,t){!this.itemTemplate&&!this.itemView&&a.call(this,"itemTemplate",{extension:"-item",required:!this.itemView});if(this.itemView){var n={model:e};this.itemTemplate&&(n.template=this.itemTemplate);var r=i.Util.getViewInstance(this.itemView,n);return r.ensureRendered(),r}return this.renderTemplate(this.itemTemplate,this.itemContext(e,t))},itemContext:function(e){return e.attributes},appendEmpty:function(){var e=this.getCollectionElement();e.empty();var t=this.renderEmpty();t&&this.appendItem(t,0,{silent:!0,filter:!1}),this.trigger("rendered:empty",this,this.collection)},getCollectionElement:function(){var e=this.$(this._collectionSelector);return e.length===0?this.$el:e}}),i.CollectionView.on({collection:{reset:J,sort:J,filter:function(){Q.call(this)},change:function(e){!this.itemView&&this.updateItem(e),G.call(this,e)},add:function(e){var t=this.getCollectionElement();this.collection.length===1&&t.length&&Z.call(this);if(t.length){var n=this.collection.indexOf(e);this.appendItem(e,n)}},remove:function(e){var t=this.getCollectionElement();this.removeItem(e),this.collection.length===0&&t.length&&et.call(this)}}}),i.View.on({collection:{error:function(e,t){this._objectOptionsByCid[e.cid].errors&&this.trigger("error",t,e)}}}),$.fn.collection=function(e){if(e&&e.collection)return e.collection;var t=$(this),n=t.closest("["+z+"]"),r=n&&n.attr(z);if(r){e=t.view();if(e)return e.collection}return!1},l.model.defaultOptions.populate=!0;var tt=l.model.change;l.model.change=function(){tt.apply(this,arguments);var e=this.model&&this._objectOptionsByCid[this.model.cid];e&&e.populate&&this.populate(this.model.attributes,e.populate===!0?{}:e.populate)},l.model.defaultOptions.populate=!0,_.extend(i.View.prototype,{serialize:function(){var e,t,n;for(var r=0;r<arguments.length;++r)_.isFunction(arguments[r])?e=arguments[r]:_.isObject(arguments[r])&&("stopPropagation"in arguments[r]&&"preventDefault"in arguments[r]?n=arguments[r]:t=arguments[r]);if(n&&!this._preventDuplicateSubmission(n))return;t=_.extend({set:!0,validate:!0,children:!0,silent:!0},t||{});var i=t.attributes||{},s=this,o=[];nt.call(this,t,function(){var e=s._getInputValue(this,t,o);_.isUndefined(e)||rt.call(this,i,this.name,{mode:"serialize"},function(t,n){t[n]?_.isArray(t[n])?t[n].push(e):t[n]=[t[n],e]:t[n]=e})}),this.trigger("serialize",i,t);if(t.validate){var u=this.validateInput(i);u&&u.length&&(o=o.concat(u)),this.trigger("validate",i,o,t);if(o.length){this.trigger("error",o);return}}return t.set&&this.model&&!this.model.set(i,{silent:t.silent})?!1:(e&&e.call(this,i,_.bind(it,this)),i)},_preventDuplicateSubmission:function(e,t){e.preventDefault();var n=$(e.target);return(e.target.tagName||"").toLowerCase()!=="form"&&(n=$(e.target).closest("form")),n.attr("data-submit-wait")?!1:(n.attr("data-submit-wait","true"),t&&t.call(this,e),!0)},populate:function(e,t){t=_.extend({children:!0},t||{});var n,e=e||this._getContext();nt.call(this,t,function(){rt.call(this,e,this.name,{mode:"populate"},function(e,t){n=e&&e[t],_.isUndefined(n)||(this.type==="checkbox"&&_.isBoolean(n)?this.checked=n:this.type==="checkbox"||this.type==="radio"?this.checked=n==this.value:this.value=n)})}),this.trigger("populate",e)},validateInput:function(){},_getInputValue:function(e){if(e.type!=="checkbox"&&e.type!=="radio"){if(e.multiple===!0){var t=[];return $("option",e).each(function(){this.selected&&t.push(this.value)}),t}return e.value}if(e.checked)return e.value}}),i.View.on({error:function(){it.call(this),this.model&&this.model.previousAttributes&&this.model.set(this.model.previousAttributes(),{silent:!0})},deactivated:function(){it.call(this)}});var st="data-layout-cid";i.LayoutView=i.View.extend({_defaultTemplate:Handlebars.VM.noop,render:function(){var e=i.View.prototype.render.apply(this,arguments);return this.template===Handlebars.VM.noop?ut.call(this):at.call(this),e},setView:function(e,t){t=_.extend({scroll:!0,destroy:!0},t||{}),_.isString(e)&&(e=new(i.Util.registryGet(i,"Views",e,!1))),this.ensureRendered();var n=this._view;return e===n?!1:(t.destroy&&e&&(e._shouldDestroyOnNextSetView=!0),this.trigger("change:view:start",e,n,t),n&&(this._removeChild(n),n.$el.remove(),ot.call(n,"deactivated",t),n._shouldDestroyOnNextSetView&&n.destroy()),e?(ot.call(this,"activated",t),e.trigger("activated",t),this._addChild(e),this._view=e,this._view.appendTo(ft.call(this))):this._view=undefined,this.trigger("change:view:end",e,n,t),e)},getView:function(){return this._view}}),Handlebars.registerHelper("layout-element",function(e){var t=m(e).view;if(!t.getView)throw new Error("layout-element must be used within a LayoutView");return e.hash[st]=t.cid,y(e.hash),new Handlebars.SafeString(i.Util.tag.call(this,e.hash,"",this))}),i.Router=Backbone.Router.extend({constructor:function(){var e=i.Router.__super__.constructor.apply(this,arguments);return lt.call(this),e},route:function(e,t,n){return n||(n=this[t]),Backbone.Router.prototype.route.call(this,e,t,function(){return this.trigger.apply(this,["route:before",e,t].concat(Array.prototype.slice.call(arguments))),n.apply(this,arguments)})}}),i.Routers={},o(i.Router,i.Routers),i.CollectionHelperView=i.CollectionView.extend({events:{"rendered:item":pt("rendered:item"),"rendered:collection":pt("rendered:collection"),"rendered:empty":pt("rendered:empty")},constructor:function(e){_.each(ht,function(t,n){if(e.options[n]){var r=e.options[n];if(t==="itemTemplate"||t==="emptyTemplate")r=i.Util.getTemplate(r);e[t]=r}}),!e.itemTemplate&&e.template&&e.template!==Handlebars.VM.noop&&(e.itemTemplate=e.template,e.template=Handlebars.VM.noop),!e.emptyTemplate&&e.inverse&&e.inverse!==Handlebars.VM.noop&&(e.emptyTemplate=e.inverse,e.inverse=Handlebars.VM.noop);var t=i.HelperView.call(this,e);return this.parent.name&&(this.emptyTemplate||(this.emptyTemplate=i.Util.getTemplate(this.parent.name+"-empty",!0)),this.itemTemplate||(this.itemTemplate=i.Util.getTemplate(this.parent.name+"-item",!!this.itemView))),t},setAsPrimaryCollectionHelper:function(){_.each(dt,function(e){vt.call(this,e)},this),this.parent.itemFilter&&!this.itemFilter&&(this.itemFilter=function(){return this.parent.itemFilter.apply(this.parent,arguments)}),this.parent.itemContext&&(this.itemContext=function(){return this.parent.itemContext.apply(this.parent,arguments)})}}),_.extend(i.CollectionHelperView.prototype,A);var ht={"item-template":"itemTemplate","empty-template":"emptyTemplate","item-view":"itemView","empty-view":"emptyView","empty-class":"emptyClass"},dt=["itemTemplate","itemView","emptyTemplate","emptyView"];Handlebars.registerViewHelper("collection",i.CollectionHelperView,function(e,t){arguments.length===1&&(t=e,e=t.parent.collection,e&&t.setAsPrimaryCollectionHelper(),t.$el.attr(X,"true"),t.listenTo(t.parent,"change:data-object",function(e,n){e==="collection"&&(t.setAsPrimaryCollectionHelper(),t.setCollection(n))})),e&&t.setCollection(e)}),Handlebars.registerHelper("collection-element",function(e){if(!m(e).view.renderCollection)throw new Error("collection-element helper must be declared inside of a CollectionView");var t=e.hash;return y(t),t.tagName=t.tagName||"div",t[X]=!0,new Handlebars.SafeString(i.Util.tag.call(this,t,"",this))}),Handlebars.registerHelper("empty",function(e,t){arguments.length===1&&(t=e);var n=m(t).view;return arguments.length===1&&(e=n.model),n._emptyListeners||(n._emptyListeners={}),e&&!n._emptyListeners[e.cid]&&e.models&&"length"in e&&(n._emptyListeners[e.cid]=!0,n.listenTo(e,"remove",function(){e.length===0&&n.render()}),n.listenTo(e,"add",function(){e.length===1&&n.render()}),n.listenTo(e,"reset",function(){n.render()})),!e||e.isEmpty()?t.fn(this):t.inverse(this)}),Handlebars.registerHelper("template",function(e,t){var n=_.extend({fn:t&&t.fn},this,t?t.hash:{}),r=m(t).view.renderTemplate(e,n);return new Handlebars.SafeString(r)}),Handlebars.registerHelper("yield",function(e){return m(e).yield&&e.data.yield()}),Handlebars.registerHelper("url",function(e){var t;if(arguments.length>2)t=_.map(_.head(arguments,arguments.length-1),encodeURIComponent).join("/");else{var n=arguments[1],r=n&&n.hash||n;r&&r["expand-tokens"]?t=i.Util.expandToken(e,this):t=e}return(Backbone.history._hasPushState?Backbone.history.options.root:"#")+t}),Handlebars.registerViewHelper("view",{factory:function(e,t){var n=e.length>=1?e[0]:i.View;return i.Util.getViewInstance(n,t.options)},callback:function(){var e=arguments[arguments.length-1],t=e._helperOptions.options,n=e.cid;t.fn&&(L[n]=t.fn)}});var mt="data-call-method",gt="data-trigger-event";Handlebars.registerHelper("button",function(e,t){arguments.length===1&&(t=e,e=t.hash.method);var n=t.hash,r=n["expand-tokens"];delete n["expand-tokens"];if(!e&&!t.hash.trigger)throw new Error("button helper must have a method name as the first argument or a 'trigger', or a 'method' attribute specified.");return y(n),n.tagName=n.tagName||"button",n.trigger&&(n[gt]=n.trigger),delete n.trigger,e&&(n[mt]=e),new Handlebars.SafeString(i.Util.tag(n,t.fn?t.fn(this):"",r?this:null))}),Handlebars.registerHelper("link",function(){var e=_.toArray(arguments),t=e.pop(),n=t.hash,r=e.length===0?[n.href]:e,s=n["expand-tokens"];delete n["expand-tokens"];if(!r[0]&&r[0]!=="")throw new Error("link helper requires an href as the first argument or an 'href' attribute");return y(n),r.push(t),n.href=Handlebars.helpers.url.apply(this,r),n.tagName=n.tagName||"a",n.trigger&&(n[gt]=t.hash.trigger),delete n.trigger,n[mt]="_anchorClick",new Handlebars.SafeString(i.Util.tag(n,t.fn?t.fn(this):"",s?this:null))});var yt="["+mt+"], ["+gt+"]",wt;$(document).ready(function(){i._fastClickEventName||Et()});var xt="data-element-tmp";Handlebars.registerHelper("element",function(e,t){y(t.hash);var n=_.uniqueId("element"),r=m(t).view,s=_.pick(t.hash,g);return s[xt]=n,r._elementsByCid||(r._elementsByCid={}),r._elementsByCid[n]=e,new Handlebars.SafeString(i.Util.tag(s))}),i.View.on("append",function(e,t){(e||this.$el).find("["+xt+"]").forEach(function(e){var n=$(e),r=n.attr(xt),i=this._elementsByCid[r];_.isFunction(i)&&(i=i.call(this)),n.replaceWith(i),t&&t(i)},this)}),Handlebars.registerHelper("super",function(e){var t=m(e).view,n=t.constructor&&t.constructor.__super__;if(n){var r=n.template;if(!r){if(!n.name)throw new Error("Cannot use super helper when parent has no name or template.");r=n.name}return _.isString(r)&&(r=i.Util.getTemplate(r,!1)),new Handlebars.SafeString(r(this,e))}return""});var Tt="load:start",Nt="load:end",Ct;i.setRootObject=function(e){Ct=e},i.loadHandler=function(e,t,n){var r=_.uniqueId();return function(s,o,u){function l(){if(f.timeout&&!f.run)return;var t=a._loadingTimeoutDuration!==undefined?a._loadingTimeoutDuration:i.View.prototype._loadingTimeoutDuration;f.timeout=setTimeout(function(){try{f.run=!0,e.call(a,f.message,f.background,f)}catch(t){i.onException("loadStart",t)}},t*1e3)}var a=n||this;a._loadInfo=a._loadInfo||[];var f=a._loadInfo[r];f?(clearTimeout(f.endTimeout),f.message=s,!o&&f.background&&(f.background=!1,l())):(f=a._loadInfo[r]=_.extend({events:[],timeout:0,message:s,background:!!o},Backbone.Events),l());if(f.events.indexOf(u)>=0){f.events.push(u);return}f.events.push(u),u.on(Nt,function c(){var e=a._loadingTimeoutEndDuration;e===void 0&&(e=i.View.prototype._loadingTimeoutEndDuration);var n=f.events,s=n.indexOf(u);s>=0&&(n.splice(s,1),n.indexOf(u)<0&&u.off(Nt,c)),n.length||(clearTimeout(f.endTimeout),f.endTimeout=setTimeout(function(){try{if(!n.length){var e=f.run;e&&(t.call(a,f.background,f),f.trigger(Nt,f)),clearTimeout(f.timeout),f=a._loadInfo[r]=undefined}}catch(s){i.onException("loadEnd",s)}},e*1e3))})}},i.forwardLoadEvents=function(e,t,n){function r(i,s,o){n&&e.off(Tt,r),t.trigger(Tt,i,s,o)}return e.on(Tt,r),{off:function(){e.off(Tt,r)}}},i.mixinLoadable=function(e,t){_.extend(e,{_loadingClassName:"loading",_loadingTimeoutDuration:.33,_loadingTimeoutEndDuration:.1,onLoadStart:function(e,n,r){var i=t?this.parent:this;if(!i||!i.el)return;!i.nonBlockingLoad&&!n&&Ct&&Ct!==this&&Ct.trigger(Tt,e,n,r),i._isLoading=!0,$(i.el).addClass(i._loadingClassName),i.trigger("change:load-state","start")},onLoadEnd:function(){var e=t?this.parent:this;if(!e||!e.el)return;e._isLoading=!1,$(e.el).removeClass(e._loadingClassName),e.trigger("change:load-state","end")}})},i.mixinLoadableEvents=function(e,t){_.extend(e,{loadStart:function(e,n){var r=t?this.parent:this;r.trigger(Tt,e,n,r)},loadEnd:function(){var e=t?this.parent:this;e.trigger(Nt,e)}})},i.mixinLoadable(i.View.prototype),i.mixinLoadableEvents(i.View.prototype),i.HelperView&&(i.mixinLoadable(i.HelperView.prototype,!0),i.mixinLoadableEvents(i.HelperView.prototype,!0)),i.CollectionHelperView&&(i.mixinLoadable(i.CollectionHelperView.prototype,!0),i.mixinLoadableEvents(i.CollectionHelperView.prototype,!0)),i.sync=function(e,t,n){var r=this,i=n.complete;return n.complete=function(){r._request=undefined,r._aborted=!1,i&&i.apply(this,arguments)},this._request=Backbone.sync.apply(this,arguments),this._request};var Mt=[];i.Model&&Mt.push(i.Model),i.Collection&&Mt.push(i.Collection),_.each(Mt,function(e){var t=e.prototype.fetch;i.mixinLoadableEvents(e.prototype,!1),_.extend(e.prototype,{sync:i.sync,fetch:function(e){e=e||{};var n=this,r=e.complete;return e.complete=function(){r&&r.apply(this,arguments),n.loadEnd()},n.loadStart(undefined,e.background),At.call(this,e||{},t)},load:function(e,t,n){arguments.length===2&&!_.isFunction(t)&&(n=t,t=!1),n=n||{},!n.background&&!this.isPopulated()&&Ct&&i.forwardLoadEvents(this,Ct,!0),Lt.call(this,e,t,n)}})}),i.Util.bindToRoute=kt,i.Router&&(i.Router.bindToRoute=i.Router.prototype.bindToRoute=kt),i.View.prototype._modifyDataObjectOptions=function(e,t){return t.ignoreErrors=this.ignoreFetchError,t.background=this.nonBlockingLoad,t},i.HelperView.prototype._modifyDataObjectOptions=i.CollectionHelperView.prototype._modifyDataObjectOptions=function(e,t){return t.ignoreErrors=this.parent.ignoreFetchError,t.background=this.parent.nonBlockingLoad,t},l.collection.loading=function(){var e=this.loadingView,t=this.loadingTemplate,n=this.loadingPlacement;if(e||t){var r=i.loadHandler(_.bind(function(){var r;this.collection.length===0&&this.$el.empty();if(e){var s=i.Util.getViewInstance(e);this._addChild(s),t?s.render(t):s.render(),r=s}else r=this.renderTemplate(t);var o=n?n.call(this):this.collection.length;this.appendItem(r,o),this.$el.children().eq(o).attr("data-loading-element",this.collection.cid)},this),_.bind(function(){this.$el.find('[data-loading-element="'+this.collection.cid+'"]').remove()},this),this.collection);this.listenTo(this.collection,"load:start",r)}},ht&&(ht["loading-template"]="loadingTemplate",ht["loading-view"]="loadingView",ht["loading-placement"]="loadingPlacement"),i.View.on({"load:start":i.loadHandler(function(e,t,n){this.onLoadStart(e,t,n)},function(e,t){this.onLoadEnd(t)}),collection:{"load:start":function(e,t,n){this.trigger(Tt,e,t,n)}},model:{"load:start":function(e,t,n){this.trigger(Tt,e,t,n)}}}),Handlebars.registerHelper("loading",function(e){var t=m(e).view;return t.off("change:load-state",_t,t),t.on("change:load-state",_t,t),t._isLoading?e.fn(this):e.inverse(this)});var Dt=/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());Dt&&(i.View.on("before:append",function(){this._renderCount>0&&(_.each(this._elementsByCid,function(e){$(e).detach()}),_.each(this.children,function(e){e.$el.detach()}))}),i.CollectionView.prototype._replaceHTML=function(e){if(!(this.collection&&this._objectOptionsByCid[this.collection.cid]&&this._renderCount))return U.call(this,e);var t,n=this.getCollectionElement().clone(!0,!0);t=U.call(this,e),n.attr("data-view-cid")||this.getCollectionElement().replaceWith(n)})}() |
src/routes.js | Sekhmet/busy | import React from 'react';
import { Route, IndexRoute } from 'react-router';
import Wrapper from './wrapper';
import Settings from './app/AppSettings';
import Page from './feed/Page';
import User from './user/User';
import Profile from './user/UserProfile';
import Followers from './user/UserFollowers';
import Following from './user/UserFollowing';
import Posts from './user/UserPosts';
import Reblogs from './user/UserReblogs';
import Replies from './user/UserReplies';
import Feed from './user/UserFeed';
import Transfers from './user/UserTransfers';
import Transfer from './wallet/Transfer';
import Tags from './tags/Tags';
import Donors from './statics/Donors';
import { Trending, Hot, Votes, Responses, Active, Created, Cashout } from './feed/PathMatching';
import PostSingle from './post/postSingle/PostSingle';
import Bookmarks from './bookmarks/Bookmarks';
import Error404 from './statics/Error404';
import Write from './post/Write/Write';
import Drafts from './post/Write/Drafts';
import About from './statics/About';
import Help from './statics/Help';
import Team from './statics/Team';
import RequireLogin from './auth/RequireLogin';
var MessagesUser = require('./messages/MessagesUser').default,
MessagesCategory = require('./messages/MessagesCategory').default;
export default (
<Route path="/" component={Wrapper}>
<IndexRoute component={Page} />
<Route path="/help" component={Help} />
<Route path="/about" component={About} />
<Route path="/team" component={Team} />
<Route path="/tags" component={Tags} />
<Route path="/donors" component={Donors} />
<Route path="/trending(/:category)" component={Trending} />
<Route path="/hot(/:category)" component={Hot} />
<Route path="/cashout(/:category)" component={Cashout} />
<Route path="/created(/:category)" component={Created} />
<Route path="/active(/:category)" component={Active} />
<Route path="/responses(/:category)" component={Responses} />
<Route path="/votes(/:category)" component={Votes} />
<Route component={RequireLogin}>
<Route path="/transfer" component={Transfer} />
<Route path="/messages/@:username" component={MessagesUser} />
<Route path="/messages/:category" component={MessagesCategory} />
<Route path="/bookmarks" component={Bookmarks} />
<Route path="/write" component={Write} />
<Route path="/drafts" component={Drafts} />
<Route path="/settings" component={Settings} />
</Route>
<Route component={User}>
<Route path="/@:name/reblogs" component={Reblogs} />
<Route path="/@:name/posts" component={Posts} />
<Route path="/@:name/feed" component={Feed} />
<Route path="/@:name/replies" component={Replies} />
<Route path="/@:name/followers" component={Followers} />
<Route path="/@:name/followed" component={Following} />
<Route path="/@:name/transfers" component={Transfers} />
<Route path="/@:name" component={Profile} />
</Route>
<Route path="/:category/@:author/:permlink" component={PostSingle} />
<Route path="/*" component={Error404} />
</Route>
);
|
pnpm-offline/.pnpm-store-offline/1/registry.npmjs.org/react-router/4.1.1/es/Prompt.js | Akkuma/npm-cache-benchmark | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
import React from 'react';
import PropTypes from 'prop-types';
/**
* The public API for prompting the user before navigating away
* from a screen with a component.
*/
var Prompt = function (_React$Component) {
_inherits(Prompt, _React$Component);
function Prompt() {
_classCallCheck(this, Prompt);
return _possibleConstructorReturn(this, _React$Component.apply(this, arguments));
}
Prompt.prototype.enable = function enable(message) {
if (this.unblock) this.unblock();
this.unblock = this.context.router.history.block(message);
};
Prompt.prototype.disable = function disable() {
if (this.unblock) {
this.unblock();
this.unblock = null;
}
};
Prompt.prototype.componentWillMount = function componentWillMount() {
if (this.props.when) this.enable(this.props.message);
};
Prompt.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
if (nextProps.when) {
if (!this.props.when || this.props.message !== nextProps.message) this.enable(nextProps.message);
} else {
this.disable();
}
};
Prompt.prototype.componentWillUnmount = function componentWillUnmount() {
this.disable();
};
Prompt.prototype.render = function render() {
return null;
};
return Prompt;
}(React.Component);
Prompt.propTypes = {
when: PropTypes.bool,
message: PropTypes.oneOfType([PropTypes.func, PropTypes.string]).isRequired
};
Prompt.defaultProps = {
when: true
};
Prompt.contextTypes = {
router: PropTypes.shape({
history: PropTypes.shape({
block: PropTypes.func.isRequired
}).isRequired
}).isRequired
};
export default Prompt; |
Subsets and Splits