Files
hydra/frontend/web-editor/public/bundle.min.js
2022-02-09 13:51:22 +01:00

26 lines
1.1 MiB
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,(function(r){var n=e[i][1][r];return o(n||r)}),p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){const PatchBay=require("./src/pb-live.js");const HydraSynth=require("hydra-synth");const Editor=require("./src/editor.js");const loop=require("raf-loop");const P5=require("./src/p5-wrapper.js");const Gallery=require("./src/gallery.js");const Menu=require("./src/menu.js");const keymaps=require("./keymaps.js");const log=require("./src/log.js");const repl=require("./src/repl.js");function init(){window.pb=pb;window.P5=P5;var canvas=document.getElementById("hydra-canvas");canvas.width=window.innerWidth;canvas.height=window.innerHeight;canvas.style.width="100%";canvas.style.height="100%";canvas.style.imageRendering="pixelated";let isIOS=(/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;let precisionValue=isIOS?"highp":"mediump";var pb=new PatchBay;var hydra=new HydraSynth({pb:pb,canvas:canvas,autoLoop:false,precision:precisionValue});var editor=new Editor;var menu=new Menu({editor:editor,hydra:hydra});log.init();window.hush=()=>{solid().out();solid().out(o1);solid().out(o2);solid().out(o3);render(o0)};window.loadScript=(url="")=>{const p=new Promise(((res,rej)=>{var script=document.createElement("script");script.onload=function(){log.log(`loaded script ${url}`);res()};script.onerror=err=>{log.log(`error loading script ${url}`,"log-error");res()};script.src=url;document.head.appendChild(script)}));return p};var sketches=new Gallery((function(code,sketchFromURL){editor.setValue(code);repl.eval(code);if(sketchFromURL){menu.closeModal()}else{menu.openModal()}}));menu.sketches=sketches;keymaps.init({editor:editor,gallery:sketches,menu:menu,repl:repl,log:log});pb.init(hydra.captureStream,{server:window.location.origin,room:"iclc"});var engine=loop((function(dt){hydra.tick(dt)})).start()}window.onload=init},{"./keymaps.js":2,"./src/editor.js":5,"./src/gallery.js":7,"./src/log.js":8,"./src/menu.js":9,"./src/p5-wrapper.js":10,"./src/pb-live.js":11,"./src/repl.js":12,"hydra-synth":60,"raf-loop":113}],2:[function(require,module,exports){module.exports={init:({editor:editor,gallery:gallery,menu:menu,repl:repl,log:log})=>{window.onkeydown=e=>{if(e.ctrlKey===true){if(e.shiftKey===true){if(e.keyCode===13){e.preventDefault();menu.runAll()}if(e.keyCode===71){e.preventDefault();menu.shareSketch()}if(e.keyCode===70){e.preventDefault();menu.formatCode()}if(e.keyCode===76){e.preventDefault();gallery.saveLocally(editor.getValue())}if(e.keyCode===72){e.preventDefault();editor.toggle();log.toggle()}if(e.keyCode===83){e.preventDefault();screencap()}}else{if(e.keyCode===13){e.preventDefault();repl.eval(editor.getLine())}if(e.keyCode===191){e.preventDefault();editor.cm.toggleComment()}}}if(e.altKey===true){if(e.keyCode===13){e.preventDefault();repl.eval(editor.getCurrentBlock().text)}}}}}},{}],3:[function(require,module,exports){const{Parser:Parser}=require("acorn");const{generate:generate}=require("astring");const{defaultTraveler:defaultTraveler,attachComments:attachComments,makeTraveler:makeTraveler}=require("astravel");const{UndoStack:UndoStack}=require("./UndoStack.js");const repl=require("./repl.js");const glslTransforms=require("hydra-synth/src/glsl/glsl-functions.js")();class Mutator{constructor(editor){this.editor=editor;this.undoStack=new UndoStack;this.initialVector=[];this.funcTab={};this.transMap={};this.scanFuncs();this.dumpDict()}dumpList(){let gslTab=glslTransforms;gslTab.forEach((v=>{var argList="";v.inputs.forEach((a=>{if(argList!="")argList+=", ";let argL=a.name+": "+a.type+" {"+a.default+"}";argList=argList+argL}))}))}scanFuncs(){let gslTab=glslTransforms;gslTab.forEach((f=>{this.transMap[f.name]=f;if(this.funcTab[f.type]===undefined){this.funcTab[f.type]=[]}this.funcTab[f.type].push(f)}))}dumpDict(){for(let tn in this.funcTab){this.funcTab[tn].forEach((f=>{var argList="";f.inputs.forEach((a=>{if(argList!="")argList+=", ";let argL=a.name+": "+a.type+" {"+a.default+"}";argList=argList+argL}))}))}}mutate(options){let text=this.editor.cm.getValue();this.undoStack.push({text:text,lastLitX:this.lastLitX});let needToRun=true;let tryCounter=5;while(needToRun&&tryCounter-- >=0){var comments=[];let ast=Parser.parse(text,{locations:true,onComment:comments});this.transform(ast,options);attachComments(ast,comments);let regen=generate(ast,{comments:true});this.editor.cm.setValue(regen);try{repl.eval(regen,((code,error)=>{if(error){console.log("Eval error: "+regen)}needToRun=error}))}catch(err){console.log("Exception caught: "+err);needToRun=err}}}doUndo(){if(this.undoStack.atTop()){let text=this.editor.cm.getValue();this.undoStack.push({text:text,lastLitX:this.lastLitX})}if(this.undoStack.canUndo()){let{text:text,lastLitX:lastLitX}=this.undoStack.undo();this.setText(text);this.lastLitX=lastLitX}}doRedo(){if(this.undoStack.canRedo()){let{text:text,lastLitX:lastLitX}=this.undoStack.redo();this.setText(text);this.lastLitX=lastLitX}}setText(text){this.editor.cm.setValue(text);repl.eval(text,((code,error)=>{}))}transform(ast,options){let traveler=makeTraveler({go:function(node,state){if(node.type==="Literal"){state.literalTab.push(node)}else if(node.type==="MemberExpression"){if(node.property&&node.property.type==="Literal"){return}}else if(node.type==="CallExpression"){if(node.callee&&node.callee.property&&node.callee.property.name&&node.callee.property.name!=="out"){state.functionTab.push(node)}}this.super.go.call(this,node,state)}});let state={};state.literalTab=[];state.functionTab=[];traveler.go(ast,state);this.litCount=state.literalTab.length;this.funCount=state.functionTab.length;if(this.litCount!==this.initialVector.length){let nextVect=[];for(let i=0;i<this.litCount;++i){nextVect.push(state.literalTab[i].value)}this.initialVector=nextVect}if(options.changeTransform){this.glitchTrans(state,options)}else this.glitchLiteral(state,options)}glitchLiteral(state,options){let litx=0;if(options.reroll){if(this.lastLitX!==undefined){litx=this.lastLitX}}else{litx=Math.floor(Math.random()*this.litCount);this.lastLitX=litx}let modLit=state.literalTab[litx];if(modLit){let glitched=this.glitchRelToInit(modLit.value,this.initialVector[litx]);let was=modLit.raw;modLit.value=glitched;modLit.raw=""+glitched;console.log("Literal: "+litx+" changed from: "+was+" to: "+glitched)}}glitchNumber(num){if(num===0){num=1}let range=num*2;let rndVal=Math.round(Math.random()*range*1e3)/1e3;return rndVal}glitchRelToInit(num,initVal){if(initVal===undefined){return glitchNumber(num)}if(initVal===0){initVal=.5}let rndVal=Math.round(Math.random()*initVal*2*1e3)/1e3;return rndVal}glitchTrans(state,options){let funx=Math.floor(Math.random()*this.funCount);if(state.functionTab[funx]===undefined||state.functionTab[funx].callee===undefined||state.functionTab[funx].callee.property===undefined){console.log("No valid functionTab for index: "+funx);return}let oldName=state.functionTab[funx].callee.property.name;if(oldName==undefined){console.log("No name for callee");return}let ftype=this.transMap[oldName].type;if(ftype==undefined){console.log("ftype undefined for: "+oldName);return}let others=this.funcTab[ftype];if(others==undefined){console.log("no funcTab entry for: "+ftype);return}let changeX=Math.floor(Math.random()*others.length);let become=others[changeX].name;if(oldName==="modulate"&&become==="modulateScrollX"){console.log("Function: "+funx+" changing from: "+oldName+" can't change to: "+become);return}state.functionTab[funx].callee.property.name=become;console.log("Function: "+funx+" changed from: "+oldName+" to: "+become)}}module.exports=Mutator},{"./UndoStack.js":4,"./repl.js":12,acorn:14,astravel:17,astring:20,"hydra-synth/src/glsl/glsl-functions.js":65}],4:[function(require,module,exports){class UndoStack{constructor(limit){this.stack=[];this.index=-1;this.limit=limit}atTop(){return this.index===-1}canUndo(){if(this.stack.length===0)return false;return this.index===-1||this.index>0}canRedo(){if(this.stack.length===0||this.index===-1)return false;return this.index<this.stack.length-1}push(item){if(this.index>=0){while(this.index<this.stack.length)this.stack.pop();this.index=-1}if(this.limit&&this.stack.length>this.limit){this.stack.shift()}this.stack.push(item)}undo(){if(this.stack.length===0)return undefined;if(this.index===-1){this.index=this.stack.length-1}if(this.index>0)this.index--;let v=this.stack[this.index];return v}redo(){if(this.stack.length===0||this.index===-1)return undefined;let nextX=this.index+1;if(nextX>=this.stack.length)return undefined;this.index=nextX;return this.stack[this.index]}}module.exports={UndoStack:UndoStack}},{}],5:[function(require,module,exports){var CodeMirror=require("codemirror-minified/lib/codemirror");require("codemirror-minified/mode/javascript/javascript");require("codemirror-minified/addon/hint/javascript-hint");require("codemirror-minified/addon/hint/show-hint");require("codemirror-minified/addon/selection/mark-selection");require("codemirror-minified/addon/comment/comment");var Mutator=require("./Mutator.js");var isShowing=true;var EditorClass=function(){console.log("*** Editor class created");var self=this;var container=document.createElement("div");container.setAttribute("id","editor-container");var el=document.createElement("TEXTAREA");document.body.appendChild(container);container.appendChild(el);this.mutator=new Mutator(this);this.cm=CodeMirror.fromTextArea(el,{theme:"tomorrow-night-eighties",value:"hello",mode:{name:"javascript",globalVars:true},lineWrapping:true,styleSelectedText:true});this.cm.refresh();this.show();let searchParams=new URLSearchParams(window.location.search);let showCode=searchParams.get("show-code");if(showCode=="false"){var l=document.getElementsByClassName("CodeMirror-scroll")[0];l.style.display="none";isShowing=false}};EditorClass.prototype.clear=function(){this.cm.setValue('\n \n // Type some code on a new line (such as "osc().out()"), and press CTRL+shift+enter')};EditorClass.prototype.setValue=function(val){this.cm.setValue(val)};EditorClass.prototype.getValue=function(){return this.cm.getValue()};EditorClass.prototype.hide=function(){var l=document.getElementsByClassName("CodeMirror-scroll")[0];var m=document.getElementById("modal-header");l.style.display="none";m.style.display="none";this.isShowing=false};EditorClass.prototype.show=function(){var l=document.getElementsByClassName("CodeMirror-scroll")[0];var m=document.getElementById("modal-header");l.style.display="block";m.style.display="flex";this.isShowing=true};EditorClass.prototype.toggle=function(){if(this.isShowing){this.hide()}else{this.show()}};EditorClass.prototype.getLine=function(){var c=this.cm.getCursor();var s=this.cm.getLine(c.line);this.flashCode({line:c.line,ch:0},{line:c.line+1,ch:0});return s};EditorClass.prototype.flashCode=function(start,end){if(!start)start={line:this.cm.firstLine(),ch:0};if(!end)end={line:this.cm.lastLine()+1,ch:0};var marker=this.cm.markText(start,end,{className:"styled-background"});setTimeout((()=>marker.clear()),300)};EditorClass.prototype.getCurrentBlock=function(){var editor=this.cm;var pos=editor.getCursor();var startline=pos.line;var endline=pos.line;while(startline>0&&editor.getLine(startline)!==""){startline--}while(endline<editor.lineCount()&&editor.getLine(endline)!==""){endline++}var pos1={line:startline,ch:0};var pos2={line:endline,ch:0};var str=editor.getRange(pos1,pos2);this.flashCode(pos1,pos2);return{start:pos1,end:pos2,text:str}};module.exports=EditorClass},{"./Mutator.js":3,"codemirror-minified/addon/comment/comment":28,"codemirror-minified/addon/hint/javascript-hint":29,"codemirror-minified/addon/hint/show-hint":30,"codemirror-minified/addon/selection/mark-selection":31,"codemirror-minified/lib/codemirror":32,"codemirror-minified/mode/javascript/javascript":33}],6:[function(require,module,exports){module.exports=[{sketch_id:"example_0",code:"JTJGJTJGRmxvciUyMGRlJTIwRnVlZ28lMEElMEFzaGFwZSgyMDAlMkMwLjUlMkMxLjUpJTBBLnNjYWxlKDAuNSUyQzAuNSklMEEuY29sb3IoJTVCMC41JTJDMiU1RC5zbW9vdGgoMSklMkMwLjMlMkMwKSUwQS5yZXBlYXQoMiUyQzIpJTBBLm1vZHVsYXRlU2NhbGUob3NjKDMlMkMwLjUpJTJDLTAuNiklMEEuYWRkKG8wJTJDMC41KSUwQS5zY2FsZSgwLjkpJTBBLm91dCgp"},{sketch_id:"example_3",code:"JTJGJTJGJTIwYnklMjBPbGl2aWElMjBKYWNrJTBBJTBBb3NjKDIwJTJDJTIwMC4wMyUyQyUyMDEuNykua2FsZWlkKCkubXVsdChvc2MoMjAlMkMlMjAwLjAwMSUyQyUyMDApLnJvdGF0ZSgxLjU4KSkuYmxlbmQobzAlMkMlMjAwLjk0KS5tb2R1bGF0ZVNjYWxlKG9zYygxMCUyQyUyMDApJTJDLTAuMDMpLnNjYWxlKDAuOCUyQyUyMCgpJTIwJTNEJTNFJTIwKDEuMDUlMjAlMkIlMjAwLjElMjAqJTIwTWF0aC5zaW4oMC4wNSp0aW1lKSkpLm91dChvMCk="},{sketch_id:"example_4",code:"JTJGJTJGJTIwYnklMjBOZWxzb24lMjBWZXJhJTBBJTJGJTJGJTIwdHdpdHRlciUzQSUyMCU0MG5lbF9zb25vbG9naWElMEElMEFvc2MoOCUyQy0wLjUlMkMlMjAxKS5jb2xvcigtMS41JTJDJTIwLTEuNSUyQyUyMC0xLjUpLmJsZW5kKG8wKS5yb3RhdGUoLTAuNSUyQyUyMC0wLjUpLm1vZHVsYXRlKHNoYXBlKDQpLnJvdGF0ZSgwLjUlMkMlMjAwLjUpLnNjYWxlKDIpLnJlcGVhdFgoMiUyQyUyMDIpLm1vZHVsYXRlKG8wJTJDJTIwKCklMjAlM0QlM0UlMjBtb3VzZS54JTIwKiUyMDAuMDAwNSkucmVwZWF0WSgyJTJDJTIwMikpLm91dChvMCklMEElMEElMEElMEElMEElMEE="},{sketch_id:"example_6",code:"JTJGJTJGJTIwYnklMjBEJUMzJUE5Ym9yYSUyMEZhbGxlaXJvcyUyMEdvbnphbGVzJTBBJTJGJTJGJTIwaHR0cHMlM0ElMkYlMkZ3d3cuZ29uemFsZXNkZWJvcmEuY29tJTJGJTBBJTBBb3NjKDUpLmFkZChub2lzZSg1JTJDJTIwMikpLmNvbG9yKDAlMkMlMjAwJTJDJTIwMykuY29sb3JhbWEoMC40KS5vdXQoKSUwQSUwQSUwQSUwQQ=="},{sketch_id:"example_8",code:"JTJGJTJGJTIwYnklMjBSb2RyaWdvJTIwVmVsYXNjbyUwQSUyRiUyRiUyMGh0dHBzJTNBJTJGJTJGeWVjdG8uZ2l0aHViLmlvJTJGJTBBJTBBb3NjKDEwNyUyQyUyMDAlMkMlMjAwLjcpLmNvbG9yKDElMkMlMjAwJTJDJTIwMSkucm90YXRlKDAlMkMlMjAtMC4wOCkubW9kdWxhdGVSb3RhdGUobzElMkMlMjAwLjQpLm91dChvMCklMEFvc2MoMzMpLnJvdGF0ZSgyJTJDJTIwMC44KS5tb2R1bGF0ZVJvdGF0ZShvMCUyQyUyMCgpJTIwJTNEJTNFJTIwKGEuZmZ0JTVCMCU1RCoyKSkub3V0KG8xKSUwQQ=="},{sketch_id:"example_9",code:"JTJGJTJGJTIwYnklMjBSb2RyaWdvJTIwVmVsYXNjbyUwQSUyRiUyRiUyMGh0dHBzJTNBJTJGJTJGeWVjdG8uZ2l0aHViLmlvJTJGJTBBJTBBb3NjKDE4JTJDJTIwMC4xJTJDJTIwMCkuY29sb3IoMiUyQyUyMDAuMSUyQyUyMDIpJTBBLm11bHQob3NjKDIwJTJDJTIwMC4wMSUyQyUyMDApKS5yZXBlYXQoMiUyQyUyMDIwKS5yb3RhdGUoMC41KS5tb2R1bGF0ZShvMSklMEEuc2NhbGUoMSUyQyUyMCgpJTIwJTNEJTNFJTIwJTIwKGEuZmZ0JTVCMCU1RCowLjklMjAlMkIlMjAyKSkuZGlmZihvMSkub3V0KG8wKSUwQW9zYygyMCUyQyUyMDAuMiUyQyUyMDApLmNvbG9yKDIlMkMlMjAwLjclMkMlMjAwLjEpLm11bHQob3NjKDQwKSkubW9kdWxhdGVSb3RhdGUobzAlMkMlMjAwLjIpJTBBLnJvdGF0ZSgwLjIpLm91dChvMSk="},{sketch_id:"example_10",code:"JTJGJTJGJTIwYnklMjBaYWNoJTIwS3JhbGwlMEElMkYlMkYlMjBodHRwJTNBJTJGJTJGemFjaGtyYWxsLm9ubGluZSUyRiUwQSUwQW9zYyglMjAyMTUlMkMlMjAwLjElMkMlMjAyJTIwKSUwQS5tb2R1bGF0ZSglMEElMjAlMjBvc2MoJTIwMiUyQyUyMC0wLjMlMkMlMjAxMDAlMjApJTBBJTIwJTIwLnJvdGF0ZSgxNSklMEEpJTBBLm11bHQoJTBBJTIwJTIwb3NjKCUyMDIxNSUyQyUyMC0wLjElMkMlMjAyKSUwQSUyMCUyMC5waXhlbGF0ZSglMjA1MCUyQyUyMDUwJTIwKSUwQSklMEEuY29sb3IoJTIwMC45JTJDJTIwMC4wJTJDJTIwMC45JTIwKSUwQS5tb2R1bGF0ZSglMEElMjAlMjBvc2MoJTIwNiUyQyUyMC0wLjElMjApJTBBJTIwJTIwLnJvdGF0ZSglMjA5JTIwKSUwQSklMEEuYWRkKCUwQSUyMCUyMG9zYyglMjAxMCUyQyUyMC0wLjklMkMlMjA5MDAlMjApJTBBJTIwJTIwLmNvbG9yKDElMkMwJTJDMSklMEEpJTBBLm11bHQoJTBBJTIwJTIwc2hhcGUoOTAwJTJDJTIwMC4yJTJDJTIwMSklMEElMjAlMjAubHVtYSgpJTBBJTIwJTIwLnJlcGVhdFgoMiklMEElMjAlMjAucmVwZWF0WSgyKSUwQSUyMCUyMC5jb2xvcmFtYSgxMCklMEEpJTBBLm1vZHVsYXRlKCUwQSUyMCUyMG9zYyglMjA5JTJDJTIwLTAuMyUyQyUyMDkwMCUyMCklMEElMjAlMjAucm90YXRlKCUyMDYlMjApJTBBKSUwQS5hZGQoJTBBJTIwJTIwb3NjKDQlMkMlMjAxJTJDJTIwOTApJTBBJTIwJTIwLmNvbG9yKDAuMiUyQzAlMkMxKSUwQSklMEEub3V0KCklMEE="},{sketch_id:"example_11",code:"JTJGJTJGJTIwYnklMjBaYWNoJTIwS3JhbGwlMEElMkYlMkYlMjBodHRwJTNBJTJGJTJGemFjaGtyYWxsLm9ubGluZSUyRiUwQSUwQW9zYygxMCUyQyUyMDAuOSUyQyUyMDMwMCklMEEuY29sb3IoMC45JTJDJTIwMC43JTJDJTIwMC44KSUwQS5kaWZmKCUwQSUyMCUyMG9zYyg0NSUyQyUyMDAuMyUyQyUyMDEwMCklMEElMjAlMjAuY29sb3IoMC45JTJDJTIwMC45JTJDJTIwMC45KSUwQSUyMCUyMC5yb3RhdGUoMC4xOCklMEElMjAlMjAucGl4ZWxhdGUoMTIpJTBBJTIwJTIwLmthbGVpZCgpJTBBKSUwQS5zY3JvbGxYKDEwKSUwQS5jb2xvcmFtYSgpJTBBLmx1bWEoKSUwQS5yZXBlYXRYKDQpJTBBLnJlcGVhdFkoNCklMEEubW9kdWxhdGUoJTBBJTIwJTIwb3NjKDElMkMlMjAtMC45JTJDJTIwMzAwKSUwQSklMEEuc2NhbGUoMiklMEEub3V0KCklMEE="},{sketch_id:"example_13",code:"JTJGJTJGJTIwYWNpZCUyMGJ1cyUyMHNlYXQlMEElMkYlMkYlMjBieSUyMFdpbGwlMjBIdW1waHJleXMlMEElMkYlMkYlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZUaGVXaXNweSUwQSUwQW9zYygxMDUpLmNvbG9yKDAuNSUyQzAuMSUyQzAuOCkucm90YXRlKDAuMTElMkMlMjAwLjEpLm1vZHVsYXRlKG9zYygxMCkucm90YXRlKDAuMykuYWRkKG8wJTJDJTIwMC4xKSkuYWRkKG9zYygyMCUyQzAuMDElMkMxKS5jb2xvcigwJTJDMC44JTJDMSkpLm91dChvMCklMEFvc2MoNTAlMkMwLjA1JTJDJTIwMC43KS5jb2xvcigxJTJDMC43JTJDMC41KS5kaWZmKG8wKS5tb2R1bGF0ZShvMSUyQzAuMDUpLm91dChvMSklMEFyZW5kZXIobzEp"},{sketch_id:"example_14",code:"JTJGJTJGJTIwYnklMjBPbGl2aWElMjBKYWNrJTBBJTJGJTJGJTIwJTQwX29qYWNrXyUwQSUwQW9zYygyMCUyQyUyMDAuMDElMkMlMjAxLjEpJTBBJTA5LmthbGVpZCg1KSUwQSUwOS5jb2xvcigyLjgzJTJDMC45MSUyQzAuMzkpJTBBJTA5LnJvdGF0ZSgwJTJDJTIwMC4xKSUwQSUwOS5tb2R1bGF0ZShvMCUyQyUyMCgpJTIwJTNEJTNFJTIwbW91c2UueCUyMColMjAwLjAwMDMpJTBBJTA5LnNjYWxlKDEuMDEpJTBBJTIwJTIwJTA5Lm91dChvMCk="},{sketch_id:"example_15",code:"JTJGJTJGJTIwYnklMjBPbGl2aWElMjBKYWNrJTBBJTJGJTJGJTIwaHR0cHMlM0ElMkYlMkZvamFjay5naXRodWIuaW8lMEElMEFvc2MoMTAwJTJDJTIwMC4wMSUyQyUyMDEuNCklMEElMDkucm90YXRlKDAlMkMlMjAwLjEpJTBBJTA5Lm11bHQob3NjKDEwJTJDJTIwMC4xKS5tb2R1bGF0ZShvc2MoMTApLnJvdGF0ZSgwJTJDJTIwLTAuMSklMkMlMjAxKSklMEElMDkuY29sb3IoMi44MyUyQzAuOTElMkMwLjM5KSUwQSUyMCUyMC5vdXQobzAp"},{sketch_id:"example_16",code:"JTJGJTJGJTIwYnklMjBPbGl2aWElMjBKYWNrJTBBJTJGJTJGJTIwaHR0cHMlM0ElMkYlMkZvamFjay5naXRodWIuaW8lMEElMEFvc2MoNCUyQyUyMDAuMSUyQyUyMDAuOCkuY29sb3IoMS4wNCUyQzAlMkMlMjAtMS4xKS5yb3RhdGUoMC4zMCUyQyUyMDAuMSkucGl4ZWxhdGUoMiUyQyUyMDIwKS5tb2R1bGF0ZShub2lzZSgyLjUpJTJDJTIwKCklMjAlM0QlM0UlMjAxLjUlMjAqJTIwTWF0aC5zaW4oMC4wOCUyMColMjB0aW1lKSkub3V0KG8wKQ=="},{sketch_id:"example_17",code:"JTJGJTJGJTIwbW9pcmUlMEElMkYlMkYlMjBieSUyME9saXZpYSUyMEphY2slMEElMkYlMkYlMjB0d2l0dGVyJTNBJTIwJTQwX29qYWNrXyUwQSUwQXBhdHRlcm4lMjAlM0QlMjAoKSUyMCUzRCUzRSUyMG9zYygyMDAlMkMlMjAwKS5rYWxlaWQoMjAwKS5zY2FsZSgxJTJDJTIwMC40KSUwQSUyRiUyRiUwQXBhdHRlcm4oKSUwQSUyMCUyMC5zY3JvbGxYKDAuMSUyQyUyMDAuMDEpJTBBJTIwJTIwLm11bHQocGF0dGVybigpKSUwQSUyMCUyMC5vdXQoKQ=="},{sketch_id:"example_18",code:"JTJGJTJGJTIwYnklMjBPbGl2aWElMjBKYWNrJTBBJTJGJTJGJTIwaHR0cHMlM0ElMkYlMkZvamFjay5naXRodWIuaW8lMEElMEFvc2MoNiUyQyUyMDAlMkMlMjAwLjgpJTBBJTIwJTIwLmNvbG9yKDEuMTQlMkMlMjAwLjYlMkMuODApJTBBJTIwJTIwLnJvdGF0ZSgwLjkyJTJDJTIwMC4zKSUwQSUyMCUyMC5waXhlbGF0ZSgyMCUyQyUyMDEwKSUwQSUyMCUyMC5tdWx0KG9zYyg0MCUyQyUyMDAuMDMpLnRocmVzaCgwLjQpLnJvdGF0ZSgwJTJDJTIwLTAuMDIpKSUwQSUyMCUyMC5tb2R1bGF0ZVJvdGF0ZShvc2MoMjAlMkMlMjAwKS50aHJlc2goMC4zJTJDJTIwMC42KSUyQyUyMCgpJTIwJTNEJTNFJTIwMC4xJTIwJTJCJTIwbW91c2UueCUyMColMjAwLjAwMiklMEElMjAlMjAub3V0KG8wKQ=="},{sketch_id:"rangga_0",code:"JTJGJTJGJTIwRHJlYW15JTIwRGlhbW9uZCUwQSUyRiUyRiUyMGJ5JTIwUmFuZ2dhJTIwUHVybmFtYSUyMEFqaSUwQSUyRiUyRiUyMGh0dHBzJTNBJTJGJTJGcmFuZ2dhcHVybmFtYWFqaTEud2l4c2l0ZS5jb20lMkZwb3J0Zm9saW8lMEElMEFvc2MoNyUyQy0wLjEyNSkubW9kdWxhdGUodm9yb25vaSgxKSkuZGlmZih2b3Jvbm9pKDEpLm11bHQoZ3JhZGllbnQoLTEpLmx1bWEoMC4xMjUpKSklMEElMjAlMjAubHVtYSgwLjEyNSklMEElMjAlMjAuYWRkKHNoYXBlKDclMkMlMjAwLjUpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwLm11bHQodm9yb25vaSgxMCUyQzIpLmJsZW5kKG8wKS5kaWZmKGdyYWRpZW50KDEpKS5tb2R1bGF0ZSh2b3Jvbm9pKCkpKSklMEElMjAlMjAuc2Nyb2xsWSgtMC4xKSUwQSUyMCUyMC5zY3JvbGxYKDAuMTI1KSUwQSUyMCUyMC5ibGVuZChvMCklMEElMjAlMjAuYmxlbmQobzApJTBBJTIwJTIwLm91dCgpJTBB"},{sketch_id:"rangga_1",code:"JTJGJTJGJTIwVGFnJTIwJTI2JTIwU3dlZXAlMEElMkYlMkYlMjBieSUyMFJhbmdnYSUyMFB1cm5hbWElMjBBamklMEElMkYlMkYlMjBodHRwcyUzQSUyRiUyRnJhbmdnYXB1cm5hbWFhamkxLndpeHNpdGUuY29tJTJGcG9ydGZvbGlvJTBBJTBBb3NjKDUlMkMwLjEyNSkuY29sb3JhbWEoMSklMEElMjAlMjAubHVtYSgwLjEyNSkuYWRkKHNoYXBlKDElMkMwLjUpLmx1bWEoMikuZGlmZihncmFkaWVudCgxKSkpJTBBJTIwJTIwLmRpZmYob3NjKC0xJTJDLTAuMjUpKS5ibGVuZChvMCkuY29sb3IoMCUyQzIuNSUyQzEuNzUpJTBBJTIwJTIwLm91dCgp"},{sketch_id:"rangga_2",code:"JTJGJTJGJTIwTW9ub2Nocm9tZSUyME1lbW9hciUwQSUyRiUyRiUyMGJ5JTIwUmFuZ2dhJTIwUHVybmFtYSUyMEFqaSUwQSUyRiUyRiUyMGh0dHBzJTNBJTJGJTJGcmFuZ2dhcHVybmFtYWFqaTEud2l4c2l0ZS5jb20lMkZwb3J0Zm9saW8lMEElMEF2b3Jvbm9pKDUwJTJDMSklMEElMjAlMjAubHVtYSgwLjUpLmFkZChzaGFwZSgxJTJDMSkubHVtYSgxKSklMEElMjAlMjAubW9kdWxhdGUob3NjKC0xMDAwJTJDLTEpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLm1vZHVsYXRlKG9zYygpLmx1bWEoKSkpJTBBJTIwJTIwLmJsZW5kKG8wKSUwQSUyMCUyMC5ibGVuZChvMCklMEElMjAlMjAuYmxlbmQobzApJTBBJTIwJTIwLmJsZW5kKG8wKSUwQSUyMCUyMC5vdXQoKQ=="},{sketch_id:"rangga_3",code:"JTJGJTJGJTIwR2FsYXh5JTIwVHJpcCUwQSUyRiUyRiUyMGJ5JTIwUmFuZ2dhJTIwUHVybmFtYSUyMEFqaSUwQSUyRiUyRiUyMGh0dHBzJTNBJTJGJTJGcmFuZ2dhcHVybmFtYWFqaTEud2l4c2l0ZS5jb20lMkZwb3J0Zm9saW8lMEElMEFzaGFwZSgxJTJDMSklMEElMjAlMjAubXVsdCh2b3Jvbm9pKDEwMDAlMkMyKSUwQSUyMCUyMC5ibGVuZChvMCkubHVtYSgpKSUwQSUyMCUyMC5hZGQoc2hhcGUoMyUyQzAuMTI1KSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMC5yb3RhdGUoMSUyQzEpLm11bHQodm9yb25vaSgxMDAwJTJDMSkubHVtYSgpKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMC5yb3RhdGUoMS41KSkuc2Nyb2xsWCglNUIwLjElMkMtMC4wNjI1JTJDMC4wMDUlMkMwLjAwMDAxJTVEJTJDMCklMEElMjAlMjAuc2Nyb2xsWSglNUIwLjElMkMtMC4wNjI1JTJDMC4wMDUlMkMwLjAwMDAxJTVEJTJDMCklMEElMjAlMjAub3V0KCk="},{sketch_id:"rangga_4",code:"JTJGJTJGJTIwU3VtZXQlMEElMkYlMkYlMjBieSUyMFJhbmdnYSUyMFB1cm5hbWElMjBBamklMEElMkYlMkYlMjBodHRwcyUzQSUyRiUyRnJhbmdnYXB1cm5hbWFhamkxLndpeHNpdGUuY29tJTJGcG9ydGZvbGlvJTBBJTBBb3NjKDAuNSUyQzEuMjUpLm11bHQoc2hhcGUoMSUyQzAuMDkpLnJvdGF0ZSgxLjUpKSUwQSUyMCUyMC5kaWZmKGdyYWRpZW50KCkpJTBBJTIwJTIwLmFkZChzaGFwZSgyJTJDMikuYmxlbmQoZ3JhZGllbnQoMSkpKSUwQSUyMCUyMC5tb2R1bGF0ZShub2lzZSgpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLm1vZHVsYXRlKG5vaXNlKCkuc2Nyb2xsWSgxJTJDMC4wNjI1KSkpJTBBJTIwJTIwLmJsZW5kKG8wKSUwQSUyMCUyMC5jb2xvcigxJTJDLTAuNSUyQy0wLjc1KSUwQSUyMCUyMC5vdXQoKQ=="},{sketch_id:"marianne_0",code:"JTJGJTJGcG9ydCUwQSUyRiUyRmJ5JTIwTWFyaWFubmUlMjBUZWl4aWRvJTBBJTJGJTJGaHR0cHMlM0ElMkYlMkZtYXJpYW5uZXRlaXhpZG8uZ2l0aHViLmlvJTJGJTBBJTBBb3NjKDUlMkMlMjAwLjklMkMlMjAwLjAwMSklMEElMjAlMjAlMjAlMjAua2FsZWlkKCU1QjMlMkM0JTJDNSUyQzclMkM4JTJDOSUyQzEwJTVELmZhc3QoMC4xKSklMEElMjAlMjAlMjAlMjAuY29sb3IoMC41JTJDJTIwMC4zKSUwQSUyMCUyMCUyMCUyMC5jb2xvcmFtYSgwLjQpJTBBJTIwJTIwJTIwJTIwLnJvdGF0ZSgwLjAwOSUyQygpJTNEJTNFTWF0aC5zaW4odGltZSkqJTIwLTAuMDAxJTIwKSUwQSUyMCUyMCUyMCUyMC5tb2R1bGF0ZVJvdGF0ZShvMCUyQygpJTNEJTNFTWF0aC5zaW4odGltZSklMjAqJTIwMC4wMDMpJTBBJTIwJTIwJTIwJTIwLm1vZHVsYXRlKG8wJTJDJTIwMC45KSUwQSUyMCUyMCUyMCUyMC5zY2FsZSgwLjkpJTBBJTIwJTIwJTIwJTIwLm91dChvMCklMEElMEE="},{sketch_id:"marianne_1",code:"JTJGJTJGUGl4ZWxzY2FwZSUwQSUyRiUyRk1hcmlhbm5lJTIwVGVpeGlkbyUwQSUyRiUyRmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRk1hcmlhbm5lVGVpeGlkbyUwQSUwQXNyYyhvMCklMEElMjAuc2F0dXJhdGUoMS4wMSklMEElMjAuc2NhbGUoLjk5OSklMEElMjAuY29sb3IoMS4wMSUyQzEuMDElMkMxLjAxKSUwQSUyMC5odWUoLjAxKSUwQSUyMC5tb2R1bGF0ZUh1ZShzcmMobzEpLmh1ZSguMykucG9zdGVyaXplKC0xKS5jb250cmFzdCguNyklMkMyKSUwQSUyMCUyMC5sYXllcihzcmMobzEpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLmx1bWEoKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMC5tdWx0KGdyYWRpZW50KDEpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLnNhdHVyYXRlKC45KSkpJTBBJTIwJTIwLm91dChvMCklMEElMEFub2lzZSgxJTJDJTIwLjIpJTBBJTIwJTIwLnJvdGF0ZSgyJTJDLjUpJTBBJTIwJTIwLmxheWVyKHNyYyhvMCklMEElMjAlMjAuc2Nyb2xsWCguMikpJTBBJTIwJTIwLm91dChvMSklMEElMEFyZW5kZXIobzAp"},{sketch_id:"naoto_0",code:"JTJGJTJGJTIwJTQwbmFvdG9faGllZGElMEFvc2MoMjAlMkMlMjAwLjElMkMlMjAwKS5jb2xvcigwJTJDJTIwMSUyQyUyMDIpLnJvdGF0ZSgxLjU3JTJGMikub3V0KG8xKSUwQW9zYygzMCUyQyUyMDAuMDElMkMlMjAwKS5jb2xvcigyJTJDJTIwMC43JTJDJTIwMSkubW9kdWxhdGUobzElMkMlMjAwKS5hZGQobzElMkMxKS5tb2R1bGF0ZVBpeGVsYXRlKG8xJTJDMSUyQzEwKS5vdXQobzAp"},{sketch_id:"naoto_1",code:"JTJGJTJGJTIwJTQwbmFvdG9faGllZGElMEFzb2xpZCgwLjIlMkMwLjYlMkMwLjkpLmxheWVyKG9zYygzMS40JTJDMCkudGhyZXNoKDAuNykubHVtYSgpLm1vZHVsYXRlKG9zYyg0JTJDMSkucm90YXRlKDEpJTJDMC4wNSkuY29sb3IoMCUyQzAlMkMwKSkubGF5ZXIob3NjKDMxLjQlMkMwKS50aHJlc2goMC43KS5sdW1hKCkubW9kdWxhdGUob3NjKDQlMkMxKS5yb3RhdGUoMSklMkMwLjEpKS5vdXQoKQ=="},{sketch_id:"ritchse_0",code:"JTJGJTJGcmFuZG9tJTIwdHJ5cG9waG9iaWElMjAtJTIwY2hhbmdlcyUyMGV2ZXJ5dGltZSUyMHlvdSUyMGxvYWQlMjBpdCElMEElMkYlMkZieSUyMFJpdGNoc2UlMEElMkYlMkZpbnN0YWdyYW0uY29tJTJGcml0Y2hzZSUwQSUyMCUwQWZ1bmN0aW9uJTIwcihtaW4lM0QwJTJDbWF4JTNEMSklMjAlN0IlMjByZXR1cm4lMjBNYXRoLnJhbmRvbSgpKihtYXgtbWluKSUyQm1pbiUzQiUyMCU3RCUwQSUyMCUwQXNvbGlkKDElMkMxJTJDMSklMEElMjAlMjAlMDkuZGlmZihzaGFwZSglNUI0JTJDNCUyQzQlMkMyNCU1RC5zbW9vdGgoKS5mYXN0KC41KSUyQ3IoMC42JTJDMC45MyklMkMuMDkpLnJlcGVhdCgyMCUyQzEwKSklMEElMDkubW9kdWxhdGVTY2FsZShvc2MoOCkucm90YXRlKHIoLS41JTJDLjUpKSUyQy41MiklMEElMDkuYWRkKCUwQSUyMCUyMCUwOSUwOXNyYyhvMCkuc2NhbGUoMC45NjUpLnJvdGF0ZSguMDEyKihNYXRoLnJvdW5kKHIoLTIlMkMxKSkpKSUwQSUyMCUyMCUwOSUwOS5jb2xvcihyKCklMkNyKCklMkNyKCkpJTBBJTIwJTIwJTIwJTIwJTA5Lm1vZHVsYXRlUm90YXRlKG8wJTJDcigwJTJDMC41KSklMEElMjAlMjAlMDklMDkuYnJpZ2h0bmVzcyguMTUpJTBBJTIwJTIwJTA5JTA5JTJDLjcpJTBBJTA5Lm91dCgp"},{sketch_id:"ritchse_1",code:"JTJGJTJGY29ycnVwdGVkJTIwc2NyZWVuc2F2ZXIlMEElMkYlMkZieSUyMFJpdGNoc2UlMEElMkYlMkZpbnN0YWdyYW0uY29tJTJGcml0Y2hzZSUwQSUyMCUwQXZvcm9ub2koMzUwJTJDMC4xNSklMEElMjAlMjAlMDkubW9kdWxhdGVTY2FsZShvc2MoOCkucm90YXRlKE1hdGguc2luKHRpbWUpKSUyQy41KSUwQSUyMCUyMCUwOS50aHJlc2goLjgpJTBBJTA5Lm1vZHVsYXRlUm90YXRlKG9zYyg3KSUyQy40KSUwQSUwOS50aHJlc2goLjcpJTBBJTIwJTIwJTA5LmRpZmYoc3JjKG8wKS5zY2FsZSgxLjgpKSUwQSUwOS5tb2R1bGF0ZVNjYWxlKG9zYygyKS5tb2R1bGF0ZVJvdGF0ZShvMCUyQy43NCkpJTBBJTA5LmRpZmYoc3JjKG8wKS5yb3RhdGUoJTVCLS4wMTIlMkMuMDElMkMtLjAwMiUyQzAlNUQpLnNjcm9sbFkoMCUyQyU1Qi0xJTJGMTk5ODAwJTJDMCU1RC5mYXN0KDAuNykpKSUwQSUwOS5icmlnaHRuZXNzKCU1Qi0uMDIlMkMtLjE3JTVELnNtb290aCgpLmZhc3QoLjUpKSUwQSUwOS5vdXQoKQ=="},{sketch_id:"ritchse_2",code:"JTJGJTJGdHJvcGljYWwlMjBqdWljZSUwQSUyRiUyRmJ5JTIwUml0Y2hzZSUwQSUyRiUyRmluc3RhZ3JhbS5jb20lMkZyaXRjaHNlJTBBJTIwJTBBdm9yb25vaSgyJTJDMC4zJTJDMC4yKS5zaGlmdCgwLjUpJTBBLm1vZHVsYXRlUGl4ZWxhdGUodm9yb25vaSg0JTJDMC4yKSUyQzMyJTJDMiklMEEuc2NhbGUoKCklM0QlM0UxJTJCKE1hdGguc2luKHRpbWUqMi41KSowLjA1KSklMEEuZGlmZih2b3Jvbm9pKDMpLnNoaWZ0KDAuNikpJTBBLmRpZmYob3NjKDIlMkMwLjE1JTJDMS4xKS5yb3RhdGUoKSklMEEuYnJpZ2h0bmVzcygwLjEpLmNvbnRyYXN0KDEuMikuc2F0dXJhdGUoMS4yKSUwQSUwOS5vdXQoKSUwQXNwZWVkJTIwJTNEJTIwMC44"},{sketch_id:"ritchse_3",code:"JTJGJTJGdHJ5aW5nJTIwdG8lMjBnZXQlMjBjbG9zZXIlMEElMkYlMkZieSUyMFJpdGNoc2UlMEElMkYlMkZpbnN0YWdyYW0uY29tJTJGcml0Y2hzZSUwQSUyMCUwQW9zYyg2MCUyQy0wLjAxNSUyQzAuMykuZGlmZihvc2MoNjAlMkMwLjA4KS5yb3RhdGUoTWF0aC5QSSUyRjIpKSUwQSUwOS5tb2R1bGF0ZVNjYWxlKG5vaXNlKDMuNSUyQzAuMjUpLm1vZHVsYXRlU2NhbGUob3NjKDE1KS5yb3RhdGUoKCklM0QlM0VNYXRoLnNpbih0aW1lJTJGMikpKSUyQzAuNiklMEElMDkuY29sb3IoMSUyQzAuNSUyQzAuNCkuY29udHJhc3QoMS40KSUwQSUwOS5hZGQoc3JjKG8wKS5tb2R1bGF0ZShvMCUyQy4wNCklMkMuNiklMEElMDkuaW52ZXJ0KCkuYnJpZ2h0bmVzcygwLjEpLmNvbnRyYXN0KDEuMiklMEElMDkubW9kdWxhdGVTY2FsZShvc2MoMiklMkMtMC4yKSUwQSUyMCUyMC5vdXQoKQ=="},{sketch_id:"ritchse_4",code:"JTJGJTJGJTIwZGlzaW50ZWdyYXRpb24lMEElMkYlMkYlMjBieSUyMFJpdGNoc2UlMEElMkYlMkYlMjBpbnN0YWdyYW0uY29tJTJGcml0Y2hzZSUwQSUyMCUwQW9zYyg1JTJDLjEpLm1vZHVsYXRlKG5vaXNlKDYpJTJDLjIyKS5kaWZmKG8wKSUwQSUyMCUyMCUwOS5tb2R1bGF0ZVNjcm9sbFkob3NjKDIpLm1vZHVsYXRlKG9zYygpLnJvdGF0ZSgpJTJDLjExKSklMEElMDkuc2NhbGUoLjcyKS5jb2xvcigwLjk5JTJDMS4wMTQlMkMxKSUwQSUyMCUyMCUwOS5vdXQoKQ== "},{sketch_id:"flor_0",code:"JTJGJTJGRmxvciUyMGRlJTIwRnVlZ28lMEElMkYlMkZodHRwcyUzQSUyRiUyRmZsb3JkZWZ1ZWdvLmdpdGh1Yi5pbyUyRiUwQW9zYygzMCUyQzAuMDElMkMxKSUwQS5tdWx0KG9zYygyMCUyQy0wLjElMkMxKS5tb2R1bGF0ZShub2lzZSgzJTJDMSkpLnJvdGF0ZSgwLjcpKSUwQS5wb3N0ZXJpemUoJTVCMyUyQzEwJTJDMiU1RC5mYXN0KDAuNSkuc21vb3RoKDEpKSUwQS5tb2R1bGF0ZVJvdGF0ZShvMCUyQygpJTNEJTNFbW91c2UueCowLjAwMyklMEEub3V0KCk= "},{sketch_id:"mahalia_0",code:"JTJGJTJGJTIwTWFoYWxpYSUyMEgtUiUwQSUyRiUyRiUyMElHJTNBJTIwJTQwbW1faHJfJTBBJTBBc2hhcGUoMjAlMkMwLjElMkMwLjAxKSUwQSUyMCUyMC5zY2FsZSgoKSUyMCUzRCUzRSUyME1hdGguc2luKHRpbWUpKjMpJTBBJTIwJTIwLnJlcGVhdCgoKSUyMCUzRCUzRSUyME1hdGguc2luKHRpbWUpKjEwKSUwQSUyMCUyMC5tb2R1bGF0ZVJvdGF0ZShvMCklMEElMjAlMjAuc2NhbGUoKCklMjAlM0QlM0UlMjBNYXRoLnNpbih0aW1lKSoyKSUwQSUyMCUyMC5tb2R1bGF0ZShub2lzZSgyJTJDMCkpJTBBJTIwJTIwLnJvdGF0ZSgwLjElMkMlMjAwLjkpJTBBLm91dChvMCklMEElMEFzcmMobzApJTBBLm1vZHVsYXRlKG9zYyg1MDAlMkMwJTJDMCkpJTBBLm91dChvMSklMEElMEFzcmMobzEpJTBBLm1vZHVsYXRlS2FsZWlkKHZvcm9ub2koKCklMjAlM0QlM0UlMjBNYXRoLnNpbih0aW1lKSozJTJDMC4xJTJDMC4wMSklMkMoKSUyMCUzRCUzRSUyME1hdGguc2luKHRpbWUpKjMpJTBBLnNjYWxlKCgpJTIwJTNEJTNFJTIwTWF0aC5zaW4odGltZSkqMyklMEEub3V0KG8yKSUwQSUwQXJlbmRlcihvMik="},{sketch_id:"mahalia_1",code:"JTJGJTJGJTIwTWFoYWxpYSUyMEgtUiUwQSUyRiUyRiUyMElHJTNBJTIwJTQwbW1faHJfJTBBJTBBc2hhcGUoKCklMjAlM0QlM0UlMjBNYXRoLnNpbih0aW1lKSUyQjEqMiklMEEucm90YXRlKCgpJTIwJTNEJTNFJTIwTWF0aC5QSSUyMColMjBtb3VzZS54JTIwJTJGMTgwKSUwQS5yZXBlYXRYKDMpJTBBLnJlcGVhdFkoKCklM0QlM0VNYXRoLnNpbih0aW1lKSo1KSUwQS5zY2FsZSgoKSUyMCUzRCUzRSUyME1hdGguUEklMkY0KSUwQS5ibGVuZChzcmMobzApLmNvbG9yKDElMkMwJTJDMCkpJTBBLm1vZHVsYXRlKG9zYygyMCUyQyUyMDAlMkMuNCkpJTBBLmthbGVpZCgyKSUwQSUyMC5vdXQobzApJTBBJTBBcmVuZGVyKG8wKQ=="},{sketch_id:"mahalia_2",code:"JTJGJTJGJTIwVmVsdmV0JTIwUG9vbCUwQSUyRiUyRiUyMGJ5JTIwTWFoYWxpYSUyMEgtUiUwQSUyRiUyRiUyMElHJTNBJTIwbW1faHJfJTBBJTBBJTBBbm9pc2UoKSUwQS5jb2xvcigoKSUyMCUzRCUzRSUyMGEuZmZ0JTVCMiU1RCoyJTJDMCUyQy42KSUwQS5tb2R1bGF0ZShub2lzZSgoKSUyMCUzRCUzRSUyMGEuZmZ0JTVCMCU1RCoxMCkpJTBBLnNjYWxlKCgpJTNEJTNFJTIwYS5mZnQlNUIyJTVEKjUpJTBBLmxheWVyKCUwQSUyMCUyMHNyYyhvMCklMEElMjAlMjAubWFzayhvc2MoMTApLm1vZHVsYXRlUm90YXRlKG9zYygpJTJDOTAlMkMwKSklMEElMjAlMjAuc2NhbGUoKCklMjAlM0QlM0UlMjBhLmZmdCU1QjAlNUQqMiklMEElMjAlMjAubHVtYSgwLjIlMkMwLjMpJTBBKSUwQS5ibGVuZChvMCklMEEub3V0KG8wKSUwQSUwQW9zYygpJTBBLm1vZHVsYXRlKG5vaXNlKCgpJTIwJTNEJTNFJTIwYS5mZnQlNUIxJTVEJTJCNSkpJTBBLmNvbG9yKDElMkMwJTJDMCklMEEub3V0KG8xKSUwQSUwQXNyYyhvMCklMEEubW9kdWxhdGUobzEpJTBBLmxheWVyKCUwQSUyMCUyMHNyYyhvMSklMEElMjAlMjAubWFzayhvMSklMEElMjAlMjAuc2F0dXJhdGUoNyklMEEpJTBBLm1vZHVsYXRlUm90YXRlKG8xKSUwQS5yb3RhdGUoKCU3QnRpbWUlN0QpJTIwJTNEJTNFJTIwdGltZSUyNTM2MCowLjA1KSUwQS5vdXQobzIpJTBBJTBBcmVuZGVyKG8yKQ=="},{sketch_id:"mahalia_3",code:"JTJGJTJGJTIwYnklMjBNYWhhbGlhJTIwSC1SJTBBJTJGJTJGJTIwSUclM0ElMjBtbV9ocl8lMEElMEFzaGFwZSgoKSUzRCUzRU1hdGguc2luKHRpbWUpJTJCMSozJTJDJTIwLjUlMkMuMDEpJTBBLnJlcGVhdCg1JTJDMyUyQyUyMCgpJTNEJTNFYS5mZnQlNUIwJTVEKjIlMkMlMjAoKSUzRCUzRWEuZmZ0JTVCMSU1RCoyKSUwQS5zY3JvbGxZKC41JTJDMC4xKSUwQS5sYXllciglMEElMjAlMjBzcmMobzEpJTBBJTIwJTIwLm1hc2sobzApJTBBJTIwJTIwLmx1bWEoLjAxJTJDJTIwLjEpJTBBJTIwJTIwLmludmVydCguMiklMEEpJTBBLm1vZHVsYXRlKG8xJTJDLjAyKSUwQS5vdXQobzApJTBBJTBBb3NjKDQwJTJDJTIwMC4wOSUyQyUyMDAuOSklMEEuY29sb3IoLjklMkMwJTJDNSklMEEubW9kdWxhdGUob3NjKDEwKS5yb3RhdGUoMSUyQyUyMDAuNSkpJTBBLnJvdGF0ZSgxJTJDJTIwMC4yKSUwQS5vdXQobzEpJTBBJTBBcmVuZGVyKG8wKSUwQSUwQQ=="},{sketch_id:"mahalia_4",code:"JTJGJTJGJTIwQ2VsbHVsYXIlMjAlMjYlMjBCbG9idWxhciUwQSUyRiUyRiUyMGJ5JTIwTWFoYWxpYSUyMEgtUiUwQSUyRiUyRiUyMElHJTNBJTIwbW1faHJfJTBBJTBBc3BlZWQlMjAlM0QlMjAwLjMlMEElMEFzaGFwZSgyMCUyQzAuMiUyQzAuMyklMEEuY29sb3IoMC41JTJDMC44JTJDNTApJTBBJTIwJTIwLnNjYWxlKCgpJTIwJTNEJTNFJTIwTWF0aC5zaW4odGltZSklMkIxKjIpJTBBJTIwJTIwLnJlcGVhdCgoKSUyMCUzRCUzRSUyME1hdGguc2luKHRpbWUpKjEwKSUwQSUyMCUyMC5tb2R1bGF0ZVJvdGF0ZShvMCklMEElMjAlMjAuc2NhbGUoKCklMjAlM0QlM0UlMjBNYXRoLnNpbih0aW1lKSUyQjElMjAqMS41KSUwQSUyMCUyMC5tb2R1bGF0ZShub2lzZSgyJTJDMikpJTBBJTIwJTIwLnJvdGF0ZSgxJTJDJTIwLjIpJTBBJTIwJTIwJTJGJTJGJTIwLmludmVydCgyLjQpJTBBLm91dChvMCklMEE="},{sketch_id:"andromeda_0",code:"JTJGJTJGJTIwMy4wJTBBJTJGJTJGJTIwYnklMjAlQ0UlOTRORFIwTTNEJUNFJTk0JTBBJTJGJTJGJTIwaHR0cHMlM0ElMkYlMkZ3d3cuaW5zdGFncmFtLmNvbSUyRmFuZHJvbTNfZGElMkYlMEElMEElMEFub2lzZSgzJTJDMC4zJTJDMykudGhyZXNoKDAuMyUyQzAuMDMpLmRpZmYobzMlMkMwLjMpLm91dChvMSklMEFncmFkaWVudCglNUIwLjMlMkMwLjMlMkMzJTVEKS5kaWZmKG8wKS5ibGVuZChvMSkub3V0KG8zKSUwQXZvcm9ub2koMzMlMkMzJTJDMzApLnJvdGF0ZSgzJTJDMC4zJTJDMCkubW9kdWxhdGVTY2FsZShvMiUyQzAuMykuY29sb3IoLTMlMkMzJTJDMCkuYnJpZ2h0bmVzcygzKS5vdXQobzApJTBBc2hhcGUoMzAlMkMwLjMlMkMxKS5pbnZlcnQoKCU3QnRpbWUlN0QpJTNEJTNFTWF0aC5zaW4odGltZSkqMykub3V0KG8yKSUwQSUwQXJlbmRlcihvMyklMEE="},{sketch_id:"andromeda_1",code:"JTJGJTJGJTIwMy4zJTBBJTJGJTJGJTIwYnklMjAlQ0UlOTRORFIwTTNEJUNFJTk0JTBBJTJGJTJGJTIwaHR0cHMlM0ElMkYlMkZ3d3cuaW5zdGFncmFtLmNvbSUyRmFuZHJvbTNfZGElMkYlMEElMEFvc2MoKS5tb2R1bGF0ZVJvdGF0ZShvMCUyQzAuMykub3V0KCklMEFvc2MoMzMlMkMwLjMlMkMwLjMpLmRpZmYobzMlMkMzKS5vdXQobzEpJTBBb3NjKDMlMkMwLjMlMkMzMykubW9kdWxhdGVLYWxlaWQobzMlMkMzKS5kaWZmKG8wKS5vdXQobzIpJTBBc3JjKG8wJTJDMykubXVsdChvMSUyQzMpLmthbGVpZCgzKS5vdXQobzMpJTBBcmVuZGVyKG8yKQ=="},{sketch_id:"asdrubal_0",code:"JTJGJTJGQXNkciVDMyVCQWJhbCUyMEdvbWV6JTBBJTBBbm9pc2UoMyUyQzAuMSUyQzcpJTBBLnJvdGF0ZSgxJTJDLTElMkMtMikubWFzayhzaGFwZSgyMCkpJTBBLmNvbG9yYW1hKDAuNSklMEEubW9kdWxhdGVTY2FsZShvMCklMEEubW9kdWxhdGVTY2FsZShvMCUyQzElMkMpJTBBLmJsZW5kKG8wKSUwQS5ibGVuZChvMCklMEEuYmxlbmQobzApJTBBLmJsZW5kKG8wKSUwQS5vdXQobzApJTBB"},{sketch_id:"flor_1",code:"JTJGJTJGSHlkcmElMjBHbGl0Y2h5JTIwU2xpdCUyMFNjYW4lMEElMkYlMkZGbG9yJTIwZGUlMjBGdWVnbyUwQSUyRiUyRmh0dHBzJTNBJTJGJTJGZmxvcmRlZnVlZ28uZ2l0aHViLmlvJTJGJTIwJTBBczAuaW5pdENhbSgpJTBBc3JjKHMwKS5zYXR1cmF0ZSgyKS5jb250cmFzdCgxLjMpLmxheWVyKHNyYyhvMCkubWFzayhzaGFwZSg0JTJDMikuc2NhbGUoMC41JTJDMC43KS5zY3JvbGxYKDAuMjUpKS5zY3JvbGxYKDAuMDAxKSkubW9kdWxhdGUobzAlMkMwLjAwMSkub3V0KG8wKSUwQSUwQQ=="},{sketch_id:"flor_2",code:"JTJGJTJGR2xpdGNoJTIwUml2ZXIlMEElMkYlMkZGbG9yJTIwZGUlMjBGdWVnbyUwQSUyRiUyRmh0dHBzJTNBJTJGJTJGZmxvcmRlZnVlZ28uZ2l0aHViLmlvJTJGJTBBdm9yb25vaSg4JTJDMSklMEEubXVsdChvc2MoMTAlMkMwLjElMkMoKSUzRCUzRU1hdGguc2luKHRpbWUpKjMpLnNhdHVyYXRlKDMpLmthbGVpZCgyMDApKSUwQS5tb2R1bGF0ZShvMCUyQzAuNSklMEEuYWRkKG8wJTJDMC44KSUwQS5zY3JvbGxZKC0wLjAxKSUwQS5zY2FsZSgwLjk5KSUwQS5tb2R1bGF0ZSh2b3Jvbm9pKDglMkMxKSUyQzAuMDA4KSUwQS5sdW1hKDAuMyklMEEub3V0KCklMEElMEElMEFzcGVlZCUyMCUzRCUyMDAuMSUwQSUwQSUwQSUwQQ=="},{sketch_id:"nesso_0",code:"JTBBJTJGJTJGY2xvdWRzJTIwb2YlMjBwYXNzYWdlJTBBJTJGJTJGYnklMjBOZXNzbyUwQSUyRiUyRnd3dy5uZXNzby54eXolMEElMEFzaGFwZSglNUI0JTJDNSUyQzYlNUQuZmFzdCgwLjEpLnNtb290aCgxKSUyQzAuMDAwMDAxJTJDJTVCMC4yJTJDMC43JTVELnNtb290aCgxKSklMEEuY29sb3IoMC4yJTJDMC40JTJDMC4zKSUwQS5zY3JvbGxYKCgpJTNEJTNFTWF0aC5zaW4odGltZSowLjI3KSklMEEuYWRkKCUwQSUyMCUyMHNoYXBlKCU1QjQlMkM1JTJDNiU1RC5mYXN0KDAuMSkuc21vb3RoKDEpJTJDMC4wMDAwMDElMkMlNUIwLjIlMkMwLjclMkMwLjUlMkMwLjMlNUQuc21vb3RoKDEpKSUwQSUyMCUyMC5jb2xvcigwLjYlMkMwLjIlMkMwLjUpJTBBJTIwJTIwLnNjcm9sbFkoMC4zNSklMEElMjAlMjAuc2Nyb2xsWCgoKSUzRCUzRU1hdGguc2luKHRpbWUqMC4zMykpKSUwQS5hZGQoJTBBJTIwJTIwc2hhcGUoJTVCNCUyQzUlMkM2JTVELmZhc3QoMC4xKS5zbW9vdGgoMSklMkMwLjAwMDAwMSUyQyU1QjAuMiUyQzAuNyUyQzAuMyU1RC5zbW9vdGgoMSkpJTBBJTIwJTIwLmNvbG9yKDAuMiUyQzAuNCUyQzAuNiklMEElMjAlMjAuc2Nyb2xsWSgtMC4zNSklMEElMjAlMjAuc2Nyb2xsWCgoKSUzRCUzRU1hdGguc2luKHRpbWUqMC40MSkqLTEpKSUwQS5hZGQoJTBBJTIwJTIwJTIwJTIwJTIwJTIwc3JjKG8wKS5zaGlmdCgwLjAwMSUyQzAuMDElMkMwLjAwMSklMEElMjAlMjAlMjAlMjAlMjAlMjAuc2Nyb2xsWCglNUIwLjA1JTJDLTAuMDUlNUQuZmFzdCgwLjEpLnNtb290aCgxKSklMEElMjAlMjAlMjAlMjAlMjAlMjAuc2NhbGUoJTVCMS4wNSUyQzAuOSU1RC5mYXN0KDAuMykuc21vb3RoKDEpJTJDJTVCMS4wNSUyQzAuOSUyQzElNUQuZmFzdCgwLjI5KS5zbW9vdGgoMSkpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTJDMC44NSklMEEubW9kdWxhdGUodm9yb25vaSgxMCUyQzIlMkMyKSklMEEub3V0KCk="},{sketch_id:"malitzin_0",code:"JTJGJTJGQ05EU0QlMEElMkYlMkZodHRwJTNBJTJGJTJGbWFsaXR6aW5jb3J0ZXMubmV0JTJGJTBBJTJGJTJGJTIwc2FuZCUyMHNwaXJhbHMlMEElMEFvc2MoMyUyQyUyMDAuMDElMkMlMjAwLjQpJTBBLmNvbG9yKDEuMiUyQzEuMiUyQzEuMyklMEEuc2F0dXJhdGUoMC40KSUwQS5tb2R1bGF0ZVJlcGVhdChvc2MoMiklMkMxJTJDJTIwMiUyQyUyMDQlMkMlMjAzKSUwQS5tb2R1bGF0ZUthbGVpZChvc2MoMTIlMkMwLjA1JTJDMCklMkMxKSUwQS5sdW1hJTIwKDAuNCklMEEucm90YXRlKDQlMkMlMjAwLjElMkMwKSUwQS5tb2R1bGF0ZShvMCUyQyUyMCgpJTIwJTNEJTNFJTIwbW91c2UueSUyMCowLjAwMDIlMjApJTBBLnNjYWxlKDEpLmRpZmYobzEpJTBBLm91dChvMCk="},{sketch_id:"malitzin_1",code:"JTJGJTJGQ05EU0QlMEElMkYlMkZodHRwJTNBJTJGJTJGbWFsaXR6aW5jb3J0ZXMubmV0JTJGJTBBJTJGJTJGYW1lYmElMEElMEFvc2MoMTUlMkMlMjAwLjAxJTJDJTIwMC4xKS5tdWx0KG9zYygxJTJDJTIwLTAuMSkubW9kdWxhdGUob3NjKDIpLnJvdGF0ZSg0JTJDMSklMkMlMjAyMCkpJTBBLmNvbG9yKDAlMkMyLjQlMkM1KSUwQS5zYXR1cmF0ZSgwLjQpJTBBLmx1bWEoMSUyQzAuMSUyQyUyMCg2JTJDJTIwKCklM0QlM0UlMjAxJTIwJTJCJTIwYS5mZnQlNUIzJTVEKSklMEEuc2NhbGUoMC43JTJDJTIwKCklM0QlM0UlMjAwLjclMjAlMkIlMjBhLmZmdCU1QjMlNUQpJTBBLmRpZmYobzApJTJGJTJGJTIwbzAlMEEub3V0KG8wKSUyRiUyRiUyMG8x"},{sketch_id:"malitzin_2",code:"JTJGJTJGQ05EU0QlMEElMkYlMkZodHRwJTNBJTJGJTJGbWFsaXR6aW5jb3J0ZXMubmV0JTJGJTBBJTJGJTJGY3JhenklMjBzcXVhcmVzJTBBJTBBc2hhcGUoNCUyQyUyMCgwLjAxJTJDJTIwKCklM0QlM0UlMjAwLjIlMjAlMkIlMjBhLmZmdCU1QjIlNUQpJTJDMSklMEEubXVsdChvc2MoMSUyQyUyMDEpLm1vZHVsYXRlKG9zYyg1KS5yb3RhdGUoMS40JTJDMSklMkMzKSklMEEuY29sb3IoMSUyQzIlMkM0KSUwQS5zYXR1cmF0ZSgwLjIpJTBBLmx1bWEoMS4yJTJDMC4wNSUyQyUyMCg1JTJDJTIwKCklM0QlM0UlMjAyJTIwJTJCJTIwYS5mZnQlNUIzJTVEKSklMEEuc2NhbGUoMC42JTJDJTIwKCklM0QlM0UlMjAwLjklMjAlMkIlMjBhLmZmdCU1QjMlNUQpJTBBLmRpZmYobzApJTJGJTJGJTIwbzAlMEEub3V0KG8wKSUyRiUyRiUyMG8x"},{sketch_id:"khoparzi_0",code:"JTJGJTJGJTIwSGFwcHklMjBNYW5kYWxhJTBBJTJGJTJGJTIwQnklMjBBYmhpbmF5JTIwS2hvcGFyemklMEElMkYlMkYlMjB0d2l0dGVyJTJGZ2l0aHViJTJGaW5zdGFncmFtJTNBJTIwJTQwa2hvcGFyemklMEF2b3Jvbm9pKDUlMkMtMC4xJTJDNSklMEEuYWRkKG9zYygxJTJDMCUyQzEpKS5rYWxlaWQoMjEpJTBBLnNjYWxlKDElMkMxJTJDMikuY29sb3JhbWEoKS5vdXQobzEpJTBBc3JjKG8xKS5tdWx0KHNyYyhzMCkubW9kdWxhdGVSb3RhdGUobzElMkMxMDApJTJDJTIwLTAuNSklMEElMjAlMjAub3V0KG8wKSUwQSUwQQ=="},{sketch_id:"khoparzi_1",code:"JTJGJTJGJTIwUGVycGV0dWFsJTIwZWxldmF0b3IlMjBidXR0b25zJTBBJTJGJTJGJTIwQnklMjBLaG9wYXJ6aSUwQSUyRiUyRiUyMGh0dHAlM0ElMkYlMkZraG9wYXJ6aS5jb20lMEElMEFzaGFwZSgzKS5hZGQob3NjKDElMkMwLjUlMkMxKSUyQyUyMDEpJTBBJTA5LmFkZChvMSUyQyUyMCgpJTIwJTNEJTNFJTIwKE1hdGguc2luKHRpbWUlMkY0KSUyMColMjAwLjclMjAlMkIlMjAwLjEpKSUwQSUwOSUyRiUyRi5yZXBlYXQoNSklMEElMjAlMjAlMDkuc2NhbGUoKCklM0QlM0VNYXRoLnNpbih0aW1lJTIwJTJGJTIwMTYpKS5yb3RhdGUoMCUyQyUyMC0wLjEpJTBBJTA5Lm91dChvMSklMEElMEFzcmMobzEpJTBBJTIwJTIwLnJvdGF0ZSgwJTJDMC4xKSUwQSUyMCUyMC5vdXQoKQ=="},{sketch_id:"khoparzi_2",code:"JTJGJTJGJTIwUmVhbGx5JTIwTG92ZSUwQSUyRiUyRiUyMGJ5JTIwQWJoaW5heSUyMEtob3BhcnppJTBBJTJGJTJGJTIwaHR0cCUzQSUyRiUyRmtob3BhcnppLmNvbSUwQW9zYygxMDAlMkMtMC4wMTI0NSUyQzEpLnBpeGVsYXRlKDUwKS5rYWxlaWQoKCklM0QlM0UoTWF0aC5zaW4odGltZSUyRjgpKjklMkIzKSkucm90YXRlKDAlMkMwLjEyNSklMEEubW9kdWxhdGVSb3RhdGUoc2hhcGUoMykuc2NhbGUoKCklM0QlM0UoTWF0aC5jb3ModGltZSkqMikpLnJvdGF0ZSgwJTJDLTAuMjUpKS5kaWZmKHNyYyhvMCkuYnJpZ2h0bmVzcygwLjMpKSUwQSUyMCUyMC5vdXQoKQ=="},{sketch_id:"khoparzi_3",code:"JTJGJTJGJTIwQXFhdXRpYyUyMGJsdWJzJTBBJTJGJTJGJTIwQnklMjBLaG9wYXJ6aSUwQSUyRiUyRiUyMGh0dHBzJTNBJTJGJTJGa2hvcGFyemkuY29tJTBBJTBBZ3JhZGllbnQoMC4yNSklMEEuYWRkKG5vaXNlKCklMkMlMjAoKSUzRCUzRU1hdGguY29zKHRpbWUpKSUwQS5tb2R1bGF0ZVJvdGF0ZShzcmMobzApLnJvdGF0ZSgwJTJDJTIwLTAuNTIpJTJDJTIwMC4yKS5tdWx0KHNoYXBlKDM2MCklMkMlMjAwLjgpJTBBLnJlcGVhdCgxMCUyQzUpLm11bHQoc2hhcGUoMzYwKS5zY2FsZSgoKSUzRCUzRU1hdGguc2luKHRpbWUpKSUyQyUyMDAuOCkucm90YXRlKDAlMkMlMjAwLjIpJTBBLmRpZmYoc3JjKG8wKS5yb3RhdGUoMCUyQyUyMC0wLjIpJTJDJTIwMC4yKSUwQS5vdXQoKQ=="},{sketch_id:"celeste_0",code:"JTBBJTIwJTJGJTJGJTIwUHVlcnRhcyUyMElJJTBBJTJGJTJGJTIwcG9yJTIwQ2VsZXN0ZSUyMEJldGFuY3VyJTBBJTJGJTJGJTIwaHR0cHMlM0ElMkYlMkZnaXRodWIuY29tJTJGZXNzdGViYW4lMEElMEFvc2MoMTMlMkMwJTJDMSklMEElMjAlMjAua2FsZWlkKCklMEElMjAlMjAubWFzayhzaGFwZSg0JTJDMC4zJTJDMSkpJTBBJTIwJTIwLm1vZHVsYXRlUm90YXRlKHNoYXBlKDQlMkMwLjElMkMxKSklMEElMjAlMjAubW9kdWxhdGVSb3RhdGUoc2hhcGUoNCUyQzAuMSUyQzAuOSkpJTBBJTIwJTIwLm1vZHVsYXRlUm90YXRlKHNoYXBlKDQlMkMwLjElMkMwLjgpKSUwQSUyMCUyMC5zY2FsZSgwLjMpJTBBJTIwJTIwLmFkZChzaGFwZSg0JTJDMC4yJTJDMSkuY29sb3IoMC4zJTJDMSUyQzElMkMwLjUpKSUwQSUyMCUyMC5yb3RhdGUoKCklM0QlM0V0aW1lKSUwQSUyMCUyMC5vdXQoKQ=="},{sketch_id:"celeste_1",code:"JTJGJTJGJTIwUHVlcnRhcyUyMElJSSUwQSUyRiUyRiUyMHBvciUyMENlbGVzdGUlMjBCZXRhbmN1ciUwQSUyRiUyRiUyMGh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmVzc3RlYmFuJTBBJTIwJTBBb3NjKDQwJTJDMC4yJTJDMSklMEElMjAlMjAubW9kdWxhdGVTY2FsZShvc2MoNDAlMkMwJTJDMSkua2FsZWlkKDgpKSUwQSUyMCUyMC5yZXBlYXQoMiUyQzQpJTBBJTIwJTIwLm1vZHVsYXRlKG8wJTJDMC4wNSklMEElMjAlMjAubW9kdWxhdGVLYWxlaWQoc2hhcGUoNCUyQzAuMSUyQzEpKSUwQSUyMCUyMC5vdXQobzAp"},{sketch_id:"celeste_2",code:"JTBBJTIwJTJGJTJGJTIwUHVlcnRhcyUwQSUyRiUyRiUyMHBvciUyMENlbGVzdGUlMjBCZXRhbmN1ciUwQSUyRiUyRiUyMGh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmVzc3RlYmFuJTBBJTBBb3NjKDEzJTJDMCUyQzEpJTBBJTIwJTIwLm1vZHVsYXRlKG9zYygyMSUyQzAuMjUlMkMwKSklMEElMjAlMjAubW9kdWxhdGVTY2FsZShvc2MoMzQpKSUwQSUyMCUyMC5tb2R1bGF0ZUthbGVpZChvc2MoNTUpJTJDMC4xJTJDMSklMEElMjAlMjAub3V0KCk="},{sketch_id:"alexandre_0",code:"JTJGJTJGJTIwJTIydGhlLXdhbGwlMjIlMEElMkYlMkYlMjBBbGV4YW5kcmUlMjBSYW5nZWwlMEElMkYlMkYlMjB3d3cuYWxleGFuZHJlcmFuZ2VsLmFydC5iciUyRmh5ZHJhLmh0bWwlMEElMEFzcGVlZCUzRC4wMjIyJTBBb3NjKDQ4JTJDLS4xJTJDMCkudGhyZXNoKCU1Qi4zJTJDLjclNUQuZmFzdCguNzUpJTJDMCkuY29sb3IoMCUyQzAlMkMxKSUwQSUwQS5hZGQoJTBBJTIwJTIwJTIwJTIwb3NjKDI4JTJDLjElMkMwKS50aHJlc2goJTVCLjMlMkMuNyU1RC5mYXN0KC43NSklMkMwKS5yb3RhdGUoMy4xNCUyRjQpJTBBJTIwJTIwJTIwJTIwLmNvbG9yKDElMkMwJTJDMCklMEElMjAlMjAlMjAlMjAubW9kdWxhdGVTY2FsZSglMjBvc2MoNjQlMkMtLjAxJTJDMCkudGhyZXNoKCU1Qi4zJTJDLjclNUQuZmFzdCguNzUpJTJDMCklMjApJTBBKSUwQS5kaWZmKCUwQSUyMCUyMCUyMCUyMG9zYygyOCUyQy4xJTJDMCkudGhyZXNoKCU1Qi4zJTJDLjclNUQuZmFzdCguNSklMkMwKS5yb3RhdGUoMy4xNCUyRjIpJTBBJTIwJTIwJTIwJTIwLmNvbG9yKDElMkMwJTJDMSklMEElMjAlMjAlMjAlMjAubW9kdWxhdGVTY2FsZSglMjBvc2MoNjQlMkMtLjAxNSUyQzApLnRocmVzaCglNUIuMyUyQy43JTVELmZhc3QoLjUpJTJDMCklMjApJTBBKSUwQS5tb2R1bGF0ZVJvdGF0ZSglMjBvc2MoNTQlMkMtLjAwNSUyQzApLnRocmVzaCglNUIuMyUyQy43JTVELmZhc3QoLjI1KSUyQzApJTIwKSUwQS5tb2R1bGF0ZVNjYWxlKCUyMG9zYyg0NCUyQy0uMDIwJTJDMCkudGhyZXNoKCU1Qi4zJTJDLjclNUQuZmFzdCguMjUpJTJDMCklMjApJTBBLmNvbG9yYW1hKCUyMCgpJTNEJTNFTWF0aC5zaW4odGltZSUyRjI3KSouMDEyMjIlMkI5Ljg5KSUwQS5zY2FsZSgyLjEyMiklMEElMEEub3V0KCk="},{sketch_id:"alexandre_1",code:"JTBBJTIwJTJGJTJGJTIwJTIyZXllJTIwb2YlMjB0aGUlMjBiZWhvbGRlciUyMiUwQSUyRiUyRiUyMEFsZXhhbmRyZSUyMFJhbmdlbCUwQSUyRiUyRiUyMHd3dy5hbGV4YW5kcmVyYW5nZWwuYXJ0LmJyJTJGaHlkcmEuaHRtbCUwQSUwQW5vaXNlKDYlMkMuMDUpJTBBLm11bHQoJTIwb3NjKDklMkMwJTJDJTIwKCklM0QlM0VNYXRoLnNpbih0aW1lJTJGMS41KSUyQjIlMjApJTIwKSUwQS5tdWx0KCUwQSUyMCUyMCUyMCUyMG5vaXNlKDklMkMuMDMpLmJyaWdodG5lc3MoMS4yKS5jb250cmFzdCgyKSUwQSUyMCUyMCUyMCUyMC5tdWx0KCUyMG9zYyg5JTJDMCUyQyUyMCgpJTNEJTNFTWF0aC5zaW4odGltZSUyRjMpJTJCMTMlMjApJTIwKSUwQSklMEEuZGlmZiglMEElMjAlMjAlMjAlMjBub2lzZSgxNSUyQy4wNCkuYnJpZ2h0bmVzcyguMikuY29udHJhc3QoMS4zKSUwQSUyMCUyMCUyMCUyMC5tdWx0KCUyMG9zYyg5JTJDMCUyQyUyMCgpJTNEJTNFTWF0aC5zaW4odGltZSUyRjUpJTJCMTMlMjApJTIwKSUwQSUyMCUyMCUyMCUyMC5yb3RhdGUoJTIwKCklM0QlM0V0aW1lJTJGMzMlMjApJTBBKSUwQS5zY2FsZSglMjAoKSUzRCUzRU1hdGguc2luKHRpbWUlMkY2LjIpKi4xMiUyQi4xNSUyMCklMEEubW9kdWxhdGVTY2FsZSglMEElMjAlMjAlMjAlMjBvc2MoMyUyQzAlMkMwKS5tdWx0KCUyMG9zYygzJTJDMCUyQzApLnJvdGF0ZSgzLjE0JTJGMiklMjApJTBBJTIwJTIwJTIwJTIwLnJvdGF0ZSglMjAoKSUzRCUzRXRpbWUlMkYyNSUyMCkuc2NhbGUoLjM5KS5zY2FsZSgxJTJDLjYlMkMxKS5pbnZlcnQoKSUwQSUyMCUyMCUyMCUyMCUyQyUyMCgpJTNEJTNFTWF0aC5zaW4odGltZSUyRjUuMykqMS41JTJCMyUyMCUyMCklMEEucm90YXRlKCUyMCgpJTNEJTNFdGltZSUyRjIyJTIwKSUwQS5tdWx0KCUyMHNoYXBlKDEwMCUyQy45JTJDLjAxKS5zY2FsZSgxJTJDLjYlMkMxKSUyMCklMEEub3V0KCk="},{sketch_id:"alexandre_2",code:"JTJGJTJGJTIwJTIyZWdnJTIwb2YlMjB0aGUlMjBwaG9lbml4JTIyJTBBJTJGJTJGJTIwQWxleGFuZHJlJTIwUmFuZ2VsJTBBJTJGJTJGJTIwd3d3LmFsZXhhbmRyZXJhbmdlbC5hcnQuYnIlMkZoeWRyYS5odG1sJTBBJTBBc3BlZWQlM0QxLjIlMEFzaGFwZSg5OSUyQy4xNSUyQy41KS5jb2xvcigwJTJDMSUyQzIpJTBBJTBBLmRpZmYoJTIwc2hhcGUoMjQwJTJDLjUlMkMwKS5zY3JvbGxYKC4wNSkucm90YXRlKCUyMCgpJTNEJTNFdGltZSUyRjEwJTIwKS5jb2xvcigxJTJDMCUyQy43NSklMjApJTBBLmRpZmYoJTIwc2hhcGUoOTklMkMuNCUyQy4wMDIpLnNjcm9sbFgoLjEwKS5yb3RhdGUoJTIwKCklM0QlM0V0aW1lJTJGMjAlMjApLmNvbG9yKDElMkMwJTJDLjc1KSUyMCklMEEuZGlmZiglMjBzaGFwZSg5OSUyQy4zJTJDLjAwMikuc2Nyb2xsWCguMTUpLnJvdGF0ZSglMjAoKSUzRCUzRXRpbWUlMkYzMCUyMCkuY29sb3IoMSUyQzAlMkMuNzUpJTIwKSUwQS5kaWZmKCUyMHNoYXBlKDk5JTJDLjIlMkMuMDAyKS5zY3JvbGxYKC4yMCkucm90YXRlKCUyMCgpJTNEJTNFdGltZSUyRjQwJTIwKS5jb2xvcigxJTJDMCUyQy43NSklMjApJTBBLmRpZmYoJTIwc2hhcGUoOTklMkMuMSUyQy4wMDIpLnNjcm9sbFgoLjI1KS5yb3RhdGUoJTIwKCklM0QlM0V0aW1lJTJGNTAlMjApLmNvbG9yKDElMkMwJTJDLjc1KSUyMCklMEElMEEubW9kdWxhdGVTY2FsZSglMEElMjAlMjBzaGFwZSgyNDAlMkMuNSUyQzApLnNjcm9sbFgoLjA1KS5yb3RhdGUoJTIwKCklM0QlM0V0aW1lJTJGMTAlMjApJTBBJTIwJTIwJTJDJTIwKCklM0QlM0UoTWF0aC5zaW4odGltZSUyRjMpKi4yKSUyQi4yJTIwKSUwQSUwQS5zY2FsZSgxLjYlMkMuNiUyQzEpJTBBLm91dCgp"},{sketch_id:"afalfl_0",code:"JTJGJTJGZmlsZXQlMjBtaWdub24lMEElMkYlMkYlMjBBRkFMRkwlMEElMkYlMkYlMjBpbnN0YWdyYW0lMkZhX2ZfYWxmbCUyMCUwQSUwQW9zYygxMDAlMkMtMC4wMDE4JTJDMC4xNykuZGlmZihvc2MoMjAlMkMwLjAwMDA4KS5yb3RhdGUoTWF0aC5QSSUyRjAuMDAwMDMpKSUwQS5tb2R1bGF0ZVNjYWxlKG5vaXNlKDEuNSUyQzAuMTgpLm1vZHVsYXRlU2NhbGUob3NjKDEzKS5yb3RhdGUoKCklM0QlM0VNYXRoLnNpbih0aW1lJTJGMjIpKSklMkMzKSUwQS5jb2xvcigxMSUyQzAuNSUyQzAuNCUyQyUyMDAuOSUyQyUyMDAuMiUyQyUyMDAuMDExJTJDJTIwNSUyQyUyMDIyJTJDJTIwJTIwMC41JTJDJTIwLTEpLmNvbnRyYXN0KDEuNCklMEEuYWRkKHNyYyhvMCkubW9kdWxhdGUobzAlMkMuMDQpJTJDLjYlMkMlMjAuOSklMEElMjAlMjAlMkYlMkYucGl4ZWxhdGUoMC40JTJDJTIwMC4yJTJDJTIwMC4xKSUwQS5pbnZlcnQoKS5icmlnaHRuZXNzKDAuMDAwMyUyQyUyMDIpLmNvbnRyYXN0KCUyMDAuNSUyQyUyMDIlMkMlMjAwLjElMkMlMjAyKS5jb2xvcig0JTJDJTIwLTIlMkMlMjAwLjEpJTBBLm1vZHVsYXRlU2NhbGUob3NjKDIpJTJDLTAuMiUyQyUyMDIlMkMlMjAxJTJDJTIwMC4zKSUwQSUyMC5wb3N0ZXJpemUoMjAwKSUyMC5yb3RhdGUoMSUyQyUyMDAuMiUyQyUyMDAuMDElMkMlMjAwLjAwMSklMEElMjAuY29sb3IoMjIlMkMlMjAtMiUyQyUyMDAuNSUyQyUyMDAuNSUyQyUyMDAuMDAwMSUyQyUyMCUyMDAuMSUyQyUyMDAuMiUyQyUyMDgpLmNvbnRyYXN0KDAuMTglMkMlMjAwLjMlMkMlMjAwLjElMkMlMjAwLjIlMkMlMjAwLjAzJTJDJTIwMSklMjAuJTIwYnJpZ2h0bmVzcygwLjAwMDElMkMlMjAtMSUyQyUyMDEwKSUwQSUwOS5vdXQoKQ=="},{sketch_id:"eerie_ear_0",code:"JTJGJTJGJTIwZWVfMiUyMC4lMjBNVUxUSVZFUlNFJTIwLiUyMHRpbWUlMjBhbmQlMjBmZWVkYmFjayUwQSUyRiUyRiUyMGVfZSUyMCUyRiUyRiUyMCU0MGVlcmllX2VhciUwQXBhdCUyMCUzRCUyMCgpJTNEJTNFJTBBc29saWQoKSUwQS5sYXllcihzb2xpZCgpLmRpZmYoJTBBJTIwJTIwb3NjKCh0aW1lJTJGMTYpJTIwKiUyMDElMkMlMjAodGltZSUyRjEwMDApJTIwKiUyMDAuMiUyMCUyMCklMEElMjAlMjAlMjAlMjAubXVsdChvc2MoKHRpbWUlMkY4KSUyMColMjAxJTJDJTIwKHRpbWUlMkYxMDA2KSUyMColMjAwLjIlMjAlMjApLnJvdGF0ZSgxLjU3KSklMEElMjAlMjAlMjAlMjAubW9kdWxhdGUoKHNoYXBlKDEwNiUyQzElMkMwLjA1KSkpJTBBJTIwJTIwJTIwJTIwLm11bHQoc2hhcGUoMTA2JTJDMSUyQzAuMDUpKSUwQSUyMCUyMCkpJTBBJTIwJTIwLm1vZHVsYXRlU2NhbGUob3NjKDIlMkMwLjEyNSklMkMwLjEyNSklMEElMkYlMkYlMEFzb2xpZCgpJTBBLmxheWVyKHNvbGlkKDElMkMxJTJDMSklMEElMjAlMjAubXVsdChwYXQoKSUwQSUyMCUyMC5kaWZmKHNyYyhvMCkuc2NhbGUoMC4yKS5tdWx0KHNvbGlkKCklMkMlNUIwLjclMkMwLjYlMkMwLjQlMkMwLjYlNUQpLmthbGVpZCgxLjAxKS5zYXR1cmF0ZSgwLjMpKSUwQSklMEEubGF5ZXIoc29saWQoMSUyQzElMkMxKSUwQSUyMCUyMCUyMCUyMC5tYXNrKCUwQSUyMCUyMCUyMCUyMCUyMCUyMG5vaXNlKDIlMkMwLjA1KSUwQSUyMCUyMCUyMCUyMCUyMCUyMC5pbnZlcnQoKS5jb2xvcmFtYSgyKS5wb3N0ZXJpemUoOCUyQzQpLmx1bWEoMC4yNSkudGhyZXNoKDAuNSklMEElMjAlMjAlMjAlMjAlMjAlMjAubW9kdWxhdGVSb3RhdGUob3NjKDElMkMwLjUpKSUwQSUyMCUyMCUyMCUyMCklMEElMjAlMjAlMjAlMjAubXVsdChncmFkaWVudCgwLjUpLmthbGVpZCgxKS5jb2xvcmFtYSgyKS5zYXR1cmF0ZSgxLjEpLmNvbnRyYXN0KDEuNikubXVsdChzb2xpZCgpJTJDMC40NSkpJTBBJTIwJTIwKSklMEElMjAlMjAub3V0KCklMEElMkYlMkYlMEFzcGVlZCUzRCUyMDAuNSUwQQ=="},{sketch_id:"eerie_ear_1",code:"JTJGJTJGJTIwZWVfMyUyMCUyRiUyRkxJTkVTJTBBJTJGJTJGJTIwZV9lJTIwJTJGJTJGJTIwJTQwZWVyaWVfZWFyJTBBJTJGJTJGJTBBJTJGJTJGYmFzZWQlMjBvbiUwQSUyRiUyRiU0MG5hb3RvX2hpZWRhJTBBJTJGJTJGaHR0cHMlM0ElMkYlMkZuYW90b2hpZWRhLmNvbSUyRmJsb2clMkZoeWRyYS1ib29rJTJGJTBBJTJGJTJGJTBBbiUyMCUzRCUyMDglMEFhJTIwJTNEJTIwKCklMjAlM0QlM0UlMjBzaGFwZSg0JTJDMC4yNSUyQzAuMDA5KS5yb3RhdGUoKCklM0QlM0V0aW1lJTJGLTQwKS5yZXBlYXQobiUyQ24pJTBBYSgpLmFkZChhKCkuc2Nyb2xsWCgwLjUlMkZuKS5zY3JvbGxZKDAuNSUyRm4pJTJDMSkubW9kdWxhdGUobzElMkMwLjEpLm1vZHVsYXRlKHNyYyhvMSkuY29sb3IoMTAlMkMxMCkuYWRkKHNvbGlkKC0xNCUyQy0xNCkpLnJvdGF0ZSgoKSUzRCUzRXRpbWUlMkY0MCklMkMwLjAwNSkuYWRkKHNyYyhvMSkuc2Nyb2xsWSgwLjAxMiUyQzAuMDIpJTJDMC41KS5vdXQobzEpJTBBc3JjKG8xKS5jb2xvcmFtYSgxLjIpLnBvc3Rlcml6ZSg0KS5zYXR1cmF0ZSgwLjcpLmNvbnRyYXN0KDYpLm11bHQoc29saWQoKSUyQzAuMTUpLm91dChvMCklMEElMEElMEE="},{sketch_id:"eerie_ear_2",code:"JTJGJTJGZWVfNSUyMC4lMjBGVUdJVElWRSUyMEdFT01FVFJZJTIwVkhTJTIwLiUyMGF1ZGlvcmVhY3RpdmUlMjBzaGFwZXMlMjBhbmQlMjBncmFkaWVudHMlMEElMkYlMkYlMjBlX2UlMjAlMkYlMkYlMjAlNDBlZXJpZV9lYXIlMEElMkYlMkYlMEFzJTNEJTIwKCklM0QlM0UlMEElMjAlMjBzaGFwZSg0KSUwQS5zY3JvbGxYKCU1Qi0wLjUlMkMtMC4yJTJDMC4zJTJDLTAuMSUyQy0wLjElNUQuc21vb3RoKDAuMSkuZmFzdCgwLjMpKSUwQS5zY3JvbGxZKCU1QjAuMjUlMkMtMC4yJTJDMC4zJTJDLTAuMSUyQzAuMiU1RC5zbW9vdGgoMC45KS5mYXN0KDAuMTUpKSUwQSUyRiUyRiUwQXNvbGlkKCklMEEuYWRkKGdyYWRpZW50KDMlMkMwLjA1KS5yb3RhdGUoMC4wNSUyQy0wLjIpLnBvc3Rlcml6ZSgyKS5jb250cmFzdCgwLjYpJTJDJTVCMSUyQzAlMkMxJTJDMC41JTJDMCUyQzAuNiU1RC5zbW9vdGgoMC45KSklMEEuYWRkKHMoKSklMEEubXVsdChzKCkuc2NhbGUoMC44KS5zY3JvbGxYKDAuMDEpLnNjcm9sbFkoLTAuMDEpLnJvdGF0ZSgwLjIlMkMwLjA2KS5hZGQoZ3JhZGllbnQoMykuY29udHJhc3QoMC42KSUyQyU1QjElMkMwJTJDMSUyQzAuNSU1RC5zbW9vdGgoMC45KSUyQzAuNSkubXVsdChzcmMobzApLnNjYWxlKDAuOTgpJTJDKCklM0QlM0VhLmZmdCU1QjAlNUQqOSklMEElMjAlMjAlMjAlMjAlMjApJTBBLmRpZmYocygpLm1vZHVsYXRlKHNoYXBlKDUwMCkpLnNjYWxlKCU1QjEuNyUyQzEuMiU1RC5zbW9vdGgoMC45KS5mYXN0KDAuMDUpKSklMEEuYWRkKGdyYWRpZW50KDIpLmludmVydCgpJTJDKCklM0QlM0VhLmZmdCU1QjIlNUQpJTBBLm11bHQoZ3JhZGllbnQoKCklM0QlM0VhLmZmdCU1QjMlNUQqOCkpJTBBLmJsZW5kKHNyYygobzApJTJDKCklM0QlM0VhLmZmdCU1QjElNUQqNDApKSUwQS5hZGQodm9yb25vaSgoKSUzRCUzRWEuZmZ0JTVCMSU1RCUyQygpJTNEJTNFYS5mZnQlNUIzJTVEJTJDKCklM0QlM0VhLmZmdCU1QjAlNUQpLnRocmVzaCgwLjcpLnBvc3Rlcml6ZSgyJTJDNCkubHVtYSgwLjkpLnNjcm9sbFkoMSUyQygpJTNEJTNFYS5mZnQlNUIwJTVEJTJGMzApLmNvbG9yYW1hKDMpLnRocmVzaCgoKSUzRCUzRWEuZmZ0JTVCMSU1RCkuc2NhbGUoKCklM0QlM0VhLmZmdCU1QjMlNUQqMiklMkMoKSUzRCUzRWEuZmZ0JTVCMCU1RCUyRjIpJTBBJTIwJTIwLm91dCgpJTBBJTJGJTJGJTBBc3BlZWQlM0QlMjAxJTBBJTBBYS5zZXRTbW9vdGgoMC45Nik="},{sketch_id:"eerie_ear_3",code:"JTJGJTJGJTIwZWVfMSUyMC4lMjBFWUUlMjBJTiUyMFRIRSUyMFNLWSUwQSUyRiUyRmV4YW1wbGUlMjBvZiUyMG1hc2slMjBhbmQlMjBmdW5jdGlvbiUyMG1vZHVsYXRpb24lMEElMkYlMkYlMjBlX2UlMjAlMkYlMkYlMjAlNDBlZXJpZV9lYXIlMEFub2lzZSgxOCklMEElMjAlMjAuY29sb3JhbWEoMSklMEElMjAlMjAucG9zdGVyaXplKDIpJTBBJTIwJTIwLmthbGVpZCg1MCklMEElMjAlMjAubWFzayglMEElMjAlMjAlMjAlMjBzaGFwZSgyNSUyQyUyMDAuMjUpLm1vZHVsYXRlU2NhbGUoJTBBJTIwJTIwJTIwJTIwJTIwJTIwbm9pc2UoNDAwLjUlMkMlMjAwLjUpJTBBJTIwJTIwJTIwJTIwKSUwQSUyMCUyMCklMEElMjAlMjAubWFzayhzaGFwZSg0MDAlMkMlMjAxJTJDJTIwMi4xMjUpKSUwQSUyMCUyMC5tb2R1bGF0ZVNjYWxlKG9zYyg2JTJDJTIwMC4xMjUlMkMlMjAwLjA1KS5rYWxlaWQoNTApKSUwQSUyMCUyMC5tdWx0KG9zYygyMCUyQyUyMDAuMDUlMkMlMjAyLjQpLmthbGVpZCg1MCklMkMlMjAwLjI1KSUwQSUyMCUyMC5zY2FsZSgxLjc1JTJDJTIwMC42NSUyQyUyMDAuNSklMEElMjAlMjAubW9kdWxhdGUobm9pc2UoMC41KSklMEElMjAlMjAuc2F0dXJhdGUoNiklMEElMjAlMjAucG9zdGVyaXplKDQlMkMlMjAwLjIpJTBBJTIwJTIwLnNjYWxlKDEuNSklMEElMjAlMjAub3V0KCklM0IlMEE="}]},{}],7:[function(require,module,exports){const request=require("superagent");const examples=require("./examples.json");const sketches=[];class Gallery{constructor(callback){this.sketches=[];this.examples=[];this.current=null;this.code=null;this.exampleIndex=null;this.examples=examples;this.setSketchFromURL(callback);window.addEventListener("popstate",(event=>{this.setSketchFromURL(callback)}));this.setRandomSketch=this.setRandomSketch.bind(this)}clear(){this.current=null;this.code=null;let newurl=window.location.protocol+"//"+window.location.host+window.location.pathname;window.history.pushState({path:newurl},"",newurl);this.url=newurl}setSketchFromURL(callback){hush();render(o0);let searchParams=new URLSearchParams(window.location.search);let base64Code=searchParams.get("code");let sketch_id=searchParams.get("sketch_id");let code="";this.foundSketch=false;if(sketch_id){var sketch=this.getExampleById(sketch_id);if(sketch){this.setSketch(sketch);callback(this.code,false)}else{request.get("/sketchById").query({sketch_id:sketch_id}).end(((err,res)=>{if(err){console.log("err getting sketches",err);this.setSketchFromCode(base64Code,callback)}else{this.sketches=JSON.parse(res.text);if(this.sketches.length>0){this.setSketch(this.sketches[0]);this.foundSketch=true;callback(this.code,this.foundSketch)}else{this.setSketchFromCode(base64Code,callback)}}}))}}else{this.setSketchFromCode(base64Code,callback)}}setSketchFromCode(base64Code,callback){if(base64Code){this.code=this.decodeBase64(base64Code);this.foundSketch=true}else{this.setRandomSketch()}callback(this.code,this.foundSketch)}saveImage(){}setToURL(params){var url_params;if(params.sketch_id){url_params=`sketch_id=${params.sketch_id}`}else{url_params=`sketch_id=${params.sketch_id}&code=${params.code}`}let newurl=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+url_params;window.history.replaceState({path:newurl},"",newurl);this.url=newurl}encodeBase64(text){return btoa(encodeURIComponent(text))}decodeBase64(base64Code){return decodeURIComponent(atob(base64Code))}setSketch(sketch){this.code=this.decodeBase64(sketch.code);this.current=sketch;this.setToURL(sketch)}setRandomSketch(){if(this.examples.length>0){let index;index=Math.floor(Math.random()*this.examples.length);while(index===this.exampleIndex){index=Math.floor(Math.random()*this.examples.length)}this.exampleIndex=index;this.setSketch(this.examples[index])}else{var startString="osc("+2+Math.floor(Math.pow(10,Math.random()*2))+")";startString+=".color("+Math.random().toFixed(2)+","+Math.random().toFixed(2)+","+Math.random().toFixed(2)+")";startString+=".rotate("+Math.random().toFixed(2)+")";startString+=".out(o0)";this.code=startString}}shareSketch(code,hydra,name){this.saveSketch(code,(()=>{console.log("URL is",this.url,"sketch is",this.current);hydra.getScreenImage((img=>{request.post("/image").attach("previewImage",img).query({url:this.url,sketch_id:this.current.sketch_id,name:name}).end(((err,res)=>{if(err){console.log("error postingimage",err)}else{console.log("image response",res.text)}}))}))}))}saveSketch(code,callback){let self=this;let base64=this.encodeBase64(code);let query={code:base64,parent:this.current?this.current.sketch_id:null};console.log("saving in gallery",query);request.post("/sketch").query(query).end(((err,res)=>{if(err){console.log("error posting sketch",err);if(callback)callback(err)}else{console.log("response",res.text);self.setSketch({sketch_id:res.text,code:base64});if(callback)callback(null)}}))}saveLocally(code){let base64=this.encodeBase64(code);var url_params=`code=${base64}`;let newurl=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+url_params;window.history.pushState({path:newurl},"",newurl);this.url=newurl}getExampleById(id){var sketches=this.examples.filter((sketch=>sketch.sketch_id===id));if(sketches.length<=0)sketches=this.sketches.filter((sketch=>sketch.sketch_id===id));return sketches[0]}}module.exports=Gallery},{"./examples.json":6,superagent:157}],8:[function(require,module,exports){var logElement;module.exports={init:()=>{logElement=document.createElement("div");logElement.className="console cm-s-tomorrow-night-eighties";document.body.appendChild(logElement)},log:(msg,className="")=>{if(logElement)logElement.innerHTML=` >> <span class=${className}> ${msg} </span> `},hide:()=>{if(logElement)logElement.style.display="none"},show:()=>{if(logElement)logElement.style.display="block"},toggle:()=>{if(logElement.style.display=="none"){logElement.style.display="block"}else{logElement.style.display="none"}}}},{}],9:[function(require,module,exports){const repl=require("./repl.js");const beautify_js=require("js-beautify").js_beautify;class Menu{constructor(obj){this.sketches=obj.sketches;this.editor=obj.editor;this.hydra=obj.hydra;this.closeButton=document.getElementById("close-icon");this.clearButton=document.getElementById("clear-icon");this.shareButton=document.getElementById("share-icon");this.shuffleButton=document.getElementById("shuffle-icon");this.mutatorButton=document.getElementById("mutator-icon");this.runButton=document.getElementById("run-icon");this.editorText=document.getElementsByClassName("CodeMirror-scroll")[0];this.runButton.onclick=this.runAll.bind(this);this.shuffleButton.onclick=this.shuffleSketches.bind(this);this.shareButton.onclick=this.shareSketch.bind(this);this.clearButton.onclick=this.clearAll.bind(this);this.closeButton.onclick=()=>{if(!this.isClosed){this.closeModal()}else{this.openModal()}};this.mutatorButton.onclick=this.mutateSketch.bind(this);this.isClosed=false;this.closeModal()}runAll(){repl.eval(this.editor.getValue(),((string,err)=>{this.editor.flashCode();if(!err)this.sketches.saveLocally(this.editor.getValue())}))}shuffleSketches(){this.clearAll();this.sketches.setRandomSketch();this.editor.setValue(this.sketches.code);repl.eval(this.editor.getValue())}formatCode(){const formatted=beautify_js(this.editor.getValue(),{indent_size:2,break_chained_methods:true,indent_with_tabs:true});this.editor.setValue(formatted)}shareSketch(){repl.eval(this.editor.getValue(),((code,error)=>{if(!error){this.showConfirmation((name=>{this.sketches.shareSketch(code,this.hydra,name)}),(()=>this.hideConfirmation()))}else{console.warn(error)}}))}showConfirmation(successCallback,terminateCallback){var c=prompt("Pressing OK will share this sketch to \nhttps://twitter.com/hydra_patterns.\n\nInclude your name or twitter handle (optional):");if(c!==null){successCallback(c)}else{terminateCallback()}}hideConfirmation(){}clearAll(){hush();speed=1;this.sketches.clear();this.editor.clear()}closeModal(){document.getElementById("info-container").className="hidden";this.closeButton.className="fas fa-question-circle icon";this.shareButton.classList.remove("hidden");this.clearButton.classList.remove("hidden");this.mutatorButton.classList.remove("hidden");this.runButton.classList.remove("hidden");this.editorText.style.opacity=1;this.isClosed=true}openModal(){document.getElementById("info-container").className="";this.closeButton.className="fas fa-times icon";this.shareButton.classList.add("hidden");this.clearButton.classList.add("hidden");this.mutatorButton.classList.add("hidden");this.runButton.classList.add("hidden");this.editorText.style.opacity=0;this.isClosed=false}mutateSketch(evt){if(evt.shiftKey){this.editor.mutator.doUndo()}else{this.editor.mutator.mutate({reroll:false,changeTransform:evt.metaKey});this.formatCode();this.sketches.saveLocally(this.editor.getValue())}}}module.exports=Menu},{"./repl.js":12,"js-beautify":83}],10:[function(require,module,exports){class P5 extends p5{constructor({width:width=window.innerWidth,height:height=window.innerHeight,mode:mode="P2D"}={}){super((p=>{p.setup=()=>{p.createCanvas(width,height,p[mode])};p.draw=()=>{}}),"hydra-ui");this.width=width;this.height=height;this.mode=mode;this.canvas.style.position="absolute";this.canvas.style.top="0px";this.canvas.style.left="0px";this.canvas.style.zIndex=-1}show(){this.canvas.style.visibility="visible"}hide(){this.canvas.style.visibility="hidden"}clear(){this.drawingContext.clearRect(0,0,this.canvas.width,this.canvas.height)}}module.exports=P5},{}],11:[function(require,module,exports){var PatchBay=require("./rtc-patch-bay.js");var inherits=require("inherits");var PBLive=function(){this.session={};this.nickFromId={};this.idFromNick={};this.loadFromStorage()};inherits(PBLive,PatchBay);PBLive.prototype.init=function(stream,opts){this.settings={server:opts.server||"https://patch-bay.glitch.me/",room:opts.room||"patch-bay",stream:stream};this.makeGlobal=opts.makeGlobal||true;this.setPageTitle=opts.setTitle||true;if(this.session.id)this.settings.id=this.session.id;PatchBay.call(this,this.settings);if(this.makeGlobal)window.pb=this;this.on("ready",(()=>{if(!this.nick){if(this.session.nick){this.setName(this.session.nick)}else{this.session.id=this.id;this.setName(this.session.id)}}console.log("connected to server "+this.settings.server+" with name "+this.settings.id)}));this.on("broadcast",this._processBroadcast.bind(this));this.on("new peer",this.handleNewPeer.bind(this));window.onbeforeunload=()=>{this.session.id=window.pb.id;this.session.nick=this.nick;sessionStorage.setItem("pb",JSON.stringify(this.session))};var self=this;this.on("stream",(function(id,stream){console.log("got stream!",id,stream);const video=document.createElement("video");if("srcObject"in video){video.srcObject=stream}else{video.src=window.URL.createObjectURL(stream)}video.addEventListener("loadedmetadata",(()=>{video.play();self.video=video;self.emit("got video",self.nickFromId[id],video)}))}))};PBLive.prototype.loadFromStorage=function(){if(sessionStorage.getItem("pb")!==null){this.session=JSON.parse(sessionStorage.getItem("pb"))}};PBLive.prototype.initSource=function(nick,callback){this.initConnectionFromId(this.idFromNick[nick],callback)};PBLive.prototype.handleNewPeer=function(peer){this.nickFromId[peer]=peer;this.idFromNick[peer]=peer;if(this.nick){this.broadcast({type:"update-nick",id:this.id,nick:this.nick})}};PBLive.prototype.list=function(){var l=Object.keys(this.idFromNick);return Object.keys(this.idFromNick)};PBLive.prototype.setName=function(nick){this.broadcast({type:"update-nick",id:this.id,nick:nick,previous:this.nick});this.nick=nick;if(this.setPageTitle)document.title=nick};PBLive.prototype._processBroadcast=function(data){if(data.type==="update-nick"){if(data.previous!==data.nick){delete this.idFromNick[this.nickFromId[data.id]];this.nickFromId[data.id]=data.nick;this.idFromNick[data.nick]=data.id;if(data.previous){}else{}}}};module.exports=PBLive},{"./rtc-patch-bay.js":13,inherits:80}],12:[function(require,module,exports){const log=require("./log.js").log;module.exports={eval:(arg,callback)=>{var self=this;var jsString=`(async() => {\n ${arg}\n})().catch(${err=>log(err.message,"log-error")})`;var isError=false;try{eval(jsString);log("")}catch(e){isError=true;console.log("logging",e);log(e.message,"log-error")}if(callback)callback(jsString,isError)}}},{"./log.js":8}],13:[function(require,module,exports){var io=require("socket.io-client");var SimplePeer=require("simple-peer");var extend=Object.assign;var events=require("events").EventEmitter;var inherits=require("inherits");const shortid=require("shortid");var PatchBay=function(options){this.signaller=io(options.server);this.id=options.id||shortid.generate();this.stream=options.stream||null;this._peerOptions=options.peerOptions||{};this._room=options.room;this.settings["shareMediaWhenRequested"]=true;this.settings["shareMediaWhenInitiating"]=false;this.settings["requestMediaWhenInitiating"]=true;this.settings["autoconnect"]=false;this.peers={};this.rtcPeers={};this.signaller.on("ready",this._readyForSignalling.bind(this));this.signaller.on("message",this._handleMessage.bind(this));this.signaller.on("broadcast",this._receivedBroadcast.bind(this));this.signaller.emit("join",this._room,{uuid:this.id});this.signaller.on("new peer",this._newPeer.bind(this))};inherits(PatchBay,events);PatchBay.prototype.sendToAll=function(data){Object.keys(this.rtcPeers).forEach((function(id){this.rtcPeers[id].send(data)}),this)};PatchBay.prototype.sendToPeer=function(peerId,data){if(peerId in this.rtcPeers){this.rtcPeers[peerId].send(data)}};PatchBay.prototype.reinitAll=function(){Object.keys(this.rtcPeers).forEach(function(id){this.reinitPeer(id)}.bind(this))};PatchBay.prototype.initRtcPeer=function(id,opts){this.emit("new peer",{id:id});var newOptions=opts;if(this.iceServers){opts["config"]={iceServers:this.iceServers}}if(opts.initiator===true){if(this.stream!=null){if(this.settings.shareMediaWhenInitiating===true){newOptions.stream=this.stream}}if(this.settings.requestMediaWhenInitiating===true){newOptions.offerConstraints={offerToReceiveVideo:true,offerToReceiveAudio:true}}}else{if(this.settings.shareMediaWhenRequested===true){if(this.stream!=null){newOptions.stream=this.stream}}}var options=extend(this._peerOptions,newOptions);this.rtcPeers[id]=new SimplePeer(options);this._attachPeerEvents(this.rtcPeers[id],id)};PatchBay.prototype.reinitRtcConnection=function(id,opts){this.rtcPeers[id]._destroy(null,function(e){this.initRtcPeer(id,{stream:this.stream,initiator:true})}.bind(this))};PatchBay.prototype._newPeer=function(peer){this.peers[peer]={rtcPeer:null};this.emit("new peer",peer)};PatchBay.prototype._readyForSignalling=function({peers:peers,servers:servers}){peers.forEach((peer=>{this._newPeer(peer)}));if(servers){this.iceServers=servers}this.emit("ready")};PatchBay.prototype.initConnectionFromId=function(id,callback){if(id in this.rtcPeers){console.log("Already connected to..",id,this.rtcPeers);if(this.rtcPeers[id].initiator===false){this.reinitRtcConnection(id)}else{}}else{this.initRtcPeer(id,{initiator:true})}};PatchBay.prototype._handleMessage=function(data){if(data.type==="signal"){this._handleSignal(data)}else{this.emit("message",data)}};PatchBay.prototype._handleSignal=function(data){if(!this.rtcPeers[data.id]){this.initRtcPeer(data.id,{initiator:false})}this.rtcPeers[data.id].signal(data.message)};PatchBay.prototype._receivedBroadcast=function(data){this.emit("broadcast",data)};PatchBay.prototype.broadcast=function(data){this.signaller.emit("broadcast",data)};PatchBay.prototype._attachPeerEvents=function(p,_id){p.on("signal",function(id,signal){this.signaller.emit("message",{id:id,message:signal,type:"signal"})}.bind(this,_id));p.on("stream",function(id,stream){this.rtcPeers[id].stream=stream;this.emit("stream",id,stream)}.bind(this,_id));p.on("connect",function(id){this.emit("connect",id)}.bind(this,_id));p.on("data",function(id,data){this.emit("data",{id:id,data:JSON.parse(data)})}.bind(this,_id));p.on("close",function(id){delete this.rtcPeers[id];this.emit("close",id)}.bind(this,_id));p.on("error",(function(e){console.warn("simple peer error",e)}))};PatchBay.prototype._destroy=function(){Object.values(this.rtcPeers).forEach((function(peer){peer.destroy()}));this.signaller.close()};module.exports=PatchBay},{events:26,inherits:80,shortid:128,"simple-peer":138,"socket.io-client":142}],14:[function(require,module,exports){(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?factory(exports):typeof define==="function"&&define.amd?define(["exports"],factory):(global=global||self,factory(global.acorn={}))})(this,(function(exports){"use strict";var reservedWords={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"};var ecma5AndLessKeywords="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this";var keywords={5:ecma5AndLessKeywords,"5module":ecma5AndLessKeywords+" export import",6:ecma5AndLessKeywords+" const class extends export import super"};var keywordRelationalOperator=/^in(stanceof)?$/;var nonASCIIidentifierStartChars="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA--zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";var nonASCIIidentifierChars="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍--_";var nonASCIIidentifierStart=new RegExp("["+nonASCIIidentifierStartChars+"]");var nonASCIIidentifier=new RegExp("["+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"]");nonASCIIidentifierStartChars=nonASCIIidentifierChars=null;var astralIdentifierStartCodes=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938];var astralIdentifierCodes=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function isInAstralSet(code,set){var pos=65536;for(var i=0;i<set.length;i+=2){pos+=set[i];if(pos>code){return false}pos+=set[i+1];if(pos>=code){return true}}}function isIdentifierStart(code,astral){if(code<65){return code===36}if(code<91){return true}if(code<97){return code===95}if(code<123){return true}if(code<=65535){return code>=170&&nonASCIIidentifierStart.test(String.fromCharCode(code))}if(astral===false){return false}return isInAstralSet(code,astralIdentifierStartCodes)}function isIdentifierChar(code,astral){if(code<48){return code===36}if(code<58){return true}if(code<65){return false}if(code<91){return true}if(code<97){return code===95}if(code<123){return true}if(code<=65535){return code>=170&&nonASCIIidentifier.test(String.fromCharCode(code))}if(astral===false){return false}return isInAstralSet(code,astralIdentifierStartCodes)||isInAstralSet(code,astralIdentifierCodes)}var TokenType=function TokenType(label,conf){if(conf===void 0)conf={};this.label=label;this.keyword=conf.keyword;this.beforeExpr=!!conf.beforeExpr;this.startsExpr=!!conf.startsExpr;this.isLoop=!!conf.isLoop;this.isAssign=!!conf.isAssign;this.prefix=!!conf.prefix;this.postfix=!!conf.postfix;this.binop=conf.binop||null;this.updateContext=null};function binop(name,prec){return new TokenType(name,{beforeExpr:true,binop:prec})}var beforeExpr={beforeExpr:true},startsExpr={startsExpr:true};var keywords$1={};function kw(name,options){if(options===void 0)options={};options.keyword=name;return keywords$1[name]=new TokenType(name,options)}var types={num:new TokenType("num",startsExpr),regexp:new TokenType("regexp",startsExpr),string:new TokenType("string",startsExpr),name:new TokenType("name",startsExpr),eof:new TokenType("eof"),bracketL:new TokenType("[",{beforeExpr:true,startsExpr:true}),bracketR:new TokenType("]"),braceL:new TokenType("{",{beforeExpr:true,startsExpr:true}),braceR:new TokenType("}"),parenL:new TokenType("(",{beforeExpr:true,startsExpr:true}),parenR:new TokenType(")"),comma:new TokenType(",",beforeExpr),semi:new TokenType(";",beforeExpr),colon:new TokenType(":",beforeExpr),dot:new TokenType("."),question:new TokenType("?",beforeExpr),questionDot:new TokenType("?."),arrow:new TokenType("=>",beforeExpr),template:new TokenType("template"),invalidTemplate:new TokenType("invalidTemplate"),ellipsis:new TokenType("...",beforeExpr),backQuote:new TokenType("`",startsExpr),dollarBraceL:new TokenType("${",{beforeExpr:true,startsExpr:true}),eq:new TokenType("=",{beforeExpr:true,isAssign:true}),assign:new TokenType("_=",{beforeExpr:true,isAssign:true}),incDec:new TokenType("++/--",{prefix:true,postfix:true,startsExpr:true}),prefix:new TokenType("!/~",{beforeExpr:true,prefix:true,startsExpr:true}),logicalOR:binop("||",1),logicalAND:binop("&&",2),bitwiseOR:binop("|",3),bitwiseXOR:binop("^",4),bitwiseAND:binop("&",5),equality:binop("==/!=/===/!==",6),relational:binop("</>/<=/>=",7),bitShift:binop("<</>>/>>>",8),plusMin:new TokenType("+/-",{beforeExpr:true,binop:9,prefix:true,startsExpr:true}),modulo:binop("%",10),star:binop("*",10),slash:binop("/",10),starstar:new TokenType("**",{beforeExpr:true}),coalesce:binop("??",1),_break:kw("break"),_case:kw("case",beforeExpr),_catch:kw("catch"),_continue:kw("continue"),_debugger:kw("debugger"),_default:kw("default",beforeExpr),_do:kw("do",{isLoop:true,beforeExpr:true}),_else:kw("else",beforeExpr),_finally:kw("finally"),_for:kw("for",{isLoop:true}),_function:kw("function",startsExpr),_if:kw("if"),_return:kw("return",beforeExpr),_switch:kw("switch"),_throw:kw("throw",beforeExpr),_try:kw("try"),_var:kw("var"),_const:kw("const"),_while:kw("while",{isLoop:true}),_with:kw("with"),_new:kw("new",{beforeExpr:true,startsExpr:true}),_this:kw("this",startsExpr),_super:kw("super",startsExpr),_class:kw("class",startsExpr),_extends:kw("extends",beforeExpr),_export:kw("export"),_import:kw("import",startsExpr),_null:kw("null",startsExpr),_true:kw("true",startsExpr),_false:kw("false",startsExpr),_in:kw("in",{beforeExpr:true,binop:7}),_instanceof:kw("instanceof",{beforeExpr:true,binop:7}),_typeof:kw("typeof",{beforeExpr:true,prefix:true,startsExpr:true}),_void:kw("void",{beforeExpr:true,prefix:true,startsExpr:true}),_delete:kw("delete",{beforeExpr:true,prefix:true,startsExpr:true})};var lineBreak=/\r\n?|\n|\u2028|\u2029/;var lineBreakG=new RegExp(lineBreak.source,"g");function isNewLine(code,ecma2019String){return code===10||code===13||!ecma2019String&&(code===8232||code===8233)}var nonASCIIwhitespace=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;var skipWhiteSpace=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;var ref=Object.prototype;var hasOwnProperty=ref.hasOwnProperty;var toString=ref.toString;function has(obj,propName){return hasOwnProperty.call(obj,propName)}var isArray=Array.isArray||function(obj){return toString.call(obj)==="[object Array]"};function wordsRegexp(words){return new RegExp("^(?:"+words.replace(/ /g,"|")+")$")}var Position=function Position(line,col){this.line=line;this.column=col};Position.prototype.offset=function offset(n){return new Position(this.line,this.column+n)};var SourceLocation=function SourceLocation(p,start,end){this.start=start;this.end=end;if(p.sourceFile!==null){this.source=p.sourceFile}};function getLineInfo(input,offset){for(var line=1,cur=0;;){lineBreakG.lastIndex=cur;var match=lineBreakG.exec(input);if(match&&match.index<offset){++line;cur=match.index+match[0].length}else{return new Position(line,offset-cur)}}}var defaultOptions={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:false,allowImportExportEverywhere:false,allowAwaitOutsideFunction:false,allowHashBang:false,locations:false,onToken:null,onComment:null,ranges:false,program:null,sourceFile:null,directSourceFile:null,preserveParens:false};var warnedAboutEcmaVersion=false;function getOptions(opts){var options={};for(var opt in defaultOptions){options[opt]=opts&&has(opts,opt)?opts[opt]:defaultOptions[opt]}if(options.ecmaVersion==="latest"){options.ecmaVersion=1e8}else if(options.ecmaVersion==null){if(!warnedAboutEcmaVersion&&typeof console==="object"&&console.warn){warnedAboutEcmaVersion=true;console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")}options.ecmaVersion=11}else if(options.ecmaVersion>=2015){options.ecmaVersion-=2009}if(options.allowReserved==null){options.allowReserved=options.ecmaVersion<5}if(isArray(options.onToken)){var tokens=options.onToken;options.onToken=function(token){return tokens.push(token)}}if(isArray(options.onComment)){options.onComment=pushComment(options,options.onComment)}return options}function pushComment(options,array){return function(block,text,start,end,startLoc,endLoc){var comment={type:block?"Block":"Line",value:text,start:start,end:end};if(options.locations){comment.loc=new SourceLocation(this,startLoc,endLoc)}if(options.ranges){comment.range=[start,end]}array.push(comment)}}var SCOPE_TOP=1,SCOPE_FUNCTION=2,SCOPE_VAR=SCOPE_TOP|SCOPE_FUNCTION,SCOPE_ASYNC=4,SCOPE_GENERATOR=8,SCOPE_ARROW=16,SCOPE_SIMPLE_CATCH=32,SCOPE_SUPER=64,SCOPE_DIRECT_SUPER=128;function functionFlags(async,generator){return SCOPE_FUNCTION|(async?SCOPE_ASYNC:0)|(generator?SCOPE_GENERATOR:0)}var BIND_NONE=0,BIND_VAR=1,BIND_LEXICAL=2,BIND_FUNCTION=3,BIND_SIMPLE_CATCH=4,BIND_OUTSIDE=5;var Parser=function Parser(options,input,startPos){this.options=options=getOptions(options);this.sourceFile=options.sourceFile;this.keywords=wordsRegexp(keywords[options.ecmaVersion>=6?6:options.sourceType==="module"?"5module":5]);var reserved="";if(options.allowReserved!==true){reserved=reservedWords[options.ecmaVersion>=6?6:options.ecmaVersion===5?5:3];if(options.sourceType==="module"){reserved+=" await"}}this.reservedWords=wordsRegexp(reserved);var reservedStrict=(reserved?reserved+" ":"")+reservedWords.strict;this.reservedWordsStrict=wordsRegexp(reservedStrict);this.reservedWordsStrictBind=wordsRegexp(reservedStrict+" "+reservedWords.strictBind);this.input=String(input);this.containsEsc=false;if(startPos){this.pos=startPos;this.lineStart=this.input.lastIndexOf("\n",startPos-1)+1;this.curLine=this.input.slice(0,this.lineStart).split(lineBreak).length}else{this.pos=this.lineStart=0;this.curLine=1}this.type=types.eof;this.value=null;this.start=this.end=this.pos;this.startLoc=this.endLoc=this.curPosition();this.lastTokEndLoc=this.lastTokStartLoc=null;this.lastTokStart=this.lastTokEnd=this.pos;this.context=this.initialContext();this.exprAllowed=true;this.inModule=options.sourceType==="module";this.strict=this.inModule||this.strictDirective(this.pos);this.potentialArrowAt=-1;this.yieldPos=this.awaitPos=this.awaitIdentPos=0;this.labels=[];this.undefinedExports={};if(this.pos===0&&options.allowHashBang&&this.input.slice(0,2)==="#!"){this.skipLineComment(2)}this.scopeStack=[];this.enterScope(SCOPE_TOP);this.regexpState=null};var prototypeAccessors={inFunction:{configurable:true},inGenerator:{configurable:true},inAsync:{configurable:true},allowSuper:{configurable:true},allowDirectSuper:{configurable:true},treatFunctionsAsVar:{configurable:true},inNonArrowFunction:{configurable:true}};Parser.prototype.parse=function parse(){var node=this.options.program||this.startNode();this.nextToken();return this.parseTopLevel(node)};prototypeAccessors.inFunction.get=function(){return(this.currentVarScope().flags&SCOPE_FUNCTION)>0};prototypeAccessors.inGenerator.get=function(){return(this.currentVarScope().flags&SCOPE_GENERATOR)>0};prototypeAccessors.inAsync.get=function(){return(this.currentVarScope().flags&SCOPE_ASYNC)>0};prototypeAccessors.allowSuper.get=function(){return(this.currentThisScope().flags&SCOPE_SUPER)>0};prototypeAccessors.allowDirectSuper.get=function(){return(this.currentThisScope().flags&SCOPE_DIRECT_SUPER)>0};prototypeAccessors.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};prototypeAccessors.inNonArrowFunction.get=function(){return(this.currentThisScope().flags&SCOPE_FUNCTION)>0};Parser.extend=function extend(){var plugins=[],len=arguments.length;while(len--)plugins[len]=arguments[len];var cls=this;for(var i=0;i<plugins.length;i++){cls=plugins[i](cls)}return cls};Parser.parse=function parse(input,options){return new this(options,input).parse()};Parser.parseExpressionAt=function parseExpressionAt(input,pos,options){var parser=new this(options,input,pos);parser.nextToken();return parser.parseExpression()};Parser.tokenizer=function tokenizer(input,options){return new this(options,input)};Object.defineProperties(Parser.prototype,prototypeAccessors);var pp=Parser.prototype;var literal=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;pp.strictDirective=function(start){for(;;){skipWhiteSpace.lastIndex=start;start+=skipWhiteSpace.exec(this.input)[0].length;var match=literal.exec(this.input.slice(start));if(!match){return false}if((match[1]||match[2])==="use strict"){skipWhiteSpace.lastIndex=start+match[0].length;var spaceAfter=skipWhiteSpace.exec(this.input),end=spaceAfter.index+spaceAfter[0].length;var next=this.input.charAt(end);return next===";"||next==="}"||lineBreak.test(spaceAfter[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(next)||next==="!"&&this.input.charAt(end+1)==="=")}start+=match[0].length;skipWhiteSpace.lastIndex=start;start+=skipWhiteSpace.exec(this.input)[0].length;if(this.input[start]===";"){start++}}};pp.eat=function(type){if(this.type===type){this.next();return true}else{return false}};pp.isContextual=function(name){return this.type===types.name&&this.value===name&&!this.containsEsc};pp.eatContextual=function(name){if(!this.isContextual(name)){return false}this.next();return true};pp.expectContextual=function(name){if(!this.eatContextual(name)){this.unexpected()}};pp.canInsertSemicolon=function(){return this.type===types.eof||this.type===types.braceR||lineBreak.test(this.input.slice(this.lastTokEnd,this.start))};pp.insertSemicolon=function(){if(this.canInsertSemicolon()){if(this.options.onInsertedSemicolon){this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc)}return true}};pp.semicolon=function(){if(!this.eat(types.semi)&&!this.insertSemicolon()){this.unexpected()}};pp.afterTrailingComma=function(tokType,notNext){if(this.type===tokType){if(this.options.onTrailingComma){this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc)}if(!notNext){this.next()}return true}};pp.expect=function(type){this.eat(type)||this.unexpected()};pp.unexpected=function(pos){this.raise(pos!=null?pos:this.start,"Unexpected token")};function DestructuringErrors(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}pp.checkPatternErrors=function(refDestructuringErrors,isAssign){if(!refDestructuringErrors){return}if(refDestructuringErrors.trailingComma>-1){this.raiseRecoverable(refDestructuringErrors.trailingComma,"Comma is not permitted after the rest element")}var parens=isAssign?refDestructuringErrors.parenthesizedAssign:refDestructuringErrors.parenthesizedBind;if(parens>-1){this.raiseRecoverable(parens,"Parenthesized pattern")}};pp.checkExpressionErrors=function(refDestructuringErrors,andThrow){if(!refDestructuringErrors){return false}var shorthandAssign=refDestructuringErrors.shorthandAssign;var doubleProto=refDestructuringErrors.doubleProto;if(!andThrow){return shorthandAssign>=0||doubleProto>=0}if(shorthandAssign>=0){this.raise(shorthandAssign,"Shorthand property assignments are valid only in destructuring patterns")}if(doubleProto>=0){this.raiseRecoverable(doubleProto,"Redefinition of __proto__ property")}};pp.checkYieldAwaitInDefaultParams=function(){if(this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)){this.raise(this.yieldPos,"Yield expression cannot be a default value")}if(this.awaitPos){this.raise(this.awaitPos,"Await expression cannot be a default value")}};pp.isSimpleAssignTarget=function(expr){if(expr.type==="ParenthesizedExpression"){return this.isSimpleAssignTarget(expr.expression)}return expr.type==="Identifier"||expr.type==="MemberExpression"};var pp$1=Parser.prototype;pp$1.parseTopLevel=function(node){var exports={};if(!node.body){node.body=[]}while(this.type!==types.eof){var stmt=this.parseStatement(null,true,exports);node.body.push(stmt)}if(this.inModule){for(var i=0,list=Object.keys(this.undefinedExports);i<list.length;i+=1){var name=list[i];this.raiseRecoverable(this.undefinedExports[name].start,"Export '"+name+"' is not defined")}}this.adaptDirectivePrologue(node.body);this.next();node.sourceType=this.options.sourceType;return this.finishNode(node,"Program")};var loopLabel={kind:"loop"},switchLabel={kind:"switch"};pp$1.isLet=function(context){if(this.options.ecmaVersion<6||!this.isContextual("let")){return false}skipWhiteSpace.lastIndex=this.pos;var skip=skipWhiteSpace.exec(this.input);var next=this.pos+skip[0].length,nextCh=this.input.charCodeAt(next);if(nextCh===91){return true}if(context){return false}if(nextCh===123){return true}if(isIdentifierStart(nextCh,true)){var pos=next+1;while(isIdentifierChar(this.input.charCodeAt(pos),true)){++pos}var ident=this.input.slice(next,pos);if(!keywordRelationalOperator.test(ident)){return true}}return false};pp$1.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async")){return false}skipWhiteSpace.lastIndex=this.pos;var skip=skipWhiteSpace.exec(this.input);var next=this.pos+skip[0].length;return!lineBreak.test(this.input.slice(this.pos,next))&&this.input.slice(next,next+8)==="function"&&(next+8===this.input.length||!isIdentifierChar(this.input.charAt(next+8)))};pp$1.parseStatement=function(context,topLevel,exports){var starttype=this.type,node=this.startNode(),kind;if(this.isLet(context)){starttype=types._var;kind="let"}switch(starttype){case types._break:case types._continue:return this.parseBreakContinueStatement(node,starttype.keyword);case types._debugger:return this.parseDebuggerStatement(node);case types._do:return this.parseDoStatement(node);case types._for:return this.parseForStatement(node);case types._function:if(context&&(this.strict||context!=="if"&&context!=="label")&&this.options.ecmaVersion>=6){this.unexpected()}return this.parseFunctionStatement(node,false,!context);case types._class:if(context){this.unexpected()}return this.parseClass(node,true);case types._if:return this.parseIfStatement(node);case types._return:return this.parseReturnStatement(node);case types._switch:return this.parseSwitchStatement(node);case types._throw:return this.parseThrowStatement(node);case types._try:return this.parseTryStatement(node);case types._const:case types._var:kind=kind||this.value;if(context&&kind!=="var"){this.unexpected()}return this.parseVarStatement(node,kind);case types._while:return this.parseWhileStatement(node);case types._with:return this.parseWithStatement(node);case types.braceL:return this.parseBlock(true,node);case types.semi:return this.parseEmptyStatement(node);case types._export:case types._import:if(this.options.ecmaVersion>10&&starttype===types._import){skipWhiteSpace.lastIndex=this.pos;var skip=skipWhiteSpace.exec(this.input);var next=this.pos+skip[0].length,nextCh=this.input.charCodeAt(next);if(nextCh===40||nextCh===46){return this.parseExpressionStatement(node,this.parseExpression())}}if(!this.options.allowImportExportEverywhere){if(!topLevel){this.raise(this.start,"'import' and 'export' may only appear at the top level")}if(!this.inModule){this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")}}return starttype===types._import?this.parseImport(node):this.parseExport(node,exports);default:if(this.isAsyncFunction()){if(context){this.unexpected()}this.next();return this.parseFunctionStatement(node,true,!context)}var maybeName=this.value,expr=this.parseExpression();if(starttype===types.name&&expr.type==="Identifier"&&this.eat(types.colon)){return this.parseLabeledStatement(node,maybeName,expr,context)}else{return this.parseExpressionStatement(node,expr)}}};pp$1.parseBreakContinueStatement=function(node,keyword){var isBreak=keyword==="break";this.next();if(this.eat(types.semi)||this.insertSemicolon()){node.label=null}else if(this.type!==types.name){this.unexpected()}else{node.label=this.parseIdent();this.semicolon()}var i=0;for(;i<this.labels.length;++i){var lab=this.labels[i];if(node.label==null||lab.name===node.label.name){if(lab.kind!=null&&(isBreak||lab.kind==="loop")){break}if(node.label&&isBreak){break}}}if(i===this.labels.length){this.raise(node.start,"Unsyntactic "+keyword)}return this.finishNode(node,isBreak?"BreakStatement":"ContinueStatement")};pp$1.parseDebuggerStatement=function(node){this.next();this.semicolon();return this.finishNode(node,"DebuggerStatement")};pp$1.parseDoStatement=function(node){this.next();this.labels.push(loopLabel);node.body=this.parseStatement("do");this.labels.pop();this.expect(types._while);node.test=this.parseParenExpression();if(this.options.ecmaVersion>=6){this.eat(types.semi)}else{this.semicolon()}return this.finishNode(node,"DoWhileStatement")};pp$1.parseForStatement=function(node){this.next();var awaitAt=this.options.ecmaVersion>=9&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction)&&this.eatContextual("await")?this.lastTokStart:-1;this.labels.push(loopLabel);this.enterScope(0);this.expect(types.parenL);if(this.type===types.semi){if(awaitAt>-1){this.unexpected(awaitAt)}return this.parseFor(node,null)}var isLet=this.isLet();if(this.type===types._var||this.type===types._const||isLet){var init$1=this.startNode(),kind=isLet?"let":this.value;this.next();this.parseVar(init$1,true,kind);this.finishNode(init$1,"VariableDeclaration");if((this.type===types._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&init$1.declarations.length===1){if(this.options.ecmaVersion>=9){if(this.type===types._in){if(awaitAt>-1){this.unexpected(awaitAt)}}else{node.await=awaitAt>-1}}return this.parseForIn(node,init$1)}if(awaitAt>-1){this.unexpected(awaitAt)}return this.parseFor(node,init$1)}var refDestructuringErrors=new DestructuringErrors;var init=this.parseExpression(true,refDestructuringErrors);if(this.type===types._in||this.options.ecmaVersion>=6&&this.isContextual("of")){if(this.options.ecmaVersion>=9){if(this.type===types._in){if(awaitAt>-1){this.unexpected(awaitAt)}}else{node.await=awaitAt>-1}}this.toAssignable(init,false,refDestructuringErrors);this.checkLValPattern(init);return this.parseForIn(node,init)}else{this.checkExpressionErrors(refDestructuringErrors,true)}if(awaitAt>-1){this.unexpected(awaitAt)}return this.parseFor(node,init)};pp$1.parseFunctionStatement=function(node,isAsync,declarationPosition){this.next();return this.parseFunction(node,FUNC_STATEMENT|(declarationPosition?0:FUNC_HANGING_STATEMENT),false,isAsync)};pp$1.parseIfStatement=function(node){this.next();node.test=this.parseParenExpression();node.consequent=this.parseStatement("if");node.alternate=this.eat(types._else)?this.parseStatement("if"):null;return this.finishNode(node,"IfStatement")};pp$1.parseReturnStatement=function(node){if(!this.inFunction&&!this.options.allowReturnOutsideFunction){this.raise(this.start,"'return' outside of function")}this.next();if(this.eat(types.semi)||this.insertSemicolon()){node.argument=null}else{node.argument=this.parseExpression();this.semicolon()}return this.finishNode(node,"ReturnStatement")};pp$1.parseSwitchStatement=function(node){this.next();node.discriminant=this.parseParenExpression();node.cases=[];this.expect(types.braceL);this.labels.push(switchLabel);this.enterScope(0);var cur;for(var sawDefault=false;this.type!==types.braceR;){if(this.type===types._case||this.type===types._default){var isCase=this.type===types._case;if(cur){this.finishNode(cur,"SwitchCase")}node.cases.push(cur=this.startNode());cur.consequent=[];this.next();if(isCase){cur.test=this.parseExpression()}else{if(sawDefault){this.raiseRecoverable(this.lastTokStart,"Multiple default clauses")}sawDefault=true;cur.test=null}this.expect(types.colon)}else{if(!cur){this.unexpected()}cur.consequent.push(this.parseStatement(null))}}this.exitScope();if(cur){this.finishNode(cur,"SwitchCase")}this.next();this.labels.pop();return this.finishNode(node,"SwitchStatement")};pp$1.parseThrowStatement=function(node){this.next();if(lineBreak.test(this.input.slice(this.lastTokEnd,this.start))){this.raise(this.lastTokEnd,"Illegal newline after throw")}node.argument=this.parseExpression();this.semicolon();return this.finishNode(node,"ThrowStatement")};var empty=[];pp$1.parseTryStatement=function(node){this.next();node.block=this.parseBlock();node.handler=null;if(this.type===types._catch){var clause=this.startNode();this.next();if(this.eat(types.parenL)){clause.param=this.parseBindingAtom();var simple=clause.param.type==="Identifier";this.enterScope(simple?SCOPE_SIMPLE_CATCH:0);this.checkLValPattern(clause.param,simple?BIND_SIMPLE_CATCH:BIND_LEXICAL);this.expect(types.parenR)}else{if(this.options.ecmaVersion<10){this.unexpected()}clause.param=null;this.enterScope(0)}clause.body=this.parseBlock(false);this.exitScope();node.handler=this.finishNode(clause,"CatchClause")}node.finalizer=this.eat(types._finally)?this.parseBlock():null;if(!node.handler&&!node.finalizer){this.raise(node.start,"Missing catch or finally clause")}return this.finishNode(node,"TryStatement")};pp$1.parseVarStatement=function(node,kind){this.next();this.parseVar(node,false,kind);this.semicolon();return this.finishNode(node,"VariableDeclaration")};pp$1.parseWhileStatement=function(node){this.next();node.test=this.parseParenExpression();this.labels.push(loopLabel);node.body=this.parseStatement("while");this.labels.pop();return this.finishNode(node,"WhileStatement")};pp$1.parseWithStatement=function(node){if(this.strict){this.raise(this.start,"'with' in strict mode")}this.next();node.object=this.parseParenExpression();node.body=this.parseStatement("with");return this.finishNode(node,"WithStatement")};pp$1.parseEmptyStatement=function(node){this.next();return this.finishNode(node,"EmptyStatement")};pp$1.parseLabeledStatement=function(node,maybeName,expr,context){for(var i$1=0,list=this.labels;i$1<list.length;i$1+=1){var label=list[i$1];if(label.name===maybeName){this.raise(expr.start,"Label '"+maybeName+"' is already declared")}}var kind=this.type.isLoop?"loop":this.type===types._switch?"switch":null;for(var i=this.labels.length-1;i>=0;i--){var label$1=this.labels[i];if(label$1.statementStart===node.start){label$1.statementStart=this.start;label$1.kind=kind}else{break}}this.labels.push({name:maybeName,kind:kind,statementStart:this.start});node.body=this.parseStatement(context?context.indexOf("label")===-1?context+"label":context:"label");this.labels.pop();node.label=expr;return this.finishNode(node,"LabeledStatement")};pp$1.parseExpressionStatement=function(node,expr){node.expression=expr;this.semicolon();return this.finishNode(node,"ExpressionStatement")};pp$1.parseBlock=function(createNewLexicalScope,node,exitStrict){if(createNewLexicalScope===void 0)createNewLexicalScope=true;if(node===void 0)node=this.startNode();node.body=[];this.expect(types.braceL);if(createNewLexicalScope){this.enterScope(0)}while(this.type!==types.braceR){var stmt=this.parseStatement(null);node.body.push(stmt)}if(exitStrict){this.strict=false}this.next();if(createNewLexicalScope){this.exitScope()}return this.finishNode(node,"BlockStatement")};pp$1.parseFor=function(node,init){node.init=init;this.expect(types.semi);node.test=this.type===types.semi?null:this.parseExpression();this.expect(types.semi);node.update=this.type===types.parenR?null:this.parseExpression();this.expect(types.parenR);node.body=this.parseStatement("for");this.exitScope();this.labels.pop();return this.finishNode(node,"ForStatement")};pp$1.parseForIn=function(node,init){var isForIn=this.type===types._in;this.next();if(init.type==="VariableDeclaration"&&init.declarations[0].init!=null&&(!isForIn||this.options.ecmaVersion<8||this.strict||init.kind!=="var"||init.declarations[0].id.type!=="Identifier")){this.raise(init.start,(isForIn?"for-in":"for-of")+" loop variable declaration may not have an initializer")}node.left=init;node.right=isForIn?this.parseExpression():this.parseMaybeAssign();this.expect(types.parenR);node.body=this.parseStatement("for");this.exitScope();this.labels.pop();return this.finishNode(node,isForIn?"ForInStatement":"ForOfStatement")};pp$1.parseVar=function(node,isFor,kind){node.declarations=[];node.kind=kind;for(;;){var decl=this.startNode();this.parseVarId(decl,kind);if(this.eat(types.eq)){decl.init=this.parseMaybeAssign(isFor)}else if(kind==="const"&&!(this.type===types._in||this.options.ecmaVersion>=6&&this.isContextual("of"))){this.unexpected()}else if(decl.id.type!=="Identifier"&&!(isFor&&(this.type===types._in||this.isContextual("of")))){this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value")}else{decl.init=null}node.declarations.push(this.finishNode(decl,"VariableDeclarator"));if(!this.eat(types.comma)){break}}return node};pp$1.parseVarId=function(decl,kind){decl.id=this.parseBindingAtom();this.checkLValPattern(decl.id,kind==="var"?BIND_VAR:BIND_LEXICAL,false)};var FUNC_STATEMENT=1,FUNC_HANGING_STATEMENT=2,FUNC_NULLABLE_ID=4;pp$1.parseFunction=function(node,statement,allowExpressionBody,isAsync){this.initFunction(node);if(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!isAsync){if(this.type===types.star&&statement&FUNC_HANGING_STATEMENT){this.unexpected()}node.generator=this.eat(types.star)}if(this.options.ecmaVersion>=8){node.async=!!isAsync}if(statement&FUNC_STATEMENT){node.id=statement&FUNC_NULLABLE_ID&&this.type!==types.name?null:this.parseIdent();if(node.id&&!(statement&FUNC_HANGING_STATEMENT)){this.checkLValSimple(node.id,this.strict||node.generator||node.async?this.treatFunctionsAsVar?BIND_VAR:BIND_LEXICAL:BIND_FUNCTION)}}var oldYieldPos=this.yieldPos,oldAwaitPos=this.awaitPos,oldAwaitIdentPos=this.awaitIdentPos;this.yieldPos=0;this.awaitPos=0;this.awaitIdentPos=0;this.enterScope(functionFlags(node.async,node.generator));if(!(statement&FUNC_STATEMENT)){node.id=this.type===types.name?this.parseIdent():null}this.parseFunctionParams(node);this.parseFunctionBody(node,allowExpressionBody,false);this.yieldPos=oldYieldPos;this.awaitPos=oldAwaitPos;this.awaitIdentPos=oldAwaitIdentPos;return this.finishNode(node,statement&FUNC_STATEMENT?"FunctionDeclaration":"FunctionExpression")};pp$1.parseFunctionParams=function(node){this.expect(types.parenL);node.params=this.parseBindingList(types.parenR,false,this.options.ecmaVersion>=8);this.checkYieldAwaitInDefaultParams()};pp$1.parseClass=function(node,isStatement){this.next();var oldStrict=this.strict;this.strict=true;this.parseClassId(node,isStatement);this.parseClassSuper(node);var classBody=this.startNode();var hadConstructor=false;classBody.body=[];this.expect(types.braceL);while(this.type!==types.braceR){var element=this.parseClassElement(node.superClass!==null);if(element){classBody.body.push(element);if(element.type==="MethodDefinition"&&element.kind==="constructor"){if(hadConstructor){this.raise(element.start,"Duplicate constructor in the same class")}hadConstructor=true}}}this.strict=oldStrict;this.next();node.body=this.finishNode(classBody,"ClassBody");return this.finishNode(node,isStatement?"ClassDeclaration":"ClassExpression")};pp$1.parseClassElement=function(constructorAllowsSuper){var this$1=this;if(this.eat(types.semi)){return null}var method=this.startNode();var tryContextual=function(k,noLineBreak){if(noLineBreak===void 0)noLineBreak=false;var start=this$1.start,startLoc=this$1.startLoc;if(!this$1.eatContextual(k)){return false}if(this$1.type!==types.parenL&&(!noLineBreak||!this$1.canInsertSemicolon())){return true}if(method.key){this$1.unexpected()}method.computed=false;method.key=this$1.startNodeAt(start,startLoc);method.key.name=k;this$1.finishNode(method.key,"Identifier");return false};method.kind="method";method.static=tryContextual("static");var isGenerator=this.eat(types.star);var isAsync=false;if(!isGenerator){if(this.options.ecmaVersion>=8&&tryContextual("async",true)){isAsync=true;isGenerator=this.options.ecmaVersion>=9&&this.eat(types.star)}else if(tryContextual("get")){method.kind="get"}else if(tryContextual("set")){method.kind="set"}}if(!method.key){this.parsePropertyName(method)}var key=method.key;var allowsDirectSuper=false;if(!method.computed&&!method.static&&(key.type==="Identifier"&&key.name==="constructor"||key.type==="Literal"&&key.value==="constructor")){if(method.kind!=="method"){this.raise(key.start,"Constructor can't have get/set modifier")}if(isGenerator){this.raise(key.start,"Constructor can't be a generator")}if(isAsync){this.raise(key.start,"Constructor can't be an async method")}method.kind="constructor";allowsDirectSuper=constructorAllowsSuper}else if(method.static&&key.type==="Identifier"&&key.name==="prototype"){this.raise(key.start,"Classes may not have a static property named prototype")}this.parseClassMethod(method,isGenerator,isAsync,allowsDirectSuper);if(method.kind==="get"&&method.value.params.length!==0){this.raiseRecoverable(method.value.start,"getter should have no params")}if(method.kind==="set"&&method.value.params.length!==1){this.raiseRecoverable(method.value.start,"setter should have exactly one param")}if(method.kind==="set"&&method.value.params[0].type==="RestElement"){this.raiseRecoverable(method.value.params[0].start,"Setter cannot use rest params")}return method};pp$1.parseClassMethod=function(method,isGenerator,isAsync,allowsDirectSuper){method.value=this.parseMethod(isGenerator,isAsync,allowsDirectSuper);return this.finishNode(method,"MethodDefinition")};pp$1.parseClassId=function(node,isStatement){if(this.type===types.name){node.id=this.parseIdent();if(isStatement){this.checkLValSimple(node.id,BIND_LEXICAL,false)}}else{if(isStatement===true){this.unexpected()}node.id=null}};pp$1.parseClassSuper=function(node){node.superClass=this.eat(types._extends)?this.parseExprSubscripts():null};pp$1.parseExport=function(node,exports){this.next();if(this.eat(types.star)){if(this.options.ecmaVersion>=11){if(this.eatContextual("as")){node.exported=this.parseIdent(true);this.checkExport(exports,node.exported.name,this.lastTokStart)}else{node.exported=null}}this.expectContextual("from");if(this.type!==types.string){this.unexpected()}node.source=this.parseExprAtom();this.semicolon();return this.finishNode(node,"ExportAllDeclaration")}if(this.eat(types._default)){this.checkExport(exports,"default",this.lastTokStart);var isAsync;if(this.type===types._function||(isAsync=this.isAsyncFunction())){var fNode=this.startNode();this.next();if(isAsync){this.next()}node.declaration=this.parseFunction(fNode,FUNC_STATEMENT|FUNC_NULLABLE_ID,false,isAsync)}else if(this.type===types._class){var cNode=this.startNode();node.declaration=this.parseClass(cNode,"nullableID")}else{node.declaration=this.parseMaybeAssign();this.semicolon()}return this.finishNode(node,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement()){node.declaration=this.parseStatement(null);if(node.declaration.type==="VariableDeclaration"){this.checkVariableExport(exports,node.declaration.declarations)}else{this.checkExport(exports,node.declaration.id.name,node.declaration.id.start)}node.specifiers=[];node.source=null}else{node.declaration=null;node.specifiers=this.parseExportSpecifiers(exports);if(this.eatContextual("from")){if(this.type!==types.string){this.unexpected()}node.source=this.parseExprAtom()}else{for(var i=0,list=node.specifiers;i<list.length;i+=1){var spec=list[i];this.checkUnreserved(spec.local);this.checkLocalExport(spec.local)}node.source=null}this.semicolon()}return this.finishNode(node,"ExportNamedDeclaration")};pp$1.checkExport=function(exports,name,pos){if(!exports){return}if(has(exports,name)){this.raiseRecoverable(pos,"Duplicate export '"+name+"'")}exports[name]=true};pp$1.checkPatternExport=function(exports,pat){var type=pat.type;if(type==="Identifier"){this.checkExport(exports,pat.name,pat.start)}else if(type==="ObjectPattern"){for(var i=0,list=pat.properties;i<list.length;i+=1){var prop=list[i];this.checkPatternExport(exports,prop)}}else if(type==="ArrayPattern"){for(var i$1=0,list$1=pat.elements;i$1<list$1.length;i$1+=1){var elt=list$1[i$1];if(elt){this.checkPatternExport(exports,elt)}}}else if(type==="Property"){this.checkPatternExport(exports,pat.value)}else if(type==="AssignmentPattern"){this.checkPatternExport(exports,pat.left)}else if(type==="RestElement"){this.checkPatternExport(exports,pat.argument)}else if(type==="ParenthesizedExpression"){this.checkPatternExport(exports,pat.expression)}};pp$1.checkVariableExport=function(exports,decls){if(!exports){return}for(var i=0,list=decls;i<list.length;i+=1){var decl=list[i];this.checkPatternExport(exports,decl.id)}};pp$1.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};pp$1.parseExportSpecifiers=function(exports){var nodes=[],first=true;this.expect(types.braceL);while(!this.eat(types.braceR)){if(!first){this.expect(types.comma);if(this.afterTrailingComma(types.braceR)){break}}else{first=false}var node=this.startNode();node.local=this.parseIdent(true);node.exported=this.eatContextual("as")?this.parseIdent(true):node.local;this.checkExport(exports,node.exported.name,node.exported.start);nodes.push(this.finishNode(node,"ExportSpecifier"))}return nodes};pp$1.parseImport=function(node){this.next();if(this.type===types.string){node.specifiers=empty;node.source=this.parseExprAtom()}else{node.specifiers=this.parseImportSpecifiers();this.expectContextual("from");node.source=this.type===types.string?this.parseExprAtom():this.unexpected()}this.semicolon();return this.finishNode(node,"ImportDeclaration")};pp$1.parseImportSpecifiers=function(){var nodes=[],first=true;if(this.type===types.name){var node=this.startNode();node.local=this.parseIdent();this.checkLValSimple(node.local,BIND_LEXICAL);nodes.push(this.finishNode(node,"ImportDefaultSpecifier"));if(!this.eat(types.comma)){return nodes}}if(this.type===types.star){var node$1=this.startNode();this.next();this.expectContextual("as");node$1.local=this.parseIdent();this.checkLValSimple(node$1.local,BIND_LEXICAL);nodes.push(this.finishNode(node$1,"ImportNamespaceSpecifier"));return nodes}this.expect(types.braceL);while(!this.eat(types.braceR)){if(!first){this.expect(types.comma);if(this.afterTrailingComma(types.braceR)){break}}else{first=false}var node$2=this.startNode();node$2.imported=this.parseIdent(true);if(this.eatContextual("as")){node$2.local=this.parseIdent()}else{this.checkUnreserved(node$2.imported);node$2.local=node$2.imported}this.checkLValSimple(node$2.local,BIND_LEXICAL);nodes.push(this.finishNode(node$2,"ImportSpecifier"))}return nodes};pp$1.adaptDirectivePrologue=function(statements){for(var i=0;i<statements.length&&this.isDirectiveCandidate(statements[i]);++i){statements[i].directive=statements[i].expression.raw.slice(1,-1)}};pp$1.isDirectiveCandidate=function(statement){return statement.type==="ExpressionStatement"&&statement.expression.type==="Literal"&&typeof statement.expression.value==="string"&&(this.input[statement.start]==='"'||this.input[statement.start]==="'")};var pp$2=Parser.prototype;pp$2.toAssignable=function(node,isBinding,refDestructuringErrors){if(this.options.ecmaVersion>=6&&node){switch(node.type){case"Identifier":if(this.inAsync&&node.name==="await"){this.raise(node.start,"Cannot use 'await' as identifier inside an async function")}break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":node.type="ObjectPattern";if(refDestructuringErrors){this.checkPatternErrors(refDestructuringErrors,true)}for(var i=0,list=node.properties;i<list.length;i+=1){var prop=list[i];this.toAssignable(prop,isBinding);if(prop.type==="RestElement"&&(prop.argument.type==="ArrayPattern"||prop.argument.type==="ObjectPattern")){this.raise(prop.argument.start,"Unexpected token")}}break;case"Property":if(node.kind!=="init"){this.raise(node.key.start,"Object pattern can't contain getter or setter")}this.toAssignable(node.value,isBinding);break;case"ArrayExpression":node.type="ArrayPattern";if(refDestructuringErrors){this.checkPatternErrors(refDestructuringErrors,true)}this.toAssignableList(node.elements,isBinding);break;case"SpreadElement":node.type="RestElement";this.toAssignable(node.argument,isBinding);if(node.argument.type==="AssignmentPattern"){this.raise(node.argument.start,"Rest elements cannot have a default value")}break;case"AssignmentExpression":if(node.operator!=="="){this.raise(node.left.end,"Only '=' operator can be used for specifying default value.")}node.type="AssignmentPattern";delete node.operator;this.toAssignable(node.left,isBinding);break;case"ParenthesizedExpression":this.toAssignable(node.expression,isBinding,refDestructuringErrors);break;case"ChainExpression":this.raiseRecoverable(node.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!isBinding){break}default:this.raise(node.start,"Assigning to rvalue")}}else if(refDestructuringErrors){this.checkPatternErrors(refDestructuringErrors,true)}return node};pp$2.toAssignableList=function(exprList,isBinding){var end=exprList.length;for(var i=0;i<end;i++){var elt=exprList[i];if(elt){this.toAssignable(elt,isBinding)}}if(end){var last=exprList[end-1];if(this.options.ecmaVersion===6&&isBinding&&last&&last.type==="RestElement"&&last.argument.type!=="Identifier"){this.unexpected(last.argument.start)}}return exprList};pp$2.parseSpread=function(refDestructuringErrors){var node=this.startNode();this.next();node.argument=this.parseMaybeAssign(false,refDestructuringErrors);return this.finishNode(node,"SpreadElement")};pp$2.parseRestBinding=function(){var node=this.startNode();this.next();if(this.options.ecmaVersion===6&&this.type!==types.name){this.unexpected()}node.argument=this.parseBindingAtom();return this.finishNode(node,"RestElement")};pp$2.parseBindingAtom=function(){if(this.options.ecmaVersion>=6){switch(this.type){case types.bracketL:var node=this.startNode();this.next();node.elements=this.parseBindingList(types.bracketR,true,true);return this.finishNode(node,"ArrayPattern");case types.braceL:return this.parseObj(true)}}return this.parseIdent()};pp$2.parseBindingList=function(close,allowEmpty,allowTrailingComma){var elts=[],first=true;while(!this.eat(close)){if(first){first=false}else{this.expect(types.comma)}if(allowEmpty&&this.type===types.comma){elts.push(null)}else if(allowTrailingComma&&this.afterTrailingComma(close)){break}else if(this.type===types.ellipsis){var rest=this.parseRestBinding();this.parseBindingListItem(rest);elts.push(rest);if(this.type===types.comma){this.raise(this.start,"Comma is not permitted after the rest element")}this.expect(close);break}else{var elem=this.parseMaybeDefault(this.start,this.startLoc);this.parseBindingListItem(elem);elts.push(elem)}}return elts};pp$2.parseBindingListItem=function(param){return param};pp$2.parseMaybeDefault=function(startPos,startLoc,left){left=left||this.parseBindingAtom();if(this.options.ecmaVersion<6||!this.eat(types.eq)){return left}var node=this.startNodeAt(startPos,startLoc);node.left=left;node.right=this.parseMaybeAssign();return this.finishNode(node,"AssignmentPattern")};pp$2.checkLValSimple=function(expr,bindingType,checkClashes){if(bindingType===void 0)bindingType=BIND_NONE;var isBind=bindingType!==BIND_NONE;switch(expr.type){case"Identifier":if(this.strict&&this.reservedWordsStrictBind.test(expr.name)){this.raiseRecoverable(expr.start,(isBind?"Binding ":"Assigning to ")+expr.name+" in strict mode")}if(isBind){if(bindingType===BIND_LEXICAL&&expr.name==="let"){this.raiseRecoverable(expr.start,"let is disallowed as a lexically bound name")}if(checkClashes){if(has(checkClashes,expr.name)){this.raiseRecoverable(expr.start,"Argument name clash")}checkClashes[expr.name]=true}if(bindingType!==BIND_OUTSIDE){this.declareName(expr.name,bindingType,expr.start)}}break;case"ChainExpression":this.raiseRecoverable(expr.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(isBind){this.raiseRecoverable(expr.start,"Binding member expression")}break;case"ParenthesizedExpression":if(isBind){this.raiseRecoverable(expr.start,"Binding parenthesized expression")}return this.checkLValSimple(expr.expression,bindingType,checkClashes);default:this.raise(expr.start,(isBind?"Binding":"Assigning to")+" rvalue")}};pp$2.checkLValPattern=function(expr,bindingType,checkClashes){if(bindingType===void 0)bindingType=BIND_NONE;switch(expr.type){case"ObjectPattern":for(var i=0,list=expr.properties;i<list.length;i+=1){var prop=list[i];this.checkLValInnerPattern(prop,bindingType,checkClashes)}break;case"ArrayPattern":for(var i$1=0,list$1=expr.elements;i$1<list$1.length;i$1+=1){var elem=list$1[i$1];if(elem){this.checkLValInnerPattern(elem,bindingType,checkClashes)}}break;default:this.checkLValSimple(expr,bindingType,checkClashes)}};pp$2.checkLValInnerPattern=function(expr,bindingType,checkClashes){if(bindingType===void 0)bindingType=BIND_NONE;switch(expr.type){case"Property":this.checkLValInnerPattern(expr.value,bindingType,checkClashes);break;case"AssignmentPattern":this.checkLValPattern(expr.left,bindingType,checkClashes);break;case"RestElement":this.checkLValPattern(expr.argument,bindingType,checkClashes);break;default:this.checkLValPattern(expr,bindingType,checkClashes)}};var pp$3=Parser.prototype;pp$3.checkPropClash=function(prop,propHash,refDestructuringErrors){if(this.options.ecmaVersion>=9&&prop.type==="SpreadElement"){return}if(this.options.ecmaVersion>=6&&(prop.computed||prop.method||prop.shorthand)){return}var key=prop.key;var name;switch(key.type){case"Identifier":name=key.name;break;case"Literal":name=String(key.value);break;default:return}var kind=prop.kind;if(this.options.ecmaVersion>=6){if(name==="__proto__"&&kind==="init"){if(propHash.proto){if(refDestructuringErrors){if(refDestructuringErrors.doubleProto<0){refDestructuringErrors.doubleProto=key.start}}else{this.raiseRecoverable(key.start,"Redefinition of __proto__ property")}}propHash.proto=true}return}name="$"+name;var other=propHash[name];if(other){var redefinition;if(kind==="init"){redefinition=this.strict&&other.init||other.get||other.set}else{redefinition=other.init||other[kind]}if(redefinition){this.raiseRecoverable(key.start,"Redefinition of property")}}else{other=propHash[name]={init:false,get:false,set:false}}other[kind]=true};pp$3.parseExpression=function(noIn,refDestructuringErrors){var startPos=this.start,startLoc=this.startLoc;var expr=this.parseMaybeAssign(noIn,refDestructuringErrors);if(this.type===types.comma){var node=this.startNodeAt(startPos,startLoc);node.expressions=[expr];while(this.eat(types.comma)){node.expressions.push(this.parseMaybeAssign(noIn,refDestructuringErrors))}return this.finishNode(node,"SequenceExpression")}return expr};pp$3.parseMaybeAssign=function(noIn,refDestructuringErrors,afterLeftParse){if(this.isContextual("yield")){if(this.inGenerator){return this.parseYield(noIn)}else{this.exprAllowed=false}}var ownDestructuringErrors=false,oldParenAssign=-1,oldTrailingComma=-1;if(refDestructuringErrors){oldParenAssign=refDestructuringErrors.parenthesizedAssign;oldTrailingComma=refDestructuringErrors.trailingComma;refDestructuringErrors.parenthesizedAssign=refDestructuringErrors.trailingComma=-1}else{refDestructuringErrors=new DestructuringErrors;ownDestructuringErrors=true}var startPos=this.start,startLoc=this.startLoc;if(this.type===types.parenL||this.type===types.name){this.potentialArrowAt=this.start}var left=this.parseMaybeConditional(noIn,refDestructuringErrors);if(afterLeftParse){left=afterLeftParse.call(this,left,startPos,startLoc)}if(this.type.isAssign){var node=this.startNodeAt(startPos,startLoc);node.operator=this.value;if(this.type===types.eq){left=this.toAssignable(left,false,refDestructuringErrors)}if(!ownDestructuringErrors){refDestructuringErrors.parenthesizedAssign=refDestructuringErrors.trailingComma=refDestructuringErrors.doubleProto=-1}if(refDestructuringErrors.shorthandAssign>=left.start){refDestructuringErrors.shorthandAssign=-1}if(this.type===types.eq){this.checkLValPattern(left)}else{this.checkLValSimple(left)}node.left=left;this.next();node.right=this.parseMaybeAssign(noIn);return this.finishNode(node,"AssignmentExpression")}else{if(ownDestructuringErrors){this.checkExpressionErrors(refDestructuringErrors,true)}}if(oldParenAssign>-1){refDestructuringErrors.parenthesizedAssign=oldParenAssign}if(oldTrailingComma>-1){refDestructuringErrors.trailingComma=oldTrailingComma}return left};pp$3.parseMaybeConditional=function(noIn,refDestructuringErrors){var startPos=this.start,startLoc=this.startLoc;var expr=this.parseExprOps(noIn,refDestructuringErrors);if(this.checkExpressionErrors(refDestructuringErrors)){return expr}if(this.eat(types.question)){var node=this.startNodeAt(startPos,startLoc);node.test=expr;node.consequent=this.parseMaybeAssign();this.expect(types.colon);node.alternate=this.parseMaybeAssign(noIn);return this.finishNode(node,"ConditionalExpression")}return expr};pp$3.parseExprOps=function(noIn,refDestructuringErrors){var startPos=this.start,startLoc=this.startLoc;var expr=this.parseMaybeUnary(refDestructuringErrors,false);if(this.checkExpressionErrors(refDestructuringErrors)){return expr}return expr.start===startPos&&expr.type==="ArrowFunctionExpression"?expr:this.parseExprOp(expr,startPos,startLoc,-1,noIn)};pp$3.parseExprOp=function(left,leftStartPos,leftStartLoc,minPrec,noIn){var prec=this.type.binop;if(prec!=null&&(!noIn||this.type!==types._in)){if(prec>minPrec){var logical=this.type===types.logicalOR||this.type===types.logicalAND;var coalesce=this.type===types.coalesce;if(coalesce){prec=types.logicalAND.binop}var op=this.value;this.next();var startPos=this.start,startLoc=this.startLoc;var right=this.parseExprOp(this.parseMaybeUnary(null,false),startPos,startLoc,prec,noIn);var node=this.buildBinary(leftStartPos,leftStartLoc,left,right,op,logical||coalesce);if(logical&&this.type===types.coalesce||coalesce&&(this.type===types.logicalOR||this.type===types.logicalAND)){this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses")}return this.parseExprOp(node,leftStartPos,leftStartLoc,minPrec,noIn)}}return left};pp$3.buildBinary=function(startPos,startLoc,left,right,op,logical){var node=this.startNodeAt(startPos,startLoc);node.left=left;node.operator=op;node.right=right;return this.finishNode(node,logical?"LogicalExpression":"BinaryExpression")};pp$3.parseMaybeUnary=function(refDestructuringErrors,sawUnary){var startPos=this.start,startLoc=this.startLoc,expr;if(this.isContextual("await")&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction)){expr=this.parseAwait();sawUnary=true}else if(this.type.prefix){var node=this.startNode(),update=this.type===types.incDec;node.operator=this.value;node.prefix=true;this.next();node.argument=this.parseMaybeUnary(null,true);this.checkExpressionErrors(refDestructuringErrors,true);if(update){this.checkLValSimple(node.argument)}else if(this.strict&&node.operator==="delete"&&node.argument.type==="Identifier"){this.raiseRecoverable(node.start,"Deleting local variable in strict mode")}else{sawUnary=true}expr=this.finishNode(node,update?"UpdateExpression":"UnaryExpression")}else{expr=this.parseExprSubscripts(refDestructuringErrors);if(this.checkExpressionErrors(refDestructuringErrors)){return expr}while(this.type.postfix&&!this.canInsertSemicolon()){var node$1=this.startNodeAt(startPos,startLoc);node$1.operator=this.value;node$1.prefix=false;node$1.argument=expr;this.checkLValSimple(expr);this.next();expr=this.finishNode(node$1,"UpdateExpression")}}if(!sawUnary&&this.eat(types.starstar)){return this.buildBinary(startPos,startLoc,expr,this.parseMaybeUnary(null,false),"**",false)}else{return expr}};pp$3.parseExprSubscripts=function(refDestructuringErrors){var startPos=this.start,startLoc=this.startLoc;var expr=this.parseExprAtom(refDestructuringErrors);if(expr.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")"){return expr}var result=this.parseSubscripts(expr,startPos,startLoc);if(refDestructuringErrors&&result.type==="MemberExpression"){if(refDestructuringErrors.parenthesizedAssign>=result.start){refDestructuringErrors.parenthesizedAssign=-1}if(refDestructuringErrors.parenthesizedBind>=result.start){refDestructuringErrors.parenthesizedBind=-1}}return result};pp$3.parseSubscripts=function(base,startPos,startLoc,noCalls){var maybeAsyncArrow=this.options.ecmaVersion>=8&&base.type==="Identifier"&&base.name==="async"&&this.lastTokEnd===base.end&&!this.canInsertSemicolon()&&base.end-base.start===5&&this.potentialArrowAt===base.start;var optionalChained=false;while(true){var element=this.parseSubscript(base,startPos,startLoc,noCalls,maybeAsyncArrow,optionalChained);if(element.optional){optionalChained=true}if(element===base||element.type==="ArrowFunctionExpression"){if(optionalChained){var chainNode=this.startNodeAt(startPos,startLoc);chainNode.expression=element;element=this.finishNode(chainNode,"ChainExpression")}return element}base=element}};pp$3.parseSubscript=function(base,startPos,startLoc,noCalls,maybeAsyncArrow,optionalChained){var optionalSupported=this.options.ecmaVersion>=11;var optional=optionalSupported&&this.eat(types.questionDot);if(noCalls&&optional){this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions")}var computed=this.eat(types.bracketL);if(computed||optional&&this.type!==types.parenL&&this.type!==types.backQuote||this.eat(types.dot)){var node=this.startNodeAt(startPos,startLoc);node.object=base;node.property=computed?this.parseExpression():this.parseIdent(this.options.allowReserved!=="never");node.computed=!!computed;if(computed){this.expect(types.bracketR)}if(optionalSupported){node.optional=optional}base=this.finishNode(node,"MemberExpression")}else if(!noCalls&&this.eat(types.parenL)){var refDestructuringErrors=new DestructuringErrors,oldYieldPos=this.yieldPos,oldAwaitPos=this.awaitPos,oldAwaitIdentPos=this.awaitIdentPos;this.yieldPos=0;this.awaitPos=0;this.awaitIdentPos=0;var exprList=this.parseExprList(types.parenR,this.options.ecmaVersion>=8,false,refDestructuringErrors);if(maybeAsyncArrow&&!optional&&!this.canInsertSemicolon()&&this.eat(types.arrow)){this.checkPatternErrors(refDestructuringErrors,false);this.checkYieldAwaitInDefaultParams();if(this.awaitIdentPos>0){this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function")}this.yieldPos=oldYieldPos;this.awaitPos=oldAwaitPos;this.awaitIdentPos=oldAwaitIdentPos;return this.parseArrowExpression(this.startNodeAt(startPos,startLoc),exprList,true)}this.checkExpressionErrors(refDestructuringErrors,true);this.yieldPos=oldYieldPos||this.yieldPos;this.awaitPos=oldAwaitPos||this.awaitPos;this.awaitIdentPos=oldAwaitIdentPos||this.awaitIdentPos;var node$1=this.startNodeAt(startPos,startLoc);node$1.callee=base;node$1.arguments=exprList;if(optionalSupported){node$1.optional=optional}base=this.finishNode(node$1,"CallExpression")}else if(this.type===types.backQuote){if(optional||optionalChained){this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions")}var node$2=this.startNodeAt(startPos,startLoc);node$2.tag=base;node$2.quasi=this.parseTemplate({isTagged:true});base=this.finishNode(node$2,"TaggedTemplateExpression")}return base};pp$3.parseExprAtom=function(refDestructuringErrors){if(this.type===types.slash){this.readRegexp()}var node,canBeArrow=this.potentialArrowAt===this.start;switch(this.type){case types._super:if(!this.allowSuper){this.raise(this.start,"'super' keyword outside a method")}node=this.startNode();this.next();if(this.type===types.parenL&&!this.allowDirectSuper){this.raise(node.start,"super() call outside constructor of a subclass")}if(this.type!==types.dot&&this.type!==types.bracketL&&this.type!==types.parenL){this.unexpected()}return this.finishNode(node,"Super");case types._this:node=this.startNode();this.next();return this.finishNode(node,"ThisExpression");case types.name:var startPos=this.start,startLoc=this.startLoc,containsEsc=this.containsEsc;var id=this.parseIdent(false);if(this.options.ecmaVersion>=8&&!containsEsc&&id.name==="async"&&!this.canInsertSemicolon()&&this.eat(types._function)){return this.parseFunction(this.startNodeAt(startPos,startLoc),0,false,true)}if(canBeArrow&&!this.canInsertSemicolon()){if(this.eat(types.arrow)){return this.parseArrowExpression(this.startNodeAt(startPos,startLoc),[id],false)}if(this.options.ecmaVersion>=8&&id.name==="async"&&this.type===types.name&&!containsEsc){id=this.parseIdent(false);if(this.canInsertSemicolon()||!this.eat(types.arrow)){this.unexpected()}return this.parseArrowExpression(this.startNodeAt(startPos,startLoc),[id],true)}}return id;case types.regexp:var value=this.value;node=this.parseLiteral(value.value);node.regex={pattern:value.pattern,flags:value.flags};return node;case types.num:case types.string:return this.parseLiteral(this.value);case types._null:case types._true:case types._false:node=this.startNode();node.value=this.type===types._null?null:this.type===types._true;node.raw=this.type.keyword;this.next();return this.finishNode(node,"Literal");case types.parenL:var start=this.start,expr=this.parseParenAndDistinguishExpression(canBeArrow);if(refDestructuringErrors){if(refDestructuringErrors.parenthesizedAssign<0&&!this.isSimpleAssignTarget(expr)){refDestructuringErrors.parenthesizedAssign=start}if(refDestructuringErrors.parenthesizedBind<0){refDestructuringErrors.parenthesizedBind=start}}return expr;case types.bracketL:node=this.startNode();this.next();node.elements=this.parseExprList(types.bracketR,true,true,refDestructuringErrors);return this.finishNode(node,"ArrayExpression");case types.braceL:return this.parseObj(false,refDestructuringErrors);case types._function:node=this.startNode();this.next();return this.parseFunction(node,0);case types._class:return this.parseClass(this.startNode(),false);case types._new:return this.parseNew();case types.backQuote:return this.parseTemplate();case types._import:if(this.options.ecmaVersion>=11){return this.parseExprImport()}else{return this.unexpected()}default:this.unexpected()}};pp$3.parseExprImport=function(){var node=this.startNode();if(this.containsEsc){this.raiseRecoverable(this.start,"Escape sequence in keyword import")}var meta=this.parseIdent(true);switch(this.type){case types.parenL:return this.parseDynamicImport(node);case types.dot:node.meta=meta;return this.parseImportMeta(node);default:this.unexpected()}};pp$3.parseDynamicImport=function(node){this.next();node.source=this.parseMaybeAssign();if(!this.eat(types.parenR)){var errorPos=this.start;if(this.eat(types.comma)&&this.eat(types.parenR)){this.raiseRecoverable(errorPos,"Trailing comma is not allowed in import()")}else{this.unexpected(errorPos)}}return this.finishNode(node,"ImportExpression")};pp$3.parseImportMeta=function(node){this.next();var containsEsc=this.containsEsc;node.property=this.parseIdent(true);if(node.property.name!=="meta"){this.raiseRecoverable(node.property.start,"The only valid meta property for import is 'import.meta'")}if(containsEsc){this.raiseRecoverable(node.start,"'import.meta' must not contain escaped characters")}if(this.options.sourceType!=="module"){this.raiseRecoverable(node.start,"Cannot use 'import.meta' outside a module")}return this.finishNode(node,"MetaProperty")};pp$3.parseLiteral=function(value){var node=this.startNode();node.value=value;node.raw=this.input.slice(this.start,this.end);if(node.raw.charCodeAt(node.raw.length-1)===110){node.bigint=node.raw.slice(0,-1).replace(/_/g,"")}this.next();return this.finishNode(node,"Literal")};pp$3.parseParenExpression=function(){this.expect(types.parenL);var val=this.parseExpression();this.expect(types.parenR);return val};pp$3.parseParenAndDistinguishExpression=function(canBeArrow){var startPos=this.start,startLoc=this.startLoc,val,allowTrailingComma=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var innerStartPos=this.start,innerStartLoc=this.startLoc;var exprList=[],first=true,lastIsComma=false;var refDestructuringErrors=new DestructuringErrors,oldYieldPos=this.yieldPos,oldAwaitPos=this.awaitPos,spreadStart;this.yieldPos=0;this.awaitPos=0;while(this.type!==types.parenR){first?first=false:this.expect(types.comma);if(allowTrailingComma&&this.afterTrailingComma(types.parenR,true)){lastIsComma=true;break}else if(this.type===types.ellipsis){spreadStart=this.start;exprList.push(this.parseParenItem(this.parseRestBinding()));if(this.type===types.comma){this.raise(this.start,"Comma is not permitted after the rest element")}break}else{exprList.push(this.parseMaybeAssign(false,refDestructuringErrors,this.parseParenItem))}}var innerEndPos=this.start,innerEndLoc=this.startLoc;this.expect(types.parenR);if(canBeArrow&&!this.canInsertSemicolon()&&this.eat(types.arrow)){this.checkPatternErrors(refDestructuringErrors,false);this.checkYieldAwaitInDefaultParams();this.yieldPos=oldYieldPos;this.awaitPos=oldAwaitPos;return this.parseParenArrowList(startPos,startLoc,exprList)}if(!exprList.length||lastIsComma){this.unexpected(this.lastTokStart)}if(spreadStart){this.unexpected(spreadStart)}this.checkExpressionErrors(refDestructuringErrors,true);this.yieldPos=oldYieldPos||this.yieldPos;this.awaitPos=oldAwaitPos||this.awaitPos;if(exprList.length>1){val=this.startNodeAt(innerStartPos,innerStartLoc);val.expressions=exprList;this.finishNodeAt(val,"SequenceExpression",innerEndPos,innerEndLoc)}else{val=exprList[0]}}else{val=this.parseParenExpression()}if(this.options.preserveParens){var par=this.startNodeAt(startPos,startLoc);par.expression=val;return this.finishNode(par,"ParenthesizedExpression")}else{return val}};pp$3.parseParenItem=function(item){return item};pp$3.parseParenArrowList=function(startPos,startLoc,exprList){return this.parseArrowExpression(this.startNodeAt(startPos,startLoc),exprList)};var empty$1=[];pp$3.parseNew=function(){if(this.containsEsc){this.raiseRecoverable(this.start,"Escape sequence in keyword new")}var node=this.startNode();var meta=this.parseIdent(true);if(this.options.ecmaVersion>=6&&this.eat(types.dot)){node.meta=meta;var containsEsc=this.containsEsc;node.property=this.parseIdent(true);if(node.property.name!=="target"){this.raiseRecoverable(node.property.start,"The only valid meta property for new is 'new.target'")}if(containsEsc){this.raiseRecoverable(node.start,"'new.target' must not contain escaped characters")}if(!this.inNonArrowFunction){this.raiseRecoverable(node.start,"'new.target' can only be used in functions")}return this.finishNode(node,"MetaProperty")}var startPos=this.start,startLoc=this.startLoc,isImport=this.type===types._import;node.callee=this.parseSubscripts(this.parseExprAtom(),startPos,startLoc,true);if(isImport&&node.callee.type==="ImportExpression"){this.raise(startPos,"Cannot use new with import()")}if(this.eat(types.parenL)){node.arguments=this.parseExprList(types.parenR,this.options.ecmaVersion>=8,false)}else{node.arguments=empty$1}return this.finishNode(node,"NewExpression")};pp$3.parseTemplateElement=function(ref){var isTagged=ref.isTagged;var elem=this.startNode();if(this.type===types.invalidTemplate){if(!isTagged){this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal")}elem.value={raw:this.value,cooked:null}}else{elem.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value}}this.next();elem.tail=this.type===types.backQuote;return this.finishNode(elem,"TemplateElement")};pp$3.parseTemplate=function(ref){if(ref===void 0)ref={};var isTagged=ref.isTagged;if(isTagged===void 0)isTagged=false;var node=this.startNode();this.next();node.expressions=[];var curElt=this.parseTemplateElement({isTagged:isTagged});node.quasis=[curElt];while(!curElt.tail){if(this.type===types.eof){this.raise(this.pos,"Unterminated template literal")}this.expect(types.dollarBraceL);node.expressions.push(this.parseExpression());this.expect(types.braceR);node.quasis.push(curElt=this.parseTemplateElement({isTagged:isTagged}))}this.next();return this.finishNode(node,"TemplateLiteral")};pp$3.isAsyncProp=function(prop){return!prop.computed&&prop.key.type==="Identifier"&&prop.key.name==="async"&&(this.type===types.name||this.type===types.num||this.type===types.string||this.type===types.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===types.star)&&!lineBreak.test(this.input.slice(this.lastTokEnd,this.start))};pp$3.parseObj=function(isPattern,refDestructuringErrors){var node=this.startNode(),first=true,propHash={};node.properties=[];this.next();while(!this.eat(types.braceR)){if(!first){this.expect(types.comma);if(this.options.ecmaVersion>=5&&this.afterTrailingComma(types.braceR)){break}}else{first=false}var prop=this.parseProperty(isPattern,refDestructuringErrors);if(!isPattern){this.checkPropClash(prop,propHash,refDestructuringErrors)}node.properties.push(prop)}return this.finishNode(node,isPattern?"ObjectPattern":"ObjectExpression")};pp$3.parseProperty=function(isPattern,refDestructuringErrors){var prop=this.startNode(),isGenerator,isAsync,startPos,startLoc;if(this.options.ecmaVersion>=9&&this.eat(types.ellipsis)){if(isPattern){prop.argument=this.parseIdent(false);if(this.type===types.comma){this.raise(this.start,"Comma is not permitted after the rest element")}return this.finishNode(prop,"RestElement")}if(this.type===types.parenL&&refDestructuringErrors){if(refDestructuringErrors.parenthesizedAssign<0){refDestructuringErrors.parenthesizedAssign=this.start}if(refDestructuringErrors.parenthesizedBind<0){refDestructuringErrors.parenthesizedBind=this.start}}prop.argument=this.parseMaybeAssign(false,refDestructuringErrors);if(this.type===types.comma&&refDestructuringErrors&&refDestructuringErrors.trailingComma<0){refDestructuringErrors.trailingComma=this.start}return this.finishNode(prop,"SpreadElement")}if(this.options.ecmaVersion>=6){prop.method=false;prop.shorthand=false;if(isPattern||refDestructuringErrors){startPos=this.start;startLoc=this.startLoc}if(!isPattern){isGenerator=this.eat(types.star)}}var containsEsc=this.containsEsc;this.parsePropertyName(prop);if(!isPattern&&!containsEsc&&this.options.ecmaVersion>=8&&!isGenerator&&this.isAsyncProp(prop)){isAsync=true;isGenerator=this.options.ecmaVersion>=9&&this.eat(types.star);this.parsePropertyName(prop,refDestructuringErrors)}else{isAsync=false}this.parsePropertyValue(prop,isPattern,isGenerator,isAsync,startPos,startLoc,refDestructuringErrors,containsEsc);return this.finishNode(prop,"Property")};pp$3.parsePropertyValue=function(prop,isPattern,isGenerator,isAsync,startPos,startLoc,refDestructuringErrors,containsEsc){if((isGenerator||isAsync)&&this.type===types.colon){this.unexpected()}if(this.eat(types.colon)){prop.value=isPattern?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(false,refDestructuringErrors);prop.kind="init"}else if(this.options.ecmaVersion>=6&&this.type===types.parenL){if(isPattern){this.unexpected()}prop.kind="init";prop.method=true;prop.value=this.parseMethod(isGenerator,isAsync)}else if(!isPattern&&!containsEsc&&this.options.ecmaVersion>=5&&!prop.computed&&prop.key.type==="Identifier"&&(prop.key.name==="get"||prop.key.name==="set")&&(this.type!==types.comma&&this.type!==types.braceR&&this.type!==types.eq)){if(isGenerator||isAsync){this.unexpected()}prop.kind=prop.key.name;this.parsePropertyName(prop);prop.value=this.parseMethod(false);var paramCount=prop.kind==="get"?0:1;if(prop.value.params.length!==paramCount){var start=prop.value.start;if(prop.kind==="get"){this.raiseRecoverable(start,"getter should have no params")}else{this.raiseRecoverable(start,"setter should have exactly one param")}}else{if(prop.kind==="set"&&prop.value.params[0].type==="RestElement"){this.raiseRecoverable(prop.value.params[0].start,"Setter cannot use rest params")}}}else if(this.options.ecmaVersion>=6&&!prop.computed&&prop.key.type==="Identifier"){if(isGenerator||isAsync){this.unexpected()}this.checkUnreserved(prop.key);if(prop.key.name==="await"&&!this.awaitIdentPos){this.awaitIdentPos=startPos}prop.kind="init";if(isPattern){prop.value=this.parseMaybeDefault(startPos,startLoc,this.copyNode(prop.key))}else if(this.type===types.eq&&refDestructuringErrors){if(refDestructuringErrors.shorthandAssign<0){refDestructuringErrors.shorthandAssign=this.start}prop.value=this.parseMaybeDefault(startPos,startLoc,this.copyNode(prop.key))}else{prop.value=this.copyNode(prop.key)}prop.shorthand=true}else{this.unexpected()}};pp$3.parsePropertyName=function(prop){if(this.options.ecmaVersion>=6){if(this.eat(types.bracketL)){prop.computed=true;prop.key=this.parseMaybeAssign();this.expect(types.bracketR);return prop.key}else{prop.computed=false}}return prop.key=this.type===types.num||this.type===types.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};pp$3.initFunction=function(node){node.id=null;if(this.options.ecmaVersion>=6){node.generator=node.expression=false}if(this.options.ecmaVersion>=8){node.async=false}};pp$3.parseMethod=function(isGenerator,isAsync,allowDirectSuper){var node=this.startNode(),oldYieldPos=this.yieldPos,oldAwaitPos=this.awaitPos,oldAwaitIdentPos=this.awaitIdentPos;this.initFunction(node);if(this.options.ecmaVersion>=6){node.generator=isGenerator}if(this.options.ecmaVersion>=8){node.async=!!isAsync}this.yieldPos=0;this.awaitPos=0;this.awaitIdentPos=0;this.enterScope(functionFlags(isAsync,node.generator)|SCOPE_SUPER|(allowDirectSuper?SCOPE_DIRECT_SUPER:0));this.expect(types.parenL);node.params=this.parseBindingList(types.parenR,false,this.options.ecmaVersion>=8);this.checkYieldAwaitInDefaultParams();this.parseFunctionBody(node,false,true);this.yieldPos=oldYieldPos;this.awaitPos=oldAwaitPos;this.awaitIdentPos=oldAwaitIdentPos;return this.finishNode(node,"FunctionExpression")};pp$3.parseArrowExpression=function(node,params,isAsync){var oldYieldPos=this.yieldPos,oldAwaitPos=this.awaitPos,oldAwaitIdentPos=this.awaitIdentPos;this.enterScope(functionFlags(isAsync,false)|SCOPE_ARROW);this.initFunction(node);if(this.options.ecmaVersion>=8){node.async=!!isAsync}this.yieldPos=0;this.awaitPos=0;this.awaitIdentPos=0;node.params=this.toAssignableList(params,true);this.parseFunctionBody(node,true,false);this.yieldPos=oldYieldPos;this.awaitPos=oldAwaitPos;this.awaitIdentPos=oldAwaitIdentPos;return this.finishNode(node,"ArrowFunctionExpression")};pp$3.parseFunctionBody=function(node,isArrowFunction,isMethod){var isExpression=isArrowFunction&&this.type!==types.braceL;var oldStrict=this.strict,useStrict=false;if(isExpression){node.body=this.parseMaybeAssign();node.expression=true;this.checkParams(node,false)}else{var nonSimple=this.options.ecmaVersion>=7&&!this.isSimpleParamList(node.params);if(!oldStrict||nonSimple){useStrict=this.strictDirective(this.end);if(useStrict&&nonSimple){this.raiseRecoverable(node.start,"Illegal 'use strict' directive in function with non-simple parameter list")}}var oldLabels=this.labels;this.labels=[];if(useStrict){this.strict=true}this.checkParams(node,!oldStrict&&!useStrict&&!isArrowFunction&&!isMethod&&this.isSimpleParamList(node.params));if(this.strict&&node.id){this.checkLValSimple(node.id,BIND_OUTSIDE)}node.body=this.parseBlock(false,undefined,useStrict&&!oldStrict);node.expression=false;this.adaptDirectivePrologue(node.body.body);this.labels=oldLabels}this.exitScope()};pp$3.isSimpleParamList=function(params){for(var i=0,list=params;i<list.length;i+=1){var param=list[i];if(param.type!=="Identifier"){return false}}return true};pp$3.checkParams=function(node,allowDuplicates){var nameHash={};for(var i=0,list=node.params;i<list.length;i+=1){var param=list[i];this.checkLValInnerPattern(param,BIND_VAR,allowDuplicates?null:nameHash)}};pp$3.parseExprList=function(close,allowTrailingComma,allowEmpty,refDestructuringErrors){var elts=[],first=true;while(!this.eat(close)){if(!first){this.expect(types.comma);if(allowTrailingComma&&this.afterTrailingComma(close)){break}}else{first=false}var elt=void 0;if(allowEmpty&&this.type===types.comma){elt=null}else if(this.type===types.ellipsis){elt=this.parseSpread(refDestructuringErrors);if(refDestructuringErrors&&this.type===types.comma&&refDestructuringErrors.trailingComma<0){refDestructuringErrors.trailingComma=this.start}}else{elt=this.parseMaybeAssign(false,refDestructuringErrors)}elts.push(elt)}return elts};pp$3.checkUnreserved=function(ref){var start=ref.start;var end=ref.end;var name=ref.name;if(this.inGenerator&&name==="yield"){this.raiseRecoverable(start,"Cannot use 'yield' as identifier inside a generator")}if(this.inAsync&&name==="await"){this.raiseRecoverable(start,"Cannot use 'await' as identifier inside an async function")}if(this.keywords.test(name)){this.raise(start,"Unexpected keyword '"+name+"'")}if(this.options.ecmaVersion<6&&this.input.slice(start,end).indexOf("\\")!==-1){return}var re=this.strict?this.reservedWordsStrict:this.reservedWords;if(re.test(name)){if(!this.inAsync&&name==="await"){this.raiseRecoverable(start,"Cannot use keyword 'await' outside an async function")}this.raiseRecoverable(start,"The keyword '"+name+"' is reserved")}};pp$3.parseIdent=function(liberal,isBinding){var node=this.startNode();if(this.type===types.name){node.name=this.value}else if(this.type.keyword){node.name=this.type.keyword;if((node.name==="class"||node.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)){this.context.pop()}}else{this.unexpected()}this.next(!!liberal);this.finishNode(node,"Identifier");if(!liberal){this.checkUnreserved(node);if(node.name==="await"&&!this.awaitIdentPos){this.awaitIdentPos=node.start}}return node};pp$3.parseYield=function(noIn){if(!this.yieldPos){this.yieldPos=this.start}var node=this.startNode();this.next();if(this.type===types.semi||this.canInsertSemicolon()||this.type!==types.star&&!this.type.startsExpr){node.delegate=false;node.argument=null}else{node.delegate=this.eat(types.star);node.argument=this.parseMaybeAssign(noIn)}return this.finishNode(node,"YieldExpression")};pp$3.parseAwait=function(){if(!this.awaitPos){this.awaitPos=this.start}var node=this.startNode();this.next();node.argument=this.parseMaybeUnary(null,true);return this.finishNode(node,"AwaitExpression")};var pp$4=Parser.prototype;pp$4.raise=function(pos,message){var loc=getLineInfo(this.input,pos);message+=" ("+loc.line+":"+loc.column+")";var err=new SyntaxError(message);err.pos=pos;err.loc=loc;err.raisedAt=this.pos;throw err};pp$4.raiseRecoverable=pp$4.raise;pp$4.curPosition=function(){if(this.options.locations){return new Position(this.curLine,this.pos-this.lineStart)}};var pp$5=Parser.prototype;var Scope=function Scope(flags){this.flags=flags;this.var=[];this.lexical=[];this.functions=[]};pp$5.enterScope=function(flags){this.scopeStack.push(new Scope(flags))};pp$5.exitScope=function(){this.scopeStack.pop()};pp$5.treatFunctionsAsVarInScope=function(scope){return scope.flags&SCOPE_FUNCTION||!this.inModule&&scope.flags&SCOPE_TOP};pp$5.declareName=function(name,bindingType,pos){var redeclared=false;if(bindingType===BIND_LEXICAL){var scope=this.currentScope();redeclared=scope.lexical.indexOf(name)>-1||scope.functions.indexOf(name)>-1||scope.var.indexOf(name)>-1;scope.lexical.push(name);if(this.inModule&&scope.flags&SCOPE_TOP){delete this.undefinedExports[name]}}else if(bindingType===BIND_SIMPLE_CATCH){var scope$1=this.currentScope();scope$1.lexical.push(name)}else if(bindingType===BIND_FUNCTION){var scope$2=this.currentScope();if(this.treatFunctionsAsVar){redeclared=scope$2.lexical.indexOf(name)>-1}else{redeclared=scope$2.lexical.indexOf(name)>-1||scope$2.var.indexOf(name)>-1}scope$2.functions.push(name)}else{for(var i=this.scopeStack.length-1;i>=0;--i){var scope$3=this.scopeStack[i];if(scope$3.lexical.indexOf(name)>-1&&!(scope$3.flags&SCOPE_SIMPLE_CATCH&&scope$3.lexical[0]===name)||!this.treatFunctionsAsVarInScope(scope$3)&&scope$3.functions.indexOf(name)>-1){redeclared=true;break}scope$3.var.push(name);if(this.inModule&&scope$3.flags&SCOPE_TOP){delete this.undefinedExports[name]}if(scope$3.flags&SCOPE_VAR){break}}}if(redeclared){this.raiseRecoverable(pos,"Identifier '"+name+"' has already been declared")}};pp$5.checkLocalExport=function(id){if(this.scopeStack[0].lexical.indexOf(id.name)===-1&&this.scopeStack[0].var.indexOf(id.name)===-1){this.undefinedExports[id.name]=id}};pp$5.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};pp$5.currentVarScope=function(){for(var i=this.scopeStack.length-1;;i--){var scope=this.scopeStack[i];if(scope.flags&SCOPE_VAR){return scope}}};pp$5.currentThisScope=function(){for(var i=this.scopeStack.length-1;;i--){var scope=this.scopeStack[i];if(scope.flags&SCOPE_VAR&&!(scope.flags&SCOPE_ARROW)){return scope}}};var Node=function Node(parser,pos,loc){this.type="";this.start=pos;this.end=0;if(parser.options.locations){this.loc=new SourceLocation(parser,loc)}if(parser.options.directSourceFile){this.sourceFile=parser.options.directSourceFile}if(parser.options.ranges){this.range=[pos,0]}};var pp$6=Parser.prototype;pp$6.startNode=function(){return new Node(this,this.start,this.startLoc)};pp$6.startNodeAt=function(pos,loc){return new Node(this,pos,loc)};function finishNodeAt(node,type,pos,loc){node.type=type;node.end=pos;if(this.options.locations){node.loc.end=loc}if(this.options.ranges){node.range[1]=pos}return node}pp$6.finishNode=function(node,type){return finishNodeAt.call(this,node,type,this.lastTokEnd,this.lastTokEndLoc)};pp$6.finishNodeAt=function(node,type,pos,loc){return finishNodeAt.call(this,node,type,pos,loc)};pp$6.copyNode=function(node){var newNode=new Node(this,node.start,this.startLoc);for(var prop in node){newNode[prop]=node[prop]}return newNode};var TokContext=function TokContext(token,isExpr,preserveSpace,override,generator){this.token=token;this.isExpr=!!isExpr;this.preserveSpace=!!preserveSpace;this.override=override;this.generator=!!generator};var types$1={b_stat:new TokContext("{",false),b_expr:new TokContext("{",true),b_tmpl:new TokContext("${",false),p_stat:new TokContext("(",false),p_expr:new TokContext("(",true),q_tmpl:new TokContext("`",true,true,(function(p){return p.tryReadTemplateToken()})),f_stat:new TokContext("function",false),f_expr:new TokContext("function",true),f_expr_gen:new TokContext("function",true,false,null,true),f_gen:new TokContext("function",false,false,null,true)};var pp$7=Parser.prototype;pp$7.initialContext=function(){return[types$1.b_stat]};pp$7.braceIsBlock=function(prevType){var parent=this.curContext();if(parent===types$1.f_expr||parent===types$1.f_stat){return true}if(prevType===types.colon&&(parent===types$1.b_stat||parent===types$1.b_expr)){return!parent.isExpr}if(prevType===types._return||prevType===types.name&&this.exprAllowed){return lineBreak.test(this.input.slice(this.lastTokEnd,this.start))}if(prevType===types._else||prevType===types.semi||prevType===types.eof||prevType===types.parenR||prevType===types.arrow){return true}if(prevType===types.braceL){return parent===types$1.b_stat}if(prevType===types._var||prevType===types._const||prevType===types.name){return false}return!this.exprAllowed};pp$7.inGeneratorContext=function(){for(var i=this.context.length-1;i>=1;i--){var context=this.context[i];if(context.token==="function"){return context.generator}}return false};pp$7.updateContext=function(prevType){var update,type=this.type;if(type.keyword&&prevType===types.dot){this.exprAllowed=false}else if(update=type.updateContext){update.call(this,prevType)}else{this.exprAllowed=type.beforeExpr}};types.parenR.updateContext=types.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=true;return}var out=this.context.pop();if(out===types$1.b_stat&&this.curContext().token==="function"){out=this.context.pop()}this.exprAllowed=!out.isExpr};types.braceL.updateContext=function(prevType){this.context.push(this.braceIsBlock(prevType)?types$1.b_stat:types$1.b_expr);this.exprAllowed=true};types.dollarBraceL.updateContext=function(){this.context.push(types$1.b_tmpl);this.exprAllowed=true};types.parenL.updateContext=function(prevType){var statementParens=prevType===types._if||prevType===types._for||prevType===types._with||prevType===types._while;this.context.push(statementParens?types$1.p_stat:types$1.p_expr);this.exprAllowed=true};types.incDec.updateContext=function(){};types._function.updateContext=types._class.updateContext=function(prevType){if(prevType.beforeExpr&&prevType!==types._else&&!(prevType===types.semi&&this.curContext()!==types$1.p_stat)&&!(prevType===types._return&&lineBreak.test(this.input.slice(this.lastTokEnd,this.start)))&&!((prevType===types.colon||prevType===types.braceL)&&this.curContext()===types$1.b_stat)){this.context.push(types$1.f_expr)}else{this.context.push(types$1.f_stat)}this.exprAllowed=false};types.backQuote.updateContext=function(){if(this.curContext()===types$1.q_tmpl){this.context.pop()}else{this.context.push(types$1.q_tmpl)}this.exprAllowed=false};types.star.updateContext=function(prevType){if(prevType===types._function){var index=this.context.length-1;if(this.context[index]===types$1.f_expr){this.context[index]=types$1.f_expr_gen}else{this.context[index]=types$1.f_gen}}this.exprAllowed=true};types.name.updateContext=function(prevType){var allowed=false;if(this.options.ecmaVersion>=6&&prevType!==types.dot){if(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext()){allowed=true}}this.exprAllowed=allowed};var ecma9BinaryProperties="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS";var ecma10BinaryProperties=ecma9BinaryProperties+" Extended_Pictographic";var ecma11BinaryProperties=ecma10BinaryProperties;var ecma12BinaryProperties=ecma11BinaryProperties+" EBase EComp EMod EPres ExtPict";var unicodeBinaryProperties={9:ecma9BinaryProperties,10:ecma10BinaryProperties,11:ecma11BinaryProperties,12:ecma12BinaryProperties};var unicodeGeneralCategoryValues="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu";var ecma9ScriptValues="Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb";var ecma10ScriptValues=ecma9ScriptValues+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd";var ecma11ScriptValues=ecma10ScriptValues+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho";var ecma12ScriptValues=ecma11ScriptValues+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi";var unicodeScriptValues={9:ecma9ScriptValues,10:ecma10ScriptValues,11:ecma11ScriptValues,12:ecma12ScriptValues};var data={};function buildUnicodeData(ecmaVersion){var d=data[ecmaVersion]={binary:wordsRegexp(unicodeBinaryProperties[ecmaVersion]+" "+unicodeGeneralCategoryValues),nonBinary:{General_Category:wordsRegexp(unicodeGeneralCategoryValues),Script:wordsRegexp(unicodeScriptValues[ecmaVersion])}};d.nonBinary.Script_Extensions=d.nonBinary.Script;d.nonBinary.gc=d.nonBinary.General_Category;d.nonBinary.sc=d.nonBinary.Script;d.nonBinary.scx=d.nonBinary.Script_Extensions}buildUnicodeData(9);buildUnicodeData(10);buildUnicodeData(11);buildUnicodeData(12);var pp$8=Parser.prototype;var RegExpValidationState=function RegExpValidationState(parser){this.parser=parser;this.validFlags="gim"+(parser.options.ecmaVersion>=6?"uy":"")+(parser.options.ecmaVersion>=9?"s":"");this.unicodeProperties=data[parser.options.ecmaVersion>=12?12:parser.options.ecmaVersion];this.source="";this.flags="";this.start=0;this.switchU=false;this.switchN=false;this.pos=0;this.lastIntValue=0;this.lastStringValue="";this.lastAssertionIsQuantifiable=false;this.numCapturingParens=0;this.maxBackReference=0;this.groupNames=[];this.backReferenceNames=[]};RegExpValidationState.prototype.reset=function reset(start,pattern,flags){var unicode=flags.indexOf("u")!==-1;this.start=start|0;this.source=pattern+"";this.flags=flags;this.switchU=unicode&&this.parser.options.ecmaVersion>=6;this.switchN=unicode&&this.parser.options.ecmaVersion>=9};RegExpValidationState.prototype.raise=function raise(message){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+message)};RegExpValidationState.prototype.at=function at(i,forceU){if(forceU===void 0)forceU=false;var s=this.source;var l=s.length;if(i>=l){return-1}var c=s.charCodeAt(i);if(!(forceU||this.switchU)||c<=55295||c>=57344||i+1>=l){return c}var next=s.charCodeAt(i+1);return next>=56320&&next<=57343?(c<<10)+next-56613888:c};RegExpValidationState.prototype.nextIndex=function nextIndex(i,forceU){if(forceU===void 0)forceU=false;var s=this.source;var l=s.length;if(i>=l){return l}var c=s.charCodeAt(i),next;if(!(forceU||this.switchU)||c<=55295||c>=57344||i+1>=l||(next=s.charCodeAt(i+1))<56320||next>57343){return i+1}return i+2};RegExpValidationState.prototype.current=function current(forceU){if(forceU===void 0)forceU=false;return this.at(this.pos,forceU)};RegExpValidationState.prototype.lookahead=function lookahead(forceU){if(forceU===void 0)forceU=false;return this.at(this.nextIndex(this.pos,forceU),forceU)};RegExpValidationState.prototype.advance=function advance(forceU){if(forceU===void 0)forceU=false;this.pos=this.nextIndex(this.pos,forceU)};RegExpValidationState.prototype.eat=function eat(ch,forceU){if(forceU===void 0)forceU=false;if(this.current(forceU)===ch){this.advance(forceU);return true}return false};function codePointToString(ch){if(ch<=65535){return String.fromCharCode(ch)}ch-=65536;return String.fromCharCode((ch>>10)+55296,(ch&1023)+56320)}pp$8.validateRegExpFlags=function(state){var validFlags=state.validFlags;var flags=state.flags;for(var i=0;i<flags.length;i++){var flag=flags.charAt(i);if(validFlags.indexOf(flag)===-1){this.raise(state.start,"Invalid regular expression flag")}if(flags.indexOf(flag,i+1)>-1){this.raise(state.start,"Duplicate regular expression flag")}}};pp$8.validateRegExpPattern=function(state){this.regexp_pattern(state);if(!state.switchN&&this.options.ecmaVersion>=9&&state.groupNames.length>0){state.switchN=true;this.regexp_pattern(state)}};pp$8.regexp_pattern=function(state){state.pos=0;state.lastIntValue=0;state.lastStringValue="";state.lastAssertionIsQuantifiable=false;state.numCapturingParens=0;state.maxBackReference=0;state.groupNames.length=0;state.backReferenceNames.length=0;this.regexp_disjunction(state);if(state.pos!==state.source.length){if(state.eat(41)){state.raise("Unmatched ')'")}if(state.eat(93)||state.eat(125)){state.raise("Lone quantifier brackets")}}if(state.maxBackReference>state.numCapturingParens){state.raise("Invalid escape")}for(var i=0,list=state.backReferenceNames;i<list.length;i+=1){var name=list[i];if(state.groupNames.indexOf(name)===-1){state.raise("Invalid named capture referenced")}}};pp$8.regexp_disjunction=function(state){this.regexp_alternative(state);while(state.eat(124)){this.regexp_alternative(state)}if(this.regexp_eatQuantifier(state,true)){state.raise("Nothing to repeat")}if(state.eat(123)){state.raise("Lone quantifier brackets")}};pp$8.regexp_alternative=function(state){while(state.pos<state.source.length&&this.regexp_eatTerm(state)){}};pp$8.regexp_eatTerm=function(state){if(this.regexp_eatAssertion(state)){if(state.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(state)){if(state.switchU){state.raise("Invalid quantifier")}}return true}if(state.switchU?this.regexp_eatAtom(state):this.regexp_eatExtendedAtom(state)){this.regexp_eatQuantifier(state);return true}return false};pp$8.regexp_eatAssertion=function(state){var start=state.pos;state.lastAssertionIsQuantifiable=false;if(state.eat(94)||state.eat(36)){return true}if(state.eat(92)){if(state.eat(66)||state.eat(98)){return true}state.pos=start}if(state.eat(40)&&state.eat(63)){var lookbehind=false;if(this.options.ecmaVersion>=9){lookbehind=state.eat(60)}if(state.eat(61)||state.eat(33)){this.regexp_disjunction(state);if(!state.eat(41)){state.raise("Unterminated group")}state.lastAssertionIsQuantifiable=!lookbehind;return true}}state.pos=start;return false};pp$8.regexp_eatQuantifier=function(state,noError){if(noError===void 0)noError=false;if(this.regexp_eatQuantifierPrefix(state,noError)){state.eat(63);return true}return false};pp$8.regexp_eatQuantifierPrefix=function(state,noError){return state.eat(42)||state.eat(43)||state.eat(63)||this.regexp_eatBracedQuantifier(state,noError)};pp$8.regexp_eatBracedQuantifier=function(state,noError){var start=state.pos;if(state.eat(123)){var min=0,max=-1;if(this.regexp_eatDecimalDigits(state)){min=state.lastIntValue;if(state.eat(44)&&this.regexp_eatDecimalDigits(state)){max=state.lastIntValue}if(state.eat(125)){if(max!==-1&&max<min&&!noError){state.raise("numbers out of order in {} quantifier")}return true}}if(state.switchU&&!noError){state.raise("Incomplete quantifier")}state.pos=start}return false};pp$8.regexp_eatAtom=function(state){return this.regexp_eatPatternCharacters(state)||state.eat(46)||this.regexp_eatReverseSolidusAtomEscape(state)||this.regexp_eatCharacterClass(state)||this.regexp_eatUncapturingGroup(state)||this.regexp_eatCapturingGroup(state)};pp$8.regexp_eatReverseSolidusAtomEscape=function(state){var start=state.pos;if(state.eat(92)){if(this.regexp_eatAtomEscape(state)){return true}state.pos=start}return false};pp$8.regexp_eatUncapturingGroup=function(state){var start=state.pos;if(state.eat(40)){if(state.eat(63)&&state.eat(58)){this.regexp_disjunction(state);if(state.eat(41)){return true}state.raise("Unterminated group")}state.pos=start}return false};pp$8.regexp_eatCapturingGroup=function(state){if(state.eat(40)){if(this.options.ecmaVersion>=9){this.regexp_groupSpecifier(state)}else if(state.current()===63){state.raise("Invalid group")}this.regexp_disjunction(state);if(state.eat(41)){state.numCapturingParens+=1;return true}state.raise("Unterminated group")}return false};pp$8.regexp_eatExtendedAtom=function(state){return state.eat(46)||this.regexp_eatReverseSolidusAtomEscape(state)||this.regexp_eatCharacterClass(state)||this.regexp_eatUncapturingGroup(state)||this.regexp_eatCapturingGroup(state)||this.regexp_eatInvalidBracedQuantifier(state)||this.regexp_eatExtendedPatternCharacter(state)};pp$8.regexp_eatInvalidBracedQuantifier=function(state){if(this.regexp_eatBracedQuantifier(state,true)){state.raise("Nothing to repeat")}return false};pp$8.regexp_eatSyntaxCharacter=function(state){var ch=state.current();if(isSyntaxCharacter(ch)){state.lastIntValue=ch;state.advance();return true}return false};function isSyntaxCharacter(ch){return ch===36||ch>=40&&ch<=43||ch===46||ch===63||ch>=91&&ch<=94||ch>=123&&ch<=125}pp$8.regexp_eatPatternCharacters=function(state){var start=state.pos;var ch=0;while((ch=state.current())!==-1&&!isSyntaxCharacter(ch)){state.advance()}return state.pos!==start};pp$8.regexp_eatExtendedPatternCharacter=function(state){var ch=state.current();if(ch!==-1&&ch!==36&&!(ch>=40&&ch<=43)&&ch!==46&&ch!==63&&ch!==91&&ch!==94&&ch!==124){state.advance();return true}return false};pp$8.regexp_groupSpecifier=function(state){if(state.eat(63)){if(this.regexp_eatGroupName(state)){if(state.groupNames.indexOf(state.lastStringValue)!==-1){state.raise("Duplicate capture group name")}state.groupNames.push(state.lastStringValue);return}state.raise("Invalid group")}};pp$8.regexp_eatGroupName=function(state){state.lastStringValue="";if(state.eat(60)){if(this.regexp_eatRegExpIdentifierName(state)&&state.eat(62)){return true}state.raise("Invalid capture group name")}return false};pp$8.regexp_eatRegExpIdentifierName=function(state){state.lastStringValue="";if(this.regexp_eatRegExpIdentifierStart(state)){state.lastStringValue+=codePointToString(state.lastIntValue);while(this.regexp_eatRegExpIdentifierPart(state)){state.lastStringValue+=codePointToString(state.lastIntValue)}return true}return false};pp$8.regexp_eatRegExpIdentifierStart=function(state){var start=state.pos;var forceU=this.options.ecmaVersion>=11;var ch=state.current(forceU);state.advance(forceU);if(ch===92&&this.regexp_eatRegExpUnicodeEscapeSequence(state,forceU)){ch=state.lastIntValue}if(isRegExpIdentifierStart(ch)){state.lastIntValue=ch;return true}state.pos=start;return false};function isRegExpIdentifierStart(ch){return isIdentifierStart(ch,true)||ch===36||ch===95}pp$8.regexp_eatRegExpIdentifierPart=function(state){var start=state.pos;var forceU=this.options.ecmaVersion>=11;var ch=state.current(forceU);state.advance(forceU);if(ch===92&&this.regexp_eatRegExpUnicodeEscapeSequence(state,forceU)){ch=state.lastIntValue}if(isRegExpIdentifierPart(ch)){state.lastIntValue=ch;return true}state.pos=start;return false};function isRegExpIdentifierPart(ch){return isIdentifierChar(ch,true)||ch===36||ch===95||ch===8204||ch===8205}pp$8.regexp_eatAtomEscape=function(state){if(this.regexp_eatBackReference(state)||this.regexp_eatCharacterClassEscape(state)||this.regexp_eatCharacterEscape(state)||state.switchN&&this.regexp_eatKGroupName(state)){return true}if(state.switchU){if(state.current()===99){state.raise("Invalid unicode escape")}state.raise("Invalid escape")}return false};pp$8.regexp_eatBackReference=function(state){var start=state.pos;if(this.regexp_eatDecimalEscape(state)){var n=state.lastIntValue;if(state.switchU){if(n>state.maxBackReference){state.maxBackReference=n}return true}if(n<=state.numCapturingParens){return true}state.pos=start}return false};pp$8.regexp_eatKGroupName=function(state){if(state.eat(107)){if(this.regexp_eatGroupName(state)){state.backReferenceNames.push(state.lastStringValue);return true}state.raise("Invalid named reference")}return false};pp$8.regexp_eatCharacterEscape=function(state){return this.regexp_eatControlEscape(state)||this.regexp_eatCControlLetter(state)||this.regexp_eatZero(state)||this.regexp_eatHexEscapeSequence(state)||this.regexp_eatRegExpUnicodeEscapeSequence(state,false)||!state.switchU&&this.regexp_eatLegacyOctalEscapeSequence(state)||this.regexp_eatIdentityEscape(state)};pp$8.regexp_eatCControlLetter=function(state){var start=state.pos;if(state.eat(99)){if(this.regexp_eatControlLetter(state)){return true}state.pos=start}return false};pp$8.regexp_eatZero=function(state){if(state.current()===48&&!isDecimalDigit(state.lookahead())){state.lastIntValue=0;state.advance();return true}return false};pp$8.regexp_eatControlEscape=function(state){var ch=state.current();if(ch===116){state.lastIntValue=9;state.advance();return true}if(ch===110){state.lastIntValue=10;state.advance();return true}if(ch===118){state.lastIntValue=11;state.advance();return true}if(ch===102){state.lastIntValue=12;state.advance();return true}if(ch===114){state.lastIntValue=13;state.advance();return true}return false};pp$8.regexp_eatControlLetter=function(state){var ch=state.current();if(isControlLetter(ch)){state.lastIntValue=ch%32;state.advance();return true}return false};function isControlLetter(ch){return ch>=65&&ch<=90||ch>=97&&ch<=122}pp$8.regexp_eatRegExpUnicodeEscapeSequence=function(state,forceU){if(forceU===void 0)forceU=false;var start=state.pos;var switchU=forceU||state.switchU;if(state.eat(117)){if(this.regexp_eatFixedHexDigits(state,4)){var lead=state.lastIntValue;if(switchU&&lead>=55296&&lead<=56319){var leadSurrogateEnd=state.pos;if(state.eat(92)&&state.eat(117)&&this.regexp_eatFixedHexDigits(state,4)){var trail=state.lastIntValue;if(trail>=56320&&trail<=57343){state.lastIntValue=(lead-55296)*1024+(trail-56320)+65536;return true}}state.pos=leadSurrogateEnd;state.lastIntValue=lead}return true}if(switchU&&state.eat(123)&&this.regexp_eatHexDigits(state)&&state.eat(125)&&isValidUnicode(state.lastIntValue)){return true}if(switchU){state.raise("Invalid unicode escape")}state.pos=start}return false};function isValidUnicode(ch){return ch>=0&&ch<=1114111}pp$8.regexp_eatIdentityEscape=function(state){if(state.switchU){if(this.regexp_eatSyntaxCharacter(state)){return true}if(state.eat(47)){state.lastIntValue=47;return true}return false}var ch=state.current();if(ch!==99&&(!state.switchN||ch!==107)){state.lastIntValue=ch;state.advance();return true}return false};pp$8.regexp_eatDecimalEscape=function(state){state.lastIntValue=0;var ch=state.current();if(ch>=49&&ch<=57){do{state.lastIntValue=10*state.lastIntValue+(ch-48);state.advance()}while((ch=state.current())>=48&&ch<=57);return true}return false};pp$8.regexp_eatCharacterClassEscape=function(state){var ch=state.current();if(isCharacterClassEscape(ch)){state.lastIntValue=-1;state.advance();return true}if(state.switchU&&this.options.ecmaVersion>=9&&(ch===80||ch===112)){state.lastIntValue=-1;state.advance();if(state.eat(123)&&this.regexp_eatUnicodePropertyValueExpression(state)&&state.eat(125)){return true}state.raise("Invalid property name")}return false};function isCharacterClassEscape(ch){return ch===100||ch===68||ch===115||ch===83||ch===119||ch===87}pp$8.regexp_eatUnicodePropertyValueExpression=function(state){var start=state.pos;if(this.regexp_eatUnicodePropertyName(state)&&state.eat(61)){var name=state.lastStringValue;if(this.regexp_eatUnicodePropertyValue(state)){var value=state.lastStringValue;this.regexp_validateUnicodePropertyNameAndValue(state,name,value);return true}}state.pos=start;if(this.regexp_eatLoneUnicodePropertyNameOrValue(state)){var nameOrValue=state.lastStringValue;this.regexp_validateUnicodePropertyNameOrValue(state,nameOrValue);return true}return false};pp$8.regexp_validateUnicodePropertyNameAndValue=function(state,name,value){if(!has(state.unicodeProperties.nonBinary,name)){state.raise("Invalid property name")}if(!state.unicodeProperties.nonBinary[name].test(value)){state.raise("Invalid property value")}};pp$8.regexp_validateUnicodePropertyNameOrValue=function(state,nameOrValue){if(!state.unicodeProperties.binary.test(nameOrValue)){state.raise("Invalid property name")}};pp$8.regexp_eatUnicodePropertyName=function(state){var ch=0;state.lastStringValue="";while(isUnicodePropertyNameCharacter(ch=state.current())){state.lastStringValue+=codePointToString(ch);state.advance()}return state.lastStringValue!==""};function isUnicodePropertyNameCharacter(ch){return isControlLetter(ch)||ch===95}pp$8.regexp_eatUnicodePropertyValue=function(state){var ch=0;state.lastStringValue="";while(isUnicodePropertyValueCharacter(ch=state.current())){state.lastStringValue+=codePointToString(ch);state.advance()}return state.lastStringValue!==""};function isUnicodePropertyValueCharacter(ch){return isUnicodePropertyNameCharacter(ch)||isDecimalDigit(ch)}pp$8.regexp_eatLoneUnicodePropertyNameOrValue=function(state){return this.regexp_eatUnicodePropertyValue(state)};pp$8.regexp_eatCharacterClass=function(state){if(state.eat(91)){state.eat(94);this.regexp_classRanges(state);if(state.eat(93)){return true}state.raise("Unterminated character class")}return false};pp$8.regexp_classRanges=function(state){while(this.regexp_eatClassAtom(state)){var left=state.lastIntValue;if(state.eat(45)&&this.regexp_eatClassAtom(state)){var right=state.lastIntValue;if(state.switchU&&(left===-1||right===-1)){state.raise("Invalid character class")}if(left!==-1&&right!==-1&&left>right){state.raise("Range out of order in character class")}}}};pp$8.regexp_eatClassAtom=function(state){var start=state.pos;if(state.eat(92)){if(this.regexp_eatClassEscape(state)){return true}if(state.switchU){var ch$1=state.current();if(ch$1===99||isOctalDigit(ch$1)){state.raise("Invalid class escape")}state.raise("Invalid escape")}state.pos=start}var ch=state.current();if(ch!==93){state.lastIntValue=ch;state.advance();return true}return false};pp$8.regexp_eatClassEscape=function(state){var start=state.pos;if(state.eat(98)){state.lastIntValue=8;return true}if(state.switchU&&state.eat(45)){state.lastIntValue=45;return true}if(!state.switchU&&state.eat(99)){if(this.regexp_eatClassControlLetter(state)){return true}state.pos=start}return this.regexp_eatCharacterClassEscape(state)||this.regexp_eatCharacterEscape(state)};pp$8.regexp_eatClassControlLetter=function(state){var ch=state.current();if(isDecimalDigit(ch)||ch===95){state.lastIntValue=ch%32;state.advance();return true}return false};pp$8.regexp_eatHexEscapeSequence=function(state){var start=state.pos;if(state.eat(120)){if(this.regexp_eatFixedHexDigits(state,2)){return true}if(state.switchU){state.raise("Invalid escape")}state.pos=start}return false};pp$8.regexp_eatDecimalDigits=function(state){var start=state.pos;var ch=0;state.lastIntValue=0;while(isDecimalDigit(ch=state.current())){state.lastIntValue=10*state.lastIntValue+(ch-48);state.advance()}return state.pos!==start};function isDecimalDigit(ch){return ch>=48&&ch<=57}pp$8.regexp_eatHexDigits=function(state){var start=state.pos;var ch=0;state.lastIntValue=0;while(isHexDigit(ch=state.current())){state.lastIntValue=16*state.lastIntValue+hexToInt(ch);state.advance()}return state.pos!==start};function isHexDigit(ch){return ch>=48&&ch<=57||ch>=65&&ch<=70||ch>=97&&ch<=102}function hexToInt(ch){if(ch>=65&&ch<=70){return 10+(ch-65)}if(ch>=97&&ch<=102){return 10+(ch-97)}return ch-48}pp$8.regexp_eatLegacyOctalEscapeSequence=function(state){if(this.regexp_eatOctalDigit(state)){var n1=state.lastIntValue;if(this.regexp_eatOctalDigit(state)){var n2=state.lastIntValue;if(n1<=3&&this.regexp_eatOctalDigit(state)){state.lastIntValue=n1*64+n2*8+state.lastIntValue}else{state.lastIntValue=n1*8+n2}}else{state.lastIntValue=n1}return true}return false};pp$8.regexp_eatOctalDigit=function(state){var ch=state.current();if(isOctalDigit(ch)){state.lastIntValue=ch-48;state.advance();return true}state.lastIntValue=0;return false};function isOctalDigit(ch){return ch>=48&&ch<=55}pp$8.regexp_eatFixedHexDigits=function(state,length){var start=state.pos;state.lastIntValue=0;for(var i=0;i<length;++i){var ch=state.current();if(!isHexDigit(ch)){state.pos=start;return false}state.lastIntValue=16*state.lastIntValue+hexToInt(ch);state.advance()}return true};var Token=function Token(p){this.type=p.type;this.value=p.value;this.start=p.start;this.end=p.end;if(p.options.locations){this.loc=new SourceLocation(p,p.startLoc,p.endLoc)}if(p.options.ranges){this.range=[p.start,p.end]}};var pp$9=Parser.prototype;pp$9.next=function(ignoreEscapeSequenceInKeyword){if(!ignoreEscapeSequenceInKeyword&&this.type.keyword&&this.containsEsc){this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword)}if(this.options.onToken){this.options.onToken(new Token(this))}this.lastTokEnd=this.end;this.lastTokStart=this.start;this.lastTokEndLoc=this.endLoc;this.lastTokStartLoc=this.startLoc;this.nextToken()};pp$9.getToken=function(){this.next();return new Token(this)};if(typeof Symbol!=="undefined"){pp$9[Symbol.iterator]=function(){var this$1=this;return{next:function(){var token=this$1.getToken();return{done:token.type===types.eof,value:token}}}}}pp$9.curContext=function(){return this.context[this.context.length-1]};pp$9.nextToken=function(){var curContext=this.curContext();if(!curContext||!curContext.preserveSpace){this.skipSpace()}this.start=this.pos;if(this.options.locations){this.startLoc=this.curPosition()}if(this.pos>=this.input.length){return this.finishToken(types.eof)}if(curContext.override){return curContext.override(this)}else{this.readToken(this.fullCharCodeAtPos())}};pp$9.readToken=function(code){if(isIdentifierStart(code,this.options.ecmaVersion>=6)||code===92){return this.readWord()}return this.getTokenFromCode(code)};pp$9.fullCharCodeAtPos=function(){var code=this.input.charCodeAt(this.pos);if(code<=55295||code>=57344){return code}var next=this.input.charCodeAt(this.pos+1);return(code<<10)+next-56613888};pp$9.skipBlockComment=function(){var startLoc=this.options.onComment&&this.curPosition();var start=this.pos,end=this.input.indexOf("*/",this.pos+=2);if(end===-1){this.raise(this.pos-2,"Unterminated comment")}this.pos=end+2;if(this.options.locations){lineBreakG.lastIndex=start;var match;while((match=lineBreakG.exec(this.input))&&match.index<this.pos){++this.curLine;this.lineStart=match.index+match[0].length}}if(this.options.onComment){this.options.onComment(true,this.input.slice(start+2,end),start,this.pos,startLoc,this.curPosition())}};pp$9.skipLineComment=function(startSkip){var start=this.pos;var startLoc=this.options.onComment&&this.curPosition();var ch=this.input.charCodeAt(this.pos+=startSkip);while(this.pos<this.input.length&&!isNewLine(ch)){ch=this.input.charCodeAt(++this.pos)}if(this.options.onComment){this.options.onComment(false,this.input.slice(start+startSkip,this.pos),start,this.pos,startLoc,this.curPosition())}};pp$9.skipSpace=function(){loop:while(this.pos<this.input.length){var ch=this.input.charCodeAt(this.pos);switch(ch){case 32:case 160:++this.pos;break;case 13:if(this.input.charCodeAt(this.pos+1)===10){++this.pos}case 10:case 8232:case 8233:++this.pos;if(this.options.locations){++this.curLine;this.lineStart=this.pos}break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break loop}break;default:if(ch>8&&ch<14||ch>=5760&&nonASCIIwhitespace.test(String.fromCharCode(ch))){++this.pos}else{break loop}}}};pp$9.finishToken=function(type,val){this.end=this.pos;if(this.options.locations){this.endLoc=this.curPosition()}var prevType=this.type;this.type=type;this.value=val;this.updateContext(prevType)};pp$9.readToken_dot=function(){var next=this.input.charCodeAt(this.pos+1);if(next>=48&&next<=57){return this.readNumber(true)}var next2=this.input.charCodeAt(this.pos+2);if(this.options.ecmaVersion>=6&&next===46&&next2===46){this.pos+=3;return this.finishToken(types.ellipsis)}else{++this.pos;return this.finishToken(types.dot)}};pp$9.readToken_slash=function(){var next=this.input.charCodeAt(this.pos+1);if(this.exprAllowed){++this.pos;return this.readRegexp()}if(next===61){return this.finishOp(types.assign,2)}return this.finishOp(types.slash,1)};pp$9.readToken_mult_modulo_exp=function(code){var next=this.input.charCodeAt(this.pos+1);var size=1;var tokentype=code===42?types.star:types.modulo;if(this.options.ecmaVersion>=7&&code===42&&next===42){++size;tokentype=types.starstar;next=this.input.charCodeAt(this.pos+2)}if(next===61){return this.finishOp(types.assign,size+1)}return this.finishOp(tokentype,size)};pp$9.readToken_pipe_amp=function(code){var next=this.input.charCodeAt(this.pos+1);if(next===code){if(this.options.ecmaVersion>=12){var next2=this.input.charCodeAt(this.pos+2);if(next2===61){return this.finishOp(types.assign,3)}}return this.finishOp(code===124?types.logicalOR:types.logicalAND,2)}if(next===61){return this.finishOp(types.assign,2)}return this.finishOp(code===124?types.bitwiseOR:types.bitwiseAND,1)};pp$9.readToken_caret=function(){var next=this.input.charCodeAt(this.pos+1);if(next===61){return this.finishOp(types.assign,2)}return this.finishOp(types.bitwiseXOR,1)};pp$9.readToken_plus_min=function(code){var next=this.input.charCodeAt(this.pos+1);if(next===code){if(next===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||lineBreak.test(this.input.slice(this.lastTokEnd,this.pos)))){this.skipLineComment(3);this.skipSpace();return this.nextToken()}return this.finishOp(types.incDec,2)}if(next===61){return this.finishOp(types.assign,2)}return this.finishOp(types.plusMin,1)};pp$9.readToken_lt_gt=function(code){var next=this.input.charCodeAt(this.pos+1);var size=1;if(next===code){size=code===62&&this.input.charCodeAt(this.pos+2)===62?3:2;if(this.input.charCodeAt(this.pos+size)===61){return this.finishOp(types.assign,size+1)}return this.finishOp(types.bitShift,size)}if(next===33&&code===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45){this.skipLineComment(4);this.skipSpace();return this.nextToken()}if(next===61){size=2}return this.finishOp(types.relational,size)};pp$9.readToken_eq_excl=function(code){var next=this.input.charCodeAt(this.pos+1);if(next===61){return this.finishOp(types.equality,this.input.charCodeAt(this.pos+2)===61?3:2)}if(code===61&&next===62&&this.options.ecmaVersion>=6){this.pos+=2;return this.finishToken(types.arrow)}return this.finishOp(code===61?types.eq:types.prefix,1)};pp$9.readToken_question=function(){var ecmaVersion=this.options.ecmaVersion;if(ecmaVersion>=11){var next=this.input.charCodeAt(this.pos+1);if(next===46){var next2=this.input.charCodeAt(this.pos+2);if(next2<48||next2>57){return this.finishOp(types.questionDot,2)}}if(next===63){if(ecmaVersion>=12){var next2$1=this.input.charCodeAt(this.pos+2);if(next2$1===61){return this.finishOp(types.assign,3)}}return this.finishOp(types.coalesce,2)}}return this.finishOp(types.question,1)};pp$9.getTokenFromCode=function(code){switch(code){case 46:return this.readToken_dot();case 40:++this.pos;return this.finishToken(types.parenL);case 41:++this.pos;return this.finishToken(types.parenR);case 59:++this.pos;return this.finishToken(types.semi);case 44:++this.pos;return this.finishToken(types.comma);case 91:++this.pos;return this.finishToken(types.bracketL);case 93:++this.pos;return this.finishToken(types.bracketR);case 123:++this.pos;return this.finishToken(types.braceL);case 125:++this.pos;return this.finishToken(types.braceR);case 58:++this.pos;return this.finishToken(types.colon);case 96:if(this.options.ecmaVersion<6){break}++this.pos;return this.finishToken(types.backQuote);case 48:var next=this.input.charCodeAt(this.pos+1);if(next===120||next===88){return this.readRadixNumber(16)}if(this.options.ecmaVersion>=6){if(next===111||next===79){return this.readRadixNumber(8)}if(next===98||next===66){return this.readRadixNumber(2)}}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(false);case 34:case 39:return this.readString(code);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(code);case 124:case 38:return this.readToken_pipe_amp(code);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(code);case 60:case 62:return this.readToken_lt_gt(code);case 61:case 33:return this.readToken_eq_excl(code);case 63:return this.readToken_question();case 126:return this.finishOp(types.prefix,1)}this.raise(this.pos,"Unexpected character '"+codePointToString$1(code)+"'")};pp$9.finishOp=function(type,size){var str=this.input.slice(this.pos,this.pos+size);this.pos+=size;return this.finishToken(type,str)};pp$9.readRegexp=function(){var escaped,inClass,start=this.pos;for(;;){if(this.pos>=this.input.length){this.raise(start,"Unterminated regular expression")}var ch=this.input.charAt(this.pos);if(lineBreak.test(ch)){this.raise(start,"Unterminated regular expression")}if(!escaped){if(ch==="["){inClass=true}else if(ch==="]"&&inClass){inClass=false}else if(ch==="/"&&!inClass){break}escaped=ch==="\\"}else{escaped=false}++this.pos}var pattern=this.input.slice(start,this.pos);++this.pos;var flagsStart=this.pos;var flags=this.readWord1();if(this.containsEsc){this.unexpected(flagsStart)}var state=this.regexpState||(this.regexpState=new RegExpValidationState(this));state.reset(start,pattern,flags);this.validateRegExpFlags(state);this.validateRegExpPattern(state);var value=null;try{value=new RegExp(pattern,flags)}catch(e){}return this.finishToken(types.regexp,{pattern:pattern,flags:flags,value:value})};pp$9.readInt=function(radix,len,maybeLegacyOctalNumericLiteral){var allowSeparators=this.options.ecmaVersion>=12&&len===undefined;var isLegacyOctalNumericLiteral=maybeLegacyOctalNumericLiteral&&this.input.charCodeAt(this.pos)===48;var start=this.pos,total=0,lastCode=0;for(var i=0,e=len==null?Infinity:len;i<e;++i,++this.pos){var code=this.input.charCodeAt(this.pos),val=void 0;if(allowSeparators&&code===95){if(isLegacyOctalNumericLiteral){this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals")}if(lastCode===95){this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore")}if(i===0){this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits")}lastCode=code;continue}if(code>=97){val=code-97+10}else if(code>=65){val=code-65+10}else if(code>=48&&code<=57){val=code-48}else{val=Infinity}if(val>=radix){break}lastCode=code;total=total*radix+val}if(allowSeparators&&lastCode===95){this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits")}if(this.pos===start||len!=null&&this.pos-start!==len){return null}return total};function stringToNumber(str,isLegacyOctalNumericLiteral){if(isLegacyOctalNumericLiteral){return parseInt(str,8)}return parseFloat(str.replace(/_/g,""))}function stringToBigInt(str){if(typeof BigInt!=="function"){return null}return BigInt(str.replace(/_/g,""))}pp$9.readRadixNumber=function(radix){var start=this.pos;this.pos+=2;var val=this.readInt(radix);if(val==null){this.raise(this.start+2,"Expected number in radix "+radix)}if(this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110){val=stringToBigInt(this.input.slice(start,this.pos));++this.pos}else if(isIdentifierStart(this.fullCharCodeAtPos())){this.raise(this.pos,"Identifier directly after number")}return this.finishToken(types.num,val)};pp$9.readNumber=function(startsWithDot){var start=this.pos;if(!startsWithDot&&this.readInt(10,undefined,true)===null){this.raise(start,"Invalid number")}var octal=this.pos-start>=2&&this.input.charCodeAt(start)===48;if(octal&&this.strict){this.raise(start,"Invalid number")}var next=this.input.charCodeAt(this.pos);if(!octal&&!startsWithDot&&this.options.ecmaVersion>=11&&next===110){var val$1=stringToBigInt(this.input.slice(start,this.pos));++this.pos;if(isIdentifierStart(this.fullCharCodeAtPos())){this.raise(this.pos,"Identifier directly after number")}return this.finishToken(types.num,val$1)}if(octal&&/[89]/.test(this.input.slice(start,this.pos))){octal=false}if(next===46&&!octal){++this.pos;this.readInt(10);next=this.input.charCodeAt(this.pos)}if((next===69||next===101)&&!octal){next=this.input.charCodeAt(++this.pos);if(next===43||next===45){++this.pos}if(this.readInt(10)===null){this.raise(start,"Invalid number")}}if(isIdentifierStart(this.fullCharCodeAtPos())){this.raise(this.pos,"Identifier directly after number")}var val=stringToNumber(this.input.slice(start,this.pos),octal);return this.finishToken(types.num,val)};pp$9.readCodePoint=function(){var ch=this.input.charCodeAt(this.pos),code;if(ch===123){if(this.options.ecmaVersion<6){this.unexpected()}var codePos=++this.pos;code=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos);++this.pos;if(code>1114111){this.invalidStringToken(codePos,"Code point out of bounds")}}else{code=this.readHexChar(4)}return code};function codePointToString$1(code){if(code<=65535){return String.fromCharCode(code)}code-=65536;return String.fromCharCode((code>>10)+55296,(code&1023)+56320)}pp$9.readString=function(quote){var out="",chunkStart=++this.pos;for(;;){if(this.pos>=this.input.length){this.raise(this.start,"Unterminated string constant")}var ch=this.input.charCodeAt(this.pos);if(ch===quote){break}if(ch===92){out+=this.input.slice(chunkStart,this.pos);out+=this.readEscapedChar(false);chunkStart=this.pos}else{if(isNewLine(ch,this.options.ecmaVersion>=10)){this.raise(this.start,"Unterminated string constant")}++this.pos}}out+=this.input.slice(chunkStart,this.pos++);return this.finishToken(types.string,out)};var INVALID_TEMPLATE_ESCAPE_ERROR={};pp$9.tryReadTemplateToken=function(){this.inTemplateElement=true;try{this.readTmplToken()}catch(err){if(err===INVALID_TEMPLATE_ESCAPE_ERROR){this.readInvalidTemplateToken()}else{throw err}}this.inTemplateElement=false};pp$9.invalidStringToken=function(position,message){if(this.inTemplateElement&&this.options.ecmaVersion>=9){throw INVALID_TEMPLATE_ESCAPE_ERROR}else{this.raise(position,message)}};pp$9.readTmplToken=function(){var out="",chunkStart=this.pos;for(;;){if(this.pos>=this.input.length){this.raise(this.start,"Unterminated template")}var ch=this.input.charCodeAt(this.pos);if(ch===96||ch===36&&this.input.charCodeAt(this.pos+1)===123){if(this.pos===this.start&&(this.type===types.template||this.type===types.invalidTemplate)){if(ch===36){this.pos+=2;return this.finishToken(types.dollarBraceL)}else{++this.pos;return this.finishToken(types.backQuote)}}out+=this.input.slice(chunkStart,this.pos);return this.finishToken(types.template,out)}if(ch===92){out+=this.input.slice(chunkStart,this.pos);out+=this.readEscapedChar(true);chunkStart=this.pos}else if(isNewLine(ch)){out+=this.input.slice(chunkStart,this.pos);++this.pos;switch(ch){case 13:if(this.input.charCodeAt(this.pos)===10){++this.pos}case 10:out+="\n";break;default:out+=String.fromCharCode(ch);break}if(this.options.locations){++this.curLine;this.lineStart=this.pos}chunkStart=this.pos}else{++this.pos}}};pp$9.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++){switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{"){break}case"`":return this.finishToken(types.invalidTemplate,this.input.slice(this.start,this.pos))}}this.raise(this.start,"Unterminated template")};pp$9.readEscapedChar=function(inTemplate){var ch=this.input.charCodeAt(++this.pos);++this.pos;switch(ch){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString$1(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:if(this.input.charCodeAt(this.pos)===10){++this.pos}case 10:if(this.options.locations){this.lineStart=this.pos;++this.curLine}return"";case 56:case 57:if(this.strict){this.invalidStringToken(this.pos-1,"Invalid escape sequence")}if(inTemplate){var codePos=this.pos-1;this.invalidStringToken(codePos,"Invalid escape sequence in template string");return null}default:if(ch>=48&&ch<=55){var octalStr=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0];var octal=parseInt(octalStr,8);if(octal>255){octalStr=octalStr.slice(0,-1);octal=parseInt(octalStr,8)}this.pos+=octalStr.length-1;ch=this.input.charCodeAt(this.pos);if((octalStr!=="0"||ch===56||ch===57)&&(this.strict||inTemplate)){this.invalidStringToken(this.pos-1-octalStr.length,inTemplate?"Octal literal in template string":"Octal literal in strict mode")}return String.fromCharCode(octal)}if(isNewLine(ch)){return""}return String.fromCharCode(ch)}};pp$9.readHexChar=function(len){var codePos=this.pos;var n=this.readInt(16,len);if(n===null){this.invalidStringToken(codePos,"Bad character escape sequence")}return n};pp$9.readWord1=function(){this.containsEsc=false;var word="",first=true,chunkStart=this.pos;var astral=this.options.ecmaVersion>=6;while(this.pos<this.input.length){var ch=this.fullCharCodeAtPos();if(isIdentifierChar(ch,astral)){this.pos+=ch<=65535?1:2}else if(ch===92){this.containsEsc=true;word+=this.input.slice(chunkStart,this.pos);var escStart=this.pos;if(this.input.charCodeAt(++this.pos)!==117){this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX")}++this.pos;var esc=this.readCodePoint();if(!(first?isIdentifierStart:isIdentifierChar)(esc,astral)){this.invalidStringToken(escStart,"Invalid Unicode escape")}word+=codePointToString$1(esc);chunkStart=this.pos}else{break}first=false}return word+this.input.slice(chunkStart,this.pos)};pp$9.readWord=function(){var word=this.readWord1();var type=types.name;if(this.keywords.test(word)){type=keywords$1[word]}return this.finishToken(type,word)};var version="8.0.4";Parser.acorn={Parser:Parser,version:version,defaultOptions:defaultOptions,Position:Position,SourceLocation:SourceLocation,getLineInfo:getLineInfo,Node:Node,TokenType:TokenType,tokTypes:types,keywordTypes:keywords$1,TokContext:TokContext,tokContexts:types$1,isIdentifierChar:isIdentifierChar,isIdentifierStart:isIdentifierStart,Token:Token,isNewLine:isNewLine,lineBreak:lineBreak,lineBreakG:lineBreakG,nonASCIIwhitespace:nonASCIIwhitespace};function parse(input,options){return Parser.parse(input,options)}function parseExpressionAt(input,pos,options){return Parser.parseExpressionAt(input,pos,options)}function tokenizer(input,options){return Parser.tokenizer(input,options)}exports.Node=Node;exports.Parser=Parser;exports.Position=Position;exports.SourceLocation=SourceLocation;exports.TokContext=TokContext;exports.Token=Token;exports.TokenType=TokenType;exports.defaultOptions=defaultOptions;exports.getLineInfo=getLineInfo;exports.isIdentifierChar=isIdentifierChar;exports.isIdentifierStart=isIdentifierStart;exports.isNewLine=isNewLine;exports.keywordTypes=keywords$1;exports.lineBreak=lineBreak;exports.lineBreakG=lineBreakG;exports.nonASCIIwhitespace=nonASCIIwhitespace;exports.parse=parse;exports.parseExpressionAt=parseExpressionAt;exports.tokContexts=types$1;exports.tokTypes=types;exports.tokenizer=tokenizer;exports.version=version;Object.defineProperty(exports,"__esModule",{value:true})}))},{}],15:[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;if(err){bail=true;callback(err);callback=err_cb}else if(proxy.count===0&&!bail){callback(null,result)}}}function noop(){}},{}],16:[function(require,module,exports){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}},{}],17:[function(require,module,exports){(function(global,factory){if(typeof define==="function"&&define.amd){define(["exports","./defaultTraveler","./attachComments"],factory)}else if(typeof exports!=="undefined"){factory(exports,require("./defaultTraveler"),require("./attachComments"))}else{var mod={exports:{}};factory(mod.exports,global.defaultTraveler,global.attachComments);global.astravel=mod.exports}})(this,(function(exports,_defaultTraveler,_attachComments){"use strict";exports.__esModule=true;exports.makeTraveler=exports.attachComments=exports.defaultTraveler=undefined;var _defaultTraveler2=_interopRequireDefault(_defaultTraveler);var _attachComments2=_interopRequireDefault(_attachComments);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function makeTraveler(properties){return _defaultTraveler2.default.makeChild(properties)}exports.defaultTraveler=_defaultTraveler2.default;exports.attachComments=_attachComments2.default;exports.makeTraveler=makeTraveler}))},{"./attachComments":18,"./defaultTraveler":19}],18:[function(require,module,exports){(function(global,factory){if(typeof define==="function"&&define.amd){define(["exports","./defaultTraveler"],factory)}else if(typeof exports!=="undefined"){factory(exports,require("./defaultTraveler"))}else{var mod={exports:{}};factory(mod.exports,global.defaultTraveler);global.attachComments=mod.exports}})(this,(function(exports,_defaultTraveler){"use strict";exports.__esModule=true;exports.default=function(node,comments){customTraveler[node.type](node,{comments:comments,index:0});return node};var _defaultTraveler2=_interopRequireDefault(_defaultTraveler);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function attachComments(parent,children,findHeadingComments,state,traveler){var index=state.index,comments=state.comments;var comment=comments[index];var boundComments=void 0,trailingComments=void 0;if(comment!=null){if(children==null||children.length===0){boundComments=parent.comments!=null?parent.comments:[];while(comment!=null&&comment.end<parent.end){boundComments.push(comment);comment=comments[++index]}state.index=index;if(boundComments.length!==0&&parent.comments==null)parent.comments=boundComments}else{if(findHeadingComments){boundComments=parent.comments!=null?parent.comments:[];var start=children[0].start;while(comment!=null&&comment.type[0]==="B"&&comment.end<start){boundComments.push(comment);comment=comments[++index]}if(boundComments.length!==0&&parent.comments==null)parent.comments=boundComments}for(var i=0,length=children.length;comment!=null&&i<length;i++){var child=children[i];boundComments=[];while(comment!=null&&comment.end<child.start){boundComments.push(comment);comment=comments[++index]}if(comment!=null&&comment.type[0]==="L"){if(comment.loc.start.line===child.loc.end.line){boundComments.push(comment);comment=comments[++index]}}if(boundComments.length!==0)child.comments=boundComments;state.index=index;traveler[child.type](child,state);index=state.index;comment=comments[index]}trailingComments=[];while(comment!=null&&comment.end<parent.end){trailingComments.push(comment);comment=comments[++index]}if(trailingComments.length!==0)parent.trailingComments=trailingComments;state.index=index}}}var Program=void 0;var customTraveler=_defaultTraveler2.default.makeChild({Program:Program=function Program(node,state){attachComments(node,node.body,true,state,this)},BlockStatement:Program,ObjectExpression:function ObjectExpression(node,state){attachComments(node,node.properties,true,state,this)},ArrayExpression:function ArrayExpression(node,state){attachComments(node,node.elements,true,state,this)},SwitchStatement:function SwitchStatement(node,state){attachComments(node,node.cases,false,state,this)},SwitchCase:function SwitchCase(node,state){attachComments(node,node.consequent,false,state,this)}})}))},{"./defaultTraveler":19}],19:[function(require,module,exports){(function(global,factory){if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports!=="undefined"){factory(exports)}else{var mod={exports:{}};factory(mod.exports);global.defaultTraveler=mod.exports}})(this,(function(exports){"use strict";exports.__esModule=true;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var ForInStatement=void 0,FunctionDeclaration=void 0,RestElement=void 0,BinaryExpression=void 0,ArrayExpression=void 0;var ignore=Function.prototype;var Found=function Found(node,state){_classCallCheck(this,Found);this.node=node;this.state=state};exports.default={go:function go(node,state){this[node.type](node,state)},find:function find(predicate,node,state){var finder=Object.create(this);finder.go=function(node,state){if(predicate(node,state)){throw new Found(node,state)}this[node.type](node,state)};try{finder.go(node,state)}catch(error){if(error instanceof Found){return error}else{throw error}}},makeChild:function makeChild(){var properties=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var traveler=Object.create(this);traveler.super=this;for(var key in properties){traveler[key]=properties[key]}return traveler},Program:function Program(node,state){var statements=node.body,length=statements.length;for(var i=0;i<length;i++){this.go(statements[i],state)}},BlockStatement:function BlockStatement(node,state){var statements=node.body;if(statements!=null){for(var i=0,length=statements.length;i<length;i++){this.go(statements[i],state)}}},EmptyStatement:ignore,ExpressionStatement:function ExpressionStatement(node,state){this.go(node.expression,state)},IfStatement:function IfStatement(node,state){this.go(node.test,state);this.go(node.consequent,state);if(node.alternate!=null){this.go(node.alternate,state)}},LabeledStatement:function LabeledStatement(node,state){this.go(node.label,state);this.go(node.body,state)},BreakStatement:function BreakStatement(node,state){if(node.label){this.go(node.label,state)}},ContinueStatement:function ContinueStatement(node,state){if(node.label){this.go(node.label,state)}},WithStatement:function WithStatement(node,state){this.go(node.object,state);this.go(node.body,state)},SwitchStatement:function SwitchStatement(node,state){this.go(node.discriminant,state);var cases=node.cases,length=cases.length;for(var i=0;i<length;i++){this.go(cases[i],state)}},SwitchCase:function SwitchCase(node,state){if(node.test!=null){this.go(node.test,state)}var statements=node.consequent,length=statements.length;for(var i=0;i<length;i++){this.go(statements[i],state)}},ReturnStatement:function ReturnStatement(node,state){if(node.argument){this.go(node.argument,state)}},ThrowStatement:function ThrowStatement(node,state){this.go(node.argument,state)},TryStatement:function TryStatement(node,state){this.go(node.block,state);if(node.handler!=null){this.go(node.handler,state)}if(node.finalizer!=null){this.go(node.finalizer,state)}},CatchClause:function CatchClause(node,state){if(node.param!=null){this.go(node.param,state)}this.go(node.body,state)},WhileStatement:function WhileStatement(node,state){this.go(node.test,state);this.go(node.body,state)},DoWhileStatement:function DoWhileStatement(node,state){this.go(node.body,state);this.go(node.test,state)},ForStatement:function ForStatement(node,state){if(node.init!=null){this.go(node.init,state)}if(node.test!=null){this.go(node.test,state)}if(node.update!=null){this.go(node.update,state)}this.go(node.body,state)},ForInStatement:ForInStatement=function ForInStatement(node,state){this.go(node.left,state);this.go(node.right,state);this.go(node.body,state)},DebuggerStatement:ignore,FunctionDeclaration:FunctionDeclaration=function FunctionDeclaration(node,state){if(node.id!=null){this.go(node.id,state)}var params=node.params;if(params!=null){for(var i=0,length=params.length;i<length;i++){this.go(params[i],state)}}this.go(node.body,state)},VariableDeclaration:function VariableDeclaration(node,state){var declarations=node.declarations,length=declarations.length;for(var i=0;i<length;i++){this.go(declarations[i],state)}},VariableDeclarator:function VariableDeclarator(node,state){this.go(node.id,state);if(node.init!=null){this.go(node.init,state)}},ArrowFunctionExpression:function ArrowFunctionExpression(node,state){var params=node.params;if(params!=null){for(var i=0,length=params.length;i<length;i++){this.go(params[i],state)}}this.go(node.body,state)},ThisExpression:ignore,ArrayExpression:ArrayExpression=function ArrayExpression(node,state){var elements=node.elements,length=elements.length;for(var i=0;i<length;i++){var element=elements[i];if(element!=null){this.go(elements[i],state)}}},ObjectExpression:function ObjectExpression(node,state){var properties=node.properties,length=properties.length;for(var i=0;i<length;i++){this.go(properties[i],state)}},Property:function Property(node,state){this.go(node.key,state);if(!node.shorthand){this.go(node.value,state)}},FunctionExpression:FunctionDeclaration,SequenceExpression:function SequenceExpression(node,state){var expressions=node.expressions,length=expressions.length;for(var i=0;i<length;i++){this.go(expressions[i],state)}},UnaryExpression:function UnaryExpression(node,state){this.go(node.argument,state)},UpdateExpression:function UpdateExpression(node,state){this.go(node.argument,state)},AssignmentExpression:function AssignmentExpression(node,state){this.go(node.left,state);this.go(node.right,state)},BinaryExpression:BinaryExpression=function BinaryExpression(node,state){this.go(node.left,state);this.go(node.right,state)},LogicalExpression:BinaryExpression,ConditionalExpression:function ConditionalExpression(node,state){this.go(node.test,state);this.go(node.consequent,state);this.go(node.alternate,state)},NewExpression:function NewExpression(node,state){this.CallExpression(node,state)},CallExpression:function CallExpression(node,state){this.go(node.callee,state);var args=node["arguments"],length=args.length;for(var i=0;i<length;i++){this.go(args[i],state)}},MemberExpression:function MemberExpression(node,state){this.go(node.object,state);this.go(node.property,state)},Identifier:ignore,Literal:ignore,ForOfStatement:ForInStatement,ClassDeclaration:function ClassDeclaration(node,state){if(node.id){this.go(node.id,state)}if(node.superClass){this.go(node.superClass,state)}this.go(node.body,state)},ClassBody:function ClassBody(node,state){var body=node.body,length=body.length;for(var i=0;i<length;i++){this.go(body[i],state)}},ImportDeclaration:function ImportDeclaration(node,state){var specifiers=node.specifiers,length=specifiers.length;for(var i=0;i<length;i++){this.go(specifiers[i],state)}this.go(node.source,state)},ImportNamespaceSpecifier:function ImportNamespaceSpecifier(node,state){this.go(node.local,state)},ImportDefaultSpecifier:function ImportDefaultSpecifier(node,state){this.go(node.local,state)},ImportSpecifier:function ImportSpecifier(node,state){this.go(node.imported,state);this.go(node.local,state)},ExportDefaultDeclaration:function ExportDefaultDeclaration(node,state){this.go(node.declaration,state)},ExportNamedDeclaration:function ExportNamedDeclaration(node,state){if(node.declaration){this.go(node.declaration,state)}var specifiers=node.specifiers,length=specifiers.length;for(var i=0;i<length;i++){this.go(specifiers[i],state)}if(node.source){this.go(node.source,state)}},ExportSpecifier:function ExportSpecifier(node,state){this.go(node.local,state);this.go(node.exported,state)},ExportAllDeclaration:function ExportAllDeclaration(node,state){this.go(node.source,state)},MethodDefinition:function MethodDefinition(node,state){this.go(node.key,state);this.go(node.value,state)},ClassExpression:function ClassExpression(node,state){this.ClassDeclaration(node,state)},Super:ignore,RestElement:RestElement=function RestElement(node,state){this.go(node.argument,state)},SpreadElement:RestElement,YieldExpression:function YieldExpression(node,state){if(node.argument){this.go(node.argument,state)}},TaggedTemplateExpression:function TaggedTemplateExpression(node,state){this.go(node.tag,state);this.go(node.quasi,state)},TemplateLiteral:function TemplateLiteral(node,state){var quasis=node.quasis,expressions=node.expressions;for(var i=0,length=expressions.length;i<length;i++){this.go(expressions[i],state)}for(var _i=0,_length=quasis.length;_i<_length;_i++){this.go(quasis[_i],state)}},TemplateElement:ignore,ObjectPattern:function ObjectPattern(node,state){var properties=node.properties,length=properties.length;for(var i=0;i<length;i++){this.go(properties[i],state)}},ArrayPattern:ArrayExpression,AssignmentPattern:function AssignmentPattern(node,state){this.go(node.left,state);this.go(node.right,state)},MetaProperty:function MetaProperty(node,state){this.go(node.meta,state);this.go(node.property,state)},AwaitExpression:function AwaitExpression(node,state){this.go(node.argument,state)}}}))},{}],20:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.generate=generate;exports.baseGenerator=void 0;function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor}var stringify=JSON.stringify;if(!String.prototype.repeat){throw new Error("String.prototype.repeat is undefined, see https://github.com/davidbonnet/astring#installation")}if(!String.prototype.endsWith){throw new Error("String.prototype.endsWith is undefined, see https://github.com/davidbonnet/astring#installation")}var OPERATOR_PRECEDENCE={"||":3,"&&":4,"|":5,"^":6,"&":7,"==":8,"!=":8,"===":8,"!==":8,"<":9,">":9,"<=":9,">=":9,in:9,instanceof:9,"<<":10,">>":10,">>>":10,"+":11,"-":11,"*":12,"%":12,"/":12,"**":13};var NEEDS_PARENTHESES=17;var EXPRESSIONS_PRECEDENCE={ArrayExpression:20,TaggedTemplateExpression:20,ThisExpression:20,Identifier:20,Literal:18,TemplateLiteral:20,Super:20,SequenceExpression:20,MemberExpression:19,CallExpression:19,NewExpression:19,ArrowFunctionExpression:NEEDS_PARENTHESES,ClassExpression:NEEDS_PARENTHESES,FunctionExpression:NEEDS_PARENTHESES,ObjectExpression:NEEDS_PARENTHESES,UpdateExpression:16,UnaryExpression:15,BinaryExpression:14,LogicalExpression:13,ConditionalExpression:4,AssignmentExpression:3,AwaitExpression:2,YieldExpression:2,RestElement:1};function formatSequence(state,nodes){var generator=state.generator;state.write("(");if(nodes!=null&&nodes.length>0){generator[nodes[0].type](nodes[0],state);var length=nodes.length;for(var i=1;i<length;i++){var param=nodes[i];state.write(", ");generator[param.type](param,state)}}state.write(")")}function expressionNeedsParenthesis(node,parentNode,isRightHand){var nodePrecedence=EXPRESSIONS_PRECEDENCE[node.type];if(nodePrecedence===NEEDS_PARENTHESES){return true}var parentNodePrecedence=EXPRESSIONS_PRECEDENCE[parentNode.type];if(nodePrecedence!==parentNodePrecedence){return nodePrecedence<parentNodePrecedence}if(nodePrecedence!==13&&nodePrecedence!==14){return false}if(node.operator==="**"&&parentNode.operator==="**"){return!isRightHand}if(isRightHand){return OPERATOR_PRECEDENCE[node.operator]<=OPERATOR_PRECEDENCE[parentNode.operator]}return OPERATOR_PRECEDENCE[node.operator]<OPERATOR_PRECEDENCE[parentNode.operator]}function formatBinaryExpressionPart(state,node,parentNode,isRightHand){var generator=state.generator;if(expressionNeedsParenthesis(node,parentNode,isRightHand)){state.write("(");generator[node.type](node,state);state.write(")")}else{generator[node.type](node,state)}}function reindent(state,text,indent,lineEnd){var lines=text.split("\n");var end=lines.length-1;state.write(lines[0].trim());if(end>0){state.write(lineEnd);for(var i=1;i<end;i++){state.write(indent+lines[i].trim()+lineEnd)}state.write(indent+lines[end].trim())}}function formatComments(state,comments,indent,lineEnd){var length=comments.length;for(var i=0;i<length;i++){var comment=comments[i];state.write(indent);if(comment.type[0]==="L"){state.write("// "+comment.value.trim()+"\n")}else{state.write("/*");reindent(state,comment.value,indent,lineEnd);state.write("*/"+lineEnd)}}}function hasCallExpression(node){var currentNode=node;while(currentNode!=null){var _currentNode=currentNode,type=_currentNode.type;if(type[0]==="C"&&type[1]==="a"){return true}else if(type[0]==="M"&&type[1]==="e"&&type[2]==="m"){currentNode=currentNode.object}else{return false}}}function formatVariableDeclaration(state,node){var generator=state.generator;var declarations=node.declarations;state.write(node.kind+" ");var length=declarations.length;if(length>0){generator.VariableDeclarator(declarations[0],state);for(var i=1;i<length;i++){state.write(", ");generator.VariableDeclarator(declarations[i],state)}}}var ForInStatement,FunctionDeclaration,RestElement,BinaryExpression,ArrayExpression,BlockStatement;var baseGenerator={Program:function Program(node,state){var indent=state.indent.repeat(state.indentLevel);var lineEnd=state.lineEnd,writeComments=state.writeComments;if(writeComments&&node.comments!=null){formatComments(state,node.comments,indent,lineEnd)}var statements=node.body;var length=statements.length;for(var i=0;i<length;i++){var statement=statements[i];if(writeComments&&statement.comments!=null){formatComments(state,statement.comments,indent,lineEnd)}state.write(indent);this[statement.type](statement,state);state.write(lineEnd)}if(writeComments&&node.trailingComments!=null){formatComments(state,node.trailingComments,indent,lineEnd)}},BlockStatement:BlockStatement=function BlockStatement(node,state){var indent=state.indent.repeat(state.indentLevel++);var lineEnd=state.lineEnd,writeComments=state.writeComments;var statementIndent=indent+state.indent;state.write("{");var statements=node.body;if(statements!=null&&statements.length>0){state.write(lineEnd);if(writeComments&&node.comments!=null){formatComments(state,node.comments,statementIndent,lineEnd)}var length=statements.length;for(var i=0;i<length;i++){var statement=statements[i];if(writeComments&&statement.comments!=null){formatComments(state,statement.comments,statementIndent,lineEnd)}state.write(statementIndent);this[statement.type](statement,state);state.write(lineEnd)}state.write(indent)}else{if(writeComments&&node.comments!=null){state.write(lineEnd);formatComments(state,node.comments,statementIndent,lineEnd);state.write(indent)}}if(writeComments&&node.trailingComments!=null){formatComments(state,node.trailingComments,statementIndent,lineEnd)}state.write("}");state.indentLevel--},ClassBody:BlockStatement,EmptyStatement:function EmptyStatement(node,state){state.write(";")},ExpressionStatement:function ExpressionStatement(node,state){var precedence=EXPRESSIONS_PRECEDENCE[node.expression.type];if(precedence===NEEDS_PARENTHESES||precedence===3&&node.expression.left.type[0]==="O"){state.write("(");this[node.expression.type](node.expression,state);state.write(")")}else{this[node.expression.type](node.expression,state)}state.write(";")},IfStatement:function IfStatement(node,state){state.write("if (");this[node.test.type](node.test,state);state.write(") ");this[node.consequent.type](node.consequent,state);if(node.alternate!=null){state.write(" else ");this[node.alternate.type](node.alternate,state)}},LabeledStatement:function LabeledStatement(node,state){this[node.label.type](node.label,state);state.write(": ");this[node.body.type](node.body,state)},BreakStatement:function BreakStatement(node,state){state.write("break");if(node.label!=null){state.write(" ");this[node.label.type](node.label,state)}state.write(";")},ContinueStatement:function ContinueStatement(node,state){state.write("continue");if(node.label!=null){state.write(" ");this[node.label.type](node.label,state)}state.write(";")},WithStatement:function WithStatement(node,state){state.write("with (");this[node.object.type](node.object,state);state.write(") ");this[node.body.type](node.body,state)},SwitchStatement:function SwitchStatement(node,state){var indent=state.indent.repeat(state.indentLevel++);var lineEnd=state.lineEnd,writeComments=state.writeComments;state.indentLevel++;var caseIndent=indent+state.indent;var statementIndent=caseIndent+state.indent;state.write("switch (");this[node.discriminant.type](node.discriminant,state);state.write(") {"+lineEnd);var occurences=node.cases;var occurencesCount=occurences.length;for(var i=0;i<occurencesCount;i++){var occurence=occurences[i];if(writeComments&&occurence.comments!=null){formatComments(state,occurence.comments,caseIndent,lineEnd)}if(occurence.test){state.write(caseIndent+"case ");this[occurence.test.type](occurence.test,state);state.write(":"+lineEnd)}else{state.write(caseIndent+"default:"+lineEnd)}var consequent=occurence.consequent;var consequentCount=consequent.length;for(var _i=0;_i<consequentCount;_i++){var statement=consequent[_i];if(writeComments&&statement.comments!=null){formatComments(state,statement.comments,statementIndent,lineEnd)}state.write(statementIndent);this[statement.type](statement,state);state.write(lineEnd)}}state.indentLevel-=2;state.write(indent+"}")},ReturnStatement:function ReturnStatement(node,state){state.write("return");if(node.argument){state.write(" ");this[node.argument.type](node.argument,state)}state.write(";")},ThrowStatement:function ThrowStatement(node,state){state.write("throw ");this[node.argument.type](node.argument,state);state.write(";")},TryStatement:function TryStatement(node,state){state.write("try ");this[node.block.type](node.block,state);if(node.handler){var handler=node.handler;if(handler.param==null){state.write(" catch ")}else{state.write(" catch (");this[handler.param.type](handler.param,state);state.write(") ")}this[handler.body.type](handler.body,state)}if(node.finalizer){state.write(" finally ");this[node.finalizer.type](node.finalizer,state)}},WhileStatement:function WhileStatement(node,state){state.write("while (");this[node.test.type](node.test,state);state.write(") ");this[node.body.type](node.body,state)},DoWhileStatement:function DoWhileStatement(node,state){state.write("do ");this[node.body.type](node.body,state);state.write(" while (");this[node.test.type](node.test,state);state.write(");")},ForStatement:function ForStatement(node,state){state.write("for (");if(node.init!=null){var init=node.init;if(init.type[0]==="V"){formatVariableDeclaration(state,init)}else{this[init.type](init,state)}}state.write("; ");if(node.test){this[node.test.type](node.test,state)}state.write("; ");if(node.update){this[node.update.type](node.update,state)}state.write(") ");this[node.body.type](node.body,state)},ForInStatement:ForInStatement=function ForInStatement(node,state){state.write("for ".concat(node.await?"await ":"","("));var left=node.left;if(left.type[0]==="V"){formatVariableDeclaration(state,left)}else{this[left.type](left,state)}state.write(node.type[3]==="I"?" in ":" of ");this[node.right.type](node.right,state);state.write(") ");this[node.body.type](node.body,state)},ForOfStatement:ForInStatement,DebuggerStatement:function DebuggerStatement(node,state){state.write("debugger;"+state.lineEnd)},FunctionDeclaration:FunctionDeclaration=function FunctionDeclaration(node,state){state.write((node.async?"async ":"")+(node.generator?"function* ":"function ")+(node.id?node.id.name:""),node);formatSequence(state,node.params);state.write(" ");this[node.body.type](node.body,state)},FunctionExpression:FunctionDeclaration,VariableDeclaration:function VariableDeclaration(node,state){formatVariableDeclaration(state,node);state.write(";")},VariableDeclarator:function VariableDeclarator(node,state){this[node.id.type](node.id,state);if(node.init!=null){state.write(" = ");this[node.init.type](node.init,state)}},ClassDeclaration:function ClassDeclaration(node,state){state.write("class "+(node.id?"".concat(node.id.name," "):""),node);if(node.superClass){state.write("extends ");this[node.superClass.type](node.superClass,state);state.write(" ")}this.ClassBody(node.body,state)},ImportDeclaration:function ImportDeclaration(node,state){state.write("import ");var specifiers=node.specifiers;var length=specifiers.length;var i=0;if(length>0){for(;i<length;){if(i>0){state.write(", ")}var specifier=specifiers[i];var type=specifier.type[6];if(type==="D"){state.write(specifier.local.name,specifier);i++}else if(type==="N"){state.write("* as "+specifier.local.name,specifier);i++}else{break}}if(i<length){state.write("{");for(;;){var _specifier=specifiers[i];var name=_specifier.imported.name;state.write(name,_specifier);if(name!==_specifier.local.name){state.write(" as "+_specifier.local.name)}if(++i<length){state.write(", ")}else{break}}state.write("}")}state.write(" from ")}this.Literal(node.source,state);state.write(";")},ExportDefaultDeclaration:function ExportDefaultDeclaration(node,state){state.write("export default ");this[node.declaration.type](node.declaration,state);if(EXPRESSIONS_PRECEDENCE[node.declaration.type]&&node.declaration.type[0]!=="F"){state.write(";")}},ExportNamedDeclaration:function ExportNamedDeclaration(node,state){state.write("export ");if(node.declaration){this[node.declaration.type](node.declaration,state)}else{state.write("{");var specifiers=node.specifiers,length=specifiers.length;if(length>0){for(var i=0;;){var specifier=specifiers[i];var name=specifier.local.name;state.write(name,specifier);if(name!==specifier.exported.name){state.write(" as "+specifier.exported.name)}if(++i<length){state.write(", ")}else{break}}}state.write("}");if(node.source){state.write(" from ");this.Literal(node.source,state)}state.write(";")}},ExportAllDeclaration:function ExportAllDeclaration(node,state){state.write("export * from ");this.Literal(node.source,state);state.write(";")},MethodDefinition:function MethodDefinition(node,state){if(node.static){state.write("static ")}var kind=node.kind[0];if(kind==="g"||kind==="s"){state.write(node.kind+" ")}if(node.value.async){state.write("async ")}if(node.value.generator){state.write("*")}if(node.computed){state.write("[");this[node.key.type](node.key,state);state.write("]")}else{this[node.key.type](node.key,state)}formatSequence(state,node.value.params);state.write(" ");this[node.value.body.type](node.value.body,state)},ClassExpression:function ClassExpression(node,state){this.ClassDeclaration(node,state)},ArrowFunctionExpression:function ArrowFunctionExpression(node,state){state.write(node.async?"async ":"",node);var params=node.params;if(params!=null){if(params.length===1&&params[0].type[0]==="I"){state.write(params[0].name,params[0])}else{formatSequence(state,node.params)}}state.write(" => ");if(node.body.type[0]==="O"){state.write("(");this.ObjectExpression(node.body,state);state.write(")")}else{this[node.body.type](node.body,state)}},ThisExpression:function ThisExpression(node,state){state.write("this",node)},Super:function Super(node,state){state.write("super",node)},RestElement:RestElement=function RestElement(node,state){state.write("...");this[node.argument.type](node.argument,state)},SpreadElement:RestElement,YieldExpression:function YieldExpression(node,state){state.write(node.delegate?"yield*":"yield");if(node.argument){state.write(" ");this[node.argument.type](node.argument,state)}},AwaitExpression:function AwaitExpression(node,state){state.write("await ");if(node.argument){this[node.argument.type](node.argument,state)}},TemplateLiteral:function TemplateLiteral(node,state){var quasis=node.quasis,expressions=node.expressions;state.write("`");var length=expressions.length;for(var i=0;i<length;i++){var expression=expressions[i];state.write(quasis[i].value.raw);state.write("${");this[expression.type](expression,state);state.write("}")}state.write(quasis[quasis.length-1].value.raw);state.write("`")},TaggedTemplateExpression:function TaggedTemplateExpression(node,state){this[node.tag.type](node.tag,state);this[node.quasi.type](node.quasi,state)},ArrayExpression:ArrayExpression=function ArrayExpression(node,state){state.write("[");if(node.elements.length>0){var elements=node.elements,length=elements.length;for(var i=0;;){var element=elements[i];if(element!=null){this[element.type](element,state)}if(++i<length){state.write(", ")}else{if(element==null){state.write(", ")}break}}}state.write("]")},ArrayPattern:ArrayExpression,ObjectExpression:function ObjectExpression(node,state){var indent=state.indent.repeat(state.indentLevel++);var lineEnd=state.lineEnd,writeComments=state.writeComments;var propertyIndent=indent+state.indent;state.write("{");if(node.properties.length>0){state.write(lineEnd);if(writeComments&&node.comments!=null){formatComments(state,node.comments,propertyIndent,lineEnd)}var comma=","+lineEnd;var properties=node.properties,length=properties.length;for(var i=0;;){var property=properties[i];if(writeComments&&property.comments!=null){formatComments(state,property.comments,propertyIndent,lineEnd)}state.write(propertyIndent);this[property.type](property,state);if(++i<length){state.write(comma)}else{break}}state.write(lineEnd);if(writeComments&&node.trailingComments!=null){formatComments(state,node.trailingComments,propertyIndent,lineEnd)}state.write(indent+"}")}else if(writeComments){if(node.comments!=null){state.write(lineEnd);formatComments(state,node.comments,propertyIndent,lineEnd);if(node.trailingComments!=null){formatComments(state,node.trailingComments,propertyIndent,lineEnd)}state.write(indent+"}")}else if(node.trailingComments!=null){state.write(lineEnd);formatComments(state,node.trailingComments,propertyIndent,lineEnd);state.write(indent+"}")}else{state.write("}")}}else{state.write("}")}state.indentLevel--},Property:function Property(node,state){if(node.method||node.kind[0]!=="i"){this.MethodDefinition(node,state)}else{if(!node.shorthand){if(node.computed){state.write("[");this[node.key.type](node.key,state);state.write("]")}else{this[node.key.type](node.key,state)}state.write(": ")}this[node.value.type](node.value,state)}},ObjectPattern:function ObjectPattern(node,state){state.write("{");if(node.properties.length>0){var properties=node.properties,length=properties.length;for(var i=0;;){this[properties[i].type](properties[i],state);if(++i<length){state.write(", ")}else{break}}}state.write("}")},SequenceExpression:function SequenceExpression(node,state){formatSequence(state,node.expressions)},UnaryExpression:function UnaryExpression(node,state){if(node.prefix){state.write(node.operator);if(node.operator.length>1){state.write(" ")}if(EXPRESSIONS_PRECEDENCE[node.argument.type]<EXPRESSIONS_PRECEDENCE.UnaryExpression){state.write("(");this[node.argument.type](node.argument,state);state.write(")")}else{this[node.argument.type](node.argument,state)}}else{this[node.argument.type](node.argument,state);state.write(node.operator)}},UpdateExpression:function UpdateExpression(node,state){if(node.prefix){state.write(node.operator);this[node.argument.type](node.argument,state)}else{this[node.argument.type](node.argument,state);state.write(node.operator)}},AssignmentExpression:function AssignmentExpression(node,state){this[node.left.type](node.left,state);state.write(" "+node.operator+" ");this[node.right.type](node.right,state)},AssignmentPattern:function AssignmentPattern(node,state){this[node.left.type](node.left,state);state.write(" = ");this[node.right.type](node.right,state)},BinaryExpression:BinaryExpression=function BinaryExpression(node,state){if(node.operator==="in"){state.write("(");formatBinaryExpressionPart(state,node.left,node,false);state.write(" "+node.operator+" ");formatBinaryExpressionPart(state,node.right,node,true);state.write(")")}else{formatBinaryExpressionPart(state,node.left,node,false);state.write(" "+node.operator+" ");formatBinaryExpressionPart(state,node.right,node,true)}},LogicalExpression:BinaryExpression,ConditionalExpression:function ConditionalExpression(node,state){if(EXPRESSIONS_PRECEDENCE[node.test.type]>EXPRESSIONS_PRECEDENCE.ConditionalExpression){this[node.test.type](node.test,state)}else{state.write("(");this[node.test.type](node.test,state);state.write(")")}state.write(" ? ");this[node.consequent.type](node.consequent,state);state.write(" : ");this[node.alternate.type](node.alternate,state)},NewExpression:function NewExpression(node,state){state.write("new ");if(EXPRESSIONS_PRECEDENCE[node.callee.type]<EXPRESSIONS_PRECEDENCE.CallExpression||hasCallExpression(node.callee)){state.write("(");this[node.callee.type](node.callee,state);state.write(")")}else{this[node.callee.type](node.callee,state)}formatSequence(state,node["arguments"])},CallExpression:function CallExpression(node,state){if(EXPRESSIONS_PRECEDENCE[node.callee.type]<EXPRESSIONS_PRECEDENCE.CallExpression){state.write("(");this[node.callee.type](node.callee,state);state.write(")")}else{this[node.callee.type](node.callee,state)}formatSequence(state,node["arguments"])},MemberExpression:function MemberExpression(node,state){if(EXPRESSIONS_PRECEDENCE[node.object.type]<EXPRESSIONS_PRECEDENCE.MemberExpression){state.write("(");this[node.object.type](node.object,state);state.write(")")}else{this[node.object.type](node.object,state)}if(node.computed){state.write("[");this[node.property.type](node.property,state);state.write("]")}else{state.write(".");this[node.property.type](node.property,state)}},MetaProperty:function MetaProperty(node,state){state.write(node.meta.name+"."+node.property.name,node)},Identifier:function Identifier(node,state){state.write(node.name,node)},Literal:function Literal(node,state){if(node.raw!=null){state.write(node.raw,node)}else if(node.regex!=null){this.RegExpLiteral(node,state)}else{state.write(stringify(node.value),node)}},RegExpLiteral:function RegExpLiteral(node,state){var regex=node.regex;state.write("/".concat(regex.pattern,"/").concat(regex.flags),node)}};exports.baseGenerator=baseGenerator;var EMPTY_OBJECT={};var State=function(){function State(options){_classCallCheck(this,State);var setup=options==null?EMPTY_OBJECT:options;this.output="";if(setup.output!=null){this.output=setup.output;this.write=this.writeToStream}else{this.output=""}this.generator=setup.generator!=null?setup.generator:baseGenerator;this.indent=setup.indent!=null?setup.indent:" ";this.lineEnd=setup.lineEnd!=null?setup.lineEnd:"\n";this.indentLevel=setup.startingIndentLevel!=null?setup.startingIndentLevel:0;this.writeComments=setup.comments?setup.comments:false;if(setup.sourceMap!=null){this.write=setup.output==null?this.writeAndMap:this.writeToStreamAndMap;this.sourceMap=setup.sourceMap;this.line=1;this.column=0;this.lineEndSize=this.lineEnd.split("\n").length-1;this.mapping={original:null,generated:this,name:undefined,source:setup.sourceMap.file||setup.sourceMap._file}}}_createClass(State,[{key:"write",value:function write(code){this.output+=code}},{key:"writeToStream",value:function writeToStream(code){this.output.write(code)}},{key:"writeAndMap",value:function writeAndMap(code,node){this.output+=code;this.map(code,node)}},{key:"writeToStreamAndMap",value:function writeToStreamAndMap(code,node){this.output.write(code);this.map(code,node)}},{key:"map",value:function map(code,node){if(node!=null&&node.loc!=null){var mapping=this.mapping;mapping.original=node.loc.start;mapping.name=node.name;this.sourceMap.addMapping(mapping)}if(code.length>0){if(this.lineEndSize>0){if(code.endsWith(this.lineEnd)){this.line+=this.lineEndSize;this.column=0}else if(code[code.length-1]==="\n"){this.line++;this.column=0}else{this.column+=code.length}}else{if(code[code.length-1]==="\n"){this.line++;this.column=0}else{this.column+=code.length}}}}},{key:"toString",value:function toString(){return this.output}}]);return State}();function generate(node,options){var state=new State(options);state.generator[node.type](node,state);return state.output}},{}],21:[function(require,module,exports){module.exports=Backoff;function Backoff(opts){opts=opts||{};this.ms=opts.min||100;this.max=opts.max||1e4;this.factor=opts.factor||2;this.jitter=opts.jitter>0&&opts.jitter<=1?opts.jitter:0;this.attempts=0}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};Backoff.prototype.reset=function(){this.attempts=0};Backoff.prototype.setMin=function(min){this.ms=min};Backoff.prototype.setMax=function(max){this.max=max};Backoff.prototype.setJitter=function(jitter){this.jitter=jitter}},{}],22:[function(require,module,exports){(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*.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+/")},{}],23:[function(require,module,exports){"use strict";exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i}revLookup["-".charCodeAt(0)]=62;revLookup["_".charCodeAt(0)]=63;function getLens(b64){var len=b64.length;if(len%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var validLen=b64.indexOf("=");if(validLen===-1)validLen=len;var placeHoldersLen=validLen===len?0:4-validLen%4;return[validLen,placeHoldersLen]}function byteLength(b64){var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function _byteLength(b64,validLen,placeHoldersLen){return(validLen+placeHoldersLen)*3/4-placeHoldersLen}function toByteArray(b64){var tmp;var lens=getLens(b64);var validLen=lens[0];var placeHoldersLen=lens[1];var arr=new Arr(_byteLength(b64,validLen,placeHoldersLen));var curByte=0;var len=placeHoldersLen>0?validLen-4:validLen;var i;for(i=0;i<len;i+=4){tmp=revLookup[b64.charCodeAt(i)]<<18|revLookup[b64.charCodeAt(i+1)]<<12|revLookup[b64.charCodeAt(i+2)]<<6|revLookup[b64.charCodeAt(i+3)];arr[curByte++]=tmp>>16&255;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}if(placeHoldersLen===2){tmp=revLookup[b64.charCodeAt(i)]<<2|revLookup[b64.charCodeAt(i+1)]>>4;arr[curByte++]=tmp&255}if(placeHoldersLen===1){tmp=revLookup[b64.charCodeAt(i)]<<10|revLookup[b64.charCodeAt(i+1)]<<4|revLookup[b64.charCodeAt(i+2)]>>2;arr[curByte++]=tmp>>8&255;arr[curByte++]=tmp&255}return arr}function tripletToBase64(num){return lookup[num>>18&63]+lookup[num>>12&63]+lookup[num>>6&63]+lookup[num&63]}function encodeChunk(uint8,start,end){var tmp;var output=[];for(var i=start;i<end;i+=3){tmp=(uint8[i]<<16&16711680)+(uint8[i+1]<<8&65280)+(uint8[i+2]&255);output.push(tripletToBase64(tmp))}return output.join("")}function fromByteArray(uint8){var tmp;var len=uint8.length;var extraBytes=len%3;var parts=[];var maxChunkLength=16383;for(var i=0,len2=len-extraBytes;i<len2;i+=maxChunkLength){parts.push(encodeChunk(uint8,i,i+maxChunkLength>len2?len2:i+maxChunkLength))}if(extraBytes===1){tmp=uint8[len-1];parts.push(lookup[tmp>>2]+lookup[tmp<<4&63]+"==")}else if(extraBytes===2){tmp=(uint8[len-2]<<8)+uint8[len-1];parts.push(lookup[tmp>>10]+lookup[tmp>>4&63]+lookup[tmp<<2&63]+"=")}return parts.join("")}},{}],24:[function(require,module,exports){var BlobBuilder=typeof BlobBuilder!=="undefined"?BlobBuilder:typeof WebKitBlobBuilder!=="undefined"?WebKitBlobBuilder:typeof MSBlobBuilder!=="undefined"?MSBlobBuilder:typeof MozBlobBuilder!=="undefined"?MozBlobBuilder:false;var blobSupported=function(){try{var a=new Blob(["hi"]);return a.size===2}catch(e){return false}}();var blobSupportsArrayBufferView=blobSupported&&function(){try{var b=new Blob([new Uint8Array([1,2])]);return b.size===2}catch(e){return false}}();var blobBuilderSupported=BlobBuilder&&BlobBuilder.prototype.append&&BlobBuilder.prototype.getBlob;function mapArrayBufferViews(ary){return ary.map((function(chunk){if(chunk.buffer instanceof ArrayBuffer){var buf=chunk.buffer;if(chunk.byteLength!==buf.byteLength){var copy=new Uint8Array(chunk.byteLength);copy.set(new Uint8Array(buf,chunk.byteOffset,chunk.byteLength));buf=copy.buffer}return buf}return chunk}))}function BlobBuilderConstructor(ary,options){options=options||{};var bb=new BlobBuilder;mapArrayBufferViews(ary).forEach((function(part){bb.append(part)}));return options.type?bb.getBlob(options.type):bb.getBlob()}function BlobConstructor(ary,options){return new Blob(mapArrayBufferViews(ary),options||{})}if(typeof Blob!=="undefined"){BlobBuilderConstructor.prototype=Blob.prototype;BlobConstructor.prototype=Blob.prototype}module.exports=function(){if(blobSupported){return blobSupportsArrayBufferView?Blob:BlobConstructor}else if(blobBuilderSupported){return BlobBuilderConstructor}else{return undefined}}()},{}],25:[function(require,module,exports){},{}],26:[function(require,module,exports){var objectCreate=Object.create||objectCreatePolyfill;var objectKeys=Object.keys||objectKeysPolyfill;var bind=Function.prototype.bind||functionBindPolyfill;function EventEmitter(){if(!this._events||!Object.prototype.hasOwnProperty.call(this,"_events")){this._events=objectCreate(null);this._eventsCount=0}this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;var defaultMaxListeners=10;var hasDefineProperty;try{var o={};if(Object.defineProperty)Object.defineProperty(o,"x",{value:0});hasDefineProperty=o.x===0}catch(err){hasDefineProperty=false}if(hasDefineProperty){Object.defineProperty(EventEmitter,"defaultMaxListeners",{enumerable:true,get:function(){return defaultMaxListeners},set:function(arg){if(typeof arg!=="number"||arg<0||arg!==arg)throw new TypeError('"defaultMaxListeners" must be a positive number');defaultMaxListeners=arg}})}else{EventEmitter.defaultMaxListeners=defaultMaxListeners}EventEmitter.prototype.setMaxListeners=function setMaxListeners(n){if(typeof n!=="number"||n<0||isNaN(n))throw new TypeError('"n" argument must be a positive number');this._maxListeners=n;return this};function $getMaxListeners(that){if(that._maxListeners===undefined)return EventEmitter.defaultMaxListeners;return that._maxListeners}EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return $getMaxListeners(this)};function emitNone(handler,isFn,self){if(isFn)handler.call(self);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i)listeners[i].call(self)}}function emitOne(handler,isFn,self,arg1){if(isFn)handler.call(self,arg1);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i)listeners[i].call(self,arg1)}}function emitTwo(handler,isFn,self,arg1,arg2){if(isFn)handler.call(self,arg1,arg2);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i)listeners[i].call(self,arg1,arg2)}}function emitThree(handler,isFn,self,arg1,arg2,arg3){if(isFn)handler.call(self,arg1,arg2,arg3);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i)listeners[i].call(self,arg1,arg2,arg3)}}function emitMany(handler,isFn,self,args){if(isFn)handler.apply(self,args);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i)listeners[i].apply(self,args)}}EventEmitter.prototype.emit=function emit(type){var er,handler,len,args,i,events;var doError=type==="error";events=this._events;if(events)doError=doError&&events.error==null;else if(!doError)return false;if(doError){if(arguments.length>1)er=arguments[1];if(er instanceof Error){throw er}else{var err=new Error('Unhandled "error" event. ('+er+")");err.context=er;throw err}return false}handler=events[type];if(!handler)return false;var isFn=typeof handler==="function";len=arguments.length;switch(len){case 1:emitNone(handler,isFn,this);break;case 2:emitOne(handler,isFn,this,arguments[1]);break;case 3:emitTwo(handler,isFn,this,arguments[1],arguments[2]);break;case 4:emitThree(handler,isFn,this,arguments[1],arguments[2],arguments[3]);break;default:args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];emitMany(handler,isFn,this,args)}return true};function _addListener(target,type,listener,prepend){var m;var events;var existing;if(typeof listener!=="function")throw new TypeError('"listener" argument must be a function');events=target._events;if(!events){events=target._events=objectCreate(null);target._eventsCount=0}else{if(events.newListener){target.emit("newListener",type,listener.listener?listener.listener:listener);events=target._events}existing=events[type]}if(!existing){existing=events[type]=listener;++target._eventsCount}else{if(typeof existing==="function"){existing=events[type]=prepend?[listener,existing]:[existing,listener]}else{if(prepend){existing.unshift(listener)}else{existing.push(listener)}}if(!existing.warned){m=$getMaxListeners(target);if(m&&m>0&&existing.length>m){existing.warned=true;var w=new Error("Possible EventEmitter memory leak detected. "+existing.length+' "'+String(type)+'" listeners '+"added. Use emitter.setMaxListeners() to "+"increase limit.");w.name="MaxListenersExceededWarning";w.emitter=target;w.type=type;w.count=existing.length;if(typeof console==="object"&&console.warn){console.warn("%s: %s",w.name,w.message)}}}}return target}EventEmitter.prototype.addListener=function addListener(type,listener){return _addListener(this,type,listener,false)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function prependListener(type,listener){return _addListener(this,type,listener,true)};function onceWrapper(){if(!this.fired){this.target.removeListener(this.type,this.wrapFn);this.fired=true;switch(arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:var args=new Array(arguments.length);for(var i=0;i<args.length;++i)args[i]=arguments[i];this.listener.apply(this.target,args)}}}function _onceWrap(target,type,listener){var state={fired:false,wrapFn:undefined,target:target,type:type,listener:listener};var wrapped=bind.call(onceWrapper,state);wrapped.listener=listener;state.wrapFn=wrapped;return wrapped}EventEmitter.prototype.once=function once(type,listener){if(typeof listener!=="function")throw new TypeError('"listener" argument must be a function');this.on(type,_onceWrap(this,type,listener));return this};EventEmitter.prototype.prependOnceListener=function prependOnceListener(type,listener){if(typeof listener!=="function")throw new TypeError('"listener" argument must be a function');this.prependListener(type,_onceWrap(this,type,listener));return this};EventEmitter.prototype.removeListener=function removeListener(type,listener){var list,events,position,i,originalListener;if(typeof listener!=="function")throw new TypeError('"listener" argument must be a function');events=this._events;if(!events)return this;list=events[type];if(!list)return this;if(list===listener||list.listener===listener){if(--this._eventsCount===0)this._events=objectCreate(null);else{delete events[type];if(events.removeListener)this.emit("removeListener",type,list.listener||listener)}}else if(typeof list!=="function"){position=-1;for(i=list.length-1;i>=0;i--){if(list[i]===listener||list[i].listener===listener){originalListener=list[i].listener;position=i;break}}if(position<0)return this;if(position===0)list.shift();else spliceOne(list,position);if(list.length===1)events[type]=list[0];if(events.removeListener)this.emit("removeListener",type,originalListener||listener)}return this};EventEmitter.prototype.removeAllListeners=function removeAllListeners(type){var listeners,events,i;events=this._events;if(!events)return this;if(!events.removeListener){if(arguments.length===0){this._events=objectCreate(null);this._eventsCount=0}else if(events[type]){if(--this._eventsCount===0)this._events=objectCreate(null);else delete events[type]}return this}if(arguments.length===0){var keys=objectKeys(events);var key;for(i=0;i<keys.length;++i){key=keys[i];if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events=objectCreate(null);this._eventsCount=0;return this}listeners=events[type];if(typeof listeners==="function"){this.removeListener(type,listeners)}else if(listeners){for(i=listeners.length-1;i>=0;i--){this.removeListener(type,listeners[i])}}return this};function _listeners(target,type,unwrap){var events=target._events;if(!events)return[];var evlistener=events[type];if(!evlistener)return[];if(typeof evlistener==="function")return unwrap?[evlistener.listener||evlistener]:[evlistener];return unwrap?unwrapListeners(evlistener):arrayClone(evlistener,evlistener.length)}EventEmitter.prototype.listeners=function listeners(type){return _listeners(this,type,true)};EventEmitter.prototype.rawListeners=function rawListeners(type){return _listeners(this,type,false)};EventEmitter.listenerCount=function(emitter,type){if(typeof emitter.listenerCount==="function"){return emitter.listenerCount(type)}else{return listenerCount.call(emitter,type)}};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(type){var events=this._events;if(events){var evlistener=events[type];if(typeof evlistener==="function"){return 1}else if(evlistener){return evlistener.length}}return 0}EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]};function spliceOne(list,index){for(var i=index,k=i+1,n=list.length;k<n;i+=1,k+=1)list[i]=list[k];list.pop()}function arrayClone(arr,n){var copy=new Array(n);for(var i=0;i<n;++i)copy[i]=arr[i];return copy}function unwrapListeners(arr){var ret=new Array(arr.length);for(var i=0;i<ret.length;++i){ret[i]=arr[i].listener||arr[i]}return ret}function objectCreatePolyfill(proto){var F=function(){};F.prototype=proto;return new F}function objectKeysPolyfill(obj){var keys=[];for(var k in obj)if(Object.prototype.hasOwnProperty.call(obj,k)){keys.push(k)}return k}function functionBindPolyfill(context){var fn=this;return function(){return fn.apply(context,arguments)}}},{}],27:[function(require,module,exports){(function(Buffer){(function(){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
"use strict";var base64=require("base64-js");var ieee754=require("ieee754");exports.Buffer=Buffer;exports.SlowBuffer=SlowBuffer;exports.INSPECT_MAX_BYTES=50;var K_MAX_LENGTH=2147483647;exports.kMaxLength=K_MAX_LENGTH;Buffer.TYPED_ARRAY_SUPPORT=typedArraySupport();if(!Buffer.TYPED_ARRAY_SUPPORT&&typeof console!=="undefined"&&typeof console.error==="function"){console.error("This browser lacks typed array (Uint8Array) support which is required by "+"`buffer` v5.x. Use `buffer` v4.x if you require old browser support.")}function typedArraySupport(){try{var arr=new Uint8Array(1);arr.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}};return arr.foo()===42}catch(e){return false}}Object.defineProperty(Buffer.prototype,"parent",{enumerable:true,get:function(){if(!Buffer.isBuffer(this))return undefined;return this.buffer}});Object.defineProperty(Buffer.prototype,"offset",{enumerable:true,get:function(){if(!Buffer.isBuffer(this))return undefined;return this.byteOffset}});function createBuffer(length){if(length>K_MAX_LENGTH){throw new RangeError('The value "'+length+'" is invalid for option "size"')}var buf=new Uint8Array(length);buf.__proto__=Buffer.prototype;return buf}function Buffer(arg,encodingOrOffset,length){if(typeof arg==="number"){if(typeof encodingOrOffset==="string"){throw new TypeError('The "string" argument must be of type string. Received type number')}return allocUnsafe(arg)}return from(arg,encodingOrOffset,length)}if(typeof Symbol!=="undefined"&&Symbol.species!=null&&Buffer[Symbol.species]===Buffer){Object.defineProperty(Buffer,Symbol.species,{value:null,configurable:true,enumerable:false,writable:false})}Buffer.poolSize=8192;function from(value,encodingOrOffset,length){if(typeof value==="string"){return fromString(value,encodingOrOffset)}if(ArrayBuffer.isView(value)){return fromArrayLike(value)}if(value==null){throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof value)}if(isInstance(value,ArrayBuffer)||value&&isInstance(value.buffer,ArrayBuffer)){return fromArrayBuffer(value,encodingOrOffset,length)}if(typeof value==="number"){throw new TypeError('The "value" argument must not be of type number. Received type number')}var valueOf=value.valueOf&&value.valueOf();if(valueOf!=null&&valueOf!==value){return Buffer.from(valueOf,encodingOrOffset,length)}var b=fromObject(value);if(b)return b;if(typeof Symbol!=="undefined"&&Symbol.toPrimitive!=null&&typeof value[Symbol.toPrimitive]==="function"){return Buffer.from(value[Symbol.toPrimitive]("string"),encodingOrOffset,length)}throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, "+"or Array-like Object. Received type "+typeof value)}Buffer.from=function(value,encodingOrOffset,length){return from(value,encodingOrOffset,length)};Buffer.prototype.__proto__=Uint8Array.prototype;Buffer.__proto__=Uint8Array;function assertSize(size){if(typeof size!=="number"){throw new TypeError('"size" argument must be of type number')}else if(size<0){throw new RangeError('The value "'+size+'" is invalid for option "size"')}}function alloc(size,fill,encoding){assertSize(size);if(size<=0){return createBuffer(size)}if(fill!==undefined){return typeof encoding==="string"?createBuffer(size).fill(fill,encoding):createBuffer(size).fill(fill)}return createBuffer(size)}Buffer.alloc=function(size,fill,encoding){return alloc(size,fill,encoding)};function allocUnsafe(size){assertSize(size);return createBuffer(size<0?0:checked(size)|0)}Buffer.allocUnsafe=function(size){return allocUnsafe(size)};Buffer.allocUnsafeSlow=function(size){return allocUnsafe(size)};function fromString(string,encoding){if(typeof encoding!=="string"||encoding===""){encoding="utf8"}if(!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}var length=byteLength(string,encoding)|0;var buf=createBuffer(length);var actual=buf.write(string,encoding);if(actual!==length){buf=buf.slice(0,actual)}return buf}function fromArrayLike(array){var length=array.length<0?0:checked(array.length)|0;var buf=createBuffer(length);for(var i=0;i<length;i+=1){buf[i]=array[i]&255}return buf}function fromArrayBuffer(array,byteOffset,length){if(byteOffset<0||array.byteLength<byteOffset){throw new RangeError('"offset" is outside of buffer bounds')}if(array.byteLength<byteOffset+(length||0)){throw new RangeError('"length" is outside of buffer bounds')}var buf;if(byteOffset===undefined&&length===undefined){buf=new Uint8Array(array)}else if(length===undefined){buf=new Uint8Array(array,byteOffset)}else{buf=new Uint8Array(array,byteOffset,length)}buf.__proto__=Buffer.prototype;return buf}function fromObject(obj){if(Buffer.isBuffer(obj)){var len=checked(obj.length)|0;var buf=createBuffer(len);if(buf.length===0){return buf}obj.copy(buf,0,0,len);return buf}if(obj.length!==undefined){if(typeof obj.length!=="number"||numberIsNaN(obj.length)){return createBuffer(0)}return fromArrayLike(obj)}if(obj.type==="Buffer"&&Array.isArray(obj.data)){return fromArrayLike(obj.data)}}function checked(length){if(length>=K_MAX_LENGTH){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+K_MAX_LENGTH.toString(16)+" bytes")}return length|0}function SlowBuffer(length){if(+length!=length){length=0}return Buffer.alloc(+length)}Buffer.isBuffer=function isBuffer(b){return b!=null&&b._isBuffer===true&&b!==Buffer.prototype};Buffer.compare=function compare(a,b){if(isInstance(a,Uint8Array))a=Buffer.from(a,a.offset,a.byteLength);if(isInstance(b,Uint8Array))b=Buffer.from(b,b.offset,b.byteLength);if(!Buffer.isBuffer(a)||!Buffer.isBuffer(b)){throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array')}if(a===b)return 0;var x=a.length;var y=b.length;for(var i=0,len=Math.min(x,y);i<len;++i){if(a[i]!==b[i]){x=a[i];y=b[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};Buffer.isEncoding=function isEncoding(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.concat=function concat(list,length){if(!Array.isArray(list)){throw new TypeError('"list" argument must be an Array of Buffers')}if(list.length===0){return Buffer.alloc(0)}var i;if(length===undefined){length=0;for(i=0;i<list.length;++i){length+=list[i].length}}var buffer=Buffer.allocUnsafe(length);var pos=0;for(i=0;i<list.length;++i){var buf=list[i];if(isInstance(buf,Uint8Array)){buf=Buffer.from(buf)}if(!Buffer.isBuffer(buf)){throw new TypeError('"list" argument must be an Array of Buffers')}buf.copy(buffer,pos);pos+=buf.length}return buffer};function byteLength(string,encoding){if(Buffer.isBuffer(string)){return string.length}if(ArrayBuffer.isView(string)||isInstance(string,ArrayBuffer)){return string.byteLength}if(typeof string!=="string"){throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. '+"Received type "+typeof string)}var len=string.length;var mustMatch=arguments.length>2&&arguments[2]===true;if(!mustMatch&&len===0)return 0;var loweredCase=false;for(;;){switch(encoding){case"ascii":case"latin1":case"binary":return len;case"utf8":case"utf-8":return utf8ToBytes(string).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return len*2;case"hex":return len>>>1;case"base64":return base64ToBytes(string).length;default:if(loweredCase){return mustMatch?-1:utf8ToBytes(string).length}encoding=(""+encoding).toLowerCase();loweredCase=true}}}Buffer.byteLength=byteLength;function slowToString(encoding,start,end){var loweredCase=false;if(start===undefined||start<0){start=0}if(start>this.length){return""}if(end===undefined||end>this.length){end=this.length}if(end<=0){return""}end>>>=0;start>>>=0;if(end<=start){return""}if(!encoding)encoding="utf8";while(true){switch(encoding){case"hex":return hexSlice(this,start,end);case"utf8":case"utf-8":return utf8Slice(this,start,end);case"ascii":return asciiSlice(this,start,end);case"latin1":case"binary":return latin1Slice(this,start,end);case"base64":return base64Slice(this,start,end);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return utf16leSlice(this,start,end);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(encoding+"").toLowerCase();loweredCase=true}}}Buffer.prototype._isBuffer=true;function swap(b,n,m){var i=b[n];b[n]=b[m];b[m]=i}Buffer.prototype.swap16=function swap16(){var len=this.length;if(len%2!==0){throw new RangeError("Buffer size must be a multiple of 16-bits")}for(var i=0;i<len;i+=2){swap(this,i,i+1)}return this};Buffer.prototype.swap32=function swap32(){var len=this.length;if(len%4!==0){throw new RangeError("Buffer size must be a multiple of 32-bits")}for(var i=0;i<len;i+=4){swap(this,i,i+3);swap(this,i+1,i+2)}return this};Buffer.prototype.swap64=function swap64(){var len=this.length;if(len%8!==0){throw new RangeError("Buffer size must be a multiple of 64-bits")}for(var i=0;i<len;i+=8){swap(this,i,i+7);swap(this,i+1,i+6);swap(this,i+2,i+5);swap(this,i+3,i+4)}return this};Buffer.prototype.toString=function toString(){var length=this.length;if(length===0)return"";if(arguments.length===0)return utf8Slice(this,0,length);return slowToString.apply(this,arguments)};Buffer.prototype.toLocaleString=Buffer.prototype.toString;Buffer.prototype.equals=function equals(b){if(!Buffer.isBuffer(b))throw new TypeError("Argument must be a Buffer");if(this===b)return true;return Buffer.compare(this,b)===0};Buffer.prototype.inspect=function inspect(){var str="";var max=exports.INSPECT_MAX_BYTES;str=this.toString("hex",0,max).replace(/(.{2})/g,"$1 ").trim();if(this.length>max)str+=" ... ";return"<Buffer "+str+">"};Buffer.prototype.compare=function compare(target,start,end,thisStart,thisEnd){if(isInstance(target,Uint8Array)){target=Buffer.from(target,target.offset,target.byteLength)}if(!Buffer.isBuffer(target)){throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. '+"Received type "+typeof target)}if(start===undefined){start=0}if(end===undefined){end=target?target.length:0}if(thisStart===undefined){thisStart=0}if(thisEnd===undefined){thisEnd=this.length}if(start<0||end>target.length||thisStart<0||thisEnd>this.length){throw new RangeError("out of range index")}if(thisStart>=thisEnd&&start>=end){return 0}if(thisStart>=thisEnd){return-1}if(start>=end){return 1}start>>>=0;end>>>=0;thisStart>>>=0;thisEnd>>>=0;if(this===target)return 0;var x=thisEnd-thisStart;var y=end-start;var len=Math.min(x,y);var thisCopy=this.slice(thisStart,thisEnd);var targetCopy=target.slice(start,end);for(var i=0;i<len;++i){if(thisCopy[i]!==targetCopy[i]){x=thisCopy[i];y=targetCopy[i];break}}if(x<y)return-1;if(y<x)return 1;return 0};function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){if(buffer.length===0)return-1;if(typeof byteOffset==="string"){encoding=byteOffset;byteOffset=0}else if(byteOffset>2147483647){byteOffset=2147483647}else if(byteOffset<-2147483648){byteOffset=-2147483648}byteOffset=+byteOffset;if(numberIsNaN(byteOffset)){byteOffset=dir?0:buffer.length-1}if(byteOffset<0)byteOffset=buffer.length+byteOffset;if(byteOffset>=buffer.length){if(dir)return-1;else byteOffset=buffer.length-1}else if(byteOffset<0){if(dir)byteOffset=0;else return-1}if(typeof val==="string"){val=Buffer.from(val,encoding)}if(Buffer.isBuffer(val)){if(val.length===0){return-1}return arrayIndexOf(buffer,val,byteOffset,encoding,dir)}else if(typeof val==="number"){val=val&255;if(typeof Uint8Array.prototype.indexOf==="function"){if(dir){return Uint8Array.prototype.indexOf.call(buffer,val,byteOffset)}else{return Uint8Array.prototype.lastIndexOf.call(buffer,val,byteOffset)}}return arrayIndexOf(buffer,[val],byteOffset,encoding,dir)}throw new TypeError("val must be string, number or Buffer")}function arrayIndexOf(arr,val,byteOffset,encoding,dir){var indexSize=1;var arrLength=arr.length;var valLength=val.length;if(encoding!==undefined){encoding=String(encoding).toLowerCase();if(encoding==="ucs2"||encoding==="ucs-2"||encoding==="utf16le"||encoding==="utf-16le"){if(arr.length<2||val.length<2){return-1}indexSize=2;arrLength/=2;valLength/=2;byteOffset/=2}}function read(buf,i){if(indexSize===1){return buf[i]}else{return buf.readUInt16BE(i*indexSize)}}var i;if(dir){var foundIndex=-1;for(i=byteOffset;i<arrLength;i++){if(read(arr,i)===read(val,foundIndex===-1?0:i-foundIndex)){if(foundIndex===-1)foundIndex=i;if(i-foundIndex+1===valLength)return foundIndex*indexSize}else{if(foundIndex!==-1)i-=i-foundIndex;foundIndex=-1}}}else{if(byteOffset+valLength>arrLength)byteOffset=arrLength-valLength;for(i=byteOffset;i>=0;i--){var found=true;for(var j=0;j<valLength;j++){if(read(arr,i+j)!==read(val,j)){found=false;break}}if(found)return i}}return-1}Buffer.prototype.includes=function includes(val,byteOffset,encoding){return this.indexOf(val,byteOffset,encoding)!==-1};Buffer.prototype.indexOf=function indexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,true)};Buffer.prototype.lastIndexOf=function lastIndexOf(val,byteOffset,encoding){return bidirectionalIndexOf(this,val,byteOffset,encoding,false)};function hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;if(length>strLen/2){length=strLen/2}for(var i=0;i<length;++i){var parsed=parseInt(string.substr(i*2,2),16);if(numberIsNaN(parsed))return i;buf[offset+i]=parsed}return i}function utf8Write(buf,string,offset,length){return blitBuffer(utf8ToBytes(string,buf.length-offset),buf,offset,length)}function asciiWrite(buf,string,offset,length){return blitBuffer(asciiToBytes(string),buf,offset,length)}function latin1Write(buf,string,offset,length){return asciiWrite(buf,string,offset,length)}function base64Write(buf,string,offset,length){return blitBuffer(base64ToBytes(string),buf,offset,length)}function ucs2Write(buf,string,offset,length){return blitBuffer(utf16leToBytes(string,buf.length-offset),buf,offset,length)}Buffer.prototype.write=function write(string,offset,length,encoding){if(offset===undefined){encoding="utf8";length=this.length;offset=0}else if(length===undefined&&typeof offset==="string"){encoding=offset;length=this.length;offset=0}else if(isFinite(offset)){offset=offset>>>0;if(isFinite(length)){length=length>>>0;if(encoding===undefined)encoding="utf8"}else{encoding=length;length=undefined}}else{throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported")}var remaining=this.length-offset;if(length===undefined||length>remaining)length=remaining;if(string.length>0&&(length<0||offset<0)||offset>this.length){throw new RangeError("Attempt to write outside buffer bounds")}if(!encoding)encoding="utf8";var loweredCase=false;for(;;){switch(encoding){case"hex":return hexWrite(this,string,offset,length);case"utf8":case"utf-8":return utf8Write(this,string,offset,length);case"ascii":return asciiWrite(this,string,offset,length);case"latin1":case"binary":return latin1Write(this,string,offset,length);case"base64":return base64Write(this,string,offset,length);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ucs2Write(this,string,offset,length);default:if(loweredCase)throw new TypeError("Unknown encoding: "+encoding);encoding=(""+encoding).toLowerCase();loweredCase=true}}};Buffer.prototype.toJSON=function toJSON(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function utf8Slice(buf,start,end){end=Math.min(buf.length,end);var res=[];var i=start;while(i<end){var firstByte=buf[i];var codePoint=null;var bytesPerSequence=firstByte>239?4:firstByte>223?3:firstByte>191?2:1;if(i+bytesPerSequence<=end){var secondByte,thirdByte,fourthByte,tempCodePoint;switch(bytesPerSequence){case 1:if(firstByte<128){codePoint=firstByte}break;case 2:secondByte=buf[i+1];if((secondByte&192)===128){tempCodePoint=(firstByte&31)<<6|secondByte&63;if(tempCodePoint>127){codePoint=tempCodePoint}}break;case 3:secondByte=buf[i+1];thirdByte=buf[i+2];if((secondByte&192)===128&&(thirdByte&192)===128){tempCodePoint=(firstByte&15)<<12|(secondByte&63)<<6|thirdByte&63;if(tempCodePoint>2047&&(tempCodePoint<55296||tempCodePoint>57343)){codePoint=tempCodePoint}}break;case 4:secondByte=buf[i+1];thirdByte=buf[i+2];fourthByte=buf[i+3];if((secondByte&192)===128&&(thirdByte&192)===128&&(fourthByte&192)===128){tempCodePoint=(firstByte&15)<<18|(secondByte&63)<<12|(thirdByte&63)<<6|fourthByte&63;if(tempCodePoint>65535&&tempCodePoint<1114112){codePoint=tempCodePoint}}}}if(codePoint===null){codePoint=65533;bytesPerSequence=1}else if(codePoint>65535){codePoint-=65536;res.push(codePoint>>>10&1023|55296);codePoint=56320|codePoint&1023}res.push(codePoint);i+=bytesPerSequence}return decodeCodePointsArray(res)}var MAX_ARGUMENTS_LENGTH=4096;function decodeCodePointsArray(codePoints){var len=codePoints.length;if(len<=MAX_ARGUMENTS_LENGTH){return String.fromCharCode.apply(String,codePoints)}var res="";var i=0;while(i<len){res+=String.fromCharCode.apply(String,codePoints.slice(i,i+=MAX_ARGUMENTS_LENGTH))}return res}function asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i]&127)}return ret}function latin1Slice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;++i){ret+=String.fromCharCode(buf[i])}return ret}function hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;++i){out+=toHex(buf[i])}return out}function utf16leSlice(buf,start,end){var bytes=buf.slice(start,end);var res="";for(var i=0;i<bytes.length;i+=2){res+=String.fromCharCode(bytes[i]+bytes[i+1]*256)}return res}Buffer.prototype.slice=function slice(start,end){var len=this.length;start=~~start;end=end===undefined?len:~~end;if(start<0){start+=len;if(start<0)start=0}else if(start>len){start=len}if(end<0){end+=len;if(end<0)end=0}else if(end>len){end=len}if(end<start)end=start;var newBuf=this.subarray(start,end);newBuf.__proto__=Buffer.prototype;return newBuf};function checkOffset(offset,ext,length){if(offset%1!==0||offset<0)throw new RangeError("offset is not uint");if(offset+ext>length)throw new RangeError("Trying to access beyond buffer length")}Buffer.prototype.readUIntLE=function readUIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}return val};Buffer.prototype.readUIntBE=function readUIntBE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){checkOffset(offset,byteLength,this.length)}var val=this[offset+--byteLength];var mul=1;while(byteLength>0&&(mul*=256)){val+=this[offset+--byteLength]*mul}return val};Buffer.prototype.readUInt8=function readUInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);return this[offset]};Buffer.prototype.readUInt16LE=function readUInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]|this[offset+1]<<8};Buffer.prototype.readUInt16BE=function readUInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);return this[offset]<<8|this[offset+1]};Buffer.prototype.readUInt32LE=function readUInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return(this[offset]|this[offset+1]<<8|this[offset+2]<<16)+this[offset+3]*16777216};Buffer.prototype.readUInt32BE=function readUInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]*16777216+(this[offset+1]<<16|this[offset+2]<<8|this[offset+3])};Buffer.prototype.readIntLE=function readIntLE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var val=this[offset];var mul=1;var i=0;while(++i<byteLength&&(mul*=256)){val+=this[offset+i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readIntBE=function readIntBE(offset,byteLength,noAssert){offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert)checkOffset(offset,byteLength,this.length);var i=byteLength;var mul=1;var val=this[offset+--i];while(i>0&&(mul*=256)){val+=this[offset+--i]*mul}mul*=128;if(val>=mul)val-=Math.pow(2,8*byteLength);return val};Buffer.prototype.readInt8=function readInt8(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,1,this.length);if(!(this[offset]&128))return this[offset];return(255-this[offset]+1)*-1};Buffer.prototype.readInt16LE=function readInt16LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset]|this[offset+1]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt16BE=function readInt16BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,2,this.length);var val=this[offset+1]|this[offset]<<8;return val&32768?val|4294901760:val};Buffer.prototype.readInt32LE=function readInt32LE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]|this[offset+1]<<8|this[offset+2]<<16|this[offset+3]<<24};Buffer.prototype.readInt32BE=function readInt32BE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return this[offset]<<24|this[offset+1]<<16|this[offset+2]<<8|this[offset+3]};Buffer.prototype.readFloatLE=function readFloatLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,true,23,4)};Buffer.prototype.readFloatBE=function readFloatBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,4,this.length);return ieee754.read(this,offset,false,23,4)};Buffer.prototype.readDoubleLE=function readDoubleLE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,true,52,8)};Buffer.prototype.readDoubleBE=function readDoubleBE(offset,noAssert){offset=offset>>>0;if(!noAssert)checkOffset(offset,8,this.length);return ieee754.read(this,offset,false,52,8)};function checkInt(buf,value,offset,ext,max,min){if(!Buffer.isBuffer(buf))throw new TypeError('"buffer" argument must be a Buffer instance');if(value>max||value<min)throw new RangeError('"value" argument is out of bounds');if(offset+ext>buf.length)throw new RangeError("Index out of range")}Buffer.prototype.writeUIntLE=function writeUIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var mul=1;var i=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUIntBE=function writeUIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;byteLength=byteLength>>>0;if(!noAssert){var maxBytes=Math.pow(2,8*byteLength)-1;checkInt(this,value,offset,byteLength,maxBytes,0)}var i=byteLength-1;var mul=1;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){this[offset+i]=value/mul&255}return offset+byteLength};Buffer.prototype.writeUInt8=function writeUInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,255,0);this[offset]=value&255;return offset+1};Buffer.prototype.writeUInt16LE=function writeUInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeUInt16BE=function writeUInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,65535,0);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeUInt32LE=function writeUInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset+3]=value>>>24;this[offset+2]=value>>>16;this[offset+1]=value>>>8;this[offset]=value&255;return offset+4};Buffer.prototype.writeUInt32BE=function writeUInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,4294967295,0);this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};Buffer.prototype.writeIntLE=function writeIntLE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=0;var mul=1;var sub=0;this[offset]=value&255;while(++i<byteLength&&(mul*=256)){if(value<0&&sub===0&&this[offset+i-1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeIntBE=function writeIntBE(value,offset,byteLength,noAssert){value=+value;offset=offset>>>0;if(!noAssert){var limit=Math.pow(2,8*byteLength-1);checkInt(this,value,offset,byteLength,limit-1,-limit)}var i=byteLength-1;var mul=1;var sub=0;this[offset+i]=value&255;while(--i>=0&&(mul*=256)){if(value<0&&sub===0&&this[offset+i+1]!==0){sub=1}this[offset+i]=(value/mul>>0)-sub&255}return offset+byteLength};Buffer.prototype.writeInt8=function writeInt8(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,1,127,-128);if(value<0)value=255+value+1;this[offset]=value&255;return offset+1};Buffer.prototype.writeInt16LE=function writeInt16LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value&255;this[offset+1]=value>>>8;return offset+2};Buffer.prototype.writeInt16BE=function writeInt16BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,2,32767,-32768);this[offset]=value>>>8;this[offset+1]=value&255;return offset+2};Buffer.prototype.writeInt32LE=function writeInt32LE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);this[offset]=value&255;this[offset+1]=value>>>8;this[offset+2]=value>>>16;this[offset+3]=value>>>24;return offset+4};Buffer.prototype.writeInt32BE=function writeInt32BE(value,offset,noAssert){value=+value;offset=offset>>>0;if(!noAssert)checkInt(this,value,offset,4,2147483647,-2147483648);if(value<0)value=4294967295+value+1;this[offset]=value>>>24;this[offset+1]=value>>>16;this[offset+2]=value>>>8;this[offset+3]=value&255;return offset+4};function checkIEEE754(buf,value,offset,ext,max,min){if(offset+ext>buf.length)throw new RangeError("Index out of range");if(offset<0)throw new RangeError("Index out of range")}function writeFloat(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,4,34028234663852886e22,-34028234663852886e22)}ieee754.write(buf,value,offset,littleEndian,23,4);return offset+4}Buffer.prototype.writeFloatLE=function writeFloatLE(value,offset,noAssert){return writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function writeFloatBE(value,offset,noAssert){return writeFloat(this,value,offset,false,noAssert)};function writeDouble(buf,value,offset,littleEndian,noAssert){value=+value;offset=offset>>>0;if(!noAssert){checkIEEE754(buf,value,offset,8,17976931348623157e292,-17976931348623157e292)}ieee754.write(buf,value,offset,littleEndian,52,8);return offset+8}Buffer.prototype.writeDoubleLE=function writeDoubleLE(value,offset,noAssert){return writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function writeDoubleBE(value,offset,noAssert){return writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.copy=function copy(target,targetStart,start,end){if(!Buffer.isBuffer(target))throw new TypeError("argument should be a Buffer");if(!start)start=0;if(!end&&end!==0)end=this.length;if(targetStart>=target.length)targetStart=target.length;if(!targetStart)targetStart=0;if(end>0&&end<start)end=start;if(end===start)return 0;if(target.length===0||this.length===0)return 0;if(targetStart<0){throw new RangeError("targetStart out of bounds")}if(start<0||start>=this.length)throw new RangeError("Index out of range");if(end<0)throw new RangeError("sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-targetStart<end-start){end=target.length-targetStart+start}var len=end-start;if(this===target&&typeof Uint8Array.prototype.copyWithin==="function"){this.copyWithin(targetStart,start,end)}else if(this===target&&start<targetStart&&targetStart<end){for(var i=len-1;i>=0;--i){target[i+targetStart]=this[i+start]}}else{Uint8Array.prototype.set.call(target,this.subarray(start,end),targetStart)}return len};Buffer.prototype.fill=function fill(val,start,end,encoding){if(typeof val==="string"){if(typeof start==="string"){encoding=start;start=0;end=this.length}else if(typeof end==="string"){encoding=end;end=this.length}if(encoding!==undefined&&typeof encoding!=="string"){throw new TypeError("encoding must be a string")}if(typeof encoding==="string"&&!Buffer.isEncoding(encoding)){throw new TypeError("Unknown encoding: "+encoding)}if(val.length===1){var code=val.charCodeAt(0);if(encoding==="utf8"&&code<128||encoding==="latin1"){val=code}}}else if(typeof val==="number"){val=val&255}if(start<0||this.length<start||this.length<end){throw new RangeError("Out of range index")}if(end<=start){return this}start=start>>>0;end=end===undefined?this.length:end>>>0;if(!val)val=0;var i;if(typeof val==="number"){for(i=start;i<end;++i){this[i]=val}}else{var bytes=Buffer.isBuffer(val)?val:Buffer.from(val,encoding);var len=bytes.length;if(len===0){throw new TypeError('The value "'+val+'" is invalid for argument "value"')}for(i=0;i<end-start;++i){this[i+start]=bytes[i%len]}}return this};var INVALID_BASE64_RE=/[^+/0-9A-Za-z-_]/g;function base64clean(str){str=str.split("=")[0];str=str.trim().replace(INVALID_BASE64_RE,"");if(str.length<2)return"";while(str.length%4!==0){str=str+"="}return str}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(string,units){units=units||Infinity;var codePoint;var length=string.length;var leadSurrogate=null;var bytes=[];for(var i=0;i<length;++i){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(!leadSurrogate){if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}leadSurrogate=codePoint;continue}if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}codePoint=(leadSurrogate-55296<<10|codePoint-56320)+65536}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189)}leadSurrogate=null;if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<1114112){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;++i){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function utf16leToBytes(str,units){var c,hi,lo;var byteArray=[];for(var i=0;i<str.length;++i){if((units-=2)<0)break;c=str.charCodeAt(i);hi=c>>8;lo=c%256;byteArray.push(lo);byteArray.push(hi)}return byteArray}function base64ToBytes(str){return base64.toByteArray(base64clean(str))}function blitBuffer(src,dst,offset,length){for(var i=0;i<length;++i){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function isInstance(obj,type){return obj instanceof type||obj!=null&&obj.constructor!=null&&obj.constructor.name!=null&&obj.constructor.name===type.name}function numberIsNaN(obj){return obj!==obj}}).call(this)}).call(this,require("buffer").Buffer)},{"base64-js":23,buffer:27,ieee754:78}],28:[function(require,module,exports){(function(r){"object"==typeof exports&&"object"==typeof module?r(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})((function(r){function I(c){c=c.search(w);return-1==c?0:c}function J(c,d,a){return/\bstring\b/.test(c.getTokenTypeAt(l(d.line,0)))&&!/^['"`]/.test(a)}function G(c,d){var a=c.getMode();return!1!==a.useInnerComments&&a.innerMode?c.getModeAt(d):a}var E={},w=/[^\s\u00a0]/,l=r.Pos,K=r.cmpPos;r.commands.toggleComment=function(c){c.toggleComment()};r.defineExtension("toggleComment",(function(c){c||(c=E);for(var d=Infinity,a=this.listSelections(),b=null,e=a.length-1;0<=e;e--){var g=a[e].from(),f=a[e].to();g.line>=d||(f.line>=d&&(f=l(d,0)),d=g.line,null==b?this.uncomment(g,f,c)?b="un":(this.lineComment(g,f,c),b="line"):"un"==b?this.uncomment(g,f,c):this.lineComment(g,f,c))}}));r.defineExtension("lineComment",(function(c,d,a){a||(a=E);var b=this,e=G(b,c),g=b.getLine(c.line);if(null!=g&&!J(b,c,g)){var f=a.lineComment||e.lineComment;if(f){var m=Math.min(0!=d.ch||d.line==c.line?d.line+1:d.line,b.lastLine()+1),u=null==a.padding?" ":a.padding,k=a.commentBlankLines||c.line==d.line;b.operation((function(){if(a.indent){for(var p=null,h=c.line;h<m;++h){var q=b.getLine(h);q=q.slice(0,I(q));if(null==p||p.length>q.length)p=q}for(h=c.line;h<m;++h){q=b.getLine(h);var t=p.length;if(k||w.test(q))q.slice(0,t)!=p&&(t=I(q)),b.replaceRange(p+f+u,l(h,0),l(h,t))}}else for(h=c.line;h<m;++h)(k||w.test(b.getLine(h)))&&b.replaceRange(f+u,l(h,0))}))}else if(a.blockCommentStart||e.blockCommentStart)a.fullLines=!0,b.blockComment(c,d,a)}}));r.defineExtension("blockComment",(function(c,d,a){a||(a=E);var b=this,e=G(b,c),g=a.blockCommentStart||e.blockCommentStart,f=a.blockCommentEnd||e.blockCommentEnd;if(!g||!f)(a.lineComment||e.lineComment)&&0!=a.fullLines&&b.lineComment(c,d,a);else if(!/\bcomment\b/.test(b.getTokenTypeAt(l(c.line,0)))){var m=Math.min(d.line,b.lastLine());m!=c.line&&0==d.ch&&w.test(b.getLine(m))&&--m;var u=null==a.padding?" ":a.padding;c.line>m||b.operation((function(){if(0!=a.fullLines){var k=w.test(b.getLine(m));b.replaceRange(u+f,l(m));b.replaceRange(g+u,l(c.line,0));var p=a.blockCommentLead||e.blockCommentLead;if(null!=p)for(var h=c.line+1;h<=m;++h)(h!=m||k)&&b.replaceRange(p+u,l(h,0))}else k=0==K(b.getCursor("to"),d),p=!b.somethingSelected(),b.replaceRange(f,d),k&&b.setSelection(p?d:b.getCursor("from"),d),b.replaceRange(g,c)}))}}));r.defineExtension("uncomment",(function(c,d,a){a||(a=E);var b=this,e=G(b,c),g=Math.min(0!=d.ch||d.line==c.line?d.line:d.line-1,b.lastLine()),f=Math.min(c.line,g),m=a.lineComment||e.lineComment,u=[],k=null==a.padding?" ":a.padding,p;a:if(m){for(var h=f;h<=g;++h){var q=b.getLine(h),t=q.indexOf(m);-1<t&&!/comment/.test(b.getTokenTypeAt(l(h,t+1)))&&(t=-1);if(-1==t&&w.test(q))break a;if(-1<t&&w.test(q.slice(0,t)))break a;u.push(q)}b.operation((function(){for(var n=f;n<=g;++n){var A=u[n-f],x=A.indexOf(m),v=x+m.length;0>x||(A.slice(v,v+k.length)==k&&(v+=k.length),p=!0,b.replaceRange("",l(n,x),l(n,v)))}}));if(p)return!0}var y=a.blockCommentStart||e.blockCommentStart,z=a.blockCommentEnd||e.blockCommentEnd;if(!y||!z)return!1;var H=a.blockCommentLead||e.blockCommentLead,C=b.getLine(f),D=C.indexOf(y);if(-1==D)return!1;var F=g==f?C:b.getLine(g),B=F.indexOf(z,g==f?D+y.length:0);a=l(f,D+1);e=l(g,B+1);if(-1==B||!/comment/.test(b.getTokenTypeAt(a))||!/comment/.test(b.getTokenTypeAt(e))||-1<b.getRange(a,e,"\n").indexOf(z))return!1;e=C.lastIndexOf(y,c.ch);a=-1==e?-1:C.slice(0,c.ch).indexOf(z,e+y.length);if(-1!=e&&-1!=a&&a+z.length!=c.ch)return!1;a=F.indexOf(z,d.ch);c=F.slice(d.ch).lastIndexOf(y,a-d.ch);e=-1==a||-1==c?-1:d.ch+c;if(-1!=a&&-1!=e&&e!=d.ch)return!1;b.operation((function(){b.replaceRange("",l(g,B-(k&&F.slice(B-k.length,B)==k?k.length:0)),l(g,B+z.length));var n=D+y.length;k&&C.slice(n,n+k.length)==k&&(n+=k.length);b.replaceRange("",l(f,D),l(f,n));if(H)for(n=f+1;n<=g;++n){var A=b.getLine(n),x=A.indexOf(H);if(-1!=x&&!w.test(A.slice(0,x))){var v=x+H.length;k&&A.slice(v,v+k.length)==k&&(v+=k.length);b.replaceRange("",l(n,x),l(n,v))}}}));return!0}))}))},{"../../lib/codemirror":32}],29:[function(require,module,exports){(function(m){"object"==typeof exports&&"object"==typeof module?m(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],m):m(CodeMirror)})((function(m){function q(a,b){for(var l=0,e=a.length;l<e;++l)b(a[l])}function t(a,b,l,e){var c=a.getCursor(),d=l(a,c);if(!/\b(?:string|comment)\b/.test(d.type)){var g=m.innerMode(a.getMode(),d.state);if("json"!==g.mode.helperType){d.state=g.state;/^[\w$_]*$/.test(d.string)?d.end>c.ch&&(d.end=c.ch,d.string=d.string.slice(0,c.ch-d.start)):d={start:c.ch,end:c.ch,string:"",state:d.state,type:"."==d.string?"property":null};for(g=d;"property"==g.type;){g=l(a,r(c.line,g.start));if("."!=g.string)return;g=l(a,r(c.line,g.start));if(!p)var p=[];p.push(g)}return{list:u(d,p,b,e),from:r(c.line,d.start),to:r(c.line,d.end)}}}}function v(a,b){a=a.getTokenAt(b);b.ch==a.start+1&&"."==a.string.charAt(0)?(a.end=a.start,a.string=".",a.type="property"):/^\.[\w$_]*$/.test(a.string)&&(a.type="property",a.start++,a.string=a.string.replace(/\./,""));return a}function u(a,b,l,e){function c(h){var k;if(k=0==h.lastIndexOf(p,0)){a:if(Array.prototype.indexOf)k=-1!=g.indexOf(h);else{for(k=g.length;k--;)if(g[k]===h){k=!0;break a}k=!1}k=!k}k&&g.push(h)}function d(h){"string"==typeof h?q(w,c):h instanceof Array?q(x,c):h instanceof Function&&q(y,c);if(Object.getOwnPropertyNames&&Object.getPrototypeOf)for(;h;h=Object.getPrototypeOf(h))Object.getOwnPropertyNames(h).forEach(c);else for(var k in h)c(k)}var g=[],p=a.string,n=e&&e.globalScope||window;if(b&&b.length){a=b.pop();var f;a.type&&0===a.type.indexOf("variable")?(e&&e.additionalContext&&(f=e.additionalContext[a.string]),e&&!1===e.useGlobalScope||(f=f||n[a.string])):"string"==a.type?f="":"atom"==a.type?f=1:"function"==a.type&&(null==n.jQuery||"$"!=a.string&&"jQuery"!=a.string||"function"!=typeof n.jQuery?null!=n._&&"_"==a.string&&"function"==typeof n._&&(f=n._()):f=n.jQuery());for(;null!=f&&b.length;)f=f[b.pop().string];null!=f&&d(f)}else{for(b=a.state.localVars;b;b=b.next)c(b.name);for(f=a.state.context;f;f=f.prev)for(b=f.vars;b;b=b.next)c(b.name);for(b=a.state.globalVars;b;b=b.next)c(b.name);if(e&&null!=e.additionalContext)for(var z in e.additionalContext)c(z);e&&!1===e.useGlobalScope||d(n);q(l,c)}return g}var r=m.Pos;m.registerHelper("hint","javascript",(function(a,b){return t(a,A,(function(l,e){return l.getTokenAt(e)}),b)}));m.registerHelper("hint","coffeescript",(function(a,b){return t(a,B,v,b)}));var w="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),x="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),y=["prototype","apply","call","bind"],A="break case catch class const continue debugger default delete do else export extends false finally for function if in import instanceof new null return super switch this throw true try typeof var void while with yield".split(" "),B="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")}))},{"../../lib/codemirror":32}],30:[function(require,module,exports){(function(h){"object"==typeof exports&&"object"==typeof module?h(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],h):h(CodeMirror)})((function(h){function B(a,b){this.cm=a;this.options=b;this.widget=null;this.tick=this.debounce=0;this.startPos=this.cm.getCursor("start");this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;if(this.options.updateOnCursorActivity){var c=this;a.on("cursorActivity",this.activityFunc=function(){c.cursorActivity()})}}function J(a,b){function c(r,g){var m="string"!=typeof g?function(k){return g(k,b)}:d.hasOwnProperty(g)?d[g]:g;p[r]=m}var d={Up:function(){b.moveFocus(-1)},Down:function(){b.moveFocus(1)},PageUp:function(){b.moveFocus(-b.menuSize()+1,!0)},PageDown:function(){b.moveFocus(b.menuSize()-1,!0)},Home:function(){b.setFocus(0)},End:function(){b.setFocus(b.length-1)},Enter:b.pick,Tab:b.pick,Esc:b.close};/Mac/.test(navigator.platform)&&(d["Ctrl-P"]=function(){b.moveFocus(-1)},d["Ctrl-N"]=function(){b.moveFocus(1)});var e=a.options.customKeys,p=e?{}:d;if(e)for(var f in e)e.hasOwnProperty(f)&&c(f,e[f]);if(a=a.options.extraKeys)for(f in a)a.hasOwnProperty(f)&&c(f,a[f]);return p}function C(a,b){for(;b&&b!=a;){if("LI"===b.nodeName.toUpperCase()&&b.parentNode==a)return b;b=b.parentNode}}function D(a,b){this.id="cm-complete-"+Math.floor(Math.random(1e6));this.completion=a;this.data=b;this.picked=!1;var c=this,d=a.cm,e=d.getInputField().ownerDocument,p=e.defaultView||e.parentWindow,f=this.hints=e.createElement("ul");f.setAttribute("role","listbox");f.setAttribute("aria-expanded","true");f.id=this.id;f.className="CodeMirror-hints "+a.cm.options.theme;this.selectedHint=b.selectedHint||0;for(var r=b.list,g=0;g<r.length;++g){var m=f.appendChild(e.createElement("li")),k=r[g],l="CodeMirror-hint"+(g!=this.selectedHint?"":" CodeMirror-hint-active");null!=k.className&&(l=k.className+" "+l);m.className=l;g==this.selectedHint&&m.setAttribute("aria-selected","true");m.id=this.id+"-"+g;m.setAttribute("role","option");k.render?k.render(m,b,k):m.appendChild(e.createTextNode(k.displayText||("string"==typeof k?k:k.text)));m.hintId=g}l=a.options.container||e.body;g=d.cursorCoords(a.options.alignWithWord?b.from:null);var v=g.left,w=g.bottom,E=!0,q=m=0;if(l!==e.body){k=-1!==["absolute","relative","fixed"].indexOf(p.getComputedStyle(l).position)?l:l.offsetParent;var t=k.getBoundingClientRect();q=e.body.getBoundingClientRect();m=t.left-q.left-k.scrollLeft;q=t.top-q.top-k.scrollTop}f.style.left=v-m+"px";f.style.top=w-q+"px";k=p.innerWidth||Math.max(e.body.offsetWidth,e.documentElement.offsetWidth);var y=p.innerHeight||Math.max(e.body.offsetHeight,e.documentElement.offsetHeight);l.appendChild(f);d.getInputField().setAttribute("aria-autocomplete","list");d.getInputField().setAttribute("aria-owns",this.id);d.getInputField().setAttribute("aria-activedescendant",this.id+"-"+this.selectedHint);l=a.options.moveOnOverlap?f.getBoundingClientRect():new DOMRect;t=a.options.paddingForScrollbar?f.scrollHeight>f.clientHeight+1:!1;var u;setTimeout((function(){u=d.getScrollInfo()}));if(0<l.bottom-y){var z=l.bottom-l.top;0<g.top-(g.bottom-l.top)-z?(f.style.top=(w=g.top-z-q)+"px",E=!1):z>y&&(f.style.height=y-5+"px",f.style.top=(w=g.bottom-l.top-q)+"px",q=d.getCursor(),b.from.ch!=q.ch&&(g=d.cursorCoords(q),f.style.left=(v=g.left-m)+"px",l=f.getBoundingClientRect()))}q=l.right-k;t&&(q+=d.display.nativeBarWidth);0<q&&(l.right-l.left>k&&(f.style.width=k-5+"px",q-=l.right-l.left-k),f.style.left=(v=g.left-q-m)+"px");if(t)for(g=f.firstChild;g;g=g.nextSibling)g.style.paddingRight=d.display.nativeBarWidth+"px";d.addKeyMap(this.keyMap=J(a,{moveFocus:function(n,x){c.changeActive(c.selectedHint+n,x)},setFocus:function(n){c.changeActive(n)},menuSize:function(){return c.screenAmount()},length:r.length,close:function(){a.close()},pick:function(){c.pick()},data:b}));if(a.options.closeOnUnfocus){var F;d.on("blur",this.onBlur=function(){F=setTimeout((function(){a.close()}),100)});d.on("focus",this.onFocus=function(){clearTimeout(F)})}d.on("scroll",this.onScroll=function(){var n=d.getScrollInfo(),x=d.getWrapperElement().getBoundingClientRect();u||(u=d.getScrollInfo());var G=w+u.top-n.top,A=G-(p.pageYOffset||(e.documentElement||e.body).scrollTop);E||(A+=f.offsetHeight);if(A<=x.top||A>=x.bottom)return a.close();f.style.top=G+"px";f.style.left=v+u.left-n.left+"px"});h.on(f,"dblclick",(function(n){(n=C(f,n.target||n.srcElement))&&null!=n.hintId&&(c.changeActive(n.hintId),c.pick())}));h.on(f,"click",(function(n){(n=C(f,n.target||n.srcElement))&&null!=n.hintId&&(c.changeActive(n.hintId),a.options.completeOnSingleClick&&c.pick())}));h.on(f,"mousedown",(function(){setTimeout((function(){d.focus()}),20)}));g=this.getSelectedHintRange();0===g.from&&0===g.to||this.scrollToActive();h.signal(b,"select",r[this.selectedHint],f.childNodes[this.selectedHint]);return!0}function K(a,b){if(!a.somethingSelected())return b;a=[];for(var c=0;c<b.length;c++)b[c].supportsSelection&&a.push(b[c]);return a}function H(a,b,c,d){a.async?a(b,d,c):(a=a(b,c))&&a.then?a.then(d):d(a)}h.showHint=function(a,b,c){if(!b)return a.showHint(c);c&&c.async&&(b.async=!0);b={hint:b};if(c)for(var d in c)b[d]=c[d];return a.showHint(b)};h.defineExtension("showHint",(function(a){var b=this.getCursor("start"),c=this.options.hintOptions,d={},e;for(e in I)d[e]=I[e];if(c)for(e in c)void 0!==c[e]&&(d[e]=c[e]);if(a)for(e in a)void 0!==a[e]&&(d[e]=a[e]);d.hint.resolve&&(d.hint=d.hint.resolve(this,b));a=d;b=this.listSelections();if(!(1<b.length)){if(this.somethingSelected()){if(!a.hint.supportsSelection)return;for(e=0;e<b.length;e++)if(b[e].head.line!=b[e].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();b=this.state.completionActive=new B(this,a);b.options.hint&&(h.signal(this,"startCompletion",this),b.update(!0))}}));h.defineExtension("closeHint",(function(){this.state.completionActive&&this.state.completionActive.close()}));var L=window.requestAnimationFrame||function(a){return setTimeout(a,1e3/60)},M=window.cancelAnimationFrame||clearTimeout;B.prototype={close:function(){this.active()&&(this.tick=this.cm.state.completionActive=null,this.options.updateOnCursorActivity&&this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&h.signal(this.data,"close"),this.widget&&this.widget.close(),h.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(a,b){var c=a.list[b],d=this;this.cm.operation((function(){c.hint?c.hint(d.cm,a,c):d.cm.replaceRange("string"==typeof c?c:c.text,c.from||a.from,c.to||a.to,"complete");h.signal(a,"pick",c);d.cm.scrollIntoView()}));this.options.closeOnPick&&this.close()},cursorActivity:function(){this.debounce&&(M(this.debounce),this.debounce=0);var a=this.startPos;this.data&&(a=this.data.from);var b=this.cm.getCursor(),c=this.cm.getLine(b.line);if(b.line!=this.startPos.line||c.length-b.ch!=this.startLen-this.startPos.ch||b.ch<a.ch||this.cm.somethingSelected()||!b.ch||this.options.closeCharacters.test(c.charAt(b.ch-1)))this.close();else{var d=this;this.debounce=L((function(){d.update()}));this.widget&&this.widget.disable()}},update:function(a){if(null!=this.tick){var b=this,c=++this.tick;H(this.options.hint,this.cm,this.options,(function(d){b.tick==c&&b.finishUpdate(d,a)}))}},finishUpdate:function(a,b){this.data&&h.signal(this.data,"update");b=this.widget&&this.widget.picked||b&&this.options.completeSingle;this.widget&&this.widget.close();(this.data=a)&&a.list.length&&(b&&1==a.list.length?this.pick(a,0):(this.widget=new D(this,a),h.signal(a,"shown")))}};D.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null;this.hints.parentNode&&this.hints.parentNode.removeChild(this.hints);this.completion.cm.removeKeyMap(this.keyMap);var a=this.completion.cm.getInputField();a.removeAttribute("aria-activedescendant");a.removeAttribute("aria-owns");a=this.completion.cm;this.completion.options.closeOnUnfocus&&(a.off("blur",this.onBlur),a.off("focus",this.onFocus));a.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var a=this;this.keyMap={Enter:function(){a.picked=!0}};this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(a,b){a>=this.data.list.length?a=b?this.data.list.length-1:0:0>a&&(a=b?0:this.data.list.length-1);if(this.selectedHint!=a){if(b=this.hints.childNodes[this.selectedHint])b.className=b.className.replace(" CodeMirror-hint-active",""),b.removeAttribute("aria-selected");b=this.hints.childNodes[this.selectedHint=a];b.className+=" CodeMirror-hint-active";b.setAttribute("aria-selected","true");this.completion.cm.getInputField().setAttribute("aria-activedescendant",b.id);this.scrollToActive();h.signal(this.data,"select",this.data.list[this.selectedHint],b)}},scrollToActive:function(){var a=this.getSelectedHintRange(),b=this.hints.childNodes[a.from];a=this.hints.childNodes[a.to];var c=this.hints.firstChild;b.offsetTop<this.hints.scrollTop?this.hints.scrollTop=b.offsetTop-c.offsetTop:a.offsetTop+a.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=a.offsetTop+a.offsetHeight-this.hints.clientHeight+c.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1},getSelectedHintRange:function(){var a=this.completion.options.scrollMargin||0;return{from:Math.max(0,this.selectedHint-a),to:Math.min(this.data.list.length-1,this.selectedHint+a)}}};h.registerHelper("hint","auto",{resolve:function(a,b){var c=a.getHelpers(b,"hint"),d;return c.length?(a=function(e,p,f){function r(m){if(m==g.length)return p(null);H(g[m],e,f,(function(k){k&&0<k.list.length?p(k):r(m+1)}))}var g=K(e,c);r(0)},a.async=!0,a.supportsSelection=!0,a):(d=a.getHelper(a.getCursor(),"hintWords"))?function(e){return h.hint.fromList(e,{words:d})}:h.hint.anyword?function(e,p){return h.hint.anyword(e,p)}:function(){}}});h.registerHelper("hint","fromList",(function(a,b){var c=a.getCursor(),d=a.getTokenAt(c);a=h.Pos(c.line,d.start);d.start<c.ch&&/\w/.test(d.string.charAt(c.ch-d.start-1))?d=d.string.substr(0,c.ch-d.start):(d="",a=c);for(var e=[],p=0;p<b.words.length;p++){var f=b.words[p];f.slice(0,d.length)==d&&e.push(f)}if(e.length)return{list:e,from:a,to:c}}));h.commands.autocomplete=h.showHint;var I={hint:h.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnPick:!0,closeOnUnfocus:!0,updateOnCursorActivity:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null,paddingForScrollbar:!0,moveOnOverlap:!0};h.defineOption("hintOptions",null)}))},{"../../lib/codemirror":32}],31:[function(require,module,exports){(function(global){(function(){var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(a,d,c){a instanceof String&&(a=String(a));for(var e=a.length,f=0;f<e;f++){var m=a[f];if(d.call(c,m,f,a))return{i:f,v:m}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(a,d,c){if(a==Array.prototype||a==Object.prototype)return a;a[d]=c.value;return a};$jscomp.getGlobal=function(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var d=0;d<a.length;++d){var c=a[d];if(c&&c.Math==Math)return c}throw Error("Cannot find global object")};$jscomp.global=$jscomp.getGlobal(this);$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(a,d){var c=$jscomp.propertyToPolyfillSymbol[d];if(null==c)return a[d];c=a[c];return void 0!==c?c:a[d]};$jscomp.polyfill=function(a,d,c,e){d&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(a,d,c,e):$jscomp.polyfillUnisolated(a,d,c,e))};$jscomp.polyfillUnisolated=function(a,d,c,e){c=$jscomp.global;a=a.split(".");for(e=0;e<a.length-1;e++){var f=a[e];if(!(f in c))return;c=c[f]}a=a[a.length-1];e=c[a];d=d(e);d!=e&&null!=d&&$jscomp.defineProperty(c,a,{configurable:!0,writable:!0,value:d})};$jscomp.polyfillIsolated=function(a,d,c,e){var f=a.split(".");a=1===f.length;e=f[0];e=!a&&e in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var m=0;m<f.length-1;m++){var r=f[m];if(!(r in e))return;e=e[r]}f=f[f.length-1];c=$jscomp.IS_SYMBOL_NATIVE&&"es6"===c?e[f]:null;d=d(c);null!=d&&(a?$jscomp.defineProperty($jscomp.polyfills,f,{configurable:!0,writable:!0,value:d}):d!==c&&(void 0===$jscomp.propertyToPolyfillSymbol[f]&&(c=1e9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[f]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(f):$jscomp.POLYFILL_PREFIX+c+"$"+f),$jscomp.defineProperty(e,$jscomp.propertyToPolyfillSymbol[f],{configurable:!0,writable:!0,value:d})))};$jscomp.polyfill("Array.prototype.find",(function(a){return a?a:function(d,c){return $jscomp.findInternal(this,d,c).v}}),"es6","es3");(function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)})((function(a){function d(b){b.state.markedSelection&&b.operation((function(){r(b)}))}function c(b){b.state.markedSelection&&b.state.markedSelection.length&&b.operation((function(){f(b)}))}function e(b,g,h,k){if(0!=p(g,h))for(var l=b.state.markedSelection,n=b.state.markedSelectionStyle,q=g.line;;){var t=q==g.line?g:v(q,0);q+=u;var w=q>=h.line,x=w?h:v(q,0);t=b.markText(t,x,{className:n});null==k?l.push(t):l.splice(k++,0,t);if(w)break}}function f(b){b=b.state.markedSelection;for(var g=0;g<b.length;++g)b[g].clear();b.length=0}function m(b){f(b);for(var g=b.listSelections(),h=0;h<g.length;h++)e(b,g[h].from(),g[h].to())}function r(b){if(!b.somethingSelected())return f(b);if(1<b.listSelections().length)return m(b);var g=b.getCursor("start"),h=b.getCursor("end"),k=b.state.markedSelection;if(!k.length)return e(b,g,h);var l=k[0].find(),n=k[k.length-1].find();if(!l||!n||h.line-g.line<=u||0<=p(g,n.to)||0>=p(h,l.from))return m(b);for(;0<p(g,l.from);)k.shift().clear(),l=k[0].find();0>p(g,l.from)&&(l.to.line-g.line<u?(k.shift().clear(),e(b,g,l.to,0)):e(b,g,l.from,0));for(;0>p(h,n.to);)k.pop().clear(),n=k[k.length-1].find();0<p(h,n.to)&&(h.line-n.from.line<u?(k.pop().clear(),e(b,n.from,h)):e(b,n.to,h))}a.defineOption("styleSelectedText",!1,(function(b,g,h){h=h&&h!=a.Init;g&&!h?(b.state.markedSelection=[],b.state.markedSelectionStyle="string"==typeof g?g:"CodeMirror-selectedtext",m(b),b.on("cursorActivity",d),b.on("change",c)):!g&&h&&(b.off("cursorActivity",d),b.off("change",c),f(b),b.state.markedSelection=b.state.markedSelectionStyle=null)}));var u=8,v=a.Pos,p=a.cmpPos}))}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"../../lib/codemirror":32}],32:[function(require,module,exports){(function(global){(function(){var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(y,E,D){y instanceof String&&(y=String(y));for(var v=y.length,M=0;M<v;M++){var ja=y[M];if(E.call(D,ja,M,y))return{i:M,v:ja}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(y,E,D){if(y==Array.prototype||y==Object.prototype)return y;y[E]=D.value;return y};$jscomp.getGlobal=function(y){y=["object"==typeof globalThis&&globalThis,y,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var E=0;E<y.length;++E){var D=y[E];if(D&&D.Math==Math)return D}throw Error("Cannot find global object")};$jscomp.global=$jscomp.getGlobal(this);$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(y,E){var D=$jscomp.propertyToPolyfillSymbol[E];if(null==D)return y[E];D=y[D];return void 0!==D?D:y[E]};$jscomp.polyfill=function(y,E,D,v){E&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(y,E,D,v):$jscomp.polyfillUnisolated(y,E,D,v))};$jscomp.polyfillUnisolated=function(y,E,D,v){D=$jscomp.global;y=y.split(".");for(v=0;v<y.length-1;v++){var M=y[v];if(!(M in D))return;D=D[M]}y=y[y.length-1];v=D[y];E=E(v);E!=v&&null!=E&&$jscomp.defineProperty(D,y,{configurable:!0,writable:!0,value:E})};$jscomp.polyfillIsolated=function(y,E,D,v){var M=y.split(".");y=1===M.length;v=M[0];v=!y&&v in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var ja=0;ja<M.length-1;ja++){var ka=M[ja];if(!(ka in v))return;v=v[ka]}M=M[M.length-1];D=$jscomp.IS_SYMBOL_NATIVE&&"es6"===D?v[M]:null;E=E(D);null!=E&&(y?$jscomp.defineProperty($jscomp.polyfills,M,{configurable:!0,writable:!0,value:E}):E!==D&&(void 0===$jscomp.propertyToPolyfillSymbol[M]&&(D=1e9*Math.random()>>>0,$jscomp.propertyToPolyfillSymbol[M]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(M):$jscomp.POLYFILL_PREFIX+D+"$"+M),$jscomp.defineProperty(v,$jscomp.propertyToPolyfillSymbol[M],{configurable:!0,writable:!0,value:E})))};$jscomp.polyfill("Array.prototype.find",(function(y){return y?y:function(E,D){return $jscomp.findInternal(this,E,D).v}}),"es6","es3");(function(y,E){"object"===typeof exports&&"undefined"!==typeof module?module.exports=E():"function"===typeof define&&define.amd?define(E):(y=y||self,y.CodeMirror=E())})(this,(function(){function y(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function E(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function D(a,b){return E(a).appendChild(b)}function v(a,b,d,c){a=document.createElement(a);d&&(a.className=d);c&&(a.style.cssText=c);if("string"==typeof b)a.appendChild(document.createTextNode(b));else if(b)for(d=0;d<b.length;++d)a.appendChild(b[d]);return a}function M(a,b,d,c){a=v(a,b,d,c);a.setAttribute("role","presentation");return a}function ja(a,b){3==b.nodeType&&(b=b.parentNode);if(a.contains)return a.contains(b);do{if(11==b.nodeType&&(b=b.host),b==a)return!0}while(b=b.parentNode)}function ka(){try{var a=document.activeElement}catch(b){a=document.body||null}for(;a&&a.shadowRoot&&a.shadowRoot.activeElement;)a=a.shadowRoot.activeElement;return a}function Wa(a,b){var d=a.className;y(b).test(d)||(a.className+=(d?" ":"")+b)}function ed(a,b){a=a.split(" ");for(var d=0;d<a.length;d++)a[d]&&!y(a[d]).test(b)&&(b+=" "+a[d]);return b}function fd(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function Xa(a,b,d){b||(b={});for(var c in a)!a.hasOwnProperty(c)||!1===d&&b.hasOwnProperty(c)||(b[c]=a[c]);return b}function va(a,b,d,c,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));c=c||0;for(e=e||0;;){var f=a.indexOf("\t",c);if(0>f||f>=b)return e+(b-c);e+=f-c;e+=d-e%d;c=f+1}}function ea(a,b){for(var d=0;d<a.length;++d)if(a[d]==b)return d;return-1}function gd(a,b,d){for(var c=0,e=0;;){var f=a.indexOf("\t",c);-1==f&&(f=a.length);var g=f-c;if(f==a.length||e+g>=b)return c+Math.min(g,b-e);e+=f-c;e+=d-e%d;c=f+1;if(e>=b)return c}}function hd(a){for(;tc.length<=a;)tc.push(J(tc)+" ");return tc[a]}function J(a){return a[a.length-1]}function uc(a,b){for(var d=[],c=0;c<a.length;c++)d[c]=b(a[c],c);return d}function wg(a,b,d){for(var c=0,e=d(b);c<a.length&&d(a[c])<=e;)c++;a.splice(c,0,b)}function ne(){}function oe(a,b){Object.create?a=Object.create(a):(ne.prototype=a,a=new ne);b&&Xa(b,a);return a}function id(a){return/\w/.test(a)||"€"<a&&(a.toUpperCase()!=a.toLowerCase()||xg.test(a))}function vc(a,b){return b?-1<b.source.indexOf("\\w")&&id(a)?!0:b.test(a):id(a)}function pe(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}function jd(a){return 768<=a.charCodeAt(0)&&yg.test(a)}function qe(a,b,d){for(;(0>d?0<b:b<a.length)&&jd(a.charAt(b));)b+=d;return b}function Hb(a,b,d){for(var c=b>d?-1:1;;){if(b==d)return b;var e=(b+d)/2;e=0>c?Math.ceil(e):Math.floor(e);if(e==b)return a(e)?b:d;a(e)?d=e:b=e+c}}function zg(a,b,d,c){if(!a)return c(b,d,"ltr",0);for(var e=!1,f=0;f<a.length;++f){var g=a[f];if(g.from<d&&g.to>b||b==d&&g.to==b)c(Math.max(g.from,b),Math.min(g.to,d),1==g.level?"rtl":"ltr",f),e=!0}e||c(b,d,"ltr")}function Ib(a,b,d){var c;Jb=null;for(var e=0;e<a.length;++e){var f=a[e];if(f.from<b&&f.to>b)return e;f.to==b&&(f.from!=f.to&&"before"==d?c=e:Jb=e);f.from==b&&(f.from!=f.to&&"before"!=d?c=e:Jb=e)}return null!=c?c:Jb}function Ia(a,b){var d=a.order;null==d&&(d=a.order=Ag(a.text,b));return d}function sa(a,b,d){if(a.removeEventListener)a.removeEventListener(b,d,!1);else if(a.detachEvent)a.detachEvent("on"+b,d);else{var c=(a=a._handlers)&&a[b];c&&(d=ea(c,d),-1<d&&(a[b]=c.slice(0,d).concat(c.slice(d+1))))}}function W(a,b){var d=a._handlers&&a._handlers[b]||wc;if(d.length)for(var c=Array.prototype.slice.call(arguments,2),e=0;e<d.length;++e)d[e].apply(null,c)}function Z(a,b,d){"string"==typeof b&&(b={type:b,preventDefault:function(){this.defaultPrevented=!0}});W(a,d||b.type,a,b);return kd(b)||b.codemirrorIgnore}function re(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var d=0;d<b.length;++d)-1==ea(a,b[d])&&a.push(b[d])}}function wa(a,b){return 0<(a._handlers&&a._handlers[b]||wc).length}function nb(a){a.prototype.on=function(b,d){z(this,b,d)};a.prototype.off=function(b,d){sa(this,b,d)}}function la(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function se(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function kd(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Kb(a){la(a);se(a)}function te(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));xa&&a.ctrlKey&&1==b&&(b=3);return b}function Bg(a,b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));ld[a]=b}function xc(a){if("string"==typeof a&&ob.hasOwnProperty(a))a=ob[a];else if(a&&"string"==typeof a.name&&ob.hasOwnProperty(a.name)){var b=ob[a.name];"string"==typeof b&&(b={name:b});a=oe(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return xc("application/xml");if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return xc("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function md(a,b){b=xc(b);var d=ld[b.name];if(!d)return md(a,"text/plain");a=d(a,b);if(pb.hasOwnProperty(b.name)){d=pb[b.name];for(var c in d)d.hasOwnProperty(c)&&(a.hasOwnProperty(c)&&(a["_"+c]=a[c]),a[c]=d[c])}a.name=b.name;b.helperType&&(a.helperType=b.helperType);if(b.modeProps)for(var e in b.modeProps)a[e]=b.modeProps[e];return a}function Cg(a,b){a=pb.hasOwnProperty(a)?pb[a]:pb[a]={};Xa(b,a)}function Ya(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);a={};for(var d in b){var c=b[d];c instanceof Array&&(c=c.concat([]));a[d]=c}return a}function nd(a,b){for(var d;a.innerMode;){d=a.innerMode(b);if(!d||d.mode==a)break;b=d.state;a=d.mode}return d||{mode:a,state:b}}function ue(a,b,d){return a.startState?a.startState(b,d):!0}function w(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(;!a.lines;)for(var d=0;;++d){var c=a.children[d],e=c.chunkSize();if(b<e){a=c;break}b-=e}return a.lines[b]}function Za(a,b,d){var c=[],e=b.line;a.iter(b.line,d.line+1,(function(f){f=f.text;e==d.line&&(f=f.slice(0,d.ch));e==b.line&&(f=f.slice(b.ch));c.push(f);++e}));return c}function od(a,b,d){var c=[];a.iter(b,d,(function(e){c.push(e.text)}));return c}function Ca(a,b){if(b-=a.height)for(;a;a=a.parent)a.height+=b}function N(a){if(null==a.parent)return null;var b=a.parent;a=ea(b.lines,a);for(var d=b.parent;d;b=d,d=d.parent)for(var c=0;d.children[c]!=b;++c)a+=d.children[c].chunkSize();return a+b.first}function $a(a,b){var d=a.first;a:do{for(var c=0;c<a.children.length;++c){var e=a.children[c],f=e.height;if(b<f){a=e;continue a}b-=f;d+=e.chunkSize()}return d}while(!a.lines);for(c=0;c<a.lines.length;++c){e=a.lines[c].height;if(b<e)break;b-=e}return d+c}function Lb(a,b){return b>=a.first&&b<a.first+a.size}function pd(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function t(a,b,d){void 0===d&&(d=null);if(!(this instanceof t))return new t(a,b,d);this.line=a;this.ch=b;this.sticky=d}function B(a,b){return a.line-b.line||a.ch-b.ch}function qd(a,b){return a.sticky==b.sticky&&0==B(a,b)}function rd(a){return t(a.line,a.ch)}function yc(a,b){return 0>B(a,b)?b:a}function zc(a,b){return 0>B(a,b)?a:b}function C(a,b){if(b.line<a.first)return t(a.first,0);var d=a.first+a.size-1;if(b.line>d)return t(d,w(a,d).text.length);a=w(a,b.line).text.length;d=b.ch;b=null==d||d>a?t(b.line,a):0>d?t(b.line,0):b;return b}function ve(a,b){for(var d=[],c=0;c<b.length;c++)d[c]=C(a,b[c]);return d}function we(a,b,d,c){var e=[a.state.modeGen],f={};xe(a,b.text,a.doc.mode,d,(function(k,l){return e.push(k,l)}),f,c);var g=d.state;c=function(k){d.baseTokens=e;var l=a.state.overlays[k],m=1,n=0;d.state=!0;xe(a,b.text,l.mode,d,(function(p,q){for(var r=m;n<p;){var u=e[m];u>p&&e.splice(m,1,p,e[m+1],u);m+=2;n=Math.min(p,u)}if(q)if(l.opaque)e.splice(r,m-r,p,"overlay "+q),m=r+2;else for(;r<m;r+=2)p=e[r+1],e[r+1]=(p?p+" ":"")+"overlay "+q}),f);d.state=g;d.baseTokens=null;d.baseTokenPos=1};for(var h=0;h<a.state.overlays.length;++h)c(h);return{styles:e,classes:f.bgClass||f.textClass?f:null}}function ye(a,b,d){if(!b.styles||b.styles[0]!=a.state.modeGen){var c=Mb(a,N(b)),e=b.text.length>a.options.maxHighlightLength&&Ya(a.doc.mode,c.state),f=we(a,b,c);e&&(c.state=e);b.stateAfter=c.save(!e);b.styles=f.styles;f.classes?b.styleClasses=f.classes:b.styleClasses&&(b.styleClasses=null);d===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function Mb(a,b,d){var c=a.doc,e=a.display;if(!c.mode.startState)return new Da(c,!0,b);var f=Dg(a,b,d),g=f>c.first&&w(c,f-1).stateAfter,h=g?Da.fromSaved(c,g,f):new Da(c,ue(c.mode),f);c.iter(f,b,(function(k){sd(a,k.text,h);var l=h.line;k.stateAfter=l==b-1||0==l%5||l>=e.viewFrom&&l<e.viewTo?h.save():null;h.nextLine()}));d&&(c.modeFrontier=h.line);return h}function sd(a,b,d,c){var e=a.doc.mode;a=new X(b,a.options.tabSize,d);a.start=a.pos=c||0;for(""==b&&ze(e,d.state);!a.eol();)td(e,a,d.state),a.start=a.pos}function ze(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode&&(a=nd(a,b),a.mode.blankLine))return a.mode.blankLine(a.state)}function td(a,b,d,c){for(var e=0;10>e;e++){c&&(c[0]=nd(a,d).mode);var f=a.token(b,d);if(b.pos>b.start)return f}throw Error("Mode "+a.name+" failed to advance stream.")}function Ae(a,b,d,c){var e=a.doc,f=e.mode;b=C(e,b);var g=w(e,b.line);d=Mb(a,b.line,d);a=new X(g.text,a.options.tabSize,d);var h;for(c&&(h=[]);(c||a.pos<b.ch)&&!a.eol();){a.start=a.pos;var k=td(f,a,d.state);c&&h.push(new Be(a,k,Ya(e.mode,d.state)))}return c?h:new Be(a,k,d.state)}function Ce(a,b){if(a)for(;;){var d=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!d)break;a=a.slice(0,d.index)+a.slice(d.index+d[0].length);var c=d[1]?"bgClass":"textClass";null==b[c]?b[c]=d[2]:new RegExp("(?:^|\\s)"+d[2]+"(?:$|\\s)").test(b[c])||(b[c]+=" "+d[2])}return a}function xe(a,b,d,c,e,f,g){var h=d.flattenSpans;null==h&&(h=a.options.flattenSpans);var k=0,l=null,m=new X(b,a.options.tabSize,c),n=a.options.addModeClass&&[null];for(""==b&&Ce(ze(d,c.state),f);!m.eol();){if(m.pos>a.options.maxHighlightLength){h=!1;g&&sd(a,b,c,m.pos);m.pos=b.length;var p=null}else p=Ce(td(d,m,c.state,n),f);if(n){var q=n[0].name;q&&(p="m-"+(p?q+" "+p:q))}if(!h||l!=p){for(;k<m.start;)k=Math.min(m.start,k+5e3),e(k,l);l=p}m.start=m.pos}for(;k<m.pos;)a=Math.min(m.pos,k+5e3),e(a,l),k=a}function Dg(a,b,d){for(var c,e,f=a.doc,g=d?-1:b-(a.doc.mode.innerMode?1e3:100);b>g;--b){if(b<=f.first)return f.first;var h=w(f,b-1),k=h.stateAfter;if(k&&(!d||b+(k instanceof Ac?k.lookAhead:0)<=f.modeFrontier))return b;h=va(h.text,null,a.options.tabSize);if(null==e||c>h)e=b-1,c=h}return e}function Eg(a,b){a.modeFrontier=Math.min(a.modeFrontier,b);if(!(a.highlightFrontier<b-10)){for(var d=a.first,c=b-1;c>d;c--){var e=w(a,c).stateAfter;if(e&&(!(e instanceof Ac)||c+e.lookAhead<b)){d=c+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,d)}}function Bc(a,b,d){this.marker=a;this.from=b;this.to=d}function Nb(a,b){if(a)for(var d=0;d<a.length;++d){var c=a[d];if(c.marker==b)return c}}function ud(a,b){if(b.full)return null;var d=Lb(a,b.from.line)&&w(a,b.from.line).markedSpans,c=Lb(a,b.to.line)&&w(a,b.to.line).markedSpans;if(!d&&!c)return null;a=b.from.ch;var e=b.to.ch,f=0==B(b.from,b.to),g;if(d)for(var h=0;h<d.length;++h){var k=d[h],l=k.marker;if(null==k.from||(l.inclusiveLeft?k.from<=a:k.from<a)||!(k.from!=a||"bookmark"!=l.type||f&&k.marker.insertLeft)){var m=null==k.to||(l.inclusiveRight?k.to>=a:k.to>a);(g||(g=[])).push(new Bc(l,k.from,m?null:k.to))}}d=g;var n;if(c)for(g=0;g<c.length;++g)if(h=c[g],k=h.marker,null==h.to||(k.inclusiveRight?h.to>=e:h.to>e)||h.from==e&&"bookmark"==k.type&&(!f||h.marker.insertLeft))l=null==h.from||(k.inclusiveLeft?h.from<=e:h.from<e),(n||(n=[])).push(new Bc(k,l?null:h.from-e,null==h.to?null:h.to-e));c=1==b.text.length;e=J(b.text).length+(c?a:0);if(d)for(f=0;f<d.length;++f)if(g=d[f],null==g.to)(h=Nb(n,g.marker),h)?c&&(g.to=null==h.to?null:h.to+e):g.to=a;if(n)for(a=0;a<n.length;++a)f=n[a],null!=f.to&&(f.to+=e),null==f.from?Nb(d,f.marker)||(f.from=e,c&&(d||(d=[])).push(f)):(f.from+=e,c&&(d||(d=[])).push(f));d&&(d=De(d));n&&n!=d&&(n=De(n));a=[d];if(!c){b=b.text.length-2;var p;if(0<b&&d)for(c=0;c<d.length;++c)null==d[c].to&&(p||(p=[])).push(new Bc(d[c].marker,null,null));for(d=0;d<b;++d)a.push(p);a.push(n)}return a}function De(a){for(var b=0;b<a.length;++b){var d=a[b];null!=d.from&&d.from==d.to&&!1!==d.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}function Fg(a,b,d){var c=null;a.iter(b.line,d.line+1,(function(m){if(m.markedSpans)for(var n=0;n<m.markedSpans.length;++n){var p=m.markedSpans[n].marker;!p.readOnly||c&&-1!=ea(c,p)||(c||(c=[])).push(p)}}));if(!c)return null;a=[{from:b,to:d}];for(b=0;b<c.length;++b){d=c[b];for(var e=d.find(0),f=0;f<a.length;++f){var g=a[f];if(!(0>B(g.to,e.from)||0<B(g.from,e.to))){var h=[f,1],k=B(g.from,e.from),l=B(g.to,e.to);(0>k||!d.inclusiveLeft&&!k)&&h.push({from:g.from,to:e.from});(0<l||!d.inclusiveRight&&!l)&&h.push({from:e.to,to:g.to});a.splice.apply(a,h);f+=h.length-3}}}return a}function Ee(a){var b=a.markedSpans;if(b){for(var d=0;d<b.length;++d)b[d].marker.detachLine(a);a.markedSpans=null}}function Fe(a,b){if(b){for(var d=0;d<b.length;++d)b[d].marker.attachLine(a);a.markedSpans=b}}function vd(a,b){var d=a.lines.length-b.lines.length;if(0!=d)return d;d=a.find();var c=b.find(),e=B(d.from,c.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(d=B(d.to,c.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?d:b.id-a.id}function qb(a,b){a=Ja&&a.markedSpans;if(a)for(var d,c=0;c<a.length;++c)if(d=a[c],d.marker.collapsed&&null==(b?d.from:d.to)&&(!e||0>vd(e,d.marker)))var e=d.marker;return e}function Ge(a,b,d,c,e){a=w(a,b);if(a=Ja&&a.markedSpans)for(b=0;b<a.length;++b){var f=a[b];if(f.marker.collapsed){var g=f.marker.find(0),h=B(g.from,d)||(f.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),k=B(g.to,c)||(f.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(0<=h&&0>=k||0>=h&&0<=k)&&(0>=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0<=B(g.to,d):0<B(g.to,d))||0<=h&&(f.marker.inclusiveRight&&e.inclusiveLeft?0>=B(g.from,c):0>B(g.from,c))))return!0}}}function Ea(a){for(var b;b=qb(a,!0);)a=b.find(-1,!0).line;return a}function wd(a,b){a=w(a,b);var d=Ea(a);return a==d?b:N(d)}function He(a,b){if(b>a.lastLine())return b;var d=w(a,b);if(!Oa(a,d))return b;for(;a=qb(d,!1);)d=a.find(1,!0).line;return N(d)+1}function Oa(a,b){var d=Ja&&b.markedSpans;if(d)for(var c,e=0;e<d.length;++e)if(c=d[e],c.marker.collapsed&&(null==c.from||!c.marker.widgetNode&&0==c.from&&c.marker.inclusiveLeft&&xd(a,b,c)))return!0}function xd(a,b,d){if(null==d.to)return b=d.marker.find(1,!0),xd(a,b.line,Nb(b.line.markedSpans,d.marker));if(d.marker.inclusiveRight&&d.to==b.text.length)return!0;for(var c,e=0;e<b.markedSpans.length;++e)if(c=b.markedSpans[e],c.marker.collapsed&&!c.marker.widgetNode&&c.from==d.to&&(null==c.to||c.to!=d.from)&&(c.marker.inclusiveLeft||d.marker.inclusiveRight)&&xd(a,b,c))return!0}function Fa(a){a=Ea(a);for(var b=0,d=a.parent,c=0;c<d.lines.length;++c){var e=d.lines[c];if(e==a)break;else b+=e.height}for(a=d.parent;a;d=a,a=d.parent)for(c=0;c<a.children.length&&(e=a.children[c],e!=d);++c)b+=e.height;return b}function Cc(a){if(0==a.height)return 0;for(var b=a.text.length,d,c=a;d=qb(c,!0);)d=d.find(0,!0),c=d.from.line,b+=d.from.ch-d.to.ch;for(c=a;d=qb(c,!1);)a=d.find(0,!0),b-=c.text.length-a.from.ch,c=a.to.line,b+=c.text.length-a.to.ch;return b}function yd(a){var b=a.display;a=a.doc;b.maxLine=w(a,a.first);b.maxLineLength=Cc(b.maxLine);b.maxLineChanged=!0;a.iter((function(d){var c=Cc(d);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=d)}))}function Ie(a,b){if(!a||/^\s*$/.test(a))return null;b=b.addModeClass?Gg:Hg;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function Je(a,b){var d=M("span",null,null,fa?"padding-right: .1px":null);d={pre:M("pre",[d],"CodeMirror-line"),content:d,col:0,pos:0,cm:a,trailingSpace:!1,splitSpaces:a.getOption("lineWrapping")};b.measure={};for(var c=0;c<=(b.rest?b.rest.length:0);c++){var e=c?b.rest[c-1]:b.line,f=void 0;d.pos=0;d.addToken=Ig;var g=a.display.measure;if(null!=zd)g=zd;else{var h=D(g,document.createTextNode("AخA")),k=Ob(h,0,1).getBoundingClientRect();h=Ob(h,1,2).getBoundingClientRect();E(g);g=k&&k.left!=k.right?zd=3>h.right-k.right:!1}g&&(f=Ia(e,a.doc.direction))&&(d.addToken=Jg(d.addToken,f));d.map=[];var l=b!=a.display.externalMeasured&&N(e);a:{var m=h=k=g=void 0,n=void 0,p=void 0,q=void 0;f=d;l=ye(a,e,l);var r=e.markedSpans,u=e.text,A=0;if(r)for(var Y=u.length,x=0,P=1,K="",Q=0;;){if(Q==x){n=m=h=p="";k=g=null;Q=Infinity;for(var S=[],F=void 0,R=0;R<r.length;++R){var H=r[R],L=H.marker;if("bookmark"==L.type&&H.from==x&&L.widgetNode)S.push(L);else if(H.from<=x&&(null==H.to||H.to>x||L.collapsed&&H.to==x&&H.from==x)){null!=H.to&&H.to!=x&&Q>H.to&&(Q=H.to,m="");L.className&&(n+=" "+L.className);L.css&&(p=(p?p+";":"")+L.css);L.startStyle&&H.from==x&&(h+=" "+L.startStyle);L.endStyle&&H.to==Q&&(F||(F=[])).push(L.endStyle,H.to);L.title&&((g||(g={})).title=L.title);if(L.attributes)for(var ha in L.attributes)(g||(g={}))[ha]=L.attributes[ha];L.collapsed&&(!k||0>vd(k.marker,L))&&(k=H)}else H.from>x&&Q>H.from&&(Q=H.from)}if(F)for(R=0;R<F.length;R+=2)F[R+1]==Q&&(m+=" "+F[R]);if(!k||k.from==x)for(F=0;F<S.length;++F)Ke(f,0,S[F]);if(k&&(k.from||0)==x){Ke(f,(null==k.to?Y+1:k.to)-x,k.marker,null==k.from);if(null==k.to)break a;k.to==x&&(k=!1)}}if(x>=Y)break;for(S=Math.min(Y,Q);;){if(K){F=x+K.length;k||(R=F>S?K.slice(0,S-x):K,f.addToken(f,R,q?q+n:n,h,x+R.length==Q?m:"",p,g));if(F>=S){K=K.slice(S-x);x=S;break}x=F;h=""}K=u.slice(A,A=l[P++]);q=Ie(l[P++],f.cm.options)}}else for(g=1;g<l.length;g+=2)f.addToken(f,u.slice(A,A=l[g]),Ie(l[g+1],f.cm.options))}e.styleClasses&&(e.styleClasses.bgClass&&(d.bgClass=ed(e.styleClasses.bgClass,d.bgClass||"")),e.styleClasses.textClass&&(d.textClass=ed(e.styleClasses.textClass,d.textClass||"")));0==d.map.length&&(e=d.map,f=e.push,g=d.content,k=g.appendChild,h=a.display.measure,null==Ad&&(m=v("span",""),D(h,v("span",[m,document.createTextNode("x")])),0!=h.firstChild.offsetHeight&&(Ad=1>=m.offsetWidth&&2<m.offsetHeight&&!(G&&8>T))),h=Ad?v("span",""):v("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px"),h.setAttribute("cm-text",""),f.call(e,0,0,k.call(g,h)));0==c?(b.measure.map=d.map,b.measure.cache={}):((b.measure.maps||(b.measure.maps=[])).push(d.map),(b.measure.caches||(b.measure.caches=[])).push({}))}fa&&(ha=d.content.lastChild,/\bcm-tab\b/.test(ha.className)||ha.querySelector&&ha.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack");W(a,"renderLine",a,b.line,d.pre);d.pre.className&&(d.textClass=ed(d.pre.className,d.textClass||""));return d}function Kg(a){var b=v("span","•","cm-invalidchar");b.title="\\u"+a.charCodeAt(0).toString(16);b.setAttribute("aria-label",b.title);return b}function Ig(a,b,d,c,e,f,g){if(b){if(a.splitSpaces){var h=a.trailingSpace;if(1<b.length&&!/ /.test(b))h=b;else{for(var k="",l=0;l<b.length;l++){var m=b.charAt(l);" "!=m||!h||l!=b.length-1&&32!=b.charCodeAt(l+1)||(m=" ");k+=m;h=" "==m}h=k}}else h=b;k=h;l=a.cm.state.specialChars;m=!1;if(l.test(b)){h=document.createDocumentFragment();for(var n=0;;){l.lastIndex=n;var p=l.exec(b),q=p?p.index-n:b.length-n;if(q){var r=document.createTextNode(k.slice(n,n+q));G&&9>T?h.appendChild(v("span",[r])):h.appendChild(r);a.map.push(a.pos,a.pos+q,r);a.col+=q;a.pos+=q}if(!p)break;n+=q+1;"\t"==p[0]?(p=a.cm.options.tabSize,p-=a.col%p,q=h.appendChild(v("span",hd(p),"cm-tab")),q.setAttribute("role","presentation"),q.setAttribute("cm-text","\t"),a.col+=p):("\r"==p[0]||"\n"==p[0]?(q=h.appendChild(v("span","\r"==p[0]?"␍":"␤","cm-invalidchar")),q.setAttribute("cm-text",p[0])):(q=a.cm.options.specialCharPlaceholder(p[0]),q.setAttribute("cm-text",p[0]),G&&9>T?h.appendChild(v("span",[q])):h.appendChild(q)),a.col+=1);a.map.push(a.pos,a.pos+1,q);a.pos++}}else a.col+=b.length,h=document.createTextNode(k),a.map.push(a.pos,a.pos+b.length,h),G&&9>T&&(m=!0),a.pos+=b.length;a.trailingSpace=32==k.charCodeAt(b.length-1);if(d||c||e||m||f||g){b=d||"";c&&(b+=c);e&&(b+=e);c=v("span",[h],b,f);if(g)for(var u in g)g.hasOwnProperty(u)&&"style"!=u&&"class"!=u&&c.setAttribute(u,g[u]);return a.content.appendChild(c)}a.content.appendChild(h)}}function Jg(a,b){return function(d,c,e,f,g,h,k){e=e?e+" cm-force-border":"cm-force-border";for(var l=d.pos,m=l+c.length;;){for(var n=void 0,p=0;p<b.length&&!(n=b[p],n.to>l&&n.from<=l);p++);if(n.to>=m)return a(d,c,e,f,g,h,k);a(d,c.slice(0,n.to-l),e,f,null,h,k);f=null;c=c.slice(n.to-l);l=n.to}}}function Ke(a,b,d,c){var e=!c&&d.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!c&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",d.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function Le(a,b,d){for(var c=this.line=b,e;c=qb(c,!1);)c=c.find(1,!0).line,(e||(e=[])).push(c);this.size=(this.rest=e)?N(J(this.rest))-d+1:1;this.node=this.text=null;this.hidden=Oa(a,b)}function Dc(a,b,d){var c=[],e;for(e=b;e<d;)b=new Le(a.doc,w(a.doc,e),e),e+=b.size,c.push(b);return c}function Lg(a,b){if(a=a.ownsGroup)try{var d=a.delayedCallbacks,c=0;do{for(;c<d.length;c++)d[c].call(null);for(var e=0;e<a.ops.length;e++){var f=a.ops[e];if(f.cursorActivityHandlers)for(;f.cursorActivityCalled<f.cursorActivityHandlers.length;)f.cursorActivityHandlers[f.cursorActivityCalled++].call(null,f.cm)}}while(c<d.length)}finally{rb=null,b(a)}}function aa(a,b){var d=a._handlers&&a._handlers[b]||wc;if(d.length){var c=Array.prototype.slice.call(arguments,2);if(rb)var e=rb.delayedCallbacks;else Pb?e=Pb:(e=Pb=[],setTimeout(Mg,0));for(var f=function(h){e.push((function(){return d[h].apply(null,c)}))},g=0;g<d.length;++g)f(g)}}function Mg(){var a=Pb;Pb=null;for(var b=0;b<a.length;++b)a[b]()}function Me(a,b,d,c){for(var e=0;e<b.changes.length;e++){var f=b.changes[e];if("text"==f){f=a;var g=b,h=g.text.className,k=Ne(f,g);g.text==g.node&&(g.node=k.pre);g.text.parentNode.replaceChild(k.pre,g.text);g.text=k.pre;k.bgClass!=g.bgClass||k.textClass!=g.textClass?(g.bgClass=k.bgClass,g.textClass=k.textClass,Bd(f,g)):h&&(g.text.className=h)}else if("gutter"==f)Oe(a,b,d,c);else if("class"==f)Bd(a,b);else if("widget"==f){f=a;g=b;h=c;g.alignable&&(g.alignable=null);k=y("CodeMirror-linewidget");for(var l=g.node.firstChild,m;l;l=m)m=l.nextSibling,k.test(l.className)&&g.node.removeChild(l);Pe(f,g,h)}}b.changes=null}function Qb(a){a.node==a.text&&(a.node=v("div",null,null,"position: relative"),a.text.parentNode&&a.text.parentNode.replaceChild(a.node,a.text),a.node.appendChild(a.text),G&&8>T&&(a.node.style.zIndex=2));return a.node}function Ne(a,b){var d=a.display.externalMeasured;return d&&d.line==b.line?(a.display.externalMeasured=null,b.measure=d.measure,d.built):Je(a,b)}function Bd(a,b){var d=b.bgClass?b.bgClass+" "+(b.line.bgClass||""):b.line.bgClass;d&&(d+=" CodeMirror-linebackground");if(b.background)d?b.background.className=d:(b.background.parentNode.removeChild(b.background),b.background=null);else if(d){var c=Qb(b);b.background=c.insertBefore(v("div",null,d),c.firstChild);a.display.input.setUneditable(b.background)}b.line.wrapClass?Qb(b).className=b.line.wrapClass:b.node!=b.text&&(b.node.className="");b.text.className=(b.textClass?b.textClass+" "+(b.line.textClass||""):b.line.textClass)||""}function Oe(a,b,d,c){b.gutter&&(b.node.removeChild(b.gutter),b.gutter=null);b.gutterBackground&&(b.node.removeChild(b.gutterBackground),b.gutterBackground=null);if(b.line.gutterClass){var e=Qb(b);b.gutterBackground=v("div",null,"CodeMirror-gutter-background "+b.line.gutterClass,"left: "+(a.options.fixedGutter?c.fixedPos:-c.gutterTotalWidth)+"px; width: "+c.gutterTotalWidth+"px");a.display.input.setUneditable(b.gutterBackground);e.insertBefore(b.gutterBackground,b.text)}e=b.line.gutterMarkers;if(a.options.lineNumbers||e){var f=Qb(b),g=b.gutter=v("div",null,"CodeMirror-gutter-wrapper","left: "+(a.options.fixedGutter?c.fixedPos:-c.gutterTotalWidth)+"px");g.setAttribute("aria-hidden","true");a.display.input.setUneditable(g);f.insertBefore(g,b.text);b.line.gutterClass&&(g.className+=" "+b.line.gutterClass);!a.options.lineNumbers||e&&e["CodeMirror-linenumbers"]||(b.lineNumber=g.appendChild(v("div",pd(a.options,d),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+c.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+a.display.lineNumInnerWidth+"px")));if(e)for(b=0;b<a.display.gutterSpecs.length;++b)d=a.display.gutterSpecs[b].className,(f=e.hasOwnProperty(d)&&e[d])&&g.appendChild(v("div",[f],"CodeMirror-gutter-elt","left: "+c.gutterLeft[d]+"px; width: "+c.gutterWidth[d]+"px"))}}function Ng(a,b,d,c){var e=Ne(a,b);b.text=b.node=e.pre;e.bgClass&&(b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);Bd(a,b);Oe(a,b,d,c);Pe(a,b,c);return b.node}function Pe(a,b,d){Qe(a,b.line,b,d,!0);if(b.rest)for(var c=0;c<b.rest.length;c++)Qe(a,b.rest[c],b,d,!1)}function Qe(a,b,d,c,e){if(b.widgets){var f=Qb(d),g=0;for(b=b.widgets;g<b.length;++g){var h=b[g],k=v("div",[h.node],"CodeMirror-linewidget"+(h.className?" "+h.className:""));h.handleMouseEvents||k.setAttribute("cm-ignore-events","true");var l=h,m=k,n=c;if(l.noHScroll){(d.alignable||(d.alignable=[])).push(m);var p=n.wrapperWidth;m.style.left=n.fixedPos+"px";l.coverGutter||(p-=n.gutterTotalWidth,m.style.paddingLeft=n.gutterTotalWidth+"px");m.style.width=p+"px"}l.coverGutter&&(m.style.zIndex=5,m.style.position="relative",l.noHScroll||(m.style.marginLeft=-n.gutterTotalWidth+"px"));a.display.input.setUneditable(k);e&&h.above?f.insertBefore(k,d.gutter||d.text):f.appendChild(k);aa(h,"redraw")}}}function Rb(a){if(null!=a.height)return a.height;var b=a.doc.cm;if(!b)return 0;if(!ja(document.body,a.node)){var d="position: relative;";a.coverGutter&&(d+="margin-left: -"+b.display.gutters.offsetWidth+"px;");a.noHScroll&&(d+="width: "+b.display.wrapper.clientWidth+"px;");D(b.display.measure,v("div",[a.node],null,d))}return a.height=a.node.parentNode.offsetHeight}function Ka(a,b){for(b=b.target||b.srcElement;b!=a.wrapper;b=b.parentNode)if(!b||1==b.nodeType&&"true"==b.getAttribute("cm-ignore-events")||b.parentNode==a.sizer&&b!=a.mover)return!0}function Cd(a){return a.mover.offsetHeight-a.lineSpace.offsetHeight}function Re(a){if(a.cachedPaddingH)return a.cachedPaddingH;var b=D(a.measure,v("pre","x","CodeMirror-line-like"));b=window.getComputedStyle?window.getComputedStyle(b):b.currentStyle;b={left:parseInt(b.paddingLeft),right:parseInt(b.paddingRight)};isNaN(b.left)||isNaN(b.right)||(a.cachedPaddingH=b);return b}function Ga(a){return 50-a.display.nativeBarWidth}function ab(a){return a.display.scroller.clientWidth-Ga(a)-a.display.barWidth}function Dd(a){return a.display.scroller.clientHeight-Ga(a)-a.display.barHeight}function Se(a,b,d){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var c=0;c<a.rest.length;c++)if(a.rest[c]==b)return{map:a.measure.maps[c],cache:a.measure.caches[c]};for(b=0;b<a.rest.length;b++)if(N(a.rest[b])>d)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function Ed(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[bb(a,b)];if((a=a.display.externalMeasured)&&b>=a.lineN&&b<a.lineN+a.size)return a}function cb(a,b){var d=N(b),c=Ed(a,d);c&&!c.text?c=null:c&&c.changes&&(Me(a,c,d,Fd(a)),a.curOp.forceUpdate=!0);if(!c){var e=Ea(b);c=N(e);e=a.display.externalMeasured=new Le(a.doc,e,c);e.lineN=c;c=e.built=Je(a,e);e.text=c.pre;D(a.display.lineMeasure,c.pre);c=e}a=Se(c,b,d);return{line:b,view:c,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function ya(a,b,d,c,e){b.before&&(d=-1);var f=d+(c||"");if(b.cache.hasOwnProperty(f))a=b.cache[f];else{b.rect||(b.rect=b.view.text.getBoundingClientRect());if(!b.hasHeights){var g=b.view,h=b.rect,k=a.options.lineWrapping,l=k&&ab(a);if(!g.measure.heights||k&&g.measure.width!=l){var m=g.measure.heights=[];if(k)for(g.measure.width=l,g=g.text.firstChild.getClientRects(),k=0;k<g.length-1;k++){l=g[k];var n=g[k+1];2<Math.abs(l.bottom-n.bottom)&&m.push((l.bottom+n.top)/2-h.top)}m.push(h.bottom-h.top)}b.hasHeights=!0}m=c;g=Te(b.map,d,m);c=g.node;h=g.start;k=g.end;d=g.collapse;if(3==c.nodeType){for(var p=0;4>p;p++){for(;h&&jd(b.line.text.charAt(g.coverStart+h));)--h;for(;g.coverStart+k<g.coverEnd&&jd(b.line.text.charAt(g.coverStart+k));)++k;if(G&&9>T&&0==h&&k==g.coverEnd-g.coverStart)var q=c.parentNode.getBoundingClientRect();else{q=Ob(c,h,k).getClientRects();k=Ue;if("left"==m)for(l=0;l<q.length&&(k=q[l]).left==k.right;l++);else for(l=q.length-1;0<=l&&(k=q[l]).left==k.right;l--);q=k}if(q.left||q.right||0==h)break;k=h;--h;d="right"}G&&11>T&&((p=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=Gd?p=Gd:(m=D(a.display.measure,v("span","x")),p=m.getBoundingClientRect(),m=Ob(m,0,1).getBoundingClientRect(),p=Gd=1<Math.abs(p.left-m.left)),p=!p),p||(p=screen.logicalXDPI/screen.deviceXDPI,m=screen.logicalYDPI/screen.deviceYDPI,q={left:q.left*p,right:q.right*p,top:q.top*m,bottom:q.bottom*m}))}else 0<h&&(d=m="right"),q=a.options.lineWrapping&&1<(p=c.getClientRects()).length?p["right"==m?p.length-1:0]:c.getBoundingClientRect();!(G&&9>T)||h||q&&(q.left||q.right)||(q=(q=c.parentNode.getClientRects()[0])?{left:q.left,right:q.left+sb(a.display),top:q.top,bottom:q.bottom}:Ue);c=q.top-b.rect.top;h=q.bottom-b.rect.top;p=(c+h)/2;m=b.view.measure.heights;for(g=0;g<m.length-1&&!(p<m[g]);g++);d={left:("right"==d?q.right:q.left)-b.rect.left,right:("left"==d?q.left:q.right)-b.rect.left,top:g?m[g-1]:0,bottom:m[g]};q.left||q.right||(d.bogus=!0);a.options.singleCursorHeightPerLine||(d.rtop=c,d.rbottom=h);a=d;a.bogus||(b.cache[f]=a)}return{left:a.left,right:a.right,top:e?a.rtop:a.top,bottom:e?a.rbottom:a.bottom}}function Te(a,b,d){for(var c,e,f,g,h,k,l=0;l<a.length;l+=3){h=a[l];k=a[l+1];if(b<h)e=0,f=1,g="left";else if(b<k)e=b-h,f=e+1;else if(l==a.length-3||b==k&&a[l+3]>b)f=k-h,e=f-1,b>=k&&(g="right");if(null!=e){c=a[l+2];h==k&&d==(c.insertLeft?"left":"right")&&(g=d);if("left"==d&&0==e)for(;l&&a[l-2]==a[l-3]&&a[l-1].insertLeft;)c=a[(l-=3)+2],g="left";if("right"==d&&e==k-h)for(;l<a.length-3&&a[l+3]==a[l+4]&&!a[l+5].insertLeft;)c=a[(l+=3)+2],g="right";break}}return{node:c,start:e,end:f,collapse:g,coverStart:h,coverEnd:k}}function Ve(a){if(a.measure&&(a.measure.cache={},a.measure.heights=null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function We(a){a.display.externalMeasure=null;E(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)Ve(a.display.view[b])}function Sb(a){We(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function Xe(){return Ec&&Fc?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Ye(){return Ec&&Fc?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Hd(a){var b=0;if(a.widgets)for(var d=0;d<a.widgets.length;++d)a.widgets[d].above&&(b+=Rb(a.widgets[d]));return b}function Gc(a,b,d,c,e){e||(e=Hd(b),d.top+=e,d.bottom+=e);if("line"==c)return d;c||(c="local");b=Fa(b);b="local"==c?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==c||"window"==c)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==c?0:Ye()),c=a.left+("window"==c?0:Xe()),d.left+=c,d.right+=c;d.top+=b;d.bottom+=b;return d}function Ze(a,b,d){if("div"==d)return b;var c=b.left;b=b.top;"page"==d?(c-=Xe(),b-=Ye()):"local"!=d&&d||(d=a.display.sizer.getBoundingClientRect(),c+=d.left,b+=d.top);a=a.display.lineSpace.getBoundingClientRect();return{left:c-a.left,top:b-a.top}}function Hc(a,b,d,c,e){c||(c=w(a.doc,b.line));var f=c;b=b.ch;c=ya(a,cb(a,c),b,e);return Gc(a,f,c,d)}function za(a,b,d,c,e,f){function g(p,q){p=ya(a,e,p,q?"right":"left",f);q?p.left=p.right:p.right=p.left;return Gc(a,c,p,d)}function h(p,q,r){return g(r?p-1:p,1==k[q].level!=r)}c=c||w(a.doc,b.line);e||(e=cb(a,c));var k=Ia(c,a.doc.direction),l=b.ch;b=b.sticky;l>=c.text.length?(l=c.text.length,b="before"):0>=l&&(l=0,b="after");if(!k)return g("before"==b?l-1:l,"before"==b);var m=Ib(k,l,b),n=Jb;m=h(l,m,"before"==b);null!=n&&(m.other=h(l,n,"before"!=b));return m}function $e(a,b){var d=0;b=C(a.doc,b);a.options.lineWrapping||(d=sb(a.display)*b.ch);b=w(a.doc,b.line);a=Fa(b)+a.display.lineSpace.offsetTop;return{left:d,right:d,top:a,bottom:a+b.height}}function Id(a,b,d,c,e){a=t(a,b,d);a.xRel=e;c&&(a.outside=c);return a}function Jd(a,b,d){var c=a.doc;d+=a.display.viewOffset;if(0>d)return Id(c.first,0,null,-1,-1);var e=$a(c,d),f=c.first+c.size-1;if(e>f)return Id(c.first+c.size-1,w(c,f).text.length,null,1,1);0>b&&(b=0);for(var g=w(c,e);;){f=Og(a,g,e,b,d);var h=void 0;var k=f.ch+(0<f.xRel||0<f.outside?1:0);if(g=Ja&&g.markedSpans)for(var l=0;l<g.length;++l){var m=g[l];m.marker.collapsed&&(null==m.from||m.from<k)&&(null==m.to||m.to>k)&&(!h||0>vd(h,m.marker))&&(h=m.marker)}if(!h)return f;f=h.find(1);if(f.line==e)return f;g=w(c,e=f.line)}}function af(a,b,d,c){c-=Hd(b);b=b.text.length;var e=Hb((function(f){return ya(a,d,f-1).bottom<=c}),b,0);b=Hb((function(f){return ya(a,d,f).top>c}),e,b);return{begin:e,end:b}}function bf(a,b,d,c){d||(d=cb(a,b));c=Gc(a,b,ya(a,d,c),"line").top;return af(a,b,d,c)}function Kd(a,b,d,c){return a.bottom<=d?!1:a.top>d?!0:(c?a.left:a.right)>b}function Og(a,b,d,c,e){e-=Fa(b);var f=cb(a,b),g=Hd(b),h=0,k=b.text.length,l=!0,m=Ia(b,a.doc.direction);m&&(m=(a.options.lineWrapping?Pg:Qg)(a,b,d,f,m,c,e),h=(l=1!=m.level)?m.from:m.to-1,k=l?m.to:m.from-1);var n=null,p=null;m=Hb((function(r){var u=ya(a,f,r);u.top+=g;u.bottom+=g;if(!Kd(u,c,e,!1))return!1;u.top<=e&&u.left<=c&&(n=r,p=u);return!0}),h,k);var q=!1;p?(h=c-p.left<p.right-c,l=h==l,m=n+(l?0:1),l=l?"after":"before",h=h?p.left:p.right):(l||m!=k&&m!=h||m++,l=0==m?"after":m==b.text.length?"before":ya(a,f,m-(l?1:0)).bottom+g<=e==l?"after":"before",q=za(a,t(d,m,l),"line",b,f),h=q.left,q=e<q.top?-1:e>=q.bottom?1:0);m=qe(b.text,m,1);return Id(d,m,l,q,c-h)}function Qg(a,b,d,c,e,f,g){var h=Hb((function(m){m=e[m];var n=1!=m.level;return Kd(za(a,t(d,n?m.to:m.from,n?"before":"after"),"line",b,c),f,g,!0)}),0,e.length-1),k=e[h];if(0<h){var l=1!=k.level;l=za(a,t(d,l?k.from:k.to,l?"after":"before"),"line",b,c);Kd(l,f,g,!0)&&l.top>g&&(k=e[h-1])}return k}function Pg(a,b,d,c,e,f,g){g=af(a,b,c,g);d=g.begin;g=g.end;/\s/.test(b.text.charAt(g-1))&&g--;for(var h=b=null,k=0;k<e.length;k++){var l=e[k];if(!(l.from>=g||l.to<=d)){var m=ya(a,c,1!=l.level?Math.min(g,l.to)-1:Math.max(d,l.from)).right;m=m<f?f-m+1e9:m-f;if(!b||h>m)b=l,h=m}}b||(b=e[e.length-1]);b.from<d&&(b={from:d,to:b.to,level:b.level});b.to>g&&(b={from:b.from,to:g,level:b.level});return b}function tb(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==db){db=v("pre",null,"CodeMirror-line-like");for(var b=0;49>b;++b)db.appendChild(document.createTextNode("x")),db.appendChild(v("br"));db.appendChild(document.createTextNode("x"))}D(a.measure,db);b=db.offsetHeight/50;3<b&&(a.cachedTextHeight=b);E(a.measure);return b||1}function sb(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=v("span","xxxxxxxxxx"),d=v("pre",[b],"CodeMirror-line-like");D(a.measure,d);b=b.getBoundingClientRect();b=(b.right-b.left)/10;2<b&&(a.cachedCharWidth=b);return b||10}function Fd(a){for(var b=a.display,d={},c={},e=b.gutters.clientLeft,f=b.gutters.firstChild,g=0;f;f=f.nextSibling,++g){var h=a.display.gutterSpecs[g].className;d[h]=f.offsetLeft+f.clientLeft+e;c[h]=f.clientWidth}return{fixedPos:Ld(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:d,gutterWidth:c,wrapperWidth:b.wrapper.clientWidth}}function Ld(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function cf(a){var b=tb(a.display),d=a.options.lineWrapping,c=d&&Math.max(5,a.display.scroller.clientWidth/sb(a.display)-3);return function(e){if(Oa(a.doc,e))return 0;var f=0;if(e.widgets)for(var g=0;g<e.widgets.length;g++)e.widgets[g].height&&(f+=e.widgets[g].height);return d?f+(Math.ceil(e.text.length/c)||1)*b:f+b}}function Md(a){var b=a.doc,d=cf(a);b.iter((function(c){var e=d(c);e!=c.height&&Ca(c,e)}))}function eb(a,b,d,c){var e=a.display;if(!d&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;d=e.lineSpace.getBoundingClientRect();try{var f=b.clientX-d.left;var g=b.clientY-d.top}catch(k){return null}b=Jd(a,f,g);var h;c&&0<b.xRel&&(h=w(a.doc,b.line).text).length==b.ch&&(c=va(h,h.length,a.options.tabSize)-h.length,b=t(b.line,Math.max(0,Math.round((f-Re(a.display).left)/sb(a.display))-c)));return b}function bb(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var d=0;d<a.length;d++)if(b-=a[d].size,0>b)return d}function ma(a,b,d,c){null==b&&(b=a.doc.first);null==d&&(d=a.doc.first+a.doc.size);c||(c=0);var e=a.display;c&&d<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)Ja&&wd(a.doc,b)<e.viewTo&&Pa(a);else if(d<=e.viewFrom)Ja&&He(a.doc,d+c)>e.viewFrom?Pa(a):(e.viewFrom+=c,e.viewTo+=c);else if(b<=e.viewFrom&&d>=e.viewTo)Pa(a);else if(b<=e.viewFrom){var f=Ic(a,d,d+c,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=c):Pa(a)}else if(d>=e.viewTo)(f=Ic(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Pa(a);else{f=Ic(a,b,b,-1);var g=Ic(a,d,d+c,1);f&&g?(e.view=e.view.slice(0,f.index).concat(Dc(a,f.lineN,g.lineN)).concat(e.view.slice(g.index)),e.viewTo+=c):Pa(a)}if(a=e.externalMeasured)d<a.lineN?a.lineN+=c:b<a.lineN+a.size&&(e.externalMeasured=null)}function Qa(a,b,d){a.curOp.viewChanged=!0;var c=a.display,e=a.display.externalMeasured;e&&b>=e.lineN&&b<e.lineN+e.size&&(c.externalMeasured=null);b<c.viewFrom||b>=c.viewTo||(a=c.view[bb(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==ea(a,d)&&a.push(d)))}function Pa(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function Ic(a,b,d,c){var e=bb(a,b),f=a.display.view;if(!Ja||d==a.doc.first+a.doc.size)return{index:e,lineN:d};for(var g=a.display.viewFrom,h=0;h<e;h++)g+=f[h].size;if(g!=b){if(0<c){if(e==f.length-1)return null;b=g+f[e].size-b;e++}else b=g-b;d+=b}for(;wd(a.doc,d)!=d;){if(e==(0>c?0:f.length-1))return null;d+=c*f[e-(0>c?1:0)].size;e+=c}return{index:e,lineN:d}}function df(a){a=a.display.view;for(var b=0,d=0;d<a.length;d++){var c=a[d];c.hidden||c.node&&!c.changes||++b}return b}function Tb(a){a.display.input.showSelection(a.display.input.prepareSelection())}function ef(a,b){void 0===b&&(b=!0);for(var d=a.doc,c={},e=c.cursors=document.createDocumentFragment(),f=c.selection=document.createDocumentFragment(),g=0;g<d.sel.ranges.length;g++)if(b||g!=d.sel.primIndex){var h=d.sel.ranges[g];if(!(h.from().line>=a.display.viewTo||h.to().line<a.display.viewFrom)){var k=h.empty();(k||a.options.showCursorWhenSelecting)&&ff(a,h.head,e);k||Rg(a,h,f)}}return c}function ff(a,b,d){var c=za(a,b,"div",null,null,!a.options.singleCursorHeightPerLine),e=d.appendChild(v("div"," ","CodeMirror-cursor"));e.style.left=c.left+"px";e.style.top=c.top+"px";e.style.height=Math.max(0,c.bottom-c.top)*a.options.cursorHeight+"px";/\bcm-fat-cursor\b/.test(a.getWrapperElement().className)&&(a=Hc(a,b,"div",null,null),0<a.right-a.left&&(e.style.width=a.right-a.left+"px"));c.other&&(d=d.appendChild(v("div"," ","CodeMirror-cursor CodeMirror-secondarycursor")),d.style.display="",d.style.left=c.other.left+"px",d.style.top=c.other.top+"px",d.style.height=.85*(c.other.bottom-c.other.top)+"px")}function Jc(a,b){return a.top-b.top||a.left-b.left}function Rg(a,b,d){function c(q,r,u,A){0>r&&(r=0);r=Math.round(r);A=Math.round(A);h.appendChild(v("div",null,"CodeMirror-selected","position: absolute; left: "+q+"px;\n top: "+r+"px; width: "+(null==u?m-q:u)+"px;\n height: "+(A-r)+"px"))}function e(q,r,u){function A(F,R){return Hc(a,t(q,F),"div",x,R)}function Y(F,R,H){F=bf(a,x,null,F);R="ltr"==R==("after"==H)?"left":"right";H="after"==H?F.begin:F.end-(/\s/.test(x.text.charAt(F.end-1))?2:1);return A(H,R)[R]}var x=w(g,q),P=x.text.length,K,Q,S=Ia(x,g.direction);zg(S,r||0,null==u?P:u,(function(F,R,H,L){var ha="ltr"==H,na=A(F,ha?"left":"right"),ta=A(R-1,ha?"right":"left"),fb=null==r&&0==F,gb=null==u&&R==P,Nd=0==L;L=!S||L==S.length-1;3>=ta.top-na.top?(R=(n?fb:gb)&&Nd?l:(ha?na:ta).left,c(R,na.top,((n?gb:fb)&&L?m:(ha?ta:na).right)-R,na.bottom)):(ha?(ha=n&&fb&&Nd?l:na.left,fb=n?m:Y(F,H,"before"),F=n?l:Y(R,H,"after"),gb=n&&gb&&L?m:ta.right):(ha=n?Y(F,H,"before"):l,fb=!n&&fb&&Nd?m:na.right,F=!n&&gb&&L?l:ta.left,gb=n?Y(R,H,"after"):m),c(ha,na.top,fb-ha,na.bottom),na.bottom<ta.top&&c(l,na.bottom,null,ta.top),c(F,ta.top,gb-F,ta.bottom));if(!K||0>Jc(na,K))K=na;0>Jc(ta,K)&&(K=ta);if(!Q||0>Jc(na,Q))Q=na;0>Jc(ta,Q)&&(Q=ta)}));return{start:K,end:Q}}var f=a.display,g=a.doc,h=document.createDocumentFragment(),k=Re(a.display),l=k.left,m=Math.max(f.sizerWidth,ab(a)-f.sizer.offsetLeft)-k.right,n="ltr"==g.direction;f=b.from();b=b.to();if(f.line==b.line)e(f.line,f.ch,b.ch);else{var p=w(g,f.line);k=w(g,b.line);k=Ea(p)==Ea(k);f=e(f.line,f.ch,k?p.text.length+1:null).end;b=e(b.line,k?0:null,b.ch).start;k&&(f.top<b.top-2?(c(f.right,f.top,null,f.bottom),c(l,b.top,b.left,b.bottom)):c(f.right,f.top,b.left-f.right,f.bottom));f.bottom<b.top&&c(l,f.bottom,null,b.top)}d.appendChild(h)}function Od(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var d=!0;b.cursorDiv.style.visibility="";0<a.options.cursorBlinkRate?b.blinker=setInterval((function(){a.hasFocus()||ub(a);b.cursorDiv.style.visibility=(d=!d)?"":"hidden"}),a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function gf(a){a.hasFocus()||(a.display.input.focus(),a.state.focused||Pd(a))}function Qd(a){a.state.delayingBlurEvent=!0;setTimeout((function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,a.state.focused&&ub(a))}),100)}function Pd(a,b){a.state.delayingBlurEvent&&!a.state.draggingText&&(a.state.delayingBlurEvent=!1);"nocursor"!=a.options.readOnly&&(a.state.focused||(W(a,"focus",a,b),a.state.focused=!0,Wa(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),fa&&setTimeout((function(){return a.display.input.reset(!0)}),20)),a.display.input.receivedFocus()),Od(a))}function ub(a,b){a.state.delayingBlurEvent||(a.state.focused&&(W(a,"blur",a,b),a.state.focused=!1,hb(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout((function(){a.state.focused||(a.display.shift=!1)}),150))}function Kc(a){for(var b=a.display,d=b.lineDiv.offsetTop,c=Math.max(0,b.scroller.getBoundingClientRect().top),e=b.lineDiv.getBoundingClientRect().top,f=0,g=0;g<b.view.length;g++){var h=b.view[g],k=a.options.lineWrapping,l=0;if(!h.hidden){e+=h.line.height;if(G&&8>T){k=h.node.offsetTop+h.node.offsetHeight;var m=k-d;d=k}else{var n=h.node.getBoundingClientRect();m=n.bottom-n.top;!k&&h.text.firstChild&&(l=h.text.firstChild.getBoundingClientRect().right-n.left-1)}k=h.line.height-m;if(.005<k||-.005>k)if(e<c&&(f-=k),Ca(h.line,m),hf(h.line),h.rest)for(m=0;m<h.rest.length;m++)hf(h.rest[m]);l>a.display.sizerWidth&&(l=Math.ceil(l/sb(a.display)),l>a.display.maxLineLength&&(a.display.maxLineLength=l,a.display.maxLine=h.line,a.display.maxLineChanged=!0))}}2<Math.abs(f)&&(b.scroller.scrollTop+=f)}function hf(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b){var d=a.widgets[b],c=d.node.parentNode;c&&(d.height=c.offsetHeight)}}function Lc(a,b,d){var c=d&&null!=d.top?Math.max(0,d.top):a.scroller.scrollTop;c=Math.floor(c-a.lineSpace.offsetTop);var e=d&&null!=d.bottom?d.bottom:c+a.wrapper.clientHeight;c=$a(b,c);e=$a(b,e);if(d&&d.ensure){var f=d.ensure.from.line;d=d.ensure.to.line;f<c?(c=f,e=$a(b,Fa(w(b,f))+a.wrapper.clientHeight)):Math.min(d,b.lastLine())>=e&&(c=$a(b,Fa(w(b,d))-a.wrapper.clientHeight),e=d)}return{from:c,to:Math.max(e,c+1)}}function Rd(a,b){var d=a.display,c=tb(a.display);0>b.top&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:d.scroller.scrollTop,f=Dd(a),g={};b.bottom-b.top>f&&(b.bottom=b.top+f);var h=a.doc.height+Cd(d),k=b.top<c;c=b.bottom>h-c;b.top<e?g.scrollTop=k?0:b.top:b.bottom>e+f&&(f=Math.min(b.top,(c?h:b.bottom)-f),f!=e&&(g.scrollTop=f));e=a.options.fixedGutter?0:d.gutters.offsetWidth;f=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:d.scroller.scrollLeft-e;a=ab(a)-d.gutters.offsetWidth;if(d=b.right-b.left>a)b.right=b.left+a;10>b.left?g.scrollLeft=0:b.left<f?g.scrollLeft=Math.max(0,b.left+e-(d?0:10)):b.right>a+f-3&&(g.scrollLeft=b.right+(d?0:10)-a);return g}function Mc(a,b){null!=b&&(Nc(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function vb(a){Nc(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function Ub(a,b,d){null==b&&null==d||Nc(a);null!=b&&(a.curOp.scrollLeft=b);null!=d&&(a.curOp.scrollTop=d)}function Nc(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var d=$e(a,b.from),c=$e(a,b.to);jf(a,d,c,b.margin)}}function jf(a,b,d,c){b=Rd(a,{left:Math.min(b.left,d.left),top:Math.min(b.top,d.top)-c,right:Math.max(b.right,d.right),bottom:Math.max(b.bottom,d.bottom)+c});Ub(a,b.scrollLeft,b.scrollTop)}function Vb(a,b){2>Math.abs(a.doc.scrollTop-b)||(La||Sd(a,{top:b}),kf(a,b,!0),La&&Sd(a),Wb(a,100))}function kf(a,b,d){b=Math.max(0,Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b));if(a.display.scroller.scrollTop!=b||d)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b)}function ib(a,b,d,c){b=Math.max(0,Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth));(d?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))&&!c||(a.doc.scrollLeft=b,lf(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Xb(a){var b=a.display,d=b.gutters.offsetWidth,c=Math.round(a.doc.height+Cd(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?d:0,docHeight:c,scrollHeight:c+Ga(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:d}}function wb(a,b){b||(b=Xb(a));var d=a.display.barWidth,c=a.display.barHeight;mf(a,b);for(b=0;4>b&&d!=a.display.barWidth||c!=a.display.barHeight;b++)d!=a.display.barWidth&&a.options.lineWrapping&&Kc(a),mf(a,Xb(a)),d=a.display.barWidth,c=a.display.barHeight}function mf(a,b){var d=a.display,c=d.scrollbars.update(b);d.sizer.style.paddingRight=(d.barWidth=c.right)+"px";d.sizer.style.paddingBottom=(d.barHeight=c.bottom)+"px";d.heightForcer.style.borderBottom=c.bottom+"px solid transparent";c.right&&c.bottom?(d.scrollbarFiller.style.display="block",d.scrollbarFiller.style.height=c.bottom+"px",d.scrollbarFiller.style.width=c.right+"px"):d.scrollbarFiller.style.display="";c.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(d.gutterFiller.style.display="block",d.gutterFiller.style.height=c.bottom+"px",d.gutterFiller.style.width=b.gutterWidth+"px"):d.gutterFiller.style.display=""}function nf(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&hb(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new of[a.options.scrollbarStyle]((function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);z(b,"mousedown",(function(){a.state.focused&&setTimeout((function(){return a.display.input.focus()}),0)}));b.setAttribute("cm-not-content","true")}),(function(b,d){"horizontal"==d?ib(a,b):Vb(a,b)}),a);a.display.scrollbars.addClass&&Wa(a.display.wrapper,a.display.scrollbars.addClass)}function jb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Sg,markArrays:null};a=a.curOp;rb?rb.ops.push(a):a.ownsGroup=rb={ops:[a],delayedCallbacks:[]}}function kb(a){(a=a.curOp)&&Lg(a,(function(b){for(var d=0;d<b.ops.length;d++)b.ops[d].cm.curOp=null;b=b.ops;for(d=0;d<b.length;d++){var c=b[d],e=c.cm,f=e.display,g=e.display;!g.scrollbarsClipped&&g.scroller.offsetWidth&&(g.nativeBarWidth=g.scroller.offsetWidth-g.scroller.clientWidth,g.heightForcer.style.height=Ga(e)+"px",g.sizer.style.marginBottom=-g.nativeBarWidth+"px",g.sizer.style.borderRightWidth=Ga(e)+"px",g.scrollbarsClipped=!0);c.updateMaxLine&&yd(e);c.mustUpdate=c.viewChanged||c.forceUpdate||null!=c.scrollTop||c.scrollToPos&&(c.scrollToPos.from.line<f.viewFrom||c.scrollToPos.to.line>=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;c.update=c.mustUpdate&&new Oc(e,c.mustUpdate&&{top:c.scrollTop,ensure:c.scrollToPos},c.forceUpdate)}for(d=0;d<b.length;d++)c=b[d],c.updatedDisplay=c.mustUpdate&&Td(c.cm,c.update);for(d=0;d<b.length;d++)if(c=b[d],e=c.cm,f=e.display,c.updatedDisplay&&Kc(e),c.barMeasure=Xb(e),f.maxLineChanged&&!e.options.lineWrapping&&(g=f.maxLine.text.length,g=ya(e,cb(e,f.maxLine),g,void 0),c.adjustWidthTo=g.left+3,e.display.sizerWidth=c.adjustWidthTo,c.barMeasure.scrollWidth=Math.max(f.scroller.clientWidth,f.sizer.offsetLeft+c.adjustWidthTo+Ga(e)+e.display.barWidth),c.maxScrollLeft=Math.max(0,f.sizer.offsetLeft+c.adjustWidthTo-ab(e))),c.updatedDisplay||c.selectionChanged)c.preparedSelection=f.input.prepareSelection();for(d=0;d<b.length;d++)c=b[d],e=c.cm,null!=c.adjustWidthTo&&(e.display.sizer.style.minWidth=c.adjustWidthTo+"px",c.maxScrollLeft<e.doc.scrollLeft&&ib(e,Math.min(e.display.scroller.scrollLeft,c.maxScrollLeft),!0),e.display.maxLineChanged=!1),f=c.focus&&c.focus==ka(),c.preparedSelection&&e.display.input.showSelection(c.preparedSelection,f),(c.updatedDisplay||c.startHeight!=e.doc.height)&&wb(e,c.barMeasure),c.updatedDisplay&&Ud(e,c.barMeasure),c.selectionChanged&&Od(e),e.state.focused&&c.updateInput&&e.display.input.reset(c.typing),f&&gf(c.cm);for(d=0;d<b.length;d++){var h=void 0;c=b[d];e=c.cm;f=e.display;g=e.doc;c.updatedDisplay&&pf(e,c.update);null==f.wheelStartX||null==c.scrollTop&&null==c.scrollLeft&&!c.scrollToPos||(f.wheelStartX=f.wheelStartY=null);null!=c.scrollTop&&kf(e,c.scrollTop,c.forceScroll);null!=c.scrollLeft&&ib(e,c.scrollLeft,!0,!0);if(c.scrollToPos){var k=C(g,c.scrollToPos.from);var l=C(g,c.scrollToPos.to);var m=c.scrollToPos.margin;null==m&&(m=0);e.options.lineWrapping||k!=l||(l="before"==k.sticky?t(k.line,k.ch+1,"before"):k,k=k.ch?t(k.line,"before"==k.sticky?k.ch-1:k.ch,"after"):k);for(var n=0;5>n;n++){var p=!1;h=za(e,k);var q=l&&l!=k?za(e,l):h;h={left:Math.min(h.left,q.left),top:Math.min(h.top,q.top)-m,right:Math.max(h.left,q.left),bottom:Math.max(h.bottom,q.bottom)+m};q=Rd(e,h);var r=e.doc.scrollTop,u=e.doc.scrollLeft;null!=q.scrollTop&&(Vb(e,q.scrollTop),1<Math.abs(e.doc.scrollTop-r)&&(p=!0));null!=q.scrollLeft&&(ib(e,q.scrollLeft),1<Math.abs(e.doc.scrollLeft-u)&&(p=!0));if(!p)break}l=h;Z(e,"scrollCursorIntoView")||(m=e.display,n=m.sizer.getBoundingClientRect(),k=null,0>l.top+n.top?k=!0:l.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(k=!1),null==k||Tg||(l=v("div","",null,"position: absolute;\n top: "+(l.top-m.viewOffset-e.display.lineSpace.offsetTop)+"px;\n height: "+(l.bottom-l.top+Ga(e)+m.barHeight)+"px;\n left: "+l.left+"px; width: "+Math.max(2,l.right-l.left)+"px;"),e.display.lineSpace.appendChild(l),l.scrollIntoView(k),e.display.lineSpace.removeChild(l)))}l=c.maybeHiddenMarkers;k=c.maybeUnhiddenMarkers;if(l)for(m=0;m<l.length;++m)l[m].lines.length||W(l[m],"hide");if(k)for(l=0;l<k.length;++l)k[l].lines.length&&W(k[l],"unhide");f.wrapper.offsetHeight&&(g.scrollTop=e.display.scroller.scrollTop);c.changeObjs&&W(e,"changes",e,c.changeObjs);c.update&&c.update.finish()}}))}function qa(a,b){if(a.curOp)return b();jb(a);try{return b()}finally{kb(a)}}function ba(a,b){return function(){if(a.curOp)return b.apply(a,arguments);jb(a);try{return b.apply(a,arguments)}finally{kb(a)}}}function ia(a){return function(){if(this.curOp)return a.apply(this,arguments);jb(this);try{return a.apply(this,arguments)}finally{kb(this)}}}function ca(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);jb(b);try{return a.apply(this,arguments)}finally{kb(b)}}}function Wb(a,b){a.doc.highlightFrontier<a.display.viewTo&&a.state.highlight.set(b,fd(Ug,a))}function Ug(a){var b=a.doc;if(!(b.highlightFrontier>=a.display.viewTo)){var d=+new Date+a.options.workTime,c=Mb(a,b.highlightFrontier),e=[];b.iter(c.line,Math.min(b.first+b.size,a.display.viewTo+500),(function(f){if(c.line>=a.display.viewFrom){var g=f.styles,h=f.text.length>a.options.maxHighlightLength?Ya(b.mode,c.state):null,k=we(a,f,c,!0);h&&(c.state=h);f.styles=k.styles;h=f.styleClasses;(k=k.classes)?f.styleClasses=k:h&&(f.styleClasses=null);k=!g||g.length!=f.styles.length||h!=k&&(!h||!k||h.bgClass!=k.bgClass||h.textClass!=k.textClass);for(h=0;!k&&h<g.length;++h)k=g[h]!=f.styles[h];k&&e.push(c.line);f.stateAfter=c.save()}else f.text.length<=a.options.maxHighlightLength&&sd(a,f.text,c),f.stateAfter=0==c.line%5?c.save():null;c.nextLine();if(+new Date>d)return Wb(a,a.options.workDelay),!0}));b.highlightFrontier=c.line;b.modeFrontier=Math.max(b.modeFrontier,c.line);e.length&&qa(a,(function(){for(var f=0;f<e.length;f++)Qa(a,e[f],"text")}))}}function Td(a,b){var d=a.display,c=a.doc;if(b.editorIsHidden)return Pa(a),!1;if(!b.force&&b.visible.from>=d.viewFrom&&b.visible.to<=d.viewTo&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo)&&d.renderedView==d.view&&0==df(a))return!1;qf(a)&&(Pa(a),b.dims=Fd(a));var e=c.first+c.size,f=Math.max(b.visible.from-a.options.viewportMargin,c.first),g=Math.min(e,b.visible.to+a.options.viewportMargin);d.viewFrom<f&&20>f-d.viewFrom&&(f=Math.max(c.first,d.viewFrom));d.viewTo>g&&20>d.viewTo-g&&(g=Math.min(e,d.viewTo));Ja&&(f=wd(a.doc,f),g=He(a.doc,g));c=f!=d.viewFrom||g!=d.viewTo||d.lastWrapHeight!=b.wrapperHeight||d.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||f>=e.viewTo||g<=e.viewFrom?(e.view=Dc(a,f,g),e.viewFrom=f):(e.viewFrom>f?e.view=Dc(a,f,e.viewFrom).concat(e.view):e.viewFrom<f&&(e.view=e.view.slice(bb(a,f))),e.viewFrom=f,e.viewTo<g?e.view=e.view.concat(Dc(a,e.viewTo,g)):e.viewTo>g&&(e.view=e.view.slice(0,bb(a,g))));e.viewTo=g;d.viewOffset=Fa(w(a.doc,d.viewFrom));a.display.mover.style.top=d.viewOffset+"px";g=df(a);if(!c&&0==g&&!b.force&&d.renderedView==d.view&&(null==d.updateLineNumbers||d.updateLineNumbers>=d.viewTo))return!1;a.hasFocus()?f=null:(f=ka())&&ja(a.display.lineDiv,f)?(f={activeElt:f},window.getSelection&&(e=window.getSelection(),e.anchorNode&&e.extend&&ja(a.display.lineDiv,e.anchorNode)&&(f.anchorNode=e.anchorNode,f.anchorOffset=e.anchorOffset,f.focusNode=e.focusNode,f.focusOffset=e.focusOffset))):f=null;4<g&&(d.lineDiv.style.display="none");Vg(a,d.updateLineNumbers,b.dims);4<g&&(d.lineDiv.style.display="");d.renderedView=d.view;(g=f)&&g.activeElt&&g.activeElt!=ka()&&(g.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(g.activeElt.nodeName)&&g.anchorNode&&ja(document.body,g.anchorNode)&&ja(document.body,g.focusNode)&&(f=window.getSelection(),e=document.createRange(),e.setEnd(g.anchorNode,g.anchorOffset),e.collapse(!1),f.removeAllRanges(),f.addRange(e),f.extend(g.focusNode,g.focusOffset)));E(d.cursorDiv);E(d.selectionDiv);d.gutters.style.height=d.sizer.style.minHeight=0;c&&(d.lastWrapHeight=b.wrapperHeight,d.lastWrapWidth=b.wrapperWidth,Wb(a,400));d.updateLineNumbers=null;return!0}function pf(a,b){for(var d=b.viewport,c=!0;;c=!1){if(c&&a.options.lineWrapping&&b.oldDisplayWidth!=ab(a))c&&(b.visible=Lc(a.display,a.doc,d));else if(d&&null!=d.top&&(d={top:Math.min(a.doc.height+Cd(a.display)-Dd(a),d.top)}),b.visible=Lc(a.display,a.doc,d),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!Td(a,b))break;Kc(a);c=Xb(a);Tb(a);wb(a,c);Ud(a,c);b.force=!1}b.signal(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom||a.display.viewTo!=a.display.reportedViewTo)b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo}function Sd(a,b){b=new Oc(a,b);if(Td(a,b)){Kc(a);pf(a,b);var d=Xb(a);Tb(a);wb(a,d);Ud(a,d);b.finish()}}function Vg(a,b,d){function c(p){var q=p.nextSibling;fa&&xa&&a.display.currentWheelTarget==p?p.style.display="none":p.parentNode.removeChild(p);return q}var e=a.display,f=a.options.lineNumbers,g=e.lineDiv,h=g.firstChild,k=e.view;e=e.viewFrom;for(var l=0;l<k.length;l++){var m=k[l];if(!m.hidden)if(m.node&&m.node.parentNode==g){for(;h!=m.node;)h=c(h);h=f&&null!=b&&b<=e&&m.lineNumber;m.changes&&(-1<ea(m.changes,"gutter")&&(h=!1),Me(a,m,e,d));h&&(E(m.lineNumber),m.lineNumber.appendChild(document.createTextNode(pd(a.options,e))));h=m.node.nextSibling}else{var n=Ng(a,m,e,d);g.insertBefore(n,h)}e+=m.size}for(;h;)h=c(h)}function Vd(a){a.sizer.style.marginLeft=a.gutters.offsetWidth+"px";aa(a,"gutterChanged",a)}function Ud(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";a.display.heightForcer.style.top=b.docHeight+"px";a.display.gutters.style.height=b.docHeight+a.display.barHeight+Ga(a)+"px"}function lf(a){var b=a.display,d=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var c=Ld(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=c+"px",g=0;g<d.length;g++)if(!d[g].hidden){a.options.fixedGutter&&(d[g].gutter&&(d[g].gutter.style.left=f),d[g].gutterBackground&&(d[g].gutterBackground.style.left=f));var h=d[g].alignable;if(h)for(var k=0;k<h.length;k++)h[k].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=c+e+"px")}}function qf(a){if(!a.options.lineNumbers)return!1;var b=a.doc;b=pd(a.options,b.first+b.size-1);var d=a.display;if(b.length!=d.lineNumChars){var c=d.measure.appendChild(v("div",[v("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),e=c.firstChild.offsetWidth;c=c.offsetWidth-e;d.lineGutter.style.width="";d.lineNumInnerWidth=Math.max(e,d.lineGutter.offsetWidth-c)+1;d.lineNumWidth=d.lineNumInnerWidth+c;d.lineNumChars=d.lineNumInnerWidth?b.length:-1;d.lineGutter.style.width=d.lineNumWidth+"px";Vd(a.display);return!0}return!1}function Wd(a,b){for(var d=[],c=!1,e=0;e<a.length;e++){var f=a[e],g=null;"string"!=typeof f&&(g=f.style,f=f.className);if("CodeMirror-linenumbers"==f)if(b)c=!0;else continue;d.push({className:f,style:g})}b&&!c&&d.push({className:"CodeMirror-linenumbers",style:null});return d}function rf(a){var b=a.gutters,d=a.gutterSpecs;E(b);a.lineGutter=null;for(var c=0;c<d.length;++c){var e=d[c],f=e.className;e=e.style;var g=b.appendChild(v("div",null,"CodeMirror-gutter "+f));e&&(g.style.cssText=e);"CodeMirror-linenumbers"==f&&(a.lineGutter=g,g.style.width=(a.lineNumWidth||1)+"px")}b.style.display=d.length?"":"none";Vd(a)}function Yb(a){rf(a.display);ma(a);lf(a)}function Wg(a,b,d,c){this.input=d;this.scrollbarFiller=v("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content","true");this.gutterFiller=v("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content","true");this.lineDiv=M("div",null,"CodeMirror-code");this.selectionDiv=v("div",null,null,"position: relative; z-index: 1");this.cursorDiv=v("div",null,"CodeMirror-cursors");this.measure=v("div",null,"CodeMirror-measure");this.lineMeasure=v("div",null,"CodeMirror-measure");this.lineSpace=M("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var e=M("div",[this.lineSpace],"CodeMirror-lines");this.mover=v("div",[e],null,"position: relative");this.sizer=v("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=v("div",null,null,"position: absolute; height: 50px; width: 1px;");this.gutters=v("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=v("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=v("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");this.wrapper.setAttribute("translate","no");G&&8>T&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=0);fa||La&&Zb||(this.scroller.draggable=!0);a&&(a.appendChild?a.appendChild(this.wrapper):a(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=b.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;this.gutterSpecs=Wd(c.gutters,c.lineNumbers);rf(this);d.init(this)}function sf(a){var b=a.wheelDeltaX,d=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==d&&a.detail&&a.axis==a.VERTICAL_AXIS?d=a.detail:null==d&&(d=a.wheelDelta);return{x:b,y:d}}function Xg(a){a=sf(a);a.x*=Ma;a.y*=Ma;return a}function tf(a,b){var d=sf(b),c=d.x;d=d.y;var e=Ma;0===b.deltaMode&&(c=b.deltaX,d=b.deltaY,e=1);var f=a.display,g=f.scroller,h=g.scrollWidth>g.clientWidth,k=g.scrollHeight>g.clientHeight;if(c&&h||d&&k){if(d&&xa&&fa){h=b.target;var l=f.view;a:for(;h!=g;h=h.parentNode)for(var m=0;m<l.length;m++)if(l[m].node==h){a.display.currentWheelTarget=h;break a}}!c||La||Aa||null==e?(d&&null!=e&&(e*=d,k=a.doc.scrollTop,h=k+f.wrapper.clientHeight,0>e?k=Math.max(0,k+e-50):h=Math.min(a.doc.height,h+e+50),Sd(a,{top:k,bottom:h})),20>Pc&&0!==b.deltaMode&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=c,f.wheelDY=d,setTimeout((function(){if(null!=f.wheelStartX){var n=g.scrollLeft-f.wheelStartX,p=g.scrollTop-f.wheelStartY;n=p&&f.wheelDY&&p/f.wheelDY||n&&f.wheelDX&&n/f.wheelDX;f.wheelStartX=f.wheelStartY=null;n&&(Ma=(Ma*Pc+n)/(Pc+1),++Pc)}}),200)):(f.wheelDX+=c,f.wheelDY+=d))):(d&&k&&Vb(a,Math.max(0,g.scrollTop+d*e)),ib(a,Math.max(0,g.scrollLeft+c*e)),(!d||d&&k)&&la(b),f.wheelStartX=null)}}function Ba(a,b,d){a=a&&a.options.selectionsMayTouch;d=b[d];b.sort((function(k,l){return B(k.from(),l.from())}));d=ea(b,d);for(var c=1;c<b.length;c++){var e=b[c],f=b[c-1],g=B(f.to(),e.from());if(a&&!e.empty()?0<g:0<=g){g=zc(f.from(),e.from());var h=yc(f.to(),e.to());e=f.empty()?e.from()==e.head:f.from()==f.head;c<=d&&--d;b.splice(--c,2,new I(e?h:g,e?g:h))}}return new ua(b,d)}function Na(a,b){return new ua([new I(a,b||a)],0)}function Ra(a){return a.text?t(a.from.line+a.text.length-1,J(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function uf(a,b){if(0>B(a,b.from))return a;if(0>=B(a,b.to))return Ra(b);var d=a.line+b.text.length-(b.to.line-b.from.line)-1,c=a.ch;a.line==b.to.line&&(c+=Ra(b).ch-b.to.ch);return t(d,c)}function Xd(a,b){for(var d=[],c=0;c<a.sel.ranges.length;c++){var e=a.sel.ranges[c];d.push(new I(uf(e.anchor,b),uf(e.head,b)))}return Ba(a.cm,d,a.sel.primIndex)}function vf(a,b,d){return a.line==b.line?t(d.line,a.ch-b.ch+d.ch):t(d.line+(a.line-b.line),a.ch)}function Yd(a){a.doc.mode=md(a.options,a.doc.modeOption);$b(a)}function $b(a){a.doc.iter((function(b){b.stateAfter&&(b.stateAfter=null);b.styles&&(b.styles=null)}));a.doc.modeFrontier=a.doc.highlightFrontier=a.doc.first;Wb(a,100);a.state.modeGen++;a.curOp&&ma(a)}function wf(a,b){return 0==b.from.ch&&0==b.to.ch&&""==J(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}function Zd(a,b,d,c){function e(r,u,A){r.text=u;r.stateAfter&&(r.stateAfter=null);r.styles&&(r.styles=null);null!=r.order&&(r.order=null);Ee(r);Fe(r,A);u=c?c(r):1;u!=r.height&&Ca(r,u);aa(r,"change",r,b)}function f(r,u){for(var A=[];r<u;++r)A.push(new xb(k[r],d?d[r]:null,c));return A}var g=b.from,h=b.to,k=b.text,l=w(a,g.line),m=w(a,h.line),n=J(k),p=d?d[k.length-1]:null,q=h.line-g.line;b.full?(a.insert(0,f(0,k.length)),a.remove(k.length,a.size-k.length)):wf(a,b)?(h=f(0,k.length-1),e(m,m.text,p),q&&a.remove(g.line,q),h.length&&a.insert(g.line,h)):l==m?1==k.length?e(l,l.text.slice(0,g.ch)+n+l.text.slice(h.ch),p):(q=f(1,k.length-1),q.push(new xb(n+l.text.slice(h.ch),p,c)),e(l,l.text.slice(0,g.ch)+k[0],d?d[0]:null),a.insert(g.line+1,q)):1==k.length?(e(l,l.text.slice(0,g.ch)+k[0]+m.text.slice(h.ch),d?d[0]:null),a.remove(g.line+1,q)):(e(l,l.text.slice(0,g.ch)+k[0],d?d[0]:null),e(m,n+m.text.slice(h.ch),p),p=f(1,k.length-1),1<q&&a.remove(g.line+1,q-1),a.insert(g.line+1,p));aa(a,"change",a,b)}function Sa(a,b,d){function c(e,f,g){if(e.linked)for(var h=0;h<e.linked.length;++h){var k=e.linked[h];if(k.doc!=f){var l=g&&k.sharedHist;if(!d||l)b(k.doc,l),c(k.doc,e,l)}}}c(a,null,!0)}function xf(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;Md(a);Yd(a);yf(a);a.options.direction=b.direction;a.options.lineWrapping||yd(a);a.options.mode=b.modeOption;ma(a)}function yf(a){("rtl"==a.doc.direction?Wa:hb)(a.display.lineDiv,"CodeMirror-rtl")}function Yg(a){qa(a,(function(){yf(a);ma(a)}))}function Qc(a){this.done=[];this.undone=[];this.undoDepth=a?a.undoDepth:Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a?a.maxGeneration:1}function $d(a,b){var d={from:rd(b.from),to:Ra(b),text:Za(a,b.from,b.to)};zf(a,d,b.from.line,b.to.line+1);Sa(a,(function(c){return zf(c,d,b.from.line,b.to.line+1)}),!0);return d}function Af(a){for(;a.length;)if(J(a).ranges)a.pop();else break}function Bf(a,b,d,c){var e=a.history;e.undone.length=0;var f=+new Date,g;if(g=e.lastOp==c||e.lastOrigin==b.origin&&b.origin&&("+"==b.origin.charAt(0)&&e.lastModTime>f-(a.cm?a.cm.options.historyEventDelay:500)||"*"==b.origin.charAt(0))){if(e.lastOp==c){Af(e.done);var h=J(e.done)}else e.done.length&&!J(e.done).ranges?h=J(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),h=J(e.done)):h=void 0;g=h}if(g){var k=J(h.changes);0==B(b.from,b.to)&&0==B(b.from,k.to)?k.to=Ra(b):h.changes.push($d(a,b))}else for((h=J(e.done))&&h.ranges||Rc(a.sel,e.done),h={changes:[$d(a,b)],generation:e.generation},e.done.push(h);e.done.length>e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(d);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=c;e.lastOrigin=e.lastSelOrigin=b.origin;k||W(a,"historyAdded")}function Rc(a,b){var d=J(b);d&&d.ranges&&d.equals(a)||b.push(a)}function zf(a,b,d,c){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,d),Math.min(a.first+a.size,c),(function(g){g.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=g.markedSpans);++f}))}function Cf(a,b){var d;if(d=b["spans_"+a.id]){for(var c=[],e=0;e<b.text.length;++e){var f=c,g=f.push;var h=void 0;var k=d[e];if(k){for(var l=0;l<k.length;++l)k[l].marker.explicitlyCleared?h||(h=k.slice(0,l)):h&&h.push(k[l]);h=h?h.length?h:null:k}else h=null;g.call(f,h)}d=c}else d=null;a=ud(a,b);if(!d)return a;if(!a)return d;for(b=0;b<d.length;++b)if(c=d[b],e=a[b],c&&e)a:for(f=0;f<e.length;++f){g=e[f];for(h=0;h<c.length;++h)if(c[h].marker==g.marker)continue a;c.push(g)}else e&&(d[b]=e);return d}function yb(a,b,d){for(var c=[],e=0;e<a.length;++e){var f=a[e];if(f.ranges)c.push(d?ua.prototype.deepCopy.call(f):f);else{f=f.changes;var g=[];c.push({changes:g});for(var h=0;h<f.length;++h){var k=f[h],l;g.push({from:k.from,to:k.to,text:k.text});if(b)for(var m in k)(l=m.match(/^spans_(\d+)$/))&&-1<ea(b,Number(l[1]))&&(J(g)[m]=k[m],delete k[m])}}}return c}function ae(a,b,d,c){return c?(a=a.anchor,d&&(c=0>B(b,a),c!=0>B(d,a)?(a=b,b=d):c!=0>B(b,d)&&(b=d)),new I(a,b)):new I(d||b,b)}function Sc(a,b,d,c,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));da(a,new ua([ae(a.sel.primary(),b,d,e)],0),c)}function Df(a,b,d){for(var c=[],e=a.cm&&(a.cm.display.shift||a.extend),f=0;f<a.sel.ranges.length;f++)c[f]=ae(a.sel.ranges[f],b[f],null,e);b=Ba(a.cm,c,a.sel.primIndex);da(a,b,d)}function be(a,b,d,c){var e=a.sel.ranges.slice(0);e[b]=d;da(a,Ba(a.cm,e,a.sel.primIndex),c)}function Zg(a,b,d){d={ranges:b.ranges,update:function(c){this.ranges=[];for(var e=0;e<c.length;e++)this.ranges[e]=new I(C(a,c[e].anchor),C(a,c[e].head))},origin:d&&d.origin};W(a,"beforeSelectionChange",a,d);a.cm&&W(a.cm,"beforeSelectionChange",a.cm,d);return d.ranges!=b.ranges?Ba(a.cm,d.ranges,d.ranges.length-1):b}function Ef(a,b,d){var c=a.history.done,e=J(c);e&&e.ranges?(c[c.length-1]=b,Tc(a,b,d)):da(a,b,d)}function da(a,b,d){Tc(a,b,d);b=a.sel;var c=a.cm?a.cm.curOp.id:NaN,e=a.history,f=d&&d.origin,g;if(!(g=c==e.lastSelOp)&&(g=f&&e.lastSelOrigin==f)&&!(g=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){g=J(e.done);var h=f.charAt(0);g="*"==h||"+"==h&&g.ranges.length==b.ranges.length&&g.somethingSelected()==b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?e.done[e.done.length-1]=b:Rc(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=c;d&&!1!==d.clearRedo&&Af(e.undone)}function Tc(a,b,d){if(wa(a,"beforeSelectionChange")||a.cm&&wa(a.cm,"beforeSelectionChange"))b=Zg(a,b,d);var c=d&&d.bias||(0>B(b.primary().head,a.sel.primary().head)?-1:1);Ff(a,Gf(a,b,c,!0));d&&!1===d.scroll||!a.cm||"nocursor"==a.cm.getOption("readOnly")||vb(a.cm)}function Ff(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&(a.cm.curOp.updateInput=1,a.cm.curOp.selectionChanged=!0,re(a.cm)),aa(a,"cursorActivity",a))}function Hf(a){Ff(a,Gf(a,a.sel,null,!1))}function Gf(a,b,d,c){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[f],k=Uc(a,g.anchor,h&&h.anchor,d,c);h=Uc(a,g.head,h&&h.head,d,c);if(e||k!=g.anchor||h!=g.head)e||(e=b.ranges.slice(0,f)),e[f]=new I(k,h)}return e?Ba(a.cm,e,b.primIndex):b}function zb(a,b,d,c,e){var f=w(a,b.line);if(f.markedSpans)for(var g=0;g<f.markedSpans.length;++g){var h=f.markedSpans[g],k=h.marker,l="selectLeft"in k?!k.selectLeft:k.inclusiveLeft,m="selectRight"in k?!k.selectRight:k.inclusiveRight;if((null==h.from||(l?h.from<=b.ch:h.from<b.ch))&&(null==h.to||(m?h.to>=b.ch:h.to>b.ch))){if(e&&(W(k,"beforeCursorEnter"),k.explicitlyCleared))if(f.markedSpans){--g;continue}else break;if(k.atomic){if(d){g=k.find(0>c?1:-1);h=void 0;if(0>c?m:l)g=If(a,g,-c,g&&g.line==b.line?f:null);if(g&&g.line==b.line&&(h=B(g,d))&&(0>c?0>h:0<h))return zb(a,g,b,c,e)}d=k.find(0>c?-1:1);if(0>c?l:m)d=If(a,d,c,d.line==b.line?f:null);return d?zb(a,d,b,c,e):null}}}return b}function Uc(a,b,d,c,e){c=c||1;b=zb(a,b,d,c,e)||!e&&zb(a,b,d,c,!0)||zb(a,b,d,-c,e)||!e&&zb(a,b,d,-c,!0);return b?b:(a.cantEdit=!0,t(a.first,0))}function If(a,b,d,c){return 0>d&&0==b.ch?b.line>a.first?C(a,t(b.line-1)):null:0<d&&b.ch==(c||w(a,b.line)).text.length?b.line<a.first+a.size-1?t(b.line+1,0):null:new t(b.line,b.ch+d)}function Jf(a){a.setSelection(t(a.firstLine(),0),t(a.lastLine()),Ha)}function Kf(a,b,d){var c={canceled:!1,from:b.from,to:b.to,text:b.text,origin:b.origin,cancel:function(){return c.canceled=!0}};d&&(c.update=function(e,f,g,h){e&&(c.from=C(a,e));f&&(c.to=C(a,f));g&&(c.text=g);void 0!==h&&(c.origin=h)});W(a,"beforeChange",a,c);a.cm&&W(a.cm,"beforeChange",a.cm,c);return c.canceled?(a.cm&&(a.cm.curOp.updateInput=2),null):{from:c.from,to:c.to,text:c.text,origin:c.origin}}function Ab(a,b,d){if(a.cm){if(!a.cm.curOp)return ba(a.cm,Ab)(a,b,d);if(a.cm.state.suppressEdits)return}if(wa(a,"beforeChange")||a.cm&&wa(a.cm,"beforeChange"))if(b=Kf(a,b,!0),!b)return;if(d=Lf&&!d&&Fg(a,b.from,b.to))for(var c=d.length-1;0<=c;--c)Mf(a,{from:d[c].from,to:d[c].to,text:c?[""]:b.text,origin:b.origin});else Mf(a,b)}function Mf(a,b){if(1!=b.text.length||""!=b.text[0]||0!=B(b.from,b.to)){var d=Xd(a,b);Bf(a,b,d,a.cm?a.cm.curOp.id:NaN);ac(a,b,d,ud(a,b));var c=[];Sa(a,(function(e,f){f||-1!=ea(c,e.history)||(Nf(e.history,b),c.push(e.history));ac(e,b,null,ud(e,b))}))}}function Vc(a,b,d){var c=a.cm&&a.cm.state.suppressEdits;if(!c||d){for(var e=a.history,f,g=a.sel,h="undo"==b?e.done:e.undone,k="undo"==b?e.undone:e.done,l=0;l<h.length&&(f=h[l],d?!f.ranges||f.equals(a.sel):f.ranges);l++);if(l!=h.length){for(e.lastOrigin=e.lastSelOrigin=null;;)if(f=h.pop(),f.ranges){Rc(f,k);if(d&&!f.equals(a.sel)){da(a,f,{clearRedo:!1});return}g=f}else{if(c){h.push(f);return}break}var m=[];Rc(g,k);k.push({changes:m,generation:e.generation});e.generation=f.generation||++e.maxGeneration;var n=wa(a,"beforeChange")||a.cm&&wa(a.cm,"beforeChange");d=function(p){var q=f.changes[p];q.origin=b;if(n&&!Kf(a,q,!1))return h.length=0,{};m.push($d(a,q));var r=p?Xd(a,q):J(h);ac(a,q,r,Cf(a,q));!p&&a.cm&&a.cm.scrollIntoView({from:q.from,to:Ra(q)});var u=[];Sa(a,(function(A,Y){Y||-1!=ea(u,A.history)||(Nf(A.history,q),u.push(A.history));ac(A,q,null,Cf(A,q))}))};for(c=f.changes.length-1;0<=c;--c)if(e=d(c))return e.v}}}function Of(a,b){if(0!=b&&(a.first+=b,a.sel=new ua(uc(a.sel.ranges,(function(e){return new I(t(e.anchor.line+b,e.anchor.ch),t(e.head.line+b,e.head.ch))})),a.sel.primIndex),a.cm)){ma(a.cm,a.first,a.first-b,b);for(var d=a.cm.display,c=d.viewFrom;c<d.viewTo;c++)Qa(a.cm,c,"gutter")}}function ac(a,b,d,c){if(a.cm&&!a.cm.curOp)return ba(a.cm,ac)(a,b,d,c);if(b.to.line<a.first)Of(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);Of(a,e);b={from:t(a.first,0),to:t(b.to.line+e,b.to.ch),text:[J(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:t(e,w(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=Za(a,b.from,b.to);d||(d=Xd(a,b));a.cm?$g(a.cm,b,c):Zd(a,b,c);Tc(a,d,Ha);a.cantEdit&&Uc(a,t(a.firstLine(),0))&&(a.cantEdit=!1)}}function $g(a,b,d){var c=a.doc,e=a.display,f=b.from,g=b.to,h=!1,k=f.line;a.options.lineWrapping||(k=N(Ea(w(c,f.line))),c.iter(k,g.line+1,(function(l){if(l==e.maxLine)return h=!0})));-1<c.sel.contains(b.from,b.to)&&re(a);Zd(c,b,d,cf(a));a.options.lineWrapping||(c.iter(k,f.line+b.text.length,(function(l){var m=Cc(l);m>e.maxLineLength&&(e.maxLine=l,e.maxLineLength=m,e.maxLineChanged=!0,h=!1)})),h&&(a.curOp.updateMaxLine=!0));Eg(c,f.line);Wb(a,400);d=b.text.length-(g.line-f.line)-1;b.full?ma(a):f.line!=g.line||1!=b.text.length||wf(a.doc,b)?ma(a,f.line,g.line+1,d):Qa(a,f.line,"text");d=wa(a,"changes");if((c=wa(a,"change"))||d)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},c&&aa(a,"change",a,b),d&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function Bb(a,b,d,c,e){c||(c=d);0>B(c,d)&&(c=[c,d],d=c[0],c=c[1]);"string"==typeof b&&(b=a.splitLines(b));Ab(a,{from:d,to:c,text:b,origin:e})}function Pf(a,b,d,c){d<a.line?a.line+=c:b<a.line&&(a.line=b,a.ch=0)}function Qf(a,b,d,c){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges)for(f.copied||(f=a[e]=f.deepCopy(),f.copied=!0),g=0;g<f.ranges.length;g++)Pf(f.ranges[g].anchor,b,d,c),Pf(f.ranges[g].head,b,d,c);else{for(var h=0;h<f.changes.length;++h){var k=f.changes[h];if(d<k.from.line)k.from=t(k.from.line+c,k.from.ch),k.to=t(k.to.line+c,k.to.ch);else if(b<=k.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function Nf(a,b){var d=b.from.line,c=b.to.line;b=b.text.length-(c-d)-1;Qf(a.done,d,c,b);Qf(a.undone,d,c,b)}function bc(a,b,d,c){var e=b,f=b;"number"==typeof b?f=w(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):e=N(b);if(null==e)return null;c(f,e)&&a.cm&&Qa(a.cm,e,d);return f}function cc(a){this.lines=a;this.parent=null;for(var b=0,d=0;d<a.length;++d)a[d].parent=this,b+=a[d].height;this.height=b}function dc(a){this.children=a;for(var b=0,d=0,c=0;c<a.length;++c){var e=a[c];b+=e.chunkSize();d+=e.height;e.parent=this}this.size=b;this.height=d;this.parent=null}function ah(a,b,d,c){var e=new ec(a,d,c),f=a.cm;f&&e.noHScroll&&(f.display.alignWidgets=!0);bc(a,b,"widget",(function(g){var h=g.widgets||(g.widgets=[]);null==e.insertAt?h.push(e):h.splice(Math.min(h.length,Math.max(0,e.insertAt)),0,e);e.line=g;f&&!Oa(a,g)&&(h=Fa(g)<a.scrollTop,Ca(g,g.height+Rb(e)),h&&Mc(f,e.height),f.curOp.forceUpdate=!0);return!0}));f&&aa(f,"lineWidgetAdded",f,e,"number"==typeof b?b:N(b));return e}function Cb(a,b,d,c,e){if(c&&c.shared)return bh(a,b,d,c,e);if(a.cm&&!a.cm.curOp)return ba(a.cm,Cb)(a,b,d,c,e);var f=new Ta(a,e);e=B(b,d);c&&Xa(c,f,!1);if(0<e||0==e&&!1!==f.clearWhenEmpty)return f;f.replacedWith&&(f.collapsed=!0,f.widgetNode=M("span",[f.replacedWith],"CodeMirror-widget"),c.handleMouseEvents||f.widgetNode.setAttribute("cm-ignore-events","true"),c.insertLeft&&(f.widgetNode.insertLeft=!0));if(f.collapsed){if(Ge(a,b.line,b,d,f)||b.line!=d.line&&Ge(a,d.line,b,d,f))throw Error("Inserting collapsed marker partially overlapping an existing one");Ja=!0}f.addToHistory&&Bf(a,{from:b,to:d,origin:"markText"},a.sel,NaN);var g=b.line,h=a.cm,k;a.iter(g,d.line+1,(function(l){h&&f.collapsed&&!h.options.lineWrapping&&Ea(l)==h.display.maxLine&&(k=!0);f.collapsed&&g!=b.line&&Ca(l,0);var m=new Bc(f,g==b.line?b.ch:null,g==d.line?d.ch:null),n=a.cm&&a.cm.curOp;(n=n&&window.WeakSet&&(n.markedSpans||(n.markedSpans=new WeakSet)))&&n.has(l.markedSpans)?l.markedSpans.push(m):(l.markedSpans=l.markedSpans?l.markedSpans.concat([m]):[m],n&&n.add(l.markedSpans));m.marker.attachLine(l);++g}));f.collapsed&&a.iter(b.line,d.line+1,(function(l){Oa(a,l)&&Ca(l,0)}));f.clearOnEnter&&z(f,"beforeCursorEnter",(function(){return f.clear()}));f.readOnly&&(Lf=!0,(a.history.done.length||a.history.undone.length)&&a.clearHistory());f.collapsed&&(f.id=++Rf,f.atomic=!0);if(h){k&&(h.curOp.updateMaxLine=!0);if(f.collapsed)ma(h,b.line,d.line+1);else if(f.className||f.startStyle||f.endStyle||f.css||f.attributes||f.title)for(c=b.line;c<=d.line;c++)Qa(h,c,"text");f.atomic&&Hf(h.doc);aa(h,"markerAdded",h,f)}return f}function bh(a,b,d,c,e){c=Xa(c);c.shared=!1;var f=[Cb(a,b,d,c,e)],g=f[0],h=c.widgetNode;Sa(a,(function(k){h&&(c.widgetNode=h.cloneNode(!0));f.push(Cb(k,C(k,b),C(k,d),c,e));for(var l=0;l<k.linked.length;++l)if(k.linked[l].isParent)return;g=J(f)}));return new fc(f,g)}function Sf(a){return a.findMarks(t(a.first,0),a.clipPos(t(a.lastLine())),(function(b){return b.parent}))}function ch(a){for(var b=function(c){c=a[c];var e=[c.primary.doc];Sa(c.primary.doc,(function(h){return e.push(h)}));for(var f=0;f<c.markers.length;f++){var g=c.markers[f];-1==ea(e,g.doc)&&(g.parent=null,c.markers.splice(f--,1))}},d=0;d<a.length;d++)b(d)}function dh(a){var b=this;Tf(b);if(!Z(b,a)&&!Ka(b.display,a)){la(a);G&&(Uf=+new Date);var d=eb(b,a,!0),c=a.dataTransfer.files;if(d&&!b.isReadOnly())if(c&&c.length&&window.FileReader&&window.File)for(var e=c.length,f=Array(e),g=0,h=function(){++g==e&&ba(b,(function(){d=C(b.doc,d);var m={from:d,to:d,text:b.doc.splitLines(f.filter((function(n){return null!=n})).join(b.doc.lineSeparator())),origin:"paste"};Ab(b.doc,m);Ef(b.doc,Na(C(b.doc,d),C(b.doc,Ra(m))))}))()},k=function(m,n){if(b.options.allowDropFileTypes&&-1==ea(b.options.allowDropFileTypes,m.type))h();else{var p=new FileReader;p.onerror=function(){return h()};p.onload=function(){var q=p.result;/[\x00-\x08\x0e-\x1f]{2}/.test(q)||(f[n]=q);h()};p.readAsText(m)}},l=0;l<c.length;l++)k(c[l],l);else if(b.state.draggingText&&-1<b.doc.sel.contains(d))b.state.draggingText(a),setTimeout((function(){return b.display.input.focus()}),20);else try{if(k=a.dataTransfer.getData("Text")){b.state.draggingText&&!b.state.draggingText.copy&&(l=b.listSelections());Tc(b.doc,Na(d,d));if(l)for(c=0;c<l.length;++c)Bb(b.doc,"",l[c].anchor,l[c].head,"drag");b.replaceSelection(k,"around","paste");b.display.input.focus()}}catch(m){}}}function Tf(a){a.display.dragCursor&&(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function Vf(a){if(document.getElementsByClassName){for(var b=document.getElementsByClassName("CodeMirror"),d=[],c=0;c<b.length;c++){var e=b[c].CodeMirror;e&&d.push(e)}d.length&&d[0].operation((function(){for(var f=0;f<d.length;f++)a(d[f])}))}}function eh(){var a;z(window,"resize",(function(){null==a&&(a=setTimeout((function(){a=null;Vf(fh)}),100))}));z(window,"blur",(function(){return Vf(ub)}))}function fh(a){var b=a.display;b.cachedCharWidth=b.cachedTextHeight=b.cachedPaddingH=null;b.scrollbarsClipped=!1;a.setSize()}function gh(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var d,c,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))d=!0;else if(/^(c|ctrl|control)$/i.test(h))c=!0;else if(/^s(hift)?$/i.test(h))e=!0;else throw Error("Unrecognized modifier name: "+h)}d&&(a="Alt-"+a);c&&(a="Ctrl-"+a);f&&(a="Cmd-"+a);e&&(a="Shift-"+a);return a}function hh(a){var b={},d;for(d in a)if(a.hasOwnProperty(d)){var c=a[d];if(!/^(name|fallthrough|(de|at)tach)$/.test(d)){if("..."!=c)for(var e=uc(d.split(" "),gh),f=0;f<e.length;f++){if(f==e.length-1){var g=e.join(" ");var h=c}else g=e.slice(0,f+1).join(" "),h="...";var k=b[g];if(!k)b[g]=h;else if(k!=h)throw Error("Inconsistent bindings for "+g)}delete a[d]}}for(var l in b)a[l]=b[l];return a}function Db(a,b,d,c){b=Wc(b);var e=b.call?b.call(a,c):b[a];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&d(e))return"handled";if(b.fallthrough){if("[object Array]"!=Object.prototype.toString.call(b.fallthrough))return Db(a,b.fallthrough,d,c);for(e=0;e<b.fallthrough.length;e++){var f=Db(a,b.fallthrough[e],d,c);if(f)return f}}}function Wf(a){a="string"==typeof a?a:Ua[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function Xf(a,b,d){var c=a;b.altKey&&"Alt"!=c&&(a="Alt-"+a);(Yf?b.metaKey:b.ctrlKey)&&"Ctrl"!=c&&(a="Ctrl-"+a);(Yf?b.ctrlKey:b.metaKey)&&"Mod"!=c&&(a="Cmd-"+a);!d&&b.shiftKey&&"Shift"!=c&&(a="Shift-"+a);return a}function Zf(a,b){if(Aa&&34==a.keyCode&&a["char"])return!1;var d=Ua[a.keyCode];if(null==d||a.altGraphKey)return!1;3==a.keyCode&&a.code&&(d=a.code);return Xf(d,a,b)}function Wc(a){return"string"==typeof a?gc[a]:a}function Eb(a,b){for(var d=a.doc.sel.ranges,c=[],e=0;e<d.length;e++){for(var f=b(d[e]);c.length&&0>=B(f.from,J(c).to);){var g=c.pop();if(0>B(g.from,f.from)){f.from=g.from;break}}c.push(f)}qa(a,(function(){for(var h=c.length-1;0<=h;h--)Bb(a.doc,"",c[h].from,c[h].to,"+delete");vb(a)}))}function ce(a,b,d){b=qe(a.text,b+d,d);return 0>b||b>a.text.length?null:b}function de(a,b,d){a=ce(a,b.ch,d);return null==a?null:new t(b.line,a,0>d?"after":"before")}function ee(a,b,d,c,e){if(a&&("rtl"==b.doc.direction&&(e=-e),a=Ia(d,b.doc.direction))){a=0>e?J(a):a[0];var f=0>e==(1==a.level)?"after":"before";if(0<a.level||"rtl"==b.doc.direction){var g=cb(b,d);var h=0>e?d.text.length-1:0;var k=ya(b,g,h).top;h=Hb((function(l){return ya(b,g,l).top==k}),0>e==(1==a.level)?a.from:a.to-1,h);"before"==f&&(h=ce(d,h,1))}else h=0>e?a.to:a.from;return new t(c,h,f)}return new t(c,0>e?d.text.length:0,0>e?"before":"after")}function ih(a,b,d,c){var e=Ia(b,a.doc.direction);if(!e)return de(b,d,c);d.ch>=b.text.length?(d.ch=b.text.length,d.sticky="before"):0>=d.ch&&(d.ch=0,d.sticky="after");var f=Ib(e,d.ch,d.sticky),g=e[f];if("ltr"==a.doc.direction&&0==g.level%2&&(0<c?g.to>d.ch:g.from<d.ch))return de(b,d,c);var h=function(q,r){return ce(b,q instanceof t?q.ch:q,r)},k,l=function(q){if(!a.options.lineWrapping)return{begin:0,end:b.text.length};k=k||cb(a,b);return bf(a,b,k,q)},m=l("before"==d.sticky?h(d,-1):d.ch);if("rtl"==a.doc.direction||1==g.level){var n=1==g.level==0>c,p=h(d,n?1:-1);if(null!=p&&(n?p<=g.to&&p<=m.end:p>=g.from&&p>=m.begin))return new t(d.line,p,n?"before":"after")}g=function(q,r,u){for(var A=function(K,Q){return Q?new t(d.line,h(K,1),"before"):new t(d.line,K,"after")};0<=q&&q<e.length;q+=r){var Y=e[q],x=0<r==(1!=Y.level),P=x?u.begin:h(u.end,-1);if(Y.from<=P&&P<Y.to)return A(P,x);P=x?Y.from:h(Y.to,-1);if(u.begin<=P&&P<u.end)return A(P,x)}};if(f=g(f+c,c,m))return f;m=0<c?m.end:h(m.begin,-1);return null==m||0<c&&m==b.text.length||!(f=g(0<c?0:e.length-1,c,l(m)))?null:f}function $f(a,b){var d=w(a.doc,b),c=Ea(d);c!=d&&(b=N(c));return ee(!0,a,c,b,1)}function ag(a,b){var d=$f(a,b.line),c=w(a.doc,d.line);a=Ia(c,a.doc.direction);return a&&0!=a[0].level?d:(c=Math.max(d.ch,c.text.search(/\S/)),t(d.line,b.line==d.line&&b.ch<=c&&b.ch?0:c,d.sticky))}function Xc(a,b,d){if("string"==typeof b&&(b=hc[b],!b))return!1;a.display.input.ensurePolled();var c=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d&&(a.display.shift=!1),e=b(a)!=Yc}finally{a.display.shift=c,a.state.suppressEdits=!1}return e}function ic(a,b,d,c){var e=a.state.keySeq;if(e){if(Wf(b))return"handled";/'$/.test(b)?a.state.keySeq=null:jh.set(50,(function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())}));if(bg(a,e+" "+b,d,c))return!0}return bg(a,b,d,c)}function bg(a,b,d,c){a:{for(var e=0;e<a.state.keyMaps.length;e++){var f=Db(b,a.state.keyMaps[e],c,a);if(f){c=f;break a}}c=a.options.extraKeys&&Db(b,a.options.extraKeys,c,a)||Db(b,a.options.keyMap,c,a)}"multi"==c&&(a.state.keySeq=b);"handled"==c&&aa(a,"keyHandled",a,b,d);if("handled"==c||"multi"==c)la(d),Od(a);return!!c}function cg(a,b){var d=Zf(b,!0);return d?b.shiftKey&&!a.state.keySeq?ic(a,"Shift-"+d,b,(function(c){return Xc(a,c,!0)}))||ic(a,d,b,(function(c){if("string"==typeof c?/^go[A-Z]/.test(c):c.motion)return Xc(a,c)})):ic(a,d,b,(function(c){return Xc(a,c)})):!1}function kh(a,b,d){return ic(a,"'"+d+"'",b,(function(c){return Xc(a,c,!0)}))}function dg(a){if(!a.target||a.target==this.display.input.getField())if(this.curOp.focus=ka(),!Z(this,a)){G&&11>T&&27==a.keyCode&&(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var d=cg(this,a);Aa&&(fe=d?b:null,!d&&88==b&&!lh&&(xa?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));La&&!xa&&!d&&46==b&&a.shiftKey&&!a.ctrlKey&&document.execCommand&&document.execCommand("cut");18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||mh(this)}}function mh(a){function b(c){18!=c.keyCode&&c.altKey||(hb(d,"CodeMirror-crosshair"),sa(document,"keyup",b),sa(document,"mouseover",b))}var d=a.display.lineDiv;Wa(d,"CodeMirror-crosshair");z(document,"keyup",b);z(document,"mouseover",b)}function eg(a){16==a.keyCode&&(this.doc.sel.shift=!1);Z(this,a)}function fg(a){if(!(a.target&&a.target!=this.display.input.getField()||Ka(this.display,a)||Z(this,a)||a.ctrlKey&&!a.altKey||xa&&a.metaKey)){var b=a.keyCode,d=a.charCode;if(Aa&&b==fe)fe=null,la(a);else if(!Aa||a.which&&!(10>a.which)||!cg(this,a))if(b=String.fromCharCode(null==d?b:d),"\b"!=b&&!kh(this,a,b))this.display.input.onKeyPress(a)}}function nh(a,b){var d=+new Date;if(jc&&jc.compare(d,a,b))return kc=jc=null,"triple";if(kc&&kc.compare(d,a,b))return jc=new ge(d,a,b),kc=null,"double";kc=new ge(d,a,b);jc=null;return"single"}function gg(a){var b=this.display;if(!(Z(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,Ka(b,a))fa||(b.scroller.draggable=!1,setTimeout((function(){return b.scroller.draggable=!0}),100));else if(!Zc(this,a,"gutterClick",!0)){var d=eb(this,a),c=te(a),e=d?nh(d,c):"single";window.focus();1==c&&this.state.selectingText&&this.state.selectingText(a);if(!d||!oh(this,c,d,e,a))if(1==c)d?ph(this,d,e,a):(a.target||a.srcElement)==b.scroller&&la(a);else if(2==c)d&&Sc(this.doc,d),setTimeout((function(){return b.input.focus()}),20);else if(3==c)if(he)this.display.input.onContextMenu(a);else Qd(this)}}function oh(a,b,d,c,e){var f="Click";"double"==c?f="Double"+f:"triple"==c&&(f="Triple"+f);return ic(a,Xf((1==b?"Left":2==b?"Middle":"Right")+f,e),e,(function(g){"string"==typeof g&&(g=hc[g]);if(!g)return!1;var h=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),h=g(a,d)!=Yc}finally{a.state.suppressEdits=!1}return h}))}function ph(a,b,d,c){G?setTimeout(fd(gf,a),0):a.curOp.focus=ka();var e=a.getOption("configureMouse");e=e?e(a,d,c):{};null==e.unit&&(e.unit=(qh?c.shiftKey&&c.metaKey:c.altKey)?"rectangle":"single"==d?"char":"double"==d?"word":"line");if(null==e.extend||a.doc.extend)e.extend=a.doc.extend||c.shiftKey;null==e.addNew&&(e.addNew=xa?c.metaKey:c.ctrlKey);null==e.moveOnDrag&&(e.moveOnDrag=!(xa?c.altKey:c.ctrlKey));var f=a.doc.sel,g;a.options.dragDrop&&rh&&!a.isReadOnly()&&"single"==d&&-1<(g=f.contains(b))&&(0>B((g=f.ranges[g]).from(),b)||0<b.xRel)&&(0<B(g.to(),b)||0>b.xRel)?sh(a,c,b,e):th(a,c,b,e)}function sh(a,b,d,c){var e=a.display,f=!1,g=ba(a,(function(l){fa&&(e.scroller.draggable=!1);a.state.draggingText=!1;a.state.delayingBlurEvent&&(a.hasFocus()?a.state.delayingBlurEvent=!1:Qd(a));sa(e.wrapper.ownerDocument,"mouseup",g);sa(e.wrapper.ownerDocument,"mousemove",h);sa(e.scroller,"dragstart",k);sa(e.scroller,"drop",g);f||(la(l),c.addNew||Sc(a.doc,d,null,null,c.extend),fa&&!$c||G&&9==T?setTimeout((function(){e.wrapper.ownerDocument.body.focus({preventScroll:!0});e.input.focus()}),20):e.input.focus())})),h=function(l){f=f||10<=Math.abs(b.clientX-l.clientX)+Math.abs(b.clientY-l.clientY)},k=function(){return f=!0};fa&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=!c.moveOnDrag;z(e.wrapper.ownerDocument,"mouseup",g);z(e.wrapper.ownerDocument,"mousemove",h);z(e.scroller,"dragstart",k);z(e.scroller,"drop",g);a.state.delayingBlurEvent=!0;setTimeout((function(){return e.input.focus()}),20);e.scroller.dragDrop&&e.scroller.dragDrop()}function hg(a,b,d){if("char"==d)return new I(b,b);if("word"==d)return a.findWordAt(b);if("line"==d)return new I(t(b.line,0),C(a.doc,t(b.line+1,0)));a=d(a,b);return new I(a.from,a.to)}function th(a,b,d,c){function e(x){if(0!=B(q,x))if(q=x,"rectangle"==c.unit){var P=[],K=a.options.tabSize,Q=va(w(k,d.line).text,d.ch,K),S=va(w(k,x.line).text,x.ch,K),F=Math.min(Q,S);Q=Math.max(Q,S);S=Math.min(d.line,x.line);for(var R=Math.min(a.lastLine(),Math.max(d.line,x.line));S<=R;S++){var H=w(k,S).text,L=gd(H,F,K);F==Q?P.push(new I(t(S,L),t(S,L))):H.length>L&&P.push(new I(t(S,L),t(S,gd(H,Q,K))))}P.length||P.push(new I(d,d));da(k,Ba(a,l.ranges.slice(0,n).concat(P),n),{origin:"*mouse",scroll:!1});a.scrollIntoView(x)}else P=p,F=hg(a,x,c.unit),x=P.anchor,0<B(F.anchor,x)?(K=F.head,x=zc(P.from(),F.anchor)):(K=F.anchor,x=yc(P.to(),F.head)),P=l.ranges.slice(0),P[n]=uh(a,new I(C(k,x),K)),da(k,Ba(a,P,n),ie)}function f(x){var P=++u,K=eb(a,x,!0,"rectangle"==c.unit);if(K)if(0!=B(K,q)){a.curOp.focus=ka();e(K);var Q=Lc(h,k);(K.line>=Q.to||K.line<Q.from)&&setTimeout(ba(a,(function(){u==P&&f(x)})),150)}else{var S=x.clientY<r.top?-20:x.clientY>r.bottom?20:0;S&&setTimeout(ba(a,(function(){u==P&&(h.scroller.scrollTop+=S,f(x))})),50)}}function g(x){a.state.selectingText=!1;u=Infinity;x&&(la(x),h.input.focus());sa(h.wrapper.ownerDocument,"mousemove",A);sa(h.wrapper.ownerDocument,"mouseup",Y);k.history.lastSelOrigin=null}G&&Qd(a);var h=a.display,k=a.doc;la(b);var l=k.sel,m=l.ranges;if(c.addNew&&!c.extend){var n=k.sel.contains(d);var p=-1<n?m[n]:new I(d,d)}else p=k.sel.primary(),n=k.sel.primIndex;"rectangle"==c.unit?(c.addNew||(p=new I(d,d)),d=eb(a,b,!0,!0),n=-1):(b=hg(a,d,c.unit),p=c.extend?ae(p,b.anchor,b.head,c.extend):b);c.addNew?-1==n?(n=m.length,da(k,Ba(a,m.concat([p]),n),{scroll:!1,origin:"*mouse"})):1<m.length&&m[n].empty()&&"char"==c.unit&&!c.extend?(da(k,Ba(a,m.slice(0,n).concat(m.slice(n+1)),0),{scroll:!1,origin:"*mouse"}),l=k.sel):be(k,n,p,ie):(n=0,da(k,new ua([p],0),ie),l=k.sel);var q=d,r=h.wrapper.getBoundingClientRect(),u=0,A=ba(a,(function(x){0!==x.buttons&&te(x)?f(x):g(x)})),Y=ba(a,g);a.state.selectingText=Y;z(h.wrapper.ownerDocument,"mousemove",A);z(h.wrapper.ownerDocument,"mouseup",Y)}function uh(a,b){var d=b.anchor,c=b.head,e=w(a.doc,d.line);if(0==B(d,c)&&d.sticky==c.sticky)return b;e=Ia(e);if(!e)return b;var f=Ib(e,d.ch,d.sticky),g=e[f];if(g.from!=d.ch&&g.to!=d.ch)return b;var h=f+(g.from==d.ch==(1!=g.level)?0:1);if(0==h||h==e.length)return b;c.line!=d.line?a=0<(c.line-d.line)*("ltr"==a.doc.direction?1:-1):(a=Ib(e,c.ch,c.sticky),f=a-f||(c.ch-d.ch)*(1==g.level?-1:1),a=a==h-1||a==h?0>f:0<f);e=e[h+(a?-1:0)];e=(h=a==(1==e.level))?e.from:e.to;h=h?"after":"before";return d.ch==e&&d.sticky==h?b:new I(new t(d.line,e,h),c)}function Zc(a,b,d,c){if(b.touches){var e=b.touches[0].clientX;var f=b.touches[0].clientY}else try{e=b.clientX,f=b.clientY}catch(k){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;c&&la(b);c=a.display;var g=c.lineDiv.getBoundingClientRect();if(f>g.bottom||!wa(a,d))return kd(b);f-=g.top-c.viewOffset;for(g=0;g<a.display.gutterSpecs.length;++g){var h=c.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=e)return e=$a(a.doc,f),W(a,d,a,e,a.display.gutterSpecs[g].className,b),kd(b)}}function ig(a,b){var d;(d=Ka(a.display,b))||(d=wa(a,"gutterContextMenu")?Zc(a,b,"gutterContextMenu",!1):!1);if(!d&&!Z(a,b,"contextmenu")&&!he)a.display.input.onContextMenu(b)}function jg(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Sb(a)}function vh(a,b,d){!b!=!(d&&d!=Fb)&&(d=a.display.dragFunctions,b=b?z:sa,b(a.display.scroller,"dragstart",d.start),b(a.display.scroller,"dragenter",d.enter),b(a.display.scroller,"dragover",d.over),b(a.display.scroller,"dragleave",d.leave),b(a.display.scroller,"drop",d.drop))}function wh(a){a.options.lineWrapping?(Wa(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(hb(a.display.wrapper,"CodeMirror-wrap"),yd(a));Md(a);ma(a);Sb(a);setTimeout((function(){return wb(a)}),100)}function U(a,b){var d=this;if(!(this instanceof U))return new U(a,b);this.options=b=b?Xa(b):{};Xa(kg,b,!1);var c=b.value;"string"==typeof c?c=new oa(c,b.mode,null,b.lineSeparator,b.direction):b.mode&&(c.modeOption=b.mode);this.doc=c;var e=new U.inputStyles[b.inputStyle](this);a=this.display=new Wg(a,c,e,b);a.wrapper.CodeMirror=this;jg(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");nf(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Va,keySeq:null,specialChars:null};b.autofocus&&!Zb&&a.input.focus();G&&11>T&&setTimeout((function(){return d.display.input.reset(!0)}),20);xh(this);lg||(eh(),lg=!0);jb(this);this.curOp.forceUpdate=!0;xf(this,c);b.autofocus&&!Zb||this.hasFocus()?setTimeout((function(){d.hasFocus()&&!d.state.focused&&Pd(d)}),20):ub(this);for(var f in ad)if(ad.hasOwnProperty(f))ad[f](this,b[f],Fb);qf(this);b.finishInit&&b.finishInit(this);for(c=0;c<je.length;++c)je[c](this);kb(this);fa&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function xh(a){function b(){c.activeTouch&&(e=setTimeout((function(){return c.activeTouch=null}),1e3),f=c.activeTouch,f.end=+new Date)}function d(h,k){if(null==k.left)return!0;var l=k.left-h.left;h=k.top-h.top;return 400<l*l+h*h}var c=a.display;z(c.scroller,"mousedown",ba(a,gg));G&&11>T?z(c.scroller,"dblclick",ba(a,(function(h){if(!Z(a,h)){var k=eb(a,h);!k||Zc(a,h,"gutterClick",!0)||Ka(a.display,h)||(la(h),h=a.findWordAt(k),Sc(a.doc,h.anchor,h.head))}}))):z(c.scroller,"dblclick",(function(h){return Z(a,h)||la(h)}));z(c.scroller,"contextmenu",(function(h){return ig(a,h)}));z(c.input.getField(),"contextmenu",(function(h){c.scroller.contains(h.target)||ig(a,h)}));var e,f={end:0};z(c.scroller,"touchstart",(function(h){var k;if(k=!Z(a,h))1!=h.touches.length?k=!1:(k=h.touches[0],k=1>=k.radiusX&&1>=k.radiusY),k=!k;k&&!Zc(a,h,"gutterClick",!0)&&(c.input.ensurePolled(),clearTimeout(e),k=+new Date,c.activeTouch={start:k,moved:!1,prev:300>=k-f.end?f:null},1==h.touches.length&&(c.activeTouch.left=h.touches[0].pageX,c.activeTouch.top=h.touches[0].pageY))}));z(c.scroller,"touchmove",(function(){c.activeTouch&&(c.activeTouch.moved=!0)}));z(c.scroller,"touchend",(function(h){var k=c.activeTouch;if(k&&!Ka(c,h)&&null!=k.left&&!k.moved&&300>new Date-k.start){var l=a.coordsChar(c.activeTouch,"page");k=!k.prev||d(k,k.prev)?new I(l,l):!k.prev.prev||d(k,k.prev.prev)?a.findWordAt(l):new I(t(l.line,0),C(a.doc,t(l.line+1,0)));a.setSelection(k.anchor,k.head);a.focus();la(h)}b()}));z(c.scroller,"touchcancel",b);z(c.scroller,"scroll",(function(){c.scroller.clientHeight&&(Vb(a,c.scroller.scrollTop),ib(a,c.scroller.scrollLeft,!0),W(a,"scroll",a))}));z(c.scroller,"mousewheel",(function(h){return tf(a,h)}));z(c.scroller,"DOMMouseScroll",(function(h){return tf(a,h)}));z(c.wrapper,"scroll",(function(){return c.wrapper.scrollTop=c.wrapper.scrollLeft=0}));c.dragFunctions={enter:function(h){Z(a,h)||Kb(h)},over:function(h){if(!Z(a,h)){var k=eb(a,h);if(k){var l=document.createDocumentFragment();ff(a,k,l);a.display.dragCursor||(a.display.dragCursor=v("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),a.display.lineSpace.insertBefore(a.display.dragCursor,a.display.cursorDiv));D(a.display.dragCursor,l)}Kb(h)}},start:function(h){if(G&&(!a.state.draggingText||100>+new Date-Uf))Kb(h);else if(!Z(a,h)&&!Ka(a.display,h)&&(h.dataTransfer.setData("Text",a.getSelection()),h.dataTransfer.effectAllowed="copyMove",h.dataTransfer.setDragImage&&!$c)){var k=v("img",null,null,"position: fixed; left: 0; top: 0;");k.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";Aa&&(k.width=k.height=1,a.display.wrapper.appendChild(k),k._top=k.offsetTop);h.dataTransfer.setDragImage(k,0,0);Aa&&k.parentNode.removeChild(k)}},drop:ba(a,dh),leave:function(h){Z(a,h)||Tf(a)}};var g=c.input.getField();z(g,"keyup",(function(h){return eg.call(a,h)}));z(g,"keydown",ba(a,dg));z(g,"keypress",ba(a,fg));z(g,"focus",(function(h){return Pd(a,h)}));z(g,"blur",(function(h){return ub(a,h)}))}function lc(a,b,d,c){var e=a.doc,f;null==d&&(d="add");"smart"==d&&(e.mode.indent?f=Mb(a,b).state:d="prev");var g=a.options.tabSize,h=w(e,b),k=va(h.text,null,g);h.stateAfter&&(h.stateAfter=null);var l=h.text.match(/^\s*/)[0];if(!c&&!/\S/.test(h.text)){var m=0;d="not"}else if("smart"==d&&(m=e.mode.indent(f,h.text.slice(l.length),h.text),m==Yc||150<m)){if(!c)return;d="prev"}"prev"==d?m=b>e.first?va(w(e,b-1).text,null,g):0:"add"==d?m=k+a.options.indentUnit:"subtract"==d?m=k-a.options.indentUnit:"number"==typeof d&&(m=k+d);m=Math.max(0,m);d="";c=0;if(a.options.indentWithTabs)for(a=Math.floor(m/g);a;--a)c+=g,d+="\t";c<m&&(d+=hd(m-c));if(d!=l)return Bb(e,d,t(b,0),t(b,l.length),"+input"),h.stateAfter=null,!0;for(g=0;g<e.sel.ranges.length;g++)if(h=e.sel.ranges[g],h.head.line==b&&h.head.ch<l.length){b=t(b,l.length);be(e,g,new I(b,b));break}}function ke(a,b,d,c,e){var f=a.doc;a.display.shift=!1;c||(c=f.sel);var g=+new Date-200,h="paste"==e||a.state.pasteIncoming>g,k=le(b),l=null;if(h&&1<c.ranges.length)if(ra&&ra.text.join("\n")==b){if(0==c.ranges.length%ra.text.length){l=[];for(var m=0;m<ra.text.length;m++)l.push(f.splitLines(ra.text[m]))}}else k.length==c.ranges.length&&a.options.pasteLinesPerSelection&&(l=uc(k,(function(u){return[u]})));m=a.curOp.updateInput;for(var n=c.ranges.length-1;0<=n;n--){var p=c.ranges[n],q=p.from(),r=p.to();p.empty()&&(d&&0<d?q=t(q.line,q.ch-d):a.state.overwrite&&!h?r=t(r.line,Math.min(w(f,r.line).text.length,r.ch+J(k).length)):h&&ra&&ra.lineWise&&ra.text.join("\n")==k.join("\n")&&(q=r=t(q.line,0)));p={from:q,to:r,text:l?l[n%l.length]:k,origin:e||(h?"paste":a.state.cutIncoming>g?"cut":"+input")};Ab(a.doc,p);aa(a,"inputRead",a,p)}b&&!h&&mg(a,b);vb(a);2>a.curOp.updateInput&&(a.curOp.updateInput=m);a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=-1}function ng(a,b){var d=a.clipboardData&&a.clipboardData.getData("Text");if(d)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||qa(b,(function(){return ke(b,d,0,null,"paste")})),!0}function mg(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var d=a.doc.sel,c=d.ranges.length-1;0<=c;c--){var e=d.ranges[c];if(!(100<e.head.ch||c&&d.ranges[c-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars)for(var h=0;h<f.electricChars.length;h++){if(-1<b.indexOf(f.electricChars.charAt(h))){g=lc(a,e.head.line,"smart");break}}else f.electricInput&&f.electricInput.test(w(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=lc(a,e.head.line,"smart"));g&&aa(a,"electricInput",a,e.head.line)}}}function og(a){for(var b=[],d=[],c=0;c<a.doc.sel.ranges.length;c++){var e=a.doc.sel.ranges[c].head.line;e={anchor:t(e,0),head:t(e+1,0)};d.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:d}}function pg(a,b,d,c){a.setAttribute("autocorrect",d?"":"off");a.setAttribute("autocapitalize",c?"":"off");a.setAttribute("spellcheck",!!b)}function qg(){var a=v("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none"),b=v("div",[a],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");fa?a.style.width="1000px":a.setAttribute("wrap","off");mc&&(a.style.border="1px solid black");pg(a);return b}function me(a,b,d,c,e){function f(u){if("codepoint"==c){var A=k.text.charCodeAt(b.ch+(0<d?0:-1));A=isNaN(A)?null:new t(b.line,Math.max(0,Math.min(k.text.length,b.ch+d*((0<d?55296<=A&&56320>A:56320<=A&&57343>A)?2:1))),-d)}else A=e?ih(a.cm,k,b,d):de(k,b,d);if(null==A){if(u=!u)u=b.line+l,u<a.first||u>=a.first+a.size?u=!1:(b=new t(u,b.ch,b.sticky),u=k=w(a,u));if(u)b=ee(e,a.cm,k,b.line,l);else return!1}else b=A;return!0}var g=b,h=d,k=w(a,b.line),l=e&&"rtl"==a.direction?-d:d;if("char"==c||"codepoint"==c)f();else if("column"==c)f(!0);else if("word"==c||"group"==c)for(var m=null,n="group"==c,p=a.cm&&a.cm.getHelper(b,"wordChars"),q=!0;!(0>d)||f(!q);q=!1){var r=k.text.charAt(b.ch)||"\n";r=vc(r,p)?"w":n&&"\n"==r?"n":!n||/\s/.test(r)?null:"p";!n||q||r||(r="s");if(m&&m!=r){0>d&&(d=1,f(),b.sticky="after");break}r&&(m=r);if(0<d&&!f(!q))break}h=Uc(a,b,g,h,!0);qd(g,h)&&(h.hitSide=!0);return h}function rg(a,b,d,c){var e=a.doc,f=b.left;if("page"==c){var g=Math.max(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-.5*tb(a.display),3);g=(0<d?b.bottom:b.top)+d*g}else"line"==c&&(g=0<d?b.bottom+3:b.top-3);for(;;){b=Jd(a,f,g);if(!b.outside)break;if(0>d?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*d}return b}function sg(a,b){var d=Ed(a,b.line);if(!d||d.hidden)return null;var c=w(a.doc,b.line);d=Se(d,c,b.line);a=Ia(c,a.doc.direction);c="left";a&&(c=Ib(a,b.ch)%2?"right":"left");b=Te(d.map,b.ch,c);b.offset="right"==b.collapse?b.end:b.start;return b}function yh(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function Gb(a,b){b&&(a.bad=!0);return a}function zh(a,b,d,c,e){function f(q){return function(r){return r.id==q}}function g(){m&&(l+=n,p&&(l+=n),m=p=!1)}function h(q){q&&(g(),l+=q)}function k(q){if(1==q.nodeType){var r=q.getAttribute("cm-text");if(r)h(r);else{r=q.getAttribute("cm-marker");var u;if(r)q=a.findMarks(t(c,0),t(e+1,0),f(+r)),q.length&&(u=q[0].find(0))&&h(Za(a.doc,u.from,u.to).join(n));else if("false"!=q.getAttribute("contenteditable")&&(u=/^(pre|div|p|li|table|br)$/i.test(q.nodeName),/^br$/i.test(q.nodeName)||0!=q.textContent.length)){u&&g();for(r=0;r<q.childNodes.length;r++)k(q.childNodes[r]);/^(pre|p)$/i.test(q.nodeName)&&(p=!0);u&&(m=!0)}}}else 3==q.nodeType&&h(q.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(var l="",m=!1,n=a.doc.lineSeparator(),p=!1;;){k(b);if(b==d)break;b=b.nextSibling;p=!1}return l}function bd(a,b,d){if(b==a.display.lineDiv){var c=a.display.lineDiv.childNodes[d];if(!c)return Gb(a.clipPos(t(a.display.viewTo-1)),!0);b=null;d=0}else for(c=b;;c=c.parentNode){if(!c||c==a.display.lineDiv)return null;if(c.parentNode&&c.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==c)return Ah(f,b,d)}}function Ah(a,b,d){function c(m,n,p){for(var q=-1;q<(l?l.length:0);q++)for(var r=0>q?k.map:l[q],u=0;u<r.length;u+=3){var A=r[u+2];if(A==m||A==n){n=N(0>q?a.line:a.rest[q]);q=r[u]+p;if(0>p||A!=m)q=r[u+(p?1:0)];return t(n,q)}}}var e=a.text.firstChild,f=!1;if(!b||!ja(e,b))return Gb(t(N(a.line),0),!0);if(b==e&&(f=!0,b=e.childNodes[d],d=0,!b))return d=a.rest?J(a.rest):a.line,Gb(t(N(d),d.text.length),f);var g=3==b.nodeType?b:null,h=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,d&&(d=g.nodeValue.length));for(;h.parentNode!=e;)h=h.parentNode;var k=a.measure,l=k.maps;if(b=c(g,h,d))return Gb(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-d:0;e;e=e.nextSibling){if(b=c(e,e.firstChild,0))return Gb(t(b.line,b.ch-g),f);g+=e.textContent.length}for(h=h.previousSibling;h;h=h.previousSibling){if(b=c(h,h.firstChild,-1))return Gb(t(b.line,b.ch+d),f);d+=h.textContent.length}}var pa=navigator.userAgent,tg=navigator.platform,La=/gecko\/\d/i.test(pa),ug=/MSIE \d/.test(pa),vg=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pa),cd=/Edge\/(\d+)/.exec(pa),G=ug||vg||cd,T=G&&(ug?document.documentMode||6:+(cd||vg)[1]),fa=!cd&&/WebKit\//.test(pa),Bh=fa&&/Qt\/\d+\.\d+/.test(pa),Ec=!cd&&/Chrome\//.test(pa),Aa=/Opera\//.test(pa),$c=/Apple Computer/.test(navigator.vendor),Ch=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(pa),Tg=/PhantomJS/.test(pa),mc=$c&&(/Mobile\/\w+/.test(pa)||2<navigator.maxTouchPoints),Fc=/Android/.test(pa),Zb=mc||Fc||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(pa),xa=mc||/Mac/.test(tg),qh=/\bCrOS\b/.test(pa),Dh=/win/i.test(tg),lb=Aa&&pa.match(/Version\/(\d*\.\d*)/);lb&&(lb=Number(lb[1]));lb&&15<=lb&&(Aa=!1,fa=!0);var Yf=xa&&(Bh||Aa&&(null==lb||12.11>lb)),he=La||G&&9<=T,hb=function(a,b){var d=a.className;if(b=y(b).exec(d)){var c=d.slice(b.index+b[0].length);a.className=d.slice(0,b.index)+(c?b[1]+c:"")}};var Ob=document.createRange?function(a,b,d,c){var e=document.createRange();e.setEnd(c||a,d);e.setStart(a,b);return e}:function(a,b,d){var c=document.body.createTextRange();try{c.moveToElementText(a.parentNode)}catch(e){return c}c.collapse(!0);c.moveEnd("character",d);c.moveStart("character",b);return c};var nc=function(a){a.select()};mc?nc=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:G&&(nc=function(a){try{a.select()}catch(b){}});var Va=function(){this.f=this.id=null;this.time=0;this.handler=fd(this.onTimeout,this)};Va.prototype.onTimeout=function(a){a.id=0;a.time<=+new Date?a.f():setTimeout(a.handler,a.time-+new Date)};Va.prototype.set=function(a,b){this.f=b;b=+new Date+a;if(!this.id||b<this.time)clearTimeout(this.id),this.id=setTimeout(this.handler,a),this.time=b};var Yc={toString:function(){return"CodeMirror.Pass"}},Ha={scroll:!1},ie={origin:"*mouse"},oc={origin:"+move"},tc=[""],xg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,yg=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,Jb=null,Ag=function(){function a(g,h,k){this.level=g;this.from=h;this.to=k}var b=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,c=/[LRr]/,e=/[Lb1n]/,f=/[1n]/;return function(g,h){var k="ltr"==h?"L":"R";if(0==g.length||"ltr"==h&&!b.test(g))return!1;for(var l=g.length,m=[],n=0;n<l;++n){var p=m,q=p.push;var r=g.charCodeAt(n);r=247>=r?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(r):1424<=r&&1524>=r?"R":1536<=r&&1785>=r?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(r-1536):1774<=r&&2220>=r?"r":8192<=r&&8203>=r?"w":8204==r?"b":"L";q.call(p,r)}n=0;for(p=k;n<l;++n)q=m[n],"m"==q?m[n]=p:p=q;n=0;for(p=k;n<l;++n)q=m[n],"1"==q&&"r"==p?m[n]="n":c.test(q)&&(p=q,"r"==q&&(m[n]="R"));n=1;for(p=m[0];n<l-1;++n)q=m[n],"+"==q&&"1"==p&&"1"==m[n+1]?m[n]="1":","!=q||p!=m[n+1]||"1"!=p&&"n"!=p||(m[n]=p),p=q;for(n=0;n<l;++n)if(p=m[n],","==p)m[n]="N";else if("%"==p){for(p=n+1;p<l&&"%"==m[p];++p);for(q=n&&"!"==m[n-1]||p<l&&"1"==m[p]?"1":"N";n<p;++n)m[n]=q;n=p-1}n=0;for(p=k;n<l;++n)q=m[n],"L"==p&&"1"==q?m[n]="L":c.test(q)&&(p=q);for(p=0;p<l;++p)if(d.test(m[p])){for(n=p+1;n<l&&d.test(m[n]);++n);q="L"==(p?m[p-1]:k);for(q=q==("L"==(n<l?m[n]:k))?q?"L":"R":k;p<n;++p)m[p]=q;p=n-1}k=[];var u;for(n=0;n<l;)if(e.test(m[n])){p=n;for(++n;n<l&&e.test(m[n]);++n);k.push(new a(0,p,n))}else{var A=n;p=k.length;q="rtl"==h?1:0;for(++n;n<l&&"L"!=m[n];++n);for(r=A;r<n;)if(f.test(m[r])){A<r&&(k.splice(p,0,new a(1,A,r)),p+=q);A=r;for(++r;r<n&&f.test(m[r]);++r);k.splice(p,0,new a(2,A,r));p+=q;A=r}else++r;A<n&&k.splice(p,0,new a(1,A,n))}"ltr"==h&&(1==k[0].level&&(u=g.match(/^\s+/))&&(k[0].from=u[0].length,k.unshift(new a(0,0,u[0].length))),1==J(k).level&&(u=g.match(/\s+$/))&&(J(k).to-=u[0].length,k.push(new a(0,l-u[0].length,l))));return"rtl"==h?k.reverse():k}}(),wc=[],z=function(a,b,d){a.addEventListener?a.addEventListener(b,d,!1):a.attachEvent?a.attachEvent("on"+b,d):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||wc).concat(d))},rh=function(){if(G&&9>T)return!1;var a=v("div");return"draggable"in a||"dragDrop"in a}(),Ad,zd,le=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,d=[],c=a.length;b<=c;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(d.push(f.slice(0,g)),b+=g+1):(d.push(f),b=e+1)}return d}:function(a){return a.split(/\r\n?|\n/)},Eh=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(d){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},lh=function(){var a=v("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),Gd=null,ld={},ob={},pb={},X=function(a,b,d){this.pos=this.start=0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=d};X.prototype.eol=function(){return this.pos>=this.string.length};X.prototype.sol=function(){return this.pos==this.lineStart};X.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};X.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)};X.prototype.eat=function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b};X.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););return this.pos>b};X.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};X.prototype.skipToEnd=function(){this.pos=this.string.length};X.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0};X.prototype.backUp=function(a){this.pos-=a};X.prototype.column=function(){this.lastColumnPos<this.start&&(this.lastColumnValue=va(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?va(this.string,this.lineStart,this.tabSize):0)};X.prototype.indentation=function(){return va(this.string,null,this.tabSize)-(this.lineStart?va(this.string,this.lineStart,this.tabSize):0)};X.prototype.match=function(a,b,d){if("string"==typeof a){var c=function(f){return d?f.toLowerCase():f},e=this.string.substr(this.pos,a.length);if(c(e)==c(a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}};X.prototype.current=function(){return this.string.slice(this.start,this.pos)};X.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}};X.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)};X.prototype.baseToken=function(){var a=this.lineOracle;return a&&a.baseToken(this.pos)};var Ac=function(a,b){this.state=a;this.lookAhead=b},Da=function(a,b,d,c){this.state=b;this.doc=a;this.line=d;this.maxLookAhead=c||0;this.baseTokens=null;this.baseTokenPos=1};Da.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);null!=b&&a>this.maxLookAhead&&(this.maxLookAhead=a);return b};Da.prototype.baseToken=function(a){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=a;)this.baseTokenPos+=2;var b=this.baseTokens[this.baseTokenPos+1];return{type:b&&b.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-a}};Da.prototype.nextLine=function(){this.line++;0<this.maxLookAhead&&this.maxLookAhead--};Da.fromSaved=function(a,b,d){return b instanceof Ac?new Da(a,Ya(a.mode,b.state),d,b.lookAhead):new Da(a,Ya(a.mode,b),d)};Da.prototype.save=function(a){a=!1!==a?Ya(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new Ac(a,this.maxLookAhead):a};var Be=function(a,b,d){this.start=a.start;this.end=a.pos;this.string=a.current();this.type=b||null;this.state=d},Lf=!1,Ja=!1,xb=function(a,b,d){this.text=a;Fe(this,b);this.height=d?d(this):1};xb.prototype.lineNo=function(){return N(this)};nb(xb);var Hg={},Gg={},rb=null,Pb=null,Ue={left:0,right:0,top:0,bottom:0},db,mb=function(a,b,d){this.cm=d;var c=this.vert=v("div",[v("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),e=this.horiz=v("div",[v("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");c.tabIndex=e.tabIndex=-1;a(c);a(e);z(c,"scroll",(function(){c.clientHeight&&b(c.scrollTop,"vertical")}));z(e,"scroll",(function(){e.clientWidth&&b(e.scrollLeft,"horizontal")}));this.checkedZeroWidth=!1;G&&8>T&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};mb.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,d=a.scrollHeight>a.clientHeight+1,c=a.nativeBarWidth;d?(this.vert.style.display="block",this.vert.style.bottom=b?c+"px":"0",this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?c:0)))+"px"):(this.vert.style.display="",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=d?c+"px":"0",this.horiz.style.left=a.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(d?c:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0<a.clientHeight&&(0==c&&this.zeroWidthHack(),this.checkedZeroWidth=!0);return{right:d?c:0,bottom:b?c:0}};mb.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")};mb.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")};mb.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=xa&&!Ch?"12px":"18px";this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new Va;this.disableVert=new Va};mb.prototype.enableZeroWidthBar=function(a,b,d){function c(){var e=a.getBoundingClientRect();("vert"==d?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1))!=a?a.style.pointerEvents="none":b.set(1e3,c)}a.style.pointerEvents="auto";b.set(1e3,c)};mb.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var pc=function(){};pc.prototype.update=function(){return{bottom:0,right:0}};pc.prototype.setScrollLeft=function(){};pc.prototype.setScrollTop=function(){};pc.prototype.clear=function(){};var of={native:mb,null:pc},Sg=0,Oc=function(a,b,d){var c=a.display;this.viewport=b;this.visible=Lc(c,a.doc,b);this.editorIsHidden=!c.wrapper.offsetWidth;this.wrapperHeight=c.wrapper.clientHeight;this.wrapperWidth=c.wrapper.clientWidth;this.oldDisplayWidth=ab(a);this.force=d;this.dims=Fd(a);this.events=[]};Oc.prototype.signal=function(a,b){wa(a,b)&&this.events.push(arguments)};Oc.prototype.finish=function(){for(var a=0;a<this.events.length;a++)W.apply(null,this.events[a])};var Pc=0,Ma=null;G?Ma=-.53:La?Ma=15:Ec?Ma=-.7:$c&&(Ma=-1/3);var ua=function(a,b){this.ranges=a;this.primIndex=b};ua.prototype.primary=function(){return this.ranges[this.primIndex]};ua.prototype.equals=function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var d=this.ranges[b],c=a.ranges[b];if(!qd(d.anchor,c.anchor)||!qd(d.head,c.head))return!1}return!0};ua.prototype.deepCopy=function(){for(var a=[],b=0;b<this.ranges.length;b++)a[b]=new I(rd(this.ranges[b].anchor),rd(this.ranges[b].head));return new ua(a,this.primIndex)};ua.prototype.somethingSelected=function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1};ua.prototype.contains=function(a,b){b||(b=a);for(var d=0;d<this.ranges.length;d++){var c=this.ranges[d];if(0<=B(b,c.from())&&0>=B(a,c.to()))return d}return-1};var I=function(a,b){this.anchor=a;this.head=b};I.prototype.from=function(){return zc(this.anchor,this.head)};I.prototype.to=function(){return yc(this.anchor,this.head)};I.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};cc.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var d=a,c=a+b;d<c;++d){var e=this.lines[d];this.height-=e.height;var f=e;f.parent=null;Ee(f);aa(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,d){this.height+=d;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,d){for(b=a+b;a<b;++a)if(d(this.lines[a]))return!0}};dc.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var d=0;d<this.children.length;++d){var c=this.children[d],e=c.chunkSize();if(a<e){var f=Math.min(b,e-a),g=c.height;c.removeInner(a,f);this.height-=g-c.height;e==f&&(this.children.splice(d--,1),c.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-b&&(1<this.children.length||!(this.children[0]instanceof cc))&&(a=[],this.collapse(a),this.children=[new cc(a)],this.children[0].parent=this)},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,d){this.size+=b.length;this.height+=d;for(var c=0;c<this.children.length;++c){var e=this.children[c],f=e.chunkSize();if(a<=f){e.insertInner(a,b,d);if(e.lines&&50<e.lines.length){for(b=a=e.lines.length%25+25;b<e.lines.length;)d=new cc(e.lines.slice(b,b+=25)),e.height-=d.height,this.children.splice(++c,0,d),d.parent=this;e.lines=e.lines.slice(0,a);this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new dc(b);if(a.parent){a.size-=b.size;a.height-=b.height;var d=ea(a.parent.children,a);a.parent.children.splice(d+1,0,b)}else d=new dc(a.children),d.parent=a,a.children=[d,b],a=d;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,b,d){for(var c=0;c<this.children.length;++c){var e=this.children[c],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,d))return!0;if(0==(b-=f))break;a=0}else a-=f}}};var ec=function(a,b,d){if(d)for(var c in d)d.hasOwnProperty(c)&&(this[c]=d[c]);this.doc=a;this.node=b};ec.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,d=this.line,c=N(d);if(null!=c&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(d.widgets=null);var f=Rb(this);Ca(d,Math.max(0,d.height-f));a&&(qa(a,(function(){var g=-f;Fa(d)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Mc(a,g);Qa(a,c,"widget")})),aa(a,"lineWidgetCleared",a,this,c))}};ec.prototype.changed=function(){var a=this,b=this.height,d=this.doc.cm,c=this.line;this.height=null;var e=Rb(this)-b;e&&(Oa(this.doc,c)||Ca(c,c.height+e),d&&qa(d,(function(){d.curOp.forceUpdate=!0;Fa(c)<(d.curOp&&d.curOp.scrollTop||d.doc.scrollTop)&&Mc(d,e);aa(d,"lineWidgetChanged",d,a,N(c))})))};nb(ec);var Rf=0,Ta=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=++Rf};Ta.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&jb(a);if(wa(this,"clear")){var d=this.find();d&&aa(this,"clear",d.from,d.to)}for(var c=d=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=Nb(f.markedSpans,this);a&&!this.collapsed?Qa(a,N(f),"text"):a&&(null!=g.to&&(c=N(f)),null!=g.from&&(d=N(f)));for(var h=f,k=void 0,l=f.markedSpans,m=g,n=0;n<l.length;++n)l[n]!=m&&(k||(k=[])).push(l[n]);h.markedSpans=k;null==g.from&&this.collapsed&&!Oa(this.doc,f)&&a&&Ca(f,tb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)f=Ea(this.lines[e]),g=Cc(f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=d&&a&&this.collapsed&&ma(a,d,c+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&Hf(a.doc));a&&aa(a,"markerCleared",a,this,d,c);b&&kb(a);this.parent&&this.parent.clear()}};Ta.prototype.find=function(a,b){null==a&&"bookmark"==this.type&&(a=1);for(var d,c,e=0;e<this.lines.length;++e){var f=this.lines[e],g=Nb(f.markedSpans,this);if(null!=g.from&&(d=t(b?f:N(f),g.from),-1==a))return d;if(null!=g.to&&(c=t(b?f:N(f),g.to),1==a))return c}return d&&{from:d,to:c}};Ta.prototype.changed=function(){var a=this,b=this.find(-1,!0),d=this,c=this.doc.cm;b&&c&&qa(c,(function(){var e=b.line,f=N(b.line);if(f=Ed(c,f))Ve(f),c.curOp.selectionChanged=c.curOp.forceUpdate=!0;c.curOp.updateMaxLine=!0;Oa(d.doc,e)||null==d.height||(f=d.height,d.height=null,(f=Rb(d)-f)&&Ca(e,e.height+f));aa(c,"markerChanged",c,a)}))};Ta.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=ea(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};Ta.prototype.detachLine=function(a){this.lines.splice(ea(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};nb(Ta);var fc=function(a,b){this.markers=a;this.primary=b;for(b=0;b<a.length;++b)a[b].parent=this};fc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();aa(this,"clear")}};fc.prototype.find=function(a,b){return this.primary.find(a,b)};nb(fc);var Fh=0,oa=function(a,b,d,c,e){if(!(this instanceof oa))return new oa(a,b,d,c,e);null==d&&(d=0);dc.call(this,[new cc([new xb("",null)])]);this.first=d;this.scrollTop=this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=d;d=t(d,0);this.sel=Na(d);this.history=new Qc(null);this.id=++Fh;this.modeOption=b;this.lineSep=c;this.direction="rtl"==e?"rtl":"ltr";this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Zd(this,{from:d,to:d,text:a});da(this,Na(d),Ha)};oa.prototype=oe(dc.prototype,{constructor:oa,iter:function(a,b,d){d?this.iterN(a-this.first,b-a,d):this.iterN(this.first,this.first+this.size,a)},insert:function(a,b){for(var d=0,c=0;c<b.length;++c)d+=b[c].height;this.insertInner(a-this.first,b,d)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=od(this,this.first,this.first+this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:ca((function(a){var b=t(this.first,0),d=this.first+this.size-1;Ab(this,{from:b,to:t(d,w(this,d).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0);this.cm&&Ub(this.cm,0,0);da(this,Na(b),Ha)})),replaceRange:function(a,b,d,c){b=C(this,b);d=d?C(this,d):b;Bb(this,a,b,d,c)},getRange:function(a,b,d){a=Za(this,C(this,a),C(this,b));return!1===d?a:""===d?a.join(""):a.join(d||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(Lb(this,a))return w(this,a)},getLineNumber:function(a){return N(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=w(this,a));return Ea(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(a){return C(this,a)},getCursor:function(a){var b=this.sel.primary();return null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||!1===a?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ca((function(a,b,d){a=C(this,"number"==typeof a?t(a,b||0):a);da(this,Na(a,null),d)})),setSelection:ca((function(a,b,d){var c=C(this,a);a=C(this,b||a);da(this,Na(c,a),d)})),extendSelection:ca((function(a,b,d){Sc(this,C(this,a),b&&C(this,b),d)})),extendSelections:ca((function(a,b){Df(this,ve(this,a),b)})),extendSelectionsBy:ca((function(a,b){a=uc(this.sel.ranges,a);Df(this,ve(this,a),b)})),setSelections:ca((function(a,b,d){if(a.length){for(var c=[],e=0;e<a.length;e++)c[e]=new I(C(this,a[e].anchor),C(this,a[e].head||a[e].anchor));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));da(this,Ba(this.cm,c,b),d)}})),addSelection:ca((function(a,b,d){var c=this.sel.ranges.slice(0);c.push(new I(C(this,a),C(this,b||a)));da(this,Ba(this.cm,c,c.length-1),d)})),getSelection:function(a){for(var b=this.sel.ranges,d,c=0;c<b.length;c++){var e=Za(this,b[c].from(),b[c].to());d=d?d.concat(e):e}return!1===a?d:d.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],d=this.sel.ranges,c=0;c<d.length;c++){var e=Za(this,d[c].from(),d[c].to());!1!==a&&(e=e.join(a||this.lineSeparator()));b[c]=e}return b},replaceSelection:function(a,b,d){for(var c=[],e=0;e<this.sel.ranges.length;e++)c[e]=a;this.replaceSelections(c,b,d||"+input")},replaceSelections:ca((function(a,b,d){for(var c=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];c[f]={from:g.from(),to:g.to(),text:this.splitLines(a[f]),origin:d}}if(a=b&&"end"!=b){a=[];e=d=t(this.first,0);for(f=0;f<c.length;f++){var h=c[f];g=vf(h.from,d,e);var k=vf(Ra(h),d,e);d=h.to;e=k;"around"==b?(h=this.sel.ranges[f],h=0>B(h.head,h.anchor),a[f]=new I(h?k:g,h?g:k)):a[f]=new I(g,g)}a=new ua(a,this.sel.primIndex)}b=a;for(a=c.length-1;0<=a;a--)Ab(this,c[a]);b?Ef(this,b):this.cm&&vb(this.cm)})),undo:ca((function(){Vc(this,"undo")})),redo:ca((function(){Vc(this,"redo")})),undoSelection:ca((function(){Vc(this,"undo",!0)})),redoSelection:ca((function(){Vc(this,"redo",!0)})),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,d=0,c=0;c<a.done.length;c++)a.done[c].ranges||++b;for(c=0;c<a.undone.length;c++)a.undone[c].ranges||++d;return{undo:b,redo:d}},clearHistory:function(){var a=this;this.history=new Qc(this.history);Sa(this,(function(b){return b.history=a.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(a){a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:yb(this.history.done),undone:yb(this.history.undone)}},setHistory:function(a){var b=this.history=new Qc(this.history);b.done=yb(a.done.slice(0),null,!0);b.undone=yb(a.undone.slice(0),null,!0)},setGutterMarker:ca((function(a,b,d){return bc(this,a,"gutter",(function(c){var e=c.gutterMarkers||(c.gutterMarkers={});e[b]=d;!d&&pe(e)&&(c.gutterMarkers=null);return!0}))})),clearGutter:ca((function(a){var b=this;this.iter((function(d){d.gutterMarkers&&d.gutterMarkers[a]&&bc(b,d,"gutter",(function(){d.gutterMarkers[a]=null;pe(d.gutterMarkers)&&(d.gutterMarkers=null);return!0}))}))})),lineInfo:function(a){if("number"==typeof a){if(!Lb(this,a))return null;var b=a;a=w(this,a);if(!a)return null}else if(b=N(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:ca((function(a,b,d){return bc(this,a,"gutter"==b?"gutter":"class",(function(c){var e="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(c[e]){if(y(d).test(c[e]))return!1;c[e]+=" "+d}else c[e]=d;return!0}))})),removeLineClass:ca((function(a,b,d){return bc(this,a,"gutter"==b?"gutter":"class",(function(c){var e="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",f=c[e];if(f)if(null==d)c[e]=null;else{var g=f.match(y(d));if(!g)return!1;var h=g.index+g[0].length;c[e]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||null}else return!1;return!0}))})),addLineWidget:ca((function(a,b,d){return ah(this,a,b,d)})),removeLineWidget:function(a){a.clear()},markText:function(a,b,d){return Cb(this,C(this,a),C(this,b),d,d&&d.type||"range")},setBookmark:function(a,b){b={replacedWith:b&&(null==b.nodeType?b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};a=C(this,a);return Cb(this,a,a,b,"bookmark")},findMarksAt:function(a){a=C(this,a);var b=[],d=w(this,a.line).markedSpans;if(d)for(var c=0;c<d.length;++c){var e=d[c];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,d){a=C(this,a);b=C(this,b);var c=[],e=a.line;this.iter(a.line,b.line+1,(function(f){if(f=f.markedSpans)for(var g=0;g<f.length;g++){var h=f[g];null!=h.to&&e==a.line&&a.ch>=h.to||null==h.from&&e!=a.line||null!=h.from&&e==b.line&&h.from>=b.ch||d&&!d(h.marker)||c.push(h.marker.parent||h.marker)}++e}));return c},getAllMarks:function(){var a=[];this.iter((function(b){if(b=b.markedSpans)for(var d=0;d<b.length;++d)null!=b[d].from&&a.push(b[d].marker)}));return a},posFromIndex:function(a){var b,d=this.first,c=this.lineSeparator().length;this.iter((function(e){e=e.text.length+c;if(e>a)return b=a,!0;a-=e;++d}));return C(this,t(d,b))},indexFromPos:function(a){a=C(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var d=this.lineSeparator().length;this.iter(this.first,a.line,(function(c){b+=c.text.length+d}));return b},copy:function(a){var b=new oa(od(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||(a={});var b=this.first,d=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<d&&(d=a.to);b=new oa(od(this,b,d),a.mode||this.modeOption,b,this.lineSep,this.direction);a.sharedHist&&(b.history=this.history);(this.linked||(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}];a=Sf(this);for(d=0;d<a.length;d++){var c=a[d],e=c.find(),f=b.clipPos(e.from);e=b.clipPos(e.to);B(f,e)&&(f=Cb(b,f,e,c.primary,c.primary.type),c.markers.push(f),f.parent=c)}return b},unlinkDoc:function(a){a instanceof U&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);ch(Sf(this));break}if(a.history==this.history){var d=[a.id];Sa(a,(function(c){return d.push(c.id)}),!0);a.history=new Qc(null);a.history.done=yb(this.history.done,d);a.history.undone=yb(this.history.undone,d)}},iterLinkedDocs:function(a){Sa(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(a){return this.lineSep?a.split(this.lineSep):le(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ca((function(a){"rtl"!=a&&(a="ltr");a!=this.direction&&(this.direction=a,this.iter((function(b){return b.order=null})),this.cm&&Yg(this.cm))}))});oa.prototype.eachLine=oa.prototype.iter;for(var Uf=0,lg=!1,Ua={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},qc=0;10>qc;qc++)Ua[qc+48]=Ua[qc+96]=String(qc);for(var dd=65;90>=dd;dd++)Ua[dd]=String.fromCharCode(dd);for(var rc=1;12>=rc;rc++)Ua[rc+111]=Ua[rc+63235]="F"+rc;var gc={basic:{Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},pcDefault:{"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},emacsy:{"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},macDefault:{"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]}};gc["default"]=xa?gc.macDefault:gc.pcDefault;var hc={selectAll:Jf,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),Ha)},killLine:function(a){return Eb(a,(function(b){if(b.empty()){var d=w(a.doc,b.head.line).text.length;return b.head.ch==d&&b.head.line<a.lastLine()?{from:b.head,to:t(b.head.line+1,0)}:{from:b.head,to:t(b.head.line,d)}}return{from:b.from(),to:b.to()}}))},deleteLine:function(a){return Eb(a,(function(b){return{from:t(b.from().line,0),to:C(a.doc,t(b.to().line+1,0))}}))},delLineLeft:function(a){return Eb(a,(function(b){return{from:t(b.from().line,0),to:b.from()}}))},delWrappedLineLeft:function(a){return Eb(a,(function(b){var d=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:d},"div"),to:b.from()}}))},delWrappedLineRight:function(a){return Eb(a,(function(b){var d=a.charCoords(b.head,"div").top+5;d=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:d},"div");return{from:b.from(),to:d}}))},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(t(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(t(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy((function(b){return $f(a,b.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy((function(b){return ag(a,b.head)}),{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy((function(b){b=b.head.line;var d=w(a.doc,b);var c=d;for(var e;e=qb(c,!1);)c=e.find(1,!0).line;c!=d&&(b=N(c));return ee(!0,a,d,b,-1)}),{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy((function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:b},"div")}),oc)},goLineLeft:function(a){return a.extendSelectionsBy((function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")}),oc)},goLineLeftSmart:function(a){return a.extendSelectionsBy((function(b){var d=a.cursorCoords(b.head,"div").top+5;d=a.coordsChar({left:0,top:d},"div");return d.ch<a.getLine(d.line).search(/\S/)?ag(a,b.head):d}),oc)},goLineUp:function(a){return a.moveV(-1,"line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,"group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,"codepoint")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},insertSoftTab:function(a){for(var b=[],d=a.listSelections(),c=a.options.tabSize,e=0;e<d.length;e++){var f=d[e].from();f=va(a.getLine(f.line),f.ch,c);b.push(hd(c-f%c))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return qa(a,(function(){for(var b=a.listSelections(),d=[],c=0;c<b.length;c++)if(b[c].empty()){var e=b[c].head,f=w(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new t(e.line,e.ch-1)),0<e.ch)e=new t(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),t(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=w(a.doc,e.line-1).text;g&&(e=new t(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),t(e.line-1,g.length-1),e,"+transpose"))}d.push(new I(e,e))}a.setSelections(d)}))},newlineAndIndent:function(a){return qa(a,(function(){for(var b=a.listSelections(),d=b.length-1;0<=d;d--)a.replaceRange(a.doc.lineSeparator(),b[d].anchor,b[d].head,"+input");b=a.listSelections();for(d=0;d<b.length;d++)a.indentLine(b[d].from().line,null,!0);vb(a)}))},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},jh=new Va,fe=null,ge=function(a,b,d){this.time=a;this.pos=b;this.button=d};ge.prototype.compare=function(a,b,d){return this.time+400>a&&0==B(b,this.pos)&&d==this.button};var kc,jc,Fb={toString:function(){return"CodeMirror.Init"}},kg={},ad={};U.defaults=kg;U.optionHandlers=ad;var je=[];U.defineInitHook=function(a){return je.push(a)};var ra=null,O=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new Va;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};O.prototype.init=function(a){function b(h){for(h=h.target;h;h=h.parentNode){if(h==g)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(h.className))break}return!1}function d(h){if(b(h)&&!Z(f,h)){if(f.somethingSelected())ra={lineWise:!1,text:f.getSelections()},"cut"==h.type&&f.replaceSelection("",null,"cut");else if(f.options.lineWiseCopyCut){var k=og(f);ra={lineWise:!0,text:k.text};"cut"==h.type&&f.operation((function(){f.setSelections(k.ranges,0,Ha);f.replaceSelection("",null,"cut")}))}else return;if(h.clipboardData){h.clipboardData.clearData();var l=ra.text.join("\n");h.clipboardData.setData("Text",l);if(h.clipboardData.getData("Text")==l){h.preventDefault();return}}var m=qg();h=m.firstChild;f.display.lineSpace.insertBefore(m,f.display.lineSpace.firstChild);h.value=ra.text.join("\n");var n=ka();nc(h);setTimeout((function(){f.display.lineSpace.removeChild(m);n.focus();n==g&&e.showPrimarySelection()}),50)}}var c=this,e=this,f=e.cm,g=e.div=a.lineDiv;g.contentEditable=!0;pg(g,f.options.spellcheck,f.options.autocorrect,f.options.autocapitalize);z(g,"paste",(function(h){!b(h)||Z(f,h)||ng(h,f)||11>=T&&setTimeout(ba(f,(function(){return c.updateFromDOM()})),20)}));z(g,"compositionstart",(function(h){c.composing={data:h.data,done:!1}}));z(g,"compositionupdate",(function(h){c.composing||(c.composing={data:h.data,done:!1})}));z(g,"compositionend",(function(h){c.composing&&(h.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)}));z(g,"touchstart",(function(){return e.forceCompositionEnd()}));z(g,"input",(function(){c.composing||c.readFromDOMSoon()}));z(g,"copy",d);z(g,"cut",d)};O.prototype.screenReaderLabelChanged=function(a){a?this.div.setAttribute("aria-label",a):this.div.removeAttribute("aria-label")};O.prototype.prepareSelection=function(){var a=ef(this.cm,!1);a.focus=ka()==this.div;return a};O.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};O.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()};O.prototype.showPrimarySelection=function(){var a=this.getSelection(),b=this.cm,d=b.doc.sel.primary(),c=d.from();d=d.to();if(b.display.viewTo==b.display.viewFrom||c.line>=b.display.viewTo||d.line<b.display.viewFrom)a.removeAllRanges();else{var e=bd(b,a.anchorNode,a.anchorOffset),f=bd(b,a.focusNode,a.focusOffset);if(!e||e.bad||!f||f.bad||0!=B(zc(e,f),c)||0!=B(yc(e,f),d))if(e=b.display.view,c=c.line>=b.display.viewFrom&&sg(b,c)||{node:e[0].measure.map[2],offset:0},d=d.line<b.display.viewTo&&sg(b,d),d||(d=e[e.length-1].measure,d=d.maps?d.maps[d.maps.length-1]:d.map,d={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}),c&&d){e=a.rangeCount&&a.getRangeAt(0);try{var g=Ob(c.node,c.offset,d.offset,d.node)}catch(h){}g&&(!La&&b.state.focused?(a.collapse(c.node,c.offset),g.collapsed||(a.removeAllRanges(),a.addRange(g))):(a.removeAllRanges(),a.addRange(g)),e&&null==a.anchorNode?a.addRange(e):La&&this.startGracePeriod());this.rememberSelection()}else a.removeAllRanges()}};O.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout((function(){a.gracePeriod=!1;a.selectionChanged()&&a.cm.operation((function(){return a.cm.curOp.selectionChanged=!0}))}),20)};O.prototype.showMultipleSelections=function(a){D(this.cm.display.cursorDiv,a.cursors);D(this.cm.display.selectionDiv,a.selection)};O.prototype.rememberSelection=function(){var a=this.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};O.prototype.selectionInEditor=function(){var a=this.getSelection();if(!a.rangeCount)return!1;a=a.getRangeAt(0).commonAncestorContainer;return ja(this.div,a)};O.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&ka()==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())};O.prototype.blur=function(){this.div.blur()};O.prototype.getField=function(){return this.div};O.prototype.supportsTouch=function(){return!0};O.prototype.receivedFocus=function(){function a(){d.cm.state.focused&&(d.pollSelection(),d.polling.set(d.cm.options.pollInterval,a))}var b=this,d=this;this.selectionInEditor()?setTimeout((function(){return b.pollSelection()}),20):qa(this.cm,(function(){return d.cm.curOp.selectionChanged=!0}));this.polling.set(this.cm.options.pollInterval,a)};O.prototype.selectionChanged=function(){var a=this.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};O.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=this.getSelection(),b=this.cm;if(Fc&&Ec&&this.cm.display.gutterSpecs.length&&yh(a.anchorNode))this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();else if(!this.composing){this.rememberSelection();var d=bd(b,a.anchorNode,a.anchorOffset),c=bd(b,a.focusNode,a.focusOffset);d&&c&&qa(b,(function(){da(b.doc,Na(d,c),Ha);if(d.bad||c.bad)b.curOp.selectionChanged=!0}))}}};O.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var a=this.cm,b=a.display,d=a.doc.sel.primary(),c=d.from(),e=d.to();0==c.ch&&c.line>a.firstLine()&&(c=t(c.line-1,w(a.doc,c.line-1).length));e.ch==w(a.doc,e.line).text.length&&e.line<a.lastLine()&&(e=t(e.line+1,0));if(c.line<b.viewFrom||e.line>b.viewTo-1)return!1;var f;c.line==b.viewFrom||0==(f=bb(a,c.line))?(d=N(b.view[0].line),f=b.view[0].node):(d=N(b.view[f].line),f=b.view[f-1].node.nextSibling);var g=bb(a,e.line);g==b.view.length-1?(e=b.viewTo-1,b=b.lineDiv.lastChild):(e=N(b.view[g+1].line)-1,b=b.view[g+1].node.previousSibling);if(!f)return!1;b=a.doc.splitLines(zh(a,f,b,d,e));for(f=Za(a.doc,t(d,0),t(e,w(a.doc,e).text.length));1<b.length&&1<f.length;)if(J(b)==J(f))b.pop(),f.pop(),e--;else if(b[0]==f[0])b.shift(),f.shift(),d++;else break;var h=0;g=0;for(var k=b[0],l=f[0],m=Math.min(k.length,l.length);h<m&&k.charCodeAt(h)==l.charCodeAt(h);)++h;k=J(b);l=J(f);for(m=Math.min(k.length-(1==b.length?h:0),l.length-(1==f.length?h:0));g<m&&k.charCodeAt(k.length-g-1)==l.charCodeAt(l.length-g-1);)++g;if(1==b.length&&1==f.length&&d==c.line)for(;h&&h>c.ch&&k.charCodeAt(k.length-g-1)==l.charCodeAt(l.length-g-1);)h--,g++;b[b.length-1]=k.slice(0,k.length-g).replace(/^\u200b+/,"");b[0]=b[0].slice(h).replace(/\u200b+$/,"");c=t(d,h);d=t(e,f.length?J(f).length-g:0);if(1<b.length||b[0]||B(c,d))return Bb(a.doc,b,c,d,"+input"),!0};O.prototype.ensurePolled=function(){this.forceCompositionEnd()};O.prototype.reset=function(){this.forceCompositionEnd()};O.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())};O.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){a.readDOMTimeout=null;if(a.composing)if(a.composing.done)a.composing=null;else return;a.updateFromDOM()}),80))};O.prototype.updateFromDOM=function(){var a=this;!this.cm.isReadOnly()&&this.pollContent()||qa(this.cm,(function(){return ma(a.cm)}))};O.prototype.setUneditable=function(a){a.contentEditable="false"};O.prototype.onKeyPress=function(a){0==a.charCode||this.composing||(a.preventDefault(),this.cm.isReadOnly()||ba(this.cm,ke)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))};O.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};O.prototype.onContextMenu=function(){};O.prototype.resetPosition=function(){};O.prototype.needsContentAttribute=!0;var V=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=new Va;this.hasSelection=!1;this.composing=null};V.prototype.init=function(a){function b(g){if(!Z(e,g)){if(e.somethingSelected())ra={lineWise:!1,text:e.getSelections()};else if(e.options.lineWiseCopyCut){var h=og(e);ra={lineWise:!0,text:h.text};"cut"==g.type?e.setSelections(h.ranges,null,Ha):(c.prevInput="",f.value=h.text.join("\n"),nc(f))}else return;"cut"==g.type&&(e.state.cutIncoming=+new Date)}}var d=this,c=this,e=this.cm;this.createField(a);var f=this.textarea;a.wrapper.insertBefore(this.wrapper,a.wrapper.firstChild);mc&&(f.style.width="0px");z(f,"input",(function(){G&&9<=T&&d.hasSelection&&(d.hasSelection=null);c.poll()}));z(f,"paste",(function(g){Z(e,g)||ng(g,e)||(e.state.pasteIncoming=+new Date,c.fastPoll())}));z(f,"cut",b);z(f,"copy",b);z(a.scroller,"paste",(function(g){if(!Ka(a,g)&&!Z(e,g))if(f.dispatchEvent){var h=new Event("paste");h.clipboardData=g.clipboardData;f.dispatchEvent(h)}else e.state.pasteIncoming=+new Date,c.focus()}));z(a.lineSpace,"selectstart",(function(g){Ka(a,g)||la(g)}));z(f,"compositionstart",(function(){var g=e.getCursor("from");c.composing&&c.composing.range.clear();c.composing={start:g,range:e.markText(g,e.getCursor("to"),{className:"CodeMirror-composing"})}}));z(f,"compositionend",(function(){c.composing&&(c.poll(),c.composing.range.clear(),c.composing=null)}))};V.prototype.createField=function(a){this.wrapper=qg();this.textarea=this.wrapper.firstChild};V.prototype.screenReaderLabelChanged=function(a){a?this.textarea.setAttribute("aria-label",a):this.textarea.removeAttribute("aria-label")};V.prototype.prepareSelection=function(){var a=this.cm,b=a.display,d=a.doc,c=ef(a);if(a.options.moveInputWithCursor){a=za(a,d.sel.primary().head,"div");d=b.wrapper.getBoundingClientRect();var e=b.lineDiv.getBoundingClientRect();c.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-d.top));c.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+e.left-d.left))}return c};V.prototype.showSelection=function(a){var b=this.cm.display;D(b.cursorDiv,a.cursors);D(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};V.prototype.reset=function(a){if(!this.contextMenuPending&&!this.composing){var b=this.cm;b.somethingSelected()?(this.prevInput="",a=b.getSelection(),this.textarea.value=a,b.state.focused&&nc(this.textarea),G&&9<=T&&(this.hasSelection=a)):a||(this.prevInput=this.textarea.value="",G&&9<=T&&(this.hasSelection=null))}};V.prototype.getField=function(){return this.textarea};V.prototype.supportsTouch=function(){return!1};V.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Zb||ka()!=this.textarea))try{this.textarea.focus()}catch(a){}};V.prototype.blur=function(){this.textarea.blur()};V.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};V.prototype.receivedFocus=function(){this.slowPoll()};V.prototype.slowPoll=function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){a.poll();a.cm.state.focused&&a.slowPoll()}))};V.prototype.fastPoll=function(){function a(){d.poll()||b?(d.pollingFast=!1,d.slowPoll()):(b=!0,d.polling.set(60,a))}var b=!1,d=this;d.pollingFast=!0;d.polling.set(20,a)};V.prototype.poll=function(){var a=this,b=this.cm,d=this.textarea,c=this.prevInput;if(this.contextMenuPending||!b.state.focused||Eh(d)&&!c&&!this.composing||b.isReadOnly()||b.options.disableInput||b.state.keySeq)return!1;var e=d.value;if(e==c&&!b.somethingSelected())return!1;if(G&&9<=T&&this.hasSelection===e||xa&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);8203!=f||c||(c="");if(8666==f)return this.reset(),this.cm.execCommand("undo")}var g=0;for(f=Math.min(c.length,e.length);g<f&&c.charCodeAt(g)==e.charCodeAt(g);)++g;qa(b,(function(){ke(b,e.slice(g),c.length-g,null,a.composing?"*compose":null);1e3<e.length||-1<e.indexOf("\n")?d.value=a.prevInput="":a.prevInput=e;a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))}));return!0};V.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};V.prototype.onKeyPress=function(){G&&9<=T&&(this.hasSelection=null);this.fastPoll()};V.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var q=e.somethingSelected(),r=""+(q?g.value:"");g.value="⇚";g.value=r;c.prevInput=q?"":"";g.selectionStart=1;g.selectionEnd=r.length;f.selForContextMenu=e.doc.sel}}function d(){if(c.contextMenuPending==d&&(c.contextMenuPending=!1,c.wrapper.style.cssText=m,g.style.cssText=l,G&&9>T&&f.scrollbars.setScrollTop(f.scroller.scrollTop=k),null!=g.selectionStart)){(!G||G&&9>T)&&b();var q=0,r=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0<g.selectionEnd&&""==c.prevInput?ba(e,Jf)(e):10>q++?f.detectingSelectAll=setTimeout(r,500):(f.selForContextMenu=null,f.input.reset())};f.detectingSelectAll=setTimeout(r,200)}}var c=this,e=c.cm,f=e.display,g=c.textarea;c.contextMenuPending&&c.contextMenuPending();var h=eb(e,a),k=f.scroller.scrollTop;if(h&&!Aa){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&ba(e,da)(e.doc,Na(h),Ha);var l=g.style.cssText,m=c.wrapper.style.cssText;h=c.wrapper.offsetParent.getBoundingClientRect();c.wrapper.style.cssText="position: static";g.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(a.clientY-h.top-5)+"px; left: "+(a.clientX-h.left-5)+"px;\n z-index: 1000; background: "+(G?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(fa)var n=window.scrollY;f.input.focus();fa&&window.scrollTo(null,n);f.input.reset();e.somethingSelected()||(g.value=c.prevInput=" ");c.contextMenuPending=d;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);G&&9<=T&&b();if(he){Kb(a);var p=function(){sa(window,"mouseup",p);setTimeout(d,20)};z(window,"mouseup",p)}else setTimeout(d,50)}};V.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled="nocursor"==a;this.textarea.readOnly=!!a};V.prototype.setUneditable=function(){};V.prototype.needsContentAttribute=!1;(function(a){function b(c,e,f,g){a.defaults[c]=e;f&&(d[c]=g?function(h,k,l){l!=Fb&&f(h,k,l)}:f)}var d=a.optionHandlers;a.defineOption=b;a.Init=Fb;b("value","",(function(c,e){return c.setValue(e)}),!0);b("mode",null,(function(c,e){c.doc.modeOption=e;Yd(c)}),!0);b("indentUnit",2,Yd,!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,(function(c){$b(c);Sb(c);ma(c)}),!0);b("lineSeparator",null,(function(c,e){if(c.doc.lineSep=e){var f=[],g=c.doc.first;c.doc.iter((function(k){for(var l=0;;){var m=k.text.indexOf(e,l);if(-1==m)break;l=m+e.length;f.push(t(g,m))}g++}));for(var h=f.length-1;0<=h;h--)Bb(c.doc,e,f[h],t(f[h].line,f[h].ch+e.length))}}));b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(c,e,f){c.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g");f!=Fb&&c.refresh()}));b("specialCharPlaceholder",Kg,(function(c){return c.refresh()}),!0);b("electricChars",!0);b("inputStyle",Zb?"contenteditable":"textarea",(function(){throw Error("inputStyle can not (yet) be changed in a running editor")}),!0);b("spellcheck",!1,(function(c,e){return c.getInputField().spellcheck=e}),!0);b("autocorrect",!1,(function(c,e){return c.getInputField().autocorrect=e}),!0);b("autocapitalize",!1,(function(c,e){return c.getInputField().autocapitalize=e}),!0);b("rtlMoveVisually",!Dh);b("wholeLineUpdateBefore",!0);b("theme","default",(function(c){jg(c);Yb(c)}),!0);b("keyMap","default",(function(c,e,f){e=Wc(e);(f=f!=Fb&&Wc(f))&&f.detach&&f.detach(c,e);e.attach&&e.attach(c,f||null)}));b("extraKeys",null);b("configureMouse",null);b("lineWrapping",!1,wh,!0);b("gutters",[],(function(c,e){c.display.gutterSpecs=Wd(e,c.options.lineNumbers);Yb(c)}),!0);b("fixedGutter",!0,(function(c,e){c.display.gutters.style.left=e?Ld(c.display)+"px":"0";c.refresh()}),!0);b("coverGutterNextToScrollbar",!1,(function(c){return wb(c)}),!0);b("scrollbarStyle","native",(function(c){nf(c);wb(c);c.display.scrollbars.setScrollTop(c.doc.scrollTop);c.display.scrollbars.setScrollLeft(c.doc.scrollLeft)}),!0);b("lineNumbers",!1,(function(c,e){c.display.gutterSpecs=Wd(c.options.gutters,e);Yb(c)}),!0);b("firstLineNumber",1,Yb,!0);b("lineNumberFormatter",(function(c){return c}),Yb,!0);b("showCursorWhenSelecting",!1,Tb,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection",!0);b("selectionsMayTouch",!1);b("readOnly",!1,(function(c,e){"nocursor"==e&&(ub(c),c.display.input.blur());c.display.input.readOnlyChanged(e)}));b("screenReaderLabel",null,(function(c,e){c.display.input.screenReaderLabelChanged(""===e?null:e)}));b("disableInput",!1,(function(c,e){e||c.display.input.reset()}),!0);b("dragDrop",!0,vh);b("allowDropFileTypes",null);b("cursorBlinkRate",530);b("cursorScrollMargin",0);b("cursorHeight",1,Tb,!0);b("singleCursorHeightPerLine",!0,Tb,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,$b,!0);b("addModeClass",!1,$b,!0);b("pollInterval",100);b("undoDepth",200,(function(c,e){return c.doc.history.undoDepth=e}));b("historyEventDelay",1250);b("viewportMargin",10,(function(c){return c.refresh()}),!0);b("maxHighlightLength",1e4,$b,!0);b("moveInputWithCursor",!0,(function(c,e){e||c.display.input.resetPosition()}));b("tabindex",null,(function(c,e){return c.display.input.getField().tabIndex=e||""}));b("autofocus",null);b("direction","ltr",(function(c,e){return c.doc.setDirection(e)}),!0);b("phrases",null)})(U);(function(a){var b=a.optionHandlers,d=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(c,e){var f=this.options,g=f[c];if(f[c]!=e||"mode"==c)f[c]=e,b.hasOwnProperty(c)&&ba(this,b[c])(this,e,g),W(this,"optionChange",this,c)},getOption:function(c){return this.options[c]},getDoc:function(){return this.doc},addKeyMap:function(c,e){this.state.keyMaps[e?"push":"unshift"](Wc(c))},removeKeyMap:function(c){for(var e=this.state.keyMaps,f=0;f<e.length;++f)if(e[f]==c||e[f].name==c)return e.splice(f,1),!0},addOverlay:ia((function(c,e){var f=c.token?c:a.getMode(this.options,c);if(f.startState)throw Error("Overlays may not be stateful.");wg(this.state.overlays,{mode:f,modeSpec:c,opaque:e&&e.opaque,priority:e&&e.priority||0},(function(g){return g.priority}));this.state.modeGen++;ma(this)})),removeOverlay:ia((function(c){for(var e=this.state.overlays,f=0;f<e.length;++f){var g=e[f].modeSpec;if(g==c||"string"==typeof c&&g.name==c){e.splice(f,1);this.state.modeGen++;ma(this);break}}})),indentLine:ia((function(c,e,f){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract");Lb(this.doc,c)&&lc(this,c,e,f)})),indentSelection:ia((function(c){for(var e=this.doc.sel.ranges,f=-1,g=0;g<e.length;g++){var h=e[g];if(h.empty())h.head.line>f&&(lc(this,h.head.line,c,!0),f=h.head.line,g==this.doc.sel.primIndex&&vb(this));else{var k=h.from();h=h.to();var l=Math.max(f,k.line);f=Math.min(this.lastLine(),h.line-(h.ch?0:1))+1;for(h=l;h<f;++h)lc(this,h,c);h=this.doc.sel.ranges;0==k.ch&&e.length==h.length&&0<h[g].from().ch&&be(this.doc,g,new I(k,h[g].to()),Ha)}}})),getTokenAt:function(c,e){return Ae(this,c,e)},getLineTokens:function(c,e){return Ae(this,t(c),e,!0)},getTokenTypeAt:function(c){c=C(this.doc,c);var e=ye(this,w(this.doc,c.line)),f=0,g=(e.length-1)/2;c=c.ch;if(0==c)e=e[2];else for(;;){var h=f+g>>1;if((h?e[2*h-1]:0)>=c)g=h;else if(e[2*h+1]<c)f=h+1;else{e=e[2*h+2];break}}f=e?e.indexOf("overlay "):-1;return 0>f?e:0==f?null:e.slice(0,f-1)},getModeAt:function(c){var e=this.doc.mode;return e.innerMode?a.innerMode(e,this.getTokenAt(c).state).mode:e},getHelper:function(c,e){return this.getHelpers(c,e)[0]},getHelpers:function(c,e){var f=[];if(!d.hasOwnProperty(e))return f;var g=d[e];c=this.getModeAt(c);if("string"==typeof c[e])g[c[e]]&&f.push(g[c[e]]);else if(c[e])for(var h=0;h<c[e].length;h++){var k=g[c[e][h]];k&&f.push(k)}else c.helperType&&g[c.helperType]?f.push(g[c.helperType]):g[c.name]&&f.push(g[c.name]);for(e=0;e<g._global.length;e++)h=g._global[e],h.pred(c,this)&&-1==ea(f,h.val)&&f.push(h.val);return f},getStateAfter:function(c,e){var f=this.doc;c=Math.max(f.first,Math.min(null==c?f.first+f.size-1:c,f.first+f.size-1));return Mb(this,c+1,e).state},cursorCoords:function(c,e){var f=this.doc.sel.primary();c=null==c?f.head:"object"==typeof c?C(this.doc,c):c?f.from():f.to();return za(this,c,e||"page")},charCoords:function(c,e){return Hc(this,C(this.doc,c),e||"page")},coordsChar:function(c,e){c=Ze(this,c,e||"page");return Jd(this,c.left,c.top)},lineAtHeight:function(c,e){c=Ze(this,{top:c,left:0},e||"page").top;return $a(this.doc,c+this.display.viewOffset)},heightAtLine:function(c,e,f){var g=!1;if("number"==typeof c){var h=this.doc.first+this.doc.size-1;c<this.doc.first?c=this.doc.first:c>h&&(c=h,g=!0);c=w(this.doc,c)}return Gc(this,c,{top:0,left:0},e||"page",f||g).top+(g?this.doc.height-Fa(c):0)},defaultTextHeight:function(){return tb(this.display)},defaultCharWidth:function(){return sb(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(c,e,f,g,h){var k=this.display;c=za(this,C(this.doc,c));var l=c.bottom,m=c.left;e.style.position="absolute";e.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(e);k.sizer.appendChild(e);if("over"==g)l=c.top;else if("above"==g||"near"==g){var n=Math.max(k.wrapper.clientHeight,this.doc.height),p=Math.max(k.sizer.clientWidth,k.lineSpace.clientWidth);("above"==g||c.bottom+e.offsetHeight>n)&&c.top>e.offsetHeight?l=c.top-e.offsetHeight:c.bottom+e.offsetHeight<=n&&(l=c.bottom);m+e.offsetWidth>p&&(m=p-e.offsetWidth)}e.style.top=l+"px";e.style.left=e.style.right="";"right"==h?(m=k.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==h?m=0:"middle"==h&&(m=(k.sizer.clientWidth-e.offsetWidth)/2),e.style.left=m+"px");f&&(c=Rd(this,{left:m,top:l,right:m+e.offsetWidth,bottom:l+e.offsetHeight}),null!=c.scrollTop&&Vb(this,c.scrollTop),null!=c.scrollLeft&&ib(this,c.scrollLeft))},triggerOnKeyDown:ia(dg),triggerOnKeyPress:ia(fg),triggerOnKeyUp:eg,triggerOnMouseDown:ia(gg),execCommand:function(c){if(hc.hasOwnProperty(c))return hc[c].call(null,this)},triggerElectric:ia((function(c){mg(this,c)})),findPosH:function(c,e,f,g){var h=1;0>e&&(h=-1,e=-e);c=C(this.doc,c);for(var k=0;k<e&&(c=me(this.doc,c,h,f,g),!c.hitSide);++k);return c},moveH:ia((function(c,e){var f=this;this.extendSelectionsBy((function(g){return f.display.shift||f.doc.extend||g.empty()?me(f.doc,g.head,c,e,f.options.rtlMoveVisually):0>c?g.from():g.to()}),oc)})),deleteH:ia((function(c,e){var f=this.doc;this.doc.sel.somethingSelected()?f.replaceSelection("",null,"+delete"):Eb(this,(function(g){var h=me(f,g.head,c,e,!1);return 0>c?{from:h,to:g.head}:{from:g.head,to:h}}))})),findPosV:function(c,e,f,g){var h=1;0>e&&(h=-1,e=-e);var k=C(this.doc,c);for(c=0;c<e&&(k=za(this,k,"div"),null==g?g=k.left:k.left=g,k=rg(this,k,h,f),!k.hitSide);++c);return k},moveV:ia((function(c,e){var f=this,g=this.doc,h=[],k=!this.display.shift&&!g.extend&&g.sel.somethingSelected();g.extendSelectionsBy((function(m){if(k)return 0>c?m.from():m.to();var n=za(f,m.head,"div");null!=m.goalColumn&&(n.left=m.goalColumn);h.push(n.left);var p=rg(f,n,c,e);"page"==e&&m==g.sel.primary()&&Mc(f,Hc(f,p,"div").top-n.top);return p}),oc);if(h.length)for(var l=0;l<g.sel.ranges.length;l++)g.sel.ranges[l].goalColumn=h[l]})),findWordAt:function(c){var e=w(this.doc,c.line).text,f=c.ch,g=c.ch;if(e){var h=this.getHelper(c,"wordChars");"before"!=c.sticky&&g!=e.length||!f?++g:--f;var k=e.charAt(f);for(k=vc(k,h)?function(l){return vc(l,h)}:/\s/.test(k)?function(l){return/\s/.test(l)}:function(l){return!/\s/.test(l)&&!vc(l)};0<f&&k(e.charAt(f-1));)--f;for(;g<e.length&&k(e.charAt(g));)++g}return new I(t(c.line,f),t(c.line,g))},toggleOverwrite:function(c){if(null==c||c!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?Wa(this.display.cursorDiv,"CodeMirror-overwrite"):hb(this.display.cursorDiv,"CodeMirror-overwrite"),W(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==ka()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ia((function(c,e){Ub(this,c,e)})),getScrollInfo:function(){var c=this.display.scroller;return{left:c.scrollLeft,top:c.scrollTop,height:c.scrollHeight-Ga(this)-this.display.barHeight,width:c.scrollWidth-Ga(this)-this.display.barWidth,clientHeight:Dd(this),clientWidth:ab(this)}},scrollIntoView:ia((function(c,e){null==c?(c={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof c?c={from:t(c,0),to:null}:null==c.from&&(c={from:c,to:null});c.to||(c.to=c.from);c.margin=e||0;null!=c.from.line?(Nc(this),this.curOp.scrollToPos=c):jf(this,c.from,c.to,c.margin)})),setSize:ia((function(c,e){var f=this,g=function(k){return"number"==typeof k||/^\d+$/.test(String(k))?k+"px":k};null!=c&&(this.display.wrapper.style.width=g(c));null!=e&&(this.display.wrapper.style.height=g(e));this.options.lineWrapping&&We(this);var h=this.display.viewFrom;this.doc.iter(h,this.display.viewTo,(function(k){if(k.widgets)for(var l=0;l<k.widgets.length;l++)if(k.widgets[l].noHScroll){Qa(f,h,"widget");break}++h}));this.curOp.forceUpdate=!0;W(this,"refresh",this)})),operation:function(c){return qa(this,c)},startOperation:function(){return jb(this)},endOperation:function(){return kb(this)},refresh:ia((function(){var c=this.display.cachedTextHeight;ma(this);this.curOp.forceUpdate=!0;Sb(this);Ub(this,this.doc.scrollLeft,this.doc.scrollTop);Vd(this.display);(null==c||.5<Math.abs(c-tb(this.display))||this.options.lineWrapping)&&Md(this);W(this,"refresh",this)})),swapDoc:ia((function(c){var e=this.doc;e.cm=null;this.state.selectingText&&this.state.selectingText();xf(this,c);Sb(this);this.display.input.reset();Ub(this,c.scrollLeft,c.scrollTop);this.curOp.forceScroll=!0;aa(this,"swapDoc",this,e);return e})),phrase:function(c){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,c)?e[c]:c},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};nb(a);a.registerHelper=function(c,e,f){d.hasOwnProperty(c)||(d[c]=a[c]={_global:[]});d[c][e]=f};a.registerGlobalHelper=function(c,e,f,g){a.registerHelper(c,e,g);d[c]._global.push({pred:f,val:g})}})(U);var Gh="iter insert remove copy getEditor constructor".split(" "),sc;for(sc in oa.prototype)oa.prototype.hasOwnProperty(sc)&&0>ea(Gh,sc)&&(U.prototype[sc]=function(a){return function(){return a.apply(this.doc,arguments)}}(oa.prototype[sc]));nb(oa);U.inputStyles={textarea:V,contenteditable:O};U.defineMode=function(a){U.defaults.mode||"null"==a||(U.defaults.mode=a);Bg.apply(this,arguments)};U.defineMIME=function(a,b){ob[a]=b};U.defineMode("null",(function(){return{token:function(a){return a.skipToEnd()}}}));U.defineMIME("text/plain","null");U.defineExtension=function(a,b){U.prototype[a]=b};U.defineDocExtension=function(a,b){oa.prototype[a]=b};U.fromTextArea=function(a,b){function d(){a.value=h.getValue()}b=b?Xa(b):{};b.value=a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var c=ka();b.autofocus=c==a||null!=a.getAttribute("autofocus")&&c==document.body}if(a.form&&(z(a.form,"submit",d),!b.leaveSubmitMethodAlone)){var e=a.form;var f=e.submit;try{var g=e.submit=function(){d();e.submit=f;e.submit();e.submit=g}}catch(k){}}b.finishInit=function(k){k.save=d;k.getTextArea=function(){return a};k.toTextArea=function(){k.toTextArea=isNaN;d();a.parentNode.removeChild(k.getWrapperElement());a.style.display="";a.form&&(sa(a.form,"submit",d),b.leaveSubmitMethodAlone||"function"!=typeof a.form.submit||(a.form.submit=f))}};a.style.display="none";var h=U((function(k){return a.parentNode.insertBefore(k,a.nextSibling)}),b);return h};(function(a){a.off=sa;a.on=z;a.wheelEventPixels=Xg;a.Doc=oa;a.splitLines=le;a.countColumn=va;a.findColumn=gd;a.isWordChar=id;a.Pass=Yc;a.signal=W;a.Line=xb;a.changeEnd=Ra;a.scrollbarModel=of;a.Pos=t;a.cmpPos=B;a.modes=ld;a.mimeModes=ob;a.resolveMode=xc;a.getMode=md;a.modeExtensions=pb;a.extendMode=Cg;a.copyState=Ya;a.startState=ue;a.innerMode=nd;a.commands=hc;a.keyMap=gc;a.keyName=Zf;a.isModifierKey=Wf;a.lookupKey=Db;a.normalizeKeyMap=hh;a.StringStream=X;a.SharedTextMarker=fc;a.TextMarker=Ta;a.LineWidget=ec;a.e_preventDefault=la;a.e_stopPropagation=se;a.e_stop=Kb;a.addClass=Wa;a.contains=ja;a.rmClass=hb;a.keyNames=Ua})(U);U.version="5.63.3";return U}))}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],33:[function(require,module,exports){(function(v){"object"==typeof exports&&"object"==typeof module?v(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],v):v(CodeMirror)})((function(v){v.defineMode("javascript",(function(Ua,A){var p,w,f;function u(a,b,d){V=a;ca=d;return b}function I(a,b){var d=a.next();if('"'==d||"'"==d)return b.tokenize=Va(d),b.tokenize(a,b);if("."==d&&a.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return u("number","number");if("."==d&&a.match(".."))return u("spread","meta");if(/[\[\]{}\(\),;:\.]/.test(d))return u(d);if("="==d&&a.eat(">"))return u("=>","operator");if("0"==d&&a.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return u("number","number");if(/\d/.test(d))return a.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),u("number","number");if("/"==d){if(a.eat("*"))return b.tokenize=da,da(a,b);if(a.eat("/"))return a.skipToEnd(),u("comment","comment");if(Aa(a,b,1)){a:for(var e=b=!1;null!=(d=a.next());){if(!b){if("/"==d&&!e)break a;"["==d?e=!0:e&&"]"==d&&(e=!1)}b=!b&&"\\"==d}a.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/);return u("regexp","string-2")}a.eat("=");return u("operator","operator",a.current())}if("`"==d)return b.tokenize=W,W(a,b);if("#"==d&&"!"==a.peek())return a.skipToEnd(),u("meta","meta");if("#"==d&&a.eatWhile(ea))return u("variable","property");if("<"==d&&a.match("!--")||"-"==d&&a.match("->")&&!/\S/.test(a.string.slice(0,a.start)))return a.skipToEnd(),u("comment","comment");if(Ba.test(d))return">"==d&&b.lexical&&">"==b.lexical.type||(a.eat("=")?"!"!=d&&"="!=d||a.eat("="):/[<>*+\-|&?]/.test(d)&&(a.eat(d),">"==d&&a.eat(d))),"?"==d&&a.eat(".")?u("."):u("operator","operator",a.current());if(ea.test(d)){a.eatWhile(ea);d=a.current();if("."!=b.lastType){if(Ca.propertyIsEnumerable(d))return a=Ca[d],u(a.type,a.style,d);if("async"==d&&a.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return u("async","keyword",d)}return u("variable","variable",d)}}function Va(a){return function(b,d){var e=!1,h;if(fa&&"@"==b.peek()&&b.match(Wa))return d.tokenize=I,u("jsonld-keyword","meta");for(;null!=(h=b.next())&&(h!=a||e);)e=!e&&"\\"==h;e||(d.tokenize=I);return u("string","string")}}function da(a,b){for(var d=!1,e;e=a.next();){if("/"==e&&d){b.tokenize=I;break}d="*"==e}return u("comment","comment")}function W(a,b){for(var d=!1,e;null!=(e=a.next());){if(!d&&("`"==e||"$"==e&&a.eat("{"))){b.tokenize=I;break}d=!d&&"\\"==e}return u("quasi","string-2",a.current())}function pa(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var d=a.string.indexOf("=>",a.start);if(!(0>d)){if(r){var e=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(a.string.slice(a.start,d));e&&(d=e.index)}e=0;var h=!1;for(--d;0<=d;--d){var m=a.string.charAt(d),y="([{}])".indexOf(m);if(0<=y&&3>y){if(!e){++d;break}if(0==--e){"("==m&&(h=!0);break}}else if(3<=y&&6>y)++e;else if(ea.test(m))h=!0;else if(/["'\/`]/.test(m))for(;;--d){if(0==d)return;if(a.string.charAt(d-1)==m&&"\\"!=a.string.charAt(d-2)){d--;break}}else if(h&&!e){++d;break}}h&&!e&&(b.fatArrowAt=d)}}function Da(a,b,d,e,h,m){this.indented=a;this.column=b;this.type=d;this.prev=h;this.info=m;null!=e&&(this.align=e)}function Ea(a,b,d,e,h){var m=a.cc;p=a;w=h;f=null;qa=m;X=b;a.lexical.hasOwnProperty("align")||(a.lexical.align=!0);for(;;)if((m.length?m.pop():J?t:x)(d,e)){for(;m.length&&m[m.length-1].lex;)m.pop()();if(f)return f;if(d="variable"==d)a:if(Fa){for(d=a.localVars;d;d=d.next)if(d.name==e){d=!0;break a}for(a=a.context;a;a=a.prev)for(d=a.vars;d;d=d.next)if(d.name==e){d=!0;break a}d=void 0}else d=!1;return d?"variable-2":b}}function k(){for(var a=arguments.length-1;0<=a;a--)qa.push(arguments[a])}function c(){k.apply(null,arguments);return!0}function ra(a,b){for(;b;b=b.next)if(b.name==a)return!0;return!1}function N(a){var b=p;f="def";if(Fa){if(b.context)if("var"==b.lexical.info&&b.context&&b.context.block){var d=Ga(a,b.context);if(null!=d){b.context=d;return}}else if(!ra(a,b.localVars)){b.localVars=new Y(a,b.localVars);return}A.globalVars&&!ra(a,b.globalVars)&&(b.globalVars=new Y(a,b.globalVars))}}function Ga(a,b){return b?b.block?(a=Ga(a,b.prev))?a==b.prev?b:new Z(a,b.vars,!0):null:ra(a,b.vars)?b:new Z(b.prev,new Y(a,b.vars),!1):null}function ha(a){return"public"==a||"private"==a||"protected"==a||"abstract"==a||"readonly"==a}function Z(a,b,d){this.prev=a;this.vars=b;this.block=d}function Y(a,b){this.name=a;this.next=b}function O(){p.context=new Z(p.context,p.localVars,!1);p.localVars=Xa}function sa(){p.context=new Z(p.context,p.localVars,!0);p.localVars=null}function C(){p.localVars=p.context.vars;p.context=p.context.prev}function l(a,b){var d=function(){var e=p,h=e.indented;if("stat"==e.lexical.type)h=e.lexical.indented;else for(var m=e.lexical;m&&")"==m.type&&m.align;m=m.prev)h=m.indented;e.lexical=new Da(h,w.column(),a,null,e.lexical,b)};d.lex=!0;return d}function g(){var a=p;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function n(a){function b(d){return d==a?c():";"==a||"}"==d||")"==d||"]"==d?k():c(b)}return b}function x(a,b){return"var"==a?c(l("vardef",b),ta,n(";"),g):"keyword a"==a?c(l("form"),ua,x,g):"keyword b"==a?c(l("form"),x,g):"keyword d"==a?w.match(/^\s*$/,!1)?c():c(l("stat"),P,n(";"),g):"debugger"==a?c(n(";")):"{"==a?c(l("}"),sa,ia,g,C):";"==a?c():"if"==a?("else"==p.lexical.info&&p.cc[p.cc.length-1]==g&&p.cc.pop()(),c(l("form"),ua,x,g,Ha)):"function"==a?c(G):"for"==a?c(l("form"),sa,Ia,x,C,g):"class"==a||r&&"interface"==b?(f="keyword",c(l("form","class"==a?a:b),Ja,g)):"variable"==a?r&&"declare"==b?(f="keyword",c(x)):r&&("module"==b||"enum"==b||"type"==b)&&w.match(/^\s*\w/,!1)?(f="keyword","enum"==b?c(Ka):"type"==b?c(La,n("operator"),q,n(";")):c(l("form"),D,n("{"),l("}"),ia,g,g)):r&&"namespace"==b?(f="keyword",c(l("form"),t,x,g)):r&&"abstract"==b?(f="keyword",c(x)):c(l("stat"),Ya):"switch"==a?c(l("form"),ua,n("{"),l("}","switch"),sa,ia,g,g,C):"case"==a?c(t,n(":")):"default"==a?c(n(":")):"catch"==a?c(l("form"),O,Za,x,g,C):"export"==a?c(l("stat"),$a,g):"import"==a?c(l("stat"),ab,g):"async"==a?c(x):"@"==b?c(t,x):k(l("stat"),t,n(";"),g)}function Za(a){if("("==a)return c(K,n(")"))}function t(a,b){return Ma(a,b,!1)}function B(a,b){return Ma(a,b,!0)}function ua(a){return"("!=a?k():c(l(")"),P,n(")"),g)}function Ma(a,b,d){if(p.fatArrowAt==w.start){var e=d?Na:Oa;if("("==a)return c(O,l(")"),z(K,")"),g,n("=>"),e,C);if("variable"==a)return k(O,D,n("=>"),e,C)}e=d?Q:L;return bb.hasOwnProperty(a)?c(e):"function"==a?c(G,e):"class"==a||r&&"interface"==b?(f="keyword",c(l("form"),cb,g)):"keyword c"==a||"async"==a?c(d?B:t):"("==a?c(l(")"),P,n(")"),g,e):"operator"==a||"spread"==a?c(d?B:t):"["==a?c(l("]"),db,g,e):"{"==a?aa(ja,"}",null,e):"quasi"==a?k(ka,e):"new"==a?c(eb(d)):c()}function P(a){return a.match(/[;\}\)\],]/)?k():k(t)}function L(a,b){return","==a?c(P):Q(a,b,!1)}function Q(a,b,d){var e=0==d?L:Q,h=0==d?t:B;if("=>"==a)return c(O,d?Na:Oa,C);if("operator"==a)return/\+\+|--/.test(b)||r&&"!"==b?c(e):r&&"<"==b&&w.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?c(l(">"),z(q,">"),g,e):"?"==b?c(t,n(":"),h):c(h);if("quasi"==a)return k(ka,e);if(";"!=a){if("("==a)return aa(B,")","call",e);if("."==a)return c(fb,e);if("["==a)return c(l("]"),P,n("]"),g,e);if(r&&"as"==b)return f="keyword",c(q,e);if("regexp"==a)return p.lastType=f="operator",w.backUp(w.pos-w.start-1),c(h)}}function ka(a,b){return"quasi"!=a?k():"${"!=b.slice(b.length-2)?c(ka):c(P,gb)}function gb(a){if("}"==a)return f="string-2",p.tokenize=W,c(ka)}function Oa(a){pa(w,p);return k("{"==a?x:t)}function Na(a){pa(w,p);return k("{"==a?x:B)}function eb(a){return function(b){return"."==b?c(a?hb:ib):"variable"==b&&r?c(jb,a?Q:L):k(a?B:t)}}function ib(a,b){if("target"==b)return f="keyword",c(L)}function hb(a,b){if("target"==b)return f="keyword",c(Q)}function Ya(a){return":"==a?c(g,x):k(L,n(";"),g)}function fb(a){if("variable"==a)return f="property",c()}function ja(a,b){if("async"==a)return f="property",c(ja);if("variable"==a||"keyword"==X){f="property";if("get"==b||"set"==b)return c(kb);var d;r&&p.fatArrowAt==w.start&&(d=w.match(/^\s*:\s*/,!1))&&(p.fatArrowAt=w.pos+d[0].length);return c(M)}if("number"==a||"string"==a)return f=fa?"property":X+" property",c(M);if("jsonld-keyword"==a)return c(M);if(r&&ha(b))return f="keyword",c(ja);if("["==a)return c(t,R,n("]"),M);if("spread"==a)return c(B,M);if("*"==b)return f="keyword",c(ja);if(":"==a)return k(M)}function kb(a){if("variable"!=a)return k(M);f="property";return c(G)}function M(a){if(":"==a)return c(B);if("("==a)return k(G)}function z(a,b,d){function e(h,m){return(d?-1<d.indexOf(h):","==h)?(h=p.lexical,"call"==h.info&&(h.pos=(h.pos||0)+1),c((function(y,va){return y==b||va==b?k():k(a)}),e)):h==b||m==b?c():d&&-1<d.indexOf(";")?k(a):c(n(b))}return function(h,m){return h==b||m==b?c():k(a,e)}}function aa(a,b,d){for(var e=3;e<arguments.length;e++)qa.push(arguments[e]);return c(l(b,d),z(a,b),g)}function ia(a){return"}"==a?c():k(x,ia)}function R(a,b){if(r){if(":"==a)return c(q);if("?"==b)return c(R)}}function lb(a,b){if(r&&(":"==a||"in"==b))return c(q)}function Pa(a){if(r&&":"==a)return w.match(/^\s*\w+\s+is\b/,!1)?c(t,mb,q):c(q)}function mb(a,b){if("is"==b)return f="keyword",c()}function q(a,b){if("keyof"==b||"typeof"==b||"infer"==b||"readonly"==b)return f="keyword",c("typeof"==b?B:q);if("variable"==a||"void"==b)return f="type",c(E);if("|"==b||"&"==b)return c(q);if("string"==a||"number"==a||"atom"==a)return c(E);if("["==a)return c(l("]"),z(q,"]",","),g,E);if("{"==a)return c(l("}"),wa,g,E);if("("==a)return c(z(xa,")"),nb,E);if("<"==a)return c(z(q,">"),q);if("quasi"==a)return k(ya,E)}function nb(a){if("=>"==a)return c(q)}function wa(a){return a.match(/[\}\)\]]/)?c():","==a||";"==a?c(wa):k(ba,wa)}function ba(a,b){if("variable"==a||"keyword"==X)return f="property",c(ba);if("?"==b||"number"==a||"string"==a)return c(ba);if(":"==a)return c(q);if("["==a)return c(n("variable"),lb,n("]"),ba);if("("==a)return k(S,ba);if(!a.match(/[;\}\)\],]/))return c()}function ya(a,b){return"quasi"!=a?k():"${"!=b.slice(b.length-2)?c(ya):c(q,ob)}function ob(a){if("}"==a)return f="string-2",p.tokenize=W,c(ya)}function xa(a,b){return"variable"==a&&w.match(/^\s*[?:]/,!1)||"?"==b?c(xa):":"==a?c(q):"spread"==a?c(xa):k(q)}function E(a,b){if("<"==b)return c(l(">"),z(q,">"),g,E);if("|"==b||"."==a||"&"==b)return c(q);if("["==a)return c(q,n("]"),E);if("extends"==b||"implements"==b)return f="keyword",c(q);if("?"==b)return c(q,n(":"),q)}function jb(a,b){if("<"==b)return c(l(">"),z(q,">"),g,E)}function la(){return k(q,pb)}function pb(a,b){if("="==b)return c(q)}function ta(a,b){return"enum"==b?(f="keyword",c(Ka)):k(D,R,H,qb)}function D(a,b){if(r&&ha(b))return f="keyword",c(D);if("variable"==a)return N(b),c();if("spread"==a)return c(D);if("["==a)return aa(rb,"]");if("{"==a)return aa(Qa,"}")}function Qa(a,b){if("variable"==a&&!w.match(/^\s*:/,!1))return N(b),c(H);"variable"==a&&(f="property");return"spread"==a?c(D):"}"==a?k():"["==a?c(t,n("]"),n(":"),Qa):c(n(":"),D,H)}function rb(){return k(D,H)}function H(a,b){if("="==b)return c(B)}function qb(a){if(","==a)return c(ta)}function Ha(a,b){if("keyword b"==a&&"else"==b)return c(l("form","else"),x,g)}function Ia(a,b){if("await"==b)return c(Ia);if("("==a)return c(l(")"),sb,g)}function sb(a){return"var"==a?c(ta,T):"variable"==a?c(T):k(T)}function T(a,b){return")"==a?c():";"==a?c(T):"in"==b||"of"==b?(f="keyword",c(t,T)):k(t,T)}function G(a,b){if("*"==b)return f="keyword",c(G);if("variable"==a)return N(b),c(G);if("("==a)return c(O,l(")"),z(K,")"),g,Pa,x,C);if(r&&"<"==b)return c(l(">"),z(la,">"),g,G)}function S(a,b){if("*"==b)return f="keyword",c(S);if("variable"==a)return N(b),c(S);if("("==a)return c(O,l(")"),z(K,")"),g,Pa,C);if(r&&"<"==b)return c(l(">"),z(la,">"),g,S)}function La(a,b){if("keyword"==a||"variable"==a)return f="type",c(La);if("<"==b)return c(l(">"),z(la,">"),g)}function K(a,b){"@"==b&&c(t,K);return"spread"==a?c(K):r&&ha(b)?(f="keyword",c(K)):r&&"this"==a?c(R,H):k(D,R,H)}function cb(a,b){return"variable"==a?Ja(a,b):ma(a,b)}function Ja(a,b){if("variable"==a)return N(b),c(ma)}function ma(a,b){if("<"==b)return c(l(">"),z(la,">"),g,ma);if("extends"==b||"implements"==b||r&&","==a)return"implements"==b&&(f="keyword"),c(r?q:t,ma);if("{"==a)return c(l("}"),F,g)}function F(a,b){if("async"==a||"variable"==a&&("static"==b||"get"==b||"set"==b||r&&ha(b))&&w.match(/^\s+[\w$\xa1-\uffff]/,!1))return f="keyword",c(F);if("variable"==a||"keyword"==X)return f="property",c(na,F);if("number"==a||"string"==a)return c(na,F);if("["==a)return c(t,R,n("]"),na,F);if("*"==b)return f="keyword",c(F);if(r&&"("==a)return k(S,F);if(";"==a||","==a)return c(F);if("}"==a)return c();if("@"==b)return c(t,F)}function na(a,b){if("!"==b||"?"==b)return c(na);if(":"==a)return c(q,H);if("="==b)return c(B);a=p.lexical.prev;return k(a&&"interface"==a.info?S:G)}function $a(a,b){return"*"==b?(f="keyword",c(za,n(";"))):"default"==b?(f="keyword",c(t,n(";"))):"{"==a?c(z(Ra,"}"),za,n(";")):k(x)}function Ra(a,b){if("as"==b)return f="keyword",c(n("variable"));if("variable"==a)return k(B,Ra)}function ab(a){return"string"==a?c():"("==a?k(t):"."==a?k(L):k(oa,Sa,za)}function oa(a,b){if("{"==a)return aa(oa,"}");"variable"==a&&N(b);"*"==b&&(f="keyword");return c(tb)}function Sa(a){if(","==a)return c(oa,Sa)}function tb(a,b){if("as"==b)return f="keyword",c(oa)}function za(a,b){if("from"==b)return f="keyword",c(t)}function db(a){return"]"==a?c():k(z(B,"]"))}function Ka(){return k(l("form"),D,n("{"),l("}"),z(ub,"}"),g,g)}function ub(){return k(D,H)}function Aa(a,b,d){return b.tokenize==I&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(b.lastType)||"quasi"==b.lastType&&/\{\s*$/.test(a.string.slice(0,a.pos-(d||0)))}var U=Ua.indentUnit,Ta=A.statementIndent,fa=A.jsonld,J=A.json||fa,Fa=!1!==A.trackScope,r=A.typescript,ea=A.wordCharacters||/[\w$\xa1-\uffff]/,Ca=function(){function a(va){return{type:va,style:"keyword"}}var b=a("keyword a"),d=a("keyword b"),e=a("keyword c"),h=a("keyword d"),m=a("operator"),y={type:"atom",style:"atom"};return{if:a("if"),while:b,with:b,else:d,do:d,try:d,finally:d,return:h,break:h,continue:h,new:a("new"),delete:e,void:e,throw:e,debugger:a("debugger"),var:a("var"),const:a("var"),let:a("var"),function:a("function"),catch:a("catch"),for:a("for"),switch:a("switch"),case:a("case"),default:a("default"),in:m,typeof:m,instanceof:m,true:y,false:y,null:y,undefined:y,NaN:y,Infinity:y,this:a("this"),class:a("class"),super:a("atom"),yield:e,export:a("export"),import:a("import"),extends:e,await:e}}(),Ba=/[+\-*&%=<>!?|~^@]/,Wa=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,V,ca,bb={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,import:!0,"jsonld-keyword":!0};var qa=f=p=null;var X=w=void 0;var Xa=new Y("this",new Y("arguments",null));C.lex=!0;g.lex=!0;return{startState:function(a){a={tokenize:I,lastType:"sof",cc:[],lexical:new Da((a||0)-U,0,"block",!1),localVars:A.localVars,context:A.localVars&&new Z(null,null,!1),indented:a||0};A.globalVars&&"object"==typeof A.globalVars&&(a.globalVars=A.globalVars);return a},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),pa(a,b));if(b.tokenize!=da&&a.eatSpace())return null;var d=b.tokenize(a,b);if("comment"==V)return d;b.lastType="operator"!=V||"++"!=ca&&"--"!=ca?V:"incdec";return Ea(b,d,V,ca,a)},indent:function(a,b){if(a.tokenize==da||a.tokenize==W)return v.Pass;if(a.tokenize!=I)return 0;var d=b&&b.charAt(0),e=a.lexical,h;if(!/^\s*else\b/.test(b))for(var m=a.cc.length-1;0<=m;--m){var y=a.cc[m];if(y==g)e=e.prev;else if(y!=Ha&&y!=C)break}for(;!("stat"!=e.type&&"form"!=e.type||"}"!=d&&(!(h=a.cc[a.cc.length-1])||h!=L&&h!=Q||/^[,\.=+\-*:?[\(]/.test(b)));)e=e.prev;Ta&&")"==e.type&&"stat"==e.prev.type&&(e=e.prev);h=e.type;m=d==h;return"vardef"==h?e.indented+("operator"==a.lastType||","==a.lastType?e.info.length+1:0):"form"==h&&"{"==d?e.indented:"form"==h?e.indented+U:"stat"==h?(d=e.indented,a="operator"==a.lastType||","==a.lastType||Ba.test(b.charAt(0))||/[,.]/.test(b.charAt(0)),d+(a?Ta||U:0)):"switch"!=e.info||m||0==A.doubleIndentSwitch?e.align?e.column+(m?0:1):e.indented+(m?0:U):e.indented+(/^(?:case|default)\b/.test(b)?U:2*U)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:J?null:"/*",blockCommentEnd:J?null:"*/",blockCommentContinue:J?null:" * ",lineComment:J?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:J?"json":"javascript",jsonldMode:fa,jsonMode:J,expressionAllowed:Aa,skipExpression:function(a){Ea(a,"atom","atom","true",new v.StringStream("",2,null))}}}));v.registerHelper("wordChars","javascript",/[\w$]/);v.defineMIME("text/javascript","javascript");v.defineMIME("text/ecmascript","javascript");v.defineMIME("application/javascript","javascript");v.defineMIME("application/x-javascript","javascript");v.defineMIME("application/ecmascript","javascript");v.defineMIME("application/json",{name:"javascript",json:!0});v.defineMIME("application/x-json",{name:"javascript",json:!0});v.defineMIME("application/manifest+json",{name:"javascript",json:!0});v.defineMIME("application/ld+json",{name:"javascript",jsonld:!0});v.defineMIME("text/typescript",{name:"javascript",typescript:!0});v.defineMIME("application/typescript",{name:"javascript",typescript:!0})}))},{"../../lib/codemirror":32}],34:[function(require,module,exports){var slice=[].slice;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)))}}},{}],35:[function(require,module,exports){if(typeof module!=="undefined"){module.exports=Emitter}function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks["$"+event]=this._callbacks["$"+event]||[]).push(fn);return this};Emitter.prototype.once=function(event,fn){function on(){this.off(event,on);fn.apply(this,arguments)}on.fn=fn;this.on(event,on);return this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks["$"+event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks["$"+event];return this}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};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};Emitter.prototype.listeners=function(event){this._callbacks=this._callbacks||{};return this._callbacks["$"+event]||[]};Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length}},{}],36:[function(require,module,exports){module.exports=function(a,b){var fn=function(){};fn.prototype=b.prototype;a.prototype=new fn;a.prototype.constructor=a}},{}],37:[function(require,module,exports){(function(Buffer){(function(){function isArray(arg){if(Array.isArray){return Array.isArray(arg)}return objectToString(arg)==="[object Array]"}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return objectToString(e)==="[object Error]"||e instanceof Error}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=Buffer.isBuffer;function objectToString(o){return Object.prototype.toString.call(o)}}).call(this)}).call(this,{isBuffer:require("../../is-buffer/index.js")})},{"../../is-buffer/index.js":81}],38:[function(require,module,exports){module.exports=function(){if(typeof self!=="undefined"){return self}else if(typeof window!=="undefined"){return window}else{return Function("return this")()}}()},{}],39:[function(require,module,exports){module.exports=require("./socket");module.exports.parser=require("engine.io-parser")},{"./socket":40,"engine.io-parser":52}],40:[function(require,module,exports){var transports=require("./transports/index");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 parseqs=require("parseqs");module.exports=Socket;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:typeof location!=="undefined"&&"https:"===location.protocol;if(opts.hostname&&!opts.port){opts.port=this.secure?"443":"80"}this.agent=opts.agent||false;this.hostname=opts.hostname||(typeof location!=="undefined"?location.hostname:"localhost");this.port=opts.port||(typeof location!=="undefined"&&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.withCredentials=false!==opts.withCredentials;this.timestampParam=opts.timestampParam||"t";this.timestampRequests=opts.timestampRequests;this.transports=opts.transports||["polling","websocket"];this.transportOptions=opts.transportOptions||{};this.readyState="";this.writeBuffer=[];this.prevBufferLen=0;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}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;this.forceNode=!!opts.forceNode;this.isReactNative=typeof navigator!=="undefined"&&typeof navigator.product==="string"&&navigator.product.toLowerCase()==="reactnative";if(typeof self==="undefined"||this.isReactNative){if(opts.extraHeaders&&Object.keys(opts.extraHeaders).length>0){this.extraHeaders=opts.extraHeaders}if(opts.localAddress){this.localAddress=opts.localAddress}}this.id=null;this.upgrades=null;this.pingInterval=null;this.pingTimeout=null;this.pingIntervalTimer=null;this.pingTimeoutTimer=null;this.open()}Socket.priorWebsocketSuccess=false;Emitter(Socket.prototype);Socket.protocol=parser.protocol;Socket.Socket=Socket;Socket.Transport=require("./transport");Socket.transports=require("./transports/index");Socket.parser=require("engine.io-parser");Socket.prototype.createTransport=function(name){debug('creating transport "%s"',name);var query=clone(this.query);query.EIO=parser.protocol;query.transport=name;var options=this.transportOptions[name]||{};if(this.id)query.sid=this.id;var transport=new transports[name]({query:query,socket:this,agent:options.agent||this.agent,hostname:options.hostname||this.hostname,port:options.port||this.port,secure:options.secure||this.secure,path:options.path||this.path,forceJSONP:options.forceJSONP||this.forceJSONP,jsonp:options.jsonp||this.jsonp,forceBase64:options.forceBase64||this.forceBase64,enablesXDR:options.enablesXDR||this.enablesXDR,withCredentials:options.withCredentials||this.withCredentials,timestampRequests:options.timestampRequests||this.timestampRequests,timestampParam:options.timestampParam||this.timestampParam,policyPort:options.policyPort||this.policyPort,pfx:options.pfx||this.pfx,key:options.key||this.key,passphrase:options.passphrase||this.passphrase,cert:options.cert||this.cert,ca:options.ca||this.ca,ciphers:options.ciphers||this.ciphers,rejectUnauthorized:options.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:options.perMessageDeflate||this.perMessageDeflate,extraHeaders:options.extraHeaders||this.extraHeaders,forceNode:options.forceNode||this.forceNode,localAddress:options.localAddress||this.localAddress,requestTimeout:options.requestTimeout||this.requestTimeout,protocols:options.protocols||void 0,isReactNative:this.isReactNative});return transport};function clone(obj){var o={};for(var i in obj){if(obj.hasOwnProperty(i)){o[i]=obj[i]}}return o}Socket.prototype.open=function(){var transport;if(this.rememberUpgrade&&Socket.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1){transport="websocket"}else if(0===this.transports.length){var self=this;setTimeout((function(){self.emit("error","No transports available")}),0);return}else{transport=this.transports[0]}this.readyState="opening";try{transport=this.createTransport(transport)}catch(e){this.transports.shift();this.open();return}transport.open();this.setTransport(transport)};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()}this.transport=transport;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")}))};Socket.prototype.probe=function(name){debug('probing transport "%s"',name);var transport=this.createTransport(name,{probe:1});var failed=false;var 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;failed=true;cleanup();transport.close();transport=null}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")}function onclose(){onerror("socket closed")}function onupgrade(to){if(transport&&to.name!==transport.name){debug('"%s" works - aborting "%s"',to.name,transport.name);freezeTransport()}}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()};Socket.prototype.onOpen=function(){debug("socket open");this.readyState="open";Socket.priorWebsocketSuccess="websocket"===this.transport.name;this.emit("open");this.flush();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])}}};Socket.prototype.onPacket=function(packet){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){debug('socket receive: type "%s", data "%s"',packet.type,packet.data);this.emit("packet",packet);this.emit("heartbeat");switch(packet.type){case"open":this.onHandshake(JSON.parse(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)}};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();if("closed"===this.readyState)return;this.setPing();this.removeListener("heartbeat",this.onHeartbeat);this.on("heartbeat",this.onHeartbeat)};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)};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)};Socket.prototype.ping=function(){var self=this;this.sendPacket("ping",(function(){self.emit("ping")}))};Socket.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen);this.prevBufferLen=0;if(0===this.writeBuffer.length){this.emit("drain")}else{this.flush()}};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);this.prevBufferLen=this.writeBuffer.length;this.emit("flush")}};Socket.prototype.write=Socket.prototype.send=function(msg,options,fn){this.sendPacket("message",msg,options,fn);return this};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()};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(){self.once("upgrade",cleanupAndClose);self.once("upgradeError",cleanupAndClose)}return this};Socket.prototype.onError=function(err){debug("socket error %j",err);Socket.priorWebsocketSuccess=false;this.emit("error",err);this.onClose("transport error",err)};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;clearTimeout(this.pingIntervalTimer);clearTimeout(this.pingTimeoutTimer);this.transport.removeAllListeners("close");this.transport.close();this.transport.removeAllListeners();this.readyState="closed";this.id=null;this.emit("close",reason,desc);self.writeBuffer=[];self.prevBufferLen=0}};Socket.prototype.filterUpgrades=function(upgrades){var filteredUpgrades=[];for(var i=0,j=upgrades.length;i<j;i++){if(~index(this.transports,upgrades[i]))filteredUpgrades.push(upgrades[i])}return filteredUpgrades}},{"./transport":41,"./transports/index":42,"component-emitter":48,debug:49,"engine.io-parser":52,indexof:79,parseqs:108,parseuri:109}],41:[function(require,module,exports){var parser=require("engine.io-parser");var Emitter=require("component-emitter");module.exports=Transport;function Transport(opts){this.path=opts.path;this.hostname=opts.hostname;this.port=opts.port;this.secure=opts.secure;this.query=opts.query;this.timestampParam=opts.timestampParam;this.timestampRequests=opts.timestampRequests;this.readyState="";this.agent=opts.agent||false;this.socket=opts.socket;this.enablesXDR=opts.enablesXDR;this.withCredentials=opts.withCredentials;this.pfx=opts.pfx;this.key=opts.key;this.passphrase=opts.passphrase;this.cert=opts.cert;this.ca=opts.ca;this.ciphers=opts.ciphers;this.rejectUnauthorized=opts.rejectUnauthorized;this.forceNode=opts.forceNode;this.isReactNative=opts.isReactNative;this.extraHeaders=opts.extraHeaders;this.localAddress=opts.localAddress}Emitter(Transport.prototype);Transport.prototype.onError=function(msg,desc){var err=new Error(msg);err.type="TransportError";err.description=desc;this.emit("error",err);return this};Transport.prototype.open=function(){if("closed"===this.readyState||""===this.readyState){this.readyState="opening";this.doOpen()}return this};Transport.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.doClose();this.onClose()}return this};Transport.prototype.send=function(packets){if("open"===this.readyState){this.write(packets)}else{throw new Error("Transport not open")}};Transport.prototype.onOpen=function(){this.readyState="open";this.writable=true;this.emit("open")};Transport.prototype.onData=function(data){var packet=parser.decodePacket(data,this.socket.binaryType);this.onPacket(packet)};Transport.prototype.onPacket=function(packet){this.emit("packet",packet)};Transport.prototype.onClose=function(){this.readyState="closed";this.emit("close")}},{"component-emitter":48,"engine.io-parser":52}],42:[function(require,module,exports){var XMLHttpRequest=require("xmlhttprequest-ssl");var XHR=require("./polling-xhr");var JSONP=require("./polling-jsonp");var websocket=require("./websocket");exports.polling=polling;exports.websocket=websocket;function polling(opts){var xhr;var xd=false;var xs=false;var jsonp=false!==opts.jsonp;if(typeof location!=="undefined"){var isSSL="https:"===location.protocol;var port=location.port;if(!port){port=isSSL?443:80}xd=opts.hostname!==location.hostname||port!==opts.port;xs=opts.secure!==isSSL}opts.xdomain=xd;opts.xscheme=xs;xhr=new XMLHttpRequest(opts);if("open"in xhr&&!opts.forceJSONP){return new XHR(opts)}else{if(!jsonp)throw new Error("JSONP disabled");return new JSONP(opts)}}},{"./polling-jsonp":43,"./polling-xhr":44,"./websocket":46,"xmlhttprequest-ssl":47}],43:[function(require,module,exports){var Polling=require("./polling");var inherit=require("component-inherit");var globalThis=require("../globalThis");module.exports=JSONPPolling;var rNewline=/\n/g;var rEscapedNewline=/\\n/g;var callbacks;function empty(){}function JSONPPolling(opts){Polling.call(this,opts);this.query=this.query||{};if(!callbacks){callbacks=globalThis.___eio=globalThis.___eio||[]}this.index=callbacks.length;var self=this;callbacks.push((function(msg){self.onData(msg)}));this.query.j=this.index;if(typeof addEventListener==="function"){addEventListener("beforeunload",(function(){if(self.script)self.script.onerror=empty}),false)}}inherit(JSONPPolling,Polling);JSONPPolling.prototype.supportsBinary=false;JSONPPolling.prototype.doClose=function(){if(this.script){this.script.parentNode.removeChild(this.script);this.script=null}if(this.form){this.form.parentNode.removeChild(this.form);this.form=null;this.iframe=null}Polling.prototype.doClose.call(this)};JSONPPolling.prototype.doPoll=function(){var self=this;var script=document.createElement("script");if(this.script){this.script.parentNode.removeChild(this.script);this.script=null}script.async=true;script.src=this.uri();script.onerror=function(e){self.onError("jsonp poll error",e)};var insertAt=document.getElementsByTagName("script")[0];if(insertAt){insertAt.parentNode.insertBefore(script,insertAt)}else{(document.head||document.body).appendChild(script)}this.script=script;var isUAgecko="undefined"!==typeof navigator&&/gecko/i.test(navigator.userAgent);if(isUAgecko){setTimeout((function(){var iframe=document.createElement("iframe");document.body.appendChild(iframe);document.body.removeChild(iframe)}),100)}};JSONPPolling.prototype.doWrite=function(data,fn){var self=this;if(!this.form){var form=document.createElement("form");var area=document.createElement("textarea");var id=this.iframeId="eio_iframe_"+this.index;var iframe;form.className="socketio";form.style.position="absolute";form.style.top="-1000px";form.style.left="-1000px";form.target=id;form.method="POST";form.setAttribute("accept-charset","utf-8");area.name="d";form.appendChild(area);document.body.appendChild(form);this.form=form;this.area=area}this.form.action=this.uri();function complete(){initIframe();fn()}function initIframe(){if(self.iframe){try{self.form.removeChild(self.iframe)}catch(e){self.onError("jsonp polling iframe removal error",e)}}try{var html='<iframe src="javascript:0" name="'+self.iframeId+'">';iframe=document.createElement(html)}catch(e){iframe=document.createElement("iframe");iframe.name=self.iframeId;iframe.src="javascript:0"}iframe.id=self.iframeId;self.form.appendChild(iframe);self.iframe=iframe}initIframe();data=data.replace(rEscapedNewline,"\\\n");this.area.value=data.replace(rNewline,"\\n");try{this.form.submit()}catch(e){}if(this.iframe.attachEvent){this.iframe.onreadystatechange=function(){if(self.iframe.readyState==="complete"){complete()}}}else{this.iframe.onload=complete}}},{"../globalThis":38,"./polling":45,"component-inherit":36}],44:[function(require,module,exports){var XMLHttpRequest=require("xmlhttprequest-ssl");var Polling=require("./polling");var Emitter=require("component-emitter");var inherit=require("component-inherit");var debug=require("debug")("engine.io-client:polling-xhr");var globalThis=require("../globalThis");module.exports=XHR;module.exports.Request=Request;function empty(){}function XHR(opts){Polling.call(this,opts);this.requestTimeout=opts.requestTimeout;this.extraHeaders=opts.extraHeaders;if(typeof location!=="undefined"){var isSSL="https:"===location.protocol;var port=location.port;if(!port){port=isSSL?443:80}this.xd=typeof location!=="undefined"&&opts.hostname!==location.hostname||port!==opts.port;this.xs=opts.secure!==isSSL}}inherit(XHR,Polling);XHR.prototype.supportsBinary=true;XHR.prototype.request=function(opts){opts=opts||{};opts.uri=this.uri();opts.xd=this.xd;opts.xs=this.xs;opts.agent=this.agent||false;opts.supportsBinary=this.supportsBinary;opts.enablesXDR=this.enablesXDR;opts.withCredentials=this.withCredentials;opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized;opts.requestTimeout=this.requestTimeout;opts.extraHeaders=this.extraHeaders;return new Request(opts)};XHR.prototype.doWrite=function(data,fn){var isBinary=typeof data!=="string"&&data!==undefined;var req=this.request({method:"POST",data:data,isBinary:isBinary});var self=this;req.on("success",fn);req.on("error",(function(err){self.onError("xhr post error",err)}));this.sendXhr=req};XHR.prototype.doPoll=function(){debug("xhr poll");var req=this.request();var self=this;req.on("data",(function(data){self.onData(data)}));req.on("error",(function(err){self.onError("xhr poll error",err)}));this.pollXhr=req};function Request(opts){this.method=opts.method||"GET";this.uri=opts.uri;this.xd=!!opts.xd;this.xs=!!opts.xs;this.async=false!==opts.async;this.data=undefined!==opts.data?opts.data:null;this.agent=opts.agent;this.isBinary=opts.isBinary;this.supportsBinary=opts.supportsBinary;this.enablesXDR=opts.enablesXDR;this.withCredentials=opts.withCredentials;this.requestTimeout=opts.requestTimeout;this.pfx=opts.pfx;this.key=opts.key;this.passphrase=opts.passphrase;this.cert=opts.cert;this.ca=opts.ca;this.ciphers=opts.ciphers;this.rejectUnauthorized=opts.rejectUnauthorized;this.extraHeaders=opts.extraHeaders;this.create()}Emitter(Request.prototype);Request.prototype.create=function(){var opts={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized;var xhr=this.xhr=new XMLHttpRequest(opts);var self=this;try{debug("xhr open %s: %s",this.method,this.uri);xhr.open(this.method,this.uri,this.async);try{if(this.extraHeaders){xhr.setDisableHeaderCheck&&xhr.setDisableHeaderCheck(true);for(var i in this.extraHeaders){if(this.extraHeaders.hasOwnProperty(i)){xhr.setRequestHeader(i,this.extraHeaders[i])}}}}catch(e){}if("POST"===this.method){try{if(this.isBinary){xhr.setRequestHeader("Content-type","application/octet-stream")}else{xhr.setRequestHeader("Content-type","text/plain;charset=UTF-8")}}catch(e){}}try{xhr.setRequestHeader("Accept","*/*")}catch(e){}if("withCredentials"in xhr){xhr.withCredentials=this.withCredentials}if(this.requestTimeout){xhr.timeout=this.requestTimeout}if(this.hasXDR()){xhr.onload=function(){self.onLoad()};xhr.onerror=function(){self.onError(xhr.responseText)}}else{xhr.onreadystatechange=function(){if(xhr.readyState===2){try{var contentType=xhr.getResponseHeader("Content-Type");if(self.supportsBinary&&contentType==="application/octet-stream"||contentType==="application/octet-stream; charset=UTF-8"){xhr.responseType="arraybuffer"}}catch(e){}}if(4!==xhr.readyState)return;if(200===xhr.status||1223===xhr.status){self.onLoad()}else{setTimeout((function(){self.onError(typeof xhr.status==="number"?xhr.status:0)}),0)}}}debug("xhr data %s",this.data);xhr.send(this.data)}catch(e){setTimeout((function(){self.onError(e)}),0);return}if(typeof document!=="undefined"){this.index=Request.requestsCount++;Request.requests[this.index]=this}};Request.prototype.onSuccess=function(){this.emit("success");this.cleanup()};Request.prototype.onData=function(data){this.emit("data",data);this.onSuccess()};Request.prototype.onError=function(err){this.emit("error",err);this.cleanup(true)};Request.prototype.cleanup=function(fromError){if("undefined"===typeof this.xhr||null===this.xhr){return}if(this.hasXDR()){this.xhr.onload=this.xhr.onerror=empty}else{this.xhr.onreadystatechange=empty}if(fromError){try{this.xhr.abort()}catch(e){}}if(typeof document!=="undefined"){delete Request.requests[this.index]}this.xhr=null};Request.prototype.onLoad=function(){var data;try{var contentType;try{contentType=this.xhr.getResponseHeader("Content-Type")}catch(e){}if(contentType==="application/octet-stream"||contentType==="application/octet-stream; charset=UTF-8"){data=this.xhr.response||this.xhr.responseText}else{data=this.xhr.responseText}}catch(e){this.onError(e)}if(null!=data){this.onData(data)}};Request.prototype.hasXDR=function(){return typeof XDomainRequest!=="undefined"&&!this.xs&&this.enablesXDR};Request.prototype.abort=function(){this.cleanup()};Request.requestsCount=0;Request.requests={};if(typeof document!=="undefined"){if(typeof attachEvent==="function"){attachEvent("onunload",unloadHandler)}else if(typeof addEventListener==="function"){var terminationEvent="onpagehide"in globalThis?"pagehide":"unload";addEventListener(terminationEvent,unloadHandler,false)}}function unloadHandler(){for(var i in Request.requests){if(Request.requests.hasOwnProperty(i)){Request.requests[i].abort()}}}},{"../globalThis":38,"./polling":45,"component-emitter":48,"component-inherit":36,debug:49,"xmlhttprequest-ssl":47}],45:[function(require,module,exports){var Transport=require("../transport");var parseqs=require("parseqs");var parser=require("engine.io-parser");var inherit=require("component-inherit");var yeast=require("yeast");var debug=require("debug")("engine.io-client:polling");module.exports=Polling;var hasXHR2=function(){var XMLHttpRequest=require("xmlhttprequest-ssl");var xhr=new XMLHttpRequest({xdomain:false});return null!=xhr.responseType}();function Polling(opts){var forceBase64=opts&&opts.forceBase64;if(!hasXHR2||forceBase64){this.supportsBinary=false}Transport.call(this,opts)}inherit(Polling,Transport);Polling.prototype.name="polling";Polling.prototype.doOpen=function(){this.poll()};Polling.prototype.pause=function(onPause){var self=this;this.readyState="pausing";function pause(){debug("paused");self.readyState="paused";onPause()}if(this.polling||!this.writable){var total=0;if(this.polling){debug("we are currently polling - waiting to pause");total++;this.once("pollComplete",(function(){debug("pre-pause polling complete");--total||pause()}))}if(!this.writable){debug("we are currently writing - waiting to pause");total++;this.once("drain",(function(){debug("pre-pause writing complete");--total||pause()}))}}else{pause()}};Polling.prototype.poll=function(){debug("polling");this.polling=true;this.doPoll();this.emit("poll")};Polling.prototype.onData=function(data){var self=this;debug("polling got data %s",data);var callback=function(packet,index,total){if("opening"===self.readyState&&packet.type==="open"){self.onOpen()}if("close"===packet.type){self.onClose();return false}self.onPacket(packet)};parser.decodePayload(data,this.socket.binaryType,callback);if("closed"!==this.readyState){this.polling=false;this.emit("pollComplete");if("open"===this.readyState){this.poll()}else{debug('ignoring poll - transport state "%s"',this.readyState)}}};Polling.prototype.doClose=function(){var self=this;function close(){debug("writing close packet");self.write([{type:"close"}])}if("open"===this.readyState){debug("transport open - closing");close()}else{debug("transport not open - deferring close");this.once("open",close)}};Polling.prototype.write=function(packets){var self=this;this.writable=false;var callbackfn=function(){self.writable=true;self.emit("drain")};parser.encodePayload(packets,this.supportsBinary,(function(data){self.doWrite(data,callbackfn)}))};Polling.prototype.uri=function(){var query=this.query||{};var schema=this.secure?"https":"http";var port="";if(false!==this.timestampRequests){query[this.timestampParam]=yeast()}if(!this.supportsBinary&&!query.sid){query.b64=1}query=parseqs.encode(query);if(this.port&&("https"===schema&&Number(this.port)!==443||"http"===schema&&Number(this.port)!==80)){port=":"+this.port}if(query.length){query="?"+query}var ipv6=this.hostname.indexOf(":")!==-1;return schema+"://"+(ipv6?"["+this.hostname+"]":this.hostname)+port+this.path+query}},{"../transport":41,"component-inherit":36,debug:49,"engine.io-parser":52,parseqs:108,"xmlhttprequest-ssl":47,yeast:165}],46:[function(require,module,exports){(function(Buffer){(function(){var Transport=require("../transport");var parser=require("engine.io-parser");var parseqs=require("parseqs");var inherit=require("component-inherit");var yeast=require("yeast");var debug=require("debug")("engine.io-client:websocket");var BrowserWebSocket,NodeWebSocket;if(typeof WebSocket!=="undefined"){BrowserWebSocket=WebSocket}else if(typeof self!=="undefined"){BrowserWebSocket=self.WebSocket||self.MozWebSocket}if(typeof window==="undefined"){try{NodeWebSocket=require("ws")}catch(e){}}var WebSocketImpl=BrowserWebSocket||NodeWebSocket;module.exports=WS;function WS(opts){var forceBase64=opts&&opts.forceBase64;if(forceBase64){this.supportsBinary=false}this.perMessageDeflate=opts.perMessageDeflate;this.usingBrowserWebSocket=BrowserWebSocket&&!opts.forceNode;this.protocols=opts.protocols;if(!this.usingBrowserWebSocket){WebSocketImpl=NodeWebSocket}Transport.call(this,opts)}inherit(WS,Transport);WS.prototype.name="websocket";WS.prototype.supportsBinary=true;WS.prototype.doOpen=function(){if(!this.check()){return}var uri=this.uri();var protocols=this.protocols;var opts={};if(!this.isReactNative){opts.agent=this.agent;opts.perMessageDeflate=this.perMessageDeflate;opts.pfx=this.pfx;opts.key=this.key;opts.passphrase=this.passphrase;opts.cert=this.cert;opts.ca=this.ca;opts.ciphers=this.ciphers;opts.rejectUnauthorized=this.rejectUnauthorized}if(this.extraHeaders){opts.headers=this.extraHeaders}if(this.localAddress){opts.localAddress=this.localAddress}try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?protocols?new WebSocketImpl(uri,protocols):new WebSocketImpl(uri):new WebSocketImpl(uri,protocols,opts)}catch(err){return this.emit("error",err)}if(this.ws.binaryType===undefined){this.supportsBinary=false}if(this.ws.supports&&this.ws.supports.binary){this.supportsBinary=true;this.ws.binaryType="nodebuffer"}else{this.ws.binaryType="arraybuffer"}this.addEventListeners()};WS.prototype.addEventListeners=function(){var self=this;this.ws.onopen=function(){self.onOpen()};this.ws.onclose=function(){self.onClose()};this.ws.onmessage=function(ev){self.onData(ev.data)};this.ws.onerror=function(e){self.onError("websocket error",e)}};WS.prototype.write=function(packets){var self=this;this.writable=false;var total=packets.length;for(var i=0,l=total;i<l;i++){(function(packet){parser.encodePacket(packet,self.supportsBinary,(function(data){if(!self.usingBrowserWebSocket){var opts={};if(packet.options){opts.compress=packet.options.compress}if(self.perMessageDeflate){var len="string"===typeof data?Buffer.byteLength(data):data.length;if(len<self.perMessageDeflate.threshold){opts.compress=false}}}try{if(self.usingBrowserWebSocket){self.ws.send(data)}else{self.ws.send(data,opts)}}catch(e){debug("websocket closed before onclose event")}--total||done()}))})(packets[i])}function done(){self.emit("flush");setTimeout((function(){self.writable=true;self.emit("drain")}),0)}};WS.prototype.onClose=function(){Transport.prototype.onClose.call(this)};WS.prototype.doClose=function(){if(typeof this.ws!=="undefined"){this.ws.close()}};WS.prototype.uri=function(){var query=this.query||{};var schema=this.secure?"wss":"ws";var port="";if(this.port&&("wss"===schema&&Number(this.port)!==443||"ws"===schema&&Number(this.port)!==80)){port=":"+this.port}if(this.timestampRequests){query[this.timestampParam]=yeast()}if(!this.supportsBinary){query.b64=1}query=parseqs.encode(query);if(query.length){query="?"+query}var ipv6=this.hostname.indexOf(":")!==-1;return schema+"://"+(ipv6?"["+this.hostname+"]":this.hostname)+port+this.path+query};WS.prototype.check=function(){return!!WebSocketImpl&&!("__initialize"in WebSocketImpl&&this.name===WS.prototype.name)}}).call(this)}).call(this,require("buffer").Buffer)},{"../transport":41,buffer:27,"component-inherit":36,debug:49,"engine.io-parser":52,parseqs:108,ws:25,yeast:165}],47:[function(require,module,exports){var hasCORS=require("has-cors");var globalThis=require("./globalThis");module.exports=function(opts){var xdomain=opts.xdomain;var xscheme=opts.xscheme;var enablesXDR=opts.enablesXDR;try{if("undefined"!==typeof XMLHttpRequest&&(!xdomain||hasCORS)){return new XMLHttpRequest}}catch(e){}try{if("undefined"!==typeof XDomainRequest&&!xscheme&&enablesXDR){return new XDomainRequest}}catch(e){}if(!xdomain){try{return new(globalThis[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}}},{"./globalThis":38,"has-cors":58}],48:[function(require,module,exports){if(typeof module!=="undefined"){module.exports=Emitter}function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks["$"+event]=this._callbacks["$"+event]||[]).push(fn);return this};Emitter.prototype.once=function(event,fn){function on(){this.off(event,on);fn.apply(this,arguments)}on.fn=fn;this.on(event,on);return this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks["$"+event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks["$"+event];return this}var cb;for(var i=0;i<callbacks.length;i++){cb=callbacks[i];if(cb===fn||cb.fn===fn){callbacks.splice(i,1);break}}if(callbacks.length===0){delete this._callbacks["$"+event]}return this};Emitter.prototype.emit=function(event){this._callbacks=this._callbacks||{};var args=new Array(arguments.length-1),callbacks=this._callbacks["$"+event];for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}if(callbacks){callbacks=callbacks.slice(0);for(var i=0,len=callbacks.length;i<len;++i){callbacks[i].apply(this,args)}}return this};Emitter.prototype.listeners=function(event){this._callbacks=this._callbacks||{};return this._callbacks["$"+event]||[]};Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length}},{}],49:[function(require,module,exports){(function(process){(function(){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();exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function useColors(){if(typeof window!=="undefined"&&window.process&&window.process.type==="renderer"){return true}if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)){return false}return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}exports.formatters.j=function(v){try{return JSON.stringify(v)}catch(err){return"[UnexpectedJSONParseError]: "+err.message}};function formatArgs(args){var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return;var c="color: "+this.color;args.splice(1,0,c,"color: inherit");var index=0;var lastC=0;args[0].replace(/%[a-zA-Z%]/g,(function(match){if("%%"===match)return;index++;if("%c"===match){lastC=index}}));args.splice(lastC,0,c)}function log(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){exports.storage.removeItem("debug")}else{exports.storage.debug=namespaces}}catch(e){}}function load(){var r;try{r=exports.storage.debug}catch(e){}if(!r&&typeof process!=="undefined"&&"env"in process){r=process.env.DEBUG}return r}exports.enable(load());function localstorage(){try{return window.localStorage}catch(e){}}}).call(this)}).call(this,require("_process"))},{"./debug":50,_process:112}],50:[function(require,module,exports){exports=module.exports=createDebug.debug=createDebug["default"]=createDebug;exports.coerce=coerce;exports.disable=disable;exports.enable=enable;exports.enabled=enabled;exports.humanize=require("ms");exports.instances=[];exports.names=[];exports.skips=[];exports.formatters={};function selectColor(namespace){var hash=0,i;for(i in namespace){hash=(hash<<5)-hash+namespace.charCodeAt(i);hash|=0}return exports.colors[Math.abs(hash)%exports.colors.length]}function createDebug(namespace){var prevTime;function debug(){if(!debug.enabled)return;var self=debug;var curr=+new Date;var ms=curr-(prevTime||curr);self.diff=ms;self.prev=prevTime;self.curr=curr;prevTime=curr;var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i]}args[0]=exports.coerce(args[0]);if("string"!==typeof args[0]){args.unshift("%O")}var index=0;args[0]=args[0].replace(/%([a-zA-Z%])/g,(function(match,format){if(match==="%%")return match;index++;var formatter=exports.formatters[format];if("function"===typeof formatter){var val=args[index];match=formatter.call(self,val);args.splice(index,1);index--}return match}));exports.formatArgs.call(self,args);var logFn=debug.log||exports.log||console.log.bind(console);logFn.apply(self,args)}debug.namespace=namespace;debug.enabled=exports.enabled(namespace);debug.useColors=exports.useColors();debug.color=selectColor(namespace);debug.destroy=destroy;if("function"===typeof exports.init){exports.init(debug)}exports.instances.push(debug);return debug}function destroy(){var index=exports.instances.indexOf(this);if(index!==-1){exports.instances.splice(index,1);return true}else{return false}}function enable(namespaces){exports.save(namespaces);exports.names=[];exports.skips=[];var i;var split=(typeof namespaces==="string"?namespaces:"").split(/[\s,]+/);var len=split.length;for(i=0;i<len;i++){if(!split[i])continue;namespaces=split[i].replace(/\*/g,".*?");if(namespaces[0]==="-"){exports.skips.push(new RegExp("^"+namespaces.substr(1)+"$"))}else{exports.names.push(new RegExp("^"+namespaces+"$"))}}for(i=0;i<exports.instances.length;i++){var instance=exports.instances[i];instance.enabled=exports.enabled(instance.namespace)}}function disable(){exports.enable("")}function enabled(name){if(name[name.length-1]==="*"){return true}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}function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}},{ms:51}],51:[function(require,module,exports){var s=1e3;var m=s*60;var h=m*60;var d=h*24;var y=d*365.25;module.exports=function(val,options){options=options||{};var type=typeof val;if(type==="string"&&val.length>0){return parse(val)}else if(type==="number"&&isNaN(val)===false){return options.long?fmtLong(val):fmtShort(val)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(val))};function parse(str){str=String(str);if(str.length>100){return}var match=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);if(!match){return}var n=parseFloat(match[1]);var type=(match[2]||"ms").toLowerCase();switch(type){case"years":case"year":case"yrs":case"yr":case"y":return n*y;case"days":case"day":case"d":return n*d;case"hours":case"hour":case"hrs":case"hr":case"h":return n*h;case"minutes":case"minute":case"mins":case"min":case"m":return n*m;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return undefined}}function fmtShort(ms){if(ms>=d){return Math.round(ms/d)+"d"}if(ms>=h){return Math.round(ms/h)+"h"}if(ms>=m){return Math.round(ms/m)+"m"}if(ms>=s){return Math.round(ms/s)+"s"}return ms+"ms"}function fmtLong(ms){return plural(ms,d,"day")||plural(ms,h,"hour")||plural(ms,m,"minute")||plural(ms,s,"second")||ms+" ms"}function plural(ms,n,name){if(ms<n){return}if(ms<n*1.5){return Math.floor(ms/n)+" "+name}return Math.ceil(ms/n)+" "+name+"s"}},{}],52:[function(require,module,exports){var keys=require("./keys");var hasBinary=require("has-binary2");var sliceBuffer=require("arraybuffer.slice");var after=require("after");var utf8=require("./utf8");var base64encoder;if(typeof ArrayBuffer!=="undefined"){base64encoder=require("base64-arraybuffer")}var isAndroid=typeof navigator!=="undefined"&&/Android/i.test(navigator.userAgent);var isPhantomJS=typeof navigator!=="undefined"&&/PhantomJS/i.test(navigator.userAgent);var dontSendBlobs=isAndroid||isPhantomJS;exports.protocol=3;var packets=exports.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6};var packetslist=keys(packets);var err={type:"error",data:"parser error"};var Blob=require("blob");exports.encodePacket=function(packet,supportsBinary,utf8encode,callback){if(typeof supportsBinary==="function"){callback=supportsBinary;supportsBinary=false}if(typeof utf8encode==="function"){callback=utf8encode;utf8encode=null}var data=packet.data===undefined?undefined:packet.data.buffer||packet.data;if(typeof ArrayBuffer!=="undefined"&&data instanceof ArrayBuffer){return encodeArrayBuffer(packet,supportsBinary,callback)}else if(typeof Blob!=="undefined"&&data instanceof Blob){return encodeBlob(packet,supportsBinary,callback)}if(data&&data.base64){return encodeBase64Object(packet,callback)}var encoded=packets[packet.type];if(undefined!==packet.data){encoded+=utf8encode?utf8.encode(String(packet.data),{strict:false}):String(packet.data)}return callback(""+encoded)};function encodeBase64Object(packet,callback){var message="b"+exports.packets[packet.type]+packet.data.data;return callback(message)}function encodeArrayBuffer(packet,supportsBinary,callback){if(!supportsBinary){return exports.encodeBase64Packet(packet,callback)}var data=packet.data;var contentArray=new Uint8Array(data);var resultBuffer=new Uint8Array(1+data.byteLength);resultBuffer[0]=packets[packet.type];for(var i=0;i<contentArray.length;i++){resultBuffer[i+1]=contentArray[i]}return callback(resultBuffer.buffer)}function encodeBlobAsArrayBuffer(packet,supportsBinary,callback){if(!supportsBinary){return exports.encodeBase64Packet(packet,callback)}var fr=new FileReader;fr.onload=function(){exports.encodePacket({type:packet.type,data:fr.result},supportsBinary,true,callback)};return fr.readAsArrayBuffer(packet.data)}function encodeBlob(packet,supportsBinary,callback){if(!supportsBinary){return exports.encodeBase64Packet(packet,callback)}if(dontSendBlobs){return encodeBlobAsArrayBuffer(packet,supportsBinary,callback)}var length=new Uint8Array(1);length[0]=packets[packet.type];var blob=new Blob([length.buffer,packet.data]);return callback(blob)}exports.encodeBase64Packet=function(packet,callback){var message="b"+exports.packets[packet.type];if(typeof Blob!=="undefined"&&packet.data instanceof Blob){var fr=new FileReader;fr.onload=function(){var b64=fr.result.split(",")[1];callback(message+b64)};return fr.readAsDataURL(packet.data)}var b64data;try{b64data=String.fromCharCode.apply(null,new Uint8Array(packet.data))}catch(e){var typed=new Uint8Array(packet.data);var basic=new Array(typed.length);for(var i=0;i<typed.length;i++){basic[i]=typed[i]}b64data=String.fromCharCode.apply(null,basic)}message+=btoa(b64data);return callback(message)};exports.decodePacket=function(data,binaryType,utf8decode){if(data===undefined){return err}if(typeof data==="string"){if(data.charAt(0)==="b"){return exports.decodeBase64Packet(data.substr(1),binaryType)}if(utf8decode){data=tryDecode(data);if(data===false){return err}}var type=data.charAt(0);if(Number(type)!=type||!packetslist[type]){return err}if(data.length>1){return{type:packetslist[type],data:data.substring(1)}}else{return{type:packetslist[type]}}}var asArray=new Uint8Array(data);var type=asArray[0];var rest=sliceBuffer(data,1);if(Blob&&binaryType==="blob"){rest=new Blob([rest])}return{type:packetslist[type],data:rest}};function tryDecode(data){try{data=utf8.decode(data,{strict:false})}catch(e){return false}return data}exports.decodeBase64Packet=function(msg,binaryType){var type=packetslist[msg.charAt(0)];if(!base64encoder){return{type:type,data:{base64:true,data:msg.substr(1)}}}var data=base64encoder.decode(msg.substr(1));if(binaryType==="blob"&&Blob){data=new Blob([data])}return{type:type,data:data}};exports.encodePayload=function(packets,supportsBinary,callback){if(typeof supportsBinary==="function"){callback=supportsBinary;supportsBinary=null}var isBinary=hasBinary(packets);if(supportsBinary&&isBinary){if(Blob&&!dontSendBlobs){return exports.encodePayloadAsBlob(packets,callback)}return exports.encodePayloadAsArrayBuffer(packets,callback)}if(!packets.length){return callback("0:")}function setLengthHeader(message){return message.length+":"+message}function encodeOne(packet,doneCallback){exports.encodePacket(packet,!isBinary?false:supportsBinary,false,(function(message){doneCallback(null,setLengthHeader(message))}))}map(packets,encodeOne,(function(err,results){return callback(results.join(""))}))};function map(ary,each,done){var result=new Array(ary.length);var next=after(ary.length,done);var eachWithIndex=function(i,el,cb){each(el,(function(error,msg){result[i]=msg;cb(error,result)}))};for(var i=0;i<ary.length;i++){eachWithIndex(i,ary[i],next)}}exports.decodePayload=function(data,binaryType,callback){if(typeof data!=="string"){return exports.decodePayloadAsBinary(data,binaryType,callback)}if(typeof binaryType==="function"){callback=binaryType;binaryType=null}var packet;if(data===""){return callback(err,0,1)}var length="",n,msg;for(var i=0,l=data.length;i<l;i++){var chr=data.charAt(i);if(chr!==":"){length+=chr;continue}if(length===""||length!=(n=Number(length))){return callback(err,0,1)}msg=data.substr(i+1,n);if(length!=msg.length){return callback(err,0,1)}if(msg.length){packet=exports.decodePacket(msg,binaryType,false);if(err.type===packet.type&&err.data===packet.data){return callback(err,0,1)}var ret=callback(packet,i+n,l);if(false===ret)return}i+=n;length=""}if(length!==""){return callback(err,0,1)}};exports.encodePayloadAsArrayBuffer=function(packets,callback){if(!packets.length){return callback(new ArrayBuffer(0))}function encodeOne(packet,doneCallback){exports.encodePacket(packet,true,true,(function(data){return doneCallback(null,data)}))}map(packets,encodeOne,(function(err,encodedPackets){var totalLength=encodedPackets.reduce((function(acc,p){var len;if(typeof p==="string"){len=p.length}else{len=p.byteLength}return acc+len.toString().length+len+2}),0);var resultArray=new Uint8Array(totalLength);var bufferIndex=0;encodedPackets.forEach((function(p){var isString=typeof p==="string";var ab=p;if(isString){var view=new Uint8Array(p.length);for(var i=0;i<p.length;i++){view[i]=p.charCodeAt(i)}ab=view.buffer}if(isString){resultArray[bufferIndex++]=0}else{resultArray[bufferIndex++]=1}var lenStr=ab.byteLength.toString();for(var i=0;i<lenStr.length;i++){resultArray[bufferIndex++]=parseInt(lenStr[i])}resultArray[bufferIndex++]=255;var view=new Uint8Array(ab);for(var i=0;i<view.length;i++){resultArray[bufferIndex++]=view[i]}}));return callback(resultArray.buffer)}))};exports.encodePayloadAsBlob=function(packets,callback){function encodeOne(packet,doneCallback){exports.encodePacket(packet,true,true,(function(encoded){var binaryIdentifier=new Uint8Array(1);binaryIdentifier[0]=1;if(typeof encoded==="string"){var view=new Uint8Array(encoded.length);for(var i=0;i<encoded.length;i++){view[i]=encoded.charCodeAt(i)}encoded=view.buffer;binaryIdentifier[0]=0}var len=encoded instanceof ArrayBuffer?encoded.byteLength:encoded.size;var lenStr=len.toString();var lengthAry=new Uint8Array(lenStr.length+1);for(var i=0;i<lenStr.length;i++){lengthAry[i]=parseInt(lenStr[i])}lengthAry[lenStr.length]=255;if(Blob){var blob=new Blob([binaryIdentifier.buffer,lengthAry.buffer,encoded]);doneCallback(null,blob)}}))}map(packets,encodeOne,(function(err,results){return callback(new Blob(results))}))};exports.decodePayloadAsBinary=function(data,binaryType,callback){if(typeof binaryType==="function"){callback=binaryType;binaryType=null}var bufferTail=data;var buffers=[];while(bufferTail.byteLength>0){var tailArray=new Uint8Array(bufferTail);var isString=tailArray[0]===0;var msgLength="";for(var i=1;;i++){if(tailArray[i]===255)break;if(msgLength.length>310){return callback(err,0,1)}msgLength+=tailArray[i]}bufferTail=sliceBuffer(bufferTail,2+msgLength.length);msgLength=parseInt(msgLength);var msg=sliceBuffer(bufferTail,0,msgLength);if(isString){try{msg=String.fromCharCode.apply(null,new Uint8Array(msg))}catch(e){var typed=new Uint8Array(msg);msg="";for(var i=0;i<typed.length;i++){msg+=String.fromCharCode(typed[i])}}}buffers.push(msg);bufferTail=sliceBuffer(bufferTail,msgLength)}var total=buffers.length;buffers.forEach((function(buffer,i){callback(exports.decodePacket(buffer,binaryType,true),i,total)}))}},{"./keys":53,"./utf8":54,after:15,"arraybuffer.slice":16,"base64-arraybuffer":22,blob:24,"has-binary2":56}],53:[function(require,module,exports){module.exports=Object.keys||function keys(obj){var arr=[];var has=Object.prototype.hasOwnProperty;for(var i in obj){if(has.call(obj,i)){arr.push(i)}}return arr}},{}],54:[function(require,module,exports){
/*! https://mths.be/utf8js v2.1.2 by @mathias */
var stringFromCharCode=String.fromCharCode;function ucs2decode(string){var output=[];var counter=0;var length=string.length;var value;var extra;while(counter<length){value=string.charCodeAt(counter++);if(value>=55296&&value<=56319&&counter<length){extra=string.charCodeAt(counter++);if((extra&64512)==56320){output.push(((value&1023)<<10)+(extra&1023)+65536)}else{output.push(value);counter--}}else{output.push(value)}}return output}function ucs2encode(array){var length=array.length;var index=-1;var value;var output="";while(++index<length){value=array[index];if(value>65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value)}return output}function checkScalarValue(codePoint,strict){if(codePoint>=55296&&codePoint<=57343){if(strict){throw Error("Lone surrogate U+"+codePoint.toString(16).toUpperCase()+" is not a scalar value")}return false}return true}function createByte(codePoint,shift){return stringFromCharCode(codePoint>>shift&63|128)}function encodeCodePoint(codePoint,strict){if((codePoint&4294967168)==0){return stringFromCharCode(codePoint)}var symbol="";if((codePoint&4294965248)==0){symbol=stringFromCharCode(codePoint>>6&31|192)}else if((codePoint&4294901760)==0){if(!checkScalarValue(codePoint,strict)){codePoint=65533}symbol=stringFromCharCode(codePoint>>12&15|224);symbol+=createByte(codePoint,6)}else if((codePoint&4292870144)==0){symbol=stringFromCharCode(codePoint>>18&7|240);symbol+=createByte(codePoint,12);symbol+=createByte(codePoint,6)}symbol+=stringFromCharCode(codePoint&63|128);return symbol}function utf8encode(string,opts){opts=opts||{};var strict=false!==opts.strict;var codePoints=ucs2decode(string);var length=codePoints.length;var index=-1;var codePoint;var byteString="";while(++index<length){codePoint=codePoints[index];byteString+=encodeCodePoint(codePoint,strict)}return byteString}function readContinuationByte(){if(byteIndex>=byteCount){throw Error("Invalid byte index")}var continuationByte=byteArray[byteIndex]&255;byteIndex++;if((continuationByte&192)==128){return continuationByte&63}throw Error("Invalid continuation byte")}function decodeSymbol(strict){var byte1;var byte2;var byte3;var byte4;var codePoint;if(byteIndex>byteCount){throw Error("Invalid byte index")}if(byteIndex==byteCount){return false}byte1=byteArray[byteIndex]&255;byteIndex++;if((byte1&128)==0){return byte1}if((byte1&224)==192){byte2=readContinuationByte();codePoint=(byte1&31)<<6|byte2;if(codePoint>=128){return codePoint}else{throw Error("Invalid continuation byte")}}if((byte1&240)==224){byte2=readContinuationByte();byte3=readContinuationByte();codePoint=(byte1&15)<<12|byte2<<6|byte3;if(codePoint>=2048){return checkScalarValue(codePoint,strict)?codePoint:65533}else{throw Error("Invalid continuation byte")}}if((byte1&248)==240){byte2=readContinuationByte();byte3=readContinuationByte();byte4=readContinuationByte();codePoint=(byte1&7)<<18|byte2<<12|byte3<<6|byte4;if(codePoint>=65536&&codePoint<=1114111){return codePoint}}throw Error("Invalid UTF-8 detected")}var byteArray;var byteCount;var byteIndex;function utf8decode(byteString,opts){opts=opts||{};var strict=false!==opts.strict;byteArray=ucs2decode(byteString);byteCount=byteArray.length;byteIndex=0;var codePoints=[];var tmp;while((tmp=decodeSymbol(strict))!==false){codePoints.push(tmp)}return ucs2encode(codePoints)}module.exports={version:"2.1.2",encode:utf8encode,decode:utf8decode}},{}],55:[function(require,module,exports){module.exports=function getBrowserRTC(){if(typeof window==="undefined")return null;var wrtc={RTCPeerConnection:window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,RTCSessionDescription:window.RTCSessionDescription||window.mozRTCSessionDescription||window.webkitRTCSessionDescription,RTCIceCandidate:window.RTCIceCandidate||window.mozRTCIceCandidate||window.webkitRTCIceCandidate};if(!wrtc.RTCPeerConnection)return null;return wrtc}},{}],56:[function(require,module,exports){(function(Buffer){(function(){var isArray=require("isarray");var toString=Object.prototype.toString;var withNativeBlob=typeof Blob==="function"||typeof Blob!=="undefined"&&toString.call(Blob)==="[object BlobConstructor]";var withNativeFile=typeof File==="function"||typeof File!=="undefined"&&toString.call(File)==="[object FileConstructor]";module.exports=hasBinary;function hasBinary(obj){if(!obj||typeof obj!=="object"){return false}if(isArray(obj)){for(var i=0,l=obj.length;i<l;i++){if(hasBinary(obj[i])){return true}}return false}if(typeof Buffer==="function"&&Buffer.isBuffer&&Buffer.isBuffer(obj)||typeof ArrayBuffer==="function"&&obj instanceof ArrayBuffer||withNativeBlob&&obj instanceof Blob||withNativeFile&&obj instanceof File){return true}if(obj.toJSON&&typeof obj.toJSON==="function"&&arguments.length===1){return hasBinary(obj.toJSON(),true)}for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key)&&hasBinary(obj[key])){return true}}return false}}).call(this)}).call(this,require("buffer").Buffer)},{buffer:27,isarray:57}],57:[function(require,module,exports){var toString={}.toString;module.exports=Array.isArray||function(arr){return toString.call(arr)=="[object Array]"}},{}],58:[function(require,module,exports){try{module.exports=typeof XMLHttpRequest!=="undefined"&&"withCredentials"in new XMLHttpRequest}catch(err){module.exports=false}},{}],59:[function(require,module,exports){const Output=require("./src/output.js");const loop=require("raf-loop");const Source=require("./src/hydra-source.js");const Mouse=require("./src/lib/mouse.js")();const Audio=require("./src/lib/audio.js");const VidRecorder=require("./src/lib/video-recorder.js");const ArrayUtils=require("./src/lib/array-utils.js");const Sandbox=require("./src/eval-sandbox.js");const Generator=require("./src/generator-factory.js");class HydraRenderer{constructor({pb:pb=null,width:width=1280,height:height=720,numSources:numSources=4,numOutputs:numOutputs=4,makeGlobal:makeGlobal=true,autoLoop:autoLoop=true,detectAudio:detectAudio=true,enableStreamCapture:enableStreamCapture=true,canvas:canvas,precision:precision,extendTransforms:extendTransforms={}}={}){ArrayUtils.init();this.pb=pb;this.width=width;this.height=height;this.renderAll=false;this.detectAudio=detectAudio;this._initCanvas(canvas);this.synth={time:0,bpm:30,width:this.width,height:this.height,fps:undefined,stats:{fps:0},speed:1,mouse:Mouse,render:this._render.bind(this),setResolution:this.setResolution.bind(this),update:dt=>{},hush:this.hush.bind(this)};if(makeGlobal)window.loadScript=this.loadScript;this.timeSinceLastUpdate=0;this._time=0;let precisionOptions=["lowp","mediump","highp"];if(precision&&precisionOptions.includes(precision.toLowerCase())){this.precision=precision.toLowerCase()}else{let isIOS=(/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1)&&!window.MSStream;this.precision=isIOS?"highp":"mediump"}this.extendTransforms=extendTransforms;this.saveFrame=false;this.captureStream=null;this.generator=undefined;this._initRegl();this._initOutputs(numOutputs);this._initSources(numSources);this._generateGlslTransforms();this.synth.screencap=()=>{this.saveFrame=true};if(enableStreamCapture){try{this.captureStream=this.canvas.captureStream(25);this.synth.vidRecorder=new VidRecorder(this.captureStream)}catch(e){console.warn("[hydra-synth warning]\nnew MediaSource() is not currently supported on iOS.");console.error(e)}}if(detectAudio)this._initAudio();if(autoLoop)loop(this.tick.bind(this)).start();this.sandbox=new Sandbox(this.synth,makeGlobal,["speed","update","bpm","fps"])}eval(code){this.sandbox.eval(code)}getScreenImage(callback){this.imageCallback=callback;this.saveFrame=true}hush(){this.s.forEach((source=>{source.clear()}));this.o.forEach((output=>{this.synth.solid(1,1,1,0).out(output)}))}loadScript(url=""){const p=new Promise(((res,rej)=>{var script=document.createElement("script");script.onload=function(){console.log(`loaded script ${url}`);res()};script.onerror=err=>{console.log(`error loading script ${url}`,"log-error");res()};script.src=url;document.head.appendChild(script)}));return p}setResolution(width,height){this.canvas.width=width;this.canvas.height=height;this.width=width;this.height=height;this.o.forEach((output=>{output.resize(width,height)}));this.s.forEach((source=>{source.resize(width,height)}));this.regl._refresh();console.log(this.canvas.width)}canvasToImage(callback){const a=document.createElement("a");a.style.display="none";let d=new Date;a.download=`hydra-${d.getFullYear()}-${d.getMonth()+1}-${d.getDate()}-${d.getHours()}.${d.getMinutes()}.${d.getSeconds()}.png`;document.body.appendChild(a);var self=this;this.canvas.toBlob((blob=>{if(self.imageCallback){self.imageCallback(blob);delete self.imageCallback}else{a.href=URL.createObjectURL(blob);console.log(a.href);a.click()}}),"image/png");setTimeout((()=>{document.body.removeChild(a);window.URL.revokeObjectURL(a.href)}),300)}_initAudio(){const that=this;this.synth.a=new Audio({numBins:4})}_initCanvas(canvas){if(canvas){this.canvas=canvas;this.width=canvas.width;this.height=canvas.height}else{this.canvas=document.createElement("canvas");this.canvas.width=this.width;this.canvas.height=this.height;this.canvas.style.width="100%";this.canvas.style.height="100%";this.canvas.style.imageRendering="pixelated";document.body.appendChild(this.canvas)}}_initRegl(){this.regl=require("regl")({canvas:this.canvas,pixelRatio:1});this.regl.clear({color:[0,0,0,1]});this.renderAll=this.regl({frag:`\n precision ${this.precision} float;\n varying vec2 uv;\n uniform sampler2D tex0;\n uniform sampler2D tex1;\n uniform sampler2D tex2;\n uniform sampler2D tex3;\n\n void main () {\n vec2 st = vec2(1.0 - uv.x, uv.y);\n st*= vec2(2);\n vec2 q = floor(st).xy*(vec2(2.0, 1.0));\n int quad = int(q.x) + int(q.y);\n st.x += step(1., mod(st.y,2.0));\n st.y += step(1., mod(st.x,2.0));\n st = fract(st);\n if(quad==0){\n gl_FragColor = texture2D(tex0, st);\n } else if(quad==1){\n gl_FragColor = texture2D(tex1, st);\n } else if (quad==2){\n gl_FragColor = texture2D(tex2, st);\n } else {\n gl_FragColor = texture2D(tex3, st);\n }\n\n }\n `,vert:`\n precision ${this.precision} float;\n attribute vec2 position;\n varying vec2 uv;\n\n void main () {\n uv = position;\n gl_Position = vec4(1.0 - 2.0 * position, 0, 1);\n }`,attributes:{position:[[-2,0],[0,-2],[2,2]]},uniforms:{tex0:this.regl.prop("tex0"),tex1:this.regl.prop("tex1"),tex2:this.regl.prop("tex2"),tex3:this.regl.prop("tex3")},count:3,depth:{enable:false}});this.renderFbo=this.regl({frag:`\n precision ${this.precision} float;\n varying vec2 uv;\n uniform vec2 resolution;\n uniform sampler2D tex0;\n\n void main () {\n gl_FragColor = texture2D(tex0, vec2(1.0 - uv.x, uv.y));\n }\n `,vert:`\n precision ${this.precision} float;\n attribute vec2 position;\n varying vec2 uv;\n\n void main () {\n uv = position;\n gl_Position = vec4(1.0 - 2.0 * position, 0, 1);\n }`,attributes:{position:[[-2,0],[0,-2],[2,2]]},uniforms:{tex0:this.regl.prop("tex0"),resolution:this.regl.prop("resolution")},count:3,depth:{enable:false}})}_initOutputs(numOutputs){const self=this;this.o=Array(numOutputs).fill().map(((el,index)=>{var o=new Output({regl:this.regl,width:this.width,height:this.height,precision:this.precision,label:`o${index}`});o.id=index;self.synth["o"+index]=o;return o}));this.output=this.o[0]}_initSources(numSources){this.s=[];for(var i=0;i<numSources;i++){this.createSource(i)}}createSource(i){let s=new Source({regl:this.regl,pb:this.pb,width:this.width,height:this.height,label:`s${i}`});this.synth["s"+this.s.length]=s;this.s.push(s);return s}_generateGlslTransforms(){var self=this;this.generator=new Generator({defaultOutput:this.o[0],defaultUniforms:this.o[0].uniforms,extendTransforms:this.extendTransforms,changeListener:({type:type,method:method,synth:synth})=>{if(type==="add"){self.synth[method]=synth.generators[method];if(self.sandbox)self.sandbox.add(method)}else if(type==="remove"){}}});this.synth.setFunction=this.generator.setFunction.bind(this.generator)}_render(output){if(output){this.output=output;this.isRenderingAll=false}else{this.isRenderingAll=true}}tick(dt,uniforms){this.sandbox.tick();if(this.detectAudio===true)this.synth.a.tick();if(this.synth.update){try{this.synth.update(dt)}catch(e){console.log(error)}}this.sandbox.set("time",this.synth.time+=dt*.001*this.synth.speed);this.timeSinceLastUpdate+=dt;if(!this.synth.fps||this.timeSinceLastUpdate>=1e3/this.synth.fps){this.synth.stats.fps=Math.ceil(1e3/this.timeSinceLastUpdate);for(let i=0;i<this.s.length;i++){this.s[i].tick(this.synth.time)}for(let i=0;i<this.o.length;i++){this.o[i].tick({time:this.synth.time,mouse:this.synth.mouse,bpm:this.synth.bpm,resolution:[this.canvas.width,this.canvas.height]})}if(this.isRenderingAll){this.renderAll({tex0:this.o[0].getCurrent(),tex1:this.o[1].getCurrent(),tex2:this.o[2].getCurrent(),tex3:this.o[3].getCurrent(),resolution:[this.canvas.width,this.canvas.height]})}else{this.renderFbo({tex0:this.output.getCurrent(),resolution:[this.canvas.width,this.canvas.height]})}this.timeSinceLastUpdate=0}if(this.saveFrame===true){this.canvasToImage();this.saveFrame=false}}}module.exports=HydraRenderer},{"./src/eval-sandbox.js":61,"./src/generator-factory.js":62,"./src/hydra-source.js":67,"./src/lib/array-utils.js":68,"./src/lib/audio.js":69,"./src/lib/mouse.js":72,"./src/lib/video-recorder.js":75,"./src/output.js":77,"raf-loop":113,regl:125}],60:[function(require,module,exports){const Synth=require("./hydra-synth.js");module.exports=Synth},{"./hydra-synth.js":59}],61:[function(require,module,exports){const Sandbox=require("./lib/sandbox.js");const ArrayUtils=require("./lib/array-utils.js");class EvalSandbox{constructor(parent,makeGlobal,userProps=[]){this.makeGlobal=makeGlobal;this.sandbox=Sandbox(parent);this.parent=parent;var properties=Object.keys(parent);properties.forEach((property=>this.add(property)));this.userProps=userProps}add(name){if(this.makeGlobal)window[name]=this.parent[name];this.sandbox.addToContext(name,`parent.${name}`)}set(property,value){if(this.makeGlobal){window[property]=value}this.parent[property]=value}tick(){if(this.makeGlobal){this.userProps.forEach((property=>{this.parent[property]=window[property]}))}else{}}eval(code){this.sandbox.eval(code)}}module.exports=EvalSandbox},{"./lib/array-utils.js":68,"./lib/sandbox.js":73}],62:[function(require,module,exports){const GlslSource=require("./glsl-source.js");class GeneratorFactory{constructor({defaultUniforms:defaultUniforms,defaultOutput:defaultOutput,extendTransforms:extendTransforms=[],changeListener:changeListener=(()=>{})}={}){this.defaultOutput=defaultOutput;this.defaultUniforms=defaultUniforms;this.changeListener=changeListener;this.extendTransforms=extendTransforms;this.generators={};this.init()}init(){this.glslTransforms={};this.generators=Object.entries(this.generators).reduce(((prev,[method,transform])=>{this.changeListener({type:"remove",synth:this,method:method});return prev}),{});this.sourceClass=(()=>class extends GlslSource{})();let functions=require("./glsl/glsl-functions.js")();if(Array.isArray(this.extendTransforms)){functions.concat(this.extendTransforms)}else if(typeof this.extendTransforms==="object"&&this.extendTransforms.type){functions.push(this.extendTransforms)}return functions.map((transform=>this.setFunction(transform)))}_addMethod(method,transform){this.glslTransforms[method]=transform;if(transform.type==="src"){const func=(...args)=>new this.sourceClass({name:method,transform:transform,userArgs:args,defaultOutput:this.defaultOutput,defaultUniforms:this.defaultUniforms,synth:this});this.generators[method]=func;this.changeListener({type:"add",synth:this,method:method});return func}else{this.sourceClass.prototype[method]=function(...args){this.transforms.push({name:method,transform:transform,userArgs:args});return this}}return undefined}setFunction(obj){var processedGlsl=processGlsl(obj);if(processedGlsl)this._addMethod(obj.name,processedGlsl)}}const typeLookup={src:{returnType:"vec4",args:["vec2 _st"]},coord:{returnType:"vec2",args:["vec2 _st"]},color:{returnType:"vec4",args:["vec4 _c0"]},combine:{returnType:"vec4",args:["vec4 _c0","vec4 _c1"]},combineCoord:{returnType:"vec2",args:["vec2 _st","vec4 _c0"]}};function processGlsl(obj){let t=typeLookup[obj.type];if(t){let baseArgs=t.args.map((arg=>arg)).join(", ");let customArgs=obj.inputs.map((input=>`${input.type} ${input.name}`)).join(", ");let args=`${baseArgs}${customArgs.length>0?", "+customArgs:""}`;let glslFunction=`\n ${t.returnType} ${obj.name}(${args}) {\n ${obj.glsl}\n }\n`;if(obj.type==="combine"||obj.type==="combineCoord")obj.inputs.unshift({name:"color",type:"vec4"});return Object.assign({},obj,{glsl:glslFunction})}else{console.warn(`type ${obj.type} not recognized`,obj)}}module.exports=GeneratorFactory},{"./glsl-source.js":63,"./glsl/glsl-functions.js":65}],63:[function(require,module,exports){const generateGlsl=require("./glsl-utils.js").generateGlsl;const formatArguments=require("./glsl-utils.js").formatArguments;const utilityGlsl=require("./glsl/utility-functions.js");var GlslSource=function(obj){this.transforms=[];this.transforms.push(obj);this.defaultOutput=obj.defaultOutput;this.synth=obj.synth;this.type="GlslSource";this.defaultUniforms=obj.defaultUniforms;return this};GlslSource.prototype.addTransform=function(obj){this.transforms.push(obj)};GlslSource.prototype.out=function(_output){var output=_output||this.defaultOutput;var glsl=this.glsl(output);this.synth.currentFunctions=[];if(output)try{output.render(glsl)}catch(error){console.log("shader could not compile",error)}};GlslSource.prototype.glsl=function(){var self=this;var passes=[];var transforms=[];this.transforms.forEach((transform=>{if(transform.transform.type==="renderpass"){console.warn("no support for renderpass")}else{transforms.push(transform)}}));if(transforms.length>0)passes.push(this.compile(transforms));return passes};GlslSource.prototype.compile=function(transforms){var shaderInfo=generateGlsl(transforms);var uniforms={};shaderInfo.uniforms.forEach((uniform=>{uniforms[uniform.name]=uniform.value}));var frag=`\n precision ${this.defaultOutput.precision} float;\n ${Object.values(shaderInfo.uniforms).map((uniform=>{let type=uniform.type;switch(uniform.type){case"texture":type="sampler2D";break}return`\n uniform ${type} ${uniform.name};`})).join("")}\n uniform float time;\n uniform vec2 resolution;\n varying vec2 uv;\n uniform sampler2D prevBuffer;\n\n ${Object.values(utilityGlsl).map((transform=>`\n ${transform.glsl}\n `)).join("")}\n\n ${shaderInfo.glslFunctions.map((transform=>`\n ${transform.transform.glsl}\n `)).join("")}\n\n void main () {\n vec4 c = vec4(1, 0, 0, 1);\n vec2 st = gl_FragCoord.xy/resolution.xy;\n gl_FragColor = ${shaderInfo.fragColor};\n }\n `;return{frag:frag,uniforms:Object.assign({},this.defaultUniforms,uniforms)}};module.exports=GlslSource},{"./glsl-utils.js":64,"./glsl/utility-functions.js":66}],64:[function(require,module,exports){const arrayUtils=require("./lib/array-utils.js");const DEFAULT_CONVERSIONS={float:{vec4:{name:"sum",args:[[1,1,1,1]]},vec2:{name:"sum",args:[[1,1]]}}};module.exports={generateGlsl:function(transforms){var shaderParams={uniforms:[],glslFunctions:[],fragColor:""};var gen=generateGlsl(transforms,shaderParams)("st");shaderParams.fragColor=gen;let uniforms={};shaderParams.uniforms.forEach((uniform=>uniforms[uniform.name]=uniform));shaderParams.uniforms=Object.values(uniforms);return shaderParams},formatArguments:formatArguments};function generateGlsl(transforms,shaderParams){var fragColor=()=>"";transforms.forEach((transform=>{var inputs=formatArguments(transform,shaderParams.uniforms.length);inputs.forEach((input=>{if(input.isUniform)shaderParams.uniforms.push(input)}));if(!contains(transform,shaderParams.glslFunctions))shaderParams.glslFunctions.push(transform);var f0=fragColor;if(transform.transform.type==="src"){fragColor=uv=>`${shaderString(uv,transform.name,inputs,shaderParams)}`}else if(transform.transform.type==="coord"){fragColor=uv=>`${f0(`${shaderString(uv,transform.name,inputs,shaderParams)}`)}`}else if(transform.transform.type==="color"){fragColor=uv=>`${shaderString(`${f0(uv)}`,transform.name,inputs,shaderParams)}`}else if(transform.transform.type==="combine"){var f1=inputs[0].value&&inputs[0].value.transforms?uv=>`${generateGlsl(inputs[0].value.transforms,shaderParams)(uv)}`:inputs[0].isUniform?()=>inputs[0].name:()=>inputs[0].value;fragColor=uv=>`${shaderString(`${f0(uv)}, ${f1(uv)}`,transform.name,inputs.slice(1),shaderParams)}`}else if(transform.transform.type==="combineCoord"){var f1=inputs[0].value&&inputs[0].value.transforms?uv=>`${generateGlsl(inputs[0].value.transforms,shaderParams)(uv)}`:inputs[0].isUniform?()=>inputs[0].name:()=>inputs[0].value;fragColor=uv=>`${f0(`${shaderString(`${uv}, ${f1(uv)}`,transform.name,inputs.slice(1),shaderParams)}`)}`}}));return fragColor}function shaderString(uv,method,inputs,shaderParams){const str=inputs.map((input=>{if(input.isUniform){return input.name}else if(input.value&&input.value.transforms){return`${generateGlsl(input.value.transforms,shaderParams)("st")}`}return input.value})).reduce(((p,c)=>`${p}, ${c}`),"");return`${method}(${uv}${str})`}function mergeArrays(a,b){return a.concat(b.filter((function(item){return a.indexOf(item)<0})))}function contains(object,arr){for(var i=0;i<arr.length;i++){if(object.name==arr[i].name)return true}return false}function fillArrayWithDefaults(arr,len){while(arr.length<len){if(arr.length===3){arr.push(1)}else{arr.push(0)}}return arr.slice(0,len)}const ensure_decimal_dot=val=>{val=val.toString();if(val.indexOf(".")<0){val+="."}return val};function formatArguments(transform,startIndex){const defaultArgs=transform.transform.inputs;const userArgs=transform.userArgs;return defaultArgs.map(((input,index)=>{const typedArg={value:input.default,type:input.type,isUniform:false,name:input.name,vecLen:0};if(typedArg.type==="float")typedArg.value=ensure_decimal_dot(input.default);if(input.type.startsWith("vec")){try{typedArg.vecLen=Number.parseInt(input.type.substr(3))}catch(e){console.log(`Error determining length of vector input type ${input.type} (${input.name})`)}}if(userArgs.length>index){typedArg.value=userArgs[index];if(typeof userArgs[index]==="function"){if(typedArg.vecLen>0){typedArg.value=(context,props,batchId)=>fillArrayWithDefaults(userArgs[index](props),typedArg.vecLen)}else{typedArg.value=(context,props,batchId)=>{try{return userArgs[index](props)}catch(e){console.log("ERROR",e);return input.default}}}typedArg.isUniform=true}else if(userArgs[index].constructor===Array){if(typedArg.vecLen>0){typedArg.isUniform=true;typedArg.value=fillArrayWithDefaults(typedArg.value,typedArg.vecLen)}else{typedArg.value=(context,props,batchId)=>arrayUtils.getValue(userArgs[index])(props);typedArg.isUniform=true}}}if(startIndex<0){}else{if(typedArg.value&&typedArg.value.transforms){const final_transform=typedArg.value.transforms[typedArg.value.transforms.length-1];if(final_transform.transform.glsl_return_type!==input.type){const defaults=DEFAULT_CONVERSIONS[input.type];if(typeof defaults!=="undefined"){const default_def=defaults[final_transform.transform.glsl_return_type];if(typeof default_def!=="undefined"){const{name:name,args:args}=default_def;typedArg.value=typedArg.value[name](...args)}}}typedArg.isUniform=false}else if(typedArg.type==="float"&&typeof typedArg.value==="number"){typedArg.value=ensure_decimal_dot(typedArg.value)}else if(typedArg.type.startsWith("vec")&&typeof typedArg.value==="object"&&Array.isArray(typedArg.value)){typedArg.isUniform=false;typedArg.value=`${typedArg.type}(${typedArg.value.map(ensure_decimal_dot).join(", ")})`}else if(input.type==="sampler2D"){var x=typedArg.value;typedArg.value=()=>x.getTexture();typedArg.isUniform=true}else{if(typedArg.value.getTexture&&input.type==="vec4"){var x1=typedArg.value;typedArg.value=src(x1);typedArg.isUniform=false}}if(typedArg.isUniform){typedArg.name+=startIndex}}return typedArg}))}},{"./lib/array-utils.js":68}],65:[function(require,module,exports){module.exports=()=>[{name:"noise",type:"src",inputs:[{type:"float",name:"scale",default:10},{type:"float",name:"offset",default:.1}],glsl:` return vec4(vec3(_noise(vec3(_st*scale, offset*time))), 1.0);`},{name:"voronoi",type:"src",inputs:[{type:"float",name:"scale",default:5},{type:"float",name:"speed",default:.3},{type:"float",name:"blending",default:.3}],glsl:` vec3 color = vec3(.0);\n // Scale\n _st *= scale;\n // Tile the space\n vec2 i_st = floor(_st);\n vec2 f_st = fract(_st);\n float m_dist = 10.; // minimun distance\n vec2 m_point; // minimum point\n for (int j=-1; j<=1; j++ ) {\n for (int i=-1; i<=1; i++ ) {\n vec2 neighbor = vec2(float(i),float(j));\n vec2 p = i_st + neighbor;\n vec2 point = fract(sin(vec2(dot(p,vec2(127.1,311.7)),dot(p,vec2(269.5,183.3))))*43758.5453);\n point = 0.5 + 0.5*sin(time*speed + 6.2831*point);\n vec2 diff = neighbor + point - f_st;\n float dist = length(diff);\n if( dist < m_dist ) {\n m_dist = dist;\n m_point = point;\n }\n }\n }\n // Assign a color using the closest point position\n color += dot(m_point,vec2(.3,.6));\n color *= 1.0 - blending*m_dist;\n return vec4(color, 1.0);`},{name:"osc",type:"src",inputs:[{type:"float",name:"frequency",default:60},{type:"float",name:"sync",default:.1},{type:"float",name:"offset",default:0}],glsl:` vec2 st = _st;\n float r = sin((st.x-offset/frequency+time*sync)*frequency)*0.5 + 0.5;\n float g = sin((st.x+time*sync)*frequency)*0.5 + 0.5;\n float b = sin((st.x+offset/frequency+time*sync)*frequency)*0.5 + 0.5;\n return vec4(r, g, b, 1.0);`},{name:"shape",type:"src",inputs:[{type:"float",name:"sides",default:3},{type:"float",name:"radius",default:.3},{type:"float",name:"smoothing",default:.01}],glsl:` vec2 st = _st * 2. - 1.;\n // Angle and radius from the current pixel\n float a = atan(st.x,st.y)+3.1416;\n float r = (2.*3.1416)/sides;\n float d = cos(floor(.5+a/r)*r-a)*length(st);\n return vec4(vec3(1.0-smoothstep(radius,radius + smoothing + 0.0000001,d)), 1.0);`},{name:"gradient",type:"src",inputs:[{type:"float",name:"speed",default:0}],glsl:` return vec4(_st, sin(time*speed), 1.0);`},{name:"src",type:"src",inputs:[{type:"sampler2D",name:"tex",default:NaN}],glsl:` // vec2 uv = gl_FragCoord.xy/vec2(1280., 720.);\n return texture2D(tex, fract(_st));`},{name:"solid",type:"src",inputs:[{type:"float",name:"r",default:0},{type:"float",name:"g",default:0},{type:"float",name:"b",default:0},{type:"float",name:"a",default:1}],glsl:` return vec4(r, g, b, a);`},{name:"rotate",type:"coord",inputs:[{type:"float",name:"angle",default:10},{type:"float",name:"speed",default:0}],glsl:` vec2 xy = _st - vec2(0.5);\n float ang = angle + speed *time;\n xy = mat2(cos(ang),-sin(ang), sin(ang),cos(ang))*xy;\n xy += 0.5;\n return xy;`},{name:"scale",type:"coord",inputs:[{type:"float",name:"amount",default:1.5},{type:"float",name:"xMult",default:1},{type:"float",name:"yMult",default:1},{type:"float",name:"offsetX",default:.5},{type:"float",name:"offsetY",default:.5}],glsl:` vec2 xy = _st - vec2(offsetX, offsetY);\n xy*=(1.0/vec2(amount*xMult, amount*yMult));\n xy+=vec2(offsetX, offsetY);\n return xy;\n `},{name:"pixelate",type:"coord",inputs:[{type:"float",name:"pixelX",default:20},{type:"float",name:"pixelY",default:20}],glsl:` vec2 xy = vec2(pixelX, pixelY);\n return (floor(_st * xy) + 0.5)/xy;`},{name:"posterize",type:"color",inputs:[{type:"float",name:"bins",default:3},{type:"float",name:"gamma",default:.6}],glsl:` vec4 c2 = pow(_c0, vec4(gamma));\n c2 *= vec4(bins);\n c2 = floor(c2);\n c2/= vec4(bins);\n c2 = pow(c2, vec4(1.0/gamma));\n return vec4(c2.xyz, _c0.a);`},{name:"shift",type:"color",inputs:[{type:"float",name:"r",default:.5},{type:"float",name:"g",default:0},{type:"float",name:"b",default:0},{type:"float",name:"a",default:0}],glsl:` vec4 c2 = vec4(_c0);\n c2.r = fract(c2.r + r);\n c2.g = fract(c2.g + g);\n c2.b = fract(c2.b + b);\n c2.a = fract(c2.a + a);\n return vec4(c2.rgba);`},{name:"repeat",type:"coord",inputs:[{type:"float",name:"repeatX",default:3},{type:"float",name:"repeatY",default:3},{type:"float",name:"offsetX",default:0},{type:"float",name:"offsetY",default:0}],glsl:` vec2 st = _st * vec2(repeatX, repeatY);\n st.x += step(1., mod(st.y,2.0)) * offsetX;\n st.y += step(1., mod(st.x,2.0)) * offsetY;\n return fract(st);`},{name:"modulateRepeat",type:"combineCoord",inputs:[{type:"float",name:"repeatX",default:3},{type:"float",name:"repeatY",default:3},{type:"float",name:"offsetX",default:.5},{type:"float",name:"offsetY",default:.5}],glsl:` vec2 st = _st * vec2(repeatX, repeatY);\n st.x += step(1., mod(st.y,2.0)) + _c0.r * offsetX;\n st.y += step(1., mod(st.x,2.0)) + _c0.g * offsetY;\n return fract(st);`},{name:"repeatX",type:"coord",inputs:[{type:"float",name:"reps",default:3},{type:"float",name:"offset",default:0}],glsl:` vec2 st = _st * vec2(reps, 1.0);\n // float f = mod(_st.y,2.0);\n st.y += step(1., mod(st.x,2.0))* offset;\n return fract(st);`},{name:"modulateRepeatX",type:"combineCoord",inputs:[{type:"float",name:"reps",default:3},{type:"float",name:"offset",default:.5}],glsl:` vec2 st = _st * vec2(reps, 1.0);\n // float f = mod(_st.y,2.0);\n st.y += step(1., mod(st.x,2.0)) + _c0.r * offset;\n return fract(st);`},{name:"repeatY",type:"coord",inputs:[{type:"float",name:"reps",default:3},{type:"float",name:"offset",default:0}],glsl:` vec2 st = _st * vec2(1.0, reps);\n // float f = mod(_st.y,2.0);\n st.x += step(1., mod(st.y,2.0))* offset;\n return fract(st);`},{name:"modulateRepeatY",type:"combineCoord",inputs:[{type:"float",name:"reps",default:3},{type:"float",name:"offset",default:.5}],glsl:` vec2 st = _st * vec2(reps, 1.0);\n // float f = mod(_st.y,2.0);\n st.x += step(1., mod(st.y,2.0)) + _c0.r * offset;\n return fract(st);`},{name:"kaleid",type:"coord",inputs:[{type:"float",name:"nSides",default:4}],glsl:` vec2 st = _st;\n st -= 0.5;\n float r = length(st);\n float a = atan(st.y, st.x);\n float pi = 2.*3.1416;\n a = mod(a,pi/nSides);\n a = abs(a-pi/nSides/2.);\n return r*vec2(cos(a), sin(a));`},{name:"modulateKaleid",type:"combineCoord",inputs:[{type:"float",name:"nSides",default:4}],glsl:` vec2 st = _st - 0.5;\n float r = length(st);\n float a = atan(st.y, st.x);\n float pi = 2.*3.1416;\n a = mod(a,pi/nSides);\n a = abs(a-pi/nSides/2.);\n return (_c0.r+r)*vec2(cos(a), sin(a));`},{name:"scroll",type:"coord",inputs:[{type:"float",name:"scrollX",default:.5},{type:"float",name:"scrollY",default:.5},{type:"float",name:"speedX",default:0},{type:"float",name:"speedY",default:0}],glsl:`\n _st.x += scrollX + time*speedX;\n _st.y += scrollY + time*speedY;\n return fract(_st);`},{name:"scrollX",type:"coord",inputs:[{type:"float",name:"scrollX",default:.5},{type:"float",name:"speed",default:0}],glsl:` _st.x += scrollX + time*speed;\n return fract(_st);`},{name:"modulateScrollX",type:"combineCoord",inputs:[{type:"float",name:"scrollX",default:.5},{type:"float",name:"speed",default:0}],glsl:` _st.x += _c0.r*scrollX + time*speed;\n return fract(_st);`},{name:"scrollY",type:"coord",inputs:[{type:"float",name:"scrollY",default:.5},{type:"float",name:"speed",default:0}],glsl:` _st.y += scrollY + time*speed;\n return fract(_st);`},{name:"modulateScrollY",type:"combineCoord",inputs:[{type:"float",name:"scrollY",default:.5},{type:"float",name:"speed",default:0}],glsl:` _st.y += _c0.r*scrollY + time*speed;\n return fract(_st);`},{name:"add",type:"combine",inputs:[{type:"float",name:"amount",default:1}],glsl:` return (_c0+_c1)*amount + _c0*(1.0-amount);`},{name:"sub",type:"combine",inputs:[{type:"float",name:"amount",default:1}],glsl:` return (_c0-_c1)*amount + _c0*(1.0-amount);`},{name:"layer",type:"combine",inputs:[],glsl:` return vec4(mix(_c0.rgb, _c1.rgb, _c1.a), _c0.a+_c1.a);`},{name:"blend",type:"combine",inputs:[{type:"float",name:"amount",default:.5}],glsl:` return _c0*(1.0-amount)+_c1*amount;`},{name:"mult",type:"combine",inputs:[{type:"float",name:"amount",default:1}],glsl:` return _c0*(1.0-amount)+(_c0*_c1)*amount;`},{name:"diff",type:"combine",inputs:[],glsl:` return vec4(abs(_c0.rgb-_c1.rgb), max(_c0.a, _c1.a));`},{name:"modulate",type:"combineCoord",inputs:[{type:"float",name:"amount",default:.1}],glsl:` // return fract(st+(_c0.xy-0.5)*amount);\n return _st + _c0.xy*amount;`},{name:"modulateScale",type:"combineCoord",inputs:[{type:"float",name:"multiple",default:1},{type:"float",name:"offset",default:1}],glsl:` vec2 xy = _st - vec2(0.5);\n xy*=(1.0/vec2(offset + multiple*_c0.r, offset + multiple*_c0.g));\n xy+=vec2(0.5);\n return xy;`},{name:"modulatePixelate",type:"combineCoord",inputs:[{type:"float",name:"multiple",default:10},{type:"float",name:"offset",default:3}],glsl:` vec2 xy = vec2(offset + _c0.x*multiple, offset + _c0.y*multiple);\n return (floor(_st * xy) + 0.5)/xy;`},{name:"modulateRotate",type:"combineCoord",inputs:[{type:"float",name:"multiple",default:1},{type:"float",name:"offset",default:0}],glsl:` vec2 xy = _st - vec2(0.5);\n float angle = offset + _c0.x * multiple;\n xy = mat2(cos(angle),-sin(angle), sin(angle),cos(angle))*xy;\n xy += 0.5;\n return xy;`},{name:"modulateHue",type:"combineCoord",inputs:[{type:"float",name:"amount",default:1}],glsl:` return _st + (vec2(_c0.g - _c0.r, _c0.b - _c0.g) * amount * 1.0/resolution);`},{name:"invert",type:"color",inputs:[{type:"float",name:"amount",default:1}],glsl:` return vec4((1.0-_c0.rgb)*amount + _c0.rgb*(1.0-amount), _c0.a);`},{name:"contrast",type:"color",inputs:[{type:"float",name:"amount",default:1.6}],glsl:` vec4 c = (_c0-vec4(0.5))*vec4(amount) + vec4(0.5);\n return vec4(c.rgb, _c0.a);`},{name:"brightness",type:"color",inputs:[{type:"float",name:"amount",default:.4}],glsl:` return vec4(_c0.rgb + vec3(amount), _c0.a);`},{name:"mask",type:"combine",inputs:[],glsl:` float a = _luminance(_c1.rgb);\n return vec4(_c0.rgb*a, a);`},{name:"luma",type:"color",inputs:[{type:"float",name:"threshold",default:.5},{type:"float",name:"tolerance",default:.1}],glsl:` float a = smoothstep(threshold-(tolerance+0.0000001), threshold+(tolerance+0.0000001), _luminance(_c0.rgb));\n return vec4(_c0.rgb*a, a);`},{name:"thresh",type:"color",inputs:[{type:"float",name:"threshold",default:.5},{type:"float",name:"tolerance",default:.04}],glsl:` return vec4(vec3(smoothstep(threshold-(tolerance+0.0000001), threshold+(tolerance+0.0000001), _luminance(_c0.rgb))), _c0.a);`},{name:"color",type:"color",inputs:[{type:"float",name:"r",default:1},{type:"float",name:"g",default:1},{type:"float",name:"b",default:1},{type:"float",name:"a",default:1}],glsl:` vec4 c = vec4(r, g, b, a);\n vec4 pos = step(0.0, c); // detect whether negative\n // if > 0, return r * _c0\n // if < 0 return (1.0-r) * _c0\n return vec4(mix((1.0-_c0)*abs(c), c*_c0, pos));`},{name:"saturate",type:"color",inputs:[{type:"float",name:"amount",default:2}],glsl:` const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(_c0.rgb, W));\n return vec4(mix(intensity, _c0.rgb, amount), _c0.a);`},{name:"hue",type:"color",inputs:[{type:"float",name:"hue",default:.4}],glsl:` vec3 c = _rgbToHsv(_c0.rgb);\n c.r += hue;\n // c.r = fract(c.r);\n return vec4(_hsvToRgb(c), _c0.a);`},{name:"colorama",type:"color",inputs:[{type:"float",name:"amount",default:.005}],glsl:` vec3 c = _rgbToHsv(_c0.rgb);\n c += vec3(amount);\n c = _hsvToRgb(c);\n c = fract(c);\n return vec4(c, _c0.a);`},{name:"prev",type:"src",inputs:[],glsl:` return texture2D(prevBuffer, fract(_st));`},{name:"sum",type:"color",inputs:[{type:"vec4",name:"scale",default:1}],glsl:` vec4 v = _c0 * s;\n return v.r + v.g + v.b + v.a;\n }\n float sum(vec2 _st, vec4 s) { // vec4 is not a typo, because argument type is not overloaded\n vec2 v = _st.xy * s.xy;\n return v.x + v.y;`},{name:"r",type:"color",inputs:[{type:"float",name:"scale",default:1},{type:"float",name:"offset",default:0}],glsl:` return vec4(_c0.r * scale + offset);`},{name:"g",type:"color",inputs:[{type:"float",name:"scale",default:1},{type:"float",name:"offset",default:0}],glsl:` return vec4(_c0.g * scale + offset);`},{name:"b",type:"color",inputs:[{type:"float",name:"scale",default:1},{type:"float",name:"offset",default:0}],glsl:` return vec4(_c0.b * scale + offset);`},{name:"a",type:"color",inputs:[{type:"float",name:"scale",default:1},{type:"float",name:"offset",default:0}],glsl:` return vec4(_c0.a * scale + offset);`}]},{}],66:[function(require,module,exports){module.exports={_luminance:{type:"util",glsl:`float _luminance(vec3 rgb){\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n return dot(rgb, W);\n }`},_noise:{type:"util",glsl:`\n //\tSimplex 3D Noise\n //\tby Ian McEwan, Ashima Arts\n vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}\n vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}\n\n float _noise(vec3 v){\n const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;\n const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);\n\n // First corner\n vec3 i = floor(v + dot(v, C.yyy) );\n vec3 x0 = v - i + dot(i, C.xxx) ;\n\n // Other corners\n vec3 g = step(x0.yzx, x0.xyz);\n vec3 l = 1.0 - g;\n vec3 i1 = min( g.xyz, l.zxy );\n vec3 i2 = max( g.xyz, l.zxy );\n\n // x0 = x0 - 0. + 0.0 * C\n vec3 x1 = x0 - i1 + 1.0 * C.xxx;\n vec3 x2 = x0 - i2 + 2.0 * C.xxx;\n vec3 x3 = x0 - 1. + 3.0 * C.xxx;\n\n // Permutations\n i = mod(i, 289.0 );\n vec4 p = permute( permute( permute(\n i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\n + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))\n + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\n // Gradients\n // ( N*N points uniformly over a square, mapped onto an octahedron.)\n float n_ = 1.0/7.0; // N=7\n vec3 ns = n_ * D.wyz - D.xzx;\n\n vec4 j = p - 49.0 * floor(p * ns.z *ns.z); // mod(p,N*N)\n\n vec4 x_ = floor(j * ns.z);\n vec4 y_ = floor(j - 7.0 * x_ ); // mod(j,N)\n\n vec4 x = x_ *ns.x + ns.yyyy;\n vec4 y = y_ *ns.x + ns.yyyy;\n vec4 h = 1.0 - abs(x) - abs(y);\n\n vec4 b0 = vec4( x.xy, y.xy );\n vec4 b1 = vec4( x.zw, y.zw );\n\n vec4 s0 = floor(b0)*2.0 + 1.0;\n vec4 s1 = floor(b1)*2.0 + 1.0;\n vec4 sh = -step(h, vec4(0.0));\n\n vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\n vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\n vec3 p0 = vec3(a0.xy,h.x);\n vec3 p1 = vec3(a0.zw,h.y);\n vec3 p2 = vec3(a1.xy,h.z);\n vec3 p3 = vec3(a1.zw,h.w);\n\n //Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n\n // Mix final noise value\n vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\n m = m * m;\n return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),\n dot(p2,x2), dot(p3,x3) ) );\n }\n `},_rgbToHsv:{type:"util",glsl:`vec3 _rgbToHsv(vec3 c){\n vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\n float d = q.x - min(q.w, q.y);\n float e = 1.0e-10;\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n }`},_hsvToRgb:{type:"util",glsl:`vec3 _hsvToRgb(vec3 c){\n vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n }`}}},{}],67:[function(require,module,exports){const Webcam=require("./lib/webcam.js");const Screen=require("./lib/screenmedia.js");class HydraSource{constructor({regl:regl,width:width,height:height,pb:pb,label:label=""}){this.label=label;this.regl=regl;this.src=null;this.dynamic=true;this.width=width;this.height=height;this.tex=this.regl.texture({shape:[1,1]});this.pb=pb}init(opts){if(opts.src){this.src=opts.src;this.tex=this.regl.texture(this.src)}if(opts.dynamic)this.dynamic=opts.dynamic}initCam(index){const self=this;Webcam(index).then((response=>{self.src=response.video;self.dynamic=true;self.tex=self.regl.texture(self.src)})).catch((err=>console.log("could not get camera",err)))}initVideo(url=""){const vid=document.createElement("video");vid.crossOrigin="anonymous";vid.autoplay=true;vid.loop=true;vid.muted=true;const onload=vid.addEventListener("loadeddata",(()=>{this.src=vid;vid.play();this.tex=this.regl.texture(this.src);this.dynamic=true}));vid.src=url}initImage(url=""){const img=document.createElement("img");img.crossOrigin="anonymous";img.src=url;img.onload=()=>{this.src=img;this.dynamic=false;this.tex=this.regl.texture(this.src)}}initStream(streamName){let self=this;if(streamName&&this.pb){this.pb.initSource(streamName);this.pb.on("got video",(function(nick,video){if(nick===streamName){self.src=video;self.dynamic=true;self.tex=self.regl.texture(self.src)}}))}}initScreen(){const self=this;Screen().then((function(response){self.src=response.video;self.tex=self.regl.texture(self.src);self.dynamic=true})).catch((err=>console.log("could not get screen",err)))}resize(width,height){this.width=width;this.height=height}clear(){if(this.src&&this.src.srcObject){if(this.src.srcObject.getTracks){this.src.srcObject.getTracks().forEach((track=>track.stop()))}}this.src=null;this.tex=this.regl.texture({shape:[1,1]})}tick(time){if(this.src!==null&&this.dynamic===true){if(this.src.videoWidth&&this.src.videoWidth!==this.tex.width){console.log(this.src.videoWidth,this.src.videoHeight,this.tex.width,this.tex.height);this.tex.resize(this.src.videoWidth,this.src.videoHeight)}if(this.src.width&&this.src.width!==this.tex.width){this.tex.resize(this.src.width,this.src.height)}this.tex.subimage(this.src)}}getTexture(){return this.tex}}module.exports=HydraSource},{"./lib/screenmedia.js":74,"./lib/webcam.js":76}],68:[function(require,module,exports){var easing=require("./easing-functions.js");var map=(num,in_min,in_max,out_min,out_max)=>(num-in_min)*(out_max-out_min)/(in_max-in_min)+out_min;module.exports={init:()=>{Array.prototype.fast=function(speed=1){this._speed=speed;return this};Array.prototype.smooth=function(smooth=1){this._smooth=smooth;return this};Array.prototype.ease=function(ease="linear"){if(typeof ease=="function"){this._smooth=1;this._ease=ease}else if(easing[ease]){this._smooth=1;this._ease=easing[ease]}return this};Array.prototype.offset=function(offset=.5){this._offset=offset%1;return this};Array.prototype.fit=function(low=0,high=1){let lowest=Math.min(...this);let highest=Math.max(...this);var newArr=this.map((num=>map(num,lowest,highest,low,high)));newArr._speed=this._speed;newArr._smooth=this._smooth;newArr._ease=this._ease;return newArr}},getValue:(arr=[])=>({time:time,bpm:bpm})=>{let speed=arr._speed?arr._speed:1;let smooth=arr._smooth?arr._smooth:0;let index=time*speed*(bpm/60)+(arr._offset||0);if(smooth!==0){let ease=arr._ease?arr._ease:easing["linear"];let _index=index-smooth/2;let currValue=arr[Math.floor(_index%arr.length)];let nextValue=arr[Math.floor((_index+1)%arr.length)];let t=Math.min(_index%1/smooth,1);return ease(t)*(nextValue-currValue)+currValue}else{return arr[Math.floor(index%arr.length)]}}}},{"./easing-functions.js":70}],69:[function(require,module,exports){const Meyda=require("meyda");class Audio{constructor({numBins:numBins=4,cutoff:cutoff=2,smooth:smooth=.4,max:max=15,scale:scale=10,isDrawing:isDrawing=false}){this.vol=0;this.scale=scale;this.max=max;this.cutoff=cutoff;this.smooth=smooth;this.setBins(numBins);this.beat={holdFrames:20,threshold:40,_cutoff:0,decay:.98,_framesSinceBeat:0};this.onBeat=()=>{};this.canvas=document.createElement("canvas");this.canvas.width=100;this.canvas.height=80;this.canvas.style.width="100px";this.canvas.style.height="80px";this.canvas.style.position="absolute";this.canvas.style.right="0px";this.canvas.style.bottom="0px";document.body.appendChild(this.canvas);this.isDrawing=isDrawing;this.ctx=this.canvas.getContext("2d");this.ctx.fillStyle="#DFFFFF";this.ctx.strokeStyle="#0ff";this.ctx.lineWidth=.5;window.navigator.mediaDevices.getUserMedia({video:false,audio:true}).then((stream=>{this.stream=stream;this.context=new AudioContext;let audio_stream=this.context.createMediaStreamSource(stream);this.meyda=Meyda.createMeydaAnalyzer({audioContext:this.context,source:audio_stream,featureExtractors:["loudness"]})})).catch((err=>console.log("ERROR",err)))}detectBeat(level){if(level>this.beat._cutoff&&level>this.beat.threshold){this.onBeat();this.beat._cutoff=level*1.2;this.beat._framesSinceBeat=0}else{if(this.beat._framesSinceBeat<=this.beat.holdFrames){this.beat._framesSinceBeat++}else{this.beat._cutoff*=this.beat.decay;this.beat._cutoff=Math.max(this.beat._cutoff,this.beat.threshold)}}}tick(){if(this.meyda){var features=this.meyda.get();if(features&&features!==null){this.vol=features.loudness.total;this.detectBeat(this.vol);const reducer=(accumulator,currentValue)=>accumulator+currentValue;let spacing=Math.floor(features.loudness.specific.length/this.bins.length);this.prevBins=this.bins.slice(0);this.bins=this.bins.map(((bin,index)=>features.loudness.specific.slice(index*spacing,(index+1)*spacing).reduce(reducer))).map(((bin,index)=>bin*(1-this.settings[index].smooth)+this.prevBins[index]*this.settings[index].smooth));this.fft=this.bins.map(((bin,index)=>Math.max(0,(bin-this.settings[index].cutoff)/this.settings[index].scale)));if(this.isDrawing)this.draw()}}}setCutoff(cutoff){this.cutoff=cutoff;this.settings=this.settings.map((el=>{el.cutoff=cutoff;return el}))}setSmooth(smooth){this.smooth=smooth;this.settings=this.settings.map((el=>{el.smooth=smooth;return el}))}setBins(numBins){this.bins=Array(numBins).fill(0);this.prevBins=Array(numBins).fill(0);this.fft=Array(numBins).fill(0);this.settings=Array(numBins).fill(0).map((()=>({cutoff:this.cutoff,scale:this.scale,smooth:this.smooth})));this.bins.forEach(((bin,index)=>{window["a"+index]=(scale=1,offset=0)=>()=>a.fft[index]*scale+offset}))}setScale(scale){this.scale=scale;this.settings=this.settings.map((el=>{el.scale=scale;return el}))}setMax(max){this.max=max;console.log("set max is deprecated")}hide(){this.isDrawing=false;this.canvas.style.display="none"}show(){this.isDrawing=true;this.canvas.style.display="block"}draw(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);var spacing=this.canvas.width/this.bins.length;var scale=this.canvas.height/(this.max*2);this.bins.forEach(((bin,index)=>{var height=bin*scale;this.ctx.fillRect(index*spacing,this.canvas.height-height,spacing,height);var y=this.canvas.height-scale*this.settings[index].cutoff;this.ctx.beginPath();this.ctx.moveTo(index*spacing,y);this.ctx.lineTo((index+1)*spacing,y);this.ctx.stroke();var yMax=this.canvas.height-scale*(this.settings[index].scale+this.settings[index].cutoff);this.ctx.beginPath();this.ctx.moveTo(index*spacing,yMax);this.ctx.lineTo((index+1)*spacing,yMax);this.ctx.stroke()}))}}module.exports=Audio},{meyda:107}],70:[function(require,module,exports){module.exports={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return t*(2-t)},easeInOutQuad:function(t){return t<.5?2*t*t:-1+(4-2*t)*t},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return--t*t*t+1},easeInOutCubic:function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return 1- --t*t*t*t},easeInOutQuart:function(t){return t<.5?8*t*t*t*t:1-8*--t*t*t*t},easeInQuint:function(t){return t*t*t*t*t},easeOutQuint:function(t){return 1+--t*t*t*t*t},easeInOutQuint:function(t){return t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t},sin:function(t){return(1+Math.sin(Math.PI*t-Math.PI/2))/2}}},{}],71:[function(require,module,exports){"use strict";function mouseButtons(ev){if(typeof ev==="object"){if("buttons"in ev){return ev.buttons}else if("which"in ev){var b=ev.which;if(b===2){return 4}else if(b===3){return 2}else if(b>0){return 1<<b-1}}else if("button"in ev){var b=ev.button;if(b===1){return 4}else if(b===2){return 2}else if(b>=0){return 1<<b}}}return 0}exports.buttons=mouseButtons;function mouseElement(ev){return ev.target||ev.srcElement||window}exports.element=mouseElement;function mouseRelativeX(ev){if(typeof ev==="object"){if("pageX"in ev){return ev.pageX}}return 0}exports.x=mouseRelativeX;function mouseRelativeY(ev){if(typeof ev==="object"){if("pageY"in ev){return ev.pageY}}return 0}exports.y=mouseRelativeY},{}],72:[function(require,module,exports){"use strict";module.exports=mouseListen;var mouse=require("./mouse-event.js");function mouseListen(element,callback){if(!callback){callback=element;element=window}var buttonState=0;var x=0;var y=0;var mods={shift:false,alt:false,control:false,meta:false};var attached=false;function updateMods(ev){var changed=false;if("altKey"in ev){changed=changed||ev.altKey!==mods.alt;mods.alt=!!ev.altKey}if("shiftKey"in ev){changed=changed||ev.shiftKey!==mods.shift;mods.shift=!!ev.shiftKey}if("ctrlKey"in ev){changed=changed||ev.ctrlKey!==mods.control;mods.control=!!ev.ctrlKey}if("metaKey"in ev){changed=changed||ev.metaKey!==mods.meta;mods.meta=!!ev.metaKey}return changed}function handleEvent(nextButtons,ev){var nextX=mouse.x(ev);var nextY=mouse.y(ev);if("buttons"in ev){nextButtons=ev.buttons|0}if(nextButtons!==buttonState||nextX!==x||nextY!==y||updateMods(ev)){buttonState=nextButtons|0;x=nextX||0;y=nextY||0;callback&&callback(buttonState,x,y,mods)}}function clearState(ev){handleEvent(0,ev)}function handleBlur(){if(buttonState||x||y||mods.shift||mods.alt||mods.meta||mods.control){x=y=0;buttonState=0;mods.shift=mods.alt=mods.control=mods.meta=false;callback&&callback(0,0,0,mods)}}function handleMods(ev){if(updateMods(ev)){callback&&callback(buttonState,x,y,mods)}}function handleMouseMove(ev){if(mouse.buttons(ev)===0){handleEvent(0,ev)}else{handleEvent(buttonState,ev)}}function handleMouseDown(ev){handleEvent(buttonState|mouse.buttons(ev),ev)}function handleMouseUp(ev){handleEvent(buttonState&~mouse.buttons(ev),ev)}function attachListeners(){if(attached){return}attached=true;element.addEventListener("mousemove",handleMouseMove);element.addEventListener("mousedown",handleMouseDown);element.addEventListener("mouseup",handleMouseUp);element.addEventListener("mouseleave",clearState);element.addEventListener("mouseenter",clearState);element.addEventListener("mouseout",clearState);element.addEventListener("mouseover",clearState);element.addEventListener("blur",handleBlur);element.addEventListener("keyup",handleMods);element.addEventListener("keydown",handleMods);element.addEventListener("keypress",handleMods);if(element!==window){window.addEventListener("blur",handleBlur);window.addEventListener("keyup",handleMods);window.addEventListener("keydown",handleMods);window.addEventListener("keypress",handleMods)}}function detachListeners(){if(!attached){return}attached=false;element.removeEventListener("mousemove",handleMouseMove);element.removeEventListener("mousedown",handleMouseDown);element.removeEventListener("mouseup",handleMouseUp);element.removeEventListener("mouseleave",clearState);element.removeEventListener("mouseenter",clearState);element.removeEventListener("mouseout",clearState);element.removeEventListener("mouseover",clearState);element.removeEventListener("blur",handleBlur);element.removeEventListener("keyup",handleMods);element.removeEventListener("keydown",handleMods);element.removeEventListener("keypress",handleMods);if(element!==window){window.removeEventListener("blur",handleBlur);window.removeEventListener("keyup",handleMods);window.removeEventListener("keydown",handleMods);window.removeEventListener("keypress",handleMods)}}attachListeners();var result={element:element};Object.defineProperties(result,{enabled:{get:function(){return attached},set:function(f){if(f){attachListeners()}else{detachListeners()}},enumerable:true},buttons:{get:function(){return buttonState},enumerable:true},x:{get:function(){return x},enumerable:true},y:{get:function(){return y},enumerable:true},mods:{get:function(){return mods},enumerable:true}});return result}},{"./mouse-event.js":71}],73:[function(require,module,exports){module.exports=parent=>{var initialCode=``;var sandbox=createSandbox(initialCode);var addToContext=(name,object)=>{initialCode+=`\n var ${name} = ${object}\n `;sandbox=createSandbox(initialCode)};return{addToContext:addToContext,eval:code=>sandbox.eval(code)};function createSandbox(initial){eval(initial);var localEval=function(code){eval(code)};return{eval:localEval}}}},{}],74:[function(require,module,exports){module.exports=function(options){return new Promise((function(resolve,reject){navigator.mediaDevices.getDisplayMedia(options).then((stream=>{const video=document.createElement("video");video.srcObject=stream;video.addEventListener("loadedmetadata",(()=>{video.play();resolve({video:video})}))})).catch((err=>reject(err)))}))}},{}],75:[function(require,module,exports){class VideoRecorder{constructor(stream){this.mediaSource=new MediaSource;this.stream=stream;this.output=document.createElement("video");this.output.autoplay=true;this.output.loop=true;let self=this;this.mediaSource.addEventListener("sourceopen",(()=>{console.log("MediaSource opened");self.sourceBuffer=self.mediaSource.addSourceBuffer('video/webm; codecs="vp8"');console.log("Source buffer: ",sourceBuffer)}))}start(){let options={mimeType:"video/webm;codecs=vp9"};this.recordedBlobs=[];try{this.mediaRecorder=new MediaRecorder(this.stream,options)}catch(e0){console.log("Unable to create MediaRecorder with options Object: ",e0);try{options={mimeType:"video/webm,codecs=vp9"};this.mediaRecorder=new MediaRecorder(this.stream,options)}catch(e1){console.log("Unable to create MediaRecorder with options Object: ",e1);try{options="video/vp8";this.mediaRecorder=new MediaRecorder(this.stream,options)}catch(e2){alert("MediaRecorder is not supported by this browser.\n\n"+"Try Firefox 29 or later, or Chrome 47 or later, "+"with Enable experimental Web Platform features enabled from chrome://flags.");console.error("Exception while creating MediaRecorder:",e2);return}}}console.log("Created MediaRecorder",this.mediaRecorder,"with options",options);this.mediaRecorder.onstop=this._handleStop.bind(this);this.mediaRecorder.ondataavailable=this._handleDataAvailable.bind(this);this.mediaRecorder.start(100);console.log("MediaRecorder started",this.mediaRecorder)}stop(){this.mediaRecorder.stop()}_handleStop(){const blob=new Blob(this.recordedBlobs,{type:this.mediaRecorder.mimeType});const url=window.URL.createObjectURL(blob);this.output.src=url;const a=document.createElement("a");a.style.display="none";a.href=url;let d=new Date;a.download=`hydra-${d.getFullYear()}-${d.getMonth()+1}-${d.getDate()}-${d.getHours()}.${d.getMinutes()}.${d.getSeconds()}.webm`;document.body.appendChild(a);a.click();setTimeout((()=>{document.body.removeChild(a);window.URL.revokeObjectURL(url)}),300)}_handleDataAvailable(event){if(event.data&&event.data.size>0){this.recordedBlobs.push(event.data)}}}module.exports=VideoRecorder},{}],76:[function(require,module,exports){module.exports=function(deviceId){return navigator.mediaDevices.enumerateDevices().then((devices=>devices.filter((devices=>devices.kind==="videoinput")))).then((cameras=>{let constraints={audio:false,video:true};if(cameras[deviceId]){constraints["video"]={deviceId:{exact:cameras[deviceId].deviceId}}}return window.navigator.mediaDevices.getUserMedia(constraints)})).then((stream=>{const video=document.createElement("video");video.setAttribute("autoplay","");video.setAttribute("muted","");video.setAttribute("playsinline","");video.srcObject=stream;return new Promise(((resolve,reject)=>{video.addEventListener("loadedmetadata",(()=>{video.play().then((()=>resolve({video:video})))}))}))})).catch(console.log.bind(console))}},{}],77:[function(require,module,exports){var Output=function({regl:regl,precision:precision,label:label="",width:width,height:height}){this.regl=regl;this.precision=precision;this.label=label;this.positionBuffer=this.regl.buffer([[-2,0],[0,-2],[2,2]]);this.draw=()=>{};this.init();this.pingPongIndex=0;this.fbos=Array(2).fill().map((()=>this.regl.framebuffer({color:this.regl.texture({mag:"nearest",width:width,height:height,format:"rgba"}),depthStencil:false})))};Output.prototype.resize=function(width,height){this.fbos.forEach((fbo=>{fbo.resize(width,height)}))};Output.prototype.getCurrent=function(){return this.fbos[this.pingPongIndex]};Output.prototype.getTexture=function(){var index=this.pingPongIndex?0:1;return this.fbos[index]};Output.prototype.init=function(){this.transformIndex=0;this.fragHeader=`\n precision ${this.precision} float;\n\n uniform float time;\n varying vec2 uv;\n `;this.fragBody=``;this.vert=`\n precision ${this.precision} float;\n attribute vec2 position;\n varying vec2 uv;\n\n void main () {\n uv = position;\n gl_Position = vec4(2.0 * position - 1.0, 0, 1);\n }`;this.attributes={position:this.positionBuffer};this.uniforms={time:this.regl.prop("time"),resolution:this.regl.prop("resolution")};this.frag=`\n ${this.fragHeader}\n\n void main () {\n vec4 c = vec4(0, 0, 0, 0);\n vec2 st = uv;\n ${this.fragBody}\n gl_FragColor = c;\n }\n `;return this};Output.prototype.render=function(passes){let pass=passes[0];var self=this;var uniforms=Object.assign(pass.uniforms,{prevBuffer:()=>self.fbos[self.pingPongIndex]});self.draw=self.regl({frag:pass.frag,vert:self.vert,attributes:self.attributes,uniforms:uniforms,count:3,framebuffer:()=>{self.pingPongIndex=self.pingPongIndex?0:1;return self.fbos[self.pingPongIndex]}})};Output.prototype.tick=function(props){this.draw(props)};module.exports=Output},{}],78:[function(require,module,exports){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128}},{}],79:[function(require,module,exports){var indexOf=[].indexOf;module.exports=function(arr,obj){if(indexOf)return arr.indexOf(obj);for(var i=0;i<arr.length;++i){if(arr[i]===obj)return i}return-1}},{}],80:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],81:[function(require,module,exports){
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
module.exports=function(obj){return obj!=null&&(isBuffer(obj)||isSlowBuffer(obj)||!!obj._isBuffer)};function isBuffer(obj){return!!obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj)}function isSlowBuffer(obj){return typeof obj.readFloatLE==="function"&&typeof obj.slice==="function"&&isBuffer(obj.slice(0,0))}},{}],82:[function(require,module,exports){arguments[4][57][0].apply(exports,arguments)},{dup:57}],83:[function(require,module,exports){"use strict";function get_beautify(js_beautify,css_beautify,html_beautify){var beautify=function(src,config){return js_beautify.js_beautify(src,config)};beautify.js=js_beautify.js_beautify;beautify.css=css_beautify.css_beautify;beautify.html=html_beautify.html_beautify;beautify.js_beautify=js_beautify.js_beautify;beautify.css_beautify=css_beautify.css_beautify;beautify.html_beautify=html_beautify.html_beautify;return beautify}if(typeof define==="function"&&define.amd){define(["./lib/beautify","./lib/beautify-css","./lib/beautify-html"],(function(js_beautify,css_beautify,html_beautify){return get_beautify(js_beautify,css_beautify,html_beautify)}))}else{(function(mod){var beautifier=require("./src/index");beautifier.js_beautify=beautifier.js;beautifier.css_beautify=beautifier.css;beautifier.html_beautify=beautifier.html;mod.exports=get_beautify(beautifier,beautifier,beautifier)})(module)}},{"./src/index":101}],84:[function(require,module,exports){"use strict";function Directives(start_block_pattern,end_block_pattern){start_block_pattern=typeof start_block_pattern==="string"?start_block_pattern:start_block_pattern.source;end_block_pattern=typeof end_block_pattern==="string"?end_block_pattern:end_block_pattern.source;this.__directives_block_pattern=new RegExp(start_block_pattern+/ beautify( \w+[:]\w+)+ /.source+end_block_pattern,"g");this.__directive_pattern=/ (\w+)[:](\w+)/g;this.__directives_end_ignore_pattern=new RegExp(start_block_pattern+/\sbeautify\signore:end\s/.source+end_block_pattern,"g")}Directives.prototype.get_directives=function(text){if(!text.match(this.__directives_block_pattern)){return null}var directives={};this.__directive_pattern.lastIndex=0;var directive_match=this.__directive_pattern.exec(text);while(directive_match){directives[directive_match[1]]=directive_match[2];directive_match=this.__directive_pattern.exec(text)}return directives};Directives.prototype.readIgnored=function(input){return input.readUntilAfter(this.__directives_end_ignore_pattern)};module.exports.Directives=Directives},{}],85:[function(require,module,exports){"use strict";var regexp_has_sticky=RegExp.prototype.hasOwnProperty("sticky");function InputScanner(input_string){this.__input=input_string||"";this.__input_length=this.__input.length;this.__position=0}InputScanner.prototype.restart=function(){this.__position=0};InputScanner.prototype.back=function(){if(this.__position>0){this.__position-=1}};InputScanner.prototype.hasNext=function(){return this.__position<this.__input_length};InputScanner.prototype.next=function(){var val=null;if(this.hasNext()){val=this.__input.charAt(this.__position);this.__position+=1}return val};InputScanner.prototype.peek=function(index){var val=null;index=index||0;index+=this.__position;if(index>=0&&index<this.__input_length){val=this.__input.charAt(index)}return val};InputScanner.prototype.__match=function(pattern,index){pattern.lastIndex=index;var pattern_match=pattern.exec(this.__input);if(pattern_match&&!(regexp_has_sticky&&pattern.sticky)){if(pattern_match.index!==index){pattern_match=null}}return pattern_match};InputScanner.prototype.test=function(pattern,index){index=index||0;index+=this.__position;if(index>=0&&index<this.__input_length){return!!this.__match(pattern,index)}else{return false}};InputScanner.prototype.testChar=function(pattern,index){var val=this.peek(index);pattern.lastIndex=0;return val!==null&&pattern.test(val)};InputScanner.prototype.match=function(pattern){var pattern_match=this.__match(pattern,this.__position);if(pattern_match){this.__position+=pattern_match[0].length}else{pattern_match=null}return pattern_match};InputScanner.prototype.read=function(starting_pattern,until_pattern,until_after){var val="";var match;if(starting_pattern){match=this.match(starting_pattern);if(match){val+=match[0]}}if(until_pattern&&(match||!starting_pattern)){val+=this.readUntil(until_pattern,until_after)}return val};InputScanner.prototype.readUntil=function(pattern,until_after){var val="";var match_index=this.__position;pattern.lastIndex=this.__position;var pattern_match=pattern.exec(this.__input);if(pattern_match){match_index=pattern_match.index;if(until_after){match_index+=pattern_match[0].length}}else{match_index=this.__input_length}val=this.__input.substring(this.__position,match_index);this.__position=match_index;return val};InputScanner.prototype.readUntilAfter=function(pattern){return this.readUntil(pattern,true)};InputScanner.prototype.get_regexp=function(pattern,match_from){var result=null;var flags="g";if(match_from&&regexp_has_sticky){flags="y"}if(typeof pattern==="string"&&pattern!==""){result=new RegExp(pattern,flags)}else if(pattern){result=new RegExp(pattern.source,flags)}return result};InputScanner.prototype.get_literal_regexp=function(literal_string){return RegExp(literal_string.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"))};InputScanner.prototype.peekUntilAfter=function(pattern){var start=this.__position;var val=this.readUntilAfter(pattern);this.__position=start;return val};InputScanner.prototype.lookBack=function(testVal){var start=this.__position-1;return start>=testVal.length&&this.__input.substring(start-testVal.length,start).toLowerCase()===testVal};module.exports.InputScanner=InputScanner},{}],86:[function(require,module,exports){"use strict";function Options(options,merge_child_field){this.raw_options=_mergeOpts(options,merge_child_field);this.disabled=this._get_boolean("disabled");this.eol=this._get_characters("eol","auto");this.end_with_newline=this._get_boolean("end_with_newline");this.indent_size=this._get_number("indent_size",4);this.indent_char=this._get_characters("indent_char"," ");this.indent_level=this._get_number("indent_level");this.preserve_newlines=this._get_boolean("preserve_newlines",true);this.max_preserve_newlines=this._get_number("max_preserve_newlines",32786);if(!this.preserve_newlines){this.max_preserve_newlines=0}this.indent_with_tabs=this._get_boolean("indent_with_tabs",this.indent_char==="\t");if(this.indent_with_tabs){this.indent_char="\t";if(this.indent_size===1){this.indent_size=4}}this.wrap_line_length=this._get_number("wrap_line_length",this._get_number("max_char"));this.indent_empty_lines=this._get_boolean("indent_empty_lines");this.templating=this._get_selection_list("templating",["auto","none","django","erb","handlebars","php","smarty"],["auto"])}Options.prototype._get_array=function(name,default_value){var option_value=this.raw_options[name];var result=default_value||[];if(typeof option_value==="object"){if(option_value!==null&&typeof option_value.concat==="function"){result=option_value.concat()}}else if(typeof option_value==="string"){result=option_value.split(/[^a-zA-Z0-9_\/\-]+/)}return result};Options.prototype._get_boolean=function(name,default_value){var option_value=this.raw_options[name];var result=option_value===undefined?!!default_value:!!option_value;return result};Options.prototype._get_characters=function(name,default_value){var option_value=this.raw_options[name];var result=default_value||"";if(typeof option_value==="string"){result=option_value.replace(/\\r/,"\r").replace(/\\n/,"\n").replace(/\\t/,"\t")}return result};Options.prototype._get_number=function(name,default_value){var option_value=this.raw_options[name];default_value=parseInt(default_value,10);if(isNaN(default_value)){default_value=0}var result=parseInt(option_value,10);if(isNaN(result)){result=default_value}return result};Options.prototype._get_selection=function(name,selection_list,default_value){var result=this._get_selection_list(name,selection_list,default_value);if(result.length!==1){throw new Error("Invalid Option Value: The option '"+name+"' can only be one of the following values:\n"+selection_list+"\nYou passed in: '"+this.raw_options[name]+"'")}return result[0]};Options.prototype._get_selection_list=function(name,selection_list,default_value){if(!selection_list||selection_list.length===0){throw new Error("Selection list cannot be empty.")}default_value=default_value||[selection_list[0]];if(!this._is_valid_selection(default_value,selection_list)){throw new Error("Invalid Default Value!")}var result=this._get_array(name,default_value);if(!this._is_valid_selection(result,selection_list)){throw new Error("Invalid Option Value: The option '"+name+"' can contain only the following values:\n"+selection_list+"\nYou passed in: '"+this.raw_options[name]+"'")}return result};Options.prototype._is_valid_selection=function(result,selection_list){return result.length&&selection_list.length&&!result.some((function(item){return selection_list.indexOf(item)===-1}))};function _mergeOpts(allOptions,childFieldName){var finalOpts={};allOptions=_normalizeOpts(allOptions);var name;for(name in allOptions){if(name!==childFieldName){finalOpts[name]=allOptions[name]}}if(childFieldName&&allOptions[childFieldName]){for(name in allOptions[childFieldName]){finalOpts[name]=allOptions[childFieldName][name]}}return finalOpts}function _normalizeOpts(options){var convertedOpts={};var key;for(key in options){var newKey=key.replace(/-/g,"_");convertedOpts[newKey]=options[key]}return convertedOpts}module.exports.Options=Options;module.exports.normalizeOpts=_normalizeOpts;module.exports.mergeOpts=_mergeOpts},{}],87:[function(require,module,exports){"use strict";function OutputLine(parent){this.__parent=parent;this.__character_count=0;this.__indent_count=-1;this.__alignment_count=0;this.__wrap_point_index=0;this.__wrap_point_character_count=0;this.__wrap_point_indent_count=-1;this.__wrap_point_alignment_count=0;this.__items=[]}OutputLine.prototype.clone_empty=function(){var line=new OutputLine(this.__parent);line.set_indent(this.__indent_count,this.__alignment_count);return line};OutputLine.prototype.item=function(index){if(index<0){return this.__items[this.__items.length+index]}else{return this.__items[index]}};OutputLine.prototype.has_match=function(pattern){for(var lastCheckedOutput=this.__items.length-1;lastCheckedOutput>=0;lastCheckedOutput--){if(this.__items[lastCheckedOutput].match(pattern)){return true}}return false};OutputLine.prototype.set_indent=function(indent,alignment){if(this.is_empty()){this.__indent_count=indent||0;this.__alignment_count=alignment||0;this.__character_count=this.__parent.get_indent_size(this.__indent_count,this.__alignment_count)}};OutputLine.prototype._set_wrap_point=function(){if(this.__parent.wrap_line_length){this.__wrap_point_index=this.__items.length;this.__wrap_point_character_count=this.__character_count;this.__wrap_point_indent_count=this.__parent.next_line.__indent_count;this.__wrap_point_alignment_count=this.__parent.next_line.__alignment_count}};OutputLine.prototype._should_wrap=function(){return this.__wrap_point_index&&this.__character_count>this.__parent.wrap_line_length&&this.__wrap_point_character_count>this.__parent.next_line.__character_count};OutputLine.prototype._allow_wrap=function(){if(this._should_wrap()){this.__parent.add_new_line();var next=this.__parent.current_line;next.set_indent(this.__wrap_point_indent_count,this.__wrap_point_alignment_count);next.__items=this.__items.slice(this.__wrap_point_index);this.__items=this.__items.slice(0,this.__wrap_point_index);next.__character_count+=this.__character_count-this.__wrap_point_character_count;this.__character_count=this.__wrap_point_character_count;if(next.__items[0]===" "){next.__items.splice(0,1);next.__character_count-=1}return true}return false};OutputLine.prototype.is_empty=function(){return this.__items.length===0};OutputLine.prototype.last=function(){if(!this.is_empty()){return this.__items[this.__items.length-1]}else{return null}};OutputLine.prototype.push=function(item){this.__items.push(item);var last_newline_index=item.lastIndexOf("\n");if(last_newline_index!==-1){this.__character_count=item.length-last_newline_index}else{this.__character_count+=item.length}};OutputLine.prototype.pop=function(){var item=null;if(!this.is_empty()){item=this.__items.pop();this.__character_count-=item.length}return item};OutputLine.prototype._remove_indent=function(){if(this.__indent_count>0){this.__indent_count-=1;this.__character_count-=this.__parent.indent_size}};OutputLine.prototype._remove_wrap_indent=function(){if(this.__wrap_point_indent_count>0){this.__wrap_point_indent_count-=1}};OutputLine.prototype.trim=function(){while(this.last()===" "){this.__items.pop();this.__character_count-=1}};OutputLine.prototype.toString=function(){var result="";if(this.is_empty()){if(this.__parent.indent_empty_lines){result=this.__parent.get_indent_string(this.__indent_count)}}else{result=this.__parent.get_indent_string(this.__indent_count,this.__alignment_count);result+=this.__items.join("")}return result};function IndentStringCache(options,baseIndentString){this.__cache=[""];this.__indent_size=options.indent_size;this.__indent_string=options.indent_char;if(!options.indent_with_tabs){this.__indent_string=new Array(options.indent_size+1).join(options.indent_char)}baseIndentString=baseIndentString||"";if(options.indent_level>0){baseIndentString=new Array(options.indent_level+1).join(this.__indent_string)}this.__base_string=baseIndentString;this.__base_string_length=baseIndentString.length}IndentStringCache.prototype.get_indent_size=function(indent,column){var result=this.__base_string_length;column=column||0;if(indent<0){result=0}result+=indent*this.__indent_size;result+=column;return result};IndentStringCache.prototype.get_indent_string=function(indent_level,column){var result=this.__base_string;column=column||0;if(indent_level<0){indent_level=0;result=""}column+=indent_level*this.__indent_size;this.__ensure_cache(column);result+=this.__cache[column];return result};IndentStringCache.prototype.__ensure_cache=function(column){while(column>=this.__cache.length){this.__add_column()}};IndentStringCache.prototype.__add_column=function(){var column=this.__cache.length;var indent=0;var result="";if(this.__indent_size&&column>=this.__indent_size){indent=Math.floor(column/this.__indent_size);column-=indent*this.__indent_size;result=new Array(indent+1).join(this.__indent_string)}if(column){result+=new Array(column+1).join(" ")}this.__cache.push(result)};function Output(options,baseIndentString){this.__indent_cache=new IndentStringCache(options,baseIndentString);this.raw=false;this._end_with_newline=options.end_with_newline;this.indent_size=options.indent_size;this.wrap_line_length=options.wrap_line_length;this.indent_empty_lines=options.indent_empty_lines;this.__lines=[];this.previous_line=null;this.current_line=null;this.next_line=new OutputLine(this);this.space_before_token=false;this.non_breaking_space=false;this.previous_token_wrapped=false;this.__add_outputline()}Output.prototype.__add_outputline=function(){this.previous_line=this.current_line;this.current_line=this.next_line.clone_empty();this.__lines.push(this.current_line)};Output.prototype.get_line_number=function(){return this.__lines.length};Output.prototype.get_indent_string=function(indent,column){return this.__indent_cache.get_indent_string(indent,column)};Output.prototype.get_indent_size=function(indent,column){return this.__indent_cache.get_indent_size(indent,column)};Output.prototype.is_empty=function(){return!this.previous_line&&this.current_line.is_empty()};Output.prototype.add_new_line=function(force_newline){if(this.is_empty()||!force_newline&&this.just_added_newline()){return false}if(!this.raw){this.__add_outputline()}return true};Output.prototype.get_code=function(eol){this.trim(true);var last_item=this.current_line.pop();if(last_item){if(last_item[last_item.length-1]==="\n"){last_item=last_item.replace(/\n+$/g,"")}this.current_line.push(last_item)}if(this._end_with_newline){this.__add_outputline()}var sweet_code=this.__lines.join("\n");if(eol!=="\n"){sweet_code=sweet_code.replace(/[\n]/g,eol)}return sweet_code};Output.prototype.set_wrap_point=function(){this.current_line._set_wrap_point()};Output.prototype.set_indent=function(indent,alignment){indent=indent||0;alignment=alignment||0;this.next_line.set_indent(indent,alignment);if(this.__lines.length>1){this.current_line.set_indent(indent,alignment);return true}this.current_line.set_indent();return false};Output.prototype.add_raw_token=function(token){for(var x=0;x<token.newlines;x++){this.__add_outputline()}this.current_line.set_indent(-1);this.current_line.push(token.whitespace_before);this.current_line.push(token.text);this.space_before_token=false;this.non_breaking_space=false;this.previous_token_wrapped=false};Output.prototype.add_token=function(printable_token){this.__add_space_before_token();this.current_line.push(printable_token);this.space_before_token=false;this.non_breaking_space=false;this.previous_token_wrapped=this.current_line._allow_wrap()};Output.prototype.__add_space_before_token=function(){if(this.space_before_token&&!this.just_added_newline()){if(!this.non_breaking_space){this.set_wrap_point()}this.current_line.push(" ")}};Output.prototype.remove_indent=function(index){var output_length=this.__lines.length;while(index<output_length){this.__lines[index]._remove_indent();index++}this.current_line._remove_wrap_indent()};Output.prototype.trim=function(eat_newlines){eat_newlines=eat_newlines===undefined?false:eat_newlines;this.current_line.trim();while(eat_newlines&&this.__lines.length>1&&this.current_line.is_empty()){this.__lines.pop();this.current_line=this.__lines[this.__lines.length-1];this.current_line.trim()}this.previous_line=this.__lines.length>1?this.__lines[this.__lines.length-2]:null};Output.prototype.just_added_newline=function(){return this.current_line.is_empty()};Output.prototype.just_added_blankline=function(){return this.is_empty()||this.current_line.is_empty()&&this.previous_line.is_empty()};Output.prototype.ensure_empty_line_above=function(starts_with,ends_with){var index=this.__lines.length-2;while(index>=0){var potentialEmptyLine=this.__lines[index];if(potentialEmptyLine.is_empty()){break}else if(potentialEmptyLine.item(0).indexOf(starts_with)!==0&&potentialEmptyLine.item(-1)!==ends_with){this.__lines.splice(index+1,0,new OutputLine(this));this.previous_line=this.__lines[this.__lines.length-2];break}index--}};module.exports.Output=Output},{}],88:[function(require,module,exports){"use strict";function Pattern(input_scanner,parent){this._input=input_scanner;this._starting_pattern=null;this._match_pattern=null;this._until_pattern=null;this._until_after=false;if(parent){this._starting_pattern=this._input.get_regexp(parent._starting_pattern,true);this._match_pattern=this._input.get_regexp(parent._match_pattern,true);this._until_pattern=this._input.get_regexp(parent._until_pattern);this._until_after=parent._until_after}}Pattern.prototype.read=function(){var result=this._input.read(this._starting_pattern);if(!this._starting_pattern||result){result+=this._input.read(this._match_pattern,this._until_pattern,this._until_after)}return result};Pattern.prototype.read_match=function(){return this._input.match(this._match_pattern)};Pattern.prototype.until_after=function(pattern){var result=this._create();result._until_after=true;result._until_pattern=this._input.get_regexp(pattern);result._update();return result};Pattern.prototype.until=function(pattern){var result=this._create();result._until_after=false;result._until_pattern=this._input.get_regexp(pattern);result._update();return result};Pattern.prototype.starting_with=function(pattern){var result=this._create();result._starting_pattern=this._input.get_regexp(pattern,true);result._update();return result};Pattern.prototype.matching=function(pattern){var result=this._create();result._match_pattern=this._input.get_regexp(pattern,true);result._update();return result};Pattern.prototype._create=function(){return new Pattern(this._input,this)};Pattern.prototype._update=function(){};module.exports.Pattern=Pattern},{}],89:[function(require,module,exports){"use strict";var Pattern=require("./pattern").Pattern;var template_names={django:false,erb:false,handlebars:false,php:false,smarty:false};function TemplatablePattern(input_scanner,parent){Pattern.call(this,input_scanner,parent);this.__template_pattern=null;this._disabled=Object.assign({},template_names);this._excluded=Object.assign({},template_names);if(parent){this.__template_pattern=this._input.get_regexp(parent.__template_pattern);this._excluded=Object.assign(this._excluded,parent._excluded);this._disabled=Object.assign(this._disabled,parent._disabled)}var pattern=new Pattern(input_scanner);this.__patterns={handlebars_comment:pattern.starting_with(/{{!--/).until_after(/--}}/),handlebars_unescaped:pattern.starting_with(/{{{/).until_after(/}}}/),handlebars:pattern.starting_with(/{{/).until_after(/}}/),php:pattern.starting_with(/<\?(?:[= ]|php)/).until_after(/\?>/),erb:pattern.starting_with(/<%[^%]/).until_after(/[^%]%>/),django:pattern.starting_with(/{%/).until_after(/%}/),django_value:pattern.starting_with(/{{/).until_after(/}}/),django_comment:pattern.starting_with(/{#/).until_after(/#}/),smarty:pattern.starting_with(/{(?=[^}{\s\n])/).until_after(/[^\s\n]}/),smarty_comment:pattern.starting_with(/{\*/).until_after(/\*}/),smarty_literal:pattern.starting_with(/{literal}/).until_after(/{\/literal}/)}}TemplatablePattern.prototype=new Pattern;TemplatablePattern.prototype._create=function(){return new TemplatablePattern(this._input,this)};TemplatablePattern.prototype._update=function(){this.__set_templated_pattern()};TemplatablePattern.prototype.disable=function(language){var result=this._create();result._disabled[language]=true;result._update();return result};TemplatablePattern.prototype.read_options=function(options){var result=this._create();for(var language in template_names){result._disabled[language]=options.templating.indexOf(language)===-1}result._update();return result};TemplatablePattern.prototype.exclude=function(language){var result=this._create();result._excluded[language]=true;result._update();return result};TemplatablePattern.prototype.read=function(){var result="";if(this._match_pattern){result=this._input.read(this._starting_pattern)}else{result=this._input.read(this._starting_pattern,this.__template_pattern)}var next=this._read_template();while(next){if(this._match_pattern){next+=this._input.read(this._match_pattern)}else{next+=this._input.readUntil(this.__template_pattern)}result+=next;next=this._read_template()}if(this._until_after){result+=this._input.readUntilAfter(this._until_pattern)}return result};TemplatablePattern.prototype.__set_templated_pattern=function(){var items=[];if(!this._disabled.php){items.push(this.__patterns.php._starting_pattern.source)}if(!this._disabled.handlebars){items.push(this.__patterns.handlebars._starting_pattern.source)}if(!this._disabled.erb){items.push(this.__patterns.erb._starting_pattern.source)}if(!this._disabled.django){items.push(this.__patterns.django._starting_pattern.source);items.push(this.__patterns.django_value._starting_pattern.source);items.push(this.__patterns.django_comment._starting_pattern.source)}if(!this._disabled.smarty){items.push(this.__patterns.smarty._starting_pattern.source)}if(this._until_pattern){items.push(this._until_pattern.source)}this.__template_pattern=this._input.get_regexp("(?:"+items.join("|")+")")};TemplatablePattern.prototype._read_template=function(){var resulting_string="";var c=this._input.peek();if(c==="<"){var peek1=this._input.peek(1);if(!this._disabled.php&&!this._excluded.php&&peek1==="?"){resulting_string=resulting_string||this.__patterns.php.read()}if(!this._disabled.erb&&!this._excluded.erb&&peek1==="%"){resulting_string=resulting_string||this.__patterns.erb.read()}}else if(c==="{"){if(!this._disabled.handlebars&&!this._excluded.handlebars){resulting_string=resulting_string||this.__patterns.handlebars_comment.read();resulting_string=resulting_string||this.__patterns.handlebars_unescaped.read();resulting_string=resulting_string||this.__patterns.handlebars.read()}if(!this._disabled.django){if(!this._excluded.django&&!this._excluded.handlebars){resulting_string=resulting_string||this.__patterns.django_value.read()}if(!this._excluded.django){resulting_string=resulting_string||this.__patterns.django_comment.read();resulting_string=resulting_string||this.__patterns.django.read()}}if(!this._disabled.smarty){if(this._disabled.django&&this._disabled.handlebars){resulting_string=resulting_string||this.__patterns.smarty_comment.read();resulting_string=resulting_string||this.__patterns.smarty_literal.read();resulting_string=resulting_string||this.__patterns.smarty.read()}}}return resulting_string};module.exports.TemplatablePattern=TemplatablePattern},{"./pattern":88}],90:[function(require,module,exports){"use strict";function Token(type,text,newlines,whitespace_before){this.type=type;this.text=text;this.comments_before=null;this.newlines=newlines||0;this.whitespace_before=whitespace_before||"";this.parent=null;this.next=null;this.previous=null;this.opened=null;this.closed=null;this.directives=null}module.exports.Token=Token},{}],91:[function(require,module,exports){"use strict";var InputScanner=require("../core/inputscanner").InputScanner;var Token=require("../core/token").Token;var TokenStream=require("../core/tokenstream").TokenStream;var WhitespacePattern=require("./whitespacepattern").WhitespacePattern;var TOKEN={START:"TK_START",RAW:"TK_RAW",EOF:"TK_EOF"};var Tokenizer=function(input_string,options){this._input=new InputScanner(input_string);this._options=options||{};this.__tokens=null;this._patterns={};this._patterns.whitespace=new WhitespacePattern(this._input)};Tokenizer.prototype.tokenize=function(){this._input.restart();this.__tokens=new TokenStream;this._reset();var current;var previous=new Token(TOKEN.START,"");var open_token=null;var open_stack=[];var comments=new TokenStream;while(previous.type!==TOKEN.EOF){current=this._get_next_token(previous,open_token);while(this._is_comment(current)){comments.add(current);current=this._get_next_token(previous,open_token)}if(!comments.isEmpty()){current.comments_before=comments;comments=new TokenStream}current.parent=open_token;if(this._is_opening(current)){open_stack.push(open_token);open_token=current}else if(open_token&&this._is_closing(current,open_token)){current.opened=open_token;open_token.closed=current;open_token=open_stack.pop();current.parent=open_token}current.previous=previous;previous.next=current;this.__tokens.add(current);previous=current}return this.__tokens};Tokenizer.prototype._is_first_token=function(){return this.__tokens.isEmpty()};Tokenizer.prototype._reset=function(){};Tokenizer.prototype._get_next_token=function(previous_token,open_token){this._readWhitespace();var resulting_string=this._input.read(/.+/g);if(resulting_string){return this._create_token(TOKEN.RAW,resulting_string)}else{return this._create_token(TOKEN.EOF,"")}};Tokenizer.prototype._is_comment=function(current_token){return false};Tokenizer.prototype._is_opening=function(current_token){return false};Tokenizer.prototype._is_closing=function(current_token,open_token){return false};Tokenizer.prototype._create_token=function(type,text){var token=new Token(type,text,this._patterns.whitespace.newline_count,this._patterns.whitespace.whitespace_before_token);return token};Tokenizer.prototype._readWhitespace=function(){return this._patterns.whitespace.read()};module.exports.Tokenizer=Tokenizer;module.exports.TOKEN=TOKEN},{"../core/inputscanner":85,"../core/token":90,"../core/tokenstream":92,"./whitespacepattern":93}],92:[function(require,module,exports){"use strict";function TokenStream(parent_token){this.__tokens=[];this.__tokens_length=this.__tokens.length;this.__position=0;this.__parent_token=parent_token}TokenStream.prototype.restart=function(){this.__position=0};TokenStream.prototype.isEmpty=function(){return this.__tokens_length===0};TokenStream.prototype.hasNext=function(){return this.__position<this.__tokens_length};TokenStream.prototype.next=function(){var val=null;if(this.hasNext()){val=this.__tokens[this.__position];this.__position+=1}return val};TokenStream.prototype.peek=function(index){var val=null;index=index||0;index+=this.__position;if(index>=0&&index<this.__tokens_length){val=this.__tokens[index]}return val};TokenStream.prototype.add=function(token){if(this.__parent_token){token.parent=this.__parent_token}this.__tokens.push(token);this.__tokens_length+=1};module.exports.TokenStream=TokenStream},{}],93:[function(require,module,exports){"use strict";var Pattern=require("../core/pattern").Pattern;function WhitespacePattern(input_scanner,parent){Pattern.call(this,input_scanner,parent);if(parent){this._line_regexp=this._input.get_regexp(parent._line_regexp)}else{this.__set_whitespace_patterns("","")}this.newline_count=0;this.whitespace_before_token=""}WhitespacePattern.prototype=new Pattern;WhitespacePattern.prototype.__set_whitespace_patterns=function(whitespace_chars,newline_chars){whitespace_chars+="\\t ";newline_chars+="\\n\\r";this._match_pattern=this._input.get_regexp("["+whitespace_chars+newline_chars+"]+",true);this._newline_regexp=this._input.get_regexp("\\r\\n|["+newline_chars+"]")};WhitespacePattern.prototype.read=function(){this.newline_count=0;this.whitespace_before_token="";var resulting_string=this._input.read(this._match_pattern);if(resulting_string===" "){this.whitespace_before_token=" "}else if(resulting_string){var matches=this.__split(this._newline_regexp,resulting_string);this.newline_count=matches.length-1;this.whitespace_before_token=matches[this.newline_count]}return resulting_string};WhitespacePattern.prototype.matching=function(whitespace_chars,newline_chars){var result=this._create();result.__set_whitespace_patterns(whitespace_chars,newline_chars);result._update();return result};WhitespacePattern.prototype._create=function(){return new WhitespacePattern(this._input,this)};WhitespacePattern.prototype.__split=function(regexp,input_string){regexp.lastIndex=0;var start_index=0;var result=[];var next_match=regexp.exec(input_string);while(next_match){result.push(input_string.substring(start_index,next_match.index));start_index=next_match.index+next_match[0].length;next_match=regexp.exec(input_string)}if(start_index<input_string.length){result.push(input_string.substring(start_index,input_string.length))}else{result.push("")}return result};module.exports.WhitespacePattern=WhitespacePattern},{"../core/pattern":88}],94:[function(require,module,exports){"use strict";var Options=require("./options").Options;var Output=require("../core/output").Output;var InputScanner=require("../core/inputscanner").InputScanner;var Directives=require("../core/directives").Directives;var directives_core=new Directives(/\/\*/,/\*\//);var lineBreak=/\r\n|[\r\n]/;var allLineBreaks=/\r\n|[\r\n]/g;var whitespaceChar=/\s/;var whitespacePattern=/(?:\s|\n)+/g;var block_comment_pattern=/\/\*(?:[\s\S]*?)((?:\*\/)|$)/g;var comment_pattern=/\/\/(?:[^\n\r\u2028\u2029]*)/g;function Beautifier(source_text,options){this._source_text=source_text||"";this._options=new Options(options);this._ch=null;this._input=null;this.NESTED_AT_RULE={"@page":true,"@font-face":true,"@keyframes":true,"@media":true,"@supports":true,"@document":true};this.CONDITIONAL_GROUP_RULE={"@media":true,"@supports":true,"@document":true}}Beautifier.prototype.eatString=function(endChars){var result="";this._ch=this._input.next();while(this._ch){result+=this._ch;if(this._ch==="\\"){result+=this._input.next()}else if(endChars.indexOf(this._ch)!==-1||this._ch==="\n"){break}this._ch=this._input.next()}return result};Beautifier.prototype.eatWhitespace=function(allowAtLeastOneNewLine){var result=whitespaceChar.test(this._input.peek());var newline_count=0;while(whitespaceChar.test(this._input.peek())){this._ch=this._input.next();if(allowAtLeastOneNewLine&&this._ch==="\n"){if(newline_count===0||newline_count<this._options.max_preserve_newlines){newline_count++;this._output.add_new_line(true)}}}return result};Beautifier.prototype.foundNestedPseudoClass=function(){var openParen=0;var i=1;var ch=this._input.peek(i);while(ch){if(ch==="{"){return true}else if(ch==="("){openParen+=1}else if(ch===")"){if(openParen===0){return false}openParen-=1}else if(ch===";"||ch==="}"){return false}i++;ch=this._input.peek(i)}return false};Beautifier.prototype.print_string=function(output_string){this._output.set_indent(this._indentLevel);this._output.non_breaking_space=true;this._output.add_token(output_string)};Beautifier.prototype.preserveSingleSpace=function(isAfterSpace){if(isAfterSpace){this._output.space_before_token=true}};Beautifier.prototype.indent=function(){this._indentLevel++};Beautifier.prototype.outdent=function(){if(this._indentLevel>0){this._indentLevel--}};Beautifier.prototype.beautify=function(){if(this._options.disabled){return this._source_text}var source_text=this._source_text;var eol=this._options.eol;if(eol==="auto"){eol="\n";if(source_text&&lineBreak.test(source_text||"")){eol=source_text.match(lineBreak)[0]}}source_text=source_text.replace(allLineBreaks,"\n");var baseIndentString=source_text.match(/^[\t ]*/)[0];this._output=new Output(this._options,baseIndentString);this._input=new InputScanner(source_text);this._indentLevel=0;this._nestedLevel=0;this._ch=null;var parenLevel=0;var insideRule=false;var insidePropertyValue=false;var enteringConditionalGroup=false;var insideAtExtend=false;var insideAtImport=false;var topCharacter=this._ch;var whitespace;var isAfterSpace;var previous_ch;while(true){whitespace=this._input.read(whitespacePattern);isAfterSpace=whitespace!=="";previous_ch=topCharacter;this._ch=this._input.next();if(this._ch==="\\"&&this._input.hasNext()){this._ch+=this._input.next()}topCharacter=this._ch;if(!this._ch){break}else if(this._ch==="/"&&this._input.peek()==="*"){this._output.add_new_line();this._input.back();var comment=this._input.read(block_comment_pattern);var directives=directives_core.get_directives(comment);if(directives&&directives.ignore==="start"){comment+=directives_core.readIgnored(this._input)}this.print_string(comment);this.eatWhitespace(true);this._output.add_new_line()}else if(this._ch==="/"&&this._input.peek()==="/"){this._output.space_before_token=true;this._input.back();this.print_string(this._input.read(comment_pattern));this.eatWhitespace(true)}else if(this._ch==="@"){this.preserveSingleSpace(isAfterSpace);if(this._input.peek()==="{"){this.print_string(this._ch+this.eatString("}"))}else{this.print_string(this._ch);var variableOrRule=this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);if(variableOrRule.match(/[ :]$/)){variableOrRule=this.eatString(": ").replace(/\s$/,"");this.print_string(variableOrRule);this._output.space_before_token=true}variableOrRule=variableOrRule.replace(/\s$/,"");if(variableOrRule==="extend"){insideAtExtend=true}else if(variableOrRule==="import"){insideAtImport=true}if(variableOrRule in this.NESTED_AT_RULE){this._nestedLevel+=1;if(variableOrRule in this.CONDITIONAL_GROUP_RULE){enteringConditionalGroup=true}}else if(!insideRule&&parenLevel===0&&variableOrRule.indexOf(":")!==-1){insidePropertyValue=true;this.indent()}}}else if(this._ch==="#"&&this._input.peek()==="{"){this.preserveSingleSpace(isAfterSpace);this.print_string(this._ch+this.eatString("}"))}else if(this._ch==="{"){if(insidePropertyValue){insidePropertyValue=false;this.outdent()}if(enteringConditionalGroup){enteringConditionalGroup=false;insideRule=this._indentLevel>=this._nestedLevel}else{insideRule=this._indentLevel>=this._nestedLevel-1}if(this._options.newline_between_rules&&insideRule){if(this._output.previous_line&&this._output.previous_line.item(-1)!=="{"){this._output.ensure_empty_line_above("/",",")}}this._output.space_before_token=true;if(this._options.brace_style==="expand"){this._output.add_new_line();this.print_string(this._ch);this.indent();this._output.set_indent(this._indentLevel)}else{this.indent();this.print_string(this._ch)}this.eatWhitespace(true);this._output.add_new_line()}else if(this._ch==="}"){this.outdent();this._output.add_new_line();if(previous_ch==="{"){this._output.trim(true)}insideAtImport=false;insideAtExtend=false;if(insidePropertyValue){this.outdent();insidePropertyValue=false}this.print_string(this._ch);insideRule=false;if(this._nestedLevel){this._nestedLevel--}this.eatWhitespace(true);this._output.add_new_line();if(this._options.newline_between_rules&&!this._output.just_added_blankline()){if(this._input.peek()!=="}"){this._output.add_new_line(true)}}}else if(this._ch===":"){if((insideRule||enteringConditionalGroup)&&!(this._input.lookBack("&")||this.foundNestedPseudoClass())&&!this._input.lookBack("(")&&!insideAtExtend&&parenLevel===0){this.print_string(":");if(!insidePropertyValue){insidePropertyValue=true;this._output.space_before_token=true;this.eatWhitespace(true);this.indent()}}else{if(this._input.lookBack(" ")){this._output.space_before_token=true}if(this._input.peek()===":"){this._ch=this._input.next();this.print_string("::")}else{this.print_string(":")}}}else if(this._ch==='"'||this._ch==="'"){this.preserveSingleSpace(isAfterSpace);this.print_string(this._ch+this.eatString(this._ch));this.eatWhitespace(true)}else if(this._ch===";"){if(parenLevel===0){if(insidePropertyValue){this.outdent();insidePropertyValue=false}insideAtExtend=false;insideAtImport=false;this.print_string(this._ch);this.eatWhitespace(true);if(this._input.peek()!=="/"){this._output.add_new_line()}}else{this.print_string(this._ch);this.eatWhitespace(true);this._output.space_before_token=true}}else if(this._ch==="("){if(this._input.lookBack("url")){this.print_string(this._ch);this.eatWhitespace();parenLevel++;this.indent();this._ch=this._input.next();if(this._ch===")"||this._ch==='"'||this._ch==="'"){this._input.back()}else if(this._ch){this.print_string(this._ch+this.eatString(")"));if(parenLevel){parenLevel--;this.outdent()}}}else{this.preserveSingleSpace(isAfterSpace);this.print_string(this._ch);this.eatWhitespace();parenLevel++;this.indent()}}else if(this._ch===")"){if(parenLevel){parenLevel--;this.outdent()}this.print_string(this._ch)}else if(this._ch===","){this.print_string(this._ch);this.eatWhitespace(true);if(this._options.selector_separator_newline&&!insidePropertyValue&&parenLevel===0&&!insideAtImport&&!insideAtExtend){this._output.add_new_line()}else{this._output.space_before_token=true}}else if((this._ch===">"||this._ch==="+"||this._ch==="~")&&!insidePropertyValue&&parenLevel===0){if(this._options.space_around_combinator){this._output.space_before_token=true;this.print_string(this._ch);this._output.space_before_token=true}else{this.print_string(this._ch);this.eatWhitespace();if(this._ch&&whitespaceChar.test(this._ch)){this._ch=""}}}else if(this._ch==="]"){this.print_string(this._ch)}else if(this._ch==="["){this.preserveSingleSpace(isAfterSpace);this.print_string(this._ch)}else if(this._ch==="="){this.eatWhitespace();this.print_string("=");if(whitespaceChar.test(this._ch)){this._ch=""}}else if(this._ch==="!"&&!this._input.lookBack("\\")){this.print_string(" ");this.print_string(this._ch)}else{this.preserveSingleSpace(isAfterSpace);this.print_string(this._ch)}}var sweetCode=this._output.get_code(eol);return sweetCode};module.exports.Beautifier=Beautifier},{"../core/directives":84,"../core/inputscanner":85,"../core/output":87,"./options":96}],95:[function(require,module,exports){"use strict";var Beautifier=require("./beautifier").Beautifier,Options=require("./options").Options;function css_beautify(source_text,options){var beautifier=new Beautifier(source_text,options);return beautifier.beautify()}module.exports=css_beautify;module.exports.defaultOptions=function(){return new Options}},{"./beautifier":94,"./options":96}],96:[function(require,module,exports){"use strict";var BaseOptions=require("../core/options").Options;function Options(options){BaseOptions.call(this,options,"css");this.selector_separator_newline=this._get_boolean("selector_separator_newline",true);this.newline_between_rules=this._get_boolean("newline_between_rules",true);var space_around_selector_separator=this._get_boolean("space_around_selector_separator");this.space_around_combinator=this._get_boolean("space_around_combinator")||space_around_selector_separator;var brace_style_split=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_style="collapse";for(var bs=0;bs<brace_style_split.length;bs++){if(brace_style_split[bs]!=="expand"){this.brace_style="collapse"}else{this.brace_style=brace_style_split[bs]}}}Options.prototype=new BaseOptions;module.exports.Options=Options},{"../core/options":86}],97:[function(require,module,exports){"use strict";var Options=require("../html/options").Options;var Output=require("../core/output").Output;var Tokenizer=require("../html/tokenizer").Tokenizer;var TOKEN=require("../html/tokenizer").TOKEN;var lineBreak=/\r\n|[\r\n]/;var allLineBreaks=/\r\n|[\r\n]/g;var Printer=function(options,base_indent_string){this.indent_level=0;this.alignment_size=0;this.max_preserve_newlines=options.max_preserve_newlines;this.preserve_newlines=options.preserve_newlines;this._output=new Output(options,base_indent_string)};Printer.prototype.current_line_has_match=function(pattern){return this._output.current_line.has_match(pattern)};Printer.prototype.set_space_before_token=function(value,non_breaking){this._output.space_before_token=value;this._output.non_breaking_space=non_breaking};Printer.prototype.set_wrap_point=function(){this._output.set_indent(this.indent_level,this.alignment_size);this._output.set_wrap_point()};Printer.prototype.add_raw_token=function(token){this._output.add_raw_token(token)};Printer.prototype.print_preserved_newlines=function(raw_token){var newlines=0;if(raw_token.type!==TOKEN.TEXT&&raw_token.previous.type!==TOKEN.TEXT){newlines=raw_token.newlines?1:0}if(this.preserve_newlines){newlines=raw_token.newlines<this.max_preserve_newlines+1?raw_token.newlines:this.max_preserve_newlines+1}for(var n=0;n<newlines;n++){this.print_newline(n>0)}return newlines!==0};Printer.prototype.traverse_whitespace=function(raw_token){if(raw_token.whitespace_before||raw_token.newlines){if(!this.print_preserved_newlines(raw_token)){this._output.space_before_token=true}return true}return false};Printer.prototype.previous_token_wrapped=function(){return this._output.previous_token_wrapped};Printer.prototype.print_newline=function(force){this._output.add_new_line(force)};Printer.prototype.print_token=function(token){if(token.text){this._output.set_indent(this.indent_level,this.alignment_size);this._output.add_token(token.text)}};Printer.prototype.indent=function(){this.indent_level++};Printer.prototype.get_full_indent=function(level){level=this.indent_level+(level||0);if(level<1){return""}return this._output.get_indent_string(level)};var get_type_attribute=function(start_token){var result=null;var raw_token=start_token.next;while(raw_token.type!==TOKEN.EOF&&start_token.closed!==raw_token){if(raw_token.type===TOKEN.ATTRIBUTE&&raw_token.text==="type"){if(raw_token.next&&raw_token.next.type===TOKEN.EQUALS&&raw_token.next.next&&raw_token.next.next.type===TOKEN.VALUE){result=raw_token.next.next.text}break}raw_token=raw_token.next}return result};var get_custom_beautifier_name=function(tag_check,raw_token){var typeAttribute=null;var result=null;if(!raw_token.closed){return null}if(tag_check==="script"){typeAttribute="text/javascript"}else if(tag_check==="style"){typeAttribute="text/css"}typeAttribute=get_type_attribute(raw_token)||typeAttribute;if(typeAttribute.search("text/css")>-1){result="css"}else if(typeAttribute.search(/module|((text|application|dojo)\/(x-)?(javascript|ecmascript|jscript|livescript|(ld\+)?json|method|aspect))/)>-1){result="javascript"}else if(typeAttribute.search(/(text|application|dojo)\/(x-)?(html)/)>-1){result="html"}else if(typeAttribute.search(/test\/null/)>-1){result="null"}return result};function in_array(what,arr){return arr.indexOf(what)!==-1}function TagFrame(parent,parser_token,indent_level){this.parent=parent||null;this.tag=parser_token?parser_token.tag_name:"";this.indent_level=indent_level||0;this.parser_token=parser_token||null}function TagStack(printer){this._printer=printer;this._current_frame=null}TagStack.prototype.get_parser_token=function(){return this._current_frame?this._current_frame.parser_token:null};TagStack.prototype.record_tag=function(parser_token){var new_frame=new TagFrame(this._current_frame,parser_token,this._printer.indent_level);this._current_frame=new_frame};TagStack.prototype._try_pop_frame=function(frame){var parser_token=null;if(frame){parser_token=frame.parser_token;this._printer.indent_level=frame.indent_level;this._current_frame=frame.parent}return parser_token};TagStack.prototype._get_frame=function(tag_list,stop_list){var frame=this._current_frame;while(frame){if(tag_list.indexOf(frame.tag)!==-1){break}else if(stop_list&&stop_list.indexOf(frame.tag)!==-1){frame=null;break}frame=frame.parent}return frame};TagStack.prototype.try_pop=function(tag,stop_list){var frame=this._get_frame([tag],stop_list);return this._try_pop_frame(frame)};TagStack.prototype.indent_to_tag=function(tag_list){var frame=this._get_frame(tag_list);if(frame){this._printer.indent_level=frame.indent_level}};function Beautifier(source_text,options,js_beautify,css_beautify){this._source_text=source_text||"";options=options||{};this._js_beautify=js_beautify;this._css_beautify=css_beautify;this._tag_stack=null;var optionHtml=new Options(options,"html");this._options=optionHtml;this._is_wrap_attributes_force=this._options.wrap_attributes.substr(0,"force".length)==="force";this._is_wrap_attributes_force_expand_multiline=this._options.wrap_attributes==="force-expand-multiline";this._is_wrap_attributes_force_aligned=this._options.wrap_attributes==="force-aligned";this._is_wrap_attributes_aligned_multiple=this._options.wrap_attributes==="aligned-multiple";this._is_wrap_attributes_preserve=this._options.wrap_attributes.substr(0,"preserve".length)==="preserve";this._is_wrap_attributes_preserve_aligned=this._options.wrap_attributes==="preserve-aligned"}Beautifier.prototype.beautify=function(){if(this._options.disabled){return this._source_text}var source_text=this._source_text;var eol=this._options.eol;if(this._options.eol==="auto"){eol="\n";if(source_text&&lineBreak.test(source_text)){eol=source_text.match(lineBreak)[0]}}source_text=source_text.replace(allLineBreaks,"\n");var baseIndentString=source_text.match(/^[\t ]*/)[0];var last_token={text:"",type:""};var last_tag_token=new TagOpenParserToken;var printer=new Printer(this._options,baseIndentString);var tokens=new Tokenizer(source_text,this._options).tokenize();this._tag_stack=new TagStack(printer);var parser_token=null;var raw_token=tokens.next();while(raw_token.type!==TOKEN.EOF){if(raw_token.type===TOKEN.TAG_OPEN||raw_token.type===TOKEN.COMMENT){parser_token=this._handle_tag_open(printer,raw_token,last_tag_token,last_token);last_tag_token=parser_token}else if(raw_token.type===TOKEN.ATTRIBUTE||raw_token.type===TOKEN.EQUALS||raw_token.type===TOKEN.VALUE||raw_token.type===TOKEN.TEXT&&!last_tag_token.tag_complete){parser_token=this._handle_inside_tag(printer,raw_token,last_tag_token,tokens)}else if(raw_token.type===TOKEN.TAG_CLOSE){parser_token=this._handle_tag_close(printer,raw_token,last_tag_token)}else if(raw_token.type===TOKEN.TEXT){parser_token=this._handle_text(printer,raw_token,last_tag_token)}else{printer.add_raw_token(raw_token)}last_token=parser_token;raw_token=tokens.next()}var sweet_code=printer._output.get_code(eol);return sweet_code};Beautifier.prototype._handle_tag_close=function(printer,raw_token,last_tag_token){var parser_token={text:raw_token.text,type:raw_token.type};printer.alignment_size=0;last_tag_token.tag_complete=true;printer.set_space_before_token(raw_token.newlines||raw_token.whitespace_before!=="",true);if(last_tag_token.is_unformatted){printer.add_raw_token(raw_token)}else{if(last_tag_token.tag_start_char==="<"){printer.set_space_before_token(raw_token.text[0]==="/",true);if(this._is_wrap_attributes_force_expand_multiline&&last_tag_token.has_wrapped_attrs){printer.print_newline(false)}}printer.print_token(raw_token)}if(last_tag_token.indent_content&&!(last_tag_token.is_unformatted||last_tag_token.is_content_unformatted)){printer.indent();last_tag_token.indent_content=false}if(!last_tag_token.is_inline_element&&!(last_tag_token.is_unformatted||last_tag_token.is_content_unformatted)){printer.set_wrap_point()}return parser_token};Beautifier.prototype._handle_inside_tag=function(printer,raw_token,last_tag_token,tokens){var wrapped=last_tag_token.has_wrapped_attrs;var parser_token={text:raw_token.text,type:raw_token.type};printer.set_space_before_token(raw_token.newlines||raw_token.whitespace_before!=="",true);if(last_tag_token.is_unformatted){printer.add_raw_token(raw_token)}else if(last_tag_token.tag_start_char==="{"&&raw_token.type===TOKEN.TEXT){if(printer.print_preserved_newlines(raw_token)){raw_token.newlines=0;printer.add_raw_token(raw_token)}else{printer.print_token(raw_token)}}else{if(raw_token.type===TOKEN.ATTRIBUTE){printer.set_space_before_token(true);last_tag_token.attr_count+=1}else if(raw_token.type===TOKEN.EQUALS){printer.set_space_before_token(false)}else if(raw_token.type===TOKEN.VALUE&&raw_token.previous.type===TOKEN.EQUALS){printer.set_space_before_token(false)}if(raw_token.type===TOKEN.ATTRIBUTE&&last_tag_token.tag_start_char==="<"){if(this._is_wrap_attributes_preserve||this._is_wrap_attributes_preserve_aligned){printer.traverse_whitespace(raw_token);wrapped=wrapped||raw_token.newlines!==0}if(this._is_wrap_attributes_force){var force_attr_wrap=last_tag_token.attr_count>1;if(this._is_wrap_attributes_force_expand_multiline&&last_tag_token.attr_count===1){var is_only_attribute=true;var peek_index=0;var peek_token;do{peek_token=tokens.peek(peek_index);if(peek_token.type===TOKEN.ATTRIBUTE){is_only_attribute=false;break}peek_index+=1}while(peek_index<4&&peek_token.type!==TOKEN.EOF&&peek_token.type!==TOKEN.TAG_CLOSE);force_attr_wrap=!is_only_attribute}if(force_attr_wrap){printer.print_newline(false);wrapped=true}}}printer.print_token(raw_token);wrapped=wrapped||printer.previous_token_wrapped();last_tag_token.has_wrapped_attrs=wrapped}return parser_token};Beautifier.prototype._handle_text=function(printer,raw_token,last_tag_token){var parser_token={text:raw_token.text,type:"TK_CONTENT"};if(last_tag_token.custom_beautifier_name){this._print_custom_beatifier_text(printer,raw_token,last_tag_token)}else if(last_tag_token.is_unformatted||last_tag_token.is_content_unformatted){printer.add_raw_token(raw_token)}else{printer.traverse_whitespace(raw_token);printer.print_token(raw_token)}return parser_token};Beautifier.prototype._print_custom_beatifier_text=function(printer,raw_token,last_tag_token){var local=this;if(raw_token.text!==""){var text=raw_token.text,_beautifier,script_indent_level=1,pre="",post="";if(last_tag_token.custom_beautifier_name==="javascript"&&typeof this._js_beautify==="function"){_beautifier=this._js_beautify}else if(last_tag_token.custom_beautifier_name==="css"&&typeof this._css_beautify==="function"){_beautifier=this._css_beautify}else if(last_tag_token.custom_beautifier_name==="html"){_beautifier=function(html_source,options){var beautifier=new Beautifier(html_source,options,local._js_beautify,local._css_beautify);return beautifier.beautify()}}if(this._options.indent_scripts==="keep"){script_indent_level=0}else if(this._options.indent_scripts==="separate"){script_indent_level=-printer.indent_level}var indentation=printer.get_full_indent(script_indent_level);text=text.replace(/\n[ \t]*$/,"");if(last_tag_token.custom_beautifier_name!=="html"&&text[0]==="<"&&text.match(/^(<!--|<!\[CDATA\[)/)){var matched=/^(<!--[^\n]*|<!\[CDATA\[)(\n?)([ \t\n]*)([\s\S]*)(-->|]]>)$/.exec(text);if(!matched){printer.add_raw_token(raw_token);return}pre=indentation+matched[1]+"\n";text=matched[4];if(matched[5]){post=indentation+matched[5]}text=text.replace(/\n[ \t]*$/,"");if(matched[2]||matched[3].indexOf("\n")!==-1){matched=matched[3].match(/[ \t]+$/);if(matched){raw_token.whitespace_before=matched[0]}}}if(text){if(_beautifier){var Child_options=function(){this.eol="\n"};Child_options.prototype=this._options.raw_options;var child_options=new Child_options;text=_beautifier(indentation+text,child_options)}else{var white=raw_token.whitespace_before;if(white){text=text.replace(new RegExp("\n("+white+")?","g"),"\n")}text=indentation+text.replace(/\n/g,"\n"+indentation)}}if(pre){if(!text){text=pre+post}else{text=pre+text+"\n"+post}}printer.print_newline(false);if(text){raw_token.text=text;raw_token.whitespace_before="";raw_token.newlines=0;printer.add_raw_token(raw_token);printer.print_newline(true)}}};Beautifier.prototype._handle_tag_open=function(printer,raw_token,last_tag_token,last_token){var parser_token=this._get_tag_open_token(raw_token);if((last_tag_token.is_unformatted||last_tag_token.is_content_unformatted)&&!last_tag_token.is_empty_element&&raw_token.type===TOKEN.TAG_OPEN&&raw_token.text.indexOf("</")===0){printer.add_raw_token(raw_token);parser_token.start_tag_token=this._tag_stack.try_pop(parser_token.tag_name)}else{printer.traverse_whitespace(raw_token);this._set_tag_position(printer,raw_token,parser_token,last_tag_token,last_token);if(!parser_token.is_inline_element){printer.set_wrap_point()}printer.print_token(raw_token)}if(this._is_wrap_attributes_force_aligned||this._is_wrap_attributes_aligned_multiple||this._is_wrap_attributes_preserve_aligned){parser_token.alignment_size=raw_token.text.length+1}if(!parser_token.tag_complete&&!parser_token.is_unformatted){printer.alignment_size=parser_token.alignment_size}return parser_token};var TagOpenParserToken=function(parent,raw_token){this.parent=parent||null;this.text="";this.type="TK_TAG_OPEN";this.tag_name="";this.is_inline_element=false;this.is_unformatted=false;this.is_content_unformatted=false;this.is_empty_element=false;this.is_start_tag=false;this.is_end_tag=false;this.indent_content=false;this.multiline_content=false;this.custom_beautifier_name=null;this.start_tag_token=null;this.attr_count=0;this.has_wrapped_attrs=false;this.alignment_size=0;this.tag_complete=false;this.tag_start_char="";this.tag_check="";if(!raw_token){this.tag_complete=true}else{var tag_check_match;this.tag_start_char=raw_token.text[0];this.text=raw_token.text;if(this.tag_start_char==="<"){tag_check_match=raw_token.text.match(/^<([^\s>]*)/);this.tag_check=tag_check_match?tag_check_match[1]:""}else{tag_check_match=raw_token.text.match(/^{{(?:[\^]|#\*?)?([^\s}]+)/);this.tag_check=tag_check_match?tag_check_match[1]:"";if(raw_token.text==="{{#>"&&this.tag_check===">"&&raw_token.next!==null){this.tag_check=raw_token.next.text}}this.tag_check=this.tag_check.toLowerCase();if(raw_token.type===TOKEN.COMMENT){this.tag_complete=true}this.is_start_tag=this.tag_check.charAt(0)!=="/";this.tag_name=!this.is_start_tag?this.tag_check.substr(1):this.tag_check;this.is_end_tag=!this.is_start_tag||raw_token.closed&&raw_token.closed.text==="/>";this.is_end_tag=this.is_end_tag||this.tag_start_char==="{"&&(this.text.length<3||/[^#\^]/.test(this.text.charAt(2)))}};Beautifier.prototype._get_tag_open_token=function(raw_token){var parser_token=new TagOpenParserToken(this._tag_stack.get_parser_token(),raw_token);parser_token.alignment_size=this._options.wrap_attributes_indent_size;parser_token.is_end_tag=parser_token.is_end_tag||in_array(parser_token.tag_check,this._options.void_elements);parser_token.is_empty_element=parser_token.tag_complete||parser_token.is_start_tag&&parser_token.is_end_tag;parser_token.is_unformatted=!parser_token.tag_complete&&in_array(parser_token.tag_check,this._options.unformatted);parser_token.is_content_unformatted=!parser_token.is_empty_element&&in_array(parser_token.tag_check,this._options.content_unformatted);parser_token.is_inline_element=in_array(parser_token.tag_name,this._options.inline)||parser_token.tag_start_char==="{";return parser_token};Beautifier.prototype._set_tag_position=function(printer,raw_token,parser_token,last_tag_token,last_token){if(!parser_token.is_empty_element){if(parser_token.is_end_tag){parser_token.start_tag_token=this._tag_stack.try_pop(parser_token.tag_name)}else{if(this._do_optional_end_element(parser_token)){if(!parser_token.is_inline_element){printer.print_newline(false)}}this._tag_stack.record_tag(parser_token);if((parser_token.tag_name==="script"||parser_token.tag_name==="style")&&!(parser_token.is_unformatted||parser_token.is_content_unformatted)){parser_token.custom_beautifier_name=get_custom_beautifier_name(parser_token.tag_check,raw_token)}}}if(in_array(parser_token.tag_check,this._options.extra_liners)){printer.print_newline(false);if(!printer._output.just_added_blankline()){printer.print_newline(true)}}if(parser_token.is_empty_element){if(parser_token.tag_start_char==="{"&&parser_token.tag_check==="else"){this._tag_stack.indent_to_tag(["if","unless","each"]);parser_token.indent_content=true;var foundIfOnCurrentLine=printer.current_line_has_match(/{{#if/);if(!foundIfOnCurrentLine){printer.print_newline(false)}}if(parser_token.tag_name==="!--"&&last_token.type===TOKEN.TAG_CLOSE&&last_tag_token.is_end_tag&&parser_token.text.indexOf("\n")===-1){}else{if(!(parser_token.is_inline_element||parser_token.is_unformatted)){printer.print_newline(false)}this._calcluate_parent_multiline(printer,parser_token)}}else if(parser_token.is_end_tag){var do_end_expand=false;do_end_expand=parser_token.start_tag_token&&parser_token.start_tag_token.multiline_content;do_end_expand=do_end_expand||!parser_token.is_inline_element&&!(last_tag_token.is_inline_element||last_tag_token.is_unformatted)&&!(last_token.type===TOKEN.TAG_CLOSE&&parser_token.start_tag_token===last_tag_token)&&last_token.type!=="TK_CONTENT";if(parser_token.is_content_unformatted||parser_token.is_unformatted){do_end_expand=false}if(do_end_expand){printer.print_newline(false)}}else{parser_token.indent_content=!parser_token.custom_beautifier_name;if(parser_token.tag_start_char==="<"){if(parser_token.tag_name==="html"){parser_token.indent_content=this._options.indent_inner_html}else if(parser_token.tag_name==="head"){parser_token.indent_content=this._options.indent_head_inner_html}else if(parser_token.tag_name==="body"){parser_token.indent_content=this._options.indent_body_inner_html}}if(!(parser_token.is_inline_element||parser_token.is_unformatted)&&(last_token.type!=="TK_CONTENT"||parser_token.is_content_unformatted)){printer.print_newline(false)}this._calcluate_parent_multiline(printer,parser_token)}};Beautifier.prototype._calcluate_parent_multiline=function(printer,parser_token){if(parser_token.parent&&printer._output.just_added_newline()&&!((parser_token.is_inline_element||parser_token.is_unformatted)&&parser_token.parent.is_inline_element)){parser_token.parent.multiline_content=true}};var p_closers=["address","article","aside","blockquote","details","div","dl","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hr","main","nav","ol","p","pre","section","table","ul"];var p_parent_excludes=["a","audio","del","ins","map","noscript","video"];Beautifier.prototype._do_optional_end_element=function(parser_token){var result=null;if(parser_token.is_empty_element||!parser_token.is_start_tag||!parser_token.parent){return}if(parser_token.tag_name==="body"){result=result||this._tag_stack.try_pop("head")}else if(parser_token.tag_name==="li"){result=result||this._tag_stack.try_pop("li",["ol","ul"])}else if(parser_token.tag_name==="dd"||parser_token.tag_name==="dt"){result=result||this._tag_stack.try_pop("dt",["dl"]);result=result||this._tag_stack.try_pop("dd",["dl"])}else if(parser_token.parent.tag_name==="p"&&p_closers.indexOf(parser_token.tag_name)!==-1){var p_parent=parser_token.parent.parent;if(!p_parent||p_parent_excludes.indexOf(p_parent.tag_name)===-1){result=result||this._tag_stack.try_pop("p")}}else if(parser_token.tag_name==="rp"||parser_token.tag_name==="rt"){result=result||this._tag_stack.try_pop("rt",["ruby","rtc"]);result=result||this._tag_stack.try_pop("rp",["ruby","rtc"])}else if(parser_token.tag_name==="optgroup"){result=result||this._tag_stack.try_pop("optgroup",["select"])}else if(parser_token.tag_name==="option"){result=result||this._tag_stack.try_pop("option",["select","datalist","optgroup"])}else if(parser_token.tag_name==="colgroup"){result=result||this._tag_stack.try_pop("caption",["table"])}else if(parser_token.tag_name==="thead"){result=result||this._tag_stack.try_pop("caption",["table"]);result=result||this._tag_stack.try_pop("colgroup",["table"])}else if(parser_token.tag_name==="tbody"||parser_token.tag_name==="tfoot"){result=result||this._tag_stack.try_pop("caption",["table"]);result=result||this._tag_stack.try_pop("colgroup",["table"]);result=result||this._tag_stack.try_pop("thead",["table"]);result=result||this._tag_stack.try_pop("tbody",["table"])}else if(parser_token.tag_name==="tr"){result=result||this._tag_stack.try_pop("caption",["table"]);result=result||this._tag_stack.try_pop("colgroup",["table"]);result=result||this._tag_stack.try_pop("tr",["table","thead","tbody","tfoot"])}else if(parser_token.tag_name==="th"||parser_token.tag_name==="td"){result=result||this._tag_stack.try_pop("td",["table","thead","tbody","tfoot","tr"]);result=result||this._tag_stack.try_pop("th",["table","thead","tbody","tfoot","tr"])}parser_token.parent=this._tag_stack.get_parser_token();return result};module.exports.Beautifier=Beautifier},{"../core/output":87,"../html/options":99,"../html/tokenizer":100}],98:[function(require,module,exports){"use strict";var Beautifier=require("./beautifier").Beautifier,Options=require("./options").Options;function style_html(html_source,options,js_beautify,css_beautify){var beautifier=new Beautifier(html_source,options,js_beautify,css_beautify);return beautifier.beautify()}module.exports=style_html;module.exports.defaultOptions=function(){return new Options}},{"./beautifier":97,"./options":99}],99:[function(require,module,exports){"use strict";var BaseOptions=require("../core/options").Options;function Options(options){BaseOptions.call(this,options,"html");if(this.templating.length===1&&this.templating[0]==="auto"){this.templating=["django","erb","handlebars","php"]}this.indent_inner_html=this._get_boolean("indent_inner_html");this.indent_body_inner_html=this._get_boolean("indent_body_inner_html",true);this.indent_head_inner_html=this._get_boolean("indent_head_inner_html",true);this.indent_handlebars=this._get_boolean("indent_handlebars",true);this.wrap_attributes=this._get_selection("wrap_attributes",["auto","force","force-aligned","force-expand-multiline","aligned-multiple","preserve","preserve-aligned"]);this.wrap_attributes_indent_size=this._get_number("wrap_attributes_indent_size",this.indent_size);this.extra_liners=this._get_array("extra_liners",["head","body","/html"]);this.inline=this._get_array("inline",["a","abbr","area","audio","b","bdi","bdo","br","button","canvas","cite","code","data","datalist","del","dfn","em","embed","i","iframe","img","input","ins","kbd","keygen","label","map","mark","math","meter","noscript","object","output","progress","q","ruby","s","samp","select","small","span","strong","sub","sup","svg","template","textarea","time","u","var","video","wbr","text","acronym","big","strike","tt"]);this.void_elements=this._get_array("void_elements",["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr","!doctype","?xml","basefont","isindex"]);this.unformatted=this._get_array("unformatted",[]);this.content_unformatted=this._get_array("content_unformatted",["pre","textarea"]);this.unformatted_content_delimiter=this._get_characters("unformatted_content_delimiter");this.indent_scripts=this._get_selection("indent_scripts",["normal","keep","separate"])}Options.prototype=new BaseOptions;module.exports.Options=Options},{"../core/options":86}],100:[function(require,module,exports){"use strict";var BaseTokenizer=require("../core/tokenizer").Tokenizer;var BASETOKEN=require("../core/tokenizer").TOKEN;var Directives=require("../core/directives").Directives;var TemplatablePattern=require("../core/templatablepattern").TemplatablePattern;var Pattern=require("../core/pattern").Pattern;var TOKEN={TAG_OPEN:"TK_TAG_OPEN",TAG_CLOSE:"TK_TAG_CLOSE",ATTRIBUTE:"TK_ATTRIBUTE",EQUALS:"TK_EQUALS",VALUE:"TK_VALUE",COMMENT:"TK_COMMENT",TEXT:"TK_TEXT",UNKNOWN:"TK_UNKNOWN",START:BASETOKEN.START,RAW:BASETOKEN.RAW,EOF:BASETOKEN.EOF};var directives_core=new Directives(/<\!--/,/-->/);var Tokenizer=function(input_string,options){BaseTokenizer.call(this,input_string,options);this._current_tag_name="";var templatable_reader=new TemplatablePattern(this._input).read_options(this._options);var pattern_reader=new Pattern(this._input);this.__patterns={word:templatable_reader.until(/[\n\r\t <]/),single_quote:templatable_reader.until_after(/'/),double_quote:templatable_reader.until_after(/"/),attribute:templatable_reader.until(/[\n\r\t =>]|\/>/),element_name:templatable_reader.until(/[\n\r\t >\/]/),handlebars_comment:pattern_reader.starting_with(/{{!--/).until_after(/--}}/),handlebars:pattern_reader.starting_with(/{{/).until_after(/}}/),handlebars_open:pattern_reader.until(/[\n\r\t }]/),handlebars_raw_close:pattern_reader.until(/}}/),comment:pattern_reader.starting_with(/<!--/).until_after(/-->/),cdata:pattern_reader.starting_with(/<!\[CDATA\[/).until_after(/]]>/),conditional_comment:pattern_reader.starting_with(/<!\[/).until_after(/]>/),processing:pattern_reader.starting_with(/<\?/).until_after(/\?>/)};if(this._options.indent_handlebars){this.__patterns.word=this.__patterns.word.exclude("handlebars")}this._unformatted_content_delimiter=null;if(this._options.unformatted_content_delimiter){var literal_regexp=this._input.get_literal_regexp(this._options.unformatted_content_delimiter);this.__patterns.unformatted_content_delimiter=pattern_reader.matching(literal_regexp).until_after(literal_regexp)}};Tokenizer.prototype=new BaseTokenizer;Tokenizer.prototype._is_comment=function(current_token){return false};Tokenizer.prototype._is_opening=function(current_token){return current_token.type===TOKEN.TAG_OPEN};Tokenizer.prototype._is_closing=function(current_token,open_token){return current_token.type===TOKEN.TAG_CLOSE&&(open_token&&((current_token.text===">"||current_token.text==="/>")&&open_token.text[0]==="<"||current_token.text==="}}"&&open_token.text[0]==="{"&&open_token.text[1]==="{"))};Tokenizer.prototype._reset=function(){this._current_tag_name=""};Tokenizer.prototype._get_next_token=function(previous_token,open_token){var token=null;this._readWhitespace();var c=this._input.peek();if(c===null){return this._create_token(TOKEN.EOF,"")}token=token||this._read_open_handlebars(c,open_token);token=token||this._read_attribute(c,previous_token,open_token);token=token||this._read_close(c,open_token);token=token||this._read_raw_content(c,previous_token,open_token);token=token||this._read_content_word(c);token=token||this._read_comment_or_cdata(c);token=token||this._read_processing(c);token=token||this._read_open(c,open_token);token=token||this._create_token(TOKEN.UNKNOWN,this._input.next());return token};Tokenizer.prototype._read_comment_or_cdata=function(c){var token=null;var resulting_string=null;var directives=null;if(c==="<"){var peek1=this._input.peek(1);if(peek1==="!"){resulting_string=this.__patterns.comment.read();if(resulting_string){directives=directives_core.get_directives(resulting_string);if(directives&&directives.ignore==="start"){resulting_string+=directives_core.readIgnored(this._input)}}else{resulting_string=this.__patterns.cdata.read()}}if(resulting_string){token=this._create_token(TOKEN.COMMENT,resulting_string);token.directives=directives}}return token};Tokenizer.prototype._read_processing=function(c){var token=null;var resulting_string=null;var directives=null;if(c==="<"){var peek1=this._input.peek(1);if(peek1==="!"||peek1==="?"){resulting_string=this.__patterns.conditional_comment.read();resulting_string=resulting_string||this.__patterns.processing.read()}if(resulting_string){token=this._create_token(TOKEN.COMMENT,resulting_string);token.directives=directives}}return token};Tokenizer.prototype._read_open=function(c,open_token){var resulting_string=null;var token=null;if(!open_token){if(c==="<"){resulting_string=this._input.next();if(this._input.peek()==="/"){resulting_string+=this._input.next()}resulting_string+=this.__patterns.element_name.read();token=this._create_token(TOKEN.TAG_OPEN,resulting_string)}}return token};Tokenizer.prototype._read_open_handlebars=function(c,open_token){var resulting_string=null;var token=null;if(!open_token){if(this._options.indent_handlebars&&c==="{"&&this._input.peek(1)==="{"){if(this._input.peek(2)==="!"){resulting_string=this.__patterns.handlebars_comment.read();resulting_string=resulting_string||this.__patterns.handlebars.read();token=this._create_token(TOKEN.COMMENT,resulting_string)}else{resulting_string=this.__patterns.handlebars_open.read();token=this._create_token(TOKEN.TAG_OPEN,resulting_string)}}}return token};Tokenizer.prototype._read_close=function(c,open_token){var resulting_string=null;var token=null;if(open_token){if(open_token.text[0]==="<"&&(c===">"||c==="/"&&this._input.peek(1)===">")){resulting_string=this._input.next();if(c==="/"){resulting_string+=this._input.next()}token=this._create_token(TOKEN.TAG_CLOSE,resulting_string)}else if(open_token.text[0]==="{"&&c==="}"&&this._input.peek(1)==="}"){this._input.next();this._input.next();token=this._create_token(TOKEN.TAG_CLOSE,"}}")}}return token};Tokenizer.prototype._read_attribute=function(c,previous_token,open_token){var token=null;var resulting_string="";if(open_token&&open_token.text[0]==="<"){if(c==="="){token=this._create_token(TOKEN.EQUALS,this._input.next())}else if(c==='"'||c==="'"){var content=this._input.next();if(c==='"'){content+=this.__patterns.double_quote.read()}else{content+=this.__patterns.single_quote.read()}token=this._create_token(TOKEN.VALUE,content)}else{resulting_string=this.__patterns.attribute.read();if(resulting_string){if(previous_token.type===TOKEN.EQUALS){token=this._create_token(TOKEN.VALUE,resulting_string)}else{token=this._create_token(TOKEN.ATTRIBUTE,resulting_string)}}}}return token};Tokenizer.prototype._is_content_unformatted=function(tag_name){return this._options.void_elements.indexOf(tag_name)===-1&&(this._options.content_unformatted.indexOf(tag_name)!==-1||this._options.unformatted.indexOf(tag_name)!==-1)};Tokenizer.prototype._read_raw_content=function(c,previous_token,open_token){var resulting_string="";if(open_token&&open_token.text[0]==="{"){resulting_string=this.__patterns.handlebars_raw_close.read()}else if(previous_token.type===TOKEN.TAG_CLOSE&&previous_token.opened.text[0]==="<"&&previous_token.text[0]!=="/"){var tag_name=previous_token.opened.text.substr(1).toLowerCase();if(tag_name==="script"||tag_name==="style"){var token=this._read_comment_or_cdata(c);if(token){token.type=TOKEN.TEXT;return token}resulting_string=this._input.readUntil(new RegExp("</"+tag_name+"[\\n\\r\\t ]*?>","ig"))}else if(this._is_content_unformatted(tag_name)){resulting_string=this._input.readUntil(new RegExp("</"+tag_name+"[\\n\\r\\t ]*?>","ig"))}}if(resulting_string){return this._create_token(TOKEN.TEXT,resulting_string)}return null};Tokenizer.prototype._read_content_word=function(c){var resulting_string="";if(this._options.unformatted_content_delimiter){if(c===this._options.unformatted_content_delimiter[0]){resulting_string=this.__patterns.unformatted_content_delimiter.read()}}if(!resulting_string){resulting_string=this.__patterns.word.read()}if(resulting_string){return this._create_token(TOKEN.TEXT,resulting_string)}};module.exports.Tokenizer=Tokenizer;module.exports.TOKEN=TOKEN},{"../core/directives":84,"../core/pattern":88,"../core/templatablepattern":89,"../core/tokenizer":91}],101:[function(require,module,exports){"use strict";var js_beautify=require("./javascript/index");var css_beautify=require("./css/index");var html_beautify=require("./html/index");function style_html(html_source,options,js,css){js=js||js_beautify;css=css||css_beautify;return html_beautify(html_source,options,js,css)}style_html.defaultOptions=html_beautify.defaultOptions;module.exports.js=js_beautify;module.exports.css=css_beautify;module.exports.html=style_html},{"./css/index":95,"./html/index":98,"./javascript/index":104}],102:[function(require,module,exports){"use strict";var baseASCIIidentifierStartChars="\\x23\\x24\\x40\\x41-\\x5a\\x5f\\x61-\\x7a";var baseASCIIidentifierChars="\\x24\\x30-\\x39\\x41-\\x5a\\x5f\\x61-\\x7a";var nonASCIIidentifierStartChars="\\xaa\\xb5\\xba\\xc0-\\xd6\\xd8-\\xf6\\xf8-\\u02c1\\u02c6-\\u02d1\\u02e0-\\u02e4\\u02ec\\u02ee\\u0370-\\u0374\\u0376\\u0377\\u037a-\\u037d\\u0386\\u0388-\\u038a\\u038c\\u038e-\\u03a1\\u03a3-\\u03f5\\u03f7-\\u0481\\u048a-\\u0527\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05d0-\\u05ea\\u05f0-\\u05f2\\u0620-\\u064a\\u066e\\u066f\\u0671-\\u06d3\\u06d5\\u06e5\\u06e6\\u06ee\\u06ef\\u06fa-\\u06fc\\u06ff\\u0710\\u0712-\\u072f\\u074d-\\u07a5\\u07b1\\u07ca-\\u07ea\\u07f4\\u07f5\\u07fa\\u0800-\\u0815\\u081a\\u0824\\u0828\\u0840-\\u0858\\u08a0\\u08a2-\\u08ac\\u0904-\\u0939\\u093d\\u0950\\u0958-\\u0961\\u0971-\\u0977\\u0979-\\u097f\\u0985-\\u098c\\u098f\\u0990\\u0993-\\u09a8\\u09aa-\\u09b0\\u09b2\\u09b6-\\u09b9\\u09bd\\u09ce\\u09dc\\u09dd\\u09df-\\u09e1\\u09f0\\u09f1\\u0a05-\\u0a0a\\u0a0f\\u0a10\\u0a13-\\u0a28\\u0a2a-\\u0a30\\u0a32\\u0a33\\u0a35\\u0a36\\u0a38\\u0a39\\u0a59-\\u0a5c\\u0a5e\\u0a72-\\u0a74\\u0a85-\\u0a8d\\u0a8f-\\u0a91\\u0a93-\\u0aa8\\u0aaa-\\u0ab0\\u0ab2\\u0ab3\\u0ab5-\\u0ab9\\u0abd\\u0ad0\\u0ae0\\u0ae1\\u0b05-\\u0b0c\\u0b0f\\u0b10\\u0b13-\\u0b28\\u0b2a-\\u0b30\\u0b32\\u0b33\\u0b35-\\u0b39\\u0b3d\\u0b5c\\u0b5d\\u0b5f-\\u0b61\\u0b71\\u0b83\\u0b85-\\u0b8a\\u0b8e-\\u0b90\\u0b92-\\u0b95\\u0b99\\u0b9a\\u0b9c\\u0b9e\\u0b9f\\u0ba3\\u0ba4\\u0ba8-\\u0baa\\u0bae-\\u0bb9\\u0bd0\\u0c05-\\u0c0c\\u0c0e-\\u0c10\\u0c12-\\u0c28\\u0c2a-\\u0c33\\u0c35-\\u0c39\\u0c3d\\u0c58\\u0c59\\u0c60\\u0c61\\u0c85-\\u0c8c\\u0c8e-\\u0c90\\u0c92-\\u0ca8\\u0caa-\\u0cb3\\u0cb5-\\u0cb9\\u0cbd\\u0cde\\u0ce0\\u0ce1\\u0cf1\\u0cf2\\u0d05-\\u0d0c\\u0d0e-\\u0d10\\u0d12-\\u0d3a\\u0d3d\\u0d4e\\u0d60\\u0d61\\u0d7a-\\u0d7f\\u0d85-\\u0d96\\u0d9a-\\u0db1\\u0db3-\\u0dbb\\u0dbd\\u0dc0-\\u0dc6\\u0e01-\\u0e30\\u0e32\\u0e33\\u0e40-\\u0e46\\u0e81\\u0e82\\u0e84\\u0e87\\u0e88\\u0e8a\\u0e8d\\u0e94-\\u0e97\\u0e99-\\u0e9f\\u0ea1-\\u0ea3\\u0ea5\\u0ea7\\u0eaa\\u0eab\\u0ead-\\u0eb0\\u0eb2\\u0eb3\\u0ebd\\u0ec0-\\u0ec4\\u0ec6\\u0edc-\\u0edf\\u0f00\\u0f40-\\u0f47\\u0f49-\\u0f6c\\u0f88-\\u0f8c\\u1000-\\u102a\\u103f\\u1050-\\u1055\\u105a-\\u105d\\u1061\\u1065\\u1066\\u106e-\\u1070\\u1075-\\u1081\\u108e\\u10a0-\\u10c5\\u10c7\\u10cd\\u10d0-\\u10fa\\u10fc-\\u1248\\u124a-\\u124d\\u1250-\\u1256\\u1258\\u125a-\\u125d\\u1260-\\u1288\\u128a-\\u128d\\u1290-\\u12b0\\u12b2-\\u12b5\\u12b8-\\u12be\\u12c0\\u12c2-\\u12c5\\u12c8-\\u12d6\\u12d8-\\u1310\\u1312-\\u1315\\u1318-\\u135a\\u1380-\\u138f\\u13a0-\\u13f4\\u1401-\\u166c\\u166f-\\u167f\\u1681-\\u169a\\u16a0-\\u16ea\\u16ee-\\u16f0\\u1700-\\u170c\\u170e-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176c\\u176e-\\u1770\\u1780-\\u17b3\\u17d7\\u17dc\\u1820-\\u1877\\u1880-\\u18a8\\u18aa\\u18b0-\\u18f5\\u1900-\\u191c\\u1950-\\u196d\\u1970-\\u1974\\u1980-\\u19ab\\u19c1-\\u19c7\\u1a00-\\u1a16\\u1a20-\\u1a54\\u1aa7\\u1b05-\\u1b33\\u1b45-\\u1b4b\\u1b83-\\u1ba0\\u1bae\\u1baf\\u1bba-\\u1be5\\u1c00-\\u1c23\\u1c4d-\\u1c4f\\u1c5a-\\u1c7d\\u1ce9-\\u1cec\\u1cee-\\u1cf1\\u1cf5\\u1cf6\\u1d00-\\u1dbf\\u1e00-\\u1f15\\u1f18-\\u1f1d\\u1f20-\\u1f45\\u1f48-\\u1f4d\\u1f50-\\u1f57\\u1f59\\u1f5b\\u1f5d\\u1f5f-\\u1f7d\\u1f80-\\u1fb4\\u1fb6-\\u1fbc\\u1fbe\\u1fc2-\\u1fc4\\u1fc6-\\u1fcc\\u1fd0-\\u1fd3\\u1fd6-\\u1fdb\\u1fe0-\\u1fec\\u1ff2-\\u1ff4\\u1ff6-\\u1ffc\\u2071\\u207f\\u2090-\\u209c\\u2102\\u2107\\u210a-\\u2113\\u2115\\u2119-\\u211d\\u2124\\u2126\\u2128\\u212a-\\u212d\\u212f-\\u2139\\u213c-\\u213f\\u2145-\\u2149\\u214e\\u2160-\\u2188\\u2c00-\\u2c2e\\u2c30-\\u2c5e\\u2c60-\\u2ce4\\u2ceb-\\u2cee\\u2cf2\\u2cf3\\u2d00-\\u2d25\\u2d27\\u2d2d\\u2d30-\\u2d67\\u2d6f\\u2d80-\\u2d96\\u2da0-\\u2da6\\u2da8-\\u2dae\\u2db0-\\u2db6\\u2db8-\\u2dbe\\u2dc0-\\u2dc6\\u2dc8-\\u2dce\\u2dd0-\\u2dd6\\u2dd8-\\u2dde\\u2e2f\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303c\\u3041-\\u3096\\u309d-\\u309f\\u30a1-\\u30fa\\u30fc-\\u30ff\\u3105-\\u312d\\u3131-\\u318e\\u31a0-\\u31ba\\u31f0-\\u31ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\ua000-\\ua48c\\ua4d0-\\ua4fd\\ua500-\\ua60c\\ua610-\\ua61f\\ua62a\\ua62b\\ua640-\\ua66e\\ua67f-\\ua697\\ua6a0-\\ua6ef\\ua717-\\ua71f\\ua722-\\ua788\\ua78b-\\ua78e\\ua790-\\ua793\\ua7a0-\\ua7aa\\ua7f8-\\ua801\\ua803-\\ua805\\ua807-\\ua80a\\ua80c-\\ua822\\ua840-\\ua873\\ua882-\\ua8b3\\ua8f2-\\ua8f7\\ua8fb\\ua90a-\\ua925\\ua930-\\ua946\\ua960-\\ua97c\\ua984-\\ua9b2\\ua9cf\\uaa00-\\uaa28\\uaa40-\\uaa42\\uaa44-\\uaa4b\\uaa60-\\uaa76\\uaa7a\\uaa80-\\uaaaf\\uaab1\\uaab5\\uaab6\\uaab9-\\uaabd\\uaac0\\uaac2\\uaadb-\\uaadd\\uaae0-\\uaaea\\uaaf2-\\uaaf4\\uab01-\\uab06\\uab09-\\uab0e\\uab11-\\uab16\\uab20-\\uab26\\uab28-\\uab2e\\uabc0-\\uabe2\\uac00-\\ud7a3\\ud7b0-\\ud7c6\\ud7cb-\\ud7fb\\uf900-\\ufa6d\\ufa70-\\ufad9\\ufb00-\\ufb06\\ufb13-\\ufb17\\ufb1d\\ufb1f-\\ufb28\\ufb2a-\\ufb36\\ufb38-\\ufb3c\\ufb3e\\ufb40\\ufb41\\ufb43\\ufb44\\ufb46-\\ufbb1\\ufbd3-\\ufd3d\\ufd50-\\ufd8f\\ufd92-\\ufdc7\\ufdf0-\\ufdfb\\ufe70-\\ufe74\\ufe76-\\ufefc\\uff21-\\uff3a\\uff41-\\uff5a\\uff66-\\uffbe\\uffc2-\\uffc7\\uffca-\\uffcf\\uffd2-\\uffd7\\uffda-\\uffdc";var nonASCIIidentifierChars="\\u0300-\\u036f\\u0483-\\u0487\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u0620-\\u0649\\u0672-\\u06d3\\u06e7-\\u06e8\\u06fb-\\u06fc\\u0730-\\u074a\\u0800-\\u0814\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0840-\\u0857\\u08e4-\\u08fe\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\u0966-\\u096f\\u0981-\\u0983\\u09bc\\u09be-\\u09c4\\u09c7\\u09c8\\u09d7\\u09df-\\u09e0\\u0a01-\\u0a03\\u0a3c\\u0a3e-\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a66-\\u0a71\\u0a75\\u0a81-\\u0a83\\u0abc\\u0abe-\\u0ac5\\u0ac7-\\u0ac9\\u0acb-\\u0acd\\u0ae2-\\u0ae3\\u0ae6-\\u0aef\\u0b01-\\u0b03\\u0b3c\\u0b3e-\\u0b44\\u0b47\\u0b48\\u0b4b-\\u0b4d\\u0b56\\u0b57\\u0b5f-\\u0b60\\u0b66-\\u0b6f\\u0b82\\u0bbe-\\u0bc2\\u0bc6-\\u0bc8\\u0bca-\\u0bcd\\u0bd7\\u0be6-\\u0bef\\u0c01-\\u0c03\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62-\\u0c63\\u0c66-\\u0c6f\\u0c82\\u0c83\\u0cbc\\u0cbe-\\u0cc4\\u0cc6-\\u0cc8\\u0cca-\\u0ccd\\u0cd5\\u0cd6\\u0ce2-\\u0ce3\\u0ce6-\\u0cef\\u0d02\\u0d03\\u0d46-\\u0d48\\u0d57\\u0d62-\\u0d63\\u0d66-\\u0d6f\\u0d82\\u0d83\\u0dca\\u0dcf-\\u0dd4\\u0dd6\\u0dd8-\\u0ddf\\u0df2\\u0df3\\u0e34-\\u0e3a\\u0e40-\\u0e45\\u0e50-\\u0e59\\u0eb4-\\u0eb9\\u0ec8-\\u0ecd\\u0ed0-\\u0ed9\\u0f18\\u0f19\\u0f20-\\u0f29\\u0f35\\u0f37\\u0f39\\u0f41-\\u0f47\\u0f71-\\u0f84\\u0f86-\\u0f87\\u0f8d-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u1000-\\u1029\\u1040-\\u1049\\u1067-\\u106d\\u1071-\\u1074\\u1082-\\u108d\\u108f-\\u109d\\u135d-\\u135f\\u170e-\\u1710\\u1720-\\u1730\\u1740-\\u1750\\u1772\\u1773\\u1780-\\u17b2\\u17dd\\u17e0-\\u17e9\\u180b-\\u180d\\u1810-\\u1819\\u1920-\\u192b\\u1930-\\u193b\\u1951-\\u196d\\u19b0-\\u19c0\\u19c8-\\u19c9\\u19d0-\\u19d9\\u1a00-\\u1a15\\u1a20-\\u1a53\\u1a60-\\u1a7c\\u1a7f-\\u1a89\\u1a90-\\u1a99\\u1b46-\\u1b4b\\u1b50-\\u1b59\\u1b6b-\\u1b73\\u1bb0-\\u1bb9\\u1be6-\\u1bf3\\u1c00-\\u1c22\\u1c40-\\u1c49\\u1c5b-\\u1c7d\\u1cd0-\\u1cd2\\u1d00-\\u1dbe\\u1e01-\\u1f15\\u200c\\u200d\\u203f\\u2040\\u2054\\u20d0-\\u20dc\\u20e1\\u20e5-\\u20f0\\u2d81-\\u2d96\\u2de0-\\u2dff\\u3021-\\u3028\\u3099\\u309a\\ua640-\\ua66d\\ua674-\\ua67d\\ua69f\\ua6f0-\\ua6f1\\ua7f8-\\ua800\\ua806\\ua80b\\ua823-\\ua827\\ua880-\\ua881\\ua8b4-\\ua8c4\\ua8d0-\\ua8d9\\ua8f3-\\ua8f7\\ua900-\\ua909\\ua926-\\ua92d\\ua930-\\ua945\\ua980-\\ua983\\ua9b3-\\ua9c0\\uaa00-\\uaa27\\uaa40-\\uaa41\\uaa4c-\\uaa4d\\uaa50-\\uaa59\\uaa7b\\uaae0-\\uaae9\\uaaf2-\\uaaf3\\uabc0-\\uabe1\\uabec\\uabed\\uabf0-\\uabf9\\ufb20-\\ufb28\\ufe00-\\ufe0f\\ufe20-\\ufe26\\ufe33\\ufe34\\ufe4d-\\ufe4f\\uff10-\\uff19\\uff3f";var identifierStart="(?:\\\\u[0-9a-fA-F]{4}|["+baseASCIIidentifierStartChars+nonASCIIidentifierStartChars+"])";var identifierChars="(?:\\\\u[0-9a-fA-F]{4}|["+baseASCIIidentifierChars+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"])*";exports.identifier=new RegExp(identifierStart+identifierChars,"g");exports.identifierStart=new RegExp(identifierStart);exports.identifierMatch=new RegExp("(?:\\\\u[0-9a-fA-F]{4}|["+baseASCIIidentifierChars+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"])+");var nonASCIIwhitespace=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;exports.newline=/[\n\r\u2028\u2029]/;exports.lineBreak=new RegExp("\r\n|"+exports.newline.source);exports.allLineBreaks=new RegExp(exports.lineBreak.source,"g")},{}],103:[function(require,module,exports){"use strict";var Output=require("../core/output").Output;var Token=require("../core/token").Token;var acorn=require("./acorn");var Options=require("./options").Options;var Tokenizer=require("./tokenizer").Tokenizer;var line_starters=require("./tokenizer").line_starters;var positionable_operators=require("./tokenizer").positionable_operators;var TOKEN=require("./tokenizer").TOKEN;function in_array(what,arr){return arr.indexOf(what)!==-1}function ltrim(s){return s.replace(/^\s+/g,"")}function generateMapFromStrings(list){var result={};for(var x=0;x<list.length;x++){result[list[x].replace(/-/g,"_")]=list[x]}return result}function reserved_word(token,word){return token&&token.type===TOKEN.RESERVED&&token.text===word}function reserved_array(token,words){return token&&token.type===TOKEN.RESERVED&&in_array(token.text,words)}var special_words=["case","return","do","if","throw","else","await","break","continue","async"];var validPositionValues=["before-newline","after-newline","preserve-newline"];var OPERATOR_POSITION=generateMapFromStrings(validPositionValues);var OPERATOR_POSITION_BEFORE_OR_PRESERVE=[OPERATOR_POSITION.before_newline,OPERATOR_POSITION.preserve_newline];var MODE={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function remove_redundant_indentation(output,frame){if(frame.multiline_frame||frame.mode===MODE.ForInitializer||frame.mode===MODE.Conditional){return}output.remove_indent(frame.start_line_index)}function split_linebreaks(s){s=s.replace(acorn.allLineBreaks,"\n");var out=[],idx=s.indexOf("\n");while(idx!==-1){out.push(s.substring(0,idx));s=s.substring(idx+1);idx=s.indexOf("\n")}if(s.length){out.push(s)}return out}function is_array(mode){return mode===MODE.ArrayLiteral}function is_expression(mode){return in_array(mode,[MODE.Expression,MODE.ForInitializer,MODE.Conditional])}function all_lines_start_with(lines,c){for(var i=0;i<lines.length;i++){var line=lines[i].trim();if(line.charAt(0)!==c){return false}}return true}function each_line_matches_indent(lines,indent){var i=0,len=lines.length,line;for(;i<len;i++){line=lines[i];if(line&&line.indexOf(indent)!==0){return false}}return true}function Beautifier(source_text,options){options=options||{};this._source_text=source_text||"";this._output=null;this._tokens=null;this._last_last_text=null;this._flags=null;this._previous_flags=null;this._flag_store=null;this._options=new Options(options)}Beautifier.prototype.create_flags=function(flags_base,mode){var next_indent_level=0;if(flags_base){next_indent_level=flags_base.indentation_level;if(!this._output.just_added_newline()&&flags_base.line_indent_level>next_indent_level){next_indent_level=flags_base.line_indent_level}}var next_flags={mode:mode,parent:flags_base,last_token:flags_base?flags_base.last_token:new Token(TOKEN.START_BLOCK,""),last_word:flags_base?flags_base.last_word:"",declaration_statement:false,declaration_assignment:false,multiline_frame:false,inline_frame:false,if_block:false,else_block:false,do_block:false,do_while:false,import_block:false,in_case_statement:false,in_case:false,case_body:false,indentation_level:next_indent_level,alignment:0,line_indent_level:flags_base?flags_base.line_indent_level:next_indent_level,start_line_index:this._output.get_line_number(),ternary_depth:0};return next_flags};Beautifier.prototype._reset=function(source_text){var baseIndentString=source_text.match(/^[\t ]*/)[0];this._last_last_text="";this._output=new Output(this._options,baseIndentString);this._output.raw=this._options.test_output_raw;this._flag_store=[];this.set_mode(MODE.BlockStatement);var tokenizer=new Tokenizer(source_text,this._options);this._tokens=tokenizer.tokenize();return source_text};Beautifier.prototype.beautify=function(){if(this._options.disabled){return this._source_text}var sweet_code;var source_text=this._reset(this._source_text);var eol=this._options.eol;if(this._options.eol==="auto"){eol="\n";if(source_text&&acorn.lineBreak.test(source_text||"")){eol=source_text.match(acorn.lineBreak)[0]}}var current_token=this._tokens.next();while(current_token){this.handle_token(current_token);this._last_last_text=this._flags.last_token.text;this._flags.last_token=current_token;current_token=this._tokens.next()}sweet_code=this._output.get_code(eol);return sweet_code};Beautifier.prototype.handle_token=function(current_token,preserve_statement_flags){if(current_token.type===TOKEN.START_EXPR){this.handle_start_expr(current_token)}else if(current_token.type===TOKEN.END_EXPR){this.handle_end_expr(current_token)}else if(current_token.type===TOKEN.START_BLOCK){this.handle_start_block(current_token)}else if(current_token.type===TOKEN.END_BLOCK){this.handle_end_block(current_token)}else if(current_token.type===TOKEN.WORD){this.handle_word(current_token)}else if(current_token.type===TOKEN.RESERVED){this.handle_word(current_token)}else if(current_token.type===TOKEN.SEMICOLON){this.handle_semicolon(current_token)}else if(current_token.type===TOKEN.STRING){this.handle_string(current_token)}else if(current_token.type===TOKEN.EQUALS){this.handle_equals(current_token)}else if(current_token.type===TOKEN.OPERATOR){this.handle_operator(current_token)}else if(current_token.type===TOKEN.COMMA){this.handle_comma(current_token)}else if(current_token.type===TOKEN.BLOCK_COMMENT){this.handle_block_comment(current_token,preserve_statement_flags)}else if(current_token.type===TOKEN.COMMENT){this.handle_comment(current_token,preserve_statement_flags)}else if(current_token.type===TOKEN.DOT){this.handle_dot(current_token)}else if(current_token.type===TOKEN.EOF){this.handle_eof(current_token)}else if(current_token.type===TOKEN.UNKNOWN){this.handle_unknown(current_token,preserve_statement_flags)}else{this.handle_unknown(current_token,preserve_statement_flags)}};Beautifier.prototype.handle_whitespace_and_comments=function(current_token,preserve_statement_flags){var newlines=current_token.newlines;var keep_whitespace=this._options.keep_array_indentation&&is_array(this._flags.mode);if(current_token.comments_before){var comment_token=current_token.comments_before.next();while(comment_token){this.handle_whitespace_and_comments(comment_token,preserve_statement_flags);this.handle_token(comment_token,preserve_statement_flags);comment_token=current_token.comments_before.next()}}if(keep_whitespace){for(var i=0;i<newlines;i+=1){this.print_newline(i>0,preserve_statement_flags)}}else{if(this._options.max_preserve_newlines&&newlines>this._options.max_preserve_newlines){newlines=this._options.max_preserve_newlines}if(this._options.preserve_newlines){if(newlines>1){this.print_newline(false,preserve_statement_flags);for(var j=1;j<newlines;j+=1){this.print_newline(true,preserve_statement_flags)}}}}};var newline_restricted_tokens=["async","break","continue","return","throw","yield"];Beautifier.prototype.allow_wrap_or_preserved_newline=function(current_token,force_linewrap){force_linewrap=force_linewrap===undefined?false:force_linewrap;if(this._output.just_added_newline()){return}var shouldPreserveOrForce=this._options.preserve_newlines&&current_token.newlines||force_linewrap;var operatorLogicApplies=in_array(this._flags.last_token.text,positionable_operators)||in_array(current_token.text,positionable_operators);if(operatorLogicApplies){var shouldPrintOperatorNewline=in_array(this._flags.last_token.text,positionable_operators)&&in_array(this._options.operator_position,OPERATOR_POSITION_BEFORE_OR_PRESERVE)||in_array(current_token.text,positionable_operators);shouldPreserveOrForce=shouldPreserveOrForce&&shouldPrintOperatorNewline}if(shouldPreserveOrForce){this.print_newline(false,true)}else if(this._options.wrap_line_length){if(reserved_array(this._flags.last_token,newline_restricted_tokens)){return}this._output.set_wrap_point()}};Beautifier.prototype.print_newline=function(force_newline,preserve_statement_flags){if(!preserve_statement_flags){if(this._flags.last_token.text!==";"&&this._flags.last_token.text!==","&&this._flags.last_token.text!=="="&&(this._flags.last_token.type!==TOKEN.OPERATOR||this._flags.last_token.text==="--"||this._flags.last_token.text==="++")){var next_token=this._tokens.peek();while(this._flags.mode===MODE.Statement&&!(this._flags.if_block&&reserved_word(next_token,"else"))&&!this._flags.do_block){this.restore_mode()}}}if(this._output.add_new_line(force_newline)){this._flags.multiline_frame=true}};Beautifier.prototype.print_token_line_indentation=function(current_token){if(this._output.just_added_newline()){if(this._options.keep_array_indentation&&current_token.newlines&&(current_token.text==="["||is_array(this._flags.mode))){this._output.current_line.set_indent(-1);this._output.current_line.push(current_token.whitespace_before);this._output.space_before_token=false}else if(this._output.set_indent(this._flags.indentation_level,this._flags.alignment)){this._flags.line_indent_level=this._flags.indentation_level}}};Beautifier.prototype.print_token=function(current_token){if(this._output.raw){this._output.add_raw_token(current_token);return}if(this._options.comma_first&&current_token.previous&&current_token.previous.type===TOKEN.COMMA&&this._output.just_added_newline()){if(this._output.previous_line.last()===","){var popped=this._output.previous_line.pop();if(this._output.previous_line.is_empty()){this._output.previous_line.push(popped);this._output.trim(true);this._output.current_line.pop();this._output.trim()}this.print_token_line_indentation(current_token);this._output.add_token(",");this._output.space_before_token=true}}this.print_token_line_indentation(current_token);this._output.non_breaking_space=true;this._output.add_token(current_token.text);if(this._output.previous_token_wrapped){this._flags.multiline_frame=true}};Beautifier.prototype.indent=function(){this._flags.indentation_level+=1;this._output.set_indent(this._flags.indentation_level,this._flags.alignment)};Beautifier.prototype.deindent=function(){if(this._flags.indentation_level>0&&(!this._flags.parent||this._flags.indentation_level>this._flags.parent.indentation_level)){this._flags.indentation_level-=1;this._output.set_indent(this._flags.indentation_level,this._flags.alignment)}};Beautifier.prototype.set_mode=function(mode){if(this._flags){this._flag_store.push(this._flags);this._previous_flags=this._flags}else{this._previous_flags=this.create_flags(null,mode)}this._flags=this.create_flags(this._previous_flags,mode);this._output.set_indent(this._flags.indentation_level,this._flags.alignment)};Beautifier.prototype.restore_mode=function(){if(this._flag_store.length>0){this._previous_flags=this._flags;this._flags=this._flag_store.pop();if(this._previous_flags.mode===MODE.Statement){remove_redundant_indentation(this._output,this._previous_flags)}this._output.set_indent(this._flags.indentation_level,this._flags.alignment)}};Beautifier.prototype.start_of_object_property=function(){return this._flags.parent.mode===MODE.ObjectLiteral&&this._flags.mode===MODE.Statement&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||reserved_array(this._flags.last_token,["get","set"]))};Beautifier.prototype.start_of_statement=function(current_token){var start=false;start=start||reserved_array(this._flags.last_token,["var","let","const"])&&current_token.type===TOKEN.WORD;start=start||reserved_word(this._flags.last_token,"do");start=start||!(this._flags.parent.mode===MODE.ObjectLiteral&&this._flags.mode===MODE.Statement)&&reserved_array(this._flags.last_token,newline_restricted_tokens)&&!current_token.newlines;start=start||reserved_word(this._flags.last_token,"else")&&!(reserved_word(current_token,"if")&&!current_token.comments_before);start=start||this._flags.last_token.type===TOKEN.END_EXPR&&(this._previous_flags.mode===MODE.ForInitializer||this._previous_flags.mode===MODE.Conditional);start=start||this._flags.last_token.type===TOKEN.WORD&&this._flags.mode===MODE.BlockStatement&&!this._flags.in_case&&!(current_token.text==="--"||current_token.text==="++")&&this._last_last_text!=="function"&&current_token.type!==TOKEN.WORD&&current_token.type!==TOKEN.RESERVED;start=start||this._flags.mode===MODE.ObjectLiteral&&(this._flags.last_token.text===":"&&this._flags.ternary_depth===0||reserved_array(this._flags.last_token,["get","set"]));if(start){this.set_mode(MODE.Statement);this.indent();this.handle_whitespace_and_comments(current_token,true);if(!this.start_of_object_property()){this.allow_wrap_or_preserved_newline(current_token,reserved_array(current_token,["do","for","if","while"]))}return true}return false};Beautifier.prototype.handle_start_expr=function(current_token){if(!this.start_of_statement(current_token)){this.handle_whitespace_and_comments(current_token)}var next_mode=MODE.Expression;if(current_token.text==="["){if(this._flags.last_token.type===TOKEN.WORD||this._flags.last_token.text===")"){if(reserved_array(this._flags.last_token,line_starters)){this._output.space_before_token=true}this.print_token(current_token);this.set_mode(next_mode);this.indent();if(this._options.space_in_paren){this._output.space_before_token=true}return}next_mode=MODE.ArrayLiteral;if(is_array(this._flags.mode)){if(this._flags.last_token.text==="["||this._flags.last_token.text===","&&(this._last_last_text==="]"||this._last_last_text==="}")){if(!this._options.keep_array_indentation){this.print_newline()}}}if(!in_array(this._flags.last_token.type,[TOKEN.START_EXPR,TOKEN.END_EXPR,TOKEN.WORD,TOKEN.OPERATOR,TOKEN.DOT])){this._output.space_before_token=true}}else{if(this._flags.last_token.type===TOKEN.RESERVED){if(this._flags.last_token.text==="for"){this._output.space_before_token=this._options.space_before_conditional;next_mode=MODE.ForInitializer}else if(in_array(this._flags.last_token.text,["if","while","switch"])){this._output.space_before_token=this._options.space_before_conditional;next_mode=MODE.Conditional}else if(in_array(this._flags.last_word,["await","async"])){this._output.space_before_token=true}else if(this._flags.last_token.text==="import"&&current_token.whitespace_before===""){this._output.space_before_token=false}else if(in_array(this._flags.last_token.text,line_starters)||this._flags.last_token.text==="catch"){this._output.space_before_token=true}}else if(this._flags.last_token.type===TOKEN.EQUALS||this._flags.last_token.type===TOKEN.OPERATOR){if(!this.start_of_object_property()){this.allow_wrap_or_preserved_newline(current_token)}}else if(this._flags.last_token.type===TOKEN.WORD){this._output.space_before_token=false;var peek_back_two=this._tokens.peek(-3);if(this._options.space_after_named_function&&peek_back_two){var peek_back_three=this._tokens.peek(-4);if(reserved_array(peek_back_two,["async","function"])||peek_back_two.text==="*"&&reserved_array(peek_back_three,["async","function"])){this._output.space_before_token=true}else if(this._flags.mode===MODE.ObjectLiteral){if(peek_back_two.text==="{"||peek_back_two.text===","||peek_back_two.text==="*"&&(peek_back_three.text==="{"||peek_back_three.text===",")){this._output.space_before_token=true}}}}else{this.allow_wrap_or_preserved_newline(current_token)}if(this._flags.last_token.type===TOKEN.RESERVED&&(this._flags.last_word==="function"||this._flags.last_word==="typeof")||this._flags.last_token.text==="*"&&(in_array(this._last_last_text,["function","yield"])||this._flags.mode===MODE.ObjectLiteral&&in_array(this._last_last_text,["{",","]))){this._output.space_before_token=this._options.space_after_anon_function}}if(this._flags.last_token.text===";"||this._flags.last_token.type===TOKEN.START_BLOCK){this.print_newline()}else if(this._flags.last_token.type===TOKEN.END_EXPR||this._flags.last_token.type===TOKEN.START_EXPR||this._flags.last_token.type===TOKEN.END_BLOCK||this._flags.last_token.text==="."||this._flags.last_token.type===TOKEN.COMMA){this.allow_wrap_or_preserved_newline(current_token,current_token.newlines)}this.print_token(current_token);this.set_mode(next_mode);if(this._options.space_in_paren){this._output.space_before_token=true}this.indent()};Beautifier.prototype.handle_end_expr=function(current_token){while(this._flags.mode===MODE.Statement){this.restore_mode()}this.handle_whitespace_and_comments(current_token);if(this._flags.multiline_frame){this.allow_wrap_or_preserved_newline(current_token,current_token.text==="]"&&is_array(this._flags.mode)&&!this._options.keep_array_indentation)}if(this._options.space_in_paren){if(this._flags.last_token.type===TOKEN.START_EXPR&&!this._options.space_in_empty_paren){this._output.trim();this._output.space_before_token=false}else{this._output.space_before_token=true}}this.deindent();this.print_token(current_token);this.restore_mode();remove_redundant_indentation(this._output,this._previous_flags);if(this._flags.do_while&&this._previous_flags.mode===MODE.Conditional){this._previous_flags.mode=MODE.Expression;this._flags.do_block=false;this._flags.do_while=false}};Beautifier.prototype.handle_start_block=function(current_token){this.handle_whitespace_and_comments(current_token);var next_token=this._tokens.peek();var second_token=this._tokens.peek(1);if(this._flags.last_word==="switch"&&this._flags.last_token.type===TOKEN.END_EXPR){this.set_mode(MODE.BlockStatement);this._flags.in_case_statement=true}else if(this._flags.case_body){this.set_mode(MODE.BlockStatement)}else if(second_token&&(in_array(second_token.text,[":",","])&&in_array(next_token.type,[TOKEN.STRING,TOKEN.WORD,TOKEN.RESERVED])||in_array(next_token.text,["get","set","..."])&&in_array(second_token.type,[TOKEN.WORD,TOKEN.RESERVED]))){if(!in_array(this._last_last_text,["class","interface"])){this.set_mode(MODE.ObjectLiteral)}else{this.set_mode(MODE.BlockStatement)}}else if(this._flags.last_token.type===TOKEN.OPERATOR&&this._flags.last_token.text==="=>"){this.set_mode(MODE.BlockStatement)}else if(in_array(this._flags.last_token.type,[TOKEN.EQUALS,TOKEN.START_EXPR,TOKEN.COMMA,TOKEN.OPERATOR])||reserved_array(this._flags.last_token,["return","throw","import","default"])){this.set_mode(MODE.ObjectLiteral)}else{this.set_mode(MODE.BlockStatement)}var empty_braces=!next_token.comments_before&&next_token.text==="}";var empty_anonymous_function=empty_braces&&this._flags.last_word==="function"&&this._flags.last_token.type===TOKEN.END_EXPR;if(this._options.brace_preserve_inline){var index=0;var check_token=null;this._flags.inline_frame=true;do{index+=1;check_token=this._tokens.peek(index-1);if(check_token.newlines){this._flags.inline_frame=false;break}}while(check_token.type!==TOKEN.EOF&&!(check_token.type===TOKEN.END_BLOCK&&check_token.opened===current_token))}if((this._options.brace_style==="expand"||this._options.brace_style==="none"&&current_token.newlines)&&!this._flags.inline_frame){if(this._flags.last_token.type!==TOKEN.OPERATOR&&(empty_anonymous_function||this._flags.last_token.type===TOKEN.EQUALS||reserved_array(this._flags.last_token,special_words)&&this._flags.last_token.text!=="else")){this._output.space_before_token=true}else{this.print_newline(false,true)}}else{if(is_array(this._previous_flags.mode)&&(this._flags.last_token.type===TOKEN.START_EXPR||this._flags.last_token.type===TOKEN.COMMA)){if(this._flags.last_token.type===TOKEN.COMMA||this._options.space_in_paren){this._output.space_before_token=true}if(this._flags.last_token.type===TOKEN.COMMA||this._flags.last_token.type===TOKEN.START_EXPR&&this._flags.inline_frame){this.allow_wrap_or_preserved_newline(current_token);this._previous_flags.multiline_frame=this._previous_flags.multiline_frame||this._flags.multiline_frame;this._flags.multiline_frame=false}}if(this._flags.last_token.type!==TOKEN.OPERATOR&&this._flags.last_token.type!==TOKEN.START_EXPR){if(this._flags.last_token.type===TOKEN.START_BLOCK&&!this._flags.inline_frame){this.print_newline()}else{this._output.space_before_token=true}}}this.print_token(current_token);this.indent();if(!empty_braces&&!(this._options.brace_preserve_inline&&this._flags.inline_frame)){this.print_newline()}};Beautifier.prototype.handle_end_block=function(current_token){this.handle_whitespace_and_comments(current_token);while(this._flags.mode===MODE.Statement){this.restore_mode()}var empty_braces=this._flags.last_token.type===TOKEN.START_BLOCK;if(this._flags.inline_frame&&!empty_braces){this._output.space_before_token=true}else if(this._options.brace_style==="expand"){if(!empty_braces){this.print_newline()}}else{if(!empty_braces){if(is_array(this._flags.mode)&&this._options.keep_array_indentation){this._options.keep_array_indentation=false;this.print_newline();this._options.keep_array_indentation=true}else{this.print_newline()}}}this.restore_mode();this.print_token(current_token)};Beautifier.prototype.handle_word=function(current_token){if(current_token.type===TOKEN.RESERVED){if(in_array(current_token.text,["set","get"])&&this._flags.mode!==MODE.ObjectLiteral){current_token.type=TOKEN.WORD}else if(current_token.text==="import"&&this._tokens.peek().text==="("){current_token.type=TOKEN.WORD}else if(in_array(current_token.text,["as","from"])&&!this._flags.import_block){current_token.type=TOKEN.WORD}else if(this._flags.mode===MODE.ObjectLiteral){var next_token=this._tokens.peek();if(next_token.text===":"){current_token.type=TOKEN.WORD}}}if(this.start_of_statement(current_token)){if(reserved_array(this._flags.last_token,["var","let","const"])&&current_token.type===TOKEN.WORD){this._flags.declaration_statement=true}}else if(current_token.newlines&&!is_expression(this._flags.mode)&&(this._flags.last_token.type!==TOKEN.OPERATOR||(this._flags.last_token.text==="--"||this._flags.last_token.text==="++"))&&this._flags.last_token.type!==TOKEN.EQUALS&&(this._options.preserve_newlines||!reserved_array(this._flags.last_token,["var","let","const","set","get"]))){this.handle_whitespace_and_comments(current_token);this.print_newline()}else{this.handle_whitespace_and_comments(current_token)}if(this._flags.do_block&&!this._flags.do_while){if(reserved_word(current_token,"while")){this._output.space_before_token=true;this.print_token(current_token);this._output.space_before_token=true;this._flags.do_while=true;return}else{this.print_newline();this._flags.do_block=false}}if(this._flags.if_block){if(!this._flags.else_block&&reserved_word(current_token,"else")){this._flags.else_block=true}else{while(this._flags.mode===MODE.Statement){this.restore_mode()}this._flags.if_block=false;this._flags.else_block=false}}if(this._flags.in_case_statement&&reserved_array(current_token,["case","default"])){this.print_newline();if(this._flags.last_token.type!==TOKEN.END_BLOCK&&(this._flags.case_body||this._options.jslint_happy)){this.deindent()}this._flags.case_body=false;this.print_token(current_token);this._flags.in_case=true;return}if(this._flags.last_token.type===TOKEN.COMMA||this._flags.last_token.type===TOKEN.START_EXPR||this._flags.last_token.type===TOKEN.EQUALS||this._flags.last_token.type===TOKEN.OPERATOR){if(!this.start_of_object_property()){this.allow_wrap_or_preserved_newline(current_token)}}if(reserved_word(current_token,"function")){if(in_array(this._flags.last_token.text,["}",";"])||this._output.just_added_newline()&&!(in_array(this._flags.last_token.text,["(","[","{",":","=",","])||this._flags.last_token.type===TOKEN.OPERATOR)){if(!this._output.just_added_blankline()&&!current_token.comments_before){this.print_newline();this.print_newline(true)}}if(this._flags.last_token.type===TOKEN.RESERVED||this._flags.last_token.type===TOKEN.WORD){if(reserved_array(this._flags.last_token,["get","set","new","export"])||reserved_array(this._flags.last_token,newline_restricted_tokens)){this._output.space_before_token=true}else if(reserved_word(this._flags.last_token,"default")&&this._last_last_text==="export"){this._output.space_before_token=true}else if(this._flags.last_token.text==="declare"){this._output.space_before_token=true}else{this.print_newline()}}else if(this._flags.last_token.type===TOKEN.OPERATOR||this._flags.last_token.text==="="){this._output.space_before_token=true}else if(!this._flags.multiline_frame&&(is_expression(this._flags.mode)||is_array(this._flags.mode))){}else{this.print_newline()}this.print_token(current_token);this._flags.last_word=current_token.text;return}var prefix="NONE";if(this._flags.last_token.type===TOKEN.END_BLOCK){if(this._previous_flags.inline_frame){prefix="SPACE"}else if(!reserved_array(current_token,["else","catch","finally","from"])){prefix="NEWLINE"}else{if(this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&current_token.newlines){prefix="NEWLINE"}else{prefix="SPACE";this._output.space_before_token=true}}}else if(this._flags.last_token.type===TOKEN.SEMICOLON&&this._flags.mode===MODE.BlockStatement){prefix="NEWLINE"}else if(this._flags.last_token.type===TOKEN.SEMICOLON&&is_expression(this._flags.mode)){prefix="SPACE"}else if(this._flags.last_token.type===TOKEN.STRING){prefix="NEWLINE"}else if(this._flags.last_token.type===TOKEN.RESERVED||this._flags.last_token.type===TOKEN.WORD||this._flags.last_token.text==="*"&&(in_array(this._last_last_text,["function","yield"])||this._flags.mode===MODE.ObjectLiteral&&in_array(this._last_last_text,["{",","]))){prefix="SPACE"}else if(this._flags.last_token.type===TOKEN.START_BLOCK){if(this._flags.inline_frame){prefix="SPACE"}else{prefix="NEWLINE"}}else if(this._flags.last_token.type===TOKEN.END_EXPR){this._output.space_before_token=true;prefix="NEWLINE"}if(reserved_array(current_token,line_starters)&&this._flags.last_token.text!==")"){if(this._flags.inline_frame||this._flags.last_token.text==="else"||this._flags.last_token.text==="export"){prefix="SPACE"}else{prefix="NEWLINE"}}if(reserved_array(current_token,["else","catch","finally"])){if((!(this._flags.last_token.type===TOKEN.END_BLOCK&&this._previous_flags.mode===MODE.BlockStatement)||this._options.brace_style==="expand"||this._options.brace_style==="end-expand"||this._options.brace_style==="none"&&current_token.newlines)&&!this._flags.inline_frame){this.print_newline()}else{this._output.trim(true);var line=this._output.current_line;if(line.last()!=="}"){this.print_newline()}this._output.space_before_token=true}}else if(prefix==="NEWLINE"){if(reserved_array(this._flags.last_token,special_words)){this._output.space_before_token=true}else if(this._flags.last_token.text==="declare"&&reserved_array(current_token,["var","let","const"])){this._output.space_before_token=true}else if(this._flags.last_token.type!==TOKEN.END_EXPR){if((this._flags.last_token.type!==TOKEN.START_EXPR||!reserved_array(current_token,["var","let","const"]))&&this._flags.last_token.text!==":"){if(reserved_word(current_token,"if")&&reserved_word(current_token.previous,"else")){this._output.space_before_token=true}else{this.print_newline()}}}else if(reserved_array(current_token,line_starters)&&this._flags.last_token.text!==")"){this.print_newline()}}else if(this._flags.multiline_frame&&is_array(this._flags.mode)&&this._flags.last_token.text===","&&this._last_last_text==="}"){this.print_newline()}else if(prefix==="SPACE"){this._output.space_before_token=true}if(current_token.previous&&(current_token.previous.type===TOKEN.WORD||current_token.previous.type===TOKEN.RESERVED)){this._output.space_before_token=true}this.print_token(current_token);this._flags.last_word=current_token.text;if(current_token.type===TOKEN.RESERVED){if(current_token.text==="do"){this._flags.do_block=true}else if(current_token.text==="if"){this._flags.if_block=true}else if(current_token.text==="import"){this._flags.import_block=true}else if(this._flags.import_block&&reserved_word(current_token,"from")){this._flags.import_block=false}}};Beautifier.prototype.handle_semicolon=function(current_token){if(this.start_of_statement(current_token)){this._output.space_before_token=false}else{this.handle_whitespace_and_comments(current_token)}var next_token=this._tokens.peek();while(this._flags.mode===MODE.Statement&&!(this._flags.if_block&&reserved_word(next_token,"else"))&&!this._flags.do_block){this.restore_mode()}if(this._flags.import_block){this._flags.import_block=false}this.print_token(current_token)};Beautifier.prototype.handle_string=function(current_token){if(current_token.text.startsWith("`")&&current_token.newlines===0&&current_token.whitespace_before===""&&(current_token.previous.text===")"||this._flags.last_token.type===TOKEN.WORD)){}else if(this.start_of_statement(current_token)){this._output.space_before_token=true}else{this.handle_whitespace_and_comments(current_token);if(this._flags.last_token.type===TOKEN.RESERVED||this._flags.last_token.type===TOKEN.WORD||this._flags.inline_frame){this._output.space_before_token=true}else if(this._flags.last_token.type===TOKEN.COMMA||this._flags.last_token.type===TOKEN.START_EXPR||this._flags.last_token.type===TOKEN.EQUALS||this._flags.last_token.type===TOKEN.OPERATOR){if(!this.start_of_object_property()){this.allow_wrap_or_preserved_newline(current_token)}}else if(current_token.text.startsWith("`")&&this._flags.last_token.type===TOKEN.END_EXPR&&(current_token.previous.text==="]"||current_token.previous.text===")")&&current_token.newlines===0){this._output.space_before_token=true}else{this.print_newline()}}this.print_token(current_token)};Beautifier.prototype.handle_equals=function(current_token){if(this.start_of_statement(current_token)){}else{this.handle_whitespace_and_comments(current_token)}if(this._flags.declaration_statement){this._flags.declaration_assignment=true}this._output.space_before_token=true;this.print_token(current_token);this._output.space_before_token=true};Beautifier.prototype.handle_comma=function(current_token){this.handle_whitespace_and_comments(current_token,true);this.print_token(current_token);this._output.space_before_token=true;if(this._flags.declaration_statement){if(is_expression(this._flags.parent.mode)){this._flags.declaration_assignment=false}if(this._flags.declaration_assignment){this._flags.declaration_assignment=false;this.print_newline(false,true)}else if(this._options.comma_first){this.allow_wrap_or_preserved_newline(current_token)}}else if(this._flags.mode===MODE.ObjectLiteral||this._flags.mode===MODE.Statement&&this._flags.parent.mode===MODE.ObjectLiteral){if(this._flags.mode===MODE.Statement){this.restore_mode()}if(!this._flags.inline_frame){this.print_newline()}}else if(this._options.comma_first){this.allow_wrap_or_preserved_newline(current_token)}};Beautifier.prototype.handle_operator=function(current_token){var isGeneratorAsterisk=current_token.text==="*"&&(reserved_array(this._flags.last_token,["function","yield"])||in_array(this._flags.last_token.type,[TOKEN.START_BLOCK,TOKEN.COMMA,TOKEN.END_BLOCK,TOKEN.SEMICOLON]));var isUnary=in_array(current_token.text,["-","+"])&&(in_array(this._flags.last_token.type,[TOKEN.START_BLOCK,TOKEN.START_EXPR,TOKEN.EQUALS,TOKEN.OPERATOR])||in_array(this._flags.last_token.text,line_starters)||this._flags.last_token.text===",");if(this.start_of_statement(current_token)){}else{var preserve_statement_flags=!isGeneratorAsterisk;this.handle_whitespace_and_comments(current_token,preserve_statement_flags)}if(reserved_array(this._flags.last_token,special_words)){this._output.space_before_token=true;this.print_token(current_token);return}if(current_token.text==="*"&&this._flags.last_token.type===TOKEN.DOT){this.print_token(current_token);return}if(current_token.text==="::"){this.print_token(current_token);return}if(this._flags.last_token.type===TOKEN.OPERATOR&&in_array(this._options.operator_position,OPERATOR_POSITION_BEFORE_OR_PRESERVE)){this.allow_wrap_or_preserved_newline(current_token)}if(current_token.text===":"&&this._flags.in_case){this.print_token(current_token);this._flags.in_case=false;this._flags.case_body=true;if(this._tokens.peek().type!==TOKEN.START_BLOCK){this.indent();this.print_newline()}else{this._output.space_before_token=true}return}var space_before=true;var space_after=true;var in_ternary=false;if(current_token.text===":"){if(this._flags.ternary_depth===0){space_before=false}else{this._flags.ternary_depth-=1;in_ternary=true}}else if(current_token.text==="?"){this._flags.ternary_depth+=1}if(!isUnary&&!isGeneratorAsterisk&&this._options.preserve_newlines&&in_array(current_token.text,positionable_operators)){var isColon=current_token.text===":";var isTernaryColon=isColon&&in_ternary;var isOtherColon=isColon&&!in_ternary;switch(this._options.operator_position){case OPERATOR_POSITION.before_newline:this._output.space_before_token=!isOtherColon;this.print_token(current_token);if(!isColon||isTernaryColon){this.allow_wrap_or_preserved_newline(current_token)}this._output.space_before_token=true;return;case OPERATOR_POSITION.after_newline:this._output.space_before_token=true;if(!isColon||isTernaryColon){if(this._tokens.peek().newlines){this.print_newline(false,true)}else{this.allow_wrap_or_preserved_newline(current_token)}}else{this._output.space_before_token=false}this.print_token(current_token);this._output.space_before_token=true;return;case OPERATOR_POSITION.preserve_newline:if(!isOtherColon){this.allow_wrap_or_preserved_newline(current_token)}space_before=!(this._output.just_added_newline()||isOtherColon);this._output.space_before_token=space_before;this.print_token(current_token);this._output.space_before_token=true;return}}if(isGeneratorAsterisk){this.allow_wrap_or_preserved_newline(current_token);space_before=false;var next_token=this._tokens.peek();space_after=next_token&&in_array(next_token.type,[TOKEN.WORD,TOKEN.RESERVED])}else if(current_token.text==="..."){this.allow_wrap_or_preserved_newline(current_token);space_before=this._flags.last_token.type===TOKEN.START_BLOCK;space_after=false}else if(in_array(current_token.text,["--","++","!","~"])||isUnary){if(this._flags.last_token.type===TOKEN.COMMA||this._flags.last_token.type===TOKEN.START_EXPR){this.allow_wrap_or_preserved_newline(current_token)}space_before=false;space_after=false;if(current_token.newlines&&(current_token.text==="--"||current_token.text==="++")){this.print_newline(false,true)}if(this._flags.last_token.text===";"&&is_expression(this._flags.mode)){space_before=true}if(this._flags.last_token.type===TOKEN.RESERVED){space_before=true}else if(this._flags.last_token.type===TOKEN.END_EXPR){space_before=!(this._flags.last_token.text==="]"&&(current_token.text==="--"||current_token.text==="++"))}else if(this._flags.last_token.type===TOKEN.OPERATOR){space_before=in_array(current_token.text,["--","-","++","+"])&&in_array(this._flags.last_token.text,["--","-","++","+"]);if(in_array(current_token.text,["+","-"])&&in_array(this._flags.last_token.text,["--","++"])){space_after=true}}if((this._flags.mode===MODE.BlockStatement&&!this._flags.inline_frame||this._flags.mode===MODE.Statement)&&(this._flags.last_token.text==="{"||this._flags.last_token.text===";")){this.print_newline()}}this._output.space_before_token=this._output.space_before_token||space_before;this.print_token(current_token);this._output.space_before_token=space_after};Beautifier.prototype.handle_block_comment=function(current_token,preserve_statement_flags){if(this._output.raw){this._output.add_raw_token(current_token);if(current_token.directives&&current_token.directives.preserve==="end"){this._output.raw=this._options.test_output_raw}return}if(current_token.directives){this.print_newline(false,preserve_statement_flags);this.print_token(current_token);if(current_token.directives.preserve==="start"){this._output.raw=true}this.print_newline(false,true);return}if(!acorn.newline.test(current_token.text)&&!current_token.newlines){this._output.space_before_token=true;this.print_token(current_token);this._output.space_before_token=true;return}else{this.print_block_commment(current_token,preserve_statement_flags)}};Beautifier.prototype.print_block_commment=function(current_token,preserve_statement_flags){var lines=split_linebreaks(current_token.text);var j;var javadoc=false;var starless=false;var lastIndent=current_token.whitespace_before;var lastIndentLength=lastIndent.length;this.print_newline(false,preserve_statement_flags);this.print_token_line_indentation(current_token);this._output.add_token(lines[0]);this.print_newline(false,preserve_statement_flags);if(lines.length>1){lines=lines.slice(1);javadoc=all_lines_start_with(lines,"*");starless=each_line_matches_indent(lines,lastIndent);if(javadoc){this._flags.alignment=1}for(j=0;j<lines.length;j++){if(javadoc){this.print_token_line_indentation(current_token);this._output.add_token(ltrim(lines[j]))}else if(starless&&lines[j]){this.print_token_line_indentation(current_token);this._output.add_token(lines[j].substring(lastIndentLength))}else{this._output.current_line.set_indent(-1);this._output.add_token(lines[j])}this.print_newline(false,preserve_statement_flags)}this._flags.alignment=0}};Beautifier.prototype.handle_comment=function(current_token,preserve_statement_flags){if(current_token.newlines){this.print_newline(false,preserve_statement_flags)}else{this._output.trim(true)}this._output.space_before_token=true;this.print_token(current_token);this.print_newline(false,preserve_statement_flags)};Beautifier.prototype.handle_dot=function(current_token){if(this.start_of_statement(current_token)){}else{this.handle_whitespace_and_comments(current_token,true)}if(reserved_array(this._flags.last_token,special_words)){this._output.space_before_token=false}else{this.allow_wrap_or_preserved_newline(current_token,this._flags.last_token.text===")"&&this._options.break_chained_methods)}if(this._options.unindent_chained_methods&&this._output.just_added_newline()){this.deindent()}this.print_token(current_token)};Beautifier.prototype.handle_unknown=function(current_token,preserve_statement_flags){this.print_token(current_token);if(current_token.text[current_token.text.length-1]==="\n"){this.print_newline(false,preserve_statement_flags)}};Beautifier.prototype.handle_eof=function(current_token){while(this._flags.mode===MODE.Statement){this.restore_mode()}this.handle_whitespace_and_comments(current_token)};module.exports.Beautifier=Beautifier},{"../core/output":87,"../core/token":90,"./acorn":102,"./options":105,"./tokenizer":106}],104:[function(require,module,exports){"use strict";var Beautifier=require("./beautifier").Beautifier,Options=require("./options").Options;function js_beautify(js_source_text,options){var beautifier=new Beautifier(js_source_text,options);return beautifier.beautify()}module.exports=js_beautify;module.exports.defaultOptions=function(){return new Options}},{"./beautifier":103,"./options":105}],105:[function(require,module,exports){"use strict";var BaseOptions=require("../core/options").Options;var validPositionValues=["before-newline","after-newline","preserve-newline"];function Options(options){BaseOptions.call(this,options,"js");var raw_brace_style=this.raw_options.brace_style||null;if(raw_brace_style==="expand-strict"){this.raw_options.brace_style="expand"}else if(raw_brace_style==="collapse-preserve-inline"){this.raw_options.brace_style="collapse,preserve-inline"}else if(this.raw_options.braces_on_own_line!==undefined){this.raw_options.brace_style=this.raw_options.braces_on_own_line?"expand":"collapse"}var brace_style_split=this._get_selection_list("brace_style",["collapse","expand","end-expand","none","preserve-inline"]);this.brace_preserve_inline=false;this.brace_style="collapse";for(var bs=0;bs<brace_style_split.length;bs++){if(brace_style_split[bs]==="preserve-inline"){this.brace_preserve_inline=true}else{this.brace_style=brace_style_split[bs]}}this.unindent_chained_methods=this._get_boolean("unindent_chained_methods");this.break_chained_methods=this._get_boolean("break_chained_methods");this.space_in_paren=this._get_boolean("space_in_paren");this.space_in_empty_paren=this._get_boolean("space_in_empty_paren");this.jslint_happy=this._get_boolean("jslint_happy");this.space_after_anon_function=this._get_boolean("space_after_anon_function");this.space_after_named_function=this._get_boolean("space_after_named_function");this.keep_array_indentation=this._get_boolean("keep_array_indentation");this.space_before_conditional=this._get_boolean("space_before_conditional",true);this.unescape_strings=this._get_boolean("unescape_strings");this.e4x=this._get_boolean("e4x");this.comma_first=this._get_boolean("comma_first");this.operator_position=this._get_selection("operator_position",validPositionValues);this.test_output_raw=this._get_boolean("test_output_raw");if(this.jslint_happy){this.space_after_anon_function=true}}Options.prototype=new BaseOptions;module.exports.Options=Options},{"../core/options":86}],106:[function(require,module,exports){"use strict";var InputScanner=require("../core/inputscanner").InputScanner;var BaseTokenizer=require("../core/tokenizer").Tokenizer;var BASETOKEN=require("../core/tokenizer").TOKEN;var Directives=require("../core/directives").Directives;var acorn=require("./acorn");var Pattern=require("../core/pattern").Pattern;var TemplatablePattern=require("../core/templatablepattern").TemplatablePattern;function in_array(what,arr){return arr.indexOf(what)!==-1}var TOKEN={START_EXPR:"TK_START_EXPR",END_EXPR:"TK_END_EXPR",START_BLOCK:"TK_START_BLOCK",END_BLOCK:"TK_END_BLOCK",WORD:"TK_WORD",RESERVED:"TK_RESERVED",SEMICOLON:"TK_SEMICOLON",STRING:"TK_STRING",EQUALS:"TK_EQUALS",OPERATOR:"TK_OPERATOR",COMMA:"TK_COMMA",BLOCK_COMMENT:"TK_BLOCK_COMMENT",COMMENT:"TK_COMMENT",DOT:"TK_DOT",UNKNOWN:"TK_UNKNOWN",START:BASETOKEN.START,RAW:BASETOKEN.RAW,EOF:BASETOKEN.EOF};var directives_core=new Directives(/\/\*/,/\*\//);var number_pattern=/0[xX][0123456789abcdefABCDEF_]*n?|0[oO][01234567_]*n?|0[bB][01_]*n?|\d[\d_]*n|(?:\.\d[\d_]*|\d[\d_]*\.?[\d_]*)(?:[eE][+-]?[\d_]+)?/;var digit=/[0-9]/;var dot_pattern=/[^\d\.]/;var positionable_operators=(">>> === !== "+"<< && >= ** != == <= >> || ?? |> "+"< / - + > : & % ? ^ | *").split(" ");var punct=">>>= "+"... >>= <<= === >>> !== **= "+"=> ^= :: /= << <= == && -= >= >> != -- += ** || ?? ++ %= &= *= |= |> "+"= ! ? > < : / ^ - + * & % ~ |";punct=punct.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&");punct="\\?\\.(?!\\d) "+punct;punct=punct.replace(/ /g,"|");var punct_pattern=new RegExp(punct);var line_starters="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,import,export".split(",");var reserved_words=line_starters.concat(["do","in","of","else","get","set","new","catch","finally","typeof","yield","async","await","from","as"]);var reserved_word_pattern=new RegExp("^(?:"+reserved_words.join("|")+")$");var in_html_comment;var Tokenizer=function(input_string,options){BaseTokenizer.call(this,input_string,options);this._patterns.whitespace=this._patterns.whitespace.matching(/\u00A0\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff/.source,/\u2028\u2029/.source);var pattern_reader=new Pattern(this._input);var templatable=new TemplatablePattern(this._input).read_options(this._options);this.__patterns={template:templatable,identifier:templatable.starting_with(acorn.identifier).matching(acorn.identifierMatch),number:pattern_reader.matching(number_pattern),punct:pattern_reader.matching(punct_pattern),comment:pattern_reader.starting_with(/\/\//).until(/[\n\r\u2028\u2029]/),block_comment:pattern_reader.starting_with(/\/\*/).until_after(/\*\//),html_comment_start:pattern_reader.matching(/<!--/),html_comment_end:pattern_reader.matching(/-->/),include:pattern_reader.starting_with(/#include/).until_after(acorn.lineBreak),shebang:pattern_reader.starting_with(/#!/).until_after(acorn.lineBreak),xml:pattern_reader.matching(/[\s\S]*?<(\/?)([-a-zA-Z:0-9_.]+|{[\s\S]+?}|!\[CDATA\[[\s\S]*?\]\]|)(\s+{[\s\S]+?}|\s+[-a-zA-Z:0-9_.]+|\s+[-a-zA-Z:0-9_.]+\s*=\s*('[^']*'|"[^"]*"|{[\s\S]+?}))*\s*(\/?)\s*>/),single_quote:templatable.until(/['\\\n\r\u2028\u2029]/),double_quote:templatable.until(/["\\\n\r\u2028\u2029]/),template_text:templatable.until(/[`\\$]/),template_expression:templatable.until(/[`}\\]/)}};Tokenizer.prototype=new BaseTokenizer;Tokenizer.prototype._is_comment=function(current_token){return current_token.type===TOKEN.COMMENT||current_token.type===TOKEN.BLOCK_COMMENT||current_token.type===TOKEN.UNKNOWN};Tokenizer.prototype._is_opening=function(current_token){return current_token.type===TOKEN.START_BLOCK||current_token.type===TOKEN.START_EXPR};Tokenizer.prototype._is_closing=function(current_token,open_token){return(current_token.type===TOKEN.END_BLOCK||current_token.type===TOKEN.END_EXPR)&&(open_token&&(current_token.text==="]"&&open_token.text==="["||current_token.text===")"&&open_token.text==="("||current_token.text==="}"&&open_token.text==="{"))};Tokenizer.prototype._reset=function(){in_html_comment=false};Tokenizer.prototype._get_next_token=function(previous_token,open_token){var token=null;this._readWhitespace();var c=this._input.peek();if(c===null){return this._create_token(TOKEN.EOF,"")}token=token||this._read_non_javascript(c);token=token||this._read_string(c);token=token||this._read_word(previous_token);token=token||this._read_singles(c);token=token||this._read_comment(c);token=token||this._read_regexp(c,previous_token);token=token||this._read_xml(c,previous_token);token=token||this._read_punctuation();token=token||this._create_token(TOKEN.UNKNOWN,this._input.next());return token};Tokenizer.prototype._read_word=function(previous_token){var resulting_string;resulting_string=this.__patterns.identifier.read();if(resulting_string!==""){resulting_string=resulting_string.replace(acorn.allLineBreaks,"\n");if(!(previous_token.type===TOKEN.DOT||previous_token.type===TOKEN.RESERVED&&(previous_token.text==="set"||previous_token.text==="get"))&&reserved_word_pattern.test(resulting_string)){if(resulting_string==="in"||resulting_string==="of"){return this._create_token(TOKEN.OPERATOR,resulting_string)}return this._create_token(TOKEN.RESERVED,resulting_string)}return this._create_token(TOKEN.WORD,resulting_string)}resulting_string=this.__patterns.number.read();if(resulting_string!==""){return this._create_token(TOKEN.WORD,resulting_string)}};Tokenizer.prototype._read_singles=function(c){var token=null;if(c==="("||c==="["){token=this._create_token(TOKEN.START_EXPR,c)}else if(c===")"||c==="]"){token=this._create_token(TOKEN.END_EXPR,c)}else if(c==="{"){token=this._create_token(TOKEN.START_BLOCK,c)}else if(c==="}"){token=this._create_token(TOKEN.END_BLOCK,c)}else if(c===";"){token=this._create_token(TOKEN.SEMICOLON,c)}else if(c==="."&&dot_pattern.test(this._input.peek(1))){token=this._create_token(TOKEN.DOT,c)}else if(c===","){token=this._create_token(TOKEN.COMMA,c)}if(token){this._input.next()}return token};Tokenizer.prototype._read_punctuation=function(){var resulting_string=this.__patterns.punct.read();if(resulting_string!==""){if(resulting_string==="="){return this._create_token(TOKEN.EQUALS,resulting_string)}else if(resulting_string==="?."){return this._create_token(TOKEN.DOT,resulting_string)}else{return this._create_token(TOKEN.OPERATOR,resulting_string)}}};Tokenizer.prototype._read_non_javascript=function(c){var resulting_string="";if(c==="#"){if(this._is_first_token()){resulting_string=this.__patterns.shebang.read();if(resulting_string){return this._create_token(TOKEN.UNKNOWN,resulting_string.trim()+"\n")}}resulting_string=this.__patterns.include.read();if(resulting_string){return this._create_token(TOKEN.UNKNOWN,resulting_string.trim()+"\n")}c=this._input.next();var sharp="#";if(this._input.hasNext()&&this._input.testChar(digit)){do{c=this._input.next();sharp+=c}while(this._input.hasNext()&&c!=="#"&&c!=="=");if(c==="#"){}else if(this._input.peek()==="["&&this._input.peek(1)==="]"){sharp+="[]";this._input.next();this._input.next()}else if(this._input.peek()==="{"&&this._input.peek(1)==="}"){sharp+="{}";this._input.next();this._input.next()}return this._create_token(TOKEN.WORD,sharp)}this._input.back()}else if(c==="<"&&this._is_first_token()){resulting_string=this.__patterns.html_comment_start.read();if(resulting_string){while(this._input.hasNext()&&!this._input.testChar(acorn.newline)){resulting_string+=this._input.next()}in_html_comment=true;return this._create_token(TOKEN.COMMENT,resulting_string)}}else if(in_html_comment&&c==="-"){resulting_string=this.__patterns.html_comment_end.read();if(resulting_string){in_html_comment=false;return this._create_token(TOKEN.COMMENT,resulting_string)}}return null};Tokenizer.prototype._read_comment=function(c){var token=null;if(c==="/"){var comment="";if(this._input.peek(1)==="*"){comment=this.__patterns.block_comment.read();var directives=directives_core.get_directives(comment);if(directives&&directives.ignore==="start"){comment+=directives_core.readIgnored(this._input)}comment=comment.replace(acorn.allLineBreaks,"\n");token=this._create_token(TOKEN.BLOCK_COMMENT,comment);token.directives=directives}else if(this._input.peek(1)==="/"){comment=this.__patterns.comment.read();token=this._create_token(TOKEN.COMMENT,comment)}}return token};Tokenizer.prototype._read_string=function(c){if(c==="`"||c==="'"||c==='"'){var resulting_string=this._input.next();this.has_char_escapes=false;if(c==="`"){resulting_string+=this._read_string_recursive("`",true,"${")}else{resulting_string+=this._read_string_recursive(c)}if(this.has_char_escapes&&this._options.unescape_strings){resulting_string=unescape_string(resulting_string)}if(this._input.peek()===c){resulting_string+=this._input.next()}resulting_string=resulting_string.replace(acorn.allLineBreaks,"\n");return this._create_token(TOKEN.STRING,resulting_string)}return null};Tokenizer.prototype._allow_regexp_or_xml=function(previous_token){return previous_token.type===TOKEN.RESERVED&&in_array(previous_token.text,["return","case","throw","else","do","typeof","yield"])||previous_token.type===TOKEN.END_EXPR&&previous_token.text===")"&&previous_token.opened.previous.type===TOKEN.RESERVED&&in_array(previous_token.opened.previous.text,["if","while","for"])||in_array(previous_token.type,[TOKEN.COMMENT,TOKEN.START_EXPR,TOKEN.START_BLOCK,TOKEN.START,TOKEN.END_BLOCK,TOKEN.OPERATOR,TOKEN.EQUALS,TOKEN.EOF,TOKEN.SEMICOLON,TOKEN.COMMA])};Tokenizer.prototype._read_regexp=function(c,previous_token){if(c==="/"&&this._allow_regexp_or_xml(previous_token)){var resulting_string=this._input.next();var esc=false;var in_char_class=false;while(this._input.hasNext()&&((esc||in_char_class||this._input.peek()!==c)&&!this._input.testChar(acorn.newline))){resulting_string+=this._input.peek();if(!esc){esc=this._input.peek()==="\\";if(this._input.peek()==="["){in_char_class=true}else if(this._input.peek()==="]"){in_char_class=false}}else{esc=false}this._input.next()}if(this._input.peek()===c){resulting_string+=this._input.next();resulting_string+=this._input.read(acorn.identifier)}return this._create_token(TOKEN.STRING,resulting_string)}return null};Tokenizer.prototype._read_xml=function(c,previous_token){if(this._options.e4x&&c==="<"&&this._allow_regexp_or_xml(previous_token)){var xmlStr="";var match=this.__patterns.xml.read_match();if(match){var rootTag=match[2].replace(/^{\s+/,"{").replace(/\s+}$/,"}");var isCurlyRoot=rootTag.indexOf("{")===0;var depth=0;while(match){var isEndTag=!!match[1];var tagName=match[2];var isSingletonTag=!!match[match.length-1]||tagName.slice(0,8)==="![CDATA[";if(!isSingletonTag&&(tagName===rootTag||isCurlyRoot&&tagName.replace(/^{\s+/,"{").replace(/\s+}$/,"}"))){if(isEndTag){--depth}else{++depth}}xmlStr+=match[0];if(depth<=0){break}match=this.__patterns.xml.read_match()}if(!match){xmlStr+=this._input.match(/[\s\S]*/g)[0]}xmlStr=xmlStr.replace(acorn.allLineBreaks,"\n");return this._create_token(TOKEN.STRING,xmlStr)}}return null};function unescape_string(s){var out="",escaped=0;var input_scan=new InputScanner(s);var matched=null;while(input_scan.hasNext()){matched=input_scan.match(/([\s]|[^\\]|\\\\)+/g);if(matched){out+=matched[0]}if(input_scan.peek()==="\\"){input_scan.next();if(input_scan.peek()==="x"){matched=input_scan.match(/x([0-9A-Fa-f]{2})/g)}else if(input_scan.peek()==="u"){matched=input_scan.match(/u([0-9A-Fa-f]{4})/g)}else{out+="\\";if(input_scan.hasNext()){out+=input_scan.next()}continue}if(!matched){return s}escaped=parseInt(matched[1],16);if(escaped>126&&escaped<=255&&matched[0].indexOf("x")===0){return s}else if(escaped>=0&&escaped<32){out+="\\"+matched[0];continue}else if(escaped===34||escaped===39||escaped===92){out+="\\"+String.fromCharCode(escaped)}else{out+=String.fromCharCode(escaped)}}}return out}Tokenizer.prototype._read_string_recursive=function(delimiter,allow_unescaped_newlines,start_sub){var current_char;var pattern;if(delimiter==="'"){pattern=this.__patterns.single_quote}else if(delimiter==='"'){pattern=this.__patterns.double_quote}else if(delimiter==="`"){pattern=this.__patterns.template_text}else if(delimiter==="}"){pattern=this.__patterns.template_expression}var resulting_string=pattern.read();var next="";while(this._input.hasNext()){next=this._input.next();if(next===delimiter||!allow_unescaped_newlines&&acorn.newline.test(next)){this._input.back();break}else if(next==="\\"&&this._input.hasNext()){current_char=this._input.peek();if(current_char==="x"||current_char==="u"){this.has_char_escapes=true}else if(current_char==="\r"&&this._input.peek(1)==="\n"){this._input.next()}next+=this._input.next()}else if(start_sub){if(start_sub==="${"&&next==="$"&&this._input.peek()==="{"){next+=this._input.next()}if(start_sub===next){if(delimiter==="`"){next+=this._read_string_recursive("}",allow_unescaped_newlines,"`")}else{next+=this._read_string_recursive("`",allow_unescaped_newlines,"${")}if(this._input.hasNext()){next+=this._input.next()}}}next+=pattern.read();resulting_string+=next}return resulting_string};module.exports.Tokenizer=Tokenizer;module.exports.TOKEN=TOKEN;module.exports.positionable_operators=positionable_operators.slice();module.exports.line_starters=line_starters.slice()},{"../core/directives":84,"../core/inputscanner":85,"../core/pattern":88,"../core/templatablepattern":89,"../core/tokenizer":91,"./acorn":102}],107:[function(require,module,exports){!function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.Meyda=r():t.Meyda=r()}(this,(function(){return function(t){function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}var e={};return r.m=t,r.c=e,r.i=function(t){return t},r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},r.p="",r(r.s=23)}([function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}function o(t){for(;t%2==0&&t>1;)t/=2;return 1===t}function i(t,r){for(var e=[],n=0;n<Math.min(t.length,r.length);n++)e[n]=t[n]*r[n];return e}function a(t,r){if("rect"!==r){if(""!==r&&r||(r="hanning"),g[r]||(g[r]={}),!g[r][t.length])try{g[r][t.length]=b[r](t.length)}catch(t){throw new Error("Invalid windowing function")}t=i(t,g[r][t.length])}return t}function u(t,r,e){for(var n=new Float32Array(t),o=0;o<n.length;o++)n[o]=o*r/e,n[o]=13*Math.atan(n[o]/1315.8)+3.5*Math.atan(Math.pow(n[o]/7518,2));return n}function c(t){return Float32Array.from(t)}function f(t){return 700*(Math.exp(t/1125)-1)}function l(t){return 1125*Math.log(1+t/700)}function s(t,r,e){for(var n=new Float32Array(t+2),o=new Float32Array(t+2),i=r/2,a=l(0),u=l(i),c=u-a,s=c/(t+1),p=Array(t+2),m=0;m<n.length;m++)n[m]=m*s,o[m]=f(n[m]),p[m]=Math.floor((e+1)*o[m]/r);for(var y=Array(t),h=0;h<y.length;h++){y[h]=Array.apply(null,new Array(e/2+1)).map(Number.prototype.valueOf,0);for(var b=p[h];b<p[h+1];b++)y[h][b]=(b-p[h])/(p[h+1]-p[h]);for(var g=p[h+1];g<p[h+2];g++)y[h][g]=(p[h+2]-g)/(p[h+2]-p[h+1])}return y}function p(t,r){return Math.log2(16*t/r)}function m(t){var r=t[0].map((function(){return 0})),e=t.reduce((function(t,r){return r.forEach((function(r,e){t[e]+=Math.pow(r,2)})),t}),r).map(Math.sqrt);return t.map((function(t,r){return t.map((function(t,r){return t/(e[r]||1)}))}))}function y(t,r,e){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,a=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:440,c=Math.floor(e/2)+1,f=new Array(e).fill(0).map((function(n,o){return t*p(r*o/e,u)}));f[0]=f[1]-1.5*t;var l=f.slice(1).map((function(t,r){return Math.max(t-f[r])}),1).concat([1]),s=Math.round(t/2),y=new Array(t).fill(0).map((function(r,e){return f.map((function(r){return(10*t+s+r-e)%t-s}))})),h=y.map((function(t,r){return t.map((function(t,e){return Math.exp(-.5*Math.pow(2*y[r][e]/l[e],2))}))}));if(h=m(h),i){var b=f.map((function(r){return Math.exp(-.5*Math.pow((r/t-o)/i,2))}));h=h.map((function(t){return t.map((function(t,r){return t*b[r]}))}))}return a&&(h=[].concat(n(h.slice(3)),n(h.slice(0,3)))),h.map((function(t){return t.slice(0,c)}))}function h(t,r,e){if(t.length<r)throw new Error("Buffer is too short for frame length");if(e<1)throw new Error("Hop length cannot be less that 1");if(r<1)throw new Error("Frame length cannot be less that 1");var n=1+Math.floor((t.length-r)/e);return new Array(n).fill(0).map((function(n,o){return t.slice(o*e,o*e+r)}))}r.b=o,r.a=a,r.c=u,r.f=c,r.d=s,r.e=y,r.g=h;var b=e(25),g={}},function(t,r,e){"use strict";function n(t,r){for(var e=0,n=0,o=0;o<r.length;o++)e+=Math.pow(o,t)*Math.abs(r[o]),n+=r[o];return e/n}r.a=n},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(t){if("object"!==n(t.ampSpectrum)||"object"!==n(t.barkScale))throw new TypeError;var r=new Float32Array(24),e=0,o=t.ampSpectrum,i=new Int32Array(25);i[0]=0;for(var a=t.barkScale[o.length-1]/24,u=1,c=0;c<o.length;c++)for(;t.barkScale[c]>a;)i[u++]=c,a=u*t.barkScale[o.length-1]/24;i[24]=o.length-1;for(var f=0;f<24;f++){for(var l=0,s=i[f];s<i[f+1];s++)l+=o[s];r[f]=Math.pow(l,.23)}for(var p=0;p<r.length;p++)e+=r[p];return{specific:r,total:e}}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(){if("object"!==n(arguments[0].ampSpectrum))throw new TypeError;for(var t=new Float32Array(arguments[0].ampSpectrum.length),r=0;r<t.length;r++)t[r]=Math.pow(arguments[0].ampSpectrum[r],2);return t}},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),e.d(r,"buffer",(function(){return v})),e.d(r,"complexSpectrum",(function(){return w})),e.d(r,"amplitudeSpectrum",(function(){return x}));var n=e(13),o=e(9),i=e(20),a=e(14),u=e(18),c=e(15),f=e(21),l=e(19),s=e(17),p=e(22),m=e(2),y=e(12),h=e(11),b=e(10),g=e(8),S=e(3),d=e(16);e.d(r,"rms",(function(){return n.a})),e.d(r,"energy",(function(){return o.a})),e.d(r,"spectralSlope",(function(){return i.a})),e.d(r,"spectralCentroid",(function(){return a.a})),e.d(r,"spectralRolloff",(function(){return u.a})),e.d(r,"spectralFlatness",(function(){return c.a})),e.d(r,"spectralSpread",(function(){return f.a})),e.d(r,"spectralSkewness",(function(){return l.a})),e.d(r,"spectralKurtosis",(function(){return s.a})),e.d(r,"zcr",(function(){return p.a})),e.d(r,"loudness",(function(){return m.a})),e.d(r,"perceptualSpread",(function(){return y.a})),e.d(r,"perceptualSharpness",(function(){return h.a})),e.d(r,"powerSpectrum",(function(){return S.a})),e.d(r,"mfcc",(function(){return b.a})),e.d(r,"chroma",(function(){return g.a})),e.d(r,"spectralFlux",(function(){return d.a}));var v=function(t){return t.signal},w=function(t){return t.complexSpectrum},x=function(t){return t.ampSpectrum}},function(t,r){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,r,e){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=e(0),o=e(4),i=e(28),a=(e.n(i),e(24)),u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c={audioContext:null,spn:null,bufferSize:512,sampleRate:44100,melBands:26,chromaBands:12,callback:null,windowingFunction:"hanning",featureExtractors:o,EXTRACTION_STARTED:!1,_featuresToExtract:[],windowing:n.a,_errors:{notPow2:new Error("Meyda: Buffer size must be a power of 2, e.g. 64 or 512"),featureUndef:new Error("Meyda: No features defined."),invalidFeatureFmt:new Error("Meyda: Invalid feature format"),invalidInput:new Error("Meyda: Invalid input."),noAC:new Error("Meyda: No AudioContext specified."),noSource:new Error("Meyda: No source node specified.")},createMeydaAnalyzer:function(t){return new a.a(t,c)},extract:function(t,r,e){if(!r)throw this._errors.invalidInput;if("object"!=(void 0===r?"undefined":u(r)))throw this._errors.invalidInput;if(!t)throw this._errors.featureUndef;if(!n.b(r.length))throw this._errors.notPow2;void 0!==this.barkScale&&this.barkScale.length==this.bufferSize||(this.barkScale=n.c(this.bufferSize,this.sampleRate,this.bufferSize)),void 0!==this.melFilterBank&&this.barkScale.length==this.bufferSize&&this.melFilterBank.length==this.melBands||(this.melFilterBank=n.d(this.melBands,this.sampleRate,this.bufferSize)),void 0!==this.chromaFilterBank&&this.chromaFilterBank.length==this.chromaBands||(this.chromaFilterBank=n.e(this.chromaBands,this.sampleRate,this.bufferSize)),void 0===r.buffer?this.signal=n.f(r):this.signal=r;var o=f(r,this.windowingFunction,this.bufferSize);if(this.signal=o.windowedSignal,this.complexSpectrum=o.complexSpectrum,this.ampSpectrum=o.ampSpectrum,e){var i=f(e,this.windowingFunction,this.bufferSize);this.previousSignal=i.windowedSignal,this.previousComplexSpectrum=i.complexSpectrum,this.previousAmpSpectrum=i.ampSpectrum}if("object"===(void 0===t?"undefined":u(t))){for(var a={},c=0;c<t.length;c++)a[t[c]]=this.featureExtractors[t[c]]({ampSpectrum:this.ampSpectrum,chromaFilterBank:this.chromaFilterBank,complexSpectrum:this.complexSpectrum,signal:this.signal,bufferSize:this.bufferSize,sampleRate:this.sampleRate,barkScale:this.barkScale,melFilterBank:this.melFilterBank,previousSignal:this.previousSignal,previousAmpSpectrum:this.previousAmpSpectrum,previousComplexSpectrum:this.previousComplexSpectrum});return a}if("string"==typeof t)return this.featureExtractors[t]({ampSpectrum:this.ampSpectrum,chromaFilterBank:this.chromaFilterBank,complexSpectrum:this.complexSpectrum,signal:this.signal,bufferSize:this.bufferSize,sampleRate:this.sampleRate,barkScale:this.barkScale,melFilterBank:this.melFilterBank,previousSignal:this.previousSignal,previousAmpSpectrum:this.previousAmpSpectrum,previousComplexSpectrum:this.previousComplexSpectrum});throw this._errors.invalidFeatureFmt}},f=function(t,r,o){var a={};void 0===t.buffer?a.signal=n.f(t):a.signal=t,a.windowedSignal=n.a(a.signal,r),a.complexSpectrum=e.i(i.fft)(a.windowedSignal),a.ampSpectrum=new Float32Array(o/2);for(var u=0;u<o/2;u++)a.ampSpectrum[u]=Math.sqrt(Math.pow(a.complexSpectrum.real[u],2)+Math.pow(a.complexSpectrum.imag[u],2));return a};r.default=c,"undefined"!=typeof window&&(window.Meyda=c)},function(t,r,e){"use strict";(function(r){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
function n(t,r){if(t===r)return 0;for(var e=t.length,n=r.length,o=0,i=Math.min(e,n);o<i;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0}function o(t){return r.Buffer&&"function"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}function i(t){return Object.prototype.toString.call(t)}function a(t){return!o(t)&&("function"==typeof r.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}function u(t){if(v.isFunction(t)){if(E)return t.name;var r=t.toString(),e=r.match(M);return e&&e[1]}}function c(t,r){return"string"==typeof t?t.length<r?t:t.slice(0,r):t}function f(t){if(E||!v.isFunction(t))return v.inspect(t);var r=u(t);return"[Function"+(r?": "+r:"")+"]"}function l(t){return c(f(t.actual),128)+" "+t.operator+" "+c(f(t.expected),128)}function s(t,r,e,n,o){throw new _.AssertionError({message:e,actual:t,expected:r,operator:n,stackStartFunction:o})}function p(t,r){t||s(t,!0,r,"==",_.ok)}function m(t,r,e,u){if(t===r)return!0;if(o(t)&&o(r))return 0===n(t,r);if(v.isDate(t)&&v.isDate(r))return t.getTime()===r.getTime();if(v.isRegExp(t)&&v.isRegExp(r))return t.source===r.source&&t.global===r.global&&t.multiline===r.multiline&&t.lastIndex===r.lastIndex&&t.ignoreCase===r.ignoreCase;if(null!==t&&"object"==typeof t||null!==r&&"object"==typeof r){if(a(t)&&a(r)&&i(t)===i(r)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===n(new Uint8Array(t.buffer),new Uint8Array(r.buffer));if(o(t)!==o(r))return!1;u=u||{actual:[],expected:[]};var c=u.actual.indexOf(t);return-1!==c&&c===u.expected.indexOf(r)||(u.actual.push(t),u.expected.push(r),h(t,r,e,u))}return e?t===r:t==r}function y(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function h(t,r,e,n){if(null===t||void 0===t||null===r||void 0===r)return!1;if(v.isPrimitive(t)||v.isPrimitive(r))return t===r;if(e&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(r))return!1;var o=y(t),i=y(r);if(o&&!i||!o&&i)return!1;if(o)return t=x.call(t),r=x.call(r),m(t,r,e);var a,u,c=A(t),f=A(r);if(c.length!==f.length)return!1;for(c.sort(),f.sort(),u=c.length-1;u>=0;u--)if(c[u]!==f[u])return!1;for(u=c.length-1;u>=0;u--)if(a=c[u],!m(t[a],r[a],e,n))return!1;return!0}function b(t,r,e){m(t,r,!0)&&s(t,r,e,"notDeepStrictEqual",b)}function g(t,r){if(!t||!r)return!1;if("[object RegExp]"==Object.prototype.toString.call(r))return r.test(t);try{if(t instanceof r)return!0}catch(t){}return!Error.isPrototypeOf(r)&&!0===r.call({},t)}function S(t){var r;try{t()}catch(t){r=t}return r}function d(t,r,e,n){var o;if("function"!=typeof r)throw new TypeError('"block" argument must be a function');"string"==typeof e&&(n=e,e=null),o=S(r),n=(e&&e.name?" ("+e.name+").":".")+(n?" "+n:"."),t&&!o&&s(o,e,"Missing expected exception"+n);var i="string"==typeof n,a=!t&&v.isError(o),u=!t&&o&&!e;if((a&&i&&g(o,e)||u)&&s(o,e,"Got unwanted exception"+n),t&&o&&e&&!g(o,e)||!t&&o)throw o}var v=e(33),w=Object.prototype.hasOwnProperty,x=Array.prototype.slice,E=function(){return"foo"===function(){}.name}(),_=t.exports=p,M=/\s*function\s+([^\(\s]*)\s*/;_.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=l(this),this.generatedMessage=!0);var r=t.stackStartFunction||s;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var e=new Error;if(e.stack){var n=e.stack,o=u(r),i=n.indexOf("\n"+o);if(i>=0){var a=n.indexOf("\n",i+1);n=n.substring(a+1)}this.stack=n}}},v.inherits(_.AssertionError,Error),_.fail=s,_.ok=p,_.equal=function(t,r,e){t!=r&&s(t,r,e,"==",_.equal)},_.notEqual=function(t,r,e){t==r&&s(t,r,e,"!=",_.notEqual)},_.deepEqual=function(t,r,e){m(t,r,!1)||s(t,r,e,"deepEqual",_.deepEqual)},_.deepStrictEqual=function(t,r,e){m(t,r,!0)||s(t,r,e,"deepStrictEqual",_.deepStrictEqual)},_.notDeepEqual=function(t,r,e){m(t,r,!1)&&s(t,r,e,"notDeepEqual",_.notDeepEqual)},_.notDeepStrictEqual=b,_.strictEqual=function(t,r,e){t!==r&&s(t,r,e,"===",_.strictEqual)},_.notStrictEqual=function(t,r,e){t===r&&s(t,r,e,"!==",_.notStrictEqual)},_.throws=function(t,r,e){d(!0,t,r,e)},_.doesNotThrow=function(t,r,e){d(!1,t,r,e)},_.ifError=function(t){if(t)throw t};var A=Object.keys||function(t){var r=[];for(var e in t)w.call(t,e)&&r.push(e);return r}}).call(r,e(5))},function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}var o=(e(0),"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t});r.a=function(t){if("object"!==o(t.ampSpectrum))throw new TypeError("Valid ampSpectrum is required to generate chroma");if("object"!==o(t.chromaFilterBank))throw new TypeError("Valid chromaFilterBank is required to generate chroma");var r=t.chromaFilterBank.map((function(r,e){return t.ampSpectrum.reduce((function(t,e,n){return t+e*r[n]}),0)})),e=Math.max.apply(Math,n(r));return e?r.map((function(t){return t/e})):r}},function(t,r,e){"use strict";var n=e(7),o=(e.n(n),"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t});r.a=function(){if("object"!==o(arguments[0].signal))throw new TypeError;for(var t=0,r=0;r<arguments[0].signal.length;r++)t+=Math.pow(Math.abs(arguments[0].signal[r]),2);return t}},function(t,r,e){"use strict";var n=e(3),o=(e(0),"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t}),i=e(26);r.a=function(t){if("object"!==o(t.ampSpectrum))throw new TypeError("Valid ampSpectrum is required to generate MFCC");if("object"!==o(t.melFilterBank))throw new TypeError("Valid melFilterBank is required to generate MFCC");for(var r=e.i(n.a)(t),a=t.melFilterBank.length,u=Array(a),c=new Float32Array(a),f=0;f<c.length;f++){u[f]=new Float32Array(t.bufferSize/2),c[f]=0;for(var l=0;l<t.bufferSize/2;l++)u[f][l]=t.melFilterBank[f][l]*r[l],c[f]+=u[f][l];c[f]=Math.log(c[f]+1)}var s=Array.prototype.slice.call(c);return i(s).slice(0,13)}},function(t,r,e){"use strict";var n=e(2),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(){if("object"!==o(arguments[0].signal))throw new TypeError;for(var t=e.i(n.a)(arguments[0]),r=t.specific,i=0,a=0;a<r.length;a++)i+=a<15?(a+1)*r[a+1]:.066*Math.exp(.171*(a+1));return i*=.11/t.total}},function(t,r,e){"use strict";var n=e(2),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(){if("object"!==o(arguments[0].signal))throw new TypeError;for(var t=e.i(n.a)(arguments[0]),r=0,i=0;i<t.specific.length;i++)t.specific[i]>r&&(r=t.specific[i]);return Math.pow((t.total-r)/t.total,2)}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(t){if("object"!==n(t.signal))throw new TypeError;for(var r=0,e=0;e<t.signal.length;e++)r+=Math.pow(t.signal[e],2);return r/=t.signal.length,r=Math.sqrt(r)}},function(t,r,e){"use strict";var n=e(1),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(){if("object"!==o(arguments[0].ampSpectrum))throw new TypeError;return e.i(n.a)(1,arguments[0].ampSpectrum)}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(){if("object"!==n(arguments[0].ampSpectrum))throw new TypeError;for(var t=0,r=0,e=0;e<arguments[0].ampSpectrum.length;e++)t+=Math.log(arguments[0].ampSpectrum[e]),r+=arguments[0].ampSpectrum[e];return Math.exp(t/arguments[0].ampSpectrum.length)*arguments[0].ampSpectrum.length/r}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(t){if("object"!==n(t.signal)||"object"!=n(t.previousSignal))throw new TypeError;for(var r=0,e=-t.bufferSize/2;e<signal.length/2-1;e++)x=Math.abs(t.signal[e])-Math.abs(t.previousSignal[e]),r+=(x+Math.abs(x))/2;return r}},function(t,r,e){"use strict";var n=e(1),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(){if("object"!==o(arguments[0].ampSpectrum))throw new TypeError;var t=arguments[0].ampSpectrum,r=e.i(n.a)(1,t),i=e.i(n.a)(2,t),a=e.i(n.a)(3,t),u=e.i(n.a)(4,t);return(-3*Math.pow(r,4)+6*r*i-4*r*a+u)/Math.pow(Math.sqrt(i-Math.pow(r,2)),4)}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(){if("object"!==n(arguments[0].ampSpectrum))throw new TypeError;for(var t=arguments[0].ampSpectrum,r=arguments[0].sampleRate/(2*(t.length-1)),e=0,o=0;o<t.length;o++)e+=t[o];for(var i=.99*e,a=t.length-1;e>i&&a>=0;)e-=t[a],--a;return(a+1)*r}},function(t,r,e){"use strict";var n=e(1),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(t){if("object"!==o(t.ampSpectrum))throw new TypeError;var r=e.i(n.a)(1,t.ampSpectrum),i=e.i(n.a)(2,t.ampSpectrum),a=e.i(n.a)(3,t.ampSpectrum);return(2*Math.pow(r,3)-3*r*i+a)/Math.pow(Math.sqrt(i-Math.pow(r,2)),3)}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(t){if("object"!==n(t.ampSpectrum))throw new TypeError;for(var r=0,e=0,o=new Float32Array(t.ampSpectrum.length),i=0,a=0,u=0;u<t.ampSpectrum.length;u++){r+=t.ampSpectrum[u];var c=u*t.sampleRate/t.bufferSize;o[u]=c,i+=c*c,e+=c,a+=c*t.ampSpectrum[u]}return(t.ampSpectrum.length*a-e*r)/(r*(i-Math.pow(e,2)))}},function(t,r,e){"use strict";var n=e(1),o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(t){if("object"!==o(t.ampSpectrum))throw new TypeError;return Math.sqrt(e.i(n.a)(2,t.ampSpectrum)-Math.pow(e.i(n.a)(1,t.ampSpectrum),2))}},function(t,r,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};r.a=function(){if("object"!==n(arguments[0].signal))throw new TypeError;for(var t=0,r=0;r<arguments[0].signal.length;r++)(arguments[0].signal[r]>=0&&arguments[0].signal[r+1]<0||arguments[0].signal[r]<0&&arguments[0].signal[r+1]>=0)&&t++;return t}},function(t,r,e){t.exports=e(6).default},function(t,r,e){"use strict";function n(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}e.d(r,"a",(function(){return u}));var o=e(0),i=e(4),a=function(){function t(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(r,e,n){return e&&t(r.prototype,e),n&&t(r,n),r}}(),u=function(){function t(r,e){var a=this;if(n(this,t),this._m=e,!r.audioContext)throw this._m.errors.noAC;if(r.bufferSize&&!o.b(r.bufferSize))throw this._m._errors.notPow2;if(!r.source)throw this._m._errors.noSource;this._m.audioContext=r.audioContext,this._m.bufferSize=r.bufferSize||this._m.bufferSize||256,this._m.hopSize=r.hopSize||this._m.hopSize||this._m.bufferSize,this._m.sampleRate=r.sampleRate||this._m.audioContext.sampleRate||44100,this._m.callback=r.callback,this._m.windowingFunction=r.windowingFunction||"hanning",this._m.featureExtractors=i,this._m.EXTRACTION_STARTED=r.startImmediately||!1,this._m.spn=this._m.audioContext.createScriptProcessor(this._m.bufferSize,1,1),this._m.spn.connect(this._m.audioContext.destination),this._m._featuresToExtract=r.featureExtractors||[],this._m.barkScale=o.c(this._m.bufferSize,this._m.sampleRate,this._m.bufferSize),this._m.melFilterBank=o.d(this._m.melBands,this._m.sampleRate,this._m.bufferSize),this._m.inputData=null,this._m.previousInputData=null,this._m.frame=null,this._m.previousFrame=null,this.setSource(r.source),this._m.spn.onaudioprocess=function(t){if(null!==a._m.inputData&&(a._m.previousInputData=a._m.inputData),a._m.inputData=t.inputBuffer.getChannelData(0),a._m.previousInputData){var r=new Float32Array(a._m.previousInputData.length+a._m.inputData.length-a._m.hopSize);r.set(a._m.previousInputData.slice(a._m.hopSize)),r.set(a._m.inputData,a._m.previousInputData.length-a._m.hopSize)}else var r=a._m.inputData;o.g(r,a._m.bufferSize,a._m.hopSize).forEach((function(t){a._m.frame=t;var r=a._m.extract(a._m._featuresToExtract,a._m.frame,a._m.previousFrame);"function"==typeof a._m.callback&&a._m.EXTRACTION_STARTED&&a._m.callback(r),a._m.previousFrame=a._m.frame}))}}return a(t,[{key:"start",value:function(t){this._m._featuresToExtract=t||this._m._featuresToExtract,this._m.EXTRACTION_STARTED=!0}},{key:"stop",value:function(){this._m.EXTRACTION_STARTED=!1}},{key:"setSource",value:function(t){t.connect(this._m.spn)}},{key:"get",value:function(t){return this._m.inputData?this._m.extract(t||this._m._featuresToExtract,this._m.inputData,this._m.previousInputData):null}}]),t}()},function(t,r,e){"use strict";function n(t){for(var r=new Float32Array(t),e=2*Math.PI/(t-1),n=2*e,o=0;o<t/2;o++)r[o]=.42-.5*Math.cos(o*e)+.08*Math.cos(o*n);for(var i=t/2;i>0;i--)r[t-i]=r[i-1];return r}function o(t){for(var r=Math.PI/(t-1),e=new Float32Array(t),n=0;n<t;n++)e[n]=Math.sin(r*n);return e}function i(t){for(var r=new Float32Array(t),e=0;e<t;e++)r[e]=.5-.5*Math.cos(2*Math.PI*e/(t-1));return r}function a(t){for(var r=new Float32Array(t),e=0;e<t;e++)r[e]=.54-.46*Math.cos(2*Math.PI*(e/t-1));return r}Object.defineProperty(r,"__esModule",{value:!0}),r.blackman=n,r.sine=o,r.hanning=i,r.hamming=a},function(t,r,e){t.exports=e(27)},function(t,r){function e(t,r){var e=t.length;return r=r||2,cosMap&&cosMap[e]||n(e),t.map((function(){return 0})).map((function(n,o){return r*t.reduce((function(t,r,n,i){return t+r*cosMap[e][n+o*e]}),0)}))}cosMap=null;var n=function(t){cosMap=cosMap||{},cosMap[t]=new Array(t*t);for(var r=Math.PI/t,e=0;e<t;e++)for(var n=0;n<t;n++)cosMap[t][n+e*t]=Math.cos(r*(n+.5)*e)};t.exports=e},function(t,r,e){"use strict";var n=e(29),o=function(t){var r={};void 0===t.real||void 0===t.imag?r=n.constructComplexArray(t):(r.real=t.real.slice(),r.imag=t.imag.slice());var e=r.real.length,o=Math.log2(e);if(Math.round(o)!=o)throw new Error("Input size must be a power of 2.");if(r.real.length!=r.imag.length)throw new Error("Real and imaginary components must have the same length.");for(var i=n.bitReverseArray(e),a={real:[],imag:[]},u=0;u<e;u++)a.real[i[u]]=r.real[u],a.imag[i[u]]=r.imag[u];for(var c=0;c<e;c++)r.real[c]=a.real[c],r.imag[c]=a.imag[c];for(var f=1;f<=o;f++)for(var l=Math.pow(2,f),s=0;s<l/2;s++)for(var p=n.euler(s,l),m=0;m<e/l;m++){var y=l*m+s,h=l*m+s+l/2,b={real:r.real[y],imag:r.imag[y]},g={real:r.real[h],imag:r.imag[h]},S=n.multiply(p,g),d=n.subtract(b,S);r.real[h]=d.real,r.imag[h]=d.imag;var v=n.add(S,b);r.real[y]=v.real,r.imag[y]=v.imag}return r},i=function(t){if(void 0===t.real||void 0===t.imag)throw new Error("IFFT only accepts a complex input.");for(var r=t.real.length,e={real:[],imag:[]},i=0;i<r;i++){var a={real:t.real[i],imag:t.imag[i]},u=n.conj(a);e.real[i]=u.real,e.imag[i]=u.imag}var c=o(e);return e.real=c.real.map((function(t){return t/r})),e.imag=c.imag.map((function(t){return t/r})),e};t.exports={fft:o,ifft:i}},function(t,r,e){"use strict";function n(t){if(Array.isArray(t)){for(var r=0,e=Array(t.length);r<t.length;r++)e[r]=t[r];return e}return Array.from(t)}var o={},i={},a=function(t){var r={};r.real=void 0===t.real?t.slice():t.real.slice();var e=r.real.length;return void 0===i[e]&&(i[e]=Array.apply(null,Array(e)).map(Number.prototype.valueOf,0)),r.imag=i[e].slice(),r},u=function(t){if(void 0===o[t]){for(var r=(t-1).toString(2).length,e="0".repeat(r),i={},a=0;a<t;a++){var u=a.toString(2);u=e.substr(u.length)+u,u=[].concat(n(u)).reverse().join(""),i[a]=parseInt(u,2)}o[t]=i}return o[t]},c=function(t,r){return{real:t.real*r.real-t.imag*r.imag,imag:t.real*r.imag+t.imag*r.real}},f=function(t,r){return{real:t.real+r.real,imag:t.imag+r.imag}},l=function(t,r){return{real:t.real-r.real,imag:t.imag-r.imag}},s=function(t,r){var e=-2*Math.PI*t/r;return{real:Math.cos(e),imag:Math.sin(e)}},p=function(t){return t.imag*=-1,t};t.exports={bitReverseArray:u,multiply:c,add:f,subtract:l,euler:s,conj:p,constructComplexArray:a}},function(t,r){function e(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(t){if(l===setTimeout)return setTimeout(t,0);if((l===e||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(r){try{return l.call(null,t,0)}catch(r){return l.call(this,t,0)}}}function i(t){if(s===clearTimeout)return clearTimeout(t);if((s===n||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(t);try{return s(t)}catch(r){try{return s.call(null,t)}catch(r){return s.call(this,t)}}}function a(){h&&m&&(h=!1,m.length?y=m.concat(y):b=-1,y.length&&u())}function u(){if(!h){var t=o(a);h=!0;for(var r=y.length;r;){for(m=y,y=[];++b<r;)m&&m[b].run();b=-1,r=y.length}m=null,h=!1,i(t)}}function c(t,r){this.fun=t,this.array=r}function f(){}var l,s,p=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:e}catch(t){l=e}try{s="function"==typeof clearTimeout?clearTimeout:n}catch(t){s=n}}();var m,y=[],h=!1,b=-1;p.nextTick=function(t){var r=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)r[e-1]=arguments[e];y.push(new c(t,r)),1!==y.length||h||o(u)},c.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=f,p.addListener=f,p.once=f,p.off=f,p.removeListener=f,p.removeAllListeners=f,p.emit=f,p.prependListener=f,p.prependOnceListener=f,p.listeners=function(t){return[]},p.binding=function(t){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(t){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(t,r){"function"==typeof Object.create?t.exports=function(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(t,r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}},function(t,r){t.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},function(t,r,e){(function(t,n){function o(t,e){var n={seen:[],stylize:a};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),h(e)?n.showHidden=e:e&&r._extend(n,e),w(n.showHidden)&&(n.showHidden=!1),w(n.depth)&&(n.depth=2),w(n.colors)&&(n.colors=!1),w(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=i),c(n,t,n.depth)}function i(t,r){var e=o.styles[r];return e?"["+o.colors[e][0]+"m"+t+"["+o.colors[e][1]+"m":t}function a(t,r){return t}function u(t){var r={};return t.forEach((function(t,e){r[t]=!0})),r}function c(t,e,n){if(t.customInspect&&e&&A(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var o=e.inspect(n,t);return d(o)||(o=c(t,o,n)),o}var i=f(t,e);if(i)return i;var a=Object.keys(e),h=u(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),M(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(e);if(0===a.length){if(A(e)){var b=e.name?": "+e.name:"";return t.stylize("[Function"+b+"]","special")}if(x(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(_(e))return t.stylize(Date.prototype.toString.call(e),"date");if(M(e))return l(e)}var g="",S=!1,v=["{","}"];if(y(e)&&(S=!0,v=["[","]"]),A(e)){g=" [Function"+(e.name?": "+e.name:"")+"]"}if(x(e)&&(g=" "+RegExp.prototype.toString.call(e)),_(e)&&(g=" "+Date.prototype.toUTCString.call(e)),M(e)&&(g=" "+l(e)),0===a.length&&(!S||0==e.length))return v[0]+g+v[1];if(n<0)return x(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var w;return w=S?s(t,e,n,h,a):a.map((function(r){return p(t,e,n,h,r,S)})),t.seen.pop(),m(w,g,v)}function f(t,r){if(w(r))return t.stylize("undefined","undefined");if(d(r)){var e="'"+JSON.stringify(r).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(e,"string")}return S(r)?t.stylize(""+r,"number"):h(r)?t.stylize(""+r,"boolean"):b(r)?t.stylize("null","null"):void 0}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function s(t,r,e,n,o){for(var i=[],a=0,u=r.length;a<u;++a)z(r,String(a))?i.push(p(t,r,e,n,String(a),!0)):i.push("");return o.forEach((function(o){o.match(/^\d+$/)||i.push(p(t,r,e,n,o,!0))})),i}function p(t,r,e,n,o,i){var a,u,f;if(f=Object.getOwnPropertyDescriptor(r,o)||{value:r[o]},f.get?u=f.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):f.set&&(u=t.stylize("[Setter]","special")),z(n,o)||(a="["+o+"]"),u||(t.seen.indexOf(f.value)<0?(u=b(e)?c(t,f.value,null):c(t,f.value,e-1),u.indexOf("\n")>-1&&(u=i?u.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+u.split("\n").map((function(t){return" "+t})).join("\n"))):u=t.stylize("[Circular]","special")),w(a)){if(i&&o.match(/^\d+$/))return u;a=JSON.stringify(""+o),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+u}function m(t,r,e){var n=0;return t.reduce((function(t,r){return n++,r.indexOf("\n")>=0&&n++,t+r.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?e[0]+(""===r?"":r+"\n ")+" "+t.join(",\n ")+" "+e[1]:e[0]+r+" "+t.join(", ")+" "+e[1]}function y(t){return Array.isArray(t)}function h(t){return"boolean"==typeof t}function b(t){return null===t}function g(t){return null==t}function S(t){return"number"==typeof t}function d(t){return"string"==typeof t}function v(t){return"symbol"==typeof t}function w(t){return void 0===t}function x(t){return E(t)&&"[object RegExp]"===T(t)}function E(t){return"object"==typeof t&&null!==t}function _(t){return E(t)&&"[object Date]"===T(t)}function M(t){return E(t)&&("[object Error]"===T(t)||t instanceof Error)}function A(t){return"function"==typeof t}function j(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t}function T(t){return Object.prototype.toString.call(t)}function F(t){return t<10?"0"+t.toString(10):t.toString(10)}function k(){var t=new Date,r=[F(t.getHours()),F(t.getMinutes()),F(t.getSeconds())].join(":");return[t.getDate(),R[t.getMonth()],r].join(" ")}function z(t,r){return Object.prototype.hasOwnProperty.call(t,r)}var O=/%[sdj%]/g;r.format=function(t){if(!d(t)){for(var r=[],e=0;e<arguments.length;e++)r.push(o(arguments[e]));return r.join(" ")}for(var e=1,n=arguments,i=n.length,a=String(t).replace(O,(function(t){if("%%"===t)return"%";if(e>=i)return t;switch(t){case"%s":return String(n[e++]);case"%d":return Number(n[e++]);case"%j":try{return JSON.stringify(n[e++])}catch(t){return"[Circular]"}default:return t}})),u=n[e];e<i;u=n[++e])b(u)||!E(u)?a+=" "+u:a+=" "+o(u);return a},r.deprecate=function(e,o){function i(){if(!a){if(n.throwDeprecation)throw new Error(o);n.traceDeprecation?console.trace(o):console.error(o),a=!0}return e.apply(this,arguments)}if(w(t.process))return function(){return r.deprecate(e,o).apply(this,arguments)};if(!0===n.noDeprecation)return e;var a=!1;return i};var B,D={};r.debuglog=function(t){if(w(B)&&(B=n.env.NODE_DEBUG||""),t=t.toUpperCase(),!D[t])if(new RegExp("\\b"+t+"\\b","i").test(B)){var e=n.pid;D[t]=function(){var n=r.format.apply(r,arguments);console.error("%s %d: %s",t,e,n)}}else D[t]=function(){};return D[t]},r.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=y,r.isBoolean=h,r.isNull=b,r.isNullOrUndefined=g,r.isNumber=S,r.isString=d,r.isSymbol=v,r.isUndefined=w,r.isRegExp=x,r.isObject=E,r.isDate=_,r.isError=M,r.isFunction=A,r.isPrimitive=j,r.isBuffer=e(32);var R=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",k(),r.format.apply(r,arguments))},r.inherits=e(31),r._extend=function(t,r){if(!r||!E(r))return t;for(var e=Object.keys(r),n=e.length;n--;)t[e[n]]=r[e[n]];return t}}).call(r,e(5),e(30))}])}))},{}],108:[function(require,module,exports){exports.encode=function(obj){var str="";for(var i in obj){if(obj.hasOwnProperty(i)){if(str.length)str+="&";str+=encodeURIComponent(i)+"="+encodeURIComponent(obj[i])}}return str};exports.decode=function(qs){var qry={};var pairs=qs.split("&");for(var i=0,l=pairs.length;i<l;i++){var pair=pairs[i].split("=");qry[decodeURIComponent(pair[0])]=decodeURIComponent(pair[1])}return qry}},{}],109:[function(require,module,exports){var re=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;var parts=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];module.exports=function parseuri(str){var src=str,b=str.indexOf("["),e=str.indexOf("]");if(b!=-1&&e!=-1){str=str.substring(0,b)+str.substring(b,e).replace(/:/g,";")+str.substring(e,str.length)}var m=re.exec(str||""),uri={},i=14;while(i--){uri[parts[i]]=m[i]||""}if(b!=-1&&e!=-1){uri.source=src;uri.host=uri.host.substring(1,uri.host.length-1).replace(/;/g,":");uri.authority=uri.authority.replace("[","").replace("]","").replace(/;/g,":");uri.ipv6uri=true}uri.pathNames=pathNames(uri,uri["path"]);uri.queryKey=queryKey(uri,uri["query"]);return uri};function pathNames(obj,path){var regx=/\/{2,9}/g,names=path.replace(regx,"/").split("/");if(path.substr(0,1)=="/"||path.length===0){names.splice(0,1)}if(path.substr(path.length-1,1)=="/"){names.splice(names.length-1,1)}return names}function queryKey(uri,query){var data={};query.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function($0,$1,$2){if($1){data[$1]=$2}}));return data}},{}],110:[function(require,module,exports){(function(process){(function(){(function(){var getNanoSeconds,hrtime,loadTime,moduleLoadTime,nodeLoadTime,upTime;if(typeof performance!=="undefined"&&performance!==null&&performance.now){module.exports=function(){return performance.now()}}else if(typeof process!=="undefined"&&process!==null&&process.hrtime){module.exports=function(){return(getNanoSeconds()-nodeLoadTime)/1e6};hrtime=process.hrtime;getNanoSeconds=function(){var hr;hr=hrtime();return hr[0]*1e9+hr[1]};moduleLoadTime=getNanoSeconds();upTime=process.uptime()*1e9;nodeLoadTime=moduleLoadTime-upTime}else if(Date.now){module.exports=function(){return Date.now()-loadTime};loadTime=Date.now()}else{module.exports=function(){return(new Date).getTime()-loadTime};loadTime=(new Date).getTime()}}).call(this)}).call(this)}).call(this,require("_process"))},{_process:112}],111:[function(require,module,exports){(function(process){(function(){"use strict";if(!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0){module.exports={nextTick:nextTick}}else{module.exports=process}function nextTick(fn,arg1,arg2,arg3){if(typeof fn!=="function"){throw new TypeError('"callback" argument must be a function')}var len=arguments.length;var args,i;switch(len){case 0:case 1:return process.nextTick(fn);case 2:return process.nextTick((function afterTickOne(){fn.call(null,arg1)}));case 3:return process.nextTick((function afterTickTwo(){fn.call(null,arg1,arg2)}));case 4:return process.nextTick((function afterTickThree(){fn.call(null,arg1,arg2,arg3)}));default:args=new Array(len-1);i=0;while(i<args.length){args[i++]=arguments[i]}return process.nextTick((function afterTick(){fn.apply(null,args)}))}}}).call(this)}).call(this,require("_process"))},{_process:112}],112:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],113:[function(require,module,exports){var inherits=require("inherits");var EventEmitter=require("events").EventEmitter;var now=require("right-now");var raf=require("raf");module.exports=Engine;function Engine(fn){if(!(this instanceof Engine))return new Engine(fn);this.running=false;this.last=now();this._frame=0;this._tick=this.tick.bind(this);if(fn)this.on("tick",fn)}inherits(Engine,EventEmitter);Engine.prototype.start=function(){if(this.running)return;this.running=true;this.last=now();this._frame=raf(this._tick);return this};Engine.prototype.stop=function(){this.running=false;if(this._frame!==0)raf.cancel(this._frame);this._frame=0;return this};Engine.prototype.tick=function(){this._frame=raf(this._tick);var time=now();var dt=time-this.last;this.emit("tick",dt);this.last=time}},{events:26,inherits:80,raf:114,"right-now":126}],114:[function(require,module,exports){(function(global){(function(){var now=require("performance-now"),root=typeof window==="undefined"?global:window,vendors=["moz","webkit"],suffix="AnimationFrame",raf=root["request"+suffix],caf=root["cancel"+suffix]||root["cancelRequest"+suffix];for(var i=0;!raf&&i<vendors.length;i++){raf=root[vendors[i]+"Request"+suffix];caf=root[vendors[i]+"Cancel"+suffix]||root[vendors[i]+"CancelRequest"+suffix]}if(!raf||!caf){var last=0,id=0,queue=[],frameDuration=1e3/60;raf=function(callback){if(queue.length===0){var _now=now(),next=Math.max(0,frameDuration-(_now-last));last=next+_now;setTimeout((function(){var cp=queue.slice(0);queue.length=0;for(var i=0;i<cp.length;i++){if(!cp[i].cancelled){try{cp[i].callback(last)}catch(e){setTimeout((function(){throw e}),0)}}}}),Math.round(next))}queue.push({handle:++id,callback:callback,cancelled:false});return id};caf=function(handle){for(var i=0;i<queue.length;i++){if(queue[i].handle===handle){queue[i].cancelled=true}}}}module.exports=function(fn){return raf.call(root,fn)};module.exports.cancel=function(){caf.apply(root,arguments)};module.exports.polyfill=function(object){if(!object){object=root}object.requestAnimationFrame=raf;object.cancelAnimationFrame=caf}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"performance-now":110}],115:[function(require,module,exports){(function(process,global){(function(){"use strict";function oldBrowser(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}var Buffer=require("safe-buffer").Buffer;var crypto=global.crypto||global.msCrypto;if(crypto&&crypto.getRandomValues){module.exports=randomBytes}else{module.exports=oldBrowser}function randomBytes(size,cb){if(size>65536)throw new Error("requested too many random bytes");var rawBytes=new global.Uint8Array(size);if(size>0){crypto.getRandomValues(rawBytes)}var bytes=Buffer.from(rawBytes.buffer);if(typeof cb==="function"){return process.nextTick((function(){cb(null,bytes)}))}return bytes}}).call(this)}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{_process:112,"safe-buffer":127}],116:[function(require,module,exports){"use strict";var processNextTick=require("process-nextick-args").nextTick;var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){keys.push(key)}return keys};module.exports=Duplex;var util=require("core-util-is");util.inherits=require("inherits");var Readable=require("./_stream_readable");var Writable=require("./_stream_writable");util.inherits(Duplex,Readable);var keys=objectKeys(Writable.prototype);for(var v=0;v<keys.length;v++){var method=keys[v];if(!Duplex.prototype[method])Duplex.prototype[method]=Writable.prototype[method]}function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);if(options&&options.readable===false)this.readable=false;if(options&&options.writable===false)this.writable=false;this.allowHalfOpen=true;if(options&&options.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",onend)}function onend(){if(this.allowHalfOpen||this._writableState.ended)return;processNextTick(onEndNT,this)}function onEndNT(self){self.end()}Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){if(this._readableState===undefined||this._writableState===undefined){return false}return this._readableState.destroyed&&this._writableState.destroyed},set:function(value){if(this._readableState===undefined||this._writableState===undefined){return}this._readableState.destroyed=value;this._writableState.destroyed=value}});Duplex.prototype._destroy=function(err,cb){this.push(null);this.end();processNextTick(cb,err)};function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}},{"./_stream_readable":118,"./_stream_writable":120,"core-util-is":37,inherits:80,"process-nextick-args":111}],117:[function(require,module,exports){"use strict";module.exports=PassThrough;var Transform=require("./_stream_transform");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./_stream_transform":119,"core-util-is":37,inherits:80}],118:[function(require,module,exports){(function(process,global){(function(){"use strict";var processNextTick=require("process-nextick-args").nextTick;module.exports=Readable;var isArray=require("isarray");var Duplex;Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter;var EElistenerCount=function(emitter,type){return emitter.listeners(type).length};var Stream=require("./internal/streams/stream");var Buffer=require("safe-buffer").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk)}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array}var util=require("core-util-is");util.inherits=require("inherits");var debugUtil=require("util");var debug=void 0;if(debugUtil&&debugUtil.debuglog){debug=debugUtil.debuglog("stream")}else{debug=function(){}}var BufferList=require("./internal/streams/BufferList");var destroyImpl=require("./internal/streams/destroy");var StringDecoder;util.inherits(Readable,Stream);var kProxyEvents=["error","close","destroy","pause","resume"];function prependListener(emitter,event,fn){if(typeof emitter.prependListener==="function")return emitter.prependListener(event,fn);if(!emitter._events||!emitter._events[event])emitter.on(event,fn);else if(isArray(emitter._events[event]))emitter._events[event].unshift(fn);else emitter._events[event]=[fn,emitter._events[event]]}function ReadableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};var isDuplex=stream instanceof Duplex;this.objectMode=!!options.objectMode;if(isDuplex)this.objectMode=this.objectMode||!!options.readableObjectMode;var hwm=options.highWaterMark;var readableHwm=options.readableHighWaterMark;var defaultHwm=this.objectMode?16:16*1024;if(hwm||hwm===0)this.highWaterMark=hwm;else if(isDuplex&&(readableHwm||readableHwm===0))this.highWaterMark=readableHwm;else this.highWaterMark=defaultHwm;this.highWaterMark=Math.floor(this.highWaterMark);this.buffer=new BufferList;this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=null;this.ended=false;this.endEmitted=false;this.reading=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.resumeScheduled=false;this.destroyed=false;this.defaultEncoding=options.defaultEncoding||"utf8";this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding}}function Readable(options){Duplex=Duplex||require("./_stream_duplex");if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);this.readable=true;if(options){if(typeof options.read==="function")this._read=options.read;if(typeof options.destroy==="function")this._destroy=options.destroy}Stream.call(this)}Object.defineProperty(Readable.prototype,"destroyed",{get:function(){if(this._readableState===undefined){return false}return this._readableState.destroyed},set:function(value){if(!this._readableState){return}this._readableState.destroyed=value}});Readable.prototype.destroy=destroyImpl.destroy;Readable.prototype._undestroy=destroyImpl.undestroy;Readable.prototype._destroy=function(err,cb){this.push(null);cb(err)};Readable.prototype.push=function(chunk,encoding){var state=this._readableState;var skipChunkCheck;if(!state.objectMode){if(typeof chunk==="string"){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=Buffer.from(chunk,encoding);encoding=""}skipChunkCheck=true}}else{skipChunkCheck=true}return readableAddChunk(this,chunk,encoding,false,skipChunkCheck)};Readable.prototype.unshift=function(chunk){return readableAddChunk(this,chunk,null,true,false)};function readableAddChunk(stream,chunk,encoding,addToFront,skipChunkCheck){var state=stream._readableState;if(chunk===null){state.reading=false;onEofChunk(stream,state)}else{var er;if(!skipChunkCheck)er=chunkInvalid(state,chunk);if(er){stream.emit("error",er)}else if(state.objectMode||chunk&&chunk.length>0){if(typeof chunk!=="string"&&!state.objectMode&&Object.getPrototypeOf(chunk)!==Buffer.prototype){chunk=_uint8ArrayToBuffer(chunk)}if(addToFront){if(state.endEmitted)stream.emit("error",new Error("stream.unshift() after end event"));else addChunk(stream,state,chunk,true)}else if(state.ended){stream.emit("error",new Error("stream.push() after EOF"))}else{state.reading=false;if(state.decoder&&!encoding){chunk=state.decoder.write(chunk);if(state.objectMode||chunk.length!==0)addChunk(stream,state,chunk,false);else maybeReadMore(stream,state)}else{addChunk(stream,state,chunk,false)}}}else if(!addToFront){state.reading=false}}return needMoreData(state)}function addChunk(stream,state,chunk,addToFront){if(state.flowing&&state.length===0&&!state.sync){stream.emit("data",chunk);stream.read(0)}else{state.length+=state.objectMode?1:chunk.length;if(addToFront)state.buffer.unshift(chunk);else state.buffer.push(chunk);if(state.needReadable)emitReadable(stream)}maybeReadMore(stream,state)}function chunkInvalid(state,chunk){var er;if(!_isUint8Array(chunk)&&typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}return er}function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}Readable.prototype.isPaused=function(){return this._readableState.flowing===false};Readable.prototype.setEncoding=function(enc){if(!StringDecoder)StringDecoder=require("string_decoder/").StringDecoder;this._readableState.decoder=new StringDecoder(enc);this._readableState.encoding=enc;return this};var MAX_HWM=8388608;function computeNewHighWaterMark(n){if(n>=MAX_HWM){n=MAX_HWM}else{n--;n|=n>>>1;n|=n>>>2;n|=n>>>4;n|=n>>>8;n|=n>>>16;n++}return n}function howMuchToRead(n,state){if(n<=0||state.length===0&&state.ended)return 0;if(state.objectMode)return 1;if(n!==n){if(state.flowing&&state.length)return state.buffer.head.data.length;else return state.length}if(n>state.highWaterMark)state.highWaterMark=computeNewHighWaterMark(n);if(n<=state.length)return n;if(!state.ended){state.needReadable=true;return 0}return state.length}Readable.prototype.read=function(n){debug("read",n);n=parseInt(n,10);var state=this._readableState;var nOrig=n;if(n!==0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){debug("read: emitReadable",state.length,state.ended);if(state.length===0&&state.ended)endReadable(this);else emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){if(state.length===0)endReadable(this);return null}var doRead=state.needReadable;debug("need readable",doRead);if(state.length===0||state.length-n<state.highWaterMark){doRead=true;debug("length less than watermark",doRead)}if(state.ended||state.reading){doRead=false;debug("reading or ended",doRead)}else if(doRead){debug("do read");state.reading=true;state.sync=true;if(state.length===0)state.needReadable=true;this._read(state.highWaterMark);state.sync=false;if(!state.reading)n=howMuchToRead(nOrig,state)}var ret;if(n>0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}else{state.length-=n}if(state.length===0){if(!state.ended)state.needReadable=true;if(nOrig!==n&&state.ended)endReadable(this)}if(ret!==null)this.emit("data",ret);return ret};function onEofChunk(stream,state){if(state.ended)return;if(state.decoder){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;emitReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(!state.emittedReadable){debug("emitReadable",state.flowing);state.emittedReadable=true;if(state.sync)processNextTick(emitReadable_,stream);else emitReadable_(stream)}}function emitReadable_(stream){debug("emit readable");stream.emit("readable");flow(stream)}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;processNextTick(maybeReadMore_,stream,state)}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark){debug("maybeReadMore read 0");stream.read(0);if(len===state.length)break;else len=state.length}state.readingMore=false}Readable.prototype._read=function(n){this.emit("error",new Error("_read() is not implemented"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this;var state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1;debug("pipe count=%d opts=%j",state.pipesCount,pipeOpts);var doEnd=(!pipeOpts||pipeOpts.end!==false)&&dest!==process.stdout&&dest!==process.stderr;var endFn=doEnd?onend:unpipe;if(state.endEmitted)processNextTick(endFn);else src.once("end",endFn);dest.on("unpipe",onunpipe);function onunpipe(readable,unpipeInfo){debug("onunpipe");if(readable===src){if(unpipeInfo&&unpipeInfo.hasUnpiped===false){unpipeInfo.hasUnpiped=true;cleanup()}}}function onend(){debug("onend");dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);var cleanedUp=false;function cleanup(){debug("cleanup");dest.removeListener("close",onclose);dest.removeListener("finish",onfinish);dest.removeListener("drain",ondrain);dest.removeListener("error",onerror);dest.removeListener("unpipe",onunpipe);src.removeListener("end",onend);src.removeListener("end",unpipe);src.removeListener("data",ondata);cleanedUp=true;if(state.awaitDrain&&(!dest._writableState||dest._writableState.needDrain))ondrain()}var increasedAwaitDrain=false;src.on("data",ondata);function ondata(chunk){debug("ondata");increasedAwaitDrain=false;var ret=dest.write(chunk);if(false===ret&&!increasedAwaitDrain){if((state.pipesCount===1&&state.pipes===dest||state.pipesCount>1&&indexOf(state.pipes,dest)!==-1)&&!cleanedUp){debug("false write response, pause",src._readableState.awaitDrain);src._readableState.awaitDrain++;increasedAwaitDrain=true}src.pause()}}function onerror(er){debug("onerror",er);unpipe();dest.removeListener("error",onerror);if(EElistenerCount(dest,"error")===0)dest.emit("error",er)}prependListener(dest,"error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){debug("onfinish");dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){debug("unpipe");src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){debug("pipe resume");src.resume()}return dest};function pipeOnDrain(src){return function(){var state=src._readableState;debug("pipeOnDrain",state.awaitDrain);if(state.awaitDrain)state.awaitDrain--;if(state.awaitDrain===0&&EElistenerCount(src,"data")){state.flowing=true;flow(src)}}}Readable.prototype.unpipe=function(dest){var state=this._readableState;var unpipeInfo={hasUnpiped:false};if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;state.flowing=false;if(dest)dest.emit("unpipe",this,unpipeInfo);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;state.flowing=false;for(var i=0;i<len;i++){dests[i].emit("unpipe",this,unpipeInfo)}return this}var index=indexOf(state.pipes,dest);if(index===-1)return this;state.pipes.splice(index,1);state.pipesCount-=1;if(state.pipesCount===1)state.pipes=state.pipes[0];dest.emit("unpipe",this,unpipeInfo);return this};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if(ev==="data"){if(this._readableState.flowing!==false)this.resume()}else if(ev==="readable"){var state=this._readableState;if(!state.endEmitted&&!state.readableListening){state.readableListening=state.needReadable=true;state.emittedReadable=false;if(!state.reading){processNextTick(nReadingNextTick,this)}else if(state.length){emitReadable(this)}}}return res};Readable.prototype.addListener=Readable.prototype.on;function nReadingNextTick(self){debug("readable nexttick read 0");self.read(0)}Readable.prototype.resume=function(){var state=this._readableState;if(!state.flowing){debug("resume");state.flowing=true;resume(this,state)}return this};function resume(stream,state){if(!state.resumeScheduled){state.resumeScheduled=true;processNextTick(resume_,stream,state)}}function resume_(stream,state){if(!state.reading){debug("resume read 0");stream.read(0)}state.resumeScheduled=false;state.awaitDrain=0;stream.emit("resume");flow(stream);if(state.flowing&&!state.reading)stream.read(0)}Readable.prototype.pause=function(){debug("call pause flowing=%j",this._readableState.flowing);if(false!==this._readableState.flowing){debug("pause");this._readableState.flowing=false;this.emit("pause")}return this};function flow(stream){var state=stream._readableState;debug("flow",state.flowing);while(state.flowing&&stream.read()!==null){}}Readable.prototype.wrap=function(stream){var _this=this;var state=this._readableState;var paused=false;stream.on("end",(function(){debug("wrapped end");if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length)_this.push(chunk)}_this.push(null)}));stream.on("data",(function(chunk){debug("wrapped data");if(state.decoder)chunk=state.decoder.write(chunk);if(state.objectMode&&(chunk===null||chunk===undefined))return;else if(!state.objectMode&&(!chunk||!chunk.length))return;var ret=_this.push(chunk);if(!ret){paused=true;stream.pause()}}));for(var i in stream){if(this[i]===undefined&&typeof stream[i]==="function"){this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i)}}for(var n=0;n<kProxyEvents.length;n++){stream.on(kProxyEvents[n],this.emit.bind(this,kProxyEvents[n]))}this._read=function(n){debug("wrapped _read",n);if(paused){paused=false;stream.resume()}};return this};Readable._fromList=fromList;function fromList(n,state){if(state.length===0)return null;var ret;if(state.objectMode)ret=state.buffer.shift();else if(!n||n>=state.length){if(state.decoder)ret=state.buffer.join("");else if(state.buffer.length===1)ret=state.buffer.head.data;else ret=state.buffer.concat(state.length);state.buffer.clear()}else{ret=fromListPartial(n,state.buffer,state.decoder)}return ret}function fromListPartial(n,list,hasStrings){var ret;if(n<list.head.data.length){ret=list.head.data.slice(0,n);list.head.data=list.head.data.slice(n)}else if(n===list.head.data.length){ret=list.shift()}else{ret=hasStrings?copyFromBufferString(n,list):copyFromBuffer(n,list)}return ret}function copyFromBufferString(n,list){var p=list.head;var c=1;var ret=p.data;n-=ret.length;while(p=p.next){var str=p.data;var nb=n>str.length?str.length:n;if(nb===str.length)ret+=str;else ret+=str.slice(0,n);n-=nb;if(n===0){if(nb===str.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=str.slice(nb)}break}++c}list.length-=c;return ret}function copyFromBuffer(n,list){var ret=Buffer.allocUnsafe(n);var p=list.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)list.head=p.next;else list.head=list.tail=null}else{list.head=p;p.data=buf.slice(nb)}break}++c}list.length-=c;return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error('"endReadable()" called on non-empty stream');if(!state.endEmitted){state.ended=true;processNextTick(endReadableNT,state,stream)}}function endReadableNT(state,stream){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i}return-1}}).call(this)}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./_stream_duplex":116,"./internal/streams/BufferList":121,"./internal/streams/destroy":122,"./internal/streams/stream":123,_process:112,"core-util-is":37,events:26,inherits:80,isarray:82,"process-nextick-args":111,"safe-buffer":127,"string_decoder/":155,util:25}],119:[function(require,module,exports){"use strict";module.exports=Transform;var Duplex=require("./_stream_duplex");var util=require("core-util-is");util.inherits=require("inherits");util.inherits(Transform,Duplex);function afterTransform(er,data){var ts=this._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb){return this.emit("error",new Error("write callback called multiple times"))}ts.writechunk=null;ts.writecb=null;if(data!=null)this.push(data);cb(er);var rs=this._readableState;rs.reading=false;if(rs.needReadable||rs.length<rs.highWaterMark){this._read(rs.highWaterMark)}}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options);this._transformState={afterTransform:afterTransform.bind(this),needTransform:false,transforming:false,writecb:null,writechunk:null,writeencoding:null};this._readableState.needReadable=true;this._readableState.sync=false;if(options){if(typeof options.transform==="function")this._transform=options.transform;if(typeof options.flush==="function")this._flush=options.flush}this.on("prefinish",prefinish)}function prefinish(){var _this=this;if(typeof this._flush==="function"){this._flush((function(er,data){done(_this,er,data)}))}else{done(this,null,null)}}Transform.prototype.push=function(chunk,encoding){this._transformState.needTransform=false;return Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("_transform() is not implemented")};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb;ts.writechunk=chunk;ts.writeencoding=encoding;if(!ts.transforming){var rs=this._readableState;if(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)this._read(rs.highWaterMark)}};Transform.prototype._read=function(n){var ts=this._transformState;if(ts.writechunk!==null&&ts.writecb&&!ts.transforming){ts.transforming=true;this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)}else{ts.needTransform=true}};Transform.prototype._destroy=function(err,cb){var _this2=this;Duplex.prototype._destroy.call(this,err,(function(err2){cb(err2);_this2.emit("close")}))};function done(stream,er,data){if(er)return stream.emit("error",er);if(data!=null)stream.push(data);if(stream._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(stream._transformState.transforming)throw new Error("Calling transform done when still transforming");return stream.push(null)}},{"./_stream_duplex":116,"core-util-is":37,inherits:80}],120:[function(require,module,exports){(function(process,global,setImmediate){(function(){"use strict";var processNextTick=require("process-nextick-args").nextTick;module.exports=Writable;function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb;this.next=null}function CorkedRequest(state){var _this=this;this.next=null;this.entry=null;this.finish=function(){onCorkedFinish(_this,state)}}var asyncWrite=!process.browser&&["v0.10","v0.9."].indexOf(process.version.slice(0,5))>-1?setImmediate:processNextTick;var Duplex;Writable.WritableState=WritableState;var util=require("core-util-is");util.inherits=require("inherits");var internalUtil={deprecate:require("util-deprecate")};var Stream=require("./internal/streams/stream");var Buffer=require("safe-buffer").Buffer;var OurUint8Array=global.Uint8Array||function(){};function _uint8ArrayToBuffer(chunk){return Buffer.from(chunk)}function _isUint8Array(obj){return Buffer.isBuffer(obj)||obj instanceof OurUint8Array}var destroyImpl=require("./internal/streams/destroy");util.inherits(Writable,Stream);function nop(){}function WritableState(options,stream){Duplex=Duplex||require("./_stream_duplex");options=options||{};var isDuplex=stream instanceof Duplex;this.objectMode=!!options.objectMode;if(isDuplex)this.objectMode=this.objectMode||!!options.writableObjectMode;var hwm=options.highWaterMark;var writableHwm=options.writableHighWaterMark;var defaultHwm=this.objectMode?16:16*1024;if(hwm||hwm===0)this.highWaterMark=hwm;else if(isDuplex&&(writableHwm||writableHwm===0))this.highWaterMark=writableHwm;else this.highWaterMark=defaultHwm;this.highWaterMark=Math.floor(this.highWaterMark);this.finalCalled=false;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;this.destroyed=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.corked=0;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.bufferedRequest=null;this.lastBufferedRequest=null;this.pendingcb=0;this.prefinished=false;this.errorEmitted=false;this.bufferedRequestCount=0;this.corkedRequestsFree=new CorkedRequest(this)}WritableState.prototype.getBuffer=function getBuffer(){var current=this.bufferedRequest;var out=[];while(current){out.push(current);current=current.next}return out};(function(){try{Object.defineProperty(WritableState.prototype,"buffer",{get:internalUtil.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer "+"instead.","DEP0003")})}catch(_){}})();var realHasInstance;if(typeof Symbol==="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]==="function"){realHasInstance=Function.prototype[Symbol.hasInstance];Object.defineProperty(Writable,Symbol.hasInstance,{value:function(object){if(realHasInstance.call(this,object))return true;if(this!==Writable)return false;return object&&object._writableState instanceof WritableState}})}else{realHasInstance=function(object){return object instanceof this}}function Writable(options){Duplex=Duplex||require("./_stream_duplex");if(!realHasInstance.call(Writable,this)&&!(this instanceof Duplex)){return new Writable(options)}this._writableState=new WritableState(options,this);this.writable=true;if(options){if(typeof options.write==="function")this._write=options.write;if(typeof options.writev==="function")this._writev=options.writev;if(typeof options.destroy==="function")this._destroy=options.destroy;if(typeof options.final==="function")this._final=options.final}Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function writeAfterEnd(stream,cb){var er=new Error("write after end");stream.emit("error",er);processNextTick(cb,er)}function validChunk(stream,state,chunk,cb){var valid=true;var er=false;if(chunk===null){er=new TypeError("May not write null values to stream")}else if(typeof chunk!=="string"&&chunk!==undefined&&!state.objectMode){er=new TypeError("Invalid non-string/buffer chunk")}if(er){stream.emit("error",er);processNextTick(cb,er);valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;var isBuf=!state.objectMode&&_isUint8Array(chunk);if(isBuf&&!Buffer.isBuffer(chunk)){chunk=_uint8ArrayToBuffer(chunk)}if(typeof encoding==="function"){cb=encoding;encoding=null}if(isBuf)encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=nop;if(state.ended)writeAfterEnd(this,cb);else if(isBuf||validChunk(this,state,chunk,cb)){state.pendingcb++;ret=writeOrBuffer(this,state,isBuf,chunk,encoding,cb)}return ret};Writable.prototype.cork=function(){var state=this._writableState;state.corked++};Writable.prototype.uncork=function(){var state=this._writableState;if(state.corked){state.corked--;if(!state.writing&&!state.corked&&!state.finished&&!state.bufferProcessing&&state.bufferedRequest)clearBuffer(this,state)}};Writable.prototype.setDefaultEncoding=function setDefaultEncoding(encoding){if(typeof encoding==="string")encoding=encoding.toLowerCase();if(!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((encoding+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+encoding);this._writableState.defaultEncoding=encoding;return this};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=Buffer.from(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,isBuf,chunk,encoding,cb){if(!isBuf){var newChunk=decodeChunk(state,chunk,encoding);if(chunk!==newChunk){isBuf=true;encoding="buffer";chunk=newChunk}}var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;if(!ret)state.needDrain=true;if(state.writing||state.corked){var last=state.lastBufferedRequest;state.lastBufferedRequest={chunk:chunk,encoding:encoding,isBuf:isBuf,callback:cb,next:null};if(last){last.next=state.lastBufferedRequest}else{state.bufferedRequest=state.lastBufferedRequest}state.bufferedRequestCount+=1}else{doWrite(stream,state,false,len,chunk,encoding,cb)}return ret}function doWrite(stream,state,writev,len,chunk,encoding,cb){state.writelen=len;state.writecb=cb;state.writing=true;state.sync=true;if(writev)stream._writev(chunk,state.onwrite);else stream._write(chunk,encoding,state.onwrite);state.sync=false}function onwriteError(stream,state,sync,er,cb){--state.pendingcb;if(sync){processNextTick(cb,er);processNextTick(finishMaybe,stream,state);stream._writableState.errorEmitted=true;stream.emit("error",er)}else{cb(er);stream._writableState.errorEmitted=true;stream.emit("error",er);finishMaybe(stream,state)}}function onwriteStateUpdate(state){state.writing=false;state.writecb=null;state.length-=state.writelen;state.writelen=0}function onwrite(stream,er){var state=stream._writableState;var sync=state.sync;var cb=state.writecb;onwriteStateUpdate(state);if(er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(state);if(!finished&&!state.corked&&!state.bufferProcessing&&state.bufferedRequest){clearBuffer(stream,state)}if(sync){asyncWrite(afterWrite,stream,state,finished,cb)}else{afterWrite(stream,state,finished,cb)}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);state.pendingcb--;cb();finishMaybe(stream,state)}function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit("drain")}}function clearBuffer(stream,state){state.bufferProcessing=true;var entry=state.bufferedRequest;if(stream._writev&&entry&&entry.next){var l=state.bufferedRequestCount;var buffer=new Array(l);var holder=state.corkedRequestsFree;holder.entry=entry;var count=0;var allBuffers=true;while(entry){buffer[count]=entry;if(!entry.isBuf)allBuffers=false;entry=entry.next;count+=1}buffer.allBuffers=allBuffers;doWrite(stream,state,true,state.length,buffer,"",holder.finish);state.pendingcb++;state.lastBufferedRequest=null;if(holder.next){state.corkedRequestsFree=holder.next;holder.next=null}else{state.corkedRequestsFree=new CorkedRequest(state)}state.bufferedRequestCount=0}else{while(entry){var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,false,len,chunk,encoding,cb);entry=entry.next;state.bufferedRequestCount--;if(state.writing){break}}if(entry===null)state.lastBufferedRequest=null}state.bufferedRequest=entry;state.bufferProcessing=false}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("_write() is not implemented"))};Writable.prototype._writev=null;Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==="function"){cb=chunk;chunk=null;encoding=null}else if(typeof encoding==="function"){cb=encoding;encoding=null}if(chunk!==null&&chunk!==undefined)this.write(chunk,encoding);if(state.corked){state.corked=1;this.uncork()}if(!state.ending&&!state.finished)endWritable(this,state,cb)};function needFinish(state){return state.ending&&state.length===0&&state.bufferedRequest===null&&!state.finished&&!state.writing}function callFinal(stream,state){stream._final((function(err){state.pendingcb--;if(err){stream.emit("error",err)}state.prefinished=true;stream.emit("prefinish");finishMaybe(stream,state)}))}function prefinish(stream,state){if(!state.prefinished&&!state.finalCalled){if(typeof stream._final==="function"){state.pendingcb++;state.finalCalled=true;processNextTick(callFinal,stream,state)}else{state.prefinished=true;stream.emit("prefinish")}}}function finishMaybe(stream,state){var need=needFinish(state);if(need){prefinish(stream,state);if(state.pendingcb===0){state.finished=true;stream.emit("finish")}}return need}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)processNextTick(cb);else stream.once("finish",cb)}state.ended=true;stream.writable=false}function onCorkedFinish(corkReq,state,err){var entry=corkReq.entry;corkReq.entry=null;while(entry){var cb=entry.callback;state.pendingcb--;cb(err);entry=entry.next}if(state.corkedRequestsFree){state.corkedRequestsFree.next=corkReq}else{state.corkedRequestsFree=corkReq}}Object.defineProperty(Writable.prototype,"destroyed",{get:function(){if(this._writableState===undefined){return false}return this._writableState.destroyed},set:function(value){if(!this._writableState){return}this._writableState.destroyed=value}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){this.end();cb(err)}}).call(this)}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("timers").setImmediate)},{"./_stream_duplex":116,"./internal/streams/destroy":122,"./internal/streams/stream":123,_process:112,"core-util-is":37,inherits:80,"process-nextick-args":111,"safe-buffer":127,timers:162,"util-deprecate":164}],121:[function(require,module,exports){"use strict";function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var Buffer=require("safe-buffer").Buffer;var util=require("util");function copyBuffer(src,target,offset){src.copy(target,offset)}module.exports=function(){function BufferList(){_classCallCheck(this,BufferList);this.head=null;this.tail=null;this.length=0}BufferList.prototype.push=function push(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length};BufferList.prototype.unshift=function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length};BufferList.prototype.shift=function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret};BufferList.prototype.clear=function clear(){this.head=this.tail=null;this.length=0};BufferList.prototype.join=function join(s){if(this.length===0)return"";var p=this.head;var ret=""+p.data;while(p=p.next){ret+=s+p.data}return ret};BufferList.prototype.concat=function concat(n){if(this.length===0)return Buffer.alloc(0);if(this.length===1)return this.head.data;var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next}return ret};return BufferList}();if(util&&util.inspect&&util.inspect.custom){module.exports.prototype[util.inspect.custom]=function(){var obj=util.inspect({length:this.length});return this.constructor.name+" "+obj}}},{"safe-buffer":127,util:25}],122:[function(require,module,exports){"use strict";var processNextTick=require("process-nextick-args").nextTick;function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err)}else if(err&&(!this._writableState||!this._writableState.errorEmitted)){processNextTick(emitErrorNT,this,err)}return this}if(this._readableState){this._readableState.destroyed=true}if(this._writableState){this._writableState.destroyed=true}this._destroy(err||null,(function(err){if(!cb&&err){processNextTick(emitErrorNT,_this,err);if(_this._writableState){_this._writableState.errorEmitted=true}}else if(cb){cb(err)}}));return this}function undestroy(){if(this._readableState){this._readableState.destroyed=false;this._readableState.reading=false;this._readableState.ended=false;this._readableState.endEmitted=false}if(this._writableState){this._writableState.destroyed=false;this._writableState.ended=false;this._writableState.ending=false;this._writableState.finished=false;this._writableState.errorEmitted=false}}function emitErrorNT(self,err){self.emit("error",err)}module.exports={destroy:destroy,undestroy:undestroy}},{"process-nextick-args":111}],123:[function(require,module,exports){module.exports=require("events").EventEmitter},{events:26}],124:[function(require,module,exports){exports=module.exports=require("./lib/_stream_readable.js");exports.Stream=exports;exports.Readable=exports;exports.Writable=require("./lib/_stream_writable.js");exports.Duplex=require("./lib/_stream_duplex.js");exports.Transform=require("./lib/_stream_transform.js");exports.PassThrough=require("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":116,"./lib/_stream_passthrough.js":117,"./lib/_stream_readable.js":118,"./lib/_stream_transform.js":119,"./lib/_stream_writable.js":120}],125:[function(require,module,exports){(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.createREGL=factory()})(this,(function(){"use strict";var isTypedArray=function(x){return x instanceof Uint8Array||x instanceof Uint16Array||x instanceof Uint32Array||x instanceof Int8Array||x instanceof Int16Array||x instanceof Int32Array||x instanceof Float32Array||x instanceof Float64Array||x instanceof Uint8ClampedArray};var extend=function(base,opts){var keys=Object.keys(opts);for(var i=0;i<keys.length;++i){base[keys[i]]=opts[keys[i]]}return base};var endl="\n";function decodeB64(str){if(typeof atob!=="undefined"){return atob(str)}return"base64:"+str}function raise(message){var error=new Error("(regl) "+message);console.error(error);throw error}function check(pred,message){if(!pred){raise(message)}}function encolon(message){if(message){return": "+message}return""}function checkParameter(param,possibilities,message){if(!(param in possibilities)){raise("unknown parameter ("+param+")"+encolon(message)+". possible values: "+Object.keys(possibilities).join())}}function checkIsTypedArray(data,message){if(!isTypedArray(data)){raise("invalid parameter type"+encolon(message)+". must be a typed array")}}function standardTypeEh(value,type){switch(type){case"number":return typeof value==="number";case"object":return typeof value==="object";case"string":return typeof value==="string";case"boolean":return typeof value==="boolean";case"function":return typeof value==="function";case"undefined":return typeof value==="undefined";case"symbol":return typeof value==="symbol"}}function checkTypeOf(value,type,message){if(!standardTypeEh(value,type)){raise("invalid parameter type"+encolon(message)+". expected "+type+", got "+typeof value)}}function checkNonNegativeInt(value,message){if(!(value>=0&&(value|0)===value)){raise("invalid parameter type, ("+value+")"+encolon(message)+". must be a nonnegative integer")}}function checkOneOf(value,list,message){if(list.indexOf(value)<0){raise("invalid value"+encolon(message)+". must be one of: "+list)}}var constructorKeys=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function checkConstructor(obj){Object.keys(obj).forEach((function(key){if(constructorKeys.indexOf(key)<0){raise('invalid regl constructor argument "'+key+'". must be one of '+constructorKeys)}}))}function leftPad(str,n){str=str+"";while(str.length<n){str=" "+str}return str}function ShaderFile(){this.name="unknown";this.lines=[];this.index={};this.hasErrors=false}function ShaderLine(number,line){this.number=number;this.line=line;this.errors=[]}function ShaderError(fileNumber,lineNumber,message){this.file=fileNumber;this.line=lineNumber;this.message=message}function guessCommand(){var error=new Error;var stack=(error.stack||error).toString();var pat=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(stack);if(pat){return pat[1]}var pat2=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(stack);if(pat2){return pat2[1]}return"unknown"}function guessCallSite(){var error=new Error;var stack=(error.stack||error).toString();var pat=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(stack);if(pat){return pat[1]}var pat2=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(stack);if(pat2){return pat2[1]}return"unknown"}function parseSource(source,command){var lines=source.split("\n");var lineNumber=1;var fileNumber=0;var files={unknown:new ShaderFile,0:new ShaderFile};files.unknown.name=files[0].name=command||guessCommand();files.unknown.lines.push(new ShaderLine(0,""));for(var i=0;i<lines.length;++i){var line=lines[i];var parts=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(line);if(parts){switch(parts[1]){case"line":var lineNumberInfo=/(\d+)(\s+\d+)?/.exec(parts[2]);if(lineNumberInfo){lineNumber=lineNumberInfo[1]|0;if(lineNumberInfo[2]){fileNumber=lineNumberInfo[2]|0;if(!(fileNumber in files)){files[fileNumber]=new ShaderFile}}}break;case"define":var nameInfo=/SHADER_NAME(_B64)?\s+(.*)$/.exec(parts[2]);if(nameInfo){files[fileNumber].name=nameInfo[1]?decodeB64(nameInfo[2]):nameInfo[2]}break}}files[fileNumber].lines.push(new ShaderLine(lineNumber++,line))}Object.keys(files).forEach((function(fileNumber){var file=files[fileNumber];file.lines.forEach((function(line){file.index[line.number]=line}))}));return files}function parseErrorLog(errLog){var result=[];errLog.split("\n").forEach((function(errMsg){if(errMsg.length<5){return}var parts=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(errMsg);if(parts){result.push(new ShaderError(parts[1]|0,parts[2]|0,parts[3].trim()))}else if(errMsg.length>0){result.push(new ShaderError("unknown",0,errMsg))}}));return result}function annotateFiles(files,errors){errors.forEach((function(error){var file=files[error.file];if(file){var line=file.index[error.line];if(line){line.errors.push(error);file.hasErrors=true;return}}files.unknown.hasErrors=true;files.unknown.lines[0].errors.push(error)}))}function checkShaderError(gl,shader,source,type,command){if(!gl.getShaderParameter(shader,gl.COMPILE_STATUS)){var errLog=gl.getShaderInfoLog(shader);var typeName=type===gl.FRAGMENT_SHADER?"fragment":"vertex";checkCommandType(source,"string",typeName+" shader source must be a string",command);var files=parseSource(source,command);var errors=parseErrorLog(errLog);annotateFiles(files,errors);Object.keys(files).forEach((function(fileNumber){var file=files[fileNumber];if(!file.hasErrors){return}var strings=[""];var styles=[""];function push(str,style){strings.push(str);styles.push(style||"")}push("file number "+fileNumber+": "+file.name+"\n","color:red;text-decoration:underline;font-weight:bold");file.lines.forEach((function(line){if(line.errors.length>0){push(leftPad(line.number,4)+"| ","background-color:yellow; font-weight:bold");push(line.line+endl,"color:red; background-color:yellow; font-weight:bold");var offset=0;line.errors.forEach((function(error){var message=error.message;var token=/^\s*'(.*)'\s*:\s*(.*)$/.exec(message);if(token){var tokenPat=token[1];message=token[2];switch(tokenPat){case"assign":tokenPat="=";break}offset=Math.max(line.line.indexOf(tokenPat,offset),0)}else{offset=0}push(leftPad("| ",6));push(leftPad("^^^",offset+3)+endl,"font-weight:bold");push(leftPad("| ",6));push(message+endl,"font-weight:bold")}));push(leftPad("| ",6)+endl)}else{push(leftPad(line.number,4)+"| ");push(line.line+endl,"color:red")}}));if(typeof document!=="undefined"&&!window.chrome){styles[0]=strings.join("%c");console.log.apply(console,styles)}else{console.log(strings.join(""))}}));check.raise("Error compiling "+typeName+" shader, "+files[0].name)}}function checkLinkError(gl,program,fragShader,vertShader,command){if(!gl.getProgramParameter(program,gl.LINK_STATUS)){var errLog=gl.getProgramInfoLog(program);var fragParse=parseSource(fragShader,command);var vertParse=parseSource(vertShader,command);var header='Error linking program with vertex shader, "'+vertParse[0].name+'", and fragment shader "'+fragParse[0].name+'"';if(typeof document!=="undefined"){console.log("%c"+header+endl+"%c"+errLog,"color:red;text-decoration:underline;font-weight:bold","color:red")}else{console.log(header+endl+errLog)}check.raise(header)}}function saveCommandRef(object){object._commandRef=guessCommand()}function saveDrawCommandInfo(opts,uniforms,attributes,stringStore){saveCommandRef(opts);function id(str){if(str){return stringStore.id(str)}return 0}opts._fragId=id(opts.static.frag);opts._vertId=id(opts.static.vert);function addProps(dict,set){Object.keys(set).forEach((function(u){dict[stringStore.id(u)]=true}))}var uniformSet=opts._uniformSet={};addProps(uniformSet,uniforms.static);addProps(uniformSet,uniforms.dynamic);var attributeSet=opts._attributeSet={};addProps(attributeSet,attributes.static);addProps(attributeSet,attributes.dynamic);opts._hasCount="count"in opts.static||"count"in opts.dynamic||"elements"in opts.static||"elements"in opts.dynamic}function commandRaise(message,command){var callSite=guessCallSite();raise(message+" in command "+(command||guessCommand())+(callSite==="unknown"?"":" called from "+callSite))}function checkCommand(pred,message,command){if(!pred){commandRaise(message,command||guessCommand())}}function checkParameterCommand(param,possibilities,message,command){if(!(param in possibilities)){commandRaise("unknown parameter ("+param+")"+encolon(message)+". possible values: "+Object.keys(possibilities).join(),command||guessCommand())}}function checkCommandType(value,type,message,command){if(!standardTypeEh(value,type)){commandRaise("invalid parameter type"+encolon(message)+". expected "+type+", got "+typeof value,command||guessCommand())}}function checkOptional(block){block()}function checkFramebufferFormat(attachment,texFormats,rbFormats){if(attachment.texture){checkOneOf(attachment.texture._texture.internalformat,texFormats,"unsupported texture format for attachment")}else{checkOneOf(attachment.renderbuffer._renderbuffer.format,rbFormats,"unsupported renderbuffer format for attachment")}}var GL_CLAMP_TO_EDGE=33071;var GL_NEAREST=9728;var GL_NEAREST_MIPMAP_NEAREST=9984;var GL_LINEAR_MIPMAP_NEAREST=9985;var GL_NEAREST_MIPMAP_LINEAR=9986;var GL_LINEAR_MIPMAP_LINEAR=9987;var GL_BYTE=5120;var GL_UNSIGNED_BYTE=5121;var GL_SHORT=5122;var GL_UNSIGNED_SHORT=5123;var GL_INT=5124;var GL_UNSIGNED_INT=5125;var GL_FLOAT=5126;var GL_UNSIGNED_SHORT_4_4_4_4=32819;var GL_UNSIGNED_SHORT_5_5_5_1=32820;var GL_UNSIGNED_SHORT_5_6_5=33635;var GL_UNSIGNED_INT_24_8_WEBGL=34042;var GL_HALF_FLOAT_OES=36193;var TYPE_SIZE={};TYPE_SIZE[GL_BYTE]=TYPE_SIZE[GL_UNSIGNED_BYTE]=1;TYPE_SIZE[GL_SHORT]=TYPE_SIZE[GL_UNSIGNED_SHORT]=TYPE_SIZE[GL_HALF_FLOAT_OES]=TYPE_SIZE[GL_UNSIGNED_SHORT_5_6_5]=TYPE_SIZE[GL_UNSIGNED_SHORT_4_4_4_4]=TYPE_SIZE[GL_UNSIGNED_SHORT_5_5_5_1]=2;TYPE_SIZE[GL_INT]=TYPE_SIZE[GL_UNSIGNED_INT]=TYPE_SIZE[GL_FLOAT]=TYPE_SIZE[GL_UNSIGNED_INT_24_8_WEBGL]=4;function pixelSize(type,channels){if(type===GL_UNSIGNED_SHORT_5_5_5_1||type===GL_UNSIGNED_SHORT_4_4_4_4||type===GL_UNSIGNED_SHORT_5_6_5){return 2}else if(type===GL_UNSIGNED_INT_24_8_WEBGL){return 4}else{return TYPE_SIZE[type]*channels}}function isPow2(v){return!(v&v-1)&&!!v}function checkTexture2D(info,mipData,limits){var i;var w=mipData.width;var h=mipData.height;var c=mipData.channels;check(w>0&&w<=limits.maxTextureSize&&h>0&&h<=limits.maxTextureSize,"invalid texture shape");if(info.wrapS!==GL_CLAMP_TO_EDGE||info.wrapT!==GL_CLAMP_TO_EDGE){check(isPow2(w)&&isPow2(h),"incompatible wrap mode for texture, both width and height must be power of 2")}if(mipData.mipmask===1){if(w!==1&&h!==1){check(info.minFilter!==GL_NEAREST_MIPMAP_NEAREST&&info.minFilter!==GL_NEAREST_MIPMAP_LINEAR&&info.minFilter!==GL_LINEAR_MIPMAP_NEAREST&&info.minFilter!==GL_LINEAR_MIPMAP_LINEAR,"min filter requires mipmap")}}else{check(isPow2(w)&&isPow2(h),"texture must be a square power of 2 to support mipmapping");check(mipData.mipmask===(w<<1)-1,"missing or incomplete mipmap data")}if(mipData.type===GL_FLOAT){if(limits.extensions.indexOf("oes_texture_float_linear")<0){check(info.minFilter===GL_NEAREST&&info.magFilter===GL_NEAREST,"filter not supported, must enable oes_texture_float_linear")}check(!info.genMipmaps,"mipmap generation not supported with float textures")}var mipimages=mipData.images;for(i=0;i<16;++i){if(mipimages[i]){var mw=w>>i;var mh=h>>i;check(mipData.mipmask&1<<i,"missing mipmap data");var img=mipimages[i];check(img.width===mw&&img.height===mh,"invalid shape for mip images");check(img.format===mipData.format&&img.internalformat===mipData.internalformat&&img.type===mipData.type,"incompatible type for mip image");if(img.compressed){}else if(img.data){var rowSize=Math.ceil(pixelSize(img.type,c)*mw/img.unpackAlignment)*img.unpackAlignment;check(img.data.byteLength===rowSize*mh,"invalid data for image, buffer size is inconsistent with image format")}else if(img.element){}else if(img.copy){}}else if(!info.genMipmaps){check((mipData.mipmask&1<<i)===0,"extra mipmap data")}}if(mipData.compressed){check(!info.genMipmaps,"mipmap generation for compressed images not supported")}}function checkTextureCube(texture,info,faces,limits){var w=texture.width;var h=texture.height;var c=texture.channels;check(w>0&&w<=limits.maxTextureSize&&h>0&&h<=limits.maxTextureSize,"invalid texture shape");check(w===h,"cube map must be square");check(info.wrapS===GL_CLAMP_TO_EDGE&&info.wrapT===GL_CLAMP_TO_EDGE,"wrap mode not supported by cube map");for(var i=0;i<faces.length;++i){var face=faces[i];check(face.width===w&&face.height===h,"inconsistent cube map face shape");if(info.genMipmaps){check(!face.compressed,"can not generate mipmap for compressed textures");check(face.mipmask===1,"can not specify mipmaps and generate mipmaps")}else{}var mipmaps=face.images;for(var j=0;j<16;++j){var img=mipmaps[j];if(img){var mw=w>>j;var mh=h>>j;check(face.mipmask&1<<j,"missing mipmap data");check(img.width===mw&&img.height===mh,"invalid shape for mip images");check(img.format===texture.format&&img.internalformat===texture.internalformat&&img.type===texture.type,"incompatible type for mip image");if(img.compressed){}else if(img.data){check(img.data.byteLength===mw*mh*Math.max(pixelSize(img.type,c),img.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format")}else if(img.element){}else if(img.copy){}}}}}var check$1=extend(check,{optional:checkOptional,raise:raise,commandRaise:commandRaise,command:checkCommand,parameter:checkParameter,commandParameter:checkParameterCommand,constructor:checkConstructor,type:checkTypeOf,commandType:checkCommandType,isTypedArray:checkIsTypedArray,nni:checkNonNegativeInt,oneOf:checkOneOf,shaderError:checkShaderError,linkError:checkLinkError,callSite:guessCallSite,saveCommandRef:saveCommandRef,saveDrawInfo:saveDrawCommandInfo,framebufferFormat:checkFramebufferFormat,guessCommand:guessCommand,texture2D:checkTexture2D,textureCube:checkTextureCube});var VARIABLE_COUNTER=0;var DYN_FUNC=0;var DYN_CONSTANT=5;var DYN_ARRAY=6;function DynamicVariable(type,data){this.id=VARIABLE_COUNTER++;this.type=type;this.data=data}function escapeStr(str){return str.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function splitParts(str){if(str.length===0){return[]}var firstChar=str.charAt(0);var lastChar=str.charAt(str.length-1);if(str.length>1&&firstChar===lastChar&&(firstChar==='"'||firstChar==="'")){return['"'+escapeStr(str.substr(1,str.length-2))+'"']}var parts=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(str);if(parts){return splitParts(str.substr(0,parts.index)).concat(splitParts(parts[1])).concat(splitParts(str.substr(parts.index+parts[0].length)))}var subparts=str.split(".");if(subparts.length===1){return['"'+escapeStr(str)+'"']}var result=[];for(var i=0;i<subparts.length;++i){result=result.concat(splitParts(subparts[i]))}return result}function toAccessorString(str){return"["+splitParts(str).join("][")+"]"}function defineDynamic(type,data){return new DynamicVariable(type,toAccessorString(data+""))}function isDynamic(x){return typeof x==="function"&&!x._reglType||x instanceof DynamicVariable}function unbox(x,path){if(typeof x==="function"){return new DynamicVariable(DYN_FUNC,x)}else if(typeof x==="number"||typeof x==="boolean"){return new DynamicVariable(DYN_CONSTANT,x)}else if(Array.isArray(x)){return new DynamicVariable(DYN_ARRAY,x.map(((y,i)=>unbox(y,path+"["+i+"]"))))}else if(x instanceof DynamicVariable){return x}check$1(false,"invalid option type in uniform "+path)}var dynamic={DynamicVariable:DynamicVariable,define:defineDynamic,isDynamic:isDynamic,unbox:unbox,accessor:toAccessorString};var raf={next:typeof requestAnimationFrame==="function"?function(cb){return requestAnimationFrame(cb)}:function(cb){return setTimeout(cb,16)},cancel:typeof cancelAnimationFrame==="function"?function(raf){return cancelAnimationFrame(raf)}:clearTimeout};var clock=typeof performance!=="undefined"&&performance.now?function(){return performance.now()}:function(){return+new Date};function createStringStore(){var stringIds={"":0};var stringValues=[""];return{id:function(str){var result=stringIds[str];if(result){return result}result=stringIds[str]=stringValues.length;stringValues.push(str);return result},str:function(id){return stringValues[id]}}}function createCanvas(element,onDone,pixelRatio){var canvas=document.createElement("canvas");extend(canvas.style,{border:0,margin:0,padding:0,top:0,left:0});element.appendChild(canvas);if(element===document.body){canvas.style.position="absolute";extend(element.style,{margin:0,padding:0})}function resize(){var w=window.innerWidth;var h=window.innerHeight;if(element!==document.body){var bounds=element.getBoundingClientRect();w=bounds.right-bounds.left;h=bounds.bottom-bounds.top}canvas.width=pixelRatio*w;canvas.height=pixelRatio*h;extend(canvas.style,{width:w+"px",height:h+"px"})}var resizeObserver;if(element!==document.body&&typeof ResizeObserver==="function"){resizeObserver=new ResizeObserver((function(){setTimeout(resize)}));resizeObserver.observe(element)}else{window.addEventListener("resize",resize,false)}function onDestroy(){if(resizeObserver){resizeObserver.disconnect()}else{window.removeEventListener("resize",resize)}element.removeChild(canvas)}resize();return{canvas:canvas,onDestroy:onDestroy}}function createContext(canvas,contextAttributes){function get(name){try{return canvas.getContext(name,contextAttributes)}catch(e){return null}}return get("webgl")||get("experimental-webgl")||get("webgl-experimental")}function isHTMLElement(obj){return typeof obj.nodeName==="string"&&typeof obj.appendChild==="function"&&typeof obj.getBoundingClientRect==="function"}function isWebGLContext(obj){return typeof obj.drawArrays==="function"||typeof obj.drawElements==="function"}function parseExtensions(input){if(typeof input==="string"){return input.split()}check$1(Array.isArray(input),"invalid extension array");return input}function getElement(desc){if(typeof desc==="string"){check$1(typeof document!=="undefined","not supported outside of DOM");return document.querySelector(desc)}return desc}function parseArgs(args_){var args=args_||{};var element,container,canvas,gl;var contextAttributes={};var extensions=[];var optionalExtensions=[];var pixelRatio=typeof window==="undefined"?1:window.devicePixelRatio;var profile=false;var onDone=function(err){if(err){check$1.raise(err)}};var onDestroy=function(){};if(typeof args==="string"){check$1(typeof document!=="undefined","selector queries only supported in DOM enviroments");element=document.querySelector(args);check$1(element,"invalid query string for element")}else if(typeof args==="object"){if(isHTMLElement(args)){element=args}else if(isWebGLContext(args)){gl=args;canvas=gl.canvas}else{check$1.constructor(args);if("gl"in args){gl=args.gl}else if("canvas"in args){canvas=getElement(args.canvas)}else if("container"in args){container=getElement(args.container)}if("attributes"in args){contextAttributes=args.attributes;check$1.type(contextAttributes,"object","invalid context attributes")}if("extensions"in args){extensions=parseExtensions(args.extensions)}if("optionalExtensions"in args){optionalExtensions=parseExtensions(args.optionalExtensions)}if("onDone"in args){check$1.type(args.onDone,"function","invalid or missing onDone callback");onDone=args.onDone}if("profile"in args){profile=!!args.profile}if("pixelRatio"in args){pixelRatio=+args.pixelRatio;check$1(pixelRatio>0,"invalid pixel ratio")}}}else{check$1.raise("invalid arguments to regl")}if(element){if(element.nodeName.toLowerCase()==="canvas"){canvas=element}else{container=element}}if(!gl){if(!canvas){check$1(typeof document!=="undefined","must manually specify webgl context outside of DOM environments");var result=createCanvas(container||document.body,onDone,pixelRatio);if(!result){return null}canvas=result.canvas;onDestroy=result.onDestroy}if(contextAttributes.premultipliedAlpha===undefined)contextAttributes.premultipliedAlpha=true;gl=createContext(canvas,contextAttributes)}if(!gl){onDestroy();onDone("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org");return null}return{gl:gl,canvas:canvas,container:container,extensions:extensions,optionalExtensions:optionalExtensions,pixelRatio:pixelRatio,profile:profile,onDone:onDone,onDestroy:onDestroy}}function createExtensionCache(gl,config){var extensions={};function tryLoadExtension(name_){check$1.type(name_,"string","extension name must be string");var name=name_.toLowerCase();var ext;try{ext=extensions[name]=gl.getExtension(name)}catch(e){}return!!ext}for(var i=0;i<config.extensions.length;++i){var name=config.extensions[i];if(!tryLoadExtension(name)){config.onDestroy();config.onDone('"'+name+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser');return null}}config.optionalExtensions.forEach(tryLoadExtension);return{extensions:extensions,restore:function(){Object.keys(extensions).forEach((function(name){if(extensions[name]&&!tryLoadExtension(name)){throw new Error("(regl): error restoring extension "+name)}}))}}}function loop(n,f){var result=Array(n);for(var i=0;i<n;++i){result[i]=f(i)}return result}var GL_BYTE$1=5120;var GL_UNSIGNED_BYTE$2=5121;var GL_SHORT$1=5122;var GL_UNSIGNED_SHORT$1=5123;var GL_INT$1=5124;var GL_UNSIGNED_INT$1=5125;var GL_FLOAT$2=5126;function nextPow16(v){for(var i=16;i<=1<<28;i*=16){if(v<=i){return i}}return 0}function log2(v){var r,shift;r=(v>65535)<<4;v>>>=r;shift=(v>255)<<3;v>>>=shift;r|=shift;shift=(v>15)<<2;v>>>=shift;r|=shift;shift=(v>3)<<1;v>>>=shift;r|=shift;return r|v>>1}function createPool(){var bufferPool=loop(8,(function(){return[]}));function alloc(n){var sz=nextPow16(n);var bin=bufferPool[log2(sz)>>2];if(bin.length>0){return bin.pop()}return new ArrayBuffer(sz)}function free(buf){bufferPool[log2(buf.byteLength)>>2].push(buf)}function allocType(type,n){var result=null;switch(type){case GL_BYTE$1:result=new Int8Array(alloc(n),0,n);break;case GL_UNSIGNED_BYTE$2:result=new Uint8Array(alloc(n),0,n);break;case GL_SHORT$1:result=new Int16Array(alloc(2*n),0,n);break;case GL_UNSIGNED_SHORT$1:result=new Uint16Array(alloc(2*n),0,n);break;case GL_INT$1:result=new Int32Array(alloc(4*n),0,n);break;case GL_UNSIGNED_INT$1:result=new Uint32Array(alloc(4*n),0,n);break;case GL_FLOAT$2:result=new Float32Array(alloc(4*n),0,n);break;default:return null}if(result.length!==n){return result.subarray(0,n)}return result}function freeType(array){free(array.buffer)}return{alloc:alloc,free:free,allocType:allocType,freeType:freeType}}var pool=createPool();pool.zero=createPool();var GL_SUBPIXEL_BITS=3408;var GL_RED_BITS=3410;var GL_GREEN_BITS=3411;var GL_BLUE_BITS=3412;var GL_ALPHA_BITS=3413;var GL_DEPTH_BITS=3414;var GL_STENCIL_BITS=3415;var GL_ALIASED_POINT_SIZE_RANGE=33901;var GL_ALIASED_LINE_WIDTH_RANGE=33902;var GL_MAX_TEXTURE_SIZE=3379;var GL_MAX_VIEWPORT_DIMS=3386;var GL_MAX_VERTEX_ATTRIBS=34921;var GL_MAX_VERTEX_UNIFORM_VECTORS=36347;var GL_MAX_VARYING_VECTORS=36348;var GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661;var GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660;var GL_MAX_TEXTURE_IMAGE_UNITS=34930;var GL_MAX_FRAGMENT_UNIFORM_VECTORS=36349;var GL_MAX_CUBE_MAP_TEXTURE_SIZE=34076;var GL_MAX_RENDERBUFFER_SIZE=34024;var GL_VENDOR=7936;var GL_RENDERER=7937;var GL_VERSION=7938;var GL_SHADING_LANGUAGE_VERSION=35724;var GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047;var GL_MAX_COLOR_ATTACHMENTS_WEBGL=36063;var GL_MAX_DRAW_BUFFERS_WEBGL=34852;var GL_TEXTURE_2D=3553;var GL_TEXTURE_CUBE_MAP=34067;var GL_TEXTURE_CUBE_MAP_POSITIVE_X=34069;var GL_TEXTURE0=33984;var GL_RGBA=6408;var GL_FLOAT$1=5126;var GL_UNSIGNED_BYTE$1=5121;var GL_FRAMEBUFFER=36160;var GL_FRAMEBUFFER_COMPLETE=36053;var GL_COLOR_ATTACHMENT0=36064;var GL_COLOR_BUFFER_BIT$1=16384;var wrapLimits=function(gl,extensions){var maxAnisotropic=1;if(extensions.ext_texture_filter_anisotropic){maxAnisotropic=gl.getParameter(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT)}var maxDrawbuffers=1;var maxColorAttachments=1;if(extensions.webgl_draw_buffers){maxDrawbuffers=gl.getParameter(GL_MAX_DRAW_BUFFERS_WEBGL);maxColorAttachments=gl.getParameter(GL_MAX_COLOR_ATTACHMENTS_WEBGL)}var readFloat=!!extensions.oes_texture_float;if(readFloat){var readFloatTexture=gl.createTexture();gl.bindTexture(GL_TEXTURE_2D,readFloatTexture);gl.texImage2D(GL_TEXTURE_2D,0,GL_RGBA,1,1,0,GL_RGBA,GL_FLOAT$1,null);var fbo=gl.createFramebuffer();gl.bindFramebuffer(GL_FRAMEBUFFER,fbo);gl.framebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0,GL_TEXTURE_2D,readFloatTexture,0);gl.bindTexture(GL_TEXTURE_2D,null);if(gl.checkFramebufferStatus(GL_FRAMEBUFFER)!==GL_FRAMEBUFFER_COMPLETE)readFloat=false;else{gl.viewport(0,0,1,1);gl.clearColor(1,0,0,1);gl.clear(GL_COLOR_BUFFER_BIT$1);var pixels=pool.allocType(GL_FLOAT$1,4);gl.readPixels(0,0,1,1,GL_RGBA,GL_FLOAT$1,pixels);if(gl.getError())readFloat=false;else{gl.deleteFramebuffer(fbo);gl.deleteTexture(readFloatTexture);readFloat=pixels[0]===1}pool.freeType(pixels)}}var isIE=typeof navigator!=="undefined"&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)||/Edge/.test(navigator.userAgent));var npotTextureCube=true;if(!isIE){var cubeTexture=gl.createTexture();var data=pool.allocType(GL_UNSIGNED_BYTE$1,36);gl.activeTexture(GL_TEXTURE0);gl.bindTexture(GL_TEXTURE_CUBE_MAP,cubeTexture);gl.texImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X,0,GL_RGBA,3,3,0,GL_RGBA,GL_UNSIGNED_BYTE$1,data);pool.freeType(data);gl.bindTexture(GL_TEXTURE_CUBE_MAP,null);gl.deleteTexture(cubeTexture);npotTextureCube=!gl.getError()}return{colorBits:[gl.getParameter(GL_RED_BITS),gl.getParameter(GL_GREEN_BITS),gl.getParameter(GL_BLUE_BITS),gl.getParameter(GL_ALPHA_BITS)],depthBits:gl.getParameter(GL_DEPTH_BITS),stencilBits:gl.getParameter(GL_STENCIL_BITS),subpixelBits:gl.getParameter(GL_SUBPIXEL_BITS),extensions:Object.keys(extensions).filter((function(ext){return!!extensions[ext]})),maxAnisotropic:maxAnisotropic,maxDrawbuffers:maxDrawbuffers,maxColorAttachments:maxColorAttachments,pointSizeDims:gl.getParameter(GL_ALIASED_POINT_SIZE_RANGE),lineWidthDims:gl.getParameter(GL_ALIASED_LINE_WIDTH_RANGE),maxViewportDims:gl.getParameter(GL_MAX_VIEWPORT_DIMS),maxCombinedTextureUnits:gl.getParameter(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS),maxCubeMapSize:gl.getParameter(GL_MAX_CUBE_MAP_TEXTURE_SIZE),maxRenderbufferSize:gl.getParameter(GL_MAX_RENDERBUFFER_SIZE),maxTextureUnits:gl.getParameter(GL_MAX_TEXTURE_IMAGE_UNITS),maxTextureSize:gl.getParameter(GL_MAX_TEXTURE_SIZE),maxAttributes:gl.getParameter(GL_MAX_VERTEX_ATTRIBS),maxVertexUniforms:gl.getParameter(GL_MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextureUnits:gl.getParameter(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxVaryingVectors:gl.getParameter(GL_MAX_VARYING_VECTORS),maxFragmentUniforms:gl.getParameter(GL_MAX_FRAGMENT_UNIFORM_VECTORS),glsl:gl.getParameter(GL_SHADING_LANGUAGE_VERSION),renderer:gl.getParameter(GL_RENDERER),vendor:gl.getParameter(GL_VENDOR),version:gl.getParameter(GL_VERSION),readFloat:readFloat,npotTextureCube:npotTextureCube}};function isNDArrayLike(obj){return!!obj&&typeof obj==="object"&&Array.isArray(obj.shape)&&Array.isArray(obj.stride)&&typeof obj.offset==="number"&&obj.shape.length===obj.stride.length&&(Array.isArray(obj.data)||isTypedArray(obj.data))}var values=function(obj){return Object.keys(obj).map((function(key){return obj[key]}))};var flattenUtils={shape:arrayShape$1,flatten:flattenArray};function flatten1D(array,nx,out){for(var i=0;i<nx;++i){out[i]=array[i]}}function flatten2D(array,nx,ny,out){var ptr=0;for(var i=0;i<nx;++i){var row=array[i];for(var j=0;j<ny;++j){out[ptr++]=row[j]}}}function flatten3D(array,nx,ny,nz,out,ptr_){var ptr=ptr_;for(var i=0;i<nx;++i){var row=array[i];for(var j=0;j<ny;++j){var col=row[j];for(var k=0;k<nz;++k){out[ptr++]=col[k]}}}}function flattenRec(array,shape,level,out,ptr){var stride=1;for(var i=level+1;i<shape.length;++i){stride*=shape[i]}var n=shape[level];if(shape.length-level===4){var nx=shape[level+1];var ny=shape[level+2];var nz=shape[level+3];for(i=0;i<n;++i){flatten3D(array[i],nx,ny,nz,out,ptr);ptr+=stride}}else{for(i=0;i<n;++i){flattenRec(array[i],shape,level+1,out,ptr);ptr+=stride}}}function flattenArray(array,shape,type,out_){var sz=1;if(shape.length){for(var i=0;i<shape.length;++i){sz*=shape[i]}}else{sz=0}var out=out_||pool.allocType(type,sz);switch(shape.length){case 0:break;case 1:flatten1D(array,shape[0],out);break;case 2:flatten2D(array,shape[0],shape[1],out);break;case 3:flatten3D(array,shape[0],shape[1],shape[2],out,0);break;default:flattenRec(array,shape,0,out,0)}return out}function arrayShape$1(array_){var shape=[];for(var array=array_;array.length;array=array[0]){shape.push(array.length)}return shape}var arrayTypes={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121};var int8=5120;var int16=5122;var int32=5124;var uint8=5121;var uint16=5123;var uint32=5125;var float=5126;var float32=5126;var glTypes={int8:int8,int16:int16,int32:int32,uint8:uint8,uint16:uint16,uint32:uint32,float:float,float32:float32};var dynamic$1=35048;var stream=35040;var usageTypes={dynamic:dynamic$1,stream:stream,static:35044};var arrayFlatten=flattenUtils.flatten;var arrayShape=flattenUtils.shape;var GL_STATIC_DRAW=35044;var GL_STREAM_DRAW=35040;var GL_UNSIGNED_BYTE$3=5121;var GL_FLOAT$3=5126;var DTYPES_SIZES=[];DTYPES_SIZES[5120]=1;DTYPES_SIZES[5122]=2;DTYPES_SIZES[5124]=4;DTYPES_SIZES[5121]=1;DTYPES_SIZES[5123]=2;DTYPES_SIZES[5125]=4;DTYPES_SIZES[5126]=4;function typedArrayCode(data){return arrayTypes[Object.prototype.toString.call(data)]|0}function copyArray(out,inp){for(var i=0;i<inp.length;++i){out[i]=inp[i]}}function transpose(result,data,shapeX,shapeY,strideX,strideY,offset){var ptr=0;for(var i=0;i<shapeX;++i){for(var j=0;j<shapeY;++j){result[ptr++]=data[strideX*i+strideY*j+offset]}}}function wrapBufferState(gl,stats,config,destroyBuffer){var bufferCount=0;var bufferSet={};function REGLBuffer(type){this.id=bufferCount++;this.buffer=gl.createBuffer();this.type=type;this.usage=GL_STATIC_DRAW;this.byteLength=0;this.dimension=1;this.dtype=GL_UNSIGNED_BYTE$3;this.persistentData=null;if(config.profile){this.stats={size:0}}}REGLBuffer.prototype.bind=function(){gl.bindBuffer(this.type,this.buffer)};REGLBuffer.prototype.destroy=function(){destroy(this)};var streamPool=[];function createStream(type,data){var buffer=streamPool.pop();if(!buffer){buffer=new REGLBuffer(type)}buffer.bind();initBufferFromData(buffer,data,GL_STREAM_DRAW,0,1,false);return buffer}function destroyStream(stream$$1){streamPool.push(stream$$1)}function initBufferFromTypedArray(buffer,data,usage){buffer.byteLength=data.byteLength;gl.bufferData(buffer.type,data,usage)}function initBufferFromData(buffer,data,usage,dtype,dimension,persist){var shape;buffer.usage=usage;if(Array.isArray(data)){buffer.dtype=dtype||GL_FLOAT$3;if(data.length>0){var flatData;if(Array.isArray(data[0])){shape=arrayShape(data);var dim=1;for(var i=1;i<shape.length;++i){dim*=shape[i]}buffer.dimension=dim;flatData=arrayFlatten(data,shape,buffer.dtype);initBufferFromTypedArray(buffer,flatData,usage);if(persist){buffer.persistentData=flatData}else{pool.freeType(flatData)}}else if(typeof data[0]==="number"){buffer.dimension=dimension;var typedData=pool.allocType(buffer.dtype,data.length);copyArray(typedData,data);initBufferFromTypedArray(buffer,typedData,usage);if(persist){buffer.persistentData=typedData}else{pool.freeType(typedData)}}else if(isTypedArray(data[0])){buffer.dimension=data[0].length;buffer.dtype=dtype||typedArrayCode(data[0])||GL_FLOAT$3;flatData=arrayFlatten(data,[data.length,data[0].length],buffer.dtype);initBufferFromTypedArray(buffer,flatData,usage);if(persist){buffer.persistentData=flatData}else{pool.freeType(flatData)}}else{check$1.raise("invalid buffer data")}}}else if(isTypedArray(data)){buffer.dtype=dtype||typedArrayCode(data);buffer.dimension=dimension;initBufferFromTypedArray(buffer,data,usage);if(persist){buffer.persistentData=new Uint8Array(new Uint8Array(data.buffer))}}else if(isNDArrayLike(data)){shape=data.shape;var stride=data.stride;var offset=data.offset;var shapeX=0;var shapeY=0;var strideX=0;var strideY=0;if(shape.length===1){shapeX=shape[0];shapeY=1;strideX=stride[0];strideY=0}else if(shape.length===2){shapeX=shape[0];shapeY=shape[1];strideX=stride[0];strideY=stride[1]}else{check$1.raise("invalid shape")}buffer.dtype=dtype||typedArrayCode(data.data)||GL_FLOAT$3;buffer.dimension=shapeY;var transposeData=pool.allocType(buffer.dtype,shapeX*shapeY);transpose(transposeData,data.data,shapeX,shapeY,strideX,strideY,offset);initBufferFromTypedArray(buffer,transposeData,usage);if(persist){buffer.persistentData=transposeData}else{pool.freeType(transposeData)}}else if(data instanceof ArrayBuffer){buffer.dtype=GL_UNSIGNED_BYTE$3;buffer.dimension=dimension;initBufferFromTypedArray(buffer,data,usage);if(persist){buffer.persistentData=new Uint8Array(new Uint8Array(data))}}else{check$1.raise("invalid buffer data")}}function destroy(buffer){stats.bufferCount--;destroyBuffer(buffer);var handle=buffer.buffer;check$1(handle,"buffer must not be deleted already");gl.deleteBuffer(handle);buffer.buffer=null;delete bufferSet[buffer.id]}function createBuffer(options,type,deferInit,persistent){stats.bufferCount++;var buffer=new REGLBuffer(type);bufferSet[buffer.id]=buffer;function reglBuffer(options){var usage=GL_STATIC_DRAW;var data=null;var byteLength=0;var dtype=0;var dimension=1;if(Array.isArray(options)||isTypedArray(options)||isNDArrayLike(options)||options instanceof ArrayBuffer){data=options}else if(typeof options==="number"){byteLength=options|0}else if(options){check$1.type(options,"object","buffer arguments must be an object, a number or an array");if("data"in options){check$1(data===null||Array.isArray(data)||isTypedArray(data)||isNDArrayLike(data),"invalid data for buffer");data=options.data}if("usage"in options){check$1.parameter(options.usage,usageTypes,"invalid buffer usage");usage=usageTypes[options.usage]}if("type"in options){check$1.parameter(options.type,glTypes,"invalid buffer type");dtype=glTypes[options.type]}if("dimension"in options){check$1.type(options.dimension,"number","invalid dimension");dimension=options.dimension|0}if("length"in options){check$1.nni(byteLength,"buffer length must be a nonnegative integer");byteLength=options.length|0}}buffer.bind();if(!data){if(byteLength)gl.bufferData(buffer.type,byteLength,usage);buffer.dtype=dtype||GL_UNSIGNED_BYTE$3;buffer.usage=usage;buffer.dimension=dimension;buffer.byteLength=byteLength}else{initBufferFromData(buffer,data,usage,dtype,dimension,persistent)}if(config.profile){buffer.stats.size=buffer.byteLength*DTYPES_SIZES[buffer.dtype]}return reglBuffer}function setSubData(data,offset){check$1(offset+data.byteLength<=buffer.byteLength,"invalid buffer subdata call, buffer is too small. "+" Can't write data of size "+data.byteLength+" starting from offset "+offset+" to a buffer of size "+buffer.byteLength);gl.bufferSubData(buffer.type,offset,data)}function subdata(data,offset_){var offset=(offset_||0)|0;var shape;buffer.bind();if(isTypedArray(data)||data instanceof ArrayBuffer){setSubData(data,offset)}else if(Array.isArray(data)){if(data.length>0){if(typeof data[0]==="number"){var converted=pool.allocType(buffer.dtype,data.length);copyArray(converted,data);setSubData(converted,offset);pool.freeType(converted)}else if(Array.isArray(data[0])||isTypedArray(data[0])){shape=arrayShape(data);var flatData=arrayFlatten(data,shape,buffer.dtype);setSubData(flatData,offset);pool.freeType(flatData)}else{check$1.raise("invalid buffer data")}}}else if(isNDArrayLike(data)){shape=data.shape;var stride=data.stride;var shapeX=0;var shapeY=0;var strideX=0;var strideY=0;if(shape.length===1){shapeX=shape[0];shapeY=1;strideX=stride[0];strideY=0}else if(shape.length===2){shapeX=shape[0];shapeY=shape[1];strideX=stride[0];strideY=stride[1]}else{check$1.raise("invalid shape")}var dtype=Array.isArray(data.data)?buffer.dtype:typedArrayCode(data.data);var transposeData=pool.allocType(dtype,shapeX*shapeY);transpose(transposeData,data.data,shapeX,shapeY,strideX,strideY,data.offset);setSubData(transposeData,offset);pool.freeType(transposeData)}else{check$1.raise("invalid data for buffer subdata")}return reglBuffer}if(!deferInit){reglBuffer(options)}reglBuffer._reglType="buffer";reglBuffer._buffer=buffer;reglBuffer.subdata=subdata;if(config.profile){reglBuffer.stats=buffer.stats}reglBuffer.destroy=function(){destroy(buffer)};return reglBuffer}function restoreBuffers(){values(bufferSet).forEach((function(buffer){buffer.buffer=gl.createBuffer();gl.bindBuffer(buffer.type,buffer.buffer);gl.bufferData(buffer.type,buffer.persistentData||buffer.byteLength,buffer.usage)}))}if(config.profile){stats.getTotalBufferSize=function(){var total=0;Object.keys(bufferSet).forEach((function(key){total+=bufferSet[key].stats.size}));return total}}return{create:createBuffer,createStream:createStream,destroyStream:destroyStream,clear:function(){values(bufferSet).forEach(destroy);streamPool.forEach(destroy)},getBuffer:function(wrapper){if(wrapper&&wrapper._buffer instanceof REGLBuffer){return wrapper._buffer}return null},restore:restoreBuffers,_initBuffer:initBufferFromData}}var points=0;var point=0;var lines=1;var line=1;var triangles=4;var triangle=4;var primTypes={points:points,point:point,lines:lines,line:line,triangles:triangles,triangle:triangle,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6};var GL_POINTS=0;var GL_LINES=1;var GL_TRIANGLES=4;var GL_BYTE$2=5120;var GL_UNSIGNED_BYTE$4=5121;var GL_SHORT$2=5122;var GL_UNSIGNED_SHORT$2=5123;var GL_INT$2=5124;var GL_UNSIGNED_INT$2=5125;var GL_ELEMENT_ARRAY_BUFFER=34963;var GL_STREAM_DRAW$1=35040;var GL_STATIC_DRAW$1=35044;function wrapElementsState(gl,extensions,bufferState,stats){var elementSet={};var elementCount=0;var elementTypes={uint8:GL_UNSIGNED_BYTE$4,uint16:GL_UNSIGNED_SHORT$2};if(extensions.oes_element_index_uint){elementTypes.uint32=GL_UNSIGNED_INT$2}function REGLElementBuffer(buffer){this.id=elementCount++;elementSet[this.id]=this;this.buffer=buffer;this.primType=GL_TRIANGLES;this.vertCount=0;this.type=0}REGLElementBuffer.prototype.bind=function(){this.buffer.bind()};var bufferPool=[];function createElementStream(data){var result=bufferPool.pop();if(!result){result=new REGLElementBuffer(bufferState.create(null,GL_ELEMENT_ARRAY_BUFFER,true,false)._buffer)}initElements(result,data,GL_STREAM_DRAW$1,-1,-1,0,0);return result}function destroyElementStream(elements){bufferPool.push(elements)}function initElements(elements,data,usage,prim,count,byteLength,type){elements.buffer.bind();var dtype;if(data){var predictedType=type;if(!type&&(!isTypedArray(data)||isNDArrayLike(data)&&!isTypedArray(data.data))){predictedType=extensions.oes_element_index_uint?GL_UNSIGNED_INT$2:GL_UNSIGNED_SHORT$2}bufferState._initBuffer(elements.buffer,data,usage,predictedType,3)}else{gl.bufferData(GL_ELEMENT_ARRAY_BUFFER,byteLength,usage);elements.buffer.dtype=dtype||GL_UNSIGNED_BYTE$4;elements.buffer.usage=usage;elements.buffer.dimension=3;elements.buffer.byteLength=byteLength}dtype=type;if(!type){switch(elements.buffer.dtype){case GL_UNSIGNED_BYTE$4:case GL_BYTE$2:dtype=GL_UNSIGNED_BYTE$4;break;case GL_UNSIGNED_SHORT$2:case GL_SHORT$2:dtype=GL_UNSIGNED_SHORT$2;break;case GL_UNSIGNED_INT$2:case GL_INT$2:dtype=GL_UNSIGNED_INT$2;break;default:check$1.raise("unsupported type for element array")}elements.buffer.dtype=dtype}elements.type=dtype;check$1(dtype!==GL_UNSIGNED_INT$2||!!extensions.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var vertCount=count;if(vertCount<0){vertCount=elements.buffer.byteLength;if(dtype===GL_UNSIGNED_SHORT$2){vertCount>>=1}else if(dtype===GL_UNSIGNED_INT$2){vertCount>>=2}}elements.vertCount=vertCount;var primType=prim;if(prim<0){primType=GL_TRIANGLES;var dimension=elements.buffer.dimension;if(dimension===1)primType=GL_POINTS;if(dimension===2)primType=GL_LINES;if(dimension===3)primType=GL_TRIANGLES}elements.primType=primType}function destroyElements(elements){stats.elementsCount--;check$1(elements.buffer!==null,"must not double destroy elements");delete elementSet[elements.id];elements.buffer.destroy();elements.buffer=null}function createElements(options,persistent){var buffer=bufferState.create(null,GL_ELEMENT_ARRAY_BUFFER,true);var elements=new REGLElementBuffer(buffer._buffer);stats.elementsCount++;function reglElements(options){if(!options){buffer();elements.primType=GL_TRIANGLES;elements.vertCount=0;elements.type=GL_UNSIGNED_BYTE$4}else if(typeof options==="number"){buffer(options);elements.primType=GL_TRIANGLES;elements.vertCount=options|0;elements.type=GL_UNSIGNED_BYTE$4}else{var data=null;var usage=GL_STATIC_DRAW$1;var primType=-1;var vertCount=-1;var byteLength=0;var dtype=0;if(Array.isArray(options)||isTypedArray(options)||isNDArrayLike(options)){data=options}else{check$1.type(options,"object","invalid arguments for elements");if("data"in options){data=options.data;check$1(Array.isArray(data)||isTypedArray(data)||isNDArrayLike(data),"invalid data for element buffer")}if("usage"in options){check$1.parameter(options.usage,usageTypes,"invalid element buffer usage");usage=usageTypes[options.usage]}if("primitive"in options){check$1.parameter(options.primitive,primTypes,"invalid element buffer primitive");primType=primTypes[options.primitive]}if("count"in options){check$1(typeof options.count==="number"&&options.count>=0,"invalid vertex count for elements");vertCount=options.count|0}if("type"in options){check$1.parameter(options.type,elementTypes,"invalid buffer type");dtype=elementTypes[options.type]}if("length"in options){byteLength=options.length|0}else{byteLength=vertCount;if(dtype===GL_UNSIGNED_SHORT$2||dtype===GL_SHORT$2){byteLength*=2}else if(dtype===GL_UNSIGNED_INT$2||dtype===GL_INT$2){byteLength*=4}}}initElements(elements,data,usage,primType,vertCount,byteLength,dtype)}return reglElements}reglElements(options);reglElements._reglType="elements";reglElements._elements=elements;reglElements.subdata=function(data,offset){buffer.subdata(data,offset);return reglElements};reglElements.destroy=function(){destroyElements(elements)};return reglElements}return{create:createElements,createStream:createElementStream,destroyStream:destroyElementStream,getElements:function(elements){if(typeof elements==="function"&&elements._elements instanceof REGLElementBuffer){return elements._elements}return null},clear:function(){values(elementSet).forEach(destroyElements)}}}var FLOAT=new Float32Array(1);var INT=new Uint32Array(FLOAT.buffer);var GL_UNSIGNED_SHORT$4=5123;function convertToHalfFloat(array){var ushorts=pool.allocType(GL_UNSIGNED_SHORT$4,array.length);for(var i=0;i<array.length;++i){if(isNaN(array[i])){ushorts[i]=65535}else if(array[i]===Infinity){ushorts[i]=31744}else if(array[i]===-Infinity){ushorts[i]=64512}else{FLOAT[0]=array[i];var x=INT[0];var sgn=x>>>31<<15;var exp=(x<<1>>>24)-127;var frac=x>>13&(1<<10)-1;if(exp<-24){ushorts[i]=sgn}else if(exp<-14){var s=-14-exp;ushorts[i]=sgn+(frac+(1<<10)>>s)}else if(exp>15){ushorts[i]=sgn+31744}else{ushorts[i]=sgn+(exp+15<<10)+frac}}}return ushorts}function isArrayLike(s){return Array.isArray(s)||isTypedArray(s)}var isPow2$1=function(v){return!(v&v-1)&&!!v};var GL_COMPRESSED_TEXTURE_FORMATS=34467;var GL_TEXTURE_2D$1=3553;var GL_TEXTURE_CUBE_MAP$1=34067;var GL_TEXTURE_CUBE_MAP_POSITIVE_X$1=34069;var GL_RGBA$1=6408;var GL_ALPHA=6406;var GL_RGB=6407;var GL_LUMINANCE=6409;var GL_LUMINANCE_ALPHA=6410;var GL_RGBA4=32854;var GL_RGB5_A1=32855;var GL_RGB565=36194;var GL_UNSIGNED_SHORT_4_4_4_4$1=32819;var GL_UNSIGNED_SHORT_5_5_5_1$1=32820;var GL_UNSIGNED_SHORT_5_6_5$1=33635;var GL_UNSIGNED_INT_24_8_WEBGL$1=34042;var GL_DEPTH_COMPONENT=6402;var GL_DEPTH_STENCIL=34041;var GL_SRGB_EXT=35904;var GL_SRGB_ALPHA_EXT=35906;var GL_HALF_FLOAT_OES$1=36193;var GL_COMPRESSED_RGB_S3TC_DXT1_EXT=33776;var GL_COMPRESSED_RGBA_S3TC_DXT1_EXT=33777;var GL_COMPRESSED_RGBA_S3TC_DXT3_EXT=33778;var GL_COMPRESSED_RGBA_S3TC_DXT5_EXT=33779;var GL_COMPRESSED_RGB_ATC_WEBGL=35986;var GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987;var GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798;var GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840;var GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841;var GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842;var GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843;var GL_COMPRESSED_RGB_ETC1_WEBGL=36196;var GL_UNSIGNED_BYTE$5=5121;var GL_UNSIGNED_SHORT$3=5123;var GL_UNSIGNED_INT$3=5125;var GL_FLOAT$4=5126;var GL_TEXTURE_WRAP_S=10242;var GL_TEXTURE_WRAP_T=10243;var GL_REPEAT=10497;var GL_CLAMP_TO_EDGE$1=33071;var GL_MIRRORED_REPEAT=33648;var GL_TEXTURE_MAG_FILTER=10240;var GL_TEXTURE_MIN_FILTER=10241;var GL_NEAREST$1=9728;var GL_LINEAR=9729;var GL_NEAREST_MIPMAP_NEAREST$1=9984;var GL_LINEAR_MIPMAP_NEAREST$1=9985;var GL_NEAREST_MIPMAP_LINEAR$1=9986;var GL_LINEAR_MIPMAP_LINEAR$1=9987;var GL_GENERATE_MIPMAP_HINT=33170;var GL_DONT_CARE=4352;var GL_FASTEST=4353;var GL_NICEST=4354;var GL_TEXTURE_MAX_ANISOTROPY_EXT=34046;var GL_UNPACK_ALIGNMENT=3317;var GL_UNPACK_FLIP_Y_WEBGL=37440;var GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441;var GL_UNPACK_COLORSPACE_CONVERSION_WEBGL=37443;var GL_BROWSER_DEFAULT_WEBGL=37444;var GL_TEXTURE0$1=33984;var MIPMAP_FILTERS=[GL_NEAREST_MIPMAP_NEAREST$1,GL_NEAREST_MIPMAP_LINEAR$1,GL_LINEAR_MIPMAP_NEAREST$1,GL_LINEAR_MIPMAP_LINEAR$1];var CHANNELS_FORMAT=[0,GL_LUMINANCE,GL_LUMINANCE_ALPHA,GL_RGB,GL_RGBA$1];var FORMAT_CHANNELS={};FORMAT_CHANNELS[GL_LUMINANCE]=FORMAT_CHANNELS[GL_ALPHA]=FORMAT_CHANNELS[GL_DEPTH_COMPONENT]=1;FORMAT_CHANNELS[GL_DEPTH_STENCIL]=FORMAT_CHANNELS[GL_LUMINANCE_ALPHA]=2;FORMAT_CHANNELS[GL_RGB]=FORMAT_CHANNELS[GL_SRGB_EXT]=3;FORMAT_CHANNELS[GL_RGBA$1]=FORMAT_CHANNELS[GL_SRGB_ALPHA_EXT]=4;function objectName(str){return"[object "+str+"]"}var CANVAS_CLASS=objectName("HTMLCanvasElement");var OFFSCREENCANVAS_CLASS=objectName("OffscreenCanvas");var CONTEXT2D_CLASS=objectName("CanvasRenderingContext2D");var BITMAP_CLASS=objectName("ImageBitmap");var IMAGE_CLASS=objectName("HTMLImageElement");var VIDEO_CLASS=objectName("HTMLVideoElement");var PIXEL_CLASSES=Object.keys(arrayTypes).concat([CANVAS_CLASS,OFFSCREENCANVAS_CLASS,CONTEXT2D_CLASS,BITMAP_CLASS,IMAGE_CLASS,VIDEO_CLASS]);var TYPE_SIZES=[];TYPE_SIZES[GL_UNSIGNED_BYTE$5]=1;TYPE_SIZES[GL_FLOAT$4]=4;TYPE_SIZES[GL_HALF_FLOAT_OES$1]=2;TYPE_SIZES[GL_UNSIGNED_SHORT$3]=2;TYPE_SIZES[GL_UNSIGNED_INT$3]=4;var FORMAT_SIZES_SPECIAL=[];FORMAT_SIZES_SPECIAL[GL_RGBA4]=2;FORMAT_SIZES_SPECIAL[GL_RGB5_A1]=2;FORMAT_SIZES_SPECIAL[GL_RGB565]=2;FORMAT_SIZES_SPECIAL[GL_DEPTH_STENCIL]=4;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_S3TC_DXT1_EXT]=.5;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_S3TC_DXT1_EXT]=.5;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_S3TC_DXT3_EXT]=1;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_S3TC_DXT5_EXT]=1;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_ATC_WEBGL]=.5;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]=1;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]=1;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=.5;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=.25;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=.5;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=.25;FORMAT_SIZES_SPECIAL[GL_COMPRESSED_RGB_ETC1_WEBGL]=.5;function isNumericArray(arr){return Array.isArray(arr)&&(arr.length===0||typeof arr[0]==="number")}function isRectArray(arr){if(!Array.isArray(arr)){return false}var width=arr.length;if(width===0||!isArrayLike(arr[0])){return false}return true}function classString(x){return Object.prototype.toString.call(x)}function isCanvasElement(object){return classString(object)===CANVAS_CLASS}function isOffscreenCanvas(object){return classString(object)===OFFSCREENCANVAS_CLASS}function isContext2D(object){return classString(object)===CONTEXT2D_CLASS}function isBitmap(object){return classString(object)===BITMAP_CLASS}function isImageElement(object){return classString(object)===IMAGE_CLASS}function isVideoElement(object){return classString(object)===VIDEO_CLASS}function isPixelData(object){if(!object){return false}var className=classString(object);if(PIXEL_CLASSES.indexOf(className)>=0){return true}return isNumericArray(object)||isRectArray(object)||isNDArrayLike(object)}function typedArrayCode$1(data){return arrayTypes[Object.prototype.toString.call(data)]|0}function convertData(result,data){var n=data.length;switch(result.type){case GL_UNSIGNED_BYTE$5:case GL_UNSIGNED_SHORT$3:case GL_UNSIGNED_INT$3:case GL_FLOAT$4:var converted=pool.allocType(result.type,n);converted.set(data);result.data=converted;break;case GL_HALF_FLOAT_OES$1:result.data=convertToHalfFloat(data);break;default:check$1.raise("unsupported texture type, must specify a typed array")}}function preConvert(image,n){return pool.allocType(image.type===GL_HALF_FLOAT_OES$1?GL_FLOAT$4:image.type,n)}function postConvert(image,data){if(image.type===GL_HALF_FLOAT_OES$1){image.data=convertToHalfFloat(data);pool.freeType(data)}else{image.data=data}}function transposeData(image,array,strideX,strideY,strideC,offset){var w=image.width;var h=image.height;var c=image.channels;var n=w*h*c;var data=preConvert(image,n);var p=0;for(var i=0;i<h;++i){for(var j=0;j<w;++j){for(var k=0;k<c;++k){data[p++]=array[strideX*j+strideY*i+strideC*k+offset]}}}postConvert(image,data)}function getTextureSize(format,type,width,height,isMipmap,isCube){var s;if(typeof FORMAT_SIZES_SPECIAL[format]!=="undefined"){s=FORMAT_SIZES_SPECIAL[format]}else{s=FORMAT_CHANNELS[format]*TYPE_SIZES[type]}if(isCube){s*=6}if(isMipmap){var total=0;var w=width;while(w>=1){total+=s*w*w;w/=2}return total}else{return s*width*height}}function createTextureSet(gl,extensions,limits,reglPoll,contextState,stats,config){var mipmapHint={"don't care":GL_DONT_CARE,"dont care":GL_DONT_CARE,nice:GL_NICEST,fast:GL_FASTEST};var wrapModes={repeat:GL_REPEAT,clamp:GL_CLAMP_TO_EDGE$1,mirror:GL_MIRRORED_REPEAT};var magFilters={nearest:GL_NEAREST$1,linear:GL_LINEAR};var minFilters=extend({mipmap:GL_LINEAR_MIPMAP_LINEAR$1,"nearest mipmap nearest":GL_NEAREST_MIPMAP_NEAREST$1,"linear mipmap nearest":GL_LINEAR_MIPMAP_NEAREST$1,"nearest mipmap linear":GL_NEAREST_MIPMAP_LINEAR$1,"linear mipmap linear":GL_LINEAR_MIPMAP_LINEAR$1},magFilters);var colorSpace={none:0,browser:GL_BROWSER_DEFAULT_WEBGL};var textureTypes={uint8:GL_UNSIGNED_BYTE$5,rgba4:GL_UNSIGNED_SHORT_4_4_4_4$1,rgb565:GL_UNSIGNED_SHORT_5_6_5$1,"rgb5 a1":GL_UNSIGNED_SHORT_5_5_5_1$1};var textureFormats={alpha:GL_ALPHA,luminance:GL_LUMINANCE,"luminance alpha":GL_LUMINANCE_ALPHA,rgb:GL_RGB,rgba:GL_RGBA$1,rgba4:GL_RGBA4,"rgb5 a1":GL_RGB5_A1,rgb565:GL_RGB565};var compressedTextureFormats={};if(extensions.ext_srgb){textureFormats.srgb=GL_SRGB_EXT;textureFormats.srgba=GL_SRGB_ALPHA_EXT}if(extensions.oes_texture_float){textureTypes.float32=textureTypes.float=GL_FLOAT$4}if(extensions.oes_texture_half_float){textureTypes["float16"]=textureTypes["half float"]=GL_HALF_FLOAT_OES$1}if(extensions.webgl_depth_texture){extend(textureFormats,{depth:GL_DEPTH_COMPONENT,"depth stencil":GL_DEPTH_STENCIL});extend(textureTypes,{uint16:GL_UNSIGNED_SHORT$3,uint32:GL_UNSIGNED_INT$3,"depth stencil":GL_UNSIGNED_INT_24_8_WEBGL$1})}if(extensions.webgl_compressed_texture_s3tc){extend(compressedTextureFormats,{"rgb s3tc dxt1":GL_COMPRESSED_RGB_S3TC_DXT1_EXT,"rgba s3tc dxt1":GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,"rgba s3tc dxt3":GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,"rgba s3tc dxt5":GL_COMPRESSED_RGBA_S3TC_DXT5_EXT})}if(extensions.webgl_compressed_texture_atc){extend(compressedTextureFormats,{"rgb atc":GL_COMPRESSED_RGB_ATC_WEBGL,"rgba atc explicit alpha":GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,"rgba atc interpolated alpha":GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL})}if(extensions.webgl_compressed_texture_pvrtc){extend(compressedTextureFormats,{"rgb pvrtc 4bppv1":GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,"rgb pvrtc 2bppv1":GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,"rgba pvrtc 4bppv1":GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,"rgba pvrtc 2bppv1":GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG})}if(extensions.webgl_compressed_texture_etc1){compressedTextureFormats["rgb etc1"]=GL_COMPRESSED_RGB_ETC1_WEBGL}var supportedCompressedFormats=Array.prototype.slice.call(gl.getParameter(GL_COMPRESSED_TEXTURE_FORMATS));Object.keys(compressedTextureFormats).forEach((function(name){var format=compressedTextureFormats[name];if(supportedCompressedFormats.indexOf(format)>=0){textureFormats[name]=format}}));var supportedFormats=Object.keys(textureFormats);limits.textureFormats=supportedFormats;var textureFormatsInvert=[];Object.keys(textureFormats).forEach((function(key){var val=textureFormats[key];textureFormatsInvert[val]=key}));var textureTypesInvert=[];Object.keys(textureTypes).forEach((function(key){var val=textureTypes[key];textureTypesInvert[val]=key}));var magFiltersInvert=[];Object.keys(magFilters).forEach((function(key){var val=magFilters[key];magFiltersInvert[val]=key}));var minFiltersInvert=[];Object.keys(minFilters).forEach((function(key){var val=minFilters[key];minFiltersInvert[val]=key}));var wrapModesInvert=[];Object.keys(wrapModes).forEach((function(key){var val=wrapModes[key];wrapModesInvert[val]=key}));var colorFormats=supportedFormats.reduce((function(color,key){var glenum=textureFormats[key];if(glenum===GL_LUMINANCE||glenum===GL_ALPHA||glenum===GL_LUMINANCE||glenum===GL_LUMINANCE_ALPHA||glenum===GL_DEPTH_COMPONENT||glenum===GL_DEPTH_STENCIL||extensions.ext_srgb&&(glenum===GL_SRGB_EXT||glenum===GL_SRGB_ALPHA_EXT)){color[glenum]=glenum}else if(glenum===GL_RGB5_A1||key.indexOf("rgba")>=0){color[glenum]=GL_RGBA$1}else{color[glenum]=GL_RGB}return color}),{});function TexFlags(){this.internalformat=GL_RGBA$1;this.format=GL_RGBA$1;this.type=GL_UNSIGNED_BYTE$5;this.compressed=false;this.premultiplyAlpha=false;this.flipY=false;this.unpackAlignment=1;this.colorSpace=GL_BROWSER_DEFAULT_WEBGL;this.width=0;this.height=0;this.channels=0}function copyFlags(result,other){result.internalformat=other.internalformat;result.format=other.format;result.type=other.type;result.compressed=other.compressed;result.premultiplyAlpha=other.premultiplyAlpha;result.flipY=other.flipY;result.unpackAlignment=other.unpackAlignment;result.colorSpace=other.colorSpace;result.width=other.width;result.height=other.height;result.channels=other.channels}function parseFlags(flags,options){if(typeof options!=="object"||!options){return}if("premultiplyAlpha"in options){check$1.type(options.premultiplyAlpha,"boolean","invalid premultiplyAlpha");flags.premultiplyAlpha=options.premultiplyAlpha}if("flipY"in options){check$1.type(options.flipY,"boolean","invalid texture flip");flags.flipY=options.flipY}if("alignment"in options){check$1.oneOf(options.alignment,[1,2,4,8],"invalid texture unpack alignment");flags.unpackAlignment=options.alignment}if("colorSpace"in options){check$1.parameter(options.colorSpace,colorSpace,"invalid colorSpace");flags.colorSpace=colorSpace[options.colorSpace]}if("type"in options){var type=options.type;check$1(extensions.oes_texture_float||!(type==="float"||type==="float32"),"you must enable the OES_texture_float extension in order to use floating point textures.");check$1(extensions.oes_texture_half_float||!(type==="half float"||type==="float16"),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures.");check$1(extensions.webgl_depth_texture||!(type==="uint16"||type==="uint32"||type==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures.");check$1.parameter(type,textureTypes,"invalid texture type");flags.type=textureTypes[type]}var w=flags.width;var h=flags.height;var c=flags.channels;var hasChannels=false;if("shape"in options){check$1(Array.isArray(options.shape)&&options.shape.length>=2,"shape must be an array");w=options.shape[0];h=options.shape[1];if(options.shape.length===3){c=options.shape[2];check$1(c>0&&c<=4,"invalid number of channels");hasChannels=true}check$1(w>=0&&w<=limits.maxTextureSize,"invalid width");check$1(h>=0&&h<=limits.maxTextureSize,"invalid height")}else{if("radius"in options){w=h=options.radius;check$1(w>=0&&w<=limits.maxTextureSize,"invalid radius")}if("width"in options){w=options.width;check$1(w>=0&&w<=limits.maxTextureSize,"invalid width")}if("height"in options){h=options.height;check$1(h>=0&&h<=limits.maxTextureSize,"invalid height")}if("channels"in options){c=options.channels;check$1(c>0&&c<=4,"invalid number of channels");hasChannels=true}}flags.width=w|0;flags.height=h|0;flags.channels=c|0;var hasFormat=false;if("format"in options){var formatStr=options.format;check$1(extensions.webgl_depth_texture||!(formatStr==="depth"||formatStr==="depth stencil"),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures.");check$1.parameter(formatStr,textureFormats,"invalid texture format");var internalformat=flags.internalformat=textureFormats[formatStr];flags.format=colorFormats[internalformat];if(formatStr in textureTypes){if(!("type"in options)){flags.type=textureTypes[formatStr]}}if(formatStr in compressedTextureFormats){flags.compressed=true}hasFormat=true}if(!hasChannels&&hasFormat){flags.channels=FORMAT_CHANNELS[flags.format]}else if(hasChannels&&!hasFormat){if(flags.channels!==CHANNELS_FORMAT[flags.format]){flags.format=flags.internalformat=CHANNELS_FORMAT[flags.channels]}}else if(hasFormat&&hasChannels){check$1(flags.channels===FORMAT_CHANNELS[flags.format],"number of channels inconsistent with specified format")}}function setFlags(flags){gl.pixelStorei(GL_UNPACK_FLIP_Y_WEBGL,flags.flipY);gl.pixelStorei(GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL,flags.premultiplyAlpha);gl.pixelStorei(GL_UNPACK_COLORSPACE_CONVERSION_WEBGL,flags.colorSpace);gl.pixelStorei(GL_UNPACK_ALIGNMENT,flags.unpackAlignment)}function TexImage(){TexFlags.call(this);this.xOffset=0;this.yOffset=0;this.data=null;this.needsFree=false;this.element=null;this.needsCopy=false}function parseImage(image,options){var data=null;if(isPixelData(options)){data=options}else if(options){check$1.type(options,"object","invalid pixel data type");parseFlags(image,options);if("x"in options){image.xOffset=options.x|0}if("y"in options){image.yOffset=options.y|0}if(isPixelData(options.data)){data=options.data}}check$1(!image.compressed||data instanceof Uint8Array,"compressed texture data must be stored in a uint8array");if(options.copy){check$1(!data,"can not specify copy and data field for the same texture");var viewW=contextState.viewportWidth;var viewH=contextState.viewportHeight;image.width=image.width||viewW-image.xOffset;image.height=image.height||viewH-image.yOffset;image.needsCopy=true;check$1(image.xOffset>=0&&image.xOffset<viewW&&image.yOffset>=0&&image.yOffset<viewH&&image.width>0&&image.width<=viewW&&image.height>0&&image.height<=viewH,"copy texture read out of bounds")}else if(!data){image.width=image.width||1;image.height=image.height||1;image.channels=image.channels||4}else if(isTypedArray(data)){image.channels=image.channels||4;image.data=data;if(!("type"in options)&&image.type===GL_UNSIGNED_BYTE$5){image.type=typedArrayCode$1(data)}}else if(isNumericArray(data)){image.channels=image.channels||4;convertData(image,data);image.alignment=1;image.needsFree=true}else if(isNDArrayLike(data)){var array=data.data;if(!Array.isArray(array)&&image.type===GL_UNSIGNED_BYTE$5){image.type=typedArrayCode$1(array)}var shape=data.shape;var stride=data.stride;var shapeX,shapeY,shapeC,strideX,strideY,strideC;if(shape.length===3){shapeC=shape[2];strideC=stride[2]}else{check$1(shape.length===2,"invalid ndarray pixel data, must be 2 or 3D");shapeC=1;strideC=1}shapeX=shape[0];shapeY=shape[1];strideX=stride[0];strideY=stride[1];image.alignment=1;image.width=shapeX;image.height=shapeY;image.channels=shapeC;image.format=image.internalformat=CHANNELS_FORMAT[shapeC];image.needsFree=true;transposeData(image,array,strideX,strideY,strideC,data.offset)}else if(isCanvasElement(data)||isOffscreenCanvas(data)||isContext2D(data)){if(isCanvasElement(data)||isOffscreenCanvas(data)){image.element=data}else{image.element=data.canvas}image.width=image.element.width;image.height=image.element.height;image.channels=4}else if(isBitmap(data)){image.element=data;image.width=data.width;image.height=data.height;image.channels=4}else if(isImageElement(data)){image.element=data;image.width=data.naturalWidth;image.height=data.naturalHeight;image.channels=4}else if(isVideoElement(data)){image.element=data;image.width=data.videoWidth;image.height=data.videoHeight;image.channels=4}else if(isRectArray(data)){var w=image.width||data[0].length;var h=image.height||data.length;var c=image.channels;if(isArrayLike(data[0][0])){c=c||data[0][0].length}else{c=c||1}var arrayShape=flattenUtils.shape(data);var n=1;for(var dd=0;dd<arrayShape.length;++dd){n*=arrayShape[dd]}var allocData=preConvert(image,n);flattenUtils.flatten(data,arrayShape,"",allocData);postConvert(image,allocData);image.alignment=1;image.width=w;image.height=h;image.channels=c;image.format=image.internalformat=CHANNELS_FORMAT[c];image.needsFree=true}if(image.type===GL_FLOAT$4){check$1(limits.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled")}else if(image.type===GL_HALF_FLOAT_OES$1){check$1(limits.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}}function setImage(info,target,miplevel){var element=info.element;var data=info.data;var internalformat=info.internalformat;var format=info.format;var type=info.type;var width=info.width;var height=info.height;setFlags(info);if(element){gl.texImage2D(target,miplevel,format,format,type,element)}else if(info.compressed){gl.compressedTexImage2D(target,miplevel,internalformat,width,height,0,data)}else if(info.needsCopy){reglPoll();gl.copyTexImage2D(target,miplevel,format,info.xOffset,info.yOffset,width,height,0)}else{gl.texImage2D(target,miplevel,format,width,height,0,format,type,data||null)}}function setSubImage(info,target,x,y,miplevel){var element=info.element;var data=info.data;var internalformat=info.internalformat;var format=info.format;var type=info.type;var width=info.width;var height=info.height;setFlags(info);if(element){gl.texSubImage2D(target,miplevel,x,y,format,type,element)}else if(info.compressed){gl.compressedTexSubImage2D(target,miplevel,x,y,internalformat,width,height,data)}else if(info.needsCopy){reglPoll();gl.copyTexSubImage2D(target,miplevel,x,y,info.xOffset,info.yOffset,width,height)}else{gl.texSubImage2D(target,miplevel,x,y,width,height,format,type,data)}}var imagePool=[];function allocImage(){return imagePool.pop()||new TexImage}function freeImage(image){if(image.needsFree){pool.freeType(image.data)}TexImage.call(image);imagePool.push(image)}function MipMap(){TexFlags.call(this);this.genMipmaps=false;this.mipmapHint=GL_DONT_CARE;this.mipmask=0;this.images=Array(16)}function parseMipMapFromShape(mipmap,width,height){var img=mipmap.images[0]=allocImage();mipmap.mipmask=1;img.width=mipmap.width=width;img.height=mipmap.height=height;img.channels=mipmap.channels=4}function parseMipMapFromObject(mipmap,options){var imgData=null;if(isPixelData(options)){imgData=mipmap.images[0]=allocImage();copyFlags(imgData,mipmap);parseImage(imgData,options);mipmap.mipmask=1}else{parseFlags(mipmap,options);if(Array.isArray(options.mipmap)){var mipData=options.mipmap;for(var i=0;i<mipData.length;++i){imgData=mipmap.images[i]=allocImage();copyFlags(imgData,mipmap);imgData.width>>=i;imgData.height>>=i;parseImage(imgData,mipData[i]);mipmap.mipmask|=1<<i}}else{imgData=mipmap.images[0]=allocImage();copyFlags(imgData,mipmap);parseImage(imgData,options);mipmap.mipmask=1}}copyFlags(mipmap,mipmap.images[0]);if(mipmap.compressed&&(mipmap.internalformat===GL_COMPRESSED_RGB_S3TC_DXT1_EXT||mipmap.internalformat===GL_COMPRESSED_RGBA_S3TC_DXT1_EXT||mipmap.internalformat===GL_COMPRESSED_RGBA_S3TC_DXT3_EXT||mipmap.internalformat===GL_COMPRESSED_RGBA_S3TC_DXT5_EXT)){check$1(mipmap.width%4===0&&mipmap.height%4===0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}}function setMipMap(mipmap,target){var images=mipmap.images;for(var i=0;i<images.length;++i){if(!images[i]){return}setImage(images[i],target,i)}}var mipPool=[];function allocMipMap(){var result=mipPool.pop()||new MipMap;TexFlags.call(result);result.mipmask=0;for(var i=0;i<16;++i){result.images[i]=null}return result}function freeMipMap(mipmap){var images=mipmap.images;for(var i=0;i<images.length;++i){if(images[i]){freeImage(images[i])}images[i]=null}mipPool.push(mipmap)}function TexInfo(){this.minFilter=GL_NEAREST$1;this.magFilter=GL_NEAREST$1;this.wrapS=GL_CLAMP_TO_EDGE$1;this.wrapT=GL_CLAMP_TO_EDGE$1;this.anisotropic=1;this.genMipmaps=false;this.mipmapHint=GL_DONT_CARE}function parseTexInfo(info,options){if("min"in options){var minFilter=options.min;check$1.parameter(minFilter,minFilters);info.minFilter=minFilters[minFilter];if(MIPMAP_FILTERS.indexOf(info.minFilter)>=0&&!("faces"in options)){info.genMipmaps=true}}if("mag"in options){var magFilter=options.mag;check$1.parameter(magFilter,magFilters);info.magFilter=magFilters[magFilter]}var wrapS=info.wrapS;var wrapT=info.wrapT;if("wrap"in options){var wrap=options.wrap;if(typeof wrap==="string"){check$1.parameter(wrap,wrapModes);wrapS=wrapT=wrapModes[wrap]}else if(Array.isArray(wrap)){check$1.parameter(wrap[0],wrapModes);check$1.parameter(wrap[1],wrapModes);wrapS=wrapModes[wrap[0]];wrapT=wrapModes[wrap[1]]}}else{if("wrapS"in options){var optWrapS=options.wrapS;check$1.parameter(optWrapS,wrapModes);wrapS=wrapModes[optWrapS]}if("wrapT"in options){var optWrapT=options.wrapT;check$1.parameter(optWrapT,wrapModes);wrapT=wrapModes[optWrapT]}}info.wrapS=wrapS;info.wrapT=wrapT;if("anisotropic"in options){var anisotropic=options.anisotropic;check$1(typeof anisotropic==="number"&&anisotropic>=1&&anisotropic<=limits.maxAnisotropic,"aniso samples must be between 1 and ");info.anisotropic=options.anisotropic}if("mipmap"in options){var hasMipMap=false;switch(typeof options.mipmap){case"string":check$1.parameter(options.mipmap,mipmapHint,"invalid mipmap hint");info.mipmapHint=mipmapHint[options.mipmap];info.genMipmaps=true;hasMipMap=true;break;case"boolean":hasMipMap=info.genMipmaps=options.mipmap;break;case"object":check$1(Array.isArray(options.mipmap),"invalid mipmap type");info.genMipmaps=false;hasMipMap=true;break;default:check$1.raise("invalid mipmap type")}if(hasMipMap&&!("min"in options)){info.minFilter=GL_NEAREST_MIPMAP_NEAREST$1}}}function setTexInfo(info,target){gl.texParameteri(target,GL_TEXTURE_MIN_FILTER,info.minFilter);gl.texParameteri(target,GL_TEXTURE_MAG_FILTER,info.magFilter);gl.texParameteri(target,GL_TEXTURE_WRAP_S,info.wrapS);gl.texParameteri(target,GL_TEXTURE_WRAP_T,info.wrapT);if(extensions.ext_texture_filter_anisotropic){gl.texParameteri(target,GL_TEXTURE_MAX_ANISOTROPY_EXT,info.anisotropic)}if(info.genMipmaps){gl.hint(GL_GENERATE_MIPMAP_HINT,info.mipmapHint);gl.generateMipmap(target)}}var textureCount=0;var textureSet={};var numTexUnits=limits.maxTextureUnits;var textureUnits=Array(numTexUnits).map((function(){return null}));function REGLTexture(target){TexFlags.call(this);this.mipmask=0;this.internalformat=GL_RGBA$1;this.id=textureCount++;this.refCount=1;this.target=target;this.texture=gl.createTexture();this.unit=-1;this.bindCount=0;this.texInfo=new TexInfo;if(config.profile){this.stats={size:0}}}function tempBind(texture){gl.activeTexture(GL_TEXTURE0$1);gl.bindTexture(texture.target,texture.texture)}function tempRestore(){var prev=textureUnits[0];if(prev){gl.bindTexture(prev.target,prev.texture)}else{gl.bindTexture(GL_TEXTURE_2D$1,null)}}function destroy(texture){var handle=texture.texture;check$1(handle,"must not double destroy texture");var unit=texture.unit;var target=texture.target;if(unit>=0){gl.activeTexture(GL_TEXTURE0$1+unit);gl.bindTexture(target,null);textureUnits[unit]=null}gl.deleteTexture(handle);texture.texture=null;texture.params=null;texture.pixels=null;texture.refCount=0;delete textureSet[texture.id];stats.textureCount--}extend(REGLTexture.prototype,{bind:function(){var texture=this;texture.bindCount+=1;var unit=texture.unit;if(unit<0){for(var i=0;i<numTexUnits;++i){var other=textureUnits[i];if(other){if(other.bindCount>0){continue}other.unit=-1}textureUnits[i]=texture;unit=i;break}if(unit>=numTexUnits){check$1.raise("insufficient number of texture units")}if(config.profile&&stats.maxTextureUnits<unit+1){stats.maxTextureUnits=unit+1}texture.unit=unit;gl.activeTexture(GL_TEXTURE0$1+unit);gl.bindTexture(texture.target,texture.texture)}return unit},unbind:function(){this.bindCount-=1},decRef:function(){if(--this.refCount<=0){destroy(this)}}});function createTexture2D(a,b){var texture=new REGLTexture(GL_TEXTURE_2D$1);textureSet[texture.id]=texture;stats.textureCount++;function reglTexture2D(a,b){var texInfo=texture.texInfo;TexInfo.call(texInfo);var mipData=allocMipMap();if(typeof a==="number"){if(typeof b==="number"){parseMipMapFromShape(mipData,a|0,b|0)}else{parseMipMapFromShape(mipData,a|0,a|0)}}else if(a){check$1.type(a,"object","invalid arguments to regl.texture");parseTexInfo(texInfo,a);parseMipMapFromObject(mipData,a)}else{parseMipMapFromShape(mipData,1,1)}if(texInfo.genMipmaps){mipData.mipmask=(mipData.width<<1)-1}texture.mipmask=mipData.mipmask;copyFlags(texture,mipData);check$1.texture2D(texInfo,mipData,limits);texture.internalformat=mipData.internalformat;reglTexture2D.width=mipData.width;reglTexture2D.height=mipData.height;tempBind(texture);setMipMap(mipData,GL_TEXTURE_2D$1);setTexInfo(texInfo,GL_TEXTURE_2D$1);tempRestore();freeMipMap(mipData);if(config.profile){texture.stats.size=getTextureSize(texture.internalformat,texture.type,mipData.width,mipData.height,texInfo.genMipmaps,false)}reglTexture2D.format=textureFormatsInvert[texture.internalformat];reglTexture2D.type=textureTypesInvert[texture.type];reglTexture2D.mag=magFiltersInvert[texInfo.magFilter];reglTexture2D.min=minFiltersInvert[texInfo.minFilter];reglTexture2D.wrapS=wrapModesInvert[texInfo.wrapS];reglTexture2D.wrapT=wrapModesInvert[texInfo.wrapT];return reglTexture2D}function subimage(image,x_,y_,level_){check$1(!!image,"must specify image data");var x=x_|0;var y=y_|0;var level=level_|0;var imageData=allocImage();copyFlags(imageData,texture);imageData.width=0;imageData.height=0;parseImage(imageData,image);imageData.width=imageData.width||(texture.width>>level)-x;imageData.height=imageData.height||(texture.height>>level)-y;check$1(texture.type===imageData.type&&texture.format===imageData.format&&texture.internalformat===imageData.internalformat,"incompatible format for texture.subimage");check$1(x>=0&&y>=0&&x+imageData.width<=texture.width&&y+imageData.height<=texture.height,"texture.subimage write out of bounds");check$1(texture.mipmask&1<<level,"missing mipmap data");check$1(imageData.data||imageData.element||imageData.needsCopy,"missing image data");tempBind(texture);setSubImage(imageData,GL_TEXTURE_2D$1,x,y,level);tempRestore();freeImage(imageData);return reglTexture2D}function resize(w_,h_){var w=w_|0;var h=h_|0||w;if(w===texture.width&&h===texture.height){return reglTexture2D}reglTexture2D.width=texture.width=w;reglTexture2D.height=texture.height=h;tempBind(texture);for(var i=0;texture.mipmask>>i;++i){var _w=w>>i;var _h=h>>i;if(!_w||!_h)break;gl.texImage2D(GL_TEXTURE_2D$1,i,texture.format,_w,_h,0,texture.format,texture.type,null)}tempRestore();if(config.profile){texture.stats.size=getTextureSize(texture.internalformat,texture.type,w,h,false,false)}return reglTexture2D}reglTexture2D(a,b);reglTexture2D.subimage=subimage;reglTexture2D.resize=resize;reglTexture2D._reglType="texture2d";reglTexture2D._texture=texture;if(config.profile){reglTexture2D.stats=texture.stats}reglTexture2D.destroy=function(){texture.decRef()};return reglTexture2D}function createTextureCube(a0,a1,a2,a3,a4,a5){var texture=new REGLTexture(GL_TEXTURE_CUBE_MAP$1);textureSet[texture.id]=texture;stats.cubeCount++;var faces=new Array(6);function reglTextureCube(a0,a1,a2,a3,a4,a5){var i;var texInfo=texture.texInfo;TexInfo.call(texInfo);for(i=0;i<6;++i){faces[i]=allocMipMap()}if(typeof a0==="number"||!a0){var s=a0|0||1;for(i=0;i<6;++i){parseMipMapFromShape(faces[i],s,s)}}else if(typeof a0==="object"){if(a1){parseMipMapFromObject(faces[0],a0);parseMipMapFromObject(faces[1],a1);parseMipMapFromObject(faces[2],a2);parseMipMapFromObject(faces[3],a3);parseMipMapFromObject(faces[4],a4);parseMipMapFromObject(faces[5],a5)}else{parseTexInfo(texInfo,a0);parseFlags(texture,a0);if("faces"in a0){var faceInput=a0.faces;check$1(Array.isArray(faceInput)&&faceInput.length===6,"cube faces must be a length 6 array");for(i=0;i<6;++i){check$1(typeof faceInput[i]==="object"&&!!faceInput[i],"invalid input for cube map face");copyFlags(faces[i],texture);parseMipMapFromObject(faces[i],faceInput[i])}}else{for(i=0;i<6;++i){parseMipMapFromObject(faces[i],a0)}}}}else{check$1.raise("invalid arguments to cube map")}copyFlags(texture,faces[0]);if(!limits.npotTextureCube){check$1(isPow2$1(texture.width)&&isPow2$1(texture.height),"your browser does not support non power or two texture dimensions")}if(texInfo.genMipmaps){texture.mipmask=(faces[0].width<<1)-1}else{texture.mipmask=faces[0].mipmask}check$1.textureCube(texture,texInfo,faces,limits);texture.internalformat=faces[0].internalformat;reglTextureCube.width=faces[0].width;reglTextureCube.height=faces[0].height;tempBind(texture);for(i=0;i<6;++i){setMipMap(faces[i],GL_TEXTURE_CUBE_MAP_POSITIVE_X$1+i)}setTexInfo(texInfo,GL_TEXTURE_CUBE_MAP$1);tempRestore();if(config.profile){texture.stats.size=getTextureSize(texture.internalformat,texture.type,reglTextureCube.width,reglTextureCube.height,texInfo.genMipmaps,true)}reglTextureCube.format=textureFormatsInvert[texture.internalformat];reglTextureCube.type=textureTypesInvert[texture.type];reglTextureCube.mag=magFiltersInvert[texInfo.magFilter];reglTextureCube.min=minFiltersInvert[texInfo.minFilter];reglTextureCube.wrapS=wrapModesInvert[texInfo.wrapS];reglTextureCube.wrapT=wrapModesInvert[texInfo.wrapT];for(i=0;i<6;++i){freeMipMap(faces[i])}return reglTextureCube}function subimage(face,image,x_,y_,level_){check$1(!!image,"must specify image data");check$1(typeof face==="number"&&face===(face|0)&&face>=0&&face<6,"invalid face");var x=x_|0;var y=y_|0;var level=level_|0;var imageData=allocImage();copyFlags(imageData,texture);imageData.width=0;imageData.height=0;parseImage(imageData,image);imageData.width=imageData.width||(texture.width>>level)-x;imageData.height=imageData.height||(texture.height>>level)-y;check$1(texture.type===imageData.type&&texture.format===imageData.format&&texture.internalformat===imageData.internalformat,"incompatible format for texture.subimage");check$1(x>=0&&y>=0&&x+imageData.width<=texture.width&&y+imageData.height<=texture.height,"texture.subimage write out of bounds");check$1(texture.mipmask&1<<level,"missing mipmap data");check$1(imageData.data||imageData.element||imageData.needsCopy,"missing image data");tempBind(texture);setSubImage(imageData,GL_TEXTURE_CUBE_MAP_POSITIVE_X$1+face,x,y,level);tempRestore();freeImage(imageData);return reglTextureCube}function resize(radius_){var radius=radius_|0;if(radius===texture.width){return}reglTextureCube.width=texture.width=radius;reglTextureCube.height=texture.height=radius;tempBind(texture);for(var i=0;i<6;++i){for(var j=0;texture.mipmask>>j;++j){gl.texImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X$1+i,j,texture.format,radius>>j,radius>>j,0,texture.format,texture.type,null)}}tempRestore();if(config.profile){texture.stats.size=getTextureSize(texture.internalformat,texture.type,reglTextureCube.width,reglTextureCube.height,false,true)}return reglTextureCube}reglTextureCube(a0,a1,a2,a3,a4,a5);reglTextureCube.subimage=subimage;reglTextureCube.resize=resize;reglTextureCube._reglType="textureCube";reglTextureCube._texture=texture;if(config.profile){reglTextureCube.stats=texture.stats}reglTextureCube.destroy=function(){texture.decRef()};return reglTextureCube}function destroyTextures(){for(var i=0;i<numTexUnits;++i){gl.activeTexture(GL_TEXTURE0$1+i);gl.bindTexture(GL_TEXTURE_2D$1,null);textureUnits[i]=null}values(textureSet).forEach(destroy);stats.cubeCount=0;stats.textureCount=0}if(config.profile){stats.getTotalTextureSize=function(){var total=0;Object.keys(textureSet).forEach((function(key){total+=textureSet[key].stats.size}));return total}}function restoreTextures(){for(var i=0;i<numTexUnits;++i){var tex=textureUnits[i];if(tex){tex.bindCount=0;tex.unit=-1;textureUnits[i]=null}}values(textureSet).forEach((function(texture){texture.texture=gl.createTexture();gl.bindTexture(texture.target,texture.texture);for(var i=0;i<32;++i){if((texture.mipmask&1<<i)===0){continue}if(texture.target===GL_TEXTURE_2D$1){gl.texImage2D(GL_TEXTURE_2D$1,i,texture.internalformat,texture.width>>i,texture.height>>i,0,texture.internalformat,texture.type,null)}else{for(var j=0;j<6;++j){gl.texImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X$1+j,i,texture.internalformat,texture.width>>i,texture.height>>i,0,texture.internalformat,texture.type,null)}}}setTexInfo(texture.texInfo,texture.target)}))}function refreshTextures(){for(var i=0;i<numTexUnits;++i){var tex=textureUnits[i];if(tex){tex.bindCount=0;tex.unit=-1;textureUnits[i]=null}gl.activeTexture(GL_TEXTURE0$1+i);gl.bindTexture(GL_TEXTURE_2D$1,null);gl.bindTexture(GL_TEXTURE_CUBE_MAP$1,null)}}return{create2D:createTexture2D,createCube:createTextureCube,clear:destroyTextures,getTexture:function(wrapper){return null},restore:restoreTextures,refresh:refreshTextures}}var GL_RENDERBUFFER=36161;var GL_RGBA4$1=32854;var GL_RGB5_A1$1=32855;var GL_RGB565$1=36194;var GL_DEPTH_COMPONENT16=33189;var GL_STENCIL_INDEX8=36168;var GL_DEPTH_STENCIL$1=34041;var GL_SRGB8_ALPHA8_EXT=35907;var GL_RGBA32F_EXT=34836;var GL_RGBA16F_EXT=34842;var GL_RGB16F_EXT=34843;var FORMAT_SIZES=[];FORMAT_SIZES[GL_RGBA4$1]=2;FORMAT_SIZES[GL_RGB5_A1$1]=2;FORMAT_SIZES[GL_RGB565$1]=2;FORMAT_SIZES[GL_DEPTH_COMPONENT16]=2;FORMAT_SIZES[GL_STENCIL_INDEX8]=1;FORMAT_SIZES[GL_DEPTH_STENCIL$1]=4;FORMAT_SIZES[GL_SRGB8_ALPHA8_EXT]=4;FORMAT_SIZES[GL_RGBA32F_EXT]=16;FORMAT_SIZES[GL_RGBA16F_EXT]=8;FORMAT_SIZES[GL_RGB16F_EXT]=6;function getRenderbufferSize(format,width,height){return FORMAT_SIZES[format]*width*height}var wrapRenderbuffers=function(gl,extensions,limits,stats,config){var formatTypes={rgba4:GL_RGBA4$1,rgb565:GL_RGB565$1,"rgb5 a1":GL_RGB5_A1$1,depth:GL_DEPTH_COMPONENT16,stencil:GL_STENCIL_INDEX8,"depth stencil":GL_DEPTH_STENCIL$1};if(extensions.ext_srgb){formatTypes["srgba"]=GL_SRGB8_ALPHA8_EXT}if(extensions.ext_color_buffer_half_float){formatTypes["rgba16f"]=GL_RGBA16F_EXT;formatTypes["rgb16f"]=GL_RGB16F_EXT}if(extensions.webgl_color_buffer_float){formatTypes["rgba32f"]=GL_RGBA32F_EXT}var formatTypesInvert=[];Object.keys(formatTypes).forEach((function(key){var val=formatTypes[key];formatTypesInvert[val]=key}));var renderbufferCount=0;var renderbufferSet={};function REGLRenderbuffer(renderbuffer){this.id=renderbufferCount++;this.refCount=1;this.renderbuffer=renderbuffer;this.format=GL_RGBA4$1;this.width=0;this.height=0;if(config.profile){this.stats={size:0}}}REGLRenderbuffer.prototype.decRef=function(){if(--this.refCount<=0){destroy(this)}};function destroy(rb){var handle=rb.renderbuffer;check$1(handle,"must not double destroy renderbuffer");gl.bindRenderbuffer(GL_RENDERBUFFER,null);gl.deleteRenderbuffer(handle);rb.renderbuffer=null;rb.refCount=0;delete renderbufferSet[rb.id];stats.renderbufferCount--}function createRenderbuffer(a,b){var renderbuffer=new REGLRenderbuffer(gl.createRenderbuffer());renderbufferSet[renderbuffer.id]=renderbuffer;stats.renderbufferCount++;function reglRenderbuffer(a,b){var w=0;var h=0;var format=GL_RGBA4$1;if(typeof a==="object"&&a){var options=a;if("shape"in options){var shape=options.shape;check$1(Array.isArray(shape)&&shape.length>=2,"invalid renderbuffer shape");w=shape[0]|0;h=shape[1]|0}else{if("radius"in options){w=h=options.radius|0}if("width"in options){w=options.width|0}if("height"in options){h=options.height|0}}if("format"in options){check$1.parameter(options.format,formatTypes,"invalid renderbuffer format");format=formatTypes[options.format]}}else if(typeof a==="number"){w=a|0;if(typeof b==="number"){h=b|0}else{h=w}}else if(!a){w=h=1}else{check$1.raise("invalid arguments to renderbuffer constructor")}check$1(w>0&&h>0&&w<=limits.maxRenderbufferSize&&h<=limits.maxRenderbufferSize,"invalid renderbuffer size");if(w===renderbuffer.width&&h===renderbuffer.height&&format===renderbuffer.format){return}reglRenderbuffer.width=renderbuffer.width=w;reglRenderbuffer.height=renderbuffer.height=h;renderbuffer.format=format;gl.bindRenderbuffer(GL_RENDERBUFFER,renderbuffer.renderbuffer);gl.renderbufferStorage(GL_RENDERBUFFER,format,w,h);check$1(gl.getError()===0,"invalid render buffer format");if(config.profile){renderbuffer.stats.size=getRenderbufferSize(renderbuffer.format,renderbuffer.width,renderbuffer.height)}reglRenderbuffer.format=formatTypesInvert[renderbuffer.format];return reglRenderbuffer}function resize(w_,h_){var w=w_|0;var h=h_|0||w;if(w===renderbuffer.width&&h===renderbuffer.height){return reglRenderbuffer}check$1(w>0&&h>0&&w<=limits.maxRenderbufferSize&&h<=limits.maxRenderbufferSize,"invalid renderbuffer size");reglRenderbuffer.width=renderbuffer.width=w;reglRenderbuffer.height=renderbuffer.height=h;gl.bindRenderbuffer(GL_RENDERBUFFER,renderbuffer.renderbuffer);gl.renderbufferStorage(GL_RENDERBUFFER,renderbuffer.format,w,h);check$1(gl.getError()===0,"invalid render buffer format");if(config.profile){renderbuffer.stats.size=getRenderbufferSize(renderbuffer.format,renderbuffer.width,renderbuffer.height)}return reglRenderbuffer}reglRenderbuffer(a,b);reglRenderbuffer.resize=resize;reglRenderbuffer._reglType="renderbuffer";reglRenderbuffer._renderbuffer=renderbuffer;if(config.profile){reglRenderbuffer.stats=renderbuffer.stats}reglRenderbuffer.destroy=function(){renderbuffer.decRef()};return reglRenderbuffer}if(config.profile){stats.getTotalRenderbufferSize=function(){var total=0;Object.keys(renderbufferSet).forEach((function(key){total+=renderbufferSet[key].stats.size}));return total}}function restoreRenderbuffers(){values(renderbufferSet).forEach((function(rb){rb.renderbuffer=gl.createRenderbuffer();gl.bindRenderbuffer(GL_RENDERBUFFER,rb.renderbuffer);gl.renderbufferStorage(GL_RENDERBUFFER,rb.format,rb.width,rb.height)}));gl.bindRenderbuffer(GL_RENDERBUFFER,null)}return{create:createRenderbuffer,clear:function(){values(renderbufferSet).forEach(destroy)},restore:restoreRenderbuffers}};var GL_FRAMEBUFFER$1=36160;var GL_RENDERBUFFER$1=36161;var GL_TEXTURE_2D$2=3553;var GL_TEXTURE_CUBE_MAP_POSITIVE_X$2=34069;var GL_COLOR_ATTACHMENT0$1=36064;var GL_DEPTH_ATTACHMENT=36096;var GL_STENCIL_ATTACHMENT=36128;var GL_DEPTH_STENCIL_ATTACHMENT=33306;var GL_FRAMEBUFFER_COMPLETE$1=36053;var GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054;var GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055;var GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057;var GL_FRAMEBUFFER_UNSUPPORTED=36061;var GL_HALF_FLOAT_OES$2=36193;var GL_UNSIGNED_BYTE$6=5121;var GL_FLOAT$5=5126;var GL_RGB$1=6407;var GL_RGBA$2=6408;var GL_DEPTH_COMPONENT$1=6402;var colorTextureFormatEnums=[GL_RGB$1,GL_RGBA$2];var textureFormatChannels=[];textureFormatChannels[GL_RGBA$2]=4;textureFormatChannels[GL_RGB$1]=3;var textureTypeSizes=[];textureTypeSizes[GL_UNSIGNED_BYTE$6]=1;textureTypeSizes[GL_FLOAT$5]=4;textureTypeSizes[GL_HALF_FLOAT_OES$2]=2;var GL_RGBA4$2=32854;var GL_RGB5_A1$2=32855;var GL_RGB565$2=36194;var GL_DEPTH_COMPONENT16$1=33189;var GL_STENCIL_INDEX8$1=36168;var GL_DEPTH_STENCIL$2=34041;var GL_SRGB8_ALPHA8_EXT$1=35907;var GL_RGBA32F_EXT$1=34836;var GL_RGBA16F_EXT$1=34842;var GL_RGB16F_EXT$1=34843;var colorRenderbufferFormatEnums=[GL_RGBA4$2,GL_RGB5_A1$2,GL_RGB565$2,GL_SRGB8_ALPHA8_EXT$1,GL_RGBA16F_EXT$1,GL_RGB16F_EXT$1,GL_RGBA32F_EXT$1];var statusCode={};statusCode[GL_FRAMEBUFFER_COMPLETE$1]="complete";statusCode[GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT]="incomplete attachment";statusCode[GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS]="incomplete dimensions";statusCode[GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT]="incomplete, missing attachment";statusCode[GL_FRAMEBUFFER_UNSUPPORTED]="unsupported";function wrapFBOState(gl,extensions,limits,textureState,renderbufferState,stats){var framebufferState={cur:null,next:null,dirty:false,setFBO:null};var colorTextureFormats=["rgba"];var colorRenderbufferFormats=["rgba4","rgb565","rgb5 a1"];if(extensions.ext_srgb){colorRenderbufferFormats.push("srgba")}if(extensions.ext_color_buffer_half_float){colorRenderbufferFormats.push("rgba16f","rgb16f")}if(extensions.webgl_color_buffer_float){colorRenderbufferFormats.push("rgba32f")}var colorTypes=["uint8"];if(extensions.oes_texture_half_float){colorTypes.push("half float","float16")}if(extensions.oes_texture_float){colorTypes.push("float","float32")}function FramebufferAttachment(target,texture,renderbuffer){this.target=target;this.texture=texture;this.renderbuffer=renderbuffer;var w=0;var h=0;if(texture){w=texture.width;h=texture.height}else if(renderbuffer){w=renderbuffer.width;h=renderbuffer.height}this.width=w;this.height=h}function decRef(attachment){if(attachment){if(attachment.texture){attachment.texture._texture.decRef()}if(attachment.renderbuffer){attachment.renderbuffer._renderbuffer.decRef()}}}function incRefAndCheckShape(attachment,width,height){if(!attachment){return}if(attachment.texture){var texture=attachment.texture._texture;var tw=Math.max(1,texture.width);var th=Math.max(1,texture.height);check$1(tw===width&&th===height,"inconsistent width/height for supplied texture");texture.refCount+=1}else{var renderbuffer=attachment.renderbuffer._renderbuffer;check$1(renderbuffer.width===width&&renderbuffer.height===height,"inconsistent width/height for renderbuffer");renderbuffer.refCount+=1}}function attach(location,attachment){if(attachment){if(attachment.texture){gl.framebufferTexture2D(GL_FRAMEBUFFER$1,location,attachment.target,attachment.texture._texture.texture,0)}else{gl.framebufferRenderbuffer(GL_FRAMEBUFFER$1,location,GL_RENDERBUFFER$1,attachment.renderbuffer._renderbuffer.renderbuffer)}}}function parseAttachment(attachment){var target=GL_TEXTURE_2D$2;var texture=null;var renderbuffer=null;var data=attachment;if(typeof attachment==="object"){data=attachment.data;if("target"in attachment){target=attachment.target|0}}check$1.type(data,"function","invalid attachment data");var type=data._reglType;if(type==="texture2d"){texture=data;check$1(target===GL_TEXTURE_2D$2)}else if(type==="textureCube"){texture=data;check$1(target>=GL_TEXTURE_CUBE_MAP_POSITIVE_X$2&&target<GL_TEXTURE_CUBE_MAP_POSITIVE_X$2+6,"invalid cube map target")}else if(type==="renderbuffer"){renderbuffer=data;target=GL_RENDERBUFFER$1}else{check$1.raise("invalid regl object for attachment")}return new FramebufferAttachment(target,texture,renderbuffer)}function allocAttachment(width,height,isTexture,format,type){if(isTexture){var texture=textureState.create2D({width:width,height:height,format:format,type:type});texture._texture.refCount=0;return new FramebufferAttachment(GL_TEXTURE_2D$2,texture,null)}else{var rb=renderbufferState.create({width:width,height:height,format:format});rb._renderbuffer.refCount=0;return new FramebufferAttachment(GL_RENDERBUFFER$1,null,rb)}}function unwrapAttachment(attachment){return attachment&&(attachment.texture||attachment.renderbuffer)}function resizeAttachment(attachment,w,h){if(attachment){if(attachment.texture){attachment.texture.resize(w,h)}else if(attachment.renderbuffer){attachment.renderbuffer.resize(w,h)}attachment.width=w;attachment.height=h}}var framebufferCount=0;var framebufferSet={};function REGLFramebuffer(){this.id=framebufferCount++;framebufferSet[this.id]=this;this.framebuffer=gl.createFramebuffer();this.width=0;this.height=0;this.colorAttachments=[];this.depthAttachment=null;this.stencilAttachment=null;this.depthStencilAttachment=null}function decFBORefs(framebuffer){framebuffer.colorAttachments.forEach(decRef);decRef(framebuffer.depthAttachment);decRef(framebuffer.stencilAttachment);decRef(framebuffer.depthStencilAttachment)}function destroy(framebuffer){var handle=framebuffer.framebuffer;check$1(handle,"must not double destroy framebuffer");gl.deleteFramebuffer(handle);framebuffer.framebuffer=null;stats.framebufferCount--;delete framebufferSet[framebuffer.id]}function updateFramebuffer(framebuffer){var i;gl.bindFramebuffer(GL_FRAMEBUFFER$1,framebuffer.framebuffer);var colorAttachments=framebuffer.colorAttachments;for(i=0;i<colorAttachments.length;++i){attach(GL_COLOR_ATTACHMENT0$1+i,colorAttachments[i])}for(i=colorAttachments.length;i<limits.maxColorAttachments;++i){gl.framebufferTexture2D(GL_FRAMEBUFFER$1,GL_COLOR_ATTACHMENT0$1+i,GL_TEXTURE_2D$2,null,0)}gl.framebufferTexture2D(GL_FRAMEBUFFER$1,GL_DEPTH_STENCIL_ATTACHMENT,GL_TEXTURE_2D$2,null,0);gl.framebufferTexture2D(GL_FRAMEBUFFER$1,GL_DEPTH_ATTACHMENT,GL_TEXTURE_2D$2,null,0);gl.framebufferTexture2D(GL_FRAMEBUFFER$1,GL_STENCIL_ATTACHMENT,GL_TEXTURE_2D$2,null,0);attach(GL_DEPTH_ATTACHMENT,framebuffer.depthAttachment);attach(GL_STENCIL_ATTACHMENT,framebuffer.stencilAttachment);attach(GL_DEPTH_STENCIL_ATTACHMENT,framebuffer.depthStencilAttachment);var status=gl.checkFramebufferStatus(GL_FRAMEBUFFER$1);if(!gl.isContextLost()&&status!==GL_FRAMEBUFFER_COMPLETE$1){check$1.raise("framebuffer configuration not supported, status = "+statusCode[status])}gl.bindFramebuffer(GL_FRAMEBUFFER$1,framebufferState.next?framebufferState.next.framebuffer:null);framebufferState.cur=framebufferState.next;gl.getError()}function createFBO(a0,a1){var framebuffer=new REGLFramebuffer;stats.framebufferCount++;function reglFramebuffer(a,b){var i;check$1(framebufferState.next!==framebuffer,"can not update framebuffer which is currently in use");var width=0;var height=0;var needsDepth=true;var needsStencil=true;var colorBuffer=null;var colorTexture=true;var colorFormat="rgba";var colorType="uint8";var colorCount=1;var depthBuffer=null;var stencilBuffer=null;var depthStencilBuffer=null;var depthStencilTexture=false;if(typeof a==="number"){width=a|0;height=b|0||width}else if(!a){width=height=1}else{check$1.type(a,"object","invalid arguments for framebuffer");var options=a;if("shape"in options){var shape=options.shape;check$1(Array.isArray(shape)&&shape.length>=2,"invalid shape for framebuffer");width=shape[0];height=shape[1]}else{if("radius"in options){width=height=options.radius}if("width"in options){width=options.width}if("height"in options){height=options.height}}if("color"in options||"colors"in options){colorBuffer=options.color||options.colors;if(Array.isArray(colorBuffer)){check$1(colorBuffer.length===1||extensions.webgl_draw_buffers,"multiple render targets not supported")}}if(!colorBuffer){if("colorCount"in options){colorCount=options.colorCount|0;check$1(colorCount>0,"invalid color buffer count")}if("colorTexture"in options){colorTexture=!!options.colorTexture;colorFormat="rgba4"}if("colorType"in options){colorType=options.colorType;if(!colorTexture){if(colorType==="half float"||colorType==="float16"){check$1(extensions.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers");colorFormat="rgba16f"}else if(colorType==="float"||colorType==="float32"){check$1(extensions.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers");colorFormat="rgba32f"}}else{check$1(extensions.oes_texture_float||!(colorType==="float"||colorType==="float32"),"you must enable OES_texture_float in order to use floating point framebuffer objects");check$1(extensions.oes_texture_half_float||!(colorType==="half float"||colorType==="float16"),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")}check$1.oneOf(colorType,colorTypes,"invalid color type")}if("colorFormat"in options){colorFormat=options.colorFormat;if(colorTextureFormats.indexOf(colorFormat)>=0){colorTexture=true}else if(colorRenderbufferFormats.indexOf(colorFormat)>=0){colorTexture=false}else{if(colorTexture){check$1.oneOf(options.colorFormat,colorTextureFormats,"invalid color format for texture")}else{check$1.oneOf(options.colorFormat,colorRenderbufferFormats,"invalid color format for renderbuffer")}}}}if("depthTexture"in options||"depthStencilTexture"in options){depthStencilTexture=!!(options.depthTexture||options.depthStencilTexture);check$1(!depthStencilTexture||extensions.webgl_depth_texture,"webgl_depth_texture extension not supported")}if("depth"in options){if(typeof options.depth==="boolean"){needsDepth=options.depth}else{depthBuffer=options.depth;needsStencil=false}}if("stencil"in options){if(typeof options.stencil==="boolean"){needsStencil=options.stencil}else{stencilBuffer=options.stencil;needsDepth=false}}if("depthStencil"in options){if(typeof options.depthStencil==="boolean"){needsDepth=needsStencil=options.depthStencil}else{depthStencilBuffer=options.depthStencil;needsDepth=false;needsStencil=false}}}var colorAttachments=null;var depthAttachment=null;var stencilAttachment=null;var depthStencilAttachment=null;if(Array.isArray(colorBuffer)){colorAttachments=colorBuffer.map(parseAttachment)}else if(colorBuffer){colorAttachments=[parseAttachment(colorBuffer)]}else{colorAttachments=new Array(colorCount);for(i=0;i<colorCount;++i){colorAttachments[i]=allocAttachment(width,height,colorTexture,colorFormat,colorType)}}check$1(extensions.webgl_draw_buffers||colorAttachments.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers.");check$1(colorAttachments.length<=limits.maxColorAttachments,"too many color attachments, not supported");width=width||colorAttachments[0].width;height=height||colorAttachments[0].height;if(depthBuffer){depthAttachment=parseAttachment(depthBuffer)}else if(needsDepth&&!needsStencil){depthAttachment=allocAttachment(width,height,depthStencilTexture,"depth","uint32")}if(stencilBuffer){stencilAttachment=parseAttachment(stencilBuffer)}else if(needsStencil&&!needsDepth){stencilAttachment=allocAttachment(width,height,false,"stencil","uint8")}if(depthStencilBuffer){depthStencilAttachment=parseAttachment(depthStencilBuffer)}else if(!depthBuffer&&!stencilBuffer&&needsStencil&&needsDepth){depthStencilAttachment=allocAttachment(width,height,depthStencilTexture,"depth stencil","depth stencil")}check$1(!!depthBuffer+!!stencilBuffer+!!depthStencilBuffer<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var commonColorAttachmentSize=null;for(i=0;i<colorAttachments.length;++i){incRefAndCheckShape(colorAttachments[i],width,height);check$1(!colorAttachments[i]||colorAttachments[i].texture&&colorTextureFormatEnums.indexOf(colorAttachments[i].texture._texture.format)>=0||colorAttachments[i].renderbuffer&&colorRenderbufferFormatEnums.indexOf(colorAttachments[i].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+i+" is invalid");if(colorAttachments[i]&&colorAttachments[i].texture){var colorAttachmentSize=textureFormatChannels[colorAttachments[i].texture._texture.format]*textureTypeSizes[colorAttachments[i].texture._texture.type];if(commonColorAttachmentSize===null){commonColorAttachmentSize=colorAttachmentSize}else{check$1(commonColorAttachmentSize===colorAttachmentSize,"all color attachments much have the same number of bits per pixel.")}}}incRefAndCheckShape(depthAttachment,width,height);check$1(!depthAttachment||depthAttachment.texture&&depthAttachment.texture._texture.format===GL_DEPTH_COMPONENT$1||depthAttachment.renderbuffer&&depthAttachment.renderbuffer._renderbuffer.format===GL_DEPTH_COMPONENT16$1,"invalid depth attachment for framebuffer object");incRefAndCheckShape(stencilAttachment,width,height);check$1(!stencilAttachment||stencilAttachment.renderbuffer&&stencilAttachment.renderbuffer._renderbuffer.format===GL_STENCIL_INDEX8$1,"invalid stencil attachment for framebuffer object");incRefAndCheckShape(depthStencilAttachment,width,height);check$1(!depthStencilAttachment||depthStencilAttachment.texture&&depthStencilAttachment.texture._texture.format===GL_DEPTH_STENCIL$2||depthStencilAttachment.renderbuffer&&depthStencilAttachment.renderbuffer._renderbuffer.format===GL_DEPTH_STENCIL$2,"invalid depth-stencil attachment for framebuffer object");decFBORefs(framebuffer);framebuffer.width=width;framebuffer.height=height;framebuffer.colorAttachments=colorAttachments;framebuffer.depthAttachment=depthAttachment;framebuffer.stencilAttachment=stencilAttachment;framebuffer.depthStencilAttachment=depthStencilAttachment;reglFramebuffer.color=colorAttachments.map(unwrapAttachment);reglFramebuffer.depth=unwrapAttachment(depthAttachment);reglFramebuffer.stencil=unwrapAttachment(stencilAttachment);reglFramebuffer.depthStencil=unwrapAttachment(depthStencilAttachment);reglFramebuffer.width=framebuffer.width;reglFramebuffer.height=framebuffer.height;updateFramebuffer(framebuffer);return reglFramebuffer}function resize(w_,h_){check$1(framebufferState.next!==framebuffer,"can not resize a framebuffer which is currently in use");var w=Math.max(w_|0,1);var h=Math.max(h_|0||w,1);if(w===framebuffer.width&&h===framebuffer.height){return reglFramebuffer}var colorAttachments=framebuffer.colorAttachments;for(var i=0;i<colorAttachments.length;++i){resizeAttachment(colorAttachments[i],w,h)}resizeAttachment(framebuffer.depthAttachment,w,h);resizeAttachment(framebuffer.stencilAttachment,w,h);resizeAttachment(framebuffer.depthStencilAttachment,w,h);framebuffer.width=reglFramebuffer.width=w;framebuffer.height=reglFramebuffer.height=h;updateFramebuffer(framebuffer);return reglFramebuffer}reglFramebuffer(a0,a1);return extend(reglFramebuffer,{resize:resize,_reglType:"framebuffer",_framebuffer:framebuffer,destroy:function(){destroy(framebuffer);decFBORefs(framebuffer)},use:function(block){framebufferState.setFBO({framebuffer:reglFramebuffer},block)}})}function createCubeFBO(options){var faces=Array(6);function reglFramebufferCube(a){var i;check$1(faces.indexOf(framebufferState.next)<0,"can not update framebuffer which is currently in use");var params={color:null};var radius=0;var colorBuffer=null;var colorFormat="rgba";var colorType="uint8";var colorCount=1;if(typeof a==="number"){radius=a|0}else if(!a){radius=1}else{check$1.type(a,"object","invalid arguments for framebuffer");var options=a;if("shape"in options){var shape=options.shape;check$1(Array.isArray(shape)&&shape.length>=2,"invalid shape for framebuffer");check$1(shape[0]===shape[1],"cube framebuffer must be square");radius=shape[0]}else{if("radius"in options){radius=options.radius|0}if("width"in options){radius=options.width|0;if("height"in options){check$1(options.height===radius,"must be square")}}else if("height"in options){radius=options.height|0}}if("color"in options||"colors"in options){colorBuffer=options.color||options.colors;if(Array.isArray(colorBuffer)){check$1(colorBuffer.length===1||extensions.webgl_draw_buffers,"multiple render targets not supported")}}if(!colorBuffer){if("colorCount"in options){colorCount=options.colorCount|0;check$1(colorCount>0,"invalid color buffer count")}if("colorType"in options){check$1.oneOf(options.colorType,colorTypes,"invalid color type");colorType=options.colorType}if("colorFormat"in options){colorFormat=options.colorFormat;check$1.oneOf(options.colorFormat,colorTextureFormats,"invalid color format for texture")}}if("depth"in options){params.depth=options.depth}if("stencil"in options){params.stencil=options.stencil}if("depthStencil"in options){params.depthStencil=options.depthStencil}}var colorCubes;if(colorBuffer){if(Array.isArray(colorBuffer)){colorCubes=[];for(i=0;i<colorBuffer.length;++i){colorCubes[i]=colorBuffer[i]}}else{colorCubes=[colorBuffer]}}else{colorCubes=Array(colorCount);var cubeMapParams={radius:radius,format:colorFormat,type:colorType};for(i=0;i<colorCount;++i){colorCubes[i]=textureState.createCube(cubeMapParams)}}params.color=Array(colorCubes.length);for(i=0;i<colorCubes.length;++i){var cube=colorCubes[i];check$1(typeof cube==="function"&&cube._reglType==="textureCube","invalid cube map");radius=radius||cube.width;check$1(cube.width===radius&&cube.height===radius,"invalid cube map shape");params.color[i]={target:GL_TEXTURE_CUBE_MAP_POSITIVE_X$2,data:colorCubes[i]}}for(i=0;i<6;++i){for(var j=0;j<colorCubes.length;++j){params.color[j].target=GL_TEXTURE_CUBE_MAP_POSITIVE_X$2+i}if(i>0){params.depth=faces[0].depth;params.stencil=faces[0].stencil;params.depthStencil=faces[0].depthStencil}if(faces[i]){faces[i](params)}else{faces[i]=createFBO(params)}}return extend(reglFramebufferCube,{width:radius,height:radius,color:colorCubes})}function resize(radius_){var i;var radius=radius_|0;check$1(radius>0&&radius<=limits.maxCubeMapSize,"invalid radius for cube fbo");if(radius===reglFramebufferCube.width){return reglFramebufferCube}var colors=reglFramebufferCube.color;for(i=0;i<colors.length;++i){colors[i].resize(radius)}for(i=0;i<6;++i){faces[i].resize(radius)}reglFramebufferCube.width=reglFramebufferCube.height=radius;return reglFramebufferCube}reglFramebufferCube(options);return extend(reglFramebufferCube,{faces:faces,resize:resize,_reglType:"framebufferCube",destroy:function(){faces.forEach((function(f){f.destroy()}))}})}function restoreFramebuffers(){framebufferState.cur=null;framebufferState.next=null;framebufferState.dirty=true;values(framebufferSet).forEach((function(fb){fb.framebuffer=gl.createFramebuffer();updateFramebuffer(fb)}))}return extend(framebufferState,{getFramebuffer:function(object){if(typeof object==="function"&&object._reglType==="framebuffer"){var fbo=object._framebuffer;if(fbo instanceof REGLFramebuffer){return fbo}}return null},create:createFBO,createCube:createCubeFBO,clear:function(){values(framebufferSet).forEach(destroy)},restore:restoreFramebuffers})}var GL_FLOAT$6=5126;var GL_ARRAY_BUFFER$1=34962;function AttributeRecord(){this.state=0;this.x=0;this.y=0;this.z=0;this.w=0;this.buffer=null;this.size=0;this.normalized=false;this.type=GL_FLOAT$6;this.offset=0;this.stride=0;this.divisor=0}function wrapAttributeState(gl,extensions,limits,stats,bufferState){var NUM_ATTRIBUTES=limits.maxAttributes;var attributeBindings=new Array(NUM_ATTRIBUTES);for(var i=0;i<NUM_ATTRIBUTES;++i){attributeBindings[i]=new AttributeRecord}var vaoCount=0;var vaoSet={};var state={Record:AttributeRecord,scope:{},state:attributeBindings,currentVAO:null,targetVAO:null,restore:extVAO()?restoreVAO:function(){},createVAO:createVAO,getVAO:getVAO,destroyBuffer:destroyBuffer,setVAO:extVAO()?setVAOEXT:setVAOEmulated,clear:extVAO()?destroyVAOEXT:function(){}};function destroyBuffer(buffer){for(var i=0;i<attributeBindings.length;++i){var record=attributeBindings[i];if(record.buffer===buffer){gl.disableVertexAttribArray(i);record.buffer=null}}}function extVAO(){return extensions.oes_vertex_array_object}function extInstanced(){return extensions.angle_instanced_arrays}function getVAO(vao){if(typeof vao==="function"&&vao._vao){return vao._vao}return null}function setVAOEXT(vao){if(vao===state.currentVAO){return}var ext=extVAO();if(vao){ext.bindVertexArrayOES(vao.vao)}else{ext.bindVertexArrayOES(null)}state.currentVAO=vao}function setVAOEmulated(vao){if(vao===state.currentVAO){return}if(vao){vao.bindAttrs()}else{var exti=extInstanced();for(var i=0;i<attributeBindings.length;++i){var binding=attributeBindings[i];if(binding.buffer){gl.enableVertexAttribArray(i);gl.vertexAttribPointer(i,binding.size,binding.type,binding.normalized,binding.stride,binding.offfset);if(exti&&binding.divisor){exti.vertexAttribDivisorANGLE(i,binding.divisor)}}else{gl.disableVertexAttribArray(i);gl.vertexAttrib4f(i,binding.x,binding.y,binding.z,binding.w)}}}state.currentVAO=vao}function destroyVAOEXT(){values(vaoSet).forEach((function(vao){vao.destroy()}))}function REGLVAO(){this.id=++vaoCount;this.attributes=[];var extension=extVAO();if(extension){this.vao=extension.createVertexArrayOES()}else{this.vao=null}vaoSet[this.id]=this;this.buffers=[]}REGLVAO.prototype.bindAttrs=function(){var exti=extInstanced();var attributes=this.attributes;for(var i=0;i<attributes.length;++i){var attr=attributes[i];if(attr.buffer){gl.enableVertexAttribArray(i);gl.bindBuffer(GL_ARRAY_BUFFER$1,attr.buffer.buffer);gl.vertexAttribPointer(i,attr.size,attr.type,attr.normalized,attr.stride,attr.offset);if(exti&&attr.divisor){exti.vertexAttribDivisorANGLE(i,attr.divisor)}}else{gl.disableVertexAttribArray(i);gl.vertexAttrib4f(i,attr.x,attr.y,attr.z,attr.w)}}for(var j=attributes.length;j<NUM_ATTRIBUTES;++j){gl.disableVertexAttribArray(j)}};REGLVAO.prototype.refresh=function(){var ext=extVAO();if(ext){ext.bindVertexArrayOES(this.vao);this.bindAttrs();state.currentVAO=this}};REGLVAO.prototype.destroy=function(){if(this.vao){var extension=extVAO();if(this===state.currentVAO){state.currentVAO=null;extension.bindVertexArrayOES(null)}extension.deleteVertexArrayOES(this.vao);this.vao=null}if(vaoSet[this.id]){delete vaoSet[this.id];stats.vaoCount-=1}};function restoreVAO(){var ext=extVAO();if(ext){values(vaoSet).forEach((function(vao){vao.refresh()}))}}function createVAO(_attr){var vao=new REGLVAO;stats.vaoCount+=1;function updateVAO(attributes){check$1(Array.isArray(attributes),"arguments to vertex array constructor must be an array");check$1(attributes.length<NUM_ATTRIBUTES,"too many attributes");check$1(attributes.length>0,"must specify at least one attribute");var bufUpdated={};var nattributes=vao.attributes;nattributes.length=attributes.length;for(var i=0;i<attributes.length;++i){var spec=attributes[i];var rec=nattributes[i]=new AttributeRecord;var data=spec.data||spec;if(Array.isArray(data)||isTypedArray(data)||isNDArrayLike(data)){var buf;if(vao.buffers[i]){buf=vao.buffers[i];if(isTypedArray(data)&&buf._buffer.byteLength>=data.byteLength){buf.subdata(data)}else{buf.destroy();vao.buffers[i]=null}}if(!vao.buffers[i]){buf=vao.buffers[i]=bufferState.create(spec,GL_ARRAY_BUFFER$1,false,true)}rec.buffer=bufferState.getBuffer(buf);rec.size=rec.buffer.dimension|0;rec.normalized=false;rec.type=rec.buffer.dtype;rec.offset=0;rec.stride=0;rec.divisor=0;rec.state=1;bufUpdated[i]=1}else if(bufferState.getBuffer(spec)){rec.buffer=bufferState.getBuffer(spec);rec.size=rec.buffer.dimension|0;rec.normalized=false;rec.type=rec.buffer.dtype;rec.offset=0;rec.stride=0;rec.divisor=0;rec.state=1}else if(bufferState.getBuffer(spec.buffer)){rec.buffer=bufferState.getBuffer(spec.buffer);rec.size=(+spec.size||rec.buffer.dimension)|0;rec.normalized=!!spec.normalized||false;if("type"in spec){check$1.parameter(spec.type,glTypes,"invalid buffer type");rec.type=glTypes[spec.type]}else{rec.type=rec.buffer.dtype}rec.offset=(spec.offset||0)|0;rec.stride=(spec.stride||0)|0;rec.divisor=(spec.divisor||0)|0;rec.state=1;check$1(rec.size>=1&&rec.size<=4,"size must be between 1 and 4");check$1(rec.offset>=0,"invalid offset");check$1(rec.stride>=0&&rec.stride<=255,"stride must be between 0 and 255");check$1(rec.divisor>=0,"divisor must be positive");check$1(!rec.divisor||!!extensions.angle_instanced_arrays,"ANGLE_instanced_arrays must be enabled to use divisor")}else if("x"in spec){check$1(i>0,"first attribute must not be a constant");rec.x=+spec.x||0;rec.y=+spec.y||0;rec.z=+spec.z||0;rec.w=+spec.w||0;rec.state=2}else{check$1(false,"invalid attribute spec for location "+i)}}for(var j=0;j<vao.buffers.length;++j){if(!bufUpdated[j]&&vao.buffers[j]){vao.buffers[j].destroy();vao.buffers[j]=null}}vao.refresh();return updateVAO}updateVAO.destroy=function(){for(var j=0;j<vao.buffers.length;++j){if(vao.buffers[j]){vao.buffers[j].destroy()}}vao.buffers.length=0;vao.destroy()};updateVAO._vao=vao;updateVAO._reglType="vao";return updateVAO(_attr)}return state}var GL_FRAGMENT_SHADER=35632;var GL_VERTEX_SHADER=35633;var GL_ACTIVE_UNIFORMS=35718;var GL_ACTIVE_ATTRIBUTES=35721;function wrapShaderState(gl,stringStore,stats,config){var fragShaders={};var vertShaders={};function ActiveInfo(name,id,location,info){this.name=name;this.id=id;this.location=location;this.info=info}function insertActiveInfo(list,info){for(var i=0;i<list.length;++i){if(list[i].id===info.id){list[i].location=info.location;return}}list.push(info)}function getShader(type,id,command){var cache=type===GL_FRAGMENT_SHADER?fragShaders:vertShaders;var shader=cache[id];if(!shader){var source=stringStore.str(id);shader=gl.createShader(type);gl.shaderSource(shader,source);gl.compileShader(shader);check$1.shaderError(gl,shader,source,type,command);cache[id]=shader}return shader}var programCache={};var programList=[];var PROGRAM_COUNTER=0;function REGLProgram(fragId,vertId){this.id=PROGRAM_COUNTER++;this.fragId=fragId;this.vertId=vertId;this.program=null;this.uniforms=[];this.attributes=[];this.refCount=1;if(config.profile){this.stats={uniformsCount:0,attributesCount:0}}}function linkProgram(desc,command,attributeLocations){var i,info;var fragShader=getShader(GL_FRAGMENT_SHADER,desc.fragId);var vertShader=getShader(GL_VERTEX_SHADER,desc.vertId);var program=desc.program=gl.createProgram();gl.attachShader(program,fragShader);gl.attachShader(program,vertShader);if(attributeLocations){for(i=0;i<attributeLocations.length;++i){var binding=attributeLocations[i];gl.bindAttribLocation(program,binding[0],binding[1])}}gl.linkProgram(program);check$1.linkError(gl,program,stringStore.str(desc.fragId),stringStore.str(desc.vertId),command);var numUniforms=gl.getProgramParameter(program,GL_ACTIVE_UNIFORMS);if(config.profile){desc.stats.uniformsCount=numUniforms}var uniforms=desc.uniforms;for(i=0;i<numUniforms;++i){info=gl.getActiveUniform(program,i);if(info){if(info.size>1){for(var j=0;j<info.size;++j){var name=info.name.replace("[0]","["+j+"]");insertActiveInfo(uniforms,new ActiveInfo(name,stringStore.id(name),gl.getUniformLocation(program,name),info))}}else{insertActiveInfo(uniforms,new ActiveInfo(info.name,stringStore.id(info.name),gl.getUniformLocation(program,info.name),info))}}}var numAttributes=gl.getProgramParameter(program,GL_ACTIVE_ATTRIBUTES);if(config.profile){desc.stats.attributesCount=numAttributes}var attributes=desc.attributes;for(i=0;i<numAttributes;++i){info=gl.getActiveAttrib(program,i);if(info){insertActiveInfo(attributes,new ActiveInfo(info.name,stringStore.id(info.name),gl.getAttribLocation(program,info.name),info))}}}if(config.profile){stats.getMaxUniformsCount=function(){var m=0;programList.forEach((function(desc){if(desc.stats.uniformsCount>m){m=desc.stats.uniformsCount}}));return m};stats.getMaxAttributesCount=function(){var m=0;programList.forEach((function(desc){if(desc.stats.attributesCount>m){m=desc.stats.attributesCount}}));return m}}function restoreShaders(){fragShaders={};vertShaders={};for(var i=0;i<programList.length;++i){linkProgram(programList[i],null,programList[i].attributes.map((function(info){return[info.location,info.name]})))}}return{clear:function(){var deleteShader=gl.deleteShader.bind(gl);values(fragShaders).forEach(deleteShader);fragShaders={};values(vertShaders).forEach(deleteShader);vertShaders={};programList.forEach((function(desc){gl.deleteProgram(desc.program)}));programList.length=0;programCache={};stats.shaderCount=0},program:function(vertId,fragId,command,attribLocations){check$1.command(vertId>=0,"missing vertex shader",command);check$1.command(fragId>=0,"missing fragment shader",command);var cache=programCache[fragId];if(!cache){cache=programCache[fragId]={}}var prevProgram=cache[vertId];if(prevProgram){prevProgram.refCount++;if(!attribLocations){return prevProgram}}var program=new REGLProgram(fragId,vertId);stats.shaderCount++;linkProgram(program,command,attribLocations);if(!prevProgram){cache[vertId]=program}programList.push(program);return extend(program,{destroy:function(){program.refCount--;if(program.refCount<=0){gl.deleteProgram(program.program);var idx=programList.indexOf(program);programList.splice(idx,1);stats.shaderCount--}if(cache[program.vertId].refCount<=0){gl.deleteShader(vertShaders[program.vertId]);delete vertShaders[program.vertId];delete programCache[program.fragId][program.vertId]}if(!Object.keys(programCache[program.fragId]).length){gl.deleteShader(fragShaders[program.fragId]);delete fragShaders[program.fragId];delete programCache[program.fragId]}}})},restore:restoreShaders,shader:getShader,frag:-1,vert:-1}}var GL_RGBA$3=6408;var GL_UNSIGNED_BYTE$7=5121;var GL_PACK_ALIGNMENT=3333;var GL_FLOAT$7=5126;function wrapReadPixels(gl,framebufferState,reglPoll,context,glAttributes,extensions,limits){function readPixelsImpl(input){var type;if(framebufferState.next===null){check$1(glAttributes.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer');type=GL_UNSIGNED_BYTE$7}else{check$1(framebufferState.next.colorAttachments[0].texture!==null,"You cannot read from a renderbuffer");type=framebufferState.next.colorAttachments[0].texture._texture.type;if(extensions.oes_texture_float){check$1(type===GL_UNSIGNED_BYTE$7||type===GL_FLOAT$7,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'");if(type===GL_FLOAT$7){check$1(limits.readFloat,"Reading 'float' values is not permitted in your browser. For a fallback, please see: https://www.npmjs.com/package/glsl-read-float")}}else{check$1(type===GL_UNSIGNED_BYTE$7,"Reading from a framebuffer is only allowed for the type 'uint8'")}}var x=0;var y=0;var width=context.framebufferWidth;var height=context.framebufferHeight;var data=null;if(isTypedArray(input)){data=input}else if(input){check$1.type(input,"object","invalid arguments to regl.read()");x=input.x|0;y=input.y|0;check$1(x>=0&&x<context.framebufferWidth,"invalid x offset for regl.read");check$1(y>=0&&y<context.framebufferHeight,"invalid y offset for regl.read");width=(input.width||context.framebufferWidth-x)|0;height=(input.height||context.framebufferHeight-y)|0;data=input.data||null}if(data){if(type===GL_UNSIGNED_BYTE$7){check$1(data instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'")}else if(type===GL_FLOAT$7){check$1(data instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")}}check$1(width>0&&width+x<=context.framebufferWidth,"invalid width for read pixels");check$1(height>0&&height+y<=context.framebufferHeight,"invalid height for read pixels");reglPoll();var size=width*height*4;if(!data){if(type===GL_UNSIGNED_BYTE$7){data=new Uint8Array(size)}else if(type===GL_FLOAT$7){data=data||new Float32Array(size)}}check$1.isTypedArray(data,"data buffer for regl.read() must be a typedarray");check$1(data.byteLength>=size,"data buffer for regl.read() too small");gl.pixelStorei(GL_PACK_ALIGNMENT,4);gl.readPixels(x,y,width,height,GL_RGBA$3,type,data);return data}function readPixelsFBO(options){var result;framebufferState.setFBO({framebuffer:options.framebuffer},(function(){result=readPixelsImpl(options)}));return result}function readPixels(options){if(!options||!("framebuffer"in options)){return readPixelsImpl(options)}else{return readPixelsFBO(options)}}return readPixels}function slice(x){return Array.prototype.slice.call(x)}function join(x){return slice(x).join("")}function createEnvironment(){var varCounter=0;var linkedNames=[];var linkedValues=[];function link(value){for(var i=0;i<linkedValues.length;++i){if(linkedValues[i]===value){return linkedNames[i]}}var name="g"+varCounter++;linkedNames.push(name);linkedValues.push(value);return name}function block(){var code=[];function push(){code.push.apply(code,slice(arguments))}var vars=[];function def(){var name="v"+varCounter++;vars.push(name);if(arguments.length>0){code.push(name,"=");code.push.apply(code,slice(arguments));code.push(";")}return name}return extend(push,{def:def,toString:function(){return join([vars.length>0?"var "+vars.join(",")+";":"",join(code)])}})}function scope(){var entry=block();var exit=block();var entryToString=entry.toString;var exitToString=exit.toString;function save(object,prop){exit(object,prop,"=",entry.def(object,prop),";")}return extend((function(){entry.apply(entry,slice(arguments))}),{def:entry.def,entry:entry,exit:exit,save:save,set:function(object,prop,value){save(object,prop);entry(object,prop,"=",value,";")},toString:function(){return entryToString()+exitToString()}})}function conditional(){var pred=join(arguments);var thenBlock=scope();var elseBlock=scope();var thenToString=thenBlock.toString;var elseToString=elseBlock.toString;return extend(thenBlock,{then:function(){thenBlock.apply(thenBlock,slice(arguments));return this},else:function(){elseBlock.apply(elseBlock,slice(arguments));return this},toString:function(){var elseClause=elseToString();if(elseClause){elseClause="else{"+elseClause+"}"}return join(["if(",pred,"){",thenToString(),"}",elseClause])}})}var globalBlock=block();var procedures={};function proc(name,count){var args=[];function arg(){var name="a"+args.length;args.push(name);return name}count=count||0;for(var i=0;i<count;++i){arg()}var body=scope();var bodyToString=body.toString;var result=procedures[name]=extend(body,{arg:arg,toString:function(){return join(["function(",args.join(),"){",bodyToString(),"}"])}});return result}function compile(){var code=['"use strict";',globalBlock,"return {"];Object.keys(procedures).forEach((function(name){code.push('"',name,'":',procedures[name].toString(),",")}));code.push("}");var src=join(code).replace(/;/g,";\n").replace(/}/g,"}\n").replace(/{/g,"{\n");var proc=Function.apply(null,linkedNames.concat(src));return proc.apply(null,linkedValues)}return{global:globalBlock,link:link,block:block,proc:proc,scope:scope,cond:conditional,compile:compile}}var CUTE_COMPONENTS="xyzw".split("");var GL_UNSIGNED_BYTE$8=5121;var ATTRIB_STATE_POINTER=1;var ATTRIB_STATE_CONSTANT=2;var DYN_FUNC$1=0;var DYN_PROP$1=1;var DYN_CONTEXT$1=2;var DYN_STATE$1=3;var DYN_THUNK=4;var DYN_CONSTANT$1=5;var DYN_ARRAY$1=6;var S_DITHER="dither";var S_BLEND_ENABLE="blend.enable";var S_BLEND_COLOR="blend.color";var S_BLEND_EQUATION="blend.equation";var S_BLEND_FUNC="blend.func";var S_DEPTH_ENABLE="depth.enable";var S_DEPTH_FUNC="depth.func";var S_DEPTH_RANGE="depth.range";var S_DEPTH_MASK="depth.mask";var S_COLOR_MASK="colorMask";var S_CULL_ENABLE="cull.enable";var S_CULL_FACE="cull.face";var S_FRONT_FACE="frontFace";var S_LINE_WIDTH="lineWidth";var S_POLYGON_OFFSET_ENABLE="polygonOffset.enable";var S_POLYGON_OFFSET_OFFSET="polygonOffset.offset";var S_SAMPLE_ALPHA="sample.alpha";var S_SAMPLE_ENABLE="sample.enable";var S_SAMPLE_COVERAGE="sample.coverage";var S_STENCIL_ENABLE="stencil.enable";var S_STENCIL_MASK="stencil.mask";var S_STENCIL_FUNC="stencil.func";var S_STENCIL_OPFRONT="stencil.opFront";var S_STENCIL_OPBACK="stencil.opBack";var S_SCISSOR_ENABLE="scissor.enable";var S_SCISSOR_BOX="scissor.box";var S_VIEWPORT="viewport";var S_PROFILE="profile";var S_FRAMEBUFFER="framebuffer";var S_VERT="vert";var S_FRAG="frag";var S_ELEMENTS="elements";var S_PRIMITIVE="primitive";var S_COUNT="count";var S_OFFSET="offset";var S_INSTANCES="instances";var S_VAO="vao";var SUFFIX_WIDTH="Width";var SUFFIX_HEIGHT="Height";var S_FRAMEBUFFER_WIDTH=S_FRAMEBUFFER+SUFFIX_WIDTH;var S_FRAMEBUFFER_HEIGHT=S_FRAMEBUFFER+SUFFIX_HEIGHT;var S_VIEWPORT_WIDTH=S_VIEWPORT+SUFFIX_WIDTH;var S_VIEWPORT_HEIGHT=S_VIEWPORT+SUFFIX_HEIGHT;var S_DRAWINGBUFFER="drawingBuffer";var S_DRAWINGBUFFER_WIDTH=S_DRAWINGBUFFER+SUFFIX_WIDTH;var S_DRAWINGBUFFER_HEIGHT=S_DRAWINGBUFFER+SUFFIX_HEIGHT;var NESTED_OPTIONS=[S_BLEND_FUNC,S_BLEND_EQUATION,S_STENCIL_FUNC,S_STENCIL_OPFRONT,S_STENCIL_OPBACK,S_SAMPLE_COVERAGE,S_VIEWPORT,S_SCISSOR_BOX,S_POLYGON_OFFSET_OFFSET];var GL_ARRAY_BUFFER$2=34962;var GL_ELEMENT_ARRAY_BUFFER$1=34963;var GL_FRAGMENT_SHADER$1=35632;var GL_VERTEX_SHADER$1=35633;var GL_TEXTURE_2D$3=3553;var GL_TEXTURE_CUBE_MAP$2=34067;var GL_CULL_FACE=2884;var GL_BLEND=3042;var GL_DITHER=3024;var GL_STENCIL_TEST=2960;var GL_DEPTH_TEST=2929;var GL_SCISSOR_TEST=3089;var GL_POLYGON_OFFSET_FILL=32823;var GL_SAMPLE_ALPHA_TO_COVERAGE=32926;var GL_SAMPLE_COVERAGE=32928;var GL_FLOAT$8=5126;var GL_FLOAT_VEC2=35664;var GL_FLOAT_VEC3=35665;var GL_FLOAT_VEC4=35666;var GL_INT$3=5124;var GL_INT_VEC2=35667;var GL_INT_VEC3=35668;var GL_INT_VEC4=35669;var GL_BOOL=35670;var GL_BOOL_VEC2=35671;var GL_BOOL_VEC3=35672;var GL_BOOL_VEC4=35673;var GL_FLOAT_MAT2=35674;var GL_FLOAT_MAT3=35675;var GL_FLOAT_MAT4=35676;var GL_SAMPLER_2D=35678;var GL_SAMPLER_CUBE=35680;var GL_TRIANGLES$1=4;var GL_FRONT=1028;var GL_BACK=1029;var GL_CW=2304;var GL_CCW=2305;var GL_MIN_EXT=32775;var GL_MAX_EXT=32776;var GL_ALWAYS=519;var GL_KEEP=7680;var GL_ZERO=0;var GL_ONE=1;var GL_FUNC_ADD=32774;var GL_LESS=513;var GL_FRAMEBUFFER$2=36160;var GL_COLOR_ATTACHMENT0$2=36064;var blendFuncs={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776};var invalidBlendCombinations=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"];var compareFuncs={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519};var stencilOps={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386};var shaderType={frag:GL_FRAGMENT_SHADER$1,vert:GL_VERTEX_SHADER$1};var orientationType={cw:GL_CW,ccw:GL_CCW};function isBufferArgs(x){return Array.isArray(x)||isTypedArray(x)||isNDArrayLike(x)}function sortState(state){return state.sort((function(a,b){if(a===S_VIEWPORT){return-1}else if(b===S_VIEWPORT){return 1}return a<b?-1:1}))}function Declaration(thisDep,contextDep,propDep,append){this.thisDep=thisDep;this.contextDep=contextDep;this.propDep=propDep;this.append=append}function isStatic(decl){return decl&&!(decl.thisDep||decl.contextDep||decl.propDep)}function createStaticDecl(append){return new Declaration(false,false,false,append)}function createDynamicDecl(dyn,append){var type=dyn.type;if(type===DYN_FUNC$1){var numArgs=dyn.data.length;return new Declaration(true,numArgs>=1,numArgs>=2,append)}else if(type===DYN_THUNK){var data=dyn.data;return new Declaration(data.thisDep,data.contextDep,data.propDep,append)}else if(type===DYN_CONSTANT$1){return new Declaration(false,false,false,append)}else if(type===DYN_ARRAY$1){var thisDep=false;var contextDep=false;var propDep=false;for(var i=0;i<dyn.data.length;++i){var subDyn=dyn.data[i];if(subDyn.type===DYN_PROP$1){propDep=true}else if(subDyn.type===DYN_CONTEXT$1){contextDep=true}else if(subDyn.type===DYN_STATE$1){thisDep=true}else if(subDyn.type===DYN_FUNC$1){thisDep=true;var subArgs=subDyn.data;if(subArgs>=1){contextDep=true}if(subArgs>=2){propDep=true}}else if(subDyn.type===DYN_THUNK){thisDep=thisDep||subDyn.data.thisDep;contextDep=contextDep||subDyn.data.contextDep;propDep=propDep||subDyn.data.propDep}}return new Declaration(thisDep,contextDep,propDep,append)}else{return new Declaration(type===DYN_STATE$1,type===DYN_CONTEXT$1,type===DYN_PROP$1,append)}}var SCOPE_DECL=new Declaration(false,false,false,(function(){}));function reglCore(gl,stringStore,extensions,limits,bufferState,elementState,textureState,framebufferState,uniformState,attributeState,shaderState,drawState,contextState,timer,config){var AttributeRecord=attributeState.Record;var blendEquations={add:32774,subtract:32778,"reverse subtract":32779};if(extensions.ext_blend_minmax){blendEquations.min=GL_MIN_EXT;blendEquations.max=GL_MAX_EXT}var extInstancing=extensions.angle_instanced_arrays;var extDrawBuffers=extensions.webgl_draw_buffers;var currentState={dirty:true,profile:config.profile};var nextState={};var GL_STATE_NAMES=[];var GL_FLAGS={};var GL_VARIABLES={};function propName(name){return name.replace(".","_")}function stateFlag(sname,cap,init){var name=propName(sname);GL_STATE_NAMES.push(sname);nextState[name]=currentState[name]=!!init;GL_FLAGS[name]=cap}function stateVariable(sname,func,init){var name=propName(sname);GL_STATE_NAMES.push(sname);if(Array.isArray(init)){currentState[name]=init.slice();nextState[name]=init.slice()}else{currentState[name]=nextState[name]=init}GL_VARIABLES[name]=func}stateFlag(S_DITHER,GL_DITHER);stateFlag(S_BLEND_ENABLE,GL_BLEND);stateVariable(S_BLEND_COLOR,"blendColor",[0,0,0,0]);stateVariable(S_BLEND_EQUATION,"blendEquationSeparate",[GL_FUNC_ADD,GL_FUNC_ADD]);stateVariable(S_BLEND_FUNC,"blendFuncSeparate",[GL_ONE,GL_ZERO,GL_ONE,GL_ZERO]);stateFlag(S_DEPTH_ENABLE,GL_DEPTH_TEST,true);stateVariable(S_DEPTH_FUNC,"depthFunc",GL_LESS);stateVariable(S_DEPTH_RANGE,"depthRange",[0,1]);stateVariable(S_DEPTH_MASK,"depthMask",true);stateVariable(S_COLOR_MASK,S_COLOR_MASK,[true,true,true,true]);stateFlag(S_CULL_ENABLE,GL_CULL_FACE);stateVariable(S_CULL_FACE,"cullFace",GL_BACK);stateVariable(S_FRONT_FACE,S_FRONT_FACE,GL_CCW);stateVariable(S_LINE_WIDTH,S_LINE_WIDTH,1);stateFlag(S_POLYGON_OFFSET_ENABLE,GL_POLYGON_OFFSET_FILL);stateVariable(S_POLYGON_OFFSET_OFFSET,"polygonOffset",[0,0]);stateFlag(S_SAMPLE_ALPHA,GL_SAMPLE_ALPHA_TO_COVERAGE);stateFlag(S_SAMPLE_ENABLE,GL_SAMPLE_COVERAGE);stateVariable(S_SAMPLE_COVERAGE,"sampleCoverage",[1,false]);stateFlag(S_STENCIL_ENABLE,GL_STENCIL_TEST);stateVariable(S_STENCIL_MASK,"stencilMask",-1);stateVariable(S_STENCIL_FUNC,"stencilFunc",[GL_ALWAYS,0,-1]);stateVariable(S_STENCIL_OPFRONT,"stencilOpSeparate",[GL_FRONT,GL_KEEP,GL_KEEP,GL_KEEP]);stateVariable(S_STENCIL_OPBACK,"stencilOpSeparate",[GL_BACK,GL_KEEP,GL_KEEP,GL_KEEP]);stateFlag(S_SCISSOR_ENABLE,GL_SCISSOR_TEST);stateVariable(S_SCISSOR_BOX,"scissor",[0,0,gl.drawingBufferWidth,gl.drawingBufferHeight]);stateVariable(S_VIEWPORT,S_VIEWPORT,[0,0,gl.drawingBufferWidth,gl.drawingBufferHeight]);var sharedState={gl:gl,context:contextState,strings:stringStore,next:nextState,current:currentState,draw:drawState,elements:elementState,buffer:bufferState,shader:shaderState,attributes:attributeState.state,vao:attributeState,uniforms:uniformState,framebuffer:framebufferState,extensions:extensions,timer:timer,isBufferArgs:isBufferArgs};var sharedConstants={primTypes:primTypes,compareFuncs:compareFuncs,blendFuncs:blendFuncs,blendEquations:blendEquations,stencilOps:stencilOps,glTypes:glTypes,orientationType:orientationType};check$1.optional((function(){sharedState.isArrayLike=isArrayLike}));if(extDrawBuffers){sharedConstants.backBuffer=[GL_BACK];sharedConstants.drawBuffer=loop(limits.maxDrawbuffers,(function(i){if(i===0){return[0]}return loop(i,(function(j){return GL_COLOR_ATTACHMENT0$2+j}))}))}var drawCallCounter=0;function createREGLEnvironment(){var env=createEnvironment();var link=env.link;var global=env.global;env.id=drawCallCounter++;env.batchId="0";var SHARED=link(sharedState);var shared=env.shared={props:"a0"};Object.keys(sharedState).forEach((function(prop){shared[prop]=global.def(SHARED,".",prop)}));check$1.optional((function(){env.CHECK=link(check$1);env.commandStr=check$1.guessCommand();env.command=link(env.commandStr);env.assert=function(block,pred,message){block("if(!(",pred,"))",this.CHECK,".commandRaise(",link(message),",",this.command,");")};sharedConstants.invalidBlendCombinations=invalidBlendCombinations}));var nextVars=env.next={};var currentVars=env.current={};Object.keys(GL_VARIABLES).forEach((function(variable){if(Array.isArray(currentState[variable])){nextVars[variable]=global.def(shared.next,".",variable);currentVars[variable]=global.def(shared.current,".",variable)}}));var constants=env.constants={};Object.keys(sharedConstants).forEach((function(name){constants[name]=global.def(JSON.stringify(sharedConstants[name]))}));env.invoke=function(block,x){switch(x.type){case DYN_FUNC$1:var argList=["this",shared.context,shared.props,env.batchId];return block.def(link(x.data),".call(",argList.slice(0,Math.max(x.data.length+1,4)),")");case DYN_PROP$1:return block.def(shared.props,x.data);case DYN_CONTEXT$1:return block.def(shared.context,x.data);case DYN_STATE$1:return block.def("this",x.data);case DYN_THUNK:x.data.append(env,block);return x.data.ref;case DYN_CONSTANT$1:return x.data.toString();case DYN_ARRAY$1:return x.data.map((function(y){return env.invoke(block,y)}))}};env.attribCache={};var scopeAttribs={};env.scopeAttrib=function(name){var id=stringStore.id(name);if(id in scopeAttribs){return scopeAttribs[id]}var binding=attributeState.scope[id];if(!binding){binding=attributeState.scope[id]=new AttributeRecord}var result=scopeAttribs[id]=link(binding);return result};return env}function parseProfile(options){var staticOptions=options.static;var dynamicOptions=options.dynamic;var profileEnable;if(S_PROFILE in staticOptions){var value=!!staticOptions[S_PROFILE];profileEnable=createStaticDecl((function(env,scope){return value}));profileEnable.enable=value}else if(S_PROFILE in dynamicOptions){var dyn=dynamicOptions[S_PROFILE];profileEnable=createDynamicDecl(dyn,(function(env,scope){return env.invoke(scope,dyn)}))}return profileEnable}function parseFramebuffer(options,env){var staticOptions=options.static;var dynamicOptions=options.dynamic;if(S_FRAMEBUFFER in staticOptions){var framebuffer=staticOptions[S_FRAMEBUFFER];if(framebuffer){framebuffer=framebufferState.getFramebuffer(framebuffer);check$1.command(framebuffer,"invalid framebuffer object");return createStaticDecl((function(env,block){var FRAMEBUFFER=env.link(framebuffer);var shared=env.shared;block.set(shared.framebuffer,".next",FRAMEBUFFER);var CONTEXT=shared.context;block.set(CONTEXT,"."+S_FRAMEBUFFER_WIDTH,FRAMEBUFFER+".width");block.set(CONTEXT,"."+S_FRAMEBUFFER_HEIGHT,FRAMEBUFFER+".height");return FRAMEBUFFER}))}else{return createStaticDecl((function(env,scope){var shared=env.shared;scope.set(shared.framebuffer,".next","null");var CONTEXT=shared.context;scope.set(CONTEXT,"."+S_FRAMEBUFFER_WIDTH,CONTEXT+"."+S_DRAWINGBUFFER_WIDTH);scope.set(CONTEXT,"."+S_FRAMEBUFFER_HEIGHT,CONTEXT+"."+S_DRAWINGBUFFER_HEIGHT);return"null"}))}}else if(S_FRAMEBUFFER in dynamicOptions){var dyn=dynamicOptions[S_FRAMEBUFFER];return createDynamicDecl(dyn,(function(env,scope){var FRAMEBUFFER_FUNC=env.invoke(scope,dyn);var shared=env.shared;var FRAMEBUFFER_STATE=shared.framebuffer;var FRAMEBUFFER=scope.def(FRAMEBUFFER_STATE,".getFramebuffer(",FRAMEBUFFER_FUNC,")");check$1.optional((function(){env.assert(scope,"!"+FRAMEBUFFER_FUNC+"||"+FRAMEBUFFER,"invalid framebuffer object")}));scope.set(FRAMEBUFFER_STATE,".next",FRAMEBUFFER);var CONTEXT=shared.context;scope.set(CONTEXT,"."+S_FRAMEBUFFER_WIDTH,FRAMEBUFFER+"?"+FRAMEBUFFER+".width:"+CONTEXT+"."+S_DRAWINGBUFFER_WIDTH);scope.set(CONTEXT,"."+S_FRAMEBUFFER_HEIGHT,FRAMEBUFFER+"?"+FRAMEBUFFER+".height:"+CONTEXT+"."+S_DRAWINGBUFFER_HEIGHT);return FRAMEBUFFER}))}else{return null}}function parseViewportScissor(options,framebuffer,env){var staticOptions=options.static;var dynamicOptions=options.dynamic;function parseBox(param){if(param in staticOptions){var box=staticOptions[param];check$1.commandType(box,"object","invalid "+param,env.commandStr);var isStatic=true;var x=box.x|0;var y=box.y|0;var w,h;if("width"in box){w=box.width|0;check$1.command(w>=0,"invalid "+param,env.commandStr)}else{isStatic=false}if("height"in box){h=box.height|0;check$1.command(h>=0,"invalid "+param,env.commandStr)}else{isStatic=false}return new Declaration(!isStatic&&framebuffer&&framebuffer.thisDep,!isStatic&&framebuffer&&framebuffer.contextDep,!isStatic&&framebuffer&&framebuffer.propDep,(function(env,scope){var CONTEXT=env.shared.context;var BOX_W=w;if(!("width"in box)){BOX_W=scope.def(CONTEXT,".",S_FRAMEBUFFER_WIDTH,"-",x)}var BOX_H=h;if(!("height"in box)){BOX_H=scope.def(CONTEXT,".",S_FRAMEBUFFER_HEIGHT,"-",y)}return[x,y,BOX_W,BOX_H]}))}else if(param in dynamicOptions){var dynBox=dynamicOptions[param];var result=createDynamicDecl(dynBox,(function(env,scope){var BOX=env.invoke(scope,dynBox);check$1.optional((function(){env.assert(scope,BOX+"&&typeof "+BOX+'==="object"',"invalid "+param)}));var CONTEXT=env.shared.context;var BOX_X=scope.def(BOX,".x|0");var BOX_Y=scope.def(BOX,".y|0");var BOX_W=scope.def('"width" in ',BOX,"?",BOX,".width|0:","(",CONTEXT,".",S_FRAMEBUFFER_WIDTH,"-",BOX_X,")");var BOX_H=scope.def('"height" in ',BOX,"?",BOX,".height|0:","(",CONTEXT,".",S_FRAMEBUFFER_HEIGHT,"-",BOX_Y,")");check$1.optional((function(){env.assert(scope,BOX_W+">=0&&"+BOX_H+">=0","invalid "+param)}));return[BOX_X,BOX_Y,BOX_W,BOX_H]}));if(framebuffer){result.thisDep=result.thisDep||framebuffer.thisDep;result.contextDep=result.contextDep||framebuffer.contextDep;result.propDep=result.propDep||framebuffer.propDep}return result}else if(framebuffer){return new Declaration(framebuffer.thisDep,framebuffer.contextDep,framebuffer.propDep,(function(env,scope){var CONTEXT=env.shared.context;return[0,0,scope.def(CONTEXT,".",S_FRAMEBUFFER_WIDTH),scope.def(CONTEXT,".",S_FRAMEBUFFER_HEIGHT)]}))}else{return null}}var viewport=parseBox(S_VIEWPORT);if(viewport){var prevViewport=viewport;viewport=new Declaration(viewport.thisDep,viewport.contextDep,viewport.propDep,(function(env,scope){var VIEWPORT=prevViewport.append(env,scope);var CONTEXT=env.shared.context;scope.set(CONTEXT,"."+S_VIEWPORT_WIDTH,VIEWPORT[2]);scope.set(CONTEXT,"."+S_VIEWPORT_HEIGHT,VIEWPORT[3]);return VIEWPORT}))}return{viewport:viewport,scissor_box:parseBox(S_SCISSOR_BOX)}}function parseAttribLocations(options,attributes){var staticOptions=options.static;var staticProgram=typeof staticOptions[S_FRAG]==="string"&&typeof staticOptions[S_VERT]==="string";if(staticProgram){if(Object.keys(attributes.dynamic).length>0){return null}var staticAttributes=attributes.static;var sAttributes=Object.keys(staticAttributes);if(sAttributes.length>0&&typeof staticAttributes[sAttributes[0]]==="number"){var bindings=[];for(var i=0;i<sAttributes.length;++i){check$1(typeof staticAttributes[sAttributes[i]]==="number","must specify all vertex attribute locations when using vaos");bindings.push([staticAttributes[sAttributes[i]]|0,sAttributes[i]])}return bindings}}return null}function parseProgram(options,env,attribLocations){var staticOptions=options.static;var dynamicOptions=options.dynamic;function parseShader(name){if(name in staticOptions){var id=stringStore.id(staticOptions[name]);check$1.optional((function(){shaderState.shader(shaderType[name],id,check$1.guessCommand())}));var result=createStaticDecl((function(){return id}));result.id=id;return result}else if(name in dynamicOptions){var dyn=dynamicOptions[name];return createDynamicDecl(dyn,(function(env,scope){var str=env.invoke(scope,dyn);var id=scope.def(env.shared.strings,".id(",str,")");check$1.optional((function(){scope(env.shared.shader,".shader(",shaderType[name],",",id,",",env.command,");")}));return id}))}return null}var frag=parseShader(S_FRAG);var vert=parseShader(S_VERT);var program=null;var progVar;if(isStatic(frag)&&isStatic(vert)){program=shaderState.program(vert.id,frag.id,null,attribLocations);progVar=createStaticDecl((function(env,scope){return env.link(program)}))}else{progVar=new Declaration(frag&&frag.thisDep||vert&&vert.thisDep,frag&&frag.contextDep||vert&&vert.contextDep,frag&&frag.propDep||vert&&vert.propDep,(function(env,scope){var SHADER_STATE=env.shared.shader;var fragId;if(frag){fragId=frag.append(env,scope)}else{fragId=scope.def(SHADER_STATE,".",S_FRAG)}var vertId;if(vert){vertId=vert.append(env,scope)}else{vertId=scope.def(SHADER_STATE,".",S_VERT)}var progDef=SHADER_STATE+".program("+vertId+","+fragId;check$1.optional((function(){progDef+=","+env.command}));return scope.def(progDef+")")}))}return{frag:frag,vert:vert,progVar:progVar,program:program}}function parseDraw(options,env){var staticOptions=options.static;var dynamicOptions=options.dynamic;function parseElements(){if(S_ELEMENTS in staticOptions){var elements=staticOptions[S_ELEMENTS];if(isBufferArgs(elements)){elements=elementState.getElements(elementState.create(elements,true))}else if(elements){elements=elementState.getElements(elements);check$1.command(elements,"invalid elements",env.commandStr)}var result=createStaticDecl((function(env,scope){if(elements){var result=env.link(elements);env.ELEMENTS=result;return result}env.ELEMENTS=null;return null}));result.value=elements;return result}else if(S_ELEMENTS in dynamicOptions){var dyn=dynamicOptions[S_ELEMENTS];return createDynamicDecl(dyn,(function(env,scope){var shared=env.shared;var IS_BUFFER_ARGS=shared.isBufferArgs;var ELEMENT_STATE=shared.elements;var elementDefn=env.invoke(scope,dyn);var elements=scope.def("null");var elementStream=scope.def(IS_BUFFER_ARGS,"(",elementDefn,")");var ifte=env.cond(elementStream).then(elements,"=",ELEMENT_STATE,".createStream(",elementDefn,");").else(elements,"=",ELEMENT_STATE,".getElements(",elementDefn,");");check$1.optional((function(){env.assert(ifte.else,"!"+elementDefn+"||"+elements,"invalid elements")}));scope.entry(ifte);scope.exit(env.cond(elementStream).then(ELEMENT_STATE,".destroyStream(",elements,");"));env.ELEMENTS=elements;return elements}))}return null}var elements=parseElements();function parsePrimitive(){if(S_PRIMITIVE in staticOptions){var primitive=staticOptions[S_PRIMITIVE];check$1.commandParameter(primitive,primTypes,"invalid primitve",env.commandStr);return createStaticDecl((function(env,scope){return primTypes[primitive]}))}else if(S_PRIMITIVE in dynamicOptions){var dynPrimitive=dynamicOptions[S_PRIMITIVE];return createDynamicDecl(dynPrimitive,(function(env,scope){var PRIM_TYPES=env.constants.primTypes;var prim=env.invoke(scope,dynPrimitive);check$1.optional((function(){env.assert(scope,prim+" in "+PRIM_TYPES,"invalid primitive, must be one of "+Object.keys(primTypes))}));return scope.def(PRIM_TYPES,"[",prim,"]")}))}else if(elements){if(isStatic(elements)){if(elements.value){return createStaticDecl((function(env,scope){return scope.def(env.ELEMENTS,".primType")}))}else{return createStaticDecl((function(){return GL_TRIANGLES$1}))}}else{return new Declaration(elements.thisDep,elements.contextDep,elements.propDep,(function(env,scope){var elements=env.ELEMENTS;return scope.def(elements,"?",elements,".primType:",GL_TRIANGLES$1)}))}}return null}function parseParam(param,isOffset){if(param in staticOptions){var value=staticOptions[param]|0;check$1.command(!isOffset||value>=0,"invalid "+param,env.commandStr);return createStaticDecl((function(env,scope){if(isOffset){env.OFFSET=value}return value}))}else if(param in dynamicOptions){var dynValue=dynamicOptions[param];return createDynamicDecl(dynValue,(function(env,scope){var result=env.invoke(scope,dynValue);if(isOffset){env.OFFSET=result;check$1.optional((function(){env.assert(scope,result+">=0","invalid "+param)}))}return result}))}else if(isOffset&&elements){return createStaticDecl((function(env,scope){env.OFFSET="0";return 0}))}return null}var OFFSET=parseParam(S_OFFSET,true);function parseVertCount(){if(S_COUNT in staticOptions){var count=staticOptions[S_COUNT]|0;check$1.command(typeof count==="number"&&count>=0,"invalid vertex count",env.commandStr);return createStaticDecl((function(){return count}))}else if(S_COUNT in dynamicOptions){var dynCount=dynamicOptions[S_COUNT];return createDynamicDecl(dynCount,(function(env,scope){var result=env.invoke(scope,dynCount);check$1.optional((function(){env.assert(scope,"typeof "+result+'==="number"&&'+result+">=0&&"+result+"===("+result+"|0)","invalid vertex count")}));return result}))}else if(elements){if(isStatic(elements)){if(elements){if(OFFSET){return new Declaration(OFFSET.thisDep,OFFSET.contextDep,OFFSET.propDep,(function(env,scope){var result=scope.def(env.ELEMENTS,".vertCount-",env.OFFSET);check$1.optional((function(){env.assert(scope,result+">=0","invalid vertex offset/element buffer too small")}));return result}))}else{return createStaticDecl((function(env,scope){return scope.def(env.ELEMENTS,".vertCount")}))}}else{var result=createStaticDecl((function(){return-1}));check$1.optional((function(){result.MISSING=true}));return result}}else{var variable=new Declaration(elements.thisDep||OFFSET.thisDep,elements.contextDep||OFFSET.contextDep,elements.propDep||OFFSET.propDep,(function(env,scope){var elements=env.ELEMENTS;if(env.OFFSET){return scope.def(elements,"?",elements,".vertCount-",env.OFFSET,":-1")}return scope.def(elements,"?",elements,".vertCount:-1")}));check$1.optional((function(){variable.DYNAMIC=true}));return variable}}return null}return{elements:elements,primitive:parsePrimitive(),count:parseVertCount(),instances:parseParam(S_INSTANCES,false),offset:OFFSET}}function parseGLState(options,env){var staticOptions=options.static;var dynamicOptions=options.dynamic;var STATE={};GL_STATE_NAMES.forEach((function(prop){var param=propName(prop);function parseParam(parseStatic,parseDynamic){if(prop in staticOptions){var value=parseStatic(staticOptions[prop]);STATE[param]=createStaticDecl((function(){return value}))}else if(prop in dynamicOptions){var dyn=dynamicOptions[prop];STATE[param]=createDynamicDecl(dyn,(function(env,scope){return parseDynamic(env,scope,env.invoke(scope,dyn))}))}}switch(prop){case S_CULL_ENABLE:case S_BLEND_ENABLE:case S_DITHER:case S_STENCIL_ENABLE:case S_DEPTH_ENABLE:case S_SCISSOR_ENABLE:case S_POLYGON_OFFSET_ENABLE:case S_SAMPLE_ALPHA:case S_SAMPLE_ENABLE:case S_DEPTH_MASK:return parseParam((function(value){check$1.commandType(value,"boolean",prop,env.commandStr);return value}),(function(env,scope,value){check$1.optional((function(){env.assert(scope,"typeof "+value+'==="boolean"',"invalid flag "+prop,env.commandStr)}));return value}));case S_DEPTH_FUNC:return parseParam((function(value){check$1.commandParameter(value,compareFuncs,"invalid "+prop,env.commandStr);return compareFuncs[value]}),(function(env,scope,value){var COMPARE_FUNCS=env.constants.compareFuncs;check$1.optional((function(){env.assert(scope,value+" in "+COMPARE_FUNCS,"invalid "+prop+", must be one of "+Object.keys(compareFuncs))}));return scope.def(COMPARE_FUNCS,"[",value,"]")}));case S_DEPTH_RANGE:return parseParam((function(value){check$1.command(isArrayLike(value)&&value.length===2&&typeof value[0]==="number"&&typeof value[1]==="number"&&value[0]<=value[1],"depth range is 2d array",env.commandStr);return value}),(function(env,scope,value){check$1.optional((function(){env.assert(scope,env.shared.isArrayLike+"("+value+")&&"+value+".length===2&&"+"typeof "+value+'[0]==="number"&&'+"typeof "+value+'[1]==="number"&&'+value+"[0]<="+value+"[1]","depth range must be a 2d array")}));var Z_NEAR=scope.def("+",value,"[0]");var Z_FAR=scope.def("+",value,"[1]");return[Z_NEAR,Z_FAR]}));case S_BLEND_FUNC:return parseParam((function(value){check$1.commandType(value,"object","blend.func",env.commandStr);var srcRGB="srcRGB"in value?value.srcRGB:value.src;var srcAlpha="srcAlpha"in value?value.srcAlpha:value.src;var dstRGB="dstRGB"in value?value.dstRGB:value.dst;var dstAlpha="dstAlpha"in value?value.dstAlpha:value.dst;check$1.commandParameter(srcRGB,blendFuncs,param+".srcRGB",env.commandStr);check$1.commandParameter(srcAlpha,blendFuncs,param+".srcAlpha",env.commandStr);check$1.commandParameter(dstRGB,blendFuncs,param+".dstRGB",env.commandStr);check$1.commandParameter(dstAlpha,blendFuncs,param+".dstAlpha",env.commandStr);check$1.command(invalidBlendCombinations.indexOf(srcRGB+", "+dstRGB)===-1,"unallowed blending combination (srcRGB, dstRGB) = ("+srcRGB+", "+dstRGB+")",env.commandStr);return[blendFuncs[srcRGB],blendFuncs[dstRGB],blendFuncs[srcAlpha],blendFuncs[dstAlpha]]}),(function(env,scope,value){var BLEND_FUNCS=env.constants.blendFuncs;check$1.optional((function(){env.assert(scope,value+"&&typeof "+value+'==="object"',"invalid blend func, must be an object")}));function read(prefix,suffix){var func=scope.def('"',prefix,suffix,'" in ',value,"?",value,".",prefix,suffix,":",value,".",prefix);check$1.optional((function(){env.assert(scope,func+" in "+BLEND_FUNCS,"invalid "+prop+"."+prefix+suffix+", must be one of "+Object.keys(blendFuncs))}));return func}var srcRGB=read("src","RGB");var dstRGB=read("dst","RGB");check$1.optional((function(){var INVALID_BLEND_COMBINATIONS=env.constants.invalidBlendCombinations;env.assert(scope,INVALID_BLEND_COMBINATIONS+".indexOf("+srcRGB+'+", "+'+dstRGB+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")}));var SRC_RGB=scope.def(BLEND_FUNCS,"[",srcRGB,"]");var SRC_ALPHA=scope.def(BLEND_FUNCS,"[",read("src","Alpha"),"]");var DST_RGB=scope.def(BLEND_FUNCS,"[",dstRGB,"]");var DST_ALPHA=scope.def(BLEND_FUNCS,"[",read("dst","Alpha"),"]");return[SRC_RGB,DST_RGB,SRC_ALPHA,DST_ALPHA]}));case S_BLEND_EQUATION:return parseParam((function(value){if(typeof value==="string"){check$1.commandParameter(value,blendEquations,"invalid "+prop,env.commandStr);return[blendEquations[value],blendEquations[value]]}else if(typeof value==="object"){check$1.commandParameter(value.rgb,blendEquations,prop+".rgb",env.commandStr);check$1.commandParameter(value.alpha,blendEquations,prop+".alpha",env.commandStr);return[blendEquations[value.rgb],blendEquations[value.alpha]]}else{check$1.commandRaise("invalid blend.equation",env.commandStr)}}),(function(env,scope,value){var BLEND_EQUATIONS=env.constants.blendEquations;var RGB=scope.def();var ALPHA=scope.def();var ifte=env.cond("typeof ",value,'==="string"');check$1.optional((function(){function checkProp(block,name,value){env.assert(block,value+" in "+BLEND_EQUATIONS,"invalid "+name+", must be one of "+Object.keys(blendEquations))}checkProp(ifte.then,prop,value);env.assert(ifte.else,value+"&&typeof "+value+'==="object"',"invalid "+prop);checkProp(ifte.else,prop+".rgb",value+".rgb");checkProp(ifte.else,prop+".alpha",value+".alpha")}));ifte.then(RGB,"=",ALPHA,"=",BLEND_EQUATIONS,"[",value,"];");ifte.else(RGB,"=",BLEND_EQUATIONS,"[",value,".rgb];",ALPHA,"=",BLEND_EQUATIONS,"[",value,".alpha];");scope(ifte);return[RGB,ALPHA]}));case S_BLEND_COLOR:return parseParam((function(value){check$1.command(isArrayLike(value)&&value.length===4,"blend.color must be a 4d array",env.commandStr);return loop(4,(function(i){return+value[i]}))}),(function(env,scope,value){check$1.optional((function(){env.assert(scope,env.shared.isArrayLike+"("+value+")&&"+value+".length===4","blend.color must be a 4d array")}));return loop(4,(function(i){return scope.def("+",value,"[",i,"]")}))}));case S_STENCIL_MASK:return parseParam((function(value){check$1.commandType(value,"number",param,env.commandStr);return value|0}),(function(env,scope,value){check$1.optional((function(){env.assert(scope,"typeof "+value+'==="number"',"invalid stencil.mask")}));return scope.def(value,"|0")}));case S_STENCIL_FUNC:return parseParam((function(value){check$1.commandType(value,"object",param,env.commandStr);var cmp=value.cmp||"keep";var ref=value.ref||0;var mask="mask"in value?value.mask:-1;check$1.commandParameter(cmp,compareFuncs,prop+".cmp",env.commandStr);check$1.commandType(ref,"number",prop+".ref",env.commandStr);check$1.commandType(mask,"number",prop+".mask",env.commandStr);return[compareFuncs[cmp],ref,mask]}),(function(env,scope,value){var COMPARE_FUNCS=env.constants.compareFuncs;check$1.optional((function(){function assert(){env.assert(scope,Array.prototype.join.call(arguments,""),"invalid stencil.func")}assert(value+"&&typeof ",value,'==="object"');assert('!("cmp" in ',value,")||(",value,".cmp in ",COMPARE_FUNCS,")")}));var cmp=scope.def('"cmp" in ',value,"?",COMPARE_FUNCS,"[",value,".cmp]",":",GL_KEEP);var ref=scope.def(value,".ref|0");var mask=scope.def('"mask" in ',value,"?",value,".mask|0:-1");return[cmp,ref,mask]}));case S_STENCIL_OPFRONT:case S_STENCIL_OPBACK:return parseParam((function(value){check$1.commandType(value,"object",param,env.commandStr);var fail=value.fail||"keep";var zfail=value.zfail||"keep";var zpass=value.zpass||"keep";check$1.commandParameter(fail,stencilOps,prop+".fail",env.commandStr);check$1.commandParameter(zfail,stencilOps,prop+".zfail",env.commandStr);check$1.commandParameter(zpass,stencilOps,prop+".zpass",env.commandStr);return[prop===S_STENCIL_OPBACK?GL_BACK:GL_FRONT,stencilOps[fail],stencilOps[zfail],stencilOps[zpass]]}),(function(env,scope,value){var STENCIL_OPS=env.constants.stencilOps;check$1.optional((function(){env.assert(scope,value+"&&typeof "+value+'==="object"',"invalid "+prop)}));function read(name){check$1.optional((function(){env.assert(scope,'!("'+name+'" in '+value+")||"+"("+value+"."+name+" in "+STENCIL_OPS+")","invalid "+prop+"."+name+", must be one of "+Object.keys(stencilOps))}));return scope.def('"',name,'" in ',value,"?",STENCIL_OPS,"[",value,".",name,"]:",GL_KEEP)}return[prop===S_STENCIL_OPBACK?GL_BACK:GL_FRONT,read("fail"),read("zfail"),read("zpass")]}));case S_POLYGON_OFFSET_OFFSET:return parseParam((function(value){check$1.commandType(value,"object",param,env.commandStr);var factor=value.factor|0;var units=value.units|0;check$1.commandType(factor,"number",param+".factor",env.commandStr);check$1.commandType(units,"number",param+".units",env.commandStr);return[factor,units]}),(function(env,scope,value){check$1.optional((function(){env.assert(scope,value+"&&typeof "+value+'==="object"',"invalid "+prop)}));var FACTOR=scope.def(value,".factor|0");var UNITS=scope.def(value,".units|0");return[FACTOR,UNITS]}));case S_CULL_FACE:return parseParam((function(value){var face=0;if(value==="front"){face=GL_FRONT}else if(value==="back"){face=GL_BACK}check$1.command(!!face,param,env.commandStr);return face}),(function(env,scope,value){check$1.optional((function(){env.assert(scope,value+'==="front"||'+value+'==="back"',"invalid cull.face")}));return scope.def(value,'==="front"?',GL_FRONT,":",GL_BACK)}));case S_LINE_WIDTH:return parseParam((function(value){check$1.command(typeof value==="number"&&value>=limits.lineWidthDims[0]&&value<=limits.lineWidthDims[1],"invalid line width, must be a positive number between "+limits.lineWidthDims[0]+" and "+limits.lineWidthDims[1],env.commandStr);return value}),(function(env,scope,value){check$1.optional((function(){env.assert(scope,"typeof "+value+'==="number"&&'+value+">="+limits.lineWidthDims[0]+"&&"+value+"<="+limits.lineWidthDims[1],"invalid line width")}));return value}));case S_FRONT_FACE:return parseParam((function(value){check$1.commandParameter(value,orientationType,param,env.commandStr);return orientationType[value]}),(function(env,scope,value){check$1.optional((function(){env.assert(scope,value+'==="cw"||'+value+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}));return scope.def(value+'==="cw"?'+GL_CW+":"+GL_CCW)}));case S_COLOR_MASK:return parseParam((function(value){check$1.command(isArrayLike(value)&&value.length===4,"color.mask must be length 4 array",env.commandStr);return value.map((function(v){return!!v}))}),(function(env,scope,value){check$1.optional((function(){env.assert(scope,env.shared.isArrayLike+"("+value+")&&"+value+".length===4","invalid color.mask")}));return loop(4,(function(i){return"!!"+value+"["+i+"]"}))}));case S_SAMPLE_COVERAGE:return parseParam((function(value){check$1.command(typeof value==="object"&&value,param,env.commandStr);var sampleValue="value"in value?value.value:1;var sampleInvert=!!value.invert;check$1.command(typeof sampleValue==="number"&&sampleValue>=0&&sampleValue<=1,"sample.coverage.value must be a number between 0 and 1",env.commandStr);return[sampleValue,sampleInvert]}),(function(env,scope,value){check$1.optional((function(){env.assert(scope,value+"&&typeof "+value+'==="object"',"invalid sample.coverage")}));var VALUE=scope.def('"value" in ',value,"?+",value,".value:1");var INVERT=scope.def("!!",value,".invert");return[VALUE,INVERT]}))}}));return STATE}function parseUniforms(uniforms,env){var staticUniforms=uniforms.static;var dynamicUniforms=uniforms.dynamic;var UNIFORMS={};Object.keys(staticUniforms).forEach((function(name){var value=staticUniforms[name];var result;if(typeof value==="number"||typeof value==="boolean"){result=createStaticDecl((function(){return value}))}else if(typeof value==="function"){var reglType=value._reglType;if(reglType==="texture2d"||reglType==="textureCube"){result=createStaticDecl((function(env){return env.link(value)}))}else if(reglType==="framebuffer"||reglType==="framebufferCube"){check$1.command(value.color.length>0,'missing color attachment for framebuffer sent to uniform "'+name+'"',env.commandStr);result=createStaticDecl((function(env){return env.link(value.color[0])}))}else{check$1.commandRaise('invalid data for uniform "'+name+'"',env.commandStr)}}else if(isArrayLike(value)){result=createStaticDecl((function(env){var ITEM=env.global.def("[",loop(value.length,(function(i){check$1.command(typeof value[i]==="number"||typeof value[i]==="boolean","invalid uniform "+name,env.commandStr);return value[i]})),"]");return ITEM}))}else{check$1.commandRaise('invalid or missing data for uniform "'+name+'"',env.commandStr)}result.value=value;UNIFORMS[name]=result}));Object.keys(dynamicUniforms).forEach((function(key){var dyn=dynamicUniforms[key];UNIFORMS[key]=createDynamicDecl(dyn,(function(env,scope){return env.invoke(scope,dyn)}))}));return UNIFORMS}function parseAttributes(attributes,env){var staticAttributes=attributes.static;var dynamicAttributes=attributes.dynamic;var attributeDefs={};Object.keys(staticAttributes).forEach((function(attribute){var value=staticAttributes[attribute];var id=stringStore.id(attribute);var record=new AttributeRecord;if(isBufferArgs(value)){record.state=ATTRIB_STATE_POINTER;record.buffer=bufferState.getBuffer(bufferState.create(value,GL_ARRAY_BUFFER$2,false,true));record.type=0}else{var buffer=bufferState.getBuffer(value);if(buffer){record.state=ATTRIB_STATE_POINTER;record.buffer=buffer;record.type=0}else{check$1.command(typeof value==="object"&&value,"invalid data for attribute "+attribute,env.commandStr);if("constant"in value){var constant=value.constant;record.buffer="null";record.state=ATTRIB_STATE_CONSTANT;if(typeof constant==="number"){record.x=constant}else{check$1.command(isArrayLike(constant)&&constant.length>0&&constant.length<=4,"invalid constant for attribute "+attribute,env.commandStr);CUTE_COMPONENTS.forEach((function(c,i){if(i<constant.length){record[c]=constant[i]}}))}}else{if(isBufferArgs(value.buffer)){buffer=bufferState.getBuffer(bufferState.create(value.buffer,GL_ARRAY_BUFFER$2,false,true))}else{buffer=bufferState.getBuffer(value.buffer)}check$1.command(!!buffer,'missing buffer for attribute "'+attribute+'"',env.commandStr);var offset=value.offset|0;check$1.command(offset>=0,'invalid offset for attribute "'+attribute+'"',env.commandStr);var stride=value.stride|0;check$1.command(stride>=0&&stride<256,'invalid stride for attribute "'+attribute+'", must be integer betweeen [0, 255]',env.commandStr);var size=value.size|0;check$1.command(!("size"in value)||size>0&&size<=4,'invalid size for attribute "'+attribute+'", must be 1,2,3,4',env.commandStr);var normalized=!!value.normalized;var type=0;if("type"in value){check$1.commandParameter(value.type,glTypes,"invalid type for attribute "+attribute,env.commandStr);type=glTypes[value.type]}var divisor=value.divisor|0;if("divisor"in value){check$1.command(divisor===0||extInstancing,'cannot specify divisor for attribute "'+attribute+'", instancing not supported',env.commandStr);check$1.command(divisor>=0,'invalid divisor for attribute "'+attribute+'"',env.commandStr)}check$1.optional((function(){var command=env.commandStr;var VALID_KEYS=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(value).forEach((function(prop){check$1.command(VALID_KEYS.indexOf(prop)>=0,'unknown parameter "'+prop+'" for attribute pointer "'+attribute+'" (valid parameters are '+VALID_KEYS+")",command)}))}));record.buffer=buffer;record.state=ATTRIB_STATE_POINTER;record.size=size;record.normalized=normalized;record.type=type||buffer.dtype;record.offset=offset;record.stride=stride;record.divisor=divisor}}}attributeDefs[attribute]=createStaticDecl((function(env,scope){var cache=env.attribCache;if(id in cache){return cache[id]}var result={isStream:false};Object.keys(record).forEach((function(key){result[key]=record[key]}));if(record.buffer){result.buffer=env.link(record.buffer);result.type=result.type||result.buffer+".dtype"}cache[id]=result;return result}))}));Object.keys(dynamicAttributes).forEach((function(attribute){var dyn=dynamicAttributes[attribute];function appendAttributeCode(env,block){var VALUE=env.invoke(block,dyn);var shared=env.shared;var constants=env.constants;var IS_BUFFER_ARGS=shared.isBufferArgs;var BUFFER_STATE=shared.buffer;check$1.optional((function(){env.assert(block,VALUE+"&&(typeof "+VALUE+'==="object"||typeof '+VALUE+'==="function")&&('+IS_BUFFER_ARGS+"("+VALUE+")||"+BUFFER_STATE+".getBuffer("+VALUE+")||"+BUFFER_STATE+".getBuffer("+VALUE+".buffer)||"+IS_BUFFER_ARGS+"("+VALUE+".buffer)||"+'("constant" in '+VALUE+"&&(typeof "+VALUE+'.constant==="number"||'+shared.isArrayLike+"("+VALUE+".constant))))",'invalid dynamic attribute "'+attribute+'"')}));var result={isStream:block.def(false)};var defaultRecord=new AttributeRecord;defaultRecord.state=ATTRIB_STATE_POINTER;Object.keys(defaultRecord).forEach((function(key){result[key]=block.def(""+defaultRecord[key])}));var BUFFER=result.buffer;var TYPE=result.type;block("if(",IS_BUFFER_ARGS,"(",VALUE,")){",result.isStream,"=true;",BUFFER,"=",BUFFER_STATE,".createStream(",GL_ARRAY_BUFFER$2,",",VALUE,");",TYPE,"=",BUFFER,".dtype;","}else{",BUFFER,"=",BUFFER_STATE,".getBuffer(",VALUE,");","if(",BUFFER,"){",TYPE,"=",BUFFER,".dtype;",'}else if("constant" in ',VALUE,"){",result.state,"=",ATTRIB_STATE_CONSTANT,";","if(typeof "+VALUE+'.constant === "number"){',result[CUTE_COMPONENTS[0]],"=",VALUE,".constant;",CUTE_COMPONENTS.slice(1).map((function(n){return result[n]})).join("="),"=0;","}else{",CUTE_COMPONENTS.map((function(name,i){return result[name]+"="+VALUE+".constant.length>"+i+"?"+VALUE+".constant["+i+"]:0;"})).join(""),"}}else{","if(",IS_BUFFER_ARGS,"(",VALUE,".buffer)){",BUFFER,"=",BUFFER_STATE,".createStream(",GL_ARRAY_BUFFER$2,",",VALUE,".buffer);","}else{",BUFFER,"=",BUFFER_STATE,".getBuffer(",VALUE,".buffer);","}",TYPE,'="type" in ',VALUE,"?",constants.glTypes,"[",VALUE,".type]:",BUFFER,".dtype;",result.normalized,"=!!",VALUE,".normalized;");function emitReadRecord(name){block(result[name],"=",VALUE,".",name,"|0;")}emitReadRecord("size");emitReadRecord("offset");emitReadRecord("stride");emitReadRecord("divisor");block("}}");block.exit("if(",result.isStream,"){",BUFFER_STATE,".destroyStream(",BUFFER,");","}");return result}attributeDefs[attribute]=createDynamicDecl(dyn,appendAttributeCode)}));return attributeDefs}function parseVAO(options,env){var staticOptions=options.static;var dynamicOptions=options.dynamic;if(S_VAO in staticOptions){var vao=staticOptions[S_VAO];if(vao!==null&&attributeState.getVAO(vao)===null){vao=attributeState.createVAO(vao)}return createStaticDecl((function(env){return env.link(attributeState.getVAO(vao))}))}else if(S_VAO in dynamicOptions){var dyn=dynamicOptions[S_VAO];return createDynamicDecl(dyn,(function(env,scope){var vaoRef=env.invoke(scope,dyn);return scope.def(env.shared.vao+".getVAO("+vaoRef+")")}))}return null}function parseContext(context){var staticContext=context.static;var dynamicContext=context.dynamic;var result={};Object.keys(staticContext).forEach((function(name){var value=staticContext[name];result[name]=createStaticDecl((function(env,scope){if(typeof value==="number"||typeof value==="boolean"){return""+value}else{return env.link(value)}}))}));Object.keys(dynamicContext).forEach((function(name){var dyn=dynamicContext[name];result[name]=createDynamicDecl(dyn,(function(env,scope){return env.invoke(scope,dyn)}))}));return result}function parseArguments(options,attributes,uniforms,context,env){var staticOptions=options.static;var dynamicOptions=options.dynamic;check$1.optional((function(){var KEY_NAMES=[S_FRAMEBUFFER,S_VERT,S_FRAG,S_ELEMENTS,S_PRIMITIVE,S_OFFSET,S_COUNT,S_INSTANCES,S_PROFILE,S_VAO].concat(GL_STATE_NAMES);function checkKeys(dict){Object.keys(dict).forEach((function(key){check$1.command(KEY_NAMES.indexOf(key)>=0,'unknown parameter "'+key+'"',env.commandStr)}))}checkKeys(staticOptions);checkKeys(dynamicOptions)}));var attribLocations=parseAttribLocations(options,attributes);var framebuffer=parseFramebuffer(options,env);var viewportAndScissor=parseViewportScissor(options,framebuffer,env);var draw=parseDraw(options,env);var state=parseGLState(options,env);var shader=parseProgram(options,env,attribLocations);function copyBox(name){var defn=viewportAndScissor[name];if(defn){state[name]=defn}}copyBox(S_VIEWPORT);copyBox(propName(S_SCISSOR_BOX));var dirty=Object.keys(state).length>0;var result={framebuffer:framebuffer,draw:draw,shader:shader,state:state,dirty:dirty,scopeVAO:null,drawVAO:null,useVAO:false,attributes:{}};result.profile=parseProfile(options,env);result.uniforms=parseUniforms(uniforms,env);result.drawVAO=result.scopeVAO=parseVAO(options,env);if(!result.drawVAO&&shader.program&&!attribLocations&&extensions.angle_instanced_arrays){var useVAO=true;var staticBindings=shader.program.attributes.map((function(attr){var binding=attributes.static[attr];useVAO=useVAO&&!!binding;return binding}));if(useVAO&&staticBindings.length>0){var vao=attributeState.getVAO(attributeState.createVAO(staticBindings));result.drawVAO=new Declaration(null,null,null,(function(env,scope){return env.link(vao)}));result.useVAO=true}}if(attribLocations){result.useVAO=true}else{result.attributes=parseAttributes(attributes,env)}result.context=parseContext(context,env);return result}function emitContext(env,scope,context){var shared=env.shared;var CONTEXT=shared.context;var contextEnter=env.scope();Object.keys(context).forEach((function(name){scope.save(CONTEXT,"."+name);var defn=context[name];var value=defn.append(env,scope);if(Array.isArray(value)){contextEnter(CONTEXT,".",name,"=[",value.join(),"];")}else{contextEnter(CONTEXT,".",name,"=",value,";")}}));scope(contextEnter)}function emitPollFramebuffer(env,scope,framebuffer,skipCheck){var shared=env.shared;var GL=shared.gl;var FRAMEBUFFER_STATE=shared.framebuffer;var EXT_DRAW_BUFFERS;if(extDrawBuffers){EXT_DRAW_BUFFERS=scope.def(shared.extensions,".webgl_draw_buffers")}var constants=env.constants;var DRAW_BUFFERS=constants.drawBuffer;var BACK_BUFFER=constants.backBuffer;var NEXT;if(framebuffer){NEXT=framebuffer.append(env,scope)}else{NEXT=scope.def(FRAMEBUFFER_STATE,".next")}if(!skipCheck){scope("if(",NEXT,"!==",FRAMEBUFFER_STATE,".cur){")}scope("if(",NEXT,"){",GL,".bindFramebuffer(",GL_FRAMEBUFFER$2,",",NEXT,".framebuffer);");if(extDrawBuffers){scope(EXT_DRAW_BUFFERS,".drawBuffersWEBGL(",DRAW_BUFFERS,"[",NEXT,".colorAttachments.length]);")}scope("}else{",GL,".bindFramebuffer(",GL_FRAMEBUFFER$2,",null);");if(extDrawBuffers){scope(EXT_DRAW_BUFFERS,".drawBuffersWEBGL(",BACK_BUFFER,");")}scope("}",FRAMEBUFFER_STATE,".cur=",NEXT,";");if(!skipCheck){scope("}")}}function emitPollState(env,scope,args){var shared=env.shared;var GL=shared.gl;var CURRENT_VARS=env.current;var NEXT_VARS=env.next;var CURRENT_STATE=shared.current;var NEXT_STATE=shared.next;var block=env.cond(CURRENT_STATE,".dirty");GL_STATE_NAMES.forEach((function(prop){var param=propName(prop);if(param in args.state){return}var NEXT,CURRENT;if(param in NEXT_VARS){NEXT=NEXT_VARS[param];CURRENT=CURRENT_VARS[param];var parts=loop(currentState[param].length,(function(i){return block.def(NEXT,"[",i,"]")}));block(env.cond(parts.map((function(p,i){return p+"!=="+CURRENT+"["+i+"]"})).join("||")).then(GL,".",GL_VARIABLES[param],"(",parts,");",parts.map((function(p,i){return CURRENT+"["+i+"]="+p})).join(";"),";"))}else{NEXT=block.def(NEXT_STATE,".",param);var ifte=env.cond(NEXT,"!==",CURRENT_STATE,".",param);block(ifte);if(param in GL_FLAGS){ifte(env.cond(NEXT).then(GL,".enable(",GL_FLAGS[param],");").else(GL,".disable(",GL_FLAGS[param],");"),CURRENT_STATE,".",param,"=",NEXT,";")}else{ifte(GL,".",GL_VARIABLES[param],"(",NEXT,");",CURRENT_STATE,".",param,"=",NEXT,";")}}}));if(Object.keys(args.state).length===0){block(CURRENT_STATE,".dirty=false;")}scope(block)}function emitSetOptions(env,scope,options,filter){var shared=env.shared;var CURRENT_VARS=env.current;var CURRENT_STATE=shared.current;var GL=shared.gl;sortState(Object.keys(options)).forEach((function(param){var defn=options[param];if(filter&&!filter(defn)){return}var variable=defn.append(env,scope);if(GL_FLAGS[param]){var flag=GL_FLAGS[param];if(isStatic(defn)){if(variable){scope(GL,".enable(",flag,");")}else{scope(GL,".disable(",flag,");")}}else{scope(env.cond(variable).then(GL,".enable(",flag,");").else(GL,".disable(",flag,");"))}scope(CURRENT_STATE,".",param,"=",variable,";")}else if(isArrayLike(variable)){var CURRENT=CURRENT_VARS[param];scope(GL,".",GL_VARIABLES[param],"(",variable,");",variable.map((function(v,i){return CURRENT+"["+i+"]="+v})).join(";"),";")}else{scope(GL,".",GL_VARIABLES[param],"(",variable,");",CURRENT_STATE,".",param,"=",variable,";")}}))}function injectExtensions(env,scope){if(extInstancing){env.instancing=scope.def(env.shared.extensions,".angle_instanced_arrays")}}function emitProfile(env,scope,args,useScope,incrementCounter){var shared=env.shared;var STATS=env.stats;var CURRENT_STATE=shared.current;var TIMER=shared.timer;var profileArg=args.profile;function perfCounter(){if(typeof performance==="undefined"){return"Date.now()"}else{return"performance.now()"}}var CPU_START,QUERY_COUNTER;function emitProfileStart(block){CPU_START=scope.def();block(CPU_START,"=",perfCounter(),";");if(typeof incrementCounter==="string"){block(STATS,".count+=",incrementCounter,";")}else{block(STATS,".count++;")}if(timer){if(useScope){QUERY_COUNTER=scope.def();block(QUERY_COUNTER,"=",TIMER,".getNumPendingQueries();")}else{block(TIMER,".beginQuery(",STATS,");")}}}function emitProfileEnd(block){block(STATS,".cpuTime+=",perfCounter(),"-",CPU_START,";");if(timer){if(useScope){block(TIMER,".pushScopeStats(",QUERY_COUNTER,",",TIMER,".getNumPendingQueries(),",STATS,");")}else{block(TIMER,".endQuery();")}}}function scopeProfile(value){var prev=scope.def(CURRENT_STATE,".profile");scope(CURRENT_STATE,".profile=",value,";");scope.exit(CURRENT_STATE,".profile=",prev,";")}var USE_PROFILE;if(profileArg){if(isStatic(profileArg)){if(profileArg.enable){emitProfileStart(scope);emitProfileEnd(scope.exit);scopeProfile("true")}else{scopeProfile("false")}return}USE_PROFILE=profileArg.append(env,scope);scopeProfile(USE_PROFILE)}else{USE_PROFILE=scope.def(CURRENT_STATE,".profile")}var start=env.block();emitProfileStart(start);scope("if(",USE_PROFILE,"){",start,"}");var end=env.block();emitProfileEnd(end);scope.exit("if(",USE_PROFILE,"){",end,"}")}function emitAttributes(env,scope,args,attributes,filter){var shared=env.shared;function typeLength(x){switch(x){case GL_FLOAT_VEC2:case GL_INT_VEC2:case GL_BOOL_VEC2:return 2;case GL_FLOAT_VEC3:case GL_INT_VEC3:case GL_BOOL_VEC3:return 3;case GL_FLOAT_VEC4:case GL_INT_VEC4:case GL_BOOL_VEC4:return 4;default:return 1}}function emitBindAttribute(ATTRIBUTE,size,record){var GL=shared.gl;var LOCATION=scope.def(ATTRIBUTE,".location");var BINDING=scope.def(shared.attributes,"[",LOCATION,"]");var STATE=record.state;var BUFFER=record.buffer;var CONST_COMPONENTS=[record.x,record.y,record.z,record.w];var COMMON_KEYS=["buffer","normalized","offset","stride"];function emitBuffer(){scope("if(!",BINDING,".buffer){",GL,".enableVertexAttribArray(",LOCATION,");}");var TYPE=record.type;var SIZE;if(!record.size){SIZE=size}else{SIZE=scope.def(record.size,"||",size)}scope("if(",BINDING,".type!==",TYPE,"||",BINDING,".size!==",SIZE,"||",COMMON_KEYS.map((function(key){return BINDING+"."+key+"!=="+record[key]})).join("||"),"){",GL,".bindBuffer(",GL_ARRAY_BUFFER$2,",",BUFFER,".buffer);",GL,".vertexAttribPointer(",[LOCATION,SIZE,TYPE,record.normalized,record.stride,record.offset],");",BINDING,".type=",TYPE,";",BINDING,".size=",SIZE,";",COMMON_KEYS.map((function(key){return BINDING+"."+key+"="+record[key]+";"})).join(""),"}");if(extInstancing){var DIVISOR=record.divisor;scope("if(",BINDING,".divisor!==",DIVISOR,"){",env.instancing,".vertexAttribDivisorANGLE(",[LOCATION,DIVISOR],");",BINDING,".divisor=",DIVISOR,";}")}}function emitConstant(){scope("if(",BINDING,".buffer){",GL,".disableVertexAttribArray(",LOCATION,");",BINDING,".buffer=null;","}if(",CUTE_COMPONENTS.map((function(c,i){return BINDING+"."+c+"!=="+CONST_COMPONENTS[i]})).join("||"),"){",GL,".vertexAttrib4f(",LOCATION,",",CONST_COMPONENTS,");",CUTE_COMPONENTS.map((function(c,i){return BINDING+"."+c+"="+CONST_COMPONENTS[i]+";"})).join(""),"}")}if(STATE===ATTRIB_STATE_POINTER){emitBuffer()}else if(STATE===ATTRIB_STATE_CONSTANT){emitConstant()}else{scope("if(",STATE,"===",ATTRIB_STATE_POINTER,"){");emitBuffer();scope("}else{");emitConstant();scope("}")}}attributes.forEach((function(attribute){var name=attribute.name;var arg=args.attributes[name];var record;if(arg){if(!filter(arg)){return}record=arg.append(env,scope)}else{if(!filter(SCOPE_DECL)){return}var scopeAttrib=env.scopeAttrib(name);check$1.optional((function(){env.assert(scope,scopeAttrib+".state","missing attribute "+name)}));record={};Object.keys(new AttributeRecord).forEach((function(key){record[key]=scope.def(scopeAttrib,".",key)}))}emitBindAttribute(env.link(attribute),typeLength(attribute.info.type),record)}))}function emitUniforms(env,scope,args,uniforms,filter){var shared=env.shared;var GL=shared.gl;var infix;for(var i=0;i<uniforms.length;++i){var uniform=uniforms[i];var name=uniform.name;var type=uniform.info.type;var arg=args.uniforms[name];var UNIFORM=env.link(uniform);var LOCATION=UNIFORM+".location";var VALUE;if(arg){if(!filter(arg)){continue}if(isStatic(arg)){var value=arg.value;check$1.command(value!==null&&typeof value!=="undefined",'missing uniform "'+name+'"',env.commandStr);if(type===GL_SAMPLER_2D||type===GL_SAMPLER_CUBE){check$1.command(typeof value==="function"&&(type===GL_SAMPLER_2D&&(value._reglType==="texture2d"||value._reglType==="framebuffer")||type===GL_SAMPLER_CUBE&&(value._reglType==="textureCube"||value._reglType==="framebufferCube")),"invalid texture for uniform "+name,env.commandStr);var TEX_VALUE=env.link(value._texture||value.color[0]._texture);scope(GL,".uniform1i(",LOCATION,",",TEX_VALUE+".bind());");scope.exit(TEX_VALUE,".unbind();")}else if(type===GL_FLOAT_MAT2||type===GL_FLOAT_MAT3||type===GL_FLOAT_MAT4){check$1.optional((function(){check$1.command(isArrayLike(value),"invalid matrix for uniform "+name,env.commandStr);check$1.command(type===GL_FLOAT_MAT2&&value.length===4||type===GL_FLOAT_MAT3&&value.length===9||type===GL_FLOAT_MAT4&&value.length===16,"invalid length for matrix uniform "+name,env.commandStr)}));var MAT_VALUE=env.global.def("new Float32Array(["+Array.prototype.slice.call(value)+"])");var dim=2;if(type===GL_FLOAT_MAT3){dim=3}else if(type===GL_FLOAT_MAT4){dim=4}scope(GL,".uniformMatrix",dim,"fv(",LOCATION,",false,",MAT_VALUE,");")}else{switch(type){case GL_FLOAT$8:check$1.commandType(value,"number","uniform "+name,env.commandStr);infix="1f";break;case GL_FLOAT_VEC2:check$1.command(isArrayLike(value)&&value.length===2,"uniform "+name,env.commandStr);infix="2f";break;case GL_FLOAT_VEC3:check$1.command(isArrayLike(value)&&value.length===3,"uniform "+name,env.commandStr);infix="3f";break;case GL_FLOAT_VEC4:check$1.command(isArrayLike(value)&&value.length===4,"uniform "+name,env.commandStr);infix="4f";break;case GL_BOOL:check$1.commandType(value,"boolean","uniform "+name,env.commandStr);infix="1i";break;case GL_INT$3:check$1.commandType(value,"number","uniform "+name,env.commandStr);infix="1i";break;case GL_BOOL_VEC2:check$1.command(isArrayLike(value)&&value.length===2,"uniform "+name,env.commandStr);infix="2i";break;case GL_INT_VEC2:check$1.command(isArrayLike(value)&&value.length===2,"uniform "+name,env.commandStr);infix="2i";break;case GL_BOOL_VEC3:check$1.command(isArrayLike(value)&&value.length===3,"uniform "+name,env.commandStr);infix="3i";break;case GL_INT_VEC3:check$1.command(isArrayLike(value)&&value.length===3,"uniform "+name,env.commandStr);infix="3i";break;case GL_BOOL_VEC4:check$1.command(isArrayLike(value)&&value.length===4,"uniform "+name,env.commandStr);infix="4i";break;case GL_INT_VEC4:check$1.command(isArrayLike(value)&&value.length===4,"uniform "+name,env.commandStr);infix="4i";break}scope(GL,".uniform",infix,"(",LOCATION,",",isArrayLike(value)?Array.prototype.slice.call(value):value,");")}continue}else{VALUE=arg.append(env,scope)}}else{if(!filter(SCOPE_DECL)){continue}VALUE=scope.def(shared.uniforms,"[",stringStore.id(name),"]")}if(type===GL_SAMPLER_2D){check$1(!Array.isArray(VALUE),"must specify a scalar prop for textures");scope("if(",VALUE,"&&",VALUE,'._reglType==="framebuffer"){',VALUE,"=",VALUE,".color[0];","}")}else if(type===GL_SAMPLER_CUBE){check$1(!Array.isArray(VALUE),"must specify a scalar prop for cube maps");scope("if(",VALUE,"&&",VALUE,'._reglType==="framebufferCube"){',VALUE,"=",VALUE,".color[0];","}")}check$1.optional((function(){function emitCheck(pred,message){env.assert(scope,pred,'bad data or missing for uniform "'+name+'". '+message)}function checkType(type){check$1(!Array.isArray(VALUE),"must not specify an array type for uniform");emitCheck("typeof "+VALUE+'==="'+type+'"',"invalid type, expected "+type)}function checkVector(n,type){if(Array.isArray(VALUE)){check$1(VALUE.length===n,"must have length "+n)}else{emitCheck(shared.isArrayLike+"("+VALUE+")&&"+VALUE+".length==="+n,"invalid vector, should have length "+n,env.commandStr)}}function checkTexture(target){check$1(!Array.isArray(VALUE),"must not specify a value type");emitCheck("typeof "+VALUE+'==="function"&&'+VALUE+'._reglType==="texture'+(target===GL_TEXTURE_2D$3?"2d":"Cube")+'"',"invalid texture type",env.commandStr)}switch(type){case GL_INT$3:checkType("number");break;case GL_INT_VEC2:checkVector(2,"number");break;case GL_INT_VEC3:checkVector(3,"number");break;case GL_INT_VEC4:checkVector(4,"number");break;case GL_FLOAT$8:checkType("number");break;case GL_FLOAT_VEC2:checkVector(2,"number");break;case GL_FLOAT_VEC3:checkVector(3,"number");break;case GL_FLOAT_VEC4:checkVector(4,"number");break;case GL_BOOL:checkType("boolean");break;case GL_BOOL_VEC2:checkVector(2,"boolean");break;case GL_BOOL_VEC3:checkVector(3,"boolean");break;case GL_BOOL_VEC4:checkVector(4,"boolean");break;case GL_FLOAT_MAT2:checkVector(4,"number");break;case GL_FLOAT_MAT3:checkVector(9,"number");break;case GL_FLOAT_MAT4:checkVector(16,"number");break;case GL_SAMPLER_2D:checkTexture(GL_TEXTURE_2D$3);break;case GL_SAMPLER_CUBE:checkTexture(GL_TEXTURE_CUBE_MAP$2);break}}));var unroll=1;switch(type){case GL_SAMPLER_2D:case GL_SAMPLER_CUBE:var TEX=scope.def(VALUE,"._texture");scope(GL,".uniform1i(",LOCATION,",",TEX,".bind());");scope.exit(TEX,".unbind();");continue;case GL_INT$3:case GL_BOOL:infix="1i";break;case GL_INT_VEC2:case GL_BOOL_VEC2:infix="2i";unroll=2;break;case GL_INT_VEC3:case GL_BOOL_VEC3:infix="3i";unroll=3;break;case GL_INT_VEC4:case GL_BOOL_VEC4:infix="4i";unroll=4;break;case GL_FLOAT$8:infix="1f";break;case GL_FLOAT_VEC2:infix="2f";unroll=2;break;case GL_FLOAT_VEC3:infix="3f";unroll=3;break;case GL_FLOAT_VEC4:infix="4f";unroll=4;break;case GL_FLOAT_MAT2:infix="Matrix2fv";break;case GL_FLOAT_MAT3:infix="Matrix3fv";break;case GL_FLOAT_MAT4:infix="Matrix4fv";break}scope(GL,".uniform",infix,"(",LOCATION,",");if(infix.charAt(0)==="M"){var matSize=Math.pow(type-GL_FLOAT_MAT2+2,2);var STORAGE=env.global.def("new Float32Array(",matSize,")");if(Array.isArray(VALUE)){scope("false,(",loop(matSize,(function(i){return STORAGE+"["+i+"]="+VALUE[i]})),",",STORAGE,")")}else{scope("false,(Array.isArray(",VALUE,")||",VALUE," instanceof Float32Array)?",VALUE,":(",loop(matSize,(function(i){return STORAGE+"["+i+"]="+VALUE+"["+i+"]"})),",",STORAGE,")")}}else if(unroll>1){scope(loop(unroll,(function(i){return Array.isArray(VALUE)?VALUE[i]:VALUE+"["+i+"]"})))}else{check$1(!Array.isArray(VALUE),"uniform value must not be an array");scope(VALUE)}scope(");")}}function emitDraw(env,outer,inner,args){var shared=env.shared;var GL=shared.gl;var DRAW_STATE=shared.draw;var drawOptions=args.draw;function emitElements(){var defn=drawOptions.elements;var ELEMENTS;var scope=outer;if(defn){if(defn.contextDep&&args.contextDynamic||defn.propDep){scope=inner}ELEMENTS=defn.append(env,scope)}else{ELEMENTS=scope.def(DRAW_STATE,".",S_ELEMENTS)}if(ELEMENTS){scope("if("+ELEMENTS+")"+GL+".bindBuffer("+GL_ELEMENT_ARRAY_BUFFER$1+","+ELEMENTS+".buffer.buffer);")}return ELEMENTS}function emitCount(){var defn=drawOptions.count;var COUNT;var scope=outer;if(defn){if(defn.contextDep&&args.contextDynamic||defn.propDep){scope=inner}COUNT=defn.append(env,scope);check$1.optional((function(){if(defn.MISSING){env.assert(outer,"false","missing vertex count")}if(defn.DYNAMIC){env.assert(scope,COUNT+">=0","missing vertex count")}}))}else{COUNT=scope.def(DRAW_STATE,".",S_COUNT);check$1.optional((function(){env.assert(scope,COUNT+">=0","missing vertex count")}))}return COUNT}var ELEMENTS=emitElements();function emitValue(name){var defn=drawOptions[name];if(defn){if(defn.contextDep&&args.contextDynamic||defn.propDep){return defn.append(env,inner)}else{return defn.append(env,outer)}}else{return outer.def(DRAW_STATE,".",name)}}var PRIMITIVE=emitValue(S_PRIMITIVE);var OFFSET=emitValue(S_OFFSET);var COUNT=emitCount();if(typeof COUNT==="number"){if(COUNT===0){return}}else{inner("if(",COUNT,"){");inner.exit("}")}var INSTANCES,EXT_INSTANCING;if(extInstancing){INSTANCES=emitValue(S_INSTANCES);EXT_INSTANCING=env.instancing}var ELEMENT_TYPE=ELEMENTS+".type";var elementsStatic=drawOptions.elements&&isStatic(drawOptions.elements);function emitInstancing(){function drawElements(){inner(EXT_INSTANCING,".drawElementsInstancedANGLE(",[PRIMITIVE,COUNT,ELEMENT_TYPE,OFFSET+"<<(("+ELEMENT_TYPE+"-"+GL_UNSIGNED_BYTE$8+")>>1)",INSTANCES],");")}function drawArrays(){inner(EXT_INSTANCING,".drawArraysInstancedANGLE(",[PRIMITIVE,OFFSET,COUNT,INSTANCES],");")}if(ELEMENTS){if(!elementsStatic){inner("if(",ELEMENTS,"){");drawElements();inner("}else{");drawArrays();inner("}")}else{drawElements()}}else{drawArrays()}}function emitRegular(){function drawElements(){inner(GL+".drawElements("+[PRIMITIVE,COUNT,ELEMENT_TYPE,OFFSET+"<<(("+ELEMENT_TYPE+"-"+GL_UNSIGNED_BYTE$8+")>>1)"]+");")}function drawArrays(){inner(GL+".drawArrays("+[PRIMITIVE,OFFSET,COUNT]+");")}if(ELEMENTS){if(!elementsStatic){inner("if(",ELEMENTS,"){");drawElements();inner("}else{");drawArrays();inner("}")}else{drawElements()}}else{drawArrays()}}if(extInstancing&&(typeof INSTANCES!=="number"||INSTANCES>=0)){if(typeof INSTANCES==="string"){inner("if(",INSTANCES,">0){");emitInstancing();inner("}else if(",INSTANCES,"<0){");emitRegular();inner("}")}else{emitInstancing()}}else{emitRegular()}}function createBody(emitBody,parentEnv,args,program,count){var env=createREGLEnvironment();var scope=env.proc("body",count);check$1.optional((function(){env.commandStr=parentEnv.commandStr;env.command=env.link(parentEnv.commandStr)}));if(extInstancing){env.instancing=scope.def(env.shared.extensions,".angle_instanced_arrays")}emitBody(env,scope,args,program);return env.compile().body}function emitDrawBody(env,draw,args,program){injectExtensions(env,draw);if(args.useVAO){if(args.drawVAO){draw(env.shared.vao,".setVAO(",args.drawVAO.append(env,draw),");")}else{draw(env.shared.vao,".setVAO(",env.shared.vao,".targetVAO);")}}else{draw(env.shared.vao,".setVAO(null);");emitAttributes(env,draw,args,program.attributes,(function(){return true}))}emitUniforms(env,draw,args,program.uniforms,(function(){return true}));emitDraw(env,draw,draw,args)}function emitDrawProc(env,args){var draw=env.proc("draw",1);injectExtensions(env,draw);emitContext(env,draw,args.context);emitPollFramebuffer(env,draw,args.framebuffer);emitPollState(env,draw,args);emitSetOptions(env,draw,args.state);emitProfile(env,draw,args,false,true);var program=args.shader.progVar.append(env,draw);draw(env.shared.gl,".useProgram(",program,".program);");if(args.shader.program){emitDrawBody(env,draw,args,args.shader.program)}else{draw(env.shared.vao,".setVAO(null);");var drawCache=env.global.def("{}");var PROG_ID=draw.def(program,".id");var CACHED_PROC=draw.def(drawCache,"[",PROG_ID,"]");draw(env.cond(CACHED_PROC).then(CACHED_PROC,".call(this,a0);").else(CACHED_PROC,"=",drawCache,"[",PROG_ID,"]=",env.link((function(program){return createBody(emitDrawBody,env,args,program,1)})),"(",program,");",CACHED_PROC,".call(this,a0);"))}if(Object.keys(args.state).length>0){draw(env.shared.current,".dirty=true;")}}function emitBatchDynamicShaderBody(env,scope,args,program){env.batchId="a1";injectExtensions(env,scope);function all(){return true}emitAttributes(env,scope,args,program.attributes,all);emitUniforms(env,scope,args,program.uniforms,all);emitDraw(env,scope,scope,args)}function emitBatchBody(env,scope,args,program){injectExtensions(env,scope);var contextDynamic=args.contextDep;var BATCH_ID=scope.def();var PROP_LIST="a0";var NUM_PROPS="a1";var PROPS=scope.def();env.shared.props=PROPS;env.batchId=BATCH_ID;var outer=env.scope();var inner=env.scope();scope(outer.entry,"for(",BATCH_ID,"=0;",BATCH_ID,"<",NUM_PROPS,";++",BATCH_ID,"){",PROPS,"=",PROP_LIST,"[",BATCH_ID,"];",inner,"}",outer.exit);function isInnerDefn(defn){return defn.contextDep&&contextDynamic||defn.propDep}function isOuterDefn(defn){return!isInnerDefn(defn)}if(args.needsContext){emitContext(env,inner,args.context)}if(args.needsFramebuffer){emitPollFramebuffer(env,inner,args.framebuffer)}emitSetOptions(env,inner,args.state,isInnerDefn);if(args.profile&&isInnerDefn(args.profile)){emitProfile(env,inner,args,false,true)}if(!program){var progCache=env.global.def("{}");var PROGRAM=args.shader.progVar.append(env,inner);var PROG_ID=inner.def(PROGRAM,".id");var CACHED_PROC=inner.def(progCache,"[",PROG_ID,"]");inner(env.shared.gl,".useProgram(",PROGRAM,".program);","if(!",CACHED_PROC,"){",CACHED_PROC,"=",progCache,"[",PROG_ID,"]=",env.link((function(program){return createBody(emitBatchDynamicShaderBody,env,args,program,2)})),"(",PROGRAM,");}",CACHED_PROC,".call(this,a0[",BATCH_ID,"],",BATCH_ID,");")}else{if(args.useVAO){if(args.drawVAO){if(isInnerDefn(args.drawVAO)){inner(env.shared.vao,".setVAO(",args.drawVAO.append(env,inner),");")}else{outer(env.shared.vao,".setVAO(",args.drawVAO.append(env,outer),");")}}else{outer(env.shared.vao,".setVAO(",env.shared.vao,".targetVAO);")}}else{outer(env.shared.vao,".setVAO(null);");emitAttributes(env,outer,args,program.attributes,isOuterDefn);emitAttributes(env,inner,args,program.attributes,isInnerDefn)}emitUniforms(env,outer,args,program.uniforms,isOuterDefn);emitUniforms(env,inner,args,program.uniforms,isInnerDefn);emitDraw(env,outer,inner,args)}}function emitBatchProc(env,args){var batch=env.proc("batch",2);env.batchId="0";injectExtensions(env,batch);var contextDynamic=false;var needsContext=true;Object.keys(args.context).forEach((function(name){contextDynamic=contextDynamic||args.context[name].propDep}));if(!contextDynamic){emitContext(env,batch,args.context);needsContext=false}var framebuffer=args.framebuffer;var needsFramebuffer=false;if(framebuffer){if(framebuffer.propDep){contextDynamic=needsFramebuffer=true}else if(framebuffer.contextDep&&contextDynamic){needsFramebuffer=true}if(!needsFramebuffer){emitPollFramebuffer(env,batch,framebuffer)}}else{emitPollFramebuffer(env,batch,null)}if(args.state.viewport&&args.state.viewport.propDep){contextDynamic=true}function isInnerDefn(defn){return defn.contextDep&&contextDynamic||defn.propDep}emitPollState(env,batch,args);emitSetOptions(env,batch,args.state,(function(defn){return!isInnerDefn(defn)}));if(!args.profile||!isInnerDefn(args.profile)){emitProfile(env,batch,args,false,"a1")}args.contextDep=contextDynamic;args.needsContext=needsContext;args.needsFramebuffer=needsFramebuffer;var progDefn=args.shader.progVar;if(progDefn.contextDep&&contextDynamic||progDefn.propDep){emitBatchBody(env,batch,args,null)}else{var PROGRAM=progDefn.append(env,batch);batch(env.shared.gl,".useProgram(",PROGRAM,".program);");if(args.shader.program){emitBatchBody(env,batch,args,args.shader.program)}else{batch(env.shared.vao,".setVAO(null);");var batchCache=env.global.def("{}");var PROG_ID=batch.def(PROGRAM,".id");var CACHED_PROC=batch.def(batchCache,"[",PROG_ID,"]");batch(env.cond(CACHED_PROC).then(CACHED_PROC,".call(this,a0,a1);").else(CACHED_PROC,"=",batchCache,"[",PROG_ID,"]=",env.link((function(program){return createBody(emitBatchBody,env,args,program,2)})),"(",PROGRAM,");",CACHED_PROC,".call(this,a0,a1);"))}}if(Object.keys(args.state).length>0){batch(env.shared.current,".dirty=true;")}}function emitScopeProc(env,args){var scope=env.proc("scope",3);env.batchId="a2";var shared=env.shared;var CURRENT_STATE=shared.current;emitContext(env,scope,args.context);if(args.framebuffer){args.framebuffer.append(env,scope)}sortState(Object.keys(args.state)).forEach((function(name){var defn=args.state[name];var value=defn.append(env,scope);if(isArrayLike(value)){value.forEach((function(v,i){scope.set(env.next[name],"["+i+"]",v)}))}else{scope.set(shared.next,"."+name,value)}}));emitProfile(env,scope,args,true,true);[S_ELEMENTS,S_OFFSET,S_COUNT,S_INSTANCES,S_PRIMITIVE].forEach((function(opt){var variable=args.draw[opt];if(!variable){return}scope.set(shared.draw,"."+opt,""+variable.append(env,scope))}));Object.keys(args.uniforms).forEach((function(opt){var value=args.uniforms[opt].append(env,scope);if(Array.isArray(value)){value="["+value.join()+"]"}scope.set(shared.uniforms,"["+stringStore.id(opt)+"]",value)}));Object.keys(args.attributes).forEach((function(name){var record=args.attributes[name].append(env,scope);var scopeAttrib=env.scopeAttrib(name);Object.keys(new AttributeRecord).forEach((function(prop){scope.set(scopeAttrib,"."+prop,record[prop])}))}));if(args.scopeVAO){scope.set(shared.vao,".targetVAO",args.scopeVAO.append(env,scope))}function saveShader(name){var shader=args.shader[name];if(shader){scope.set(shared.shader,"."+name,shader.append(env,scope))}}saveShader(S_VERT);saveShader(S_FRAG);if(Object.keys(args.state).length>0){scope(CURRENT_STATE,".dirty=true;");scope.exit(CURRENT_STATE,".dirty=true;")}scope("a1(",env.shared.context,",a0,",env.batchId,");")}function isDynamicObject(object){if(typeof object!=="object"||isArrayLike(object)){return}var props=Object.keys(object);for(var i=0;i<props.length;++i){if(dynamic.isDynamic(object[props[i]])){return true}}return false}function splatObject(env,options,name){var object=options.static[name];if(!object||!isDynamicObject(object)){return}var globals=env.global;var keys=Object.keys(object);var thisDep=false;var contextDep=false;var propDep=false;var objectRef=env.global.def("{}");keys.forEach((function(key){var value=object[key];if(dynamic.isDynamic(value)){if(typeof value==="function"){value=object[key]=dynamic.unbox(value)}var deps=createDynamicDecl(value,null);thisDep=thisDep||deps.thisDep;propDep=propDep||deps.propDep;contextDep=contextDep||deps.contextDep}else{globals(objectRef,".",key,"=");switch(typeof value){case"number":globals(value);break;case"string":globals('"',value,'"');break;case"object":if(Array.isArray(value)){globals("[",value.join(),"]")}break;default:globals(env.link(value));break}globals(";")}}));function appendBlock(env,block){keys.forEach((function(key){var value=object[key];if(!dynamic.isDynamic(value)){return}var ref=env.invoke(block,value);block(objectRef,".",key,"=",ref,";")}))}options.dynamic[name]=new dynamic.DynamicVariable(DYN_THUNK,{thisDep:thisDep,contextDep:contextDep,propDep:propDep,ref:objectRef,append:appendBlock});delete options.static[name]}function compileCommand(options,attributes,uniforms,context,stats){var env=createREGLEnvironment();env.stats=env.link(stats);Object.keys(attributes.static).forEach((function(key){splatObject(env,attributes,key)}));NESTED_OPTIONS.forEach((function(name){splatObject(env,options,name)}));var args=parseArguments(options,attributes,uniforms,context,env);emitDrawProc(env,args);emitScopeProc(env,args);emitBatchProc(env,args);return extend(env.compile(),{destroy:function(){args.shader.program.destroy()}})}return{next:nextState,current:currentState,procs:function(){var env=createREGLEnvironment();var poll=env.proc("poll");var refresh=env.proc("refresh");var common=env.block();poll(common);refresh(common);var shared=env.shared;var GL=shared.gl;var NEXT_STATE=shared.next;var CURRENT_STATE=shared.current;common(CURRENT_STATE,".dirty=false;");emitPollFramebuffer(env,poll);emitPollFramebuffer(env,refresh,null,true);var INSTANCING;if(extInstancing){INSTANCING=env.link(extInstancing)}if(extensions.oes_vertex_array_object){refresh(env.link(extensions.oes_vertex_array_object),".bindVertexArrayOES(null);")}for(var i=0;i<limits.maxAttributes;++i){var BINDING=refresh.def(shared.attributes,"[",i,"]");var ifte=env.cond(BINDING,".buffer");ifte.then(GL,".enableVertexAttribArray(",i,");",GL,".bindBuffer(",GL_ARRAY_BUFFER$2,",",BINDING,".buffer.buffer);",GL,".vertexAttribPointer(",i,",",BINDING,".size,",BINDING,".type,",BINDING,".normalized,",BINDING,".stride,",BINDING,".offset);").else(GL,".disableVertexAttribArray(",i,");",GL,".vertexAttrib4f(",i,",",BINDING,".x,",BINDING,".y,",BINDING,".z,",BINDING,".w);",BINDING,".buffer=null;");refresh(ifte);if(extInstancing){refresh(INSTANCING,".vertexAttribDivisorANGLE(",i,",",BINDING,".divisor);")}}refresh(env.shared.vao,".currentVAO=null;",env.shared.vao,".setVAO(",env.shared.vao,".targetVAO);");Object.keys(GL_FLAGS).forEach((function(flag){var cap=GL_FLAGS[flag];var NEXT=common.def(NEXT_STATE,".",flag);var block=env.block();block("if(",NEXT,"){",GL,".enable(",cap,")}else{",GL,".disable(",cap,")}",CURRENT_STATE,".",flag,"=",NEXT,";");refresh(block);poll("if(",NEXT,"!==",CURRENT_STATE,".",flag,"){",block,"}")}));Object.keys(GL_VARIABLES).forEach((function(name){var func=GL_VARIABLES[name];var init=currentState[name];var NEXT,CURRENT;var block=env.block();block(GL,".",func,"(");if(isArrayLike(init)){var n=init.length;NEXT=env.global.def(NEXT_STATE,".",name);CURRENT=env.global.def(CURRENT_STATE,".",name);block(loop(n,(function(i){return NEXT+"["+i+"]"})),");",loop(n,(function(i){return CURRENT+"["+i+"]="+NEXT+"["+i+"];"})).join(""));poll("if(",loop(n,(function(i){return NEXT+"["+i+"]!=="+CURRENT+"["+i+"]"})).join("||"),"){",block,"}")}else{NEXT=common.def(NEXT_STATE,".",name);CURRENT=common.def(CURRENT_STATE,".",name);block(NEXT,");",CURRENT_STATE,".",name,"=",NEXT,";");poll("if(",NEXT,"!==",CURRENT,"){",block,"}")}refresh(block)}));return env.compile()}(),compile:compileCommand}}function stats(){return{vaoCount:0,bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0}}var GL_QUERY_RESULT_EXT=34918;var GL_QUERY_RESULT_AVAILABLE_EXT=34919;var GL_TIME_ELAPSED_EXT=35007;var createTimer=function(gl,extensions){if(!extensions.ext_disjoint_timer_query){return null}var queryPool=[];function allocQuery(){return queryPool.pop()||extensions.ext_disjoint_timer_query.createQueryEXT()}function freeQuery(query){queryPool.push(query)}var pendingQueries=[];function beginQuery(stats){var query=allocQuery();extensions.ext_disjoint_timer_query.beginQueryEXT(GL_TIME_ELAPSED_EXT,query);pendingQueries.push(query);pushScopeStats(pendingQueries.length-1,pendingQueries.length,stats)}function endQuery(){extensions.ext_disjoint_timer_query.endQueryEXT(GL_TIME_ELAPSED_EXT)}function PendingStats(){this.startQueryIndex=-1;this.endQueryIndex=-1;this.sum=0;this.stats=null}var pendingStatsPool=[];function allocPendingStats(){return pendingStatsPool.pop()||new PendingStats}function freePendingStats(pendingStats){pendingStatsPool.push(pendingStats)}var pendingStats=[];function pushScopeStats(start,end,stats){var ps=allocPendingStats();ps.startQueryIndex=start;ps.endQueryIndex=end;ps.sum=0;ps.stats=stats;pendingStats.push(ps)}var timeSum=[];var queryPtr=[];function update(){var ptr,i;var n=pendingQueries.length;if(n===0){return}queryPtr.length=Math.max(queryPtr.length,n+1);timeSum.length=Math.max(timeSum.length,n+1);timeSum[0]=0;queryPtr[0]=0;var queryTime=0;ptr=0;for(i=0;i<pendingQueries.length;++i){var query=pendingQueries[i];if(extensions.ext_disjoint_timer_query.getQueryObjectEXT(query,GL_QUERY_RESULT_AVAILABLE_EXT)){queryTime+=extensions.ext_disjoint_timer_query.getQueryObjectEXT(query,GL_QUERY_RESULT_EXT);freeQuery(query)}else{pendingQueries[ptr++]=query}timeSum[i+1]=queryTime;queryPtr[i+1]=ptr}pendingQueries.length=ptr;ptr=0;for(i=0;i<pendingStats.length;++i){var stats=pendingStats[i];var start=stats.startQueryIndex;var end=stats.endQueryIndex;stats.sum+=timeSum[end]-timeSum[start];var startPtr=queryPtr[start];var endPtr=queryPtr[end];if(endPtr===startPtr){stats.stats.gpuTime+=stats.sum/1e6;freePendingStats(stats)}else{stats.startQueryIndex=startPtr;stats.endQueryIndex=endPtr;pendingStats[ptr++]=stats}}pendingStats.length=ptr}return{beginQuery:beginQuery,endQuery:endQuery,pushScopeStats:pushScopeStats,update:update,getNumPendingQueries:function(){return pendingQueries.length},clear:function(){queryPool.push.apply(queryPool,pendingQueries);for(var i=0;i<queryPool.length;i++){extensions.ext_disjoint_timer_query.deleteQueryEXT(queryPool[i])}pendingQueries.length=0;queryPool.length=0},restore:function(){pendingQueries.length=0;queryPool.length=0}}};var GL_COLOR_BUFFER_BIT=16384;var GL_DEPTH_BUFFER_BIT=256;var GL_STENCIL_BUFFER_BIT=1024;var GL_ARRAY_BUFFER=34962;var CONTEXT_LOST_EVENT="webglcontextlost";var CONTEXT_RESTORED_EVENT="webglcontextrestored";var DYN_PROP=1;var DYN_CONTEXT=2;var DYN_STATE=3;function find(haystack,needle){for(var i=0;i<haystack.length;++i){if(haystack[i]===needle){return i}}return-1}function wrapREGL(args){var config=parseArgs(args);if(!config){return null}var gl=config.gl;var glAttributes=gl.getContextAttributes();var contextLost=gl.isContextLost();var extensionState=createExtensionCache(gl,config);if(!extensionState){return null}var stringStore=createStringStore();var stats$$1=stats();var extensions=extensionState.extensions;var timer=createTimer(gl,extensions);var START_TIME=clock();var WIDTH=gl.drawingBufferWidth;var HEIGHT=gl.drawingBufferHeight;var contextState={tick:0,time:0,viewportWidth:WIDTH,viewportHeight:HEIGHT,framebufferWidth:WIDTH,framebufferHeight:HEIGHT,drawingBufferWidth:WIDTH,drawingBufferHeight:HEIGHT,pixelRatio:config.pixelRatio};var uniformState={};var drawState={elements:null,primitive:4,count:-1,offset:0,instances:-1};var limits=wrapLimits(gl,extensions);var bufferState=wrapBufferState(gl,stats$$1,config,destroyBuffer);var attributeState=wrapAttributeState(gl,extensions,limits,stats$$1,bufferState);function destroyBuffer(buffer){return attributeState.destroyBuffer(buffer)}var elementState=wrapElementsState(gl,extensions,bufferState,stats$$1);var shaderState=wrapShaderState(gl,stringStore,stats$$1,config);var textureState=createTextureSet(gl,extensions,limits,(function(){core.procs.poll()}),contextState,stats$$1,config);var renderbufferState=wrapRenderbuffers(gl,extensions,limits,stats$$1,config);var framebufferState=wrapFBOState(gl,extensions,limits,textureState,renderbufferState,stats$$1);var core=reglCore(gl,stringStore,extensions,limits,bufferState,elementState,textureState,framebufferState,uniformState,attributeState,shaderState,drawState,contextState,timer,config);var readPixels=wrapReadPixels(gl,framebufferState,core.procs.poll,contextState,glAttributes,extensions,limits);var nextState=core.next;var canvas=gl.canvas;var rafCallbacks=[];var lossCallbacks=[];var restoreCallbacks=[];var destroyCallbacks=[config.onDestroy];var activeRAF=null;function handleRAF(){if(rafCallbacks.length===0){if(timer){timer.update()}activeRAF=null;return}activeRAF=raf.next(handleRAF);poll();for(var i=rafCallbacks.length-1;i>=0;--i){var cb=rafCallbacks[i];if(cb){cb(contextState,null,0)}}gl.flush();if(timer){timer.update()}}function startRAF(){if(!activeRAF&&rafCallbacks.length>0){activeRAF=raf.next(handleRAF)}}function stopRAF(){if(activeRAF){raf.cancel(handleRAF);activeRAF=null}}function handleContextLoss(event){event.preventDefault();contextLost=true;stopRAF();lossCallbacks.forEach((function(cb){cb()}))}function handleContextRestored(event){gl.getError();contextLost=false;extensionState.restore();shaderState.restore();bufferState.restore();textureState.restore();renderbufferState.restore();framebufferState.restore();attributeState.restore();if(timer){timer.restore()}core.procs.refresh();startRAF();restoreCallbacks.forEach((function(cb){cb()}))}if(canvas){canvas.addEventListener(CONTEXT_LOST_EVENT,handleContextLoss,false);canvas.addEventListener(CONTEXT_RESTORED_EVENT,handleContextRestored,false)}function destroy(){rafCallbacks.length=0;stopRAF();if(canvas){canvas.removeEventListener(CONTEXT_LOST_EVENT,handleContextLoss);canvas.removeEventListener(CONTEXT_RESTORED_EVENT,handleContextRestored)}shaderState.clear();framebufferState.clear();renderbufferState.clear();textureState.clear();elementState.clear();bufferState.clear();attributeState.clear();if(timer){timer.clear()}destroyCallbacks.forEach((function(cb){cb()}))}function compileProcedure(options){check$1(!!options,"invalid args to regl({...})");check$1.type(options,"object","invalid args to regl({...})");function flattenNestedOptions(options){var result=extend({},options);delete result.uniforms;delete result.attributes;delete result.context;delete result.vao;if("stencil"in result&&result.stencil.op){result.stencil.opBack=result.stencil.opFront=result.stencil.op;delete result.stencil.op}function merge(name){if(name in result){var child=result[name];delete result[name];Object.keys(child).forEach((function(prop){result[name+"."+prop]=child[prop]}))}}merge("blend");merge("depth");merge("cull");merge("stencil");merge("polygonOffset");merge("scissor");merge("sample");if("vao"in options){result.vao=options.vao}return result}function separateDynamic(object,useArrays){var staticItems={};var dynamicItems={};Object.keys(object).forEach((function(option){var value=object[option];if(dynamic.isDynamic(value)){dynamicItems[option]=dynamic.unbox(value,option);return}else if(useArrays&&Array.isArray(value)){for(var i=0;i<value.length;++i){if(dynamic.isDynamic(value[i])){dynamicItems[option]=dynamic.unbox(value,option);return}}}staticItems[option]=value}));return{dynamic:dynamicItems,static:staticItems}}var context=separateDynamic(options.context||{},true);var uniforms=separateDynamic(options.uniforms||{},true);var attributes=separateDynamic(options.attributes||{},false);var opts=separateDynamic(flattenNestedOptions(options),false);var stats$$1={gpuTime:0,cpuTime:0,count:0};var compiled=core.compile(opts,attributes,uniforms,context,stats$$1);var draw=compiled.draw;var batch=compiled.batch;var scope=compiled.scope;var EMPTY_ARRAY=[];function reserve(count){while(EMPTY_ARRAY.length<count){EMPTY_ARRAY.push(null)}return EMPTY_ARRAY}function REGLCommand(args,body){var i;if(contextLost){check$1.raise("context lost")}if(typeof args==="function"){return scope.call(this,null,args,0)}else if(typeof body==="function"){if(typeof args==="number"){for(i=0;i<args;++i){scope.call(this,null,body,i)}}else if(Array.isArray(args)){for(i=0;i<args.length;++i){scope.call(this,args[i],body,i)}}else{return scope.call(this,args,body,0)}}else if(typeof args==="number"){if(args>0){return batch.call(this,reserve(args|0),args|0)}}else if(Array.isArray(args)){if(args.length){return batch.call(this,args,args.length)}}else{return draw.call(this,args)}}return extend(REGLCommand,{stats:stats$$1,destroy:function(){compiled.destroy()}})}var setFBO=framebufferState.setFBO=compileProcedure({framebuffer:dynamic.define.call(null,DYN_PROP,"framebuffer")});function clearImpl(_,options){var clearFlags=0;core.procs.poll();var c=options.color;if(c){gl.clearColor(+c[0]||0,+c[1]||0,+c[2]||0,+c[3]||0);clearFlags|=GL_COLOR_BUFFER_BIT}if("depth"in options){gl.clearDepth(+options.depth);clearFlags|=GL_DEPTH_BUFFER_BIT}if("stencil"in options){gl.clearStencil(options.stencil|0);clearFlags|=GL_STENCIL_BUFFER_BIT}check$1(!!clearFlags,"called regl.clear with no buffer specified");gl.clear(clearFlags)}function clear(options){check$1(typeof options==="object"&&options,"regl.clear() takes an object as input");if("framebuffer"in options){if(options.framebuffer&&options.framebuffer_reglType==="framebufferCube"){for(var i=0;i<6;++i){setFBO(extend({framebuffer:options.framebuffer.faces[i]},options),clearImpl)}}else{setFBO(options,clearImpl)}}else{clearImpl(null,options)}}function frame(cb){check$1.type(cb,"function","regl.frame() callback must be a function");rafCallbacks.push(cb);function cancel(){var i=find(rafCallbacks,cb);check$1(i>=0,"cannot cancel a frame twice");function pendingCancel(){var index=find(rafCallbacks,pendingCancel);rafCallbacks[index]=rafCallbacks[rafCallbacks.length-1];rafCallbacks.length-=1;if(rafCallbacks.length<=0){stopRAF()}}rafCallbacks[i]=pendingCancel}startRAF();return{cancel:cancel}}function pollViewport(){var viewport=nextState.viewport;var scissorBox=nextState.scissor_box;viewport[0]=viewport[1]=scissorBox[0]=scissorBox[1]=0;contextState.viewportWidth=contextState.framebufferWidth=contextState.drawingBufferWidth=viewport[2]=scissorBox[2]=gl.drawingBufferWidth;contextState.viewportHeight=contextState.framebufferHeight=contextState.drawingBufferHeight=viewport[3]=scissorBox[3]=gl.drawingBufferHeight}function poll(){contextState.tick+=1;contextState.time=now();pollViewport();core.procs.poll()}function refresh(){textureState.refresh();pollViewport();core.procs.refresh();if(timer){timer.update()}}function now(){return(clock()-START_TIME)/1e3}refresh();function addListener(event,callback){check$1.type(callback,"function","listener callback must be a function");var callbacks;switch(event){case"frame":return frame(callback);case"lost":callbacks=lossCallbacks;break;case"restore":callbacks=restoreCallbacks;break;case"destroy":callbacks=destroyCallbacks;break;default:check$1.raise("invalid event, must be one of frame,lost,restore,destroy")}callbacks.push(callback);return{cancel:function(){for(var i=0;i<callbacks.length;++i){if(callbacks[i]===callback){callbacks[i]=callbacks[callbacks.length-1];callbacks.pop();return}}}}}var regl=extend(compileProcedure,{clear:clear,prop:dynamic.define.bind(null,DYN_PROP),context:dynamic.define.bind(null,DYN_CONTEXT),this:dynamic.define.bind(null,DYN_STATE),draw:compileProcedure({}),buffer:function(options){return bufferState.create(options,GL_ARRAY_BUFFER,false,false)},elements:function(options){return elementState.create(options,false)},texture:textureState.create2D,cube:textureState.createCube,renderbuffer:renderbufferState.create,framebuffer:framebufferState.create,framebufferCube:framebufferState.createCube,vao:attributeState.createVAO,attributes:glAttributes,frame:frame,on:addListener,limits:limits,hasExtension:function(name){return limits.extensions.indexOf(name.toLowerCase())>=0},read:readPixels,destroy:destroy,_gl:gl,_refresh:refresh,poll:function(){poll();if(timer){timer.update()}},now:now,stats:stats$$1});config.onDone(null,regl);return regl}return wrapREGL}))},{}],126:[function(require,module,exports){(function(global){(function(){module.exports=global.performance&&global.performance.now?function now(){return performance.now()}:Date.now||function now(){return+new Date}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],127:[function(require,module,exports){var buffer=require("buffer");var Buffer=buffer.Buffer;function copyProps(src,dst){for(var key in src){dst[key]=src[key]}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer}else{copyProps(buffer,exports);exports.Buffer=SafeBuffer}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length)}copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==="number"){throw new TypeError("Argument must not be a number")}return Buffer(arg,encodingOrOffset,length)};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==="string"){buf.fill(fill,encoding)}else{buf.fill(fill)}}else{buf.fill(0)}return buf};SafeBuffer.allocUnsafe=function(size){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}return Buffer(size)};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=="number"){throw new TypeError("Argument must be a number")}return buffer.SlowBuffer(size)}},{buffer:27}],128:[function(require,module,exports){"use strict";module.exports=require("./lib/index")},{"./lib/index":133}],129:[function(require,module,exports){"use strict";var randomFromSeed=require("./random/random-from-seed");var ORIGINAL="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";var alphabet;var previousSeed;var shuffled;function reset(){shuffled=false}function setCharacters(_alphabet_){if(!_alphabet_){if(alphabet!==ORIGINAL){alphabet=ORIGINAL;reset()}return}if(_alphabet_===alphabet){return}if(_alphabet_.length!==ORIGINAL.length){throw new Error("Custom alphabet for shortid must be "+ORIGINAL.length+" unique characters. You submitted "+_alphabet_.length+" characters: "+_alphabet_)}var unique=_alphabet_.split("").filter((function(item,ind,arr){return ind!==arr.lastIndexOf(item)}));if(unique.length){throw new Error("Custom alphabet for shortid must be "+ORIGINAL.length+" unique characters. These characters were not unique: "+unique.join(", "))}alphabet=_alphabet_;reset()}function characters(_alphabet_){setCharacters(_alphabet_);return alphabet}function setSeed(seed){randomFromSeed.seed(seed);if(previousSeed!==seed){reset();previousSeed=seed}}function shuffle(){if(!alphabet){setCharacters(ORIGINAL)}var sourceArray=alphabet.split("");var targetArray=[];var r=randomFromSeed.nextValue();var characterIndex;while(sourceArray.length>0){r=randomFromSeed.nextValue();characterIndex=Math.floor(r*sourceArray.length);targetArray.push(sourceArray.splice(characterIndex,1)[0])}return targetArray.join("")}function getShuffled(){if(shuffled){return shuffled}shuffled=shuffle();return shuffled}function lookup(index){var alphabetShuffled=getShuffled();return alphabetShuffled[index]}module.exports={characters:characters,seed:setSeed,lookup:lookup,shuffled:getShuffled}},{"./random/random-from-seed":136}],130:[function(require,module,exports){"use strict";var encode=require("./encode");var alphabet=require("./alphabet");var REDUCE_TIME=1459707606518;var version=6;var counter;var previousSeconds;function build(clusterWorkerId){var str="";var seconds=Math.floor((Date.now()-REDUCE_TIME)*.001);if(seconds===previousSeconds){counter++}else{counter=0;previousSeconds=seconds}str=str+encode(alphabet.lookup,version);str=str+encode(alphabet.lookup,clusterWorkerId);if(counter>0){str=str+encode(alphabet.lookup,counter)}str=str+encode(alphabet.lookup,seconds);return str}module.exports=build},{"./alphabet":129,"./encode":132}],131:[function(require,module,exports){"use strict";var alphabet=require("./alphabet");function decode(id){var characters=alphabet.shuffled();return{version:characters.indexOf(id.substr(0,1))&15,worker:characters.indexOf(id.substr(1,1))&15}}module.exports=decode},{"./alphabet":129}],132:[function(require,module,exports){"use strict";var randomByte=require("./random/random-byte");function encode(lookup,number){var loopCounter=0;var done;var str="";while(!done){str=str+lookup(number>>4*loopCounter&15|randomByte());done=number<Math.pow(16,loopCounter+1);loopCounter++}return str}module.exports=encode},{"./random/random-byte":135}],133:[function(require,module,exports){"use strict";var alphabet=require("./alphabet");var encode=require("./encode");var decode=require("./decode");var build=require("./build");var isValid=require("./is-valid");var clusterWorkerId=require("./util/cluster-worker-id")||0;function seed(seedValue){alphabet.seed(seedValue);return module.exports}function worker(workerId){clusterWorkerId=workerId;return module.exports}function characters(newCharacters){if(newCharacters!==undefined){alphabet.characters(newCharacters)}return alphabet.shuffled()}function generate(){return build(clusterWorkerId)}module.exports=generate;module.exports.generate=generate;module.exports.seed=seed;module.exports.worker=worker;module.exports.characters=characters;module.exports.decode=decode;module.exports.isValid=isValid},{"./alphabet":129,"./build":130,"./decode":131,"./encode":132,"./is-valid":134,"./util/cluster-worker-id":137}],134:[function(require,module,exports){"use strict";var alphabet=require("./alphabet");function isShortId(id){if(!id||typeof id!=="string"||id.length<6){return false}var characters=alphabet.characters();var len=id.length;for(var i=0;i<len;i++){if(characters.indexOf(id[i])===-1){return false}}return true}module.exports=isShortId},{"./alphabet":129}],135:[function(require,module,exports){"use strict";var crypto=typeof window==="object"&&(window.crypto||window.msCrypto);function randomByte(){if(!crypto||!crypto.getRandomValues){return Math.floor(Math.random()*256)&48}var dest=new Uint8Array(1);crypto.getRandomValues(dest);return dest[0]&48}module.exports=randomByte},{}],136:[function(require,module,exports){"use strict";var seed=1;function getNextValue(){seed=(seed*9301+49297)%233280;return seed/233280}function setSeed(_seed_){seed=_seed_}module.exports={nextValue:getNextValue,seed:setSeed}},{}],137:[function(require,module,exports){"use strict";module.exports=0},{}],138:[function(require,module,exports){(function(Buffer){(function(){module.exports=Peer;var debug=require("debug")("simple-peer");var getBrowserRTC=require("get-browser-rtc");var inherits=require("inherits");var randombytes=require("randombytes");var stream=require("readable-stream");var MAX_BUFFERED_AMOUNT=64*1024;inherits(Peer,stream.Duplex);function Peer(opts){var self=this;if(!(self instanceof Peer))return new Peer(opts);self._id=randombytes(4).toString("hex").slice(0,7);self._debug("new peer %o",opts);opts=Object.assign({allowHalfOpen:false},opts);stream.Duplex.call(self,opts);self.channelName=opts.initiator?opts.channelName||randombytes(20).toString("hex"):null;self._isChromium=typeof window!=="undefined"&&!!window.webkitRTCPeerConnection;self.initiator=opts.initiator||false;self.channelConfig=opts.channelConfig||Peer.channelConfig;self.config=opts.config||Peer.config;self.constraints=self._transformConstraints(opts.constraints||Peer.constraints);self.offerConstraints=self._transformConstraints(opts.offerConstraints||{});self.answerConstraints=self._transformConstraints(opts.answerConstraints||{});self.sdpTransform=opts.sdpTransform||function(sdp){return sdp};self.streams=opts.streams||(opts.stream?[opts.stream]:[]);self.trickle=opts.trickle!==undefined?opts.trickle:true;self.destroyed=false;self.connected=false;self.remoteAddress=undefined;self.remoteFamily=undefined;self.remotePort=undefined;self.localAddress=undefined;self.localPort=undefined;self._wrtc=opts.wrtc&&typeof opts.wrtc==="object"?opts.wrtc:getBrowserRTC();if(!self._wrtc){if(typeof window==="undefined"){throw makeError("No WebRTC support: Specify `opts.wrtc` option in this environment","ERR_WEBRTC_SUPPORT")}else{throw makeError("No WebRTC support: Not a supported browser","ERR_WEBRTC_SUPPORT")}}self._pcReady=false;self._channelReady=false;self._iceComplete=false;self._channel=null;self._pendingCandidates=[];self._isNegotiating=false;self._batchedNegotiation=false;self._queuedNegotiation=false;self._sendersAwaitingStable=[];self._senderMap=new WeakMap;self._remoteTracks=[];self._remoteStreams=[];self._chunk=null;self._cb=null;self._interval=null;self._pc=new self._wrtc.RTCPeerConnection(self.config,self.constraints);self._isReactNativeWebrtc=typeof self._pc._peerConnectionId==="number";self._pc.oniceconnectionstatechange=function(){self._onIceStateChange()};self._pc.onicegatheringstatechange=function(){self._onIceStateChange()};self._pc.onsignalingstatechange=function(){self._onSignalingStateChange()};self._pc.onicecandidate=function(event){self._onIceCandidate(event)};if(self.initiator){self._setupData({channel:self._pc.createDataChannel(self.channelName,self.channelConfig)})}else{self._pc.ondatachannel=function(event){self._setupData(event)}}if("addTrack"in self._pc){if(self.streams){self.streams.forEach((function(stream){self.addStream(stream)}))}self._pc.ontrack=function(event){self._onTrack(event)}}if(self.initiator){self._needsNegotiation()}self._onFinishBound=function(){self._onFinish()};self.once("finish",self._onFinishBound)}Peer.WEBRTC_SUPPORT=!!getBrowserRTC();Peer.config={iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:global.stun.twilio.com:3478?transport=udp"}]};Peer.constraints={};Peer.channelConfig={};Object.defineProperty(Peer.prototype,"bufferSize",{get:function(){var self=this;return self._channel&&self._channel.bufferedAmount||0}});Peer.prototype.address=function(){var self=this;return{port:self.localPort,family:"IPv4",address:self.localAddress}};Peer.prototype.signal=function(data){var self=this;if(self.destroyed)throw makeError("cannot signal after peer is destroyed","ERR_SIGNALING");if(typeof data==="string"){try{data=JSON.parse(data)}catch(err){data={}}}self._debug("signal()");if(data.renegotiate){self._debug("got request to renegotiate");self._needsNegotiation()}if(data.candidate){if(self._pc.remoteDescription&&self._pc.remoteDescription.type)self._addIceCandidate(data.candidate);else self._pendingCandidates.push(data.candidate)}if(data.sdp){self._pc.setRemoteDescription(new self._wrtc.RTCSessionDescription(data),(function(){if(self.destroyed)return;self._pendingCandidates.forEach((function(candidate){self._addIceCandidate(candidate)}));self._pendingCandidates=[];if(self._pc.remoteDescription.type==="offer")self._createAnswer()}),(function(err){self.destroy(makeError(err,"ERR_SET_REMOTE_DESCRIPTION"))}))}if(!data.sdp&&!data.candidate&&!data.renegotiate){self.destroy(makeError("signal() called with invalid signal data","ERR_SIGNALING"))}};Peer.prototype._addIceCandidate=function(candidate){var self=this;try{self._pc.addIceCandidate(new self._wrtc.RTCIceCandidate(candidate),noop,(function(err){self.destroy(makeError(err,"ERR_ADD_ICE_CANDIDATE"))}))}catch(err){self.destroy(makeError("error adding candidate: "+err.message,"ERR_ADD_ICE_CANDIDATE"))}};Peer.prototype.send=function(chunk){var self=this;self._channel.send(chunk)};Peer.prototype.addStream=function(stream){var self=this;self._debug("addStream()");stream.getTracks().forEach((function(track){self.addTrack(track,stream)}))};Peer.prototype.addTrack=function(track,stream){var self=this;self._debug("addTrack()");var sender=self._pc.addTrack(track,stream);var submap=self._senderMap.get(track)||new WeakMap;submap.set(stream,sender);self._senderMap.set(track,submap);self._needsNegotiation()};Peer.prototype.removeTrack=function(track,stream){var self=this;self._debug("removeSender()");var submap=self._senderMap.get(track);var sender=submap?submap.get(stream):null;if(!sender){self.destroy(new Error("Cannot remove track that was never added."))}try{self._pc.removeTrack(sender)}catch(err){if(err.name==="NS_ERROR_UNEXPECTED"){self._sendersAwaitingStable.push(sender)}else{self.destroy(err)}}};Peer.prototype.removeStream=function(stream){var self=this;self._debug("removeSenders()");stream.getTracks().forEach((function(track){self.removeTrack(track,stream)}))};Peer.prototype._needsNegotiation=function(){var self=this;self._debug("_needsNegotiation");if(self._batchedNegotiation)return;self._batchedNegotiation=true;setTimeout((function(){self._batchedNegotiation=false;self._debug("starting batched negotiation");self.negotiate()}),0)};Peer.prototype.negotiate=function(){var self=this;if(self.initiator){if(self._isNegotiating){self._queuedNegotiation=true;self._debug("already negotiating, queueing")}else{self._debug("start negotiation");self._createOffer()}}else{self._debug("requesting negotiation from initiator");self.emit("signal",{renegotiate:true})}self._isNegotiating=true};Peer.prototype.destroy=function(err){var self=this;self._destroy(err,(function(){}))};Peer.prototype._destroy=function(err,cb){var self=this;if(self.destroyed)return;self._debug("destroy (error: %s)",err&&(err.message||err));self.readable=self.writable=false;if(!self._readableState.ended)self.push(null);if(!self._writableState.finished)self.end();self.destroyed=true;self.connected=false;self._pcReady=false;self._channelReady=false;self._remoteTracks=null;self._remoteStreams=null;self._senderMap=null;clearInterval(self._interval);self._interval=null;self._chunk=null;self._cb=null;if(self._onFinishBound)self.removeListener("finish",self._onFinishBound);self._onFinishBound=null;if(self._channel){try{self._channel.close()}catch(err){}self._channel.onmessage=null;self._channel.onopen=null;self._channel.onclose=null;self._channel.onerror=null}if(self._pc){try{self._pc.close()}catch(err){}self._pc.oniceconnectionstatechange=null;self._pc.onicegatheringstatechange=null;self._pc.onsignalingstatechange=null;self._pc.onicecandidate=null;if("addTrack"in self._pc){self._pc.ontrack=null}self._pc.ondatachannel=null}self._pc=null;self._channel=null;if(err)self.emit("error",err);self.emit("close");cb()};Peer.prototype._setupData=function(event){var self=this;if(!event.channel){return self.destroy(makeError("Data channel event is missing `channel` property","ERR_DATA_CHANNEL"))}self._channel=event.channel;self._channel.binaryType="arraybuffer";if(typeof self._channel.bufferedAmountLowThreshold==="number"){self._channel.bufferedAmountLowThreshold=MAX_BUFFERED_AMOUNT}self.channelName=self._channel.label;self._channel.onmessage=function(event){self._onChannelMessage(event)};self._channel.onbufferedamountlow=function(){self._onChannelBufferedAmountLow()};self._channel.onopen=function(){self._onChannelOpen()};self._channel.onclose=function(){self._onChannelClose()};self._channel.onerror=function(err){self.destroy(makeError(err,"ERR_DATA_CHANNEL"))}};Peer.prototype._read=function(){};Peer.prototype._write=function(chunk,encoding,cb){var self=this;if(self.destroyed)return cb(makeError("cannot write after peer is destroyed","ERR_DATA_CHANNEL"));if(self.connected){try{self.send(chunk)}catch(err){return self.destroy(makeError(err,"ERR_DATA_CHANNEL"))}if(self._channel.bufferedAmount>MAX_BUFFERED_AMOUNT){self._debug("start backpressure: bufferedAmount %d",self._channel.bufferedAmount);self._cb=cb}else{cb(null)}}else{self._debug("write before connect");self._chunk=chunk;self._cb=cb}};Peer.prototype._onFinish=function(){var self=this;if(self.destroyed)return;if(self.connected){destroySoon()}else{self.once("connect",destroySoon)}function destroySoon(){setTimeout((function(){self.destroy()}),1e3)}};Peer.prototype._createOffer=function(){var self=this;if(self.destroyed)return;self._pc.createOffer((function(offer){if(self.destroyed)return;offer.sdp=self.sdpTransform(offer.sdp);self._pc.setLocalDescription(offer,onSuccess,onError);function onSuccess(){self._debug("createOffer success");if(self.destroyed)return;if(self.trickle||self._iceComplete)sendOffer();else self.once("_iceComplete",sendOffer)}function onError(err){self.destroy(makeError(err,"ERR_SET_LOCAL_DESCRIPTION"))}function sendOffer(){var signal=self._pc.localDescription||offer;self._debug("signal");self.emit("signal",{type:signal.type,sdp:signal.sdp})}}),(function(err){self.destroy(makeError(err,"ERR_CREATE_OFFER"))}),self.offerConstraints)};Peer.prototype._createAnswer=function(){var self=this;if(self.destroyed)return;self._pc.createAnswer((function(answer){if(self.destroyed)return;answer.sdp=self.sdpTransform(answer.sdp);self._pc.setLocalDescription(answer,onSuccess,onError);function onSuccess(){if(self.destroyed)return;if(self.trickle||self._iceComplete)sendAnswer();else self.once("_iceComplete",sendAnswer)}function onError(err){self.destroy(makeError(err,"ERR_SET_LOCAL_DESCRIPTION"))}function sendAnswer(){var signal=self._pc.localDescription||answer;self._debug("signal");self.emit("signal",{type:signal.type,sdp:signal.sdp})}}),(function(err){self.destroy(makeError(err,"ERR_CREATE_ANSWER"))}),self.answerConstraints)};Peer.prototype._onIceStateChange=function(){var self=this;if(self.destroyed)return;var iceConnectionState=self._pc.iceConnectionState;var iceGatheringState=self._pc.iceGatheringState;self._debug("iceStateChange (connection: %s) (gathering: %s)",iceConnectionState,iceGatheringState);self.emit("iceStateChange",iceConnectionState,iceGatheringState);if(iceConnectionState==="connected"||iceConnectionState==="completed"){self._pcReady=true;self._maybeReady()}if(iceConnectionState==="failed"){self.destroy(makeError("Ice connection failed.","ERR_ICE_CONNECTION_FAILURE"))}if(iceConnectionState==="closed"){self.destroy(new Error("Ice connection closed."))}};Peer.prototype.getStats=function(cb){var self=this;if(self._pc.getStats.length===0){self._pc.getStats().then((function(res){var reports=[];res.forEach((function(report){reports.push(report)}));cb(null,reports)}),(function(err){cb(err)}))}else if(self._isReactNativeWebrtc){self._pc.getStats(null,(function(res){var reports=[];res.forEach((function(report){reports.push(report)}));cb(null,reports)}),(function(err){cb(err)}))}else if(self._pc.getStats.length>0){self._pc.getStats((function(res){if(self.destroyed)return;var reports=[];res.result().forEach((function(result){var report={};result.names().forEach((function(name){report[name]=result.stat(name)}));report.id=result.id;report.type=result.type;report.timestamp=result.timestamp;reports.push(report)}));cb(null,reports)}),(function(err){cb(err)}))}else{cb(null,[])}};Peer.prototype._maybeReady=function(){var self=this;self._debug("maybeReady pc %s channel %s",self._pcReady,self._channelReady);if(self.connected||self._connecting||!self._pcReady||!self._channelReady)return;self._connecting=true;function findCandidatePair(){if(self.destroyed)return;self.getStats((function(err,items){if(self.destroyed)return;if(err)items=[];var remoteCandidates={};var localCandidates={};var candidatePairs={};var foundSelectedCandidatePair=false;items.forEach((function(item){if(item.type==="remotecandidate"||item.type==="remote-candidate"){remoteCandidates[item.id]=item}if(item.type==="localcandidate"||item.type==="local-candidate"){localCandidates[item.id]=item}if(item.type==="candidatepair"||item.type==="candidate-pair"){candidatePairs[item.id]=item}}));items.forEach((function(item){if(item.type==="transport"&&item.selectedCandidatePairId){setSelectedCandidatePair(candidatePairs[item.selectedCandidatePairId])}if(item.type==="googCandidatePair"&&item.googActiveConnection==="true"||(item.type==="candidatepair"||item.type==="candidate-pair")&&item.selected){setSelectedCandidatePair(item)}}));function setSelectedCandidatePair(selectedCandidatePair){foundSelectedCandidatePair=true;var local=localCandidates[selectedCandidatePair.localCandidateId];if(local&&local.ip){self.localAddress=local.ip;self.localPort=Number(local.port)}else if(local&&local.ipAddress){self.localAddress=local.ipAddress;self.localPort=Number(local.portNumber)}else if(typeof selectedCandidatePair.googLocalAddress==="string"){local=selectedCandidatePair.googLocalAddress.split(":");self.localAddress=local[0];self.localPort=Number(local[1])}var remote=remoteCandidates[selectedCandidatePair.remoteCandidateId];if(remote&&remote.ip){self.remoteAddress=remote.ip;self.remotePort=Number(remote.port)}else if(remote&&remote.ipAddress){self.remoteAddress=remote.ipAddress;self.remotePort=Number(remote.portNumber)}else if(typeof selectedCandidatePair.googRemoteAddress==="string"){remote=selectedCandidatePair.googRemoteAddress.split(":");self.remoteAddress=remote[0];self.remotePort=Number(remote[1])}self.remoteFamily="IPv4";self._debug("connect local: %s:%s remote: %s:%s",self.localAddress,self.localPort,self.remoteAddress,self.remotePort)}if(!foundSelectedCandidatePair&&(!Object.keys(candidatePairs).length||Object.keys(localCandidates).length)){setTimeout(findCandidatePair,100);return}else{self._connecting=false;self.connected=true}if(self._chunk){try{self.send(self._chunk)}catch(err){return self.destroy(makeError(err,"ERR_DATA_CHANNEL"))}self._chunk=null;self._debug('sent chunk from "write before connect"');var cb=self._cb;self._cb=null;cb(null)}if(typeof self._channel.bufferedAmountLowThreshold!=="number"){self._interval=setInterval((function(){self._onInterval()}),150);if(self._interval.unref)self._interval.unref()}self._debug("connect");self.emit("connect")}))}findCandidatePair()};Peer.prototype._onInterval=function(){var self=this;if(!self._cb||!self._channel||self._channel.bufferedAmount>MAX_BUFFERED_AMOUNT){return}self._onChannelBufferedAmountLow()};Peer.prototype._onSignalingStateChange=function(){var self=this;if(self.destroyed)return;if(self._pc.signalingState==="stable"){self._isNegotiating=false;self._debug("flushing sender queue",self._sendersAwaitingStable);self._sendersAwaitingStable.forEach((function(sender){self.removeTrack(sender);self._queuedNegotiation=true}));self._sendersAwaitingStable=[];if(self._queuedNegotiation){self._debug("flushing negotiation queue");self._queuedNegotiation=false;self._needsNegotiation()}self._debug("negotiate");self.emit("negotiate")}self._debug("signalingStateChange %s",self._pc.signalingState);self.emit("signalingStateChange",self._pc.signalingState)};Peer.prototype._onIceCandidate=function(event){var self=this;if(self.destroyed)return;if(event.candidate&&self.trickle){self.emit("signal",{candidate:{candidate:event.candidate.candidate,sdpMLineIndex:event.candidate.sdpMLineIndex,sdpMid:event.candidate.sdpMid}})}else if(!event.candidate){self._iceComplete=true;self.emit("_iceComplete")}};Peer.prototype._onChannelMessage=function(event){var self=this;if(self.destroyed)return;var data=event.data;if(data instanceof ArrayBuffer)data=Buffer.from(data);self.push(data)};Peer.prototype._onChannelBufferedAmountLow=function(){var self=this;if(self.destroyed||!self._cb)return;self._debug("ending backpressure: bufferedAmount %d",self._channel.bufferedAmount);var cb=self._cb;self._cb=null;cb(null)};Peer.prototype._onChannelOpen=function(){var self=this;if(self.connected||self.destroyed)return;self._debug("on channel open");self._channelReady=true;self._maybeReady()};Peer.prototype._onChannelClose=function(){var self=this;if(self.destroyed)return;self._debug("on channel close");self.destroy()};Peer.prototype._onTrack=function(event){var self=this;if(self.destroyed)return;event.streams.forEach((function(eventStream){self._debug("on track");self.emit("track",event.track,eventStream);self._remoteTracks.push({track:event.track,stream:eventStream});if(self._remoteStreams.some((function(remoteStream){return remoteStream.id===eventStream.id})))return;self._remoteStreams.push(eventStream);setTimeout((function(){self.emit("stream",eventStream)}),0)}))};Peer.prototype._debug=function(){var self=this;var args=[].slice.call(arguments);args[0]="["+self._id+"] "+args[0];debug.apply(null,args)};Peer.prototype._transformConstraints=function(constraints){var self=this;if(Object.keys(constraints).length===0){return constraints}if((constraints.mandatory||constraints.optional)&&!self._isChromium){var newConstraints=Object.assign({},constraints.optional,constraints.mandatory);if(newConstraints.OfferToReceiveVideo!==undefined){newConstraints.offerToReceiveVideo=newConstraints.OfferToReceiveVideo;delete newConstraints["OfferToReceiveVideo"]}if(newConstraints.OfferToReceiveAudio!==undefined){newConstraints.offerToReceiveAudio=newConstraints.OfferToReceiveAudio;delete newConstraints["OfferToReceiveAudio"]}return newConstraints}else if(!constraints.mandatory&&!constraints.optional&&self._isChromium){if(constraints.offerToReceiveVideo!==undefined){constraints.OfferToReceiveVideo=constraints.offerToReceiveVideo;delete constraints["offerToReceiveVideo"]}if(constraints.offerToReceiveAudio!==undefined){constraints.OfferToReceiveAudio=constraints.offerToReceiveAudio;delete constraints["offerToReceiveAudio"]}return{mandatory:constraints}}return constraints};function makeError(message,code){var err=new Error(message);err.code=code;return err}function noop(){}}).call(this)}).call(this,require("buffer").Buffer)},{buffer:27,debug:139,"get-browser-rtc":55,inherits:80,randombytes:115,"readable-stream":124}],139:[function(require,module,exports){(function(process){(function(){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();exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function useColors(){if(typeof window!=="undefined"&&window.process&&window.process.type==="renderer"){return true}if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)){return false}return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}exports.formatters.j=function(v){try{return JSON.stringify(v)}catch(err){return"[UnexpectedJSONParseError]: "+err.message}};function formatArgs(args){var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return;var c="color: "+this.color;args.splice(1,0,c,"color: inherit");var index=0;var lastC=0;args[0].replace(/%[a-zA-Z%]/g,(function(match){if("%%"===match)return;index++;if("%c"===match){lastC=index}}));args.splice(lastC,0,c)}function log(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){exports.storage.removeItem("debug")}else{exports.storage.debug=namespaces}}catch(e){}}function load(){var r;try{r=exports.storage.debug}catch(e){}if(!r&&typeof process!=="undefined"&&"env"in process){r=process.env.DEBUG}return r}exports.enable(load());function localstorage(){try{return window.localStorage}catch(e){}}}).call(this)}).call(this,require("_process"))},{"./debug":140,_process:112}],140:[function(require,module,exports){arguments[4][50][0].apply(exports,arguments)},{dup:50,ms:141}],141:[function(require,module,exports){arguments[4][51][0].apply(exports,arguments)},{dup:51}],142:[function(require,module,exports){var url=require("./url");var parser=require("socket.io-parser");var Manager=require("./manager");var debug=require("debug")("socket.io-client");module.exports=exports=lookup;var cache=exports.managers={};function lookup(uri,opts){if(typeof uri==="object"){opts=uri;uri=undefined}opts=opts||{};var parsed=url(uri);var source=parsed.source;var id=parsed.id;var path=parsed.path;var sameNamespace=cache[id]&&path in cache[id].nsps;var newConnection=opts.forceNew||opts["force new connection"]||false===opts.multiplex||sameNamespace;var io;if(newConnection){debug("ignoring socket cache for %s",source);io=Manager(source,opts)}else{if(!cache[id]){debug("new io instance for %s",source);cache[id]=Manager(source,opts)}io=cache[id]}if(parsed.query&&!opts.query){opts.query=parsed.query}return io.socket(parsed.path,opts)}exports.protocol=parser.protocol;exports.connect=lookup;exports.Manager=require("./manager");exports.Socket=require("./socket")},{"./manager":143,"./socket":145,"./url":146,debug:148,"socket.io-parser":153}],143:[function(require,module,exports){var eio=require("engine.io-client");var Socket=require("./socket");var Emitter=require("component-emitter");var parser=require("socket.io-parser");var on=require("./on");var bind=require("component-bind");var debug=require("debug")("socket.io-client:manager");var indexOf=require("indexof");var Backoff=require("backo2");var has=Object.prototype.hasOwnProperty;module.exports=Manager;function Manager(uri,opts){if(!(this instanceof Manager))return new Manager(uri,opts);if(uri&&"object"===typeof uri){opts=uri;uri=undefined}opts=opts||{};opts.path=opts.path||"/socket.io";this.nsps={};this.subs=[];this.opts=opts;this.reconnection(opts.reconnection!==false);this.reconnectionAttempts(opts.reconnectionAttempts||Infinity);this.reconnectionDelay(opts.reconnectionDelay||1e3);this.reconnectionDelayMax(opts.reconnectionDelayMax||5e3);this.randomizationFactor(opts.randomizationFactor||.5);this.backoff=new Backoff({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()});this.timeout(null==opts.timeout?2e4:opts.timeout);this.readyState="closed";this.uri=uri;this.connecting=[];this.lastPing=null;this.encoding=false;this.packetBuffer=[];var _parser=opts.parser||parser;this.encoder=new _parser.Encoder;this.decoder=new _parser.Decoder;this.autoConnect=opts.autoConnect!==false;if(this.autoConnect)this.open()}Manager.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var nsp in this.nsps){if(has.call(this.nsps,nsp)){this.nsps[nsp].emit.apply(this.nsps[nsp],arguments)}}};Manager.prototype.updateSocketIds=function(){for(var nsp in this.nsps){if(has.call(this.nsps,nsp)){this.nsps[nsp].id=this.generateId(nsp)}}};Manager.prototype.generateId=function(nsp){return(nsp==="/"?"":nsp+"#")+this.engine.id};Emitter(Manager.prototype);Manager.prototype.reconnection=function(v){if(!arguments.length)return this._reconnection;this._reconnection=!!v;return this};Manager.prototype.reconnectionAttempts=function(v){if(!arguments.length)return this._reconnectionAttempts;this._reconnectionAttempts=v;return this};Manager.prototype.reconnectionDelay=function(v){if(!arguments.length)return this._reconnectionDelay;this._reconnectionDelay=v;this.backoff&&this.backoff.setMin(v);return this};Manager.prototype.randomizationFactor=function(v){if(!arguments.length)return this._randomizationFactor;this._randomizationFactor=v;this.backoff&&this.backoff.setJitter(v);return this};Manager.prototype.reconnectionDelayMax=function(v){if(!arguments.length)return this._reconnectionDelayMax;this._reconnectionDelayMax=v;this.backoff&&this.backoff.setMax(v);return this};Manager.prototype.timeout=function(v){if(!arguments.length)return this._timeout;this._timeout=v;return this};Manager.prototype.maybeReconnectOnOpen=function(){if(!this.reconnecting&&this._reconnection&&this.backoff.attempts===0){this.reconnect()}};Manager.prototype.open=Manager.prototype.connect=function(fn,opts){debug("readyState %s",this.readyState);if(~this.readyState.indexOf("open"))return this;debug("opening %s",this.uri);this.engine=eio(this.uri,this.opts);var socket=this.engine;var self=this;this.readyState="opening";this.skipReconnect=false;var openSub=on(socket,"open",(function(){self.onopen();fn&&fn()}));var errorSub=on(socket,"error",(function(data){debug("connect_error");self.cleanup();self.readyState="closed";self.emitAll("connect_error",data);if(fn){var err=new Error("Connection error");err.data=data;fn(err)}else{self.maybeReconnectOnOpen()}}));if(false!==this._timeout){var timeout=this._timeout;debug("connect attempt will timeout after %d",timeout);if(timeout===0){openSub.destroy()}var timer=setTimeout((function(){debug("connect attempt timed out after %d",timeout);openSub.destroy();socket.close();socket.emit("error","timeout");self.emitAll("connect_timeout",timeout)}),timeout);this.subs.push({destroy:function(){clearTimeout(timer)}})}this.subs.push(openSub);this.subs.push(errorSub);return this};Manager.prototype.onopen=function(){debug("open");this.cleanup();this.readyState="open";this.emit("open");var socket=this.engine;this.subs.push(on(socket,"data",bind(this,"ondata")));this.subs.push(on(socket,"ping",bind(this,"onping")));this.subs.push(on(socket,"pong",bind(this,"onpong")));this.subs.push(on(socket,"error",bind(this,"onerror")));this.subs.push(on(socket,"close",bind(this,"onclose")));this.subs.push(on(this.decoder,"decoded",bind(this,"ondecoded")))};Manager.prototype.onping=function(){this.lastPing=new Date;this.emitAll("ping")};Manager.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)};Manager.prototype.ondata=function(data){this.decoder.add(data)};Manager.prototype.ondecoded=function(packet){this.emit("packet",packet)};Manager.prototype.onerror=function(err){debug("error",err);this.emitAll("error",err)};Manager.prototype.socket=function(nsp,opts){var socket=this.nsps[nsp];if(!socket){socket=new Socket(this,nsp,opts);this.nsps[nsp]=socket;var self=this;socket.on("connecting",onConnecting);socket.on("connect",(function(){socket.id=self.generateId(nsp)}));if(this.autoConnect){onConnecting()}}function onConnecting(){if(!~indexOf(self.connecting,socket)){self.connecting.push(socket)}}return socket};Manager.prototype.destroy=function(socket){var index=indexOf(this.connecting,socket);if(~index)this.connecting.splice(index,1);if(this.connecting.length)return;this.close()};Manager.prototype.packet=function(packet){debug("writing packet %j",packet);var self=this;if(packet.query&&packet.type===0)packet.nsp+="?"+packet.query;if(!self.encoding){self.encoding=true;this.encoder.encode(packet,(function(encodedPackets){for(var i=0;i<encodedPackets.length;i++){self.engine.write(encodedPackets[i],packet.options)}self.encoding=false;self.processPacketQueue()}))}else{self.packetBuffer.push(packet)}};Manager.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var pack=this.packetBuffer.shift();this.packet(pack)}};Manager.prototype.cleanup=function(){debug("cleanup");var subsLength=this.subs.length;for(var i=0;i<subsLength;i++){var sub=this.subs.shift();sub.destroy()}this.packetBuffer=[];this.encoding=false;this.lastPing=null;this.decoder.destroy()};Manager.prototype.close=Manager.prototype.disconnect=function(){debug("disconnect");this.skipReconnect=true;this.reconnecting=false;if("opening"===this.readyState){this.cleanup()}this.backoff.reset();this.readyState="closed";if(this.engine)this.engine.close()};Manager.prototype.onclose=function(reason){debug("onclose");this.cleanup();this.backoff.reset();this.readyState="closed";this.emit("close",reason);if(this._reconnection&&!this.skipReconnect){this.reconnect()}};Manager.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var self=this;if(this.backoff.attempts>=this._reconnectionAttempts){debug("reconnect failed");this.backoff.reset();this.emitAll("reconnect_failed");this.reconnecting=false}else{var delay=this.backoff.duration();debug("will wait %dms before reconnect attempt",delay);this.reconnecting=true;var timer=setTimeout((function(){if(self.skipReconnect)return;debug("attempting reconnect");self.emitAll("reconnect_attempt",self.backoff.attempts);self.emitAll("reconnecting",self.backoff.attempts);if(self.skipReconnect)return;self.open((function(err){if(err){debug("reconnect attempt error");self.reconnecting=false;self.reconnect();self.emitAll("reconnect_error",err.data)}else{debug("reconnect success");self.onreconnect()}}))}),delay);this.subs.push({destroy:function(){clearTimeout(timer)}})}};Manager.prototype.onreconnect=function(){var attempt=this.backoff.attempts;this.reconnecting=false;this.backoff.reset();this.updateSocketIds();this.emitAll("reconnect",attempt)}},{"./on":144,"./socket":145,backo2:21,"component-bind":34,"component-emitter":147,debug:148,"engine.io-client":39,indexof:79,"socket.io-parser":153}],144:[function(require,module,exports){module.exports=on;function on(obj,ev,fn){obj.on(ev,fn);return{destroy:function(){obj.removeListener(ev,fn)}}}},{}],145:[function(require,module,exports){var parser=require("socket.io-parser");var Emitter=require("component-emitter");var toArray=require("to-array");var on=require("./on");var bind=require("component-bind");var debug=require("debug")("socket.io-client:socket");var parseqs=require("parseqs");var hasBin=require("has-binary2");module.exports=exports=Socket;var events={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1};var emit=Emitter.prototype.emit;function Socket(io,nsp,opts){this.io=io;this.nsp=nsp;this.json=this;this.ids=0;this.acks={};this.receiveBuffer=[];this.sendBuffer=[];this.connected=false;this.disconnected=true;this.flags={};if(opts&&opts.query){this.query=opts.query}if(this.io.autoConnect)this.open()}Emitter(Socket.prototype);Socket.prototype.subEvents=function(){if(this.subs)return;var io=this.io;this.subs=[on(io,"open",bind(this,"onopen")),on(io,"packet",bind(this,"onpacket")),on(io,"close",bind(this,"onclose"))]};Socket.prototype.open=Socket.prototype.connect=function(){if(this.connected)return this;this.subEvents();if(!this.io.reconnecting)this.io.open();if("open"===this.io.readyState)this.onopen();this.emit("connecting");return this};Socket.prototype.send=function(){var args=toArray(arguments);args.unshift("message");this.emit.apply(this,args);return this};Socket.prototype.emit=function(ev){if(events.hasOwnProperty(ev)){emit.apply(this,arguments);return this}var args=toArray(arguments);var packet={type:(this.flags.binary!==undefined?this.flags.binary:hasBin(args))?parser.BINARY_EVENT:parser.EVENT,data:args};packet.options={};packet.options.compress=!this.flags||false!==this.flags.compress;if("function"===typeof args[args.length-1]){debug("emitting packet with ack id %d",this.ids);this.acks[this.ids]=args.pop();packet.id=this.ids++}if(this.connected){this.packet(packet)}else{this.sendBuffer.push(packet)}this.flags={};return this};Socket.prototype.packet=function(packet){packet.nsp=this.nsp;this.io.packet(packet)};Socket.prototype.onopen=function(){debug("transport is open - connecting");if("/"!==this.nsp){if(this.query){var query=typeof this.query==="object"?parseqs.encode(this.query):this.query;debug("sending connect packet with query %s",query);this.packet({type:parser.CONNECT,query:query})}else{this.packet({type:parser.CONNECT})}}};Socket.prototype.onclose=function(reason){debug("close (%s)",reason);this.connected=false;this.disconnected=true;delete this.id;this.emit("disconnect",reason)};Socket.prototype.onpacket=function(packet){var sameNamespace=packet.nsp===this.nsp;var rootNamespaceError=packet.type===parser.ERROR&&packet.nsp==="/";if(!sameNamespace&&!rootNamespaceError)return;switch(packet.type){case parser.CONNECT:this.onconnect();break;case parser.EVENT:this.onevent(packet);break;case parser.BINARY_EVENT:this.onevent(packet);break;case parser.ACK:this.onack(packet);break;case parser.BINARY_ACK:this.onack(packet);break;case parser.DISCONNECT:this.ondisconnect();break;case parser.ERROR:this.emit("error",packet.data);break}};Socket.prototype.onevent=function(packet){var args=packet.data||[];debug("emitting event %j",args);if(null!=packet.id){debug("attaching ack callback to event");args.push(this.ack(packet.id))}if(this.connected){emit.apply(this,args)}else{this.receiveBuffer.push(args)}};Socket.prototype.ack=function(id){var self=this;var sent=false;return function(){if(sent)return;sent=true;var args=toArray(arguments);debug("sending ack %j",args);self.packet({type:hasBin(args)?parser.BINARY_ACK:parser.ACK,id:id,data:args})}};Socket.prototype.onack=function(packet){var ack=this.acks[packet.id];if("function"===typeof ack){debug("calling ack %s with %j",packet.id,packet.data);ack.apply(this,packet.data);delete this.acks[packet.id]}else{debug("bad ack %s",packet.id)}};Socket.prototype.onconnect=function(){this.connected=true;this.disconnected=false;this.emit("connect");this.emitBuffered()};Socket.prototype.emitBuffered=function(){var i;for(i=0;i<this.receiveBuffer.length;i++){emit.apply(this,this.receiveBuffer[i])}this.receiveBuffer=[];for(i=0;i<this.sendBuffer.length;i++){this.packet(this.sendBuffer[i])}this.sendBuffer=[]};Socket.prototype.ondisconnect=function(){debug("server disconnect (%s)",this.nsp);this.destroy();this.onclose("io server disconnect")};Socket.prototype.destroy=function(){if(this.subs){for(var i=0;i<this.subs.length;i++){this.subs[i].destroy()}this.subs=null}this.io.destroy(this)};Socket.prototype.close=Socket.prototype.disconnect=function(){if(this.connected){debug("performing disconnect (%s)",this.nsp);this.packet({type:parser.DISCONNECT})}this.destroy();if(this.connected){this.onclose("io client disconnect")}return this};Socket.prototype.compress=function(compress){this.flags.compress=compress;return this};Socket.prototype.binary=function(binary){this.flags.binary=binary;return this}},{"./on":144,"component-bind":34,"component-emitter":147,debug:148,"has-binary2":56,parseqs:108,"socket.io-parser":153,"to-array":163}],146:[function(require,module,exports){var parseuri=require("parseuri");var debug=require("debug")("socket.io-client:url");module.exports=url;function url(uri,loc){var obj=uri;loc=loc||typeof location!=="undefined"&&location;if(null==uri)uri=loc.protocol+"//"+loc.host;if("string"===typeof uri){if("/"===uri.charAt(0)){if("/"===uri.charAt(1)){uri=loc.protocol+uri}else{uri=loc.host+uri}}if(!/^(https?|wss?):\/\//.test(uri)){debug("protocol-less url %s",uri);if("undefined"!==typeof loc){uri=loc.protocol+"//"+uri}else{uri="https://"+uri}}debug("parse %s",uri);obj=parseuri(uri)}if(!obj.port){if(/^(http|ws)$/.test(obj.protocol)){obj.port="80"}else if(/^(http|ws)s$/.test(obj.protocol)){obj.port="443"}}obj.path=obj.path||"/";var ipv6=obj.host.indexOf(":")!==-1;var host=ipv6?"["+obj.host+"]":obj.host;obj.id=obj.protocol+"://"+host+":"+obj.port;obj.href=obj.protocol+"://"+host+(loc&&loc.port===obj.port?"":":"+obj.port);return obj}},{debug:148,parseuri:109}],147:[function(require,module,exports){arguments[4][48][0].apply(exports,arguments)},{dup:48}],148:[function(require,module,exports){(function(process){(function(){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();exports.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function useColors(){if(typeof window!=="undefined"&&window.process&&window.process.type==="renderer"){return true}if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)){return false}return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}exports.formatters.j=function(v){try{return JSON.stringify(v)}catch(err){return"[UnexpectedJSONParseError]: "+err.message}};function formatArgs(args){var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return;var c="color: "+this.color;args.splice(1,0,c,"color: inherit");var index=0;var lastC=0;args[0].replace(/%[a-zA-Z%]/g,(function(match){if("%%"===match)return;index++;if("%c"===match){lastC=index}}));args.splice(lastC,0,c)}function log(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){exports.storage.removeItem("debug")}else{exports.storage.debug=namespaces}}catch(e){}}function load(){var r;try{r=exports.storage.debug}catch(e){}if(!r&&typeof process!=="undefined"&&"env"in process){r=process.env.DEBUG}return r}exports.enable(load());function localstorage(){try{return window.localStorage}catch(e){}}}).call(this)}).call(this,require("_process"))},{"./debug":149,_process:112}],149:[function(require,module,exports){arguments[4][50][0].apply(exports,arguments)},{dup:50,ms:151}],150:[function(require,module,exports){arguments[4][57][0].apply(exports,arguments)},{dup:57}],151:[function(require,module,exports){arguments[4][51][0].apply(exports,arguments)},{dup:51}],152:[function(require,module,exports){var isArray=require("isarray");var isBuf=require("./is-buffer");var toString=Object.prototype.toString;var withNativeBlob=typeof Blob==="function"||typeof Blob!=="undefined"&&toString.call(Blob)==="[object BlobConstructor]";var withNativeFile=typeof File==="function"||typeof File!=="undefined"&&toString.call(File)==="[object FileConstructor]";exports.deconstructPacket=function(packet){var buffers=[];var packetData=packet.data;var pack=packet;pack.data=_deconstructPacket(packetData,buffers);pack.attachments=buffers.length;return{packet:pack,buffers:buffers}};function _deconstructPacket(data,buffers){if(!data)return data;if(isBuf(data)){var placeholder={_placeholder:true,num:buffers.length};buffers.push(data);return placeholder}else if(isArray(data)){var newData=new Array(data.length);for(var i=0;i<data.length;i++){newData[i]=_deconstructPacket(data[i],buffers)}return newData}else if(typeof data==="object"&&!(data instanceof Date)){var newData={};for(var key in data){newData[key]=_deconstructPacket(data[key],buffers)}return newData}return data}exports.reconstructPacket=function(packet,buffers){packet.data=_reconstructPacket(packet.data,buffers);packet.attachments=undefined;return packet};function _reconstructPacket(data,buffers){if(!data)return data;if(data&&data._placeholder){return buffers[data.num]}else if(isArray(data)){for(var i=0;i<data.length;i++){data[i]=_reconstructPacket(data[i],buffers)}}else if(typeof data==="object"){for(var key in data){data[key]=_reconstructPacket(data[key],buffers)}}return data}exports.removeBlobs=function(data,callback){function _removeBlobs(obj,curKey,containingObject){if(!obj)return obj;if(withNativeBlob&&obj instanceof Blob||withNativeFile&&obj instanceof File){pendingBlobs++;var fileReader=new FileReader;fileReader.onload=function(){if(containingObject){containingObject[curKey]=this.result}else{bloblessData=this.result}if(!--pendingBlobs){callback(bloblessData)}};fileReader.readAsArrayBuffer(obj)}else if(isArray(obj)){for(var i=0;i<obj.length;i++){_removeBlobs(obj[i],i,obj)}}else if(typeof obj==="object"&&!isBuf(obj)){for(var key in obj){_removeBlobs(obj[key],key,obj)}}}var pendingBlobs=0;var bloblessData=data;_removeBlobs(bloblessData);if(!pendingBlobs){callback(bloblessData)}}},{"./is-buffer":154,isarray:150}],153:[function(require,module,exports){var debug=require("debug")("socket.io-parser");var Emitter=require("component-emitter");var binary=require("./binary");var isArray=require("isarray");var isBuf=require("./is-buffer");exports.protocol=4;exports.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"];exports.CONNECT=0;exports.DISCONNECT=1;exports.EVENT=2;exports.ACK=3;exports.ERROR=4;exports.BINARY_EVENT=5;exports.BINARY_ACK=6;exports.Encoder=Encoder;exports.Decoder=Decoder;function Encoder(){}var ERROR_PACKET=exports.ERROR+'"encode error"';Encoder.prototype.encode=function(obj,callback){debug("encoding packet %j",obj);if(exports.BINARY_EVENT===obj.type||exports.BINARY_ACK===obj.type){encodeAsBinary(obj,callback)}else{var encoding=encodeAsString(obj);callback([encoding])}};function encodeAsString(obj){var str=""+obj.type;if(exports.BINARY_EVENT===obj.type||exports.BINARY_ACK===obj.type){str+=obj.attachments+"-"}if(obj.nsp&&"/"!==obj.nsp){str+=obj.nsp+","}if(null!=obj.id){str+=obj.id}if(null!=obj.data){var payload=tryStringify(obj.data);if(payload!==false){str+=payload}else{return ERROR_PACKET}}debug("encoded %j as %s",obj,str);return str}function tryStringify(str){try{return JSON.stringify(str)}catch(e){return false}}function encodeAsBinary(obj,callback){function writeEncoding(bloblessData){var deconstruction=binary.deconstructPacket(bloblessData);var pack=encodeAsString(deconstruction.packet);var buffers=deconstruction.buffers;buffers.unshift(pack);callback(buffers)}binary.removeBlobs(obj,writeEncoding)}function Decoder(){this.reconstructor=null}Emitter(Decoder.prototype);Decoder.prototype.add=function(obj){var packet;if(typeof obj==="string"){packet=decodeString(obj);if(exports.BINARY_EVENT===packet.type||exports.BINARY_ACK===packet.type){this.reconstructor=new BinaryReconstructor(packet);if(this.reconstructor.reconPack.attachments===0){this.emit("decoded",packet)}}else{this.emit("decoded",packet)}}else if(isBuf(obj)||obj.base64){if(!this.reconstructor){throw new Error("got binary data when not reconstructing a packet")}else{packet=this.reconstructor.takeBinaryData(obj);if(packet){this.reconstructor=null;this.emit("decoded",packet)}}}else{throw new Error("Unknown type: "+obj)}};function decodeString(str){var i=0;var p={type:Number(str.charAt(0))};if(null==exports.types[p.type]){return error("unknown packet type "+p.type)}if(exports.BINARY_EVENT===p.type||exports.BINARY_ACK===p.type){var start=i+1;while(str.charAt(++i)!=="-"&&i!=str.length){}var buf=str.substring(start,i);if(buf!=Number(buf)||str.charAt(i)!=="-"){throw new Error("Illegal attachments")}p.attachments=Number(buf)}if("/"===str.charAt(i+1)){var start=i+1;while(++i){var c=str.charAt(i);if(","===c)break;if(i===str.length)break}p.nsp=str.substring(start,i)}else{p.nsp="/"}var next=str.charAt(i+1);if(""!==next&&Number(next)==next){var start=i+1;while(++i){var c=str.charAt(i);if(null==c||Number(c)!=c){--i;break}if(i===str.length)break}p.id=Number(str.substring(start,i+1))}if(str.charAt(++i)){var payload=tryParse(str.substr(i));var isPayloadValid=payload!==false&&(p.type===exports.ERROR||isArray(payload));if(isPayloadValid){p.data=payload}else{return error("invalid payload")}}debug("decoded %s as %j",str,p);return p}function tryParse(str){try{return JSON.parse(str)}catch(e){return false}}Decoder.prototype.destroy=function(){if(this.reconstructor){this.reconstructor.finishedReconstruction()}};function BinaryReconstructor(packet){this.reconPack=packet;this.buffers=[]}BinaryReconstructor.prototype.takeBinaryData=function(binData){this.buffers.push(binData);if(this.buffers.length===this.reconPack.attachments){var packet=binary.reconstructPacket(this.reconPack,this.buffers);this.finishedReconstruction();return packet}return null};BinaryReconstructor.prototype.finishedReconstruction=function(){this.reconPack=null;this.buffers=[]};function error(msg){return{type:exports.ERROR,data:"parser error: "+msg}}},{"./binary":152,"./is-buffer":154,"component-emitter":147,debug:148,isarray:150}],154:[function(require,module,exports){(function(Buffer){(function(){module.exports=isBuf;var withNativeBuffer=typeof Buffer==="function"&&typeof Buffer.isBuffer==="function";var withNativeArrayBuffer=typeof ArrayBuffer==="function";var isView=function(obj){return typeof ArrayBuffer.isView==="function"?ArrayBuffer.isView(obj):obj.buffer instanceof ArrayBuffer};function isBuf(obj){return withNativeBuffer&&Buffer.isBuffer(obj)||withNativeArrayBuffer&&(obj instanceof ArrayBuffer||isView(obj))}}).call(this)}).call(this,require("buffer").Buffer)},{buffer:27}],155:[function(require,module,exports){"use strict";var Buffer=require("safe-buffer").Buffer;var isEncoding=Buffer.isEncoding||function(encoding){encoding=""+encoding;switch(encoding&&encoding.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function _normalizeEncoding(enc){if(!enc)return"utf8";var retried;while(true){switch(enc){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return enc;default:if(retried)return;enc=(""+enc).toLowerCase();retried=true}}}function normalizeEncoding(enc){var nenc=_normalizeEncoding(enc);if(typeof nenc!=="string"&&(Buffer.isEncoding===isEncoding||!isEncoding(enc)))throw new Error("Unknown encoding: "+enc);return nenc||enc}exports.StringDecoder=StringDecoder;function StringDecoder(encoding){this.encoding=normalizeEncoding(encoding);var nb;switch(this.encoding){case"utf16le":this.text=utf16Text;this.end=utf16End;nb=4;break;case"utf8":this.fillLast=utf8FillLast;nb=4;break;case"base64":this.text=base64Text;this.end=base64End;nb=3;break;default:this.write=simpleWrite;this.end=simpleEnd;return}this.lastNeed=0;this.lastTotal=0;this.lastChar=Buffer.allocUnsafe(nb)}StringDecoder.prototype.write=function(buf){if(buf.length===0)return"";var r;var i;if(this.lastNeed){r=this.fillLast(buf);if(r===undefined)return"";i=this.lastNeed;this.lastNeed=0}else{i=0}if(i<buf.length)return r?r+this.text(buf,i):this.text(buf,i);return r||""};StringDecoder.prototype.end=utf8End;StringDecoder.prototype.text=utf8Text;StringDecoder.prototype.fillLast=function(buf){if(this.lastNeed<=buf.length){buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,this.lastTotal-this.lastNeed,0,buf.length);this.lastNeed-=buf.length};function utf8CheckByte(byte){if(byte<=127)return 0;else if(byte>>5===6)return 2;else if(byte>>4===14)return 3;else if(byte>>3===30)return 4;return-1}function utf8CheckIncomplete(self,buf,i){var j=buf.length-1;if(j<i)return 0;var nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-1;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0)self.lastNeed=nb-2;return nb}if(--j<i)return 0;nb=utf8CheckByte(buf[j]);if(nb>=0){if(nb>0){if(nb===2)nb=0;else self.lastNeed=nb-3}return nb}return 0}function utf8CheckExtraBytes(self,buf,p){if((buf[0]&192)!==128){self.lastNeed=0;return"<22>".repeat(p)}if(self.lastNeed>1&&buf.length>1){if((buf[1]&192)!==128){self.lastNeed=1;return"<22>".repeat(p+1)}if(self.lastNeed>2&&buf.length>2){if((buf[2]&192)!==128){self.lastNeed=2;return"<22>".repeat(p+2)}}}}function utf8FillLast(buf){var p=this.lastTotal-this.lastNeed;var r=utf8CheckExtraBytes(this,buf,p);if(r!==undefined)return r;if(this.lastNeed<=buf.length){buf.copy(this.lastChar,p,0,this.lastNeed);return this.lastChar.toString(this.encoding,0,this.lastTotal)}buf.copy(this.lastChar,p,0,buf.length);this.lastNeed-=buf.length}function utf8Text(buf,i){var total=utf8CheckIncomplete(this,buf,i);if(!this.lastNeed)return buf.toString("utf8",i);this.lastTotal=total;var end=buf.length-(total-this.lastNeed);buf.copy(this.lastChar,0,end);return buf.toString("utf8",i,end)}function utf8End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+"<22>".repeat(this.lastTotal-this.lastNeed);return r}function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString("utf16le",i);if(r){var c=r.charCodeAt(r.length-1);if(c>=55296&&c<=56319){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1)}}return r}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString("utf16le",i,buf.length-1)}function utf16End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString("utf16le",0,end)}return r}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString("base64",i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1]}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1]}return buf.toString("base64",i,buf.length-n)}function base64End(buf){var r=buf&&buf.length?this.write(buf):"";if(this.lastNeed)return r+this.lastChar.toString("base64",0,3-this.lastNeed);return r}function simpleWrite(buf){return buf.toString(this.encoding)}function simpleEnd(buf){return buf&&buf.length?this.write(buf):""}},{"safe-buffer":127}],156:[function(require,module,exports){function Agent(){this._defaults=[]}["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach((function(fn){Agent.prototype[fn]=function(){this._defaults.push({fn:fn,arguments:arguments});return this}}));Agent.prototype._setDefaults=function(req){this._defaults.forEach((function(def){req[def.fn].apply(req,def.arguments)}))};module.exports=Agent},{}],157:[function(require,module,exports){var root;if(typeof window!=="undefined"){root=window}else if(typeof self!=="undefined"){root=self}else{console.warn("Using browser-only version of superagent in non-browser environment");root=this}var Emitter=require("component-emitter");var RequestBase=require("./request-base");var isObject=require("./is-object");var ResponseBase=require("./response-base");var Agent=require("./agent-base");function noop(){}var request=exports=module.exports=function(method,url){if("function"==typeof url){return new exports.Request("GET",method).end(url)}if(1==arguments.length){return new exports.Request("GET",method)}return new exports.Request(method,url)};exports.Request=Request;request.getXHR=function(){if(root.XMLHttpRequest&&(!root.location||"file:"!=root.location.protocol||!root.ActiveXObject)){return new XMLHttpRequest}else{try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}}throw Error("Browser-only version of superagent could not find XHR")};var trim="".trim?function(s){return s.trim()}:function(s){return s.replace(/(^\s*|\s*$)/g,"")};function serialize(obj){if(!isObject(obj))return obj;var pairs=[];for(var key in obj){pushEncodedKeyValuePair(pairs,key,obj[key])}return pairs.join("&")}function pushEncodedKeyValuePair(pairs,key,val){if(val!=null){if(Array.isArray(val)){val.forEach((function(v){pushEncodedKeyValuePair(pairs,key,v)}))}else if(isObject(val)){for(var subkey in val){pushEncodedKeyValuePair(pairs,key+"["+subkey+"]",val[subkey])}}else{pairs.push(encodeURIComponent(key)+"="+encodeURIComponent(val))}}else if(val===null){pairs.push(encodeURIComponent(key))}}request.serializeObject=serialize;function parseString(str){var obj={};var pairs=str.split("&");var pair;var pos;for(var i=0,len=pairs.length;i<len;++i){pair=pairs[i];pos=pair.indexOf("=");if(pos==-1){obj[decodeURIComponent(pair)]=""}else{obj[decodeURIComponent(pair.slice(0,pos))]=decodeURIComponent(pair.slice(pos+1))}}return obj}request.parseString=parseString;request.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"};request.serialize={"application/x-www-form-urlencoded":serialize,"application/json":JSON.stringify};request.parse={"application/x-www-form-urlencoded":parseString,"application/json":JSON.parse};function parseHeader(str){var lines=str.split(/\r?\n/);var fields={};var index;var line;var field;var val;for(var i=0,len=lines.length;i<len;++i){line=lines[i];index=line.indexOf(":");if(index===-1){continue}field=line.slice(0,index).toLowerCase();val=trim(line.slice(index+1));fields[field]=val}return fields}function isJSON(mime){return/[\/+]json($|[^-\w])/.test(mime)}function Response(req){this.req=req;this.xhr=this.req.xhr;this.text=this.req.method!="HEAD"&&(this.xhr.responseType===""||this.xhr.responseType==="text")||typeof this.xhr.responseType==="undefined"?this.xhr.responseText:null;this.statusText=this.req.xhr.statusText;var status=this.xhr.status;if(status===1223){status=204}this._setStatusProperties(status);this.header=this.headers=parseHeader(this.xhr.getAllResponseHeaders());this.header["content-type"]=this.xhr.getResponseHeader("content-type");this._setHeaderProperties(this.header);if(null===this.text&&req._responseType){this.body=this.xhr.response}else{this.body=this.req.method!="HEAD"?this._parseBody(this.text?this.text:this.xhr.response):null}}ResponseBase(Response.prototype);Response.prototype._parseBody=function(str){var parse=request.parse[this.type];if(this.req._parser){return this.req._parser(this,str)}if(!parse&&isJSON(this.type)){parse=request.parse["application/json"]}return parse&&str&&(str.length||str instanceof Object)?parse(str):null};Response.prototype.toError=function(){var req=this.req;var method=req.method;var url=req.url;var msg="cannot "+method+" "+url+" ("+this.status+")";var err=new Error(msg);err.status=this.status;err.method=method;err.url=url;return err};request.Response=Response;function Request(method,url){var self=this;this._query=this._query||[];this.method=method;this.url=url;this.header={};this._header={};this.on("end",(function(){var err=null;var res=null;try{res=new Response(self)}catch(e){err=new Error("Parser is unable to parse the response");err.parse=true;err.original=e;if(self.xhr){err.rawResponse=typeof self.xhr.responseType=="undefined"?self.xhr.responseText:self.xhr.response;err.status=self.xhr.status?self.xhr.status:null;err.statusCode=err.status}else{err.rawResponse=null;err.status=null}return self.callback(err)}self.emit("response",res);var new_err;try{if(!self._isResponseOK(res)){new_err=new Error(res.statusText||"Unsuccessful HTTP response")}}catch(custom_err){new_err=custom_err}if(new_err){new_err.original=err;new_err.response=res;new_err.status=res.status;self.callback(new_err,res)}else{self.callback(null,res)}}))}Emitter(Request.prototype);RequestBase(Request.prototype);Request.prototype.type=function(type){this.set("Content-Type",request.types[type]||type);return this};Request.prototype.accept=function(type){this.set("Accept",request.types[type]||type);return this};Request.prototype.auth=function(user,pass,options){if(1===arguments.length)pass="";if(typeof pass==="object"&&pass!==null){options=pass;pass=""}if(!options){options={type:"function"===typeof btoa?"basic":"auto"}}var encoder=function(string){if("function"===typeof btoa){return btoa(string)}throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(user,pass,options,encoder)};Request.prototype.query=function(val){if("string"!=typeof val)val=serialize(val);if(val)this._query.push(val);return this};Request.prototype.attach=function(field,file,options){if(file){if(this._data){throw Error("superagent can't mix .send() and .attach()")}this._getFormData().append(field,file,options||file.name)}return this};Request.prototype._getFormData=function(){if(!this._formData){this._formData=new root.FormData}return this._formData};Request.prototype.callback=function(err,res){if(this._shouldRetry(err,res)){return this._retry()}var fn=this._callback;this.clearTimeout();if(err){if(this._maxRetries)err.retries=this._retries-1;this.emit("error",err)}fn(err,res)};Request.prototype.crossDomainError=function(){var err=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");err.crossDomain=true;err.status=this.status;err.method=this.method;err.url=this.url;this.callback(err)};Request.prototype.buffer=Request.prototype.ca=Request.prototype.agent=function(){console.warn("This is not supported in browser version of superagent");return this};Request.prototype.pipe=Request.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")};Request.prototype._isHost=function _isHost(obj){return obj&&"object"===typeof obj&&!Array.isArray(obj)&&Object.prototype.toString.call(obj)!=="[object Object]"};Request.prototype.end=function(fn){if(this._endCalled){console.warn("Warning: .end() was called twice. This is not supported in superagent")}this._endCalled=true;this._callback=fn||noop;this._finalizeQueryString();return this._end()};Request.prototype._end=function(){var self=this;var xhr=this.xhr=request.getXHR();var data=this._formData||this._data;this._setTimeouts();xhr.onreadystatechange=function(){var readyState=xhr.readyState;if(readyState>=2&&self._responseTimeoutTimer){clearTimeout(self._responseTimeoutTimer)}if(4!=readyState){return}var status;try{status=xhr.status}catch(e){status=0}if(!status){if(self.timedout||self._aborted)return;return self.crossDomainError()}self.emit("end")};var handleProgress=function(direction,e){if(e.total>0){e.percent=e.loaded/e.total*100}e.direction=direction;self.emit("progress",e)};if(this.hasListeners("progress")){try{xhr.onprogress=handleProgress.bind(null,"download");if(xhr.upload){xhr.upload.onprogress=handleProgress.bind(null,"upload")}}catch(e){}}try{if(this.username&&this.password){xhr.open(this.method,this.url,true,this.username,this.password)}else{xhr.open(this.method,this.url,true)}}catch(err){return this.callback(err)}if(this._withCredentials)xhr.withCredentials=true;if(!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof data&&!this._isHost(data)){var contentType=this._header["content-type"];var serialize=this._serializer||request.serialize[contentType?contentType.split(";")[0]:""];if(!serialize&&isJSON(contentType)){serialize=request.serialize["application/json"]}if(serialize)data=serialize(data)}for(var field in this.header){if(null==this.header[field])continue;if(this.header.hasOwnProperty(field))xhr.setRequestHeader(field,this.header[field])}if(this._responseType){xhr.responseType=this._responseType}this.emit("request",this);xhr.send(typeof data!=="undefined"?data:null);return this};request.agent=function(){return new Agent};["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(method){Agent.prototype[method.toLowerCase()]=function(url,fn){var req=new request.Request(method,url);this._setDefaults(req);if(fn){req.end(fn)}return req}}));Agent.prototype.del=Agent.prototype["delete"];request.get=function(url,data,fn){var req=request("GET",url);if("function"==typeof data)fn=data,data=null;if(data)req.query(data);if(fn)req.end(fn);return req};request.head=function(url,data,fn){var req=request("HEAD",url);if("function"==typeof data)fn=data,data=null;if(data)req.query(data);if(fn)req.end(fn);return req};request.options=function(url,data,fn){var req=request("OPTIONS",url);if("function"==typeof data)fn=data,data=null;if(data)req.send(data);if(fn)req.end(fn);return req};function del(url,data,fn){var req=request("DELETE",url);if("function"==typeof data)fn=data,data=null;if(data)req.send(data);if(fn)req.end(fn);return req}request["del"]=del;request["delete"]=del;request.patch=function(url,data,fn){var req=request("PATCH",url);if("function"==typeof data)fn=data,data=null;if(data)req.send(data);if(fn)req.end(fn);return req};request.post=function(url,data,fn){var req=request("POST",url);if("function"==typeof data)fn=data,data=null;if(data)req.send(data);if(fn)req.end(fn);return req};request.put=function(url,data,fn){var req=request("PUT",url);if("function"==typeof data)fn=data,data=null;if(data)req.send(data);if(fn)req.end(fn);return req}},{"./agent-base":156,"./is-object":158,"./request-base":159,"./response-base":160,"component-emitter":35}],158:[function(require,module,exports){"use strict";function isObject(obj){return null!==obj&&"object"===typeof obj}module.exports=isObject},{}],159:[function(require,module,exports){"use strict";var isObject=require("./is-object");module.exports=RequestBase;function RequestBase(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in RequestBase.prototype){obj[key]=RequestBase.prototype[key]}return obj}RequestBase.prototype.clearTimeout=function _clearTimeout(){clearTimeout(this._timer);clearTimeout(this._responseTimeoutTimer);delete this._timer;delete this._responseTimeoutTimer;return this};RequestBase.prototype.parse=function parse(fn){this._parser=fn;return this};RequestBase.prototype.responseType=function(val){this._responseType=val;return this};RequestBase.prototype.serialize=function serialize(fn){this._serializer=fn;return this};RequestBase.prototype.timeout=function timeout(options){if(!options||"object"!==typeof options){this._timeout=options;this._responseTimeout=0;return this}for(var option in options){switch(option){case"deadline":this._timeout=options.deadline;break;case"response":this._responseTimeout=options.response;break;default:console.warn("Unknown timeout option",option)}}return this};RequestBase.prototype.retry=function retry(count,fn){if(arguments.length===0||count===true)count=1;if(count<=0)count=0;this._maxRetries=count;this._retries=0;this._retryCallback=fn;return this};var ERROR_CODES=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];RequestBase.prototype._shouldRetry=function(err,res){if(!this._maxRetries||this._retries++>=this._maxRetries){return false}if(this._retryCallback){try{var override=this._retryCallback(err,res);if(override===true)return true;if(override===false)return false}catch(e){console.error(e)}}if(res&&res.status&&res.status>=500&&res.status!=501)return true;if(err){if(err.code&&~ERROR_CODES.indexOf(err.code))return true;if(err.timeout&&err.code=="ECONNABORTED")return true;if(err.crossDomain)return true}return false};RequestBase.prototype._retry=function(){this.clearTimeout();if(this.req){this.req=null;this.req=this.request()}this._aborted=false;this.timedout=false;return this._end()};RequestBase.prototype.then=function then(resolve,reject){if(!this._fullfilledPromise){var self=this;if(this._endCalled){console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises")}this._fullfilledPromise=new Promise((function(innerResolve,innerReject){self.end((function(err,res){if(err)innerReject(err);else innerResolve(res)}))}))}return this._fullfilledPromise.then(resolve,reject)};RequestBase.prototype["catch"]=function(cb){return this.then(undefined,cb)};RequestBase.prototype.use=function use(fn){fn(this);return this};RequestBase.prototype.ok=function(cb){if("function"!==typeof cb)throw Error("Callback required");this._okCallback=cb;return this};RequestBase.prototype._isResponseOK=function(res){if(!res){return false}if(this._okCallback){return this._okCallback(res)}return res.status>=200&&res.status<300};RequestBase.prototype.get=function(field){return this._header[field.toLowerCase()]};RequestBase.prototype.getHeader=RequestBase.prototype.get;RequestBase.prototype.set=function(field,val){if(isObject(field)){for(var key in field){this.set(key,field[key])}return this}this._header[field.toLowerCase()]=val;this.header[field]=val;return this};RequestBase.prototype.unset=function(field){delete this._header[field.toLowerCase()];delete this.header[field];return this};RequestBase.prototype.field=function(name,val){if(null===name||undefined===name){throw new Error(".field(name, val) name can not be empty")}if(this._data){console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()")}if(isObject(name)){for(var key in name){this.field(key,name[key])}return this}if(Array.isArray(val)){for(var i in val){this.field(name,val[i])}return this}if(null===val||undefined===val){throw new Error(".field(name, val) val can not be empty")}if("boolean"===typeof val){val=""+val}this._getFormData().append(name,val);return this};RequestBase.prototype.abort=function(){if(this._aborted){return this}this._aborted=true;this.xhr&&this.xhr.abort();this.req&&this.req.abort();this.clearTimeout();this.emit("abort");return this};RequestBase.prototype._auth=function(user,pass,options,base64Encoder){switch(options.type){case"basic":this.set("Authorization","Basic "+base64Encoder(user+":"+pass));break;case"auto":this.username=user;this.password=pass;break;case"bearer":this.set("Authorization","Bearer "+user);break}return this};RequestBase.prototype.withCredentials=function(on){if(on==undefined)on=true;this._withCredentials=on;return this};RequestBase.prototype.redirects=function(n){this._maxRedirects=n;return this};RequestBase.prototype.maxResponseSize=function(n){if("number"!==typeof n){throw TypeError("Invalid argument")}this._maxResponseSize=n;return this};RequestBase.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}};RequestBase.prototype.send=function(data){var isObj=isObject(data);var type=this._header["content-type"];if(this._formData){console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()")}if(isObj&&!this._data){if(Array.isArray(data)){this._data=[]}else if(!this._isHost(data)){this._data={}}}else if(data&&this._data&&this._isHost(this._data)){throw Error("Can't merge these send calls")}if(isObj&&isObject(this._data)){for(var key in data){this._data[key]=data[key]}}else if("string"==typeof data){if(!type)this.type("form");type=this._header["content-type"];if("application/x-www-form-urlencoded"==type){this._data=this._data?this._data+"&"+data:data}else{this._data=(this._data||"")+data}}else{this._data=data}if(!isObj||this._isHost(data)){return this}if(!type)this.type("json");return this};RequestBase.prototype.sortQuery=function(sort){this._sort=typeof sort==="undefined"?true:sort;return this};RequestBase.prototype._finalizeQueryString=function(){var query=this._query.join("&");if(query){this.url+=(this.url.indexOf("?")>=0?"&":"?")+query}this._query.length=0;if(this._sort){var index=this.url.indexOf("?");if(index>=0){var queryArr=this.url.substring(index+1).split("&");if("function"===typeof this._sort){queryArr.sort(this._sort)}else{queryArr.sort()}this.url=this.url.substring(0,index)+"?"+queryArr.join("&")}}};RequestBase.prototype._appendQueryString=function(){console.trace("Unsupported")};RequestBase.prototype._timeoutError=function(reason,timeout,errno){if(this._aborted){return}var err=new Error(reason+timeout+"ms exceeded");err.timeout=timeout;err.code="ECONNABORTED";err.errno=errno;this.timedout=true;this.abort();this.callback(err)};RequestBase.prototype._setTimeouts=function(){var self=this;if(this._timeout&&!this._timer){this._timer=setTimeout((function(){self._timeoutError("Timeout of ",self._timeout,"ETIME")}),this._timeout)}if(this._responseTimeout&&!this._responseTimeoutTimer){this._responseTimeoutTimer=setTimeout((function(){self._timeoutError("Response timeout of ",self._responseTimeout,"ETIMEDOUT")}),this._responseTimeout)}}},{"./is-object":158}],160:[function(require,module,exports){"use strict";var utils=require("./utils");module.exports=ResponseBase;function ResponseBase(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in ResponseBase.prototype){obj[key]=ResponseBase.prototype[key]}return obj}ResponseBase.prototype.get=function(field){return this.header[field.toLowerCase()]};ResponseBase.prototype._setHeaderProperties=function(header){var ct=header["content-type"]||"";this.type=utils.type(ct);var params=utils.params(ct);for(var key in params)this[key]=params[key];this.links={};try{if(header.link){this.links=utils.parseLinks(header.link)}}catch(err){}};ResponseBase.prototype._setStatusProperties=function(status){var type=status/100|0;this.status=this.statusCode=status;this.statusType=type;this.info=1==type;this.ok=2==type;this.redirect=3==type;this.clientError=4==type;this.serverError=5==type;this.error=4==type||5==type?this.toError():false;this.created=201==status;this.accepted=202==status;this.noContent=204==status;this.badRequest=400==status;this.unauthorized=401==status;this.notAcceptable=406==status;this.forbidden=403==status;this.notFound=404==status;this.unprocessableEntity=422==status}},{"./utils":161}],161:[function(require,module,exports){"use strict";exports.type=function(str){return str.split(/ *; */).shift()};exports.params=function(str){return str.split(/ *; */).reduce((function(obj,str){var parts=str.split(/ *= */);var key=parts.shift();var val=parts.shift();if(key&&val)obj[key]=val;return obj}),{})};exports.parseLinks=function(str){return str.split(/ *, */).reduce((function(obj,str){var parts=str.split(/ *; */);var url=parts[0].slice(1,-1);var rel=parts[1].split(/ *= */)[1].slice(1,-1);obj[rel]=url;return obj}),{})};exports.cleanHeader=function(header,changesOrigin){delete header["content-type"];delete header["content-length"];delete header["transfer-encoding"];delete header["host"];if(changesOrigin){delete header["authorization"];delete header["cookie"]}return header}},{}],162:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require("process/browser.js").nextTick;var apply=Function.prototype.apply;var slice=Array.prototype.slice;var immediateIds={};var nextImmediateId=0;exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout)};exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval)};exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close()};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(window,this._id)};exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout((function onTimeout(){if(item._onTimeout)item._onTimeout()}),msecs)}};exports.setImmediate=typeof setImmediate==="function"?setImmediate:function(fn){var id=nextImmediateId++;var args=arguments.length<2?false:slice.call(arguments,1);immediateIds[id]=true;nextTick((function onNextTick(){if(immediateIds[id]){if(args){fn.apply(null,args)}else{fn.call(null)}exports.clearImmediate(id)}}));return id};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id]}}).call(this)}).call(this,require("timers").setImmediate,require("timers").clearImmediate)},{"process/browser.js":112,timers:162}],163:[function(require,module,exports){module.exports=toArray;function toArray(list,index){var array=[];index=index||0;for(var i=index||0;i<list.length;i++){array[i-index]=list[i]}return array}},{}],164:[function(require,module,exports){(function(global){(function(){module.exports=deprecate;function deprecate(fn,msg){if(config("noDeprecation")){return fn}var warned=false;function deprecated(){if(!warned){if(config("throwDeprecation")){throw new Error(msg)}else if(config("traceDeprecation")){console.trace(msg)}else{console.warn(msg)}warned=true}return fn.apply(this,arguments)}return deprecated}function config(name){try{if(!global.localStorage)return false}catch(_){return false}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==="true"}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],165:[function(require,module,exports){"use strict";var alphabet="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),length=64,map={},seed=0,i=0,prev;function encode(num){var encoded="";do{encoded=alphabet[num%length]+encoded;num=Math.floor(num/length)}while(num>0);return encoded}function decode(str){var decoded=0;for(i=0;i<str.length;i++){decoded=decoded*length+map[str.charAt(i)]}return decoded}function yeast(){var now=encode(+new Date);if(now!==prev)return seed=0,prev=now;return now+"."+encode(seed++)}for(;i<length;i++)map[alphabet[i]]=i;yeast.encode=encode;yeast.decode=decode;module.exports=yeast},{}]},{},[1]);