From 908df4a9522c3315f3025cff548f19f9033b69ae Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 25 Sep 2016 22:30:29 +0200 Subject: [PATCH] remove css and js bundles from git --- app/browser/css/style.css | 1 - app/browser/js/browser-headless.bundle.js | 12219 -------------------- 2 files changed, 12220 deletions(-) delete mode 100644 app/browser/css/style.css delete mode 100644 app/browser/js/browser-headless.bundle.js diff --git a/app/browser/css/style.css b/app/browser/css/style.css deleted file mode 100644 index 53fb83c1..00000000 --- a/app/browser/css/style.css +++ /dev/null @@ -1 +0,0 @@ -:root{--color-text:rgba(255,255,255,0.8);--color-text-fade:rgba(255,255,255,0.5);--color-bg:#202329;--color-fg:#2d313a;--color-raised:#363b45;--color-faded:#292d34;--color-track:#1c1f25;--color-accent:#528bff;--color-custom:var(--color-accent);--nav-height:40rem;--sidepanel-size:300rem;--pixel-scale:1}*{margin:0;padding:0;border:0;box-sizing:border-box;text-decoration:none;outline:0;font:inherit;color:inherit;cursor:inherit;-webkit-tap-highlight-color:transparent;-webkit-user-select:none}::-webkit-scrollbar{width:20rem;height:20rem;opacity:1}::-webkit-scrollbar-track-piece{background:var(--color-bg)}::-webkit-scrollbar-track-piece:vertical{border-left:2rem solid var(--color-bg)}::-webkit-scrollbar-track-piece:horizontal{border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-corner{background:var(--color-fg);border-left:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-thumb{background:var(--color-raised)}::-webkit-scrollbar-thumb:vertical{border-left:2rem solid var(--color-bg)}::-webkit-scrollbar-thumb:horizontal{border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start,::-webkit-scrollbar-button:increment:end{background:var(--color-fg);height:20rem;width:20rem;display:block}::-webkit-scrollbar-button:decrement:start:vertical:decrement:start,::-webkit-scrollbar-button:increment:end:vertical:decrement:start{border-left:2rem solid var(--color-bg);border-bottom:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start:vertical:increment:end,::-webkit-scrollbar-button:increment:end:vertical:increment:end{border-left:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start:horizontal:decrement:start,::-webkit-scrollbar-button:increment:end:horizontal:decrement:start{border-right:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}::-webkit-scrollbar-button:decrement:start:horizontal:increment:end,::-webkit-scrollbar-button:increment:end:horizontal:increment:end{border-left:2rem solid var(--color-bg);border-top:2rem solid var(--color-bg)}body{background:var(--color-bg)}#container{position:absolute;top:0;left:0;bottom:0;right:0;display:flex;flex-direction:column;background:var(--color-bg);padding:2rem}#container.sidepanel-open{right:var(--sidepanel-size)}.content{height:100%;overflow:hidden;position:relative;background:var(--color-fg);padding:2rem}.tab{position:absolute;overflow:auto;left:0;right:0;top:0;bottom:0;background:var(--color-bg);transform:rotateZ(0)}.tab.has-tabs{display:flex;flex-direction:column}.tab.has-tabs>.navigation{background:var(--color-bg)}.tab.has-tabs>.content{background:none}.navigation{height:var(--nav-height);margin-bottom:2rem;flex-shrink:0;font-weight:bold;text-transform:uppercase}.navigation.main li:last-child{width:var(--nav-height);max-width:var(--nav-height);min-width:var(--nav-height)}.navigation.main li:last-child i{margin:0 auto}.navigation ul{list-style:none;display:flex;overflow:hidden;height:100%}.navigation ul li{display:block;min-width:0;flex:1;cursor:pointer;height:100%;margin-right:1rem}.navigation ul li:last-child{margin-right:0}.navigation ul li a{background:var(--color-fg);pointer-events:none;padding:5rem;height:100%;display:flex;align-items:center;overflow:hidden;text-align:center;position:relative}.navigation ul li a span{display:block;width:100%;-webkit-mask:linear-gradient(to left, transparent, #000 10rem) no-repeat}.navigation ul li a:after{content:"";background:var(--color-accent);position:absolute;bottom:0;left:0;right:0;height:1rem;opacity:0;transition:all .2s;transform:scale(0)}.navigation ul li.on a,.navigation ul li .sidepanel-open{position:relative;background:var(--color-raised)}.navigation ul li.on a:after,.navigation ul li .sidepanel-open:after{opacity:1;transform:scale(1)}.navigation ul .parent+li a{padding-left:calc(5rem + 0.5 * var(--nav-height))}.form .input-wrapper{display:flex;margin-bottom:4rem;background:var(--color-bg);align-items:center}.form .input-wrapper:last-child{margin-bottom:0}.form .input-wrapper label{background:var(--color-fg);flex-shrink:0;padding:5rem;border:1rem solid var(--color-bg)}.form .input-wrapper .input,.form .input-wrapper input{background:var(--color-bg);width:100%;padding:5rem}.form .input-wrapper.column{flex-direction:column}.form .input-wrapper.column label{width:100%;padding:7rem;margin-bottom:0}.form label{display:block;font-size:10rem;background:var(--color-faded)}.form .info{color:var(--color-text-fade);margin-bottom:10rem}.form input,.form .input{display:block;border:0;font:inherit;color:var(--color-text);width:100%}.form input:focus,.form .input:focus{border-color:var(--color-accent)}.form input .btn,.form .input .btn{background:var(--color-raised);box-shadow:0 0 0 1rem var(--color-bg)}.form .checkbox{background:var(--color-raised);cursor:pointer}.form .select-wrapper{position:relative;width:100%}.form .select-wrapper:after{content:"\f107";font-family:FontAwesome;position:absolute;padding:5rem;right:0;top:0;font-size:20rem}.form select{-webkit-appearance:none}.form .submit{margin-top:30rem}.form .separator{line-height:30rem;height:30rem;margin-bottom:5rem;position:relative;display:flex;align-items:center}.form .separator:before,.form .separator:after{content:"";top:14rem;width:100%;height:1rem;background:var(--color-text-fade)}.form .separator span{font-variant:small-caps;position:relative;display:block;width:100%;text-align:center}.widget.editing{z-index:11 !important;overflow:visible}.widget.editing:after,li.editing a:before,a.editing:before,.content.editing:before,#container.editing:before{content:"";z-index:999;position:absolute;top:0;left:0;right:0;bottom:0;border:1rem dashed var(--color-accent);pointer-events:none}.context-menu{position:fixed;z-index:999999999;background:var(--color-raised);box-shadow:0 0 4rem 0;color:var(--color-track)}.context-menu .item{color:var(--color-text)}.context-menu .context-menu{position:absolute;left:100%;top:0;opacity:0;pointer-events:none;margin-left:2rem}.context-menu .context-menu:before{content:"";position:absolute;top:0;bottom:0;left:-2rem;width:2rem}.context-menu>.item{padding:10rem 15rem 10rem 10rem;position:relative;cursor:pointer}.context-menu>.item i{margin-right:5rem;width:15rem;text-align:center}.context-menu>.item:hover,.context-menu>.item:focus{background:var(--color-accent)}.context-menu>.item:hover>.context-menu,.context-menu>.item:focus>.context-menu{pointer-events:auto;opacity:1}.context-menu>.item.has-sub:before{content:"\f105";display:block;font-family:FontAwesome;float:right;margin-right:-10rem;padding-left:10rem}.ui-resizable-handle{position:absolute;z-index:1000000;display:flex;justify-content:center;align-items:center;background:var(--color-accent);width:20rem;height:20rem;border-radius:100%;box-shadow:0 0 4rem 0 var(--color-bg)}.ui-resizable-handle:after{content:"";position:absolute;top:-5rem;right:-5rem;left:-5rem;bottom:-5rem}.ui-resizable-handle.ui-resizable-se{content:"";bottom:5rem;right:5rem;cursor:se-resize}.ui-resizable-handle.ui-resizable-se:before{content:"\f065";font-family:FontAwesome;transform:rotate(90deg)}.ui-resizable-handle.ui-resizable-e{top:50%;margin-top:-10rem;right:5rem;cursor:e-resize}.ui-resizable-handle.ui-resizable-e:before{content:"\f051";font-family:FontAwesome}.ui-resizable-handle.ui-resizable-s{bottom:5rem;left:50%;margin-left:-10rem;cursor:s-resize}.ui-resizable-handle.ui-resizable-s:before{content:"\f051";font-family:FontAwesome;transform:rotate(90deg)}.ui-helper{border:1rem dashed var(--color-accent);min-width:30rem !important;min-height:30rem !important;z-index:12 !important;opacity:1 !important}.ui-helper:after{content:"";display:block;width:100%;height:100%;background:var(--color-accent);opacity:.25}.ui-draggable-handle:not(.label){position:absolute;top:5rem;left:5rem;z-index:100000;height:20rem;width:20rem;display:flex;justify-content:center;align-items:center;border-radius:100%;background:var(--color-accent);box-shadow:0 0 4rem 0 var(--color-bg)}.ui-draggable-handle:not(.label):before{content:"\f0b2";font-family:FontAwesome;transform:rotate(45deg)}.ui-draggable-handle{cursor:-webkit-grab}.ui-draggable-handle:active{cursor:-webkit-grabbing}#sidepanel{position:absolute;z-index:999999;width:var(--sidepanel-size);border:8rem solid var(--color-fg);top:0;right:0;bottom:0;margin-right:calc(-1 * var(--sidepanel-size));background:var(--color-fg);transition:transform .25s, opacity .25s;transform:translate3d(0, 0, 0);opacity:0;overflow-y:auto;overflow-x:visible}#sidepanel.sidepanel-open{transform:translate3d(calc(-1 * var(--sidepanel-size)), 0, 0);opacity:1}#sidepanel #options{position:absolute;left:0;top:0;right:0;bottom:0;list-style:none}#sidepanel #options li{display:block;margin-bottom:8rem;position:relative}#sidepanel #options li:last-child{margin:0}#sidepanel #options li .btn+span{position:absolute;right:0rem;top:0rem;padding:8rem;color:var(--color-text-fade)}#sidepanel #options li .btn+span:hover{color:var(--color-text)}#sidepanel #options li ul{padding:4rem}#sidepanel #options li ul li{margin-bottom:4rem}#sidepanel #options .editor .form{margin-top:10rem}#sidepanel #options .help{margin-top:10rem;font-size:.75em;text-align:center;font-style:italic}#sidepanel::-webkit-scrollbar-track-piece{background:var(--color-bg)}#sidepanel::-webkit-scrollbar-track-piece:vertical{border-left:8rem solid var(--color-fg)}#sidepanel::-webkit-scrollbar-thumb{background:var(--color-raised)}#sidepanel::-webkit-scrollbar-thumb:vertical{border-left:8rem solid var(--color-fg)}.actions{padding:1rem;background:var(--color-bg);display:flex;align-items:stretch;flex-wrap:wrap}.actions .title{background:var(--color-faded);min-width:100%;flex-grow:2;padding:10rem;position:relative}.actions .title:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:0 0 0 1rem;color:var(--color-bg)}.actions a{min-width:33%;flex-grow:4;padding:10rem;display:block;text-align:center;position:relative;color:var(--color-text);overflow:visible}.actions a.on{pointer-events:none}.actions a.on:after{opacity:1;transform:scale(1)}.actions a:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;box-shadow:0 0 0 1rem;color:var(--color-bg)}.actions a:after{content:"";background:var(--color-accent);position:absolute;top:0;left:0;right:0;height:1rem;opacity:0;transition:all .2s;transform:scale(0)}.widget{display:inline-block;height:auto;overflow:hidden;position:relative;vertical-align:top;box-shadow:-0.5rem -0.5rem 0 0.5rem;color:var(--color-bg);border-right:1rem solid var(--color-bg);border-bottom:1rem solid var(--color-bg);background:var(--color-fg);-webkit-tap-highlight-color:transparent;min-height:30rem;min-width:30rem;display:inline-flex;flex-direction:column}.widget>*{color:var(--color-text)}.widget.absolute-position{position:absolute}.widget.nolabel>.label{display:none}.widget .label{padding:10rem 10rem;text-overflow:ellipsis;overflow:hidden;text-align:center;height:35rem;max-height:35rem;width:100%;background:var(--color-raised);border-bottom:1rem solid var(--color-bg);flex-shrink:0}.widget .label.accent{color:var(--color-accent)}.widget .input{width:100%;height:24rem;border:0;background:transparent;color:var(--color-text-fade);display:block;padding:4rem 5rem;position:relative;display:var(--display-input)}.widget .input input{position:absolute;top:0;left:0;right:0;bottom:0;padding:4rem 5rem;width:100%;font:inherit;text-align:center;border:0;background:transparent;color:var(--color-accent)}.widget .input canvas{width:100%;height:100%;opacity:0.8}.widget .input input+canvas{visibility:hidden}.widget .input:focus{color:var(--color-accent)}.widget .input[disabled]{color:var(--color-text-fade)}.fader-container{--color-pips:var(--color-text-fade);--color-gauge:var(--color-custom);--color-knob:var(--color-custom);height:100%;width:100rem}.fader{height:100%;overflow:hidden;display:flex;flex-direction:column;position:relative}.fader .wrapper{overflow:hidden;flex:1;display:flex;max-height:100%;width:100%;position:relative}.fader .wrapper canvas{flex:1;max-height:100%;width:100%}.fader .wrapper .meter-container{pointer-events:none;position:absolute;top:20rem;bottom:19rem;left:50%;height:auto;width:3rem;min-width:3rem}.fader.has-pips .wrapper canvas{padding-right:28rem}.fader.has-pips .pips{pointer-events:none;position:absolute;top:20rem;bottom:20rem;left:50%;z-index:0;width:4rem;margin-left:7rem;background:linear-gradient(to bottom, transparent 0, transparent 2px, var(--color-pips) 2px, var(--color-pips) 3px, transparent 3px, transparent 5px);background-size:100% 5px;background-repeat:repeat-y}.fader.has-pips .pips .pip{height:1px;background:var(--color-pips);color:var(--color-fg);position:absolute;width:8rem;left:0}.fader.has-pips .pips .pip:before{content:"";position:absolute;top:-4px;left:0;right:0;bottom:-4px;background:var(--color-fg);z-index:-1}.fader.has-pips .pips .pip span{position:absolute;width:30rem;display:block;text-align:center;font-size:10rem;line-height:12rem;left:3rem;top:-5.5rem;color:var(--color-pips)}.fader.has-pips.horizontal .wrapper canvas{padding-right:0;padding-bottom:20rem}.fader.has-pips.horizontal .wrapper .meter-container{left:20rem;right:20rem;height:3rem;min-height:3rem;width:auto;top:50%;margin-top:3rem}.fader.has-pips.horizontal .pips{top:50%;left:20rem;right:20rem;font-size:0;height:4rem;width:auto;margin:0;margin-top:10rem;background:linear-gradient(to right, transparent 0, transparent 2px, var(--color-pips) 2px, var(--color-pips) 3px, transparent 3px, transparent 5px);background-size:5px 100%;background-repeat:repeat-x}.fader.has-pips.horizontal .pips .pip{width:1px;height:6rem;margin:0}.fader.has-pips.horizontal .pips .pip:before{top:0;bottom:0;left:-4px;right:-4px}.fader.has-pips.horizontal .pips .pip span{top:15rem;left:-15rem !important;right:auto}.fader.has-pips.align-right .wrapper canvas{padding-right:0;padding-left:28rem}.fader.has-pips.align-right .wrapper .meter-container{left:auto;right:50%;margin-left:0}.fader.has-pips.align-right .pips{margin-left:0;margin-right:7rem;left:auto;right:50%}.fader.has-pips.align-right .pips .pip{right:0;left:auto}.fader.has-pips.align-right .pips .pip span{right:3rem;left:auto}.fader.compact .wrapper canvas{background:var(--color-faded)}.fader.compact .input{overflow:hidden;position:absolute;top:50%;transform:rotate(-90deg);pointer-events:none;width:100rem;margin-left:-50rem;left:50%;z-index:3;margin-top:-12rem}.fader.compact .meter-container{top:0;bottom:0;left:auto;right:0}.fader.compact.horizontal .meter-container{top:auto;bottom:0;left:0;right:0;height:3rem;min-height:3rem;width:auto}.fader.compact.horizontal .input{transform:none;top:50%}.knob-container{--color-pips:var(--color-text-fade);--color-gauge:var(--color-custom);--color-knob:var(--color-custom);width:100rem;height:120rem;align-items:center;flex-shrink:0}.knob{height:100%;width:100%;overflow:hidden;display:flex;flex-direction:column;position:relative}.knob .wrapper{overflow:hidden;flex:1;display:flex;max-height:100%;width:100%;position:relative}.knob .wrapper canvas{flex:1;max-height:100%;width:100%;position:relative}.knob.compact .input{position:absolute;top:calc(50% - 12rem);pointer-events:none}.multitoggle-container,.multipush-container,.multifader-container{height:200rem;width:200rem}.multitoggle-container.nolabel .matrix,.multipush-container.nolabel .matrix,.multifader-container.nolabel .matrix{top:0}.matrix{flex:1;overflow:auto;background:var(--color-bg);display:flex;flex-wrap:wrap;flex-direction:row;margin-right:-1rem;margin-bottom:-1rem}.matrix>.widget{min-height:0;min-width:0;margin:0 !important}.matrix>.widget .label{background:none;border:0}.multifader-container .matrix{padding:0 !important;align-items:stretch}.multifader-container .widget{height:auto}.multifader-container .fader-wrapper{padding:10rem 0 20rem !important}.multifader-container .fader-wrapper .fader{left:0 !important}.xy-container,.rgb-container{width:200rem;height:250rem;flex-shrink:0;display:flex}.xy-container .label,.rgb-container .label{flex-shrink:0}.xy-wrapper{height:100%;overflow:hidden;display:flex;flex-direction:column}.xy-wrapper .value{width:100%;display:var(--display-input)}.xy-wrapper .input{width:50%;float:left;height:24rem;text-align:center;position:relative}.xy{position:relative;width:auto;height:100%;overflow:hidden;cursor:-webkit-grab;background:var(--color-faded)}.xy:active{cursor:-webkit-grabbing}.xy .handle{position:absolute;bottom:0;left:0;z-index:2;pointer-events:none;backface-visibility:hidden;transform-origin:center;transform:translate3d(0, 0, 0)}.xy .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;background:var(--color-custom);border:none !important;border-radius:100% !important}.xy .handle:after{content:"";position:absolute;top:-10rem;right:-10rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-custom);opacity:.2}.rgb-wrapper .input,.rgb-wrapper input{width:33.33%}.rgb .bg{position:absolute;top:0;left:0;right:0;bottom:0;background-color:red;opacity:.75;pointer-events:none}.rgb .bg:before,.rgb .bg:after{content:"";position:absolute;left:0;top:0;width:100%;height:100%}.rgb .bg:before{background:linear-gradient(to right, #fff 0%, rgba(255,255,255,0) 100%)}.rgb .bg:after{background:linear-gradient(to bottom, transparent 0%, #000 100%)}.rgb .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;background:var(--color-text);border:none !important;border-radius:100% !important}.rgb .handle:after{content:"";position:absolute;top:-10rem;right:-10rem;height:20rem;width:20rem;border:none !important;border-radius:100% !important;background:var(--color-text)}.hue{width:auto;min-height:30rem;overflow:hidden;cursor:-webkit-grab;position:relative;flex-shrink:0}.hue .bg{position:absolute;top:0;left:0;right:0;bottom:0;opacity:0.5;background:transparent linear-gradient(to left, red, #FF0080, #f0f, #8000FF, blue, #0080FF, cyan, #00FF80, lime, #80FF00, #ff0, #FF8000, red) repeat scroll 0% 0%;pointer-events:none}.hue:active{cursor:-webkit-grabbing}.hue .handle{position:absolute;z-index:2;left:0;top:50%;pointer-events:none;transform:translate3d(0, 0, 0)}.hue .handle:before{content:"";position:absolute;top:-4rem;right:-4rem;height:8rem;width:8rem;border:none !important;border-radius:100% !important;box-shadow:none;background:var(--color-text)}.led-container{width:100rem;flex-shrink:0}.led-container .led{display:flex;align-items:center;height:100%;padding:10rem 0;overflow:hidden}.led-container .led div{border-radius:100%;width:calc(100% - 20rem);padding-bottom:calc(100% - 20rem);margin:0 auto;background:var(--color-track);position:relative}.led-container .led div span{position:absolute;top:0;left:0;right:0;bottom:0;border-radius:100%;display:block;background-color:var(--color-custom)}.led-container .led div span:after{content:"";border-radius:100%;position:absolute;top:-1rem;left:-1rem;right:-1rem;bottom:-1rem;display:block;border:6rem solid var(--color-fg);opacity:0.8}.plot-container,.visualizer-container,.eq-container{--color-custom:var(--color-accent);height:200rem;width:200rem}.plot-container .plot,.visualizer-container .plot,.eq-container .plot{display:flex;flex-direction:row;flex:1;position:relative}.plot-container canvas,.visualizer-container canvas,.eq-container canvas{position:absolute;top:0;left:0;width:100%;height:100%}.meter-container{--color-custom:var(--color-accent);--color-gauge:var(--color-custom);height:100rem}.meter-container .meter{display:flex;flex-direction:row;flex:1;position:relative;background:var(--color-track)}.meter-container .meter .level{width:100%;flex:1;transform-origin:bottom;background:var(--color-custom)}.meter-container .meter::after{content:"";position:absolute;top:0;left:0;bottom:0;right:0;background-image:linear-gradient(transparent 1px, var(--color-fg) 1px, var(--color-fg) 2px);background-size:100% 2px;background-repeat:repeat}.meter-container .meter.horizontal::after{background-image:linear-gradient(to left, transparent 1px, var(--color-fg) 1px, var(--color-fg) 2px);background-size:2px 100%}.meter-container .meter.horizontal .level{transform-origin:left}.text-container{--color-custom:var(--color-accent)}.text-container .text{flex:1;height:35rem;padding:10rem;justify-content:center;display:flex;align-items:center;background:var(--color-faded);color:var(--color-custom)}.text-container .text.vertical{transform:rotate(180deg);text-overflow:ellipsis;overflow:hidden;-webkit-writing-mode:vertical-lr}.toggle-container,.push-container{width:100rem;min-height:65rem;flex-shrink:0;padding:0 !important;background:var(--color-raised);cursor:pointer}.toggle-container .label,.push-container .label{position:absolute;top:1rem;left:0;right:0;bottom:0;height:auto;max-height:initial;border:0;background:none !important;text-align:center;pointer-events:none;display:flex;justify-content:center;align-items:center}.toggle-container .light,.push-container .light{box-shadow:0 0 1rem 0 var(--color-text-fade) inset;flex:1}.toggle-container .light:before,.push-container .light:before{content:"";width:100%;height:100%;position:absolute;background:var(--color-custom);opacity:0}.toggle-container .light.on,.push-container .light.on{box-shadow:0 0 1rem 0 var(--color-custom) inset}.toggle-container .light.on:before,.push-container .light.on:before{opacity:.3}.push-container .active{background:var(--color-fg)}.push-container .light:after{content:"";position:absolute;width:100%;height:100%;box-shadow:0 0 0 4rem var(--color-text-fade) inset;opacity:.1}.switch-container{width:100rem;flex-shrink:0}.switch-container .switch{height:100%;width:100%;cursor:pointer;display:flex;flex-direction:column;align-items:stretch;flex:1;z-index:1}.switch-container .switch.horizontal{flex-direction:row}.switch-container .switch.horizontal .value{padding:6rem;text-align:center;display:flex;justify-content:center;flex-direction:column;border-top:0;border-right:1rem solid var(--color-bg);flex:1;height:auto}.switch-container .switch.horizontal .value:last-child{border-right:0}.switch-container .switch .value{background:var(--color-raised);color:var(--color-text);width:100%;height:100%;position:relative;border-top:1rem solid var(--color-bg);white-space:normal;padding:12rem;text-align:center;word-break:break-all;overflow:hidden;display:flex;flex-direction:column;justify-content:center;box-shadow:0 0 1rem 0 var(--color-text-fade) inset}.switch-container .switch .value:first-child{border-top:0}.switch-container .switch .value:last-child{margin-bottom:0}.switch-container .switch .value:before{content:"";position:absolute;left:0;top:0;right:0;bottom:0;background:var(--color-custom);opacity:0;z-index:2}.switch-container .switch .value.on:before{opacity:.3;box-shadow:0 0 1rem 0 var(--color-custom) inset}.strip-container{width:100rem;height:100%;overflow:visible;border:0}.strip-container:before{content:"";position:absolute;top:0;bottom:0;right:0;left:0;pointer-events:none;z-index:2}.strip-container>.strip{height:100%;display:flex;flex-direction:column}.strip-container>.strip>.widget{width:auto;margin:0;box-shadow:none}.strip-container>.strip>.widget .label{background-image:none}.strip-container.vertical>.strip>.widget{max-width:100%}.strip-container.vertical::before{border-right:1rem solid var(--color-bg)}.strip-container.horizontal{width:100%;height:200rem;display:flex;flex-direction:row}.strip-container.horizontal::before{border-bottom:1rem solid var(--color-bg)}.strip-container.horizontal>.strip{flex-direction:row;flex:1}.strip-container.horizontal>.strip>.widget{flex-shrink:initial;width:100%;min-height:100%;max-height:100%;height:100%}.strip-container.horizontal>.label{width:35rem;height:100%;border-bottom:0;border-right:1rem solid var(--color-bg);max-height:initial}.strip-container.horizontal>.label span{transform:rotate(180deg);display:block;position:relative;overflow:hidden;text-overflow:ellipsis;-webkit-writing-mode:vertical-lr;text-align:center;height:100%}.panel-container{width:200rem;height:200rem;border:0;background:var(--color-faded)}.panel-container:before{content:"";position:absolute;top:0;bottom:0;right:0;left:0;border-bottom:1rem solid var(--color-bg);border-right:1rem solid var(--color-bg);pointer-events:none;z-index:2}.panel-container ::-webkit-scrollbar-thumb,.panel-container ::-webkit-scrollbar-track-piece{border-top:1rem solid var(--color-bg)}.panel-container.nolabel .panel{top:0}.panel-container .panel{overflow:auto;position:absolute;top:35rem;left:0;right:0;bottom:0}.panel-container .panel.has-tabs{display:flex;flex-direction:column;background:var(--color-bg)}.panel-container .panel.noscroll{overflow:hidden}.panel-container .panel.noscroll>.widget{max-width:100%;max-height:100%}.panel-container .navigation{border-top:0;background:transparent}.panel-container .navigation:after{background:var(--color-bg)}.panel-container .navigation a.on{border-color:var(--color-bg)}.panel-container .content{background:transparent}input:focus::selection{background:var(--color-accent);color:var(--color-text)}input{cursor:text}html,body{height:100%;overflow:hidden;position:relative}html{font-size:calc(var(--pixel-scale) * 1px);max-height:999999px}body{font-size:13rem;line-height:16rem;font-family:Droid Sans;color:var(--color-text);white-space:nowrap;opacity:1;cursor:default}i{font-size:14rem !important}.btn{background:var(--color-raised);display:block;padding:15rem;position:relative;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;cursor:pointer}.btn.small{padding:8rem;padding-right:15rem}.btn.warning{background:firebrick}.btn.disabled{pointer-events:none;color:var(--color-text-fade)}.btn.align-center{text-align:center}#lobby{background:var(--color-bg);position:absolute;top:0;left:0;right:0;bottom:0;z-index:2;display:flex;align-items:center;justify-content:center;overflow-y:auto;padding:20rem}#lobby .main{width:600rem;max-width:100%;max-height:100%;display:flex;flex-direction:column}#lobby .list{flex:1;overflow:auto;background:var(--color-fg);border-top:2rem solid var(--color-bg)}#lobby .header{padding:20rem;white-space:nowrap;text-overflow:ellipsis;flex-grow:0;background-color:var(--color-faded);color:var(--color-accent);font-size:16rem;line-height:24rem}#lobby .footer{background:var(--color-raised);white-space:nowrap;text-overflow:ellipsis;flex-grow:0;background:var(--color-faded);border-top:2rem solid var(--color-bg)}#lobby a{display:block;padding-right:35rem;overflow:hidden;padding-top:15rem;position:relative;white-space:nowrap;text-overflow:ellipsis;background:none;border-bottom:1rem solid var(--color-bg)}#lobby a:hover{background:var(--color-raised)}#lobby a:last-child{border-bottom:0}#lobby a span{position:absolute;right:0rem;top:0rem;padding:15rem;color:var(--color-text-fade)}#loading{position:absolute;top:50%;left:50%;margin-top:-15rem;text-align:center}#loading .spinner{display:block;margin:0 auto;height:30rem;width:30rem;border-radius:50%;border:2rem solid var(--color-track);border-top-color:var(--color-accent);animation:spin .5s linear infinite}#loading #status{margin-top:10rem;display:inline-block}@keyframes spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}.popup{position:fixed;top:0;left:0;right:0;bottom:0;padding:10%;display:flex;align-items:center;z-index:1000000}.popup:before{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--color-bg);opacity:.5}.popup .popup-title{position:relative;padding:15rem;background:var(--color-raised)}.popup .popup-title .closer{position:absolute;right:0rem;top:0;padding:15rem;color:var(--color-text-fade);cursor:pointer}.popup .popup-wrapper{display:flex;flex-direction:column;align-items:stretch;background:var(--color-fg);width:auto;max-width:600rem;margin:0 auto;position:relative;overflow:hidden;border:1rem solid var(--color-track)}.popup .popup-wrapper .popup-content{height:100%;width:100%;padding:10rem;overflow-y:auto;white-space:normal} diff --git a/app/browser/js/browser-headless.bundle.js b/app/browser/js/browser-headless.bundle.js deleted file mode 100644 index f6bd3a9b..00000000 --- a/app/browser/js/browser-headless.bundle.js +++ /dev/null @@ -1,12219 +0,0 @@ -(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') - var blob = new Blob([state],{type : 'text/plain'}); - down.attr('href', window.URL.createObjectURL(blob)) - down[0].click() - } - - }, - - stateGet: function (){ - var data = [] - for (i in WIDGETS) { - var widget = WIDGETS[i] - for (var j=widget.length-1;j>=0;j--) { - if (widget[j].setValue && widget[j].getValue) { - var v = widget[j].getValue() - if (v!=undefined) data.push([i,v]) - break - } - } - } - return data - }, - - stateLoad: function() { - if (WEBFRAME) { - IPC.send('stateLoad') - } else { - var prompt = $('') - prompt.click() - prompt.on('change',function(e){ - var reader = new FileReader(); - reader.onloadend = function(e) { - var preset = e.target.result - module.exports.stateSet(JSON.parse(preset),true) - STATE = preset - } - reader.readAsText(e.target.files[0],'utf-8'); - }) - } - }, - - stateSend: function(){ - var data = module.exports.stateGet() - module.exports.stateSet(data,true) - - }, - - stateSet: function(preset,send){ - - for (i in preset) { - var data = preset[i] - if (WIDGETS[data[0]]!=undefined) { - for (var i=WIDGETS[data[0]].length-1;i>=0;i--) { - if (WIDGETS[data[0]][i].setValue) { - WIDGETS[data[0]][i].setValue(data[1],send,true) - } - } - } - } - }, - - toggleFullscreen: function(){ - - if (WEBFRAME) { - IPC.send('fullscreen') - } else { - var isInFullScreen = document.webkitIsFullScreen - - if (isInFullScreen) { - document.webkitExitFullscreen() - } else { - document.documentElement.webkitRequestFullScreen() - } - } - }, - - sessionBrowse: function(){ - - if (WEBFRAME) { - IPC.send('sessionBrowse') - } else { - var prompt = $('') - prompt.click() - prompt.on('change',function(e){ - var reader = new FileReader(); - reader.onloadend = function(e) { - var session = e.target.result - IPC.send('sessionOpen',{file:session}) - } - reader.readAsText(e.target.files[0],'utf-8'); - }) - } - }, - - sessionSave: function() { - var sessionfile = JSON.stringify(SESSION,null,' ') - if (WEBFRAME) { - IPC.send('sessionSave',sessionfile) - } else { - var down = $('') - var blob = new Blob([sessionfile],{type : 'text/plain'}); - down.attr('href', window.URL.createObjectURL(blob)) - down[0].click() - } - - }, - - editorEnable: function(){ - $('.editor-root').attr('data-tab','#container').removeClass('disabled') - $('.enable-editor').addClass('on') - $('.disable-editor').removeClass('on') - - EDITING = true - }, - editorDisable: function(){ - $('.widget.ui-resizable').resizable('destroy') - $('.widget.ui-draggable').draggable('destroy').find('.ui-draggable-handle').remove() - $('.editing').removeClass('editing') - $('.editor-root').addClass('disabled') - $('.editor-container').remove() - $('.disable-editor').addClass('on') - $('.enable-editor').removeClass('on') - - EDITING = false - }, - - traversingDisable: function(){ - $('.traversingEnable, .traversingDisable').toggleClass('on') - $(document).trigger('disableTraversingGestures') - }, - traversingEnable: function(){ - $('.traversingEnable, .traversingDisable').toggleClass('on') - $(document).enableTraversingGestures() - } - -} - -},{}],3:[function(require,module,exports){ -var init = require('./init'), - actions = require('./actions'), - utils = require('./utils'), - icon = utils.icon - -module.exports = { - - receiveOsc: function(event,data){ - var data = data || event - - // fetch ids corresponding to the osc path - var path = data.path, - pathref = path, - args = data.args - - if (typeof data.args == 'object') { - for (var i=data.args.length-1;i>=0;i--) { - var ref = path+'||||'+data.args.slice(0,i).join('||||') - if (WIDGETS_BY_PATH[ref]) { - pathref = ref - args = data.args.slice(i,data.args.length) - args = args.length==1?args[0]:args - continue - } - } - } else { - args = data.args - } - for (i in WIDGETS_BY_PATH[pathref]) { - if (WIDGETS_BY_PATH[pathref][i]) WIDGETS_BY_PATH[pathref][i].setValue(args,false,true) - } - - - }, - - stateLoad: function(event,data){ - var data = data || event - data = JSON.parse(data) - actions.stateSet(data,true) - actions.stateQuickSave(data) - }, - - sessionList: function(event,data){ - var data = data || event - $('#lobby').append(` -
-
- Open Stage Control -
-
- -
`) - - for (i in data) { - $('#lobby .list').append(''+data[i]+''+icon('remove')+'') - } - $('#lobby .footer').append(''+icon('folder-open')+' Browse') - $('#lobby .footer').append(''+icon('file-o')+' New') - $('#lobby .load').click(function(e){ - e.stopPropagation() - IPC.send('sessionOpen',{path:$(this).data('session')}) - }) - $('#lobby a span').click(function(e){ - e.stopPropagation() - IPC.send('sessionRemoveFromHistory',$(this).parent().data('session')) - $(this).parents('a').remove() - }) - $('#lobby .browse').click(function(e){ - e.stopPropagation() - actions.sessionBrowse() - }) - $('#lobby .new').click(function(e){ - e.stopPropagation() - init([{}],function(){$('#open-toggle, .enable-editor').click();$('.editor-root').trigger('mousedown.editor')}) - }) - }, - - sessionOpen: function(event,data){ - var data = data || event - var session = JSON.parse(data) - init(session) - - }, - - error: function(event,data){ - var data = data || event - - utils.createPopup(icon('warning')+' '+data.title,data.text) - }, - - applyStyle: function(event,data){ - var data = data || event - var style = document.createElement('style'); - style.innerHTML = data.join(''); - document.body.appendChild(style); - if (data.indexOf('--pixel-scale')!=-1) { - PXSCALE = data.match(/--pixel-scale\s*:\s*([^;]*)/)[1] - INITIALZOOM = PXSCALE - } - } - -} - -},{"./actions":2,"./init":9,"./utils":13}],4:[function(require,module,exports){ -var correctPosition = function (m, parent){ - var pos = m.offset(), - width = m.outerWidth(), - height = m.outerHeight(), - totalWidth = $('body').outerWidth(), - totalHeight = $('body').outerHeight(), - leftAdjust = parent=='body'?0:parent.outerWidth()-2 - - if (width + pos.left > totalWidth) { - m.css({'margin-left':totalWidth-(width + pos.left + leftAdjust)}) - } - if (height + pos.top > totalHeight) { - m.css({'margin-top':totalHeight-(height + pos.top)}) - } -} - -var ev = 'fake-click' - - -var menu = function(e,actions,parent){ - - var m = $('
') - if (parent=='body') { - m.css({top:e.pageY+'px',left:e.pageX+'px'}) - } - - for (label in actions) { - - if (typeof actions[label] == 'object') { - - var item = $(`
${label}
`).appendTo(m).on(ev,function(e){e.stopPropagation()}) - menu(e,actions[label],item) - - - } else { - - $(`
${label}
`).on(ev + '.editor',function(){ - var callback = actions[label] - return function(e){ - callback() - $('.context-menu').remove() - } - }()).appendTo(m) - } - } - - m.appendTo(parent) - - - - if (parent=='body') { - correctPosition(m,parent) - } else { - parent.hover(function(){correctPosition(m,parent)}) - } - -} - -module.exports = menu - -},{}],5:[function(require,module,exports){ -var widgets = require('../widgets'), - widgetOptions = widgets.widgetOptions, - sync = widgets.sync, - parser = require('../parser') - parsewidgets = parser.widgets, - parsetabs = parser.tabs, - ui = require('../ui'), - actions = require('../actions'), - sidepanelCreateToggle = require('../sidepanel').createToggle, - editObject = function(a,b){require('./edit-objects').editObject(a,b,true)}, - editSession = function(a,b){require('./edit-objects').editSession(a,b,true)}, - purgeStores = require('./purge') - - -var getObjectData = function(obj){ - var path = [] - - if (obj.hasClass('tab')) { - return TABS['#'+obj.attr('id')].data - } - - if (obj.is('#container')) { - return SESSION - } - - while(true) { - if (obj.hasClass('widget')) { - path.unshift(obj.index()) - path.unshift('widgets') - } else if (obj.hasClass('tab')){ - path.unshift(obj.data('index')) - path.unshift('tabs') - } else if (obj.is('#container')) { - break - } - - obj = obj.parent() - } - - path.splice(0,1) - - for (var i=0,data=SESSION, path=path, len=path.length; i${data.label}`) - - editObject(newContainer,data) - - } else if (container.attr('id')=='container') { - // session - var newContainer = $('#container') - container.empty() - parsetabs(data,container,true) - - editSession(newContainer,data) - sidepanelCreateToggle() - - } - - newContainer.find('[data-tab]:first-child').click() - - $(window).resize() - - purgeStores(purgetabs) - - // restore state - actions.stateSet(state,false) - sync() - ui.scrolls() - $('#sidepanel').scrollTop(scroll) - - - // return updated node - return newContainer - -} - - -var incrementWidget = function(data){ - - if (!data) return - - delete data.linkId - - var id = data.id, - label = data.label, - path = data.path - - if (id && id==label) { - data.label = 'auto' - } - if (id && path == '/'+id) { - - data.path = 'auto' - - } else if (path){ - var pathref - while (WIDGETS_BY_PATH[pathref]) { - path = path.replace(/([0-9]*)$/,function(m){ - var n = parseInt(m)+1 - n = isNaN(n)?1:n - return n - }) - pathref = data.preArgs&&data.preArgs.length?path+'||||'+data.preArgs.join('||||'):path - } - WIDGETS_BY_PATH[pathref] = [] - data.path = path - - } - - if (id) { - while (WIDGETS[id]) { - id = id.replace(/([0-9]*)$/,function(m){ - var n = parseInt(m)+1 - n = isNaN(n)?1:n - return n - }) - } - WIDGETS[id] = [] - data.id = id - - } - - - for (i in data) { - if (typeof data[i] == 'object') data[i] = incrementWidget(data[i]) - } - - return data - -} - -module.exports = { - updateDom:updateDom, - getObjectData:getObjectData, - incrementWidget:incrementWidget -} - -},{"../actions":2,"../parser":10,"../sidepanel":11,"../ui":12,"../widgets":14,"./edit-objects":6,"./purge":8}],6:[function(require,module,exports){ -var updateDom = require('./data-workers').updateDom, - widgetOptions = require('../widgets').widgetOptions - -var ev = 'fake-click' - - -var editObject = function(container, data, refresh){ - - if (!refresh && (container.hasClass('editing') || $(`a[data-tab="#${container.attr('id')}"]`).hasClass('editing'))) return - - var isWidget = container.hasClass('widget') - - $('.editing').removeClass('editing') - $('.widget.ui-resizable').resizable('destroy') - $('.widget.ui-draggable').draggable('destroy').find('.ui-draggable-handle').remove() - - - if (isWidget) { - $(container).addClass('editing') - } else { - $(`[data-tab="#${container.attr('id')}"]`).addClass('editing').click() - $(container).parent().addClass('editing') - } - - - - $('.editor-container').remove() - $('.editor').append('
') - var form = $('
').appendTo('.editor-container') - - - var params = isWidget?widgetOptions[data.type]:{label:''} - - for (i in params) { - - if (i.indexOf('separator')!=-1) { - $(`
${params[i]}
`).appendTo(form) - continue - } else if (data[i]===undefined) { - continue - } - - // Common options edit - if (i!='widgets' && i!='tabs') { - - var type = typeof data[i], - value = type == 'object'?JSON.stringify(data[i]):data[i], - wrapper = $('
').appendTo(form), - label = $(``).appendTo(wrapper), - input - - if (i=='type') { - - input = $(``) - input.click(function(){ - $(this).val(!eval($(this).val())).trigger('change') - }) - input.appendTo(wrapper) - - } else { - - input = $(``) - input.appendTo(wrapper) - - } - - - input.on('change',function(){ - // var v = $(this).val()!= '' && $(this).data('type') == 'object'?JSON.parse($(this).val()):$(this).val() - var v - try { - eval(`v=${$(this).val()}`) - } catch(err) { - v = $(this).val() - } - - data[$(this).attr('title')] = v - if (v==='') delete data[$(this).attr('title')] - updateDom(container,data) - }) - - } - - } - - // widget list edit - if (((isWidget&&widgetOptions[data.type].widgets) || (container.hasClass('tab'))) && (!data.tabs||!data.tabs.length)) { - - var list = $('
    '), - wrapper = $('
    ').appendTo(form) - - var editItem = function(i) { - return function(){ - container.find('.widget').first().siblings().addBack().eq(i).trigger(ev) - } - } - - for (i in data.widgets) { - - - var item = $(`
  • ${data.widgets[i].id||data.widgets[i].label}
  • `) - .appendTo(list) - .click(editItem(i)) - - var remove = $('') - .appendTo(item) - .click(function(e){ - e.stopPropagation() - data.widgets.splice($(this).parent().attr('data-index'),1) - updateDom(container,data) - }) - } - - list.sortable({ - forcePlaceholderSize: true, - items: '.sortables', - start:function(){$(this).sortable( "refreshPositions" )}, - update: function(e,ui){ - var prevIndex = $(ui.item).attr('data-index') - var newIndex = $(ui.item).index() - - data.widgets.splice(newIndex, 0, data.widgets.splice(prevIndex, 1)[0]) - - updateDom(container,data) - } - }) - - var add = $(`
  • +
  • `).appendTo(list).click(function(){ - data.widgets = data.widgets || [] - data.widgets.push({}) - - updateDom(container,data) - }) - - $('').appendTo(wrapper) - list.appendTo(wrapper) - - } - - // tab list edit - if (((isWidget&&widgetOptions[data.type].tabs) || (container.hasClass('tab'))) && (!data.widgets||!data.widgets.length)) { - //tabs - var list = $('
      '), - wrapper = $('
      ').appendTo(form) - - - var editItem = function(i) { - return function(){ - container.find('.tab').first().siblings().addBack().eq(i).trigger(ev) - } - } - - for (i in data.tabs) { - var item = $(`
    • ${data.tabs[i].label}
    • `) - .appendTo(list) - .click(editItem(i)) - - var remove = $('') - .appendTo(item) - .click(function(e){ - e.stopPropagation() - data.tabs.splice($(this).parent().attr('data-index'),1) - updateDom(container,data) - }) - } - - list.sortable({ - start:function(){$(this).sortable( "refreshPositions" )}, - forcePlaceholderSize: true, - items: '.sortables', - update: function(e,ui){ - var prevIndex = $(ui.item).attr('data-index') - var newIndex = $(ui.item).index() - - data.tabs.splice(newIndex, 0, data.tabs.splice(prevIndex, 1)[0]) - - updateDom(container,data) - } - }) - - var add = $(`
    • +
    • `).appendTo(list).click(function(){ - data.tabs = data.tabs || [] - data.tabs.push({}) - - updateDom(container,data) - }) - - $('').appendTo(wrapper) - list.appendTo(wrapper) - } - - if (data.hasOwnProperty('width')) { - var handleTarget - container.resizable({ - handles:'s, e, se', - helper: "ui-helper", - start: function(event, ui){ - handleTarget = $(event.originalEvent.target) - }, - stop: function( event, ui ) { - if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-s')) data.height = Math.max(ui.size.height,30)/PXSCALE - if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-e')) data.width = Math.max(ui.size.width,30)/PXSCALE - updateDom(container,data) - } - }) - } - - if (data.hasOwnProperty('top')) { - container.draggable({ - cursor:'-webkit-grabbing', - stop: function( event, ui ) { - event.preventDefault() - data.top = (ui.helper.position().top + container.parent().scrollTop())/PXSCALE - data.left = (ui.helper.position().left + container.parent().scrollLeft())/PXSCALE - ui.helper.remove() - updateDom(container,data) - }, - handle:'.ui-draggable-handle, > .label', - snap:'.widget', - snapTolerance:5, - helper:function(){return $('
      ').css({height:container.outerHeight(),width:container.outerWidth()})} - }).append('
      ') - } - -} - -var editSession = function(container,data,refresh){ - - if (!refresh && $('.editor-root').hasClass('editing')) return - - $('.widget.ui-resizable').resizable('destroy') - $('.widget.ui-draggable').draggable('destroy').find('.ui-draggable-handle').remove() - - - $('.editing').removeClass('editing') - $('.editor-root, #container').addClass('editing') - - $('.editor-container').remove() - $('.editor').append('
      ') - - - var form = $('
      ').appendTo('.editor-container'), - list = $('
        '), - wrapper = $('
        ').appendTo(form) - - - var editItem = function(i) { - return function(){ - container.find('.tab').first().siblings().addBack().eq(i).trigger(ev) - } - } - - for (i in data) { - var item = $(`
      • ${data[i].label}
      • `) - .appendTo(list) - .click(editItem(i)) - - var remove = $('') - .appendTo(item) - .click(function(e){ - e.stopPropagation() - data.splice($(this).parent().attr('data-index'),1) - updateDom(container,data) - }) - } - - - list.sortable({ - start:function(){$(this).sortable( "refreshPositions" )}, - forcePlaceholderSize: true, - items: '.sortables', - update: function(e,ui){ - var prevIndex = $(ui.item).attr('data-index') - var newIndex = $(ui.item).index() - - data.splice(newIndex, 0, data.splice(prevIndex, 1)[0]) - - updateDom(container,data) - } - }) - - var add = $(`
      • +
      • `).appendTo(list).click(function(){ - data = data || [] - data.push({}) - - updateDom(container,data) - }) - - $('').appendTo(wrapper) - list.appendTo(wrapper) - - - $('.editor-container').append(form) - -} - -module.exports = { - editObject:editObject, - editSession:editSession -} - -},{"../widgets":14,"./data-workers":5}],7:[function(require,module,exports){ -var data = require('./data-workers'), - getObjectData = data.getObjectData, - updateDom = data.updateDom, - incrementWidget = data.incrementWidget, - edit = require('./edit-objects'), - editObject = edit.editObject, - editSession = edit.editSession, - createPopup = require('../utils').createPopup, - widgetOptions = require('../widgets').widgetOptions, - widgetCategories = require('../widgets').categories, - menu = require('./context-menu') - - - -var init = function(){ - - $('body').off('.editor').on('fake-click fake-right-click',function(e,d){ - - if (!EDITING) return - - // ignore mouse event when fired by a simulated touch event - if (e.type=='mousedown' && e.originalEvent.sourceCapabilities.firesTouchEvents) return - - $('.context-menu').remove() - - var target = $(e.target).is('.widget:not(.not-editable), .tab, [data-tab], #container')? - $(e.target): - $(e.target).closest('.widget:not(.not-editable), .tab, [data-tab], #container') - - if (!target.length) return - - var container = target.attr('data-tab')?TABS[target.attr('data-tab')].tab:target, - type = target.hasClass('widget')?'widget':'tab', - parent = container.parent(), - index = container.index(), - data = getObjectData(container) - - if (container.attr('id')=='container') { - editSession(container,SESSION) - } else { - editObject(container,data) - } - - - if (e.type!='fake-right-click') return - - if (container.attr('id')=='container') { - menu(d,{ - ' Add tab': function(){ - data.push({}) - updateDom(container,data) - } - },'body') - - return - } - - - var actions = {} - - // actions[' Edit'] = function(){editObject(container,data)} - - if (type=='widget') actions[' Copy'] = function(){CLIPBOARD=data} - - if (type=='widget') actions[' Cut'] = function(){ - CLIPBOARD=JSON.parse(JSON.stringify(data)) - var parentContainer = container.parents('.widget, .tab, #container').first() - parentData = getObjectData(parentContainer) - - parentData.widgets.splice(container.index(),1) - updateDom(parentContainer,parentData) - } - - if (((type=='widget'&&widgetOptions[data.type].widgets) || (type=='tab')) && (!data.tabs||!data.tabs.length)) { - - if (CLIPBOARD!=null) { - actions[' Paste'] = { - ' ID + 1':function(){ - data.widgets = data.widgets || [] - var newData = incrementWidget(JSON.parse(JSON.stringify(CLIPBOARD))) - - - if (!target.attr('data-tab')) { - newData.top = d.offsetY - newData.left= d.offsetX - } else { - delete newData.top - delete newData.left - } - - data.widgets.push(newData) - updateDom(container,data) - }, - ' Clone':function(){ - data.widgets = data.widgets || [] - var newData = JSON.parse(JSON.stringify(CLIPBOARD)) - if (!target.attr('data-tab')) { - newData.top = d.offsetY - newData.left= d.offsetX - } else { - delete newData.top - delete newData.left - } - data.widgets.push(newData) - updateDom(container,data) - } - } - } - - actions[' Add widget'] = {} - var createFunction = function(widgetType,container,data){ - return function() { - data.widgets = data.widgets || [] - var newData = {type:widgetType} - if (!target.attr('data-tab')) { - newData.top = d.offsetY - newData.left= d.offsetX - } - data.widgets.push(newData) - updateDom(container,data) - } - } - for (category in widgetCategories) { - actions[' Add widget'][category] = {} - for (t in widgetCategories[category]) { - var wtype = widgetCategories[category][t] - actions[' Add widget'][category][wtype] = createFunction(wtype,container,data) - - } - } - - } - if (((type=='widget'&&widgetOptions[data.type].tabs) || (type=='tab')) && (!data.widgets||!data.widgets.length)) { - - actions[' Add tab'] = function(){ - data.tabs = data.tabs || [] - data.tabs.push({}) - updateDom(container,data) - } - - } - - actions[' Delete'] = function(){ - var popup = createPopup('Are you sure ?',` -
        -
        DELETE
        -
        CANCEL
        -
        - `) - $('.confirm-delete').click(function(){ - popup.close() - var parentContainer = container.parents('.widget, .tab, #container').first() - parentData = getObjectData(parentContainer) - - - if (type=='widget') { - parentData.widgets.splice(container.index(),1) - } else if (type=='tab' && parentContainer.attr('id')!='container') { - parentData.tabs.splice(container.data('index'),1) - } else { - parentData.splice(container.data('index'),1) - } - - updateDom(parentContainer,parentData) - }) - $('.cancel-delete').click(function(){ - popup.close() - }) - $(document).on('keydown.popup', function(e){ - if (e.keyCode==13) $('.confirm-delete').click() - }) - - - } - - menu(d,actions,'body') - - }) - -} - -module.exports = init - -},{"../utils":13,"../widgets":14,"./context-menu":4,"./data-workers":5,"./edit-objects":6}],8:[function(require,module,exports){ -module.exports = function(purgetabs) { - - // prune tabs store - var count, newcount, formerBuffuredTabs, bufferedTabs - - if (purgetabs) { - while (true) { - // we need to do that several times since tabs are referenced in each of their parents - - // get all buffered tabs - formerBuffuredTabs = [] - for (i in TABS) { - formerBuffuredTabs.push(TABS[i].tab[0]) - } - - // remove deleted tabs that are not referenced (have no navigation link pointing to them) - var $f = $(formerBuffuredTabs) - for (i in TABS) { - if (!($f.find(`[data-tab="${i}"]`).length || i== '#container')) { - delete TABS[i] - } - } - - newcount = Object.keys(TABS).length - if (count == newcount) break - count = newcount - - } - } - - - bufferedTabs = [] - for (i in TABS) { - bufferedTabs.push(TABS[i].tab[0]) - } - - // prune widget stores - // if widgets cannot be found in buffered tabs, it must be unreferenced - var $b = $(bufferedTabs) - for (i in WIDGETS) { - for (var j=WIDGETS[i].length-1;j>=0;j--) { - if (!$b.find(WIDGETS[i][j]).length) { - WIDGETS[i].splice(j,1) - } - } - if (!WIDGETS[i].length) { - delete WIDGETS[i] - } - } - for (i in WIDGETS_LINKED) { - for (var j=WIDGETS_LINKED[i].length-1;j>=0;j--) { - if (!$b.find(WIDGETS_LINKED[i][j]).length) { - WIDGETS_LINKED[i].splice(j,1) - } - } - if (!WIDGETS_LINKED[i].length) { - delete WIDGETS_LINKED[i] - } - } - for (i in WIDGETS_BY_PATH) { - for (var j=WIDGETS_BY_PATH[i].length-1;j>=0;j--) { - if (!$b.find(WIDGETS_BY_PATH[i][j]).length) { - WIDGETS_BY_PATH[i].splice(j,1) - } - } - if (!WIDGETS_BY_PATH[i].length) { - delete WIDGETS_BY_PATH[i] - } - } -} - -},{}],9:[function(require,module,exports){ -var parsetabs = require('./parser').tabs, - ui = require('./ui'), - sync = require('./widgets').sync, - editorDisable = require('./actions').editorDisable, - editorInit = require('./editor/init') - -module.exports = function(session,callback) { - - $('#lobby').remove() - $('#container').empty() - var spinner = $('
        ').appendTo('#container') - - setTimeout(function(){ - parsetabs(session,$('#container'),true) - - // var t = $('
        ').appendTo('body') - // for (id in TABS) { - // if (id!='#container') { - // t[0].appendChild(TABS[id].tab[0]) - // } - // } - // setTimeout(function(){ - // t.detach() - // },250) - - - ui.init() - editorDisable() - editorInit() - sync() - - - setTimeout(function(){ - spinner.remove() - if (!callback) return - setTimeout(function(){ - callback() - },25) - },25) - },25) - -} - -},{"./actions":2,"./editor/init":7,"./parser":10,"./ui":12,"./widgets":14}],10:[function(require,module,exports){ -var widgets = require('./widgets'), - widgetOptions = widgets.widgetOptions, - createWidget = widgets.createWidget, - icon = require('./utils').icon - -var getIterator = function(id,type){ - var iterator = MISC.iterators[type] - if (iterator[id]==undefined) iterator[id] = 0 - iterator[id] += 1 - return iterator[id] -} - -var hashCode = function(s){ - return s.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0); -} - -module.exports.tabs = function(data,parent,main,parentLabel){ - - if (main) { - // Reset Globals - WIDGETS = {} - WIDGETS_LINKED = {} - WIDGETS_BY_PATH = {} - SESSION = data - for (i in TABS) { - if (i!='#container') { - TABS[i].parent.remove() - TABS[i].tab.remove() - } - } - TABS['#container'] = { - tab:$('#container') - } - - MISC.iterators.tab = {} - } - - var main = main?'main ':'', - nav = $(document.createElement('div')).addClass(main + 'navigation'), - navtabs = $(document.createElement('ul')).addClass('tablist'), - content = $(document.createElement('div')).addClass('content') - - - for (i in data) { - var tabData = data[i] - - - var label = tabData.label||tabData.id||'Unnamed', - hash = hashCode(label), - id = 'tab_'+hash+'_'+getIterator('tab'+hash,'tab') - - tabData.label = label - delete tabData.id - - navtabs.append(`
      • ${label}
      • `) - - var tabContent = $(`
        `) - tabContent.data(tabData) - - - if (tabData.tabs && tabData.tabs.length) { - module.exports.tabs(tabData.tabs,tabContent,false,label) - } else if (tabData.widgets && tabData.widgets.length) { - module.exports.widgets(tabData.widgets,tabContent) - } - - // content.append(tabContent) - TABS['#'+id]= { - parent:content, - tab:tabContent, - data:tabData - } - - } - - nav[0].appendChild(navtabs[0]) - parent[0].appendChild(nav[0]) - parent[0].appendChild(content[0]) -} - - - -module.exports.widgets = function(data,parent) { - - for (i in data) { - var widgetData = data[i] - - widgetData.type = widgetData.type || 'fader' - - var tmpWidgetOptions = JSON.parse(JSON.stringify(widgetOptions)) - - for (i in tmpWidgetOptions[widgetData.type]) { - if (i.indexOf('separator')==-1 && widgetData[i]===undefined) widgetData[i] = tmpWidgetOptions[widgetData.type][i] - } - - if (widgetData.id=='auto') { - var id - while (!id || WIDGETS[id]) { - id=widgetData.type+'_'+getIterator(widgetData.type,'widget') - } - widgetData.id = id - } - - widgetData.path = widgetData.path=='auto'?'/' + widgetData.id:widgetData.path - widgetData.target = widgetData.target?(Array.isArray(widgetData.target)?widgetData.target:[widgetData.target]):false - - for (i in widgetData) { - if (widgetOptions[widgetData.type][i]===undefined && i!='type') {delete widgetData[i]} - } - - - for (t in {width:'',height:'',top:'',left:''}) { - widgetData[t] = `${widgetData[t]}`.indexOf('-')!=-1?0:widgetData[t] - } - - if (parent.hasClass('strip')) { - delete widgetData.top - delete widgetData.left - } - - if (widgetData.preArgs!=undefined) { - widgetData.preArgs = Array.isArray(widgetData.preArgs)?widgetData.preArgs:[widgetData.preArgs] - } - if (widgetData.target!=undefined) { - widgetData.target = Array.isArray(widgetData.target)?widgetData.target:[widgetData.target] - } - - var width = parseFloat(widgetData.width)==widgetData.width?parseFloat(widgetData.width)+'rem' : widgetData.width, - height = parseFloat(widgetData.height)==widgetData.height?parseFloat(widgetData.height)+'rem' : widgetData.height, - left = parseFloat(widgetData.left)==widgetData.left?parseFloat(widgetData.left)+'rem' : widgetData.left, - top = parseFloat(widgetData.top)==widgetData.top?parseFloat(widgetData.top)+'rem' : widgetData.top - - - var styleW = widgetData.width&&widgetData.width!='auto'?`width:${width};min-width:auto;`:'', - styleH = widgetData.height&&widgetData.height!='auto'?`height:${height};min-height:auto;`:'', - styleL = widgetData.left&&widgetData.left!='auto'||widgetData.left==0?`left:${left};`:'', - styleT = widgetData.top&&widgetData.top!='auto'||widgetData.top==0?`top:${top};`:'' - - var label = widgetData.label == 'auto'? - widgetData.id: - typeof widgetData.label == 'string' && widgetData.label.indexOf('icon:')!=-1? - icon(widgetData.label.split(':')[1].trim().replace('fa-','')): - widgetData.label - - var widgetContainer = $(` -
        -
        ${label}
        -
        - `) - - if (widgetData.color && widgetData.color!='auto') widgetContainer[0].style.setProperty('--color-custom',widgetData.color) - - if (widgetData.label===false) widgetContainer.addClass('nolabel') - - // create widget - var widgetInner = createWidget[widgetData.type](widgetData,widgetContainer) - - - widgetContainer[0].appendChild(widgetInner[0]) - - // store widget reference for cross widget sync - if (WIDGETS[widgetData.id]==undefined) WIDGETS[widgetData.id] = [] - WIDGETS[widgetData.id].push(widgetInner) - - // store widget with linkId for widgte linking - if (widgetData.linkId && widgetData.linkId.length) { - if (WIDGETS_LINKED[widgetData.linkId]==undefined) WIDGETS_LINKED[widgetData.linkId] = [] - WIDGETS_LINKED[widgetData.linkId].push(widgetInner) - } - - // store widget by path and encode preArgs for perfect cross-app sync - if (widgetData.path)  { - var pathref = widgetData.preArgs&&widgetData.preArgs.length?widgetData.path+'||||'+widgetData.preArgs.join('||||'):widgetData.path - if (WIDGETS_BY_PATH[pathref]==undefined) WIDGETS_BY_PATH[pathref] = [] - WIDGETS_BY_PATH[pathref].push(widgetInner) - } - - parent[0].appendChild(widgetContainer[0]) - } - - // Editor needs to get the container object - if (data && data.length==1) return widgetContainer - -} - -},{"./utils":13,"./widgets":14}],11:[function(require,module,exports){ -var actions = require('./actions'), - icon = require('./utils').icon - -var data = [ - { - actions: [ - { - title:'Fullscreen (F11)', - action:actions.toggleFullscreen - } - - ] - }, - { - title: icon('sliders') + '  State', - actions: [ - { - title:'Store', - action:actions.stateQuickSave - }, - { - title:'Recall', - action:actions.stateQuickLoad, - class:'disabled quickload' - }, - { - title:'Send All', - action:actions.stateSend - }, - { - title:'Import', - action:actions.stateLoad - }, - { - title:'Export', - action:actions.stateSave - } - ] - }, - { - title: icon('magic') + '  Traversing gestures', - actions: [ - { - title:'On', - action:actions.traversingEnable, - class:'traversingEnable' - }, - { - title:'Off', - action:actions.traversingDisable, - class:'traversingDisable on' - } - ] - }, - { - title: icon('edit') + '  Editor', - class:'editor', - actions: [ - { - title:'On', - action:actions.editorEnable, - class:'enable-editor' - }, - { - title:'Off', - action:actions.editorDisable, - class:'on disable-editor' - }, - { - title:'Root', - class:'editor-root disabled' - }, - { - title:'Load', - action:actions.sessionBrowse - }, - { - title:'Save', - action:actions.sessionSave - } - ] - }, -] - -var sidepanel = function(data){ - - var bindAction = function(el,callback) { - el.click(function(){callback()}) - } - - var html = $('
          ') - - for (i in data) { - var itemData = data[i] - - var item = $('
        • '), - inner = $('
          ').appendTo(item) - wrapper = $('
          ').appendTo(inner) - - if (itemData.title) $('
          '+itemData.title+'
          ').prependTo(wrapper) - if (itemData.class) inner.attr('class',itemData.class) - - for (j in itemData.actions) { - var actionData = itemData.actions[j] - var el = $(''+actionData.title+'').appendTo(wrapper) - if (actionData.action) bindAction(el, actionData.action) - - if (actionData.class) el.addClass(actionData.class) - - } - item.appendTo(html) - - } - - return html - -}(data) - -var toggle = function(){ - $(`
        • ${icon('navicon')}
        • `).appendTo('.navigation.main ul').click(function(e){ - var t = 0 - if (!$('#sidepanel').hasClass('sidepanel-open')) t = 250 - - $('#open-toggle, #sidepanel').toggleClass('sidepanel-open') - setTimeout(function(){ - $('#container').toggleClass('sidepanel-open') - $(window).resize() - },t) - }).on('mousedown touchstart',function(e){e.stopPropagation()}) - - // in case where are hot loading a session - if ($('#sidepanel').hasClass('sidepanel-open')) { - $('#open-toggle, #container').addClass('sidepanel-open') - } -} - -module.exports = { - init:function(){ - $('#sidepanel').append(sidepanel) - toggle() - }, - createToggle:toggle -} - -},{"./actions":2,"./utils":13}],12:[function(require,module,exports){ -var actions = require('./actions'), - icon = require('./utils').icon - -var sidepanel = require('./sidepanel').init - -// Tabs... -var tabs = function() { - $('#container').click(function(e){ - var link = e.target - - if (!link.hasAttribute('data-tab') || link.classList.contains('on')) return - - var id = link.getAttribute('data-tab') - - link.classList.add('on') - - var previous = $(link).siblings('.on').removeClass('on').data('tab') - - // TABS[id].tab.appendTo(TABS[id].parent) - TABS[id].parent[0].appendChild(TABS[id].tab[0]) - $(previous).detach() - - - $(id).find('li[data-tab]:first-child, li.parent + li[data-tab]').each(function(){ - if (!$(this).siblings('.on').length) $(this).click() - }) - - $(window).resize() - - }) - $('li[data-tab]').first().click() -} - -// horizontal scrolling & zoom with mousewheel -// if shift is pressed (native), or if there is no vertical scrollbar, -// or if mouse is on h-scrollbar -var scrollbarHeight = 20 -var scrolls = function(){ - $('html').on('mousewheel.zoom',function(e) { - // console.log(e) - if (e.ctrlKey) { - e.preventDefault() - if (e.originalEvent.deltaY==0) return - var d = -e.originalEvent.deltaY/(10*Math.abs(e.originalEvent.deltaY)) - - PXSCALE = parseFloat(d)+parseFloat(PXSCALE) - document.documentElement.style.setProperty("--pixel-scale",'') - document.documentElement.style.setProperty("--pixel-scale",PXSCALE) - - } - }) - $(document).on('keydown.resetzoom', function(e){ - if (e.keyCode==96||e.keyCode==48) { - PXSCALE = INITIALZOOM - document.documentElement.style.setProperty("--pixel-scale",'') - document.documentElement.style.setProperty("--pixel-scale",PXSCALE) - } - }) - -} - - -module.exports = { - init: function(){ - sidepanel() - tabs() - scrolls() - }, - tabs:tabs, - scrolls:scrolls -} - -},{"./actions":2,"./sidepanel":11,"./utils":13}],13:[function(require,module,exports){ -module.exports = { - - createPopup: function(title,content) { - - var popup = $(` - `), - closer = popup.find('.popup-title .closer') - - closer.click(function(){ - popup.close() - }) - - - popup.close = function(){ - $(document).off('.popup') - popup.remove() - } - - popup.find('.popup-content').append(content) - $('body').append(popup) - - $(document).on('keydown.popup', function(e){ - if (e.keyCode==27) popup.close() - }) - - - - return popup - }, - icon: function(i) { - return `` - } - -} - -},{}],14:[function(require,module,exports){ -var widgets = { - // sliders - fader: require('./widgets/sliders/fader'), - knob: require('./widgets/sliders/knob'), - - // buttons - toggle: require('./widgets/toggle'), - switch: require('./widgets/switch'), - push: require('./widgets/push'), - - // pads - xy: require('./widgets/xy'), - rgb: require('./widgets/rgb'), - - // matrices - multitoggle: require('./widgets/multitoggle'), - multipush: require('./widgets/multipush'), - multifader: require('./widgets/multifader'), - - // plots - led: require('./widgets/plots/led'), - plot: require('./widgets/plots/plot'), - eq: require('./widgets/plots/eq'), - visualizer: require('./widgets/plots/visualizer'), - meter: require('./widgets/plots/meter'), - text: require('./widgets/plots/text'), - - // containers - strip: require('./widgets/strip'), - panel: require('./widgets/panel'), -} - -module.exports.categories = { - 'Sliders':['fader','knob'], - 'Buttons':['toggle','push','switch'], - 'Pads':['xy','rgb'], - 'Matrices':['multifader','multitoggle','multipush'], - 'Plots':['plot','eq','visualizer','led','meter','text'], - 'Containers':['panel','strip'] -} - -module.exports.widgetOptions = function(){ - var r = {} - for (i in widgets) { - r[i] = widgets[i].options - } - return r -}() - -module.exports.createWidget = function(){ - var r = {} - for (i in widgets) { - r[i] = widgets[i].create - } - return r -}() - -module.exports.sync = function() { - $('body').off('sync.global').on('sync.global',function(e,id,widget,linkId){ - // Widget that share the same id will update each other - // without sending any extra osc message - if (WIDGETS[id] && WIDGETS[id].length>1) { - var v = widget.getValue() - for (i in WIDGETS[id]) { - if (!WIDGETS[id][i].is(widget) && WIDGETS[id][i].setValue) { - WIDGETS[id][i].setValue(v,false,false) - } - } - } - // widgets that share the same linkId will update each other. - // Updated widgets will send osc messages normally - if (WIDGETS_LINKED[linkId] && WIDGETS_LINKED[linkId].length>1) { - var v = widget.getValue() - for (i in WIDGETS_LINKED[linkId]) { - if (!WIDGETS_LINKED[linkId][i].is(widget) && WIDGETS_LINKED[linkId][i].setValue) { - WIDGETS_LINKED[linkId][i].setValue(v,true,false) - } - } - } - }) -} - -},{"./widgets/multifader":17,"./widgets/multipush":18,"./widgets/multitoggle":19,"./widgets/panel":20,"./widgets/plots/eq":23,"./widgets/plots/led":24,"./widgets/plots/meter":25,"./widgets/plots/plot":26,"./widgets/plots/text":27,"./widgets/plots/visualizer":28,"./widgets/push":29,"./widgets/rgb":30,"./widgets/sliders/fader":32,"./widgets/sliders/knob":33,"./widgets/strip":34,"./widgets/switch":35,"./widgets/toggle":36,"./widgets/xy":38}],15:[function(require,module,exports){ -var _widgets_base = require('./_widgets_base') - -var _canvas_base = module.exports = function() { - - _widgets_base.apply(this,arguments) - - this.canvas = this.widget.find('canvas') - this.ctx = this.canvas[0].getContext('2d') - - this.height = undefined - this.width = undefined - - this.visible = false - - this.colors = {} - this.textColor = getComputedStyle(document.documentElement).getPropertyValue('--color-text-fade') - - - this.canvas.resize(this.resizeHandleProxy.bind(this)) - - -} - - -_canvas_base.prototype = Object.create(_widgets_base.prototype) - -_canvas_base.prototype.constructor = _canvas_base - -_canvas_base.prototype.resizeHandleProxy = function() { - this.resizeHandle.apply(this,arguments) -} - -_canvas_base.prototype.resizeHandle = function(){ - - var width = this.canvas.width(), - height = this.canvas.height() - - if (height==100 && width==100) return - - - this.height=height - this.width=width - - this.canvas[0].setAttribute('width',width) - this.canvas[0].setAttribute('height',height) - - if (!self.visible) { - this.visible = true - this.colors.custom = getComputedStyle(this.widget[0]).getPropertyValue('--color-custom') - this.colors.text = getComputedStyle(this.widget[0]).getPropertyValue('--color-text') - this.colors.raised = getComputedStyle(this.widget[0]).getPropertyValue('--color-raised') - this.colors.bg = getComputedStyle(this.widget[0]).getPropertyValue('--color-bg') - this.colors.fg = getComputedStyle(this.widget[0]).getPropertyValue('--color-fg') - this.colors.faded = getComputedStyle(this.widget[0]).getPropertyValue('--color-faded') - } - - requestAnimationFrame(this.draw.bind(this)) - -} - -_canvas_base.prototype.draw = function(){ - // -} - -},{"./_widgets_base":16}],16:[function(require,module,exports){ -var _widget_base = module.exports = function(widgetData) { - this.widgetData = widgetData -} - -},{}],17:[function(require,module,exports){ -module.exports.options = { - type:'multifader', - id:'auto', - - separator0:'Matrix', - - strips:2, - - separator1:'style', - - label:'auto', - unit:'', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - color:'auto', - compact:false, - css:'', - - - separator2:'osc', - - range:{min:0,max:1}, - logScale:false, - precision:2, - path:'auto', - preArgs:[], - target:[] -} - -module.exports.create = function(widgetData,container) { - - var parsewidgets = require('../parser').widgets - - var widget = $(` -
          -
          \ - `), - $document = $(document) - - widget.value = [] - - for (var i=0;i - \ - `), - $document = $(document) - - widget.value = [] - - for (var i=0;i - \ - `), - $document = $(document) - - widget.value = [] - - for (var i=0;i - - `) - - if (!widgetData.scroll) widget.addClass('noscroll') - - if (widgetData.tabs.length) { - parsetabs(widgetData.tabs,widget) - widget.addClass('has-tabs') - } else { - parsewidgets(widgetData.widgets,widget) - } - return widget -} - -},{"../parser":10}],21:[function(require,module,exports){ -// -// calcBiquad -// -// Dec 14, 2010 njr -// original @ Nigel Redmon - -module.exports = function(options,linear,resolution) { - var {type, freq, q, gain} = options, - Fs = 44100, - a0,a1,a2,b1,b2,norm, - ymin, ymax, minVal, maxVal, - len = resolution - - var V = Math.pow(10, Math.abs(gain) / 20) - var K = Math.tan(Math.PI * freq / Fs) - switch (type) { - case "lowpass": - norm = 1 / (1 + K / q + K * K) - a0 = K * K * norm - a1 = 2 * a0 - a2 = a0 - b1 = 2 * (K * K - 1) * norm - b2 = (1 - K / q + K * K) * norm - break - - case "highpass": - norm = 1 / (1 + K / q + K * K) - a0 = 1 * norm - a1 = -2 * a0 - a2 = a0 - b1 = 2 * (K * K - 1) * norm - b2 = (1 - K / q + K * K) * norm - break - - case "bandpass": - norm = 1 / (1 + K / q + K * K) - a0 = K / q * norm - a1 = 0 - a2 = -a0 - b1 = 2 * (K * K - 1) * norm - b2 = (1 - K / q + K * K) * norm - break - - case "notch": - norm = 1 / (1 + K / q + K * K) - a0 = (1 + K * K) * norm - a1 = 2 * (K * K - 1) * norm - a2 = a0 - b1 = a1 - b2 = (1 - K / q + K * K) * norm - break - - case "peak": - if (gain >= 0) { - norm = 1 / (1 + 1/q * K + K * K) - a0 = (1 + V/q * K + K * K) * norm - a1 = 2 * (K * K - 1) * norm - a2 = (1 - V/q * K + K * K) * norm - b1 = a1 - b2 = (1 - 1/q * K + K * K) * norm - } - else { - norm = 1 / (1 + V/q * K + K * K) - a0 = (1 + 1/q * K + K * K) * norm - a1 = 2 * (K * K - 1) * norm - a2 = (1 - 1/q * K + K * K) * norm - b1 = a1 - b2 = (1 - V/q * K + K * K) * norm - } - break - case "lowshelf": - if (gain >= 0) { - norm = 1 / (1 + Math.SQRT2 * K + K * K) - a0 = (1 + Math.sqrt(2*V) * K + V * K * K) * norm - a1 = 2 * (V * K * K - 1) * norm - a2 = (1 - Math.sqrt(2*V) * K + V * K * K) * norm - b1 = 2 * (K * K - 1) * norm - b2 = (1 - Math.SQRT2 * K + K * K) * norm - } - else { - norm = 1 / (1 + Math.sqrt(2*V) * K + V * K * K) - a0 = (1 + Math.SQRT2 * K + K * K) * norm - a1 = 2 * (K * K - 1) * norm - a2 = (1 - Math.SQRT2 * K + K * K) * norm - b1 = 2 * (V * K * K - 1) * norm - b2 = (1 - Math.sqrt(2*V) * K + V * K * K) * norm - } - break - case "highshelf": - if (gain >= 0) { - norm = 1 / (1 + Math.SQRT2 * K + K * K) - a0 = (V + Math.sqrt(2*V) * K + K * K) * norm - a1 = 2 * (K * K - V) * norm - a2 = (V - Math.sqrt(2*V) * K + K * K) * norm - b1 = 2 * (K * K - 1) * norm - b2 = (1 - Math.SQRT2 * K + K * K) * norm - } - else { - norm = 1 / (V + Math.sqrt(2*V) * K + K * K) - a0 = (1 + Math.SQRT2 * K + K * K) * norm - a1 = 2 * (K * K - 1) * norm - a2 = (1 - Math.SQRT2 * K + K * K) * norm - b1 = 2 * (K * K - V) * norm - b2 = (V - Math.sqrt(2*V) * K + K * K) * norm - } - break - } - - var magPlot = [] - for (var i = 0; i < len; i++) { - var w, phi, y - if (linear) - w = i / (len - 1) * Math.PI; // 0 to pi, linear scale - else - w = Math.exp(Math.log(1 / 0.001) * i / (len - 1)) * 0.001 * Math.PI; // 0.001 to 1, times pi, log scale - - phi = Math.pow(Math.sin(w/2), 2) - - y = Math.log(Math.pow(a0+a1+a2, 2) - 4*(a0*a1 + 4*a0*a2 + a1*a2)*phi + 16*a0*a2*phi*phi) - Math.log(Math.pow(1+b1+b2, 2) - 4*(b1 + 4*b2 + b1*b2)*phi + 16*b2*phi*phi) - y = y * 10 / Math.LN10 - if (y == -Infinity) y = -200 - - if (linear) - magPlot.push([i / (len - 1) * Fs / 2, y]) - else - magPlot.push([i / (len - 1) * Fs / 2, y]) - - if (i == 0) - minVal = maxVal = y - else if (y < minVal) - minVal = y - else if (y > maxVal) - maxVal = y - } - - return magPlot -} - -},{}],22:[function(require,module,exports){ -var {mapToScale} = require('../utils'), - _canvas_base = require('../common/_canvas_base') - -var _plots_base = module.exports = function(){ - - this.widget = $(` -
          - -
          - `) - - _canvas_base.apply(this,arguments) - - this.data = [] - this.linkedWidgets = [] - this.rangeX = this.widgetData.rangeX || {min:0,max:1} - this.rangeY = this.widgetData.rangeY || {min:0,max:1} - this.pips = { - x : { - min: Math.abs(this.rangeX.min)>=1000?this.rangeY.min/1000+'k':this.rangeX.min, - max: Math.abs(this.rangeX.max)>=1000?this.rangeY.max/1000+'k':this.rangeX.max - }, - y : { - min: Math.abs(this.rangeY.min)>=1000?this.rangeY.min/1000+'k':this.rangeY.min, - max: Math.abs(this.rangeY.max)>=1000?this.rangeY.max/1000+'k':this.rangeY.max - } - } - - - $('body').on('sync',this.syncHandleProxy.bind(this)) - -} - -_plots_base.prototype = Object.create(_canvas_base.prototype) - -_plots_base.prototype.constructor = _plots_base - -_plots_base.prototype.syncHandleProxy = function() { - this.syncHandle.apply(this,arguments) -} - -_plots_base.prototype.syncHandle = function(e,id,w) { - if (this.linkedWidgets.indexOf(id)==-1 || !WIDGETS[id]) return - this.updateData() - requestAnimationFrame(this.draw.bind(this)) -} - -_plots_base.prototype.resizeHandle = function(){ - this.updateData() - _canvas_base.prototype.resizeHandle.call(this) -} - -_plots_base.prototype.draw = function() { - - this.ctx.clearRect(0,0,this.width,this.height) - this.ctx.beginPath() - - this.draw_data() - - this.ctx.lineWidth = 1*PXSCALE - this.ctx.strokeStyle = this.colors.custom - this.ctx.stroke() - - this.ctx.font = PXSCALE * 10 + 'px sans-serif' - this.ctx.fillStyle = this.colors.text - - - this.ctx.textBaseline = "bottom" - this.ctx.textAlign = 'left' - this.ctx.fillText(this.pips.x.min,12*PXSCALE,this.height) - this.ctx.textAlign = 'right' - this.ctx.fillText(this.pips.x.max,this.width-10,this.height) - - this.ctx.save() - this.ctx.translate(0, this.height) - this.ctx.rotate(-Math.PI/2) - - this.ctx.textBaseline = "top" - this.ctx.textAlign = 'left' - this.ctx.fillText(this.pips.y.min,12*PXSCALE,2*PXSCALE) - this.ctx.textAlign = 'right' - this.ctx.fillText(this.pips.y.max,this.height-10*PXSCALE,2*PXSCALE) - this.ctx.rotate(Math.PI/2) - this.ctx.restore() - -} - -_plots_base.prototype.draw_data = function() { - var first = true - var point = [] - for (i in this.data) { - - if (this.data[i][1]>this.rangeY.max || this.data[i][1]this.rangeX.max || this.data[i][0] -
          - - `), - led = widget.find('span'), - range = widgetData.range - - widget.setValue = function(v,send,sync){ - if (typeof v != 'number') return - led.css('opacity',mapToScale(v,[range.min,range.max],[0,1],widgetData.precision,widgetData.logScale,true)) - } - - widget.setValue(range.min) - - return widget -} - -},{"../utils":37}],25:[function(require,module,exports){ -var {mapToScale, clip} = require('../utils') - -module.exports.options = { - type:'fader', - id:'auto', - - separator1:'style', - - label:'auto', - unit:'', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - horizontal:false, - color:'auto', - css:'', - - separator3:'osc', - - range:{min:0,max:1}, - logScale:false, - path:'auto', - preArgs:[] -} - -module.exports.create = function(widgetData,container) { - var widget = $(` -
          -
          -
          - `), - level = widget.find('.level'), - logScale = widgetData.logScale, - dimension = widgetData.horizontal?'width':'height', - axe = dimension=='height'?'X':'Y' - - - if (widgetData.horizontal) widget.addClass('horizontal') - - - var rangeKeys = [], - rangeVals = [] - - for (k in widgetData.range) { - var key = k=='min'?0:k=='max'?100:parseInt(k), - val = typeof widgetData.range[k] == 'object'? - widgetData.range[k][Object.keys(widgetData.range[k])[0]]: - widgetData.range[k] - - rangeKeys.push(key) - rangeVals.push(val) - } - - - - widget.updateUi = function(v){ - var s = v/100, - t = dimension=='height'? - '1,'+s+',1' - :s+',1,1' - level[0].setAttribute('style','transform:scale3d('+t+')') - } - - - widget.setValue = function(v) { - if (typeof v != 'number') return - - var h, - v=clip(v,[rangeVals[0],rangeVals.slice(-1)[0]]) - for (var i=0;i= rangeVals[i]) { - h = mapToScale(v,[rangeVals[i],rangeVals[i+1]],[rangeKeys[i],rangeKeys[i+1]],2,logScale,true) - break - } - } - - widget.updateUi(h) - - } - - widget.setValue(rangeVals[0]) - - return widget -} - -},{"../utils":37}],26:[function(require,module,exports){ -var {mapToScale} = require('../utils'), - _plots_base = require('./_plots_base') - -module.exports.options = { - type:'plot', - id:'auto', - - separator1:'style', - - label:'auto', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - color:'auto', - css:'', - - separator2:'plot', - - points:[], - rangeX: {min:0,max:1}, - rangeY: {min:0,max:1}, - logScaleX: false, - logScaleY: false, - - separator3:'osc', - - path:'auto', - preArgs:[], - -} - -var Plot = function(widgetData) { - - _plots_base.call(this,widgetData) - - if (typeof widgetData.points=='string') { - - this.linkedWidgets.push(widgetData.points) - - } else if (typeof widgetData.points=='object') { - - for (i in widgetData.points) { - for (j in widgetData.points[i]) { - if (typeof widgetData.points[i][j] == 'string') { - this.linkedWidgets.push(widgetData.points[i][j]) - } - } - } - } - - this.updateData = function(){ - var data = [], - points = widgetData.points - - if (typeof points=='string' && WIDGETS[points]) { - - data = WIDGETS[points][WIDGETS[points].length-1].getValue() - - } else if (typeof points=='object') { - - for (i in points) { - - data[i] = [] - for (k in [0,1]) { - if (typeof points[i][k] == 'string' && WIDGETS[points[i][k]]) { - data[i][k] = WIDGETS[points[i][k]][WIDGETS[points[i][k]].length-1].getValue() - } else { - data[i][k] = points[i][k] - } - } - - } - - } - - if (data.length) this.data = data - } -} - -Plot.prototype = Object.create(_plots_base.prototype) - -Plot.prototype.constructor = Plot - -module.exports.create = function(widgetData) { - var plot = new Plot(widgetData) - return plot.widget -} - -},{"../utils":37,"./_plots_base":22}],27:[function(require,module,exports){ -module.exports.options = { - type:'text', - id:'auto', - - separator1:'style', - - label:'auto', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - vertical:false, - color:'auto', - css:'', - - separator2:'osc', - - preArgs:[], - path:'auto', - defaultText:'' -} -module.exports.create = function(widgetData,container) { - var widget = $(` -
          -
          - `), - label = widgetData.defaultText!==''? - widgetData.defaultText: - widgetData.label===false? - widgetData.id: - widgetData.label=='auto'? - widgetData.id: - widgetData.label, - text = label - - - if (widgetData.vertical) widget.addClass('vertical') - - widget.setValue = function(v,send,sync){ - text = typeof v=='object' && !v.length?label:v - widget.text(text) - } - - widget.getValue = function(){ - return text - } - - widget.setValue(label) - - return widget -} - -},{}],28:[function(require,module,exports){ -var {mapToScale, clip} = require('../utils'), - _plots_base = require('./_plots_base') - -module.exports.options = { - type:'visualizer', - id:'auto', - - separator1:'style', - - label:'auto', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - color:'auto', - css:'', - - separator2:'plot', - - widgetId:'', - duration:1, - range: {min:0,max:1}, - logScale: false, - - separator3:'osc', - - path:'auto', - preArgs:[], -} - -var Visualizer = function(widgetData) { - - _plots_base.call(this,widgetData) - - this.pips.y.min = Math.abs(widgetData.range.min)>=1000?widgetData.range.min/1000+'k':widgetData.range.min - this.pips.y.max = Math.abs(widgetData.range.max)>=1000?widgetData.range.max/1000+'k':widgetData.range.max - this.pips.x.min = '' - this.pips.x.max = '' - this.length = Math.round(clip(60*widgetData.duration,[8,4096])) - this.data = new Array(this.length) - this.value = widgetData.range.min - this.cancel = false - this.loop = false - -} - -Visualizer.prototype = Object.create(_plots_base.prototype) - -Visualizer.prototype.constructor = Visualizer - -Visualizer.prototype.syncHandle = function(e,id,w) { - if (this.widgetData.widgetId!=id || !WIDGETS[id]) return - this.startLoop() -} - -Visualizer.prototype.startLoop = function(){ - - if (this.cancel) clearTimeout(this.cancel) - - this.cancel = setTimeout(function(){ - clearInterval(this.loop) - this.loop = false - this.cancel = false - },1000*this.widgetData.duration) - - if (this.loop) return - - this.loop = setInterval(function(){ - this.updateData() - this.draw() - }.bind(this),1000*this.widgetData.duration/this.length) -} - - -Visualizer.prototype.draw_data = function(){ - - var first = true - var point = [] - - for (var i=this.length-1;i>=0;i=i-1) { - var newpoint = [ - mapToScale(i,[0,this.length-1],[15*PXSCALE,this.width-15*PXSCALE],1), - mapToScale(this.data[i],[this.widgetData.range.min,this.widgetData.range.max],[this.height-15*PXSCALE,15*PXSCALE],1,this.widgetData.logScale,true), - ] - if (first) { - this.ctx.moveTo(newpoint[0],newpoint[1]) - first = false - } else { - if (this.widgetData.logScale) { - this.ctx.quadraticCurveTo(newpoint[0], point[1], newpoint[0], newpoint[1]) - } else { - this.ctx.lineTo(newpoint[0],newpoint[1]) - } - - } - point = newpoint - } - -} - - -Visualizer.prototype.updateData = function(){ - var id = this.widgetData.widgetId - - if (typeof id == 'string' && WIDGETS[id]) { - var v = WIDGETS[id][WIDGETS[id].length-1].getValue() - this.data.push(v) - this.value = v - } else { - this.data.push(this.value) - } - - this.data.splice(0,1) - -} - -Visualizer.prototype.setValue = function(v) { - this.value = v - this.startLoop() -} - - -module.exports.create = function(widgetData,container) { - var visualizer = new Visualizer(widgetData) - return visualizer.widget -} - -},{"../utils":37,"./_plots_base":22}],29:[function(require,module,exports){ -var sendOsc = require('./utils').sendOsc - -module.exports.options = { - type:'push', - id:'auto', - linkId:'', - - separator1:'style', - - label:'auto', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - color:'auto', - css:'', - - separator2:'osc', - - on:1, - off:0, - precision:2, - path:'auto', - preArgs:[], - target:[] -} -module.exports.create = function(widgetData,container) { - - - var widget = $(` -
          -
          \ - `), - $document = $(document) - - widget.value = widget.find('span') - widget.state = 0 - widget.active = 0 - widget.lastChanged = 'state' - - widget.on('drag',function(e){e.stopPropagation()}) - widget.on('draginit.push',function(){ - widget.off('draginit.push') - widget.fakeclick() - }) - - widget.fakeclick = function(){ - if (!widget.active) widget.setValuePrivate(widgetData.on,true,true) - $document.on('dragend.push',function(){ - widget.setValuePrivate(widgetData.off,true,true) - $document.off('dragend.push') - widget.on('draginit.push',function(){ - widget.off('draginit.push') - widget.fakeclick() - }) - }) - } - - widget.getValue = function() { - return widget[widget.lastChanged]?widgetData.on:widgetData.off - } - - widget.setValuePrivate = function(v,send,sync) { - if (v===widgetData.on || (v=='false'&&widgetData.on===false)) { - widget.addClass('active') - widget.active = 1 - if (send) widget.sendValue(v) - widget.lastChanged = 'active' - if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } else if (v===widgetData.off || (v=='false'&&widgetData.off===false)) { - widget.removeClass('active') - widget.active = 0 - if (send) widget.sendValue(v) - widget.lastChanged = 'active' - if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - } - - widget.setValue = function(v,send,sync) { - if (v===widgetData.on || (v=='false'&&widgetData.on===false)) { - widget.addClass('on') - widget.state = 1 - if (send) widget.sendValue(v) - widget.lastChanged = 'state' - if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } else if (v===widgetData.off || (v=='false'&&widgetData.off===false)) { - widget.removeClass('on') - widget.state = 0 - if (send) widget.sendValue(v) - widget.lastChanged = 'state' - if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - } - - widget.sendValue = function(v) { - if (v===false) return - var args = widgetData.preArgs.concat(v) - sendOsc({ - target:widgetData.target, - path:widgetData.path, - precision:widgetData.precision, - args:args - }) - } - widget.setValue() - return widget -} - -},{"./utils":37}],30:[function(require,module,exports){ -var utils = require('./utils'), - clip = utils.clip, - mapToScale = utils.mapToScale, - hsbToRgb = utils.hsbToRgb, - rgbToHsb = utils.rgbToHsb, - sendOsc = utils.sendOsc - -module.exports.options = { - type:'rgb', - id:'auto', - linkId:'', - - separator1:'style', - - label:'auto', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - css:'', - - separator2:'behaviour', - - snap:false, - - separator3:'osc', - - precision:0, - path:'auto', - preArgs:[], - split:false, - target:[] -} -module.exports.create = function(widgetData,container) { - - var widget = $(` -
          -
          -
          -
          -
          -
          -
          -
          -
          -
          -
          R
          G
          B
          -
          -
          -
          `), - rgbHandle = widget.find('.rgb .handle'), - hueHandle = widget.find('.hue .handle'), - pad = widget.find('.xy'), - huePad = widget.find('.hue'), - rgbBg = pad.find('.bg')[0], - value = {r:widget.find('.r').fakeInput({align:'center'}),g:widget.find('.g').fakeInput({align:'center'}),b:widget.find('.b').fakeInput({align:'center'})}, - snap = widgetData.snap, - split = widgetData.split? - typeof widgetData.split == 'object'? - widgetData.split:{r:widgetData.path+'/r',g:widgetData.path+'/g',b:widgetData.path+'/b'} - :false - - - pad.width = 0 - pad.height = 0 - rgbHandle.height = 0 - rgbHandle.width = 0 - hueHandle.width = 0 - widget.value = undefined - - pad.resize(function(){ - var width = pad.innerWidth(), - height = pad.innerHeight() - if (!width || (pad.height==height && pad.width==width)) return - pad.width = width - pad.height = height - rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*rgbHandle.width/100}px, -${pad.height*rgbHandle.height/100}px,0)`) - - }) - - - var rgbOff = {x:0,y:0} - pad.on('draginit',function(e,data,traversing){ - if (snap || traversing) { - - var h = ((pad.height-data.offsetY) * 100 / pad.height), - w = (data.offsetX * 100 / pad.width) - - rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) - rgbHandle.height = h - rgbHandle.width = w - - var v = widget.getValue() - - if (vwidget.value) { - widget.value = v - - widget.sendValue(v) - widget.showValue(v) - - widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - - } - - rgbOff = {x:rgbHandle.width,y:rgbHandle.height} - - }) - pad.on('drag',function(e,data){ - - var h = clip((-data.deltaY)*100/pad.height+rgbOff.y,[0,100]), - w = clip(data.deltaX*100/pad.width+rgbOff.x,[0,100]) - - rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) - rgbHandle.height = h - rgbHandle.width = w - - var v = widget.getValue() - - if (vwidget.value) { - widget.value = v - - widget.sendValue(v) - widget.showValue(v) - - widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - - }) - - - var hueOff = 0 - huePad.on('draginit',function(e,data,traversing){ - if (snap || traversing) { - - var d = (data.offsetX * 100 / pad.width) - hueHandle[0].setAttribute('style',`transform:translate3d(${pad.width*d/100}px,0,0)`) - hueHandle.width = d - - - var h = clip(hueHandle.width*3.6,[0,360]), - rgb = hsbToRgb({h:h,s:100,b:100}) - - rgbBg.setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')') - - var v = widget.getValue() - - if (vwidget.value) { - widget.value = v - - widget.sendValue(v) - widget.showValue(v) - - widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - - } - - hueOff = hueHandle.width - - }) - - - huePad.on('drag',function(e,data){ - - var w = clip(data.deltaX*100/pad.width+hueOff,[0,100]) - hueHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px,0,0)`) - hueHandle.width = w - - var h = clip(hueHandle.width*3.6,[0,360]), - rgb = hsbToRgb({h:h,s:100,b:100}) - - rgbBg.setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')') - - var v = widget.getValue() - - if (vwidget.value) { - widget.value = v - - widget.sendValue(v) - widget.showValue(v) - - widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - - }) - - - - - - widget.getValue = function() { - var s = clip(rgbHandle.width,[0,100]), - l = clip(rgbHandle.height,[0,100]), - h = mapToScale(hueHandle.width,[0,100],[0,360],widgetData.precision), - rgb = hsbToRgb({h:h,s:s,b:l}) - return [rgb.r,rgb.g,rgb.b] - } - widget.setValue = function(v,send,sync) { - if (!v || v.length!=3) return - - for (i in [0,1,2]) { - v[i] = clip(v[i],[0,255]) - } - - - var hsb = rgbToHsb({r:v[0],g:v[1],b:v[2]}) - - var w = mapToScale(hsb.s,[0,100],[0,100],false), - h = mapToScale(hsb.b,[0,100],[0,100],false), - hueW = mapToScale(hsb.h,[0,360],[0,100],false) - - rgbHandle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) - hueHandle[0].setAttribute('style',`transform:translate3d(${pad.width*hueW/100}px,0,0)`) - - rgbHandle.height = h - rgbHandle.width = w - hueHandle.width = hueW - widget.value = v - - - var rgb = hsbToRgb({h:hsb.h,s:100,b:100}) - rgbBg.setAttribute('style','background-color:rgb('+rgb.r+','+rgb.g+','+rgb.b+')') - - widget.showValue(v) - - - - if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - if (send) widget.sendValue(v) - } - widget.sendValue = function(v) { - var args = widgetData.preArgs.concat(v) - - sendOsc({ - target:split?false:widgetData.target, - path:widgetData.path, - args:args, - precision:widgetData.precision, - }) - if (split) { - sendOsc({ - target:widgetData.target, - path:split.r, - args:widgetData.preArgs.concat(v[0]), - precision:widgetData.precision, - sync:false - }) - sendOsc({ - target:widgetData.target, - path:split.g, - args:widgetData.preArgs.concat(v[1]), - precision:widgetData.precision, - sync:false - }) - sendOsc({ - target:widgetData.target, - path:split.b, - args:widgetData.preArgs.concat(v[2]), - precision:widgetData.precision, - sync:false - }) - } - } - - - - widget.showValue = function(v) { - value.r.val(v[0]) - value.g.val(v[1]) - value.b.val(v[2]) - } - value.r.change(function(){ - var r = clip(value.r.val(),[0,255]) - var v = widget.getValue() - widget.setValue([r,v[1],v[2]],true,true) - }) - value.g.change(function(){ - var g = clip(value.g.val(),[0,255]) - var v = widget.getValue() - widget.setValue([v[0],g,v[2]],true,true) - }) - value.b.change(function(){ - var b = clip(value.b.val(),[0,255]) - var v = widget.getValue() - widget.setValue([v[0],v[1],b],true,true) - }) - - widget.setValue([0,0,0]) - - return widget -} - -},{"./utils":37}],31:[function(require,module,exports){ -var {clip, roundTo, mapToScale, sendOsc} = require('../utils') -var _canvas_base = require('../common/_canvas_base') - -var _sliders_base = module.exports = function(){ - - this.widget = $(` -
          -
          - -
          -
          -
          - `) - - _canvas_base.apply(this, arguments) - - this.wrapper = this.widget.find('.wrapper') - this.input = this.widget.find('.input').fakeInput({align:'center'}) - this.roundFactor = Math.pow(10,this.widgetData.precision) - this.value = undefined - this.percent = 0 - - this.unit = this.widgetData.unit ? ' ' + this.widgetData.unit : '' - - - this.rangeKeys = [] - this.rangeVals = [] - this.rangeLabels = [] - - for (k in this.widgetData.range) { - var key = k=='min'?0:k=='max'?100:parseInt(k), - val = typeof this.widgetData.range[k] == 'object'? - this.widgetData.range[k][Object.keys(this.widgetData.range[k])[0]]: - this.widgetData.range[k], - label = typeof this.widgetData.range[k] == 'object'? - Object.keys(this.widgetData.range[k])[0]: - val - - this.rangeKeys.push(key) - this.rangeVals.push(val) - this.rangeLabels.push(label) - } - this.rangeValsMax = Math.max.apply(Math, this.rangeVals), - this.rangeValsMin = Math.min.apply(Math, this.rangeVals) - - this.originValue = this.widgetData.origin=='auto'? - this.rangeValsMin: - clip(this.widgetData.origin,[this.rangeValsMin,this.rangeValsMax]) - - - - this.widget.on('fake-right-click',function(e){ - if (!EDITING) { - e.stopPropagation() - e.preventDefault() - this.input.focus() - } - }.bind(this)) - - this.widget.on('mousewheel',this.mousewheelHandleProxy.bind(this)) - this.canvas.on('draginit',this.draginitHandleProxy.bind(this)) - this.canvas.on('drag',this.dragHandleProxy.bind(this)) - - this.input.change(function(){ - this.widget.setValue(parseFloat(this.input.val()),true,true) - }.bind(this)) - - this.widget.getValue = function(){ - return this.value - }.bind(this) - - this.widget.setValue = this.setValue.bind(this) - - this.setValue(this.originValue) - -} - -_sliders_base.prototype = Object.create(_canvas_base.prototype) - -_sliders_base.prototype.constructor = _sliders_base - - -_sliders_base.prototype.mousewheelHandleProxy = function() { - this.mousewheelHandle.apply(this,arguments) -} - -_sliders_base.prototype.draginitHandleProxy = function() { - this.draginitHandle.apply(this,arguments) -} - -_sliders_base.prototype.dragHandleProxy = function() { - this.dragHandle.apply(this,arguments) -} - - -_sliders_base.prototype.mousewheelHandle = function(e, data, traversing) { - if (e.originalEvent.wheelDeltaX) return - - e.preventDefault() - e.stopPropagation() - - var direction = e.originalEvent.wheelDelta / Math.abs(e.originalEvent.wheelDelta), - increment = e.ctrlKey?0.25:1 - - this.percent = clip(this.percent + Math.max(increment,10/Math.pow(10,this.widgetData.precision)) * direction ,[0,100]) - - this.setValue(this.percentToValue(this.percent), true, true) - - -} - -_sliders_base.prototype.draginitHandle = function(e, data, traversing) { - -} - -_sliders_base.prototype.dragHandle = function(e, data, traversing) { - -} - - -_sliders_base.prototype.resizeHandle = function() { - if (!self.visible) { - this.colors.track = getComputedStyle(this.widget[0]).getPropertyValue('--color-track') - this.colors.gauge = getComputedStyle(this.widget[0]).getPropertyValue('--color-gauge') - this.colors.knob = getComputedStyle(this.widget[0]).getPropertyValue('--color-knob') - } - _canvas_base.prototype.resizeHandle.call(this) -} - - -_sliders_base.prototype.percentToValue = function(percent) { - var h = clip(percent,[0,100]) - for (var i=0;i= this.rangeKeys[i]) { - return mapToScale(h,[this.rangeKeys[i],this.rangeKeys[i+1]],[this.rangeVals[i],this.rangeVals[i+1]],false,this.widgetData.logScale) - } - } -} -_sliders_base.prototype.valueToPercent = function(value) { - for (var i=0;i= this.rangeVals[i]) { - return mapToScale(value,[this.rangeVals[i],this.rangeVals[i+1]],[this.rangeKeys[i],this.rangeKeys[i+1]],false,this.widgetData.logScale,true) - } - } -} - -_sliders_base.prototype.setValue = function(v,send,sync, dragged) { - if (typeof v != 'number') return - - var value = roundTo(clip(Math.round(v*this.roundFactor)/this.roundFactor,[this.rangeValsMin,this.rangeValsMax]),this.widgetData.precision) - - if (dragged && this.value == value) send = false - - this.value = value - - if (!dragged) this.percent = this.valueToPercent(this.value) - - this.draw() - - this.showValue() - - if (sync) this.widget.trigger('sync',[this.widgetData.id,this.widget,this.widgetData.linkId]) - if (send) this.sendValue(v) -} - -_sliders_base.prototype.sendValue = function(value) { - var args = this.widgetData.preArgs.concat(value) - - sendOsc({ - target:this.widgetData.target, - path:this.widgetData.path, - precision:this.widgetData.precision, - args:args - }) - -} - -_sliders_base.prototype.showValue = function() { - this.input.val(this.value + this.unit) -} - -},{"../common/_canvas_base":15,"../utils":37}],32:[function(require,module,exports){ -var {clip, mapToScale, sendOsc} = require('../utils'), - _sliders_base = require('./_sliders_base') - - -module.exports.options = { - type:'fader', - id:'auto', - linkId:'', - - separator1:'style', - - label:'auto', - unit:'', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - alignRight:false, - horizontal:false, - noPip:false, - compact:false, - color:'auto', - css:'', - - separator2:'behaviour', - - snap:false, - - separator3:'osc', - - range:{min:0,max:1}, - origin: 'auto', - logScale:false, - precision:2, - meter:false, - path:'auto', - preArgs:[], - target:[] -} - -var Fader = function(widgetData){ - - _sliders_base.apply(this,arguments) - this.widget.addClass('fader') - this.margin = 20 - - - if (widgetData.horizontal) { - this.widget.addClass('horizontal') - } - - if (widgetData.compact) { - this.widget.addClass('compact') - this.margin = 0 - } - - if (widgetData.alignRight && !widgetData.horizontal) { - this.widget.addClass('align-right') - } - - if (!widgetData.noPip&&!widgetData.compact) { - - this.widget.addClass('has-pips') - - var pips = $('
          ').appendTo(this.widget.find('.wrapper')) - var pipTexts = {} - for (k in this.rangeKeys) { - pipTexts[this.rangeKeys[k]]=this.rangeLabels[k] - } - - var pipsInner = '' - for (var i=0;i<=100;i++) { - if (pipTexts[i]==undefined) continue - - var pos = widgetData.horizontal?'left':'bottom'; - - var piptext = `${Math.abs(pipTexts[i])>=1000?pipTexts[i]/1000+'k':pipTexts[i]}` - - var add = ` -
          ${piptext}
          - ` - pipsInner = pipsInner + add - } - pips[0].innerHTML = pipsInner - } - - - if (widgetData.meter) { - var parsewidgets = require('../../parser').widgets - var data = { - type:'meter', - id: widgetData.id + '/meter', - label:false, - horizontal:widgetData.horizontal, - range:widgetData.range, - logScale:widgetData.logScale, - path:widgetData.path + '/meter', - preArgs:widgetData.preArgs, - color:widgetData.color - } - var element = parsewidgets([data],this.widget.find('.wrapper')) - element[0].classList.add('not-editable') - this.widget[0].classList.add('has-meter') - } - - - -} - -Fader.prototype = Object.create(_sliders_base.prototype) - -Fader.prototype.constructor = Fader - -Fader.prototype.draginitHandle = function(e, data, traversing){ - - this.percent = clip(this.percent,[0,100]) - - if (!(traversing || this.widgetData.snap)) return - - this.percent = this.widgetData.horizontal? - (data.offsetX - this.margin * PXSCALE) / (this.width - (this.margin * PXSCALE * 2)) * 100: - (this.height - data.offsetY - this.margin * PXSCALE) / (this.height - (this.margin * PXSCALE * 2)) * 100 - - // this.percent = clip(this.percent,[0,100]) - - this.setValue(this.percentToValue(this.percent), true, true, true) - -} - -Fader.prototype.dragHandle = function(e, data) { - - this.percent = this.widgetData.horizontal? - this.percent + ( data.speedX/(this.width - this.margin * PXSCALE * 2)) * 100: - this.percent + (-data.speedY/(this.height - this.margin * PXSCALE * 2)) * 100 - - this.setValue(this.percentToValue(this.percent), true, true, true) - -} - -Fader.prototype.percentToCoord = function(percent) { - if (this.widgetData.horizontal) { - return clip(percent / 100,[0,1]) * (this.width - 2 * PXSCALE * this.margin) - } else { - return (this.height - this.margin * PXSCALE) - clip(percent / 100, [0,1]) * (this.height - 2 * PXSCALE * this.margin) - - } -} - - -Fader.prototype.draw = function(){ - - var d = this.percentToCoord(this.percent), - o = this.percentToCoord(this.valueToPercent(this.originValue)) - - this.ctx.clearRect(0,0,this.width,this.height) - - if (this.widgetData.horizontal) { - if (this.widgetData.compact) { - - - this.ctx.save() - this.ctx.globalAlpha = 0.3 - this.ctx.strokeStyle = this.colors.gauge - this.ctx.beginPath() - this.ctx.moveTo(d, this.height / 2) - this.ctx.lineTo(o, this.height / 2) - this.ctx.lineWidth = this.height - this.ctx.stroke() - this.ctx.restore() - - this.ctx.beginPath() - this.ctx.fillStyle = this.colors.knob - this.ctx.rect(Math.min(d,this.width-PXSCALE), 0, PXSCALE, this.height) - this.ctx.fill() - - - } else { - - this.ctx.beginPath() - this.ctx.fillStyle = this.colors.track - this.ctx.rect(this.margin * PXSCALE, this.height / 2 - 1 * PXSCALE, this.width - this.margin * 2 * PXSCALE, 2 * PXSCALE) - this.ctx.fill() - - this.ctx.beginPath() - this.ctx.strokeStyle = this.colors.gauge - this.ctx.moveTo(d + this.margin * PXSCALE, this.height / 2) - this.ctx.lineTo(o + this.margin * PXSCALE, this.height / 2) - this.ctx.lineWidth = 2 * PXSCALE - this.ctx.stroke() - - this.ctx.fillStyle = this.colors.knob - - this.ctx.save() - this.ctx.globalAlpha = 0.3 - this.ctx.arc(d + this.margin * PXSCALE, this.height / 2, 10 * PXSCALE, Math.PI * 2) - this.ctx.fill() - this.ctx.restore() - - this.ctx.beginPath() - this.ctx.arc(d + this.margin * PXSCALE, this.height / 2, 4 * PXSCALE, Math.PI * 2) - this.ctx.fill() - } - - - } else { - - if (this.widgetData.compact) { - - - this.ctx.save() - this.ctx.globalAlpha = 0.3 - this.ctx.strokeStyle = this.colors.gauge - this.ctx.beginPath() - this.ctx.moveTo(this.width / 2, d) - this.ctx.lineTo(this.width / 2, o) - this.ctx.lineWidth = this.width - this.ctx.stroke() - this.ctx.restore() - - this.ctx.beginPath() - this.ctx.fillStyle = this.colors.knob - this.ctx.rect(0, Math.min(d, this.height - PXSCALE), this.width, PXSCALE) - this.ctx.fill() - - - } else { - - this.ctx.beginPath() - this.ctx.fillStyle = this.colors.track - this.ctx.rect(this.width / 2 - 1 * PXSCALE, this.margin * PXSCALE, 2 * PXSCALE, this.height - this.margin *2 * PXSCALE) - this.ctx.fill() - - this.ctx.beginPath() - this.ctx.strokeStyle = this.colors.gauge - this.ctx.moveTo(this.width / 2, d) - this.ctx.lineTo(this.width / 2, o) - this.ctx.lineWidth = 2 * PXSCALE - this.ctx.stroke() - - - this.ctx.beginPath() - this.ctx.fillStyle = this.colors.knob - this.ctx.save() - this.ctx.globalAlpha = 0.3 - this.ctx.arc(this.width / 2, d, 10 * PXSCALE, Math.PI * 2,false) - this.ctx.fill() - this.ctx.restore() - - this.ctx.beginPath() - this.ctx.arc(this.width / 2, d, 4 * PXSCALE, Math.PI * 2,false) - this.ctx.fill() - } - } -} - -module.exports.create = function(widgetData,container) { - - var fader = new Fader(widgetData, container) - return fader.widget -} - -},{"../../parser":10,"../utils":37,"./_sliders_base":31}],33:[function(require,module,exports){ -var {clip, mapToScale, sendOsc} = require('../utils'), - _sliders_base = require('./_sliders_base') - - -module.exports.options = { - type:'knob', - id:'auto', - linkId:'', - - separator1:'style', - - label:'auto', - unit:'', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - color:'auto', - noPip:false, - compact:false, - angle:270, - css:'', - - separator2:'behaviour', - - snap:false, - - separator3:'osc', - - range:{min:0,max:1}, - origin: 'auto', - logScale:false, - precision:2, - path:'auto', - preArgs:[], - target:[] -} - - - -Knob = function(widgetData) { - - _sliders_base.apply(this,arguments) - - this.widget.addClass('knob') - - this.margin = 5 - - if (widgetData.compact) { - this.widget.addClass('compact') - this.margin = 0 - } - - this.lastOffsetX = 0 - this.lastOffsetY = 0 - this.minDimension = 0 - - this.maxAngle = widgetData.angle - - // calculate lost height factor - var a = Math.sin((360 - this.maxAngle)), - h = a < 0 ? 1 - a : a - - this.lostHeightFactor = h / 4 - -} - - -Knob.prototype = Object.create(_sliders_base.prototype) - -Knob.prototype.constructor = Knob - -Knob.prototype.draginitHandle = function(e, data, traversing){ - - this.percent = clip(this.percent,[0,100]) - - this.lastOffsetX = data.offsetX - this.lastOffsetY = data.offsetY - - if (!(traversing || this.widgetData.snap)) return - - this.percent = this.angleToPercent(this.coordsToAngle(data.offsetX, data.offsetY)) - - this.setValue(this.percentToValue(this.percent), true, true, true) - -} - -Knob.prototype.dragHandle = function(e, data, traversing) { - - - if (!(traversing || this.widgetData.snap)) { - - this.percent = -data.speedY + this.percent - - } else { - - this.lastOffsetX = this.lastOffsetX + data.speedX - this.lastOffsetY = this.lastOffsetY + data.speedY - this.percent = this.angleToPercent(this.coordsToAngle(this.lastOffsetX, this.lastOffsetY)) - } - - this.percent = this.percent,[0,100] - - this.setValue(this.percentToValue(this.percent), true, true, true) - -} - -Knob.prototype.coordsToAngle = function(x,y) { - var xToCenter = x - this.width /2, - yToCenter = y - this.height / 2, - angle = Math.atan2(-yToCenter, -xToCenter) * 180 / Math.PI + 90 - - return angle<0?360+angle:angle -} - -Knob.prototype.angleToPercent = function(angle) { - return clip(angle - (360 - this.maxAngle) / 2, [0, this.maxAngle]) / this.maxAngle * 100 -} - -Knob.prototype.percentToAngle = function(percent) { - var percent = clip(percent, [0, 100]) - return 2 * Math.PI * percent / 100 * (this.maxAngle / 360) // angle relative to maxAngle - + Math.PI / 2 // quarter circle offset - + Math.PI * (1 - this.maxAngle / 360) // centering offset depending on maxAngle -} - -Knob.prototype.resizeHandle = function() { - _sliders_base.prototype.resizeHandle.call(this) - this.minDimension = Math.min(this.width, this.height) - this.canvas[0].style.top = (this.minDimension / 2 - 15) * this.lostHeightFactor + 'px' - if (this.widgetData.compact) { - this.input[0].style.marginTop = (this.minDimension / 2 - 15) * this.lostHeightFactor + 'px' - - } -} - - -Knob.prototype.draw = function(){ - - var o = this.percentToAngle(this.valueToPercent(this.originValue)), - d = this.percentToAngle(this.percent), - min = this.percentToAngle(0), - max = this.percentToAngle(100) - - this.ctx.clearRect(0,0,this.width,this.height) - - if (this.widgetData.compact) { - - this.ctx.lineWidth = 10 * PXSCALE - this.ctx.beginPath() - this.ctx.strokeStyle = this.colors.track - this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - (10 + this.margin) * PXSCALE, min, max) - this.ctx.stroke() - - this.ctx.save() - this.ctx.globalAlpha = 0.5 - this.ctx.beginPath() - this.ctx.strokeStyle = this.colors.gauge - this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - (10 + this.margin) * PXSCALE, Math.min(o,d), Math.max(o,d)) - this.ctx.stroke() - this.ctx.restore() - - - this.ctx.save() - - this.ctx.translate(this.width / 2, this.height / 2) - this.ctx.rotate(d) - this.ctx.translate(-this.width / 2, -this.height / 2) - - this.ctx.beginPath() - - this.ctx.strokeStyle = this.colors.knob - this.ctx.lineWidth = 1 * PXSCALE - this.ctx.moveTo(this.width / 2 + this.minDimension / 2 - (10 + this.margin - 5) * PXSCALE, this.height / 2) - this.ctx.lineTo(this.width / 2 + this.minDimension / 2 - (10 + this.margin + 5) * PXSCALE, this.height / 2) - this.ctx.stroke() - - this.ctx.restore() - - - } else { - - this.ctx.beginPath() - this.ctx.fillStyle = this.colors.raised - this.ctx.arc(this.width / 2, this.height / 2, Math.max(this.minDimension / 2 - (30 + this.margin) * PXSCALE, 2 * PXSCALE), 0, Math.PI * 2) - this.ctx.fill() - - this.ctx.lineWidth = 2 * PXSCALE - this.ctx.beginPath() - this.ctx.strokeStyle = this.colors.track - this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - (10 + this.margin) * PXSCALE, min, max) - this.ctx.stroke() - - - this.ctx.beginPath() - this.ctx.strokeStyle = this.colors.gauge - this.ctx.arc(this.width / 2, this.height / 2, this.minDimension / 2 - (10 + this.margin) * PXSCALE, Math.min(o,d), Math.max(o,d)) - this.ctx.stroke() - - this.ctx.save() - - this.ctx.translate(this.width / 2, this.height / 2) - this.ctx.rotate(d) - this.ctx.translate(-this.width / 2, -this.height / 2) - - this.ctx.beginPath() - - this.ctx.fillStyle = this.colors.knob - this.ctx.arc(this.width / 2 + this.minDimension / 2 - (10 + this.margin) * PXSCALE, this.height / 2, 4 * PXSCALE, 0, Math.PI * 2) - this.ctx.fill() - - this.ctx.globalAlpha = 0.3 - this.ctx.fillStyle = this.colors.knob - this.ctx.arc(this.width / 2 + this.minDimension / 2 - (10 + this.margin) * PXSCALE, this.height / 2, 10 * PXSCALE, 0, Math.PI * 2) - this.ctx.fill() - - this.ctx.restore() - } - - - -} - - -module.exports.create = function(widgetData) { - var knob = new Knob(widgetData) - return knob.widget -} - -},{"../utils":37,"./_sliders_base":31}],34:[function(require,module,exports){ - -module.exports.options = { - type:'strip', - id:'auto', - - separator1:'style', - - label:'auto', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - horizontal:false, - color:'auto', - css:'', - - separator2:'children', - - widgets:[] -} -module.exports.create = function(widgetData,container) { - - var parsewidgets = require('../parser').widgets - - var widget = $(` -
          -
          - `) - if (widgetData.horizontal) { - container.addClass('horizontal') - } else { - container.addClass('vertical') - } - - parsewidgets(widgetData.widgets,widget) - - return widget -} - -},{"../parser":10}],35:[function(require,module,exports){ -var sendOsc = require('./utils').sendOsc - -module.exports.options = { - type:'switch', - id:'auto', - linkId:'', - - separator1:'style', - - label:'auto', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - horizontal:false, - color:'auto', - css:'', - - separator2:'osc', - - values:{"Value 1":1,"Value 2":2}, - precision:2, - path:'auto', - preArgs:[], - target:[] -} -module.exports.create = function(widgetData,container) { - - var widget = $(` -
          -
          - `), - $document = $(document) - - if (widgetData.horizontal) { - widget.addClass('horizontal') - } - - widget.values = [] - - for (k in widgetData.values) { - widget.values.push(widgetData.values[k]) - $('
          '+k+'
          ').data({value:widgetData.values[k]}).appendTo(widget) - } - - widget.value = undefined - - widget.find('.value').on('draginit',function(e,dd){ - var data = $(this).data() - if (data.value!=widget.value || widget.value===undefined) widget.setValue(data.value,true,true) - }) - - - - widget.getValue = function() { - return widget.value - } - widget.setValue = function(v,send,sync) { - var i = widget.values.indexOf(v) - if (i!=-1) { - widget.value = widget.values[i] - widget.find('.on').removeClass('on') - widget.find('.value').eq(i).addClass('on').removeClass('ripple').addClass('ripple').delay(250).queue(function(next){ - $(this).removeClass('ripple') - next() - }) - if (send) widget.sendValue(widget.value) - if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - - } - widget.sendValue = function(v) { - var args = widgetData.preArgs.concat(v) - - sendOsc({ - target:widgetData.target, - path:widgetData.path, - precision:widgetData.precision, - args:args - }) - } - return widget -} - -},{"./utils":37}],36:[function(require,module,exports){ -var sendOsc = require('./utils').sendOsc - -module.exports.options = { - type:'toggle', - id:'auto', - linkId:'', - - separator1:'style', - - label:'auto', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - color:'auto', - css:'', - - separator2:'osc', - - on:1, - off:0, - precision:2, - path:'auto', - preArgs:[], - target:[] -} -module.exports.create = function(widgetData,container) { - - var widget = $(` -
          -
          \ - `), - $document = $(document) - - widget.value = widget.find('span') - widget.state = 0 - - widget.on('drag',function(e){e.stopPropagation()}) - widget.on('draginit.toggle',function(){ - widget.off('draginit.toggle') - widget.fakeclick() - }) - - widget.fakeclick = function(){ - var newVal = widget.state?widgetData.off:widgetData.on - widget.setValue(newVal,true,true) - $document.on('dragend.toggle',function(){ - $document.off('dragend.toggle') - widget.on('draginit.toggle',function(){ - widget.off('draginit.toggle') - widget.fakeclick() - }) - }) - } - - - widget.getValue = function() { - return widget.state?widgetData.on:widgetData.off - } - widget.setValue = function(v,send,sync) { - if (v===widgetData.on || (v=='false'&&widgetData.on===false)) { - widget.addClass('on') - widget.state = 1 - if (send) widget.sendValue(widgetData.on) - } else if (v===widgetData.off || (v=='false'&&widgetData.off===false)) { - widget.removeClass('on') - widget.state = 0 - if (send) widget.sendValue(widgetData.off) - } - - if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - - } - widget.sendValue = function(v) { - if (v===false) return - var args = widgetData.preArgs.concat(v) - - sendOsc({ - target:widgetData.target, - path:widgetData.path, - precision:widgetData.precision, - args:args - }) - } - widget.setValue() - return widget -} - -},{"./utils":37}],37:[function(require,module,exports){ -module.exports = { - - sendOsc: function(data){ - IPC.send('sendOsc', data) - }, - - clip: function(value,range) { - var value = parseFloat(value) - - if (isNaN(value)) value = range[0] - return Math.max(Math.min(range[0],range[1]),Math.min(value,Math.max(range[0],range[1]))) - - }, - - // map a value from a scale to another input and output must be range arrays - mapToScale: function(value,rangeIn,rangeOut,precision,log,revertlog) { - - var value = module.exports.clip(value,[rangeIn[0],rangeIn[1]]) - - value = log? - revertlog? - (Math.pow(10,((value-rangeIn[0])/(rangeIn[1]-rangeIn[0])))/9-1/9) * (rangeOut[1]-rangeOut[0]) + rangeOut[0] - :Math.log10(((value-rangeIn[0])/(rangeIn[1]-rangeIn[0]))*9+1) * (rangeOut[1]-rangeOut[0]) + rangeOut[0] - :((value-rangeIn[0])/(rangeIn[1]-rangeIn[0])) * (rangeOut[1]-rangeOut[0]) + rangeOut[0] - - value = Math.max(Math.min(rangeOut[0],rangeOut[1]),Math.min(value,Math.max(rangeOut[0],rangeOut[1]))) - - if (precision!==false) value = module.exports.roundTo(value, precision) - - - return value - - }, - - roundTo: function(value, precision) { - var roundFactor = precision!=undefined?Math.pow(10,precision):100 - return Math.round(value*roundFactor)/roundFactor - }, - - hsbToRgb: function (hsb) { - var rgb = {} - var h = hsb.h - var s = hsb.s*255/100 - var v = hsb.b*255/100 - if(s == 0) { - rgb.r = rgb.g = rgb.b = v - } else { - var t1 = v - var t2 = (255-s)*v/255 - var t3 = (t1-t2)*(h%60)/60 - if(h==360) h = 0 - if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3} - else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3} - else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3} - else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3} - else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3} - else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3} - else {rgb.r=0; rgb.g=0; rgb.b=0} - } - return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)} - }, - - rgbToHsb: function (rgb) { - var hsb = {h: 0, s: 0, b: 0} - var min = Math.min(rgb.r, rgb.g, rgb.b) - var max = Math.max(rgb.r, rgb.g, rgb.b) - var delta = max - min - hsb.b = max - hsb.s = max != 0 ? 255 * delta / max : 0 - if (hsb.s != 0) { - if (rgb.r == max) hsb.h = (rgb.g - rgb.b) / delta - else if (rgb.g == max) hsb.h = 2 + (rgb.b - rgb.r) / delta - else hsb.h = 4 + (rgb.r - rgb.g) / delta - } else hsb.h = 0 - hsb.h *= 60 - if (hsb.h < 0) hsb.h += 360 - hsb.s *= 100/255 - hsb.b *= 100/255 - return hsb - } -} - -},{}],38:[function(require,module,exports){ -var utils = require('./utils'), - clip = utils.clip, - mapToScale = utils.mapToScale, - sendOsc = utils.sendOsc - -module.exports.options = { - type:'xy', - id:'auto', - linkId:'', - - separator1:'style', - - label:'auto', - left:'auto', - top:'auto', - width:'auto', - height:'auto', - color:'auto', - css:'', - - separator2:'behaviour', - - snap:false, - - separator3:'osc', - - rangeX:{min:0,max:1}, - rangeY:{min:0,max:1}, - logScaleX:false, - logScaleY:false, - precision:2, - path:'auto', - preArgs:[], - split:false, - target:[] -} -module.exports.create = function(widgetData,container) { - var widget = $(` -
          -
          -
          -
          -
          -
          X
          Y
          -
          -
          -
          - `), - handle = widget.find('.handle'), - pad = widget.find('.xy'), - value = {x:widget.find('.x').fakeInput({align:'center'}),y:widget.find('.y').fakeInput({align:'center'})}, - range = {x:widgetData.rangeX,y:widgetData.rangeY}, - snap = widgetData.snap, - split = widgetData.split? - typeof widgetData.split == 'object'? - widgetData.split:{x:widgetData.path+'/x',y:widgetData.path+'/y'} - :false; - logScaleX = widgetData.logScaleX, - logScaleY = widgetData.logScaleY, - roundFactor = Math.pow(10,widgetData.precision) - - - if (widgetData.height!='auto') widget.addClass('manual-height') - - pad.width = 0 - pad.height = 0 - handle.height = 0 - handle.width = 0 - widget.value = undefined - - pad.resize(function(){ - var width = pad.innerWidth(), - height = pad.innerHeight() - if (!width || (pad.height==height && pad.width==width)) return - pad.width = width - pad.height = height - - widget.updateUi(handle.width,handle.height) - }) - - var off = {x:0,y:0} - pad.on('draginit',function(e,data,traversing){ - - if (snap || traversing) { - var h = ((pad.height-data.offsetY) * 100 / pad.height), - w = (data.offsetX * 100 / pad.width) - - widget.updateUi(w,h) - - handle.height = h - handle.width = w - - var v = widget.getValue() - - if (vwidget.value) { - widget.value = v - - widget.sendValue(v) - widget.showValue(v) - - widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - - } - - off = {x:handle.width,y:handle.height} - - }) - pad.on('drag',function(e,data){ - - var h = clip((-data.deltaY)*100/pad.height+off.y,[0,100]), - w = clip((data.deltaX)*100/pad.width+off.x,[0,100]) - - widget.updateUi(w,h) - - handle.height = h - handle.width = w - - var v = widget.getValue() - - if (vwidget.value) { - widget.value = v - - widget.sendValue(v) - widget.showValue(v) - - widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - } - - }) - - - widget.updateUi = function(w,h) { - handle[0].setAttribute('style',`transform:translate3d(${pad.width*w/100}px, -${pad.height*h/100}px,0)`) - } - - widget.getValue = function() { - var x = mapToScale(handle.width,[0,100],[range.x.min,range.x.max],widgetData.precision,logScaleX), - y = mapToScale(handle.height,[0,100],[range.y.min,range.y.max],widgetData.precision,logScaleY) - - return [x,y] - } - widget.setValue = function(v,send,sync) { - if (!v || v.length!=2) return - - for (i in [0,1]) { - v[i] = clip(Math.round(v[i]*roundFactor)/roundFactor,[range[['x','y'][i]].min,range[['x','y'][i]].max]) - } - - var w = mapToScale(v[0],[range.x.min,range.x.max],[0,100],false,logScaleX,true) - h = mapToScale(v[1],[range.y.min,range.y.max],[0,100],false,logScaleY,true), - - - widget.updateUi(w,h) - - handle.height = h - handle.width = w - widget.value = v - - widget.showValue(v) - if (sync) widget.trigger('sync',[widgetData.id,widget,widgetData.linkId]) - if (send) widget.sendValue(v) - } - widget.sendValue = function(v) { - var args = widgetData.preArgs.concat(v) - - sendOsc({ - target:split?false:widgetData.target, - path:widgetData.path, - args:args, - precision:widgetData.precision, - }) - if (split) { - sendOsc({ - target:widgetData.target, - path:split.x, - args:widgetData.preArgs.concat(v[0]), - precision:widgetData.precision, - sync:false - }) - sendOsc({ - target:widgetData.target, - path:split.y, - args:widgetData.preArgs.concat(v[1]), - precision:widgetData.precision, - sync:false - }) - } - } - - widget.showValue = function(v) { - value.x.val(v[0]) - value.y.val(v[1]) - } - - value.x.change(function(){ - var v = widget.getValue() - v[0] = clip(value.x.val(),[range.x.min,range.x.max]) - widget.setValue(v,true,true) - }) - value.y.change(function(){ - var v = widget.getValue() - v[1] = clip(value.y.val(),[range.y.min,range.y.max]) - widget.setValue(v,true,true) - }) - - widget.setValue([range.x.min,range.y.min]) - return widget -} - -},{"./utils":37}],39:[function(require,module,exports){ -WEBFRAME = false - -// mainProcess & renderProcess communication engine -// electron's ipc module is not available here, we use socket.io as a replacement -var socket = require('socket.io-client') - -IPC = socket.connect() -IPC.send = IPC.emit - - -require('./app') - -},{"./app":1,"socket.io-client":76}],40:[function(require,module,exports){ -// jQuery drag event handler -// note: triggerHandler() is used instead of trigger() when event bubblig is not -// necessary, this increases performances a lot. -;(function($){ - var events = { - touch:{start:'touchstart',stop:'touchend touchcancel',move:'touchmove',touch:true}, - mouse:{start:'mousedown',stop:'mouseup',move:'mousemove',out:'mouseout',touch:false} - }, - - - $document = $(document), - getOffset = function(obj) { - var offsetLeft = 0 - var offsetTop = 0 - if (obj) { - do { - if (!isNaN(obj.offsetLeft)) { - offsetLeft += obj.offsetLeft - obj.scrollLeft - } - if (!isNaN(obj.offsetTop)) { - offsetTop += obj.offsetTop - obj.scrollTop - } - } while(obj = obj.offsetParent ) - } - - return {left: offsetLeft, top: offsetTop} - } - - - $.event.special.draginit = $.event.special.drag = { - setup:function(){ - - var $this = $(this) - - if ($this.data('dragSetup')) return - $this.data('dragSetup','true') - - - // mouse single touch handler - var previousEvent = null, - target = null, - traversing = false, - mouseStartHandler = function(e){ - - // ignore mouse event when fired by a simulated touch event - if (e.originalEvent.sourceCapabilities.firesTouchEvents || e.button == 2) return - - isPointerDown = true - target = $this - previousEvent = e - - e.speedX = 0 - e.speedY = 0 - e.deltaX = 0 - e.deltaY = 0 - - target.triggerHandler('draginit',[e,e.originalEvent.traversing]) - - $document.on(events.mouse.move,mouseMoveHandler) - $document.on(events.mouse.stop,mouseStopHandler) - $document.on(events.mouse.out,mouseOutHandler) - - }, - mouseMoveHandler = function(e){ - e.stopPropagation() - - e.speedX = e.pageX - previousEvent.pageX - e.speedY = e.pageY - previousEvent.pageY - e.deltaX = e.speedX + previousEvent.deltaX - e.deltaY = e.speedY + previousEvent.deltaY - - - if (e.originalEvent.traversing) { - target = $(e.target) - e.preventDefault() - target.triggerHandler('draginit',[e,e.originalEvent.traversing]) - } else { - target.triggerHandler('drag',[e,e.originalEvent.traversing]) - } - - previousEvent = e - }, - mouseStopHandler = function(e){ - e.stopPropagation() - - // ignore mouse event when fired by a simulated touch event - if (e.originalEvent.sourceCapabilities.firesTouchEvents) return - - e.speedX = e.pageX - previousEvent.pageX - e.speedY = e.pageY - previousEvent.pageY - e.deltaX = e.deltaX + previousEvent.deltaX - e.deltaY = e.deltaY + previousEvent.deltaY - - - target.trigger('dragend',[e,e.originalEvent.traversing]) - isPointerDown = false - $document.off(events.mouse.move,mouseMoveHandler) - $document.off(events.mouse.stop,mouseStopHandler) - $document.off(events.mouse.out,mouseOutHandler) - }, - mouseOutHandler = function(e){ - if (e.originalEvent.traversing) { - e.stopPropagation() - - e.speedX = e.pageX - previousEvent.pageX - e.speedY = e.pageY - previousEvent.pageY - e.deltaX = e.deltaX + previousEvent.deltaX - e.deltaY = e.deltaY + previousEvent.deltaY - - target.trigger('dragend',[e,e.originalEvent.traversing]) - - previousEvent = e - - } - } - - - $this.on(events.mouse.start,mouseStartHandler) - - - // multi touch hanlder - window.targets = window.targets || {} - window.previousTouches = window.previousTouches || {} - window.touchActive = window.touchActive || false - - var self = this, - touchStartHandler = function(e){ - e.preventDefault() - - var oE = e.originalEvent - - for (i in oE.changedTouches) { - if (isNaN(i)) continue - - var touch = oE.changedTouches[i], - id = touch.identifier - - targets[id] = $(touch.target) - previousTouches[id] = touch - - touch.speedX = 0 - touch.speedY = 0 - - touch.deltaX = 0 - touch.deltaY = 0 - - var off = getOffset(touch.target) - touch.offsetX = touch.pageX-off.left - touch.offsetY = touch.pageY-off.top - - targets[id].triggerHandler('draginit',[touch,e.originalEvent.traversing]) - - } - - if (!touchActive) { - $document.on(events.touch.move,touchMoveHandler) - $document.on(events.touch.stop,touchStopHandler) - touchActive = true - } - - }, - touchMoveHandler = function(e){ - - var oE = e.originalEvent - - for (i in oE.changedTouches) { - if (isNaN(i)) continue - - - var touch = oE.changedTouches[i], - id = touch.identifier - - if (e.originalEvent.traversing) { - targets[id] = $(document.elementFromPoint(touch.clientX, touch.clientY)) - } - - // touched[targets[id]] = touched[targets[id]]?touched[targets[id]]+1:1 - - touch.speedX = touch.pageX - previousTouches[id].pageX - touch.speedY = touch.pageY - previousTouches[id].pageY - - touch.deltaX = touch.speedX + previousTouches[id].deltaX - touch.deltaY = touch.speedY + previousTouches[id].deltaY - - touch.offsetX = previousTouches[id].offsetX+touch.speedX - touch.offsetY = previousTouches[id].offsetY+touch.speedY - - if (e.originalEvent.traversing) { - touch.traversing = true - var previousTarget = document.elementFromPoint(previousTouches[id].clientX, previousTouches[id].clientY) - if (targets[id][0]!=previousTarget) { - var off = getOffset(targets[id][0]) - touch.offsetX = touch.pageX-off.left - touch.offsetY = touch.pageY-off.top - $(previousTarget).trigger('dragend',[touch,e.originalEvent.traversing]) - } - e.preventDefault() - if (oE.traversingContainer.contains(targets[id][0])) targets[id].triggerHandler('draginit',[touch,e.originalEvent.traversing]) - - } else { - - targets[id].triggerHandler('drag',[touch,e.originalEvent.traversing]) - - } - - previousTouches[id] = touch - - } - - }, - touchStopHandler = function(e){ - - var oE = e.originalEvent - - for (i in oE.changedTouches) { - - if (isNaN(i)) continue - - var touch = oE.changedTouches[i], - id = touch.identifier - - $(oE.changedTouches[i].target).trigger('dragend',[touch,e.originalEvent.traversing]) - - delete previousTouches[id] - delete targets[id] - - } - - if (oE.touches.length==0) { - $document.off(events.touch.move,touchMoveHandler) - $document.off(events.touch.stop,touchStopHandler) - touchActive = false - } - - } - - $this.on(events.touch.start,touchStartHandler) - - - } - - } - - - - - - - - - var makeEventTraversing = function(e){ - e.traversing=true - if (!e.traversingContainer) e.traversingContainer=this - } - - - $.fn.enableTraversingGestures = function() { - - var self = this[0] - - var down = function(e){ - makeEventTraversing(e) - self.addEventListener("mousemove", makeEventTraversing, true) - self.addEventListener("touchmove", makeEventTraversing, true) - self.addEventListener("mouseout", makeEventTraversing, true) - document.addEventListener("mouseup",up,true) - document.addEventListener("touchend",up,true) - }, - up = function(){ - self.removeEventListener("mousemove", makeEventTraversing, true) - self.removeEventListener("touchmove", makeEventTraversing, true) - self.removeEventListener("mouseout", makeEventTraversing, true) - document.removeEventListener("mouseup",up,true) - document.removeEventListener("touchend",up,true) - } - - self.addEventListener("mousedown", down, true) - self.addEventListener("touchstart", down, true) - - - this.on('disableTraversingGestures',function() { - self.removeEventListener("mousedown", down, true) - self.removeEventListener("touchstart", down, true) - }) - - - return this - - } - - - $document.on('mousedown',function(e){ - - if (e.originalEvent.sourceCapabilities && e.originalEvent.sourceCapabilities.firesTouchEvents) return - - $(e.target).trigger('fake-click') - - if (e.button==2) { - e.preventDefault() - $(e.target).trigger('fake-right-click',e) - } - - }) - - var touchTapTimer = false, - clearTouchTapTimer = function() { - clearTimeout(touchTapTimer) - touchTapTimer = false - } - - $document.on(events.touch.start,function(e){ - $(e.target).trigger('fake-click') - - if (!touchTapTimer&&e.originalEvent.touches.length==1) { - touchTapTimer = setTimeout(function(){ - if (touchTapTimer) { - var touch = e.originalEvent.changedTouches[0], - off = getOffset(touch.target) - - touch.offsetX = touch.pageX-off.left - touch.offsetY = touch.pageY-off.top - $(e.originalEvent.changedTouches[0].target).trigger('fake-right-click',touch) - } - touchTapTimer = false - },600) - } else { - clearTouchTapTimer() - } - }) - - $document.on(events.touch.stop + ' ' + events.touch.move,function(e){ - clearTouchTapTimer() - }) - - $document.on('contextmenu',function(){return false}) - -})(jQuery) - -},{}],41:[function(require,module,exports){ -;(function ($) { - $.fn.fakeInput = function(options) { - - var settings = $.extend({ - align:'left' - }, options ); - - var self= this, - canvas = $('').appendTo(self), - ctx = canvas[0].getContext('2d') - - self.value = undefined - self.height = undefined - self.width = undefined - self.color = undefined - self.center = settings.align == 'center' - - self.attr('tabindex',"0") - - canvas.resize(function(e,width,height){ - e.stopPropagation() - - var width = width*2, - height = height*2 - - if (height==100 && width==100) return - - self.color = getComputedStyle(document.documentElement).getPropertyValue("--color-text") - self.height=height - self.width=width - - canvas[0].setAttribute('width',width) - canvas[0].setAttribute('height',height) - - self.val(self.value) - }) - - self.val = function(newVal) { - if (newVal==undefined) return self.value - - self.value = newVal - - if (!self.height || !self.width || (self.height==100 && self.width==100)) return - - ctx.clearRect(0,0,self.width,self.height) - ctx.font = PXSCALE * 2 * 13 + 'px Droid Sans' - ctx.textBaseline = "top" - ctx.fillStyle = self.color - - if (self.center) { - ctx.textAlign = settings.align - ctx.fillText(newVal,self.width/2,0) - } else { - ctx.fillText(newVal,0,0) - } - - - } - - self.on('focus',function(){ - self.attr('tabindex','-1') - var i = $('') - .prependTo(self) - .val(self.value) - .focus() - .change(function(){ - self.val($(this).val()) - i.blur() - setTimeout(function(){self.focus()},1) - }) - i.blur(function(){ - self.attr('tabindex','0') - i.remove() - $(document).off('.fakeInput') - }) - $(document).on('touchstart.fakeInput mousedown.fakeInput',function(e){ - if (e.originalEvent.target!=i[0]) { - i.blur() - } - }) - - }) - - return self - - } -})(jQuery) - -},{}],42:[function(require,module,exports){ -/*! jQuery v3.0.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector,-deprecated | (c) jQuery Foundation | jquery.org/license */ -!function(a,b){"use strict";"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){"use strict";var c=[],d=a.document,e=Object.getPrototypeOf,f=c.slice,g=c.concat,h=c.push,i=c.indexOf,j={},k=j.toString,l=j.hasOwnProperty,m=l.toString,n=m.call(Object),o={};function p(a,b){b=b||d;var c=b.createElement("script");c.text=a,b.head.appendChild(c).parentNode.removeChild(c)}var q="3.0.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector,-deprecated",r=function(a,b){return new r.fn.init(a,b)},s=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,t=/^-ms-/,u=/-([a-z])/g,v=function(a,b){return b.toUpperCase()};r.fn=r.prototype={jquery:q,constructor:r,length:0,toArray:function(){return f.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:f.call(this)},pushStack:function(a){var b=r.merge(this.constructor(),a);return b.prevObject=this,b},each:function(a){return r.each(this,a)},map:function(a){return this.pushStack(r.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(f.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()},push:h,sort:c.sort,splice:c.splice},r.extend=r.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||r.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(r.isPlainObject(d)||(e=r.isArray(d)))?(e?(e=!1,f=c&&r.isArray(c)?c:[]):f=c&&r.isPlainObject(c)?c:{},g[b]=r.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},r.extend({expando:"jQuery"+(q+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===r.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=r.type(a);return("number"===b||"string"===b)&&!isNaN(a-parseFloat(a))},isPlainObject:function(a){var b,c;return a&&"[object Object]"===k.call(a)?(b=e(a))?(c=l.call(b,"constructor")&&b.constructor,"function"==typeof c&&m.call(c)===n):!0:!1},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?j[k.call(a)]||"object":typeof a},globalEval:function(a){p(a)},camelCase:function(a){return a.replace(t,"ms-").replace(u,v)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(w(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(s,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(w(Object(a))?r.merge(c,"string"==typeof a?[a]:a):h.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:i.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;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,e,f=0,h=[];if(w(a))for(d=a.length;d>f;f++)e=b(a[f],f,c),null!=e&&h.push(e);else for(f in a)e=b(a[f],f,c),null!=e&&h.push(e);return g.apply([],h)},guid:1,proxy:function(a,b){var c,d,e;return"string"==typeof b&&(c=a[b],b=a,a=c),r.isFunction(a)?(d=f.call(arguments,2),e=function(){return a.apply(b||this,d.concat(f.call(arguments)))},e.guid=a.guid=a.guid||r.guid++,e):void 0},now:Date.now,support:o}),"function"==typeof Symbol&&(r.fn[Symbol.iterator]=c[Symbol.iterator]),r.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){j["[object "+b+"]"]=b.toLowerCase()});function w(a){var b=!!a&&"length"in a&&a.length,c=r.type(a);return"function"===c||r.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var x=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C={}.hasOwnProperty,D=[],E=D.pop,F=D.push,G=D.push,H=D.slice,I=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},J="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",K="[\\x20\\t\\r\\n\\f]",L="(?:\\\\.|[\\w-]|[^\x00-\\xa0])+",M="\\["+K+"*("+L+")(?:"+K+"*([*^$|!~]?=)"+K+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+L+"))|)"+K+"*\\]",N=":("+L+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+M+")*)|.*)\\)|)",O=new RegExp(K+"+","g"),P=new RegExp("^"+K+"+|((?:^|[^\\\\])(?:\\\\.)*)"+K+"+$","g"),Q=new RegExp("^"+K+"*,"+K+"*"),R=new RegExp("^"+K+"*([>+~]|"+K+")"+K+"*"),S=new RegExp("="+K+"*([^\\]'\"]*?)"+K+"*\\]","g"),T=new RegExp(N),U=new RegExp("^"+L+"$"),V={ID:new RegExp("^#("+L+")"),CLASS:new RegExp("^\\.("+L+")"),TAG:new RegExp("^("+L+"|[*])"),ATTR:new RegExp("^"+M),PSEUDO:new RegExp("^"+N),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+K+"*(even|odd|(([+-]|)(\\d*)n|)"+K+"*(?:([+-]|)"+K+"*(\\d+)|))"+K+"*\\)|)","i"),bool:new RegExp("^(?:"+J+")$","i"),needsContext:new RegExp("^"+K+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+K+"*((?:-\\d)?\\d*)"+K+"*\\)|)(?=[^-]|$)","i")},W=/^(?:input|select|textarea|button)$/i,X=/^h\d$/i,Y=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,$=/[+~]/,_=new RegExp("\\\\([\\da-f]{1,6}"+K+"?|("+K+")|.)","ig"),aa=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)},ba=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,ca=function(a,b){return b?"\x00"===a?"\ufffd":a.slice(0,-1)+"\\"+a.charCodeAt(a.length-1).toString(16)+" ":"\\"+a},da=function(){m()},ea=ta(function(a){return a.disabled===!0},{dir:"parentNode",next:"legend"});try{G.apply(D=H.call(v.childNodes),v.childNodes),D[v.childNodes.length].nodeType}catch(fa){G={apply:D.length?function(a,b){F.apply(a,H.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s=b&&b.ownerDocument,w=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==w&&9!==w&&11!==w)return d;if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==w&&(l=Z.exec(a)))if(f=l[1]){if(9===w){if(!(j=b.getElementById(f)))return d;if(j.id===f)return d.push(j),d}else if(s&&(j=s.getElementById(f))&&t(b,j)&&j.id===f)return d.push(j),d}else{if(l[2])return G.apply(d,b.getElementsByTagName(a)),d;if((f=l[3])&&c.getElementsByClassName&&b.getElementsByClassName)return G.apply(d,b.getElementsByClassName(f)),d}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==w)s=b,r=a;else if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(ba,ca):b.setAttribute("id",k=u),o=g(a),h=o.length;while(h--)o[h]="#"+k+" "+sa(o[h]);r=o.join(","),s=$.test(a)&&qa(b.parentNode)||b}if(r)try{return G.apply(d,s.querySelectorAll(r)),d}catch(x){}finally{k===u&&b.removeAttribute("id")}}}return i(a.replace(P,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("fieldset");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&a.sourceIndex-b.sourceIndex;if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return function(b){return"label"in b&&b.disabled===a||"form"in b&&b.disabled===a||"form"in b&&b.disabled===!1&&(b.isDisabled===a||b.isDisabled!==!a&&("label"in b||!ea(b))!==a)}}function pa(a){return ia(function(b){return b=+b,ia(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 qa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),v!==n&&(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Y.test(n.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(_,aa);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(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"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Y.test(n.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+K+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+K+"*(?:value|"+J+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){a.innerHTML="";var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+K+"*[*^$|!~]?="),2!==a.querySelectorAll(":enabled").length&&q.push(":enabled",":disabled"),o.appendChild(a).disabled=!0,2!==a.querySelectorAll(":disabled").length&&q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Y.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"*"),s.call(a,"[s!='']:x"),r.push("!=",N)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Y.test(o.compareDocumentPosition),t=b||Y.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===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?I(k,a)-I(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f)return a===n?-1:b===n?1:e?-1:f?1:k?I(k,a)-I(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)g.unshift(c);c=b;while(c=c.parentNode)h.unshift(c);while(g[d]===h[d])d++;return d?la(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(S,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!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 ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&C.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},ga.escape=function(a){return(a+"").replace(ba,ca)},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.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=ga.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=ga.selectors={cacheLength:50,createPseudo:ia,match:V,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(_,aa),a[3]=(a[3]||a[4]||a[5]||"").replace(_,aa),"~="===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]||ga.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]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return V.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&T.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(_,aa).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("(^|"+K+")"+a+"("+K+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.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.replace(O," ")+" ").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,t=!1;if(q){if(f){while(p){m=b;while(m=m[p])if(h?m.nodeName.toLowerCase()===r:1===m.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}else if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1)while(m=++n&&m&&m[p]||(t=n=0)||o.pop())if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b))break;return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=I(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(P,"$1"));return d[u]?ia(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),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(_,aa),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return U.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(_,aa).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:oa(!1),disabled:oa(!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 X.test(a.nodeName)},input:function(a){return W.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:pa(function(){return[0]}),last:pa(function(a,b){return[b-1]}),eq:pa(function(a,b,c){return[0>c?c+b:c]}),even:pa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:pa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:pa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:pa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function ta(a,b,c){var d=b.dir,e=b.next,f=e||d,g=c&&"parentNode"===f,h=x++;return b.first?function(b,c,e){while(b=b[d])if(1===b.nodeType||g)return a(b,c,e)}:function(b,c,i){var j,k,l,m=[w,h];if(i){while(b=b[d])if((1===b.nodeType||g)&&a(b,c,i))return!0}else while(b=b[d])if(1===b.nodeType||g)if(l=b[u]||(b[u]={}),k=l[b.uniqueID]||(l[b.uniqueID]={}),e&&e===b.nodeName.toLowerCase())b=b[d]||b;else{if((j=k[f])&&j[0]===w&&j[1]===h)return m[2]=j[2];if(k[f]=m,m[2]=a(b,c,i))return!0}}}function ua(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 va(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function wa(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 xa(a,b,c,d,e,f){return d&&!d[u]&&(d=xa(d)),e&&!e[u]&&(e=xa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||va(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:wa(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=wa(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?I(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=wa(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):G.apply(g,r)})}function ya(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ta(function(a){return a===b},h,!0),l=ta(function(a){return I(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[ta(ua(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 xa(i>1&&ua(m),i>1&&sa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(P,"$1"),c,e>i&&ya(a.slice(i,e)),f>e&&ya(a=a.slice(e)),f>e&&sa(a))}m.push(c)}return ua(m)}function za(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++])if(q(l,g||n,h)){i.push(l);break}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++])q(t,u,g,h);if(f){if(r>0)while(s--)t[s]||u[s]||(u[s]=E.call(i));u=wa(u)}G.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&ga.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=ya(b[c]),f[u]?d.push(f):e.push(f);f=A(a,za(e,d)),f.selector=a}return f},i=ga.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(_,aa),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=V.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(_,aa),$.test(j[0].type)&&qa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&sa(j),!a)return G.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,!b||$.test(a)&&qa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("fieldset"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(J,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);r.find=x,r.expr=x.selectors,r.expr[":"]=r.expr.pseudos,r.uniqueSort=r.unique=x.uniqueSort,r.text=x.getText,r.isXMLDoc=x.isXML,r.contains=x.contains,r.escapeSelector=x.escape;var y=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&r(a).is(c))break;d.push(a)}return d},z=function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c},A=r.expr.match.needsContext,B=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,C=/^.[^:#\[\.,]*$/;function D(a,b,c){if(r.isFunction(b))return r.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return r.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(C.test(b))return r.filter(b,a,c);b=r.filter(b,a)}return r.grep(a,function(a){return i.call(b,a)>-1!==c&&1===a.nodeType})}r.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?r.find.matchesSelector(d,a)?[d]:[]:r.find.matches(a,r.grep(b,function(a){return 1===a.nodeType}))},r.fn.extend({find:function(a){var b,c,d=this.length,e=this;if("string"!=typeof a)return this.pushStack(r(a).filter(function(){for(b=0;d>b;b++)if(r.contains(e[b],this))return!0}));for(c=this.pushStack([]),b=0;d>b;b++)r.find(a,e[b],c);return d>1?r.uniqueSort(c):c},filter:function(a){return this.pushStack(D(this,a||[],!1))},not:function(a){return this.pushStack(D(this,a||[],!0))},is:function(a){return!!D(this,"string"==typeof a&&A.test(a)?r(a):a||[],!1).length}});var E,F=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,G=r.fn.init=function(a,b,c){var e,f;if(!a)return this;if(c=c||E,"string"==typeof a){if(e="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:F.exec(a),!e||!e[1]&&b)return!b||b.jquery?(b||c).find(a):this.constructor(b).find(a);if(e[1]){if(b=b instanceof r?b[0]:b,r.merge(this,r.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),B.test(e[1])&&r.isPlainObject(b))for(e in b)r.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e]);return this}return f=d.getElementById(e[2]),f&&(this[0]=f,this.length=1),this}return a.nodeType?(this[0]=a,this.length=1,this):r.isFunction(a)?void 0!==c.ready?c.ready(a):a(r):r.makeArray(a,this)};G.prototype=r.fn,E=r(d);var H=/^(?:parents|prev(?:Until|All))/,I={children:!0,contents:!0,next:!0,prev:!0};r.fn.extend({has:function(a){var b=r(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(r.contains(this,b[a]))return!0})},closest:function(a,b){var c,d=0,e=this.length,f=[],g="string"!=typeof a&&r(a);if(!A.test(a))for(;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&&r.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?r.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?i.call(r(a),this[0]):i.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(r.uniqueSort(r.merge(this.get(),r(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function J(a,b){while((a=a[b])&&1!==a.nodeType);return a}r.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return y(a,"parentNode")},parentsUntil:function(a,b,c){return y(a,"parentNode",c)},next:function(a){return J(a,"nextSibling")},prev:function(a){return J(a,"previousSibling")},nextAll:function(a){return y(a,"nextSibling")},prevAll:function(a){return y(a,"previousSibling")},nextUntil:function(a,b,c){return y(a,"nextSibling",c)},prevUntil:function(a,b,c){return y(a,"previousSibling",c)},siblings:function(a){return z((a.parentNode||{}).firstChild,a)},children:function(a){return z(a.firstChild)},contents:function(a){return a.contentDocument||r.merge([],a.childNodes)}},function(a,b){r.fn[a]=function(c,d){var e=r.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=r.filter(d,e)),this.length>1&&(I[a]||r.uniqueSort(e),H.test(a)&&e.reverse()),this.pushStack(e)}});var K=/\S+/g;function L(a){var b={};return r.each(a.match(K)||[],function(a,c){b[c]=!0}),b}r.Callbacks=function(a){a="string"==typeof a?L(a):r.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h-1)f.splice(c,1),h>=c&&h--}),this},has:function(a){return a?r.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return!f},lock:function(){return e=g=[],c||b||(f=c=""),this},locked:function(){return!!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return!!d}};return j};function M(a){return a}function N(a){throw a}function O(a,b,c){var d;try{a&&r.isFunction(d=a.promise)?d.call(a).done(b).fail(c):a&&r.isFunction(d=a.then)?d.call(a,b,c):b.call(void 0,a)}catch(a){c.call(void 0,a)}}r.extend({Deferred:function(b){var c=[["notify","progress",r.Callbacks("memory"),r.Callbacks("memory"),2],["resolve","done",r.Callbacks("once memory"),r.Callbacks("once memory"),0,"resolved"],["reject","fail",r.Callbacks("once memory"),r.Callbacks("once memory"),1,"rejected"]],d="pending",e={state:function(){return d},always:function(){return f.done(arguments).fail(arguments),this},"catch":function(a){return e.then(null,a)},pipe:function(){var a=arguments;return r.Deferred(function(b){r.each(c,function(c,d){var e=r.isFunction(a[d[4]])&&a[d[4]];f[d[1]](function(){var a=e&&e.apply(this,arguments);a&&r.isFunction(a.promise)?a.promise().progress(b.notify).done(b.resolve).fail(b.reject):b[d[0]+"With"](this,e?[a]:arguments)})}),a=null}).promise()},then:function(b,d,e){var f=0;function g(b,c,d,e){return function(){var h=this,i=arguments,j=function(){var a,j;if(!(f>b)){if(a=d.apply(h,i),a===c.promise())throw new TypeError("Thenable self-resolution");j=a&&("object"==typeof a||"function"==typeof a)&&a.then,r.isFunction(j)?e?j.call(a,g(f,c,M,e),g(f,c,N,e)):(f++,j.call(a,g(f,c,M,e),g(f,c,N,e),g(f,c,M,c.notifyWith))):(d!==M&&(h=void 0,i=[a]),(e||c.resolveWith)(h,i))}},k=e?j:function(){try{j()}catch(a){r.Deferred.exceptionHook&&r.Deferred.exceptionHook(a,k.stackTrace),b+1>=f&&(d!==N&&(h=void 0,i=[a]),c.rejectWith(h,i))}};b?k():(r.Deferred.getStackHook&&(k.stackTrace=r.Deferred.getStackHook()),a.setTimeout(k))}}return r.Deferred(function(a){c[0][3].add(g(0,a,r.isFunction(e)?e:M,a.notifyWith)),c[1][3].add(g(0,a,r.isFunction(b)?b:M)),c[2][3].add(g(0,a,r.isFunction(d)?d:N))}).promise()},promise:function(a){return null!=a?r.extend(a,e):e}},f={};return r.each(c,function(a,b){var g=b[2],h=b[5];e[b[1]]=g.add,h&&g.add(function(){d=h},c[3-a][2].disable,c[0][2].lock),g.add(b[3].fire),f[b[0]]=function(){return f[b[0]+"With"](this===f?void 0:this,arguments),this},f[b[0]+"With"]=g.fireWith}),e.promise(f),b&&b.call(f,f),f},when:function(a){var b=arguments.length,c=b,d=Array(c),e=f.call(arguments),g=r.Deferred(),h=function(a){return function(c){d[a]=this,e[a]=arguments.length>1?f.call(arguments):c,--b||g.resolveWith(d,e)}};if(1>=b&&(O(a,g.done(h(c)).resolve,g.reject),"pending"===g.state()||r.isFunction(e[c]&&e[c].then)))return g.then();while(c--)O(e[c],h(c),g.reject);return g.promise()}});var P=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;r.Deferred.exceptionHook=function(b,c){a.console&&a.console.warn&&b&&P.test(b.name)&&a.console.warn("jQuery.Deferred exception: "+b.message,b.stack,c)};var Q=r.Deferred();r.fn.ready=function(a){return Q.then(a),this},r.extend({isReady:!1,readyWait:1,holdReady:function(a){a?r.readyWait++:r.ready(!0)},ready:function(a){(a===!0?--r.readyWait:r.isReady)||(r.isReady=!0,a!==!0&&--r.readyWait>0||Q.resolveWith(d,[r]))}}),r.ready.then=Q.then;function R(){d.removeEventListener("DOMContentLoaded",R),a.removeEventListener("load",R),r.ready()}"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll?a.setTimeout(r.ready):(d.addEventListener("DOMContentLoaded",R),a.addEventListener("load",R));var S=function(a,b,c,d,e,f,g){ -var h=0,i=a.length,j=null==c;if("object"===r.type(c)){e=!0;for(h in c)S(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,r.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(r(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},T=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function U(){this.expando=r.expando+U.uid++}U.uid=1,U.prototype={cache:function(a){var b=a[this.expando];return b||(b={},T(a)&&(a.nodeType?a[this.expando]=b:Object.defineProperty(a,this.expando,{value:b,configurable:!0}))),b},set:function(a,b,c){var d,e=this.cache(a);if("string"==typeof b)e[r.camelCase(b)]=c;else for(d in b)e[r.camelCase(d)]=b[d];return e},get:function(a,b){return void 0===b?this.cache(a):a[this.expando]&&a[this.expando][r.camelCase(b)]},access:function(a,b,c){return void 0===b||b&&"string"==typeof b&&void 0===c?this.get(a,b):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d=a[this.expando];if(void 0!==d){if(void 0!==b){r.isArray(b)?b=b.map(r.camelCase):(b=r.camelCase(b),b=b in d?[b]:b.match(K)||[]),c=b.length;while(c--)delete d[b[c]]}(void 0===b||r.isEmptyObject(d))&&(a.nodeType?a[this.expando]=void 0:delete a[this.expando])}},hasData:function(a){var b=a[this.expando];return void 0!==b&&!r.isEmptyObject(b)}};var V=new U,W=new U,X=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Y=/[A-Z]/g;function Z(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(Y,"-$&").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:X.test(c)?JSON.parse(c):c}catch(e){}W.set(a,b,c)}else c=void 0;return c}r.extend({hasData:function(a){return W.hasData(a)||V.hasData(a)},data:function(a,b,c){return W.access(a,b,c)},removeData:function(a,b){W.remove(a,b)},_data:function(a,b,c){return V.access(a,b,c)},_removeData:function(a,b){V.remove(a,b)}}),r.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=W.get(f),1===f.nodeType&&!V.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=r.camelCase(d.slice(5)),Z(f,d,e[d])));V.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){W.set(this,a)}):S(this,function(b){var c;if(f&&void 0===b){if(c=W.get(f,a),void 0!==c)return c;if(c=Z(f,a),void 0!==c)return c}else this.each(function(){W.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){W.remove(this,a)})}}),r.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=V.get(a,b),c&&(!d||r.isArray(c)?d=V.access(a,b,r.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=r.queue(a,b),d=c.length,e=c.shift(),f=r._queueHooks(a,b),g=function(){r.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 V.get(a,c)||V.access(a,c,{empty:r.Callbacks("once memory").add(function(){V.remove(a,[b+"queue",c])})})}}),r.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthf;f++)d=a[f],d.style&&(c=d.style.display,b?("none"===c&&(e[f]=V.get(d,"display")||null,e[f]||(d.style.display="")),""===d.style.display&&ba(d)&&(e[f]=fa(d))):"none"!==c&&(e[f]="none",V.set(d,"display",c)));for(f=0;g>f;f++)null!=e[f]&&(a[f].style.display=e[f]);return a}r.fn.extend({show:function(){return ga(this,!0)},hide:function(){return ga(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){ba(this)?r(this).show():r(this).hide()})}});var ha=/^(?:checkbox|radio)$/i,ia=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,ja=/^$|\/(?:java|ecma)script/i,ka={option:[1,""],thead:[1,"","
          "],col:[2,"","
          "],tr:[2,"","
          "],td:[3,"","
          "],_default:[0,"",""]};ka.optgroup=ka.option,ka.tbody=ka.tfoot=ka.colgroup=ka.caption=ka.thead,ka.th=ka.td;function la(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&r.nodeName(a,b)?r.merge([a],c):c}function ma(a,b){for(var c=0,d=a.length;d>c;c++)V.set(a[c],"globalEval",!b||V.get(b[c],"globalEval"))}var na=/<|&#?\w+;/;function oa(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],n=0,o=a.length;o>n;n++)if(f=a[n],f||0===f)if("object"===r.type(f))r.merge(m,f.nodeType?[f]:f);else if(na.test(f)){g=g||l.appendChild(b.createElement("div")),h=(ia.exec(f)||["",""])[1].toLowerCase(),i=ka[h]||ka._default,g.innerHTML=i[1]+r.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;r.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push(b.createTextNode(f));l.textContent="",n=0;while(f=m[n++])if(d&&r.inArray(f,d)>-1)e&&e.push(f);else if(j=r.contains(f.ownerDocument,f),g=la(l.appendChild(f),"script"),j&&ma(g),c){k=0;while(f=g[k++])ja.test(f.type||"")&&c.push(f)}return l}!function(){var a=d.createDocumentFragment(),b=a.appendChild(d.createElement("div")),c=d.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),o.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="",o.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var pa=d.documentElement,qa=/^key/,ra=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,sa=/^([^.]*)(?:\.(.+)|)/;function ta(){return!0}function ua(){return!1}function va(){try{return d.activeElement}catch(a){}}function wa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b)wa(a,h,c,d,b[h],f);return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1)e=ua;else if(!e)return a;return 1===f&&(g=e,e=function(a){return r().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=r.guid++)),a.each(function(){r.event.add(this,b,e,d,c)})}r.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.get(a);if(q){c.handler&&(f=c,c=f.handler,e=f.selector),e&&r.find.matchesSelector(pa,e),c.guid||(c.guid=r.guid++),(i=q.events)||(i=q.events={}),(g=q.handle)||(g=q.handle=function(b){return"undefined"!=typeof r&&r.event.triggered!==b.type?r.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(K)||[""],j=b.length;while(j--)h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n&&(l=r.event.special[n]||{},n=(e?l.delegateType:l.bindType)||n,l=r.event.special[n]||{},k=r.extend({type:n,origType:p,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&r.expr.match.needsContext.test(e),namespace:o.join(".")},f),(m=i[n])||(m=i[n]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,o,g)!==!1||a.addEventListener&&a.addEventListener(n,g)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),r.event.global[n]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,n,o,p,q=V.hasData(a)&&V.get(a);if(q&&(i=q.events)){b=(b||"").match(K)||[""],j=b.length;while(j--)if(h=sa.exec(b[j])||[],n=p=h[1],o=(h[2]||"").split(".").sort(),n){l=r.event.special[n]||{},n=(d?l.delegateType:l.bindType)||n,m=i[n]||[],h=h[2]&&new RegExp("(^|\\.)"+o.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&p!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,o,q.handle)!==!1||r.removeEvent(a,n,q.handle),delete i[n])}else for(n in i)r.event.remove(a,n+b[j],c,d,!0);r.isEmptyObject(i)&&V.remove(a,"handle events")}},dispatch:function(a){var b=r.event.fix(a),c,d,e,f,g,h,i=new Array(arguments.length),j=(V.get(this,"events")||{})[b.type]||[],k=r.event.special[b.type]||{};for(i[0]=b,c=1;cc;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?r(e,this).index(i)>-1:r.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h\x20\t\r\n\f]*)[^>]*)\/>/gi,ya=/\s*$/g;function Ca(a,b){return r.nodeName(a,"table")&&r.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a:a}function Da(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function Ea(a){var b=Aa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(V.hasData(a)&&(f=V.access(a),g=V.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)r.event.add(b,e,j[e][c])}W.hasData(a)&&(h=W.access(a),i=r.extend({},h),W.set(b,i))}}function Ga(a,b){var c=b.nodeName.toLowerCase();"input"===c&&ha.test(a.type)?b.checked=a.checked:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}function Ha(a,b,c,d){b=g.apply([],b);var e,f,h,i,j,k,l=0,m=a.length,n=m-1,q=b[0],s=r.isFunction(q);if(s||m>1&&"string"==typeof q&&!o.checkClone&&za.test(q))return a.each(function(e){var f=a.eq(e);s&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)});if(m&&(e=oa(b,a[0].ownerDocument,!1,a,d),f=e.firstChild,1===e.childNodes.length&&(e=f),f||d)){for(h=r.map(la(e,"script"),Da),i=h.length;m>l;l++)j=e,l!==n&&(j=r.clone(j,!0,!0),i&&r.merge(h,la(j,"script"))),c.call(a[l],j,l);if(i)for(k=h[h.length-1].ownerDocument,r.map(h,Ea),l=0;i>l;l++)j=h[l],ja.test(j.type||"")&&!V.access(j,"globalEval")&&r.contains(k,j)&&(j.src?r._evalUrl&&r._evalUrl(j.src):p(j.textContent.replace(Ba,""),k))}return a}function Ia(a,b,c){for(var d,e=b?r.filter(b,a):a,f=0;null!=(d=e[f]);f++)c||1!==d.nodeType||r.cleanData(la(d)),d.parentNode&&(c&&r.contains(d.ownerDocument,d)&&ma(la(d,"script")),d.parentNode.removeChild(d));return a}r.extend({htmlPrefilter:function(a){return a.replace(xa,"<$1>")},clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=r.contains(a.ownerDocument,a);if(!(o.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||r.isXMLDoc(a)))for(g=la(h),f=la(a),d=0,e=f.length;e>d;d++)Ga(f[d],g[d]);if(b)if(c)for(f=f||la(a),g=g||la(h),d=0,e=f.length;e>d;d++)Fa(f[d],g[d]);else Fa(a,h);return g=la(h,"script"),g.length>0&&ma(g,!i&&la(a,"script")),h},cleanData:function(a){for(var b,c,d,e=r.event.special,f=0;void 0!==(c=a[f]);f++)if(T(c)){if(b=c[V.expando]){if(b.events)for(d in b.events)e[d]?r.event.remove(c,d):r.removeEvent(c,d,b.handle);c[V.expando]=void 0}c[W.expando]&&(c[W.expando]=void 0)}}}),r.fn.extend({detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return S(this,function(a){return void 0===a?r.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=a)})},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(r.cleanData(la(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return r.clone(this,a,b)})},html:function(a){return S(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!ya.test(a)&&!ka[(ia.exec(a)||["",""])[1].toLowerCase()]){a=r.htmlPrefilter(a);try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(r.cleanData(la(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;r.inArray(this,a)<0&&(r.cleanData(la(this)),c&&c.replaceChild(b,this))},a)}}),r.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){r.fn[a]=function(a){for(var c,d=[],e=r(a),f=e.length-1,g=0;f>=g;g++)c=g===f?this:this.clone(!0),r(e[g])[b](c),h.apply(d,c.get());return this.pushStack(d)}});var Ja=/^margin/,Ka=new RegExp("^("+$+")(?!px)[a-z%]+$","i"),La=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)};!function(){function b(){if(i){i.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",i.innerHTML="",pa.appendChild(h);var b=a.getComputedStyle(i);c="1%"!==b.top,g="2px"===b.marginLeft,e="4px"===b.width,i.style.marginRight="50%",f="4px"===b.marginRight,pa.removeChild(h),i=null}}var c,e,f,g,h=d.createElement("div"),i=d.createElement("div");i.style&&(i.style.backgroundClip="content-box",i.cloneNode(!0).style.backgroundClip="",o.clearCloneStyle="content-box"===i.style.backgroundClip,h.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",h.appendChild(i),r.extend(o,{pixelPosition:function(){return b(),c},boxSizingReliable:function(){return b(),e},pixelMarginRight:function(){return b(),f},reliableMarginLeft:function(){return b(),g}}))}();function Ma(a,b,c){var d,e,f,g,h=a.style;return c=c||La(a),c&&(g=c.getPropertyValue(b)||c[b],""!==g||r.contains(a.ownerDocument,a)||(g=r.style(a,b)),!o.pixelMarginRight()&&Ka.test(g)&&Ja.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}function Na(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Oa=/^(none|table(?!-c[ea]).+)/,Pa={position:"absolute",visibility:"hidden",display:"block"},Qa={letterSpacing:"0",fontWeight:"400"},Ra=["Webkit","Moz","ms"],Sa=d.createElement("div").style;function Ta(a){if(a in Sa)return a;var b=a[0].toUpperCase()+a.slice(1),c=Ra.length;while(c--)if(a=Ra[c]+b,a in Sa)return a}function Ua(a,b,c){var d=_.exec(b);return d?Math.max(0,d[2]-(c||0))+(d[3]||"px"):b}function Va(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+=r.css(a,c+aa[f],!0,e)),d?("content"===c&&(g-=r.css(a,"padding"+aa[f],!0,e)),"margin"!==c&&(g-=r.css(a,"border"+aa[f]+"Width",!0,e))):(g+=r.css(a,"padding"+aa[f],!0,e),"padding"!==c&&(g+=r.css(a,"border"+aa[f]+"Width",!0,e)));return g}function Wa(a,b,c){var d,e=!0,f=La(a),g="border-box"===r.css(a,"boxSizing",!1,f);if(a.getClientRects().length&&(d=a.getBoundingClientRect()[b]),0>=d||null==d){if(d=Ma(a,b,f),(0>d||null==d)&&(d=a.style[b]),Ka.test(d))return d;e=g&&(o.boxSizingReliable()||d===a.style[b]),d=parseFloat(d)||0}return d+Va(a,b,c||(g?"border":"content"),e,f)+"px"}r.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ma(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,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":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=r.camelCase(b),i=a.style;return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=_.exec(c))&&e[1]&&(c=da(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(r.cssNumber[h]?"":"px")),o.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=r.camelCase(b);return b=r.cssProps[h]||(r.cssProps[h]=Ta(h)||h),g=r.cssHooks[b]||r.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=Ma(a,b,d)),"normal"===e&&b in Qa&&(e=Qa[b]),""===c||c?(f=parseFloat(e),c===!0||isFinite(f)?f||0:e):e}}),r.each(["height","width"],function(a,b){r.cssHooks[b]={get:function(a,c,d){return c?!Oa.test(r.css(a,"display"))||a.getClientRects().length&&a.getBoundingClientRect().width?Wa(a,b,d):ca(a,Pa,function(){return Wa(a,b,d)}):void 0},set:function(a,c,d){var e,f=d&&La(a),g=d&&Va(a,b,d,"border-box"===r.css(a,"boxSizing",!1,f),f);return g&&(e=_.exec(c))&&"px"!==(e[3]||"px")&&(a.style[b]=c,c=r.css(a,b)),Ua(a,c,g)}}}),r.cssHooks.marginLeft=Na(o.reliableMarginLeft,function(a,b){return b?(parseFloat(Ma(a,"marginLeft"))||a.getBoundingClientRect().left-ca(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}))+"px":void 0}),r.each({margin:"",padding:"",border:"Width"},function(a,b){r.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+aa[d]+b]=f[d]||f[d-2]||f[0];return e}},Ja.test(a)||(r.cssHooks[a+b].set=Ua)}),r.fn.extend({css:function(a,b){return S(this,function(a,b,c){var d,e,f={},g=0;if(r.isArray(b)){for(d=La(a),e=b.length;e>g;g++)f[b[g]]=r.css(a,b[g],!1,d);return f}return void 0!==c?r.style(a,b,c):r.css(a,b)},a,b,arguments.length>1)}}),r.fn.delay=function(b,c){return b=r.fx?r.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a=d.createElement("input"),b=d.createElement("select"),c=b.appendChild(d.createElement("option"));a.type="checkbox",o.checkOn=""!==a.value,o.optSelected=c.selected,a=d.createElement("input"),a.value="t",a.type="radio",o.radioValue="t"===a.value}();var Xa,Ya=r.expr.attrHandle;r.fn.extend({attr:function(a,b){return S(this,r.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){r.removeAttr(this,a)})}}),r.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return"undefined"==typeof a.getAttribute?r.prop(a,b,c):(1===f&&r.isXMLDoc(a)||(e=r.attrHooks[b.toLowerCase()]||(r.expr.match.bool.test(b)?Xa:void 0)),void 0!==c?null===c?void r.removeAttr(a,b):e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get"in e&&null!==(d=e.get(a,b))?d:(d=r.find.attr(a,b),null==d?void 0:d))},attrHooks:{type:{set:function(a,b){if(!o.radioValue&&"radio"===b&&r.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d=0,e=b&&b.match(K);if(e&&1===a.nodeType)while(c=e[d++])a.removeAttribute(c)}}),Xa={set:function(a,b,c){return b===!1?r.removeAttr(a,c):a.setAttribute(c,c),c}},r.each(r.expr.match.bool.source.match(/\w+/g),function(a,b){var c=Ya[b]||r.find.attr;Ya[b]=function(a,b,d){var e,f,g=b.toLowerCase();return d||(f=Ya[g],Ya[g]=e,e=null!=c(a,b,d)?g:null,Ya[g]=f),e}});var Za=/^(?:input|select|textarea|button)$/i,$a=/^(?:a|area)$/i;r.fn.extend({prop:function(a,b){return S(this,r.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[r.propFix[a]||a]})}}),r.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f)return 1===f&&r.isXMLDoc(a)||(b=r.propFix[b]||b,e=r.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=r.find.attr(a,"tabindex");return b?parseInt(b,10):Za.test(a.nodeName)||$a.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),o.optSelected||(r.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),r.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){r.propFix[this.toLowerCase()]=this});var _a=/[\t\r\n\f]/g;function ab(a){return a.getAttribute&&a.getAttribute("class")||""}r.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).addClass(a.call(this,b,ab(this)))});if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=ab(c),d=1===c.nodeType&&(" "+e+" ").replace(_a," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(r.isFunction(a))return this.each(function(b){r(this).removeClass(a.call(this,b,ab(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(K)||[];while(c=this[i++])if(e=ab(c),d=1===c.nodeType&&(" "+e+" ").replace(_a," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=r.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):r.isFunction(a)?this.each(function(c){r(this).toggleClass(a.call(this,c,ab(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=r(this),f=a.match(K)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=ab(this),b&&V.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":V.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+ab(c)+" ").replace(_a," ").indexOf(b)>-1)return!0;return!1}});var bb=/\r/g,cb=/[\x20\t\r\n\f]+/g;r.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=r.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,r(this).val()):a,null==e?e="":"number"==typeof e?e+="":r.isArray(e)&&(e=r.map(e,function(a){return null==a?"":a+""})),b=r.valHooks[this.type]||r.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=r.valHooks[e.type]||r.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bb,""):null==c?"":c)}}}),r.extend({valHooks:{option:{get:function(a){var b=r.find.attr(a,"value");return null!=b?b:r.trim(r.text(a)).replace(cb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type,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)&&!c.disabled&&(!c.parentNode.disabled||!r.nodeName(c.parentNode,"optgroup"))){if(b=r(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=r.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=r.inArray(r.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),r.each(["radio","checkbox"],function(){r.valHooks[this]={set:function(a,b){return r.isArray(b)?a.checked=r.inArray(r(a).val(),b)>-1:void 0}},o.checkOn||(r.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var db=/^(?:focusinfocus|focusoutblur)$/;r.extend(r.event,{trigger:function(b,c,e,f){var g,h,i,j,k,m,n,o=[e||d],p=l.call(b,"type")?b.type:b,q=l.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!db.test(p+r.event.triggered)&&(p.indexOf(".")>-1&&(q=p.split("."),p=q.shift(),q.sort()),k=p.indexOf(":")<0&&"on"+p,b=b[r.expando]?b:new r.Event(p,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=q.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:r.makeArray(c,[b]),n=r.event.special[p]||{},f||!n.trigger||n.trigger.apply(e,c)!==!1)){if(!f&&!n.noBubble&&!r.isWindow(e)){for(j=n.delegateType||p,db.test(j+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),i=h;i===(e.ownerDocument||d)&&o.push(i.defaultView||i.parentWindow||a)}g=0;while((h=o[g++])&&!b.isPropagationStopped())b.type=g>1?j:n.bindType||p,m=(V.get(h,"events")||{})[b.type]&&V.get(h,"handle"),m&&m.apply(h,c),m=k&&h[k],m&&m.apply&&T(h)&&(b.result=m.apply(h,c),b.result===!1&&b.preventDefault());return b.type=p,f||b.isDefaultPrevented()||n._default&&n._default.apply(o.pop(),c)!==!1||!T(e)||k&&r.isFunction(e[p])&&!r.isWindow(e)&&(i=e[k],i&&(e[k]=null),r.event.triggered=p,e[p](),r.event.triggered=void 0,i&&(e[k]=i)),b.result}},simulate:function(a,b,c){var d=r.extend(new r.Event,c,{type:a,isSimulated:!0});r.event.trigger(d,null,b)}}),r.fn.extend({trigger:function(a,b){return this.each(function(){r.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?r.event.trigger(a,b,c,!0):void 0}}),r.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(a,b){r.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),r.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),o.focusin="onfocusin"in a,o.focusin||r.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){r.event.simulate(b,a.target,r.event.fix(a))};r.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=V.access(d,b);e||d.addEventListener(a,c,!0),V.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=V.access(d,b)-1;e?V.access(d,b,e):(d.removeEventListener(a,c,!0),V.remove(d,b))}}});var eb=/\[\]$/,fb=/\r?\n/g,gb=/^(?:submit|button|image|reset|file)$/i,hb=/^(?:input|select|textarea|keygen)/i;function ib(a,b,c,d){var e;if(r.isArray(b))r.each(b,function(b,e){c||eb.test(a)?d(a,e):ib(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)});else if(c||"object"!==r.type(b))d(a,b);else for(e in b)ib(a+"["+e+"]",b[e],c,d)}r.param=function(a,b){var c,d=[],e=function(a,b){var c=r.isFunction(b)?b():b;d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(null==c?"":c)};if(r.isArray(a)||a.jquery&&!r.isPlainObject(a))r.each(a,function(){e(this.name,this.value)});else for(c in a)ib(c,a[c],b,e); -return d.join("&")},r.fn.extend({serialize:function(){return r.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=r.prop(this,"elements");return a?r.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!r(this).is(":disabled")&&hb.test(this.nodeName)&&!gb.test(a)&&(this.checked||!ha.test(a))}).map(function(a,b){var c=r(this).val();return null==c?null:r.isArray(c)?r.map(c,function(a){return{name:b.name,value:a.replace(fb,"\r\n")}}):{name:b.name,value:c.replace(fb,"\r\n")}}).get()}}),r.fn.extend({wrapAll:function(a){var b;return this[0]&&(r.isFunction(a)&&(a=a.call(this[0])),b=r(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this},wrapInner:function(a){return r.isFunction(a)?this.each(function(b){r(this).wrapInner(a.call(this,b))}):this.each(function(){var b=r(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=r.isFunction(a);return this.each(function(c){r(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(a){return this.parent(a).not("body").each(function(){r(this).replaceWith(this.childNodes)}),this}}),r.expr.pseudos.hidden=function(a){return!r.expr.pseudos.visible(a)},r.expr.pseudos.visible=function(a){return!!(a.offsetWidth||a.offsetHeight||a.getClientRects().length)},o.createHTMLDocument=function(){var a=d.implementation.createHTMLDocument("").body;return a.innerHTML="
          ",2===a.childNodes.length}(),r.parseHTML=function(a,b,c){if("string"!=typeof a)return[];"boolean"==typeof b&&(c=b,b=!1);var e,f,g;return b||(o.createHTMLDocument?(b=d.implementation.createHTMLDocument(""),e=b.createElement("base"),e.href=d.location.href,b.head.appendChild(e)):b=d),f=B.exec(a),g=!c&&[],f?[b.createElement(f[1])]:(f=oa([a],b,g),g&&g.length&&r(g).remove(),r.merge([],f.childNodes))};function jb(a){return r.isWindow(a)?a:9===a.nodeType&&a.defaultView}r.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=r.css(a,"position"),l=r(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=r.css(a,"top"),i=r.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),r.isFunction(b)&&(b=b.call(a,c,r.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},r.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){r.offset.setOffset(this,a,b)});var b,c,d,e,f=this[0];if(f)return f.getClientRects().length?(d=f.getBoundingClientRect(),d.width||d.height?(e=f.ownerDocument,c=jb(e),b=e.documentElement,{top:d.top+c.pageYOffset-b.clientTop,left:d.left+c.pageXOffset-b.clientLeft}):d):{top:0,left:0}},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===r.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),r.nodeName(a[0],"html")||(d=a.offset()),d={top:d.top+r.css(a[0],"borderTopWidth",!0),left:d.left+r.css(a[0],"borderLeftWidth",!0)}),{top:b.top-d.top-r.css(c,"marginTop",!0),left:b.left-d.left-r.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&"static"===r.css(a,"position"))a=a.offsetParent;return a||pa})}}),r.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c="pageYOffset"===b;r.fn[a]=function(d){return S(this,function(a,d,e){var f=jb(a);return void 0===e?f?f[b]:a[d]:void(f?f.scrollTo(c?f.pageXOffset:e,c?e:f.pageYOffset):a[d]=e)},a,d,arguments.length)}}),r.each(["top","left"],function(a,b){r.cssHooks[b]=Na(o.pixelPosition,function(a,c){return c?(c=Ma(a,b),Ka.test(c)?r(a).position()[b]+"px":c):void 0})}),r.each({Height:"height",Width:"width"},function(a,b){r.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){r.fn[d]=function(e,f){var g=arguments.length&&(c||"boolean"!=typeof e),h=c||(e===!0||f===!0?"margin":"border");return S(this,function(b,c,e){var f;return r.isWindow(b)?0===d.indexOf("outer")?b["inner"+a]:b.document.documentElement["client"+a]:9===b.nodeType?(f=b.documentElement,Math.max(b.body["scroll"+a],f["scroll"+a],b.body["offset"+a],f["offset"+a],f["client"+a])):void 0===e?r.css(b,c,h):r.style(b,c,e,h)},b,g?e:void 0,g)}})}),"function"==typeof define&&define.amd&&define("jquery",[],function(){return r});var kb=a.jQuery,lb=a.$;return r.noConflict=function(b){return a.$===r&&(a.$=lb),b&&a.jQuery===r&&(a.jQuery=kb),r},b||(a.jQuery=a.$=r),r}); - -},{}],43:[function(require,module,exports){ -/* jquery.resize - * based on jQuery resize event (@ "Cowboy" Ben Alman http://benalman.com/projects/jquery-resize-plugin/) - * just lighter and faster -*/ -(function($){ - - var elems = [], - pollInterval = 250, - resizeTimeout - - $.event.special.resize = { - setup: function() { - - if (this===window) return false - - var elem = this - - // Add this element to the list of internal elements to monitor. - elems.push( elem ) - - // If this is the first element added, start the polling loop. - if ( elems.length === 1 ) { - resizePollingLoop() - } - }, - teardown: function() { - - if (this===window) return false - - var elem = this - - // Remove this element from the list of internal elements to monitor. - for (var i = elems.length - 1; i >= 0; i--) { - if(elems[i] == this){ - elems.splice(i, 1) - break - } - } - - if ( !elems.length ) { - clearTimeout(resizeTimeout) - } - - }, - add: function(handleObj) { - - if (this===window) return false - - // Save a reference to the bound event handler. - var old_handler = handleObj.handler - - handleObj.handler = function(event,data) { - // Call the originally-bound event handler and return its result. - return old_handler.apply(this, arguments) - } - } - } - - function checkResizes(){ - // Iterate over all elements to which the 'resize' event is bound. - for (var i = elems.length - 1; i >= 0; i--) { - var elem = elems[i], - width = elem.offsetWidth, - height = elem.offsetHeight - - if (!width) continue - - var data = { - w:elem.resizedataw, - h:elem.resizedatah - } - - // If element size has changed since the last time, update the element - // data store and trigger the 'resize' event. - if ( width != data.w || height != data.h ) { - elem.resizedataw = width - elem.resizedatah = height - $(elem).triggerHandler('resize',[width,height]) - } - - } - - // Loop. - resizePollingLoop() - } - - function resizePollingLoop() { - // yep, setTimeout, 'cuz requestAnimation doesn't seem to perform that well - resizeTimeout = window.setTimeout(checkResizes, pollInterval) - - } - - $(window).resize(checkResizes) - -})(jQuery) - -},{}],44:[function(require,module,exports){ -/*! jQuery UI - v1.12.0 - 2016-07-29 -* http://jqueryui.com -* Includes: widget.js, data.js, disable-selection.js, scroll-parent.js, widgets/draggable.js, widgets/resizable.js, widgets/sortable.js, widgets/mouse.js -* Copyright jQuery Foundation and other contributors; Licensed MIT */ - -(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)})(function(t){t.ui=t.ui||{},t.ui.version="1.12.0";var e=0,i=Array.prototype.slice;t.cleanData=function(e){return function(i){var s,n,o;for(o=0;null!=(n=i[o]);o++)try{s=t._data(n,"events"),s&&s.remove&&t(n).triggerHandler("remove")}catch(a){}e(i)}}(t.cleanData),t.widget=function(e,i,s){var n,o,a,r={},l=e.split(".")[0];e=e.split(".")[1];var h=l+"-"+e;return s||(s=i,i=t.Widget),t.isArray(s)&&(s=t.extend.apply(null,[{}].concat(s))),t.expr[":"][h.toLowerCase()]=function(e){return!!t.data(e,h)},t[l]=t[l]||{},n=t[l][e],o=t[l][e]=function(t,e){return this._createWidget?(arguments.length&&this._createWidget(t,e),void 0):new o(t,e)},t.extend(o,n,{version:s.version,_proto:t.extend({},s),_childConstructors:[]}),a=new i,a.options=t.widget.extend({},a.options),t.each(s,function(e,s){return t.isFunction(s)?(r[e]=function(){function t(){return i.prototype[e].apply(this,arguments)}function n(t){return i.prototype[e].apply(this,t)}return function(){var e,i=this._super,o=this._superApply;return this._super=t,this._superApply=n,e=s.apply(this,arguments),this._super=i,this._superApply=o,e}}(),void 0):(r[e]=s,void 0)}),o.prototype=t.widget.extend(a,{widgetEventPrefix:n?a.widgetEventPrefix||e:e},r,{constructor:o,namespace:l,widgetName:e,widgetFullName:h}),n?(t.each(n._childConstructors,function(e,i){var s=i.prototype;t.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete n._childConstructors):i._childConstructors.push(o),t.widget.bridge(e,o),o},t.widget.extend=function(e){for(var s,n,o=i.call(arguments,1),a=0,r=o.length;r>a;a++)for(s in o[a])n=o[a][s],o[a].hasOwnProperty(s)&&void 0!==n&&(e[s]=t.isPlainObject(n)?t.isPlainObject(e[s])?t.widget.extend({},e[s],n):t.widget.extend({},n):n);return e},t.widget.bridge=function(e,s){var n=s.prototype.widgetFullName||e;t.fn[e]=function(o){var a="string"==typeof o,r=i.call(arguments,1),l=this;return a?this.each(function(){var i,s=t.data(this,n);return"instance"===o?(l=s,!1):s?t.isFunction(s[o])&&"_"!==o.charAt(0)?(i=s[o].apply(s,r),i!==s&&void 0!==i?(l=i&&i.jquery?l.pushStack(i.get()):i,!1):void 0):t.error("no such method '"+o+"' for "+e+" widget instance"):t.error("cannot call methods on "+e+" prior to initialization; "+"attempted to call method '"+o+"'")}):(r.length&&(o=t.widget.extend.apply(null,[o].concat(r))),this.each(function(){var e=t.data(this,n);e?(e.option(o||{}),e._init&&e._init()):t.data(this,n,new s(o,this))})),l}},t.Widget=function(){},t.Widget._childConstructors=[],t.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
          ",options:{classes:{},disabled:!1,create:null},_createWidget:function(i,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=e++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),i),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.extend({disableSelection:function(){var t="onselectstart"in document.createElement("div")?"selectstart":"mousedown";return function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}}(),enableSelection:function(){return this.off(".ui-disableSelection")}}),t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var s=!1;t(document).on("mouseup",function(){s=!1}),t.widget("ui.mouse",{version:"1.12.0",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!s){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,n=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return n&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),s=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,s=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.ui.plugin={add:function(e,i,s){var n,o=t.ui[e].prototype;for(n in s)o.plugins[n]=o.plugins[n]||[],o.plugins[n].push([i,s[n]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;o.length>n;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},t.ui.safeActiveElement=function(t){var e;try{e=t.activeElement}catch(i){e=t.body}return e||(e=t.body),e.nodeName||(e=t.body),e},t.ui.safeBlur=function(e){e&&"body"!==e.nodeName.toLowerCase()&&t(e).trigger("blur")},t.widget("ui.draggable",t.ui.mouse,{version:"1.12.0",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){return(this.helper||this.element).is(".ui-draggable-dragging")?(this.destroyOnClear=!0,void 0):(this._removeHandleClassName(),this._mouseDestroy(),void 0)},_mouseCapture:function(e){var i=this.options;return this._blurActiveElement(e),this.helper||i.disabled||t(e.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(e),this.handle?(this._blockFrames(i.iframeFix===!0?"iframe":i.iframeFix),!0):!1)},_blockFrames:function(e){this.iframeBlocks=this.document.find(e).map(function(){var e=t(this);return t("
          ").css("position","absolute").appendTo(e.parent()).outerWidth(e.outerWidth()).outerHeight(e.outerHeight()).offset(e.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(e){var i=t.ui.safeActiveElement(this.document[0]),s=t(e.target);this._getHandle(e)&&s.closest(i).length||t.ui.safeBlur(i)},_mouseStart:function(e){var i=this.options;return this.helper=this._createHelper(e),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),t.ui.ddmanager&&(t.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=this.helper.parents().filter(function(){return"fixed"===t(this).css("position")}).length>0,this.positionAbs=this.element.offset(),this._refreshOffsets(e),this.originalPosition=this.position=this._generatePosition(e,!1),this.originalPageX=e.pageX,this.originalPageY=e.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",e)===!1?(this._clear(),!1):(this._cacheHelperProportions(),t.ui.ddmanager&&!i.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this._mouseDrag(e,!0),t.ui.ddmanager&&t.ui.ddmanager.dragStart(this,e),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(e,i){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(e,!0),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",e,s)===!1)return this._mouseUp(new t.Event("mouseup",e)),!1;this.position=s.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),!1},_mouseStop:function(e){var i=this,s=!1;return t.ui.ddmanager&&!this.options.dropBehaviour&&(s=t.ui.ddmanager.drop(this,e)),this.dropped&&(s=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||t.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?t(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",e)!==!1&&i._clear()}):this._trigger("stop",e)!==!1&&this._clear(),!1},_mouseUp:function(e){return this._unblockFrames(),t.ui.ddmanager&&t.ui.ddmanager.dragStop(this,e),this.handleElement.is(e.target)&&this.element.trigger("focus"),t.ui.mouse.prototype._mouseUp.call(this,e)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new t.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(e){return this.options.handle?!!t(e.target).closest(this.element.find(this.options.handle)).length:!0},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper),n=s?t(i.helper.apply(this.element[0],[e])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return n.parents("body").length||n.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s&&n[0]===this.element[0]&&this._setPositionRelative(),n[0]===this.element[0]||/(fixed|absolute)/.test(n.css("position"))||n.css("position","absolute"),n},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var e=this.offsetParent.offset(),i=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==i&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),this._isRootNode(this.offsetParent[0])&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options,o=this.document[0];return this.relativeContainer=null,n.containment?"window"===n.containment?(this.containment=[t(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,t(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,t(window).scrollLeft()+t(window).width()-this.helperProportions.width-this.margins.left,t(window).scrollTop()+(t(window).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):"document"===n.containment?(this.containment=[0,0,t(o).width()-this.helperProportions.width-this.margins.left,(t(o).height()||o.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],void 0):n.containment.constructor===Array?(this.containment=n.containment,void 0):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=t(n.containment),s=i[0],s&&(e=/(scroll|auto)/.test(i.css("overflow")),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(e?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(e?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=i),void 0):(this.containment=null,void 0)},_convertPositionTo:function(t,e){e||(e=this.position);var i="absolute"===t?1:-1,s=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:s?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:s?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s,n,o,a=this.options,r=this._isRootNode(this.scrollParent[0]),l=t.pageX,h=t.pageY;return r&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(this.relativeContainer?(s=this.relativeContainer.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.lefti[2]&&(l=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(h=i[3]+this.offset.click.top)),a.grid&&(n=a.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/a.grid[1])*a.grid[1]:this.originalPageY,h=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-a.grid[1]:n+a.grid[1]:n,o=a.grid[0]?this.originalPageX+Math.round((l-this.originalPageX)/a.grid[0])*a.grid[0]:this.originalPageX,l=i?o-this.offset.click.left>=i[0]||o-this.offset.click.left>i[2]?o:o-this.offset.click.left>=i[0]?o-a.grid[0]:o+a.grid[0]:o),"y"===a.axis&&(l=this.originalPageX),"x"===a.axis&&(h=this.originalPageY)),{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:r?0:this.offset.scroll.top),left:l-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:r?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(e,i,s){return s=s||this._uiHash(),t.ui.plugin.call(this,e,[i,s,this],!0),/^(drag|start|stop)/.test(e)&&(this.positionAbs=this._convertPositionTo("absolute"),s.offset=this.positionAbs),t.Widget.prototype._trigger.call(this,e,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),t.ui.plugin.add("draggable","connectToSortable",{start:function(e,i,s){var n=t.extend({},i,{item:s.element});s.sortables=[],t(s.options.connectToSortable).each(function(){var i=t(this).sortable("instance");i&&!i.options.disabled&&(s.sortables.push(i),i.refreshPositions(),i._trigger("activate",e,n))})},stop:function(e,i,s){var n=t.extend({},i,{item:s.element});s.cancelHelperRemoval=!1,t.each(s.sortables,function(){var t=this;t.isOver?(t.isOver=0,s.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,n))})},drag:function(e,i,s){t.each(s.sortables,function(){var n=!1,o=this;o.positionAbs=s.positionAbs,o.helperProportions=s.helperProportions,o.offset.click=s.offset.click,o._intersectsWith(o.containerCache)&&(n=!0,t.each(s.sortables,function(){return this.positionAbs=s.positionAbs,this.helperProportions=s.helperProportions,this.offset.click=s.offset.click,this!==o&&this._intersectsWith(this.containerCache)&&t.contains(o.element[0],this.element[0])&&(n=!1),n})),n?(o.isOver||(o.isOver=1,s._parent=i.helper.parent(),o.currentItem=i.helper.appendTo(o.element).data("ui-sortable-item",!0),o.options._helper=o.options.helper,o.options.helper=function(){return i.helper[0]},e.target=o.currentItem[0],o._mouseCapture(e,!0),o._mouseStart(e,!0,!0),o.offset.click.top=s.offset.click.top,o.offset.click.left=s.offset.click.left,o.offset.parent.left-=s.offset.parent.left-o.offset.parent.left,o.offset.parent.top-=s.offset.parent.top-o.offset.parent.top,s._trigger("toSortable",e),s.dropped=o.element,t.each(s.sortables,function(){this.refreshPositions()}),s.currentItem=s.element,o.fromOutside=s),o.currentItem&&(o._mouseDrag(e),i.position=o.position)):o.isOver&&(o.isOver=0,o.cancelHelperRemoval=!0,o.options._revert=o.options.revert,o.options.revert=!1,o._trigger("out",e,o._uiHash(o)),o._mouseStop(e,!0),o.options.revert=o.options._revert,o.options.helper=o.options._helper,o.placeholder&&o.placeholder.remove(),i.helper.appendTo(s._parent),s._refreshOffsets(e),i.position=s._generatePosition(e,!0),s._trigger("fromSortable",e),s.dropped=!1,t.each(s.sortables,function(){this.refreshPositions()}))})}}),t.ui.plugin.add("draggable","cursor",{start:function(e,i,s){var n=t("body"),o=s.options;n.css("cursor")&&(o._cursor=n.css("cursor")),n.css("cursor",o.cursor)},stop:function(e,i,s){var n=s.options;n._cursor&&t("body").css("cursor",n._cursor)}}),t.ui.plugin.add("draggable","opacity",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("opacity")&&(o._opacity=n.css("opacity")),n.css("opacity",o.opacity)},stop:function(e,i,s){var n=s.options;n._opacity&&t(i.helper).css("opacity",n._opacity)}}),t.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(e,i,s){var n=s.options,o=!1,a=s.scrollParentNotHidden[0],r=s.document[0];a!==r&&"HTML"!==a.tagName?(n.axis&&"x"===n.axis||(s.overflowOffset.top+a.offsetHeight-e.pageY=0;d--)l=s.snapElements[d].left-s.margins.left,h=l+s.snapElements[d].width,c=s.snapElements[d].top-s.margins.top,u=c+s.snapElements[d].height,l-g>_||m>h+g||c-g>b||v>u+g||!t.contains(s.snapElements[d].item.ownerDocument,s.snapElements[d].item)?(s.snapElements[d].snapping&&s.options.snap.release&&s.options.snap.release.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=!1):("inner"!==f.snapMode&&(n=g>=Math.abs(c-b),o=g>=Math.abs(u-v),a=g>=Math.abs(l-_),r=g>=Math.abs(h-m),n&&(i.position.top=s._convertPositionTo("relative",{top:c-s.helperProportions.height,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l-s.helperProportions.width}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h}).left)),p=n||o||a||r,"outer"!==f.snapMode&&(n=g>=Math.abs(c-v),o=g>=Math.abs(u-b),a=g>=Math.abs(l-m),r=g>=Math.abs(h-_),n&&(i.position.top=s._convertPositionTo("relative",{top:c,left:0}).top),o&&(i.position.top=s._convertPositionTo("relative",{top:u-s.helperProportions.height,left:0}).top),a&&(i.position.left=s._convertPositionTo("relative",{top:0,left:l}).left),r&&(i.position.left=s._convertPositionTo("relative",{top:0,left:h-s.helperProportions.width}).left)),!s.snapElements[d].snapping&&(n||o||a||r||p)&&s.options.snap.snap&&s.options.snap.snap.call(s.element,e,t.extend(s._uiHash(),{snapItem:s.snapElements[d].item})),s.snapElements[d].snapping=n||o||a||r||p)}}),t.ui.plugin.add("draggable","stack",{start:function(e,i,s){var n,o=s.options,a=t.makeArray(t(o.stack)).sort(function(e,i){return(parseInt(t(e).css("zIndex"),10)||0)-(parseInt(t(i).css("zIndex"),10)||0)});a.length&&(n=parseInt(t(a[0]).css("zIndex"),10)||0,t(a).each(function(e){t(this).css("zIndex",n+e)}),this.css("zIndex",n+a.length))}}),t.ui.plugin.add("draggable","zIndex",{start:function(e,i,s){var n=t(i.helper),o=s.options;n.css("zIndex")&&(o._zIndex=n.css("zIndex")),n.css("zIndex",o.zIndex)},stop:function(e,i,s){var n=s.options;n._zIndex&&t(i.helper).css("zIndex",n._zIndex)}}),t.ui.draggable,t.widget("ui.resizable",t.ui.mouse,{version:"1.12.0",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(e,i){if("hidden"===t(e).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",n=!1;return e[s]>0?!0:(e[s]=1,n=e[s]>0,e[s]=0,n)},_create:function(){var e,i=this.options,s=this;this._addClass("ui-resizable"),t.extend(this,{_aspectRatio:!!i.aspectRatio,aspectRatio:i.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:i.helper||i.ghost||i.animate?i.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(t("
          ").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,e={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(e),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(e),this._proportionallyResize()),this._setupHandles(),i.autoHide&&t(this.element).on("mouseenter",function(){i.disabled||(s._removeClass("ui-resizable-autohide"),s._handles.show()) -}).on("mouseleave",function(){i.disabled||s.resizing||(s._addClass("ui-resizable-autohide"),s._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy();var e,i=function(e){t(e).removeData("resizable").removeData("ui-resizable").off(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(i(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),i(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;default:}},_setupHandles:function(){var e,i,s,n,o,a=this.options,r=this;if(this.handles=a.handles||(t(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=t(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),s=this.handles.split(","),this.handles={},i=0;s.length>i;i++)e=t.trim(s[i]),n="ui-resizable-"+e,o=t("
          "),this._addClass(o,"ui-resizable-handle "+n),o.css({zIndex:a.zIndex}),this.handles[e]=".ui-resizable-"+e,this.element.append(o);this._renderAxis=function(e){var i,s,n,o;e=e||this.element;for(i in this.handles)this.handles[i].constructor===String?this.handles[i]=this.element.children(this.handles[i]).first().show():(this.handles[i].jquery||this.handles[i].nodeType)&&(this.handles[i]=t(this.handles[i]),this._on(this.handles[i],{mousedown:r._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(s=t(this.handles[i],this.element),o=/sw|ne|nw|se|n|s/.test(i)?s.outerHeight():s.outerWidth(),n=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join(""),e.css(n,o),this._proportionallyResize()),this._handles=this._handles.add(this.handles[i])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){r.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),r.axis=o&&o[1]?o[1]:"se")}),a.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._handles.remove()},_mouseCapture:function(e){var i,s,n=!1;for(i in this.handles)s=t(this.handles[i])[0],(s===e.target||t.contains(s,e.target))&&(n=!0);return!this.options.disabled&&n},_mouseStart:function(e){var i,s,n,o=this.options,a=this.element;return this.resizing=!0,this._renderProxy(),i=this._num(this.helper.css("left")),s=this._num(this.helper.css("top")),o.containment&&(i+=t(o.containment).scrollLeft()||0,s+=t(o.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:s},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:a.width(),height:a.height()},this.originalSize=this._helper?{width:a.outerWidth(),height:a.outerHeight()}:{width:a.width(),height:a.height()},this.sizeDiff={width:a.outerWidth()-a.width(),height:a.outerHeight()-a.height()},this.originalPosition={left:i,top:s},this.originalMousePosition={left:e.pageX,top:e.pageY},this.aspectRatio="number"==typeof o.aspectRatio?o.aspectRatio:this.originalSize.width/this.originalSize.height||1,n=t(".ui-resizable-"+this.axis).css("cursor"),t("body").css("cursor","auto"===n?this.axis+"-resize":n),this._addClass("ui-resizable-resizing"),this._propagate("start",e),!0},_mouseDrag:function(e){var i,s,n=this.originalMousePosition,o=this.axis,a=e.pageX-n.left||0,r=e.pageY-n.top||0,l=this._change[o];return this._updatePrevProperties(),l?(i=l.apply(this,[e,a,r]),this._updateVirtualBoundaries(e.shiftKey),(this._aspectRatio||e.shiftKey)&&(i=this._updateRatio(i,e)),i=this._respectSize(i,e),this._updateCache(i),this._propagate("resize",e),s=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),t.isEmptyObject(s)||(this._updatePrevProperties(),this._trigger("resize",e,this.ui()),this._applyChanges()),!1):!1},_mouseStop:function(e){this.resizing=!1;var i,s,n,o,a,r,l,h=this.options,c=this;return this._helper&&(i=this._proportionallyResizeElements,s=i.length&&/textarea/i.test(i[0].nodeName),n=s&&this._hasScroll(i[0],"left")?0:c.sizeDiff.height,o=s?0:c.sizeDiff.width,a={width:c.helper.width()-o,height:c.helper.height()-n},r=parseFloat(c.element.css("left"))+(c.position.left-c.originalPosition.left)||null,l=parseFloat(c.element.css("top"))+(c.position.top-c.originalPosition.top)||null,h.animate||this.element.css(t.extend(a,{top:l,left:r})),c.helper.height(c.size.height),c.helper.width(c.size.width),this._helper&&!h.animate&&this._proportionallyResize()),t("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",e),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s,n,o,a=this.options;o={minWidth:this._isNumber(a.minWidth)?a.minWidth:0,maxWidth:this._isNumber(a.maxWidth)?a.maxWidth:1/0,minHeight:this._isNumber(a.minHeight)?a.minHeight:0,maxHeight:this._isNumber(a.maxHeight)?a.maxHeight:1/0},(this._aspectRatio||t)&&(e=o.minHeight*this.aspectRatio,s=o.minWidth/this.aspectRatio,i=o.maxHeight*this.aspectRatio,n=o.maxWidth/this.aspectRatio,e>o.minWidth&&(o.minWidth=e),s>o.minHeight&&(o.minHeight=s),o.maxWidth>i&&(o.maxWidth=i),o.maxHeight>n&&(o.maxHeight=n)),this._vBoundaries=o},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidtht.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),c=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&c&&(t.top=l-e.minHeight),n&&c&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];4>e;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;this._proportionallyResizeElements.length>e;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var e=this.element,i=this.options;this.elementOffset=e.offset(),this._helper?(this.helper=this.helper||t("
          "),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++i.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize,s=this.originalPosition;return{left:s.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize,n=this.originalPosition;return{top:n.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},sw:function(e,i,s){return t.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[e,i,s]))},ne:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[e,i,s]))},nw:function(e,i,s){return t.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[e,i,s]))}},_propagate:function(e,i){t.ui.plugin.call(this,e,[i,this.ui()]),"resize"!==e&&this._trigger(e,i,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),t.ui.plugin.add("resizable","animate",{stop:function(e){var i=t(this).resizable("instance"),s=i.options,n=i._proportionallyResizeElements,o=n.length&&/textarea/i.test(n[0].nodeName),a=o&&i._hasScroll(n[0],"left")?0:i.sizeDiff.height,r=o?0:i.sizeDiff.width,l={width:i.size.width-r,height:i.size.height-a},h=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,c=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(t.extend(l,c&&h?{top:c,left:h}:{}),{duration:s.animateDuration,easing:s.animateEasing,step:function(){var s={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};n&&n.length&&t(n[0]).css({width:s.width,height:s.height}),i._updateCache(s),i._propagate("resize",e)}})}}),t.ui.plugin.add("resizable","containment",{start:function(){var e,i,s,n,o,a,r,l=t(this).resizable("instance"),h=l.options,c=l.element,u=h.containment,d=u instanceof t?u.get(0):/parent/.test(u)?c.parent().get(0):u;d&&(l.containerElement=t(d),/document/.test(u)||u===document?(l.containerOffset={left:0,top:0},l.containerPosition={left:0,top:0},l.parentData={element:t(document),left:0,top:0,width:t(document).width(),height:t(document).height()||document.body.parentNode.scrollHeight}):(e=t(d),i=[],t(["Top","Right","Left","Bottom"]).each(function(t,s){i[t]=l._num(e.css("padding"+s))}),l.containerOffset=e.offset(),l.containerPosition=e.position(),l.containerSize={height:e.innerHeight()-i[3],width:e.innerWidth()-i[1]},s=l.containerOffset,n=l.containerSize.height,o=l.containerSize.width,a=l._hasScroll(d,"left")?d.scrollWidth:o,r=l._hasScroll(d)?d.scrollHeight:n,l.parentData={element:d,left:s.left,top:s.top,width:a,height:r}))},resize:function(e){var i,s,n,o,a=t(this).resizable("instance"),r=a.options,l=a.containerOffset,h=a.position,c=a._aspectRatio||e.shiftKey,u={top:0,left:0},d=a.containerElement,p=!0;d[0]!==document&&/static/.test(d.css("position"))&&(u=l),h.left<(a._helper?l.left:0)&&(a.size.width=a.size.width+(a._helper?a.position.left-l.left:a.position.left-u.left),c&&(a.size.height=a.size.width/a.aspectRatio,p=!1),a.position.left=r.helper?l.left:0),h.top<(a._helper?l.top:0)&&(a.size.height=a.size.height+(a._helper?a.position.top-l.top:a.position.top),c&&(a.size.width=a.size.height*a.aspectRatio,p=!1),a.position.top=a._helper?l.top:0),n=a.containerElement.get(0)===a.element.parent().get(0),o=/relative|absolute/.test(a.containerElement.css("position")),n&&o?(a.offset.left=a.parentData.left+a.position.left,a.offset.top=a.parentData.top+a.position.top):(a.offset.left=a.element.offset().left,a.offset.top=a.element.offset().top),i=Math.abs(a.sizeDiff.width+(a._helper?a.offset.left-u.left:a.offset.left-l.left)),s=Math.abs(a.sizeDiff.height+(a._helper?a.offset.top-u.top:a.offset.top-l.top)),i+a.size.width>=a.parentData.width&&(a.size.width=a.parentData.width-i,c&&(a.size.height=a.size.width/a.aspectRatio,p=!1)),s+a.size.height>=a.parentData.height&&(a.size.height=a.parentData.height-s,c&&(a.size.width=a.size.height*a.aspectRatio,p=!1)),p||(a.position.left=a.prevPosition.left,a.position.top=a.prevPosition.top,a.size.width=a.prevSize.width,a.size.height=a.prevSize.height)},stop:function(){var e=t(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.containerPosition,o=e.containerElement,a=t(e.helper),r=a.offset(),l=a.outerWidth()-e.sizeDiff.width,h=a.outerHeight()-e.sizeDiff.height;e._helper&&!i.animate&&/relative/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h}),e._helper&&!i.animate&&/static/.test(o.css("position"))&&t(this).css({left:r.left-n.left-s.left,width:l,height:h})}}),t.ui.plugin.add("resizable","alsoResize",{start:function(){var e=t(this).resizable("instance"),i=e.options;t(i.alsoResize).each(function(){var e=t(this);e.data("ui-resizable-alsoresize",{width:parseFloat(e.width()),height:parseFloat(e.height()),left:parseFloat(e.css("left")),top:parseFloat(e.css("top"))})})},resize:function(e,i){var s=t(this).resizable("instance"),n=s.options,o=s.originalSize,a=s.originalPosition,r={height:s.size.height-o.height||0,width:s.size.width-o.width||0,top:s.position.top-a.top||0,left:s.position.left-a.left||0};t(n.alsoResize).each(function(){var e=t(this),s=t(this).data("ui-resizable-alsoresize"),n={},o=e.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];t.each(o,function(t,e){var i=(s[e]||0)+(r[e]||0);i&&i>=0&&(n[e]=i||null)}),e.css(n)})},stop:function(){t(this).removeData("ui-resizable-alsoresize")}}),t.ui.plugin.add("resizable","ghost",{start:function(){var e=t(this).resizable("instance"),i=e.size;e.ghost=e.originalElement.clone(),e.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}),e._addClass(e.ghost,"ui-resizable-ghost"),t.uiBackCompat!==!1&&"string"==typeof e.options.ghost&&e.ghost.addClass(this.options.ghost),e.ghost.appendTo(e.helper)},resize:function(){var e=t(this).resizable("instance");e.ghost&&e.ghost.css({position:"relative",height:e.size.height,width:e.size.width})},stop:function(){var e=t(this).resizable("instance");e.ghost&&e.helper&&e.helper.get(0).removeChild(e.ghost.get(0))}}),t.ui.plugin.add("resizable","grid",{resize:function(){var e,i=t(this).resizable("instance"),s=i.options,n=i.size,o=i.originalSize,a=i.originalPosition,r=i.axis,l="number"==typeof s.grid?[s.grid,s.grid]:s.grid,h=l[0]||1,c=l[1]||1,u=Math.round((n.width-o.width)/h)*h,d=Math.round((n.height-o.height)/c)*c,p=o.width+u,f=o.height+d,g=s.maxWidth&&p>s.maxWidth,m=s.maxHeight&&f>s.maxHeight,_=s.minWidth&&s.minWidth>p,v=s.minHeight&&s.minHeight>f;s.grid=l,_&&(p+=h),v&&(f+=c),g&&(p-=h),m&&(f-=c),/^(se|s|e)$/.test(r)?(i.size.width=p,i.size.height=f):/^(ne)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.top=a.top-d):/^(sw)$/.test(r)?(i.size.width=p,i.size.height=f,i.position.left=a.left-u):((0>=f-c||0>=p-h)&&(e=i._getPaddingPlusBorderDimensions(this)),f-c>0?(i.size.height=f,i.position.top=a.top-d):(f=c-e.height,i.size.height=f,i.position.top=a.top+o.height-f),p-h>0?(i.size.width=p,i.position.left=a.left-u):(p=h-e.width,i.size.width=p,i.position.left=a.left+o.width-p))}}),t.ui.resizable,t.widget("ui.sortable",t.ui.mouse,{version:"1.12.0",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+h>r&&l>s+h,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&l>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],l=[],h=this._connectWith();if(h&&e)for(s=h.length-1;s>=0;s--)for(o=t(h[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&l.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(l.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=l.length-1;s>=0;s--)l[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,l,h,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,h=r.length;h>s;s++)l=t(r[s]),l.data(this.widgetName+"-item",a),c.push({item:l,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t(" ",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,l,h,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(l=this.items[s].item.offset()[a],h=!1,e[u]-l>this.items[s][r]/2&&(h=!0),n>Math.abs(e[u]-l)&&(n=Math.abs(e[u]-l),o=this.items[s],this.direction=h?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1 -}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.leftthis.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})}); - -/*! - * jQuery UI Touch Punch 0.2.3 - * - * Copyright 2011–2014, Dave Furfero - * Dual licensed under the MIT or GPL Version 2 licenses. - * - * Depends: - * jquery.ui.widget.js - * jquery.ui.mouse.js - */ -!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.on({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.off({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); - -},{}],45:[function(require,module,exports){ -module.exports = after - -function after(count, callback, err_cb) { - var bail = false - err_cb = err_cb || noop - proxy.count = count - - return (count === 0) ? callback() : proxy - - function proxy(err, result) { - if (proxy.count <= 0) { - throw new Error('after called too many times') - } - --proxy.count - - // after first error, rest are passed to err_cb - if (err) { - bail = true - callback(err) - // future error callbacks will go to error handler - callback = err_cb - } else if (proxy.count === 0 && !bail) { - callback(null, result) - } - } -} - -function noop() {} - -},{}],46:[function(require,module,exports){ -/** - * An abstraction for slicing an arraybuffer even when - * ArrayBuffer.prototype.slice is not supported - * - * @api public - */ - -module.exports = function(arraybuffer, start, end) { - var bytes = arraybuffer.byteLength; - start = start || 0; - end = end || bytes; - - if (arraybuffer.slice) { return arraybuffer.slice(start, end); } - - if (start < 0) { start += bytes; } - if (end < 0) { end += bytes; } - if (end > bytes) { end = bytes; } - - if (start >= bytes || start >= end || bytes === 0) { - return new ArrayBuffer(0); - } - - var abv = new Uint8Array(arraybuffer); - var result = new Uint8Array(end - start); - for (var i = start, ii = 0; i < end; i++, ii++) { - result[ii] = abv[i]; - } - return result.buffer; -}; - -},{}],47:[function(require,module,exports){ - -/** - * Expose `Backoff`. - */ - -module.exports = Backoff; - -/** - * Initialize backoff timer with `opts`. - * - * - `min` initial timeout in milliseconds [100] - * - `max` max timeout [10000] - * - `jitter` [0] - * - `factor` [2] - * - * @param {Object} opts - * @api public - */ - -function Backoff(opts) { - opts = opts || {}; - this.ms = opts.min || 100; - this.max = opts.max || 10000; - this.factor = opts.factor || 2; - this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0; - this.attempts = 0; -} - -/** - * Return the backoff duration. - * - * @return {Number} - * @api public - */ - -Backoff.prototype.duration = function(){ - var ms = this.ms * Math.pow(this.factor, this.attempts++); - if (this.jitter) { - var rand = Math.random(); - var deviation = Math.floor(rand * this.jitter * ms); - ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation; - } - return Math.min(ms, this.max) | 0; -}; - -/** - * Reset the number of attempts. - * - * @api public - */ - -Backoff.prototype.reset = function(){ - this.attempts = 0; -}; - -/** - * Set the minimum duration - * - * @api public - */ - -Backoff.prototype.setMin = function(min){ - this.ms = min; -}; - -/** - * Set the maximum duration - * - * @api public - */ - -Backoff.prototype.setMax = function(max){ - this.max = max; -}; - -/** - * Set the jitter - * - * @api public - */ - -Backoff.prototype.setJitter = function(jitter){ - this.jitter = jitter; -}; - - -},{}],48:[function(require,module,exports){ -/* - * base64-arraybuffer - * https://github.com/niklasvh/base64-arraybuffer - * - * Copyright (c) 2012 Niklas von Hertzen - * Licensed under the MIT license. - */ -(function(chars){ - "use strict"; - - exports.encode = function(arraybuffer) { - var bytes = new Uint8Array(arraybuffer), - i, len = bytes.length, base64 = ""; - - for (i = 0; i < len; i+=3) { - base64 += chars[bytes[i] >> 2]; - base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)]; - base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)]; - base64 += chars[bytes[i + 2] & 63]; - } - - if ((len % 3) === 2) { - base64 = base64.substring(0, base64.length - 1) + "="; - } else if (len % 3 === 1) { - base64 = base64.substring(0, base64.length - 2) + "=="; - } - - return base64; - }; - - exports.decode = function(base64) { - var bufferLength = base64.length * 0.75, - len = base64.length, i, p = 0, - encoded1, encoded2, encoded3, encoded4; - - if (base64[base64.length - 1] === "=") { - bufferLength--; - if (base64[base64.length - 2] === "=") { - bufferLength--; - } - } - - var arraybuffer = new ArrayBuffer(bufferLength), - bytes = new Uint8Array(arraybuffer); - - for (i = 0; i < len; i+=4) { - encoded1 = chars.indexOf(base64[i]); - encoded2 = chars.indexOf(base64[i+1]); - encoded3 = chars.indexOf(base64[i+2]); - encoded4 = chars.indexOf(base64[i+3]); - - bytes[p++] = (encoded1 << 2) | (encoded2 >> 4); - bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2); - bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63); - } - - return arraybuffer; - }; -})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"); - -},{}],49:[function(require,module,exports){ -(function (global){ -/** - * Create a blob builder even when vendor prefixes exist - */ - -var BlobBuilder = global.BlobBuilder - || global.WebKitBlobBuilder - || global.MSBlobBuilder - || global.MozBlobBuilder; - -/** - * Check if Blob constructor is supported - */ - -var blobSupported = (function() { - try { - var a = new Blob(['hi']); - return a.size === 2; - } catch(e) { - return false; - } -})(); - -/** - * Check if Blob constructor supports ArrayBufferViews - * Fails in Safari 6, so we need to map to ArrayBuffers there. - */ - -var blobSupportsArrayBufferView = blobSupported && (function() { - try { - var b = new Blob([new Uint8Array([1,2])]); - return b.size === 2; - } catch(e) { - return false; - } -})(); - -/** - * Check if BlobBuilder is supported - */ - -var blobBuilderSupported = BlobBuilder - && BlobBuilder.prototype.append - && BlobBuilder.prototype.getBlob; - -/** - * Helper function that maps ArrayBufferViews to ArrayBuffers - * Used by BlobBuilder constructor and old browsers that didn't - * support it in the Blob constructor. - */ - -function mapArrayBufferViews(ary) { - for (var i = 0; i < ary.length; i++) { - var chunk = ary[i]; - if (chunk.buffer instanceof ArrayBuffer) { - var buf = chunk.buffer; - - // if this is a subarray, make a copy so we only - // include the subarray region from the underlying buffer - if (chunk.byteLength !== buf.byteLength) { - var copy = new Uint8Array(chunk.byteLength); - copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength)); - buf = copy.buffer; - } - - ary[i] = buf; - } - } -} - -function BlobBuilderConstructor(ary, options) { - options = options || {}; - - var bb = new BlobBuilder(); - mapArrayBufferViews(ary); - - for (var i = 0; i < ary.length; i++) { - bb.append(ary[i]); - } - - return (options.type) ? bb.getBlob(options.type) : bb.getBlob(); -}; - -function BlobConstructor(ary, options) { - mapArrayBufferViews(ary); - return new Blob(ary, options || {}); -}; - -module.exports = (function() { - if (blobSupported) { - return blobSupportsArrayBufferView ? global.Blob : BlobConstructor; - } else if (blobBuilderSupported) { - return BlobBuilderConstructor; - } else { - return undefined; - } -})(); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],50:[function(require,module,exports){ -/** - * Slice reference. - */ - -var slice = [].slice; - -/** - * Bind `obj` to `fn`. - * - * @param {Object} obj - * @param {Function|String} fn or string - * @return {Function} - * @api public - */ - -module.exports = function(obj, fn){ - if ('string' == typeof fn) fn = obj[fn]; - if ('function' != typeof fn) throw new Error('bind() requires a function'); - var args = slice.call(arguments, 2); - return function(){ - return fn.apply(obj, args.concat(slice.call(arguments))); - } -}; - -},{}],51:[function(require,module,exports){ - -/** - * Expose `Emitter`. - */ - -module.exports = Emitter; - -/** - * Initialize a new `Emitter`. - * - * @api public - */ - -function Emitter(obj) { - if (obj) return mixin(obj); -}; - -/** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; -} - -/** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.on = -Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks[event] = this._callbacks[event] || []) - .push(fn); - return this; -}; - -/** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.once = function(event, fn){ - var self = this; - this._callbacks = this._callbacks || {}; - - function on() { - self.off(event, on); - fn.apply(this, arguments); - } - - on.fn = fn; - this.on(event, on); - return this; -}; - -/** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - -Emitter.prototype.off = -Emitter.prototype.removeListener = -Emitter.prototype.removeAllListeners = -Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - - // specific event - var callbacks = this._callbacks[event]; - if (!callbacks) return this; - - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks[event]; - return this; - } - - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - return this; -}; - -/** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - -Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks[event]; - - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; -}; - -/** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - -Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks[event] || []; -}; - -/** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - -Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; -}; - -},{}],52:[function(require,module,exports){ - -module.exports = function(a, b){ - var fn = function(){}; - fn.prototype = b.prototype; - a.prototype = new fn; - a.prototype.constructor = a; -}; -},{}],53:[function(require,module,exports){ - -/** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = require('./debug'); -exports.log = log; -exports.formatArgs = formatArgs; -exports.save = save; -exports.load = load; -exports.useColors = useColors; -exports.storage = 'undefined' != typeof chrome - && 'undefined' != typeof chrome.storage - ? chrome.storage.local - : localstorage(); - -/** - * Colors. - */ - -exports.colors = [ - 'lightseagreen', - 'forestgreen', - 'goldenrod', - 'dodgerblue', - 'darkorchid', - 'crimson' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -function useColors() { - // is webkit? http://stackoverflow.com/a/16459606/376773 - return ('WebkitAppearance' in document.documentElement.style) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (window.console && (console.firebug || (console.exception && console.table))) || - // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); -} - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -exports.formatters.j = function(v) { - return JSON.stringify(v); -}; - - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? ' %c' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return args; - - var c = 'color: ' + this.color; - args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); - return args; -} - -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - -function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === typeof console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - exports.storage.removeItem('debug'); - } else { - exports.storage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = exports.storage.debug; - } catch(e) {} - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); - -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - -function localstorage(){ - try { - return window.localStorage; - } catch (e) {} -} - -},{"./debug":54}],54:[function(require,module,exports){ - -/** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - -exports = module.exports = debug; -exports.coerce = coerce; -exports.disable = disable; -exports.enable = enable; -exports.enabled = enabled; -exports.humanize = require('ms'); - -/** - * The currently active debug mode names, and names to skip. - */ - -exports.names = []; -exports.skips = []; - -/** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - -exports.formatters = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Previous log timestamp. - */ - -var prevTime; - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; -} - -/** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - -function debug(namespace) { - - // define the `disabled` version - function disabled() { - } - disabled.enabled = false; - - // define the `enabled` version - function enabled() { - - var self = enabled; - - // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; - - // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - - var args = Array.prototype.slice.call(arguments); - - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } - - // apply any `formatters` transformations - var index = 0; - args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { - // if we encounter an escaped % then don't increase the array index - if (match === '%%') return match; - index++; - var formatter = exports.formatters[format]; - if ('function' === typeof formatter) { - var val = args[index]; - match = formatter.call(self, val); - - // now we need to remove `args[index]` since it's inlined in the `format` - args.splice(index, 1); - index--; - } - return match; - }); - - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } - var logFn = enabled.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } - enabled.enabled = true; - - var fn = exports.enabled(namespace) ? enabled : disabled; - - fn.namespace = namespace; - - return fn; -} - -/** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ - -function enable(namespaces) { - exports.save(namespaces); - - var split = (namespaces || '').split(/[\s,]+/); - var len = split.length; - - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } -} - -/** - * Disable debug output. - * - * @api public - */ - -function disable() { - exports.enable(''); -} - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -function enabled(name) { - var i, len; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; - } - } - return false; -} - -/** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ - -function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; -} - -},{"ms":72}],55:[function(require,module,exports){ - -module.exports = require('./lib/'); - -},{"./lib/":56}],56:[function(require,module,exports){ - -module.exports = require('./socket'); - -/** - * Exports parser - * - * @api public - * - */ -module.exports.parser = require('engine.io-parser'); - -},{"./socket":57,"engine.io-parser":65}],57:[function(require,module,exports){ -(function (global){ -/** - * Module dependencies. - */ - -var transports = require('./transports'); -var Emitter = require('component-emitter'); -var debug = require('debug')('engine.io-client:socket'); -var index = require('indexof'); -var parser = require('engine.io-parser'); -var parseuri = require('parseuri'); -var parsejson = require('parsejson'); -var parseqs = require('parseqs'); - -/** - * Module exports. - */ - -module.exports = Socket; - -/** - * Noop function. - * - * @api private - */ - -function noop(){} - -/** - * Socket constructor. - * - * @param {String|Object} uri or options - * @param {Object} options - * @api public - */ - -function Socket(uri, opts){ - if (!(this instanceof Socket)) return new Socket(uri, opts); - - opts = opts || {}; - - if (uri && 'object' == typeof uri) { - opts = uri; - uri = null; - } - - if (uri) { - uri = parseuri(uri); - opts.hostname = uri.host; - opts.secure = uri.protocol == 'https' || uri.protocol == 'wss'; - opts.port = uri.port; - if (uri.query) opts.query = uri.query; - } else if (opts.host) { - opts.hostname = parseuri(opts.host).host; - } - - this.secure = null != opts.secure ? opts.secure : - (global.location && 'https:' == location.protocol); - - if (opts.hostname && !opts.port) { - // if no port is specified manually, use the protocol default - opts.port = this.secure ? '443' : '80'; - } - - this.agent = opts.agent || false; - this.hostname = opts.hostname || - (global.location ? location.hostname : 'localhost'); - this.port = opts.port || (global.location && location.port ? - location.port : - (this.secure ? 443 : 80)); - this.query = opts.query || {}; - if ('string' == typeof this.query) this.query = parseqs.decode(this.query); - this.upgrade = false !== opts.upgrade; - this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/'; - this.forceJSONP = !!opts.forceJSONP; - this.jsonp = false !== opts.jsonp; - this.forceBase64 = !!opts.forceBase64; - this.enablesXDR = !!opts.enablesXDR; - this.timestampParam = opts.timestampParam || 't'; - this.timestampRequests = opts.timestampRequests; - this.transports = opts.transports || ['polling', 'websocket']; - this.readyState = ''; - this.writeBuffer = []; - this.policyPort = opts.policyPort || 843; - this.rememberUpgrade = opts.rememberUpgrade || false; - this.binaryType = null; - this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades; - this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false; - - if (true === this.perMessageDeflate) this.perMessageDeflate = {}; - if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) { - this.perMessageDeflate.threshold = 1024; - } - - // SSL options for Node.js client - this.pfx = opts.pfx || null; - this.key = opts.key || null; - this.passphrase = opts.passphrase || null; - this.cert = opts.cert || null; - this.ca = opts.ca || null; - this.ciphers = opts.ciphers || null; - this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized; - - // other options for Node.js client - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal) { - if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) { - this.extraHeaders = opts.extraHeaders; - } - } - - this.open(); -} - -Socket.priorWebsocketSuccess = false; - -/** - * Mix in `Emitter`. - */ - -Emitter(Socket.prototype); - -/** - * Protocol version. - * - * @api public - */ - -Socket.protocol = parser.protocol; // this is an int - -/** - * Expose deps for legacy compatibility - * and standalone browser access. - */ - -Socket.Socket = Socket; -Socket.Transport = require('./transport'); -Socket.transports = require('./transports'); -Socket.parser = require('engine.io-parser'); - -/** - * Creates transport of the given type. - * - * @param {String} transport name - * @return {Transport} - * @api private - */ - -Socket.prototype.createTransport = function (name) { - debug('creating transport "%s"', name); - var query = clone(this.query); - - // append engine.io protocol identifier - query.EIO = parser.protocol; - - // transport name - query.transport = name; - - // session id if we already have one - if (this.id) query.sid = this.id; - - var transport = new transports[name]({ - agent: this.agent, - hostname: this.hostname, - port: this.port, - secure: this.secure, - path: this.path, - query: query, - forceJSONP: this.forceJSONP, - jsonp: this.jsonp, - forceBase64: this.forceBase64, - enablesXDR: this.enablesXDR, - timestampRequests: this.timestampRequests, - timestampParam: this.timestampParam, - policyPort: this.policyPort, - socket: this, - pfx: this.pfx, - key: this.key, - passphrase: this.passphrase, - cert: this.cert, - ca: this.ca, - ciphers: this.ciphers, - rejectUnauthorized: this.rejectUnauthorized, - perMessageDeflate: this.perMessageDeflate, - extraHeaders: this.extraHeaders - }); - - return transport; -}; - -function clone (obj) { - var o = {}; - for (var i in obj) { - if (obj.hasOwnProperty(i)) { - o[i] = obj[i]; - } - } - return o; -} - -/** - * Initializes transport to use and starts probe. - * - * @api private - */ -Socket.prototype.open = function () { - var transport; - if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') != -1) { - transport = 'websocket'; - } else if (0 === this.transports.length) { - // Emit error on next tick so it can be listened to - var self = this; - setTimeout(function() { - self.emit('error', 'No transports available'); - }, 0); - return; - } else { - transport = this.transports[0]; - } - this.readyState = 'opening'; - - // Retry with the next transport if the transport is disabled (jsonp: false) - try { - transport = this.createTransport(transport); - } catch (e) { - this.transports.shift(); - this.open(); - return; - } - - transport.open(); - this.setTransport(transport); -}; - -/** - * Sets the current transport. Disables the existing one (if any). - * - * @api private - */ - -Socket.prototype.setTransport = function(transport){ - debug('setting transport %s', transport.name); - var self = this; - - if (this.transport) { - debug('clearing existing transport %s', this.transport.name); - this.transport.removeAllListeners(); - } - - // set up transport - this.transport = transport; - - // set up transport listeners - transport - .on('drain', function(){ - self.onDrain(); - }) - .on('packet', function(packet){ - self.onPacket(packet); - }) - .on('error', function(e){ - self.onError(e); - }) - .on('close', function(){ - self.onClose('transport close'); - }); -}; - -/** - * Probes a transport. - * - * @param {String} transport name - * @api private - */ - -Socket.prototype.probe = function (name) { - debug('probing transport "%s"', name); - var transport = this.createTransport(name, { probe: 1 }) - , failed = false - , self = this; - - Socket.priorWebsocketSuccess = false; - - function onTransportOpen(){ - if (self.onlyBinaryUpgrades) { - var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary; - failed = failed || upgradeLosesBinary; - } - if (failed) return; - - debug('probe transport "%s" opened', name); - transport.send([{ type: 'ping', data: 'probe' }]); - transport.once('packet', function (msg) { - if (failed) return; - if ('pong' == msg.type && 'probe' == msg.data) { - debug('probe transport "%s" pong', name); - self.upgrading = true; - self.emit('upgrading', transport); - if (!transport) return; - Socket.priorWebsocketSuccess = 'websocket' == transport.name; - - debug('pausing current transport "%s"', self.transport.name); - self.transport.pause(function () { - if (failed) return; - if ('closed' == self.readyState) return; - debug('changing transport and sending upgrade packet'); - - cleanup(); - - self.setTransport(transport); - transport.send([{ type: 'upgrade' }]); - self.emit('upgrade', transport); - transport = null; - self.upgrading = false; - self.flush(); - }); - } else { - debug('probe transport "%s" failed', name); - var err = new Error('probe error'); - err.transport = transport.name; - self.emit('upgradeError', err); - } - }); - } - - function freezeTransport() { - if (failed) return; - - // Any callback called by transport should be ignored since now - failed = true; - - cleanup(); - - transport.close(); - transport = null; - } - - //Handle any error that happens while probing - function onerror(err) { - var error = new Error('probe error: ' + err); - error.transport = transport.name; - - freezeTransport(); - - debug('probe transport "%s" failed because of error: %s', name, err); - - self.emit('upgradeError', error); - } - - function onTransportClose(){ - onerror("transport closed"); - } - - //When the socket is closed while we're probing - function onclose(){ - onerror("socket closed"); - } - - //When the socket is upgraded while we're probing - function onupgrade(to){ - if (transport && to.name != transport.name) { - debug('"%s" works - aborting "%s"', to.name, transport.name); - freezeTransport(); - } - } - - //Remove all listeners on the transport and on self - function cleanup(){ - transport.removeListener('open', onTransportOpen); - transport.removeListener('error', onerror); - transport.removeListener('close', onTransportClose); - self.removeListener('close', onclose); - self.removeListener('upgrading', onupgrade); - } - - transport.once('open', onTransportOpen); - transport.once('error', onerror); - transport.once('close', onTransportClose); - - this.once('close', onclose); - this.once('upgrading', onupgrade); - - transport.open(); - -}; - -/** - * Called when connection is deemed open. - * - * @api public - */ - -Socket.prototype.onOpen = function () { - debug('socket open'); - this.readyState = 'open'; - Socket.priorWebsocketSuccess = 'websocket' == this.transport.name; - this.emit('open'); - this.flush(); - - // we check for `readyState` in case an `open` - // listener already closed the socket - if ('open' == this.readyState && this.upgrade && this.transport.pause) { - debug('starting upgrade probes'); - for (var i = 0, l = this.upgrades.length; i < l; i++) { - this.probe(this.upgrades[i]); - } - } -}; - -/** - * Handles a packet. - * - * @api private - */ - -Socket.prototype.onPacket = function (packet) { - if ('opening' == this.readyState || 'open' == this.readyState) { - debug('socket receive: type "%s", data "%s"', packet.type, packet.data); - - this.emit('packet', packet); - - // Socket is live - any packet counts - this.emit('heartbeat'); - - switch (packet.type) { - case 'open': - this.onHandshake(parsejson(packet.data)); - break; - - case 'pong': - this.setPing(); - this.emit('pong'); - break; - - case 'error': - var err = new Error('server error'); - err.code = packet.data; - this.onError(err); - break; - - case 'message': - this.emit('data', packet.data); - this.emit('message', packet.data); - break; - } - } else { - debug('packet received with socket readyState "%s"', this.readyState); - } -}; - -/** - * Called upon handshake completion. - * - * @param {Object} handshake obj - * @api private - */ - -Socket.prototype.onHandshake = function (data) { - this.emit('handshake', data); - this.id = data.sid; - this.transport.query.sid = data.sid; - this.upgrades = this.filterUpgrades(data.upgrades); - this.pingInterval = data.pingInterval; - this.pingTimeout = data.pingTimeout; - this.onOpen(); - // In case open handler closes socket - if ('closed' == this.readyState) return; - this.setPing(); - - // Prolong liveness of socket on heartbeat - this.removeListener('heartbeat', this.onHeartbeat); - this.on('heartbeat', this.onHeartbeat); -}; - -/** - * Resets ping timeout. - * - * @api private - */ - -Socket.prototype.onHeartbeat = function (timeout) { - clearTimeout(this.pingTimeoutTimer); - var self = this; - self.pingTimeoutTimer = setTimeout(function () { - if ('closed' == self.readyState) return; - self.onClose('ping timeout'); - }, timeout || (self.pingInterval + self.pingTimeout)); -}; - -/** - * Pings server every `this.pingInterval` and expects response - * within `this.pingTimeout` or closes connection. - * - * @api private - */ - -Socket.prototype.setPing = function () { - var self = this; - clearTimeout(self.pingIntervalTimer); - self.pingIntervalTimer = setTimeout(function () { - debug('writing ping packet - expecting pong within %sms', self.pingTimeout); - self.ping(); - self.onHeartbeat(self.pingTimeout); - }, self.pingInterval); -}; - -/** -* Sends a ping packet. -* -* @api private -*/ - -Socket.prototype.ping = function () { - var self = this; - this.sendPacket('ping', function(){ - self.emit('ping'); - }); -}; - -/** - * Called on `drain` event - * - * @api private - */ - -Socket.prototype.onDrain = function() { - this.writeBuffer.splice(0, this.prevBufferLen); - - // setting prevBufferLen = 0 is very important - // for example, when upgrading, upgrade packet is sent over, - // and a nonzero prevBufferLen could cause problems on `drain` - this.prevBufferLen = 0; - - if (0 === this.writeBuffer.length) { - this.emit('drain'); - } else { - this.flush(); - } -}; - -/** - * Flush write buffers. - * - * @api private - */ - -Socket.prototype.flush = function () { - if ('closed' != this.readyState && this.transport.writable && - !this.upgrading && this.writeBuffer.length) { - debug('flushing %d packets in socket', this.writeBuffer.length); - this.transport.send(this.writeBuffer); - // keep track of current length of writeBuffer - // splice writeBuffer and callbackBuffer on `drain` - this.prevBufferLen = this.writeBuffer.length; - this.emit('flush'); - } -}; - -/** - * Sends a message. - * - * @param {String} message. - * @param {Function} callback function. - * @param {Object} options. - * @return {Socket} for chaining. - * @api public - */ - -Socket.prototype.write = -Socket.prototype.send = function (msg, options, fn) { - this.sendPacket('message', msg, options, fn); - return this; -}; - -/** - * Sends a packet. - * - * @param {String} packet type. - * @param {String} data. - * @param {Object} options. - * @param {Function} callback function. - * @api private - */ - -Socket.prototype.sendPacket = function (type, data, options, fn) { - if('function' == typeof data) { - fn = data; - data = undefined; - } - - if ('function' == typeof options) { - fn = options; - options = null; - } - - if ('closing' == this.readyState || 'closed' == this.readyState) { - return; - } - - options = options || {}; - options.compress = false !== options.compress; - - var packet = { - type: type, - data: data, - options: options - }; - this.emit('packetCreate', packet); - this.writeBuffer.push(packet); - if (fn) this.once('flush', fn); - this.flush(); -}; - -/** - * Closes the connection. - * - * @api private - */ - -Socket.prototype.close = function () { - if ('opening' == this.readyState || 'open' == this.readyState) { - this.readyState = 'closing'; - - var self = this; - - if (this.writeBuffer.length) { - this.once('drain', function() { - if (this.upgrading) { - waitForUpgrade(); - } else { - close(); - } - }); - } else if (this.upgrading) { - waitForUpgrade(); - } else { - close(); - } - } - - function close() { - self.onClose('forced close'); - debug('socket closing - telling transport to close'); - self.transport.close(); - } - - function cleanupAndClose() { - self.removeListener('upgrade', cleanupAndClose); - self.removeListener('upgradeError', cleanupAndClose); - close(); - } - - function waitForUpgrade() { - // wait for upgrade to finish since we can't send packets while pausing a transport - self.once('upgrade', cleanupAndClose); - self.once('upgradeError', cleanupAndClose); - } - - return this; -}; - -/** - * Called upon transport error - * - * @api private - */ - -Socket.prototype.onError = function (err) { - debug('socket error %j', err); - Socket.priorWebsocketSuccess = false; - this.emit('error', err); - this.onClose('transport error', err); -}; - -/** - * Called upon transport close. - * - * @api private - */ - -Socket.prototype.onClose = function (reason, desc) { - if ('opening' == this.readyState || 'open' == this.readyState || 'closing' == this.readyState) { - debug('socket close with reason: "%s"', reason); - var self = this; - - // clear timers - clearTimeout(this.pingIntervalTimer); - clearTimeout(this.pingTimeoutTimer); - - // stop event from firing again for transport - this.transport.removeAllListeners('close'); - - // ensure transport won't stay open - this.transport.close(); - - // ignore further transport communication - this.transport.removeAllListeners(); - - // set ready state - this.readyState = 'closed'; - - // clear session id - this.id = null; - - // emit close event - this.emit('close', reason, desc); - - // clean buffers after, so users can still - // grab the buffers on `close` event - self.writeBuffer = []; - self.prevBufferLen = 0; - } -}; - -/** - * Filters upgrades, returning only those matching client transports. - * - * @param {Array} server upgrades - * @api private - * - */ - -Socket.prototype.filterUpgrades = function (upgrades) { - var filteredUpgrades = []; - for (var i = 0, j = upgrades.length; i