text
stringlengths
1
22.8M
```javascript (function(){function o(n){var i=e;n&&(e[n]||(e[n]={}),i=e[n]);if(!i.define||!i.define.packaged)t.original=i.define,i.define=t,i.define.packaged=!0;if(!i.require||!i.require.packaged)r.original=i.require,i.require=r,i.require.packaged=!0}var ACE_NAMESPACE="",e=function(){return this}();!e&&typeof window!="undefined"&&(e=window);if(!ACE_NAMESPACE&&typeof requirejs!="undefined")return;var t=function(e,n,r){if(typeof e!="string"){t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(r=n),t.modules[e]||(t.payloads[e]=r,t.modules[e]=null)};t.modules={},t.payloads={};var n=function(e,t,n){if(typeof t=="string"){var i=s(e,t);if(i!=undefined)return n&&n(),i}else if(Object.prototype.toString.call(t)==="[object Array]"){var o=[];for(var u=0,a=t.length;u<a;++u){var f=s(e,t[u]);if(f==undefined&&r.original)return;o.push(f)}return n&&n.apply(null,o)||!0}},r=function(e,t){var i=n("",e,t);return i==undefined&&r.original?r.original.apply(this,arguments):i},i=function(e,t){if(t.indexOf("!")!==-1){var n=t.split("!");return i(e,n[0])+"!"+i(e,n[1])}if(t.charAt(0)=="."){var r=e.split("/").slice(0,-1).join("/");t=r+"/"+t;while(t.indexOf(".")!==-1&&s!=t){var s=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},s=function(e,r){r=i(e,r);var s=t.modules[r];if(!s){s=t.payloads[r];if(typeof s=="function"){var o={},u={id:r,uri:"",exports:o,packaged:!0},a=function(e,t){return n(r,e,t)},f=s(a,o,u);o=f||u.exports,t.modules[r]=o,delete t.payloads[r]}s=t.modules[r]=o||s}return s};o(ACE_NAMESPACE)})(),define("ace/lib/regexp",["require","exports","module"],function(e,t,n){"use strict";function o(e){return(e.global?"g":"")+(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":"")}function u(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t,n);for(var r=n||0;r<e.length;r++)if(e[r]===t)return r;return-1}var r={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},i=r.exec.call(/()??/,"")[1]===undefined,s=function(){var e=/^/g;return r.test.call(e,""),!e.lastIndex}();if(s&&i)return;RegExp.prototype.exec=function(e){var t=r.exec.apply(this,arguments),n,a;if(typeof e=="string"&&t){!i&&t.length>1&&u(t,"")>-1&&(a=RegExp(this.source,r.replace.call(o(this),"g","")),r.replace.call(e.slice(t.index),a,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===undefined&&(t[e]=undefined)}));if(this._xregexp&&this._xregexp.captureNames)for(var f=1;f<t.length;f++)n=this._xregexp.captureNames[f-1],n&&(t[n]=t[f]);!s&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--}return t},s||(RegExp.prototype.test=function(e){var t=r.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t})}),define("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function r(){}function w(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function H(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,"__defineGetter__"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=u.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),a=e+o,f=a+s-o,l=n-a,c=n-o;if(f<a)for(var h=0;h<l;++h)this[f+h]=this[a+h];else if(f>a)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var v=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?v.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(u.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(t){return a(t)=="[object Array]"});var m=Object("a"),g=m[0]!="a"||!(0 in m);Array.prototype.forEach||(Array.prototype.forEach=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=arguments[1],s=-1,o=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError;while(++s<o)s in r&&t.call(i,r[s],s,n)}),Array.prototype.map||(Array.prototype.map=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=Array(i),o=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var u=0;u<i;u++)u in r&&(s[u]=t.call(o,r[u],u,n));return s}),Array.prototype.filter||(Array.prototype.filter=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=[],o,u=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var f=0;f<i;f++)f in r&&(o=r[f],t.call(u,o,f,n)&&s.push(o));return s}),Array.prototype.every||(Array.prototype.every=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o<i;o++)if(o in r&&!t.call(s,r[o],o,n))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o<i;o++)if(o in r&&t.call(s,r[o],o,n))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;s<i;s++)s in r&&(o=t.call(void 0,o,r[s],s,n));return o}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(t){var n=F(this),r=g&&a(this)=="[object String]"?this.split(""):n,i=r.length>>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);do o in this&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=H(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i<r;i++)if(i in n&&n[i]===t)return i;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,H(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:o)});if(!Object.getOwnPropertyDescriptor){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(y+t);if(!f(t,n))return;var r,i,s;r={enumerable:!0,configurable:!0};if(d){var u=t.__proto__;t.__proto__=o;var i=h(t,n),s=p(t,n);t.__proto__=u;if(i||s)return i&&(r.get=i),s&&(r.set=s),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var b;Object.prototype.__proto__===null?b=function(){return{__proto__:null}}:b=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(t,n){var r;if(t===null)r=b();else{if(typeof t!="object")throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var E=w({}),S=typeof document=="undefined"||w(document.createElement("div"));if(!E||!S)var x=Object.defineProperty}if(!Object.defineProperty||x){var T="Property description must be an object: ",N="Object.defineProperty called on non-object: ",C="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(t,n,r){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(N+t);if(typeof r!="object"&&typeof r!="function"||r===null)throw new TypeError(T+r);if(x)try{return x.call(Object,t,n,r)}catch(i){}if(f(r,"value"))if(d&&(h(t,n)||p(t,n))){var s=t.__proto__;t.__proto__=o,delete t[n],t[n]=r.value,t.__proto__=s}else t[n]=r.value;else{if(!d)throw new TypeError(C);f(r,"get")&&l(t,n,r.get),f(r,"set")&&c(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)f(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(k){Object.freeze=function(t){return function(n){return typeof n=="function"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n="";while(f(t,n))n+="?";t[n]=!0;var r=f(t,n);return delete t[n],r});if(!Object.keys){var L=!0,A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],O=A.length;for(var M in{toString:null})L=!1;Object.keys=function I(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var I=[];for(var t in e)f(e,t)&&I.push(t);if(L)for(var n=0,r=O;n<r;n++){var i=A[n];f(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var _=" \n\x0b\f\r \u00a0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\ufeff";if(!String.prototype.trim||_.trim()){_="["+_+"]";var D=new RegExp("^"+_+_+"*"),P=new RegExp(_+_+"*$");String.prototype.trim=function(){return String(this).replace(D,"").replace(P,"")}}var F=function(e){if(e==null)throw new TypeError("can't convert "+e+" to object");return Object(e)}}),define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/regexp","ace/lib/es5-shim"],function(e,t,n){"use strict";e("./regexp"),e("./es5-shim"),typeof Element!="undefined"&&!Element.prototype.remove&&Object.defineProperty(Element.prototype,"remove",{enumerable:!1,writable:!0,configurable:!0,value:function(){this.parentNode&&this.parentNode.removeChild(this)}})}),define("ace/lib/useragent",["require","exports","module"],function(e,t,n){"use strict";t.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},t.getOS=function(){return t.isMac?t.OS.MAC:t.isLinux?t.OS.LINUX:t.OS.WINDOWS};if(typeof navigator!="object")return;var r=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),i=navigator.userAgent;t.isWin=r=="win",t.isMac=r=="mac",t.isLinux=r=="linux",t.isIE=navigator.appName=="Microsoft Internet Explorer"||navigator.appName.indexOf("MSAppHost")>=0?parseFloat((i.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((i.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=i.match(/ Gecko\/\d+/),t.isOpera=window.opera&&Object.prototype.toString.call(window.opera)=="[object Opera]",t.isWebKit=parseFloat(i.split("WebKit/")[1])||undefined,t.isChrome=parseFloat(i.split(" Chrome/")[1])||undefined,t.isEdge=parseFloat(i.split(" Edge/")[1])||undefined,t.isAIR=i.indexOf("AdobeAIR")>=0,t.isIPad=i.indexOf("iPad")>=0,t.isAndroid=i.indexOf("Android")>=0,t.isChromeOS=i.indexOf(" CrOS ")>=0,t.isIOS=/iPad|iPhone|iPod/.test(i)&&!window.MSStream,t.isIOS&&(t.isMac=!0),t.isMobile=t.isIPad||t.isAndroid}),define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("./useragent"),i="path_to_url";t.buildDom=function o(e,t,n){if(typeof e=="string"&&e){var r=document.createTextNode(e);return t&&t.appendChild(r),r}if(!Array.isArray(e))return e;if(typeof e[0]!="string"||!e[0]){var i=[];for(var s=0;s<e.length;s++){var u=o(e[s],t,n);u&&i.push(u)}return i}var a=document.createElement(e[0]),f=e[1],l=1;f&&typeof f=="object"&&!Array.isArray(f)&&(l=2);for(var s=l;s<e.length;s++)o(e[s],a,n);return l==2&&Object.keys(f).forEach(function(e){var t=f[e];e==="class"?a.className=Array.isArray(t)?t.join(" "):t:typeof t=="function"||e=="value"?a[e]=t:e==="ref"?n&&(n[t]=a):t!=null&&a.setAttribute(e,t)}),t&&t.appendChild(a),a},t.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName("head")[0]||e.documentElement},t.createElement=function(e,t){return document.createElementNS?document.createElementNS(t||i,e):document.createElement(e)},t.removeChildren=function(e){e.innerHTML=""},t.createTextNode=function(e,t){var n=t?t.ownerDocument:document;return n.createTextNode(e)},t.createFragment=function(e){var t=e?e.ownerDocument:document;return t.createDocumentFragment()},t.hasCssClass=function(e,t){var n=(e.className+"").split(/\s+/g);return n.indexOf(t)!==-1},t.addCssClass=function(e,n){t.hasCssClass(e,n)||(e.className+=" "+n)},t.removeCssClass=function(e,t){var n=e.className.split(/\s+/g);for(;;){var r=n.indexOf(t);if(r==-1)break;n.splice(r,1)}e.className=n.join(" ")},t.toggleCssClass=function(e,t){var n=e.className.split(/\s+/g),r=!0;for(;;){var i=n.indexOf(t);if(i==-1)break;r=!1,n.splice(i,1)}return r&&n.push(t),e.className=n.join(" "),r},t.setCssClass=function(e,n,r){r?t.addCssClass(e,n):t.removeCssClass(e,n)},t.hasCssString=function(e,t){var n=0,r;t=t||document;if(r=t.querySelectorAll("style"))while(n<r.length)if(r[n++].id===e)return!0},t.importCssString=function(n,r,i){var s=i&&i.getRootNode?i.getRootNode():document,o=s.ownerDocument||s;if(r&&t.hasCssString(r,s))return null;r&&(n+="\n/*# sourceURL=ace/css/"+r+" */");var u=t.createElement("style");u.appendChild(o.createTextNode(n)),r&&(u.id=r),s==o&&(s=t.getDocumentHead(o)),s.insertBefore(u,s.firstChild)},t.importCssStylsheet=function(e,n){t.buildDom(["link",{rel:"stylesheet",href:e}],t.getDocumentHead(n))},t.scrollbarWidth=function(e){var n=t.createElement("ace_inner");n.style.width="100%",n.style.minWidth="0px",n.style.height="200px",n.style.display="block";var r=t.createElement("ace_outer"),i=r.style;i.position="absolute",i.left="-10000px",i.overflow="hidden",i.width="200px",i.minWidth="0px",i.height="150px",i.display="block",r.appendChild(n);var s=e.documentElement;s.appendChild(r);var o=n.offsetWidth;i.overflow="scroll";var u=n.offsetWidth;return o==u&&(u=r.clientWidth),s.removeChild(r),o-u},typeof document=="undefined"&&(t.importCssString=function(){}),t.computedStyle=function(e,t){return window.getComputedStyle(e,"")||{}},t.setStyle=function(e,t,n){e[t]!==n&&(e[t]=n)},t.HAS_CSS_ANIMATION=!1,t.HAS_CSS_TRANSFORMS=!1,t.HI_DPI=r.isWin?typeof window!="undefined"&&window.devicePixelRatio>=1.5:!0;if(typeof document!="undefined"){var s=document.createElement("div");t.HI_DPI&&s.style.transform!==undefined&&(t.HAS_CSS_TRANSFORMS=!0),!r.isEdge&&typeof s.style.animationName!="undefined"&&(t.HAS_CSS_ANIMATION=!0),s=null}t.HAS_CSS_TRANSFORMS?t.translate=function(e,t,n){e.style.transform="translate("+Math.round(t)+"px, "+Math.round(n)+"px)"}:t.translate=function(e,t,n){e.style.top=Math.round(n)+"px",e.style.left=Math.round(t)+"px"}}),define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define("ace/lib/keys",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop"],function(e,t,n){"use strict";e("./fixoldbrowsers");var r=e("./oop"),i=function(){var e={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,"super":8,meta:8,command:8,cmd:8},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},t,n;for(n in e.FUNCTION_KEYS)t=e.FUNCTION_KEYS[n].toLowerCase(),e[t]=parseInt(n,10);for(n in e.PRINTABLE_KEYS)t=e.PRINTABLE_KEYS[n].toLowerCase(),e[t]=parseInt(n,10);return r.mixin(e,e.MODIFIER_KEYS),r.mixin(e,e.PRINTABLE_KEYS),r.mixin(e,e.FUNCTION_KEYS),e.enter=e["return"],e.escape=e.esc,e.del=e["delete"],e[173]="-",function(){var t=["cmd","ctrl","alt","shift"];for(var n=Math.pow(2,t.length);n--;)e.KEY_MODS[n]=t.filter(function(t){return n&e.KEY_MODS[t]}).join("-")+"-"}(),e.KEY_MODS[0]="",e.KEY_MODS[-1]="input-",e}();r.mixin(t,i),t.keyCodeToString=function(e){var t=i[e];return typeof t!="string"&&(t=String.fromCharCode(e)),t.toLowerCase()}}),define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function a(e,t,n){var a=u(t);if(!i.isMac&&s){t.getModifierState&&(t.getModifierState("OS")||t.getModifierState("Win"))&&(a|=8);if(s.altGr){if((3&a)==3)return;s.altGr=0}if(n===18||n===17){var f="location"in t?t.location:t.keyLocation;if(n===17&&f===1)s[n]==1&&(o=t.timeStamp);else if(n===18&&a===3&&f===2){var l=t.timeStamp-o;l<50&&(s.altGr=!0)}}}n in r.MODIFIER_KEYS&&(n=-1),a&8&&n>=91&&n<=93&&(n=-1);if(!a&&n===13){var f="location"in t?t.location:t.keyLocation;if(f===3){e(t,a,-n);if(t.defaultPrevented)return}}if(i.isChromeOS&&a&8){e(t,a,n);if(t.defaultPrevented)return;a&=-9}return!!a||n in r.FUNCTION_KEYS||n in r.PRINTABLE_KEYS?e(t,a,n):!1}function f(){s=Object.create(null)}var r=e("./keys"),i=e("./useragent"),s=null,o=0;t.addListener=function(e,t,n){if(e.addEventListener)return e.addEventListener(t,n,!1);if(e.attachEvent){var r=function(){n.call(e,window.event)};n._wrapper=r,e.attachEvent("on"+t,r)}},t.removeListener=function(e,t,n){if(e.removeEventListener)return e.removeEventListener(t,n,!1);e.detachEvent&&e.detachEvent("on"+t,n._wrapper||n)},t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},t.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},t.getButton=function(e){return e.type=="dblclick"?0:e.type=="contextmenu"||i.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.preventDefault?e.button:{1:0,2:2,4:1}[e.button]},t.capture=function(e,n,r){function i(e){n&&n(e),r&&r(e),t.removeListener(document,"mousemove",n,!0),t.removeListener(document,"mouseup",i,!0),t.removeListener(document,"dragstart",i,!0)}return t.addListener(document,"mousemove",n,!0),t.addListener(document,"mouseup",i,!0),t.addListener(document,"dragstart",i,!0),i},t.addTouchMoveListener=function(e,n){var r,i;t.addListener(e,"touchstart",function(e){var t=e.touches,n=t[0];r=n.clientX,i=n.clientY}),t.addListener(e,"touchmove",function(e){var t=e.touches;if(t.length>1)return;var s=t[0];e.wheelX=r-s.clientX,e.wheelY=i-s.clientY,r=s.clientX,i=s.clientY,n(e)})},t.addMouseWheelListener=function(e,n){"onmousewheel"in e?t.addListener(e,"mousewheel",function(e){var t=8;e.wheelDeltaX!==undefined?(e.wheelX=-e.wheelDeltaX/t,e.wheelY=-e.wheelDeltaY/t):(e.wheelX=0,e.wheelY=-e.wheelDelta/t),n(e)}):"onwheel"in e?t.addListener(e,"wheel",function(e){var t=.35;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=e.deltaX*t||0,e.wheelY=e.deltaY*t||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=(e.deltaX||0)*5,e.wheelY=(e.deltaY||0)*5}n(e)}):t.addListener(e,"DOMMouseScroll",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=(e.detail||0)*5,e.wheelY=0):(e.wheelX=0,e.wheelY=(e.detail||0)*5),n(e)})},t.addMultiMouseDownListener=function(e,n,r,s){function c(e){t.getButton(e)!==0?o=0:e.detail>1?(o++,o>4&&(o=1)):o=1;if(i.isIE){var c=Math.abs(e.clientX-u)>5||Math.abs(e.clientY-a)>5;if(!f||c)o=1;f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),o==1&&(u=e.clientX,a=e.clientY)}e._clicks=o,r[s]("mousedown",e);if(o>4)o=0;else if(o>1)return r[s](l[o],e)}function h(e){o=2,f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),r[s]("mousedown",e),r[s](l[o],e)}var o=0,u,a,f,l={2:"dblclick",3:"tripleclick",4:"quadclick"};Array.isArray(e)||(e=[e]),e.forEach(function(e){t.addListener(e,"mousedown",c),i.isOldIE&&t.addListener(e,"dblclick",h)})};var u=!i.isMac||!i.isOpera||"KeyboardEvent"in window?function(e){return 0|(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0)}:function(e){return 0|(e.metaKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.ctrlKey?8:0)};t.getModifierString=function(e){return r.KEY_MODS[u(e)]},t.addCommandKeyListener=function(e,n){var r=t.addListener;if(i.isOldGecko||i.isOpera&&!("KeyboardEvent"in window)){var o=null;r(e,"keydown",function(e){o=e.keyCode}),r(e,"keypress",function(e){return a(n,e,o)})}else{var u=null;r(e,"keydown",function(e){s[e.keyCode]=(s[e.keyCode]||0)+1;var t=a(n,e,e.keyCode);return u=e.defaultPrevented,t}),r(e,"keypress",function(e){u&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),u=null)}),r(e,"keyup",function(e){s[e.keyCode]=null}),s||(f(),r(window,"focus",f))}};if(typeof window=="object"&&window.postMessage&&!i.isOldIE){var l=1;t.nextTick=function(e,n){n=n||window;var r="zero-timeout-message-"+l++,i=function(s){s.data==r&&(t.stopPropagation(s),t.removeListener(n,"message",i),e())};t.addListener(n,"message",i),n.postMessage(r,"*")}}t.$idleBlocked=!1,t.onIdle=function(e,n){return setTimeout(function r(){t.$idleBlocked?setTimeout(r,100):e()},n)},t.$idleBlockId=null,t.blockIdle=function(e){t.$idleBlockId&&clearTimeout(t.$idleBlockId),t.$idleBlocked=!0,t.$idleBlockId=setTimeout(function(){t.$idleBlocked=!1},e||100)},t.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}}),define("ace/range",["require","exports","module"],function(e,t,n){"use strict";var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define("ace/lib/lang",["require","exports","module"],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var n="";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]=="object"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function s(e){if(typeof e!="object"||!e)return e;var t;if(Array.isArray(e)){t=[];for(var n=0;n<e.length;n++)t[n]=s(e[n]);return t}if(Object.prototype.toString.call(e)!=="[object Object]")return e;t={};for(var n in e)t[n]=s(e[n]);return t},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return(""+e).replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define("ace/keyboard/textinput_ios",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/lib/keys"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("../lib/dom"),o=e("../lib/lang"),u=e("../lib/keys"),a=u.KEY_MODS,f=i.isChrome<18,l=i.isIE,c=function(e,t){function x(e){if(m)return;m=!0;if(k)t=0,n=e?0:c.value.length-1;else var t=4,n=5;try{c.setSelectionRange(t,n)}catch(r){}m=!1}function T(){if(m)return;c.value=h,i.isWebKit&&S.schedule()}function R(){clearTimeout(q),q=setTimeout(function(){g&&(c.style.cssText=g,g=""),t.renderer.$keepTextAreaAtCursor==null&&(t.renderer.$keepTextAreaAtCursor=!0,t.renderer.$moveTextAreaToCursor())},0)}var n=this,c=s.createElement("textarea");c.className=i.isIOS?"ace_text-input ace_text-input-ios":"ace_text-input",i.isTouchPad&&c.setAttribute("x-palm-disable-auto-cap",!0),c.setAttribute("wrap","off"),c.setAttribute("autocorrect","off"),c.setAttribute("autocapitalize","off"),c.setAttribute("spellcheck",!1),c.style.opacity="0",e.insertBefore(c,e.firstChild);var h="\n aaaa a\n",p=!1,d=!1,v=!1,m=!1,g="",y=!0;try{var b=document.activeElement===c}catch(w){}r.addListener(c,"blur",function(e){t.onBlur(e),b=!1}),r.addListener(c,"focus",function(e){b=!0,t.onFocus(e),x()}),this.focus=function(){if(g)return c.focus();c.style.position="fixed",c.focus()},this.blur=function(){c.blur()},this.isFocused=function(){return b};var E=o.delayedCall(function(){b&&x(y)}),S=o.delayedCall(function(){m||(c.value=h,b&&x())});i.isWebKit||t.addEventListener("changeSelection",function(){t.selection.isEmpty()!=y&&(y=!y,E.schedule())}),T(),b&&t.onFocus();var N=function(e){return e.selectionStart===0&&e.selectionEnd===e.value.length},C=function(e){N(c)?(t.selectAll(),x()):k&&x(t.selection.isEmpty())},k=null;this.setInputHandler=function(e){k=e},this.getInputHandler=function(){return k};var L=!1,A=function(e){if(c.selectionStart===4&&c.selectionEnd===5)return;k&&(e=k(e),k=null),v?(x(),e&&t.onPaste(e),v=!1):e==h.substr(0)&&c.selectionStart===4?L?t.execCommand("del",{source:"ace"}):t.execCommand("backspace",{source:"ace"}):p||(e.substring(0,9)==h&&e.length>h.length?e=e.substr(9):e.substr(0,4)==h.substr(0,4)?e=e.substr(4,e.length-h.length+1):e.charAt(e.length-1)==h.charAt(0)&&(e=e.slice(0,-1)),e!=h.charAt(0)&&e.charAt(e.length-1)==h.charAt(0)&&(e=e.slice(0,-1)),e&&t.onTextInput(e)),p&&(p=!1),L&&(L=!1)},O=function(e){if(m)return;var t=c.value;A(t),T()},M=function(e,t,n){var r=e.clipboardData||window.clipboardData;if(!r||f)return;var i=l||n?"Text":"text/plain";try{return t?r.setData(i,t)!==!1:r.getData(i)}catch(e){if(!n)return M(e,t,!0)}},_=function(e,n){var s=t.getCopyText();if(!s)return r.preventDefault(e);M(e,s)?(i.isIOS&&(d=n,c.value="\n aa"+s+"a a\n",c.setSelectionRange(4,4+s.length),p={value:s}),n?t.onCut():t.onCopy(),i.isIOS||r.preventDefault(e)):(p=!0,c.value=s,c.select(),setTimeout(function(){p=!1,T(),x(),n?t.onCut():t.onCopy()}))},D=function(e){_(e,!0)},P=function(e){_(e,!1)},H=function(e){var n=M(e);typeof n=="string"?(n&&t.onPaste(n,e),i.isIE&&setTimeout(x),r.preventDefault(e)):(c.value="",v=!0)};r.addCommandKeyListener(c,t.onCommandKey.bind(t)),r.addListener(c,"select",C),r.addListener(c,"input",O),r.addListener(c,"cut",D),r.addListener(c,"copy",P),r.addListener(c,"paste",H);var B=function(e){if(m||!t.onCompositionStart||t.$readOnly)return;m={},m.canUndo=t.session.$undoManager,t.onCompositionStart(),setTimeout(j,0),t.on("mousedown",F),m.canUndo&&!t.selection.isEmpty()&&(t.insert(""),t.session.markUndoGroup(),t.selection.clearSelection()),t.session.markUndoGroup()},j=function(){if(!m||!t.onCompositionUpdate||t.$readOnly)return;var e=c.value.replace(/\x01/g,"");if(m.lastValue===e)return;t.onCompositionUpdate(e),m.lastValue&&t.undo(),m.canUndo&&(m.lastValue=e);if(m.lastValue){var n=t.selection.getRange();t.insert(m.lastValue),t.session.markUndoGroup(),m.range=t.selection.getRange(),t.selection.setRange(n),t.selection.clearSelection()}},F=function(e){if(!t.onCompositionEnd||t.$readOnly)return;var n=m;m=!1;var r=setTimeout(function(){r=null;var e=c.value.replace(/\x01/g,"");if(m)return;e==n.lastValue?T():!n.lastValue&&e&&(T(),A(e))});k=function(i){return r&&clearTimeout(r),i=i.replace(/\x01/g,""),i==n.lastValue?"":(n.lastValue&&r&&t.undo(),i)},t.onCompositionEnd(),t.removeListener("mousedown",F),e.type=="compositionend"&&n.range&&t.selection.setRange(n.range);var s=!!i.isChrome&&i.isChrome>=53||!!i.isWebKit&&i.isWebKit>=603;s&&O()},I=o.delayedCall(j,50);r.addListener(c,"compositionstart",B),r.addListener(c,"compositionupdate",function(){I.schedule()}),r.addListener(c,"keyup",function(){I.schedule()}),r.addListener(c,"keydown",function(){I.schedule()}),r.addListener(c,"compositionend",F),this.getElement=function(){return c},this.setReadOnly=function(e){c.readOnly=e},this.onContextMenu=function(e){L=!0,x(t.selection.isEmpty()),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,n){g||(g=c.style.cssText),c.style.cssText=(n?"z-index:100000;":"")+"height:"+c.style.height+";"+(i.isIE?"opacity:0.1;":"");var o=t.container.getBoundingClientRect(),u=s.computedStyle(t.container),a=o.top+(parseInt(u.borderTopWidth)||0),f=o.left+(parseInt(o.borderLeftWidth)||0),l=o.bottom-a-c.clientHeight-2,h=function(e){c.style.left=e.clientX-f-2+"px",c.style.top=Math.min(e.clientY-a-2,l)+"px"};h(e);if(e.type!="mousedown")return;t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=null),clearTimeout(q),i.isWin&&r.capture(t.container,h,R)},this.onContextMenuClose=R;var q,U=function(e){t.textInput.onContextMenu(e),R()};r.addListener(c,"mouseup",U),r.addListener(c,"mousedown",function(e){e.preventDefault(),R()}),r.addListener(t.renderer.scroller,"contextmenu",U),r.addListener(c,"contextmenu",U);if(i.isIOS){var z=null,W=!1;e.addEventListener("keydown",function(e){z&&clearTimeout(z),W=!0}),e.addEventListener("keyup",function(e){z=setTimeout(function(){W=!1},100)});var X=function(e){if(document.activeElement!==c)return;if(W)return;if(d)return setTimeout(function(){d=!1},100);var n=c.selectionStart,r=c.selectionEnd;c.setSelectionRange(4,5);if(n==r)switch(n){case 0:t.onCommandKey(null,0,u.up);break;case 1:t.onCommandKey(null,0,u.home);break;case 2:t.onCommandKey(null,a.option,u.left);break;case 4:t.onCommandKey(null,0,u.left);break;case 5:t.onCommandKey(null,0,u.right);break;case 7:t.onCommandKey(null,a.option,u.right);break;case 8:t.onCommandKey(null,0,u.end);break;case 9:t.onCommandKey(null,0,u.down)}else{switch(r){case 6:t.onCommandKey(null,a.shift,u.right);break;case 7:t.onCommandKey(null,a.shift|a.option,u.right);break;case 8:t.onCommandKey(null,a.shift,u.end);break;case 9:t.onCommandKey(null,a.shift,u.down)}switch(n){case 0:t.onCommandKey(null,a.shift,u.up);break;case 1:t.onCommandKey(null,a.shift,u.home);break;case 2:t.onCommandKey(null,a.shift|a.option,u.left);break;case 3:t.onCommandKey(null,a.shift,u.left)}}};document.addEventListener("selectionchange",X),t.on("destroy",function(){document.removeEventListener("selectionchange",X)})}};t.TextInput=c}),define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/keyboard/textinput_ios"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("../lib/dom"),o=e("../lib/lang"),u=i.isChrome<18,a=i.isIE,f=i.isChrome>63,l=400,c=e("./textinput_ios").TextInput,h=function(e,t){function C(){if(d||v)return;if(!T&&!O)return;d=!0;var e=t.selection,r=e.getRange(),i=e.cursor.row,s=r.start.column,o=r.end.column,u=t.session.getLine(i);if(r.start.row!=i){var a=t.session.getLine(i-1);s=r.start.row<i-1?0:s,o+=a.length+1,u=a+"\n"+u}else if(r.end.row!=i){var f=t.session.getLine(i+1);o=r.end.row>i+1?f.length:o,o+=u.length+1,u=u+"\n"+f}u.length>l&&(s<l&&o<l?u=u.slice(0,l):(u="\n",s=0,o=1));var c=u+"\n\n";c!=E&&(n.value=E=c,S=x=c.length),O&&(S=n.selectionStart,x=n.selectionEnd);if(x!=o||S!=s)try{n.setSelectionRange(s,o),S=s,x=o}catch(h){}d=!1}function R(){w=!0,n.blur(),n.focus(),w=!1}function z(e){e.keyCode==27&&n.value.length<n.selectionStart&&(d||(E=n.value),S=x=-1,C()),U()}function X(){clearTimeout(W),W=setTimeout(function(){m&&(n.style.cssText=m,m=""),t.renderer.$keepTextAreaAtCursor==null&&(t.renderer.$keepTextAreaAtCursor=!0,t.renderer.$moveTextAreaToCursor())},0)}if(i.isIOS)return c.call(this,e,t);var n=s.createElement("textarea");n.className="ace_text-input",n.setAttribute("wrap","off"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck",!1),n.style.opacity="0",e.insertBefore(n,e.firstChild);var h=!1,p=!1,d=!1,v=!1,m="",g=!0,y=!1;i.isMobile||(n.style.fontSize="1px");var b=!1,w=!1,E="",S=0,x=0;try{var T=document.activeElement===n}catch(N){}r.addListener(n,"blur",function(e){if(w)return;t.onBlur(e),T=!1}),r.addListener(n,"focus",function(e){if(w)return;T=!0,t.onFocus(e),C()}),this.$focusScroll=!1,this.focus=function(){if(m||f||this.$focusScroll=="browser")return n.focus({preventScroll:!0});if(!document.documentElement.contains(n))return;var e=n.style.top;n.style.position="fixed",n.style.top="0px";var t=n.getBoundingClientRect().top!=0,r=[];if(t){var i=n.parentElement;while(i&&i.nodeType==1)r.push(i),i.setAttribute("ace_nocontext",!0),!i.parentElement&&i.getRootNode?i=i.getRootNode().host:i=i.parentElement}n.focus({preventScroll:!0}),t&&r.forEach(function(e){e.removeAttribute("ace_nocontext")}),setTimeout(function(){n.style.position="",n.style.top=="0px"&&(n.style.top=e)},0)},this.blur=function(){n.blur()},this.isFocused=function(){return T},t.on("beforeEndOperation",function(){if(t.curOp&&t.curOp.command.name=="insertstring")return;d&&(E=n.value="",q()),C()}),T&&t.onFocus();var k=function(e){return e.selectionStart===0&&e.selectionEnd>=E.length&&e.value===E&&E&&e.selectionEnd!==x},L=function(e){if(d)return;h?h=!1:k(n)&&(t.selectAll(),C())},A=null;this.setInputHandler=function(e){A=e},this.getInputHandler=function(){return A};var O=!1,M=function(e,r){O&&(O=!1);if(p)return C(),e&&t.onPaste(e),p=!1,"";var i=n.selectionStart,s=n.selectionEnd,o=S,u=E.length-x,a=e,f=e.length-i,l=e.length-s,c=0;while(o>0&&E[c]==e[c])c++,o--;a=a.slice(c),c=1;while(u>0&&E.length-c>S-1&&E[E.length-c]==e[e.length-c])c++,u--;return f-=c-1,l-=c-1,a=a.slice(0,a.length-c+1),!r&&f==a.length&&!o&&!u&&!l?"":(v=!0,a&&!o&&!u&&!f&&!l||b?t.onTextInput(a):t.onTextInput(a,{extendLeft:o,extendRight:u,restoreStart:f,restoreEnd:l}),v=!1,E=e,S=i,x=s,a)},_=function(e){if(d)return I();var t=n.value,r=M(t,!0);(t.length>l+100||/\n/.test(r))&&C()},D=function(e,t,n){var r=e.clipboardData||window.clipboardData;if(!r||u)return;var i=a||n?"Text":"text/plain";try{return t?r.setData(i,t)!==!1:r.getData(i)}catch(e){if(!n)return D(e,t,!0)}},P=function(e,i){var s=t.getCopyText();if(!s)return r.preventDefault(e);D(e,s)?(i?t.onCut():t.onCopy(),r.preventDefault(e)):(h=!0,n.value=s,n.select(),setTimeout(function(){h=!1,C(),i?t.onCut():t.onCopy()}))},H=function(e){P(e,!0)},B=function(e){P(e,!1)},j=function(e){var s=D(e);typeof s=="string"?(s&&t.onPaste(s,e),i.isIE&&setTimeout(C),r.preventDefault(e)):(n.value="",p=!0)};r.addCommandKeyListener(n,t.onCommandKey.bind(t)),r.addListener(n,"select",L),r.addListener(n,"input",_),r.addListener(n,"cut",H),r.addListener(n,"copy",B),r.addListener(n,"paste",j),(!("oncut"in n)||!("oncopy"in n)||!("onpaste"in n))&&r.addListener(e,"keydown",function(e){if(i.isMac&&!e.metaKey||!e.ctrlKey)return;switch(e.keyCode){case 67:B(e);break;case 86:j(e);break;case 88:H(e)}});var F=function(e){if(d||!t.onCompositionStart||t.$readOnly)return;d={};if(b)return;setTimeout(I,0),t.on("mousedown",R);var r=t.getSelectionRange();r.end.row=r.start.row,r.end.column=r.start.column,d.markerRange=r,d.selectionStart=S,t.onCompositionStart(d),d.useTextareaForIME?(n.value="",E="",S=0,x=0):(n.msGetInputContext&&(d.context=n.msGetInputContext()),n.getInputContext&&(d.context=n.getInputContext()))},I=function(){if(!d||!t.onCompositionUpdate||t.$readOnly)return;if(b)return R();if(d.useTextareaForIME)t.onCompositionUpdate(n.value);else{var e=n.value;M(e),d.markerRange&&(d.context&&(d.markerRange.start.column=d.selectionStart=d.context.compositionStartOffset),d.markerRange.end.column=d.markerRange.start.column+x-d.selectionStart)}},q=function(e){if(!t.onCompositionEnd||t.$readOnly)return;d=!1,t.onCompositionEnd(),t.off("mousedown",R),e&&_()},U=o.delayedCall(I,50).schedule.bind(null,null);r.addListener(n,"compositionstart",F),r.addListener(n,"compositionupdate",I),r.addListener(n,"keyup",z),r.addListener(n,"keydown",U),r.addListener(n,"compositionend",q),this.getElement=function(){return n},this.setCommandMode=function(e){b=e,n.readOnly=!1},this.setReadOnly=function(e){b||(n.readOnly=e)},this.setCopyWithEmptySelection=function(e){y=e},this.onContextMenu=function(e){O=!0,C(),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,o){m||(m=n.style.cssText),n.style.cssText=(o?"z-index:100000;":"")+(i.isIE?"opacity:0.1;":"")+"text-indent: -"+(S+x)*t.renderer.characterWidth*.5+"px;";var u=t.container.getBoundingClientRect(),a=s.computedStyle(t.container),f=u.top+(parseInt(a.borderTopWidth)||0),l=u.left+(parseInt(u.borderLeftWidth)||0),c=u.bottom-f-n.clientHeight-2,h=function(e){n.style.left=e.clientX-l-2+"px",n.style.top=Math.min(e.clientY-f-2,c)+"px"};h(e);if(e.type!="mousedown")return;t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=null),clearTimeout(W),i.isWin&&r.capture(t.container,h,X)},this.onContextMenuClose=X;var W,V=function(e){t.textInput.onContextMenu(e),X()};r.addListener(n,"mouseup",V),r.addListener(n,"mousedown",function(e){e.preventDefault(),X()}),r.addListener(t.renderer.scroller,"contextmenu",V),r.addListener(n,"contextmenu",V)};t.TextInput=h}),define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";function o(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),t.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),t.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),t.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),t.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e)),t.setDefaultHandler("touchmove",this.onTouchMove.bind(e));var n=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];n.forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}function u(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}function a(e,t){if(e.start.row==e.end.row)var n=2*t.column-e.start.column-e.end.column;else if(e.start.row==e.end.row-1&&!e.start.column&&!e.end.column)var n=t.column-4;else var n=2*t.row-e.start.row-e.end.row;return n<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}var r=e("../lib/useragent"),i=0,s=250;(function(){this.onMouseDown=function(e){var t=e.inSelection(),n=e.getDocumentPosition();this.mousedownEvent=e;var i=this.editor,s=e.getButton();if(s!==0){var o=i.getSelectionRange(),u=o.isEmpty();(u||s==1)&&i.selection.moveToPosition(n),s==2&&(i.textInput.onContextMenu(e.domEvent),r.isMozilla||e.preventDefault());return}this.mousedownEvent.time=Date.now();if(t&&!i.isFocused()){i.focus();if(this.$focusTimeout&&!this.$clickSelection&&!i.inMultiSelectMode){this.setState("focusWait"),this.captureMouse(e);return}}return this.captureMouse(e),this.startSelect(n,e.domEvent._clicks>1),e.preventDefault()},this.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var n=this.editor;if(!this.mousedownEvent)return;this.mousedownEvent.getShiftKey()?n.selection.selectToPosition(e):t||n.selection.moveToPosition(e),t||this.select(),n.renderer.scroller.setCapture&&n.renderer.scroller.setCapture(),n.setStyle("ace_selecting"),this.setState("select")},this.select=function(){var e,t=this.editor,n=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var r=this.$clickSelection.comparePoint(n);if(r==-1)e=this.$clickSelection.end;else if(r==1)e=this.$clickSelection.start;else{var i=a(this.$clickSelection,n);n=i.cursor,e=i.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(n),t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,n=this.editor,r=n.renderer.screenToTextCoordinates(this.x,this.y),i=n.selection[e](r.row,r.column);if(this.$clickSelection){var s=this.$clickSelection.comparePoint(i.start),o=this.$clickSelection.comparePoint(i.end);if(s==-1&&o<=0){t=this.$clickSelection.end;if(i.end.row!=r.row||i.end.column!=r.column)r=i.start}else if(o==1&&s>=0){t=this.$clickSelection.start;if(i.start.row!=r.row||i.start.column!=r.column)r=i.end}else if(s==-1&&o==1)r=i.end,t=i.start;else{var u=a(this.$clickSelection,r);r=u.cursor,t=u.anchor}n.selection.setSelectionAnchor(t.row,t.column)}n.selection.selectToPosition(r),n.renderer.scrollCursorIntoView()},this.selectEnd=this.selectAllEnd=this.selectByWordsEnd=this.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting"),this.editor.renderer.scroller.releaseCapture&&this.editor.renderer.scroller.releaseCapture()},this.focusWait=function(){var e=u(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>i||t-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),n=this.editor,r=n.session,i=r.getBracketRange(t);i?(i.isEmpty()&&(i.start.column--,i.end.column++),this.setState("select")):(i=n.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=i,this.select()},this.onTripleClick=function(e){var t=e.getDocumentPosition(),n=this.editor;this.setState("selectByLines");var r=n.getSelectionRange();r.isMultiLine()&&r.contains(t.row,t.column)?(this.$clickSelection=n.selection.getLineRange(r.start.row),this.$clickSelection.end=n.selection.getLineRange(r.end.row).end):this.$clickSelection=n.selection.getLineRange(t.row),this.select()},this.onQuadClick=function(e){var t=this.editor;t.selectAll(),this.$clickSelection=t.getSelectionRange(),this.setState("selectAll")},this.onMouseWheel=function(e){if(e.getAccelKey())return;e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var n=this.$lastScroll,r=e.domEvent.timeStamp,i=r-n.t,o=i?e.wheelX/i:n.vx,u=i?e.wheelY/i:n.vy;i<s&&(o=(o+n.vx)/2,u=(u+n.vy)/2);var a=Math.abs(o/u),f=!1;a>=1&&t.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(f=!0),a<=1&&t.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(f=!0);if(f)n.allowed=r;else if(r-n.allowed<s){var l=Math.abs(o)<=1.1*Math.abs(n.vx)&&Math.abs(u)<=1.1*Math.abs(n.vy);l?(f=!0,n.allowed=r):n.allowed=0}n.t=r,n.vx=o,n.vy=u;if(f)return t.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()},this.onTouchMove=function(e){this.editor._emit("mousewheel",e)}}).call(o.prototype),t.DefaultHandlers=o}),define("ace/tooltip",["require","exports","module","ace/lib/oop","ace/lib/dom"],function(e,t,n){"use strict";function s(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}var r=e("./lib/oop"),i=e("./lib/dom");(function(){this.$init=function(){return this.$element=i.createElement("div"),this.$element.className="ace_tooltip",this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},this.getElement=function(){return this.$element||this.$init()},this.setText=function(e){this.getElement().textContent=e},this.setHtml=function(e){this.getElement().innerHTML=e},this.setPosition=function(e,t){this.getElement().style.left=e+"px",this.getElement().style.top=t+"px"},this.setClassName=function(e){i.addCssClass(this.getElement(),e)},this.show=function(e,t,n){e!=null&&this.setText(e),t!=null&&n!=null&&this.setPosition(t,n),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},this.hide=function(){this.isOpen&&(this.getElement().style.display="none",this.isOpen=!1)},this.getHeight=function(){return this.getElement().offsetHeight},this.getWidth=function(){return this.getElement().offsetWidth},this.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)}}).call(s.prototype),t.Tooltip=s}),define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event","ace/tooltip"],function(e,t,n){"use strict";function u(e){function l(){var r=u.getDocumentPosition().row,s=n.$annotations[r];if(!s)return c();var o=t.session.getLength();if(r==o){var a=t.renderer.pixelToScreenCoordinates(0,u.y).row,l=u.$pos;if(a>t.session.documentToScreenRow(l.row,l.column))return c()}if(f==s)return;f=s.text.join("<br/>"),i.setHtml(f),i.show(),t._signal("showGutterTooltip",i),t.on("mousewheel",c);if(e.$tooltipFollowsMouse)h(u);else{var p=u.domEvent.target,d=p.getBoundingClientRect(),v=i.getElement().style;v.left=d.right+"px",v.top=d.bottom+"px"}}function c(){o&&(o=clearTimeout(o)),f&&(i.hide(),f=null,t._signal("hideGutterTooltip",i),t.removeEventListener("mousewheel",c))}function h(e){i.setPosition(e.x,e.y)}var t=e.editor,n=t.renderer.$gutterLayer,i=new a(t.container);e.editor.setDefaultHandler("guttermousedown",function(r){if(!t.isFocused()||r.getButton()!=0)return;var i=n.getRegion(r);if(i=="foldWidgets")return;var s=r.getDocumentPosition().row,o=t.session.selection;if(r.getShiftKey())o.selectTo(s,0);else{if(r.domEvent.detail==2)return t.selectAll(),r.preventDefault();e.$clickSelection=t.selection.getLineRange(s)}return e.setState("selectByLines"),e.captureMouse(r),r.preventDefault()});var o,u,f;e.editor.setDefaultHandler("guttermousemove",function(t){var n=t.domEvent.target||t.domEvent.srcElement;if(r.hasCssClass(n,"ace_fold-widget"))return c();f&&e.$tooltipFollowsMouse&&h(t),u=t;if(o)return;o=setTimeout(function(){o=null,u&&!e.isMousePressed?l():c()},50)}),s.addListener(t.renderer.$gutter,"mouseout",function(e){u=null;if(!f||o)return;o=setTimeout(function(){o=null,c()},50)}),t.on("changeSession",c)}function a(e){o.call(this,e)}var r=e("../lib/dom"),i=e("../lib/oop"),s=e("../lib/event"),o=e("../tooltip").Tooltip;i.inherits(a,o),function(){this.setPosition=function(e,t){var n=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,i=this.getWidth(),s=this.getHeight();e+=15,t+=15,e+i>n&&(e-=e+i-n),t+s>r&&(t-=20+s),o.prototype.setPosition.call(this,e,t)}}.call(a.prototype),t.GutterHandler=u}),define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=t.MouseEvent=function(e,t){this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){r.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){r.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},this.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var n=this.getDocumentPosition();this.$inSelection=t.contains(n.row,n.column)}return this.$inSelection},this.getButton=function(){return r.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=i.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(s.prototype)}),define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";function f(e){function T(e,n){var r=Date.now(),i=!n||e.row!=n.row,s=!n||e.column!=n.column;if(!S||i||s)t.moveCursorToPosition(e),S=r,x={x:p,y:d};else{var o=l(x.x,x.y,p,d);o>a?S=null:r-S>=u&&(t.renderer.scrollCursorIntoView(),S=null)}}function N(e,n){var r=Date.now(),i=t.renderer.layerConfig.lineHeight,s=t.renderer.layerConfig.characterWidth,u=t.renderer.scroller.getBoundingClientRect(),a={x:{left:p-u.left,right:u.right-p},y:{top:d-u.top,bottom:u.bottom-d}},f=Math.min(a.x.left,a.x.right),l=Math.min(a.y.top,a.y.bottom),c={row:e.row,column:e.column};f/s<=2&&(c.column+=a.x.left<a.x.right?-3:2),l/i<=1&&(c.row+=a.y.top<a.y.bottom?-1:1);var h=e.row!=c.row,v=e.column!=c.column,m=!n||e.row!=n.row;h||v&&!m?E?r-E>=o&&t.renderer.scrollCursorIntoView(c):E=r:E=null}function C(){var e=g;g=t.renderer.screenToTextCoordinates(p,d),T(g,e),N(g,e)}function k(){m=t.selection.toOrientedRange(),h=t.session.addMarker(m,"ace_selection",t.getSelectionStyle()),t.clearSelection(),t.isFocused()&&t.renderer.$cursorLayer.setBlinking(!1),clearInterval(v),C(),v=setInterval(C,20),y=0,i.addListener(document,"mousemove",O)}function L(){clearInterval(v),t.session.removeMarker(h),h=null,t.selection.fromOrientedRange(m),t.isFocused()&&!w&&t.renderer.$cursorLayer.setBlinking(!t.getReadOnly()),m=null,g=null,y=0,E=null,S=null,i.removeListener(document,"mousemove",O)}function O(){A==null&&(A=setTimeout(function(){A!=null&&h&&L()},20))}function M(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return e=="text/plain"||e=="Text"})}function _(e){var t=["copy","copymove","all","uninitialized"],n=["move","copymove","linkmove","all","uninitialized"],r=s.isMac?e.altKey:e.ctrlKey,i="uninitialized";try{i=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var o="none";return r&&t.indexOf(i)>=0?o="copy":n.indexOf(i)>=0?o="move":t.indexOf(i)>=0&&(o="copy"),o}var t=e.editor,n=r.createElement("img");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",s.isOpera&&(n.style.cssText="width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;");var f=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];f.forEach(function(t){e[t]=this[t]},this),t.addEventListener("mousedown",this.onMouseDown.bind(e));var c=t.container,h,p,d,v,m,g,y=0,b,w,E,S,x;this.onDragStart=function(e){if(this.cancelDrag||!c.draggable){var r=this;return setTimeout(function(){r.startSelect(),r.captureMouse(e)},0),e.preventDefault()}m=t.getSelectionRange();var i=e.dataTransfer;i.effectAllowed=t.getReadOnly()?"copy":"copyMove",s.isOpera&&(t.container.appendChild(n),n.scrollTop=0),i.setDragImage&&i.setDragImage(n,0,0),s.isOpera&&t.container.removeChild(n),i.clearData(),i.setData("Text",t.session.getTextRange()),w=!0,this.setState("drag")},this.onDragEnd=function(e){c.draggable=!1,w=!1,this.setState(null);if(!t.getReadOnly()){var n=e.dataTransfer.dropEffect;!b&&n=="move"&&t.session.remove(t.getSelectionRange()),t.renderer.$cursorLayer.setBlinking(!0)}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||k(),y++,e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragOver=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||(k(),y++),A!==null&&(A=null),e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragLeave=function(e){y--;if(y<=0&&h)return L(),b=null,i.preventDefault(e)},this.onDrop=function(e){if(!g)return;var n=e.dataTransfer;if(w)switch(b){case"move":m.contains(g.row,g.column)?m={start:g,end:g}:m=t.moveText(m,g);break;case"copy":m=t.moveText(m,g,!0)}else{var r=n.getData("Text");m={start:g,end:t.session.insert(g,r)},t.focus(),b=null}return L(),i.preventDefault(e)},i.addListener(c,"dragstart",this.onDragStart.bind(e)),i.addListener(c,"dragend",this.onDragEnd.bind(e)),i.addListener(c,"dragenter",this.onDragEnter.bind(e)),i.addListener(c,"dragover",this.onDragOver.bind(e)),i.addListener(c,"dragleave",this.onDragLeave.bind(e)),i.addListener(c,"drop",this.onDrop.bind(e));var A=null}function l(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}var r=e("../lib/dom"),i=e("../lib/event"),s=e("../lib/useragent"),o=200,u=200,a=5;(function(){this.dragWait=function(){var e=Date.now()-this.mousedownEvent.time;e>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var e=this.editor.container;e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly()),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor,t=e.container;t.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var n=s.isWin?"default":"move";e.renderer.setCursorStyle(n),this.setState("dragReady")},this.onMouseDrag=function(e){var t=this.editor.container;if(s.isIE&&this.state=="dragReady"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>3&&t.dragDrop()}if(this.state==="dragWait"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(!this.$dragEnabled)return;this.mousedownEvent=e;var t=this.editor,n=e.inSelection(),r=e.getButton(),i=e.domEvent.detail||1;if(i===1&&r===0&&n){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var o=e.domEvent.target||e.domEvent.srcElement;"unselectable"in o&&(o.unselectable="on");if(t.getDragDelay()){if(s.isWebKit){this.cancelDrag=!0;var u=t.container;u.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}).call(f.prototype),t.DragdropHandler=f}),define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("./dom");t.get=function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.onreadystatechange=function(){n.readyState===4&&t(n.responseText)},n.send(null)},t.loadScript=function(e,t){var n=r.getDocumentHead(),i=document.createElement("script");i.src=e,n.appendChild(i),i.onload=i.onreadystatechange=function(e,n){if(n||!i.readyState||i.readyState=="loaded"||i.readyState=="complete")i=i.onload=i.onreadystatechange=null,n||t()}},t.qualifyURL=function(e){var t=document.createElement("a");return t.href=e,t.href}}),define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t)r&&this.setDefaultHandler(e,r.pop());else if(r){var i=r.indexOf(t);i!=-1&&r.splice(i,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?"unshift":"push"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"no use strict";function o(e){typeof console!="undefined"&&console.warn&&console.warn.apply(console,arguments)}function u(e,t){var n=new Error(e);n.data=t,typeof console=="object"&&console.error&&console.error(n),setTimeout(function(){throw n})}var r=e("./oop"),i=e("./event_emitter").EventEmitter,s={setOptions:function(e){Object.keys(e).forEach(function(t){this.setOption(t,e[t])},this)},getOptions:function(e){var t={};if(!e){var n=this.$options;e=Object.keys(n).filter(function(e){return!n[e].hidden})}else Array.isArray(e)||(t=e,e=Object.keys(t));return e.forEach(function(e){t[e]=this.getOption(e)},this),t},setOption:function(e,t){if(this["$"+e]===t)return;var n=this.$options[e];if(!n)return o('misspelled option "'+e+'"');if(n.forwardTo)return this[n.forwardTo]&&this[n.forwardTo].setOption(e,t);n.handlesSet||(this["$"+e]=t),n&&n.set&&n.set.call(this,t)},getOption:function(e){var t=this.$options[e];return t?t.forwardTo?this[t.forwardTo]&&this[t.forwardTo].getOption(e):t&&t.get?t.get.call(this):this["$"+e]:o('misspelled option "'+e+'"')}},a=function(){this.$defaultOptions={}};(function(){r.implement(this,i),this.defineOptions=function(e,t,n){return e.$options||(this.$defaultOptions[t]=e.$options={}),Object.keys(n).forEach(function(t){var r=n[t];typeof r=="string"&&(r={forwardTo:r}),r.name||(r.name=t),e.$options[r.name]=r,"initialValue"in r&&(e["$"+r.name]=r.initialValue)}),r.implement(e,s),this},this.resetOptions=function(e){Object.keys(e.$options).forEach(function(t){var n=e.$options[t];"value"in n&&e.setOption(t,n.value)})},this.setDefaultValue=function(e,t,n){var r=this.$defaultOptions[e]||(this.$defaultOptions[e]={});r[t]&&(r.forwardTo?this.setDefaultValue(r.forwardTo,t,n):r[t].value=n)},this.setDefaultValues=function(e,t){Object.keys(t).forEach(function(n){this.setDefaultValue(e,n,t[n])},this)},this.warn=o,this.reportError=u}).call(a.prototype),t.AppConfig=a}),define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/lib/net","ace/lib/app_config"],function(e,t,n){"no use strict";function l(r){if(!u||!u.document)return;a.packaged=r||e.packaged||n.packaged||u.define&&define.packaged;var i={},s="",o=document.currentScript||document._currentScript,f=o&&o.ownerDocument||document,l=f.getElementsByTagName("script");for(var h=0;h<l.length;h++){var p=l[h],d=p.src||p.getAttribute("src");if(!d)continue;var v=p.attributes;for(var m=0,g=v.length;m<g;m++){var y=v[m];y.name.indexOf("data-ace-")===0&&(i[c(y.name.replace(/^data-ace-/,""))]=y.value)}var b=d.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/);b&&(s=b[1])}s&&(i.base=i.base||s,i.packaged=!0),i.basePath=i.base,i.workerPath=i.workerPath||i.base,i.modePath=i.modePath||i.base,i.themePath=i.themePath||i.base,delete i.base;for(var w in i)typeof i[w]!="undefined"&&t.set(w,i[w])}function c(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./lib/net"),o=e("./lib/app_config").AppConfig;n.exports=t=new o;var u=function(){return this||typeof window!="undefined"&&window}(),a={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{}};t.get=function(e){if(!a.hasOwnProperty(e))throw new Error("Unknown config key: "+e);return a[e]},t.set=function(e,t){if(!a.hasOwnProperty(e))throw new Error("Unknown config key: "+e);a[e]=t},t.all=function(){return r.copyObject(a)},t.$modes={},t.moduleUrl=function(e,t){if(a.$moduleUrls[e])return a.$moduleUrls[e];var n=e.split("/");t=t||n[n.length-2]||"";var r=t=="snippets"?"/":"-",i=n[n.length-1];if(t=="worker"&&r=="-"){var s=new RegExp("^"+t+"[\\-_]|[\\-_]"+t+"$","g");i=i.replace(s,"")}(!i||i==t)&&n.length>1&&(i=n[n.length-2]);var o=a[t+"Path"];return o==null?o=a.basePath:r=="/"&&(t=r=""),o&&o.slice(-1)!="/"&&(o+="/"),o+t+r+i+this.get("suffix")},t.setModuleUrl=function(e,t){return a.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(n,r){var i,o;Array.isArray(n)&&(o=n[0],n=n[1]);try{i=e(n)}catch(u){}if(i&&!t.$loading[n])return r&&r(i);t.$loading[n]||(t.$loading[n]=[]),t.$loading[n].push(r);if(t.$loading[n].length>1)return;var a=function(){e([n],function(e){t._emit("load.module",{name:n,module:e});var r=t.$loading[n];t.$loading[n]=null,r.forEach(function(t){t&&t(e)})})};if(!t.get("packaged"))return a();s.loadScript(t.moduleUrl(n,o),a),f()};var f=function(){!a.basePath&&!a.workerPath&&!a.modePath&&!a.themePath&&!Object.keys(a.$moduleUrls).length&&(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),f=function(){})};t.init=l}),define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/config"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("./default_handlers").DefaultHandlers,o=e("./default_gutter_handler").GutterHandler,u=e("./mouse_event").MouseEvent,a=e("./dragdrop_handler").DragdropHandler,f=e("../config"),l=function(e){var t=this;this.editor=e,new s(this),new o(this),new a(this);var n=function(t){var n=!document.hasFocus||!document.hasFocus()||!e.isFocused()&&document.activeElement==(e.textInput&&e.textInput.getElement());n&&window.focus(),e.focus()},u=e.renderer.getMouseEventTarget();r.addListener(u,"click",this.onMouseEvent.bind(this,"click")),r.addListener(u,"mousemove",this.onMouseMove.bind(this,"mousemove")),r.addMultiMouseDownListener([u,e.renderer.scrollBarV&&e.renderer.scrollBarV.inner,e.renderer.scrollBarH&&e.renderer.scrollBarH.inner,e.textInput&&e.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent"),r.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel")),r.addTouchMoveListener(e.container,this.onTouchMove.bind(this,"touchmove"));var f=e.renderer.$gutter;r.addListener(f,"mousedown",this.onMouseEvent.bind(this,"guttermousedown")),r.addListener(f,"click",this.onMouseEvent.bind(this,"gutterclick")),r.addListener(f,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick")),r.addListener(f,"mousemove",this.onMouseEvent.bind(this,"guttermousemove")),r.addListener(u,"mousedown",n),r.addListener(f,"mousedown",n),i.isIE&&e.renderer.scrollBarV&&(r.addListener(e.renderer.scrollBarV.element,"mousedown",n),r.addListener(e.renderer.scrollBarH.element,"mousedown",n)),e.on("mousemove",function(n){if(t.state||t.$dragDelay||!t.$dragEnabled)return;var r=e.renderer.screenToTextCoordinates(n.x,n.y),i=e.session.selection.getRange(),s=e.renderer;!i.isEmpty()&&i.insideStart(r.row,r.column)?s.setCursorStyle("default"):s.setCursorStyle("")})};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new u(t,this.editor))},this.onMouseMove=function(e,t){var n=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;if(!n||!n.length)return;this.editor._emit(e,new u(t,this.editor))},this.onMouseWheel=function(e,t){var n=new u(t,this.editor);n.speed=this.$scrollSpeed*2,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.onTouchMove=function(e,t){var n=new u(t,this.editor);n.speed=1,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var n=this.editor,s=this.editor.renderer;s.$keepTextAreaAtCursor&&(s.$keepTextAreaAtCursor=null);var o=this,a=function(e){if(!e)return;if(i.isWebKit&&!e.which&&o.releaseMouse)return o.releaseMouse();o.x=e.clientX,o.y=e.clientY,t&&t(e),o.mouseEvent=new u(e,o.editor),o.$mouseMoved=!0},f=function(e){n.off("beforeEndOperation",c),clearInterval(h),l(),o[o.state+"End"]&&o[o.state+"End"](e),o.state="",s.$keepTextAreaAtCursor==null&&(s.$keepTextAreaAtCursor=!0,s.$moveTextAreaToCursor()),o.isMousePressed=!1,o.$onCaptureMouseMove=o.releaseMouse=null,e&&o.onMouseEvent("mouseup",e),n.endOperation()},l=function(){o[o.state]&&o[o.state](),o.$mouseMoved=!1};if(i.isOldIE&&e.domEvent.type=="dblclick")return setTimeout(function(){f(e)});var c=function(e){if(!o.releaseMouse)return;n.curOp.command.name&&n.curOp.selectionChanged&&(o[o.state+"End"]&&o[o.state+"End"](),o.state="",o.releaseMouse())};n.on("beforeEndOperation",c),n.startOperation({command:{name:"mouse"}}),o.$onCaptureMouseMove=a,o.releaseMouse=r.capture(this.editor.container,a,f);var h=setInterval(l,20)},this.releaseMouse=null,this.cancelContextMenu=function(){var e=function(t){if(t&&t.domEvent&&t.domEvent.type!="contextmenu")return;this.editor.off("nativecontextmenu",e),t&&t.domEvent&&r.stopEvent(t.domEvent)}.bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)}}).call(l.prototype),f.defineOptions(l.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:i.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=l}),define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";function i(e){e.on("click",function(t){var n=t.getDocumentPosition(),i=e.session,s=i.getFoldAt(n.row,n.column,1);s&&(t.getAccelKey()?i.removeFold(s):i.expandFold(s),t.stop());var o=t.domEvent&&t.domEvent.target;o&&r.hasCssClass(o,"ace_inline_button")&&r.hasCssClass(o,"ace_toggle_wrap")&&(i.setOption("wrap",!0),e.renderer.scrollCursorIntoView())}),e.on("gutterclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session;i.foldWidgets&&i.foldWidgets[r]&&e.session.onFoldWidgetClick(r,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session,s=i.getParentFoldRangeData(r,!0),o=s.range||s.firstRange;if(o){r=o.start.row;var u=i.getFoldAt(r,i.getLine(r).length,1);u?i.removeFold(u):(i.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}var r=e("../lib/dom");t.FoldHandler=i}),define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,t,n){"use strict";var r=e("../lib/keys"),i=e("../lib/event"),s=function(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)};(function(){this.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},this.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]==e)return;while(t[t.length-1]&&t[t.length-1]!=this.$defaultHandler)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)},this.addKeyboardHandler=function(e,t){if(!e)return;typeof e=="function"&&!e.handleKeyboard&&(e.handleKeyboard=e);var n=this.$handlers.indexOf(e);n!=-1&&this.$handlers.splice(n,1),t==undefined?this.$handlers.push(e):this.$handlers.splice(t,0,e),n==-1&&e.attach&&e.attach(this.$editor)},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return t==-1?!1:(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.getStatusText=function(){var e=this.$data,t=e.editor;return this.$handlers.map(function(n){return n.getStatusText&&n.getStatusText(t,e)||""}).filter(Boolean).join(" ")},this.$callKeyboardHandlers=function(e,t,n,r){var s,o=!1,u=this.$editor.commands;for(var a=this.$handlers.length;a--;){s=this.$handlers[a].handleKeyboard(this.$data,e,t,n,r);if(!s||!s.command)continue;s.command=="null"?o=!0:o=u.exec(s.command,this.$editor,s.args,r),o&&r&&e!=-1&&s.passEvent!=1&&s.command.passEvent!=1&&i.stopEvent(r);if(o)break}return!o&&e==-1&&(s={command:"insertstring"},o=u.exec("insertstring",this.$editor,t)),o&&this.$editor._signal&&this.$editor._signal("keyboardActivity",s),o},this.onCommandKey=function(e,t,n){var i=r.keyCodeToString(n);this.$callKeyboardHandlers(t,i,n,e)},this.onTextInput=function(e){this.$callKeyboardHandlers(-1,e)}}).call(s.prototype),t.KeyBinding=s}),define("ace/lib/bidiutil",["require","exports","module"],function(e,t,n){"use strict";function F(e,t,n,r){var i=s?d:p,c=null,h=null,v=null,m=0,g=null,y=null,b=-1,w=null,E=null,T=[];if(!r)for(w=0,r=[];w<n;w++)r[w]=R(e[w]);o=s,u=!1,a=!1,f=!1,l=!1;for(E=0;E<n;E++){c=m,T[E]=h=q(e,r,T,E),m=i[c][h],g=m&240,m&=15,t[E]=v=i[m][5];if(g>0)if(g==16){for(w=b;w<E;w++)t[w]=1;b=-1}else b=-1;y=i[m][6];if(y)b==-1&&(b=E);else if(b>-1){for(w=b;w<E;w++)t[w]=v;b=-1}r[E]==S&&(t[E]=0),o|=v}if(l)for(w=0;w<n;w++)if(r[w]==x){t[w]=s;for(var C=w-1;C>=0;C--){if(r[C]!=N)break;t[C]=s}}}function I(e,t,n){if(o<e)return;if(e==1&&s==m&&!f){n.reverse();return}var r=n.length,i=0,u,a,l,c;while(i<r){if(t[i]>=e){u=i+1;while(u<r&&t[u]>=e)u++;for(a=i,l=u-1;a<l;a++,l--)c=n[a],n[a]=n[l],n[l]=c;i=u}i++}}function q(e,t,n,r){var i=t[r],o,c,h,p;switch(i){case g:case y:u=!1;case E:case w:return i;case b:return u?w:b;case T:return u=!0,a=!0,y;case N:return E;case C:if(r<1||r+1>=t.length||(o=n[r-1])!=b&&o!=w||(c=t[r+1])!=b&&c!=w)return E;return u&&(c=w),c==o?c:E;case k:o=r>0?n[r-1]:S;if(o==b&&r+1<t.length&&t[r+1]==b)return b;return E;case L:if(r>0&&n[r-1]==b)return b;if(u)return E;p=r+1,h=t.length;while(p<h&&t[p]==L)p++;if(p<h&&t[p]==b)return b;return E;case A:h=t.length,p=r+1;while(p<h&&t[p]==A)p++;if(p<h){var d=e[r],v=d>=1425&&d<=2303||d==64286;o=t[p];if(v&&(o==y||o==T))return y}if(r<1||(o=t[r-1])==S)return E;return n[r-1];case S:return u=!1,f=!0,s;case x:return l=!0,E;case O:case M:case D:case P:case _:u=!1;case H:return E}}function R(e){var t=e.charCodeAt(0),n=t>>8;return n==0?t>191?g:B[t]:n==5?/[\u0591-\u05f4]/.test(e)?y:g:n==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e)?A:/[\u0660-\u0669\u066b-\u066c]/.test(e)?w:t==1642?L:/[\u06f0-\u06f9]/.test(e)?b:T:n==32&&t<=8287?j[t&255]:n==254?t>=65136?T:E:E}function U(e){return e>="\u064b"&&e<="\u0655"}var r=["\u0621","\u0641"],i=["\u063a","\u064a"],s=0,o=0,u=!1,a=!1,f=!1,l=!1,c=!1,h=!1,p=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],d=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],v=0,m=1,g=0,y=1,b=2,w=3,E=4,S=5,x=6,T=7,N=8,C=9,k=10,L=11,A=12,O=13,M=14,_=15,D=16,P=17,H=18,B=[H,H,H,H,H,H,H,H,H,x,S,x,N,S,H,H,H,H,H,H,H,H,H,H,H,H,H,H,S,S,S,x,N,E,E,L,L,L,E,E,E,E,E,k,C,k,C,C,b,b,b,b,b,b,b,b,b,b,C,E,E,E,E,E,E,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,E,E,E,E,E,E,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,E,E,E,E,H,H,H,H,H,H,S,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,C,E,L,L,L,L,E,E,E,E,g,E,E,H,E,E,L,L,b,b,E,g,E,E,E,b,g,E,E,E,E,E],j=[N,N,N,N,N,N,N,N,N,N,N,H,H,H,g,y,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,N,S,O,M,_,D,P,C,L,L,L,L,L,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,C,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,N];t.L=g,t.R=y,t.EN=b,t.ON_R=3,t.AN=4,t.R_H=5,t.B=6,t.RLE=7,t.DOT="\u00b7",t.doBidiReorder=function(e,n,r){if(e.length<2)return{};var i=e.split(""),o=new Array(i.length),u=new Array(i.length),a=[];s=r?m:v,F(i,a,i.length,n);for(var f=0;f<o.length;o[f]=f,f++);I(2,a,o),I(1,a,o);for(var f=0;f<o.length-1;f++)n[f]===w?a[f]=t.AN:a[f]===y&&(n[f]>T&&n[f]<O||n[f]===E||n[f]===H)?a[f]=t.ON_R:f>0&&i[f-1]==="\u0644"&&/\u0622|\u0623|\u0625|\u0627/.test(i[f])&&(a[f-1]=a[f]=t.R_H,f++);i[i.length-1]===t.DOT&&(a[i.length-1]=t.B),i[0]==="\u202b"&&(a[0]=t.RLE);for(var f=0;f<o.length;f++)u[f]=a[o[f]];return{logicalFromVisual:o,bidiLevels:u}},t.hasBidiCharacters=function(e,t){var n=!1;for(var r=0;r<e.length;r++)t[r]=R(e.charAt(r)),!n&&(t[r]==y||t[r]==T||t[r]==w)&&(n=!0);return n},t.getVisualFromLogicalIdx=function(e,t){for(var n=0;n<t.logicalFromVisual.length;n++)if(t.logicalFromVisual[n]==e)return n;return 0}}),define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(e,t,n){"use strict";var r=e("./lib/bidiutil"),i=e("./lib/lang"),s=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/,o=function(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=r,this.charWidths=[],this.EOL="\u00ac",this.showInvisibles=!0,this.isRtlDir=!1,this.line="",this.wrapIndent=0,this.EOF="\u00b6",this.RLE="\u202b",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=s.test(e.getValue())};(function(){this.isBidiRow=function(e,t,n){return this.seenBidi?(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(t,n),this.updateBidiMap()),this.bidiMap.bidiLevels):!1},this.onChange=function(e){this.seenBidi?this.currentRow=null:e.action=="insert"&&s.test(e.lines.join("\n"))&&(this.seenBidi=!0,this.currentRow=null)},this.getDocumentRow=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var n=this.session.$getRowCacheIndex(t,this.currentRow);n>=0&&(e=this.session.$docRowCache[n])}return e},this.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var n,r=this.session.$getRowCacheIndex(t,this.currentRow);while(this.currentRow-e>0){n=this.session.$getRowCacheIndex(t,this.currentRow-e-1);if(n!==r)break;r=n,e++}}else e=this.currentRow;return e},this.updateRowLine=function(e,t){e===undefined&&(e=this.getDocumentRow());var n=e===this.session.getLength()-1,s=n?this.EOF:this.EOL;this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.line.charAt(0)===this.RLE;if(this.session.$useWrapMode){var o=this.session.$wrapData[e];o&&(t===undefined&&(t=this.getSplitIndex()),t>0&&o.length?(this.wrapIndent=o.indent,this.wrapOffset=this.wrapIndent*this.charWidths[r.L],this.line=t<o.length?this.line.substring(o[t-1],o[t]):this.line.substring(o[o.length-1])):this.line=this.line.substring(0,o[t])),t==o.length&&(this.line+=this.showInvisibles?s:r.DOT)}else this.line+=this.showInvisibles?s:r.DOT;var u=this.session,a=0,f;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(e,t){return e===" "||u.isFullWidth(e.charCodeAt(0))?(f=e===" "?u.getScreenTabSize(t+a):2,a+=f-1,i.stringRepeat(r.DOT,f)):e}),this.isRtlDir&&(this.fontMetrics.$main.innerHTML=this.line.charAt(this.line.length-1)==r.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},this.updateBidiMap=function(){var e=[];r.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=r.doBidiReorder(this.line,e,this.isRtlDir):this.bidiMap={}},this.markAsDirty=function(){this.currentRow=null},this.updateCharacterWidths=function(e){if(this.characterWidth===e.$characterSize.width)return;this.fontMetrics=e;var t=this.characterWidth=e.$characterSize.width,n=e.$measureCharWidth("\u05d4");this.charWidths[r.L]=this.charWidths[r.EN]=this.charWidths[r.ON_R]=t,this.charWidths[r.R]=this.charWidths[r.AN]=n,this.charWidths[r.R_H]=n*.45,this.charWidths[r.B]=this.charWidths[r.RLE]=0,this.currentRow=null},this.setShowInvisibles=function(e){this.showInvisibles=e,this.currentRow=null},this.setEolChar=function(e){this.EOL=e},this.setContentWidth=function(e){this.contentWidth=e},this.isRtlLine=function(e){return e!=undefined?this.session.getLine(e).charAt(0)==this.RLE:this.isRtlDir},this.setRtlDirection=function(e,t){var n=e.getCursorPosition();for(var r=e.selection.getSelectionAnchor().row;r<=n.row;r++)!t&&e.session.getLine(r).charAt(0)===e.session.$bidiHandler.RLE?e.session.doc.removeInLine(r,0,1):t&&e.session.getLine(r).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:r},e.session.$bidiHandler.RLE)},this.getPosLeft=function(e){e-=this.wrapIndent;var t=this.line.charAt(0)===this.RLE?1:0,n=e>t?this.session.getOverwrite()?e:e-1:t,i=r.getVisualFromLogicalIdx(n,this.bidiMap),s=this.bidiMap.bidiLevels,o=0;!this.session.getOverwrite()&&e<=t&&s[i]%2!==0&&i++;for(var u=0;u<i;u++)o+=this.charWidths[s[u]];return!this.session.getOverwrite()&&e>t&&s[i]%2===0&&(o+=this.charWidths[s[i]]),this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(o+=this.rtlLineOffset),o},this.getSelections=function(e,t){var n=this.bidiMap,r=n.bidiLevels,i,s=[],o=0,u=Math.min(e,t)-this.wrapIndent,a=Math.max(e,t)-this.wrapIndent,f=!1,l=!1,c=0;this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var h,p=0;p<r.length;p++)h=n.logicalFromVisual[p],i=r[p],f=h>=u&&h<a,f&&!l?c=o:!f&&l&&s.push({left:c,width:o-c}),o+=this.charWidths[i],l=f;f&&p===r.length&&s.push({left:c,width:o-c});if(this.isRtlDir)for(var d=0;d<s.length;d++)s[d].left+=this.rtlLineOffset;return s},this.offsetToCol=function(e){this.isRtlDir&&(e-=this.rtlLineOffset);var t=0,e=Math.max(e,0),n=0,r=0,i=this.bidiMap.bidiLevels,s=this.charWidths[i[r]];this.wrapIndent&&(e-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);while(e>n+s/2){n+=s;if(r===i.length-1){s=0;break}s=this.charWidths[i[++r]]}return r>0&&i[r-1]%2!==0&&i[r]%2===0?(e<n&&r--,t=this.bidiMap.logicalFromVisual[r]):r>0&&i[r-1]%2===0&&i[r]%2!==0?t=1+(e>n?this.bidiMap.logicalFromVisual[r]:this.bidiMap.logicalFromVisual[r-1]):this.isRtlDir&&r===i.length-1&&s===0&&i[r-1]%2===0||!this.isRtlDir&&r===0&&i[r]%2!==0?t=1+this.bidiMap.logicalFromVisual[r]:(r>0&&i[r-1]%2!==0&&s!==0&&r--,t=this.bidiMap.logicalFromVisual[r]),t===0&&this.isRtlDir&&t++,t+this.wrapIndent}}).call(o.prototype),t.BidiHandler=o}),define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/lang"),s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=function(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var t=this;this.cursor.on("change",function(e){t.$cursorChanged=!0,t.$silent||t._emit("changeCursor"),!t.$isEmpty&&!t.$silent&&t._emit("changeSelection"),!t.$keepDesiredColumnOnChange&&e.old.column!=e.value.column&&(t.$desiredColumn=null)}),this.anchor.on("change",function(){t.$anchorChanged=!0,!t.$isEmpty&&!t.$silent&&t._emit("changeSelection")})};(function(){r.implement(this,s),this.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},this.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},this.getCursor=function(){return this.lead.getPosition()},this.setSelectionAnchor=function(e,t){this.$isEmpty=!1,this.anchor.setPosition(e,t)},this.getAnchor=this.getSelectionAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},this.getSelectionLead=function(){return this.lead.getPosition()},this.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},this.getRange=function(){var e=this.anchor,t=this.lead;return this.$isEmpty?o.fromPoints(t,t):this.isBackwards()?o.fromPoints(t,e):o.fromPoints(e,t)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},this.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},this.setRange=this.setSelectionRange=function(e,t){var n=t?e.end:e.start,r=t?e.start:e.end;this.$setSelection(n.row,n.column,r.row,r.column)},this.$setSelection=function(e,t,n,r){var i=this.$isEmpty,s=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,t),this.cursor.setPosition(n,r),this.$isEmpty=!o.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||i!=this.$isEmpty||s)&&this._emit("changeSelection")},this.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},this.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},this.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},this.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},this.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.getWordRange=function(e,t){if(typeof t=="undefined"){var n=e||this.lead;e=n.row,t=n.column}return this.session.getWordRange(e,t)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},this.getLineRange=function(e,t){var n=typeof e=="number"?e:this.lead.row,r,i=this.session.getFoldLine(n);return i?(n=i.start.row,r=i.end.row):r=n,t===!0?new o(n,0,r,this.session.getLine(r).length):new o(n,0,r+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.wouldMoveIntoSoftTab=function(e,t,n){var r=e.column,i=e.column+t;return n<0&&(r=e.column-t,i=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(r,i).split(" ").length-1==t},this.moveCursorLeft=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,-1))this.moveCursorTo(t.start.row,t.start.column);else if(e.column===0)e.row>0&&this.moveCursorTo(e.row-1,this.doc.getLine(e.row-1).length);else{var n=this.session.getTabSize();this.wouldMoveIntoSoftTab(e,n,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-n):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,1))this.moveCursorTo(t.end.row,t.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var n=this.session.getTabSize(),e=this.lead;this.wouldMoveIntoSoftTab(e,n,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,n):this.moveCursorBy(0,1)}},this.moveCursorLineStart=function(){var e=this.lead.row,t=this.lead.column,n=this.session.documentToScreenRow(e,t),r=this.session.screenToDocumentPosition(n,0),i=this.session.getDisplayLine(e,null,r.row,r.column),s=i.match(/^\s*/);s[0].length!=t&&!this.session.$useEmacsStyleLineStart&&(r.column+=s[0].length),this.moveCursorToPosition(r)},this.moveCursorLineEnd=function(){var e=this.lead,t=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==t.column){var n=this.session.getLine(t.row);if(t.column==n.length){var r=n.search(/\s+$/);r>0&&(t.column=r)}}this.moveCursorTo(t.row,t.column)},this.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var i=this.session.getFoldAt(e,t,1);if(i){this.moveCursorTo(i.end.row,i.end.column);return}this.session.nonTokenRe.exec(r)&&(t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,r=n.substring(t));if(t>=n.length){this.moveCursorTo(e,n.length),this.moveCursorRight(),e<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(r)&&(t+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)},this.moveCursorLongWordLeft=function(){var e=this.lead.row,t=this.lead.column,n;if(n=this.session.getFoldAt(e,t,-1)){this.moveCursorTo(n.start.row,n.start.column);return}var r=this.session.getFoldStringAt(e,t,-1);r==null&&(r=this.doc.getLine(e).substring(0,t));var s=i.stringReverse(r);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(s)&&(t-=this.session.nonTokenRe.lastIndex,s=s.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0);if(t<=0){this.moveCursorTo(e,0),this.moveCursorLeft(),e>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(s)&&(t-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)},this.$shortWordEndIndex=function(e){var t=0,n,r=/\s/,i=this.session.tokenRe;i.lastIndex=0;if(this.session.tokenRe.exec(e))t=this.session.tokenRe.lastIndex;else{while((n=e[t])&&r.test(n))t++;if(t<1){i.lastIndex=0;while((n=e[t])&&!i.test(n)){i.lastIndex=0,t++;if(r.test(n)){if(t>2){t--;break}while((n=e[t])&&r.test(n))t++;if(t>2)break}}}}return i.lastIndex=0,t},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t),i=this.session.getFoldAt(e,t,1);if(i)return this.moveCursorTo(i.end.row,i.end.column);if(t==n.length){var s=this.doc.getLength();do e++,r=this.doc.getLine(e);while(e<s&&/^\s*$/.test(r));/^\s+/.test(r)||(r=""),t=0}var o=this.$shortWordEndIndex(r);this.moveCursorTo(e,t+o)},this.moveCursorShortWordLeft=function(){var e=this.lead.row,t=this.lead.column,n;if(n=this.session.getFoldAt(e,t,-1))return this.moveCursorTo(n.start.row,n.start.column);var r=this.session.getLine(e).substring(0,t);if(t===0){do e--,r=this.doc.getLine(e);while(e>0&&/^\s*$/.test(r));t=r.length,/\s+$/.test(r)||(r="")}var s=i.stringReverse(r),o=this.$shortWordEndIndex(s);return this.moveCursorTo(e,t-o)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(e,t){var n=this.session.documentToScreenPosition(this.lead.row,this.lead.column),r;t===0&&(e!==0&&(this.session.$bidiHandler.isBidiRow(n.row,this.lead.row)?(r=this.session.$bidiHandler.getPosLeft(n.column),n.column=Math.round(r/this.session.$bidiHandler.charWidths[0])):r=n.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?n.column=this.$desiredColumn:this.$desiredColumn=n.column);var i=this.session.screenToDocumentPosition(n.row+e,n.column,r);e!==0&&t===0&&i.row===this.lead.row&&i.column===this.lead.column&&this.session.lineWidgets&&this.session.lineWidgets[i.row]&&(i.row>0||e>0)&&i.row++,this.moveCursorTo(i.row,i.column+t,t===0)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,n){var r=this.session.getFoldAt(e,t,1);r&&(e=r.start.row,t=r.start.column),this.$keepDesiredColumnOnChange=!0;var i=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(i.charAt(t))&&i.charAt(t-1)&&(this.lead.row==e&&this.lead.column==t+1?t-=1:t+=1),this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,n||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,n){var r=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(r.row,r.column,n)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},this.getRangeOfMovements=function(e){var t=this.getCursor();try{e(this);var n=this.getCursor();return o.fromPoints(t,n)}catch(r){return o.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},this.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},this.fromJSON=function(e){if(e.start==undefined){if(this.rangeList){this.toSingleRange(e[0]);for(var t=e.length;t--;){var n=o.fromPoints(e[t].start,e[t].end);e[t].isBackwards&&(n.cursor=n.start),this.addRange(n,!0)}return}e=e[0]}this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},this.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0}}).call(u.prototype),t.Selection=u}),define("ace/tokenizer",["require","exports","module","ace/config"],function(e,t,n){"use strict";var r=e("./config"),i=2e3,s=function(e){this.states=e,this.regExps={},this.matchMappings={};for(var t in this.states){var n=this.states[t],r=[],i=0,s=this.matchMappings[t]={defaultToken:"text"},o="g",u=[];for(var a=0;a<n.length;a++){var f=n[a];f.defaultToken&&(s.defaultToken=f.defaultToken),f.caseInsensitive&&(o="gi");if(f.regex==null)continue;f.regex instanceof RegExp&&(f.regex=f.regex.toString().slice(1,-1));var l=f.regex,c=(new RegExp("(?:("+l+")|(.))")).exec("a").length-2;Array.isArray(f.token)?f.token.length==1||c==1?f.token=f.token[0]:c-1!=f.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:f,groupCount:c-1}),f.token=f.token[0]):(f.tokenArray=f.token,f.token=null,f.onMatch=this.$arrayTokens):typeof f.token=="function"&&!f.onMatch&&(c>1?f.onMatch=this.$applyToken:f.onMatch=f.token),c>1&&(/\\\d/.test(f.regex)?l=f.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+i+1)}):(c=1,l=this.removeCapturingGroups(f.regex)),!f.splitRegex&&typeof f.token!="string"&&u.push(f)),s[i]=a,i+=c,r.push(l),f.onMatch||(f.onMatch=null)}r.length||(s[0]=0,r.push("$")),u.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,o)},this),this.regExps[t]=new RegExp("("+r.join(")|(")+")|($)",o)}};(function(){this.$setMaxTokenCount=function(e){i=e|0},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),n=this.token.apply(this,t);if(typeof n=="string")return[{type:n,value:e}];var r=[];for(var i=0,s=n.length;i<s;i++)t[i]&&(r[r.length]={type:n[i],value:t[i]});return r},this.$arrayTokens=function(e){if(!e)return[];var t=this.splitRegex.exec(e);if(!t)return"text";var n=[],r=this.tokenArray;for(var i=0,s=r.length;i<s;i++)t[i+1]&&(n[n.length]={type:r[i],value:t[i+1]});return n},this.removeCapturingGroups=function(e){var t=e.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!]|(\()/g,function(e,t){return t?"(?:":e});return t},this.createSplitterRegexp=function(e,t){if(e.indexOf("(?=")!=-1){var n=0,r=!1,i={};e.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(e,t,s,o,u,a){return r?r=u!="]":u?r=!0:o?(n==i.stack&&(i.end=a+1,i.stack=-1),n--):s&&(n++,s.length!=1&&(i.stack=n,i.start=a)),e}),i.end!=null&&/^\)*$/.test(e.substr(i.end))&&(e=e.substring(0,i.start)+e.substr(i.end))}return e.charAt(0)!="^"&&(e="^"+e),e.charAt(e.length-1)!="$"&&(e+="$"),new RegExp(e,(t||"").replace("g",""))},this.getLineTokens=function(e,t){if(t&&typeof t!="string"){var n=t.slice(0);t=n[0],t==="#tmp"&&(n.shift(),t=n.shift())}else var n=[];var r=t||"start",s=this.states[r];s||(r="start",s=this.states[r]);var o=this.matchMappings[r],u=this.regExps[r];u.lastIndex=0;var a,f=[],l=0,c=0,h={type:null,value:""};while(a=u.exec(e)){var p=o.defaultToken,d=null,v=a[0],m=u.lastIndex;if(m-v.length>l){var g=e.substring(l,m-v.length);h.type==p?h.value+=g:(h.type&&f.push(h),h={type:p,value:g})}for(var y=0;y<a.length-2;y++){if(a[y+1]===undefined)continue;d=s[o[y]],d.onMatch?p=d.onMatch(v,r,n,e):p=d.token,d.next&&(typeof d.next=="string"?r=d.next:r=d.next(r,n),s=this.states[r],s||(this.reportError("state doesn't exist",r),r="start",s=this.states[r]),o=this.matchMappings[r],l=m,u=this.regExps[r],u.lastIndex=m),d.consumeLineEnd&&(l=m);break}if(v)if(typeof p=="string")!!d&&d.merge===!1||h.type!==p?(h.type&&f.push(h),h={type:p,value:v}):h.value+=v;else if(p){h.type&&f.push(h),h={type:null,value:""};for(var y=0;y<p.length;y++)f.push(p[y])}if(l==e.length)break;l=m;if(c++>i){c>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});while(l<e.length)h.type&&f.push(h),h={value:e.substring(l,l+=2e3),type:"overflow"};r="start",n=[];break}}return h.type&&f.push(h),n.length>1&&n[0]!==r&&n.unshift("#tmp",r),{tokens:f,state:n.length?n:r}},this.reportError=r.reportError}).call(s.prototype),t.Tokenizer=s}),define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../lib/lang"),i=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(e,t){if(!t){for(var n in e)this.$rules[n]=e[n];return}for(var n in e){var r=e[n];for(var i=0;i<r.length;i++){var s=r[i];if(s.next||s.onMatch)typeof s.next=="string"&&s.next.indexOf(t)!==0&&(s.next=t+s.next),s.nextState&&s.nextState.indexOf(t)!==0&&(s.nextState=t+s.nextState)}this.$rules[t+n]=r}},this.getRules=function(){return this.$rules},this.embedRules=function(e,t,n,i,s){var o=typeof e=="function"?(new e).getRules():e;if(i)for(var u=0;u<i.length;u++)i[u]=t+i[u];else{i=[];for(var a in o)i.push(t+a)}this.addRules(o,t);if(n){var f=Array.prototype[s?"push":"unshift"];for(var u=0;u<i.length;u++)f.apply(this.$rules[i[u]],r.deepCopy(n))}this.$embeds||(this.$embeds=[]),this.$embeds.push(t)},this.getEmbeds=function(){return this.$embeds};var e=function(e,t){return(e!="start"||t.length)&&t.unshift(this.nextState,e),this.nextState},t=function(e,t){return t.shift(),t.shift()||"start"};this.normalizeRules=function(){function i(s){var o=r[s];o.processed=!0;for(var u=0;u<o.length;u++){var a=o[u],f=null;Array.isArray(a)&&(f=a,a={}),!a.regex&&a.start&&(a.regex=a.start,a.next||(a.next=[]),a.next.push({defaultToken:a.token},{token:a.token+".end",regex:a.end||a.start,next:"pop"}),a.token=a.token+".start",a.push=!0);var l=a.next||a.push;if(l&&Array.isArray(l)){var c=a.stateName;c||(c=a.token,typeof c!="string"&&(c=c[0]||""),r[c]&&(c+=n++)),r[c]=l,a.next=c,i(c)}else l=="pop"&&(a.next=t);a.push&&(a.nextState=a.next||a.push,a.next=e,delete a.push);if(a.rules)for(var h in a.rules)r[h]?r[h].push&&r[h].push.apply(r[h],a.rules[h]):r[h]=a.rules[h];var p=typeof a=="string"?a:a.include;p&&(Array.isArray(p)?f=p.map(function(e){return r[e]}):f=r[p]);if(f){var d=[u,1].concat(f);a.noEscape&&(d=d.filter(function(e){return!e.next})),o.splice.apply(o,d),u--}a.keywordMap&&(a.token=this.createKeywordMapper(a.keywordMap,a.defaultToken||"text",a.caseInsensitive),delete a.defaultToken)}}var n=0,r=this.$rules;Object.keys(r).forEach(i,this)},this.createKeywordMapper=function(e,t,n,r){var i=Object.create(null);return Object.keys(e).forEach(function(t){var s=e[t];n&&(s=s.toLowerCase());var o=s.split(r||"|");for(var u=o.length;u--;)i[o[u]]=t}),Object.getPrototypeOf(i)&&(i.__proto__=null),this.$keywordList=Object.keys(i),e=null,n?function(e){return i[e.toLowerCase()]||t}:function(e){return i[e]||t}},this.getKeywords=function(){return this.$keywords}}).call(i.prototype),t.TextHighlightRules=i}),define("ace/mode/behaviour",["require","exports","module"],function(e,t,n){"use strict";var r=function(){this.$behaviours={}};(function(){this.add=function(e,t,n){switch(undefined){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][t]=n},this.addBehaviours=function(e){for(var t in e)for(var n in e[t])this.add(t,n,e[t][n])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,t){if(typeof e=="function")var n=(new e).getBehaviours(t);else var n=e.getBehaviours(t);this.addBehaviours(n)},this.getBehaviours=function(e){if(!e)return this.$behaviours;var t={};for(var n=0;n<e.length;n++)this.$behaviours[e[n]]&&(t[e[n]]=this.$behaviours[e[n]]);return t}}).call(r.prototype),t.Behaviour=r}),define("ace/token_iterator",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("./range").Range,i=function(e,t,n){this.$session=e,this.$row=t,this.$rowTokens=e.getTokens(t);var r=e.getTokenAt(t,n);this.$tokenIndex=r?r.index:-1};(function(){this.stepBackward=function(){this.$tokenIndex-=1;while(this.$tokenIndex<0){this.$row-=1;if(this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},this.stepForward=function(){this.$tokenIndex+=1;var e;while(this.$tokenIndex>=this.$rowTokens.length){this.$row+=1,e||(e=this.$session.getLength());if(this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,n=e[t].start;if(n!==undefined)return n;n=0;while(t>0)t-=1,n+=e[t].value.length;return n},this.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},this.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],t=this.getCurrentTokenColumn();return new r(this.$row,t,this.$row,t+e.value.length)}}).call(i.prototype),t.TokenIterator=i}),define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=e("../../lib/lang"),u=["text","paren.rparen","punctuation.operator"],a=["text","paren.rparen","punctuation.operator","comment"],f,l={},c={'"':'"',"'":"'"},h=function(e){var t=-1;e.multiSelect&&(t=e.selection.index,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},p=function(e,t,n,r){var i=e.end.row-e.start.row;return{text:n+t+r,selection:[0,e.start.column+1,i,e.end.column+(i?0:1)]}},d=function(e){this.add("braces","insertion",function(t,n,r,i,s){var u=r.getCursorPosition(),a=i.doc.getLine(u.row);if(s=="{"){h(r);var l=r.getSelectionRange(),c=i.doc.getTextRange(l);if(c!==""&&c!=="{"&&r.getWrapBehavioursEnabled())return p(l,c,"{","}");if(d.isSaneInsertion(r,i))return/[\]\}\)]/.test(a[u.column])||r.inMultiSelectMode||e&&e.braces?(d.recordAutoInsert(r,i,"}"),{text:"{}",selection:[1,1]}):(d.recordMaybeInsert(r,i,"{"),{text:"{",selection:[1,1]})}else if(s=="}"){h(r);var v=a.substring(u.column,u.column+1);if(v=="}"){var m=i.$findOpeningBracket("}",{column:u.column+1,row:u.row});if(m!==null&&d.isAutoInsertedClosing(u,a,s))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else{if(s=="\n"||s=="\r\n"){h(r);var g="";d.isMaybeInsertedClosing(u,a)&&(g=o.stringRepeat("}",f.maybeInsertedBrackets),d.clearMaybeInsertedClosing());var v=a.substring(u.column,u.column+1);if(v==="}"){var y=i.findMatchingBracket({row:u.row,column:u.column+1},"}");if(!y)return null;var b=this.$getIndent(i.getLine(y.row))}else{if(!g){d.clearMaybeInsertedClosing();return}var b=this.$getIndent(a)}var w=b+i.getTabString();return{text:"\n"+w+"\n"+b+g,selection:[1,w.length,1,w.length]}}d.clearMaybeInsertedClosing()}}),this.add("braces","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="{"){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u=="}")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,n,r,i){if(i=="("){h(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return p(s,o,"(",")");if(d.isSaneInsertion(n,r))return d.recordAutoInsert(n,r,")"),{text:"()",selection:[1,1]}}else if(i==")"){h(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==")"){var l=r.$findOpeningBracket(")",{column:u.column+1,row:u.row});if(l!==null&&d.isAutoInsertedClosing(u,a,i))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="("){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==")")return i.end.column++,i}}),this.add("brackets","insertion",function(e,t,n,r,i){if(i=="["){h(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return p(s,o,"[","]");if(d.isSaneInsertion(n,r))return d.recordAutoInsert(n,r,"]"),{text:"[]",selection:[1,1]}}else if(i=="]"){h(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f=="]"){var l=r.$findOpeningBracket("]",{column:u.column+1,row:u.row});if(l!==null&&d.isAutoInsertedClosing(u,a,i))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="["){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u=="]")return i.end.column++,i}}),this.add("string_dquotes","insertion",function(e,t,n,r,i){var s=r.$mode.$quotes||c;if(i.length==1&&s[i]){if(this.lineCommentStart&&this.lineCommentStart.indexOf(i)!=-1)return;h(n);var o=i,u=n.getSelectionRange(),a=r.doc.getTextRange(u);if(a!==""&&(a.length!=1||!s[a])&&n.getWrapBehavioursEnabled())return p(u,a,o,o);if(!a){var f=n.getCursorPosition(),l=r.doc.getLine(f.row),d=l.substring(f.column-1,f.column),v=l.substring(f.column,f.column+1),m=r.getTokenAt(f.row,f.column),g=r.getTokenAt(f.row,f.column+1);if(d=="\\"&&m&&/escape/.test(m.type))return null;var y=m&&/string|escape/.test(m.type),b=!g||/string|escape/.test(g.type),w;if(v==o)w=y!==b,w&&/string\.end/.test(g.type)&&(w=!1);else{if(y&&!b)return null;if(y&&b)return null;var E=r.$mode.tokenRe;E.lastIndex=0;var S=E.test(d);E.lastIndex=0;var x=E.test(d);if(S||x)return null;if(v&&!/[\s;,.})\]\\]/.test(v))return null;w=!0}return{text:w?o+o:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.$mode.$quotes||c,o=r.doc.getTextRange(i);if(!i.isMultiLine()&&s.hasOwnProperty(o)){h(n);var u=r.doc.getLine(i.start.row),a=u.substring(i.start.column+1,i.start.column+2);if(a==o)return i.end.column++,i}})};d.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||"text",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||"text",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||"text",a)},d.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},d.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},d.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},d.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},d.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},d.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},d.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(d,i),t.CstyleBehaviour=d}),define("ace/unicode",["require","exports","module"],function(e,t,n){"use strict";var r=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],i=0,s=[];for(var o=0;o<r.length;o+=2)s.push(i+=r[o]),r[o+1]&&s.push(45,i+=r[o+1]);t.wordChars=String.fromCharCode.apply(null,s)}),define("ace/mode/text",["require","exports","module","ace/config","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(e,t,n){"use strict";var r=e("../config"),i=e("../tokenizer").Tokenizer,s=e("./text_highlight_rules").TextHighlightRules,o=e("./behaviour/cstyle").CstyleBehaviour,u=e("../unicode"),a=e("../lib/lang"),f=e("../token_iterator").TokenIterator,l=e("../range").Range,c=function(){this.HighlightRules=s};(function(){this.$defaultBehaviour=new o,this.tokenRe=new RegExp("^["+u.wordChars+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+u.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new i(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,t,n,r){function w(e){for(var t=n;t<=r;t++)e(i.getLine(t),t)}var i=t.doc,s=!0,o=!0,u=Infinity,f=t.getTabSize(),l=!1;if(!this.lineCommentStart){if(!this.blockComment)return!1;var c=this.blockComment.start,h=this.blockComment.end,p=new RegExp("^(\\s*)(?:"+a.escapeRegExp(c)+")"),d=new RegExp("(?:"+a.escapeRegExp(h)+")\\s*$"),v=function(e,t){if(g(e,t))return;if(!s||/\S/.test(e))i.insertInLine({row:t,column:e.length},h),i.insertInLine({row:t,column:u},c)},m=function(e,t){var n;(n=e.match(d))&&i.removeInLine(t,e.length-n[0].length,e.length),(n=e.match(p))&&i.removeInLine(t,n[1].length,n[0].length)},g=function(e,n){if(p.test(e))return!0;var r=t.getTokens(n);for(var i=0;i<r.length;i++)if(r[i].type==="comment")return!0}}else{if(Array.isArray(this.lineCommentStart))var p=this.lineCommentStart.map(a.escapeRegExp).join("|"),c=this.lineCommentStart[0];else var p=a.escapeRegExp(this.lineCommentStart),c=this.lineCommentStart;p=new RegExp("^(\\s*)(?:"+p+") ?"),l=t.getUseSoftTabs();var m=function(e,t){var n=e.match(p);if(!n)return;var r=n[1].length,s=n[0].length;!b(e,r,s)&&n[0][s-1]==" "&&s--,i.removeInLine(t,r,s)},y=c+" ",v=function(e,t){if(!s||/\S/.test(e))b(e,u,u)?i.insertInLine({row:t,column:u},y):i.insertInLine({row:t,column:u},c)},g=function(e,t){return p.test(e)},b=function(e,t,n){var r=0;while(t--&&e.charAt(t)==" ")r++;if(r%f!=0)return!1;var r=0;while(e.charAt(n++)==" ")r++;return f>2?r%f!=f-1:r%f==0}}var E=Infinity;w(function(e,t){var n=e.search(/\S/);n!==-1?(n<u&&(u=n),o&&!g(e,t)&&(o=!1)):E>e.length&&(E=e.length)}),u==Infinity&&(u=E,s=!1,o=!1),l&&u%f!=0&&(u=Math.floor(u/f)*f),w(o?m:v)},this.toggleBlockComment=function(e,t,n,r){var i=this.blockComment;if(!i)return;!i.start&&i[0]&&(i=i[0]);var s=new f(t,r.row,r.column),o=s.getCurrentToken(),u=t.selection,a=t.selection.toOrientedRange(),c,h;if(o&&/comment/.test(o.type)){var p,d;while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.start);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;p=new l(m,g,m,g+i.start.length);break}o=s.stepBackward()}var s=new f(t,r.row,r.column),o=s.getCurrentToken();while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.end);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;d=new l(m,g,m,g+i.end.length);break}o=s.stepForward()}d&&t.remove(d),p&&(t.remove(p),c=p.start.row,h=-i.start.length)}else h=i.start.length,c=n.start.row,t.insert(n.end,i.end),t.insert(n.start,i.start);a.start.row==c&&(a.start.column+=h),a.end.row==c&&(a.end.column+=h),t.selection.fromOrientedRange(a)},this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.autoOutdent=function(e,t,n){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){this.$embeds=[],this.$modes={};for(var t in e)if(e[t]){var n=e[t],i=n.prototype.$id,s=r.$modes[i];s||(r.$modes[i]=s=new n),r.$modes[t]||(r.$modes[t]=s),this.$embeds.push(t),this.$modes[t]=s}var o=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"];for(var t=0;t<o.length;t++)(function(e){var n=o[t],r=e[n];e[o[t]]=function(){return this.$delegator(n,arguments,r)}})(this)},this.$delegator=function(e,t,n){var r=t[0];if(typeof r!="string"){if(Array.isArray(r[2])){var i=r[2][r[2].length-1],s=this.$modes[i];if(s)return s[e].apply(s,[r[1]].concat([].slice.call(t,1)))}r=r[0]}for(var o=0;o<this.$embeds.length;o++){if(!this.$modes[this.$embeds[o]])continue;var u=r.split(this.$embeds[o]);if(!u[0]&&u[1]){t[0]=u[1];var s=this.$modes[this.$embeds[o]];return s[e].apply(s,t)}}var a=n.apply(this,t);return n?a:undefined},this.transformAction=function(e,t,n,r,i){if(this.$behaviour){var s=this.$behaviour.getBehaviours();for(var o in s)if(s[o][t]){var u=s[o][t].apply(this,arguments);if(u)return u}}},this.getKeywords=function(e){if(!this.completionKeywords){var t=this.$tokenizer.rules,n=[];for(var r in t){var i=t[r];for(var s=0,o=i.length;s<o;s++)if(typeof i[s].token=="string")/keyword|support|storage/.test(i[s].token)&&n.push(i[s].regex);else if(typeof i[s].token=="object")for(var u=0,a=i[s].token.length;u<a;u++)if(/keyword|support|storage/.test(i[s].token[u])){var r=i[s].regex.match(/\(.+?\)/g)[u];n.push(r.substr(1,r.length-2))}}this.completionKeywords=n}return e?n.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,t,n,r){var i=this.$keywordList||this.$createKeywordList();return i.map(function(e){return{name:e,value:e,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call(c.prototype),t.Mode=c}),define("ace/apply_delta",["require","exports","module"],function(e,t,n){"use strict";function r(e,t){throw console.log("Invalid Delta:",e),"Invalid Delta: "+t}function i(e,t){return t.row>=0&&t.row<e.length&&t.column>=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n=="undefined"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){function e(e,t,n){var r=n?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&r}function t(t,n,r){var i=t.action=="insert",s=(i?1:-1)*(t.end.row-t.start.row),o=(i?1:-1)*(t.end.column-t.start.column),u=t.start,a=i?u:t.end;return e(n,u,r)?{row:n.row,column:n.column}:e(a,n,!r)?{row:n.row+s,column:n.column+(n.row==a.row?o:0)}:{row:u.row,column:u.column}}r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){if(e.start.row==e.end.row&&e.start.row!=this.row)return;if(e.start.row>this.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e<this.getLength()?(t=t.concat([""]),n=0):(t=[""].concat(t),e--,n=this.$lines[e].length),this.insertMergedLines({row:e,column:n},t)},this.insertMergedLines=function(e,t){var n=this.clippedPos(e.row,e.column),r={row:n.row+t.length-1,column:(t.length==1?n.column:0)+t[t.length-1].length};return this.applyDelta({start:n,end:r,action:"insert",lines:t}),this.clonePos(r)},this.remove=function(e){var t=this.clippedPos(e.start.row,e.start.column),n=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:t,end:n,action:"remove",lines:this.getLinesForRange({start:t,end:n})}),this.clonePos(t)},this.removeInLine=function(e,t,n){var r=this.clippedPos(e,t),i=this.clippedPos(e,n);return this.applyDelta({start:r,end:i,action:"remove",lines:this.getLinesForRange({start:r,end:i})},!0),this.clonePos(r)},this.removeFullLines=function(e,t){e=Math.min(Math.max(0,e),this.getLength()-1),t=Math.min(Math.max(0,t),this.getLength()-1);var n=t==this.getLength()-1&&e>0,r=t<this.getLength()-1,i=n?e-1:e,s=n?this.getLine(i).length:0,u=r?t+1:t,a=r?0:this.getLine(u).length,f=new o(i,s,u,a),l=this.$lines.slice(e,t+1);return this.applyDelta({start:f.start,end:f.end,action:"remove",lines:this.getLinesForRange(f)}),l},this.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){e instanceof o||(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++)this.applyDelta(e[t])},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(i(this.$lines,e,t),this._signal("change",e))},this.$splitAndapplyLargeDelta=function(e,t){var n=e.lines,r=n.length-t+1,i=e.start.row,s=e.start.column;for(var o=0,u=0;o<r;o=u){u+=t-1;var a=n.slice(o,u);a.push(""),this.applyDelta({start:this.pos(i+o,s),end:this.pos(i+u,s=0),action:e.action,lines:a},!0)}e.lines=n.slice(o),e.start.row=i+o,e.start.column=s,this.applyDelta(e,!0)},this.revertDelta=function(e){this.applyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:e.action=="insert"?"remove":"insert",lines:e.lines.slice()})},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:e+n[s-1].length+r}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(a.prototype),t.Document=a}),define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=function(e,t){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var n=this;this.$worker=function(){if(!n.running)return;var e=new Date,t=n.currentLine,r=-1,i=n.doc,s=t;while(n.lines[t])t++;var o=i.getLength(),u=0;n.running=!1;while(t<o){n.$tokenizeRow(t),r=t;do t++;while(n.lines[t]);u++;if(u%5===0&&new Date-e>20){n.running=setTimeout(n.$worker,20);break}}n.currentLine=t,r==-1&&(r=t),s<=r&&n.fireUpdateEvent(s,r)}};(function(){r.implement(this,i),this.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(e,t){var n={first:e,last:t};this._signal("update",{data:n})},this.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},this.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},this.$updateOnChange=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.lines[t]=null;else if(e.action=="remove")this.lines.splice(t,n+1,null),this.states.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.lines.splice.apply(this.lines,r),this.states.splice.apply(this.states,r)}this.currentLine=Math.min(t,this.currentLine,this.doc.getLength()),this.stop()},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},this.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},this.$tokenizeRow=function(e){var t=this.doc.getLine(e),n=this.states[e-1],r=this.tokenizer.getLineTokens(t,n,e);return this.states[e]+""!=r.state+""?(this.states[e]=r.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=r.tokens}}).call(s.prototype),t.BackgroundTokenizer=s}),define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(e,t,n){this.setRegexp(e),this.clazz=t,this.type=n||"text"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){if(this.regExp+""==e+"")return;this.regExp=e,this.cache=[]},this.update=function(e,t,n,i){if(!this.regExp)return;var o=i.firstRow,u=i.lastRow;for(var a=o;a<=u;a++){var f=this.cache[a];f==null&&(f=r.getMatchOffsets(n.getLine(a),this.regExp),f.length>this.MAX_RANGES&&(f=f.slice(0,this.MAX_RANGES)),f=f.map(function(e){return new s(a,e.offset,a,e.offset+e.length)}),this.cache[a]=f.length?f:"");for(var l=f.length;l--;)t.drawSingleLineMarker(e,f[l].toScreenRange(n),this.clazz,i)}}}).call(o.prototype),t.SearchHighlight=o}),define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var n=t[t.length-1];this.range=new r(t[0].start.row,t[0].start.column,n.end.row,n.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}var r=e("../range").Range;(function(){this.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},this.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):this.range.compareStart(e.end.row,e.end.column)<0&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else{if(e.end.row!=this.start.row)throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column}e.foldLine=this},this.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},this.walk=function(e,t,n){var r=0,i=this.folds,s,o,u,a=!0;t==null&&(t=this.end.row,n=this.end.column);for(var f=0;f<i.length;f++){s=i[f],o=s.range.compareStart(t,n);if(o==-1){e(null,t,n,r,a);return}u=e(null,s.start.row,s.start.column,r,a),u=!u&&e(s.placeholder,s.start.row,s.start.column,r);if(u||o===0)return;a=!s.sameRow,r=s.end.column}e(null,t,n,r,a)},this.getNextFoldTo=function(e,t){var n,r;for(var i=0;i<this.folds.length;i++){n=this.folds[i],r=n.range.compareEnd(e,t);if(r==-1)return{fold:n,kind:"after"};if(r===0)return{fold:n,kind:"inside"}}return null},this.addRemoveChars=function(e,t,n){var r=this.getNextFoldTo(e,t),i,s;if(r){i=r.fold;if(r.kind=="inside"&&i.start.column!=t&&i.start.row!=e)window.console&&window.console.log(e,t,i);else if(i.start.row==e){s=this.folds;var o=s.indexOf(i);o===0&&(this.start.column+=n);for(o;o<s.length;o++){i=s[o],i.start.column+=n;if(!i.sameRow)return;i.end.column+=n}this.end.column+=n}}},this.split=function(e,t){var n=this.getNextFoldTo(e,t);if(!n||n.kind=="inside")return null;var r=n.fold,s=this.folds,o=this.foldData,u=s.indexOf(r),a=s[u-1];this.end.row=a.end.row,this.end.column=a.end.column,s=s.splice(u,s.length-u);var f=new i(o,s);return o.splice(o.indexOf(this)+1,0,f),f},this.merge=function(e){var t=e.folds;for(var n=0;n<t.length;n++)this.addFold(t[n]);var r=this.foldData;r.splice(r.indexOf(e),1)},this.toString=function(){var e=[this.range.toString()+": ["];return this.folds.forEach(function(t){e.push(" "+t.toString())}),e.push("]"),e.join("\n")},this.idxToPosition=function(e){var t=0;for(var n=0;n<this.folds.length;n++){var r=this.folds[n];e-=r.start.column-t;if(e<0)return{row:r.start.row,column:r.start.column+e};e-=r.placeholder.length;if(e<0)return r.start;t=r.end.column}return{row:this.end.row,column:this.end.column+e}}}).call(i.prototype),t.FoldLine=i}),define("ace/range_list",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("./range").Range,i=r.comparePoints,s=function(){this.ranges=[]};(function(){this.comparePoints=i,this.pointIndex=function(e,t,n){var r=this.ranges;for(var s=n||0;s<r.length;s++){var o=r[s],u=i(e,o.end);if(u>0)continue;var a=i(e,o.start);return u===0?t&&a!==0?-s-2:s:a>0||a===0&&!t?s:-s-1}return-s-1},this.add=function(e){var t=!e.isEmpty(),n=this.pointIndex(e.start,t);n<0&&(n=-n-1);var r=this.pointIndex(e.end,t,n);return r<0?r=-r-1:r++,this.ranges.splice(n,r-n,e)},this.addList=function(e){var t=[];for(var n=e.length;n--;)t.push.apply(t,this.add(e[n]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},this.merge=function(){var e=[],t=this.ranges;t=t.sort(function(e,t){return i(e.start,t.start)});var n=t[0],r;for(var s=1;s<t.length;s++){r=n,n=t[s];var o=i(r.end,n.start);if(o<0)continue;if(o==0&&!r.isEmpty()&&!n.isEmpty())continue;i(r.end,n.end)<0&&(r.end.row=n.end.row,r.end.column=n.end.column),t.splice(s,1),e.push(n),n=r,s--}return this.ranges=t,e},this.contains=function(e,t){return this.pointIndex({row:e,column:t})>=0},this.containsPoint=function(e){return this.pointIndex(e)>=0},this.rangeAtPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges[t]},this.clipRows=function(e,t){var n=this.ranges;if(n[0].start.row>t||n[n.length-1].start.row<e)return[];var r=this.pointIndex({row:e,column:0});r<0&&(r=-r-1);var i=this.pointIndex({row:t,column:0},r);i<0&&(i=-i-1);var s=[];for(var o=r;o<i;o++)s.push(n[o]);return s},this.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},this.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},this.detach=function(){if(!this.session)return;this.session.removeListener("change",this.onChange),this.session=null},this.$onChange=function(e){var t=e.start,n=e.end,r=t.row,i=n.row,s=this.ranges;for(var o=0,u=s.length;o<u;o++){var a=s[o];if(a.end.row>=r)break}if(e.action=="insert"){var f=i-r,l=-t.column+n.column;for(;o<u;o++){var a=s[o];if(a.start.row>r)break;a.start.row==r&&a.start.column>=t.column&&(a.start.column!=t.column||!this.$insertRight)&&(a.start.column+=l,a.start.row+=f);if(a.end.row==r&&a.end.column>=t.column){if(a.end.column==t.column&&this.$insertRight)continue;a.end.column==t.column&&l>0&&o<u-1&&a.end.column>a.start.column&&a.end.column==s[o+1].start.column&&(a.end.column-=l),a.end.column+=l,a.end.row+=f}}}else{var f=r-i,l=t.column-n.column;for(;o<u;o++){var a=s[o];if(a.start.row>i)break;a.end.row<i&&(a.end.row=r,a.end.column=t.column);if(a.start.row<i||a.start.row==i&&a.start.column<=n.colum)a.start.row=r,a.start.column=t.column;if(a.end.row==i)if(a.end.column<=n.column){if(f||a.end.column>t.column)a.end.column=t.column,a.end.row=t.row}else a.end.column+=l,a.end.row+=f;if(a.start.row==i)if(a.start.column<=n.column){if(f||a.start.column>t.column)a.start.column=t.column,a.start.row=t.row}else a.start.column+=l,a.start.row+=f}}if(f!=0&&o<u)for(;o<u;o++){var a=s[o];a.start.row+=f,a.end.row+=f}}}).call(s.prototype),t.RangeList=s}),define("ace/edit_session/fold",["require","exports","module","ace/range","ace/range_list","ace/lib/oop"],function(e,t,n){"use strict";function u(e,t){e.row-=t.row,e.row==0&&(e.column-=t.column)}function a(e,t){u(e.start,t),u(e.end,t)}function f(e,t){e.row==0&&(e.column+=t.column),e.row+=t.row}function l(e,t){f(e.start,t),f(e.end,t)}var r=e("../range").Range,i=e("../range_list").RangeList,s=e("../lib/oop"),o=t.Fold=function(e,t){this.foldLine=null,this.placeholder=t,this.range=e,this.start=e.start,this.end=e.end,this.sameRow=e.start.row==e.end.row,this.subFolds=this.ranges=[]};s.inherits(o,i),function(){this.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},this.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach(function(t){t.setFoldLine(e)})},this.clone=function(){var e=this.range.clone(),t=new o(e,this.placeholder);return this.subFolds.forEach(function(e){t.subFolds.push(e.clone())}),t.collapseChildren=this.collapseChildren,t},this.addSubFold=function(e){if(this.range.isEqual(e))return;if(!this.range.containsRange(e))throw new Error("A fold can't intersect already existing fold"+e.range+this.range);a(e,this.start);var t=e.start.row,n=e.start.column;for(var r=0,i=-1;r<this.subFolds.length;r++){i=this.subFolds[r].range.compare(t,n);if(i!=1)break}var s=this.subFolds[r];if(i==0)return s.addSubFold(e);var t=e.range.end.row,n=e.range.end.column;for(var o=r,i=-1;o<this.subFolds.length;o++){i=this.subFolds[o].range.compare(t,n);if(i!=1)break}var u=this.subFolds[o];if(i==0)throw new Error("A fold can't intersect already existing fold"+e.range+this.range);var f=this.subFolds.splice(r,o-r,e);return e.setFoldLine(this.foldLine),e},this.restoreRange=function(e){return l(e,this.start)}}.call(o.prototype)}),define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator"],function(e,t,n){"use strict";function u(){this.getFoldAt=function(e,t,n){var r=this.getFoldLine(e);if(!r)return null;var i=r.folds;for(var s=0;s<i.length;s++){var o=i[s];if(o.range.contains(e,t)){if(n==1&&o.range.isEnd(e,t))continue;if(n==-1&&o.range.isStart(e,t))continue;return o}}},this.getFoldsInRange=function(e){var t=e.start,n=e.end,r=this.$foldData,i=[];t.column+=1,n.column-=1;for(var s=0;s<r.length;s++){var o=r[s].range.compareRange(e);if(o==2)continue;if(o==-2)break;var u=r[s].folds;for(var a=0;a<u.length;a++){var f=u[a];o=f.range.compareRange(e);if(o==-2)break;if(o==2)continue;if(o==42)break;i.push(f)}}return t.column-=1,n.column+=1,i},this.getFoldsInRangeList=function(e){if(Array.isArray(e)){var t=[];e.forEach(function(e){t=t.concat(this.getFoldsInRange(e))},this)}else var t=this.getFoldsInRange(e);return t},this.getAllFolds=function(){var e=[],t=this.$foldData;for(var n=0;n<t.length;n++)for(var r=0;r<t[n].folds.length;r++)e.push(t[n].folds[r]);return e},this.getFoldStringAt=function(e,t,n,r){r=r||this.getFoldLine(e);if(!r)return null;var i={end:{column:0}},s,o;for(var u=0;u<r.folds.length;u++){o=r.folds[u];var a=o.range.compareEnd(e,t);if(a==-1){s=this.getLine(o.start.row).substring(i.end.column,o.start.column);break}if(a===0)return null;i=o}return s||(s=this.getLine(o.start.row).substring(i.end.column)),n==-1?s.substring(0,t-i.end.column):n==1?s.substring(t-i.end.column):s},this.getFoldLine=function(e,t){var n=this.$foldData,r=0;t&&(r=n.indexOf(t)),r==-1&&(r=0);for(r;r<n.length;r++){var i=n[r];if(i.start.row<=e&&i.end.row>=e)return i;if(i.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var n=this.$foldData,r=0;t&&(r=n.indexOf(t)),r==-1&&(r=0);for(r;r<n.length;r++){var i=n[r];if(i.end.row>=e)return i}return null},this.getFoldedRowCount=function(e,t){var n=this.$foldData,r=t-e+1;for(var i=0;i<n.length;i++){var s=n[i],o=s.end.row,u=s.start.row;if(o>=t){u<t&&(u>=e?r-=t-u:r=0);break}o>=e&&(u>=e?r-=o-u:r-=o-e+1)}return r},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var n=this.$foldData,r=!1,o;e instanceof s?o=e:(o=new s(t,e),o.collapseChildren=t.collapseChildren),this.$clipRangeToDocument(o.range);var u=o.start.row,a=o.start.column,f=o.end.row,l=o.end.column;if(u<f||u==f&&a<=l-2){var c=this.getFoldAt(u,a,1),h=this.getFoldAt(f,l,-1);if(c&&h==c)return c.addSubFold(o);c&&!c.range.isStart(u,a)&&this.removeFold(c),h&&!h.range.isEnd(f,l)&&this.removeFold(h);var p=this.getFoldsInRange(o.range);p.length>0&&(this.removeFolds(p),p.forEach(function(e){o.addSubFold(e)}));for(var d=0;d<n.length;d++){var v=n[d];if(f==v.start.row){v.addFold(o),r=!0;break}if(u==v.end.row){v.addFold(o),r=!0;if(!o.sameRow){var m=n[d+1];if(m&&m.start.row==f){v.merge(m);break}}break}if(f<=v.start.row)break}return r||(v=this.$addFoldLine(new i(this.$foldData,o))),this.$useWrapMode?this.$updateWrapData(v.start.row,v.start.row):this.$updateRowLengthCache(v.start.row,v.start.row),this.$modified=!0,this._signal("changeFold",{data:o,action:"add"}),o}throw new Error("The range has to be at least 2 characters width")},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var t=e.foldLine,n=t.start.row,r=t.end.row,i=this.$foldData,s=t.folds;if(s.length==1)i.splice(i.indexOf(t),1);else if(t.range.isEnd(e.end.row,e.end.column))s.pop(),t.end.row=s[s.length-1].end.row,t.end.column=s[s.length-1].end.column;else if(t.range.isStart(e.start.row,e.start.column))s.shift(),t.start.row=s[0].start.row,t.start.column=s[0].start.column;else if(e.sameRow)s.splice(s.indexOf(e),1);else{var o=t.split(e.start.row,e.start.column);s=o.folds,s.shift(),o.start.row=s[0].start.row,o.start.column=s[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(n,r):this.$updateRowLengthCache(n,r)),this.$modified=!0,this._signal("changeFold",{data:e,action:"remove"})},this.removeFolds=function(e){var t=[];for(var n=0;n<e.length;n++)t.push(e[n]);t.forEach(function(e){this.removeFold(e)},this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach(function(t){e.restoreRange(t),this.addFold(t)},this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){var n,i;e==null?(n=new r(0,0,this.getLength(),0),t=!0):typeof e=="number"?n=new r(e,0,e,this.getLine(e).length):"row"in e?n=r.fromPoints(e,e):n=e,i=this.getFoldsInRangeList(n);if(t)this.removeFolds(i);else{var s=i;while(s.length)this.expandFolds(s),s=this.getFoldsInRangeList(n)}if(i.length)return i},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var n=this.getFoldLine(e,t);return n?n.end.row:e},this.getRowFoldStart=function(e,t){var n=this.getFoldLine(e,t);return n?n.start.row:e},this.getFoldDisplayLine=function(e,t,n,r,i){r==null&&(r=e.start.row),i==null&&(i=0),t==null&&(t=e.end.row),n==null&&(n=this.getLine(t).length);var s=this.doc,o="";return e.walk(function(e,t,n,u){if(t<r)return;if(t==r){if(n<i)return;u=Math.max(i,u)}e!=null?o+=e:o+=s.getLine(t).substring(u,n)},t,n),o},this.getDisplayLine=function(e,t,n,r){var i=this.getFoldLine(e);if(!i){var s;return s=this.doc.getLine(e),s.substring(r||0,t||s.length)}return this.getFoldDisplayLine(i,e,t,n,r)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(t){var n=t.folds.map(function(e){return e.clone()});return new i(e,n)}),e},this.toggleFold=function(e){var t=this.selection,n=t.getRange(),r,i;if(n.isEmpty()){var s=n.start;r=this.getFoldAt(s.row,s.column);if(r){this.expandFold(r);return}(i=this.findMatchingBracket(s))?n.comparePoint(i)==1?n.end=i:(n.start=i,n.start.column++,n.end.column--):(i=this.findMatchingBracket({row:s.row,column:s.column+1}))?(n.comparePoint(i)==1?n.end=i:n.start=i,n.start.column++):n=this.getCommentFoldRange(s.row,s.column)||n}else{var o=this.getFoldsInRange(n);if(e&&o.length){this.expandFolds(o);return}o.length==1&&(r=o[0])}r||(r=this.getFoldAt(n.start.row,n.start.column));if(r&&r.range.toString()==n.toString()){this.expandFold(r);return}var u="...";if(!n.isMultiLine()){u=this.getTextRange(n);if(u.length<4)return;u=u.trim().substring(0,2)+".."}this.addFold(u,n)},this.getCommentFoldRange=function(e,t,n){var i=new o(this,e,t),s=i.getCurrentToken(),u=s.type;if(s&&/^comment|string/.test(u)){u=u.match(/comment|string/)[0],u=="comment"&&(u+="|doc-start");var a=new RegExp(u),f=new r;if(n!=1){do s=i.stepBackward();while(s&&a.test(s.type));i.stepForward()}f.start.row=i.getCurrentTokenRow(),f.start.column=i.getCurrentTokenColumn()+2,i=new o(this,e,t);if(n!=-1){var l=-1;do{s=i.stepForward();if(l==-1){var c=this.getState(i.$row);a.test(c)||(l=i.$row)}else if(i.$row>l)break}while(s&&a.test(s.type));s=i.stepBackward()}else s=i.getCurrentToken();return f.end.row=i.getCurrentTokenRow(),f.end.column=i.getCurrentTokenColumn()+s.value.length-2,f}},this.foldAll=function(e,t,n){n==undefined&&(n=1e5);var r=this.foldWidgets;if(!r)return;t=t||this.getLength(),e=e||0;for(var i=e;i<t;i++){r[i]==null&&(r[i]=this.getFoldWidget(i));if(r[i]!="start")continue;var s=this.getFoldWidgetRange(i);if(s&&s.isMultiLine()&&s.end.row<=t&&s.start.row>=e){i=s.end.row;try{var o=this.addFold("...",s);o&&(o.collapseChildren=n)}catch(u){}}}},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw new Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle==e)return;this.$foldStyle=e,e=="manual"&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)},this.$setFolding=function(e){if(this.$foldMode==e)return;this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation");if(!e||this.$foldStyle=="manual"){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)},this.getParentFoldRangeData=function(e,t){var n=this.foldWidgets;if(!n||t&&n[e])return{};var r=e-1,i;while(r>=0){var s=n[r];s==null&&(s=n[r]=this.getFoldWidget(r));if(s=="start"){var o=this.getFoldWidgetRange(r);i||(i=o);if(o&&o.end.row>=e)break}r--}return{range:r!==-1&&o,firstRange:i}},this.onFoldWidgetClick=function(e,t){t=t.domEvent;var n={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey},r=this.$toggleFoldWidget(e,n);if(!r){var i=t.target||t.srcElement;i&&/ace_fold-widget/.test(i.className)&&(i.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(!this.getFoldWidget)return;var n=this.getFoldWidget(e),r=this.getLine(e),i=n==="end"?-1:1,s=this.getFoldAt(e,i===-1?0:r.length,i);if(s)return t.children||t.all?this.removeFold(s):this.expandFold(s),s;var o=this.getFoldWidgetRange(e,!0);if(o&&!o.isMultiLine()){s=this.getFoldAt(o.start.row,o.start.column,1);if(s&&o.isEqual(s.range))return this.removeFold(s),s}if(t.siblings){var u=this.getParentFoldRangeData(e);if(u.range)var a=u.range.start.row+1,f=u.range.end.row;this.foldAll(a,f,t.all?1e4:0)}else t.children?(f=o?o.end.row:this.getLength(),this.foldAll(e+1,f,t.all?1e4:0)):o&&(t.all&&(o.collapseChildren=1e4),this.addFold("...",o));return o},this.toggleFoldWidget=function(e){var t=this.selection.getCursor().row;t=this.getRowFoldStart(t);var n=this.$toggleFoldWidget(t,{});if(n)return;var r=this.getParentFoldRangeData(t,!0);n=r.range||r.firstRange;if(n){t=n.start.row;var i=this.getFoldAt(t,this.getLine(t).length,1);i?this.removeFold(i):this.addFold("...",n)}},this.updateFoldWidgets=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.foldWidgets[t]=null;else if(e.action=="remove")this.foldWidgets.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.foldWidgets.splice.apply(this.foldWidgets,r)}},this.tokenizerUpdateFoldWidgets=function(e){var t=e.data;t.first!=t.last&&this.foldWidgets.length>t.first&&this.foldWidgets.splice(t.first,this.foldWidgets.length)}}var r=e("../range").Range,i=e("./fold_line").FoldLine,s=e("./fold").Fold,o=e("../token_iterator").TokenIterator;t.Folding=u}),define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,t,n){"use strict";function s(){this.findMatchingBracket=function(e,t){if(e.column==0)return null;var n=t||this.getLine(e.row).charAt(e.column-1);if(n=="")return null;var r=n.match(/([\(\[\{])|([\)\]\}])/);return r?r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e):null},this.getBracketRange=function(e){var t=this.getLine(e.row),n=!0,r,s=t.charAt(e.column-1),o=s&&s.match(/([\(\[\{])|([\)\]\}])/);o||(s=t.charAt(e.column),e={row:e.row,column:e.column+1},o=s&&s.match(/([\(\[\{])|([\)\]\}])/),n=!1);if(!o)return null;if(o[1]){var u=this.$findClosingBracket(o[1],e);if(!u)return null;r=i.fromPoints(e,u),n||(r.end.column++,r.start.column--),r.cursor=r.end}else{var u=this.$findOpeningBracket(o[2],e);if(!u)return null;r=i.fromPoints(u,e),n||(r.start.column++,r.end.column--),r.cursor=r.start}return r},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{"},this.$findOpeningBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn()-2,f=u.value;for(;;){while(a>=0){var l=f.charAt(a);if(l==i){s-=1;if(s==0)return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else l==e&&(s+=1);a-=1}do u=o.stepBackward();while(u&&!n.test(u.type));if(u==null)break;f=u.value,a=f.length-1}return null},this.$findClosingBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn();for(;;){var f=u.value,l=f.length;while(a<l){var c=f.charAt(a);if(c==i){s-=1;if(s==0)return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else c==e&&(s+=1);a+=1}do u=o.stepForward();while(u&&!n.test(u.type));if(u==null)break;a=0}return null}}var r=e("../token_iterator").TokenIterator,i=e("../range").Range;t.BracketMatch=s}),define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/document","ace/background_tokenizer","ace/search_highlight","ace/edit_session/folding","ace/edit_session/bracket_match"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/lang"),s=e("./bidihandler").BidiHandler,o=e("./config"),u=e("./lib/event_emitter").EventEmitter,a=e("./selection").Selection,f=e("./mode/text").Mode,l=e("./range").Range,c=e("./document").Document,h=e("./background_tokenizer").BackgroundTokenizer,p=e("./search_highlight").SearchHighlight,d=function(e,t){this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$foldData=[],this.id="session"+ ++d.$uid,this.$foldData.toString=function(){return this.join("\n")},this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this);if(typeof e!="object"||!e.getLine)e=new c(e);this.setDocument(e),this.selection=new a(this),this.$bidiHandler=new s(this),o.resetOptions(this),this.setMode(t),o._signal("session",this)};d.$uid=0,function(){function m(e){return e<4352?!1:e>=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510}r.implement(this,u),this.setDocument=function(e){this.doc&&this.doc.removeListener("change",this.$onChange),this.doc=e,e.on("change",this.$onChange),this.bgTokenizer&&this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},this.getDocument=function(){return this.doc},this.$resetRowCache=function(e){if(!e){this.$docRowCache=[],this.$screenRowCache=[];return}var t=this.$docRowCache.length,n=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>n&&(this.$docRowCache.splice(n,t),this.$screenRowCache.splice(n,t))},this.$getRowCacheIndex=function(e,t){var n=0,r=e.length-1;while(n<=r){var i=n+r>>1,s=e[i];if(t>s)n=i+1;else{if(!(t<s))return i;r=i-1}}return n-1},this.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.bgTokenizer&&this.bgTokenizer.start(0)},this.onChangeFold=function(e){var t=e.data;this.$resetRowCache(t.start.row)},this.onChange=function(e){this.$modified=!0,this.$bidiHandler.onChange(e),this.$resetRowCache(e.start.row);var t=this.$updateInternalDataOnChange(e);!this.$fromUndo&&this.$undoManager&&(t&&t.length&&(this.$undoManager.add({action:"removeFolds",folds:t},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add(e,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer&&this.bgTokenizer.$updateOnChange(e),this._signal("change",e)},this.setValue=function(e){this.doc.setValue(e),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},this.getValue=this.toString=function(){return this.doc.getValue()},this.getSelection=function(){return this.selection},this.getState=function(e){return this.bgTokenizer.getState(e)},this.getTokens=function(e){return this.bgTokenizer.getTokens(e)},this.getTokenAt=function(e,t){var n=this.bgTokenizer.getTokens(e),r,i=0;if(t==null){var s=n.length-1;i=this.getLine(e).length}else for(var s=0;s<n.length;s++){i+=n[s].value.length;if(i>=t)break}return r=n[s],r?(r.index=s,r.start=i-r.value.length,r):null},this.setUndoManager=function(e){this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel();if(e){var t=this;e.addSession(this),this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.mergeUndoDeltas=!1},this.$informUndoManager=i.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},this.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},this.$defaultUndoManager={undo:function(){},redo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?i.stringRepeat(" ",this.getTabSize()):" "},this.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},this.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},this.setTabSize=function(e){this.setOption("tabSize",e)},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize===0},this.setNavigateWithinSoftTabs=function(e){this.setOption("navigateWithinSoftTabs",e)},this.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},this.$overwrite=!1,this.setOverwrite=function(e){this.setOption("overwrite",e)},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._signal("changeBreakpoint",{})},this.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._signal("changeBreakpoint",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t<e.length;t++)this.$breakpoints[e[t]]="ace_breakpoint";this._signal("changeBreakpoint",{})},this.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},this.setBreakpoint=function(e,t){t===undefined&&(t="ace_breakpoint"),t?this.$breakpoints[e]=t:delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},this.clearBreakpoint=function(e){delete this.$breakpoints[e],this._signal("changeBreakpoint",{})},this.addMarker=function(e,t,n,r){var i=this.$markerId++,s={range:e,type:n||"line",renderer:typeof n=="function"?n:null,clazz:t,inFront:!!r,id:i};return r?(this.$frontMarkers[i]=s,this._signal("changeFrontMarker")):(this.$backMarkers[i]=s,this._signal("changeBackMarker")),i},this.addDynamicMarker=function(e,t){if(!e.update)return;var n=this.$markerId++;return e.id=n,e.inFront=!!t,t?(this.$frontMarkers[n]=e,this._signal("changeFrontMarker")):(this.$backMarkers[n]=e,this._signal("changeBackMarker")),e},this.removeMarker=function(e){var t=this.$frontMarkers[e]||this.$backMarkers[e];if(!t)return;var n=t.inFront?this.$frontMarkers:this.$backMarkers;delete n[e],this._signal(t.inFront?"changeFrontMarker":"changeBackMarker")},this.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},this.highlight=function(e){if(!this.$searchHighlight){var t=new p(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(t)}this.$searchHighlight.setRegexp(e)},this.highlightLines=function(e,t,n,r){typeof t!="number"&&(n=t,t=e),n||(n="ace_step");var i=new l(e,0,t,Infinity);return i.id=this.addMarker(i,n,"fullLine",r),i},this.setAnnotations=function(e){this.$annotations=e,this._signal("changeAnnotation",{})},this.getAnnotations=function(){return this.$annotations||[]},this.clearAnnotations=function(){this.setAnnotations([])},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r?\n)/m);t?this.$autoNewLine=t[1]:this.$autoNewLine="\n"},this.getWordRange=function(e,t){var n=this.getLine(e),r=!1;t>0&&(r=!!n.charAt(t-1).match(this.tokenRe)),r||(r=!!n.charAt(t).match(this.tokenRe));if(r)var i=this.tokenRe;else if(/^\s+$/.test(n.slice(t-1,t+1)))var i=/\s/;else var i=this.nonTokenRe;var s=t;if(s>0){do s--;while(s>=0&&n.charAt(s).match(i));s++}var o=t;while(o<n.length&&n.charAt(o).match(i))o++;return new l(e,s,e,o)},this.getAWordRange=function(e,t){var n=this.getWordRange(e,t),r=this.getLine(n.end.row);while(r.charAt(n.end.column).match(/[ \t]/))n.end.column+=1;return n},this.setNewLineMode=function(e){this.doc.setNewLineMode(e)},this.getNewLineMode=function(){return this.doc.getNewLineMode()},this.setUseWorker=function(e){this.setOption("useWorker",e)},this.getUseWorker=function(){return this.$useWorker},this.onReloadTokenizer=function(e){var t=e.data;this.bgTokenizer.start(t.first),this._signal("tokenizerUpdate",e)},this.$modes=o.$modes,this.$mode=null,this.$modeId=null,this.setMode=function(e,t){if(e&&typeof e=="object"){if(e.getTokenizer)return this.$onChangeMode(e);var n=e,r=n.path}else r=e||"ace/mode/text";this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new f);if(this.$modes[r]&&!n){this.$onChangeMode(this.$modes[r]),t&&t();return}this.$modeId=r,o.loadModule(["mode",r],function(e){if(this.$modeId!==r)return t&&t();this.$modes[r]&&!n?this.$onChangeMode(this.$modes[r]):e&&e.Mode&&(e=new e.Mode(n),n||(this.$modes[r]=e,e.$id=r),this.$onChangeMode(e)),t&&t()}.bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},this.$onChangeMode=function(e,t){t||(this.$modeId=e.$id);if(this.$mode===e)return;this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var n=e.getTokenizer();if(n.addEventListener!==undefined){var r=this.onReloadTokenizer.bind(this);n.addEventListener("update",r)}if(!this.bgTokenizer){this.bgTokenizer=new h(n);var i=this;this.bgTokenizer.addEventListener("update",function(e){i._signal("tokenizerUpdate",e)})}else this.bgTokenizer.setTokenizer(n);this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,t||(e.attachToSession&&e.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(e.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode"))},this.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},this.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(e){o.warn("Could not load worker",e),this.$worker=null}},this.getMode=function(){return this.$mode},this.$scrollTop=0,this.setScrollTop=function(e){if(this.$scrollTop===e||isNaN(e))return;this.$scrollTop=e,this._signal("changeScrollTop",e)},this.getScrollTop=function(){return this.$scrollTop},this.$scrollLeft=0,this.setScrollLeft=function(e){if(this.$scrollLeft===e||isNaN(e))return;this.$scrollLeft=e,this._signal("changeScrollLeft",e)},this.getScrollLeft=function(){return this.$scrollLeft},this.getScreenWidth=function(){return this.$computeWidth(),this.lineWidgets?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},this.getLineWidgetMaxWidth=function(){if(this.lineWidgetsWidth!=null)return this.lineWidgetsWidth;var e=0;return this.lineWidgets.forEach(function(t){t&&t.screenWidth>e&&(e=t.screenWidth)}),this.lineWidgetWidth=e},this.$computeWidth=function(e){if(this.$modified||e){this.$modified=!1;if(this.$useWrapMode)return this.screenWidth=this.$wrapLimit;var t=this.doc.getAllLines(),n=this.$rowLengthCache,r=0,i=0,s=this.$foldData[i],o=s?s.start.row:Infinity,u=t.length;for(var a=0;a<u;a++){if(a>o){a=s.end.row+1;if(a>=u)break;s=this.$foldData[i++],o=s?s.start.row:Infinity}n[a]==null&&(n[a]=this.$getStringScreenWidth(t[a])[0]),n[a]>r&&(r=n[a])}this.screenWidth=r}},this.getLine=function(e){return this.doc.getLine(e)},this.getLines=function(e,t){return this.doc.getLines(e,t)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},this.insert=function(e,t){return this.doc.insert(e,t)},this.remove=function(e){return this.doc.remove(e)},this.removeFullLines=function(e,t){return this.doc.removeFullLines(e,t)},this.undoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;for(var n=e.length-1;n!=-1;n--){var r=e[n];r.action=="insert"||r.action=="remove"?this.doc.revertDelta(r):r.folds&&this.addFolds(r.folds)}!t&&this.$undoSelect&&(e.selectionBefore?this.selection.fromJSON(e.selectionBefore):this.selection.setRange(this.$getUndoSelection(e,!0))),this.$fromUndo=!1},this.redoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;for(var n=0;n<e.length;n++){var r=e[n];(r.action=="insert"||r.action=="remove")&&this.doc.applyDelta(r)}!t&&this.$undoSelect&&(e.selectionAfter?this.selection.fromJSON(e.selectionAfter):this.selection.setRange(this.$getUndoSelection(e,!1))),this.$fromUndo=!1},this.setUndoSelect=function(e){this.$undoSelect=e},this.$getUndoSelection=function(e,t){function n(e){return t?e.action!=="insert":e.action==="insert"}var r,i,s;for(var o=0;o<e.length;o++){var u=e[o];if(!u.start)continue;if(!r){n(u)?(r=l.fromPoints(u.start,u.end),s=!0):(r=l.fromPoints(u.start,u.start),s=!1);continue}n(u)?(i=u.start,r.compare(i.row,i.column)==-1&&r.setStart(i),i=u.end,r.compare(i.row,i.column)==1&&r.setEnd(i),s=!0):(i=u.start,r.compare(i.row,i.column)==-1&&(r=l.fromPoints(u.start,u.start)),s=!1)}return r},this.replace=function(e,t){return this.doc.replace(e,t)},this.moveText=function(e,t,n){var r=this.getTextRange(e),i=this.getFoldsInRange(e),s=l.fromPoints(t,t);if(!n){this.remove(e);var o=e.start.row-e.end.row,u=o?-e.end.column:e.start.column-e.end.column;u&&(s.start.row==e.end.row&&s.start.column>e.end.column&&(s.start.column+=u),s.end.row==e.end.row&&s.end.column>e.end.column&&(s.end.column+=u)),o&&s.start.row>=e.end.row&&(s.start.row+=o,s.end.row+=o)}s.end=this.insert(s.start,r);if(i.length){var a=e.start,f=s.start,o=f.row-a.row,u=f.column-a.column;this.addFolds(i.map(function(e){return e=e.clone(),e.start.row==a.row&&(e.start.column+=u),e.end.row==a.row&&(e.end.column+=u),e.start.row+=o,e.end.row+=o,e}))}return s},this.indentRows=function(e,t,n){n=n.replace(/\t/g,this.getTabString());for(var r=e;r<=t;r++)this.doc.insertInLine({row:r,column:0},n)},this.outdentRows=function(e){var t=e.collapseRows(),n=new l(0,0,0,0),r=this.getTabSize();for(var i=t.start.row;i<=t.end.row;++i){var s=this.getLine(i);n.start.row=i,n.end.row=i;for(var o=0;o<r;++o)if(s.charAt(o)!=" ")break;o<r&&s.charAt(o)==" "?(n.start.column=o,n.end.column=o+1):(n.start.column=0,n.end.column=o),this.remove(n)}},this.$moveLines=function(e,t,n){e=this.getRowFoldStart(e),t=this.getRowFoldEnd(t);if(n<0){var r=this.getRowFoldStart(e+n);if(r<0)return 0;var i=r-e}else if(n>0){var r=this.getRowFoldEnd(t+n);if(r>this.doc.getLength()-1)return 0;var i=r-t}else{e=this.$clipRowToDocument(e),t=this.$clipRowToDocument(t);var i=t-e+1}var s=new l(e,0,t,Number.MAX_VALUE),o=this.getFoldsInRange(s).map(function(e){return e=e.clone(),e.start.row+=i,e.end.row+=i,e}),u=n==0?this.doc.getLines(e,t):this.doc.removeFullLines(e,t);return this.doc.insertFullLines(e+i,u),o.length&&this.addFolds(o),i},this.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},this.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},this.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},this.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},this.$clipColumnToRow=function(e,t){return t<0?0:Math.min(this.doc.getLine(e).length,t)},this.$clipPositionToDocument=function(e,t){t=Math.max(0,t);if(e<0)e=0,t=0;else{var n=this.doc.getLength();e>=n?(e=n-1,t=this.doc.getLine(n-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},this.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(e){if(e!=this.$useWrapMode){this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0);if(e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal("changeWrapMode")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(e,t){if(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==t)this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode")},this.adjustWrapLimit=function(e,t){var n=this.$wrapLimitRange;n.max<0&&(n={min:t,max:t});var r=this.$constrainWrapLimit(e,n.min,n.max);return r!=this.$wrapLimit&&r>1?(this.$wrapLimit=r,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},this.$constrainWrapLimit=function(e,t,n){return t&&(e=Math.max(t,e)),n&&(e=Math.min(n,e)),e},this.getWrapLimit=function(){return this.$wrapLimit},this.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(e){var t=this.$useWrapMode,n=e.action,r=e.start,i=e.end,s=r.row,o=i.row,u=o-s,a=null;this.$updating=!0;if(u!=0)if(n==="remove"){this[t?"$wrapData":"$rowLengthCache"].splice(s,u);var f=this.$foldData;a=this.getFoldsInRange(e),this.removeFolds(a);var l=this.getFoldLine(i.row),c=0;if(l){l.addRemoveChars(i.row,i.column,r.column-i.column),l.shiftRow(-u);var h=this.getFoldLine(s);h&&h!==l&&(h.merge(l),l=h),c=f.indexOf(l)+1}for(c;c<f.length;c++){var l=f[c];l.start.row>=i.row&&l.shiftRow(-u)}o=s}else{var p=Array(u);p.unshift(s,0);var d=t?this.$wrapData:this.$rowLengthCache;d.splice.apply(d,p);var f=this.$foldData,l=this.getFoldLine(s),c=0;if(l){var v=l.range.compareInside(r.row,r.column);v==0?(l=l.split(r.row,r.column),l&&(l.shiftRow(u),l.addRemoveChars(o,0,i.column-r.column))):v==-1&&(l.addRemoveChars(s,0,i.column-r.column),l.shiftRow(u)),c=f.indexOf(l)+1}for(c;c<f.length;c++){var l=f[c];l.start.row>=s&&l.shiftRow(u)}}else{u=Math.abs(e.start.column-e.end.column),n==="remove"&&(a=this.getFoldsInRange(e),this.removeFolds(a),u=-u);var l=this.getFoldLine(s);l&&l.addRemoveChars(s,r.column,u)}return t&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,t?this.$updateWrapData(s,o):this.$updateRowLengthCache(s,o),a},this.$updateRowLengthCache=function(e,t,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,t){var r=this.doc.getAllLines(),i=this.getTabSize(),o=this.$wrapData,u=this.$wrapLimit,a,f,l=e;t=Math.min(t,r.length-1);while(l<=t)f=this.getFoldLine(l,f),f?(a=[],f.walk(function(e,t,i,o){var u;if(e!=null){u=this.$getDisplayTokens(e,a.length),u[0]=n;for(var f=1;f<u.length;f++)u[f]=s}else u=this.$getDisplayTokens(r[t].substring(o,i),a.length);a=a.concat(u)}.bind(this),f.end.row,r[f.end.row].length+1),o[f.start.row]=this.$computeWrapSplits(a,u,i),l=f.end.row+1):(a=this.$getDisplayTokens(r[l]),o[l]=this.$computeWrapSplits(a,u,i),l++)};var e=1,t=2,n=3,s=4,a=9,c=10,d=11,v=12;this.$computeWrapSplits=function(e,r,i){function g(){var t=0;if(m===0)return t;if(p)for(var n=0;n<e.length;n++){var r=e[n];if(r==c)t+=1;else{if(r!=d){if(r==v)continue;break}t+=i}}return h&&p!==!1&&(t+=i),Math.min(t,m)}function y(t){var n=t-f;for(var r=f;r<t;r++){var i=e[r];if(i===12||i===2)n-=1}o.length||(b=g(),o.indent=b),l+=n,o.push(l),f=t}if(e.length==0)return[];var o=[],u=e.length,f=0,l=0,h=this.$wrapAsCode,p=this.$indentedSoftWrap,m=r<=Math.max(2*i,8)||p===!1?0:Math.floor(r/2),b=0;while(u-f>r-b){var w=f+r-b;if(e[w-1]>=c&&e[w]>=c){y(w);continue}if(e[w]==n||e[w]==s){for(w;w!=f-1;w--)if(e[w]==n)break;if(w>f){y(w);continue}w=f+r;for(w;w<e.length;w++)if(e[w]!=s)break;if(w==e.length)break;y(w);continue}var E=Math.max(w-(r-(r>>2)),f-1);while(w>E&&e[w]<n)w--;if(h){while(w>E&&e[w]<n)w--;while(w>E&&e[w]==a)w--}else while(w>E&&e[w]<c)w--;if(w>E){y(++w);continue}w=f+r,e[w]==t&&w--,y(w-b)}return o},this.$getDisplayTokens=function(n,r){var i=[],s;r=r||0;for(var o=0;o<n.length;o++){var u=n.charCodeAt(o);if(u==9){s=this.getScreenTabSize(i.length+r),i.push(d);for(var f=1;f<s;f++)i.push(v)}else u==32?i.push(c):u>39&&u<48||u>57&&u<64?i.push(a):u>=4352&&m(u)?i.push(e,t):i.push(e)}return i},this.$getStringScreenWidth=function(e,t,n){if(t==0)return[0,0];t==null&&(t=Infinity),n=n||0;var r,i;for(i=0;i<e.length;i++){r=e.charCodeAt(i),r==9?n+=this.getScreenTabSize(n):r>=4352&&m(r)?n+=2:n+=1;if(n>t)break}return[n,i]},this.lineWidgets=null,this.getRowLength=function(e){if(this.lineWidgets)var t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0;else t=0;return!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+1+t},this.getRowLineCount=function(e){return!this.$useWrapMode||!this.$wrapData[e]?1:this.$wrapData[e].length+1},this.getRowWrapIndent=function(e){if(this.$useWrapMode){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE),n=this.$wrapData[t.row];return n.length&&n[0]<t.column?n.indent:0}return 0},this.getScreenLastRowColumn=function(e){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(t.row,t.column)},this.getDocumentLastRowColumn=function(e,t){var n=this.documentToScreenRow(e,t);return this.getScreenLastRowColumn(n)},this.getDocumentLastRowColumnPosition=function(e,t){var n=this.documentToScreenRow(e,t);return this.screenToDocumentPosition(n,Number.MAX_VALUE/10)},this.getRowSplitData=function(e){return this.$useWrapMode?this.$wrapData[e]:undefined},this.getScreenTabSize=function(e){return this.$tabSize-e%this.$tabSize},this.screenToDocumentRow=function(e,t){return this.screenToDocumentPosition(e,t).row},this.screenToDocumentColumn=function(e,t){return this.screenToDocumentPosition(e,t).column},this.screenToDocumentPosition=function(e,t,n){if(e<0)return{row:0,column:0};var r,i=0,s=0,o,u=0,a=0,f=this.$screenRowCache,l=this.$getRowCacheIndex(f,e),c=f.length;if(c&&l>=0)var u=f[l],i=this.$docRowCache[l],h=e>f[c-1];else var h=!c;var p=this.getLength()-1,d=this.getNextFoldLine(i),v=d?d.start.row:Infinity;while(u<=e){a=this.getRowLength(i);if(u+a>e||i>=p)break;u+=a,i++,i>v&&(i=d.end.row+1,d=this.getNextFoldLine(i,d),v=d?d.start.row:Infinity),h&&(this.$docRowCache.push(i),this.$screenRowCache.push(u))}if(d&&d.start.row<=i)r=this.getFoldDisplayLine(d),i=d.start.row;else{if(u+a<=e||i>p)return{row:p,column:this.getLine(p).length};r=this.getLine(i),d=null}var m=0,g=Math.floor(e-u);if(this.$useWrapMode){var y=this.$wrapData[i];y&&(o=y[g],g>0&&y.length&&(m=y.indent,s=y[g-1]||y[y.length-1],r=r.substring(s)))}return n!==undefined&&this.$bidiHandler.isBidiRow(u+g,i,g)&&(t=this.$bidiHandler.offsetToCol(n)),s+=this.$getStringScreenWidth(r,t-m)[1],this.$useWrapMode&&s>=o&&(s=o-1),d?d.idxToPosition(s):{row:i,column:s}},this.documentToScreenPosition=function(e,t){if(typeof t=="undefined")var n=this.$clipPositionToDocument(e.row,e.column);else n=this.$clipPositionToDocument(e,t);e=n.row,t=n.column;var r=0,i=null,s=null;s=this.getFoldAt(e,t,1),s&&(e=s.start.row,t=s.start.column);var o,u=0,a=this.$docRowCache,f=this.$getRowCacheIndex(a,e),l=a.length;if(l&&f>=0)var u=a[f],r=this.$screenRowCache[f],c=e>a[l-1];else var c=!l;var h=this.getNextFoldLine(u),p=h?h.start.row:Infinity;while(u<e){if(u>=p){o=h.end.row+1;if(o>e)break;h=this.getNextFoldLine(o,h),p=h?h.start.row:Infinity}else o=u+1;r+=this.getRowLength(u),u=o,c&&(this.$docRowCache.push(u),this.$screenRowCache.push(r))}var d="";h&&u>=p?(d=this.getFoldDisplayLine(h,e,t),i=h.start.row):(d=this.getLine(e).substring(0,t),i=e);var v=0;if(this.$useWrapMode){var m=this.$wrapData[i];if(m){var g=0;while(d.length>=m[g])r++,g++;d=d.substring(m[g-1]||0,d.length),v=g>0?m.indent:0}}return{row:r,column:v+this.$getStringScreenWidth(d)[0]}},this.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},this.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},this.getScreenLength=function(){var e=0,t=null;if(!this.$useWrapMode){e=this.getLength();var n=this.$foldData;for(var r=0;r<n.length;r++)t=n[r],e-=t.end.row-t.start.row}else{var i=this.$wrapData.length,s=0,r=0,t=this.$foldData[r++],o=t?t.start.row:Infinity;while(s<i){var u=this.$wrapData[s];e+=u?u.length+1:1,s++,s>o&&(s=t.end.row+1,t=this.$foldData[r++],o=t?t.start.row:Infinity)}}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},this.$setFontMetrics=function(e){if(!this.$enableVarChar)return;this.$getStringScreenWidth=function(t,n,r){if(n===0)return[0,0];n||(n=Infinity),r=r||0;var i,s;for(s=0;s<t.length;s++){i=t.charAt(s),i===" "?r+=this.getScreenTabSize(r):r+=e.getCharacterWidth(i);if(r>n)break}return[r,s]}},this.destroy=function(){this.bgTokenizer&&(this.bgTokenizer.setDocument(null),this.bgTokenizer=null),this.$stopWorker()},this.isFullWidth=m}.call(d.prototype),e("./edit_session/folding").Folding.call(d.prototype),e("./edit_session/bracket_match").BracketMatch.call(d.prototype),o.defineOptions(d.prototype,"session",{wrap:{set:function(e){!e||e=="off"?e=!1:e=="free"?e=!0:e=="printMargin"?e=-1:typeof e=="string"&&(e=parseInt(e,10)||!1);if(this.$wrap==e)return;this.$wrap=e;if(!e)this.setUseWrapMode(!1);else{var t=typeof e=="number"?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){e=e=="auto"?this.$mode.type!="text":e!="text",e!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){if(isNaN(e)||this.$tabSize===e)return;this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize")},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(e){this.setFoldStyle(e)},handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId},handlesSet:!0}}),t.EditSession=d}),define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";function u(e,t){function n(e){return/\w/.test(e)||t.regExp?"\\b":""}return n(e[0])+e+n(e[e.length-1])}var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(){this.$options={}};(function(){this.set=function(e){return i.mixin(this.$options,e),this},this.getOptions=function(){return r.copyObject(this.$options)},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$options,n=this.$matchIterator(e,t);if(!n)return!1;var r=null;return n.forEach(function(e,n,i,o){return r=new s(e,n,i,o),n==o&&t.start&&t.start.start&&t.skipCurrent!=0&&r.isEqual(t.start)?(r=null,!1):!0}),r},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,i=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),o=[],u=t.re;if(t.$isMultiLine){var a=u.length,f=i.length-a,l;e:for(var c=u.offset||0;c<=f;c++){for(var h=0;h<a;h++)if(i[c+h].search(u[h])==-1)continue e;var p=i[c],d=i[c+a-1],v=p.length-p.match(u[0])[0].length,m=d.match(u[a-1])[0].length;if(l&&l.end.row===c&&l.end.column>v)continue;o.push(l=new s(c,v,c+a-1,m)),a>2&&(c=c+a-2)}}else for(var g=0;g<i.length;g++){var y=r.getMatchOffsets(i[g],u);for(var h=0;h<y.length;h++){var b=y[h];o.push(new s(g,b.offset,g,b.offset+b.length))}}if(n){var w=n.start.column,E=n.start.column,g=0,h=o.length-1;while(g<h&&o[g].start.column<w&&o[g].start.row==n.start.row)g++;while(g<h&&o[h].end.column>E&&o[h].end.row==n.end.row)h--;o=o.slice(g,h+1);for(g=0,h=o.length;g<h;g++)o[g].start.row+=n.start.row,o[g].end.row+=n.start.row}return o},this.replace=function(e,t){var n=this.$options,r=this.$assembleRegExp(n);if(n.$isMultiLine)return t;if(!r)return;var i=r.exec(e);if(!i||i[0].length!=e.length)return null;t=e.replace(r,t);if(n.preserveCase){t=t.split("");for(var s=Math.min(e.length,e.length);s--;){var o=e[s];o&&o.toLowerCase()!=o?t[s]=t[s].toUpperCase():t[s]=t[s].toLowerCase()}t=t.join("")}return t},this.$assembleRegExp=function(e,t){if(e.needle instanceof RegExp)return e.re=e.needle;var n=e.needle;if(!e.needle)return e.re=!1;e.regExp||(n=r.escapeRegExp(n)),e.wholeWord&&(n=u(n,e));var i=e.caseSensitive?"gm":"gmi";e.$isMultiLine=!t&&/[\n\r]/.test(n);if(e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(n,i);try{var s=new RegExp(n,i)}catch(o){s=!1}return e.re=s},this.$assembleMultilineRegExp=function(e,t){var n=e.replace(/\r\n|\r|\n/g,"$\n^").split("\n"),r=[];for(var i=0;i<n.length;i++)try{r.push(new RegExp(n[i],t))}catch(s){return!1}return r},this.$matchIterator=function(e,t){var n=this.$assembleRegExp(t);if(!n)return!1;var r=t.backwards==1,i=t.skipCurrent!=0,s=t.range,o=t.start;o||(o=s?s[r?"end":"start"]:e.selection.getRange()),o.start&&(o=o[i!=r?"end":"start"]);var u=s?s.start.row:0,a=s?s.end.row:e.getLength()-1;if(r)var f=function(e){var n=o.row;if(c(n,o.column,e))return;for(n--;n>=u;n--)if(c(n,Number.MAX_VALUE,e))return;if(t.wrap==0)return;for(n=a,u=o.row;n>=u;n--)if(c(n,Number.MAX_VALUE,e))return};else var f=function(e){var n=o.row;if(c(n,o.column,e))return;for(n+=1;n<=a;n++)if(c(n,0,e))return;if(t.wrap==0)return;for(n=u,a=o.row;n<=a;n++)if(c(n,0,e))return};if(t.$isMultiLine)var l=n.length,c=function(t,i,s){var o=r?t-l+1:t;if(o<0)return;var u=e.getLine(o),a=u.search(n[0]);if(!r&&a<i||a===-1)return;for(var f=1;f<l;f++){u=e.getLine(o+f);if(u.search(n[f])==-1)return}var c=u.match(n[l-1])[0].length;if(r&&c>i)return;if(s(o,a,o+l-1,c))return!0};else if(r)var c=function(t,r,i){var s=e.getLine(t),o=[],u,a=0;n.lastIndex=0;while(u=n.exec(s)){var f=u[0].length;a=u.index;if(!f){if(a>=s.length)break;n.lastIndex=a+=1}if(u.index+f>r)break;o.push(u.index,f)}for(var l=o.length-1;l>=0;l-=2){var c=o[l-1],f=o[l];if(i(t,c,t,c+f))return!0}};else var c=function(t,r,i){var s=e.getLine(t),o,u;n.lastIndex=r;while(u=n.exec(s)){var a=u[0].length;o=u.index;if(i(t,o,t,o+a))return!0;if(!a){n.lastIndex=o+=1;if(o>=s.length)return!1}}};return{forEach:f}}}).call(o.prototype),t.Search=o}),define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function o(e,t){this.platform=t||(i.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=!0}function u(e,t){o.call(this,e,t),this.$singleCommand=!1}var r=e("../lib/keys"),i=e("../lib/useragent"),s=r.KEY_MODS;u.prototype=o.prototype,function(){function e(e){return typeof e=="object"&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}this.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},this.removeCommand=function(e,t){var n=e&&(typeof e=="string"?e:e.name);e=this.commands[n],t||delete this.commands[n];var r=this.commandKeyBinding;for(var i in r){var s=r[i];if(s==e)delete r[i];else if(Array.isArray(s)){var o=s.indexOf(e);o!=-1&&(s.splice(o,1),s.length==1&&(r[i]=s[0]))}}},this.bindKey=function(e,t,n){typeof e=="object"&&e&&(n==undefined&&(n=e.position),e=e[this.platform]);if(!e)return;if(typeof t=="function")return this.addCommand({exec:t,bindKey:e,name:t.name||e});e.split("|").forEach(function(e){var r="";if(e.indexOf(" ")!=-1){var i=e.split(/\s+/);e=i.pop(),i.forEach(function(e){var t=this.parseKeys(e),n=s[t.hashId]+t.key;r+=(r?" ":"")+n,this._addCommandToBinding(r,"chainKeys")},this),r+=" "}var o=this.parseKeys(e),u=s[o.hashId]+o.key;this._addCommandToBinding(r+u,t,n)},this)},this._addCommandToBinding=function(t,n,r){var i=this.commandKeyBinding,s;if(!n)delete i[t];else if(!i[t]||this.$singleCommand)i[t]=n;else{Array.isArray(i[t])?(s=i[t].indexOf(n))!=-1&&i[t].splice(s,1):i[t]=[i[t]],typeof r!="number"&&(r=e(n));var o=i[t];for(s=0;s<o.length;s++){var u=o[s],a=e(u);if(a>r)break}o.splice(s,0,n)}},this.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var n=e[t];if(!n)return;if(typeof n=="string")return this.bindKey(n,t);typeof n=="function"&&(n={exec:n});if(typeof n!="object")return;n.name||(n.name=t),this.addCommand(n)},this)},this.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},this.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},this._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},this.parseKeys=function(e){var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),n=t.pop(),i=r[n];if(r.FUNCTION_KEYS[i])n=r.FUNCTION_KEYS[i].toLowerCase();else{if(!t.length)return{key:n,hashId:-1};if(t.length==1&&t[0]=="shift")return{key:n.toUpperCase(),hashId:-1}}var s=0;for(var o=t.length;o--;){var u=r.KEY_MODS[t[o]];if(u==null)return typeof console!="undefined"&&console.error("invalid modifier "+t[o]+" in "+e),!1;s|=u}return{key:n,hashId:s}},this.findKeyCommand=function(t,n){var r=s[t]+n;return this.commandKeyBinding[r]},this.handleKeyboard=function(e,t,n,r){if(r<0)return;var i=s[t]+n,o=this.commandKeyBinding[i];e.$keyChain&&(e.$keyChain+=" "+i,o=this.commandKeyBinding[e.$keyChain]||o);if(o)if(o=="chainKeys"||o[o.length-1]=="chainKeys")return e.$keyChain=e.$keyChain||i,{command:"null"};if(e.$keyChain)if(!!t&&t!=4||n.length!=1){if(t==-1||r>0)e.$keyChain=""}else e.$keyChain=e.$keyChain.slice(0,-i.length-1);return{command:o}},this.getStatusText=function(e,t){return t.$keyChain||""}}.call(o.prototype),t.HashHandler=o,t.MultiHashHandler=u}),define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,o=function(e,t){i.call(this,t,e),this.byName=this.commands,this.setDefaultHandler("exec",function(e){return e.command.exec(e.editor,e.args||{})})};r.inherits(o,i),function(){r.implement(this,s),this.exec=function(e,t,n){if(Array.isArray(e)){for(var r=e.length;r--;)if(this.exec(e[r],t,n))return!0;return!1}typeof e=="string"&&(e=this.commands[e]);if(!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;if(this.$checkCommandState!=0&&e.isAvailable&&!e.isAvailable(t))return!1;var i={editor:t,command:e,args:n};return i.returnValue=this._emit("exec",i),this._signal("afterExec",i),i.returnValue===!1?!1:!0},this.toggleRecording=function(e){if(this.$inReplay)return;return e&&e._emit("changeStatus"),this.recording?(this.macro.pop(),this.removeEventListener("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(e){this.macro.push([e.command,e.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},this.replay=function(e){if(this.$inReplay||!this.macro)return;if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){typeof t=="string"?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}},this.trimMacro=function(e){return e.map(function(e){return typeof e[0]!="string"&&(e[0]=e[0].name),e[1]||(e=e[0]),e})}}.call(o.prototype),t.CommandManager=o}),define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,t,n){"use strict";function o(e,t){return{win:e,mac:t}}var r=e("../lib/lang"),i=e("../config"),s=e("../range").Range;t.commands=[{name:"showSettingsMenu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){i.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",bindKey:o("Alt-E","F4"),exec:function(e){i.loadModule("./ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",bindKey:o("Alt-Shift-E","Shift-F4"),exec:function(e){i.loadModule("./ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",bindKey:o("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",bindKey:o(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",bindKey:o("Ctrl-L","Command-L"),exec:function(e,t){typeof t!="number"&&(t=parseInt(prompt("Enter line number:"),10)),isNaN(t)||e.gotoLine(t)},readOnly:!0},{name:"fold",bindKey:o("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:o("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",bindKey:o("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",bindKey:o("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",bindKey:o("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",bindKey:o("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",bindKey:o("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",bindKey:o("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",bindKey:o("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",bindKey:o("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",bindKey:o("Ctrl-F","Command-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",bindKey:o("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",bindKey:o("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",bindKey:o("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",bindKey:o("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",bindKey:o("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",bindKey:o("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",bindKey:o("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",bindKey:o("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",bindKey:o("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",bindKey:o("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",bindKey:o("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",bindKey:o("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",bindKey:o("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",bindKey:o("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",bindKey:o("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",bindKey:o("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",bindKey:o("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",bindKey:o("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",bindKey:o("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",bindKey:o("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",bindKey:o(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",bindKey:o("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",bindKey:o(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",bindKey:o("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",bindKey:o("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",bindKey:o("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",bindKey:o("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",bindKey:o("Ctrl-P","Ctrl-P"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",bindKey:o("Ctrl-Shift-P","Ctrl-Shift-P"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",bindKey:o("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",bindKey:o(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",exec:function(e){},readOnly:!0},{name:"cut",exec:function(e){var t=e.$copyWithEmptySelection&&e.selection.isEmpty(),n=t?e.selection.getLineRange():e.selection.getRange();e._emit("cut",n),n.isEmpty()||e.session.remove(n),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",bindKey:o("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",bindKey:o("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",bindKey:o("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",bindKey:o("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",bindKey:o("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",bindKey:o("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",bindKey:o("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",bindKey:o("Ctrl-H","Command-Option-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",bindKey:o("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",bindKey:o("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",bindKey:o("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",bindKey:o("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",bindKey:o("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",bindKey:o("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",bindKey:o("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",bindKey:o("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",bindKey:o("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",bindKey:o("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",bindKey:o("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",bindKey:o("Ctrl-Shift-Backspace",null),exec:function(e){var t=e.selection.getRange();t.start.column=0,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",bindKey:o("Ctrl-Shift-Delete",null),exec:function(e){var t=e.selection.getRange();t.end.column=Number.MAX_VALUE,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",bindKey:o("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",bindKey:o("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",bindKey:o("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",bindKey:o("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",bindKey:o("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",bindKey:o("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",exec:function(e,t){e.insert(r.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",bindKey:o(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",bindKey:o("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",bindKey:o("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",bindKey:o("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"expandtoline",bindKey:o("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"joinlines",bindKey:o(null,null),exec:function(e){var t=e.selection.isBackwards(),n=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),i=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),o=e.session.doc.getLine(n.row).length,u=e.session.doc.getTextRange(e.selection.getRange()),a=u.replace(/\n\s*/," ").length,f=e.session.doc.getLine(n.row);for(var l=n.row+1;l<=i.row+1;l++){var c=r.stringTrimLeft(r.stringTrimRight(e.session.doc.getLine(l)));c.length!==0&&(c=" "+c),f+=c}i.row+1<e.session.doc.getLength()-1&&(f+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new s(n.row,0,i.row+2,0),f),a>0?(e.selection.moveCursorTo(n.row,n.column),e.selection.selectTo(n.row,n.column+a)):(o=e.session.doc.getLine(n.row).length>o?o+1:o,e.selection.moveCursorTo(n.row,o))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,n=e.session.doc.getLine(t).length,r=e.selection.rangeList.ranges,i=[];r.length<1&&(r=[e.selection.getRange()]);for(var o=0;o<r.length;o++)o==r.length-1&&(r[o].end.row!==t||r[o].end.column!==n)&&i.push(new s(r[o].end.row,r[o].end.column,t,n)),o===0?(r[o].start.row!==0||r[o].start.column!==0)&&i.push(new s(0,0,r[o].start.row,r[o].start.column)):i.push(new s(r[o-1].end.row,r[o-1].end.column,r[o].start.row,r[o].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var o=0;o<i.length;o++)e.selection.addRange(i[o],!1)},readOnly:!0,scrollIntoView:"none"}]}),define("ace/clipboard",["require","exports","module"],function(e,t,n){"use strict";n.exports={lineMode:!1}}),define("ace/editor",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/clipboard"],function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./lib/lang"),o=e("./lib/useragent"),u=e("./keyboard/textinput").TextInput,a=e("./mouse/mouse_handler").MouseHandler,f=e("./mouse/fold_handler").FoldHandler,l=e("./keyboard/keybinding").KeyBinding,c=e("./edit_session").EditSession,h=e("./search").Search,p=e("./range").Range,d=e("./lib/event_emitter").EventEmitter,v=e("./commands/command_manager").CommandManager,m=e("./commands/default_commands").commands,g=e("./config"),y=e("./token_iterator").TokenIterator,b=e("./clipboard"),w=function(e,t,n){var r=e.getContainerElement();this.container=r,this.renderer=e,this.id="editor"+ ++w.$uid,this.commands=new v(o.isMac?"mac":"win",m),typeof document=="object"&&(this.textInput=new u(e.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new a(this),new f(this)),this.keyBinding=new l(this),this.$search=(new h).set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=s.delayedCall(function(){this._signal("input",{}),this.session&&this.session.bgTokenizer&&this.session.bgTokenizer.scheduleStart()}.bind(this)),this.on("change",function(e,t){t._$emitInputEvent.schedule(31)}),this.setSession(t||n&&n.session||new c("")),g.resetOptions(this),n&&this.setOptions(n),g._signal("editor",this)};w.$uid=0,function(){r.implement(this,d),this.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0),this.$opResetTimer=s.delayedCall(this.endOperation.bind(this,!0)),this.on("change",function(){this.curOp||(this.startOperation(),this.curOp.selectionBefore=this.$lastSel),this.curOp.docChanged=!0}.bind(this),!0),this.on("changeSelection",function(){this.curOp||(this.startOperation(),this.curOp.selectionBefore=this.$lastSel),this.curOp.selectionChanged=!0}.bind(this),!0)},this.curOp=null,this.prevOp={},this.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(this.previousCommand=null,e={}),this.$opResetTimer.schedule(),this.curOp=this.session.curOp={command:e.command||{},args:e.args,scrollTop:this.renderer.scrollTop},this.curOp.selectionBefore=this.selection.toJSON()},this.endOperation=function(e){if(this.curOp){if(e&&e.returnValue===!1)return this.curOp=null;if(e==1&&this.curOp.command&&this.curOp.command.name=="mouse")return;this._signal("beforeEndOperation");if(!this.curOp)return;var t=this.curOp.command,n=t&&t.scrollIntoView;if(n){switch(n){case"center-animate":n="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var r=this.selection.getRange(),i=this.renderer.layerConfig;(r.start.row>=i.lastRow||r.end.row<=i.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break;default:}n=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}var s=this.selection.toJSON();this.curOp.selectionAfter=s,this.$lastSel=this.selection.toJSON(),this.session.getUndoManager().addSelection(s),this.prevOp=this.curOp,this.curOp=null}},this.$mergeableCommands=["backspace","del","insertstring"],this.$historyTracker=function(e){if(!this.$mergeUndoDeltas)return;var t=this.prevOp,n=this.$mergeableCommands,r=t.command&&e.command.name==t.command.name;if(e.command.name=="insertstring"){var i=e.args;this.mergeNextCommand===undefined&&(this.mergeNextCommand=!0),r=r&&this.mergeNextCommand&&(!/\s/.test(i)||/\s/.test(t.args)),this.mergeNextCommand=!0}else r=r&&n.indexOf(e.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(r=!1),r?this.session.mergeUndoDeltas=!0:n.indexOf(e.command.name)!==-1&&(this.sequenceStartTime=Date.now())},this.setKeyboardHandler=function(e,t){if(e&&typeof e=="string"&&e!="ace"){this.$keybindingId=e;var n=this;g.loadModule(["keybinding",e],function(r){n.$keybindingId==e&&n.keyBinding.setKeyboardHandler(r&&r.handler),t&&t()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),t&&t()},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(e){if(this.session==e)return;this.curOp&&this.endOperation(),this.curOp={};var t=this.session;if(t){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange);var n=this.session.getSelection();n.off("changeCursor",this.$onCursorChange),n.off("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.on("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(e)),this._signal("changeSession",{session:e,oldSession:t}),this.curOp=null,t&&t._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this}),e&&e.bgTokenizer&&e.bgTokenizer.scheduleStart()},this.getSession=function(){return this.session},this.setValue=function(e,t){return this.session.doc.setValue(e),t?t==1?this.navigateFileEnd():t==-1&&this.navigateFileStart():this.selectAll(),e},this.getValue=function(){return this.session.getValue()},this.getSelection=function(){return this.selection},this.resize=function(e){this.renderer.onResize(e)},this.setTheme=function(e,t){this.renderer.setTheme(e,t)},this.getTheme=function(){return this.renderer.getTheme()},this.setStyle=function(e){this.renderer.setStyle(e)},this.unsetStyle=function(e){this.renderer.unsetStyle(e)},this.getFontSize=function(){return this.getOption("fontSize")||i.computedStyle(this.container).fontSize},this.setFontSize=function(e){this.setOption("fontSize",e)},this.$highlightBrackets=function(){this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null);if(this.$highlightPending)return;var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session;if(!t||!t.bgTokenizer)return;var n=t.findMatchingBracket(e.getCursorPosition());if(n)var r=new p(n.row,n.column,n.row,n.column+1);else if(t.$mode.getMatching)var r=t.$mode.getMatching(e.session);r&&(t.$bracketHighlight=t.addMarker(r,"ace_bracket","text"))},50)},this.$highlightTags=function(){if(this.$highlightTagPending)return;var e=this;this.$highlightTagPending=!0,setTimeout(function(){e.$highlightTagPending=!1;var t=e.session;if(!t||!t.bgTokenizer)return;var n=e.getCursorPosition(),r=new y(e.session,n.row,n.column),i=r.getCurrentToken();if(!i||!/\b(?:tag-open|tag-name)/.test(i.type)){t.removeMarker(t.$tagHighlight),t.$tagHighlight=null;return}if(i.type.indexOf("tag-open")!=-1){i=r.stepForward();if(!i)return}var s=i.value,o=0,u=r.stepBackward();if(u.value=="<"){do u=i,i=r.stepForward(),i&&i.value===s&&i.type.indexOf("tag-name")!==-1&&(u.value==="<"?o++:u.value==="</"&&o--);while(i&&o>=0)}else{do i=u,u=r.stepBackward(),i&&i.value===s&&i.type.indexOf("tag-name")!==-1&&(u.value==="<"?o++:u.value==="</"&&o--);while(u&&o<=0);r.stepForward()}if(!i){t.removeMarker(t.$tagHighlight),t.$tagHighlight=null;return}var a=r.getCurrentTokenRow(),f=r.getCurrentTokenColumn(),l=new p(a,f,a,f+i.value.length),c=t.$backMarkers[t.$tagHighlight];t.$tagHighlight&&c!=undefined&&l.compareRange(c.range)!==0&&(t.removeMarker(t.$tagHighlight),t.$tagHighlight=null),t.$tagHighlight||(t.$tagHighlight=t.addMarker(l,"ace_bracket","text"))},50)},this.focus=function(){var e=this;setTimeout(function(){e.isFocused()||e.textInput.focus()}),this.textInput.focus()},this.isFocused=function(){return this.textInput.isFocused()},this.blur=function(){this.textInput.blur()},this.onFocus=function(e){if(this.$isFocused)return;this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",e)},this.onBlur=function(e){if(!this.$isFocused)return;this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",e)},this.$cursorChange=function(){this.renderer.updateCursor()},this.onDocumentChange=function(e){var t=this.session.$useWrapMode,n=e.start.row==e.end.row?e.end.row:Infinity;this.renderer.updateLines(e.start.row,n,t),this._signal("change",e),this.$cursorChange(),this.$updateHighlightActiveLine()},this.onTokenizerUpdate=function(e){var t=e.data;this.renderer.updateLines(t.first,t.last)},this.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},this.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},this.onCursorChange=function(){this.$cursorChange(),this.$highlightBrackets(),this.$highlightTags(),this.$updateHighlightActiveLine(),this._signal("changeSelection")},this.$updateHighlightActiveLine=function(){var e=this.getSession(),t;if(this.$highlightActiveLine){if(this.$selectionStyle!="line"||!this.selection.isMultiLine())t=this.getCursorPosition();this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(t=!1),this.renderer.$maxLines&&this.session.getLength()===1&&!(this.renderer.$minLines>1)&&(t=!1)}if(e.$highlightLineMarker&&!t)e.removeMarker(e.$highlightLineMarker.id),e.$highlightLineMarker=null;else if(!e.$highlightLineMarker&&t){var n=new p(t.row,t.column,t.row,Infinity);n.id=e.addMarker(n,"ace_active-line","screenLine"),e.$highlightLineMarker=n}else t&&(e.$highlightLineMarker.start.row=t.row,e.$highlightLineMarker.end.row=t.row,e.$highlightLineMarker.start.column=t.column,e._signal("changeBackMarker"))},this.onSelectionChange=function(e){var t=this.session;t.$selectionMarker&&t.removeMarker(t.$selectionMarker),t.$selectionMarker=null;if(!this.selection.isEmpty()){var n=this.selection.getRange(),r=this.getSelectionStyle();t.$selectionMarker=t.addMarker(n,"ace_selection",r)}else this.$updateHighlightActiveLine();var i=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(i),this._signal("changeSelection")},this.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(t.isEmpty()||t.isMultiLine())return;var n=t.start.column,r=t.end.column,i=e.getLine(t.start.row),s=i.substring(n,r);if(s.length>5e3||!/[\w\d]/.test(s))return;var o=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:s}),u=i.substring(n-1,r+1);if(!o.test(u))return;return o},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},this.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},this.onChangeWrapLimit=function(){this.renderer.updateFull()},this.onChangeWrapMode=function(){this.renderer.onResize(!0)},this.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},this.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},this.getCopyText=function(){var e=this.getSelectedText(),t=this.session.doc.getNewLineCharacter(),n=!1;if(!e&&this.$copyWithEmptySelection){n=!0;var r=this.selection.getAllRanges();for(var i=0;i<r.length;i++){var s=r[i];if(i&&r[i-1].start.row==s.start.row)continue;e+=this.session.getLine(s.start.row)+t}}var o={text:e};return this._signal("copy",o),b.lineMode=n?o.text:"",o.text},this.onCopy=function(){this.commands.exec("copy",this)},this.onCut=function(){this.commands.exec("cut",this)},this.onPaste=function(e,t){var n={text:e,event:t};this.commands.exec("paste",this,n)},this.$handlePaste=function(e){typeof e=="string"&&(e={text:e}),this._signal("paste",e);var t=e.text,n=t==b.lineMode,r=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)n?r.insert({row:this.selection.lead.row,column:0},t):this.insert(t);else if(n)this.selection.rangeList.ranges.forEach(function(e){r.insert({row:e.start.row,column:0},t)});else{var i=t.split(/\r\n|\r|\n/),s=this.selection.rangeList.ranges;if(i.length>s.length||i.length<2||!i[1])return this.commands.exec("insertstring",this,t);for(var o=s.length;o--;){var u=s[o];u.isEmpty()||r.remove(u),r.insert(u.start,i[o])}}},this.execCommand=function(e,t){return this.commands.exec(e,this,t)},this.insert=function(e,t){var n=this.session,r=n.getMode(),i=this.getCursorPosition();if(this.getBehavioursEnabled()&&!t){var s=r.transformAction(n.getState(i.row),"insertion",this,n,e);s&&(e!==s.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),e=s.text)}e==" "&&(e=this.session.getTabString());if(!this.selection.isEmpty()){var o=this.getSelectionRange();i=this.session.remove(o),this.clearSelection()}else if(this.session.getOverwrite()&&e.indexOf("\n")==-1){var o=new p.fromPoints(i,i);o.end.column+=e.length,this.session.remove(o)}if(e=="\n"||e=="\r\n"){var u=n.getLine(i.row);if(i.column>u.search(/\S|$/)){var a=u.substr(i.column).search(/\S|$/);n.doc.removeInLine(i.row,i.column,i.column+a)}}this.clearSelection();var f=i.column,l=n.getState(i.row),u=n.getLine(i.row),c=r.checkOutdent(l,u,e),h=n.insert(i,e);s&&s.selection&&(s.selection.length==2?this.selection.setSelectionRange(new p(i.row,f+s.selection[0],i.row,f+s.selection[1])):this.selection.setSelectionRange(new p(i.row+s.selection[0],s.selection[1],i.row+s.selection[2],s.selection[3])));if(n.getDocument().isNewLine(e)){var d=r.getNextLineIndent(l,u.slice(0,i.column),n.getTabString());n.insert({row:i.row+1,column:0},d)}c&&r.autoOutdent(l,n,i.row)},this.onTextInput=function(e,t){if(!t)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var n=this.applyComposition.bind(this,e,t);this.selection.rangeCount?this.forEachSelection(n):n(),this.endOperation()},this.applyComposition=function(e,t){if(t.extendLeft||t.extendRight){var n=this.selection.getRange();n.start.column-=t.extendLeft,n.end.column+=t.extendRight,this.selection.setRange(n),!e&&!n.isEmpty()&&this.remove()}(e||!this.selection.isEmpty())&&this.insert(e,!0);if(t.restoreStart||t.restoreEnd){var n=this.selection.getRange();n.start.column-=t.restoreStart,n.end.column-=t.restoreEnd,this.selection.setRange(n)}},this.onCommandKey=function(e,t,n){this.keyBinding.onCommandKey(e,t,n)},this.setOverwrite=function(e){this.session.setOverwrite(e)},this.getOverwrite=function(){return this.session.getOverwrite()},this.toggleOverwrite=function(){this.session.toggleOverwrite()},this.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},this.getScrollSpeed=function(){return this.getOption("scrollSpeed")},this.setDragDelay=function(e){this.setOption("dragDelay",e)},this.getDragDelay=function(){return this.getOption("dragDelay")},this.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},this.getSelectionStyle=function(){return this.getOption("selectionStyle")},this.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},this.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},this.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},this.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},this.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},this.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},this.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},this.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.setReadOnly=function(e){this.setOption("readOnly",e)},this.getReadOnly=function(){return this.getOption("readOnly")},this.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},this.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},this.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},this.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},this.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},this.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.remove=function(e){this.selection.isEmpty()&&(e=="left"?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var n=this.session,r=n.getState(t.start.row),i=n.getMode().transformAction(r,"deletion",this,n,t);if(t.end.column===0){var s=n.getTextRange(t);if(s[s.length-1]=="\n"){var o=n.getLine(t.end.row);/^\s+$/.test(o)&&(t.end.column=o.length)}}i&&(t=i)}this.session.remove(t),this.clearSelection()},this.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},this.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},this.transposeLetters=function(){if(!this.selection.isEmpty())return;var e=this.getCursorPosition(),t=e.column;if(t===0)return;var n=this.session.getLine(e.row),r,i;t<n.length?(r=n.charAt(t)+n.charAt(t-1),i=new p(e.row,t-1,e.row,t+1)):(r=n.charAt(t-1)+n.charAt(t-2),i=new p(e.row,t-2,e.row,t)),this.session.replace(i,r),this.session.selection.moveToPosition(i.end)},this.toLowerCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),n=this.session.getTextRange(t);this.session.replace(t,n.toLowerCase()),this.selection.setSelectionRange(e)},this.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),n=this.session.getTextRange(t);this.session.replace(t,n.toUpperCase()),this.selection.setSelectionRange(e)},this.indent=function(){var e=this.session,t=this.getSelectionRange();if(t.start.row<t.end.row){var n=this.$getSelectedRows();e.indentRows(n.first,n.last," ");return}if(t.start.column<t.end.column){var r=e.getTextRange(t);if(!/^\s+$/.test(r)){var n=this.$getSelectedRows();e.indentRows(n.first,n.last," ");return}}var i=e.getLine(t.start.row),o=t.start,u=e.getTabSize(),a=e.documentToScreenColumn(o.row,o.column);if(this.session.getUseSoftTabs())var f=u-a%u,l=s.stringRepeat(" ",f);else{var f=a%u;while(i[t.start.column-1]==" "&&f)t.start.column--,f--;this.selection.setSelectionRange(t),l=" "}return this.insert(l)},this.blockIndent=function(){var e=this.$getSelectedRows();this.session.indentRows(e.first,e.last," ")},this.blockOutdent=function(){var e=this.session.getSelection();this.session.outdentRows(e.getRange())},this.sortLines=function(){var e=this.$getSelectedRows(),t=this.session,n=[];for(var r=e.first;r<=e.last;r++)n.push(t.getLine(r));n.sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:e.toLowerCase()>t.toLowerCase()?1:0});var i=new p(0,0,0,0);for(var r=e.first;r<=e.last;r++){var s=t.getLine(r);i.start.row=r,i.end.row=r,i.end.column=s.length,t.replace(i,n[r-e.first])}},this.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},this.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),n=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,n,e)},this.getNumberAt=function(e,t){var n=/[\-]?[0-9]+(?:\.[0-9]+)?/g;n.lastIndex=0;var r=this.session.getLine(e);while(n.lastIndex<t){var i=n.exec(r);if(i.index<=t&&i.index+i[0].length>=t){var s={value:i[0],start:i.index,end:i.index+i[0].length};return s}}return null},this.modifyNumber=function(e){var t=this.selection.getCursor().row,n=this.selection.getCursor().column,r=new p(t,n-1,t,n),i=this.session.getTextRange(r);if(!isNaN(parseFloat(i))&&isFinite(i)){var s=this.getNumberAt(t,n);if(s){var o=s.value.indexOf(".")>=0?s.start+s.value.indexOf(".")+1:s.end,u=s.start+s.value.length-o,a=parseFloat(s.value);a*=Math.pow(10,u),o!==s.end&&n<o?e*=Math.pow(10,s.end-n-1):e*=Math.pow(10,s.end-n),a+=e,a/=Math.pow(10,u);var f=a.toFixed(u),l=new p(t,s.start,t,s.end);this.session.replace(l,f),this.moveCursorTo(t,Math.max(s.start+1,n+f.length-s.value.length))}}else this.toggleWord()},this.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],this.toggleWord=function(){var e=this.selection.getCursor().row,t=this.selection.getCursor().column;this.selection.selectWord();var n=this.getSelectedText(),r=this.selection.getWordRange().start.column,i=n.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),o=t-r-1;o<0&&(o=0);var u=0,a=0,f=this;n.match(/[A-Za-z0-9_]+/)&&i.forEach(function(t,i){a=u+t.length,o>=u&&o<=a&&(n=t,f.selection.clearSelection(),f.moveCursorTo(e,u+r),f.selection.selectTo(e,a+r)),u=a});var l=this.$toggleWordPairs,c;for(var h=0;h<l.length;h++){var p=l[h];for(var d=0;d<=1;d++){var v=+!d,m=n.match(new RegExp("^\\s?_?("+s.escapeRegExp(p[d])+")\\s?$","i"));if(m){var g=n.match(new RegExp("([_]|^|\\s)("+s.escapeRegExp(m[1])+")($|\\s)","g"));g&&(c=n.replace(new RegExp(s.escapeRegExp(p[d]),"i"),function(e){var t=p[v];return e.toUpperCase()==e?t=t.toUpperCase():e.charAt(0).toUpperCase()==e.charAt(0)&&(t=t.substr(0,0)+p[v].charAt(0).toUpperCase()+t.substr(1)),t}),this.insert(c),c="")}}}},this.removeLines=function(){var e=this.$getSelectedRows();this.session.removeFullLines(e.first,e.last),this.clearSelection()},this.duplicateSelection=function(){var e=this.selection,t=this.session,n=e.getRange(),r=e.isBackwards();if(n.isEmpty()){var i=n.start.row;t.duplicateLines(i,i)}else{var s=r?n.start:n.end,o=t.insert(s,t.getTextRange(n),!1);n.start=s,n.end=o,e.setSelectionRange(n,r)}},this.moveLinesDown=function(){this.$moveLines(1,!1)},this.moveLinesUp=function(){this.$moveLines(-1,!1)},this.moveText=function(e,t,n){return this.session.moveText(e,t,n)},this.copyLinesUp=function(){this.$moveLines(-1,!0)},this.copyLinesDown=function(){this.$moveLines(1,!0)},this.$moveLines=function(e,t){var n,r,i=this.selection;if(!i.inMultiSelectMode||this.inVirtualSelectionMode){var s=i.toOrientedRange();n=this.$getSelectedRows(s),r=this.session.$moveLines(n.first,n.last,t?0:e),t&&e==-1&&(r=0),s.moveBy(r,0),i.fromOrientedRange(s)}else{var o=i.rangeList.ranges;i.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;var u=0,a=0,f=o.length;for(var l=0;l<f;l++){var c=l;o[l].moveBy(u,0),n=this.$getSelectedRows(o[l]);var h=n.first,p=n.last;while(++l<f){a&&o[l].moveBy(a,0);var d=this.$getSelectedRows(o[l]);if(t&&d.first!=p)break;if(!t&&d.first>p+1)break;p=d.last}l--,u=this.session.$moveLines(h,p,t?0:e),t&&e==-1&&(c=l+1);while(c<=l)o[c].moveBy(u,0),c++;t||(u=0),a+=u}i.fromOrientedRange(i.ranges[0]),i.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},this.$getSelectedRows=function(e){return e=(e||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},this.onCompositionStart=function(e){this.renderer.showComposition(e)},this.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},this.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},this.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},this.$moveByPage=function(e,t){var n=this.renderer,r=this.renderer.layerConfig,i=e*Math.floor(r.height/r.lineHeight);t===!0?this.selection.$moveSelection(function(){this.moveCursorBy(i,0)}):t===!1&&(this.selection.moveCursorBy(i,0),this.selection.clearSelection());var s=n.scrollTop;n.scrollBy(0,i*r.lineHeight),t!=null&&n.scrollCursorIntoView(null,.5),n.animateScrolling(s)},this.selectPageDown=function(){this.$moveByPage(1,!0)},this.selectPageUp=function(){this.$moveByPage(-1,!0)},this.gotoPageDown=function(){this.$moveByPage(1,!1)},this.gotoPageUp=function(){this.$moveByPage(-1,!1)},this.scrollPageDown=function(){this.$moveByPage(1)},this.scrollPageUp=function(){this.$moveByPage(-1)},this.scrollToRow=function(e){this.renderer.scrollToRow(e)},this.scrollToLine=function(e,t,n,r){this.renderer.scrollToLine(e,t,n,r)},this.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},this.getSelectionRange=function(){return this.selection.getRange()},this.selectAll=function(){this.selection.selectAll()},this.clearSelection=function(){this.selection.clearSelection()},this.moveCursorTo=function(e,t){this.selection.moveCursorTo(e,t)},this.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},this.jumpToMatching=function(e,t){var n=this.getCursorPosition(),r=new y(this.session,n.row,n.column),i=r.getCurrentToken(),s=i||r.stepForward();if(!s)return;var o,u=!1,a={},f=n.column-s.start,l,c={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(s.value.match(/[{}()\[\]]/g))for(;f<s.value.length&&!u;f++){if(!c[s.value[f]])continue;l=c[s.value[f]]+"."+s.type.replace("rparen","lparen"),isNaN(a[l])&&(a[l]=0);switch(s.value[f]){case"(":case"[":case"{":a[l]++;break;case")":case"]":case"}":a[l]--,a[l]===-1&&(o="bracket",u=!0)}}else s.type.indexOf("tag-name")!==-1&&(isNaN(a[s.value])&&(a[s.value]=0),i.value==="<"?a[s.value]++:i.value==="</"&&a[s.value]--,a[s.value]===-1&&(o="tag",u=!0));u||(i=s,s=r.stepForward(),f=0)}while(s&&!u);if(!o)return;var h,d;if(o==="bracket"){h=this.session.getBracketRange(n);if(!h){h=new p(r.getCurrentTokenRow(),r.getCurrentTokenColumn()+f-1,r.getCurrentTokenRow(),r.getCurrentTokenColumn()+f-1),d=h.start;if(t||d.row===n.row&&Math.abs(d.column-n.column)<2)h=this.session.getBracketRange(d)}}else if(o==="tag"){if(!s||s.type.indexOf("tag-name")===-1)return;var v=s.value;h=new p(r.getCurrentTokenRow(),r.getCurrentTokenColumn()-2,r.getCurrentTokenRow(),r.getCurrentTokenColumn()-2);if(h.compare(n.row,n.column)===0){u=!1;do s=i,i=r.stepBackward(),i&&(i.type.indexOf("tag-close")!==-1&&h.setEnd(r.getCurrentTokenRow(),r.getCurrentTokenColumn()+1),s.value===v&&s.type.indexOf("tag-name")!==-1&&(i.value==="<"?a[v]++:i.value==="</"&&a[v]--,a[v]===0&&(u=!0)));while(i&&!u)}s&&s.type.indexOf("tag-name")&&(d=h.start,d.row==n.row&&Math.abs(d.column-n.column)<2&&(d=h.end))}d=h&&h.cursor||d,d&&(e?h&&t?this.selection.setRange(h):h&&h.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(d.row,d.column):this.selection.moveTo(d.row,d.column))},this.gotoLine=function(e,t,n){this.selection.clearSelection(),this.session.unfold({row:e-1,column:t||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(e-1,t||0),this.isRowFullyVisible(e-1)||this.scrollToLine(e-1,!0,n)},this.navigateTo=function(e,t){this.selection.moveTo(e,t)},this.navigateUp=function(e){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(-e||-1,0)},this.navigateDown=function(e){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(e||1,0)},this.navigateLeft=function(e){if(!this.selection.isEmpty()){var t=this.getSelectionRange().start;this.moveCursorToPosition(t)}else{e=e||1;while(e--)this.selection.moveCursorLeft()}this.clearSelection()},this.navigateRight=function(e){if(!this.selection.isEmpty()){var t=this.getSelectionRange().end;this.moveCursorToPosition(t)}else{e=e||1;while(e--)this.selection.moveCursorRight()}this.clearSelection()},this.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},this.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},this.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},this.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},this.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},this.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},this.replace=function(e,t){t&&this.$search.set(t);var n=this.$search.find(this.session),r=0;return n?(this.$tryReplace(n,e)&&(r=1),this.selection.setSelectionRange(n),this.renderer.scrollSelectionIntoView(n.start,n.end),r):r},this.replaceAll=function(e,t){t&&this.$search.set(t);var n=this.$search.findAll(this.session),r=0;if(!n.length)return r;var i=this.getSelectionRange();this.selection.moveTo(0,0);for(var s=n.length-1;s>=0;--s)this.$tryReplace(n[s],e)&&r++;return this.selection.setSelectionRange(i),r},this.$tryReplace=function(e,t){var n=this.session.getTextRange(e);return t=this.$search.replace(n,t),t!==null?(e.end=this.session.replace(e,t),e):null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(e,t,n){t||(t={}),typeof e=="string"||e instanceof RegExp?t.needle=e:typeof e=="object"&&r.mixin(t,e);var i=this.selection.getRange();t.needle==null&&(e=this.session.getTextRange(i)||this.$search.$options.needle,e||(i=this.session.getWordRange(i.start.row,i.start.column),e=this.session.getTextRange(i)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:i});var s=this.$search.find(this.session);if(t.preventScroll)return s;if(s)return this.revealRange(s,n),s;t.backwards?i.start=i.end:i.end=i.start,this.selection.setRange(i)},this.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},this.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},this.revealRange=function(e,t){this.session.unfold(e),this.selection.setSelectionRange(e);var n=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),t!==!1&&this.renderer.animateScrolling(n)},this.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy()},this.setAutoScrollEditorIntoView=function(e){if(!e)return;var t,n=this,r=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var i=this.$scrollAnchor;i.style.cssText="position:absolute",this.container.insertBefore(i,this.container.firstChild);var s=this.on("changeSelection",function(){r=!0}),o=this.renderer.on("beforeRender",function(){r&&(t=n.renderer.container.getBoundingClientRect())}),u=this.renderer.on("afterRender",function(){if(r&&t&&(n.isFocused()||n.searchBox&&n.searchBox.isFocused())){var e=n.renderer,s=e.$cursorLayer.$pixelPos,o=e.layerConfig,u=s.top-o.offset;s.top>=0&&u+t.top<0?r=!0:s.top<o.height&&s.top+t.top+o.lineHeight>window.innerHeight?r=!1:r=null,r!=null&&(i.style.top=u+"px",i.style.left=s.left+"px",i.style.height=o.lineHeight+"px",i.scrollIntoView(r)),r=t=null}});this.setAutoScrollEditorIntoView=function(e){if(e)return;delete this.setAutoScrollEditorIntoView,this.off("changeSelection",s),this.renderer.off("afterRender",u),this.renderer.off("beforeRender",o)}},this.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;if(!t)return;t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&e!="wide",i.setCssClass(t.element,"ace_slim-cursors",/slim/.test(e))}}.call(w.prototype),g.defineOptions(w.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.textInput.setReadOnly(e),this.$resetCursorStyle()},initialValue:!1},copyWithEmptySelection:{set:function(e){this.textInput.setCopyWithEmptySelection(e)},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},keyboardHandler:{set:function(e){this.setKeyboardHandler(e)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(e){this.session.setValue(e)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(e){this.setSession(e)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(e){this.renderer.$gutterLayer.setShowLineNumbers(e),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),e&&this.$relativeLineNumbers?E.attach(this):E.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?E.attach(this):E.detach(this)}},hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var E={getText:function(e,t){return(Math.abs(e.selection.lead.row-t)||t+1+(t<9?"\u00b7":""))+""},getWidth:function(e,t,n){return Math.max(t.toString().length,(n.lastRow+1).toString().length,2)*n.characterWidth},update:function(e,t){t.renderer.$loop.schedule(t.renderer.CHANGE_GUTTER)},attach:function(e){e.renderer.$gutterLayer.$renderer=this,e.on("changeSelection",this.update),this.update(null,e)},detach:function(e){e.renderer.$gutterLayer.$renderer==this&&(e.renderer.$gutterLayer.$renderer=null),e.off("changeSelection",this.update),this.update(null,e)}};t.Editor=w}),define("ace/undomanager",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){for(var n=t;n--;){var r=e[n];if(r&&!r[0].ignore){while(n<t-1){var i=d(e[n],e[n+1]);e[n]=i[0],e[n+1]=i[1],n++}return!0}}}function a(e){var t=e.action=="insert",n=e.start,r=e.end,i=(r.row-n.row)*(t?1:-1),s=(r.column-n.column)*(t?1:-1);t&&(r=n);for(var o in this.marks){var a=this.marks[o],f=u(a,n);if(f<0)continue;if(f===0&&t){if(a.bias!=1){a.bias==-1;continue}f=1}var l=t?f:u(a,r);if(l>0){a.row+=i,a.column+=a.row==r.row?s:0;continue}!t&&l<=0&&(a.row=n.row,a.column=n.column,l===0&&(a.bias=1))}}function f(e){return{row:e.row,column:e.column}}function l(e){return{start:f(e.start),end:f(e.end),action:e.action,lines:e.lines.slice()}}function c(e){e=e||this;if(Array.isArray(e))return e.map(c).join("\n");var t="";e.action?(t=e.action=="insert"?"+":"-",t+="["+e.lines+"]"):e.value&&(Array.isArray(e.value)?t=e.value.map(h).join("\n"):t=h(e.value)),e.start&&(t+=h(e));if(e.id||e.rev)t+=" ("+(e.id||e.rev)+")";return t}function h(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function p(e,t){var n=e.action=="insert",r=t.action=="insert";if(n&&r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.start,e.start)<=0))return null;m(e,t,1)}else if(n&&!r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.end,e.start)<=0))return null;m(e,t,-1)}else if(!n&&r)if(o(t.start,e.start)>=0)m(t,e,1);else{if(!(o(t.start,e.start)<=0))return null;m(e,t,1)}else if(!n&&!r)if(o(t.start,e.start)>=0)m(t,e,1);else{if(!(o(t.end,e.start)<=0))return null;m(e,t,-1)}return[t,e]}function d(e,t){for(var n=e.length;n--;)for(var r=0;r<t.length;r++)if(!p(e[n],t[r])){while(n<e.length){while(r--)p(t[r],e[n]);r=t.length,n++}return[e,t]}return e.selectionBefore=t.selectionBefore=e.selectionAfter=t.selectionAfter=null,[t,e]}function v(e,t){var n=e.action=="insert",r=t.action=="insert";if(n&&r)o(e.start,t.start)<0?m(t,e,1):m(e,t,1);else if(n&&!r)o(e.start,t.end)>=0?m(e,t,-1):o(e.start,t.start)<=0?m(t,e,1):(m(e,s.fromPoints(t.start,e.start),-1),m(t,e,1));else if(!n&&r)o(t.start,e.end)>=0?m(t,e,-1):o(t.start,e.start)<=0?m(e,t,1):(m(t,s.fromPoints(e.start,t.start),-1),m(e,t,1));else if(!n&&!r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.end,e.start)<=0)){var i,u;return o(e.start,t.start)<0&&(i=e,e=y(e,t.start)),o(e.end,t.end)>0&&(u=y(e,t.end)),g(t.end,e.start,e.end,-1),u&&!i&&(e.lines=u.lines,e.start=u.start,e.end=u.end,u=e),[t,i,u].filter(Boolean)}m(e,t,-1)}return[t,e]}function m(e,t,n){g(e.start,t.start,t.end,n),g(e.end,t.start,t.end,n)}function g(e,t,n,r){e.row==(r==1?t:n).row&&(e.column+=r*(n.column-t.column)),e.row+=r*(n.row-t.row)}function y(e,t){var n=e.lines,r=e.end;e.end=f(t);var i=e.end.row-e.start.row,s=n.splice(i,n.length),o=i?t.column:t.column-e.start.column;n.push(s[0].substring(0,o)),s[0]=s[0].substr(o);var u={start:f(t),end:r,lines:s,action:e.action};return u}function b(e,t){t=l(t);for(var n=e.length;n--;){var r=e[n];for(var i=0;i<r.length;i++){var s=r[i],o=v(s,t);t=o[0],o.length!=2&&(o[2]?(r.splice(i+1,1,o[1],o[2]),i++):o[1]||(r.splice(i,1),i--))}r.length||e.splice(n,1)}return e}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];for(var i=0;i<r.length;i++)b(e,r[i])}}var r=function(){this.$maxRev=0,this.$fromUndo=!1,this.reset()};(function(){this.addSession=function(e){this.$session=e},this.add=function(e,t,n){if(this.$fromUndo)return;if(e==this.$lastDelta)return;if(t===!1||!this.lastDeltas)this.lastDeltas=[],this.$undoStack.push(this.lastDeltas),e.id=this.$rev=++this.$maxRev;if(e.action=="remove"||e.action=="insert")this.$lastDelta=e;this.lastDeltas.push(e)},this.addSelection=function(e,t){this.selections.push({value:e,rev:t||this.$rev})},this.startNewGroup=function(){return this.lastDeltas=null,this.$rev},this.markIgnored=function(e,t){t==null&&(t=this.$rev+1);var n=this.$undoStack;for(var r=n.length;r--;){var i=n[r][0];if(i.id<=e)break;i.id<t&&(i.ignore=!0)}this.lastDeltas=null},this.getSelection=function(e,t){var n=this.selections;for(var r=n.length;r--;){var i=n[r];if(i.rev<e)return t&&(i=n[r+1]),i}},this.getRevision=function(){return this.$rev},this.getDeltas=function(e,t){t==null&&(t=this.$rev+1);var n=this.$undoStack,r=null,i=0;for(var s=n.length;s--;){var o=n[s][0];o.id<t&&!r&&(r=s+1);if(o.id<=e){i=s+1;break}}return n.slice(i,r)},this.getChangedRanges=function(e,t){t==null&&(t=this.$rev+1)},this.getChangedLines=function(e,t){t==null&&(t=this.$rev+1)},this.undo=function(e,t){this.lastDeltas=null;var n=this.$undoStack;if(!i(n,n.length))return;e||(e=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var r=n.pop(),s=null;return r&&r.length&&(s=e.undoChanges(r,t),this.$redoStack.push(r),this.$syncRev()),this.$fromUndo=!1,s},this.redo=function(e,t){this.lastDeltas=null,e||(e=this.$session),this.$fromUndo=!0;if(this.$redoStackBaseRev!=this.$rev){var n=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);w(this.$redoStack,n),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(e){e[0].id=++this.$maxRev},this)}var r=this.$redoStack.pop(),i=null;return r&&(i=e.redoChanges(r,t),this.$undoStack.push(r),this.$syncRev()),this.$fromUndo=!1,i},this.$syncRev=function(){var e=this.$undoStack,t=e[e.length-1],n=t&&t[0].id||0;this.$redoStackBaseRev=n,this.$rev=n},this.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},this.canUndo=function(){return this.$undoStack.length>0},this.canRedo=function(){return this.$redoStack.length>0},this.bookmark=function(e){e==undefined&&(e=this.$rev),this.mark=e},this.isAtBookmark=function(){return this.$rev===this.mark},this.toJSON=function(){},this.fromJSON=function(){},this.hasUndo=this.canUndo,this.hasRedo=this.canRedo,this.isClean=this.isAtBookmark,this.markClean=this.bookmark,this.$prettyPrint=function(e){return e?c(e):c(this.$undoStack)+"\n---\n"+c(this.$redoStack)}}).call(r.prototype);var s=e("./range").Range,o=s.comparePoints,u=s.comparePoints;t.UndoManager=r}),define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=function(e,t){this.element=e,this.canvasHeight=t||5e5,this.element.style.height=this.canvasHeight*2+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0};(function(){this.moveContainer=function(e){r.translate(this.element,0,-(e.firstRowScreen*e.lineHeight%this.canvasHeight)-e.offset*this.$offsetCoefficient)},this.pageChanged=function(e,t){return Math.floor(e.firstRowScreen*e.lineHeight/this.canvasHeight)!==Math.floor(t.firstRowScreen*t.lineHeight/this.canvasHeight)},this.computeLineTop=function(e,t,n){var r=t.firstRowScreen*t.lineHeight,i=Math.floor(r/this.canvasHeight),s=n.documentToScreenRow(e,0)*t.lineHeight;return s-i*this.canvasHeight},this.computeLineHeight=function(e,t,n){return t.lineHeight*n.getRowLength(e)},this.getLength=function(){return this.cells.length},this.get=function(e){return this.cells[e]},this.shift=function(){this.$cacheCell(this.cells.shift())},this.pop=function(){this.$cacheCell(this.cells.pop())},this.push=function(e){if(Array.isArray(e)){this.cells.push.apply(this.cells,e);var t=r.createFragment(this.element);for(var n=0;n<e.length;n++)t.appendChild(e[n].element);this.element.appendChild(t)}else this.cells.push(e),this.element.appendChild(e.element)},this.unshift=function(e){if(Array.isArray(e)){this.cells.unshift.apply(this.cells,e);var t=r.createFragment(this.element);for(var n=0;n<e.length;n++)t.appendChild(e[n].element);this.element.firstChild?this.element.insertBefore(t,this.element.firstChild):this.element.appendChild(t)}else this.cells.unshift(e),this.element.insertAdjacentElement("afterbegin",e.element)},this.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},this.$cacheCell=function(e){if(!e)return;e.element.remove(),this.cellCache.push(e)},this.createCell=function(e,t,n,i){var s=this.cellCache.pop();if(!s){var o=r.createElement("div");i&&i(o),this.element.appendChild(o),s={element:o,text:"",row:e}}return s.row=e,s}}).call(i.prototype),t.Lines=i}),define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/layer/lines"],function(e,t,n){"use strict";function f(e){var t=document.createTextNode("");e.appendChild(t);var n=r.createElement("span");return e.appendChild(n),e}var r=e("../lib/dom"),i=e("../lib/oop"),s=e("../lib/lang"),o=e("../lib/event_emitter").EventEmitter,u=e("./lines").Lines,a=function(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_gutter-layer",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new u(this.element),this.$lines.$offsetCoefficient=1};(function(){i.implement(this,o),this.setSession=function(e){this.session&&this.session.removeEventListener("change",this.$updateAnnotations),this.session=e,e&&e.on("change",this.$updateAnnotations)},this.addGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(e,t)},this.setAnnotations=function(e){this.$annotations=[];for(var t=0;t<e.length;t++){var n=e[t],r=n.row,i=this.$annotations[r];i||(i=this.$annotations[r]={text:[]});var o=n.text;o=o?s.escapeHTML(o):n.html||"",i.text.indexOf(o)===-1&&i.text.push(o);var u=n.type;u=="error"?i.className=" ace_error":u=="warning"&&i.className!=" ace_error"?i.className=" ace_warning":u=="info"&&!i.className&&(i.className=" ace_info")}},this.$updateAnnotations=function(e){if(!this.$annotations.length)return;var t=e.start.row,n=e.end.row-t;if(n!==0)if(e.action=="remove")this.$annotations.splice(t,n+1,null);else{var r=new Array(n+1);r.unshift(t,1),this.$annotations.splice.apply(this.$annotations,r)}},this.update=function(e){this.config=e;var t=this.session,n=e.firstRow,r=Math.min(e.lastRow+e.gutterOffset,t.getLength()-1);this.oldLastRow=r,this.config=e,this.$lines.moveContainer(e),this.$updateCursorRow();var i=t.getNextFoldLine(n),s=i?i.start.row:Infinity,o=null,u=-1,a=n;for(;;){a>s&&(a=i.end.row+1,i=t.getNextFoldLine(a,i),s=i?i.start.row:Infinity);if(a>r){while(this.$lines.getLength()>u+1)this.$lines.pop();break}o=this.$lines.get(++u),o?o.row=a:(o=this.$lines.createCell(a,e,this.session,f),this.$lines.push(o)),this.$renderCell(o,e,i,a),a++}this._signal("afterRender"),this.$updateGutterWidth(e)},this.$updateGutterWidth=function(e){var t=this.session,n=t.gutterRenderer||this.$renderer,r=t.$firstLineNumber,i=this.$lines.last()?this.$lines.last().text:"";if(this.$fixedWidth||t.$useWrapMode)i=t.getLength()+r;var s=n?n.getWidth(t,i,e):i.toString().length*e.characterWidth,o=this.$padding||this.$computePadding();s+=o.left+o.right,s!==this.gutterWidth&&!isNaN(s)&&(this.gutterWidth=s,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",s))},this.$updateCursorRow=function(){if(!this.$highlightGutterLine)return;var e=this.session.selection.getCursor();if(this.$cursorRow===e.row)return;this.$cursorRow=e.row},this.updateLineHighlight=function(){if(!this.$highlightGutterLine)return;var e=this.session.selection.cursor.row;this.$cursorRow=e;if(this.$cursorCell&&this.$cursorCell.row==e)return;this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var t=this.$lines.cells;this.$cursorCell=null;for(var n=0;n<t.length;n++){var r=t[n];if(r.row>=this.$cursorRow){if(r.row>this.$cursorRow){var i=this.session.getFoldLine(this.$cursorRow);if(!(n>0&&i&&i.start.row==t[n-1].row))break;r=t[n-1]}r.element.className="ace_gutter-active-line "+r.element.className,this.$cursorCell=r;break}}},this.scrollLines=function(e){var t=this.config;this.config=e,this.$updateCursorRow();if(this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var n=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),r=this.oldLastRow;this.oldLastRow=n;if(!t||r<e.firstRow)return this.update(e);if(n<t.firstRow)return this.update(e);if(t.firstRow<e.firstRow)for(var i=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);i>0;i--)this.$lines.shift();if(r>n)for(var i=this.session.getFoldedRowCount(n+1,r);i>0;i--)this.$lines.pop();e.firstRow<t.firstRow&&this.$lines.unshift(this.$renderLines(e,e.firstRow,t.firstRow-1)),n>r&&this.$lines.push(this.$renderLines(e,r+1,n)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},this.$renderLines=function(e,t,n){var r=[],i=t,s=this.session.getNextFoldLine(i),o=s?s.start.row:Infinity;for(;;){i>o&&(i=s.end.row+1,s=this.session.getNextFoldLine(i,s),o=s?s.start.row:Infinity);if(i>n)break;var u=this.$lines.createCell(i,e,this.session,f);this.$renderCell(u,e,s,i),r.push(u),i++}return r},this.$renderCell=function(e,t,n,i){var s=e.element,o=this.session,u=s.childNodes[0],a=s.childNodes[1],f=o.$firstLineNumber,l=o.$breakpoints,c=o.$decorations,h=o.gutterRenderer||this.$renderer,p=this.$showFoldWidgets&&o.foldWidgets,d=n?n.start.row:Number.MAX_VALUE,v="ace_gutter-cell ";this.$highlightGutterLine&&(i==this.$cursorRow||n&&i<this.$cursorRow&&i>=d&&this.$cursorRow<=n.end.row)&&(v+="ace_gutter-active-line ",this.$cursorCell!=e&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=e)),l[i]&&(v+=l[i]),c[i]&&(v+=c[i]),this.$annotations[i]&&(v+=this.$annotations[i].className),s.className!=v&&(s.className=v);if(p){var m=p[i];m==null&&(m=p[i]=o.getFoldWidget(i))}if(m){var v="ace_fold-widget ace_"+m;m=="start"&&i==d&&i<n.end.row?v+=" ace_closed":v+=" ace_open",a.className!=v&&(a.className=v);var g=t.lineHeight+"px";r.setStyle(a.style,"height",g),r.setStyle(a.style,"display","inline-block")}else a&&r.setStyle(a.style,"display","none");var y=(h?h.getText(o,i):i+f).toString();return y!==u.data&&(u.data=y),r.setStyle(e.element.style,"height",this.$lines.computeLineHeight(i,t,o)+"px"),r.setStyle(e.element.style,"top",this.$lines.computeLineTop(i,t,o)+"px"),e.text=y,e},this.$fixedWidth=!1,this.$highlightGutterLine=!0,this.$renderer="",this.setHighlightGutterLine=function(e){this.$highlightGutterLine=e},this.$showLineNumbers=!0,this.$renderer="",this.setShowLineNumbers=function(e){this.$renderer=!e&&{getWidth:function(){return""},getText:function(){return""}}},this.getShowLineNumbers=function(){return this.$showLineNumbers},this.$showFoldWidgets=!0,this.setShowFoldWidgets=function(e){e?r.addCssClass(this.element,"ace_folding-enabled"):r.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=e,this.$padding=null},this.getShowFoldWidgets=function(){return this.$showFoldWidgets},this.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var e=r.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(e.borderLeftWidth)||0)+(parseInt(e.paddingLeft)||0)+1,this.$padding.right=(parseInt(e.borderRightWidth)||0)+(parseInt(e.paddingRight)||0),this.$padding},this.getRegion=function(e){var t=this.$padding||this.$computePadding(),n=this.element.getBoundingClientRect();if(e.x<t.left+n.left)return"markers";if(this.$showFoldWidgets&&e.x>n.right-t.right)return"foldWidgets"}}).call(a.prototype),t.Gutter=a}),define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../range").Range,i=e("../lib/dom"),s=function(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)};(function(){function e(e,t,n,r){return(e?1:0)|(t?2:0)|(n?4:0)|(r?8:0)}this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setMarkers=function(e){this.markers=e},this.elt=function(e,t){var n=this.i!=-1&&this.element.childNodes[this.i];n?this.i++:(n=document.createElement("div"),this.element.appendChild(n),this.i=-1),n.style.cssText=t,n.className=e},this.update=function(e){if(!e)return;this.config=e,this.i=0;var t;for(var n in this.markers){var r=this.markers[n];if(!r.range){r.update(t,this,this.session,e);continue}var i=r.range.clipRows(e.firstRow,e.lastRow);if(i.isEmpty())continue;i=i.toScreenRange(this.session);if(r.renderer){var s=this.$getTop(i.start.row,e),o=this.$padding+i.start.column*e.characterWidth;r.renderer(t,i,o,s,e)}else r.type=="fullLine"?this.drawFullLineMarker(t,i,r.clazz,e):r.type=="screenLine"?this.drawScreenLineMarker(t,i,r.clazz,e):i.isMultiLine()?r.type=="text"?this.drawTextMarker(t,i,r.clazz,e):this.drawMultiLineMarker(t,i,r.clazz,e):this.drawSingleLineMarker(t,i,r.clazz+" ace_start"+" ace_br15",e)}if(this.i!=-1)while(this.i<this.element.childElementCount)this.element.removeChild(this.element.lastChild)},this.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},this.drawTextMarker=function(t,n,i,s,o){var u=this.session,a=n.start.row,f=n.end.row,l=a,c=0,h=0,p=u.getScreenLastRowColumn(l),d=new r(l,n.start.column,l,h);for(;l<=f;l++)d.start.row=d.end.row=l,d.start.column=l==a?n.start.column:u.getRowWrapIndent(l),d.end.column=p,c=h,h=p,p=l+1<f?u.getScreenLastRowColumn(l+1):l==f?0:n.end.column,this.drawSingleLineMarker(t,d,i+(l==a?" ace_start":"")+" ace_br"+e(l==a||l==a+1&&n.start.column,c<h,h>p,l==f),s,l==f?0:1,o)},this.drawMultiLineMarker=function(e,t,n,r,i){var s=this.$padding,o=r.lineHeight,u=this.$getTop(t.start.row,r),a=s+t.start.column*r.characterWidth;i=i||"";if(this.session.$bidiHandler.isBidiRow(t.start.row)){var f=t.clone();f.end.row=f.start.row,f.end.column=this.session.getLine(f.start.row).length,this.drawBidiSingleLineMarker(e,f,n+" ace_br1 ace_start",r,null,i)}else this.elt(n+" ace_br1 ace_start","height:"+o+"px;"+"right:0;"+"top:"+u+"px;left:"+a+"px;"+(i||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){var f=t.clone();f.start.row=f.end.row,f.start.column=0,this.drawBidiSingleLineMarker(e,f,n+" ace_br12",r,null,i)}else{u=this.$getTop(t.end.row,r);var l=t.end.column*r.characterWidth;this.elt(n+" ace_br12","height:"+o+"px;"+"width:"+l+"px;"+"top:"+u+"px;"+"left:"+s+"px;"+(i||""))}o=(t.end.row-t.start.row-1)*r.lineHeight;if(o<=0)return;u=this.$getTop(t.start.row+1,r);var c=(t.start.column?1:0)|(t.end.column?0:8);this.elt(n+(c?" ace_br"+c:""),"height:"+o+"px;"+"right:0;"+"top:"+u+"px;"+"left:"+s+"px;"+(i||""))},this.drawSingleLineMarker=function(e,t,n,r,i,s){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,n,r,i,s);var o=r.lineHeight,u=(t.end.column+(i||0)-t.start.column)*r.characterWidth,a=this.$getTop(t.start.row,r),f=this.$padding+t.start.column*r.characterWidth;this.elt(n,"height:"+o+"px;"+"width:"+u+"px;"+"top:"+a+"px;"+"left:"+f+"px;"+(s||""))},this.drawBidiSingleLineMarker=function(e,t,n,r,i,s){var o=r.lineHeight,u=this.$getTop(t.start.row,r),a=this.$padding,f=this.session.$bidiHandler.getSelections(t.start.column,t.end.column);f.forEach(function(e){this.elt(n,"height:"+o+"px;"+"width:"+e.width+(i||0)+"px;"+"top:"+u+"px;"+"left:"+(a+e.left)+"px;"+(s||""))},this)},this.drawFullLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;t.start.row!=t.end.row&&(o+=this.$getTop(t.end.row,r)-s),this.elt(n,"height:"+o+"px;"+"top:"+s+"px;"+"left:0;right:0;"+(i||""))},this.drawScreenLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;this.elt(n,"height:"+o+"px;"+"top:"+s+"px;"+"left:0;right:0;"+(i||""))}}).call(s.prototype),t.Marker=s}),define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/dom"),s=e("../lib/lang"),o=e("./lines").Lines,u=e("../lib/event_emitter").EventEmitter,a=function(e){this.dom=i,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new o(this.element)};(function(){r.implement(this,u),this.EOF_CHAR="\u00b6",this.EOL_CHAR_LF="\u00ac",this.EOL_CHAR_CRLF="\u00a4",this.EOL_CHAR=this.EOL_CHAR_LF,this.TAB_CHAR="\u2014",this.SPACE_CHAR="\u00b7",this.$padding=0,this.MAX_LINE_LENGTH=1e4,this.$updateEolChar=function(){var e=this.session.doc,t=e.getNewLineCharacter()=="\n"&&e.getNewLineMode()!="windows",n=t?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=n)return this.EOL_CHAR=n,!0},this.setPadding=function(e){this.$padding=e,this.element.style.margin="0 "+e+"px"},this.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},this.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},this.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",function(e){this._signal("changeCharacterSize",e)}.bind(this)),this.$pollSizeChanges()},this.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},this.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},this.setSession=function(e){this.session=e,e&&this.$computeTabString()},this.showInvisibles=!1,this.setShowInvisibles=function(e){return this.showInvisibles==e?!1:(this.showInvisibles=e,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(e){return this.displayIndentGuides==e?!1:(this.displayIndentGuides=e,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;var t=this.$tabStrings=[0];for(var n=1;n<e+1;n++)if(this.showInvisibles){var r=this.dom.createElement("span");r.className="ace_invisible ace_invisible_tab",r.textContent=s.stringRepeat(this.TAB_CHAR,n),t.push(r)}else t.push(this.dom.createTextNode(s.stringRepeat(" ",n),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var i="ace_indent-guide",o="",u="";if(this.showInvisibles){i+=" ace_invisible",o=" ace_invisible_space",u=" ace_invisible_tab";var a=s.stringRepeat(this.SPACE_CHAR,this.tabSize),f=s.stringRepeat(this.TAB_CHAR,this.tabSize)}else var a=s.stringRepeat(" ",this.tabSize),f=a;var r=this.dom.createElement("span");r.className=i+o,r.textContent=a,this.$tabStrings[" "]=r;var r=this.dom.createElement("span");r.className=i+u,r.textContent=f,this.$tabStrings[" "]=r}},this.updateLines=function(e,t,n){if(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)return this.update(e);this.config=e;var r=Math.max(t,e.firstRow),i=Math.min(n,e.lastRow),s=this.element.childNodes,o=0;for(var u=e.firstRow;u<r;u++){var a=this.session.getFoldLine(u);if(a){if(a.containsRow(r)){r=a.start.row;break}u=a.end.row}o++}var f=!1,u=r,a=this.session.getNextFoldLine(u),l=a?a.start.row:Infinity;for(;;){u>l&&(u=a.end.row+1,a=this.session.getNextFoldLine(u,a),l=a?a.start.row:Infinity);if(u>i)break;var c=s[o++];if(c){this.dom.removeChildren(c),this.$renderLine(c,u,u==l?a:!1);var h=e.lineHeight*this.session.getRowLength(u)+"px";c.style.height!=h&&(f=!0,c.style.height=h)}u++}if(f)while(o<this.$lines.cells.length){var p=this.$lines.cells[o++];p.element.style.top=this.$lines.computeLineTop(p.row,e,this.session)+"px"}},this.scrollLines=function(e){var t=this.config;this.config=e;if(this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var n=e.lastRow,r=t?t.lastRow:-1;if(!t||r<e.firstRow)return this.update(e);if(n<t.firstRow)return this.update(e);if(!t||t.lastRow<e.firstRow)return this.update(e);if(e.lastRow<t.firstRow)return this.update(e);if(t.firstRow<e.firstRow)for(var i=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);i>0;i--)this.$lines.shift();if(t.lastRow>e.lastRow)for(var i=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);i>0;i--)this.$lines.pop();e.firstRow<t.firstRow&&this.$lines.unshift(this.$renderLinesFragment(e,e.firstRow,t.firstRow-1)),e.lastRow>t.lastRow&&this.$lines.push(this.$renderLinesFragment(e,t.lastRow+1,e.lastRow))},this.$renderLinesFragment=function(e,t,n){var r=[],s=t,o=this.session.getNextFoldLine(s),u=o?o.start.row:Infinity;for(;;){s>u&&(s=o.end.row+1,o=this.session.getNextFoldLine(s,o),u=o?o.start.row:Infinity);if(s>n)break;var a=this.$lines.createCell(s,e,this.session),f=a.element;this.dom.removeChildren(f),i.setStyle(f.style,"height",this.$lines.computeLineHeight(s,e,this.session)+"px"),i.setStyle(f.style,"top",this.$lines.computeLineTop(s,e,this.session)+"px"),this.$renderLine(f,s,s==u?o:!1),this.$useLineGroups()?f.className="ace_line_group":f.className="ace_line",r.push(a),s++}return r},this.update=function(e){this.$lines.moveContainer(e),this.config=e;var t=e.firstRow,n=e.lastRow,r=this.$lines;while(r.getLength())r.pop();r.push(this.$renderLinesFragment(e,t,n))},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(e,t,n,r){var o=this,u=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,a=this.dom.createFragment(this.element),f,l=0;while(f=u.exec(r)){var c=f[1],h=f[2],p=f[3],d=f[4],v=f[5];if(!o.showInvisibles&&h)continue;var m=l!=f.index?r.slice(l,f.index):"";l=f.index+f[0].length,m&&a.appendChild(this.dom.createTextNode(m,this.element));if(c){var g=o.session.getScreenTabSize(t+f.index);a.appendChild(o.$tabStrings[g].cloneNode(!0)),t+=g-1}else if(h)if(o.showInvisibles){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space",y.textContent=s.stringRepeat(o.SPACE_CHAR,h.length),a.appendChild(y)}else a.appendChild(this.com.createTextNode(h,this.element));else if(p){var y=this.dom.createElement("span");y.className="ace_invisible ace_invisible_space ace_invalid",y.textContent=s.stringRepeat(o.SPACE_CHAR,p.length),a.appendChild(y)}else if(d){var b=o.showInvisibles?o.SPACE_CHAR:"";t+=1;var y=this.dom.createElement("span");y.style.width=o.config.characterWidth*2+"px",y.className=o.showInvisibles?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",y.textContent=o.showInvisibles?o.SPACE_CHAR:"",a.appendChild(y)}else if(v){t+=1;var y=i.createElement("span");y.style.width=o.config.characterWidth*2+"px",y.className="ace_cjk",y.textContent=v,a.appendChild(y)}}a.appendChild(this.dom.createTextNode(l?r.slice(l):r,this.element));if(!this.$textToken[n.type]){var w="ace_"+n.type.replace(/\./g," ace_"),y=this.dom.createElement("span");n.type=="fold"&&(y.style.width=n.value.length*this.config.characterWidth+"px"),y.className=w,y.appendChild(a),e.appendChild(y)}else e.appendChild(a);return t+r.length},this.renderIndentGuide=function(e,t,n){var r=t.search(this.$indentGuideRe);if(r<=0||r>=n)return t;if(t[0]==" "){r-=r%this.tabSize;var i=r/this.tabSize;for(var s=0;s<i;s++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return t.substr(r)}if(t[0]==" "){for(var s=0;s<r;s++)e.appendChild(this.$tabStrings[" "].cloneNode(!0));return t.substr(r)}return t},this.$createLineElement=function(e){var t=this.dom.createElement("div");return t.className="ace_line",t.style.height=this.config.lineHeight+"px",t},this.$renderWrappedLine=function(e,t,n){var r=0,i=0,o=n[0],u=0,a=this.$createLineElement();e.appendChild(a);for(var f=0;f<t.length;f++){var l=t[f],c=l.value;if(f==0&&this.displayIndentGuides){r=c.length,c=this.renderIndentGuide(a,c,o);if(!c)continue;r-=c.length}if(r+c.length<o)u=this.$renderToken(a,u,l,c),r+=c.length;else{while(r+c.length>=o)u=this.$renderToken(a,u,l,c.substring(0,o-r)),c=c.substring(o-r),r=o,a=this.$createLineElement(),e.appendChild(a),a.appendChild(this.dom.createTextNode(s.stringRepeat("\u00a0",n.indent),this.element)),i++,u=0,o=n[i]||Number.MAX_VALUE;c.length!=0&&(r+=c.length,u=this.$renderToken(a,u,l,c))}}},this.$renderSimpleLine=function(e,t){var n=0,r=t[0],i=r.value;this.displayIndentGuides&&(i=this.renderIndentGuide(e,i)),i&&(n=this.$renderToken(e,n,r,i));for(var s=1;s<t.length;s++){r=t[s],i=r.value;if(n+i.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,n,r,i);n=this.$renderToken(e,n,r,i)}},this.$renderOverflowMessage=function(e,t,n,r){this.$renderToken(e,t,n,r.slice(0,this.MAX_LINE_LENGTH-t));var i=this.dom.createElement("span");i.className="ace_inline_button ace_keyword ace_toggle_wrap",i.style.position="absolute",i.style.right="0",i.textContent="<click to see more...>",e.appendChild(i)},this.$renderLine=function(e,t,n){!n&&n!=0&&(n=this.session.getFoldLine(t));if(n)var r=this.$getFoldLineTokens(t,n);else var r=this.session.getTokens(t);var i=e;if(r.length){var s=this.session.getRowSplitData(t);if(s&&s.length){this.$renderWrappedLine(e,r,s);var i=e.lastChild}else{var i=e;this.$useLineGroups()&&(i=this.$createLineElement(),e.appendChild(i)),this.$renderSimpleLine(i,r)}}else this.$useLineGroups()&&(i=this.$createLineElement(),e.appendChild(i));if(this.showInvisibles&&i){n&&(t=n.end.row);var o=this.dom.createElement("span");o.className="ace_invisible ace_invisible_eol",o.textContent=t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,i.appendChild(o)}},this.$getFoldLineTokens=function(e,t){function i(e,t,n){var i=0,s=0;while(s+e[i].value.length<t){s+=e[i].value.length,i++;if(i==e.length)return}if(s!=t){var o=e[i].value.substring(t-s);o.length>n-t&&(o=o.substring(0,n-t)),r.push({type:e[i].type,value:o}),s=t+o.length,i+=1}while(s<n&&i<e.length){var o=e[i].value;o.length+s>n?r.push({type:e[i].type,value:o.substring(0,n-s)}):r.push(e[i]),s+=o.length,i+=1}}var n=this.session,r=[],s=n.getTokens(e);return t.walk(function(e,t,o,u,a){e!=null?r.push({type:"fold",value:e}):(a&&(s=n.getTokens(t)),s.length&&i(s,u,o))},t.end.row,this.session.getLine(t.end.row).length),r},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){}}).call(a.prototype),t.Text=a}),define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=function(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),r.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)};(function(){this.$updateOpacity=function(e){var t=this.cursors;for(var n=t.length;n--;)r.setStyle(t[n].style,"opacity",e?"":"0")},this.$startCssAnimation=function(){var e=this.cursors;for(var t=e.length;t--;)e[t].style.animationDuration=this.blinkInterval+"ms";setTimeout(function(){r.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},this.$stopCssAnimation=function(){r.removeCssClass(this.element,"ace_animate-blinking")},this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},this.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},this.setSmoothBlinking=function(e){e!=this.smoothBlinking&&(this.smoothBlinking=e,r.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},this.addCursor=function(){var e=r.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},this.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},this.hideCursor=function(){this.isVisible=!1,r.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,r.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.restartTimer=function(){var e=this.$updateCursors;clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&r.removeCssClass(this.element,"ace_smooth-blinking"),e(!0);if(!this.isBlinking||!this.blinkInterval||!this.isVisible){this.$stopCssAnimation();return}this.smoothBlinking&&setTimeout(function(){r.addCssClass(this.element,"ace_smooth-blinking")}.bind(this));if(r.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var t=function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){e(!0),t()},this.blinkInterval),t()}},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var n=this.session.documentToScreenPosition(e),r=this.$padding+(this.session.$bidiHandler.isBidiRow(n.row,e.row)?this.session.$bidiHandler.getPosLeft(n.column):n.column*this.config.characterWidth),i=(n.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:r,top:i}},this.isCursorInView=function(e,t){return e.top>=0&&e.top<t.maxHeight},this.update=function(e){this.config=e;var t=this.session.$selectionMarkers,n=0,i=0;if(t===undefined||t.length===0)t=[{cursor:null}];for(var n=0,s=t.length;n<s;n++){var o=this.getPixelPosition(t[n].cursor,!0);if((o.top>e.height+e.offset||o.top<0)&&n>1)continue;var u=this.cursors[i++]||this.addCursor(),a=u.style;this.drawCursor?this.drawCursor(u,o,e,t[n],this.session):this.isCursorInView(o,e)?(r.setStyle(a,"display","block"),r.translate(u,o.left,o.top),r.setStyle(a,"width",Math.round(e.characterWidth)+"px"),r.setStyle(a,"height",e.lineHeight+"px")):r.setStyle(a,"display","none")}while(this.cursors.length>i)this.removeCursor();var f=this.session.getOverwrite();this.$setOverwrite(f),this.$pixelPos=o,this.restartTimer()},this.drawCursor=null,this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?r.addCssClass(this.element,"ace_overwrite-cursors"):r.removeCssClass(this.element,"ace_overwrite-cursors"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(i.prototype),t.Cursor=i}),define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,u=32768,a=function(e){this.element=i.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+this.classSuffix,this.inner=i.createElement("div"),this.inner.className="ace_scrollbar-inner",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addListener(this.element,"scroll",this.onScroll.bind(this)),s.addListener(this.element,"mousedown",s.preventDefault)};(function(){r.implement(this,o),this.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1}}).call(a.prototype);var f=function(e,t){a.call(this,e),this.scrollTop=0,this.scrollHeight=0,t.$scrollbarWidth=this.width=i.scrollbarWidth(e.ownerDocument),this.inner.style.width=this.element.style.width=(this.width||15)+5+"px",this.$minWidth=0};r.inherits(f,a),function(){this.classSuffix="-v",this.onScroll=function(){if(!this.skipEvent){this.scrollTop=this.element.scrollTop;if(this.coeff!=1){var e=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-e)/(this.coeff-e)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},this.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},this.setHeight=function(e){this.element.style.height=e+"px"},this.setInnerHeight=this.setScrollHeight=function(e){this.scrollHeight=e,e>u?(this.coeff=u/e,e=u):this.coeff!=1&&(this.coeff=1),this.inner.style.height=e+"px"},this.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=e,this.element.scrollTop=e*this.coeff)}}.call(f.prototype);var l=function(e,t){a.call(this,e),this.scrollLeft=0,this.height=t.$scrollbarWidth,this.inner.style.height=this.element.style.height=(this.height||15)+5+"px"};r.inherits(l,a),function(){this.classSuffix="-h",this.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},this.getHeight=function(){return this.isVisible?this.height:0},this.setWidth=function(e){this.element.style.width=e+"px"},this.setInnerWidth=function(e){this.inner.style.width=e+"px"},this.setScrollWidth=function(e){this.inner.style.width=e+"px"},this.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)}}.call(l.prototype),t.ScrollBar=f,t.ScrollBarV=f,t.ScrollBarH=l,t.VScrollBar=f,t.HScrollBar=l}),define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,t,n){"use strict";var r=e("./lib/event"),i=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.window=t||window;var n=this;this._flush=function(e){var t=n.changes;t&&(r.blockIdle(100),n.changes=0,n.onRender(t)),n.changes&&n.schedule()}};(function(){this.schedule=function(e){this.changes=this.changes|e,this.changes&&r.nextFrame(this._flush)}}).call(i.prototype),t.RenderLoop=i}),define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(e,t,n){var r=e("../lib/oop"),i=e("../lib/dom"),s=e("../lib/lang"),o=e("../lib/event"),u=e("../lib/useragent"),a=e("../lib/event_emitter").EventEmitter,f=256,l=typeof ResizeObserver=="function",c=200,h=t.FontMetrics=function(e){this.el=i.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=i.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=i.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),this.$measureNode.innerHTML=s.stringRepeat("X",f),this.$characterSize={width:0,height:0},l?this.$addObserver():this.checkForSizeChanges()};(function(){r.implement(this,a),this.$characterSize={width:0,height:0},this.$setMeasureNodeStyles=function(e,t){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",u.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},this.checkForSizeChanges=function(e){e===undefined&&(e=this.$measureSizes());if(e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},this.$addObserver=function(){var e=this;this.$observer=new window.ResizeObserver(function(t){var n=t[0].contentRect;e.checkForSizeChanges({height:n.height,width:n.width/f})}),this.$observer.observe(this.$measureNode)},this.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=o.onIdle(function t(){e.checkForSizeChanges(),o.onIdle(t,500)},500)},this.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},this.$measureSizes=function(e){var t={height:(e||this.$measureNode).clientHeight,width:(e||this.$measureNode).clientWidth/f};return t.width===0||t.height===0?null:t},this.$measureCharWidth=function(e){this.$main.innerHTML=s.stringRepeat(e,f);var t=this.$main.getBoundingClientRect();return t.width/f},this.getCharacterWidth=function(e){var t=this.charSizes[e];return t===undefined&&(t=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},this.$getZoom=function e(t){return t?(window.getComputedStyle(t).zoom||1)*e(t.parentElement):1},this.$initTransformMeasureNodes=function(){var e=function(e,t){return["div",{style:"position: absolute;top:"+e+"px;left:"+t+"px;"}]};this.els=i.buildDom([e(0,0),e(c,0),e(0,c),e(c,c)],this.el)},this.transformCoordinates=function(e,t){function r(e,t,n){var r=e[1]*t[0]-e[0]*t[1];return[(-t[1]*n[0]+t[0]*n[1])/r,(+e[1]*n[0]-e[0]*n[1])/r]}function i(e,t){return[e[0]-t[0],e[1]-t[1]]}function s(e,t){return[e[0]+t[0],e[1]+t[1]]}function o(e,t){return[e*t[0],e*t[1]]}function u(e){var t=e.getBoundingClientRect();return[t.left,t.top]}if(e){var n=this.$getZoom(this.el);e=o(1/n,e)}this.els||this.$initTransformMeasureNodes();var a=u(this.els[0]),f=u(this.els[1]),l=u(this.els[2]),h=u(this.els[3]),p=r(i(h,f),i(h,l),i(s(f,l),s(h,a))),d=o(1+p[0],i(f,a)),v=o(1+p[1],i(l,a));if(t){var m=t,g=p[0]*m[0]/c+p[1]*m[1]/c+1,y=s(o(m[0],d),o(m[1],v));return s(o(1/g/c,y),a)}var b=i(e,a),w=r(i(d,o(p[0],b)),i(v,o(p[1],b)),b);return o(c,w)}}).call(h.prototype)}),define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./config"),o=e("./layer/gutter").Gutter,u=e("./layer/marker").Marker,a=e("./layer/text").Text,f=e("./layer/cursor").Cursor,l=e("./scrollbar").HScrollBar,c=e("./scrollbar").VScrollBar,h=e("./renderloop").RenderLoop,p=e("./layer/font_metrics").FontMetrics,d=e("./lib/event_emitter").EventEmitter,v='.ace_br1 {border-top-left-radius : 3px;}.ace_br2 {border-top-right-radius : 3px;}.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}.ace_br4 {border-bottom-right-radius: 3px;}.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}.ace_br8 {border-bottom-left-radius : 3px;}.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_editor {position: relative;overflow: hidden;font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;direction: ltr;text-align: left;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.ace_scroller {position: absolute;overflow: hidden;top: 0;bottom: 0;background-color: inherit;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;cursor: text;}.ace_content {position: absolute;box-sizing: border-box;min-width: 100%;contain: style size layout;}.ace_dragging .ace_scroller:before{position: absolute;top: 0;left: 0;right: 0;bottom: 0;content: \'\';background: rgba(250, 250, 250, 0.01);z-index: 1000;}.ace_dragging.ace_dark .ace_scroller:before{background: rgba(0, 0, 0, 0.01);}.ace_selecting, .ace_selecting * {cursor: text !important;}.ace_gutter {position: absolute;overflow : hidden;width: auto;top: 0;bottom: 0;left: 0;cursor: default;z-index: 4;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;contain: style size layout;}.ace_gutter-active-line {position: absolute;left: 0;right: 0;}.ace_scroller.ace_scroll-left {box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;}.ace_gutter-cell {position: absolute;top: 0;left: 0;right: 0;padding-left: 19px;padding-right: 6px;background-repeat: no-repeat;}.ace_gutter-cell.ace_error {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/your_sha512_hash/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4your_sha512_hash+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+your_sha256_hashfASilxOLyiV5UVUyVAfbG0cCPHig+your_sha256_hashdBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: 2px center;}.ace_gutter-cell.ace_warning {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/your_sha256_hash5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");background-position: 2px center;}.ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,your_sha256_hashyour_sha256_hashyour_sha256_hashL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");background-position: 2px center;}.ace_dark .ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,your_sha256_hashgIAqKiq+your_sha256_hasheNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");}.ace_scrollbar {contain: strict;position: absolute;right: 0;bottom: 0;z-index: 6;}.ace_scrollbar-inner {position: absolute;cursor: text;left: 0;top: 0;}.ace_scrollbar-v{overflow-x: hidden;overflow-y: scroll;top: 0;}.ace_scrollbar-h {overflow-x: scroll;overflow-y: hidden;left: 0;}.ace_print-margin {position: absolute;height: 100%;}.ace_text-input {position: absolute;z-index: 0;width: 0.5em;height: 1em;opacity: 0;background: transparent;-moz-appearance: none;appearance: none;border: none;resize: none;outline: none;overflow: hidden;font: inherit;padding: 0 1px;margin: 0 -1px;contain: strict;-ms-user-select: text;-moz-user-select: text;-webkit-user-select: text;user-select: text;white-space: pre!important;}.ace_text-input.ace_composition {background: transparent;color: inherit;z-index: 1000;opacity: 1;}.ace_composition_placeholder { color: transparent }.ace_composition_marker { border-bottom: 1px solid;position: absolute;border-radius: 0;margin-top: 1px;}[ace_nocontext=true] {transform: none!important;filter: none!important;perspective: none!important;clip-path: none!important;mask : none!important;contain: none!important;perspective: none!important;mix-blend-mode: initial!important;z-index: auto;}.ace_layer {z-index: 1;position: absolute;overflow: hidden;word-wrap: normal;white-space: pre;height: 100%;width: 100%;box-sizing: border-box;pointer-events: none;}.ace_gutter-layer {position: relative;width: auto;text-align: right;pointer-events: auto;height: 1000000px;contain: style size layout;}.ace_text-layer {font: inherit !important;position: absolute;height: 1000000px;width: 1000000px;contain: style size layout;}.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {contain: style size layout;position: absolute;top: 0;left: 0;right: 0;}.ace_hidpi .ace_text-layer,.ace_hidpi .ace_gutter-layer,.ace_hidpi .ace_content,.ace_hidpi .ace_gutter {contain: strict;will-change: transform;}.ace_hidpi .ace_text-layer > .ace_line, .ace_hidpi .ace_text-layer > .ace_line_group {contain: strict;}.ace_cjk {display: inline-block;text-align: center;}.ace_cursor-layer {z-index: 4;}.ace_cursor {z-index: 4;position: absolute;box-sizing: border-box;border-left: 2px solid;transform: translatez(0);}.ace_multiselect .ace_cursor {border-left-width: 1px;}.ace_slim-cursors .ace_cursor {border-left-width: 1px;}.ace_overwrite-cursors .ace_cursor {border-left-width: 0;border-bottom: 1px solid;}.ace_hidden-cursors .ace_cursor {opacity: 0.2;}.ace_smooth-blinking .ace_cursor {transition: opacity 0.18s;}.ace_animate-blinking .ace_cursor {animation-duration: 1000ms;animation-timing-function: step-end;animation-name: blink-ace-animate;animation-iteration-count: infinite;}.ace_animate-blinking.ace_smooth-blinking .ace_cursor {animation-duration: 1000ms;animation-timing-function: ease-in-out;animation-name: blink-ace-animate-smooth;}@keyframes blink-ace-animate {from, to { opacity: 1; }60% { opacity: 0; }}@keyframes blink-ace-animate-smooth {from, to { opacity: 1; }45% { opacity: 1; }60% { opacity: 0; }85% { opacity: 0; }}.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {position: absolute;z-index: 3;}.ace_marker-layer .ace_selection {position: absolute;z-index: 5;}.ace_marker-layer .ace_bracket {position: absolute;z-index: 6;}.ace_marker-layer .ace_active-line {position: absolute;z-index: 2;}.ace_marker-layer .ace_selected-word {position: absolute;z-index: 4;box-sizing: border-box;}.ace_line .ace_fold {box-sizing: border-box;display: inline-block;height: 11px;margin-top: -2px;vertical-align: middle;background-image:url("data:image/png;base64,your_sha256_hashZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//your_sha256_hashvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/your_sha256_hashLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,your_sha256_hashZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");background-repeat: no-repeat, repeat-x;background-position: center center, top left;color: transparent;border: 1px solid black;border-radius: 2px;cursor: pointer;pointer-events: auto;}.ace_dark .ace_fold {}.ace_fold:hover{background-image:url("data:image/png;base64,your_sha256_hashZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//your_sha256_hashvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/your_sha256_hashLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,your_sha256_hashZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");}.ace_tooltip {background-color: #FFF;background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));border: 1px solid gray;border-radius: 1px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);color: black;max-width: 100%;padding: 3px 4px;position: fixed;z-index: 999999;box-sizing: border-box;cursor: default;white-space: pre;word-wrap: break-word;line-height: normal;font-style: normal;font-weight: normal;letter-spacing: normal;pointer-events: none;}.ace_folding-enabled > .ace_gutter-cell {padding-right: 13px;}.ace_fold-widget {box-sizing: border-box;margin: 0 -12px 0 1px;display: none;width: 11px;vertical-align: top;background-image: url("data:image/png;base64,your_sha256_hashyour_sha256_hashKAAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: center;border-radius: 3px;border: 1px solid transparent;cursor: pointer;}.ace_folding-enabled .ace_fold-widget {display: inline-block; }.ace_fold-widget.ace_end {background-image: url("data:image/png;base64,your_sha256_hashMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");}.ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,your_sha256_hashyour_sha256_hashL+l0YWnZAAAAAElFTkSuQmCCXA==");}.ace_fold-widget:hover {border: 1px solid rgba(0, 0, 0, 0.3);background-color: rgba(255, 255, 255, 0.2);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);}.ace_fold-widget:active {border: 1px solid rgba(0, 0, 0, 0.4);background-color: rgba(0, 0, 0, 0.05);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);}.ace_dark .ace_fold-widget {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");}.ace_dark .ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget:hover {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);background-color: rgba(255, 255, 255, 0.1);}.ace_dark .ace_fold-widget:active {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);}.ace_inline_button {border: 1px solid lightgray;display: inline-block;margin: -1px 8px;padding: 0 5px;pointer-events: auto;cursor: pointer;}.ace_inline_button:hover {border-color: gray;background: rgba(200,200,200,0.2);display: inline-block;pointer-events: auto;}.ace_fold-widget.ace_invalid {background-color: #FFB4B4;border-color: #DE5555;}.ace_fade-fold-widgets .ace_fold-widget {transition: opacity 0.4s ease 0.05s;opacity: 0;}.ace_fade-fold-widgets:hover .ace_fold-widget {transition: opacity 0.05s ease 0.05s;opacity:1;}.ace_underline {text-decoration: underline;}.ace_bold {font-weight: bold;}.ace_nobold .ace_bold {font-weight: normal;}.ace_italic {font-style: italic;}.ace_error-marker {background-color: rgba(255, 0, 0,0.2);position: absolute;z-index: 9;}.ace_highlight-marker {background-color: rgba(255, 255, 0,0.2);position: absolute;z-index: 8;}.ace_text-input-ios {position: absolute !important;top: -100000px !important;left: -100000px !important;}',m=e("./lib/useragent"),g=m.isIE;i.importCssString(v,"ace_editor.css");var y=function(e,t){var n=this;this.container=e||i.createElement("div"),i.addCssClass(this.container,"ace_editor"),i.HI_DPI&&i.addCssClass(this.container,"ace_hidpi"),this.setTheme(t),this.$gutter=i.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden",!0),this.scroller=i.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=i.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new o(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new u(this.content);var r=this.$textLayer=new a(this.content);this.canvas=r.element,this.$markerFront=new u(this.content),this.$cursorLayer=new f(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new c(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new p(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.addEventListener("changeCharacterSize",function(e){n.updateCharacterSize(),n.onResize(!0,n.gutterWidth,n.$size.width,n.$size.height),n._signal("changeCharacterSize",e)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!0,this.$loop=new h(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),s.resetOptions(this),s._emit("renderer",this)};(function(){this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,r.implement(this,d),this.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin()},this.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&e.getScrollTop()<=0&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e);if(!e)return;this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode)},this.updateLines=function(e,t,n){t===undefined&&(t=Infinity),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRow<t&&(this.$changedLines.lastRow=t)):this.$changedLines={firstRow:e,lastRow:t};if(this.$changedLines.lastRow<this.layerConfig.firstRow){if(!n)return;this.$changedLines.lastRow=this.layerConfig.lastRow}if(this.$changedLines.firstRow>this.layerConfig.lastRow)return;this.$loop.schedule(this.CHANGE_LINES)},this.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},this.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.$changes=0,this.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},this.onResize=function(e,t,n,r){if(this.resizing>2)return;this.resizing>0?this.resizing++:this.resizing=e?1:0;var i=this.container;r||(r=i.clientHeight||i.scrollHeight),n||(n=i.clientWidth||i.scrollWidth);var s=this.$updateCachedSize(e,t,n,r);if(!this.$size.scrollerHeight||!n&&!r)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(s|this.$changes,!0):this.$loop.schedule(s|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarV.scrollLeft=this.scrollBarV.scrollTop=null},this.$updateCachedSize=function(e,t,n,r){r-=this.$extraHeight||0;var s=0,o=this.$size,u={width:o.width,height:o.height,scrollerHeight:o.scrollerHeight,scrollerWidth:o.scrollerWidth};r&&(e||o.height!=r)&&(o.height=r,s|=this.CHANGE_SIZE,o.scrollerHeight=o.height,this.$horizScroll&&(o.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",s|=this.CHANGE_SCROLL);if(n&&(e||o.width!=n)){s|=this.CHANGE_SIZE,o.width=n,t==null&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,i.setStyle(this.scrollBarH.element.style,"left",t+"px"),i.setStyle(this.scroller.style,"left",t+this.margin.left+"px"),o.scrollerWidth=Math.max(0,n-t-this.scrollBarV.getWidth()-this.margin.h),i.setStyle(this.$gutter.style,"left",this.margin.left+"px");var a=this.scrollBarV.getWidth()+"px";i.setStyle(this.scrollBarH.element.style,"right",a),i.setStyle(this.scroller.style,"right",a),i.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight());if(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)s|=this.CHANGE_FULL}return o.$dirty=!n||!r,s&&this._signal("resize",u),s},this.onGutterResize=function(e){var t=this.$showGutter?e:0;t!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,t,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},this.adjustWrapLimit=function(){var e=this.$size.scrollerWidth-this.$padding*2,t=Math.floor(e/this.characterWidth);return this.session.adjustWrapLimit(t,this.$showPrintMargin&&this.$printMarginColumn)},this.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},this.getAnimatedScroll=function(){return this.$animatedScroll},this.setShowInvisibles=function(e){this.setOption("showInvisibles",e),this.session.$bidiHandler.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.getOption("showInvisibles")},this.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},this.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},this.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},this.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},this.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},this.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},this.getShowGutter=function(){return this.getOption("showGutter")},this.setShowGutter=function(e){return this.setOption("showGutter",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.$updatePrintMargin=function(){if(!this.$showPrintMargin&&!this.$printMarginEl)return;if(!this.$printMarginEl){var e=i.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=i.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",t.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()},this.getContainerElement=function(){return this.container},this.getMouseEventTarget=function(){return this.scroller},this.getTextAreaContainer=function(){return this.container},this.$moveTextAreaToCursor=function(){var e=this.textarea.style;if(!this.$keepTextAreaAtCursor){i.translate(this.textarea,-100,0);return}var t=this.$cursorLayer.$pixelPos;if(!t)return;var n=this.$composition;n&&n.markerRange&&(t=this.$cursorLayer.getPixelPosition(n.markerRange.start,!0));var r=this.layerConfig,s=t.top,o=t.left;s-=r.offset;var u=n&&n.useTextareaForIME?this.lineHeight:g?0:1;if(s<0||s>r.height-u){i.translate(this.textarea,0,0);return}var a=1;if(!n)s+=this.lineHeight;else if(n.useTextareaForIME){var f=this.textarea.value;a=this.characterWidth*this.session.$getStringScreenWidth(f)[0],u+=2}else s+=this.lineHeight+2;o-=this.scrollLeft,o>this.$size.scrollerWidth-a&&(o=this.$size.scrollerWidth-a),o+=this.gutterWidth+this.margin.left,i.setStyle(e,"height",u+"px"),i.setStyle(e,"width",a+"px"),i.translate(this.textarea,Math.min(o,this.$size.scrollerWidth-a),Math.min(s,this.$size.height-u))},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},this.getLastFullyVisibleRow=function(){var e=this.layerConfig,t=e.lastRow,n=this.session.documentToScreenRow(t,0)*e.lineHeight;return n-this.session.getScrollTop()>e.height-e.lineHeight?t-1:t},this.getLastVisibleRow=function(){return this.layerConfig.lastRow},this.$padding=null,this.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},this.setScrollMargin=function(e,t,n,r){var i=this.scrollMargin;i.top=e|0,i.bottom=t|0,i.right=r|0,i.left=n|0,i.v=i.top+i.bottom,i.h=i.left+i.right,i.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-i.top),this.updateFull()},this.setMargin=function(e,t,n,r){var i=this.margin;i.top=e|0,i.bottom=t|0,i.right=r|0,i.left=n|0,i.v=i.top+i.bottom,i.h=i.left+i.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},this.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},this.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},this.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},this.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,t=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(t-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-t&&(e=this.scrollTop+t,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},this.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},this.$frozen=!1,this.freeze=function(){this.$frozen=!0},this.unfreeze=function(){this.$frozen=!1},this.$renderChanges=function(e,t){this.$changes&&(e|=this.$changes,this.$changes=0);if(!this.session||!this.container.offsetWidth||this.$frozen||!e&&!t){this.$changes|=e;return}if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender"),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var n=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){e|=this.$computeLayerConfig();if(n.firstRow!=this.layerConfig.firstRow&&n.firstRowScreen==this.layerConfig.firstRowScreen){var r=this.scrollTop+(n.firstRow-this.layerConfig.firstRow)*this.lineHeight;r>0&&(this.scrollTop=r,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig())}n=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),i.translate(this.content,-this.scrollLeft,-n.offset);var s=n.width+2*this.$padding+"px",o=n.minHeight+"px";i.setStyle(this.content.style,"width",s),i.setStyle(this.content.style,"height",o)}e&this.CHANGE_H_SCROLL&&(i.translate(this.content,-this.scrollLeft,-n.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller":"ace_scroller ace_scroll-left");if(e&this.CHANGE_FULL){this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this._signal("afterRender");return}if(e&this.CHANGE_SCROLL){e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(n):this.$textLayer.scrollLines(n),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(n):this.$gutterLayer.scrollLines(n)),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this._signal("afterRender");return}e&this.CHANGE_TEXT?(this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n)):e&this.CHANGE_LINES?(this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(n):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?this.$showGutter&&this.$gutterLayer.update(n):e&this.CHANGE_CURSOR&&this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(n),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(n),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(n),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(n),this._signal("afterRender")},this.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,n=Math.min(t,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(n+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&n>this.$maxPixelHeight&&(n=this.$maxPixelHeight);var r=n<=2*this.lineHeight,i=!r&&e>t;if(n!=this.desiredHeight||this.$size.height!=this.desiredHeight||i!=this.$vScroll){i!=this.$vScroll&&(this.$vScroll=i,this.scrollBarV.setVisible(i));var s=this.container.clientWidth;this.container.style.height=n+"px",this.$updateCachedSize(!0,this.$gutterWidth,s,n),this.desiredHeight=n,this._signal("autosize")}},this.$computeLayerConfig=function(){var e=this.session,t=this.$size,n=t.height<=2*this.lineHeight,r=this.session.getScreenLength(),i=r*this.lineHeight,s=this.$getLongestLine(),o=!n&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-s-2*this.$padding<0),u=this.$horizScroll!==o;u&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var a=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var f=this.scrollTop%this.lineHeight,l=t.scrollerHeight+this.lineHeight,c=!this.$maxLines&&this.$scrollPastEnd?(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;i+=c;var h=this.scrollMargin;this.session.setScrollTop(Math.max(-h.top,Math.min(this.scrollTop,i-t.scrollerHeight+h.bottom))),this.session.setScrollLeft(Math.max(-h.left,Math.min(this.scrollLeft,s+2*this.$padding-t.scrollerWidth+h.right)));var p=!n&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-i+c<0||this.scrollTop>h.top),d=a!==p;d&&(this.$vScroll=p,this.scrollBarV.setVisible(p));var v=Math.ceil(l/this.lineHeight)-1,m=Math.max(0,Math.round((this.scrollTop-f)/this.lineHeight)),g=m+v,y,b,w=this.lineHeight;m=e.screenToDocumentRow(m,0);var E=e.getFoldLine(m);E&&(m=E.start.row),y=e.documentToScreenRow(m,0),b=e.getRowLength(m)*w,g=Math.min(e.screenToDocumentRow(g,0),e.getLength()-1),l=t.scrollerHeight+e.getRowLength(g)*w+b,f=this.scrollTop-y*w;var S=0;if(this.layerConfig.width!=s||u)S=this.CHANGE_H_SCROLL;if(u||d)S=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal("scrollbarVisibilityChanged"),d&&(s=this.$getLongestLine());return this.layerConfig={width:s,padding:this.$padding,firstRow:m,firstRowScreen:y,lastRow:g,lineHeight:w,characterWidth:this.characterWidth,minHeight:l,maxHeight:i,offset:f,gutterOffset:w?Math.max(0,Math.ceil((f+t.height-t.scrollerHeight)/w)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(s-this.$padding),S},this.$updateLines=function(){if(!this.$changedLines)return;var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var n=this.layerConfig;if(e>n.lastRow+1)return;if(t<n.firstRow)return;if(t===Infinity){this.$showGutter&&this.$gutterLayer.update(n),this.$textLayer.update(n);return}return this.$textLayer.updateLines(n,e,t),!0},this.$getLongestLine=function(){var e=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(e+=1),this.$textLayer&&e>this.$textLayer.MAX_LINE_LENGTH&&(e=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},this.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},this.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},this.addGutterDecoration=function(e,t){this.$gutterLayer.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){this.$gutterLayer.removeGutterDecoration(e,t)},this.updateBreakpoints=function(e){this.$loop.schedule(this.CHANGE_GUTTER)},this.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},this.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},this.hideCursor=function(){this.$cursorLayer.hideCursor()},this.showCursor=function(){this.$cursorLayer.showCursor()},this.scrollSelectionIntoView=function(e,t,n){this.scrollCursorIntoView(e,n),this.scrollCursorIntoView(t,n)},this.scrollCursorIntoView=function(e,t,n){if(this.$size.scrollerHeight===0)return;var r=this.$cursorLayer.getPixelPosition(e),i=r.left,s=r.top,o=n&&n.top||0,u=n&&n.bottom||0,a=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;a+o>s?(t&&a+o>s+this.lineHeight&&(s-=t*this.$size.scrollerHeight),s===0&&(s=-this.scrollMargin.top),this.session.setScrollTop(s)):a+this.$size.scrollerHeight-u<s+this.lineHeight&&(t&&a+this.$size.scrollerHeight-u<s-this.lineHeight&&(s+=t*this.$size.scrollerHeight),this.session.setScrollTop(s+this.lineHeight-this.$size.scrollerHeight));var f=this.scrollLeft;f>i?(i<this.$padding+2*this.layerConfig.characterWidth&&(i=-this.scrollMargin.left),this.session.setScrollLeft(i)):f+this.$size.scrollerWidth<i+this.characterWidth?this.session.setScrollLeft(Math.round(i+this.characterWidth-this.$size.scrollerWidth)):f<=this.$padding&&i-f<this.characterWidth&&this.session.setScrollLeft(0)},this.getScrollTop=function(){return this.session.getScrollTop()},this.getScrollLeft=function(){return this.session.getScrollLeft()},this.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},this.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},this.scrollToRow=function(e){this.session.setScrollTop(e*this.lineHeight)},this.alignCursor=function(e,t){typeof e=="number"&&(e={row:e,column:0});var n=this.$cursorLayer.getPixelPosition(e),r=this.$size.scrollerHeight-this.lineHeight,i=n.top-r*(t||0);return this.session.setScrollTop(i),i},this.STEPS=8,this.$calcSteps=function(e,t){var n=0,r=this.STEPS,i=[],s=function(e,t,n){return n*(Math.pow(e-1,3)+1)+t};for(n=0;n<r;++n)i.push(s(n/this.STEPS,e,t-e));return i},this.scrollToLine=function(e,t,n,r){var i=this.$cursorLayer.getPixelPosition({row:e,column:0}),s=i.top;t&&(s-=this.$size.scrollerHeight/2);var o=this.scrollTop;this.session.setScrollTop(s),n!==!1&&this.animateScrolling(o,r)},this.animateScrolling=function(e,t){var n=this.scrollTop;if(!this.$animatedScroll)return;var r=this;if(e==n)return;if(this.$scrollAnimation){var i=this.$scrollAnimation.steps;if(i.length){e=i[0];if(e==n)return}}var s=r.$calcSteps(e,n);this.$scrollAnimation={from:e,to:n,steps:s},clearInterval(this.$timer),r.session.setScrollTop(s.shift()),r.session.$scrollTop=n,this.$timer=setInterval(function(){s.length?(r.session.setScrollTop(s.shift()),r.session.$scrollTop=n):n!=null?(r.session.$scrollTop=-1,r.session.setScrollTop(n),n=null):(r.$timer=clearInterval(r.$timer),r.$scrollAnimation=null,t&&t())},10)},this.scrollToY=function(e){this.scrollTop!==e&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=e)},this.scrollToX=function(e){this.scrollLeft!==e&&(this.scrollLeft=e),this.$loop.schedule(this.CHANGE_H_SCROLL)},this.scrollTo=function(e,t){this.session.setScrollTop(t),this.session.setScrollLeft(t)},this.scrollBy=function(e,t){t&&this.session.setScrollTop(this.session.getScrollTop()+t),e&&this.session.setScrollLeft(this.session.getScrollLeft()+e)},this.isScrollableBy=function(e,t){if(t<0&&this.session.getScrollTop()>=1-this.scrollMargin.top)return!0;if(t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom)return!0;if(e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left)return!0;if(e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},this.pixelToScreenCoordinates=function(e,t){var n;if(this.$hasCssTransforms){n={top:0,left:0};var r=this.$fontMetrics.transformCoordinates([e,t]);e=r[1]-this.gutterWidth-this.margin.left,t=r[0]}else n=this.scroller.getBoundingClientRect();var i=e+this.scrollLeft-n.left-this.$padding,s=i/this.characterWidth,o=Math.floor((t+this.scrollTop-n.top)/this.lineHeight),u=this.$blockCursor?Math.floor(s):Math.round(s);return{row:o,column:u,side:s-u>0?1:-1,offsetX:i}},this.screenToTextCoordinates=function(e,t){var n;if(this.$hasCssTransforms){n={top:0,left:0};var r=this.$fontMetrics.transformCoordinates([e,t]);e=r[1]-this.gutterWidth-this.margin.left,t=r[0]}else n=this.scroller.getBoundingClientRect();var i=e+this.scrollLeft-n.left-this.$padding,s=i/this.characterWidth,o=this.$blockCursor?Math.floor(s):Math.round(s),u=Math.floor((t+this.scrollTop-n.top)/this.lineHeight);return this.session.screenToDocumentPosition(u,Math.max(o,0),i)},this.textToScreenCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),r=this.session.documentToScreenPosition(e,t),i=this.$padding+(this.session.$bidiHandler.isBidiRow(r.row,e)?this.session.$bidiHandler.getPosLeft(r.column):Math.round(r.column*this.characterWidth)),s=r.row*this.lineHeight;return{pageX:n.left+i-this.scrollLeft,pageY:n.top+s-this.scrollTop}},this.visualizeFocus=function(){i.addCssClass(this.container,"ace_focus")},this.visualizeBlur=function(){i.removeCssClass(this.container,"ace_focus")},this.showComposition=function(e){this.$composition=e,e.cssText||(e.cssText=this.textarea.style.cssText,e.keepTextAreaAtCursor=this.$keepTextAreaAtCursor),e.useTextareaForIME=this.$useTextareaForIME,this.$useTextareaForIME?(this.$keepTextAreaAtCursor=!0,i.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):e.markerId=this.session.addMarker(e.markerRange,"ace_composition_marker","text")},this.setCompositionText=function(e){var t=this.session.selection.cursor;this.addToken(e,"composition_placeholder",t.row,t.column),this.$moveTextAreaToCursor()},this.hideComposition=function(){if(!this.$composition)return;this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),i.removeCssClass(this.textarea,"ace_composition"),this.$keepTextAreaAtCursor=this.$composition.keepTextAreaAtCursor,this.textarea.style.cssText=this.$composition.cssText,this.$composition=null,this.$cursorLayer.element.style.display=""},this.addToken=function(e,t,n,r){var i=this.session;i.bgTokenizer.lines[n]=null;var s={type:t,value:e},o=i.getTokens(n);if(r==null)o.push(s);else{var u=0;for(var a=0;a<o.length;a++){var f=o[a];u+=f.value.length;if(r<=u){var l=f.value.length-(u-r),c=f.value.slice(0,l),h=f.value.slice(l);o.splice(a,1,{type:f.type,value:c},s,{type:f.type,value:h});break}}}this.updateLines(n,n)},this.setTheme=function(e,t){function o(r){if(n.$themeId!=e)return t&&t();if(!r||!r.cssClass)throw new Error("couldn't load module "+e+" or it didn't call define");r.$id&&(n.$themeId=r.$id),i.importCssString(r.cssText,r.cssClass,n.container),n.theme&&i.removeCssClass(n.container,n.theme.cssClass);var s="padding"in r?r.padding:"padding"in(n.theme||{})?4:n.$padding;n.$padding&&s!=n.$padding&&n.setPadding(s),n.$theme=r.cssClass,n.theme=r,i.addCssClass(n.container,r.cssClass),i.setCssClass(n.container,"ace_dark",r.isDark),n.$size&&(n.$size.width=0,n.$updateSizeAsync()),n._dispatchEvent("themeLoaded",{theme:r}),t&&t()}var n=this;this.$themeId=e,n._dispatchEvent("themeChange",{theme:e});if(!e||typeof e=="string"){var r=e||this.$options.theme.initialValue;s.loadModule(["theme",r],o)}else o(e)},this.getTheme=function(){return this.$themeId},this.setStyle=function(e,t){i.setCssClass(this.container,e,t!==!1)},this.unsetStyle=function(e){i.removeCssClass(this.container,e)},this.setCursorStyle=function(e){i.setStyle(this.scroller.style,"cursor",e)},this.setMouseCursor=function(e){i.setStyle(this.scroller.style,"cursor",e)},this.attachToShadowRoot=function(){i.importCssString(v,"ace_editor.css",this.container)},this.destroy=function(){this.$fontMetrics.destroy(),this.$cursorLayer.destroy()}}).call(y.prototype),s.defineOptions(y.prototype,"renderer",{animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){typeof e=="number"&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},fadeFoldWidgets:{set:function(e){i.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightGutterLine:{set:function(e){this.$gutterLayer.setHighlightGutterLine(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(e){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(e){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){typeof e=="number"&&(e+="px"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(e){this.updateFull()}},minLines:{set:function(e){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(e){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(e){e=+e||0;if(this.$scrollPastEnd==e)return;this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}},theme:{set:function(e){this.setTheme(e)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!m.isMobile&&!m.isIE}}),t.VirtualRenderer=y}),define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(e,t,n){"use strict";function u(e){var t="importScripts('"+i.qualifyURL(e)+"');";try{return new Blob([t],{type:"application/javascript"})}catch(n){var r=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,s=new r;return s.append(t),s.getBlob("application/javascript")}}function a(e){if(typeof Worker=="undefined")return{postMessage:function(){},terminate:function(){}};var t=u(e),n=window.URL||window.webkitURL,r=n.createObjectURL(t);return new Worker(r)}var r=e("../lib/oop"),i=e("../lib/net"),s=e("../lib/event_emitter").EventEmitter,o=e("../config"),f=function(t,n,r,i,s){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl);if(o.get("packaged")||!e.toUrl)i=i||o.moduleUrl(n,"worker");else{var u=this.$normalizePath;i=i||u(e.toUrl("ace/worker/worker.js",null,"_"));var f={};t.forEach(function(t){f[t]=u(e.toUrl(t,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}this.$worker=a(i),s&&this.send("importScripts",s),this.$worker.postMessage({init:!0,tlns:f,module:n,classname:r}),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){r.implement(this,s),this.onMessage=function(e){var t=e.data;switch(t.type){case"event":this._signal(t.name,{data:t.data});break;case"call":var n=this.callbacks[t.id];n&&(n(t.data),delete this.callbacks[t.id]);break;case"error":this.reportError(t.data);break;case"log":window.console&&console.log&&console.log.apply(console,t.data)}},this.reportError=function(e){window.console&&console.error&&console.error(e)},this.$normalizePath=function(e){return i.qualifyURL(e)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(e,t){this.$worker.postMessage({command:e,args:t})},this.call=function(e,t,n){if(n){var r=this.callbackId++;this.callbacks[r]=n,t.push(r)}this.send(e,t)},this.emit=function(e,t){try{t.data&&t.data.err&&(t.data.err={message:t.data.err.message,stack:t.data.err.stack,code:t.data.err.code}),this.$worker.postMessage({event:e,data:{data:t.data}})}catch(n){console.error(n.stack)}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call("setValue",[e.getValue()]),e.on("change",this.changeListener)},this.changeListener=function(e){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),e.action=="insert"?this.deltaQueue.push(e.start,e.lines):this.deltaQueue.push(e.start,e.end)},this.$sendDeltaQueue=function(){var e=this.deltaQueue;if(!e)return;this.deltaQueue=null,e.length>50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e})}}).call(f.prototype);var l=function(e,t,n){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.callbackId=1,this.callbacks={},this.messageBuffer=[];var r=null,i=!1,u=Object.create(s),a=this;this.$worker={},this.$worker.terminate=function(){},this.$worker.postMessage=function(e){a.messageBuffer.push(e),r&&(i?setTimeout(f):f())},this.setEmitSync=function(e){i=e};var f=function(){var e=a.messageBuffer.shift();e.command?r[e.command].apply(r,e.args):e.event&&u._signal(e.event,e.data)};u.postMessage=function(e){a.onMessage({data:e})},u.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},u.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},o.loadModule(["worker",t],function(e){r=new e[n](u);while(a.messageBuffer.length)f()})};l.prototype=f.prototype,t.UIWorkerClient=l,t.WorkerClient=f,t.createWorker=a}),define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,t,n){"use strict";var r=e("./range").Range,i=e("./lib/event_emitter").EventEmitter,s=e("./lib/oop"),o=function(e,t,n,r,i,s){var o=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=i,this.othersClass=s,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate),this.$others=r,this.$onCursorChange=function(){setTimeout(function(){o.onCursorChange()})},this.$pos=n;var u=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=u.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)};(function(){s.implement(this,i),this.setup=function(){var e=this,t=this.doc,n=this.session;this.selectionBefore=n.selection.toJSON(),n.selection.inMultiSelectMode&&n.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var i=this.pos;i.$insertRight=!0,i.detach(),i.markerId=n.addMarker(new r(i.row,i.column,i.row,i.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(n){var r=t.createAnchor(n.row,n.column);r.$insertRight=!0,r.detach(),e.others.push(r)}),n.setUndoSelect(!1)},this.showOtherMarkers=function(){if(this.othersActive)return;var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(n){n.markerId=e.addMarker(new r(n.row,n.column,n.row,n.column+t.length),t.othersClass,null,!1)})},this.hideOtherMarkers=function(){if(!this.othersActive)return;this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)},this.onUpdate=function(e){if(this.$updating)return this.updateAnchors(e);var t=e;if(t.start.row!==t.end.row)return;if(t.start.row!==this.pos.row)return;this.$updating=!0;var n=e.action==="insert"?t.end.column-t.start.column:t.start.column-t.end.column,i=t.start.column>=this.pos.column&&t.start.column<=this.pos.column+this.length+1,s=t.start.column-this.pos.column;this.updateAnchors(e),i&&(this.length+=n);if(i&&!this.session.$fromUndo)if(e.action==="insert")for(var o=this.others.length-1;o>=0;o--){var u=this.others[o],a={row:u.row,column:u.column+s};this.doc.insertMergedLines(a,e.lines)}else if(e.action==="remove")for(var o=this.others.length-1;o>=0;o--){var u=this.others[o],a={row:u.row,column:u.column+s};this.doc.remove(new r(a.row,a.column,a.row,a.column-n))}this.$updating=!1,this.updateMarkers()},this.updateAnchors=function(e){this.pos.onChange(e);for(var t=this.others.length;t--;)this.others[t].onChange(e);this.updateMarkers()},this.updateMarkers=function(){if(this.$updating)return;var e=this,t=this.session,n=function(n,i){t.removeMarker(n.markerId),n.markerId=t.addMarker(new r(n.row,n.column,n.row,n.column+e.length),i,null,!1)};n(this.pos,this.mainClass);for(var i=this.others.length;i--;)n(this.others[i],this.othersClass)},this.onCursorChange=function(e){if(this.$updating||!this.session)return;var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))},this.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.removeEventListener("change",this.$onUpdate),this.session.selection.removeEventListener("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},this.cancel=function(){if(this.$undoStackDepth===-1)return;var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth;for(var n=0;n<t;n++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}}).call(o.prototype),t.PlaceHolder=o}),define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){function s(e,t){return e.row==t.row&&e.column==t.column}function o(e){var t=e.domEvent,n=t.altKey,o=t.shiftKey,u=t.ctrlKey,a=e.getAccelKey(),f=e.getButton();u&&i.isMac&&(f=t.button);if(e.editor.inMultiSelectMode&&f==2){e.editor.textInput.onContextMenu(e.domEvent);return}if(!u&&!n&&!a){f===0&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode();return}if(f!==0)return;var l=e.editor,c=l.selection,h=l.inMultiSelectMode,p=e.getDocumentPosition(),d=c.getCursor(),v=e.inSelection()||c.isEmpty()&&s(p,d),m=e.x,g=e.y,y=function(e){m=e.clientX,g=e.clientY},b=l.session,w=l.renderer.pixelToScreenCoordinates(m,g),E=w,S;if(l.$mouseHandler.$enableJumpToDef)u&&n||a&&n?S=o?"block":"add":n&&l.$blockSelectEnabled&&(S="block");else if(a&&!n){S="add";if(!h&&o)return}else n&&l.$blockSelectEnabled&&(S="block");S&&i.isMac&&t.ctrlKey&&l.$mouseHandler.cancelContextMenu();if(S=="add"){if(!h&&v)return;if(!h){var x=c.toOrientedRange();l.addSelectionMarker(x)}var T=c.rangeList.rangeAtPoint(p);l.inVirtualSelectionMode=!0,o&&(T=null,x=c.ranges[0]||x,l.removeSelectionMarker(x)),l.once("mouseup",function(){var e=c.toOrientedRange();T&&e.isEmpty()&&s(T.cursor,e.cursor)?c.substractPoint(e.cursor):(o?c.substractPoint(x.cursor):x&&(l.removeSelectionMarker(x),c.addRange(x)),c.addRange(e)),l.inVirtualSelectionMode=!1})}else if(S=="block"){e.stop(),l.inVirtualSelectionMode=!0;var N,C=[],k=function(){var e=l.renderer.pixelToScreenCoordinates(m,g),t=b.screenToDocumentPosition(e.row,e.column,e.offsetX);if(s(E,e)&&s(t,c.lead))return;E=e,l.selection.moveToPosition(t),l.renderer.scrollCursorIntoView(),l.removeSelectionMarkers(C),C=c.rectangularRangeBlock(E,w),l.$mouseHandler.$clickSelection&&C.length==1&&C[0].isEmpty()&&(C[0]=l.$mouseHandler.$clickSelection.clone()),C.forEach(l.addSelectionMarker,l),l.updateSelectionMarkers()};h&&!a?c.toSingleRange():!h&&a&&(N=c.toOrientedRange(),l.addSelectionMarker(N)),o?w=b.documentToScreenPosition(c.lead):c.moveToPosition(p),E={row:-1,column:-1};var L=function(e){k(),clearInterval(O),l.removeSelectionMarkers(C),C.length||(C=[c.toOrientedRange()]),N&&(l.removeSelectionMarker(N),c.toSingleRange(N));for(var t=0;t<C.length;t++)c.addRange(C[t]);l.inVirtualSelectionMode=!1,l.$mouseHandler.$clickSelection=null},A=k;r.capture(l.container,y,L);var O=setInterval(function(){A()},20);return e.preventDefault()}}var r=e("../lib/event"),i=e("../lib/useragent");t.onMouseDown=o}),define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(e,t,n){t.defaultCommands=[{name:"addCursorAbove",exec:function(e){e.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",exec:function(e){e.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorAboveSkipCurrent",exec:function(e){e.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelowSkipCurrent",exec:function(e){e.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreBefore",exec:function(e){e.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",exec:function(e){e.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",exec:function(e){e.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextAfter",exec:function(e){e.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"splitIntoLines",exec:function(e){e.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"alignCursors",exec:function(e){e.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",exec:function(e){e.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],t.multiSelectCommands=[{name:"singleSelection",bindKey:"esc",exec:function(e){e.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(e){return e&&e.inMultiSelectMode}}];var r=e("../keyboard/hash_handler").HashHandler;t.keyboardHandler=new r(t.multiSelectCommands)}),define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(e,t,n){function h(e,t,n){return c.$options.wrap=!0,c.$options.needle=t,c.$options.backwards=n==-1,c.find(e)}function v(e,t){return e.row==t.row&&e.column==t.column}function m(e){if(e.$multiselectOnSessionChange)return;e.$onAddRange=e.$onAddRange.bind(e),e.$onRemoveRange=e.$onRemoveRange.bind(e),e.$onMultiSelect=e.$onMultiSelect.bind(e),e.$onSingleSelect=e.$onSingleSelect.bind(e),e.$multiselectOnSessionChange=t.onSessionChange.bind(e),e.$checkMultiselectChange=e.$checkMultiselectChange.bind(e),e.$multiselectOnSessionChange(e),e.on("changeSession",e.$multiselectOnSessionChange),e.on("mousedown",o),e.commands.addCommands(f.defaultCommands),g(e)}function g(e){function r(t){n&&(e.renderer.setMouseCursor(""),n=!1)}var t=e.textInput.getElement(),n=!1;u.addListener(t,"keydown",function(t){var i=t.keyCode==18&&!(t.ctrlKey||t.shiftKey||t.metaKey);e.$blockSelectEnabled&&i?n||(e.renderer.setMouseCursor("crosshair"),n=!0):n&&r()}),u.addListener(t,"keyup",r),u.addListener(t,"blur",r)}var r=e("./range_list").RangeList,i=e("./range").Range,s=e("./selection").Selection,o=e("./mouse/multi_select_handler").onMouseDown,u=e("./lib/event"),a=e("./lib/lang"),f=e("./commands/multi_select_commands");t.commands=f.defaultCommands.concat(f.multiSelectCommands);var l=e("./search").Search,c=new l,p=e("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(p.prototype),function(){this.ranges=null,this.rangeList=null,this.addRange=function(e,t){if(!e)return;if(!this.inMultiSelectMode&&this.rangeCount===0){var n=this.toOrientedRange();this.rangeList.add(n),this.rangeList.add(e);if(this.rangeList.ranges.length!=2)return this.rangeList.removeAll(),t||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(n),this.$onAddRange(n)}e.cursor||(e.cursor=e.end);var r=this.rangeList.add(e);return this.$onAddRange(e),r.length&&this.$onRemoveRange(r),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);if(t)return this.$onRemoveRange(t),t[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length&&this.$onRemoveRange(e)},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){this.rangeCount=this.rangeList.ranges.length;if(this.rangeCount==1&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var n=e.length;n--;){var r=this.ranges.indexOf(e[n]);this.ranges.splice(r,1)}this._signal("removeRange",{ranges:e}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),t=t||this.ranges[0],t&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){if(this.rangeList)return;this.rangeList=new r,this.ranges=[],this.rangeCount=0},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var n=this.getRange(),r=this.isBackwards(),s=n.start.row,o=n.end.row;if(s==o){if(r)var u=n.end,a=n.start;else var u=n.start,a=n.end;this.addRange(i.fromPoints(a,a)),this.addRange(i.fromPoints(u,u));return}var f=[],l=this.getLineRange(s,!0);l.start.column=n.start.column,f.push(l);for(var c=s+1;c<o;c++)f.push(this.getLineRange(c,!0));l=this.getLineRange(o,!0),l.end.column=n.end.column,f.push(l),f.forEach(this.addRange,this)}},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var r=this.session.documentToScreenPosition(this.cursor),s=this.session.documentToScreenPosition(this.anchor),o=this.rectangularRangeBlock(r,s);o.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,n){var r=[],s=e.column<t.column;if(s)var o=e.column,u=t.column,a=e.offsetX,f=t.offsetX;else var o=t.column,u=e.column,a=t.offsetX,f=e.offsetX;var l=e.row<t.row;if(l)var c=e.row,h=t.row;else var c=t.row,h=e.row;o<0&&(o=0),c<0&&(c=0),c==h&&(n=!0);var p;for(var d=c;d<=h;d++){var m=i.fromPoints(this.session.screenToDocumentPosition(d,o,a),this.session.screenToDocumentPosition(d,u,f));if(m.isEmpty()){if(p&&v(m.end,p))break;p=m.end}m.cursor=s?m.start:m.end,r.push(m)}l&&r.reverse();if(!n){var g=r.length-1;while(r[g].isEmpty()&&g>0)g--;if(g>0){var y=0;while(r[y].isEmpty())y++}for(var b=g;b>=y;b--)r[b].isEmpty()&&r.splice(b,1)}return r}}.call(s.prototype);var d=e("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(!e.marker)return;this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);t!=-1&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length},this.removeSelectionMarkers=function(e){var t=this.session.$selectionMarkers;for(var n=e.length;n--;){var r=e[n];if(!r.marker)continue;this.session.removeMarker(r.marker);var i=t.indexOf(r);i!=-1&&t.splice(i,1)}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){if(this.inMultiSelectMode)return;this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(f.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onSingleSelect=function(e){if(this.session.multiSelect.inVirtualMode)return;this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(f.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection")},this.$onMultiSelectExec=function(e){var t=e.command,n=e.editor;if(!n.multiSelect)return;if(!t.multiSelectAction){var r=t.exec(n,e.args||{});n.multiSelect.addRange(n.multiSelect.toOrientedRange()),n.multiSelect.mergeOverlappingRanges()}else t.multiSelectAction=="forEach"?r=n.forEachSelection(t,e.args):t.multiSelectAction=="forEachLine"?r=n.forEachSelection(t,e.args,!0):t.multiSelectAction=="single"?(n.exitMultiSelectMode(),r=t.exec(n,e.args||{})):r=t.multiSelectAction(n,e.args||{});return r},this.forEachSelection=function(e,t,n){if(this.inVirtualSelectionMode)return;var r=n&&n.keepOrder,i=n==1||n&&n.$byLines,o=this.session,u=this.selection,a=u.rangeList,f=(r?u:a).ranges,l;if(!f.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var c=u._eventRegistry;u._eventRegistry={};var h=new s(o);this.inVirtualSelectionMode=!0;for(var p=f.length;p--;){if(i)while(p>0&&f[p].start.row==f[p-1].end.row)p--;h.fromOrientedRange(f[p]),h.index=p,this.selection=o.selection=h;var d=e.exec?e.exec(this,t||{}):e(this,t||{});!l&&d!==undefined&&(l=d),h.toOrientedRange(f[p])}h.detach(),this.selection=o.selection=u,this.inVirtualSelectionMode=!1,u._eventRegistry=c,u.mergeOverlappingRanges(),u.ranges[0]&&u.fromOrientedRange(u.ranges[0]);var v=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),v&&v.from==v.to&&this.renderer.animateScrolling(v.from),l},this.exitMultiSelectMode=function(){if(!this.inMultiSelectMode||this.inVirtualSelectionMode)return;this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var t=this.multiSelect.rangeList.ranges,n=[];for(var r=0;r<t.length;r++)n.push(this.session.getTextRange(t[r]));var i=this.session.getDocument().getNewLineCharacter();e=n.join(i),e.length==(n.length-1)*i.length&&(e="")}else this.selection.isEmpty()||(e=this.session.getTextRange(this.getSelectionRange()));return e},this.$checkMultiselectChange=function(e,t){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var n=this.multiSelect.ranges[0];if(this.multiSelect.isEmpty()&&t==this.multiSelect.anchor)return;var r=t==this.multiSelect.anchor?n.cursor==n.start?n.end:n.start:n.cursor;r.row!=t.row||this.session.$clipPositionToDocument(r.row,r.column).column!=t.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}},this.findAll=function(e,t,n){t=t||{},t.needle=e||t.needle;if(t.needle==undefined){var r=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();t.needle=this.session.getTextRange(r)}this.$search.set(t);var i=this.$search.findAll(this.session);if(!i.length)return 0;var s=this.multiSelect;n||s.toSingleRange(i[0]);for(var o=i.length;o--;)s.addRange(i[o],!0);return r&&s.rangeList.rangeAtPoint(r.start)&&s.addRange(r,!0),i.length},this.selectMoreLines=function(e,t){var n=this.selection.toOrientedRange(),r=n.cursor==n.end,s=this.session.documentToScreenPosition(n.cursor);this.selection.$desiredColumn&&(s.column=this.selection.$desiredColumn);var o=this.session.screenToDocumentPosition(s.row+e,s.column);if(!n.isEmpty())var u=this.session.documentToScreenPosition(r?n.end:n.start),a=this.session.screenToDocumentPosition(u.row+e,u.column);else var a=o;if(r){var f=i.fromPoints(o,a);f.cursor=f.start}else{var f=i.fromPoints(a,o);f.cursor=f.end}f.desiredColumn=s.column;if(!this.selection.inMultiSelectMode)this.selection.addRange(n);else if(t)var l=n.cursor;this.selection.addRange(f),l&&this.selection.substractPoint(l)},this.transposeSelections=function(e){var t=this.session,n=t.multiSelect,r=n.ranges;for(var i=r.length;i--;){var s=r[i];if(s.isEmpty()){var o=t.getWordRange(s.start.row,s.start.column);s.start.row=o.start.row,s.start.column=o.start.column,s.end.row=o.end.row,s.end.column=o.end.column}}n.mergeOverlappingRanges();var u=[];for(var i=r.length;i--;){var s=r[i];u.unshift(t.getTextRange(s))}e<0?u.unshift(u.pop()):u.push(u.shift());for(var i=r.length;i--;){var s=r[i],o=s.clone();t.replace(s,u[i]),s.start.row=o.start.row,s.start.column=o.start.column}n.fromOrientedRange(n.ranges[0])},this.selectMore=function(e,t,n){var r=this.session,i=r.multiSelect,s=i.toOrientedRange();if(s.isEmpty()){s=r.getWordRange(s.start.row,s.start.column),s.cursor=e==-1?s.start:s.end,this.multiSelect.addRange(s);if(n)return}var o=r.getTextRange(s),u=h(r,o,e);u&&(u.cursor=e==-1?u.start:u.end,this.session.unfold(u),this.multiSelect.addRange(u),this.renderer.scrollCursorIntoView(null,.5)),t&&this.multiSelect.substractPoint(s.cursor)},this.alignCursors=function(){var e=this.session,t=e.multiSelect,n=t.ranges,r=-1,s=n.filter(function(e){if(e.cursor.row==r)return!0;r=e.cursor.row});if(!n.length||s.length==n.length-1){var o=this.selection.getRange(),u=o.start.row,f=o.end.row,l=u==f;if(l){var c=this.session.getLength(),h;do h=this.session.getLine(f);while(/[=:]/.test(h)&&++f<c);do h=this.session.getLine(u);while(/[=:]/.test(h)&&--u>0);u<0&&(u=0),f>=c&&(f=c-1)}var p=this.session.removeFullLines(u,f);p=this.$reAlignText(p,l),this.session.insert({row:u,column:0},p.join("\n")+"\n"),l||(o.start.column=0,o.end.column=p[p.length-1].length),this.selection.setRange(o)}else{s.forEach(function(e){t.substractPoint(e.cursor)});var d=0,v=Infinity,m=n.map(function(t){var n=t.cursor,r=e.getLine(n.row),i=r.substr(n.column).search(/\S/g);return i==-1&&(i=0),n.column>d&&(d=n.column),i<v&&(v=i),i});n.forEach(function(t,n){var r=t.cursor,s=d-r.column,o=m[n]-v;s>o?e.insert(r,a.stringRepeat(" ",s-o)):e.remove(new i(r.row,r.column,r.row,r.column-s+o)),t.start.column=t.end.column=d,t.start.row=t.end.row=r.row,t.cursor=t.end}),t.fromOrientedRange(n[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(e,t){function u(e){return a.stringRepeat(" ",e)}function f(e){return e[2]?u(i)+e[2]+u(s-e[2].length+o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function l(e){return e[2]?u(i+s-e[2].length)+e[2]+u(o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function c(e){return e[2]?u(i)+e[2]+u(o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}var n=!0,r=!0,i,s,o;return e.map(function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?i==null?(i=t[1].length,s=t[2].length,o=t[3].length,t):(i+s+o!=t[1].length+t[2].length+t[3].length&&(r=!1),i!=t[1].length&&(n=!1),i>t[1].length&&(i=t[1].length),s<t[2].length&&(s=t[2].length),o>t[3].length&&(o=t[3].length),t):[e]}).map(t?f:n?r?l:f:c)}}).call(d.prototype),t.onSessionChange=function(e){var t=e.session;t&&!t.multiSelect&&(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t&&t.multiSelect;var n=e.oldSession;n&&(n.multiSelect.off("addRange",this.$onAddRange),n.multiSelect.off("removeRange",this.$onRemoveRange),n.multiSelect.off("multiSelect",this.$onMultiSelect),n.multiSelect.off("singleSelect",this.$onSingleSelect),n.multiSelect.lead.off("change",this.$checkMultiselectChange),n.multiSelect.anchor.off("change",this.$checkMultiselectChange)),t&&(t.multiSelect.on("addRange",this.$onAddRange),t.multiSelect.on("removeRange",this.$onRemoveRange),t.multiSelect.on("multiSelect",this.$onMultiSelect),t.multiSelect.on("singleSelect",this.$onSingleSelect),t.multiSelect.lead.on("change",this.$checkMultiselectChange),t.multiSelect.anchor.on("change",this.$checkMultiselectChange)),t&&this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=m,e("./config").defineOptions(d.prototype,"editor",{enableMultiselect:{set:function(e){m(this),e?(this.on("changeSession",this.$multiselectOnSessionChange),this.on("mousedown",o)):(this.off("changeSession",this.$multiselectOnSessionChange),this.off("mousedown",o))},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})}),define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../../range").Range,i=t.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);return this.foldingStartMarker.test(r)?"start":t=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(r)?"end":""},this.getFoldWidgetRange=function(e,t,n){return null},this.indentationBlock=function(e,t,n){var i=/\S/,s=e.getLine(t),o=s.search(i);if(o==-1)return;var u=n||s.length,a=e.getLength(),f=t,l=t;while(++t<a){var c=e.getLine(t).search(i);if(c==-1)continue;if(c<=o)break;l=t}if(l>f){var h=e.getLine(l).length;return new r(f,u,l,h)}},this.openingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i+1},u=e.$findClosingBracket(t,o,s);if(!u)return;var a=e.foldWidgets[u.row];return a==null&&(a=e.getFoldWidget(u.row)),a=="start"&&u.row>o.row&&(u.row--,u.column=e.getLine(u.row).length),r.fromPoints(o,u)},this.closingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i},u=e.$findOpeningBracket(t,o);if(!u)return;return u.column++,o.column--,r.fromPoints(u,o)}}).call(i.prototype)}),define("ace/theme/textmate",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";t.isDark=!1,t.cssClass="ace-tm",t.cssText='.ace-tm .ace_gutter {background: #f0f0f0;color: #333;}.ace-tm .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-tm .ace_fold {background-color: #6B72E6;}.ace-tm {background-color: #FFFFFF;color: black;}.ace-tm .ace_cursor {color: black;}.ace-tm .ace_invisible {color: rgb(191, 191, 191);}.ace-tm .ace_storage,.ace-tm .ace_keyword {color: blue;}.ace-tm .ace_constant {color: rgb(197, 6, 11);}.ace-tm .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-tm .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-tm .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-tm .ace_invalid {background-color: rgba(255, 0, 0, 0.1);color: red;}.ace-tm .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-tm .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-tm .ace_support.ace_type,.ace-tm .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-tm .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-tm .ace_string {color: rgb(3, 106, 7);}.ace-tm .ace_comment {color: rgb(76, 136, 107);}.ace-tm .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-tm .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-tm .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-tm .ace_variable {color: rgb(49, 132, 149);}.ace-tm .ace_xml-pe {color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-tm .ace_heading {color: rgb(12, 7, 255);}.ace-tm .ace_list {color:rgb(185, 6, 144);}.ace-tm .ace_meta.ace_tag {color:rgb(0, 22, 142);}.ace-tm .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-tm .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-tm.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;}.ace-tm .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_gutter-active-line {background-color : #dcdcdc;}.ace-tm .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}',t.$id="ace/theme/textmate";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}),define("ace/line_widgets",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/range"],function(e,t,n){"use strict";function o(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./range").Range;(function(){this.getRowLength=function(e){var t;return this.lineWidgets?t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0:t=0,!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+1+t},this.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(t){t&&t.rowCount&&!t.hidden&&(e+=t.rowCount)}),e},this.$onChangeEditor=function(e){this.attach(e.editor)},this.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach();if(this.editor==e)return;this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets))},this.detach=function(e){var t=this.editor;if(!t)return;this.editor=null,t.widgetManager=null,t.renderer.off("beforeRender",this.measureWidgets),t.renderer.off("afterRender",this.renderWidgets);var n=this.session.lineWidgets;n&&n.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})},this.updateOnFold=function(e,t){var n=t.lineWidgets;if(!n||!e.action)return;var r=e.data,i=r.start.row,s=r.end.row,o=e.action=="add";for(var u=i+1;u<s;u++)n[u]&&(n[u].hidden=o);n[s]&&(o?n[i]?n[s].hidden=o:n[i]=n[s]:(n[i]==n[s]&&(n[i]=undefined),n[s].hidden=o))},this.updateOnChange=function(e){var t=this.session.lineWidgets;if(!t)return;var n=e.start.row,r=e.end.row-n;if(r!==0)if(e.action=="remove"){var i=t.splice(n+1,r);i.forEach(function(e){e&&this.removeLineWidget(e)},this),this.$updateRows()}else{var s=new Array(r);s.unshift(n,0),t.splice.apply(t,s),this.$updateRows()}},this.$updateRows=function(){var e=this.session.lineWidgets;if(!e)return;var t=!0;e.forEach(function(e,n){if(e){t=!1,e.row=n;while(e.$oldWidget)e.$oldWidget.row=n,e=e.$oldWidget}}),t&&(this.session.lineWidgets=null)},this.addLineWidget=function(e){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var t=this.session.lineWidgets[e.row];t&&(e.$oldWidget=t,t.el&&t.el.parentNode&&(t.el.parentNode.removeChild(t.el),t._inDocument=!1)),this.session.lineWidgets[e.row]=e,e.session=this.session;var n=this.editor.renderer;e.html&&!e.el&&(e.el=i.createElement("div"),e.el.innerHTML=e.html),e.el&&(i.addCssClass(e.el,"ace_lineWidgetContainer"),e.el.style.position="absolute",e.el.style.zIndex=5,n.container.appendChild(e.el),e._inDocument=!0),e.coverGutter||(e.el.style.zIndex=3),e.pixelHeight==null&&(e.pixelHeight=e.el.offsetHeight),e.rowCount==null&&(e.rowCount=e.pixelHeight/n.layerConfig.lineHeight);var r=this.session.getFoldAt(e.row,0);e.$fold=r;if(r){var s=this.session.lineWidgets;e.row==r.end.row&&!s[r.start.row]?s[r.start.row]=e:e.hidden=!0}return this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows(),this.renderWidgets(null,n),this.onWidgetChanged(e),e},this.removeLineWidget=function(e){e._inDocument=!1,e.session=null,e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el);if(e.editor&&e.editor.destroy)try{e.editor.destroy()}catch(t){}if(this.session.lineWidgets){var n=this.session.lineWidgets[e.row];if(n==e)this.session.lineWidgets[e.row]=e.$oldWidget,e.$oldWidget&&this.onWidgetChanged(e.$oldWidget);else while(n){if(n.$oldWidget==e){n.$oldWidget=e.$oldWidget;break}n=n.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows()},this.getWidgetsAtRow=function(e){var t=this.session.lineWidgets,n=t&&t[e],r=[];while(n)r.push(n),n=n.$oldWidget;return r},this.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},this.measureWidgets=function(e,t){var n=this.session._changedWidgets,r=t.layerConfig;if(!n||!n.length)return;var i=Infinity;for(var s=0;s<n.length;s++){var o=n[s];if(!o||!o.el)continue;if(o.session!=this.session)continue;if(!o._inDocument){if(this.session.lineWidgets[o.row]!=o)continue;o._inDocument=!0,t.container.appendChild(o.el)}o.h=o.el.offsetHeight,o.fixedWidth||(o.w=o.el.offsetWidth,o.screenWidth=Math.ceil(o.w/r.characterWidth));var u=o.h/r.lineHeight;o.coverLine&&(u-=this.session.getRowLineCount(o.row),u<0&&(u=0)),o.rowCount!=u&&(o.rowCount=u,o.row<i&&(i=o.row))}i!=Infinity&&(this.session._emit("changeFold",{data:{start:{row:i}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]},this.renderWidgets=function(e,t){var n=t.layerConfig,r=this.session.lineWidgets;if(!r)return;var i=Math.min(this.firstRow,n.firstRow),s=Math.max(this.lastRow,n.lastRow,r.length);while(i>0&&!r[i])i--;this.firstRow=n.firstRow,this.lastRow=n.lastRow,t.$cursorLayer.config=n;for(var o=i;o<=s;o++){var u=r[o];if(!u||!u.el)continue;if(u.hidden){u.el.style.top=-100-(u.pixelHeight||0)+"px";continue}u._inDocument||(u._inDocument=!0,t.container.appendChild(u.el));var a=t.$cursorLayer.getPixelPosition({row:o,column:0},!0).top;u.coverLine||(a+=n.lineHeight*this.session.getRowLineCount(u.row)),u.el.style.top=a-n.offset+"px";var f=u.coverGutter?0:t.gutterWidth;u.fixedWidth||(f-=t.scrollLeft),u.el.style.left=f+"px",u.fullWidth&&u.screenWidth&&(u.el.style.minWidth=n.width+2*n.padding+"px"),u.fixedWidth?u.el.style.right=t.scrollBar.getWidth()+"px":u.el.style.right=""}}}).call(o.prototype),t.LineWidgets=o}),define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range"],function(e,t,n){"use strict";function o(e,t,n){var r=0,i=e.length-1;while(r<=i){var s=r+i>>1,o=n(t,e[s]);if(o>0)r=s+1;else{if(!(o<0))return s;i=s-1}}return-(r+1)}function u(e,t,n){var r=e.getAnnotations().sort(s.comparePoints);if(!r.length)return;var i=o(r,{row:t,column:-1},s.comparePoints);i<0&&(i=-i-1),i>=r.length?i=n>0?0:r.length-1:i===0&&n<0&&(i=r.length-1);var u=r[i];if(!u||!n)return;if(u.row===t){do u=r[i+=n];while(u&&u.row===t);if(!u)return r.slice()}var a=[];t=u.row;do a[n<0?"unshift":"push"](u),u=r[i+=n];while(u&&u.row==t);return a.length&&a}var r=e("../line_widgets").LineWidgets,i=e("../lib/dom"),s=e("../range").Range;t.showErrorMarker=function(e,t){var n=e.session;n.widgetManager||(n.widgetManager=new r(n),n.widgetManager.attach(e));var s=e.getCursorPosition(),o=s.row,a=n.widgetManager.getWidgetsAtRow(o).filter(function(e){return e.type=="errorMarker"})[0];a?a.destroy():o-=t;var f=u(n,o,t),l;if(f){var c=f[0];s.column=(c.pos&&typeof c.column!="number"?c.pos.sc:c.column)||0,s.row=c.row,l=e.renderer.$gutterLayer.$annotations[s.row]}else{if(a)return;l={text:["Looks good!"],className:"ace_ok"}}e.session.unfold(s.row),e.selection.moveToPosition(s);var h={row:s.row,fixedWidth:!0,coverGutter:!0,el:i.createElement("div"),type:"errorMarker"},p=h.el.appendChild(i.createElement("div")),d=h.el.appendChild(i.createElement("div"));d.className="error_widget_arrow "+l.className;var v=e.renderer.$cursorLayer.getPixelPosition(s).left;d.style.left=v+e.renderer.gutterWidth-5+"px",h.el.className="error_widget_wrapper",p.className="error_widget "+l.className,p.innerHTML=l.text.join("<br>"),p.appendChild(i.createElement("div"));var m=function(e,t,n){if(t===0&&(n==="esc"||n==="return"))return h.destroy(),{command:"null"}};h.destroy=function(){if(e.$mouseHandler.isMousePressed)return;e.keyBinding.removeKeyboardHandler(m),n.widgetManager.removeLineWidget(h),e.off("changeSelection",h.destroy),e.off("changeSession",h.destroy),e.off("mouseup",h.destroy),e.off("change",h.destroy)},e.keyBinding.addKeyboardHandler(m),e.on("changeSelection",h.destroy),e.on("changeSession",h.destroy),e.on("mouseup",h.destroy),e.on("change",h.destroy),e.session.widgetManager.addLineWidget(h),h.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:h.el.offsetHeight})},i.importCssString(" .error_widget_wrapper { background: inherit; color: inherit; border:none } .error_widget { border-top: solid 2px; border-bottom: solid 2px; margin: 5px 0; padding: 10px 40px; white-space: pre-wrap; } .error_widget.ace_error, .error_widget_arrow.ace_error{ border-color: #ff5a5a } .error_widget.ace_warning, .error_widget_arrow.ace_warning{ border-color: #F1D817 } .error_widget.ace_info, .error_widget_arrow.ace_info{ border-color: #5a5a5a } .error_widget.ace_ok, .error_widget_arrow.ace_ok{ border-color: #5aaa5a } .error_widget_arrow { position: absolute; border: solid 5px; border-top-color: transparent!important; border-right-color: transparent!important; border-left-color: transparent!important; top: -5px; }","")}),define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"],function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var r=e("./lib/dom"),i=e("./lib/event"),s=e("./range").Range,o=e("./editor").Editor,u=e("./edit_session").EditSession,a=e("./undomanager").UndoManager,f=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),t.config=e("./config"),t.require=e,typeof define=="function"&&(t.define=define),t.edit=function(e,n){if(typeof e=="string"){var s=e;e=document.getElementById(s);if(!e)throw new Error("ace.edit can't find div #"+s)}if(e&&e.env&&e.env.editor instanceof o)return e.env.editor;var u="";if(e&&/input|textarea/i.test(e.tagName)){var a=e;u=a.value,e=r.createElement("pre"),a.parentNode.replaceChild(e,a)}else e&&(u=e.textContent,e.innerHTML="");var l=t.createEditSession(u),c=new o(new f(e),l,n),h={document:l,editor:c,onResize:c.resize.bind(c,null)};return a&&(h.textarea=a),i.addListener(window,"resize",h.onResize),c.on("destroy",function(){i.removeListener(window,"resize",h.onResize),h.editor.container.env=null}),c.container.env=c.env=h,c},t.createEditSession=function(e,t){var n=new u(e,t);return n.setUndoManager(new a),n},t.Range=s,t.EditSession=u,t.UndoManager=a,t.VirtualRenderer=f,t.version="1.4.1"}); (function() { window.require(["ace/ace"], function(a) { if (a) { a.config.init(true); a.define = window.define; } if (!window.ace) window.ace = a; for (var key in a) if (a.hasOwnProperty(key)) window.ace[key] = a[key]; window.ace["default"] = window.ace; if (typeof module == "object" && typeof exports == "object" && module) { module.exports = window.ace; } }); })(); ```
The Parang Bongkok (bongkok in Malay language literally means "hunched") is a billhook parang that originates from Kelantan, Malaysia. It has the shape of a sickle but it is broad at the middle of its blade with a steep drop point at the tip. The blade is joined to the handle with an integral neck. The handle, made of wood, has a simply turned stupa shape. See also Parang Ginah Kelantanese klewang References Blade weapons Southeast Asian swords Weapons of Malaysia
```xml import { describe, it, expect } from 'vitest'; import { Vec2 } from '../common/Vec2'; import { Vec3 } from '../common/Vec3'; describe('Math', function(): void { it('Vec2', function(): void { var r, v = new Vec2(); expect(v.x).equal(0); expect(v.y).equal(0); v.setNum(3, 4); expect(v.x).equal(3); expect(v.y).equal(4); expect(v.length()).equal(5); expect(v.lengthSquared()).equal(25); v.normalize(); expect(v.x).closeTo(3 / 5, 1e-12); expect(v.y).closeTo(4 / 5, 1e-12); v.setZero(); expect(v.x).equal(0); expect(v.y).equal(0); v.add(new Vec2(3, 2)); expect(v.x).equal(3); expect(v.y).equal(2); v.sub(new Vec2(2, 1)); expect(v.x).equal(1); expect(v.y).equal(1); v.mul(5); expect(v.x).equal(5); expect(v.y).equal(5); v.setNum(2, 3); expect(v.x).equal(2); expect(v.y).equal(3); r = Vec2.skew(v); expect(r.x).equal(-3); expect(r.y).equal(2); r = Vec2.dot(v, new Vec2(2, 3)); expect(r).equal(13); r = Vec2.crossVec2Vec2(v, new Vec2(2, 3)); expect(r).equal(0); r = Vec2.crossVec2Num(v, 5); expect(r.x).equal(15); expect(r.y).equal(-10); r = Vec2.clamp(new Vec2(6, 8), 5); expect(r.x).closeTo(3, 1e-12); expect(r.y).closeTo(4, 1e-12); }); it('Vec3', function(): void { return; let r, v = new Vec3(); expect(v.x).equal(0); expect(v.y).equal(0); expect(v.z).equal(0); v = new Vec3(3, 4, 5); expect(v.x).equal(3); expect(v.y).equal(4); expect(v.z).equal(5); v.setZero(); expect(v.x).equal(0); expect(v.y).equal(0); expect(v.z).equal(0); v.add(new Vec3(3, 2, 1)); expect(v.x).equal(3); expect(v.y).equal(2); expect(v.z).equal(1); v.sub(new Vec3(0, 1, 2)); expect(v.x).equal(3); expect(v.y).equal(1); expect(v.z).equal(-1); v.mul(5); expect(v.x).equal(15); expect(v.y).equal(5); expect(v.z).equal(-5); v.set(2, 3, 4); expect(v.x).equal(2); expect(v.y).equal(3); expect(v.z).equal(4); r = Vec3.dot(v, new Vec3(2, 0, -1)); expect(r).equal(0); r = Vec3.cross(v, new Vec3(2, 0, -1)); expect(r.x).equal(-3); expect(r.y).equal(10); expect(r.z).equal(-6); }); }); ```
```javascript var fs = require('fs'); var indexFile = require('lodash') .template(fs.readFileSync('index.tpl'))(require('./credentials')) fs.writeFileSync('./src/index.html',indexFile); process.exit(0); ```
```javascript 'use strict'; angular.module("ngLocale", [], ["$provide", function($provide) { var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"}; $provide.value("$locale", { "DATETIME_FORMATS": { "AMPMS": [ "QN", "WN" ], "DAY": [ "Il-\u0126add", "It-Tnejn", "It-Tlieta", "L-Erbg\u0127a", "Il-\u0126amis", "Il-\u0120img\u0127a", "Is-Sibt" ], "MONTH": [ "Jannar", "Frar", "Marzu", "April", "Mejju", "\u0120unju", "Lulju", "Awwissu", "Settembru", "Ottubru", "Novembru", "Di\u010bembru" ], "SHORTDAY": [ "\u0126ad", "Tne", "Tli", "Erb", "\u0126am", "\u0120im", "Sib" ], "SHORTMONTH": [ "Jan", "Fra", "Mar", "Apr", "Mej", "\u0120un", "Lul", "Aww", "Set", "Ott", "Nov", "Di\u010b" ], "fullDate": "EEEE, d 'ta'\u2019 MMMM y", "longDate": "d 'ta'\u2019 MMMM y", "medium": "dd MMM y HH:mm:ss", "mediumDate": "dd MMM y", "mediumTime": "HH:mm:ss", "short": "dd/MM/y HH:mm", "shortDate": "dd/MM/y", "shortTime": "HH:mm" }, "NUMBER_FORMATS": { "CURRENCY_SYM": "\u20ac", "DECIMAL_SEP": ".", "GROUP_SEP": ",", "PATTERNS": [ { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 3, "minFrac": 0, "minInt": 1, "negPre": "-", "negSuf": "", "posPre": "", "posSuf": "" }, { "gSize": 3, "lgSize": 3, "macFrac": 0, "maxFrac": 2, "minFrac": 2, "minInt": 1, "negPre": "\u00a4-", "negSuf": "", "posPre": "\u00a4", "posSuf": "" } ] }, "id": "mt", "pluralCat": function (n, opt_precision) { if (n == 1) { return PLURAL_CATEGORY.ONE; } if (n == 0 || n % 100 >= 2 && n % 100 <= 10) { return PLURAL_CATEGORY.FEW; } if (n % 100 >= 11 && n % 100 <= 19) { return PLURAL_CATEGORY.MANY; } return PLURAL_CATEGORY.OTHER;} }); }]); ```
```smalltalk using System; using System.Linq.Expressions; using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; using Volo.Abp.Domain.Entities; namespace Volo.Abp.Domain.Repositories; /// <summary> /// Just to mark a class as repository. /// </summary> public interface IRepository { bool? IsChangeTrackingEnabled { get; } } public interface IRepository<TEntity> : IReadOnlyRepository<TEntity>, IBasicRepository<TEntity> where TEntity : class, IEntity { /// <summary> /// Get a single entity by the given <paramref name="predicate"/>. /// <para> /// It returns null if there is no entity with the given <paramref name="predicate"/>. /// It throws <see cref="InvalidOperationException"/> if there are multiple entities with the given <paramref name="predicate"/>. /// </para> /// </summary> /// <param name="predicate">A condition to find the entity</param> /// <param name="includeDetails">Set true to include all children of this entity</param> /// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.</param> Task<TEntity?> FindAsync( [NotNull] Expression<Func<TEntity, bool>> predicate, bool includeDetails = true, CancellationToken cancellationToken = default ); /// <summary> /// Get a single entity by the given <paramref name="predicate"/>. /// <para> /// It throws <see cref="EntityNotFoundException"/> if there is no entity with the given <paramref name="predicate"/>. /// It throws <see cref="InvalidOperationException"/> if there are multiple entities with the given <paramref name="predicate"/>. /// </para> /// </summary> /// <param name="predicate">A condition to filter entities</param> /// <param name="includeDetails">Set true to include all children of this entity</param> /// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.</param> Task<TEntity> GetAsync( [NotNull] Expression<Func<TEntity, bool>> predicate, bool includeDetails = true, CancellationToken cancellationToken = default ); /// <summary> /// Deletes many entities by the given <paramref name="predicate"/>. /// <para> /// Please note: This may cause major performance problems if there are too many entities returned for a /// given predicate and the database provider doesn't have a way to efficiently delete many entities. /// </para> /// </summary> /// <param name="predicate">A condition to filter entities</param> /// <param name="autoSave"> /// Set true to automatically save changes to database. /// This is useful for ORMs / database APIs those only save changes with an explicit method call, but you need to immediately save changes to the database. /// </param> /// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.</param> Task DeleteAsync( [NotNull] Expression<Func<TEntity, bool>> predicate, bool autoSave = false, CancellationToken cancellationToken = default ); /// <summary> /// Deletes all entities those fit to the given predicate. /// It directly deletes entities from database, without fetching them. /// Some features (like soft-delete, multi-tenancy and audit logging) won't work, so use this method carefully when you need it. /// Use the DeleteAsync method if you need to these features. /// </summary> /// <param name="predicate">A condition to filter entities</param> /// <param name="cancellationToken">A <see cref="T:System.Threading.CancellationToken" /> to observe while waiting for the task to complete.</param> /// <returns></returns> Task DeleteDirectAsync( [NotNull] Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken = default ); } public interface IRepository<TEntity, TKey> : IRepository<TEntity>, IReadOnlyRepository<TEntity, TKey>, IBasicRepository<TEntity, TKey> where TEntity : class, IEntity<TKey> { } ```
```xml declare const _default: any; export default _default; //# sourceMappingURL=ExpoBattery.d.ts.map ```
```xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="path_to_url" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="true" android:paddingLeft="16dp" android:paddingRight="16dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:clickable="true" android:background="?android:attr/selectableItemBackground"> <TextView android:id="@+id/tvTitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="16sp"/> <TextView android:id="@+id/tvDescription" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12sp"/> </LinearLayout> ```
```python from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import six import tensorflow as tf from copy import deepcopy from edward.models.random_variable import RandomVariable from edward.models.random_variables import TransformedDistribution from edward.models import PointMass from edward.util.graphs import random_variables from tensorflow.core.framework import attr_value_pb2 from tensorflow.python.framework.ops import set_shapes_for_outputs from tensorflow.python.util import compat tfb = tf.contrib.distributions.bijectors def check_data(data): """Check that the data dictionary passed during inference and criticism is valid. """ if not isinstance(data, dict): raise TypeError("data must have type dict.") for key, value in six.iteritems(data): if isinstance(key, tf.Tensor) and "Placeholder" in key.op.type: if isinstance(value, RandomVariable): raise TypeError("The value of a feed cannot be a ed.RandomVariable " "object. " "Acceptable feed values include Python scalars, " "strings, lists, numpy ndarrays, or TensorHandles.") elif isinstance(value, tf.Tensor): raise TypeError("The value of a feed cannot be a tf.Tensor object. " "Acceptable feed values include Python scalars, " "strings, lists, numpy ndarrays, or TensorHandles.") elif isinstance(key, (RandomVariable, tf.Tensor)): if isinstance(value, (RandomVariable, tf.Tensor)): if not key.shape.is_compatible_with(value.shape): raise TypeError("Key-value pair in data does not have same " "shape: {}, {}".format(key.shape, value.shape)) elif key.dtype != value.dtype: raise TypeError("Key-value pair in data does not have same " "dtype: {}, {}".format(key.dtype, value.dtype)) elif isinstance(value, (float, list, int, np.ndarray, np.number, str)): if not key.shape.is_compatible_with(np.shape(value)): raise TypeError("Key-value pair in data does not have same " "shape: {}, {}".format(key.shape, np.shape(value))) elif isinstance(value, (np.ndarray, np.number)) and \ not np.issubdtype(value.dtype, np.float) and \ not np.issubdtype(value.dtype, np.int) and \ not np.issubdtype(value.dtype, np.str): raise TypeError("Data value has an invalid dtype: " "{}".format(value.dtype)) else: raise TypeError("Data value has an invalid type: " "{}".format(type(value))) else: raise TypeError("Data key has an invalid type: {}".format(type(key))) def check_latent_vars(latent_vars): """Check that the latent variable dictionary passed during inference and criticism is valid. """ if not isinstance(latent_vars, dict): raise TypeError("latent_vars must have type dict.") for key, value in six.iteritems(latent_vars): if not isinstance(key, (RandomVariable, tf.Tensor)): raise TypeError("Latent variable key has an invalid type: " "{}".format(type(key))) elif not isinstance(value, (RandomVariable, tf.Tensor)): raise TypeError("Latent variable value has an invalid type: " "{}".format(type(value))) elif not key.shape.is_compatible_with(value.shape): raise TypeError("Key-value pair in latent_vars does not have same " "shape: {}, {}".format(key.shape, value.shape)) elif key.dtype != value.dtype: raise TypeError("Key-value pair in latent_vars does not have same " "dtype: {}, {}".format(key.dtype, value.dtype)) def _get_context_copy(ctx, scope): # contexts are stored in graph collections # is there a more efficient way to do this? graph = tf.get_default_graph() for name, collection in six.iteritems(graph._collections): if ctx in collection: for item in collection: if item.name == scope + ctx.name: return item return None def _copy_context(ctx, context_matches, dict_swap, scope, copy_q): if ctx is None: return None # We'd normally check about returning early, but the context won't # be copied until after all children are, so we check that first. graph = tf.get_default_graph() # copy all nodes within context for tensorname in ctx._values: tensor = graph.as_graph_element(tensorname) copy(tensor, dict_swap, scope, True, copy_q) # now make sure we haven't already copied the context we're currently # trying to copy (in the course of copying another child) ctx_copy = _get_context_copy(ctx, scope) if ctx_copy: return ctx_copy ctx_copy = ctx.from_proto(ctx.to_proto(), scope[:-1]) outer_copy = _copy_context(ctx.outer_context, context_matches, dict_swap, scope, copy_q) ctx_copy._outer_context = outer_copy for name, collection in six.iteritems(graph._collections): if ctx in collection: graph.add_to_collection(name, ctx_copy) return ctx_copy def _copy_default(x, *args, **kwargs): if isinstance(x, (RandomVariable, tf.Operation, tf.Tensor, tf.Variable)): x = copy(x, *args, **kwargs) return x def copy(org_instance, dict_swap=None, scope="copied", replace_itself=False, copy_q=False, copy_parent_rvs=True): """Build a new node in the TensorFlow graph from `org_instance`, where any of its ancestors existing in `dict_swap` are replaced with `dict_swap`'s corresponding value. Copying is done recursively. Any `Operation` whose output is required to copy `org_instance` is also copied (if it isn't already copied within the new scope). `tf.Variable`s, `tf.placeholder`s, and nodes of type `Queue` are always reused and not copied. In addition, `tf.Operation`s with operation-level seeds are copied with a new operation-level seed. Args: org_instance: RandomVariable, tf.Operation, tf.Tensor, or tf.Variable. Node to add in graph with replaced ancestors. dict_swap: dict. Random variables, variables, tensors, or operations to swap with. Its keys are what `org_instance` may depend on, and its values are the corresponding object (not necessarily of the same class instance, but must have the same type, e.g., float32) that is used in exchange. scope: str. A scope for the new node(s). This is used to avoid name conflicts with the original node(s). replace_itself: bool. Whether to replace `org_instance` itself if it exists in `dict_swap`. (This is used for the recursion.) copy_q: bool. Whether to copy the replaced tensors too (if not already copied within the new scope). Otherwise will reuse them. copy_parent_rvs: Whether to copy parent random variables `org_instance` depends on. Otherwise will copy only the sample tensors and not the random variable class itself. Returns: RandomVariable, tf.Variable, tf.Tensor, or tf.Operation. The copied node. Raises: TypeError. If `org_instance` is not one of the above types. #### Examples ```python x = tf.constant(2.0) y = tf.constant(3.0) z = x * y qx = tf.constant(4.0) # The TensorFlow graph is currently # `x` -> `z` <- y`, `qx` # This adds a subgraph with newly copied nodes, # `qx` -> `copied/z` <- `copied/y` z_new = ed.copy(z, {x: qx}) sess = tf.Session() sess.run(z) 6.0 sess.run(z_new) 12.0 ``` """ if not isinstance(org_instance, (RandomVariable, tf.Operation, tf.Tensor, tf.Variable)): raise TypeError("Could not copy instance: " + str(org_instance)) if dict_swap is None: dict_swap = {} if scope[-1] != '/': scope += '/' # Swap instance if in dictionary. if org_instance in dict_swap and replace_itself: org_instance = dict_swap[org_instance] if not copy_q: return org_instance elif isinstance(org_instance, tf.Tensor) and replace_itself: # Deal with case when `org_instance` is the associated tensor # from the RandomVariable, e.g., `z.value()`. If # `dict_swap={z: qz}`, we aim to swap it with `qz.value()`. for key, value in six.iteritems(dict_swap): if isinstance(key, RandomVariable): if org_instance == key.value(): if isinstance(value, RandomVariable): org_instance = value.value() else: org_instance = value if not copy_q: return org_instance break # If instance is a tf.Variable, return it; do not copy any. Note we # check variables via their name. If we get variables through an # op's inputs, it has type tf.Tensor and not tf.Variable. if isinstance(org_instance, (tf.Tensor, tf.Variable)): for variable in tf.global_variables(): if org_instance.name == variable.name: if variable in dict_swap and replace_itself: # Deal with case when `org_instance` is the associated _ref # tensor for a tf.Variable. org_instance = dict_swap[variable] if not copy_q or isinstance(org_instance, tf.Variable): return org_instance for variable in tf.global_variables(): if org_instance.name == variable.name: return variable break else: return variable graph = tf.get_default_graph() new_name = scope + org_instance.name # If an instance of the same name exists, return it. if isinstance(org_instance, RandomVariable): for rv in random_variables(): if new_name == rv.name: return rv elif isinstance(org_instance, (tf.Tensor, tf.Operation)): try: return graph.as_graph_element(new_name, allow_tensor=True, allow_operation=True) except: pass # Preserve ordering of random variables. Random variables are always # copied first (from parent -> child) before any deterministic # operations that depend on them. if copy_parent_rvs and \ isinstance(org_instance, (RandomVariable, tf.Tensor, tf.Variable)): for v in get_parents(org_instance): copy(v, dict_swap, scope, True, copy_q, True) if isinstance(org_instance, RandomVariable): rv = org_instance # If it has copiable arguments, copy them. args = [_copy_default(arg, dict_swap, scope, True, copy_q, False) for arg in rv._args] kwargs = {} for key, value in six.iteritems(rv._kwargs): if isinstance(value, list): kwargs[key] = [_copy_default(v, dict_swap, scope, True, copy_q, False) for v in value] else: kwargs[key] = _copy_default( value, dict_swap, scope, True, copy_q, False) kwargs['name'] = new_name # Create new random variable with copied arguments. try: new_rv = type(rv)(*args, **kwargs) except ValueError: # Handle case where parameters are copied under absolute name # scope. This can cause an error when creating a new random # variable as tf.identity name ops are called on parameters ("op # with name already exists"). To avoid remove absolute name scope. kwargs['name'] = new_name[:-1] new_rv = type(rv)(*args, **kwargs) return new_rv elif isinstance(org_instance, tf.Tensor): tensor = org_instance # Do not copy tf.placeholders. if 'Placeholder' in tensor.op.type: return tensor # A tensor is one of the outputs of its underlying # op. Therefore copy the op itself. op = tensor.op new_op = copy(op, dict_swap, scope, True, copy_q, False) output_index = op.outputs.index(tensor) new_tensor = new_op.outputs[output_index] # Add copied tensor to collections that the original one is in. for name, collection in six.iteritems(tensor.graph._collections): if tensor in collection: graph.add_to_collection(name, new_tensor) return new_tensor elif isinstance(org_instance, tf.Operation): op = org_instance # Do not copy queue operations. if 'Queue' in op.type: return op # Copy the node def. # It is unique to every Operation instance. Replace the name and # its operation-level seed if it has one. node_def = deepcopy(op.node_def) node_def.name = new_name # when copying control flow contexts, # we need to make sure frame definitions are copied if 'frame_name' in node_def.attr and node_def.attr['frame_name'].s != b'': node_def.attr['frame_name'].s = (scope.encode('utf-8') + node_def.attr['frame_name'].s) if 'seed2' in node_def.attr and tf.get_seed(None)[1] is not None: node_def.attr['seed2'].i = tf.get_seed(None)[1] # Copy other arguments needed for initialization. output_types = op._output_types[:] # If it has an original op, copy it. if op._original_op is not None: original_op = copy(op._original_op, dict_swap, scope, True, copy_q, False) else: original_op = None # Copy the op def. # It is unique to every Operation type. op_def = deepcopy(op.op_def) new_op = tf.Operation(node_def, graph, [], # inputs; will add them afterwards output_types, [], # control inputs; will add them afterwards [], # input types; will add them afterwards original_op, op_def) # advertise op early to break recursions graph._add_op(new_op) # If it has control inputs, copy them. control_inputs = [] for x in op.control_inputs: elem = copy(x, dict_swap, scope, True, copy_q, False) if not isinstance(elem, tf.Operation): elem = tf.convert_to_tensor(elem) control_inputs.append(elem) new_op._add_control_inputs(control_inputs) # If it has inputs, copy them. for x in op.inputs: elem = copy(x, dict_swap, scope, True, copy_q, False) if not isinstance(elem, tf.Operation): elem = tf.convert_to_tensor(elem) new_op._add_input(elem) # Copy the control flow context. control_flow_context = _copy_context(op._get_control_flow_context(), {}, dict_swap, scope, copy_q) new_op._set_control_flow_context(control_flow_context) # Use Graph's private methods to add the op, following # implementation of `tf.Graph().create_op()`. compute_shapes = True compute_device = True op_type = new_name if compute_shapes: set_shapes_for_outputs(new_op) graph._record_op_seen_by_control_dependencies(new_op) if compute_device: graph._apply_device_functions(new_op) if graph._colocation_stack: all_colocation_groups = [] for colocation_op in graph._colocation_stack: all_colocation_groups.extend(colocation_op.colocation_groups()) if colocation_op.device: # Make this device match the device of the colocated op, to # provide consistency between the device and the colocation # property. if new_op.device and new_op.device != colocation_op.device: logging.warning("Tried to colocate %s with an op %s that had " "a different device: %s vs %s. " "Ignoring colocation property.", name, colocation_op.name, new_op.device, colocation_op.device) all_colocation_groups = sorted(set(all_colocation_groups)) new_op.node_def.attr["_class"].CopyFrom(attr_value_pb2.AttrValue( list=attr_value_pb2.AttrValue.ListValue(s=all_colocation_groups))) # Sets "container" attribute if # (1) graph._container is not None # (2) "is_stateful" is set in OpDef # (3) "container" attribute is in OpDef # (4) "container" attribute is None if (graph._container and op_type in graph._registered_ops and graph._registered_ops[op_type].is_stateful and "container" in new_op.node_def.attr and not new_op.node_def.attr["container"].s): new_op.node_def.attr["container"].CopyFrom( attr_value_pb2.AttrValue(s=compat.as_bytes(graph._container))) return new_op else: raise TypeError("Could not copy instance: " + str(org_instance)) def get_ancestors(x, collection=None): """Get ancestor random variables of input. Args: x: RandomVariable or tf.Tensor. Query node to find ancestors of. collection: list of RandomVariable. The collection of random variables to check with respect to; defaults to all random variables in the graph. Returns: list of RandomVariable. Ancestor random variables of x. #### Examples ```python a = Normal(0.0, 1.0) b = Normal(a, 1.0) c = Normal(0.0, 1.0) d = Normal(b * c, 1.0) assert set(ed.get_ancestors(d)) == set([a, b, c]) ``` """ if collection is None: collection = random_variables() node_dict = {node.value(): node for node in collection} # Traverse the graph. Add each node to the set if it's in the collection. output = set() visited = set() nodes = {x} while nodes: node = nodes.pop() if node in visited: continue visited.add(node) if isinstance(node, RandomVariable): node = node.value() candidate_node = node_dict.get(node, None) if candidate_node is not None and candidate_node != x: output.add(candidate_node) nodes.update(node.op.inputs) return list(output) def get_blanket(x, collection=None): """Get Markov blanket of input, which consists of its parents, its children, and the other parents of its children. Args: x: RandomVariable or tf.Tensor. Query node to find Markov blanket of. collection: list of RandomVariable. The collection of random variables to check with respect to; defaults to all random variables in the graph. Returns: list of RandomVariable. Markov blanket of x. #### Examples ```python a = Normal(0.0, 1.0) b = Normal(0.0, 1.0) c = Normal(a * b, 1.0) d = Normal(0.0, 1.0) e = Normal(c * d, 1.0) assert set(ed.get_blanket(c)) == set([a, b, d, e]) ``` """ output = set() output.update(get_parents(x, collection)) children = get_children(x, collection) output.update(children) for child in children: output.update(get_parents(child, collection)) output.discard(x) return list(output) def get_children(x, collection=None): """Get child random variables of input. Args: x: RandomVariable or tf.Tensor> Query node to find children of. collection: list of RandomVariable. The collection of random variables to check with respect to; defaults to all random variables in the graph. Returns: list of RandomVariable. Child random variables of x. #### Examples ```python a = Normal(0.0, 1.0) b = Normal(a, 1.0) c = Normal(a, 1.0) d = Normal(c, 1.0) assert set(ed.get_children(a)) == set([b, c]) ``` """ if collection is None: collection = random_variables() node_dict = {node.value(): node for node in collection} # Traverse the graph. Add each node to the set if it's in the collection. output = set() visited = set() nodes = {x} while nodes: node = nodes.pop() if node in visited: continue visited.add(node) if isinstance(node, RandomVariable): node = node.value() candidate_node = node_dict.get(node, None) if candidate_node is not None and candidate_node != x: output.add(candidate_node) else: for op in node.consumers(): nodes.update(op.outputs) return list(output) def get_descendants(x, collection=None): """Get descendant random variables of input. Args: x: RandomVariable or tf.Tensor. Query node to find descendants of. collection: list of RandomVariable. The collection of random variables to check with respect to; defaults to all random variables in the graph. Returns: list of RandomVariable. Descendant random variables of x. #### Examples ```python a = Normal(0.0, 1.0) b = Normal(a, 1.0) c = Normal(a, 1.0) d = Normal(c, 1.0) assert set(ed.get_descendants(a)) == set([b, c, d]) ``` """ if collection is None: collection = random_variables() node_dict = {node.value(): node for node in collection} # Traverse the graph. Add each node to the set if it's in the collection. output = set() visited = set() nodes = {x} while nodes: node = nodes.pop() if node in visited: continue visited.add(node) if isinstance(node, RandomVariable): node = node.value() candidate_node = node_dict.get(node, None) if candidate_node is not None and candidate_node != x: output.add(candidate_node) for op in node.consumers(): nodes.update(op.outputs) return list(output) def get_parents(x, collection=None): """Get parent random variables of input. Args: x: RandomVariable or tf.Tensor. Query node to find parents of. collection: list of RandomVariable. The collection of random variables to check with respect to; defaults to all random variables in the graph. Returns: list of RandomVariable. Parent random variables of x. #### Examples ```python a = Normal(0.0, 1.0) b = Normal(a, 1.0) c = Normal(0.0, 1.0) d = Normal(b * c, 1.0) assert set(ed.get_parents(d)) == set([b, c]) ``` """ if collection is None: collection = random_variables() node_dict = {node.value(): node for node in collection} # Traverse the graph. Add each node to the set if it's in the collection. output = set() visited = set() nodes = {x} while nodes: node = nodes.pop() if node in visited: continue visited.add(node) if isinstance(node, RandomVariable): node = node.value() candidate_node = node_dict.get(node, None) if candidate_node is not None and candidate_node != x: output.add(candidate_node) else: nodes.update(node.op.inputs) return list(output) def get_siblings(x, collection=None): """Get sibling random variables of input. Args: x: RandomVariable or tf.Tensor. Query node to find siblings of. collection: list of RandomVariable. The collection of random variables to check with respect to; defaults to all random variables in the graph. Returns: list of RandomVariable. Sibling random variables of x. #### Examples ```python a = Normal(0.0, 1.0) b = Normal(a, 1.0) c = Normal(a, 1.0) assert ed.get_siblings(b) == [c] ``` """ parents = get_parents(x, collection) siblings = set() for parent in parents: siblings.update(get_children(parent, collection)) siblings.discard(x) return list(siblings) def get_variables(x, collection=None): """Get parent TensorFlow variables of input. Args: x: RandomVariable or tf.Tensor. Query node to find parents of. collection: list of tf.Variable. The collection of variables to check with respect to; defaults to all variables in the graph. Returns: list of tf.Variable. TensorFlow variables that x depends on. #### Examples ```python a = tf.Variable(0.0) b = tf.Variable(0.0) c = Normal(a * b, 1.0) assert set(ed.get_variables(c)) == set([a, b]) ``` """ if collection is None: collection = tf.global_variables() node_dict = {node.name: node for node in collection} # Traverse the graph. Add each node to the set if it's in the collection. output = set() visited = set() nodes = {x} while nodes: node = nodes.pop() if node in visited: continue visited.add(node) if isinstance(node, RandomVariable): node = node.value() candidate_node = node_dict.get(node.name, None) if candidate_node is not None and candidate_node != x: output.add(candidate_node) nodes.update(node.op.inputs) return list(output) def is_independent(a, b, condition=None): """Assess whether a is independent of b given the random variables in condition. Implemented using the Bayes-Ball algorithm [@schachter1998bayes]. Args: a: RandomVariable or list of RandomVariable. Query node(s). b: RandomVariable or list of RandomVariable. Query node(s). condition: RandomVariable or list of RandomVariable. Random variable(s) to condition on. Returns: bool. True if a is independent of b given the random variables in condition. #### Examples ```python a = Normal(0.0, 1.0) b = Normal(a, 1.0) c = Normal(a, 1.0) assert ed.is_independent(b, c, condition=a) ``` """ if condition is None: condition = [] if not isinstance(a, list): a = [a] if not isinstance(b, list): b = [b] if not isinstance(condition, list): condition = [condition] A = set(a) B = set(b) condition = set(condition) top_marked = set() # The Bayes-Ball algorithm will traverse the belief network # and add each node that is relevant to B given condition # to the set bottom_marked. A and B are conditionally # independent if no node in A is in bottom_marked. bottom_marked = set() schedule = [(node, "child") for node in B] while schedule: node, came_from = schedule.pop() if node not in condition and came_from == "child": if node not in top_marked: top_marked.add(node) for parent in get_parents(node): schedule.append((parent, "child")) if not isinstance(node, PointMass) and node not in bottom_marked: bottom_marked.add(node) if node in A: return False # node in A is relevant to B for child in get_children(node): schedule.append((child, "parent")) elif came_from == "parent": if node in condition and node not in top_marked: top_marked.add(node) for parent in get_parents(node): schedule.append((parent, "child")) elif node not in condition and node not in bottom_marked: bottom_marked.add(node) if node in A: return False # node in A is relevant to B for child in get_children(node): schedule.append((child, "parent")) return True def transform(x, *args, **kwargs): """Transform a continuous random variable to the unconstrained space. `transform` selects among a number of default transformations which depend on the support of the provided random variable: + $[0, 1]$ (e.g., Beta): Inverse of sigmoid. + $[0, \infty)$ (e.g., Gamma): Inverse of softplus. + Simplex (e.g., Dirichlet): Inverse of softmax-centered. + $(-\infty, \infty)$ (e.g., Normal, MultivariateNormalTriL): None. Args: x: RandomVariable. Continuous random variable to transform. *args, **kwargs: Arguments to overwrite when forming the `TransformedDistribution`. For example, manually specify the transformation by passing in the `bijector` argument. Returns: RandomVariable. A `TransformedDistribution` random variable, or the provided random variable if no transformation was applied. #### Examples ```python x = Gamma(1.0, 1.0) y = ed.transform(x) sess = tf.Session() sess.run(y) -2.2279539 ``` """ if len(args) != 0 or kwargs.get('bijector', None) is not None: return TransformedDistribution(x, *args, **kwargs) try: support = x.support except AttributeError as e: msg = """'{}' object has no 'support' so cannot be transformed.""".format(type(x).__name__) raise AttributeError(msg) if support == '01': bij = tfb.Invert(tfb.Sigmoid()) new_support = 'real' elif support == 'nonnegative': bij = tfb.Invert(tfb.Softplus()) new_support = 'real' elif support == 'simplex': bij = tfb.Invert(tfb.SoftmaxCentered(event_ndims=1)) new_support = 'multivariate_real' elif support in ('real', 'multivariate_real'): return x else: msg = "'transform' does not handle supports of type '{}'".format(support) raise ValueError(msg) new_x = TransformedDistribution(x, bij, *args, **kwargs) new_x.support = new_support return new_x def compute_multinomial_mode(probs, total_count=1, seed=None): """Compute the mode of a Multinomial random variable. Args: probs: 1-D Numpy array of Multinomial class probabilities total_count: integer number of trials in single Multinomial draw seed: a Python integer. Used to create a random seed for the distribution #### Examples ```python # returns either [2, 2, 1], [2, 1, 2] or [1, 2, 2] probs = np.array(3 * [1/3]) total_count = 5 compute_multinomial_mode(probs, total_count) # returns [3, 2, 0] probs = np.array(3 * [1/3]) total_count = 5 compute_multinomial_mode(probs, total_count) ``` """ def softmax(vec): numerator = np.exp(vec) return numerator / numerator.sum(axis=0) random_state = np.random.RandomState(seed) mode = np.zeros_like(probs, dtype=np.int32) if total_count == 1: mode[np.argmax(probs)] += 1 return list(mode) remaining_count = total_count uniform_prob = 1 / total_count while remaining_count > 0: if (probs < uniform_prob).all(): probs = softmax(probs) mask = probs >= uniform_prob overflow_count = int(mask.sum() - remaining_count) if overflow_count > 0: hot_indices = np.where(mask)[0] cold_indices = random_state.choice(hot_indices, overflow_count, replace=False) mask[cold_indices] = False mode[mask] += 1 probs[mask] -= uniform_prob remaining_count -= np.sum(mask) return mode ```
```php <?php return [ /* |your_sha256_hash---------- | Default Cache Store |your_sha256_hash---------- | | This option controls the default cache connection that gets used while | using this caching library. This connection is used when another is | not explicitly specified when executing a given caching function. | */ 'default' => env('CACHE_DRIVER', 'file'), /* |your_sha256_hash---------- | Cache Stores |your_sha256_hash---------- | | Here you may define all of the cache "stores" for your application as | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | */ 'stores' => [ 'apc' => [ 'driver' => 'apc', ], 'array' => [ 'driver' => 'array', ], 'database' => [ 'driver' => 'database', 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache'), ], 'memcached' => [ 'driver' => 'memcached', 'servers' => [ [ 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ 'driver' => 'redis', 'connection' => env('REDIS_CACHE_CONNECTION', 'default'), ], ], /* |your_sha256_hash---------- | Cache Key Prefix |your_sha256_hash---------- | | When utilizing a RAM based store such as APC or Memcached, there might | be other applications utilizing the same cache. So, we'll specify a | value to get prefixed to all our keys so we can avoid collisions. | */ 'prefix' => 'laravel', ]; ```
```xml import { NextApiRequest, NextApiResponse } from "next"; import { fetchGithubStars } from "../../shared/fetch-github-stars"; export default async function handler( req: NextApiRequest, res: NextApiResponse, ) { const stars = await fetchGithubStars(); res.status(200).json({ stars }); } ```
```html <html lang="en"> <head> <title>Swallowing the Semicolon - The C Preprocessor</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="The C Preprocessor"> <meta name="generator" content="makeinfo 4.8"> <link title="Top" rel="start" href="index.html#Top"> <link rel="up" href="Macro-Pitfalls.html#Macro-Pitfalls" title="Macro Pitfalls"> <link rel="prev" href="Operator-Precedence-Problems.html#Operator-Precedence-Problems" title="Operator Precedence Problems"> <link rel="next" href="Duplication-of-Side-Effects.html#Duplication-of-Side-Effects" title="Duplication of Side Effects"> <link href="path_to_url" rel="generator-home" title="Texinfo Homepage"> <!-- Permission is granted to copy, distribute and/or modify this document any later version published by the Free Software Foundation. A copy of the license is included in the This manual contains no Invariant Sections. The Front-Cover Texts are (a) (see below), and the Back-Cover Texts are (b) (see below). (a) The FSF's Front-Cover Text is: A GNU Manual (b) The FSF's Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <p> <a name="Swallowing-the-Semicolon"></a> Next:&nbsp;<a rel="next" accesskey="n" href="Duplication-of-Side-Effects.html#Duplication-of-Side-Effects">Duplication of Side Effects</a>, Previous:&nbsp;<a rel="previous" accesskey="p" href="Operator-Precedence-Problems.html#Operator-Precedence-Problems">Operator Precedence Problems</a>, Up:&nbsp;<a rel="up" accesskey="u" href="Macro-Pitfalls.html#Macro-Pitfalls">Macro Pitfalls</a> <hr> </div> <h4 class="subsection">3.10.3 Swallowing the Semicolon</h4> <p><a name="index-semicolons-_0028after-macro-calls_0029-75"></a> Often it is desirable to define a macro that expands into a compound statement. Consider, for example, the following macro, that advances a pointer (the argument <code>p</code> says where to find it) across whitespace characters: <pre class="smallexample"> #define SKIP_SPACES(p, limit) \ { char *lim = (limit); \ while (p &lt; lim) { \ if (*p++ != ' ') { \ p--; break; }}} </pre> <p class="noindent">Here backslash-newline is used to split the macro definition, which must be a single logical line, so that it resembles the way such code would be laid out if not part of a macro definition. <p>A call to this macro might be <code>SKIP_SPACES (p, lim)</code>. Strictly speaking, the call expands to a compound statement, which is a complete statement with no need for a semicolon to end it. However, since it looks like a function call, it minimizes confusion if you can use it like a function call, writing a semicolon afterward, as in <code>SKIP_SPACES (p, lim);</code> <p>This can cause trouble before <code>else</code> statements, because the semicolon is actually a null statement. Suppose you write <pre class="smallexample"> if (*p != 0) SKIP_SPACES (p, lim); else ... </pre> <p class="noindent">The presence of two statements&mdash;the compound statement and a null statement&mdash;in between the <code>if</code> condition and the <code>else</code> makes invalid C code. <p>The definition of the macro <code>SKIP_SPACES</code> can be altered to solve this problem, using a <code>do ... while</code> statement. Here is how: <pre class="smallexample"> #define SKIP_SPACES(p, limit) \ do { char *lim = (limit); \ while (p &lt; lim) { \ if (*p++ != ' ') { \ p--; break; }}} \ while (0) </pre> <p>Now <code>SKIP_SPACES (p, lim);</code> expands into <pre class="smallexample"> do {...} while (0); </pre> <p class="noindent">which is one statement. The loop executes exactly once; most compilers generate no extra code for it. </body></html> ```
```javascript /** * @license Apache-2.0 * * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ 'use strict'; // MODULES // var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); var dmskfloor = require( './dmskfloor.js' ); var ndarray = require( './ndarray.js' ); // MAIN // setReadOnly( dmskfloor, 'ndarray', ndarray ); // EXPORTS // module.exports = dmskfloor; ```
```java /* * * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package me.lucko.luckperms.common.command.utils; import java.util.ArrayList; import java.util.List; /** * Tokenizes strings on whitespace, but ignoring whitespace enclosed within quotes. */ public class QuotedStringTokenizer { private final String string; private int cursor; public QuotedStringTokenizer(String string) { this.string = string; } public List<String> tokenize(boolean omitEmptyStringAtEnd) { List<String> output = new ArrayList<>(); while (hasNext()) { output.add(readString()); } if (!omitEmptyStringAtEnd && this.cursor > 0 && isWhitespace(peek(-1))) { output.add(""); } return output; } private static boolean isQuoteCharacter(char c) { // return c == '"' || c == '' || c == ''; return c == '\u0022' || c == '\u201C' || c == '\u201D'; } private static boolean isWhitespace(char c) { return c == ' '; } private String readString() { if (isQuoteCharacter(peek())) { return readQuotedString(); } else { return readUnquotedString(); } } private String readUnquotedString() { final int start = this.cursor; while (hasNext() && !isWhitespace(peek())) { skip(); } final int end = this.cursor; if (hasNext()) { skip(); // skip whitespace } return this.string.substring(start, end); } private String readQuotedString() { skip(); // skip start quote final int start = this.cursor; while (hasNext() && !isQuoteCharacter(peek())) { skip(); } final int end = this.cursor; if (hasNext()) { skip(); // skip end quote } if (hasNext() && isWhitespace(peek())) { skip(); // skip whitespace } return this.string.substring(start, end); } private boolean hasNext() { return this.cursor + 1 <= this.string.length(); } private char peek() { return this.string.charAt(this.cursor); } private char peek(int offset) { return this.string.charAt(this.cursor + offset); } private void skip() { this.cursor++; } } ```
```php <?php /* * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the */ namespace Google\Service\ContainerAnalysis; class BuilderConfig extends \Google\Model { /** * @var string */ public $id; /** * @param string */ public function setId($id) { $this->id = $id; } /** * @return string */ public function getId() { return $this->id; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(BuilderConfig::class, 'Google_Service_ContainerAnalysis_BuilderConfig'); ```
```shell Workflow: long running branches Workflow: topic branches Upstream shorthand Tracking shorthands View your commit history in a graph ```
```python # -*-coding=utf-8-*- __author__ = 'Rocky' ''' path_to_url Contact: weigesysu@qq.com ''' # import tushare as ts import pandas as pd import time import os import sys sys.path.append('..') # from configure.util import notify from common.BaseService import BaseService from configure.settings import DBSelector,config_dict class FetchDaily(BaseService): def __init__(self): super(FetchDaily, self).__init__(f'../log/{self.__class__.__name__}.log') self.path = config_dict('data_path') self.check_path(self.path) self.df_today_all = pd.DataFrame() self.TIMEOUT = 10 self.DB = DBSelector() self.engine = self.DB.get_engine('db_daily', 'qq') def get_today_market(self, re_try=10): while re_try > 0: try: df = ts.get_today_all() if df is None: continue if len(df) == 0: continue except Exception as e: self.logger.error(e) re_try = re_try - 1 time.sleep(self.TIMEOUT) else: return df return None def run(self): self.df_today_all = self.get_today_market() # , filename = self.today + '_all_.xls' # data full_filename = os.path.join(self.path, filename) if self.df_today_all is not None: # self.df_today_all['turnoverratio'] = self.df_today_all['turnoverratio'].map(lambda x: round(x, 2)) self.df_today_all['per'] = self.df_today_all['per'].map(lambda x: round(x, 2)) self.df_today_all['pb'] = self.df_today_all['pb'].map(lambda x: round(x, 2)) try: self.df_today_all.to_excel(full_filename) except Exception as e: self.notify(title=f'{self.__class__}excel') self.logger.error(e) try: self.df_today_all.to_sql(self.today, self.engine, if_exists='fail') except Exception as e: self.notify(title=f'{self.__class__}mysql') self.logger.error(e) def main(): obj = FetchDaily() obj.run() if __name__ == "__main__": main() ```
```php <?php //============================================================+ // File name : example_005.php // Begin : 2008-03-04 // Last Update : 2013-05-14 // // Description : Example 005 for TCPDF class // Multicell // // Author: Nicola Asuni // // Nicola Asuni // Tecnick.com LTD // www.tecnick.com // info@tecnick.com //============================================================+ /** * Creates an example PDF TEST document using TCPDF * @package com.tecnick.tcpdf * @abstract TCPDF - Example: Multicell * @author Nicola Asuni * @since 2008-03-04 */ // Include the main TCPDF library (search for installation path). require_once('tcpdf_include.php'); // create new PDF document $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); // set document information $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor('Nicola Asuni'); $pdf->SetTitle('TCPDF Example 005'); $pdf->SetSubject('TCPDF Tutorial'); $pdf->SetKeywords('TCPDF, PDF, example, test, guide'); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 005', PDF_HEADER_STRING); // set header and footer fonts $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT); $pdf->SetHeaderMargin(PDF_MARGIN_HEADER); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) if (@file_exists(dirname(__FILE__).'/lang/eng.php')) { require_once(dirname(__FILE__).'/lang/eng.php'); $pdf->setLanguageArray($l); } // --------------------------------------------------------- // set font $pdf->SetFont('times', '', 10); // add a page $pdf->AddPage(); // set cell padding $pdf->setCellPaddings(1, 1, 1, 1); // set cell margins $pdf->setCellMargins(1, 1, 1, 1); // set color for background $pdf->SetFillColor(255, 255, 127); // MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0) // set some text for example $txt = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; // Multicell test $pdf->MultiCell(55, 5, '[LEFT] '.$txt, 1, 'L', 1, 0, '', '', true); $pdf->MultiCell(55, 5, '[RIGHT] '.$txt, 1, 'R', 0, 1, '', '', true); $pdf->MultiCell(55, 5, '[CENTER] '.$txt, 1, 'C', 0, 0, '', '', true); $pdf->MultiCell(55, 5, '[JUSTIFY] '.$txt."\n", 1, 'J', 1, 2, '' ,'', true); $pdf->MultiCell(55, 5, '[DEFAULT] '.$txt, 1, '', 0, 1, '', '', true); $pdf->Ln(4); // set color for background $pdf->SetFillColor(220, 255, 220); // Vertical alignment $pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - TOP] '.$txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'T'); $pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - MIDDLE] '.$txt, 1, 'J', 1, 0, '', '', true, 0, false, true, 40, 'M'); $pdf->MultiCell(55, 40, '[VERTICAL ALIGNMENT - BOTTOM] '.$txt, 1, 'J', 1, 1, '', '', true, 0, false, true, 40, 'B'); $pdf->Ln(4); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // set color for background $pdf->SetFillColor(215, 235, 255); // set some text for example $txt = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue. Sed vel velit erat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras eget velit nulla, eu sagittis elit. Nunc ac arcu est, in lobortis tellus. Praesent condimentum rhoncus sodales. In hac habitasse platea dictumst. Proin porta eros pharetra enim tincidunt dignissim nec vel dolor. Cras sapien elit, ornare ac dignissim eu, ultricies ac eros. Maecenas augue magna, ultrices a congue in, mollis eu nulla. Nunc venenatis massa at est eleifend faucibus. Vivamus sed risus lectus, nec interdum nunc. Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.'; // print a blox of text using multicell() $pdf->MultiCell(80, 5, $txt."\n", 1, 'J', 1, 1, '' ,'', true); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // AUTO-FITTING // set color for background $pdf->SetFillColor(255, 235, 235); // Fit text on cell by reducing font size $pdf->MultiCell(55, 60, '[FIT CELL] '.$txt."\n", 1, 'J', 1, 1, 125, 145, true, 0, false, true, 60, 'M', true); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // CUSTOM PADDING // set color for background $pdf->SetFillColor(255, 255, 215); // set font $pdf->SetFont('helvetica', '', 8); // set cell padding $pdf->setCellPaddings(2, 4, 6, 8); $txt = "CUSTOM PADDING:\nLeft=2, Top=4, Right=6, Bottom=8\nLorem ipsum dolor sit amet, consectetur adipiscing elit. In sed imperdiet lectus. Phasellus quis velit velit, non condimentum quam. Sed neque urna, ultrices ac volutpat vel, laoreet vitae augue.\n"; $pdf->MultiCell(55, 5, $txt, 1, 'J', 1, 2, 125, 210, true); // move pointer to last page $pdf->lastPage(); // --------------------------------------------------------- //Close and output PDF document $pdf->Output('example_005.pdf', 'I'); //============================================================+ // END OF FILE //============================================================+ ```
```go package retry import ( "errors" "fmt" "net/http" "time" "github.com/Knetic/govaluate" "github.com/felixge/httpsnoop" "github.com/rafaeljesus/retry-go" log "github.com/sirupsen/logrus" janusErr "github.com/hellofresh/janus/pkg/errors" "github.com/hellofresh/janus/pkg/metrics" ) const ( defaultPredicate = "statusCode == 0 || statusCode >= 500" proxySection = "proxy" ) // NewRetryMiddleware creates a new retry middleware func NewRetryMiddleware(cfg Config) func(http.Handler) http.Handler { return func(handler http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { log.WithFields(log.Fields{ "attempts": cfg.Attempts, "backoff": cfg.Backoff, }).Debug("Starting retry middleware") if cfg.Predicate == "" { cfg.Predicate = defaultPredicate } expression, err := govaluate.NewEvaluableExpression(cfg.Predicate) if err != nil { log.WithError(err).Error("could not create an expression with this predicate") handler.ServeHTTP(w, r) return } if err := retry.Do(func() error { m := httpsnoop.CaptureMetrics(handler, w, r) params := make(map[string]interface{}, 8) params["statusCode"] = m.Code params["request"] = r result, err := expression.Evaluate(params) if err != nil { return errors.New("cannot evaluate the expression") } if result.(bool) { return fmt.Errorf("%s %s request failed", r.Method, r.URL) } return nil }, cfg.Attempts, time.Duration(cfg.Backoff)); err != nil { statsClient := metrics.WithContext(r.Context()) statsClient.SetHTTPRequestSection(proxySection).TrackRequest(r, nil, false).ResetHTTPRequestSection() janusErr.Handler(w, r, fmt.Errorf("request failed too many times: %w", err)) } }) } } ```
Ekaterina Ivanovna Glazyrina (; born 22 April 1987) is a Russian biathlete. Career She competed in Biathlon World Cup since 2011. Glazyrina won medals at the European championships, including two gold medals in the relay event. On 10 February 2017, IBU provisionally suspended her for doping violations during the 2014 Winter Olympics. On 4 May 2018, she was disqualified for two years, and all her results from 2013 were annulled. References External links IBU profile 1987 births Living people Russian female biathletes Biathletes at the 2014 Winter Olympics Olympic biathletes for Russia Doping cases in biathlon Russian sportspeople in doping cases People from Chaykovsky, Perm Krai Sportspeople from Perm Krai 21st-century Russian women
```javascript //your_sha256_hash--------------------------------------- //your_sha256_hash--------------------------------------- WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js"); function matchRegExp(str, regexpLiteral, expectedResult) { matchResultLiteral = str.match(regexpLiteral); errorMsgBase = "Expected result of match between string: '" + str + "' and regular expression: " + regexpLiteral + " to be " + expectedResult + " but was " actualResultLiteral = matchResultLiteral == null ? null : matchResultLiteral[0]; assert.areEqual(expectedResult, actualResultLiteral, errorMsgBase + actualResultLiteral); regexpConstructor = new RegExp(regexpLiteral); matchResultConstructor = str.match(regexpConstructor); actualResultConstructor = matchResultConstructor == null ? null : matchResultConstructor[0]; assert.areEqual(expectedResult, actualResultConstructor, errorMsgBase + actualResultConstructor); } var tests = [ { name : "Control characters followed by a word character ([A-Za-z0-9_])", body : function () { re = /[\c6]+/; //'6' = ascii x36, parsed as [\x16]+ matchRegExp("6", re, null); matchRegExp("\\", re, null); matchRegExp("\\c6", re, null); matchRegExp("c", re, null); matchRegExp("\x16", re, "\x16"); re = /\c6/; //'6' = ascii x36, parsed as "\\c6" matchRegExp("\\c6", re, "\\c6"); matchRegExp("\\", re, null); matchRegExp("6", re, null); matchRegExp("c", re, null); matchRegExp("\x16", re, null); re = /\c6[\c6]+/; //'6' = ascii x36, parsed as "\\c6"[\x16]+ matchRegExp("\\c6\x16", re, "\\c6\x16"); matchRegExp("\\", re, null); matchRegExp("c", re, null); matchRegExp("\x16", re, null); re = /[\ca]+/; //'a' = ascii x61, parsed as [\x01]+ matchRegExp("a", re, null); matchRegExp("\\", re, null); matchRegExp("c", re, null); matchRegExp("00xyzabc123\x01qrst", re, "\x01"); re = /[\c_]+/; //'_' = ascii 0x5F, parsed as [\x1F]+ matchRegExp("\x1F\x1F\x05", re, "\x1F\x1F"); matchRegExp("\\\\\\", re, null); matchRegExp("////", re, null); matchRegExp("ccc_", re, null); re = /[\cG]*/; //'G' = ascii x47, parsed as [\x07]* matchRegExp("\x07\x06\x05", re, "\x07"); matchRegExp("\\\\", re, ""); matchRegExp("////", re, ""); matchRegExp("cccG", re, ""); re = /[\cG\c6\cf]+/; //'G' = ascii x47, '6' = ascii x36, 'f' = ascii x66, parsed as [\x07\x16\x06]+ matchRegExp("\x00\x03\x07\x06\x16\x07\x08", re, "\x07\x06\x16\x07"); matchRegExp("\\\\", re, null); matchRegExp("////", re, null); matchRegExp("cfG6", re, null); re = /\cG\cf/; //'G' = ascii x47, 'f' = ascii x66, parsed as "\x07\x06" matchRegExp("\x00\x03\x07\x06\x16\x07\x08", re, "\x07\x06"); matchRegExp("\\", re, null); matchRegExp("/", re, null); matchRegExp("\\cG\\c6\\cf", re, null); re = /[\cz\cZ]+/; //'z' = ascii x7A, 'Z' = ascii x5A, have the same lowest 5 bits, parsed as [\x1A]+ matchRegExp("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", re, "\x1a"); matchRegExp("\\\\", re, null); matchRegExp("////", re, null); matchRegExp("ccczZ", re, null); } }, { name : "Control characters followed by a non-word character ([^A-Za-z0-9_])", body : function () { re = /[\c*]+/; //'*' = ascii 42, parsed as [\\c*]+ matchRegExp("\x0a\x09\x08", re, null); matchRegExp("a*c*b*d*", re, "*c*"); matchRegExp("\\\\", re, "\\\\"); matchRegExp("////", re, null); matchRegExp("ccc", re, "ccc"); re = /[\c}]*/; //'}' = ascii 125, parsed as [\\c}]* matchRegExp("\x1d\x7d\x3d", re, ""); matchRegExp("}c}}cd*c*b*d*", re, "}c}}c"); matchRegExp("\\\\", re, "\\\\"); matchRegExp("////", re, ""); matchRegExp("ccc", re, "ccc"); re = /[\c;]+/; //';' = ascii 59, parsed as [\\c;]+ matchRegExp("\x1b\x1c", re, null); matchRegExp("d;c;d;*", re, ";c;"); matchRegExp("\\\\", re, "\\\\"); matchRegExp("////", re, null); matchRegExp("ccc", re, "ccc"); re = /\c%/; //'%' = ascii x25, parsed as \\c% matchRegExp("\\", re, null); matchRegExp("\\", re, null); matchRegExp("\\c%", re, "\\c%"); matchRegExp("\x05", re, null); } }, { name : "Control Character tests with unicode flag present", body : function () { re = /[\cAg]+/u; //'A' = ascii x41, parsed as [g\x01]+ matchRegExp("abcdefghi", re, "g"); matchRegExp("\\\\", re, null); matchRegExp("////", re, null); matchRegExp("\x01\x01gg\x02\x04ggg", re, "\x01\x01gg"); re = /[\czA]+/u; //'z' = ascii x7A, parsed as [\x1AA]+ matchRegExp("abcdefghi", re, null); matchRegExp("\\\\", re, null); matchRegExp("////", re, null); matchRegExp("YZA\x1aABC", re, "A\x1aA"); assert.throws(() => eval("\"\".match(/[\\c]/u)"), SyntaxError, "(Character class) Expected an error because escaped c must be followed by a letter when unicode flag is present, but is followed by no character here.", "Invalid regular expression: invalid escape in unicode pattern"); assert.throws(() => eval("\"\".match(/[\\c-d]/u)"), SyntaxError, "(Character class) Expected an error because escaped c must be followed by a letter when unicode flag is present, but is followed by a dash, '-', here.", "Invalid regular expression: invalid escape in unicode pattern"); assert.throws(() => eval("\"\".match(/[ab\\c_$]/u)"), SyntaxError, "(Character class) Expected an error because escaped c must be followed by a letter when unicode flag is present, but is followed by an underscore, '_', here.", "Invalid regular expression: invalid escape in unicode pattern"); assert.throws(() => eval("\"\".match(/[ab\\c\\d]/u)"), SyntaxError, "(Character class) Expected an error because escaped c must be followed by a letter when unicode flag is present, but is followed by a backslash, '\\', here.", "Invalid regular expression: invalid escape in unicode pattern"); assert.throws(() => eval("\"\".match(/[ab\\c3]/u)"), SyntaxError, "(Character class) Expected an error because escaped c must be followed by a letter when unicode flag is present, but is followed by a number, '3', here.", "Invalid regular expression: invalid escape in unicode pattern"); re = /\cAg/u; //'A' = ascii x41, parsed as "\x01g" matchRegExp("abcdefghi", re, null); matchRegExp("\\\\", re, null); matchRegExp("////", re, null); matchRegExp("\x01\x01gg\x02\x04ggg", re, "\x01g"); re = /\czA/u; //'z' = ascii x7A, parsed as "\x1aA" matchRegExp("abcdefghi", re, null); matchRegExp("\\\\", re, null); matchRegExp("////", re, null); matchRegExp("YZA\x1aABC", re, "\x1aA"); assert.throws(() => eval("\"\".match(/\\c/u)"), SyntaxError, "(Non-character class) Expected an error because escaped c must be followed by a letter when unicode flag is present, but is followed by no character here.", "Invalid regular expression: invalid escape in unicode pattern"); assert.throws(() => eval("\"\".match(/\\c-d/u)"), SyntaxError, "(Non-character class) Expected an error because escaped c must be followed by a letter when unicode flag is present, but is followed by a dash, '-', here.", "Invalid regular expression: invalid escape in unicode pattern"); assert.throws(() => eval("\"\".match(/ab\\c_$/u)"), SyntaxError, "(Non-character class) Expected an error because escaped c must be followed by a letter when unicode flag is present, but is followed by an underscore, '_', here.", "Invalid regular expression: invalid escape in unicode pattern"); assert.throws(() => eval("\"\".match(/ab\\c\\d/u)"), SyntaxError, "(Non-character class) Expected an error because escaped c must be followed by a letter when unicode flag is present, but is followed by a backslash, '\\', here.", "Invalid regular expression: invalid escape in unicode pattern"); assert.throws(() => eval("\"\".match(/ab\\c3/u)"), SyntaxError, "(Non-character class) Expected an error because escaped c must be followed by a letter when unicode flag is present, but is followed by a number, '3', here.", "Invalid regular expression: invalid escape in unicode pattern"); } }, { name : "Control character edge cases", body : function () { re = /[\c-g]+/; //'-' = ascii x2D, parsed as [\\c-g]+ matchRegExp("abcdefghi", re, "cdefg"); matchRegExp("\\\\", re, "\\\\"); matchRegExp("////", re, null); matchRegExp("\x0d", re, null); matchRegExp("aobd\\f\\d", re, "d\\f\\d"); re = /[\c-]+/; //'-' = ascii x2D, parsed as [\\c-]+ matchRegExp("abcdefghi", re, "c"); matchRegExp("\x0dc--c", re, "c--c"); matchRegExp("\\\\", re, "\\\\"); matchRegExp("////", re, null); matchRegExp("aobd\\f\\d", re, "\\"); assert.throws(() => eval("\"\".match(/[\\c-a]/)"), SyntaxError, "Expected an error due to 'c-a' being an invalid range.", "Invalid range in character set"); } } ]; testRunner.runTests(tests, { verbose : WScript.Arguments[0] != "summary" }); ```
```objective-c /* * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef CPU_FEATURES_H #define CPU_FEATURES_H #include <sys/cdefs.h> #include <stdint.h> __BEGIN_DECLS /* A list of valid values returned by android_getCpuFamily(). * They describe the CPU Architecture of the current process. */ typedef enum { ANDROID_CPU_FAMILY_UNKNOWN = 0, ANDROID_CPU_FAMILY_ARM, ANDROID_CPU_FAMILY_X86, ANDROID_CPU_FAMILY_MIPS, ANDROID_CPU_FAMILY_ARM64, ANDROID_CPU_FAMILY_X86_64, ANDROID_CPU_FAMILY_MIPS64, ANDROID_CPU_FAMILY_MAX /* do not remove */ } AndroidCpuFamily; /* Return the CPU family of the current process. * * Note that this matches the bitness of the current process. I.e. when * running a 32-bit binary on a 64-bit capable CPU, this will return the * 32-bit CPU family value. */ extern AndroidCpuFamily android_getCpuFamily(void); /* Return a bitmap describing a set of optional CPU features that are * supported by the current device's CPU. The exact bit-flags returned * depend on the value returned by android_getCpuFamily(). See the * documentation for the ANDROID_CPU_*_FEATURE_* flags below for details. * * NOTE: This will return 0 for the following architectures that don't have * optional features listed at the moment: * * ANDROID_CPU_FAMILY_MIPS * ANDROID_CPU_FAMILY_ARM64 * ANDROID_CPU_FAMILY_X86_64 * ANDROID_CPU_FAMILY_MIPS64 */ extern uint64_t android_getCpuFeatures(void); /* The list of feature flags for ANDROID_CPU_FAMILY_ARM that can be * recognized by the library (see note below for 64-bit ARM). Value details * are: * * VFPv2: * CPU supports the VFPv2 instruction set. Many, but not all, ARMv6 CPUs * support these instructions. VFPv2 is a subset of VFPv3 so this will * be set whenever VFPv3 is set too. * * ARMv7: * CPU supports the ARMv7-A basic instruction set. * This feature is mandated by the 'armeabi-v7a' ABI. * * VFPv3: * CPU supports the VFPv3-D16 instruction set, providing hardware FPU * support for single and double precision floating point registers. * Note that only 16 FPU registers are available by default, unless * the D32 bit is set too. This feature is also mandated by the * 'armeabi-v7a' ABI. * * VFP_D32: * CPU VFP optional extension that provides 32 FPU registers, * instead of 16. Note that ARM mandates this feature is the 'NEON' * feature is implemented by the CPU. * * NEON: * CPU FPU supports "ARM Advanced SIMD" instructions, also known as * NEON. Note that this mandates the VFP_D32 feature as well, per the * ARM Architecture specification. * * VFP_FP16: * Half-width floating precision VFP extension. If set, the CPU * supports instructions to perform floating-point operations on * 16-bit registers. This is part of the VFPv4 specification, but * not mandated by any Android ABI. * * VFP_FMA: * Fused multiply-accumulate VFP instructions extension. Also part of * the VFPv4 specification, but not mandated by any Android ABI. * * NEON_FMA: * Fused multiply-accumulate NEON instructions extension. Optional * extension from the VFPv4 specification, but not mandated by any * Android ABI. * * IDIV_ARM: * Integer division available in ARM mode. Only available * on recent CPUs (e.g. Cortex-A15). * * IDIV_THUMB2: * Integer division available in Thumb-2 mode. Only available * on recent CPUs (e.g. Cortex-A15). * * iWMMXt: * Optional extension that adds MMX registers and operations to an * ARM CPU. This is only available on a few XScale-based CPU designs * sold by Marvell. Pretty rare in practice. * * AES: * CPU supports AES instructions. These instructions are only * available for 32-bit applications running on ARMv8 CPU. * * CRC32: * CPU supports CRC32 instructions. These instructions are only * available for 32-bit applications running on ARMv8 CPU. * * SHA2: * CPU supports SHA2 instructions. These instructions are only * available for 32-bit applications running on ARMv8 CPU. * * SHA1: * CPU supports SHA1 instructions. These instructions are only * available for 32-bit applications running on ARMv8 CPU. * * PMULL: * CPU supports 64-bit PMULL and PMULL2 instructions. These * instructions are only available for 32-bit applications * running on ARMv8 CPU. * * If you want to tell the compiler to generate code that targets one of * the feature set above, you should probably use one of the following * flags (for more details, see technical note at the end of this file): * * -mfpu=vfp * -mfpu=vfpv2 * These are equivalent and tell GCC to use VFPv2 instructions for * floating-point operations. Use this if you want your code to * run on *some* ARMv6 devices, and any ARMv7-A device supported * by Android. * * Generated code requires VFPv2 feature. * * -mfpu=vfpv3-d16 * Tell GCC to use VFPv3 instructions (using only 16 FPU registers). * This should be generic code that runs on any CPU that supports the * 'armeabi-v7a' Android ABI. Note that no ARMv6 CPU supports this. * * Generated code requires VFPv3 feature. * * -mfpu=vfpv3 * Tell GCC to use VFPv3 instructions with 32 FPU registers. * Generated code requires VFPv3|VFP_D32 features. * * -mfpu=neon * Tell GCC to use VFPv3 instructions with 32 FPU registers, and * also support NEON intrinsics (see <arm_neon.h>). * Generated code requires VFPv3|VFP_D32|NEON features. * * -mfpu=vfpv4-d16 * Generated code requires VFPv3|VFP_FP16|VFP_FMA features. * * -mfpu=vfpv4 * Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32 features. * * -mfpu=neon-vfpv4 * Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32|NEON|NEON_FMA * features. * * -mcpu=cortex-a7 * -mcpu=cortex-a15 * Generated code requires VFPv3|VFP_FP16|VFP_FMA|VFP_D32| * NEON|NEON_FMA|IDIV_ARM|IDIV_THUMB2 * This flag implies -mfpu=neon-vfpv4. * * -mcpu=iwmmxt * Allows the use of iWMMXt instrinsics with GCC. * * IMPORTANT NOTE: These flags should only be tested when * android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM, i.e. this is a * 32-bit process. * * When running a 64-bit ARM process on an ARMv8 CPU, * android_getCpuFeatures() will return a different set of bitflags */ enum { ANDROID_CPU_ARM_FEATURE_ARMv7 = (1 << 0), ANDROID_CPU_ARM_FEATURE_VFPv3 = (1 << 1), ANDROID_CPU_ARM_FEATURE_NEON = (1 << 2), ANDROID_CPU_ARM_FEATURE_LDREX_STREX = (1 << 3), ANDROID_CPU_ARM_FEATURE_VFPv2 = (1 << 4), ANDROID_CPU_ARM_FEATURE_VFP_D32 = (1 << 5), ANDROID_CPU_ARM_FEATURE_VFP_FP16 = (1 << 6), ANDROID_CPU_ARM_FEATURE_VFP_FMA = (1 << 7), ANDROID_CPU_ARM_FEATURE_NEON_FMA = (1 << 8), ANDROID_CPU_ARM_FEATURE_IDIV_ARM = (1 << 9), ANDROID_CPU_ARM_FEATURE_IDIV_THUMB2 = (1 << 10), ANDROID_CPU_ARM_FEATURE_iWMMXt = (1 << 11), ANDROID_CPU_ARM_FEATURE_AES = (1 << 12), ANDROID_CPU_ARM_FEATURE_PMULL = (1 << 13), ANDROID_CPU_ARM_FEATURE_SHA1 = (1 << 14), ANDROID_CPU_ARM_FEATURE_SHA2 = (1 << 15), ANDROID_CPU_ARM_FEATURE_CRC32 = (1 << 16), }; /* The bit flags corresponding to the output of android_getCpuFeatures() * when android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM64. Value details * are: * * FP: * CPU has Floating-point unit. * * ASIMD: * CPU has Advanced SIMD unit. * * AES: * CPU supports AES instructions. * * CRC32: * CPU supports CRC32 instructions. * * SHA2: * CPU supports SHA2 instructions. * * SHA1: * CPU supports SHA1 instructions. * * PMULL: * CPU supports 64-bit PMULL and PMULL2 instructions. */ enum { ANDROID_CPU_ARM64_FEATURE_FP = (1 << 0), ANDROID_CPU_ARM64_FEATURE_ASIMD = (1 << 1), ANDROID_CPU_ARM64_FEATURE_AES = (1 << 2), ANDROID_CPU_ARM64_FEATURE_PMULL = (1 << 3), ANDROID_CPU_ARM64_FEATURE_SHA1 = (1 << 4), ANDROID_CPU_ARM64_FEATURE_SHA2 = (1 << 5), ANDROID_CPU_ARM64_FEATURE_CRC32 = (1 << 6), }; /* The bit flags corresponding to the output of android_getCpuFeatures() * when android_getCpuFamily() returns ANDROID_CPU_FAMILY_X86. */ enum { ANDROID_CPU_X86_FEATURE_SSSE3 = (1 << 0), ANDROID_CPU_X86_FEATURE_POPCNT = (1 << 1), ANDROID_CPU_X86_FEATURE_MOVBE = (1 << 2), }; /* Return the number of CPU cores detected on this device. */ extern int android_getCpuCount(void); /* The following is used to force the CPU count and features * mask in sandboxed processes. Under 4.1 and higher, these processes * cannot access /proc, which is the only way to get information from * the kernel about the current hardware (at least on ARM). * * It _must_ be called only once, and before any android_getCpuXXX * function, any other case will fail. * * This function return 1 on success, and 0 on failure. */ extern int android_setCpu(int cpu_count, uint64_t cpu_features); #ifdef __arm__ /* Retrieve the ARM 32-bit CPUID value from the kernel. * Note that this cannot work on sandboxed processes under 4.1 and * higher, unless you called android_setCpuArm() before. */ extern uint32_t android_getCpuIdArm(void); /* An ARM-specific variant of android_setCpu() that also allows you * to set the ARM CPUID field. */ extern int android_setCpuArm(int cpu_count, uint64_t cpu_features, uint32_t cpu_id); #endif __END_DECLS #endif /* CPU_FEATURES_H */ ```
```xml /** * Adds backspace support to stickers */ import { ContentBlock, EditorState, Modifier, SelectionState } from 'draft-js'; const cleanupSticker = ( editorState: EditorState, blockKey: string ): EditorState => { const content = editorState.getCurrentContent(); // get range of the broken sticker block const targetRange = new SelectionState({ anchorKey: blockKey, anchorOffset: 0, focusKey: blockKey, focusOffset: 0, }); // convert the sticker block to a unstyled block to make text editing work const withoutSticker = Modifier.setBlockType( content, targetRange, 'unstyled' ); const newState = EditorState.push( editorState, withoutSticker, 'remove-range' ); return EditorState.forceSelection( newState, withoutSticker.getSelectionAfter() ); }; export default (editorState: EditorState): EditorState => { let newEditorState = editorState; // If there is an empty sticker block we remove it. // This can happen if a user hits the backspace button and removes the sticker. // In this case the block will still be of type sticker. editorState .getCurrentContent() .get('blockMap') .forEach((block: ContentBlock) => { if (block.get('type') === 'sticker' && block.getEntityAt(0) === null) { newEditorState = cleanupSticker(editorState, block.get('key')); } }); return newEditorState; }; ```
```yaml connectors: {} exporters: datadog: api: fail_on_invalid_key: false key: '[REDACTED]' site: datadoghq.com auth: null compression: "" cookies: null disable_keep_alives: false endpoint: "" headers: {} host_metadata: enabled: true hostname_source: config_or_system tags: [] hostname: "" http2_ping_timeout: 0s http2_read_idle_timeout: 0s idle_conn_timeout: null logs: batch_wait: 5 compression_level: 6 dialer: timeout: 0s dump_payloads: false endpoint: path_to_url use_compression: true max_conns_per_host: null max_idle_conns: null max_idle_conns_per_host: null metrics: apm_stats_receiver_addr: "" delta_ttl: 3600 dialer: timeout: 0s enabled: false endpoint: path_to_url histograms: mode: distributions send_aggregation_metrics: false send_count_sum_metrics: false instrumentation_library_metadata_as_tags: false instrumentation_scope_metadata_as_tags: false resource_attributes_as_tags: false summaries: mode: gauges sums: cumulative_monotonic_mode: to_delta initial_cumulative_monotonic_value: auto tag_cardinality: "" tags: "" only_metadata: false proxy_url: "" read_buffer_size: 0 retry_on_failure: enabled: true initial_interval: 5s max_elapsed_time: 5m0s max_interval: 30s multiplier: 1.5 randomization_factor: 0.5 sending_queue: enabled: true num_consumers: 10 queue_size: 1000 storage: null timeout: 15s tls: ca_file: "" ca_pem: '[REDACTED]' cert_file: "" cert_pem: '[REDACTED]' cipher_suites: [] include_system_ca_certs_pool: false insecure: false insecure_skip_verify: false key_file: "" key_pem: '[REDACTED]' max_version: "" min_version: "" reload_interval: 0s server_name_override: "" traces: compute_top_level_by_span_kind: true dialer: timeout: 0s endpoint: path_to_url ignore_resources: [] span_name_as_resource_name: true span_name_remappings: {} trace_buffer: 0 write_buffer_size: 0 extensions: datadog/dd-autoconfigured: auth: null compression_algorithms: [] configstore: {} cors: null endpoint: localhost:7777 include_metadata: false max_request_body_size: 0 response_headers: {} tls: null health_check/dd-autoconfigured: auth: null check_collector_pipeline: enabled: false exporter_failure_threshold: 5 interval: 5m compression_algorithms: [] cors: null endpoint: localhost:13133 include_metadata: false max_request_body_size: 0 path: / response_body: null response_headers: {} tls: null pprof/dd-autoconfigured: block_profile_fraction: 0 dialer: timeout: 0s endpoint: localhost:1777 mutex_profile_fraction: 0 save_to_file: "" zpages/dd-autoconfigured: auth: null compression_algorithms: [] cors: null endpoint: localhost:55679 include_metadata: false max_request_body_size: 0 response_headers: {} tls: null processors: infraattributes/dd-autoconfigured: cardinality: 0 logs: log: [] metrics: metric: [] traces: span: [] receivers: otlp: protocols: grpc: null http: null prometheus: config: global: evaluation_interval: 1m scrape_interval: 1m scrape_protocols: - OpenMetricsText1.0.0 - OpenMetricsText0.0.1 - PrometheusText0.0.4 scrape_timeout: 10s scrape_configs: - enable_compression: true enable_http2: true follow_redirects: true honor_timestamps: true job_name: datadog-agent metrics_path: /metrics scheme: http scrape_interval: 5s scrape_protocols: - OpenMetricsText1.0.0 - OpenMetricsText0.0.1 - PrometheusText0.0.4 scrape_timeout: 5s static_configs: - targets: - 0.0.0.0:8888 track_timestamps_staleness: false report_extra_scrape_metrics: false start_time_metric_regex: "" target_allocator: null trim_metric_suffixes: false use_start_time_metric: false service: extensions: - pprof/dd-autoconfigured - zpages/dd-autoconfigured - health_check/dd-autoconfigured - datadog/dd-autoconfigured pipelines: logs: exporters: - datadog processors: - infraattributes/dd-autoconfigured receivers: - otlp metrics: exporters: - datadog processors: - infraattributes/dd-autoconfigured receivers: - otlp - prometheus traces: exporters: - datadog processors: - infraattributes/dd-autoconfigured receivers: - otlp telemetry: logs: development: false disable_caller: false disable_stacktrace: false encoding: console error_output_paths: - stderr initial_fields: {} level: info output_paths: - stderr sampling: enabled: true initial: 10 thereafter: 100 tick: 10s metrics: address: :8888 level: Normal readers: [] resource: {} traces: processors: [] propagators: [] ```
```java /** * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ package io.pravega.segmentstore.contracts.tables; /** * Exception that is thrown whenever a Table Key exceeds the maximum allowed length. */ public class TableKeyTooLongException extends IllegalArgumentException { private static final long serialVersionUID = 1L; /** * Creates a new instance of the TableKeyTooLongException class. * * @param key The Key. * @param maximumLength The maximum allowed key length. */ public TableKeyTooLongException(TableKey key, int maximumLength) { super(String.format("Table Key too long. Maximum length: %s, given: %s.", key.getKey().getLength(), maximumLength)); } } ```
```objective-c // bindgen-flags: --with-derive-hash --with-derive-partialeq --with-derive-eq // struct foo { unsigned int a; union { unsigned int b; struct { unsigned short c1; unsigned short c2; }; struct { unsigned char d1; unsigned char d2; unsigned char d3; unsigned char d4; }; }; }; ```
```javascript Don't assume that HTML script tags are always run sequentially Use `String.link` to create `<a>` tags without messy concatenation Network Information API Fetch API MediaDevices.getUserMedia() ```
The southern Titiwangsa bent-toed gecko (Cyrtodactylus australotitiwangsaensis) is a species of gecko endemic to peninsular Malaysia. References Cyrtodactylus Reptiles described in 2012
```ruby module ConsumerApps class RpushAppQuery def self.call(app_bundle:, platform:) new(app_bundle: app_bundle, platform: platform).call end def initialize(app_bundle:, platform:) @app_bundle = app_bundle @platform = platform @app_name = "#{app_bundle}.#{platform}" @consumer_app = ConsumerApps::FindOrCreateByQuery.call( app_bundle: @app_bundle, platform: @platform, ) end def call if consumer_app.android? android_app = Rpush::Gcm::App.where(name: app_name).first android_app || recreate_android_app! elsif consumer_app.ios? ios_app = Rpush::Apns2::App.where(name: app_name).first ios_app || recreate_ios_app! end end private attr_reader :app_bundle, :app_name, :consumer_app, :platform def recreate_ios_app! # If the ConsumerApp doesn't have credentials there's no need to create it return if consumer_app.auth_credentials.blank? app = Rpush::Apns2::App.new app.name = app_name app.certificate = consumer_app.auth_credentials.to_s.gsub("\\n", "\n") app.environment = Rails.env app.password = "" app.bundle_id = app_bundle app.connections = 1 app.save! app end def recreate_android_app! # If the ConsumerApp doesn't have credentials there's no need to create it return if consumer_app.auth_credentials.blank? app = Rpush::Gcm::App.new app.name = app_name app.auth_key = consumer_app.auth_credentials.to_s app.connections = 1 app.save! app end end end ```
Charles Pence Slichter (January 21, 1924 – February 19, 2018) was an American physicist, best known for his work on nuclear magnetic resonance and superconductivity. He was awarded the 2007 National Medal of Science "for establishing nuclear magnetic resonance as a powerful tool to reveal the fundamental molecular properties of liquids and solids. His inspired teaching has led generations of physicists and chemists to develop a host of modern technologies in condensed matter physics, chemistry, biology and medicine." Birth and education Slichter was born in 1924 in Ithaca, New York. He attended Harvard University, where in 1949 received his Ph.D. under the supervision of Edward Purcell. Career Slichter was a professor of physics and chemistry at the University of Illinois at Urbana-Champaign from 1949 until his retirement in 2006. He spent one sabbatical semester (Spring 1961) as Morris Loeb Lecturer at Harvard University. The lectures he gave there formed the nucleus of his book "Principles of Magnetic Resonance". Slichter served as a member of the National Science Board from 1976–1984; as a member and vice-chair of the President's Science Advisory Committee from 1965–1969; as a member of the President's Committee on the National Medal of Science, 1969–1974; and as a member of the President's Committee on Science and Technology Policy, 1976. Slichter was a member (Fellow) of the Harvard Corporation, Harvard's senior governing body, from 1970–1995. He chaired the search committee that selected Neil Rudenstine as the president of Harvard in 1991. He was an elected member of the United States National Academy of Sciences, the American Academy of Arts and Sciences, and the American Philosophical Society. Research Slichter's research focused primarily on NMR and superconductivity. His most important work includes: Co-discoverer of the Hebel–Slichter effect, giving the earliest evidence for the BCS theory of superconductivity. With Tom Carver, gave the first demonstration of the Overhauser Effect. With Gutowsky and McCall, discovered J-coupling. With Bob Schumacher and Tom Carver, performed the first measurement of the Pauli spin susceptibility of conduction electrons. Other notable scientific contributions include the introduction of phase sensitive detection to pulsed NMR and its use to detect weak signals, studies of charge density waves and of the Kondo effect, the theory of ^{19}F chemical shifts, NMR studies of high-temperature superconductivity, theory of the effects of chemical exchange on NMR spectra, and studies of NMR of metal surfaces (catalysis). Slichter was the recipient of numerous awards, in addition to the 2007 National Medal of Science. In 1993 Slichter was awarded the Comstock Prize in Physics from the National Academy of Sciences. In 1969 he received the Langmuir Prize, and 1996 the Buckley Prize, both from the American Physical Society. The American Chemical Society honored his discovery of J-coupling with a Citation for Chemical Breakthrough Award in 2016. Slichter was an Alfred P. Sloan Fellow from 1955–1961. Slichter received honorary Doctor of Science degrees from the University of Waterloo (1993) and Leipzig University (2010), and an honorary Doctor of Laws (LL.D.) degree from Harvard University in 1996. Family Slichter was the son of economist Sumner Slichter, the grandson of mathematician Charles S. Slichter, the nephew of geophysicist Louis B. Slichter, the father of musician Jacob Slichter, and brother of Bell Labs executive William P. Slichter. Books References External links http://www.ebyte.it/library/educards/nmr/Nmr_HebelSlichter.html 1924 births 2018 deaths University of Illinois Urbana-Champaign faculty National Medal of Science laureates Members of the United States National Academy of Sciences Harvard University alumni Scientists from Ithaca, New York Oliver E. Buckley Condensed Matter Prize winners Members of the American Philosophical Society
Amusa or AMusA may refer to: Amusa (river), in Italy Associate in Music, Australia Dayo Amusa, Nigerian actress and singer
I Wish I Was Eighteen Again is the first album by George Burns, released in 1980. The album peaked at No. 93 on Billboards Top LPs & Tape chart. The title track is Burns' only Billboard Hot 100 and Adult Contemporary entry. Track listing Personnel Production Producer: Jerry Kennedy Engineers: Brent King, Carla Frederick, Mike Psanos Photography: Gary Heery Charts Album Singles References External links 1980 albums RCA Records albums George Burns albums
```javascript /** * @license */ /** @type {LH.Config} */ const config = { extends: 'lighthouse:default', settings: { onlyAudits: ['viewport'], }, }; /** * @type {Smokehouse.ExpectedRunnerResult} */ const expectations = { artifacts: { Timing: { _includes: [ { name: 'lh:runner:gather', }, ], }, }, lhr: { requestedUrl: 'path_to_url finalDisplayedUrl: 'path_to_url audits: {}, timing: { entries: { _includes: [ { name: 'lh:runner:gather', }, { name: 'lh:runner:audit', }, ], }, }, }, }; export default { id: 'timing', expectations, config, }; ```
```scala package tech.mlsql.plugins.healthy import streaming.dsl.ScriptSQLExec import tech.mlsql.app.CustomController import tech.mlsql.common.utils.serder.json.JSONTool import tech.mlsql.runtime.AppRuntimeStore import tech.mlsql.version.VersionCompatibility /** * 23/9/2020 WilliamZhu(allwefantasy@gmail.com) */ class App extends tech.mlsql.app.App with VersionCompatibility { override def run(args: Seq[String]): Unit = { AppRuntimeStore.store.registerController("/plugins/healthy", classOf[HealthyController].getName) AppRuntimeStore.store.registerRequestCleaner("/plugins/cleaner/healthy",classOf[ShutdownOnSparkContextStoppedCleaner].getName) AppRuntimeStore.store.registerRequestCleaner("/plugins/cleaner/clean/temp_tables",classOf[TempTableCleaner].getName) } override def supportedVersions: Seq[String] = Seq("1.5.0-SNAPSHOT", "1.5.0", "1.6.0-SNAPSHOT", "1.6.0") } class HealthyController extends CustomController { override def run(params: Map[String, String]): String = { params.get("_action_") match { case Some(action) => matchAction(action) case None => matchAction("info") } } def matchAction(action: String): String = { val context = ScriptSQLExec.context() val session = context.execListener.sparkSession action match { case "info" => JSONTool.toJsonStr(Map("sparkContextIsStopped" -> session.sparkContext.isStopped)) case "shutdown" => val t = new Thread(new Runnable { override def run(): Unit = { Thread.sleep(30 * 1000) if (!session.sparkContext.isStopped) { session.sparkContext.stop() } System.exit(-1) } }) t.start() JSONTool.toJsonStr(Map("success" -> "30 seconds later we will shutdown")) } } } ```
Maheish Girri is an Indian social activist and politician belonging to the Bharatiya Janata Party (BJP) and currently the National Secretary of the party. He was a Member of Parliament from the East Delhi Lok Sabha constituency. Girri is an Art of Living faculty and a former International Director of the Art of Living Foundation. He is also the founder of the NGO Navbharat Sewa Samiti. He quit the India Against Corruption movement over differences with Arvind Kejriwal, and subsequently joined BJP, winning the 2014 General Elections from East Delhi. Early life Maheish Girri was born and brought up in Nashik. According to him, he left his home at the age of 17, after being drawn to spirituality. In 1999, he became a Peethadeesh (head of a peeth) in Junagadh, Gujarat. Subsequently, he met Sri Sri Ravi Shankar, and became an Art of Living teacher. Social activism In 2009, he launched the Mantranaad movement aimed at creating a "Corruption free, Terrorism free India". In 2010, as an Art of Living leader, he launched the organization's Meri Delhi, Meri Yamuna ("My Delhi, My Yamuna") campaign to clean up the Yamuna river. In 2010, he led the "Clean Delhi" movement ahead of the Commonwealth Games. He has also helped organize over 108 medical camps and 151 free eye-and-ear check-up camps across slums of East Delhi. Politics In 2011, Girri joined India Against Corruption movement, but quit it after complaining about Arvind Kejriwal's "autocratic ways". Subsequently, he joined the Bharatiya Janata Party (BJP). He was a Member of Parliament for the Bhartiya Janata Party in 16th Lok Sabha from the East Delhi constituency. References External links 1974 births Living people Bharatiya Janata Party politicians from Delhi India MPs 2014–2019 Lok Sabha members from Delhi People from Nashik People from East Delhi district
```objective-c /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ // vim: expandtab:ts=8:sw=4:softtabstop=4: /** * \file lzma/check.h * \brief Integrity checks */ /* * Author: Lasse Collin * * This file has been put into the public domain. * You can do whatever you want with this file. * * See ../lzma.h for information about liblzma as a whole. */ #ifndef LZMA_H_INTERNAL # error Never include this file directly. Use <lzma.h> instead. #endif /** * \brief Type of the integrity check (Check ID) * * The .xz format supports multiple types of checks that are calculated * from the uncompressed data. They vary in both speed and ability to * detect errors. */ typedef enum { LZMA_CHECK_NONE = 0, /**< * No Check is calculated. * * Size of the Check field: 0 bytes */ LZMA_CHECK_CRC32 = 1, /**< * CRC32 using the polynomial from the IEEE 802.3 standard * * Size of the Check field: 4 bytes */ LZMA_CHECK_CRC64 = 4, /**< * CRC64 using the polynomial from the ECMA-182 standard * * Size of the Check field: 8 bytes */ LZMA_CHECK_SHA256 = 10 /**< * SHA-256 * * Size of the Check field: 32 bytes */ } lzma_check; /** * \brief Maximum valid Check ID * * The .xz file format specification specifies 16 Check IDs (0-15). Some * of them are only reserved, that is, no actual Check algorithm has been * assigned. When decoding, liblzma still accepts unknown Check IDs for * future compatibility. If a valid but unsupported Check ID is detected, * liblzma can indicate a warning; see the flags LZMA_TELL_NO_CHECK, * LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_TELL_ANY_CHECK in container.h. */ #define LZMA_CHECK_ID_MAX 15 /** * \brief Test if the given Check ID is supported * * Return true if the given Check ID is supported by this liblzma build. * Otherwise false is returned. It is safe to call this with a value that * is not in the range [0, 15]; in that case the return value is always false. * * You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always * supported (even if liblzma is built with limited features). */ extern LZMA_API(lzma_bool) lzma_check_is_supported(lzma_check check) lzma_nothrow lzma_attr_const; /** * \brief Get the size of the Check field with the given Check ID * * Although not all Check IDs have a check algorithm associated, the size of * every Check is already frozen. This function returns the size (in bytes) of * the Check field with the specified Check ID. The values are: * { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 } * * If the argument is not in the range [0, 15], UINT32_MAX is returned. */ extern LZMA_API(uint32_t) lzma_check_size(lzma_check check) lzma_nothrow lzma_attr_const; /** * \brief Maximum size of a Check field */ #define LZMA_CHECK_SIZE_MAX 64 /** * \brief Calculate CRC32 * * Calculate CRC32 using the polynomial from the IEEE 802.3 standard. * * \param buf Pointer to the input buffer * \param size Size of the input buffer * \param crc Previously returned CRC value. This is used to * calculate the CRC of a big buffer in smaller chunks. * Set to zero when starting a new calculation. * * \return Updated CRC value, which can be passed to this function * again to continue CRC calculation. */ extern LZMA_API(uint32_t) lzma_crc32( const uint8_t *buf, size_t size, uint32_t crc) lzma_nothrow lzma_attr_pure; /** * \brief Calculate CRC64 * * Calculate CRC64 using the polynomial from the ECMA-182 standard. * * This function is used similarly to lzma_crc32(). See its documentation. */ extern LZMA_API(uint64_t) lzma_crc64( const uint8_t *buf, size_t size, uint64_t crc) lzma_nothrow lzma_attr_pure; /* * SHA-256 functions are currently not exported to public API. * Contact Lasse Collin if you think it should be. */ /** * \brief Get the type of the integrity check * * This function can be called only immediatelly after lzma_code() has * returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK. * Calling this function in any other situation has undefined behavior. */ extern LZMA_API(lzma_check) lzma_get_check(const lzma_stream *strm) lzma_nothrow; ```
Lars Axel Larsson (17 June 1911 – 29 January 1993) was a Swedish steeplechase runner. He finished sixth at the 1936 Summer Olympics and won a European title in 1938. Larsson started as a flat runner and changed to steeplechase in 1936. That year he won the Swedish steeplechase title while finishing second in the 5,000 m. He went on winning the steeplechase title in 1937–40, improving the national record three times, from 9:16.6 in 1936 to 9:09.0 in 1939. He retired in 1941 due to a leg injury and later worked as an office clerk. References 1911 births 1993 deaths Swedish male steeplechase runners Olympic athletes for Sweden Athletes (track and field) at the 1936 Summer Olympics European Athletics Championships medalists People from Lidingö Municipality Sportspeople from Stockholm County
```emacs lisp ;;; treemacs.el --- A tree style file viewer package -*- lexical-binding: t -*- ;; This program is free software; you can redistribute it and/or modify ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; along with this program. If not, see <path_to_url ;;; Commentary: ;; Minor mode to follow the tag at point in the treemacs view on an idle timer ;; Finding the current tag is a fairly involved process: ;; * Grab current buffer's imenu output ;; * Flatten the list to create full tag paths ;; * Sort according to tag position ;; * Beware of edge cases: org-mode headlines are containers, but also hold a position, hidden as a text property and ;; semantic-mode parsed buffers use overlays instead of markers ;; * Find the last tag whose position begins before point ;; * Jump to that tag path ;; * No jump when there's no buffer file, or no imenu, or buffer file is not seen in treemacs etc. ;; NOTE: This module is lazy-loaded. ;;; Code: (require 'imenu) (require 'hl-line) (require 'treemacs-customization) (require 'treemacs-core-utils) (require 'treemacs-tags) (require 'treemacs-scope) (require 'treemacs-follow-mode) (require 'treemacs-logging) (eval-when-compile (require 'inline) (require 'cl-lib) (require 'treemacs-macros)) (defvar treemacs--tag-follow-timer nil "The idle timer object for `treemacs-tag-follow-mode'. Active while tag follow mode is enabled and nil/cancelled otherwise.") (defvar-local treemacs--previously-followed-tag-position nil "Records the last node and path whose tags were expanded by tag follow mode. Is made up of a cons of the last expanded node and its path. Both are kept to make sure that the position has not become invalidated in the meantime. When `treemacs-tag-follow-cleanup' it t this button's tags will be closed up again when tag follow mode moves to another button.") (defvar-local treemacs--imenu-cache nil "Cache for the current buffer's flattened and sorted imenu index. Is reset in `first-change-hook' will only be set again after the buffer has been saved.") (define-inline treemacs--reset-imenu-cache () "Reset `treemacs--imenu-cache'." (inline-quote (setq-local treemacs--imenu-cache nil))) (define-inline treemacs--forget-previously-follow-tag-btn () "Forget the previously followed button when treemacs is killed or rebuilt." (inline-quote (setq treemacs--previously-followed-tag-position nil))) ;;;###autoload (defun treemacs--flatten&sort-imenu-index () "Flatten current file's imenu index and sort it by tag position. The tags are sorted into the order in which they appear, regardless of section or nesting depth." (if (eq major-mode 'pdf-view-mode) 'unsupported (let* ((imenu-auto-rescan t) (org? (eq major-mode 'org-mode)) (index (-> (buffer-file-name) (treemacs--get-imenu-index))) (flat-index (if org? (treemacs--flatten-org-mode-imenu-index index) (treemacs--flatten-imenu-index index))) (first (caar flat-index)) ;; in org mode buffers the first item may not be a cons since its position ;; is still stored as a text property (semantic? (and (consp first) (overlayp (cdr first)))) (compare-func (if (memq major-mode '(markdown-mode adoc-mode)) #'treemacs--compare-markdown-tag-paths #'treemacs--compare-tag-paths))) (cond (semantic? ;; go ahead and just transform semantic overlays into markers so we dont ;; have trouble with comparisons when searching a position (dolist (tag-path flat-index) (let ((leaf (car tag-path)) (marker (make-marker))) (setcdr leaf (move-marker marker (overlay-start (cdr leaf))))))) ;; same goes for an org index, since headlines with children store their ;; positions as text properties (org? (dolist (tag-path flat-index) (let ((leaf (car tag-path))) (when (stringp leaf) (setcar tag-path (cons leaf (get-text-property 0 'org-imenu-marker leaf)))))))) (sort flat-index compare-func)))) (defun treemacs--flatten-imenu-index (index &optional path) "Flatten a nested imenu INDEX to a flat list of tag paths. The function works recursively with PATH being the already collected tag path in each iteration. INDEX: Imenu Tag Index PATH: String List" (declare (pure t) (side-effect-free t)) (let (result) (--each index (cond ((imenu--subalist-p it) (setq result (append result (treemacs--flatten-imenu-index (cdr it) (cons (car it) path))))) ;; make sure our leaf elements have a cdr where a location should be stored, it looks like there are cases, ;; at least on emacs 25, where we only get what amounts to an empty section ;; path_to_url#issuecomment-427281977 ((and (consp it) (cdr it)) (setq result (cons (cons it (nreverse (copy-sequence path))) result))))) result)) (defun treemacs--flatten-org-mode-imenu-index (index &optional path) "Specialisation of `treemacs--flatten-imenu-index' for org mode. An index produced in an `org-mode' buffer is special in that tag sections act not just as a means of grouping tags (being bags of functions, classes etc). Each tag section is instead also a headline which can be moved to. The flattening algorithm must therefore be slightly adjusted. INDEX: Org Imenu Tag Index PATH: String List" (declare (pure t) (side-effect-free t)) (let (result) (--each index (let ((is-subalist? (imenu--subalist-p it))) (setq result (cons (cons (if is-subalist? (car it) it) (nreverse (copy-sequence path))) result)) (when is-subalist? (setq result (append result (treemacs--flatten-org-mode-imenu-index (cdr it) (cons (car it) path))))))) result)) (define-inline treemacs--compare-tag-paths (p1 p2) "Compare two tag paths P1 & P2 by the position of the tags they lead to. Used to sort tag paths according to the order their tags appear in. P1: Tag-Path P2: Tag-Path" (declare (pure t) (side-effect-free t)) (inline-letevals (p1 p2) (inline-quote (< (-> ,p1 (cdar) (marker-position)) (-> ,p2 (cdar) (marker-position)))))) (define-inline treemacs--compare-markdown-tag-paths (p1 p2) "Specialised version of `treemacs--compare-tag-paths' for markdown and adoc. P1: Tag-Path P2: Tag-Path" (declare (pure t) (side-effect-free t)) (inline-letevals (p1 p2) (inline-quote (< (cdar ,p1) (cdar ,p2))))) (defun treemacs--find-index-pos (point list) "Find the tag at POINT within a flat tag-path LIST. Returns the tag-path whose tag is the last to be situated before POINT (meaning that the next tag is after POINT and thus too far). Accounts for POINT being located either before the first or after the last tag. POINT: Int LIST: Sorted Tag Path List" (declare (pure t) (side-effect-free t)) (when list (let ((first (car list)) (last (nth (1- (length list)) list))) (cond ((<= point (-> first car cdr)) first) ((>= point (-> last car cdr)) last) (t (treemacs--binary-index-search point list)))))) (cl-defun treemacs--binary-index-search (point list &optional (start 0) (end (1- (length list)))) "Find the position of POINT in LIST using a binary search. Continuation of `treemacs--find-index-pos'. Search LIST between START & END. POINT: Integer LIST: Sorted Tag Path List START: Integer END: Integer" (declare (pure t) (side-effect-free t)) (let* ((index (+ start (/ (- end start) 2))) (elem1 (nth index list)) (elem2 (nth (1+ index) list)) (pos1 (-> elem1 car cdr)) (pos2 (-> elem2 car cdr))) (cond ((and (> point pos1) (<= point pos2)) elem1) ((> pos2 point) (treemacs--binary-index-search point list 0 index)) ((< pos2 point) (treemacs--binary-index-search point list index end))))) (defun treemacs--do-follow-tag (flat-index treemacs-window buffer-file project) "Actual tag-follow implementation, run once the necessary data is gathered. FLAT-INDEX: Sorted list of tag paths TREEMACS-WINDOW: Window BUFFER-FILE: Filepath PROJECT: Project Struct" (let* ((tag-path (treemacs--find-index-pos (point) flat-index)) (file-states '(file-node-open file-node-closed root-node-open root-node-closed)) (btn)) (when tag-path (treemacs-without-following (with-selected-window treemacs-window (setq btn (treemacs-current-button)) (if btn ;; first move to the nearest file when we're on a tag (if (memq (treemacs-button-get btn :state) '(tag-node-open tag-node-closed tag-node)) (while (not (memq (treemacs-button-get btn :state) file-states)) (setq btn (treemacs-button-get btn :parent))) ;; when that doesnt work move manually to the correct file (-let [btn-path (treemacs-button-get btn :path)] (unless (and (stringp btn-path) (treemacs-is-path buffer-file :same-as btn-path)) (treemacs-goto-file-node buffer-file project) (setq btn (treemacs-current-button))))) ;; also move manually when there is no button at point (treemacs-goto-file-node buffer-file project) (setq btn (treemacs-current-button))) ;; close the button that was opened on the previous follow (goto-char (treemacs-button-start btn)) ;; imenu already rescanned when fetching the tag path (let ((imenu-auto-rescan nil) (new-file-btn)) ;; make a copy since this tag-path will be saved as cache, and the two modifications made here ;; make it impossible to find the current position in `treemacs--find-index-pos' (let* ((tag-path (copy-sequence tag-path)) (target-tag (list (car (car tag-path))))) ;; remove position marker from target tag and move it ;; to the end of the tag path (setf tag-path (nconc (cdr tag-path) target-tag)) ;; the tag path also needs its file (setf tag-path (cons buffer-file tag-path)) ;; workaround: goto routines assume that at least the very first element of the followed ;; path has a dom entry with a valid position, but this is not the case when moving to tags ;; in a previously never-expanded file node, so we first find the file to make sure its ;; position is known (setf new-file-btn (treemacs-find-file-node buffer-file)) (treemacs-goto-node tag-path) (when (and treemacs--previously-followed-tag-position (not (equal (car treemacs--previously-followed-tag-position) new-file-btn))) (-let [(prev-followed-pos . _) treemacs--previously-followed-tag-position] (save-excursion (when (eq 'file-node-open (treemacs-button-get prev-followed-pos :state)) (goto-char prev-followed-pos) (treemacs--collapse-file-node prev-followed-pos))))) (setf treemacs--previously-followed-tag-position (cons new-file-btn (treemacs-button-get new-file-btn :path))))) (hl-line-highlight) (treemacs--evade-image) (when treemacs-recenter-after-tag-follow (treemacs--maybe-recenter treemacs-recenter-after-tag-follow))))))) (defun treemacs--follow-tag-at-point () "Follow the tag at point in the treemacs view." (interactive) (let* ((treemacs-window (treemacs-get-local-window)) (buffer (current-buffer)) (buffer-file (when buffer (buffer-file-name))) (project (treemacs--find-project-for-buffer))) (when (and treemacs-window buffer-file project) (condition-case e (-when-let (index (or treemacs--imenu-cache (treemacs--flatten&sort-imenu-index))) (unless (eq index 'unsupported) (unless (buffer-modified-p) (setq-local treemacs--imenu-cache (copy-sequence index))) (treemacs--do-follow-tag index treemacs-window buffer-file project))) (imenu-unavailable (ignore e)) (error (treemacs-log-err "Encountered error while following tag at point: %s" e)))))) (defun treemacs--setup-tag-follow-mode () "Setup tag follow mode." (treemacs-follow-mode -1) (--each (buffer-list) (with-current-buffer it (treemacs--reset-imenu-cache))) (add-hook 'first-change-hook #'treemacs--reset-imenu-cache) (setq treemacs--tag-follow-timer (run-with-idle-timer treemacs-tag-follow-delay t #'treemacs--follow-tag-at-point))) (defun treemacs--tear-down-tag-follow-mode () "Tear down tag follow mode." (remove-hook 'first-change-hook #'treemacs--reset-imenu-cache) (when treemacs--tag-follow-timer (cancel-timer treemacs--tag-follow-timer))) ;;;###autoload (define-minor-mode treemacs-tag-follow-mode "Toggle `treemacs-tag-follow-mode'. This acts as more fine-grained alternative to `treemacs-follow-mode' and will thus disable `treemacs-follow-mode' on activation. When enabled treemacs will focus not only the file of the current buffer, but also the tag at point. The follow action is attached to Emacs' idle timer and will run `treemacs-tag-follow-delay' seconds of idle time. The delay value is not an integer, meaning it accepts floating point values like 1.5. Every time a tag is followed a re--scan of the imenu index is forced by temporarily setting `imenu-auto-rescan' to t (though a cache is applied as long as the buffer is unmodified). This is necessary to assure that creation or deletion of tags does not lead to errors and guarantees an always up-to-date tag view. Note that in order to move to a tag in treemacs the treemacs buffer's window needs to be temporarily selected, which will reset blink-cursor-mode's timer if it is enabled. This will result in the cursor blinking seemingly pausing for a short time and giving the appearance of the tag follow action lasting much longer than it really does." :init-value nil :global t :lighter nil :group 'treemacs (if treemacs-tag-follow-mode (treemacs--setup-tag-follow-mode) (treemacs--tear-down-tag-follow-mode))) (provide 'treemacs-tag-follow-mode) ;;; treemacs-tag-follow-mode.el ends here ```
Amata cuprizonata is a moth of the subfamily Arctiinae. It was described by George Hampson in 1901. It is found in Kenya, South Africa, Tanzania and Uganda. References cuprizonata Moths described in 1901 Moths of Africa
```php <?php /* * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the */ namespace Google\Service\Dataproc; class AutoscalingConfig extends \Google\Model { /** * @var string */ public $policyUri; /** * @param string */ public function setPolicyUri($policyUri) { $this->policyUri = $policyUri; } /** * @return string */ public function getPolicyUri() { return $this->policyUri; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(AutoscalingConfig::class, 'Google_Service_Dataproc_AutoscalingConfig'); ```
```php <?php /* * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the */ namespace Google\Service\TrafficDirectorService; class RoutesConfigDump extends \Google\Collection { protected $collection_key = 'staticRouteConfigs'; protected $dynamicRouteConfigsType = DynamicRouteConfig::class; protected $dynamicRouteConfigsDataType = 'array'; protected $staticRouteConfigsType = StaticRouteConfig::class; protected $staticRouteConfigsDataType = 'array'; /** * @param DynamicRouteConfig[] */ public function setDynamicRouteConfigs($dynamicRouteConfigs) { $this->dynamicRouteConfigs = $dynamicRouteConfigs; } /** * @return DynamicRouteConfig[] */ public function getDynamicRouteConfigs() { return $this->dynamicRouteConfigs; } /** * @param StaticRouteConfig[] */ public function setStaticRouteConfigs($staticRouteConfigs) { $this->staticRouteConfigs = $staticRouteConfigs; } /** * @return StaticRouteConfig[] */ public function getStaticRouteConfigs() { return $this->staticRouteConfigs; } } // Adding a class alias for backwards compatibility with the previous class name. class_alias(RoutesConfigDump::class, 'Google_Service_TrafficDirectorService_RoutesConfigDump'); ```
Beketovka () is a rural locality (a selo) in Mayachninsky Selsoviet of Ikryaninsky District, Astrakhan Oblast, Russia. The population was 393 as of 2010. There are 3 streets. Geography Beketovka is located 1.8 km east of Ikryanoye (the district's administrative centre) by road. Ikryanoye is the nearest rural locality. Moreover Beketovka is located at approximately 350 km to the southeast of Volgograd and 50 km to the souhwest of Astrakhan. World War II During the World War II Battle of Stalingrad, the headquarters of the 64th Soviet Army were located in the village and, after the battle, the largest POW camp for surrendered German forces was Camp #108 near Beketovka. References Rural localities in Ikryaninsky District
The 1933 Florida Gators football team represented the University of Florida during the 1933 college football season. The season was Florida alumnus Dennis K. Stanley's first as the head coach of the Florida Gators football team. Stanley, who had been a standout end on the great 1928 Gators team, assembled an all-Florida-alumni coaching staff and led the Gators to a 5–3–1 revival following two consecutive losing seasons in 1931 and 1932. The 1933 season was also the first for the new Southeastern Conference (SEC), and Stanley's 1933 Florida Gators finished with a 2–3 SEC record and tied for ninth among the thirteen SEC charter members. Before the season Dutch Stanley was hired. Quarterback Sam Davis was the first quarterback and captain since Goof Bowyer in 1928. A star on the team was Al Hickland, a 250-pound, three-sport athlete who was also the team's kicker. Schedule Season summary The highlights of the 1933 season included SEC wins over the Sewanee Tigers and Auburn Tigers, and out-of-conference victories versus the North Carolina Tar Heels and Maryland Terrapins. References Florida Florida Gators football seasons Florida Gators football
Sandra Joy Manderson is a retired police officer and police commander from New Zealand. She was the first woman in the New Zealand Police to achieve the rank of Superintendent, the first woman District Commander and the first woman to serve as a New Zealand Police International Liaison Officer. Life Manderson grew up in Christchurch and attended Hagley College and the University of Canterbury, graduating with a bachelor of science. She taught physical education for a year then applied to the police force. She qualified with 70 Recruit Wing on 15 January 1978 and began policing in Canterbury. She progressed through uniformed and CIB roles and in 1993 was appointed the first director of the Crime Prevention Unit at the Department of the Prime Minister and Cabinet in Wellington. She then held positions in Wellington District as a shift commander, and at Police National Headquarters. In 1999 she was promoted to superintendent in the role of National Manager Organisational Performance. In 2002 Manderson returned to Canterbury to serve as District Commander for six years. In 2004 she travelled to Phuket, Thailand, to lead a disaster victim identification team in the wake of the 2004 Indian Ocean earthquake and tsunami. In 2008 Manderson was transferred to Washington D.C., where she spent four years as International Liaison Officer to the Americas covering the United States, Canada and South and Central America. Following the February 2011 Canterbury earthquakes Manderson returned to Christchurch to assist with police work in the aftermath of the disaster, then returned to Washington to complete her posting. On her return to New Zealand Manderson ran policing for a number of major events such as the 2012 visit of the Prince of Wales and Duchess of Cornwall, the 2015 ICC Cricket World Cup, the 2015 FIFA Under-20 World Cup and the World Masters Games, Lions tour and Rugby League World Cup in 2017. Manderson retired from the police force in January 2018 after a 40-year career. Recognition In the 1993 Queen's Birthday Honours, Manderson was awarded the Queen's Service Medal for public services. In 2015 she received an honorary Doctor of Laws from the University of Canterbury. References Living people New Zealand police officers University of Canterbury alumni Recipients of the Queen's Service Medal Year of birth missing (living people) People from Christchurch
The women's freestyle 72 kilograms is a competition featured at the 2011 World Wrestling Championships, and was held at the Sinan Erdem Dome in Istanbul, Turkey on 16 September 2011. This freestyle wrestling competition consists of a single-elimination tournament, with a repechage used to determine the winner of two bronze medals. Results Legend F — Won by fall Final Top half Bottom half Repechage References Results Book, Page 88 Women's freestyle 72 kg World
```smalltalk // // Test the generated API for common protocol support // // Authors: // Sebastien Pouliot <sebastien@xamarin.com> // // using System; using Foundation; using AppKit; using CoreImage; using NUnit.Framework; using Xamarin.Tests; namespace Introspection { [TestFixture] public class MacApiProtocolTest : ApiProtocolTest { protected override bool Skip (Type type) { #if !NET switch (type.Namespace) { case "Chip": // The Chip framework is not stable, it's been added and removed and added and removed a few times already, so just skip verifying the entire framework. // This is legacy Xamarin only, because we removed the framework for .NET. return true; } #endif switch (type.Name) { #if !NET case "NSDraggingInfo": return true; // Incorrectly bound (BaseType on protocol), will be fixed for .NET. #endif // special cases wrt sandboxing case "NSRemoteOpenPanel": case "NSRemoteSavePanel": return true; case "AVCaptureSynchronizedDataCollection": case "AVCaptureSynchronizedData": case "CXProvider": return TestRuntime.IsVM; // skip only on vms #if !NET // NSMenuView does not exist in .NET case "NSMenuView": // not longer supported return true; #endif // !NET case "ASAuthorizationProviderExtensionRegistrationHandler": return true; default: return base.Skip (type); } } protected override bool Skip (Type type, string protocolName) { switch (protocolName) { case "NSSecureCoding": switch (type.Name) { case "CNContactFormatter": // iOS declares but macOS header does not. Failure was missed :( case "NSCachedImageRep": // Not declared in header file case "NSCIImageRep": case "NSCustomImageRep": case "NSEPSImageRep": case "NSBitmapImageRep": case "NSImageRep": case "NSPdfImageRep": case "AVAssetTrackSegment": // Not declared in header file case "AVComposition": // Not declared in header file case "AVMutableComposition": // Not declared in header file case "AVCompositionTrackSegment": // Not declared in header file case "MKMapSnapshotOptions": // Not declared in header file case "NSTextTab": // Not declared in header file case "NSTextList": // Not declared in header file case "SFSafariPage": // Not declared in header file case "SFSafariPageProperties": // Not declared in header file case "SFSafariTab": // Not declared in header file case "SFSafariToolbarItem": // Not declared in header file case "SFSafariWindow": // Not declared in header file case "SFContentBlockerState": // Not declared in header file case "NEFlowMetaData": // Not declared in header file case "MKMapItem": // Not declared in header file case "CAConstraintLayoutManager": // Not declared in header file case "NSQueryGenerationToken": // Declared in header file but SupportsSecureCoding returns false - radar 32856944 case "NSPersistentHistoryToken": // Conformance not in headers case "NSPropertyDescription": // NSPropertyDescription and children does not declare in header file case "NSAttributeDescription": case "NSExpressionDescription": case "NSFetchedPropertyDescription": case "NSRelationshipDescription": case "NSEntityDescription": // Not declared in header file case "NSFetchIndexDescription": // Not declared in header file case "NSFetchIndexElementDescription": // Not declared in header file case "NSFetchRequest": // Not declared in header file case "NSManagedObjectModel": // Not declared in header file case "NSUserInterfaceCompressionOptions": // Not declared in header file // Xcode 10 (running on macOS 10.14) case "NSTextAlternatives": case "QTDataReference": // no header files anymore for deprecated QuickTime case "NSTextBlock": case "NSTextTable": case "NSTextTableBlock": // Xcode 11 (running on macOS 10.15) case "LAContext": // Conformance not in headers case "ICHandle": // Conformance not in headers case "ICNotification": // Conformance not in headers case "ICNotificationManagerConfiguration": // Conformance not in headers case "MKPolygon": // Conformance not in headers case "MLPredictionOptions": // Conformance not in headers case "NSUrlSessionTaskMetrics": // Conformance not in headers case "NSUrlSessionTaskTransactionMetrics": // Conformance not in headers case "NSFileProviderDomain": // Conformance not in headers case "FPUIActionExtensionContext": // Conformance not in headers return true; // macOS 10.15.2 case "NSPrintInfo": // Conformance not in headers case "NSPrinter": // Conformance not in headers return true; // Xcode 12.5 case "CXCall": // Conformance not in headers case "CXCallUpdate": // Conformance not in headers case "CXProviderConfiguration": // Conformance not in headers return true; // xcode 13 / macOS 12 case "OSLogEntry": case "OSLogEntryActivity": case "OSLogEntryBoundary": case "OSLogEntryLog": case "OSLogEntrySignpost": case "OSLogMessageComponent": case "NSImageSymbolConfiguration": case "NSMergePolicy": case "MEComposeSession": case "MEComposeContext": // xcode 14 case "SNClassifySoundRequest": case "PKInk": case "VSUserAccount": case "SCContentFilter": case "SCDisplay": case "SCRunningApplication": case "SCWindow": case "HKAudiogramSensitivityPoint": // xcode 15 case "NSCompositeAttributeDescription": case "CKSyncEnginePendingDatabaseChange": case "CKSyncEnginePendingRecordZoneChange": case "CKSyncEnginePendingZoneDelete": case "CKSyncEnginePendingZoneSave": case "CKSyncEngineState": case "NSCursor": return true; default: // CIFilter started implementing NSSecureCoding in 10.11 if (!Mac.CheckSystemVersion (10, 11) && (type == typeof (CIFilter) || type.IsSubclassOf (typeof (CIFilter)))) return true; break; } break; case "NSCopying": switch (type.Name) { case "WKPreferences": // Not declared in header file case "DomNodeFilter": // Not declared in header file case "MKDirectionsRequest": // Not declared in header file case "EKObject": // Not declared in header file case "EKCalendarItem": // Not declared in header file case "EKSource": // Not declared in header file case "EKCalendar": // Not declared in header file case "EKEvent": // Not declared in header file case "EKReminder": // Not declared in header file case "ACAccount": // Not declared in header file case "NEFlowMetaData": // Not declared in header file case "ACAccountCredential": // Not declared in header file // Xcode 11 (running on macOS 10.15) case "NSCollectionViewUpdateItem": // Not declared in header file case "MLPredictionOptions": // Not declared in header file case "FPUIActionExtensionContext": // Conformance not in headers // Xcode 12.5 case "CXCall": // Conformance not in headers return true; // xcode 13 / macOS 12 case "PHCloudIdentifier": case "NSMergePolicy": case "NSEntityMapping": case "NSMappingModel": case "NSPropertyMapping": case "HMAccessoryOwnershipToken": case "MEComposeSession": // xcode 14 case "SNClassifySoundRequest": case "SCContentFilter": case "SCDisplay": case "SCRunningApplication": case "SCStreamConfiguration": case "SCWindow": case "HKAudiogramSample": case "HKCategorySample": case "HKCdaDocumentSample": case "HKCorrelation": case "HKCumulativeQuantitySample": case "HKDiscreteQuantitySample": case "HKDocumentSample": case "HKElectrocardiogram": case "HKObject": case "HKQuantitySample": case "HKSample": case "HKWorkout": // xcode 15 case "MEMessage": case "CKSyncEnginePendingDatabaseChange": case "CKSyncEnginePendingRecordZoneChange": case "CKSyncEnginePendingZoneDelete": case "CKSyncEnginePendingZoneSave": case "PKContact": return true; } break; case "NSMutableCopying": switch (type.Name) { case "EKObject": // Not declared in header file case "EKCalendarItem": // Not declared in header file case "EKSource": // Not declared in header file case "EKStructuredLocation": // Not declared in header file case "EKAlarm": // Not declared in header file case "EKCalendar": // Not declared in header file case "EKEvent": // Not declared in header file case "EKParticipant": // Not declared in header file case "EKRecurrenceRule": // Not declared in header file case "EKReminder": // Not declared in header file case "INPerson": // Not declared in header file return true; // xcode 13 / macOS 12 case "NSMergePolicy": case "UNNotificationSettings": return true; } break; case "NSCoding": switch (type.Name) { case "EKObject": // Not declared in header file case "EKCalendarItem": // Not declared in header file case "EKSource": // Not declared in header file case "EKStructuredLocation": // Not declared in header file case "EKAlarm": // Not declared in header file case "EKCalendar": // Not declared in header file case "EKEvent": // Not declared in header file case "EKParticipant": // Not declared in header file case "EKRecurrenceRule": // Not declared in header file case "EKReminder": // Not declared in header file case "AVAssetTrackSegment": // Not declared in header file case "AVComposition": // Not declared in header file case "AVMutableComposition": // Not declared in header file case "AVCompositionTrackSegment": // Not declared in header file case "MKMapSnapshotOptions": // Not declared in header file case "SFContentBlockerState": // Not declared in header file case "SFSafariPage": // Not declared in header file case "SFSafariPageProperties": // Not declared in header file case "SFSafariTab": // Not declared in header file case "SFSafariToolbarItem": // Not declared in header file case "SFSafariWindow": // Not declared in header file case "NEFlowMetaData": // Not declared in header file case "MKMapItem": // Not declared in header file case "NSConstraintConflict": // Not declared in header file case "NSQueryGenerationToken": // Declared in header file but SupportsSecureCoding returns false - radar 32856944 case "NSPersistentHistoryToken": // Conformance not in headers // Xcode 10 (running on macOS 10.14) case "NSTextAlternatives": // Xcode 11 (running on macOS 10.15) case "ICHandle": // Conformance not in headers case "ICNotification": // Conformance not in headers case "ICNotificationManagerConfiguration": // Conformance not in headers case "LAContext": // Conformance not in headers case "MKPolygon": // Conformance not in headers case "MLPredictionOptions": // Conformance not in headers case "NSUrlSessionTaskMetrics": // Conformance not in headers case "NSUrlSessionTaskTransactionMetrics": // Conformance not in headers case "NSFileProviderDomain": // Conformance not in headers case "FPUIActionExtensionContext": // Conformance not in headers // Xcode 12.5 case "CXCall": // Conformance not in headers case "CXCallUpdate": // Conformance not in headers case "CXProviderConfiguration": // Conformance not in headers return true; // xcode 13 / macOS 12 case "OSLogEntry": case "OSLogEntryActivity": case "OSLogEntryBoundary": case "OSLogEntryLog": case "OSLogEntrySignpost": case "OSLogMessageComponent": case "NSImageSymbolConfiguration": case "NSMergePolicy": case "MEComposeContext": // xcode 14 case "SNClassifySoundRequest": case "PKInk": case "VSUserAccount": case "SCContentFilter": case "SCDisplay": case "SCRunningApplication": case "SCWindow": case "HKAudiogramSensitivityPoint": // xcode 15 case "CKSyncEnginePendingDatabaseChange": case "CKSyncEnginePendingRecordZoneChange": case "CKSyncEnginePendingZoneDelete": case "CKSyncEnginePendingZoneSave": case "CKSyncEngineState": return true; } break; case "NSWindowRestoration": switch (type.Name) { case "NSDocumentController": // There's a category that implements the NSWindowRestoration protocol for NSDocumentController, // but that apparently doesn't make conformsToProtocol: return true. // '@interface NSDocumentController (NSWindowRestoration) <NSWindowRestoration>' return true; } break; case "NSUserInterfaceItemIdentification": // NSViewController started implementing NSUserInterfaceItemIdentification in 10.10 if (!Mac.CheckSystemVersion (10, 10) && (type == typeof (NSViewController) || type.IsSubclassOf (typeof (NSViewController)))) return true; switch (type.Name) { case "NSMenuItem": if (!Mac.CheckSystemVersion (10, 12)) return true; break; } break; case "NSMenuDelegate": switch (type.Name) { case "PdfView": if (!Mac.CheckSystemVersion (10, 10)) return true; break; } break; case "NSTextFinderClient": // Not listed in header, nor conformsToProtocol, but works in sample. But it just repondsToSelectors if (type.Name == "NSTextView") return true; break; #if !NET case "NSDraggingInfo": return true; // We have to keep the type to maintain backwards compatibility. #endif case "NSAccessibility": case "NSAccessibilityElement": switch (type.Name) { case "NSMenu": case "NSMenuItem": if (!Mac.CheckSystemVersion (10, 12)) return true; break; } break; case "NSAnimationDelegate": case "NSAnimatablePropertyContainer": switch (type.Name) { case "NSTitlebarAccessoryViewController": return true; } break; case "NSCandidateListTouchBarItemDelegate": case "NSTouchBarDelegate": switch (type.Name) { case "NSTextView": return true; } break; case "NSExtensionRequestHandling": return IntPtr.Size == 4; case "NSAppearanceCustomization": switch (type.Name) { case "NSPopover": if (!Mac.CheckSystemVersion (10, 13) || IntPtr.Size == 4) // Was added in 10.13 return true; break; case "NSApplication": if (!Mac.CheckSystemVersion (10, 14)) // Was added in 10.14 return true; break; case "NSMenu": if (!Mac.CheckSystemVersion (11, 0)) return true; break; } break; case "NSUserInterfaceValidations": switch (type.Name) { case "NSSplitViewController": if (!Mac.CheckSystemVersion (10, 13)) // Was added in 10.13 return true; break; } break; case "NSItemProviderWriting": switch (type.Name) { case "NSMutableString": case "NSString": case "NSUrl": if (IntPtr.Size == 4) // Only on 64-bit version of these types return true; break; } break; case "CAAction": switch (type.Name) { case "NSNull": if (!Mac.CheckSystemVersion (10, 11)) // NSNull started implementing the CAAction protocol in 10.11 return true; break; } break; case "NSTextContent": switch (type.Name) { case "NSTextField": case "NSTextView": case "NSTokenField": case "NSComboBox": case "NSSearchField": case "NSSecureTextField": if (!Mac.CheckSystemVersion (11, 0)) return true; break; } break; } switch (type.Name) { #if !XAMCORE_3_0 case "NSRemoteSavePanel": case "NSRemoteOpenPanel": return true; // These two classes don't show up in any documentation. #endif } switch (type.Namespace) { case "MonoMac.SceneKit": case "SceneKit": // skip on 32 bits but continue otherwise if (IntPtr.Size == 4) return true; break; } return base.Skip (type, protocolName); } [Test] public override void SecureCoding () { if (!Mac.CheckSystemVersion (10, 8)) return; base.SecureCoding (); } [Test] public override void SupportsSecureCoding () { if (!Mac.CheckSystemVersion (10, 8)) return; base.SupportsSecureCoding (); } } } ```
Responsibility for the Holocaust is the subject of an ongoing historical debate that has spanned several decades. The debate about the origins of the Holocaust is known as functionalism versus intentionalism. Intentionalists such as Lucy Dawidowicz argue that Adolf Hitler planned the extermination of the Jewish people as early as 1918, and personally oversaw its execution. However, functionalists such as Raul Hilberg argue that the extermination plans evolved in stages, as a result of initiatives that were taken by bureaucrats in response to other policy failures. To a large degree, the debate has been settled by acknowledgement of both centralized planning and decentralized attitudes and choices. The primary responsibility for the Holocaust rests on Hitler and the Nazi Party leadership, but operations to persecute Jews, Romani people, homosexuals and others were also perpetrated by the Schutzstaffel (SS), the Wehrmacht, and ordinary German citizens as well as by collaborationist members of various European governments, including their soldiers and civilians. A host of factors contributed to the environment in which atrocities were committed across the continent, ranging from general racism (including antisemitism), religious hatred, blind obedience, apathy, political opportunism, coercion, profiteering, and xenophobia. Historical and philosophical interpretations The enormity of the Holocaust has prompted much analysis. The Holocaust has been characterized as a project of industrial extermination. This led authors such as Enzo Traverso to argue in The Origins of Nazi Violence that Auschwitz was explicitly a product of Western civilization originating from medieval religious and racial persecution that brought together a "particular kind of stigmatization...rethought in the light of colonial wars and genocides." Beginning his book with a description of the guillotine, which according to him marks the entry of the Industrial Revolution into capital punishment, he writes: "Through an irony of history, the theories of Frederick Taylor" (taylorism) were applied by a totalitarian system to serve "not production, but extermination." Others like Russell Jacoby contend that the Holocaust is a product of German history with deep roots in German society ranging from, "German authoritarianism, feeble liberalism, brash nationalism or virulent antisemitism. From A. J. P. Taylor's The Course of German History fifty-five years ago to Daniel Goldhagen's controversial work, Hitler's Willing Executioners, Nazism is understood as the outcome of a long history of uniquely German traits". While some claim that the specificity of the Holocaust was also rooted in the constant antisemitism from which Jews had been the target since the foundation of Christianity, intellectual historian George Mosse argued that the extreme form of European racism that led to the Holocaust fully emerged in the eighteenth century. Others argue that pseudo-scientific racist theories were elaborated upon in order to justify white supremacy and that they were accompanied by the Darwinian belief in the survival of the fittest and eugenic notions of racial hygiene—particularly within the German scientific community. Authorization The question of overall responsibility for the atrocities committed under the Nazi regime traverses the oligarchy of those in command, foremost among them Adolf Hitler. In October 1939, he authorized the first Nazi mass killing for those labeled "undesirables" in the T-4 Euthanasia Program. The Nazis termed such people as being "Lives unworthy of life." or lebensunwertes Leben in German. Before the euthanasia program in Germany-proper was over, the Nazis killed between 65,000–70,000 persons. Historian Henry Friedlander calls this period during which the 70,000 adults were killed, the "first phase" of the T4 Program since the program and its contributors precipitated the Holocaust. Sometime between late June 1940 when planning for Operation Barbarossa first started and March 1941, orders were approved by Hitler for the re-establishment of the Einsatzgruppen (the surviving historical record does not permit firm conclusions to be drawn about the precise date). Hitler encouraged the killings of the Jews of Eastern Europe by the Einsatzgruppen death squads in a speech of July 1941. Evidence suggests that in the fall of 1941, Reichsführer-SS Heinrich Himmler and Hitler agreed in principle on the complete mass extermination of the Jews of Europe by gassing, with Hitler explicitly ordering the "annihilation of the Jews" in a speech on 12 December 1941, by which time the Jewish populations in the Baltic states had been effectively eliminated. To make for smoother intra-governmental cooperation in the implementation of this so-called "Final Solution to the Jewish Question", the Wannsee conference was held near Berlin on 20 January 1942, with the participation of fifteen senior officials, led by Reinhard Heydrich and Adolf Eichmann; the records of which provide the best evidence of the central planning of the Holocaust. Just five weeks later on 22 February, Hitler was recorded saying to his closest associates: "We shall regain our health only by eliminating the Jew." Allied knowledge of the atrocities Upwards of 300 Jewish organizations attempted to provide information to U.S. President Franklin Roosevelt about the persecution of Jews in Europe, but the ethnic and cultural diversity of American immigrant Jewish communities and their comparative lack of political power in the U.S. hindered their ability to influence policy. Various strategies, such as ransoming Jews following the Anschluss of 1938, failed for a host of reasons, not to exclude the unwillingness and inability of Jewish communities in the U.S. to extend financial aid to their suffering brethren. Clear evidence exists that Winston Churchill was privy to intelligence reports derived from decoded German transmissions in August 1941, during which he stated: During the early years of the war, the Polish government-in-exile published documents and organised meetings to spread the word about the fate of Jews (see Witold Pilecki's Report). In the summer of 1942, a Jewish labor organization (the Bund) leader, Leon Feiner got word to London that 700,000 Polish Jews had already been murdered. The Daily Telegraph published it on 25 June 1942, and the BBC took the story seriously, though the U.S. State Department doubted it. On 10 August 1942, the Riegner Telegram to New York described the Nazi plan to murder all the Jews in the occupied states by deporting them to concentration camps in the east, to be exterminated in one blow, possibly by prussic acid, starting at autumn 1942. It was released in the United States by Stephen Wise of the World Jewish Congress in November 1942 after a long wait for permission from the government. This led to attempts by Jewish organizations to put President Roosevelt under pressure to act on behalf of the European Jews, many of whom had tried in vain to enter either Britain or the U.S. Reports were also coming into Palestine about the German atrocities during the autumn of 1942. The allies received a detailed eyewitness account from Polish resistance fighter and later Georgetown University professor, Jan Karski. On 10 December 1942, the Polish government-in-exile published a 16-page report addressed to the Allied governments, titled The Mass Extermination of Jews in German Occupied Poland. On 17 December 1942, as the answer to Raczyński's Note, the Allies issued the Joint Declaration by Members of the United Nations, a formal declaration confirming and condemning Nazi extermination policy toward the Jews and describing the ongoing events of the Holocaust in Nazi-occupied Europe. The statement was read to British House of Commons in a floor speech by Foreign secretary Anthony Eden. The death camps were discussed between American and British officials at the Bermuda Conference in April 1943. On 12 May 1943, Polish government-in-exile member and Bund leader Szmul Zygielbojm committed suicide in London to protest the inaction of the world with regard to the Holocaust, stating in part in his suicide letter: The large camps near Auschwitz were finally surveyed by plane in April 1944. While all important German cities and production centers were bombed by Allied forces until the end of the war, no attempt was made to interdict the system of mass annihilation by destroying pertinent structures or train tracks, even though Churchill was a proponent of bombing parts of the Auschwitz complex. The US State Department was aware of the use and the location of the gas chambers of extermination camps but refused to bomb them. Significant debate continues among historians about the decision. Throughout and after the war, the British government pressed leaders of European nations to prevent illegal Jewish immigration into Palestine and sent ships to block the sea-route to Palestine, turning back many Jewish refugees found attempting to illegally enter the region. German people The debate continues on how much average Germans knew about the Holocaust. Robert Gellately, a historian at Oxford University, conducted a widely respected survey of the German media before and during the war and concluded that there was substantial participation and consent from large numbers of ordinary Germans in various aspects of the Holocaust, that German civilians frequently saw columns of slave laborers, and that the basics of the concentration camps, if not the extermination camps, were widely known. The German scholar, Peter Longerich, in a study looking at what Germans knew about the mass murders concluded that: "General information concerning the mass murder of Jews was widespread in the German population." Longerich estimates that before the war ended, 32 to 40 percent of the population had knowledge about mass killings (not necessarily the extermination camps). British historian Nicholas Stargardt presents evidence of widespread public knowledge, agreement, and collusion concerning the destruction of European Jewry, as well of the insane, feeble, disabled, Poles, Roma, and other nationals. His evidence includes speeches by Nazi leaders, which were broadcast or heard by a wide audience that included mention or inferences related to destroying the Jews, along with letters written between soldiers and their families describing the slaughter. Historian Claudia Koonz relates how reports from the Nazi security service (SD) described the public opinion as favorable where it concerned the killing of Jews. Using these same SD reports from the war years, along with a great many memoirs, diaries, and other descriptive material, historian Lawrence D. Stokes concluded that much, although not all, of the terror inflicted on the Jewish people was generally understood in the German public. Marlis Steinert came to an opposite conclusion through her own studies, contending that only a few were aware of the immense scale of the atrocities. French historian, Christian Ingrao, reminds readers that one must take into consideration the possible extent to which SD reports were manipulated by the Nazi propaganda machine when reviewing them. Historian Helmut Walser Smith remarks of the German people: "They were hardly indifferent to it; the responses range from outrage to affirmation to worry, especially toward the end of the war, when anxiety about accountability increased. That their imagination did not press to the particulars is not astounding. Nor is it astounding that few failed to imagine Auschwitz. The idea that not the killers go to the Jews, but the Jews are delivered up to industrial killing centers—this, in fact, was without historical precedent." Historian Eric A. Johnson and sociologist Karl-Heinz Reuband conducted interviews with more than 3,000 Germans and 500 German Jews about daily life in the Third Reich. From the Jewish questionnaires, the authors found that German society was not nearly as rife with antisemitism as one might otherwise have believed, but this changed dramatically with Hitler's ascension to power. German Jews claimed that they knew of the Holocaust from a wide range of sources, which included radio broadcasts from Italy and what they heard from friends or acquaintances, but they did not know details until 1943. Responses from non-Jewish Germans indicate that "the majority of Germans identified with the Nazi regime." Contrary to many other accounts and/or historical interpretations, which portray rule under the Nazis as terrifying for German citizens, most of the German respondents who participated in the interviews stated that they never really feared arrest from the Gestapo. Concerning the mass murder of the Jews, the survey results were contingent to some degree on geography, but roughly 27–29% of Germans had information about the Holocaust at some point before the war's end, and another 10–13% suspected something terrible was happening all along. Based on this information, Johnson and Reuband surmise that one-in-three Germans either heard or knew that the Holocaust was taking place before the end of the war from sources that included family members, friends, neighbors or professional colleagues. Johnson suggests (in disagreement with his co-author) that it is more likely that about 50% of the German population were aware of the atrocities being committed against the Jewish people and other enemies identified by the Nazi regime. During the years 1945 through 1949, polls indicated that a majority of Germans felt that Nazism was a "good idea, badly applied". In a poll conducted in the American German occupation zone, 37% replied that 'the extermination of the Jews and Poles and other non-Aryans was necessary for the security of Germans'. Sarah Ann Gordon in Hitler, Germans, and the Jewish Question notes that the surveys are very difficult to draw conclusions from as respondents were given only three options from which to choose: (1) Hitler was right in his treatment of the Jews, to which 0% agreed; (2) Hitler went too far in his treatment of the Jews, but something had to be done to keep them in bounds - 19% agreed; and (3) The actions against the Jews were in no way justified - 77% agreed. She also noted that another revealing example emerges from the question of whether an Aryan who marries a Jew should be condemned, a question to which 91% of the respondents answered "No". To the question: "All those who ordered the murder of civilians or participated in the murders should be made to stand trial", 94% responded "Yes". Historian Tony Judt highlights how denazification and the subsequent fear of retribution from the Allies likely obscured justice due to some of the perpetrators and camouflaged underlying societal truths. Public recollection from Germans about the atrocities was also "marginalized by postwar reconstruction and diplomacy" according to historian Nicholas Wachsmann; a delay, which obscured the complexities of understanding both the Holocaust and the concentration camps that aided in its facilitation. Wachsmann notes how the German people often claimed that the crimes occurred behind their backs and were perpetrated by Nazi fanatics, or that they frequently dodged responsibility by equating their suffering with that of the prisoners, avowing they too had been victimized by the National Socialist regime. Initially the memory of the Holocaust was repressed and set aside, but eventually, the young Federal Republic of Germany commenced its own investigations and trials. Political pressure on the prosecutors and judges tempered any extensive probes and very few systematic investigations in the first decade after the war took place. Later research efforts in Germany revealed that there were a "myriad" of links between the wider population and the SS camps. In Austria—once part of the Greater German Reich of the Nazis—the situation was much different, as they conveniently evaded accountability through the trope of being the Nazis' first foreign victim. Implementation During the perpetration of the Holocaust, participants came from all over Europe but the impetus for the pogroms was provided by German and Austrian Nazis. According to Holocaust historian, Raul Hilberg, the "anti-Jewish work" of the regime was "carried out in the civil service, the military, business, and the party" where "every specialization was utilized" and "every stratum of society was represented in the envelopment of the victims." Sobibor death camp guard Werner Dubois stated: In an entry in the Friedrich Kellner diary, "My Opposition", dated 28 October 1941, the German justice inspector recorded a conversation he had in Laubach with a German soldier who had witnessed a massacre in Poland. French officials at the Parisian branch of the Barclays Bank volunteered the names of their Jewish employees to Nazi authorities, and many of them ended up in the death camps. An insightful perspective is provided by Konnilyn G. Feig, who wrote: Additional scholars also point out that a wide range of German soldiers, officials, and civilians were in some way involved in the Holocaust, from clerks and officials in the government to units of the army, police, and the SS. Many ministries, including those of armaments, interior, justice, railroads, and foreign affairs, had substantial roles in orchestrating the Holocaust; similarly, German physicians participated in medical experiments and the T-4 euthanasia program as did civil servants; German physicians also made the selections as to who was fit to work and who would die at the concentration camps. Though there was no single department in charge of the Holocaust, the SS and Waffen-SS under Himmler had a leading role and operated with military efficiency in murdering enemies of the Nazi state. From the SS came the SS-Totenkopfverbände concentration camp guard units, the Einsatzgruppen killing squads, and the main administrative offices behind the Holocaust, including the RSHA and WVHA. The regular army participated in the atrocities along with the SS on some occasions by taking part in the massacre of Jews in the Soviet Union, Serbia, Poland, and Greece. The German Army also logistically supported the Einsatzgruppen, helped form the ghettos, ran prison camps, occasionally provided concentration camp guards, transported prisoners to camps, had medical experiments performed on prisoners, and substantially used slave labor. Significant numbers of Wehrmacht soldiers accompanied the SS in their deadly tasks or provided other forms of support for killing operations. The murders by the Einsatzgruppen required cooperation between the Einsatzgruppen chief and Wehrmacht unit commander so they could coordinate and control access to and from the execution grounds. Obedience Stanley Milgram was one of a number of post-war psychologists and sociologists who tried to address why people obeyed immoral orders in the Holocaust. Milgram's findings demonstrated that reasonable people, when instructed by a person in a position of authority, obeyed commands entailing what they believed to be the suffering of others. After making his results public, Milgram sparked a direct critical response in the scientific community by claiming that "a common psychological process is centrally involved in both" his laboratory experiments and the Holocaust. Professor James Waller, Chair of Holocaust and Genocide Studies at Keene State College, formerly Chair of Whitworth College Psychology Department, expressed the opinion that Milgram experiments "do not correspond well" to the Holocaust events: The subjects of Milgram's experiments were assured in advance that "no permanent physical damage would result from their actions." However, the Holocaust perpetrators were fully aware of their hands-on killing and maiming of the victims. Milgram's guards did not know their victims and were not motivated by racism. On the other hand, the Holocaust perpetrators displayed an "intense devaluation of the victims" through a lifetime of personal development. The subjects were not selected for sadism or loyalty to Nazi ideology, and often "exhibited great anguish and conflict" in the experiment, unlike the designers and executioners of the Final Solution (see Holocaust trials), who had a clear "goal" on their hands, set beforehand. The experiment lasted for an hour, insufficient time for participants to consider the moral implications of their actions. Meanwhile, the Holocaust lasted for years with ample time for a moral assessment of all individuals and organizations involved. In the opinion of Thomas Blass—who is the author of a scholarly monograph on the experiment (The Man Who Shocked The World) published in 2004—the historical evidence pertaining to actions of the Holocaust perpetrators speaks louder than words: Religious hatred and racism Throughout the Middle Ages in Europe, Jews were subjected to antisemitism based on Christian theology, which blamed them for rejecting and killing Jesus. Numerous attempts were made by early Christians to convert the Jews to Christianity in the collective, but when they refused, this made them "pariahs" in the eyes of many Europeans. The consequences which they suffered for resisting conversion to Christianity were varied. An extensive series of attacks was committed against Jews as a result of the religious fervor which accompanied the First and Second Crusades (1095–1149). Jews were slaughtered in the wake of the Italian famine (1315–1317), attacked following the outbreak of the Black Death in the Rhineland in 1347, expelled from both England and Italy in the 1290s, from France in 1306 and 1394, from Spain and Portugal in 1492 and 1497. By the time of the Reformation in the 16th century, historian Peter Hayes stresses that "hatred of Jews was widespread" throughout Europe. Martin Luther (a German leader of the Protestant Reformation) made a specific written call for harsh persecution of the Jewish people in On the Jews and Their Lies, published in 1543. In it, he urged that Jewish synagogues and schools be set on fire, prayer books destroyed, rabbis forbidden to preach, homes razed, and property and money confiscated. Luther argued that Jews should be shown no mercy or kindness, should have no legal protection and that these "poisonous envenomed worms" should be drafted into forced labor or expelled for all time. American historian Lucy Dawidowicz asserted in her book The War Against the Jews that a clear path of antisemitism passes from Luther to Hitler and that "modern German anti-Semitism is the bastard child of Christian anti-Semitism and German nationalism." Even after the Reformation, Catholics and Lutherans continued to persecute Jews, accusing them of blood libels and subjecting them to pogroms and expulsions. The second half of the 19th century saw the emergence of the Völkisch movement in Germany and Austria-Hungary, which was developed and incentivized by authors like Houston Stewart Chamberlain and Paul de Lagarde. The movement presented a pseudo-scientific, biologically based form of racism that viewed Jews as a race whose members were locked in mortal combat with the Aryan race for world domination. Some authors, such as liberal philosopher Hannah Arendt in The Origins of Totalitarianism (1951), Swedish writer Sven Lindqvist, historian Hajo Holborn, and Ugandan academic Mahmood Mandani, have also linked the Holocaust to colonialism, but moreover, place the tragedy into the context of the European tradition of antisemitism and the genocide of colonized peoples. Arendt claimed for instance that nationalism and imperialism were literally bridged together by racism. Pseudo-scientific theories elaborated upon during the 19th century (e.g. Arthur de Gobineau's 1853 Essay on the Inequality of the Human Races) were fundamental in preparing the conditions for the Holocaust according to some scholars. While other historical episodes of wholesale slaughter exist, there are still scholars who remain adamant about the "uniqueness" of the Holocaust, as compared to other genocides. Philosopher Michel Foucault also traced the origins of the Holocaust to "racial policies" and "state racism", which are subsumed within the framework of "biopolitics". The Nazis considered it their duty to overcome natural compassion and execute orders for what they believed to be higher ideals; members of the SS, in particular, perceived that they had a state-legitimized mandate and obligation to eliminate those perceived as racial enemies. Some of the heinous acts committed by the Nazis have been attributed to crowd psychology, and Gustave Le Bon's The Crowd: A Study of the Popular Mind (1895) provided influence to Hitler's infamous tome, Mein Kampf. Le Bon claimed that Hitler and the Nazis used propaganda to deliberately shape group-think and related behaviors, especially in cases where people committed otherwise aberrant violent acts due to the anonymity resultant from being a member of the collective. Sadistic acts of this sort were notable in the case of the genocide committed by members of the Croatian Ustashe, whose enthusiasm and sadism in their killings of Serbs appalled the Italians and Germans to the point that the German Army field police "moved in and disarmed them" at one point. One might describe the behavior of the Croatians as a sort of quasi-religious eliminationist opportunism, but this same thing might be said of the Germans, whose antisemitism was likewise religious and racialist in nomenclature. A controversy erupted in 1997 when historian Daniel Goldhagen argued in Hitler's Willing Executioners that ordinary Germans were knowing and willing participants in the Holocaust, which he writes, had its roots in a deep racially motivated eliminationist antisemitism that was uniquely manifested in German society. Historians who disagree with Goldhagen's thesis argue that, while antisemitism undeniably existed in Germany, Goldhagen's idea of a uniquely German "eliminationist" version is untenable. In complete contrast to Goldhagen's position, historian Johann Chapoutot observes, Culturally speaking, the Nazi ideology advanced by the NSDAP contained only an infinitesimal number of ideas that were genuinely German in origin. Racism, colonialism, anti-Semitism, social Darwinism, and eugenics did not originate between the Rhine and the Memel. Practically speaking, we know the Shoah would have been considerably less murderous if French and Hungarian police forces—not to mention Baltic nationalists, Ukrainian volunteer forces, Polish anti-Semites, and collaborationist politicians, to name only a few—had not supported it so fully and so swiftly: whether or not they knew where the convoys were headed, they were more than happy to rid themselves of their Jewish populations. Functionalism versus intentionalism A major issue in contemporary Holocaust studies is the question of functionalism versus intentionalism. The terms were coined during the Cumberland Lodge Conference in May 1979 which was entitled, "The National Socialist Regime and German Society" by the British Marxist historian Timothy Mason in order to describe two schools of thought about the origins of the Holocaust. Intentionalists hold the view that the Holocaust was the result of a long-term master plan on the part of Hitler, and they also believe that he was the driving force behind it. However, functionalists hold the view that Hitler did not have a master plan for genocide and based on this view, they see the Holocaust as coming from the ranks of the German bureaucracy, with little or no involvement on the part of Hitler. Within the content of Hitler biographies which were written by Joachim Fest and Alan Bullock, one encounters a "Hitler-centric explanation for genocide" even though other psycho-historians like Rudolph Binion, Walter Langer, and Robert Waite raised issues about Hitler's ability to make rational decisions; nonetheless, his antisemitism remained unquestioned, the latter authors merely juxtaposed it against his general mental health. Historian and intentionalist Lucy Dawidowicz argued that the Holocaust was planned by Hitler from the very beginning of his political career, which can be traced back to his traumatic experience at the end of the First World War. Other intentionalists, such as Andreas Hillgruber, Karl Dietrich Bracher, and Klaus Hildebrand, have suggested that Hitler had decided upon the Holocaust sometime in the early 1920s. Historian Eberhard Jäckel postulates that the extermination order placed upon the Jews may have occurred during the summer of 1940. Another intentionalist historian, the American Arno J. Mayer, argued that Hitler first ordered the mass murder of the Jews in December 1941, due principally to the failed Blitzkrieg against the Soviet Union. Saul Friedländer has argued that Hitler was an extreme antisemite early on and drove Nazi policy to exterminate the Jews, but he also recognizes the technocratic rationality of the regime that helped bring Hitler's ideological goals to fruition. While others, like Gerhard Weinberg, remain in the intentionalist camp and see Hitler's part as essential to the unfolding of the Final Solution—he also points out the importance of Nazi ideological imperatives such as the Wannsee Conference, and like many scholars, demonstrates that there is still "much to be discovered and learned." Functionalists such as Hans Mommsen, Martin Broszat, Götz Aly, Raul Hilberg, and Christopher Browning hold that the Holocaust was started in 1941–1942 either as a result of the failure of the Nazi deportation policy and/or the impending military losses in Russia. Functionalists contend that what some see as extermination fantasies outlined in Hitler's Mein Kampf and other Nazi literature were simply propaganda and did not constitute concrete plans. In Mein Kampf, Hitler repeatedly states his inexorable hatred of the Jewish people, but nowhere does he proclaim his intention to exterminate them. They also argue that, in the 1930s, Nazi policy aimed at making life so unpleasant for German Jews that they would leave Germany. Adolf Eichmann was in charge of facilitating Jewish emigration by whatever means possible from 1937 until 23 October 1941, when German Jews were forbidden to leave. Functionalists see the SS's support in the late 1930s for Zionist groups as the preferred solution to the "Jewish Question" as another sign that there was no masterplan for genocide. Essentially the view of functionalists concerning the Holocaust is that it came about via improvisation as opposed to deliberate planning. To that end, functionalists argue that, in German documents from 1939 to 1941, the term "Final Solution to the Jewish Question" was meant to be a "territorial solution"; that is, the entire Jewish population was to be expelled somewhere far from Germany. At first, the SS planned to create a gigantic Jewish reservation in the Lublin, Poland area, but the so-called "Lublin Plan" was vetoed by Hans Frank, the Governor-General of occupied Poland, who refused to allow the SS to ship any more Jews to the Lublin area after November 1939. The reason Frank vetoed the "Lublin Plan" was not due to any humane motives, but rather because he was opposed to the SS "dumping" Jews into the Government-General. In 1940, the SS and the German Foreign Office had the so-called "Madagascar Plan" to deport the entire Jewish population of Europe to a "reservation" on Madagascar. The "Madagascar Plan" was canceled because Germany could not defeat the United Kingdom and until their blockade of Nazi-occupied Europe was broken, the "Madagascar Plan" could not be put into effect. Finally, functionalist historians have made much of a memorandum written by Himmler in May 1940 explicitly rejecting extermination of the entire peoples as "un-German" and recommending to Hitler instead, the "Madagascar Plan" as the preferred "territorial solution" to the "Jewish Question". Not until July 1941 did the term "Final Solution to the Jewish Question" come to mean extermination. Recently, a synthesis of the two schools has emerged that has been championed by diverse historians such as the Canadian historian Michael Marrus, the Israeli historian Yehuda Bauer, and the British historian Ian Kershaw that contends Hitler was the driving force behind the Holocaust, but that he did not have a long-term plan and that much of the initiative for the Holocaust came from below in an effort to meet Hitler's perceived wishes. As historian Omer Bartov relates, "the "intentionalists" and "functionalists" have gradually come closer, as further research now seems to indicate that the more extreme new interpretations are just as impossible to sustain as the traditional ones." Involved Adolf Hitler Most historians take the view that Hitler was the opposite of a pragmatist: his overriding obsession was hatred of the Jews, and he showed on a number of occasions that he was willing to risk losing the war to achieve their destruction. There is no "smoking gun" in the form of a document that shows Hitler ordering the Final Solution. Hitler did not have a bureaucratic mind and many of his most important instructions were given orally. There is ample documentary evidence, however, that Hitler desired to eradicate Jewry and that the order to do so originated from him, including the authorization for mass deportations of the Jews to the east beginning in October 1941. He cannot have imagined that these hundreds of thousands of Jews would be housed, clothed, and fed by the authorities of the Government-General, and in fact Hans Frank frequently complained that he could not cope with the influx. Historian Paul Johnson writes that some writers, such as David Irving, have claimed that because there were no written orders, "the Final Solution was Himmler's work and [...] Hitler not only did not order it but did not even know it was happening". Johnson states, however, that "this argument will not stand up. The administration of the Third Reich was often chaotic but its central principle was clear enough: all key decisions emanated from Hitler." According to Kershaw, "Hitler's authority—most probably given as verbal consent to propositions usually put to him by Himmler—stood behind every decision of magnitude and significance." Hitler continued to be closely involved in the "Final Solution". Kershaw also points out that, "in the wake of the German military crisis following the catastrophe at Stalingrad" that "Hitler took a direct hand" in convincing his Hungarian and Romanian allies to "sharpen the persecution" of the Jews. Hitler's role in the Final Solution was often indirect rather than overt, frequently granting approval rather than initiating. The unparalleled outpourings of hatred were a constant even amid all the policy shifts of the Nazis. They often had propaganda or mobilizing motives, and usually remained generalized. Even so, Kershaw remains adamant that Hitler's role was decisive and indispensable in the unfolding of the "Final Solution". In the following widely cited speech made on 30 January 1939, Hitler gave a speech to the Reichstag which included the statement: On 30 January 1942 at the Sports Palace in Berlin, Hitler told the crowd: According to historian Klaus Hildebrand, moral responsibility for the Holocaust resides with Hitler and was nothing less than the culmination of his pathological hatred of the Jews, which for all intents and purposes formed the basis of Nazi genocide and drove the regime to pursue its racial-eliminationist goals. Whether or not Hitler gave a direct order for the implementation of the Final Solution is immaterial and nothing more than a red herring, which fails to recognize Hitler's leadership style, particularly since his verbal commands were sufficient to launch initiatives—due largely to the fact that his subordinates were always "working towards the Führer" in an effort to implement "his totalitarian vision" even in cases "without written authority." Throughout Gerald Fleming's notable work, Hitler and the Final Solution, he demonstrates that on numerous occasions, Himmler mentioned a "Führer-Order" concerning the annihilation of the Jews, which indicates that at the very least, Hitler verbally issued a command on the subject. Journal entries from Propaganda Minister Joseph Goebbels support the position that Hitler was the driving force behind the destruction of the Jews as well; Goebbels wrote that Hitler followed the subject closely and described the Führer as "uncompromising" about eliminating the Jews. As historian David Welch asserts, if one takes the scale of the logistical operations that the Holocaust comprised (in the middle of a worldwide war) into consideration alone, it is nearly impossible that the extermination of so many people and the coordination of such an extensive effort could have occurred without Hitler's authorization. Other Nazi leaders While significant numbers of Germans and other Europeans collectively participated in the Holocaust, it was Hitler and his Nazi followers who share the greatest responsibility for incentivizing, coercing, and/or overseeing the extermination of millions of people. Among those most responsible for the Final Solution were Heinrich Himmler, Reinhard Heydrich, Adolf Eichmann, Odilo Globocnik, Ernst Kaltenbrunner, Heinrich Müller, Theodor Eicke, Richard Glücks, Friedrich Jeckeln, Friedrich-Wilhelm Krüger, Rudolf Höss, Christian Wirth, and Oswald Pohl. Key roles were also played by Fritz Sauckel, Hans Frank, Wilhelm Frick and Robert Ley. Other top Nazi leaders such as Joseph Goebbels, Hermann Göring, and Martin Bormann contributed in various ways, whether administratively supporting killing efforts or providing ideological fodder to encourage the Holocaust. For example, Goebbels carried on an intensive antisemitic propaganda campaign and also had frequent discussions with Hitler about the fate of the Jews. He was aware throughout that the Jews were being exterminated, and completely supported this decision. In July 1941, Göring issued a memo to Heydrich ordering him to organise the practical details of a solution to the "Jewish Question". This led to the Wannsee Conference held on 20 January 1942, where Heydrich formally announced that genocide of the Jews of Europe was now an official Reich policy. That same year, Bormann signed the decree of 9 October 1942 prescribing that the permanent Final Solution in Greater Germany could no longer be solved by emigration, but only by the use of "ruthless force in the special camps of the East", that is, extermination in Nazi death camps. Although the Nazi regime is often depicted as a super-centralized vertically hierarchical state, individual initiative was an important element in how Nazi Germany functioned. Millions of people were rounded up, bureaucratically processed and transported across Europe due to the vigorous initiative of those Nazis most committed to carrying out their duties to the state, an operation involving thousands of officials and a great deal of paperwork. This was a coordinated effort among the SS and its sprawling police apparatus with the Reich ministries and the national railways, all under the supervision of the Nazi Party. Most of the Party's regional leaders (Gauleiters) also knew of the Holocaust since many were present for Himmler's October 1943 speech at Posen, during which he explicitly mentioned the extermination of the Jews. German military The extent to which the officers of the regular German military knew of the Final Solution has been much debated. Political imperatives in postwar Germany led to the army being generally absolved from responsibility, apart from the handful of "Nazi generals" such as Alfred Jodl and Wilhelm Keitel who were tried and hanged at Nuremberg. There is an abundance of evidence, however, that the top officers of the Wehrmacht certainly knew about the murders and in a number of instances, approved and/or sanctioned them. The exhibit "War of Extermination: The Crimes of the Wehrmacht" showed the extent to which the military was involved in the Holocaust. It was particularly difficult for commanders on the eastern front to avoid knowing what was happening in the areas behind the front. Many individual soldiers photographed the massacres of Jews by the Einsatzgruppen. Some generals and officers, such as Walther von Reichenau, Erich Hoepner, and Erich von Manstein, actively supported the work of the Einsatzgruppen. A number of Wehrmacht units provided direct or indirect assistance to the Einsatzgruppen—all the while mentally normalizing amoral behaviors in the conduct of war through specious justification that they were destroying the Reich's enemies. Many individual soldiers who ventured to the killing sites behind the lines voluntarily participated in the mass shootings. Cooperation between the SS police units and Wehrmacht also occurred when they took hostages and carried out reprisals against partisans, particularly in the Eastern theater, where the war took on the complexion of a racial war as opposed to the conventional one being fought in the West. Other front-line officers went through the war without coming into direct contact with the machinery of extermination, choosing to focus narrowly on their duties and not noticing the wider context of the war. On 20 July 1942, an extermination unit under the command of Walther Rauff was sent to Tobruk and assigned to the Afrika Korps led by Erwin Rommel. However, since Rommel was 500 km away at the First Battle of El Alamein, it is unlikely that the two were able to meet. The plans for Einsatzgruppe Egypt were set aside after the Allied victory at the Second Battle of El Alamein. Historian Jean-Christoph Caron opines that there is no evidence that Rommel knew of or would have supported Rauff's mission. Relations between some Army commanders and the SS were not friendly, as officers occasionally refused to co-operate with Himmler's forces; General Johannes Blaskowitz for instance, was relieved of his command after officially protesting about SS atrocities in Poland. Such behaviors were uncommon, however, as a significant portion of the German military acculturated to the norms of the Nazi regime and the SS in particular, and were likewise censurable for carrying out atrocities during the course of the Second World War. Other states Although the Holocaust was planned and directed by Germans, the Nazi regime found willing collaborators in other countries, both those allied to Germany and those under German occupation and by 1942, the atrocities across the continent became a "pan-European program." The civil service and police of the Vichy regime in occupied France actively collaborated in persecuting French Jews. Germany's allies, Italy, Finland, Hungary, Romania, and Bulgaria, were all pressured to introduce anti-Jewish measures. Bulgaria refused to co-operate, and all 50,000 Bulgarian Jews survived (though most lost their possessions and many were imprisoned), but thousands of Greek and Yugoslavian Jews were deported from the Bulgarian-occupied territories. Finland officially refused to participate in the Holocaust and only 7 out of 300 Jewish alien refugees were turned over to the Germans. The Hungarian regime of Miklós Horthy also refused to cooperate until the German invasion of Hungary in 1944, after which its 750,000 Jews were no longer safe. Between May through July 1944, upwards of 437,000 Jews were deported from Hungary to Auschwitz. The Romanian regime of Ion Antonescu actively persecuted Jews, murdering some 120,000 of them. The German puppet regime in Croatia actively persecuted Jews on its own initiative. The Nazis enlisted support for their programs in all the countries they occupied, although their recruitment methods differed in various countries according to Nazi racial theories. In the "Nordic" countries of Denmark, Norway, Netherlands, and Estonia they tried to recruit young men into the Waffen-SS, with sufficient success to create the "Wiking" SS division on the Eastern Front, many of whose members fought for Germany with great fanaticism until the end of the war. In Lithuania and Ukraine, on the other hand, they recruited large numbers of auxiliary troops that were used for anti-partisan work and guard duties at extermination and concentration camps. In recent years, the extent of local collaboration with the Nazis in Eastern Europe has become more apparent. Historian Alan Bullock writes: "The opening of the archives both in the Soviet Union and in Eastern Europe has produced incontrovertible evidence [of] ... collaboration on a much bigger scale than hitherto realized of Ukrainians and Lithuanians as well as Hungarians, Croats and Slovaks in the deportation and murder of Jews." Historians have been examining the question of whether it is fair to connote the Holocaust as a European Project. Historian Dieter Pohl has estimated that more than 200,000 non-Germans "prepared, carried out and assisted in acts of murder"; that is about the same number as Germans and Austrians. Such numbers have elicited a similar reaction from other historians; Götz Aly for instance, has come to the conclusion that the Holocaust was in fact a "European project." While the Holocaust was perpetrated at the urging of the Nazis and constituted part of the SS vision for a "pan-European racial community", the subsequent outbursts of antisemitic violence in Croatia, France, Romania, Slovakia, the Baltic states among others, make the catastrophe a "European project" according to historian Dan Stone. Belgium In Belgium the state has been accused of having actively collaborated with Nazi Germany. An official 2007 report commissioned by the Belgian senate concluded that the Belgians were indeed complicit in participating in the Holocaust. According to the report, the Belgian authorities "adopted a docile attitude providing collaboration unworthy of a democracy in its treatment of Jews." The report also identified three crucial moments that showed the attitude of Belgian authorities toward the Jews: (1) During the autumn of 1940 when they complied with the order of the German occupier to register all Jews even though it was contrary to the Belgium constitution; this led to a number of measures including the firing of all Jews from official positions in December 1940 and the expelling of all Jewish children from their schools in December 1941; (2) In summer 1942, when over one thousand Jews were deported to the death camps, particularly Auschwitz during the month of August. This was only the first of such actions as the deportations to the east continued resulting in the death of some 25,000 people; and (3) At the end of 1945, the Belgian state officials decided that its authorities bore no legal responsibility for the persecution of the Jews, even though many Belgian police officers participated in the rounding up and deportation of Jews, particularly in the Flemish part of Belgium. However, collaboration is not the whole story. While there is little doubt that there were strong antisemitic feelings in Belgium, after November 1942, the German roundups became less successful as large-scale rescue operations were carried out by ordinary Belgians. Many bankers, notaries, and judges—people who had access to information about property, accounts, and commercial registers—refused to be complicit in the expropriation of Jewish property, which elicited complaints from Nazi authorities. These actions (among others) resulted in the survival of about 25,000 Jews from Belgium. Unlike other states, which were immediately annexed, Belgium was initially placed under German military administration, which the Belgian authorities exploited by refusing to carry out some of the Nazi directives against the Jews. Roughly 40 percent of Belgium's Jews, who were there at the start of the war, did not survive the Final Solution. Bulgaria Bulgaria, mainly through the influence of the Bulgarian Orthodox Church, saved nearly all of its indigenous Jewish population from deportation and certain death. This is not to imply that Bulgaria was entirely blameless, as they passed special laws to confiscate Jewish property and remove them from public service in early 1941. When this law came into effect on 23 January 1941—signed by Tsar Boris III—Jews were also forbidden from marrying Christians, they could no longer serve in the Bulgarian military, became subject to forced labor, and could no longer vote, nor could they change residence without police authorization. Once civil and military administration over parts of Northern Greece and Macedonia were turned over to Bulgaria by Germany, Bulgarian authorities deported Jews from those territories to concentration camps. Originally SS Captain Theodor Dannecker and the head of the Commissariat for Jewish Affairs, Alexander Belev, agreed to deport as many as 20,000 Jews from Macedonia and Thrace. These deportations were set to be completed by May 1943. Belev had agreed to these measures without the knowledge or approval from officials in the Bulgarian government, which sparked protests that reached the Bulgarian National Assembly in Sofia. Before the matter was over, however, Bulgaria had deported some 11,000 foreign Jews to Nazi-held territory. Once those Jews were handed over to the Germans, they were sent to the extermination camp at Treblinka, where they perished. Channel Islands Channel Islands police collaborated with the Nazis deporting local Jews, some of whom were sent to Auschwitz in 1942, others were deported in 1943 as retaliation for the British commando raid on the small Channel Island of Sark when most of the Jews were shipped to internment camps in France and Germany. On the Channel Island of Alderney a labor camp for Jews was established, one which was notable for the brutality of the German guards; hundreds of Jews were murdered there and 384 were buried within the camp itself, while many others were simply dumped into the sea. Some 250—mostly French—Jews perished on a ship headed from Germany to the Alderney camp when it was sunk by the Royal Navy on 4 July 1944. Croatia Croatia was a puppet state which was created by the Germans and ruled by the vehemently racist head of the Ustasha, Ante Pavelić. As early as May 1941, the Croatian government forced all Jews to wear the yellow badge and by the summer of that same year, they enacted laws that excluded them from both the economy and society. Within those first few months in power, the Ustasha also demolished the main synagogue in Zagreb. The Croatian Ustaše regime killed thousands of people, the majority of whom were Serbs, (estimates vary widely, but most modern and qualified sources put the number of people who were killed at around 45,000 to 52,000), about 12,000 to 20,000 Jews and 15,000 to 20,000 Roma, primarily in the Ustasha's Jasenovac concentration camp which was located near Zagreb. Historians Donald Niewyk and Francis Nicosia provide higher estimates for the number of people who were killed, reporting the following ranges: 500,000 Serbs, 25,000 Gypsies, and 32,000 Jews; most of whom (75%) were murdered, not by the Nazis but by the Croatians themselves. Croatians murdered of their own volition as part of their own "large-scale political repopulation project," one with the obvious goal of ethnic cleansing. According to the 2001 census in Croatia, only 495 Jews were listed of the 25,000 Jews who had previously lived there before the Second World War, accounting for less than 0.1% of Croatia's population. Denmark Due in part to the fact that the Germans were dependent upon an "uninterrupted supply of Danish agricultural products to the Reich" they tolerated the status quo of 6,500 Jews living undisturbed in Denmark. Upset with German policies and wishing for democracy, the Danes began demonstrating against the Germans, which incited a military response from the Nazis that included dismantling the Danish military forces and correspondingly placing Danish Jews at increased risk. Most of the Danish Jews were saved by the unwillingness of the Danish government and people to acquiesce to the demands of the occupying forces and through their concerted efforts to ferry Danish Jews to Sweden during October 1943. In total, this endeavor saved nearly 8,000 Jews from certain death; another 425 who were sent to Theresienstadt were also saved due to the determination of the Danes, and returned to their homes following the war. About 1,500 of the roughly 8,000 Jews rescued by the Danes were recent refugees from Czechoslovakia, Austria, and Germany. Estonia Prior to the Second World War, there were approximately 5,000 Estonian Jews. With the Nazi invasion of the Baltics, the Nazi government found willing volunteers from this region to assist the Einsatzgruppen and auxiliary police, which enabled it to carry out mass genocide in this region. About 50% of Estonia's Jewish population, aware of the fate that otherwise awaited them following the Nazi invasion, managed to escape to the Soviet Union; virtually all those remaining were forced to wear badges identifying them as Jews, stripped of their property, and eventually murdered by Einsatzgruppe A and local collaborators before the end of 1941. Right-wing Estonian units, known as the Omakaitse were among those who aided the Einsatzgruppen in murdering Jews. During the winter of 1941–1942, Einsatzgruppe A operating in Ostland and the Army Group Rear reported having murdered 2,000 Jews in Estonia. At the Wannsee Conference in January 1942, Estonia was reported to be Jew-free. Jews from countries outside the Baltics were shipped there to be exterminated—as was the case for 7,130 Jews sent to Estonia in September 1943, where they were murdered within months. An estimated 20,000 Jews were sent to labor camps in Estonia from elsewhere in Eastern Europe. Finland Despite being at times a co-belligerent of Nazi Germany, Finland remained independent and its leadership flatly refused to cooperate with Heinrich Himmler's request to relinquish its 2,000 Jews. Some Jews were even able to flee German-occupied Europe and make their way into Finland. Only seven of the 300 alien Jews living in Finland were turned over to the Germans. Even the deportation of a handful of Jews did not go unnoticed, as there were protests in Finland from members of its indigenous Social Democratic Party, by a number of Lutheran ministers, the Archbishop, and the Finnish Cabinet. Like Denmark, Finland was one of only two countries in the orbit of Nazi domination that refused to cooperate fully with Hitler's regime. These historical observations do not absolve all Finns, as some scholars point out—in particular, the Einsatzkommando Finnland was formed during the joint invasion of the Soviet Union, which received collaboration from Finnish police units and Finnish military intelligence in capturing partisans, Jews, and Soviet POWs as part of their operations—exactly how many of each group remains unclear and is a subject needing further research according to historian Paul Lubotina. France Antisemitism, as the Dreyfus Affair had shown at the end of the 19th century, was widespread in France, especially among anti-republican sympathizers. Long before the rise of the Nazis, antisemitism was so pronounced in France that, according to intellectual historian George Mosse, France seemed like it would be the country where racism might direct its political future. Before the onset of World War II, there were roughly 350,000 Jews residing in France, with only 150,000 being native-born. Approximately 50,000 were refugees fleeing Germany, Austria, and Czechoslovakia, while another 25,000 came to France from Belgium and Holland; the remaining Jews were arrivals to France in the 1920s and 30s from Eastern Europe. Once the Germans invaded, many Jews fled away from the advancing forces, but France's rapid collapse, both militarily and politically, the armistice, and the speed at which everything happened trapped many of them in southern France. Philippe Pétain, who became the French premier after Paris had fallen to the German Army, arranged the surrender to Germany. He then became the head of the Vichy government, which collaborated with the Nazis, claiming that it would soften the hardships of occupation. Opposition to the German occupation of northern France and the collaborationist Vichy government was left to the French Resistance within France and the Free French Forces led by Charles de Gaulle outside France. German occupation was quickly accompanied by harsh treatment; Jews were expelled from Alsace-Lorraine and their property was confiscated, whereas foreign Jews—around 32,000—were interned following a Vichy decree on 4 October 1940. Additional discriminatory measures soon followed and intensified after the Nazis issued an ordinance on 27 September 1940; these were carried out by the French administration and included: identification requirements for Jews, a census to account for all Jews and businesses, expropriation and "Aryanization" of property, along with occupational restrictions and bans. On 7 October 1940, Pétain's government repealed the Crémieux Decree, a move which deprived 117,000 Algerian-born French Jews of the civil rights they were granted in 1870. By the end of 1940, more Jews were arrested in Vichy France than in German-occupied France. Another 1,112 Jews were arrested during French round-ups in May and December 1941; later, when they were deported, they constituted some of the earliest arrivals to Auschwitz at the end of March 1942. Five thousand additional Jews were sent from France to Auschwitz at the end of April and during June 1942. The chief of police for the Vichy government, René Bousquet, agreed to arrest foreign and stateless Jews in Vichy France starting in July 1942, and he acceded to having French police collaborate in arresting Jews in the occupied zone. Per agreement between the Vichy government and the Nazis, another 10,000 Jews were added to the total being deported between 19 July and 7 August 1942. Some 2,000 Jewish children whose parents had already been shipped to Auschwitz were also sent to the camp during the period 17–26 August 1942, and by the end of the year, the total figure of deportees from France reached 42,000 persons. From the first transport of March 1942 to the last one during July 1944, as many as 77,911 Jews were deported from France to Poland. Most of the Jews in France were transported to Auschwitz, but some were sent to Majdanek and Sobibór with a few ending up at Buchenwald. Greece The Jews of Greece mainly lived in the area around Thessaloniki, where a large and influential Sephardi community had lived since the 15th century, where some 55,000 Jews comprised nearly 20% of the city. Following the German invasion and occupation of Salonika in 1941, an antisemitic nationalist party called National Union of Greece (Ethniki Enosis Ellados, EEE), which had existed between 1927 and 1935, was revived by Nazi authorities. The Greek governor, Vasilis Simonides, cooperated with the Nazi authorities and supplied local police forces to aide in deporting 48,500 Jews from Salonika to Auschwitz-Birkenau during March to August 1943. Both Greeks and Germans looted the businesses and homes vacated by the expelled Jews. Greek Jews residing in the areas occupied by Bulgaria were also deported following the deportations from Salonika. In March 1944, German forces and Greek police in Athens rounded up Jews and deported them. Upwards of 2,000 Jews from Corfu and another 2,200 from Rhodes were transported to concentration camps in June 1944. Before the end of the war, over 60,000 Greek Jews were murdered, the vast majority of whom were sent to Auschwitz. Hungary In March 1938, several years before the German occupation of Hungary, anti-Jewish measures were already enacted by the Hungarian Parliament in the wake of Prime Minister Kálmán Darányi's announcement about the need to solve the Jewish question. This legislation and the second set of anti-Jewish laws restricted Jews from certain professions and economic sectors, it also forbade Jews from becoming Hungarian citizens by means of either marriage, naturalization, or legitimization. Approximately 90,000 Jews and their family members who relied on their support (upwards of 220,000 people) lost their means of economic survival and when the third anti-Jewish law went into effect, it nearly mirrored the Nazi Nuremberg Laws. Once the legal exclusion of Jews from Hungarian society was complete, the National Central Alien Control Office (Külföldieket Ellenőrző Országos Központi Hatóság, KEOKH), turned its attention almost exclusively to expelling "undesirable" Jews. By the summer of 1941, the Hungarians carried out their first series of mass murders, and again in early January 1942, when they slaughtered 2,500 Serbs and 700 Jews, demonstrating that the political leadership in Hungary authorized the commission of atrocities even before the German occupation. Sometime in August 1941, the Hungarian authorities deported 16,000 "alien" Jews, most of whom were shot by the SS and Ukrainian collaborators. In the spring of 1942, the Hungarian Minister of Defense ordered the majority of Jewish forced labor to the theater of military operations. Due to this order, as many as 50,000 Jews worked in military forced-labor companies starting in the spring of 1942 through 1944. Accompanying Hungarian troops during Operation Barbarossa, Jews in these units were poorly treated, insufficiently housed, ill-fed, routinely used to clear minefields, and placed in constant unnecessary danger; estimates indicate that "at least 33,000 Hungarian Jewish males in the prime of life" died in Russia. During parts of May through June 1944, some 10,000 Hungarian Jews were gassed on a daily basis at Auschwitz-Birkenau, a pace with which the crematoria could not keep up, resulting in many of the bodies being burned in open pits. The 410,000 Jews murdered during this period represents the "largest single group of Jews murdered after 1942" according to historian Christian Gerlach. Much of the efficiency with which the Germans were able to deport and murder Hungarian Jews stemmed from the "frictionless cooperation of Hungary's politicians, bureaucracy, and gendarmerie", and popular Hungarian antisemitism served to block any Jews trying to escape. After the fascist Arrow Cross coup in October 1944, Arrow Cross militias shot as many as 20,000 Jews in Budapest and dumped their bodies into the Danube River between December 1944 and the end of January 1945. Jews in labor battalions were sent on death marches into Germany and Austria. Nearly one-tenth of the Holocaust's Jewish victims were Hungarian Jews, accounting for a total of over 564,000 deaths; some 64,000 Jews had already been murdered prior to the German occupation of Hungary. Despite the atrocities in Hungary, approximately 200,000 Jews in total survived the war. Italy Among Germany's allies, Italy was not known for its antisemitism and had a relatively well-assimilated Jewish population; its policies were essentially about domination as opposed to "destruction." National pride and the need to express sovereignty had as much to do with Italian behaviors as did any general benevolence towards the Jews. Approximately 57,000 Jews resided in pre-war Italy, about 10,000 of whom were refugees from Austria and Germany, comprising less than one-tenth of one percent of the population. An Italian law was passed in 1938 as part of Mussolini's effort to align his country more with Germany; the law restricted civil liberties of Jews. This effectively reduced the country's Jews to second-class status, though the Italians never made it official policy to deport Jews to concentration camps. Edging closer towards Germany, the Italian Ministry of the Interior established 43 camps where enemy "aliens" (to include Jews) were detained—these camps were not pleasant but they were "a far cry from the Nazi concentration camps." After the fall of Benito Mussolini and the Italian Social Republic, Jews started being deported to German camps by the Italian puppet regime, which issued a police order to that effect on 30 November 1943. While Jews fled once the puppet regime came to power, the Italian police nonetheless captured and sent over 7,000 Jews to camps at Fossoli di Carpi and Bolzano, both of which served as assembly points for deportations to Auschwitz-Birkenau. Italian prisons were used to house Jews as well, the most infamous of them was San Vittore Prison in Milan where "torture and murder were common." Nazi Germany's Propaganda Minister, Joseph Goebbels, complained throughout the war about Italy's "lax" policies against the Jews. Nevertheless, through 1944, no less than 15 transports carrying around 3,800 Jews made their way from Italy to Auschwitz. Estimates from a number of sources place the total death count for Italian Jews between 6,500 and 9,000. The generally accepted death tolls for Italy are about 8,000 Jews and as many as 1,000 Roma. Latvia Before the war over 93,000 Jews resided in Latvia, comprising less than 5 percent of the country's population. Immediately in the wake of the German attack on the former Soviet Union in June 1941, Latvia was occupied and incorporated into the Reichskommissariat Ostland as Generalbezirk Lettland with a Latvian civil administration under the D. Heinrich Drechsler. Latvian auxiliary forces aided the SS Einsatzgruppen by following behind the advancing German forces, shooting Jews who they lined up in anti-tank trenches. Other instances of Latvian brutality against the Jews manifested before troops even arrived, as the local populations attacked and murdered entire communities across hundreds of small villages. Zealous Latvians assisted the German forces in collecting all males between the ages of 16 and 60 in the city of Dvinsk for support operations; hundreds of Jewish males never returned from these duties as they were often murdered. In the areas in and around Warsaw, Latvian guards accompanied the SS in securing the ghetto and deporting Jews to Treblinka. The former head of the Latvian police, Viktors Arājs, willingly collaborated with the Nazis by forming the Arājs Kommando, a Latvian volunteer police unit, which worked closely with the SS Einsatzgruppe A to murder Jews. As early as July 1941, they were already burning synagogues in Riga. According to historian Timothy Snyder, the Arājs Kommando shot 22,000 Latvian Jews at various locations after they had been brutally rounded up for this purpose by the regular police and auxiliaries, and were responsible for assisting in the murder of some 28,000 more Jews. Aggregate figures indicate that around 70,000 Latvian Jews were murdered during the Holocaust. Liechtenstein Only a handful of Jews lived in the small neutral state of Liechtenstein at the outbreak of the Second World War. Between 1933 and 1945, approximately 400 Jews were taken in by Liechtenstein, but another 165 were turned away. According to a 2005 study, the royal family of Liechtenstein purchased once Jewish-owned property and furniture that the Nazis seized after annexing Austria and Czechoslovakia. Liechtenstein's royal family also rented inmates from Strasshof an der Nordbahn concentration camp near Vienna, where they employed forced labor on nearby royal estates. Lithuania Nearly 7 percent of Lithuania's population was Jewish, totaling approximately 160,000 persons. For the most part, the Nazis considered the majority of non-Jewish people in the Baltics as racially assimilable with the exception of Jews, against whom some discrimination was already present in Lithuania before the occupation, but it was generally confined to edicts against Jews being in certain occupations and/or educational discrimination. Lithuania's Jewish population quickly swelled in the aftermath of the territorial arrangement between Nazi Germany and the Soviet Union, which proved a tumultuous time for many Jews who fled there to escape persecution; meanwhile, it increased the Jewish population of Lithuania to approximately 250,000. Angry about the Nazi-Soviet pact, many Lithuanians began taking their anger out on the country's Jews by attacking them and their property. The situation deteriorated further due to the see-saw of political power that started when the Soviet Army took control of Lithuania in June 1940 and persecuted thousands of its citizens through a program of Sovietization (approximately 17,000 Lithuanians were sent to Siberia right before the Germans arrived). Many Jews were asked to join the short-lived Soviet government and were allowed integration into Lithuanian society. Just seven weeks later, however, the Nazis invaded and were greeted as liberators. Subsequent blame for the ill fortune that befell the Lithuanians under the Soviets landed on the Jews, which started even before the Germans had finished conquering the country; Lithuanians carried out pogroms in at least 40 different places, where Jews were raped, severely injured, and murdered. Blaming the Jews also afforded the many Lithuanians who had cooperated with the Soviets the means to exonerate themselves by diverting attention onto a Jewish conspiratorial scapegoat. On 25 June 1941 Nazi forces arrived in Kaunas, where they witnessed local Lithuanians drag about 50 male Jews into the center of the city while one Lithuanian man beat them to death with a crowbar (cheered on by spectators) in a public display of brutality that shocked many Germans. After murdering all the Jews, the man climbed atop their corpses and played the Lithuanian national anthem on an accordion. These deaths were part of the Kaunas pogrom during which many thousands of Jews were murdered by the Nazis with local acquiescence or assistance. Mere weeks after arrival, the Nazis instituted a systematic campaign to eliminate the Jews of Lithuania by identifying them, rounding them up, guarding them, and transporting them to extermination sites—during which they were aided by Lithuanian soldiers and police. The pace of murder increased and spread across Lithuania as the Germans consolidated their rule, sometimes by way of Lithuanian initiative, other times triggered at the arrival of Sipo-SD contingents. Within the last 6 months of 1941 following the June invasion by Germany, the majority of Lithuanian Jews were executed, the biggest crime being the Ponary massacre. The remnants trapped in ghettos were killed in occupied Lithuania and sent to Nazi death camps in Poland. By the end of June 1941, around 80 percent of Lithuania's Jews had been "wiped out." Scholars believe the overall Holocaust-related death rate in Lithuania was approximately 90 percent, making Nazi-occupied Lithuania the European territory with the lowest proportion of Jewish survivors from World War II. While estimates vary, the number of Lithuanian Jews murdered in the Holocaust is assessed to be between 195,000 and 196,000. Additionally, Lithuanian auxiliary police troops assisted in murdering Jews in Poland, Belarus and Ukraine. Historian Laurence Rees describes the motivations for Lithuanians' slaughter of their Jewish countrymen. He first cites a prominent Lithuanian historian, who lists five motivations: antisemitism, revenge for alleged collaboration with the Soviet occupation, a desire to show loyalty to the new Nazi occupiers, and greed. Rees adds that sadism must also be included given his interviews with unrepentant perpetrators. Netherlands Known prior to the war for racial and religious tolerance, the Netherlands had taken in Jews since the 16th century, many of whom had found refuge there after fleeing Spain. Before the German invasion of May 1940, approximately 140,000 Jews resided in the Netherlands, around 30,000 of them were refugees from Austria and Germany. Nearly 60 percent of Dutch Jews lived in Amsterdam, constituting some 80,000 people. Once the Nazis invaded, a host of antisemitic measures were enacted to include exclusion from professions like the civil service. Anti-Jewish legislation that had taken years to institute in Germany was enacted within just months in the Netherlands. On 22 October 1940, all Jewish banks and businesses had to register and all assets, whether private or those in banks, had to be declared. Even radio sets in possession of Jews were forbidden and confiscated. By January 1941, the Jews of the Netherlands were being defined by racist criteria, had to be registered, and merely a month later in February, many were being deported to Westerbork transit camp in the eastern part of the country. From there, most Dutch Jews were first sent to Mauthausen concentration camp. While there was participation from some Dutch volunteers in various acts against the Jews, there was more of a tacit and begrudging acquiesance in the Netherlands, which required a very visible Nazi presence throughout the entire war to exploit the country's economic wealth and enforce Nazi occupation policies. From the summer of 1942 forward, upwards of 102,000 Dutch Jews were deported and murdered—much of which was made possible by the "cooperation and efficiency of the Dutch civil service and police" who willingly served the Germans. Not only was there relatively smooth cooperation between Dutch authorities and Dutch police, the SS and the Nazi police organizations in the Netherlands also worked well together there; additionally, volunteers from indigenous fascist organizations assisted in persecuting Jews, and the Jewish council in Amsterdam, unfortunately, spread undue optimism and as a result, very few Dutch Jews went into hiding. In all fairness to the Jewish council, however, they were deceived and provided misinformation by the Nazi commissioner for Amsterdam, Hans Böhmcker. Historians Deborah Dwork and Robert Jan van Pelt report that in the Netherlands, nearly 80% of the 140,000 Jews originally living there were murdered. Norway Amid a prewar population of 3 million, there were only 2,100 Jews living there, the largest contingency residing in Oslo. After Norway was invaded, the Nazis took control of the government by June 1940 and the native government went into exile. Power was given to the German Reichskommissar Josef Terboven and the Norwegian Fascist Party leader Vidkun Quisling, who supported the institution of anti-Jewish legislation. Quisling attempted to establish himself as the ruler of occupied Norway, but the Nazis only used him as leader of a puppet government. Like in Denmark, radios were confiscated from Jews by Norwegian police in May 1940. On 20 April 1940, SS Einsatzkommandos were established in Oslo, Bergen, Stavanger, Kristiansand, and Trondheim. The Nazis, assisted by Norwegian police units, managed to round up 763 Jews, who were deported to Auschwitz where they were murdered. Another 930 Jews escaped to Sweden from Norway. However, the Nazis and their collaborators were very unpopular in Norway and many Jews were saved by the actions of Norwegians, including civil servants and police officers. Quisling and other Norwegians, who collaborated with the Nazis, were executed as traitors after the war, at least partly due to their involvement in the Holocaust. Palestine A Palestinian Arab nationalist and a Muslim religious leader, the Grand Mufti of Jerusalem Haj Amin al-Husseini worked for Nazi Germany as a propagandist and a recruiter of Muslim volunteers for the Waffen-SS and other units. On 28 November 1941, Hitler officially received al-Husseini in Berlin. Hitler told al-Husseini of the Germans' "uncompromising fight against the Jews", which included the Jews in Arab territories. The Mufti spent the remainder of the war assisting with the formation of Muslim Waffen-SS units in the Balkans and the formation of schools and training centers for imams and mullahs who would accompany the Muslim SS and Wehrmacht units. Beginning in 1943, al-Husseini was involved in the organization and recruitment of Bosnian Muslims into several divisions, the largest of which was the 13th "Handschar" division. Poland Polish Jews comprised roughly 10 percent of the country's population at upwards of 3.3 million persons before the Second World War began, most of whom were well-integrated into Polish society in various industries. Most Polish Jews lived in the cities and were self-employed. Economic depression during the 1920s and 30s changed the situation for Jews in Poland, as a subsequent emergence of antisemitism yielded government programs to reduce their economic standing. German occupation in 1939 only worsened matters for the Jews, as they started isolating them by forcing them into ghettos, eventually transporting them to camps established in Poland itself. Far right-wing party members in Poland saw the deportation of the Jews in a favorable light, but for the majority of Poles, their thoughts on the matter were far more complex. When the Nazis attacked the Red Army in Soviet-occupied Poland during Operation Barbarossa of 1941, witnesses recalled a series of massacres committed against Jews by the Polish locals in the Białystok and Łomża areas, such as in Jedwabne, Radziłów, and Kolno villages, along with several others in the area. The extent of local collaboration in these massacres is a controversial issue, as is the role of German units present there. Historian Peter Longerich points out that "even if the pogroms can be attributed in large part to German plans to spark off 'attempts at self-cleansing', it has to be admitted that they would not have been possible if there had not already been a significant potential for anti-Semitic violence in the indigenous population and if they had not been susceptible to mobilization for such murderous campaigns." This is also true of Jedwabne, "[which] was engineered by a unit of the German Security Police... [which] had recruited local Poles as auxiliary 'pogrom police' for this purpose." According to Timothy Snyder, there were about a dozen pogroms instigated by the Nazis' arrival in Poland, resulting in several thousand deaths, but "the scale of the murder was...inferior to what the Germans were already achieving to the north and east." There were multiple occurrences of individual Volksdeutsche turning in, chasing down, or blackmailing Jews; such people were condemned as collaborators and under threat of execution by the Polish resistance. Emmanuel Ringelblum wrote that he saw Polish Blue Police beating Jews and that they participated in street round-ups. But according to Raul Hilberg, "Of all the native police forces in occupied Eastern Europe, those of Poland were least involved in anti-Jewish actions... They [the Polish Blue Police] could not join the Germans in major operations against Jews or Polish resistors, lest they be considered traitors by virtually every Polish onlooker." Poland never surrendered to the Germans so there was no collaboration on a national governmental level as took place elsewhere in occupied Europe. There also were no Polish SS battalions, though there were SS volunteer battalions from almost all of the other German-occupied countries. Attempts to organize Polish SS battalions resulted in immediate, large-scale desertions, and so these attempts were abandoned. Polish Jew, Nechama Tec, an expert on the Holocaust who herself was saved by Polish Catholics, writes that she knew of no Polish concentration camp guards. In general the machinery of the Holocaust ran with little Polish collaboration, though collaboration did take place on occasion as Yisrael Gutman and Shmuel Krakowski reported in their work Unequal Victims that a notable number of Poles turned their backs on the Jews, extorted them (see Szmalcownik ), and in the rural parts of Poland, peasants joined the Germans in hunting down and killing Jews who escaped from ghettos. They also claim that there were more bystander crimes than those willing to aide the Jews. Nonetheless, Polish citizens have the world's highest count of individuals recognized as Righteous Among the Nations by Yad Vashem; a list consisting of Gentiles who risked their lives to save Jews from extermination during the Holocaust. Nonetheless, due to its European centrality, available rail networks, and proximity to Nazi avenues of control, Poland was the nation where German persecution policies against the Jews were played out in full. German-occupied Poland had the most ghettos, the only camps designed exclusively for extermination, and trains from all across northern, southern, and western Europe carried Jewish deportees into the country. There were over 450 extermination, concentration, labor, and prisoner-of-war camps in Poland. It was also the nation where the infamous killing centers of Belzec, Chelmno, Sobibor, Treblinka, Majdanek, and Auschwitz-Birkenau were located. Before the killing came to its conclusion, upwards of ninety percent of all Poland's Jews—amounting to some three-million persons in total—were murdered by the Nazis. Romania Assimilation was common for Jews in Romania, where some 757,000 of them lived but not necessarily in total peace there. Following the First World War, attacks against Jews intensified, as many Jews were stripped of citizenship. According to historian Lucy Dawidowicz, economic discrimination as well as violent antisemitism was present in Romania concomitant with Germany. Similar to Germany, Jews were forbidden full participation in Romanian society and culture, and under Antonescu the Romanianization of Jewish property was carried out, Jews were forbidden gainful employment, made to work as forced laborers, and a process of ghettoization and deportation was begun. Leading figures in Romania's antisemitic movement included the economics professor, Alexander Cuza, who founded the Fascist League of National Christian Defense, an organization that begat the notorious Iron Guard under Corneliu Zelea Codreanu. Cuza wanted to expel all Jews out of Romania; poet Octavian Coga wished to send them to Madagascar. The fascist Alexandru Razmerita advocated imprisoning the Jews in concentration camps and working them to death, while a Romanian Orthodox priest suggested drowning them all in the Black Sea. Copying the Nazis, the Romanian government enacted its version of the Nuremberg Laws in 1936. Iron Guard leader Codreanu once exclaimed that he was in favor of "eliminating the Jews completely, totally and without exception." The Romanian Antonescu regime was responsible for the deaths of approximately 380,000 Jews according to historian Yehuda Bauer. An official declaration by the Romanian government that denied the existence of the Holocaust within the country's borders during World War II led in 2003 to the creation of the International Commission on the Holocaust in Romania. The official report of the Commission released jointly with the Romanian government concluded: In cooperation with German Einsatzgruppen and Ukrainian auxiliaries, Romanian troops murdered hundreds of thousands of Jews in Bessarabia, northern Bukovina, and Transnistria; some of the larger massacres of Jews occurred at Bogdanovka, a Romanian concentration camp along the Bug River in Transnistria, between 21 and 30 December 1941. Nearly 100,000 Jews were murdered in occupied Odessa and well over 10,000 were murdered in the Iași pogrom of June 1941. Romanian troops also massacred Jews in the Domanevka and Akhmetchetka concentration camps. Jean Ancel, who headed the commission along with Elie Wiesel, spent his entire life researching Romania's treatment of Jews. In his book, he provides a confirmation using Romania's own archives, made available in 1994–95 after the collapse of the Soviet Union, and with Nazi documents, survivor testimonies, war crimes trial transcripts, that Romania not only participated in but independently implemented its own autonomous genocide of Jews in Bessarabia, Bukovina, and in Ukraine—the only Nazi ally to do so during the war. The protests of various public, political and religious figures, including Prince Constantin Karadja, against the deportation of the Jews from the Romanian Kingdom contributed to the change of policy toward the Jews starting with October 1942. The result of this change of policy and that of the actions of a relatively small number of individuals, was that at least 290,000 Romanian Jews survived. Serbia Before the First World War, Serbia existed as an independent country before being incorporated into Yugoslavia in 1919. Approximately 16,000 Jews resided there. During the interwar years, Serbia constituted one of the places where it was comparatively safe to be a Jew, despite the presence of some general xenophobia. Serbia was occupied by Germany in April 1941. As part of their effort to occupy the northern regions of Yugoslavia, the Germans established a military government in Serbia. Serbia's collaborationist government was led by General Milan Nedić. The internal affairs of the Serbian-occupied territory were moderated by German racial laws, that were introduced in all occupied territories with immediate effects on the Jewish and Roma populations. Indigenous Serbians who harbored democratic beliefs were also targeted. Partisan activities in Serbia elicited harsh pacification measures from the SD and Wehrmacht. The Nazis had a collective punishment policy of killing 100 Serbs for each German soldier killed and another 50 Serbs for every German soldier who was wounded. Resistance activities continued for some time in Serbia nonetheless. Sometimes the Serbian authorities cooperated with the Germans as matter of course, whereas others took the individual initiative; some Serbian military commanders rounded up Gypsies so they could be concentrated in one area, where they were shot. German occupiers declared Serbia Judenfrei in August 1942. The major concentration camps in Serbia were Sajmište and Banjica but many others like Topovske Šupe, Šabac, and Niš concentration camps also interned considerable numbers of Jews. Before the war was concluded, upwards of 14,500 Serbian Jews were murdered. Legends about Serbs saving the Jews in World War II are widespread in Serbia, and 132 Serbs have been honored as Righteous Among the Nations. Slovakia In 1938 approximately 135,000 Jews resided in Slovakia, around 40,000 of them lived in Ruthenia and Subcarpathia, areas previously ceded to Hungary; most of whom led good lives despite the presence of antisemitism among the peasant population of Slovakia. As early as April 1939, anti-Jewish legislation was enacted, but this was religious and not racial in nomenclature. Nonetheless, the restrictions against Jews proceeded accordingly, blocking them from various professions, which was accompanied by violence against the Jews from the indigenous Hlinka Guard. Slovakian Jews were among the first to be handed over en masse to the Nazis following the Wannsee Conference. Members of the Hlinka Guard went house to house and brutally seized young and fit Jews from their homes in March and April 1942, sending them to Auschwitz as slave laborers. The Hlinka Guard was assisted by the Freiwillige Schutzstaffel (Slovak volunteers in the SS). Between March through October 1942, Tiso's Slovakian regime deported approximately 58,000 Jews to the German-occupied part of Poland. The Slovak government even paid the Germans for the Jews that were deported. The deportation of the remaining 24,000 was stopped due to the intervention of a Papal nuncio, whereby the Slovak president was informed that the German authorities were killing the Jews deported from Slovakia. Despite this action, approximately 12,600 Slovak Jews were still sent to Auschwitz, Theresienstadt, and other camps in Germany before the deportations ceased. Around half of them were killed in concentration camps. Aggregate numbers of Holocaust victims tabulated by experts indicate that at least 60,000 Jews as well as 400 Slovakian Gypsies were killed; high estimates place the total number of Jewish victims from Slovakia at 71,000 persons. Soviet Union As early as 1903, Vladimir Lenin had already formulated a Communist ideology about the Jews, who he avowed, were not a nation since they did not possess any specified territory; this position was shared by Stalin and in the 1920s as many as 830,000 Soviet Jews were considered lishentsy (non-citizens). Some of those Jewish non-citizens eventually applied to work in factories and subsequently gained their citizenship but Jewish culture and literature faded fast under the Stalinist government. Nearly 90 percent of Russian Jews were urbanized and lived in one of eleven cities, with the largest groups in Moscow, Kiev, Odessa, and Leningrad. Antisemitic literature like the Protocols of the Learned Elders of Zion—which purports to describe a Jewish conspiracy for world domination—was popular in prewar Russia. Russian pogroms targeting the Jews were among the first in the modern period to incite its citizens to violence for the sake of political expediency. Still, around three million Jews lived across the vast expanse of the Soviet Union in January 1939. The Jewish population within the Soviet territories was distributed as follows: 300,000 in Bessarabia and northern Bukovina, 5,000 in Estonia, 95,000 in Latvia, 155,000 in Lithuania (excluding Vilna), 1.5 to 1.6 million in Soviet-occupied Poland, and another 3.1 million in the USSR. During the invasion of the Soviet Union, the Jews were unaware of the Nazi anti-Jewish policies, partly as a result of Soviet silence about the matter. In the German-occupied Soviet territories, local Nazi collaborationist units represented over 80% of the available German forces, which provided them with a total of nearly 450,000 personnel organised in so-called Schutzmannschaften formations. Practically all of these units participated in the round-ups and mass shootings. The overwhelming majority were recruited in the western USSR and the Baltic region, areas recently occupied by the Soviets where the Jews were typically scapegoated, which exacerbated pre-Nazi antisemitic attitudes. Ukrainians in particular, displayed some of the most virulent hatred of the Jews and approved of German measures against them, despite their initial constraint in persecuting them. Eventually some 12,000 Ukrainian auxiliaries joined the Nazis in perpetuating the Final Solution and while many of them participated as Ukrainian nationalists, antisemitism proved a factor, one which they acquired on the job. Thousands of Ukrainians rushed to occupy businesses and homes vacated by persecuted Jews. German Einsatzgruppen units, members of the Wehrmacht, Order Police, and auxiliary units mostly from Latvia, Lithuania and Ukraine were already engaged in killing operations in the summer of 1941 and by July of that year, they had helped kill 39,000 Ukrainian Jews, and another 26,000 Jews in Belarus. Local citizens aided by militias in Latvia, Bukovina, Romania, Bessarabia, Moldavia, Lithuania, Bialystok, Galicia, and elsewhere killed tens-of-thousands of Jews on their own accord. Throughout the remainder of 1941 to the autumn of 1942, the concerted murder operations proceeded apace. Not accounting for the deaths of victims from its territories, at least 700,000 Soviet Jews and 30,000 Gypsies were killed in the Holocaust. Another three-million Soviet soldiers were killed or starved-to-death by the Germans. Spain During World War II, Francisco Franco remained largely silent in regard to Jewish matters, and Spain became an unlikely escape route and haven for thousands of Jews. Franco was known to harbor virulent antisemitic beliefs and agreed with Hitler that Judaism, Communism, and cosmopolitanism were related threats to European society. Western European Jews still fled to Spain, as they sought to escape deportation to concentration camps from German-occupied France, but also Sephardic Jews from Eastern Europe, especially in Hungary. Trudy Alexy refers to the "absurdity" and "paradox of refugees fleeing the Nazis' Final Solution to seek asylum in a country where no Jews had been allowed to live openly as Jews for over four centuries." In the first years of the war, "Laws regulating their admittance were written and mostly ignored." Once the tide of war began to turn against the Germans, and Count Francisco Gómez-Jordana succeeded Franco's brother-in-law Serrano Súñer as Spain's foreign minister, Spanish diplomacy became "more sympathetic to Jews", although Franco himself "never said anything" about it. Around that same time, a contingent of Spanish doctors traveling in Poland were fully informed of the Nazi extermination plans by the Gauleiter Frankel of Warsaw, who was under the misimpression that they would share his views about the matter; when they returned home, they passed the information to Admiral Luís Carrero Blanco, who told Franco. Allied diplomats discussed the possibility of Spain as a route to a containment camp for Jewish refugees near Casablanca, but it came to nothing due to a lack of support. Nonetheless, control of the Spanish border with France relaxed somewhat and thousands of Jews managed to cross into Spain (many by smugglers' routes). Almost all of them survived the war. The American Jewish Joint Distribution Committee operated openly in Barcelona. Francoist Spain, despite its aversion to Zionism and "Judeo"-Freemasonry, does not appear to have shared the rabid antisemitic ideology promoted by the Nazis. About 20,000 to 30,000 refugees, mainly Jews, were allowed to transit through Spain to Portugal and beyond. About 5,000 Jews in occupied Europe benefitted from Spanish legal protection. In 2010, a document was found in Spanish archives, which revealed that Franco's government gave a main architect of the Nazi "Final Solution", Heinrich Himmler, a list of six thousand Jews living in Spain, upon his request. Jose Maria Finat y Escriva de Romani, Franco's chief of security issued an official order dated 13 May 1941 to all provincial governors requesting a list of all Jews, both local and foreign, present in their districts. After the list was compiled, Romani was appointed Spain's ambassador to Germany, enabling him to deliver the list to Himmler. Following the defeat of Germany in 1945, the Spanish government attempted to destroy all evidence of cooperation with the Nazis, but this official order survived. Spanish diplomats did save thousands of Jews, but it was done on their personal initiative. Sweden Before the onset of the Second World War, approximately 7,000 Jews resided in Sweden, most of whom lived in Stockholm. Like Switzerland, the Swedish government remained neutral due to its financial ties and the economic advantages it secured from a friendly relationship with Germany. There was even a small fascist pro-Nazi political group—known as the Swedish National Socialist Party—but they were unable to rally support for their cause. Swedish authorities were initially resistant to Jewish immigration into the country and several thousand were turned away. That was not to last, as by 1942 the Swedish government started allowing Norwegian and Finnish immigrants, as well as taking in some 900 Norwegian Jews. Another 7,000 Danish Jews and some 9,000 Danish Christians were permitted entrance to Sweden in 1943. In 1944, the Swedish diplomat Raoul Wallenberg traveled to Budapest and negotiated for the release of thousands of Hungarian Jews. Wallenberg's efforts secured passports for 15,000–20,000 Jews; he and those collaborating with him very likely saved the lives of some 70,000 Jews before the Red Army's arrival in Hungary during January 1945. Switzerland Proximity to Nazi Germany as a bordering nation made the Swiss government very tentative about dealing with the Jews. Sharing a physical border with Germany was also part of the reason that the Swiss maintained amicable economic relations with Germany. Correspondingly, both Sweden and especially Switzerland cooperated with the Nazis concerning banking and the exploitation of financial opportunities, as they knowingly accepted expropriation of money and goods, which previously belonged to Jewish companies and/or families for their own gain. Before 1938, Swiss alien and refugee policy was already restrictive toward certain people and groups, notably foreign Roma and Sinti. However, from that date, restrictions were intensified, particularly towards Jews. As part of that policy, the Swiss government requested that the German government mark the passports of German Jews with a "J" as they were not ready to grant asylum on the grounds of racial persecution. This policy took effect following the Anschluß with Austria, as the Swiss government was concerned about potential Jewish refugees fleeing and inundating them accordingly. In 1942 Swiss borders were completely closed to all Jewish refugees, which even included Jewish children. By late October 1942, news of the Jewish catastrophe had reached Switzerland. After German troops seized control of Italy, which had withdrawn its political and military support when non-fascist Italians overthrew Mussolini, hundreds of Jews escaped over the mountain passes into neutral Switzerland. French resistance fighters and activists were also instrumental in helping smuggle Jews from France into neutral Spain and Switzerland, where they were able to find shelter. Sometime in 1944, some 1,684 Hungarian Jews arrived in Switzerland from Bergen-Belsen concentration camp, another 1,200 Jews from Theresienstadt concentration camp found safety in Switzerland and by February 1945, over 115,000 refugees of various types had made their way across the Swiss border to safety. The International Commission of Experts (ICE) set up in 1996 by the Swiss parliament to examine relations between Nazi Germany and Switzerland reported: "Anti-Semitic views were more or less widespread amongst the political classes, the civil service, the military and the church." The ICE wrote: "by progressively closing the borders, delivering captured refugees over to their persecutors, and adhering to restrictive principles for far too long, the country stood by as many people were undoubtedly driven to certain death." Although accurate statistics are hard to put together, the commission concluded that "It must therefore be assumed that Switzerland turned back or deported over 20,000 refugees during the Second World War. Furthermore, between 1938 and November 1944, around 14,500 applications for entry visas submitted by hopeful emigrants to the Swiss diplomatic missions abroad were refused." United States According to The Encyclopedia of the Holocaust, the U.S. failed to live up to its creed about accepting the "tired, poor, huddled masses" of the world during the Holocaust. The U.S. policy towards Jews fleeing Germany and claiming asylum was restrictive. In 1939, the annual combined German-Austrian immigration quota was 27,370. A famous incident was the U.S. denial of entry to the St. Louis, a ship loaded with 937 passengers. Almost all passengers aboard the vessel were Jews fleeing from Nazi Germany. Most were German citizens, some were from Eastern Europe, and a few were officially "stateless." The ship's original destination was Cuba, but the Cuban government, after admitting 28 refugees, ordered the ship to leave. The ship continued to the U.S., sailing so close to Florida that the passengers could see the lights of Miami. Some passengers on the St. Louis cabled President Franklin D. Roosevelt asking for refuge. Roosevelt never responded, though he could have issued an executive order to admit the St. Louis refugees. A State Department telegram sent to a passenger stated that the passengers must "await their turns on the waiting list and qualify for and obtain immigration visas before they may be admissible into the United States." Finally, the ship was forced to return to Europe and some 254 of its Jewish passengers eventually were murdered in the Holocaust. On 17 December 1942, the United States finally issued a statement condemning the Nazi extermination program, but this turned out to be a meaningless gesture as did the follow-on Bermuda Conference of April 1943. By that same year, evidence of the death camps was circulating via firsthand accounts through the State Department but U.S. leaders took no effort to bomb the camps nor did America offer to take in hundreds of thousands of Jewish refugees. According to historian Victor Davis Hanson, American officials like then Assistant Secretary of State Breckinridge Long and Assistant Secretary of War John J. McCloy were "especially culpable" for their roles in "downplaying" evidence of the camps and for "incorrectly asserting that heavy bombers either could not reach camps like Auschwitz or could not be diverted from more important missions." In the end, the United States did not lift its immigration restriction against Jewish refugees until after the Second World War was over. Legal proceedings against Nazis The juridical notion of crimes against humanity was developed following the Holocaust. The sheer number of people murdered and the transnational nature of the mass killing shattered any notion of national sovereignty taking precedence over international law when prosecuting these crimes. There were a number of legal efforts established to bring Nazis and their collaborators to justice. Some of the higher-ranking Nazi officials were tried as part of the Nuremberg Trials, presided over by an Allied court; the first international tribunal of its kind. Other trials were conducted in the countries in which the defendants were citizens — in West Germany and Austria, many Nazis were let off with light sentences, with the claim of "following orders" ruled a mitigating circumstance, and many returned to society soon afterward. An ongoing effort to pursue Nazis and collaborators resulted, famously, in the 1960 capture of Holocaust organizer Adolf Eichmann in Argentina (an operation led by Rafi Eitan) and to his subsequent trial in Israel in 1961. Simon Wiesenthal became one of the most famous Nazi hunters. Flight from justice and other obfuscations Some former Nazis escaped any charges. For example, Reinhard Gehlen, a former intelligence officer of the Wehrmacht, managed to work for the CIA, and created what informally became known as the Gehlen Organization. He recruited ex–intelligence-officers of the Wehrmacht and Nazis from the SS and SD to work for him. On 1 April 1956, the Bundesnachrichtendienst (BND; the German intelligence agency) was created from the Gehlen Organization, and transferred to the West German government. Gehlen became President of the BND and remained its head until 1968. Klaus Barbie, known as "the Butcher of Lyon" for his role at the head of the Gestapo, was protected from 1945 to 1955 by MI5 and the CIA, before fleeing to South America where he had a hand in Luis García Meza Tejada's 1980 Cocaine Coup in Bolivia. Barbie was finally arrested in 1983 and sentenced to life imprisonment for crimes against humanity in 1987. See also Bibliography of The Holocaust Collaboration with the Axis powers Command responsibility Evidence and documentation for the Holocaust International response to the Holocaust "Like sheep to the slaughter" List of companies involved in the Holocaust Rescue of Jews during the Holocaust - People who saved targeted groups from Hitler's regime References Informational notes Citations Bibliography Holocaust studies Aftermath of the Holocaust
In enzymology, a DNA alpha-glucosyltransferase () is an enzyme that catalyzes the chemical reaction in which an alpha-D-glucosyl residue is transferred from UDP-glucose to a hydroxymethylcytosine residue in DNA. This enzyme belongs to the family of glycosyltransferases, specifically the hexosyltransferases. The systematic name of this enzyme class is UDP-glucose:DNA alpha-D-glucosyltransferase. Other names in common use include uridine diphosphoglucose-deoxyribonucleate, alpha-glucosyltransferase, UDP-glucose-DNA alpha-glucosyltransferase, uridine diphosphoglucose-deoxyribonucleate, alpha-glucosyltransferase, T2-HMC-alpha-glucosyl transferase, T4-HMC-alpha-glucosyl transferase, and T6-HMC-alpha-glucosyl transferase. Structural studies As of late 2007, 5 structures have been solved for this class of enzymes, with PDB accession codes , , , , and . References EC 2.4.1 Enzymes of known structure
Rene Tammist (born 5 July 1978) is an Estonian politician representing the Social Democratic Party (SDE). He was sworn is as the Minister of Entrepreneurship and Information Technology in the cabinet of Jüri Ratas on 22 August 2018, succeeding Urve Palo, who resigned from the post. Background Before entering the politics, Tammist served as director of the Estonian Renewable Energy Association, a member of the Board of the European Agency for the Cooperation of Energy Regulators and adviser to the S&D Group in the European Parliament's Industry, Research and Energy Committee. References 1978 births Living people Politicians from Tartu Government ministers of Estonia 21st-century Estonian politicians
Uchastok №26 () is a rural locality (a settlement) and the administrative center of Shaninskoye Rural Settlement, Talovsky District, Voronezh Oblast, Russia. The population was 216 as of 2010. There are 15 streets. Geography Uchastok №26 is located 21 km northeast of Talovaya (the district's administrative centre) by road. Uchastok #4 is the nearest rural locality. References Rural localities in Talovsky District
The Silver Logie for Most Outstanding Reality Program is an award presented annually at the Australian TV Week Logie Awards. The award is given to recognise an outstanding Australian reality television program. The winner and nominees of this award are chosen by television industry juries. It was first awarded at the 61st Annual TV Week Logie Awards ceremony, held in 2019. Winner and Nominees Listed below are the winners, as well as their nominees, for each year. See also Logie Award for Most Popular Reality Program References External links 2019 establishments in Australia
```php <?php /* * * * path_to_url * * Unless required by applicable law or agreed to in writing, software * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the */ namespace Google\Service\CloudSearch; class AllAuthenticatedUsersProto extends \Google\Model { } // Adding a class alias for backwards compatibility with the previous class name. class_alias(AllAuthenticatedUsersProto::class, 'Google_Service_CloudSearch_AllAuthenticatedUsersProto'); ```
```python import sys import dask import dask.dataframe as dd from dask.dataframe.shuffle import SimpleShuffleLayer from unittest import mock import numpy as np import pandas as pd import pytest from ray.tests.conftest import * # noqa from ray.util.dask import dataframe_optimize from ray.util.dask.optimizations import ( rewrite_simple_shuffle_layer, MultipleReturnSimpleShuffleLayer, ) pytestmark = pytest.mark.skipif( sys.version_info >= (3, 12), reason="Skip dask tests for Python version 3.12+" ) def test_rewrite_simple_shuffle_layer(ray_start_regular_shared): npartitions = 10 df = dd.from_pandas( pd.DataFrame( np.random.randint(0, 100, size=(100, 2)), columns=["age", "grade"] ), npartitions=npartitions, ) # We set max_branch=npartitions in order to ensure that the task-based # shuffle happens in a single stage, which is required in order for our # optimization to work. a = df.set_index(["age"], shuffle="tasks", max_branch=npartitions) dsk = a.__dask_graph__() keys = a.__dask_keys__() assert any(type(v) is SimpleShuffleLayer for k, v in dsk.layers.items()) dsk = rewrite_simple_shuffle_layer(dsk, keys) assert all(type(v) is not SimpleShuffleLayer for k, v in dsk.layers.items()) assert any( type(v) is MultipleReturnSimpleShuffleLayer for k, v in dsk.layers.items() ) @mock.patch("ray.util.dask.optimizations.rewrite_simple_shuffle_layer") def test_dataframe_optimize(mock_rewrite, ray_start_regular_shared): def side_effect(dsk, keys): return rewrite_simple_shuffle_layer(dsk, keys) mock_rewrite.side_effect = side_effect with dask.config.set(dataframe_optimize=dataframe_optimize): npartitions = 10 df = dd.from_pandas( pd.DataFrame( np.random.randint(0, 100, size=(100, 2)), columns=["age", "grade"] ), npartitions=npartitions, ) # We set max_branch=npartitions in order to ensure that the task-based # shuffle happens in a single stage, which is required in order for our # optimization to work. a = df.set_index(["age"], shuffle="tasks", max_branch=npartitions).compute() assert mock_rewrite.call_count == 2 assert a.index.is_monotonic_increasing if __name__ == "__main__": import sys sys.exit(pytest.main(["-v", __file__])) ```
```objective-c /* ** $Id: luaconf.h $ ** Configuration file for Lua */ #ifndef luaconf_h #define luaconf_h #include <limits.h> #include <stddef.h> /* ** =================================================================== ** General Configuration File for Lua ** ** Some definitions here can be changed externally, through the ** compiler (e.g., with '-D' options). Those are protected by ** '#if !defined' guards. However, several other definitions should ** be changed directly here, either because they affect the Lua ** ABI (by making the changes here, you ensure that all software ** connected to Lua, such as C libraries, will be compiled with the ** same configuration); or because they are seldom changed. ** ** Search for "@@" to find all configurable definitions. ** =================================================================== */ /* ** {==================================================================== ** System Configuration: macros to adapt (if needed) Lua to some ** particular platform, for instance restricting it to C89. ** ===================================================================== */ /* @@ LUA_USE_C89 controls the use of non-ISO-C89 features. ** Define it if you want Lua to avoid the use of a few C99 features ** or Windows-specific features on Windows. */ /* #define LUA_USE_C89 */ /* ** By default, Lua on Windows use (some) specific Windows features */ #if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) #define LUA_USE_WINDOWS /* enable goodies for regular Windows */ #endif #if defined(LUA_USE_WINDOWS) #define LUA_DL_DLL /* enable support for DLL */ #define LUA_USE_C89 /* broadly, Windows is C89 */ #endif #if defined(LUA_USE_LINUX) #define LUA_USE_POSIX #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ #endif #if defined(LUA_USE_MACOSX) #define LUA_USE_POSIX #define LUA_USE_DLOPEN /* MacOS does not need -ldl */ #endif /* @@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits. */ #define LUAI_IS32INT ((UINT_MAX >> 30) >= 3) /* }================================================================== */ /* ** {================================================================== ** Configuration for Number types. ** =================================================================== */ /* @@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. */ /* #define LUA_32BITS */ /* @@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for ** C89 ('long' and 'double'); Windows always has '__int64', so it does ** not need to use this case. */ #if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) #define LUA_C89_NUMBERS #endif /* @@ LUA_INT_TYPE defines the type for Lua integers. @@ LUA_FLOAT_TYPE defines the type for Lua floats. ** Lua should work fine with any mix of these options supported ** by your C compiler. The usual configurations are 64-bit integers ** and 'double' (the default), 32-bit integers and 'float' (for ** restricted platforms), and 'long'/'double' (for C compilers not ** compliant with C99, which may not have support for 'long long'). */ /* predefined options for LUA_INT_TYPE */ #define LUA_INT_INT 1 #define LUA_INT_LONG 2 #define LUA_INT_LONGLONG 3 /* predefined options for LUA_FLOAT_TYPE */ #define LUA_FLOAT_FLOAT 1 #define LUA_FLOAT_DOUBLE 2 #define LUA_FLOAT_LONGDOUBLE 3 #if defined(LUA_32BITS) /* { */ /* ** 32-bit integers and 'float' */ #if LUAI_IS32INT /* use 'int' if big enough */ #define LUA_INT_TYPE LUA_INT_INT #else /* otherwise use 'long' */ #define LUA_INT_TYPE LUA_INT_LONG #endif #define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT #elif defined(LUA_C89_NUMBERS) /* }{ */ /* ** largest types available for C89 ('long' and 'double') */ #define LUA_INT_TYPE LUA_INT_LONG #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE #endif /* } */ /* ** default configuration for 64-bit Lua ('long long' and 'double') */ #if !defined(LUA_INT_TYPE) #define LUA_INT_TYPE LUA_INT_LONGLONG #endif #if !defined(LUA_FLOAT_TYPE) #define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE #endif /* }================================================================== */ /* ** {================================================================== ** Configuration for Paths. ** =================================================================== */ /* ** LUA_PATH_SEP is the character that separates templates in a path. ** LUA_PATH_MARK is the string that marks the substitution points in a ** template. ** LUA_EXEC_DIR in a Windows path is replaced by the executable's ** directory. */ #define LUA_PATH_SEP ";" #define LUA_PATH_MARK "?" #define LUA_EXEC_DIR "!" /* @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for ** Lua libraries. @@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for ** C libraries. ** CHANGE them if your machine has a non-conventional directory ** hierarchy or if you want to install your libraries in ** non-conventional directories. */ #define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR #if defined(_WIN32) /* { */ /* ** In Windows, any exclamation mark ('!') in the path is replaced by the ** path of the directory of the executable file of the current process. */ #define LUA_LDIR "!\\lua\\" #define LUA_CDIR "!\\" #define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" #if !defined(LUA_PATH_DEFAULT) #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ ".\\?.lua;" ".\\?\\init.lua" #endif #if !defined(LUA_CPATH_DEFAULT) #define LUA_CPATH_DEFAULT \ LUA_CDIR"?.dll;" \ LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ LUA_CDIR"loadall.dll;" ".\\?.dll;" \ LUA_CDIR"?54.dll;" ".\\?54.dll" #endif #else /* }{ */ #define LUA_ROOT "/usr/local/" #define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" #define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" #if !defined(LUA_PATH_DEFAULT) #define LUA_PATH_DEFAULT \ LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ "./?.lua;" "./?/init.lua" #endif #if !defined(LUA_CPATH_DEFAULT) #define LUA_CPATH_DEFAULT \ LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so;" \ LUA_CDIR"lib?54.so;" "./lib?54.so" #endif #endif /* } */ /* @@ LUA_DIRSEP is the directory separator (for submodules). ** CHANGE it if your machine does not use "/" as the directory separator ** and is not Windows. (On Windows Lua automatically uses "\".) */ #if !defined(LUA_DIRSEP) #if defined(_WIN32) #define LUA_DIRSEP "\\" #else #define LUA_DIRSEP "/" #endif #endif /* }================================================================== */ /* ** {================================================================== ** Marks for exported symbols in the C code ** =================================================================== */ /* @@ LUA_API is a mark for all core API functions. @@ LUALIB_API is a mark for all auxiliary library functions. @@ LUAMOD_API is a mark for all standard library opening functions. ** CHANGE them if you need to define those functions in some special way. ** For instance, if you want to create one Windows DLL with the core and ** the libraries, you may want to use the following definition (define ** LUA_BUILD_AS_DLL to get it). */ #if defined(LUA_BUILD_AS_DLL) /* { */ #if defined(LUA_CORE) || defined(LUA_LIB) /* { */ #define LUA_API __declspec(dllexport) #else /* }{ */ #define LUA_API __declspec(dllimport) #endif /* } */ #else /* }{ */ #define LUA_API extern #endif /* } */ /* ** More often than not the libs go together with the core. */ #define LUALIB_API LUA_API #define LUAMOD_API LUA_API /* @@ LUAI_FUNC is a mark for all extern functions that are not to be ** exported to outside modules. @@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables, ** none of which to be exported to outside modules (LUAI_DDEF for ** definitions and LUAI_DDEC for declarations). ** CHANGE them if you need to mark them in some special way. Elf/gcc ** (versions 3.2 and later) mark them as "hidden" to optimize access ** when Lua is compiled as a shared library. Not all elf targets support ** this attribute. Unfortunately, gcc does not offer a way to check ** whether the target offers that support, and those without support ** give a warning about it. To avoid these warnings, change to the ** default definition. */ #if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ defined(__ELF__) /* { */ #define LUAI_FUNC __attribute__((visibility("internal"))) extern #else /* }{ */ #define LUAI_FUNC extern #endif /* } */ #define LUAI_DDEC(dec) LUAI_FUNC dec #define LUAI_DDEF /* empty */ /* }================================================================== */ /* ** {================================================================== ** Compatibility with previous versions ** =================================================================== */ /* @@ LUA_COMPAT_5_3 controls other macros for compatibility with Lua 5.3. ** You can define it to get all options, or change specific options ** to fit your specific needs. */ #if defined(LUA_COMPAT_5_3) /* { */ /* @@ LUA_COMPAT_MATHLIB controls the presence of several deprecated ** functions in the mathematical library. ** (These functions were already officially removed in 5.3; ** nevertheless they are still available here.) */ #define LUA_COMPAT_MATHLIB /* @@ LUA_COMPAT_APIINTCASTS controls the presence of macros for ** manipulating other integer types (lua_pushunsigned, lua_tounsigned, ** luaL_checkint, luaL_checklong, etc.) ** (These macros were also officially removed in 5.3, but they are still ** available here.) */ #define LUA_COMPAT_APIINTCASTS /* @@ LUA_COMPAT_LT_LE controls the emulation of the '__le' metamethod ** using '__lt'. */ #define LUA_COMPAT_LT_LE /* @@ The following macros supply trivial compatibility for some ** changes in the API. The macros themselves document how to ** change your code to avoid using them. ** (Once more, these macros were officially removed in 5.3, but they are ** still available here.) */ #define lua_strlen(L,i) lua_rawlen(L, (i)) #define lua_objlen(L,i) lua_rawlen(L, (i)) #define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) #define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) #endif /* } */ /* }================================================================== */ /* ** {================================================================== ** Configuration for Numbers. ** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* ** satisfy your needs. ** =================================================================== */ /* @@ LUA_NUMBER is the floating-point type used by Lua. @@ LUAI_UACNUMBER is the result of a 'default argument promotion' @@ over a floating number. @@ l_floatatt(x) corrects float attribute 'x' to the proper float type ** by prefixing it with one of FLT/DBL/LDBL. @@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. @@ LUA_NUMBER_FMT is the format for writing floats. @@ lua_number2str converts a float to a string. @@ l_mathop allows the addition of an 'l' or 'f' to all math operations. @@ l_floor takes the floor of a float. @@ lua_str2number converts a decimal numeral to a number. */ /* The following definitions are good for most cases here */ #define l_floor(x) (l_mathop(floor)(x)) #define lua_number2str(s,sz,n) \ l_sprintf((s), sz, LUA_NUMBER_FMT, (LUAI_UACNUMBER)(n)) /* @@ lua_numbertointeger converts a float number with an integral value ** to an integer, or returns 0 if float is not within the range of ** a lua_Integer. (The range comparisons are tricky because of ** rounding. The tests here assume a two-complement representation, ** where MININTEGER always has an exact representation as a float; ** MAXINTEGER may not have one, and therefore its conversion to float ** may have an ill-defined value.) */ #define lua_numbertointeger(n,p) \ ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ (*(p) = (LUA_INTEGER)(n), 1)) /* now the variable definitions */ #if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ #define LUA_NUMBER float #define l_floatatt(n) (FLT_##n) #define LUAI_UACNUMBER double #define LUA_NUMBER_FRMLEN "" #define LUA_NUMBER_FMT "%.7g" #define l_mathop(op) op##f #define lua_str2number(s,p) strtof((s), (p)) #elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ #define LUA_NUMBER long double #define l_floatatt(n) (LDBL_##n) #define LUAI_UACNUMBER long double #define LUA_NUMBER_FRMLEN "L" #define LUA_NUMBER_FMT "%.19Lg" #define l_mathop(op) op##l #define lua_str2number(s,p) strtold((s), (p)) #elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ #define LUA_NUMBER double #define l_floatatt(n) (DBL_##n) #define LUAI_UACNUMBER double #define LUA_NUMBER_FRMLEN "" #define LUA_NUMBER_FMT "%.14g" #define l_mathop(op) op #define lua_str2number(s,p) strtod((s), (p)) #else /* }{ */ #error "numeric float type not defined" #endif /* } */ /* @@ LUA_INTEGER is the integer type used by Lua. ** @@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. ** @@ LUAI_UACINT is the result of a 'default argument promotion' @@ over a LUA_INTEGER. @@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. @@ LUA_INTEGER_FMT is the format for writing integers. @@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. @@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. @@ LUA_MAXUNSIGNED is the maximum value for a LUA_UNSIGNED. @@ LUA_UNSIGNEDBITS is the number of bits in a LUA_UNSIGNED. @@ lua_integer2str converts an integer to a string. */ /* The following definitions are good for most cases here */ #define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" #define LUAI_UACINT LUA_INTEGER #define lua_integer2str(s,sz,n) \ l_sprintf((s), sz, LUA_INTEGER_FMT, (LUAI_UACINT)(n)) /* ** use LUAI_UACINT here to avoid problems with promotions (which ** can turn a comparison between unsigneds into a signed comparison) */ #define LUA_UNSIGNED unsigned LUAI_UACINT #define LUA_UNSIGNEDBITS (sizeof(LUA_UNSIGNED) * CHAR_BIT) /* now the variable definitions */ #if LUA_INT_TYPE == LUA_INT_INT /* { int */ #define LUA_INTEGER int #define LUA_INTEGER_FRMLEN "" #define LUA_MAXINTEGER INT_MAX #define LUA_MININTEGER INT_MIN #define LUA_MAXUNSIGNED UINT_MAX #elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ #define LUA_INTEGER long #define LUA_INTEGER_FRMLEN "l" #define LUA_MAXINTEGER LONG_MAX #define LUA_MININTEGER LONG_MIN #define LUA_MAXUNSIGNED ULONG_MAX #elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ /* use presence of macro LLONG_MAX as proxy for C99 compliance */ #if defined(LLONG_MAX) /* { */ /* use ISO C99 stuff */ #define LUA_INTEGER long long #define LUA_INTEGER_FRMLEN "ll" #define LUA_MAXINTEGER LLONG_MAX #define LUA_MININTEGER LLONG_MIN #define LUA_MAXUNSIGNED ULLONG_MAX #elif defined(LUA_USE_WINDOWS) /* }{ */ /* in Windows, can use specific Windows types */ #define LUA_INTEGER __int64 #define LUA_INTEGER_FRMLEN "I64" #define LUA_MAXINTEGER _I64_MAX #define LUA_MININTEGER _I64_MIN #define LUA_MAXUNSIGNED _UI64_MAX #else /* }{ */ #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" #endif /* } */ #else /* }{ */ #error "numeric integer type not defined" #endif /* } */ /* }================================================================== */ /* ** {================================================================== ** Dependencies with C99 and other C details ** =================================================================== */ /* @@ l_sprintf is equivalent to 'snprintf' or 'sprintf' in C89. ** (All uses in Lua have only one format item.) */ #if !defined(LUA_USE_C89) #define l_sprintf(s,sz,f,i) snprintf(s,sz,f,i) #else #define l_sprintf(s,sz,f,i) ((void)(sz), sprintf(s,f,i)) #endif /* @@ lua_strx2number converts a hexadecimal numeral to a number. ** In C99, 'strtod' does that conversion. Otherwise, you can ** leave 'lua_strx2number' undefined and Lua will provide its own ** implementation. */ #if !defined(LUA_USE_C89) #define lua_strx2number(s,p) lua_str2number(s,p) #endif /* @@ lua_pointer2str converts a pointer to a readable string in a ** non-specified way. */ #define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p) /* @@ lua_number2strx converts a float to a hexadecimal numeral. ** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. ** Otherwise, you can leave 'lua_number2strx' undefined and Lua will ** provide its own implementation. */ #if !defined(LUA_USE_C89) #define lua_number2strx(L,b,sz,f,n) \ ((void)L, l_sprintf(b,sz,f,(LUAI_UACNUMBER)(n))) #endif /* ** 'strtof' and 'opf' variants for math functions are not valid in ** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the ** availability of these variants. ('math.h' is already included in ** all files that use these macros.) */ #if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) #undef l_mathop /* variants not available */ #undef lua_str2number #define l_mathop(op) (lua_Number)op /* no variant */ #define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) #endif /* @@ LUA_KCONTEXT is the type of the context ('ctx') for continuation ** functions. It must be a numerical type; Lua will use 'intptr_t' if ** available, otherwise it will use 'ptrdiff_t' (the nearest thing to ** 'intptr_t' in C89) */ #define LUA_KCONTEXT ptrdiff_t #if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ __STDC_VERSION__ >= 199901L #include <stdint.h> #if defined(INTPTR_MAX) /* even in C99 this type is optional */ #undef LUA_KCONTEXT #define LUA_KCONTEXT intptr_t #endif #endif /* @@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). ** Change that if you do not want to use C locales. (Code using this ** macro must include the header 'locale.h'.) */ #if !defined(lua_getlocaledecpoint) #define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) #endif /* }================================================================== */ /* ** {================================================================== ** Language Variations ** ===================================================================== */ /* @@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some ** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from ** numbers to strings. Define LUA_NOCVTS2N to turn off automatic ** coercion from strings to numbers. */ /* #define LUA_NOCVTN2S */ /* #define LUA_NOCVTS2N */ /* @@ LUA_USE_APICHECK turns on several consistency checks on the C API. ** Define it as a help when debugging C code. */ #if defined(LUA_USE_APICHECK) #include <assert.h> #define luai_apicheck(l,e) assert(e) #endif /* }================================================================== */ /* ** {================================================================== ** Macros that affect the API and must be stable (that is, must be the ** same when you compile Lua and when you compile code that links to ** Lua). ** ===================================================================== */ /* @@ LUAI_MAXSTACK limits the size of the Lua stack. ** CHANGE it if you need a different limit. This limit is arbitrary; ** its only purpose is to stop Lua from consuming unlimited stack ** space (and to reserve some numbers for pseudo-indices). ** (It must fit into max(size_t)/32.) */ #if LUAI_IS32INT #define LUAI_MAXSTACK 1000000 #else #define LUAI_MAXSTACK 15000 #endif /* @@ LUA_EXTRASPACE defines the size of a raw memory area associated with ** a Lua state with very fast access. ** CHANGE it if you need a different size. */ #define LUA_EXTRASPACE (sizeof(void *)) /* @@ LUA_IDSIZE gives the maximum size for the description of the source @@ of a function in debug information. ** CHANGE it if you want a different size. */ #define LUA_IDSIZE 60 /* @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. */ #define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number))) /* @@ LUAI_MAXALIGN defines fields that, when used in a union, ensure ** maximum alignment for the other items in that union. */ #define LUAI_MAXALIGN lua_Number n; double u; void *s; lua_Integer i; long l /* }================================================================== */ /* =================================================================== */ /* ** Local configuration. You can use this space to add your redefinitions ** without modifying the main part of the file. */ #endif ```
```c * * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "Hacl_HPKE_Curve51_CP32_SHA512.h" #include "internal/Hacl_Krmllib.h" /* SNIPPET_START: Hacl_HPKE_Curve51_CP32_SHA512_setupBaseS */ uint32_t Hacl_HPKE_Curve51_CP32_SHA512_setupBaseS( uint8_t *o_pkE, Hacl_Impl_HPKE_context_s o_ctx, uint8_t *skE, uint8_t *pkR, uint32_t infolen, uint8_t *info ) { uint8_t o_shared[32U] = { 0U }; uint8_t *o_pkE1 = o_pkE; Hacl_Curve25519_51_secret_to_public(o_pkE1, skE); uint32_t res1 = 0U; uint32_t res0; if (res1 == 0U) { uint8_t o_dh[32U] = { 0U }; uint8_t zeros[32U] = { 0U }; Hacl_Curve25519_51_scalarmult(o_dh, skE, pkR); uint8_t res2 = 255U; for (uint32_t i = 0U; i < 32U; i++) { uint8_t uu____0 = FStar_UInt8_eq_mask(o_dh[i], zeros[i]); res2 = (uint32_t)uu____0 & (uint32_t)res2; } uint8_t z = res2; uint32_t res; if (z == 255U) { res = 1U; } else { res = 0U; } uint32_t res20 = res; uint8_t o_kemcontext[64U] = { 0U }; if (res20 == 0U) { memcpy(o_kemcontext, o_pkE, 32U * sizeof (uint8_t)); uint8_t *o_pkRm = o_kemcontext + 32U; uint8_t *o_pkR = o_pkRm; memcpy(o_pkR, pkR, 32U * sizeof (uint8_t)); uint8_t *o_dhm = o_dh; uint8_t o_eae_prk[32U] = { 0U }; uint8_t suite_id_kem[5U] = { 0U }; uint8_t *uu____1 = suite_id_kem; uu____1[0U] = 0x4bU; uu____1[1U] = 0x45U; uu____1[2U] = 0x4dU; uint8_t *uu____2 = suite_id_kem + 3U; uu____2[0U] = 0U; uu____2[1U] = 32U; uint8_t *empty = suite_id_kem; uint8_t label_eae_prk[7U] = { 0x65U, 0x61U, 0x65U, 0x5fU, 0x70U, 0x72U, 0x6bU }; uint32_t len0 = 51U; KRML_CHECK_SIZE(sizeof (uint8_t), len0); uint8_t tmp0[len0]; memset(tmp0, 0U, len0 * sizeof (uint8_t)); uint8_t *uu____3 = tmp0; uu____3[0U] = 0x48U; uu____3[1U] = 0x50U; uu____3[2U] = 0x4bU; uu____3[3U] = 0x45U; uu____3[4U] = 0x2dU; uu____3[5U] = 0x76U; uu____3[6U] = 0x31U; memcpy(tmp0 + 7U, suite_id_kem, 5U * sizeof (uint8_t)); memcpy(tmp0 + 12U, label_eae_prk, 7U * sizeof (uint8_t)); memcpy(tmp0 + 19U, o_dhm, 32U * sizeof (uint8_t)); Hacl_HKDF_extract_sha2_256(o_eae_prk, empty, 0U, tmp0, len0); uint8_t label_shared_secret[13U] = { 0x73U, 0x68U, 0x61U, 0x72U, 0x65U, 0x64U, 0x5fU, 0x73U, 0x65U, 0x63U, 0x72U, 0x65U, 0x74U }; uint32_t len = 91U; KRML_CHECK_SIZE(sizeof (uint8_t), len); uint8_t tmp[len]; memset(tmp, 0U, len * sizeof (uint8_t)); store16_be(tmp, (uint16_t)32U); uint8_t *uu____4 = tmp + 2U; uu____4[0U] = 0x48U; uu____4[1U] = 0x50U; uu____4[2U] = 0x4bU; uu____4[3U] = 0x45U; uu____4[4U] = 0x2dU; uu____4[5U] = 0x76U; uu____4[6U] = 0x31U; memcpy(tmp + 9U, suite_id_kem, 5U * sizeof (uint8_t)); memcpy(tmp + 14U, label_shared_secret, 13U * sizeof (uint8_t)); memcpy(tmp + 27U, o_kemcontext, 64U * sizeof (uint8_t)); Hacl_HKDF_expand_sha2_256(o_shared, o_eae_prk, 32U, tmp, len, 32U); res0 = 0U; } else { res0 = 1U; } } else { res0 = 1U; } if (res0 == 0U) { uint8_t o_context[129U] = { 0U }; uint8_t o_secret[64U] = { 0U }; uint8_t suite_id[10U] = { 0U }; uint8_t *uu____5 = suite_id; uu____5[0U] = 0x48U; uu____5[1U] = 0x50U; uu____5[2U] = 0x4bU; uu____5[3U] = 0x45U; uint8_t *uu____6 = suite_id + 4U; uu____6[0U] = 0U; uu____6[1U] = 32U; uint8_t *uu____7 = suite_id + 6U; uu____7[0U] = 0U; uu____7[1U] = 3U; uint8_t *uu____8 = suite_id + 8U; uu____8[0U] = 0U; uu____8[1U] = 3U; uint8_t label_psk_id_hash[11U] = { 0x70U, 0x73U, 0x6bU, 0x5fU, 0x69U, 0x64U, 0x5fU, 0x68U, 0x61U, 0x73U, 0x68U }; uint8_t o_psk_id_hash[64U] = { 0U }; uint8_t *empty = suite_id; uint32_t len0 = 28U; KRML_CHECK_SIZE(sizeof (uint8_t), len0); uint8_t tmp0[len0]; memset(tmp0, 0U, len0 * sizeof (uint8_t)); uint8_t *uu____9 = tmp0; uu____9[0U] = 0x48U; uu____9[1U] = 0x50U; uu____9[2U] = 0x4bU; uu____9[3U] = 0x45U; uu____9[4U] = 0x2dU; uu____9[5U] = 0x76U; uu____9[6U] = 0x31U; memcpy(tmp0 + 7U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp0 + 17U, label_psk_id_hash, 11U * sizeof (uint8_t)); memcpy(tmp0 + 28U, empty, 0U * sizeof (uint8_t)); Hacl_HKDF_extract_sha2_512(o_psk_id_hash, empty, 0U, tmp0, len0); uint8_t label_info_hash[9U] = { 0x69U, 0x6eU, 0x66U, 0x6fU, 0x5fU, 0x68U, 0x61U, 0x73U, 0x68U }; uint8_t o_info_hash[64U] = { 0U }; uint32_t len1 = 26U + infolen; KRML_CHECK_SIZE(sizeof (uint8_t), len1); uint8_t tmp1[len1]; memset(tmp1, 0U, len1 * sizeof (uint8_t)); uint8_t *uu____10 = tmp1; uu____10[0U] = 0x48U; uu____10[1U] = 0x50U; uu____10[2U] = 0x4bU; uu____10[3U] = 0x45U; uu____10[4U] = 0x2dU; uu____10[5U] = 0x76U; uu____10[6U] = 0x31U; memcpy(tmp1 + 7U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp1 + 17U, label_info_hash, 9U * sizeof (uint8_t)); memcpy(tmp1 + 26U, info, infolen * sizeof (uint8_t)); Hacl_HKDF_extract_sha2_512(o_info_hash, empty, 0U, tmp1, len1); o_context[0U] = 0U; memcpy(o_context + 1U, o_psk_id_hash, 64U * sizeof (uint8_t)); memcpy(o_context + 65U, o_info_hash, 64U * sizeof (uint8_t)); uint8_t label_secret[6U] = { 0x73U, 0x65U, 0x63U, 0x72U, 0x65U, 0x74U }; uint32_t len2 = 23U; KRML_CHECK_SIZE(sizeof (uint8_t), len2); uint8_t tmp2[len2]; memset(tmp2, 0U, len2 * sizeof (uint8_t)); uint8_t *uu____11 = tmp2; uu____11[0U] = 0x48U; uu____11[1U] = 0x50U; uu____11[2U] = 0x4bU; uu____11[3U] = 0x45U; uu____11[4U] = 0x2dU; uu____11[5U] = 0x76U; uu____11[6U] = 0x31U; memcpy(tmp2 + 7U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp2 + 17U, label_secret, 6U * sizeof (uint8_t)); memcpy(tmp2 + 23U, empty, 0U * sizeof (uint8_t)); Hacl_HKDF_extract_sha2_512(o_secret, o_shared, 32U, tmp2, len2); uint8_t label_exp[3U] = { 0x65U, 0x78U, 0x70U }; uint32_t len3 = 151U; KRML_CHECK_SIZE(sizeof (uint8_t), len3); uint8_t tmp3[len3]; memset(tmp3, 0U, len3 * sizeof (uint8_t)); store16_be(tmp3, (uint16_t)64U); uint8_t *uu____12 = tmp3 + 2U; uu____12[0U] = 0x48U; uu____12[1U] = 0x50U; uu____12[2U] = 0x4bU; uu____12[3U] = 0x45U; uu____12[4U] = 0x2dU; uu____12[5U] = 0x76U; uu____12[6U] = 0x31U; memcpy(tmp3 + 9U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp3 + 19U, label_exp, 3U * sizeof (uint8_t)); memcpy(tmp3 + 22U, o_context, 129U * sizeof (uint8_t)); Hacl_HKDF_expand_sha2_512(o_ctx.ctx_exporter, o_secret, 64U, tmp3, len3, 64U); uint8_t label_key[3U] = { 0x6bU, 0x65U, 0x79U }; uint32_t len4 = 151U; KRML_CHECK_SIZE(sizeof (uint8_t), len4); uint8_t tmp4[len4]; memset(tmp4, 0U, len4 * sizeof (uint8_t)); store16_be(tmp4, (uint16_t)32U); uint8_t *uu____13 = tmp4 + 2U; uu____13[0U] = 0x48U; uu____13[1U] = 0x50U; uu____13[2U] = 0x4bU; uu____13[3U] = 0x45U; uu____13[4U] = 0x2dU; uu____13[5U] = 0x76U; uu____13[6U] = 0x31U; memcpy(tmp4 + 9U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp4 + 19U, label_key, 3U * sizeof (uint8_t)); memcpy(tmp4 + 22U, o_context, 129U * sizeof (uint8_t)); Hacl_HKDF_expand_sha2_512(o_ctx.ctx_key, o_secret, 64U, tmp4, len4, 32U); uint8_t label_base_nonce[10U] = { 0x62U, 0x61U, 0x73U, 0x65U, 0x5fU, 0x6eU, 0x6fU, 0x6eU, 0x63U, 0x65U }; uint32_t len = 158U; KRML_CHECK_SIZE(sizeof (uint8_t), len); uint8_t tmp[len]; memset(tmp, 0U, len * sizeof (uint8_t)); store16_be(tmp, (uint16_t)12U); uint8_t *uu____14 = tmp + 2U; uu____14[0U] = 0x48U; uu____14[1U] = 0x50U; uu____14[2U] = 0x4bU; uu____14[3U] = 0x45U; uu____14[4U] = 0x2dU; uu____14[5U] = 0x76U; uu____14[6U] = 0x31U; memcpy(tmp + 9U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp + 19U, label_base_nonce, 10U * sizeof (uint8_t)); memcpy(tmp + 29U, o_context, 129U * sizeof (uint8_t)); Hacl_HKDF_expand_sha2_512(o_ctx.ctx_nonce, o_secret, 64U, tmp, len, 12U); o_ctx.ctx_seq[0U] = 0ULL; return res0; } return res0; } /* SNIPPET_END: Hacl_HPKE_Curve51_CP32_SHA512_setupBaseS */ /* SNIPPET_START: Hacl_HPKE_Curve51_CP32_SHA512_setupBaseR */ uint32_t Hacl_HPKE_Curve51_CP32_SHA512_setupBaseR( Hacl_Impl_HPKE_context_s o_ctx, uint8_t *enc, uint8_t *skR, uint32_t infolen, uint8_t *info ) { uint8_t pkR[32U] = { 0U }; Hacl_Curve25519_51_secret_to_public(pkR, skR); uint32_t res1 = 0U; uint8_t shared[32U] = { 0U }; if (res1 == 0U) { uint8_t *pkE = enc; uint8_t dh[32U] = { 0U }; uint8_t zeros[32U] = { 0U }; Hacl_Curve25519_51_scalarmult(dh, skR, pkE); uint8_t res0 = 255U; for (uint32_t i = 0U; i < 32U; i++) { uint8_t uu____0 = FStar_UInt8_eq_mask(dh[i], zeros[i]); res0 = (uint32_t)uu____0 & (uint32_t)res0; } uint8_t z = res0; uint32_t res; if (z == 255U) { res = 1U; } else { res = 0U; } uint32_t res11 = res; uint32_t res2; uint8_t kemcontext[64U] = { 0U }; if (res11 == 0U) { uint8_t *pkRm = kemcontext + 32U; uint8_t *pkR1 = pkRm; Hacl_Curve25519_51_secret_to_public(pkR1, skR); uint32_t res20 = 0U; if (res20 == 0U) { memcpy(kemcontext, enc, 32U * sizeof (uint8_t)); uint8_t *dhm = dh; uint8_t o_eae_prk[32U] = { 0U }; uint8_t suite_id_kem[5U] = { 0U }; uint8_t *uu____1 = suite_id_kem; uu____1[0U] = 0x4bU; uu____1[1U] = 0x45U; uu____1[2U] = 0x4dU; uint8_t *uu____2 = suite_id_kem + 3U; uu____2[0U] = 0U; uu____2[1U] = 32U; uint8_t *empty = suite_id_kem; uint8_t label_eae_prk[7U] = { 0x65U, 0x61U, 0x65U, 0x5fU, 0x70U, 0x72U, 0x6bU }; uint32_t len0 = 51U; KRML_CHECK_SIZE(sizeof (uint8_t), len0); uint8_t tmp0[len0]; memset(tmp0, 0U, len0 * sizeof (uint8_t)); uint8_t *uu____3 = tmp0; uu____3[0U] = 0x48U; uu____3[1U] = 0x50U; uu____3[2U] = 0x4bU; uu____3[3U] = 0x45U; uu____3[4U] = 0x2dU; uu____3[5U] = 0x76U; uu____3[6U] = 0x31U; memcpy(tmp0 + 7U, suite_id_kem, 5U * sizeof (uint8_t)); memcpy(tmp0 + 12U, label_eae_prk, 7U * sizeof (uint8_t)); memcpy(tmp0 + 19U, dhm, 32U * sizeof (uint8_t)); Hacl_HKDF_extract_sha2_256(o_eae_prk, empty, 0U, tmp0, len0); uint8_t label_shared_secret[13U] = { 0x73U, 0x68U, 0x61U, 0x72U, 0x65U, 0x64U, 0x5fU, 0x73U, 0x65U, 0x63U, 0x72U, 0x65U, 0x74U }; uint32_t len = 91U; KRML_CHECK_SIZE(sizeof (uint8_t), len); uint8_t tmp[len]; memset(tmp, 0U, len * sizeof (uint8_t)); store16_be(tmp, (uint16_t)32U); uint8_t *uu____4 = tmp + 2U; uu____4[0U] = 0x48U; uu____4[1U] = 0x50U; uu____4[2U] = 0x4bU; uu____4[3U] = 0x45U; uu____4[4U] = 0x2dU; uu____4[5U] = 0x76U; uu____4[6U] = 0x31U; memcpy(tmp + 9U, suite_id_kem, 5U * sizeof (uint8_t)); memcpy(tmp + 14U, label_shared_secret, 13U * sizeof (uint8_t)); memcpy(tmp + 27U, kemcontext, 64U * sizeof (uint8_t)); Hacl_HKDF_expand_sha2_256(shared, o_eae_prk, 32U, tmp, len, 32U); res2 = 0U; } else { res2 = 1U; } } else { res2 = 1U; } if (res2 == 0U) { uint8_t o_context[129U] = { 0U }; uint8_t o_secret[64U] = { 0U }; uint8_t suite_id[10U] = { 0U }; uint8_t *uu____5 = suite_id; uu____5[0U] = 0x48U; uu____5[1U] = 0x50U; uu____5[2U] = 0x4bU; uu____5[3U] = 0x45U; uint8_t *uu____6 = suite_id + 4U; uu____6[0U] = 0U; uu____6[1U] = 32U; uint8_t *uu____7 = suite_id + 6U; uu____7[0U] = 0U; uu____7[1U] = 3U; uint8_t *uu____8 = suite_id + 8U; uu____8[0U] = 0U; uu____8[1U] = 3U; uint8_t label_psk_id_hash[11U] = { 0x70U, 0x73U, 0x6bU, 0x5fU, 0x69U, 0x64U, 0x5fU, 0x68U, 0x61U, 0x73U, 0x68U }; uint8_t o_psk_id_hash[64U] = { 0U }; uint8_t *empty = suite_id; uint32_t len0 = 28U; KRML_CHECK_SIZE(sizeof (uint8_t), len0); uint8_t tmp0[len0]; memset(tmp0, 0U, len0 * sizeof (uint8_t)); uint8_t *uu____9 = tmp0; uu____9[0U] = 0x48U; uu____9[1U] = 0x50U; uu____9[2U] = 0x4bU; uu____9[3U] = 0x45U; uu____9[4U] = 0x2dU; uu____9[5U] = 0x76U; uu____9[6U] = 0x31U; memcpy(tmp0 + 7U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp0 + 17U, label_psk_id_hash, 11U * sizeof (uint8_t)); memcpy(tmp0 + 28U, empty, 0U * sizeof (uint8_t)); Hacl_HKDF_extract_sha2_512(o_psk_id_hash, empty, 0U, tmp0, len0); uint8_t label_info_hash[9U] = { 0x69U, 0x6eU, 0x66U, 0x6fU, 0x5fU, 0x68U, 0x61U, 0x73U, 0x68U }; uint8_t o_info_hash[64U] = { 0U }; uint32_t len1 = 26U + infolen; KRML_CHECK_SIZE(sizeof (uint8_t), len1); uint8_t tmp1[len1]; memset(tmp1, 0U, len1 * sizeof (uint8_t)); uint8_t *uu____10 = tmp1; uu____10[0U] = 0x48U; uu____10[1U] = 0x50U; uu____10[2U] = 0x4bU; uu____10[3U] = 0x45U; uu____10[4U] = 0x2dU; uu____10[5U] = 0x76U; uu____10[6U] = 0x31U; memcpy(tmp1 + 7U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp1 + 17U, label_info_hash, 9U * sizeof (uint8_t)); memcpy(tmp1 + 26U, info, infolen * sizeof (uint8_t)); Hacl_HKDF_extract_sha2_512(o_info_hash, empty, 0U, tmp1, len1); o_context[0U] = 0U; memcpy(o_context + 1U, o_psk_id_hash, 64U * sizeof (uint8_t)); memcpy(o_context + 65U, o_info_hash, 64U * sizeof (uint8_t)); uint8_t label_secret[6U] = { 0x73U, 0x65U, 0x63U, 0x72U, 0x65U, 0x74U }; uint32_t len2 = 23U; KRML_CHECK_SIZE(sizeof (uint8_t), len2); uint8_t tmp2[len2]; memset(tmp2, 0U, len2 * sizeof (uint8_t)); uint8_t *uu____11 = tmp2; uu____11[0U] = 0x48U; uu____11[1U] = 0x50U; uu____11[2U] = 0x4bU; uu____11[3U] = 0x45U; uu____11[4U] = 0x2dU; uu____11[5U] = 0x76U; uu____11[6U] = 0x31U; memcpy(tmp2 + 7U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp2 + 17U, label_secret, 6U * sizeof (uint8_t)); memcpy(tmp2 + 23U, empty, 0U * sizeof (uint8_t)); Hacl_HKDF_extract_sha2_512(o_secret, shared, 32U, tmp2, len2); uint8_t label_exp[3U] = { 0x65U, 0x78U, 0x70U }; uint32_t len3 = 151U; KRML_CHECK_SIZE(sizeof (uint8_t), len3); uint8_t tmp3[len3]; memset(tmp3, 0U, len3 * sizeof (uint8_t)); store16_be(tmp3, (uint16_t)64U); uint8_t *uu____12 = tmp3 + 2U; uu____12[0U] = 0x48U; uu____12[1U] = 0x50U; uu____12[2U] = 0x4bU; uu____12[3U] = 0x45U; uu____12[4U] = 0x2dU; uu____12[5U] = 0x76U; uu____12[6U] = 0x31U; memcpy(tmp3 + 9U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp3 + 19U, label_exp, 3U * sizeof (uint8_t)); memcpy(tmp3 + 22U, o_context, 129U * sizeof (uint8_t)); Hacl_HKDF_expand_sha2_512(o_ctx.ctx_exporter, o_secret, 64U, tmp3, len3, 64U); uint8_t label_key[3U] = { 0x6bU, 0x65U, 0x79U }; uint32_t len4 = 151U; KRML_CHECK_SIZE(sizeof (uint8_t), len4); uint8_t tmp4[len4]; memset(tmp4, 0U, len4 * sizeof (uint8_t)); store16_be(tmp4, (uint16_t)32U); uint8_t *uu____13 = tmp4 + 2U; uu____13[0U] = 0x48U; uu____13[1U] = 0x50U; uu____13[2U] = 0x4bU; uu____13[3U] = 0x45U; uu____13[4U] = 0x2dU; uu____13[5U] = 0x76U; uu____13[6U] = 0x31U; memcpy(tmp4 + 9U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp4 + 19U, label_key, 3U * sizeof (uint8_t)); memcpy(tmp4 + 22U, o_context, 129U * sizeof (uint8_t)); Hacl_HKDF_expand_sha2_512(o_ctx.ctx_key, o_secret, 64U, tmp4, len4, 32U); uint8_t label_base_nonce[10U] = { 0x62U, 0x61U, 0x73U, 0x65U, 0x5fU, 0x6eU, 0x6fU, 0x6eU, 0x63U, 0x65U }; uint32_t len = 158U; KRML_CHECK_SIZE(sizeof (uint8_t), len); uint8_t tmp[len]; memset(tmp, 0U, len * sizeof (uint8_t)); store16_be(tmp, (uint16_t)12U); uint8_t *uu____14 = tmp + 2U; uu____14[0U] = 0x48U; uu____14[1U] = 0x50U; uu____14[2U] = 0x4bU; uu____14[3U] = 0x45U; uu____14[4U] = 0x2dU; uu____14[5U] = 0x76U; uu____14[6U] = 0x31U; memcpy(tmp + 9U, suite_id, 10U * sizeof (uint8_t)); memcpy(tmp + 19U, label_base_nonce, 10U * sizeof (uint8_t)); memcpy(tmp + 29U, o_context, 129U * sizeof (uint8_t)); Hacl_HKDF_expand_sha2_512(o_ctx.ctx_nonce, o_secret, 64U, tmp, len, 12U); o_ctx.ctx_seq[0U] = 0ULL; return 0U; } return 1U; } return 1U; } /* SNIPPET_END: Hacl_HPKE_Curve51_CP32_SHA512_setupBaseR */ /* SNIPPET_START: Hacl_HPKE_Curve51_CP32_SHA512_sealBase */ uint32_t Hacl_HPKE_Curve51_CP32_SHA512_sealBase( uint8_t *skE, uint8_t *pkR, uint32_t infolen, uint8_t *info, uint32_t aadlen, uint8_t *aad, uint32_t plainlen, uint8_t *plain, uint8_t *o_enc, uint8_t *o_ct ) { uint8_t ctx_key[32U] = { 0U }; uint8_t ctx_nonce[12U] = { 0U }; uint64_t ctx_seq = 0ULL; uint8_t ctx_exporter[64U] = { 0U }; Hacl_Impl_HPKE_context_s o_ctx = { .ctx_key = ctx_key, .ctx_nonce = ctx_nonce, .ctx_seq = &ctx_seq, .ctx_exporter = ctx_exporter }; uint32_t res = Hacl_HPKE_Curve51_CP32_SHA512_setupBaseS(o_enc, o_ctx, skE, pkR, infolen, info); if (res == 0U) { uint8_t nonce[12U] = { 0U }; uint64_t s = o_ctx.ctx_seq[0U]; uint8_t enc[12U] = { 0U }; store64_be(enc + 4U, s); KRML_MAYBE_FOR12(i, 0U, 12U, 1U, uint8_t xi = enc[i]; uint8_t yi = o_ctx.ctx_nonce[i]; nonce[i] = (uint32_t)xi ^ (uint32_t)yi;); uint8_t *cipher = o_ct; uint8_t *tag = o_ct + plainlen; Hacl_AEAD_Chacha20Poly1305_encrypt(cipher, tag, plain, plainlen, aad, aadlen, o_ctx.ctx_key, nonce); uint64_t s1 = o_ctx.ctx_seq[0U]; uint32_t res1; if (s1 == 18446744073709551615ULL) { res1 = 1U; } else { uint64_t s_ = s1 + 1ULL; o_ctx.ctx_seq[0U] = s_; res1 = 0U; } uint32_t res10 = res1; return res10; } return 1U; } /* SNIPPET_END: Hacl_HPKE_Curve51_CP32_SHA512_sealBase */ /* SNIPPET_START: Hacl_HPKE_Curve51_CP32_SHA512_openBase */ uint32_t Hacl_HPKE_Curve51_CP32_SHA512_openBase( uint8_t *pkE, uint8_t *skR, uint32_t infolen, uint8_t *info, uint32_t aadlen, uint8_t *aad, uint32_t ctlen, uint8_t *ct, uint8_t *o_pt ) { uint8_t ctx_key[32U] = { 0U }; uint8_t ctx_nonce[12U] = { 0U }; uint64_t ctx_seq = 0ULL; uint8_t ctx_exporter[64U] = { 0U }; Hacl_Impl_HPKE_context_s o_ctx = { .ctx_key = ctx_key, .ctx_nonce = ctx_nonce, .ctx_seq = &ctx_seq, .ctx_exporter = ctx_exporter }; uint32_t res = Hacl_HPKE_Curve51_CP32_SHA512_setupBaseR(o_ctx, pkE, skR, infolen, info); if (res == 0U) { uint8_t nonce[12U] = { 0U }; uint64_t s = o_ctx.ctx_seq[0U]; uint8_t enc[12U] = { 0U }; store64_be(enc + 4U, s); KRML_MAYBE_FOR12(i, 0U, 12U, 1U, uint8_t xi = enc[i]; uint8_t yi = o_ctx.ctx_nonce[i]; nonce[i] = (uint32_t)xi ^ (uint32_t)yi;); uint8_t *cipher = ct; uint8_t *tag = ct + ctlen - 16U; uint32_t res1 = Hacl_AEAD_Chacha20Poly1305_decrypt(o_pt, cipher, ctlen - 16U, aad, aadlen, o_ctx.ctx_key, nonce, tag); if (res1 == 0U) { uint64_t s1 = o_ctx.ctx_seq[0U]; if (s1 == 18446744073709551615ULL) { return 1U; } uint64_t s_ = s1 + 1ULL; o_ctx.ctx_seq[0U] = s_; return 0U; } return 1U; } return 1U; } /* SNIPPET_END: Hacl_HPKE_Curve51_CP32_SHA512_openBase */ ```
HMS Diamond was an in service 1874–89. History Diamond was built for the Royal Navy at Sheerness Dockyard and launched on 26 September 1874. In 1875 she commissioned service for the East Indies Station, later being transferred to the China Station. In 1876, she was driven ashore on the coast of Zanzibar. She was refloated. She returned to England in 1879 and was refitted and rearmed. After refit she commissioned service on the Australia Station in October 1881. She left the Australia Station in August 1888 and returned to England. She returned to Chatham and was paid off in 1889. She was sold in August 1889. Footnotes Bibliography Bastock, John (1988), Ships on the Australia Station, Child & Associates Publishing Pty Ltd; Frenchs Forest, Australia. External links 1874 ships Ships built in Sheerness Amethyst-class corvettes Victorian-era corvettes of the United Kingdom Maritime incidents in 1876
```xml <clickhouse> <remote_servers> <test_cluster> <shard> <replica> <host>node1</host> <port>9000</port> </replica> <replica> <host>node2</host> <port>9000</port> </replica> </shard> </test_cluster> </remote_servers> </clickhouse> ```
```xml import { RouteObject } from "react-router-dom"; import AppLayout from "src-SessionBear/layouts/AppLayout"; import { sessionRoutes } from "features/sessionBook"; import { miscRoutes } from "./miscRoutes"; import { authRoutes } from "routes/authRoutes"; import { settingsRoutes } from "./settingsRoutes"; import { accountRoutes } from "routes/accountRoutes"; import DashboardLayout from "src-SessionBear/layouts/DashboardLayout"; import FullScreenLayout from "layouts/FullScreenLayout"; import { inviteRoutes } from "routes/inviteRoutes"; import MinimalLayout from "src-SessionBear/layouts/MinimalLayout"; export const sessionBearRoutes: RouteObject[] = [ { path: "", element: <AppLayout />, children: [ /** App Dashboard - Normal Paths **/ { path: "", element: <DashboardLayout />, children: [...sessionRoutes, ...miscRoutes, ...authRoutes, ...settingsRoutes, ...accountRoutes], }, { path: "", element: <MinimalLayout />, children: [...inviteRoutes], }, /** Iframe paths - Without Header, Footer **/ { path: "iframe", element: <FullScreenLayout />, children: [...sessionRoutes], }, ], }, ]; ```
```java package ghIssues; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Issue2552 { private final List<List<?>> grid = new ArrayList<>(); // Non compliant public List<? extends List<?>> grid() { return grid; } // Compliant public List<? extends List<?>> unmodifiableGrid() { return grid.stream().map(Collections::unmodifiableList).toList(); } } ```
James Allan Turney (8 July 1922 – 8 July 1995) was an English footballer who made 40 appearances in the Football League playing as a winger for Darlington. He previously played non-league football for Blyth Shipyard and Blackhall Colliery Welfare, and went on to play for Blyth Spartans, eventually spending ten years as manager and becoming long serving chairman. References 1922 births 1995 deaths People from Cramlington Footballers from Northumberland English men's footballers Men's association football wingers Blackhall Colliery Welfare F.C. players Darlington F.C. players Blyth Spartans A.F.C. players English Football League players English football managers Blyth Spartans A.F.C. managers
```yaml {{- /* */}} {{- if and (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1/VerticalPodAutoscaler") .Values.operator.autoscaling.vpa.enabled }} apiVersion: autoscaling.k8s.io/v1 kind: VerticalPodAutoscaler metadata: name: {{ template "cilium.operator.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} app.kubernetes.io/part-of: cilium app.kubernetes.io/component: operator {{- if or .Values.operator.autoscaling.vpa.annotations .Values.commonAnnotations }} {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.operator.autoscaling.vpa.annotations .Values.commonAnnotations ) "context" . ) }} annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} {{- end }} spec: resourcePolicy: containerPolicies: - containerName: cilium-operator {{- with .Values.operator.autoscaling.vpa.controlledResources }} controlledResources: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.operator.autoscaling.vpa.maxAllowed }} maxAllowed: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.operator.autoscaling.vpa.minAllowed }} minAllowed: {{- toYaml . | nindent 8 }} {{- end }} targetRef: apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} kind: Deployment name: {{ include "cilium.operator.fullname" . }} {{- if .Values.operator.autoscaling.vpa.updatePolicy }} updatePolicy: {{- with .Values.operator.autoscaling.vpa.updatePolicy.updateMode }} updateMode: {{ . }} {{- end }} {{- end }} {{- end }} ```
```objective-c // // Generated by class-dump 3.5 (64 bit). // // #import <WebDriverAgentLib/CDStructures.h> #import <XCTest/XCUIElementQuery.h> @class NSArray, NSOrderedSet, NSString, XCUIApplication, XCUIElement; @interface XCUIElementQuery () { BOOL _changesScope; NSString *_queryDescription; XCUIElementQuery *_inputQuery; CDUnknownBlockType _filter; unsigned long long _expressedType; NSArray *_expressedIdentifiers; NSOrderedSet *_lastInput; NSOrderedSet *_lastOutput; } @property(copy) NSOrderedSet *lastOutput; // @synthesize lastOutput=_lastOutput; @property(copy) NSOrderedSet *lastInput; // @synthesize lastInput=_lastInput; @property(copy) NSArray *expressedIdentifiers; // @synthesize expressedIdentifiers=_expressedIdentifiers; @property unsigned long long expressedType; // @synthesize expressedType=_expressedType; @property BOOL changesScope; // @synthesize changesScope=_changesScope; @property(readonly, copy) CDUnknownBlockType filter; // @synthesize filter=_filter; @property(readonly) XCUIElementQuery *inputQuery; // @synthesize inputQuery=_inputQuery; @property(readonly, copy) NSString *queryDescription; // @synthesize queryDescription=_queryDescription; @property(readonly, copy) NSString *elementDescription; @property(readonly) XCUIApplication *application; - (id)matchingSnapshotsWithError:(id *)arg1; - (id)matchingSnapshotsHandleUIInterruption:(BOOL)arg1 withError:(id *)arg2; - (id)_elementMatchingAccessibilityElementOfSnapshot:(id)arg1; - (XCElementSnapshot *)elementSnapshotForDebugDescription; - (id)_containingPredicate:(id)arg1 queryDescription:(id)arg2; - (id)_predicateWithType:(unsigned long long)arg1 identifier:(id)arg2; - (id)_queryWithPredicate:(id)arg1; - (id)sorted:(CDUnknownBlockType)arg1; - (id)descending:(unsigned long long)arg1; - (id)ascending:(unsigned long long)arg1; - (id)filter:(CDUnknownBlockType)arg1; - (id)_debugInfoWithIndent:(id *)arg1; - (id)_derivedExpressedIdentifiers; - (unsigned long long)_derivedExpressedType; - (id)initWithInputQuery:(id)arg1 queryDescription:(id)arg2 filter:(CDUnknownBlockType)arg3; /*! DO NOT USE DIRECTLY! Please use fb_firstMatch instead */ - (XCUIElement *)firstMatch; @end ```
```javascript var dom = require('@xmldom/xmldom').DOMParser var gulp = require('gulp') var config = require('./config') var through = require('through2') const iso639_3_to_2 = { chs: 'zh-cn', cht: 'zh-tw', csy: 'cs-cz', deu: 'de', enu: 'en', esn: 'es', fra: 'fr', hun: 'hu', ita: 'it', jpn: 'ja', kor: 'ko', nld: 'nl', plk: 'pl', ptb: 'pt-br', ptg: 'pt', rus: 'ru', sve: 'sv-se', trk: 'tr' }; // converts a json object into a plain text json function convertDictionaryToJson(dict) { return JSON.stringify(dict, null, '\t') + '\n'; } // converts an xml file into a json object function convertXmlToDictionary(xmlInput, escapeChar = true) { let xmlDom = new dom().parseFromString(xmlInput); let transUnits = xmlDom.getElementsByTagName('trans-unit'); let dict = {}; for (var i = 0; i < transUnits.length; ++i) { let unit = transUnits[i]; // Extract ID attribute let id = unit.getAttribute('id'); // Extract source element if possible let sourceElement = unit.getElementsByTagName('source'); let source = ''; if (sourceElement.length >= 1) { source = escapeChars(sourceElement[0].textContent, escapeChar); } // Extract target element if possible let targetElement = unit.getElementsByTagName('target'); let target = ''; if (targetElement.length >= 1) { target = escapeChars(targetElement[0].textContent, escapeChar); } // Return json with {id:{target,source}} format dict[id] = { 'source': source, 'target': target }; } return dict; } // Escapes all characters which need to be escaped (') function escapeChars(input, escapeChar = true) { if (escapeChar) { return input.replace(/'/g, "\\'"); } else { return input; } } // export json files from *.xlf // mirrors the file paths and names gulp.task('ext:localization:xliff-to-json', function () { return gulp.src([config.paths.project.localization + '/xliff/**/*.xlf', '!' + config.paths.project.localization + '/xliff/enu/**/*.xlf', '!' + config.paths.project.localization + '/xliff/**/*localizedPackage.json.*.xlf']) .pipe(through.obj(function (file, enc, callback) { // convert xliff into json document let dict = convertXmlToDictionary(String(file.contents)); Object.keys(dict).map(function (key, index) { let target = dict[key]['target']; if (target) { dict[key] = target; } else { // Fall back to English dict[key] = dict[key]['source']; } }); file.contents = Buffer.from(convertDictionaryToJson(dict)); // modify file extensions to follow proper convention file.basename = file.basename.substr(0, file.basename.indexOf('.')) + '.i18n.json'; // callback to notify we have completed the current file callback(null, file); })) .pipe(gulp.dest(config.paths.project.localization + '/i18n/')); }); // Generates a localized constants file from the en xliff file gulp.task('ext:localization:xliff-to-ts', function () { return gulp.src([config.paths.project.localization + '/xliff/enu/constants/localizedConstants.enu.xlf']) .pipe(through.obj(function (file, enc, callback) { // convert xliff into json document let dict = convertXmlToDictionary(String(file.contents)); var contents = ['/* eslint-disable */', '// THIS IS A COMPUTER GENERATED FILE. CHANGES IN THIS FILE WILL BE OVERWRITTEN.', '// TO ADD LOCALIZED CONSTANTS, ADD YOUR CONSTANT TO THE ENU XLIFF FILE UNDER ~/localization/xliff/enu/constants/localizedConstants.enu.xlf AND REBUILD THE PROJECT', 'import * as nls from \'vscode-nls\';']; for (var key in dict) { if (dict.hasOwnProperty(key)) { let instantiation = 'export let ' + key + ' = \'' + dict[key]['source'] + '\';'; contents.push(instantiation); } } // add headers to export localization function contents.push('export let loadLocalizedConstants = (locale: string) => {'); contents.push('\tlet localize = nls.config({ locale: locale })();'); // Re-export each constant for (var key in dict) { if (dict.hasOwnProperty(key)) { let instantiation = '\t' + key + ' = localize(\'' + key + '\', \'' + dict[key]['source'] + '\');'; contents.push(instantiation); } } contents.push('};'); // Join with new lines in between let fullFileContents = contents.join('\r\n') + '\r\n'; file.contents = Buffer.from(fullFileContents); // Name our file file.basename = 'localizedConstants.ts'; // callback to notify we have completed the current file callback(null, file); })) .pipe(gulp.dest(config.paths.project.root + '/src/constants/')); }); // Main function used for creating the package.nls.json files, both the original English and localizedFiles. function dictionaryMapping(file, packageAllKeys = undefined) { // convert xliff into json document (get the contents of the input XLF file) let dict = convertXmlToDictionary(String(file.contents), false); var contents = ['{']; var regxForReplacingQuotes = new RegExp('"', 'g'); // If packageAllKeys is provided, that means we are updating a localized package.nls.*.json file. let mainKeys = packageAllKeys ? packageAllKeys : dict; // If running in English package.nls.json mode: // Get keys from the XLF dictionary and use them directly for the file content. // If running in Localized package.nls.*.json mode: // Get all the keys from package.nls.json which is the English version and get the localized value from xlf // Use the English value if not translated, right now there's no fall back to English if the text is not localized. // So all the keys have to exist in all package.nls.*.json Object.keys(mainKeys).forEach(key => { let value = ''; if (contents.length >= 2) { contents[contents.length - 1] += ','; } if (packageAllKeys && dict.hasOwnProperty(key)) { //running in localized mode, use localized value. value = dict[key]['target']; } else if (dict.hasOwnProperty(key)) { //running in generation mode, use original source value. value = dict[key]['source']; } if (packageAllKeys && value === '') { // If localizing and value is not provided, use original English value. value = packageAllKeys[key]; } if (value && value.indexOf('"') >= 0) { value = value.replace(regxForReplacingQuotes, '\''); } let instantiation = '"' + key + '":"' + value + '"'; contents.push(instantiation); }); contents.push('}'); // Join with new lines in between let fullFileContents = contents.join('\r\n') + '\r\n'; file.contents = Buffer.from(fullFileContents); let indexToStart = 'localizedPackage.json.'.length + 1; let languageIndex = file.basename.indexOf('.', indexToStart); let language = file.basename.substr(indexToStart - 1, (languageIndex - indexToStart) + 1); // Name our file if (language === 'enu') { file.basename = 'package.nls.json'; } else { file.basename = 'package.nls.' + iso639_3_to_2[language] + '.json'; } // Make the new file create on root. // the original directory path was 'vscode-mssql\localization\xliff\<lang>' file.dirname = replaceLastString(file.dirname, `${language}`); file.dirname = replaceLastString(file.dirname, 'xliff'); file.dirname = replaceLastString(file.dirname, 'localization'); } function replaceLastString(stringInput, stringToTrim) { const index = stringInput.lastIndexOf(stringToTrim); if (index < 0) { return stringInput; } return stringInput.substr(0, index) + stringInput.substr(index + stringToTrim.length); } // Generates a package.nls.json file from localizedPackage.json.enu.xlf by using the // dictionaryMapping function to write the contents of the xlf file into package.nls.json. gulp.task('ext:localization:generate-eng-package.nls', function () { return gulp.src([config.paths.project.localization + '/xliff/enu/localizedPackage.json.enu.xlf'], { base: '.' }) .pipe(through.obj(function (file, enc, callback) { dictionaryMapping(file); // callback to notify we have completed the current file callback(null, file); })) .pipe(gulp.dest(config.paths.project.root)); }) // Generates a localized package.nls.*.json file from localizedPackage.json.*.xlf files by // using the dictionaryMapping function to replace contents of the package.nls.json file with // localized content if possible and write them to a new localized package.nls file. gulp.task('ext:localization:xliff-to-package.nls', function () { return gulp.src([config.paths.project.localization + '/xliff/**/localizedPackage.json.*.xlf', '!' + config.paths.project.localization + '/xliff/enu/localizedPackage.json.enu.xlf'], { base: '.' }) .pipe(through.obj(function (file, enc, callback) { // Get the latest changes from package.nls.json after being updated (base English strings). var packageAllKeys = require('./../package.nls.json') dictionaryMapping(file, packageAllKeys); // callback to notify we have completed the current file callback(null, file); })) .pipe(gulp.dest(config.paths.project.root)); }); ```
```go package main import ( "reflect" "github.com/kataras/iris/v12" "github.com/kataras/iris/v12/view" ) func main() { e := iris.Jet(nil, ".jet") // You can still use a file system though. e.AddFunc("greet", func(args view.JetArguments) reflect.Value { msg := "Hello, " + args.Get(0).String() + "!" return reflect.ValueOf(msg) }) err := e.ParseTemplate("program.jet", `<h1>{{greet(.Name)}}</h1>`) if err != nil { panic(err) } e.Reload(true) app := iris.New() app.RegisterView(e) app.Get("/", index) app.Listen(":8080") } func index(ctx iris.Context) { if err := ctx.View("program.jet", iris.Map{ "Name": "Gerasimos", }); err != nil { ctx.HTML("<h3>%s</h3>", err.Error()) return } } ```
```yaml homepage: "path_to_url" language: c++ primary_contact: "szewczyk@google.com" auto_ccs: - "p.antoine@catenacyber.fr" fuzzing_engines: - libfuzzer sanitizers: - address main_repo: 'path_to_url ```
```css /*! * Bootstrap Utilities v5.1.0 (path_to_url */.clearfix::after{display:block;clear:both;content:""}.link-primary{color:#0d6efd}.link-primary:focus,.link-primary:hover{color:#0a58ca}.link-secondary{color:#6c757d}.link-secondary:focus,.link-secondary:hover{color:#565e64}.link-success{color:#198754}.link-success:focus,.link-success:hover{color:#146c43}.link-info{color:#0dcaf0}.link-info:focus,.link-info:hover{color:#3dd5f3}.link-warning{color:#ffc107}.link-warning:focus,.link-warning:hover{color:#ffcd39}.link-danger{color:#dc3545}.link-danger:focus,.link-danger:hover{color:#b02a37}.link-light{color:#f8f9fa}.link-light:focus,.link-light:hover{color:#f9fafb}.link-dark{color:#212529}.link-dark:focus,.link-dark:hover{color:#1a1e21}.ratio{position:relative;width:100%}.ratio::before{display:block;padding-top:var(--bs-aspect-ratio);content:""}.ratio>*{position:absolute;top:0;left:0;width:100%;height:100%}.ratio-1x1{--bs-aspect-ratio:100%}.ratio-4x3{--bs-aspect-ratio:calc(3 / 4 * 100%)}.ratio-16x9{--bs-aspect-ratio:calc(9 / 16 * 100%)}.ratio-21x9{--bs-aspect-ratio:calc(9 / 21 * 100%)}.fixed-top{position:fixed;top:0;right:0;left:0;z-index:1030}.fixed-bottom{position:fixed;right:0;bottom:0;left:0;z-index:1030}.sticky-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}@media (min-width:576px){.sticky-sm-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}}@media (min-width:768px){.sticky-md-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}}@media (min-width:992px){.sticky-lg-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}}@media (min-width:1200px){.sticky-xl-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}}@media (min-width:1400px){.sticky-xxl-top{position:-webkit-sticky;position:sticky;top:0;z-index:1020}}.hstack{display:flex;flex-direction:row;align-items:center;align-self:stretch}.vstack{display:flex;flex:1 1 auto;flex-direction:column;align-self:stretch}.visually-hidden,.visually-hidden-focusable:not(:focus):not(:focus-within){position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}.stretched-link::after{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;content:""}.text-truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vr{display:inline-block;align-self:stretch;width:1px;min-height:1em;background-color:currentColor;opacity:.25}.align-baseline{vertical-align:baseline!important}.align-top{vertical-align:top!important}.align-middle{vertical-align:middle!important}.align-bottom{vertical-align:bottom!important}.align-text-bottom{vertical-align:text-bottom!important}.align-text-top{vertical-align:text-top!important}.float-start{float:left!important}.float-end{float:right!important}.float-none{float:none!important}.opacity-0{opacity:0!important}.opacity-25{opacity:.25!important}.opacity-50{opacity:.5!important}.opacity-75{opacity:.75!important}.opacity-100{opacity:1!important}.overflow-auto{overflow:auto!important}.overflow-hidden{overflow:hidden!important}.overflow-visible{overflow:visible!important}.overflow-scroll{overflow:scroll!important}.d-inline{display:inline!important}.d-inline-block{display:inline-block!important}.d-block{display:block!important}.d-grid{display:grid!important}.d-table{display:table!important}.d-table-row{display:table-row!important}.d-table-cell{display:table-cell!important}.d-flex{display:flex!important}.d-inline-flex{display:inline-flex!important}.d-none{display:none!important}.shadow{box-shadow:0 .5rem 1rem rgba(0,0,0,.15)!important}.shadow-sm{box-shadow:0 .125rem .25rem rgba(0,0,0,.075)!important}.shadow-lg{box-shadow:0 1rem 3rem rgba(0,0,0,.175)!important}.shadow-none{box-shadow:none!important}.position-static{position:static!important}.position-relative{position:relative!important}.position-absolute{position:absolute!important}.position-fixed{position:fixed!important}.position-sticky{position:-webkit-sticky!important;position:sticky!important}.top-0{top:0!important}.top-50{top:50%!important}.top-100{top:100%!important}.bottom-0{bottom:0!important}.bottom-50{bottom:50%!important}.bottom-100{bottom:100%!important}.start-0{left:0!important}.start-50{left:50%!important}.start-100{left:100%!important}.end-0{right:0!important}.end-50{right:50%!important}.end-100{right:100%!important}.translate-middle{transform:translate(-50%,-50%)!important}.translate-middle-x{transform:translateX(-50%)!important}.translate-middle-y{transform:translateY(-50%)!important}.border{border:1px solid #dee2e6!important}.border-0{border:0!important}.border-top{border-top:1px solid #dee2e6!important}.border-top-0{border-top:0!important}.border-end{border-right:1px solid #dee2e6!important}.border-end-0{border-right:0!important}.border-bottom{border-bottom:1px solid #dee2e6!important}.border-bottom-0{border-bottom:0!important}.border-start{border-left:1px solid #dee2e6!important}.border-start-0{border-left:0!important}.border-primary{border-color:#0d6efd!important}.border-secondary{border-color:#6c757d!important}.border-success{border-color:#198754!important}.border-info{border-color:#0dcaf0!important}.border-warning{border-color:#ffc107!important}.border-danger{border-color:#dc3545!important}.border-light{border-color:#f8f9fa!important}.border-dark{border-color:#212529!important}.border-white{border-color:#fff!important}.border-1{border-width:1px!important}.border-2{border-width:2px!important}.border-3{border-width:3px!important}.border-4{border-width:4px!important}.border-5{border-width:5px!important}.w-25{width:25%!important}.w-50{width:50%!important}.w-75{width:75%!important}.w-100{width:100%!important}.w-auto{width:auto!important}.mw-100{max-width:100%!important}.vw-100{width:100vw!important}.min-vw-100{min-width:100vw!important}.h-25{height:25%!important}.h-50{height:50%!important}.h-75{height:75%!important}.h-100{height:100%!important}.h-auto{height:auto!important}.mh-100{max-height:100%!important}.vh-100{height:100vh!important}.min-vh-100{min-height:100vh!important}.flex-fill{flex:1 1 auto!important}.flex-row{flex-direction:row!important}.flex-column{flex-direction:column!important}.flex-row-reverse{flex-direction:row-reverse!important}.flex-column-reverse{flex-direction:column-reverse!important}.flex-grow-0{flex-grow:0!important}.flex-grow-1{flex-grow:1!important}.flex-shrink-0{flex-shrink:0!important}.flex-shrink-1{flex-shrink:1!important}.flex-wrap{flex-wrap:wrap!important}.flex-nowrap{flex-wrap:nowrap!important}.flex-wrap-reverse{flex-wrap:wrap-reverse!important}.gap-0{gap:0!important}.gap-1{gap:.25rem!important}.gap-2{gap:.5rem!important}.gap-3{gap:1rem!important}.gap-4{gap:1.5rem!important}.gap-5{gap:3rem!important}.justify-content-start{justify-content:flex-start!important}.justify-content-end{justify-content:flex-end!important}.justify-content-center{justify-content:center!important}.justify-content-between{justify-content:space-between!important}.justify-content-around{justify-content:space-around!important}.justify-content-evenly{justify-content:space-evenly!important}.align-items-start{align-items:flex-start!important}.align-items-end{align-items:flex-end!important}.align-items-center{align-items:center!important}.align-items-baseline{align-items:baseline!important}.align-items-stretch{align-items:stretch!important}.align-content-start{align-content:flex-start!important}.align-content-end{align-content:flex-end!important}.align-content-center{align-content:center!important}.align-content-between{align-content:space-between!important}.align-content-around{align-content:space-around!important}.align-content-stretch{align-content:stretch!important}.align-self-auto{align-self:auto!important}.align-self-start{align-self:flex-start!important}.align-self-end{align-self:flex-end!important}.align-self-center{align-self:center!important}.align-self-baseline{align-self:baseline!important}.align-self-stretch{align-self:stretch!important}.order-first{order:-1!important}.order-0{order:0!important}.order-1{order:1!important}.order-2{order:2!important}.order-3{order:3!important}.order-4{order:4!important}.order-5{order:5!important}.order-last{order:6!important}.m-0{margin:0!important}.m-1{margin:.25rem!important}.m-2{margin:.5rem!important}.m-3{margin:1rem!important}.m-4{margin:1.5rem!important}.m-5{margin:3rem!important}.m-auto{margin:auto!important}.mx-0{margin-right:0!important;margin-left:0!important}.mx-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-3{margin-right:1rem!important;margin-left:1rem!important}.mx-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-5{margin-right:3rem!important;margin-left:3rem!important}.mx-auto{margin-right:auto!important;margin-left:auto!important}.my-0{margin-top:0!important;margin-bottom:0!important}.my-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-0{margin-top:0!important}.mt-1{margin-top:.25rem!important}.mt-2{margin-top:.5rem!important}.mt-3{margin-top:1rem!important}.mt-4{margin-top:1.5rem!important}.mt-5{margin-top:3rem!important}.mt-auto{margin-top:auto!important}.me-0{margin-right:0!important}.me-1{margin-right:.25rem!important}.me-2{margin-right:.5rem!important}.me-3{margin-right:1rem!important}.me-4{margin-right:1.5rem!important}.me-5{margin-right:3rem!important}.me-auto{margin-right:auto!important}.mb-0{margin-bottom:0!important}.mb-1{margin-bottom:.25rem!important}.mb-2{margin-bottom:.5rem!important}.mb-3{margin-bottom:1rem!important}.mb-4{margin-bottom:1.5rem!important}.mb-5{margin-bottom:3rem!important}.mb-auto{margin-bottom:auto!important}.ms-0{margin-left:0!important}.ms-1{margin-left:.25rem!important}.ms-2{margin-left:.5rem!important}.ms-3{margin-left:1rem!important}.ms-4{margin-left:1.5rem!important}.ms-5{margin-left:3rem!important}.ms-auto{margin-left:auto!important}.p-0{padding:0!important}.p-1{padding:.25rem!important}.p-2{padding:.5rem!important}.p-3{padding:1rem!important}.p-4{padding:1.5rem!important}.p-5{padding:3rem!important}.px-0{padding-right:0!important;padding-left:0!important}.px-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-3{padding-right:1rem!important;padding-left:1rem!important}.px-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-5{padding-right:3rem!important;padding-left:3rem!important}.py-0{padding-top:0!important;padding-bottom:0!important}.py-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-0{padding-top:0!important}.pt-1{padding-top:.25rem!important}.pt-2{padding-top:.5rem!important}.pt-3{padding-top:1rem!important}.pt-4{padding-top:1.5rem!important}.pt-5{padding-top:3rem!important}.pe-0{padding-right:0!important}.pe-1{padding-right:.25rem!important}.pe-2{padding-right:.5rem!important}.pe-3{padding-right:1rem!important}.pe-4{padding-right:1.5rem!important}.pe-5{padding-right:3rem!important}.pb-0{padding-bottom:0!important}.pb-1{padding-bottom:.25rem!important}.pb-2{padding-bottom:.5rem!important}.pb-3{padding-bottom:1rem!important}.pb-4{padding-bottom:1.5rem!important}.pb-5{padding-bottom:3rem!important}.ps-0{padding-left:0!important}.ps-1{padding-left:.25rem!important}.ps-2{padding-left:.5rem!important}.ps-3{padding-left:1rem!important}.ps-4{padding-left:1.5rem!important}.ps-5{padding-left:3rem!important}.font-monospace{font-family:var(--bs-font-monospace)!important}.fs-1{font-size:calc(1.375rem + 1.5vw)!important}.fs-2{font-size:calc(1.325rem + .9vw)!important}.fs-3{font-size:calc(1.3rem + .6vw)!important}.fs-4{font-size:calc(1.275rem + .3vw)!important}.fs-5{font-size:1.25rem!important}.fs-6{font-size:1rem!important}.fst-italic{font-style:italic!important}.fst-normal{font-style:normal!important}.fw-light{font-weight:300!important}.fw-lighter{font-weight:lighter!important}.fw-normal{font-weight:400!important}.fw-bold{font-weight:700!important}.fw-bolder{font-weight:bolder!important}.lh-1{line-height:1!important}.lh-sm{line-height:1.25!important}.lh-base{line-height:1.5!important}.lh-lg{line-height:2!important}.text-start{text-align:left!important}.text-end{text-align:right!important}.text-center{text-align:center!important}.text-decoration-none{text-decoration:none!important}.text-decoration-underline{text-decoration:underline!important}.text-decoration-line-through{text-decoration:line-through!important}.text-lowercase{text-transform:lowercase!important}.text-uppercase{text-transform:uppercase!important}.text-capitalize{text-transform:capitalize!important}.text-wrap{white-space:normal!important}.text-nowrap{white-space:nowrap!important}.text-break{word-wrap:break-word!important;word-break:break-word!important}.text-primary{--bs-text-opacity:1;color:rgba(var(--bs-primary-rgb),var(--bs-text-opacity))!important}.text-secondary{--bs-text-opacity:1;color:rgba(var(--bs-secondary-rgb),var(--bs-text-opacity))!important}.text-success{--bs-text-opacity:1;color:rgba(var(--bs-success-rgb),var(--bs-text-opacity))!important}.text-info{--bs-text-opacity:1;color:rgba(var(--bs-info-rgb),var(--bs-text-opacity))!important}.text-warning{--bs-text-opacity:1;color:rgba(var(--bs-warning-rgb),var(--bs-text-opacity))!important}.text-danger{--bs-text-opacity:1;color:rgba(var(--bs-danger-rgb),var(--bs-text-opacity))!important}.text-light{--bs-text-opacity:1;color:rgba(var(--bs-light-rgb),var(--bs-text-opacity))!important}.text-dark{--bs-text-opacity:1;color:rgba(var(--bs-dark-rgb),var(--bs-text-opacity))!important}.text-black{--bs-text-opacity:1;color:rgba(var(--bs-black-rgb),var(--bs-text-opacity))!important}.text-white{--bs-text-opacity:1;color:rgba(var(--bs-white-rgb),var(--bs-text-opacity))!important}.text-body{--bs-text-opacity:1;color:rgba(var(--bs-body-rgb),var(--bs-text-opacity))!important}.text-muted{--bs-text-opacity:1;color:#6c757d!important}.text-black-50{--bs-text-opacity:1;color:rgba(0,0,0,.5)!important}.text-white-50{--bs-text-opacity:1;color:rgba(255,255,255,.5)!important}.text-reset{--bs-text-opacity:1;color:inherit!important}.text-opacity-25{--bs-text-opacity:0.25}.text-opacity-50{--bs-text-opacity:0.5}.text-opacity-75{--bs-text-opacity:0.75}.text-opacity-100{--bs-text-opacity:1}.bg-primary{--bs-bg-opacity:1;background-color:rgba(var(--bs-primary-rgb),var(--bs-bg-opacity))!important}.bg-secondary{--bs-bg-opacity:1;background-color:rgba(var(--bs-secondary-rgb),var(--bs-bg-opacity))!important}.bg-success{--bs-bg-opacity:1;background-color:rgba(var(--bs-success-rgb),var(--bs-bg-opacity))!important}.bg-info{--bs-bg-opacity:1;background-color:rgba(var(--bs-info-rgb),var(--bs-bg-opacity))!important}.bg-warning{--bs-bg-opacity:1;background-color:rgba(var(--bs-warning-rgb),var(--bs-bg-opacity))!important}.bg-danger{--bs-bg-opacity:1;background-color:rgba(var(--bs-danger-rgb),var(--bs-bg-opacity))!important}.bg-light{--bs-bg-opacity:1;background-color:rgba(var(--bs-light-rgb),var(--bs-bg-opacity))!important}.bg-dark{--bs-bg-opacity:1;background-color:rgba(var(--bs-dark-rgb),var(--bs-bg-opacity))!important}.bg-black{--bs-bg-opacity:1;background-color:rgba(var(--bs-black-rgb),var(--bs-bg-opacity))!important}.bg-white{--bs-bg-opacity:1;background-color:rgba(var(--bs-white-rgb),var(--bs-bg-opacity))!important}.bg-body{--bs-bg-opacity:1;background-color:rgba(var(--bs-body-rgb),var(--bs-bg-opacity))!important}.bg-transparent{--bs-bg-opacity:1;background-color:transparent!important}.bg-opacity-10{--bs-bg-opacity:0.1}.bg-opacity-25{--bs-bg-opacity:0.25}.bg-opacity-50{--bs-bg-opacity:0.5}.bg-opacity-75{--bs-bg-opacity:0.75}.bg-opacity-100{--bs-bg-opacity:1}.bg-gradient{background-image:var(--bs-gradient)!important}.user-select-all{-webkit-user-select:all!important;-moz-user-select:all!important;user-select:all!important}.user-select-auto{-webkit-user-select:auto!important;-moz-user-select:auto!important;user-select:auto!important}.user-select-none{-webkit-user-select:none!important;-moz-user-select:none!important;user-select:none!important}.pe-none{pointer-events:none!important}.pe-auto{pointer-events:auto!important}.rounded{border-radius:.25rem!important}.rounded-0{border-radius:0!important}.rounded-1{border-radius:.2rem!important}.rounded-2{border-radius:.25rem!important}.rounded-3{border-radius:.3rem!important}.rounded-circle{border-radius:50%!important}.rounded-pill{border-radius:50rem!important}.rounded-top{border-top-left-radius:.25rem!important;border-top-right-radius:.25rem!important}.rounded-end{border-top-right-radius:.25rem!important;border-bottom-right-radius:.25rem!important}.rounded-bottom{border-bottom-right-radius:.25rem!important;border-bottom-left-radius:.25rem!important}.rounded-start{border-bottom-left-radius:.25rem!important;border-top-left-radius:.25rem!important}.visible{visibility:visible!important}.invisible{visibility:hidden!important}@media (min-width:576px){.float-sm-start{float:left!important}.float-sm-end{float:right!important}.float-sm-none{float:none!important}.d-sm-inline{display:inline!important}.d-sm-inline-block{display:inline-block!important}.d-sm-block{display:block!important}.d-sm-grid{display:grid!important}.d-sm-table{display:table!important}.d-sm-table-row{display:table-row!important}.d-sm-table-cell{display:table-cell!important}.d-sm-flex{display:flex!important}.d-sm-inline-flex{display:inline-flex!important}.d-sm-none{display:none!important}.flex-sm-fill{flex:1 1 auto!important}.flex-sm-row{flex-direction:row!important}.flex-sm-column{flex-direction:column!important}.flex-sm-row-reverse{flex-direction:row-reverse!important}.flex-sm-column-reverse{flex-direction:column-reverse!important}.flex-sm-grow-0{flex-grow:0!important}.flex-sm-grow-1{flex-grow:1!important}.flex-sm-shrink-0{flex-shrink:0!important}.flex-sm-shrink-1{flex-shrink:1!important}.flex-sm-wrap{flex-wrap:wrap!important}.flex-sm-nowrap{flex-wrap:nowrap!important}.flex-sm-wrap-reverse{flex-wrap:wrap-reverse!important}.gap-sm-0{gap:0!important}.gap-sm-1{gap:.25rem!important}.gap-sm-2{gap:.5rem!important}.gap-sm-3{gap:1rem!important}.gap-sm-4{gap:1.5rem!important}.gap-sm-5{gap:3rem!important}.justify-content-sm-start{justify-content:flex-start!important}.justify-content-sm-end{justify-content:flex-end!important}.justify-content-sm-center{justify-content:center!important}.justify-content-sm-between{justify-content:space-between!important}.justify-content-sm-around{justify-content:space-around!important}.justify-content-sm-evenly{justify-content:space-evenly!important}.align-items-sm-start{align-items:flex-start!important}.align-items-sm-end{align-items:flex-end!important}.align-items-sm-center{align-items:center!important}.align-items-sm-baseline{align-items:baseline!important}.align-items-sm-stretch{align-items:stretch!important}.align-content-sm-start{align-content:flex-start!important}.align-content-sm-end{align-content:flex-end!important}.align-content-sm-center{align-content:center!important}.align-content-sm-between{align-content:space-between!important}.align-content-sm-around{align-content:space-around!important}.align-content-sm-stretch{align-content:stretch!important}.align-self-sm-auto{align-self:auto!important}.align-self-sm-start{align-self:flex-start!important}.align-self-sm-end{align-self:flex-end!important}.align-self-sm-center{align-self:center!important}.align-self-sm-baseline{align-self:baseline!important}.align-self-sm-stretch{align-self:stretch!important}.order-sm-first{order:-1!important}.order-sm-0{order:0!important}.order-sm-1{order:1!important}.order-sm-2{order:2!important}.order-sm-3{order:3!important}.order-sm-4{order:4!important}.order-sm-5{order:5!important}.order-sm-last{order:6!important}.m-sm-0{margin:0!important}.m-sm-1{margin:.25rem!important}.m-sm-2{margin:.5rem!important}.m-sm-3{margin:1rem!important}.m-sm-4{margin:1.5rem!important}.m-sm-5{margin:3rem!important}.m-sm-auto{margin:auto!important}.mx-sm-0{margin-right:0!important;margin-left:0!important}.mx-sm-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-sm-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-sm-3{margin-right:1rem!important;margin-left:1rem!important}.mx-sm-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-sm-5{margin-right:3rem!important;margin-left:3rem!important}.mx-sm-auto{margin-right:auto!important;margin-left:auto!important}.my-sm-0{margin-top:0!important;margin-bottom:0!important}.my-sm-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-sm-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-sm-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-sm-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-sm-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-sm-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-sm-0{margin-top:0!important}.mt-sm-1{margin-top:.25rem!important}.mt-sm-2{margin-top:.5rem!important}.mt-sm-3{margin-top:1rem!important}.mt-sm-4{margin-top:1.5rem!important}.mt-sm-5{margin-top:3rem!important}.mt-sm-auto{margin-top:auto!important}.me-sm-0{margin-right:0!important}.me-sm-1{margin-right:.25rem!important}.me-sm-2{margin-right:.5rem!important}.me-sm-3{margin-right:1rem!important}.me-sm-4{margin-right:1.5rem!important}.me-sm-5{margin-right:3rem!important}.me-sm-auto{margin-right:auto!important}.mb-sm-0{margin-bottom:0!important}.mb-sm-1{margin-bottom:.25rem!important}.mb-sm-2{margin-bottom:.5rem!important}.mb-sm-3{margin-bottom:1rem!important}.mb-sm-4{margin-bottom:1.5rem!important}.mb-sm-5{margin-bottom:3rem!important}.mb-sm-auto{margin-bottom:auto!important}.ms-sm-0{margin-left:0!important}.ms-sm-1{margin-left:.25rem!important}.ms-sm-2{margin-left:.5rem!important}.ms-sm-3{margin-left:1rem!important}.ms-sm-4{margin-left:1.5rem!important}.ms-sm-5{margin-left:3rem!important}.ms-sm-auto{margin-left:auto!important}.p-sm-0{padding:0!important}.p-sm-1{padding:.25rem!important}.p-sm-2{padding:.5rem!important}.p-sm-3{padding:1rem!important}.p-sm-4{padding:1.5rem!important}.p-sm-5{padding:3rem!important}.px-sm-0{padding-right:0!important;padding-left:0!important}.px-sm-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-sm-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-sm-3{padding-right:1rem!important;padding-left:1rem!important}.px-sm-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-sm-5{padding-right:3rem!important;padding-left:3rem!important}.py-sm-0{padding-top:0!important;padding-bottom:0!important}.py-sm-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-sm-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-sm-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-sm-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-sm-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-sm-0{padding-top:0!important}.pt-sm-1{padding-top:.25rem!important}.pt-sm-2{padding-top:.5rem!important}.pt-sm-3{padding-top:1rem!important}.pt-sm-4{padding-top:1.5rem!important}.pt-sm-5{padding-top:3rem!important}.pe-sm-0{padding-right:0!important}.pe-sm-1{padding-right:.25rem!important}.pe-sm-2{padding-right:.5rem!important}.pe-sm-3{padding-right:1rem!important}.pe-sm-4{padding-right:1.5rem!important}.pe-sm-5{padding-right:3rem!important}.pb-sm-0{padding-bottom:0!important}.pb-sm-1{padding-bottom:.25rem!important}.pb-sm-2{padding-bottom:.5rem!important}.pb-sm-3{padding-bottom:1rem!important}.pb-sm-4{padding-bottom:1.5rem!important}.pb-sm-5{padding-bottom:3rem!important}.ps-sm-0{padding-left:0!important}.ps-sm-1{padding-left:.25rem!important}.ps-sm-2{padding-left:.5rem!important}.ps-sm-3{padding-left:1rem!important}.ps-sm-4{padding-left:1.5rem!important}.ps-sm-5{padding-left:3rem!important}.text-sm-start{text-align:left!important}.text-sm-end{text-align:right!important}.text-sm-center{text-align:center!important}}@media (min-width:768px){.float-md-start{float:left!important}.float-md-end{float:right!important}.float-md-none{float:none!important}.d-md-inline{display:inline!important}.d-md-inline-block{display:inline-block!important}.d-md-block{display:block!important}.d-md-grid{display:grid!important}.d-md-table{display:table!important}.d-md-table-row{display:table-row!important}.d-md-table-cell{display:table-cell!important}.d-md-flex{display:flex!important}.d-md-inline-flex{display:inline-flex!important}.d-md-none{display:none!important}.flex-md-fill{flex:1 1 auto!important}.flex-md-row{flex-direction:row!important}.flex-md-column{flex-direction:column!important}.flex-md-row-reverse{flex-direction:row-reverse!important}.flex-md-column-reverse{flex-direction:column-reverse!important}.flex-md-grow-0{flex-grow:0!important}.flex-md-grow-1{flex-grow:1!important}.flex-md-shrink-0{flex-shrink:0!important}.flex-md-shrink-1{flex-shrink:1!important}.flex-md-wrap{flex-wrap:wrap!important}.flex-md-nowrap{flex-wrap:nowrap!important}.flex-md-wrap-reverse{flex-wrap:wrap-reverse!important}.gap-md-0{gap:0!important}.gap-md-1{gap:.25rem!important}.gap-md-2{gap:.5rem!important}.gap-md-3{gap:1rem!important}.gap-md-4{gap:1.5rem!important}.gap-md-5{gap:3rem!important}.justify-content-md-start{justify-content:flex-start!important}.justify-content-md-end{justify-content:flex-end!important}.justify-content-md-center{justify-content:center!important}.justify-content-md-between{justify-content:space-between!important}.justify-content-md-around{justify-content:space-around!important}.justify-content-md-evenly{justify-content:space-evenly!important}.align-items-md-start{align-items:flex-start!important}.align-items-md-end{align-items:flex-end!important}.align-items-md-center{align-items:center!important}.align-items-md-baseline{align-items:baseline!important}.align-items-md-stretch{align-items:stretch!important}.align-content-md-start{align-content:flex-start!important}.align-content-md-end{align-content:flex-end!important}.align-content-md-center{align-content:center!important}.align-content-md-between{align-content:space-between!important}.align-content-md-around{align-content:space-around!important}.align-content-md-stretch{align-content:stretch!important}.align-self-md-auto{align-self:auto!important}.align-self-md-start{align-self:flex-start!important}.align-self-md-end{align-self:flex-end!important}.align-self-md-center{align-self:center!important}.align-self-md-baseline{align-self:baseline!important}.align-self-md-stretch{align-self:stretch!important}.order-md-first{order:-1!important}.order-md-0{order:0!important}.order-md-1{order:1!important}.order-md-2{order:2!important}.order-md-3{order:3!important}.order-md-4{order:4!important}.order-md-5{order:5!important}.order-md-last{order:6!important}.m-md-0{margin:0!important}.m-md-1{margin:.25rem!important}.m-md-2{margin:.5rem!important}.m-md-3{margin:1rem!important}.m-md-4{margin:1.5rem!important}.m-md-5{margin:3rem!important}.m-md-auto{margin:auto!important}.mx-md-0{margin-right:0!important;margin-left:0!important}.mx-md-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-md-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-md-3{margin-right:1rem!important;margin-left:1rem!important}.mx-md-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-md-5{margin-right:3rem!important;margin-left:3rem!important}.mx-md-auto{margin-right:auto!important;margin-left:auto!important}.my-md-0{margin-top:0!important;margin-bottom:0!important}.my-md-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-md-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-md-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-md-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-md-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-md-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-md-0{margin-top:0!important}.mt-md-1{margin-top:.25rem!important}.mt-md-2{margin-top:.5rem!important}.mt-md-3{margin-top:1rem!important}.mt-md-4{margin-top:1.5rem!important}.mt-md-5{margin-top:3rem!important}.mt-md-auto{margin-top:auto!important}.me-md-0{margin-right:0!important}.me-md-1{margin-right:.25rem!important}.me-md-2{margin-right:.5rem!important}.me-md-3{margin-right:1rem!important}.me-md-4{margin-right:1.5rem!important}.me-md-5{margin-right:3rem!important}.me-md-auto{margin-right:auto!important}.mb-md-0{margin-bottom:0!important}.mb-md-1{margin-bottom:.25rem!important}.mb-md-2{margin-bottom:.5rem!important}.mb-md-3{margin-bottom:1rem!important}.mb-md-4{margin-bottom:1.5rem!important}.mb-md-5{margin-bottom:3rem!important}.mb-md-auto{margin-bottom:auto!important}.ms-md-0{margin-left:0!important}.ms-md-1{margin-left:.25rem!important}.ms-md-2{margin-left:.5rem!important}.ms-md-3{margin-left:1rem!important}.ms-md-4{margin-left:1.5rem!important}.ms-md-5{margin-left:3rem!important}.ms-md-auto{margin-left:auto!important}.p-md-0{padding:0!important}.p-md-1{padding:.25rem!important}.p-md-2{padding:.5rem!important}.p-md-3{padding:1rem!important}.p-md-4{padding:1.5rem!important}.p-md-5{padding:3rem!important}.px-md-0{padding-right:0!important;padding-left:0!important}.px-md-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-md-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-md-3{padding-right:1rem!important;padding-left:1rem!important}.px-md-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-md-5{padding-right:3rem!important;padding-left:3rem!important}.py-md-0{padding-top:0!important;padding-bottom:0!important}.py-md-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-md-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-md-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-md-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-md-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-md-0{padding-top:0!important}.pt-md-1{padding-top:.25rem!important}.pt-md-2{padding-top:.5rem!important}.pt-md-3{padding-top:1rem!important}.pt-md-4{padding-top:1.5rem!important}.pt-md-5{padding-top:3rem!important}.pe-md-0{padding-right:0!important}.pe-md-1{padding-right:.25rem!important}.pe-md-2{padding-right:.5rem!important}.pe-md-3{padding-right:1rem!important}.pe-md-4{padding-right:1.5rem!important}.pe-md-5{padding-right:3rem!important}.pb-md-0{padding-bottom:0!important}.pb-md-1{padding-bottom:.25rem!important}.pb-md-2{padding-bottom:.5rem!important}.pb-md-3{padding-bottom:1rem!important}.pb-md-4{padding-bottom:1.5rem!important}.pb-md-5{padding-bottom:3rem!important}.ps-md-0{padding-left:0!important}.ps-md-1{padding-left:.25rem!important}.ps-md-2{padding-left:.5rem!important}.ps-md-3{padding-left:1rem!important}.ps-md-4{padding-left:1.5rem!important}.ps-md-5{padding-left:3rem!important}.text-md-start{text-align:left!important}.text-md-end{text-align:right!important}.text-md-center{text-align:center!important}}@media (min-width:992px){.float-lg-start{float:left!important}.float-lg-end{float:right!important}.float-lg-none{float:none!important}.d-lg-inline{display:inline!important}.d-lg-inline-block{display:inline-block!important}.d-lg-block{display:block!important}.d-lg-grid{display:grid!important}.d-lg-table{display:table!important}.d-lg-table-row{display:table-row!important}.d-lg-table-cell{display:table-cell!important}.d-lg-flex{display:flex!important}.d-lg-inline-flex{display:inline-flex!important}.d-lg-none{display:none!important}.flex-lg-fill{flex:1 1 auto!important}.flex-lg-row{flex-direction:row!important}.flex-lg-column{flex-direction:column!important}.flex-lg-row-reverse{flex-direction:row-reverse!important}.flex-lg-column-reverse{flex-direction:column-reverse!important}.flex-lg-grow-0{flex-grow:0!important}.flex-lg-grow-1{flex-grow:1!important}.flex-lg-shrink-0{flex-shrink:0!important}.flex-lg-shrink-1{flex-shrink:1!important}.flex-lg-wrap{flex-wrap:wrap!important}.flex-lg-nowrap{flex-wrap:nowrap!important}.flex-lg-wrap-reverse{flex-wrap:wrap-reverse!important}.gap-lg-0{gap:0!important}.gap-lg-1{gap:.25rem!important}.gap-lg-2{gap:.5rem!important}.gap-lg-3{gap:1rem!important}.gap-lg-4{gap:1.5rem!important}.gap-lg-5{gap:3rem!important}.justify-content-lg-start{justify-content:flex-start!important}.justify-content-lg-end{justify-content:flex-end!important}.justify-content-lg-center{justify-content:center!important}.justify-content-lg-between{justify-content:space-between!important}.justify-content-lg-around{justify-content:space-around!important}.justify-content-lg-evenly{justify-content:space-evenly!important}.align-items-lg-start{align-items:flex-start!important}.align-items-lg-end{align-items:flex-end!important}.align-items-lg-center{align-items:center!important}.align-items-lg-baseline{align-items:baseline!important}.align-items-lg-stretch{align-items:stretch!important}.align-content-lg-start{align-content:flex-start!important}.align-content-lg-end{align-content:flex-end!important}.align-content-lg-center{align-content:center!important}.align-content-lg-between{align-content:space-between!important}.align-content-lg-around{align-content:space-around!important}.align-content-lg-stretch{align-content:stretch!important}.align-self-lg-auto{align-self:auto!important}.align-self-lg-start{align-self:flex-start!important}.align-self-lg-end{align-self:flex-end!important}.align-self-lg-center{align-self:center!important}.align-self-lg-baseline{align-self:baseline!important}.align-self-lg-stretch{align-self:stretch!important}.order-lg-first{order:-1!important}.order-lg-0{order:0!important}.order-lg-1{order:1!important}.order-lg-2{order:2!important}.order-lg-3{order:3!important}.order-lg-4{order:4!important}.order-lg-5{order:5!important}.order-lg-last{order:6!important}.m-lg-0{margin:0!important}.m-lg-1{margin:.25rem!important}.m-lg-2{margin:.5rem!important}.m-lg-3{margin:1rem!important}.m-lg-4{margin:1.5rem!important}.m-lg-5{margin:3rem!important}.m-lg-auto{margin:auto!important}.mx-lg-0{margin-right:0!important;margin-left:0!important}.mx-lg-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-lg-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-lg-3{margin-right:1rem!important;margin-left:1rem!important}.mx-lg-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-lg-5{margin-right:3rem!important;margin-left:3rem!important}.mx-lg-auto{margin-right:auto!important;margin-left:auto!important}.my-lg-0{margin-top:0!important;margin-bottom:0!important}.my-lg-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-lg-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-lg-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-lg-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-lg-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-lg-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-lg-0{margin-top:0!important}.mt-lg-1{margin-top:.25rem!important}.mt-lg-2{margin-top:.5rem!important}.mt-lg-3{margin-top:1rem!important}.mt-lg-4{margin-top:1.5rem!important}.mt-lg-5{margin-top:3rem!important}.mt-lg-auto{margin-top:auto!important}.me-lg-0{margin-right:0!important}.me-lg-1{margin-right:.25rem!important}.me-lg-2{margin-right:.5rem!important}.me-lg-3{margin-right:1rem!important}.me-lg-4{margin-right:1.5rem!important}.me-lg-5{margin-right:3rem!important}.me-lg-auto{margin-right:auto!important}.mb-lg-0{margin-bottom:0!important}.mb-lg-1{margin-bottom:.25rem!important}.mb-lg-2{margin-bottom:.5rem!important}.mb-lg-3{margin-bottom:1rem!important}.mb-lg-4{margin-bottom:1.5rem!important}.mb-lg-5{margin-bottom:3rem!important}.mb-lg-auto{margin-bottom:auto!important}.ms-lg-0{margin-left:0!important}.ms-lg-1{margin-left:.25rem!important}.ms-lg-2{margin-left:.5rem!important}.ms-lg-3{margin-left:1rem!important}.ms-lg-4{margin-left:1.5rem!important}.ms-lg-5{margin-left:3rem!important}.ms-lg-auto{margin-left:auto!important}.p-lg-0{padding:0!important}.p-lg-1{padding:.25rem!important}.p-lg-2{padding:.5rem!important}.p-lg-3{padding:1rem!important}.p-lg-4{padding:1.5rem!important}.p-lg-5{padding:3rem!important}.px-lg-0{padding-right:0!important;padding-left:0!important}.px-lg-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-lg-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-lg-3{padding-right:1rem!important;padding-left:1rem!important}.px-lg-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-lg-5{padding-right:3rem!important;padding-left:3rem!important}.py-lg-0{padding-top:0!important;padding-bottom:0!important}.py-lg-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-lg-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-lg-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-lg-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-lg-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-lg-0{padding-top:0!important}.pt-lg-1{padding-top:.25rem!important}.pt-lg-2{padding-top:.5rem!important}.pt-lg-3{padding-top:1rem!important}.pt-lg-4{padding-top:1.5rem!important}.pt-lg-5{padding-top:3rem!important}.pe-lg-0{padding-right:0!important}.pe-lg-1{padding-right:.25rem!important}.pe-lg-2{padding-right:.5rem!important}.pe-lg-3{padding-right:1rem!important}.pe-lg-4{padding-right:1.5rem!important}.pe-lg-5{padding-right:3rem!important}.pb-lg-0{padding-bottom:0!important}.pb-lg-1{padding-bottom:.25rem!important}.pb-lg-2{padding-bottom:.5rem!important}.pb-lg-3{padding-bottom:1rem!important}.pb-lg-4{padding-bottom:1.5rem!important}.pb-lg-5{padding-bottom:3rem!important}.ps-lg-0{padding-left:0!important}.ps-lg-1{padding-left:.25rem!important}.ps-lg-2{padding-left:.5rem!important}.ps-lg-3{padding-left:1rem!important}.ps-lg-4{padding-left:1.5rem!important}.ps-lg-5{padding-left:3rem!important}.text-lg-start{text-align:left!important}.text-lg-end{text-align:right!important}.text-lg-center{text-align:center!important}}@media (min-width:1200px){.float-xl-start{float:left!important}.float-xl-end{float:right!important}.float-xl-none{float:none!important}.d-xl-inline{display:inline!important}.d-xl-inline-block{display:inline-block!important}.d-xl-block{display:block!important}.d-xl-grid{display:grid!important}.d-xl-table{display:table!important}.d-xl-table-row{display:table-row!important}.d-xl-table-cell{display:table-cell!important}.d-xl-flex{display:flex!important}.d-xl-inline-flex{display:inline-flex!important}.d-xl-none{display:none!important}.flex-xl-fill{flex:1 1 auto!important}.flex-xl-row{flex-direction:row!important}.flex-xl-column{flex-direction:column!important}.flex-xl-row-reverse{flex-direction:row-reverse!important}.flex-xl-column-reverse{flex-direction:column-reverse!important}.flex-xl-grow-0{flex-grow:0!important}.flex-xl-grow-1{flex-grow:1!important}.flex-xl-shrink-0{flex-shrink:0!important}.flex-xl-shrink-1{flex-shrink:1!important}.flex-xl-wrap{flex-wrap:wrap!important}.flex-xl-nowrap{flex-wrap:nowrap!important}.flex-xl-wrap-reverse{flex-wrap:wrap-reverse!important}.gap-xl-0{gap:0!important}.gap-xl-1{gap:.25rem!important}.gap-xl-2{gap:.5rem!important}.gap-xl-3{gap:1rem!important}.gap-xl-4{gap:1.5rem!important}.gap-xl-5{gap:3rem!important}.justify-content-xl-start{justify-content:flex-start!important}.justify-content-xl-end{justify-content:flex-end!important}.justify-content-xl-center{justify-content:center!important}.justify-content-xl-between{justify-content:space-between!important}.justify-content-xl-around{justify-content:space-around!important}.justify-content-xl-evenly{justify-content:space-evenly!important}.align-items-xl-start{align-items:flex-start!important}.align-items-xl-end{align-items:flex-end!important}.align-items-xl-center{align-items:center!important}.align-items-xl-baseline{align-items:baseline!important}.align-items-xl-stretch{align-items:stretch!important}.align-content-xl-start{align-content:flex-start!important}.align-content-xl-end{align-content:flex-end!important}.align-content-xl-center{align-content:center!important}.align-content-xl-between{align-content:space-between!important}.align-content-xl-around{align-content:space-around!important}.align-content-xl-stretch{align-content:stretch!important}.align-self-xl-auto{align-self:auto!important}.align-self-xl-start{align-self:flex-start!important}.align-self-xl-end{align-self:flex-end!important}.align-self-xl-center{align-self:center!important}.align-self-xl-baseline{align-self:baseline!important}.align-self-xl-stretch{align-self:stretch!important}.order-xl-first{order:-1!important}.order-xl-0{order:0!important}.order-xl-1{order:1!important}.order-xl-2{order:2!important}.order-xl-3{order:3!important}.order-xl-4{order:4!important}.order-xl-5{order:5!important}.order-xl-last{order:6!important}.m-xl-0{margin:0!important}.m-xl-1{margin:.25rem!important}.m-xl-2{margin:.5rem!important}.m-xl-3{margin:1rem!important}.m-xl-4{margin:1.5rem!important}.m-xl-5{margin:3rem!important}.m-xl-auto{margin:auto!important}.mx-xl-0{margin-right:0!important;margin-left:0!important}.mx-xl-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-xl-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-xl-3{margin-right:1rem!important;margin-left:1rem!important}.mx-xl-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-xl-5{margin-right:3rem!important;margin-left:3rem!important}.mx-xl-auto{margin-right:auto!important;margin-left:auto!important}.my-xl-0{margin-top:0!important;margin-bottom:0!important}.my-xl-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-xl-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-xl-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-xl-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-xl-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-xl-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-xl-0{margin-top:0!important}.mt-xl-1{margin-top:.25rem!important}.mt-xl-2{margin-top:.5rem!important}.mt-xl-3{margin-top:1rem!important}.mt-xl-4{margin-top:1.5rem!important}.mt-xl-5{margin-top:3rem!important}.mt-xl-auto{margin-top:auto!important}.me-xl-0{margin-right:0!important}.me-xl-1{margin-right:.25rem!important}.me-xl-2{margin-right:.5rem!important}.me-xl-3{margin-right:1rem!important}.me-xl-4{margin-right:1.5rem!important}.me-xl-5{margin-right:3rem!important}.me-xl-auto{margin-right:auto!important}.mb-xl-0{margin-bottom:0!important}.mb-xl-1{margin-bottom:.25rem!important}.mb-xl-2{margin-bottom:.5rem!important}.mb-xl-3{margin-bottom:1rem!important}.mb-xl-4{margin-bottom:1.5rem!important}.mb-xl-5{margin-bottom:3rem!important}.mb-xl-auto{margin-bottom:auto!important}.ms-xl-0{margin-left:0!important}.ms-xl-1{margin-left:.25rem!important}.ms-xl-2{margin-left:.5rem!important}.ms-xl-3{margin-left:1rem!important}.ms-xl-4{margin-left:1.5rem!important}.ms-xl-5{margin-left:3rem!important}.ms-xl-auto{margin-left:auto!important}.p-xl-0{padding:0!important}.p-xl-1{padding:.25rem!important}.p-xl-2{padding:.5rem!important}.p-xl-3{padding:1rem!important}.p-xl-4{padding:1.5rem!important}.p-xl-5{padding:3rem!important}.px-xl-0{padding-right:0!important;padding-left:0!important}.px-xl-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-xl-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-xl-3{padding-right:1rem!important;padding-left:1rem!important}.px-xl-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-xl-5{padding-right:3rem!important;padding-left:3rem!important}.py-xl-0{padding-top:0!important;padding-bottom:0!important}.py-xl-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-xl-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-xl-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-xl-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-xl-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-xl-0{padding-top:0!important}.pt-xl-1{padding-top:.25rem!important}.pt-xl-2{padding-top:.5rem!important}.pt-xl-3{padding-top:1rem!important}.pt-xl-4{padding-top:1.5rem!important}.pt-xl-5{padding-top:3rem!important}.pe-xl-0{padding-right:0!important}.pe-xl-1{padding-right:.25rem!important}.pe-xl-2{padding-right:.5rem!important}.pe-xl-3{padding-right:1rem!important}.pe-xl-4{padding-right:1.5rem!important}.pe-xl-5{padding-right:3rem!important}.pb-xl-0{padding-bottom:0!important}.pb-xl-1{padding-bottom:.25rem!important}.pb-xl-2{padding-bottom:.5rem!important}.pb-xl-3{padding-bottom:1rem!important}.pb-xl-4{padding-bottom:1.5rem!important}.pb-xl-5{padding-bottom:3rem!important}.ps-xl-0{padding-left:0!important}.ps-xl-1{padding-left:.25rem!important}.ps-xl-2{padding-left:.5rem!important}.ps-xl-3{padding-left:1rem!important}.ps-xl-4{padding-left:1.5rem!important}.ps-xl-5{padding-left:3rem!important}.text-xl-start{text-align:left!important}.text-xl-end{text-align:right!important}.text-xl-center{text-align:center!important}}@media (min-width:1400px){.float-xxl-start{float:left!important}.float-xxl-end{float:right!important}.float-xxl-none{float:none!important}.d-xxl-inline{display:inline!important}.d-xxl-inline-block{display:inline-block!important}.d-xxl-block{display:block!important}.d-xxl-grid{display:grid!important}.d-xxl-table{display:table!important}.d-xxl-table-row{display:table-row!important}.d-xxl-table-cell{display:table-cell!important}.d-xxl-flex{display:flex!important}.d-xxl-inline-flex{display:inline-flex!important}.d-xxl-none{display:none!important}.flex-xxl-fill{flex:1 1 auto!important}.flex-xxl-row{flex-direction:row!important}.flex-xxl-column{flex-direction:column!important}.flex-xxl-row-reverse{flex-direction:row-reverse!important}.flex-xxl-column-reverse{flex-direction:column-reverse!important}.flex-xxl-grow-0{flex-grow:0!important}.flex-xxl-grow-1{flex-grow:1!important}.flex-xxl-shrink-0{flex-shrink:0!important}.flex-xxl-shrink-1{flex-shrink:1!important}.flex-xxl-wrap{flex-wrap:wrap!important}.flex-xxl-nowrap{flex-wrap:nowrap!important}.flex-xxl-wrap-reverse{flex-wrap:wrap-reverse!important}.gap-xxl-0{gap:0!important}.gap-xxl-1{gap:.25rem!important}.gap-xxl-2{gap:.5rem!important}.gap-xxl-3{gap:1rem!important}.gap-xxl-4{gap:1.5rem!important}.gap-xxl-5{gap:3rem!important}.justify-content-xxl-start{justify-content:flex-start!important}.justify-content-xxl-end{justify-content:flex-end!important}.justify-content-xxl-center{justify-content:center!important}.justify-content-xxl-between{justify-content:space-between!important}.justify-content-xxl-around{justify-content:space-around!important}.justify-content-xxl-evenly{justify-content:space-evenly!important}.align-items-xxl-start{align-items:flex-start!important}.align-items-xxl-end{align-items:flex-end!important}.align-items-xxl-center{align-items:center!important}.align-items-xxl-baseline{align-items:baseline!important}.align-items-xxl-stretch{align-items:stretch!important}.align-content-xxl-start{align-content:flex-start!important}.align-content-xxl-end{align-content:flex-end!important}.align-content-xxl-center{align-content:center!important}.align-content-xxl-between{align-content:space-between!important}.align-content-xxl-around{align-content:space-around!important}.align-content-xxl-stretch{align-content:stretch!important}.align-self-xxl-auto{align-self:auto!important}.align-self-xxl-start{align-self:flex-start!important}.align-self-xxl-end{align-self:flex-end!important}.align-self-xxl-center{align-self:center!important}.align-self-xxl-baseline{align-self:baseline!important}.align-self-xxl-stretch{align-self:stretch!important}.order-xxl-first{order:-1!important}.order-xxl-0{order:0!important}.order-xxl-1{order:1!important}.order-xxl-2{order:2!important}.order-xxl-3{order:3!important}.order-xxl-4{order:4!important}.order-xxl-5{order:5!important}.order-xxl-last{order:6!important}.m-xxl-0{margin:0!important}.m-xxl-1{margin:.25rem!important}.m-xxl-2{margin:.5rem!important}.m-xxl-3{margin:1rem!important}.m-xxl-4{margin:1.5rem!important}.m-xxl-5{margin:3rem!important}.m-xxl-auto{margin:auto!important}.mx-xxl-0{margin-right:0!important;margin-left:0!important}.mx-xxl-1{margin-right:.25rem!important;margin-left:.25rem!important}.mx-xxl-2{margin-right:.5rem!important;margin-left:.5rem!important}.mx-xxl-3{margin-right:1rem!important;margin-left:1rem!important}.mx-xxl-4{margin-right:1.5rem!important;margin-left:1.5rem!important}.mx-xxl-5{margin-right:3rem!important;margin-left:3rem!important}.mx-xxl-auto{margin-right:auto!important;margin-left:auto!important}.my-xxl-0{margin-top:0!important;margin-bottom:0!important}.my-xxl-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.my-xxl-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.my-xxl-3{margin-top:1rem!important;margin-bottom:1rem!important}.my-xxl-4{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.my-xxl-5{margin-top:3rem!important;margin-bottom:3rem!important}.my-xxl-auto{margin-top:auto!important;margin-bottom:auto!important}.mt-xxl-0{margin-top:0!important}.mt-xxl-1{margin-top:.25rem!important}.mt-xxl-2{margin-top:.5rem!important}.mt-xxl-3{margin-top:1rem!important}.mt-xxl-4{margin-top:1.5rem!important}.mt-xxl-5{margin-top:3rem!important}.mt-xxl-auto{margin-top:auto!important}.me-xxl-0{margin-right:0!important}.me-xxl-1{margin-right:.25rem!important}.me-xxl-2{margin-right:.5rem!important}.me-xxl-3{margin-right:1rem!important}.me-xxl-4{margin-right:1.5rem!important}.me-xxl-5{margin-right:3rem!important}.me-xxl-auto{margin-right:auto!important}.mb-xxl-0{margin-bottom:0!important}.mb-xxl-1{margin-bottom:.25rem!important}.mb-xxl-2{margin-bottom:.5rem!important}.mb-xxl-3{margin-bottom:1rem!important}.mb-xxl-4{margin-bottom:1.5rem!important}.mb-xxl-5{margin-bottom:3rem!important}.mb-xxl-auto{margin-bottom:auto!important}.ms-xxl-0{margin-left:0!important}.ms-xxl-1{margin-left:.25rem!important}.ms-xxl-2{margin-left:.5rem!important}.ms-xxl-3{margin-left:1rem!important}.ms-xxl-4{margin-left:1.5rem!important}.ms-xxl-5{margin-left:3rem!important}.ms-xxl-auto{margin-left:auto!important}.p-xxl-0{padding:0!important}.p-xxl-1{padding:.25rem!important}.p-xxl-2{padding:.5rem!important}.p-xxl-3{padding:1rem!important}.p-xxl-4{padding:1.5rem!important}.p-xxl-5{padding:3rem!important}.px-xxl-0{padding-right:0!important;padding-left:0!important}.px-xxl-1{padding-right:.25rem!important;padding-left:.25rem!important}.px-xxl-2{padding-right:.5rem!important;padding-left:.5rem!important}.px-xxl-3{padding-right:1rem!important;padding-left:1rem!important}.px-xxl-4{padding-right:1.5rem!important;padding-left:1.5rem!important}.px-xxl-5{padding-right:3rem!important;padding-left:3rem!important}.py-xxl-0{padding-top:0!important;padding-bottom:0!important}.py-xxl-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.py-xxl-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.py-xxl-3{padding-top:1rem!important;padding-bottom:1rem!important}.py-xxl-4{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.py-xxl-5{padding-top:3rem!important;padding-bottom:3rem!important}.pt-xxl-0{padding-top:0!important}.pt-xxl-1{padding-top:.25rem!important}.pt-xxl-2{padding-top:.5rem!important}.pt-xxl-3{padding-top:1rem!important}.pt-xxl-4{padding-top:1.5rem!important}.pt-xxl-5{padding-top:3rem!important}.pe-xxl-0{padding-right:0!important}.pe-xxl-1{padding-right:.25rem!important}.pe-xxl-2{padding-right:.5rem!important}.pe-xxl-3{padding-right:1rem!important}.pe-xxl-4{padding-right:1.5rem!important}.pe-xxl-5{padding-right:3rem!important}.pb-xxl-0{padding-bottom:0!important}.pb-xxl-1{padding-bottom:.25rem!important}.pb-xxl-2{padding-bottom:.5rem!important}.pb-xxl-3{padding-bottom:1rem!important}.pb-xxl-4{padding-bottom:1.5rem!important}.pb-xxl-5{padding-bottom:3rem!important}.ps-xxl-0{padding-left:0!important}.ps-xxl-1{padding-left:.25rem!important}.ps-xxl-2{padding-left:.5rem!important}.ps-xxl-3{padding-left:1rem!important}.ps-xxl-4{padding-left:1.5rem!important}.ps-xxl-5{padding-left:3rem!important}.text-xxl-start{text-align:left!important}.text-xxl-end{text-align:right!important}.text-xxl-center{text-align:center!important}}@media (min-width:1200px){.fs-1{font-size:2.5rem!important}.fs-2{font-size:2rem!important}.fs-3{font-size:1.75rem!important}.fs-4{font-size:1.5rem!important}}@media print{.d-print-inline{display:inline!important}.d-print-inline-block{display:inline-block!important}.d-print-block{display:block!important}.d-print-grid{display:grid!important}.d-print-table{display:table!important}.d-print-table-row{display:table-row!important}.d-print-table-cell{display:table-cell!important}.d-print-flex{display:flex!important}.d-print-inline-flex{display:inline-flex!important}.d-print-none{display:none!important}} /*# sourceMappingURL=bootstrap-utilities.min.css.map */ ```
Henry Greenebaum (June 18, 1833 – February 2, 1914) was a German-born Jewish-American banker. Life Greenebaum was born on June 18, 1833, in Eppelsheim, the Grand Duchy of Hesse, near the city of Worms and the Rhine River. He was the son of merchant Jacob Greenebaum and Sarah Hart. His maternal cousins were the Hart Brothers, prominent Chicago wholesale merchants. Greenebaum attended the local school until he was twelve, after which he went to the "Real Schule" in Alzey for a year and a half. He then went to the "Pro-Gymnasium," a Latin school in Kaiserslautern. He graduated from there in 1848. His father wanted him to take full collegiate courses and engage in the learned professions, but two of Greenebaum's older brothers who already immigrated to America convinced him to join him. In October 1848, when he was fifteen, he arrived in America and settled in Chicago, Illinois. He initially worked as a hardware salesman for W. F. Dominick for two years. He then worked as a clerk in the banking house of General R. K. Swift for four years, at one point making a business trip to Europe to make business connections for his employer. In January 1855, Greenebaum and his brother Elias established their own banking house, Greenebaum Brothers, which was Chicago's oldest European banking institution. He later presided over the firm, which was renamed Henry Greenebaum & Co, and ran it with David S. Greenebaum and Louis Rullmann. In 1856, he was elected to the Chicago City Council as an Alderman of the Sixth Ward. He declined a renomination for the City Council. A personal friend and admirer of Senator Stephen Douglas, the Democratic Party nominated him their candidate as presidential elector for Douglas in the 1860 presidential election. When the American Civil War began, he became a Republican and worked to raise and provide the regiments with men and equipment. In 1867, Governor Richard J. Oglesby appointed him a member of the State Board of Equalization. He was a Republican presidential elector-at-large in the 1872 presidential election. He declined a previous nomination for Lieutenant Governor of Illinois and for Mayor of Chicago. He was the first Jew to sit on the Chicago City Council. A patron of the arts, he was the first president of the Beethoven Society in 1876 and first president of the Orpheus Maennerchor. Greenebaum actively supported European immigration to Chicago, especially German immigrants. In 1860, he was a founder and active supporter of the Chicago Industrial Association, a group of business leaders focused on developing home industry and on immigration matters. By 1863, his bank had a Passage Office where local residents could pay passage for their friends and family to immigrate from Europe to Chicago. In 1870 and 1871, he formed the German Savings Bank and the German National Bank and controlled minority interests of the banks via his banking company and as a personal shareholder. His banks were housed in the same building, and while the building was destroyed in the 1871 Great Chicago Fire he financed a new building for his holdings within a few months. His banks were largely unaffected by the Panic of 1873. In 1877, he was indicted for committing fraud as treasurer of the West Chicago Park Commission, his banks were declared bankrupt, and he declared personal bankruptcy. In 1878, he was put on trial for embezzlement. That trial continued until early 1879 and fizzled out, but there was a congressional investigation that led to a second indictment in late 1879. That trial concluded in 1880 and found him not guilty, but by then he largely lost his previous standing and capital. In 1882, he became General Agent for the Equitable Life Assurance Company. In 1861, Greenebaum and his brother Elias were among the founders of the Sinai Congregation. He served as the first president of the Isaiah Congregation, also known as the Zion Congregation, which was founded in 1864. He was also secretary and honorary member of Congregation B'nai Sholom. In 1859, he was a founder and first president of the United Hebrew Relief Association, the first agency to centralize Jewish charitable activities in Chicago. He was president of the German Aid Society in 1856. In the 1890s, he was an executive committee member of the Russian Aid Society, which assisted Russian immigrants. He organized the B'nai B'rith Ramah Lodge No. 33 in 1857, and in 1864 he became the first head of the B'nai B'rith District Grand Lodge No. 6. He also helped establish the Chicago Public Library, the Chicago Historical Society, and the Astronomical Society, and served as a trustee of the Old University of Chicago. In 1855, Greenebaum married Emily Hyman. Their only child, George Washington, died on his first birthday. They raised several orphan children of relatives. Greenebaum died at home on February 2, 1914. His funeral took place in Sinai Temple and was officiated by Emil G. Hirsch and Joseph Stolz. The pallbearers included Adolf Kraus and Abraham G. Becker. He was buried in Rosehill Cemetery. References 1833 births 1914 deaths People from Alzey-Worms People from the Grand Duchy of Hesse 19th-century German Jews American people of German-Jewish descent Hessian emigrants to the United States American Reform Jews Jewish American bankers 19th-century American Jews 20th-century American Jews Jews and Judaism in Chicago Chicago City Council members Illinois Democrats Illinois Republicans 1872 United States presidential electors American bank presidents Burials at Rosehill Cemetery
Santiago Martínez may refer to: Santiago Martínez (equestrian) (born 1912), Spanish Olympic equestrian Santiago Martínez Delgado (1906–1954), Colombian painter, sculptor, art historian and writer Santiago Martínez (weightlifter) (born 1979), Spanish male weightlifter Santiago Martínez (footballer, born 1991), Uruguayan footballer Santiago Martinez (footballer, born 1995), Paraguayan footballer Santiago Martínez (footballer, born 1998), Colombian footballer
Mazonia/Braidwood State Fish and Wildlife Area is an Illinois state park on in Grundy County, Illinois, United States. References State parks of Illinois Protected areas of Grundy County, Illinois Protected areas established in 1981 1981 establishments in Illinois
```xml <?xml version="1.0" encoding="utf-8"?> Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> <org.chromium.chrome.browser.signin.AccountSigninView xmlns:android="path_to_url" xmlns:chrome="path_to_url" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/signin_body_background"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="52dp"> <!-- The view that allows the user to choose the sign in account --> <org.chromium.chrome.browser.signin.AccountSigninChooseView android:id="@+id/account_signin_choose_view" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="none" android:requiresFadingEdge="vertical" android:fadingEdgeLength="48dp"> <LinearLayout android:id="@+id/account_signin_choose_view_root_child_view" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- The layout_width/layout_height is set to 16/9 dynamically in Java --> <TextView android:id="@+id/signin_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="bottom" android:paddingStart="@dimen/signin_chooser_padding" android:paddingEnd="@dimen/signin_chooser_padding" android:paddingBottom="@dimen/signin_chooser_padding" android:background="@color/signin_head_background" android:textColor="@color/default_text_color" android:textSize="@dimen/fre_title_text_size" android:text="@string/sign_in_to_chrome"/> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="@color/signin_border_line_color" android:alpha="0.08"/> <TextView android:id="@+id/signin_choice_description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="@dimen/signin_chooser_padding" android:lineSpacingMultiplier="1.4" android:text="@string/signin_account_choice_description" android:textColor="@color/default_text_color" android:textSize="@dimen/fre_normal_text_size"/> </LinearLayout> </org.chromium.chrome.browser.signin.AccountSigninChooseView> <!-- The view that allows the user to confirm signed in account, sync and service personalization --> <org.chromium.chrome.browser.signin.AccountSigninConfirmationView android:id="@+id/signin_confirmation_view" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="none" android:requiresFadingEdge="vertical" android:fadingEdgeLength="48dp" android:visibility="gone"> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- The layout_width/layout_height is set to 16/9 dynamically in Java --> <LinearLayout android:id="@+id/signin_confirmation_head" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="bottom" android:paddingStart="16dp" android:paddingEnd="16dp" android:background="@color/signin_head_background" android:orientation="vertical"> <ImageView android:id="@+id/signin_account_image" android:layout_width="64dp" android:layout_height="64dp" android:layout_marginBottom="24dp" android:scaleType="fitCenter" android:contentDescription="@null"/> <TextView android:id="@+id/signin_account_name" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:textColor="@color/default_text_color" android:textSize="@dimen/fre_title_text_size" android:ellipsize="end" android:maxLines="1"/> <TextView android:id="@+id/signin_account_email" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:textColor="@color/descriptive_text_color" android:textSize="@dimen/fre_normal_text_size" android:ellipsize="end" android:maxLines="1"/> </LinearLayout> <View android:id="@+id/signin_confirmation_head_body_border" android:layout_width="match_parent" android:layout_height="1dp" android:layout_below="@id/signin_confirmation_head" android:background="@color/signin_border_line_color" android:alpha="0.08"/> <TextView android:id="@+id/signin_chrome_sync_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginBottom="8dp" android:layout_below="@id/signin_confirmation_head_body_border" android:paddingStart="16dp" android:paddingEnd="16dp" android:text="@string/sync_confirmation_chrome_sync_title" android:textColor="@color/default_text_color" android:textSize="@dimen/fre_normal_text_size" android:fontFamily="sans-serif-medium" android:drawableStart="@drawable/chrome_sync_logo" android:drawablePadding="16dp"/> <TextView android:id="@+id/signin_chrome_sync_description" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:layout_below="@id/signin_chrome_sync_title" android:paddingStart="56dp" android:paddingEnd="16dp" android:lineSpacingMultiplier="1.4" android:text="@string/sync_confirmation_chrome_sync_message" android:textColor="@color/descriptive_text_color" android:textSize="@dimen/fre_normal_text_size" /> <View android:id="@+id/signin_confirmation_body_rule_line" android:layout_width="match_parent" android:layout_height="1dp" android:layout_marginStart="56dp" android:layout_marginEnd="16dp" android:layout_below="@id/signin_chrome_sync_description" android:background="@color/signin_border_line_color" android:alpha="0.08"/> <TextView android:id="@+id/signin_personalize_service_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" android:layout_marginBottom="8dp" android:layout_below="@id/signin_confirmation_body_rule_line" android:paddingStart="16dp" android:paddingEnd="16dp" android:text="@string/sync_confirmation_personalize_services_title" android:textColor="@color/default_text_color" android:textSize="@dimen/fre_normal_text_size" android:fontFamily="sans-serif-medium" android:drawableStart="@drawable/googleg" android:drawablePadding="16dp"/> <TextView android:id="@+id/signin_personalize_service_description" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="32dp" android:layout_below="@id/signin_personalize_service_title" android:paddingStart="56dp" android:paddingEnd="16dp" android:lineSpacingMultiplier="1.4" android:text="@string/sync_confirmation_personalize_services_body" android:textColor="@color/descriptive_text_color" android:textSize="@dimen/fre_normal_text_size"/> <org.chromium.ui.widget.TextViewWithClickableSpans android:id="@+id/signin_settings_control" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@id/signin_personalize_service_description" android:paddingStart="16dp" android:paddingEnd="16dp" android:paddingBottom="36dp" android:lineSpacingMultiplier="1.4" android:text="@string/signin_signed_in_settings_description" android:textColor="@color/descriptive_text_color" android:textSize="@dimen/fre_normal_text_size" /> </RelativeLayout> </org.chromium.chrome.browser.signin.AccountSigninConfirmationView> </FrameLayout> <LinearLayout android:id="@+id/button_bar" android:layout_width="match_parent" android:layout_height="52dp" android:layout_gravity="bottom" android:paddingStart="16dp" android:paddingEnd="16dp" android:orientation="horizontal" > <!--suppress ButtonStyle --> <Button android:id="@+id/negative_button" style="@style/ButtonCompatBorderless" android:layout_width="wrap_content" android:layout_height="36dp" android:text="@string/fre_skip_text" android:textAllCaps="true" android:textColor="@color/light_active_color" android:textSize="14sp"/> <View android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" android:visibility="invisible"/> <FrameLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:measureAllChildren="true"> <!--suppress ButtonStyle --> <org.chromium.ui.widget.ButtonCompat android:id="@+id/positive_button" android:layout_width="wrap_content" android:layout_height="36dp" android:text="@string/choose_account_sign_in" android:textAllCaps="true" android:textColor="@android:color/white" android:textSize="14sp" chrome:buttonColor="@color/light_active_color" chrome:buttonRaised="false"/> <Button android:id="@+id/more_button" style="@style/ButtonCompatBorderless" android:layout_width="wrap_content" android:layout_height="36dp" android:text="@string/more" android:textAllCaps="true" android:textColor="@color/light_active_color" android:textSize="14sp" android:drawableEnd="@drawable/down_arrow" android:drawablePadding="8dp" android:visibility="gone"/> </FrameLayout> <View android:id="@+id/positive_button_end_padding" android:layout_width="0dp" android:layout_height="0dp" android:layout_weight="1" android:visibility="gone"/> </LinearLayout> </org.chromium.chrome.browser.signin.AccountSigninView> ```
```ocaml (** Universal maps *) module type Key = sig type 'a t type 'a info val create : 'a info -> 'a t end module type S = sig (** A universal map is a map that can store values for arbitrary keys. It is the the key that conveys the type of the data associated to it. *) type t module Key : sig type 'a t type 'a info end val empty : t val is_empty : t -> bool val mem : t -> 'a Key.t -> bool val set : t -> 'a Key.t -> 'a -> t val add : t -> 'a Key.t -> 'a -> (t, 'a) Result.t val update : t -> 'a Key.t -> f:('a option -> 'a option) -> t val remove : t -> 'a Key.t -> t val find : t -> 'a Key.t -> 'a option val find_exn : t -> 'a Key.t -> 'a val singleton : 'a Key.t -> 'a -> t (** [superpose a b] is [a] augmented with bindings of [b] that are not in [a]. *) val superpose : t -> t -> t type 'acc fold = { fold : 'a. 'a Key.info -> 'a -> 'acc -> 'acc } val fold : t -> init:'acc -> f:'acc fold -> 'acc end ```
```smalltalk namespace Xamarin.Forms.Xaml { public interface IReferenceProvider { object FindByName(string name); } } ```
"Gimme Gimme" is a song recorded by Romanian singer Inna for her fifth studio album, Nirvana. It was made available for digital consumption as the record's first single on 1 February 2017 through Roton and Global Records. The recording was written by Inna, Breyan Isaac and Elena Luminița Vasile, along with its producers Sebastian Barac, Marcel Botezan and David Ciente. A pop song with Bollywood, Indian and Gyspy influences, "Gimme Gimme" features "simple but meaningful" romantic lyrics. An accompanying music video for "Gimme Gimme" was shot by Edward Aninaru in October 2016 in San Miguel de Allende, Mexico, and was uploaded onto Inna's YouTube channel simultaneously with the single's release. During the filming sessions, the singer was accompanied by a Romanian and South American team, and both John Perez and Khaled Mokhtar served as directors of photography. The clip portrays Inna exploring the city and ends with her appearance at a party at night. Music critics were positive towards the recording, calling it summery and noting its club-oriented style. Commercially, it reached the top 20 in Romania, Turkey and the French, Polish and British club charts. Composition and reception The song was written by Inna, Breyan Isaac and Elena Luminița Vasile, along with its producers Sebastian Barac, Marcel Botezan and David Ciente. Music portal YaBB Music described "Gimme Gimme" as Bollywood-inspired, while Jonathan Currinn from Celebmix implied that it is "upbeat and catchy" and "suggests a summer sound for her fifth album". He further wrote that the track "has simple but meaningful lyrics that are romantic while still having her infectious club sound." Raluca Tanasă from InfoMusic saw "Gimme Gimme" as featuring both Indian and Gyspy music influences, and described it as summery. The singer herself confessed that the recording is "energetic, and has a fresh sound perfect for parties"; echoing the same thought, Urban.ro labelled "Gimme Gimme" as "good for club nights". Spanish website Trendecias opined that the recording "is going to become one of those songs that the radios won't stop playing" and invited its readers to "turn up the volume and enjoy it". In June 2017, American blogger Perez Hilton praised the track in a post on his blog as being "next level", saying it had major potential to become a hit in the United States. Hilton also shared the song on Twitter, where Inna thanked him for his support. He further described "Gimme Gimme" as pop and having a current sound. Music video Background and release On 31 January 2017, Inna uploaded a teaser of the music video for "Gimme Gimme" onto her YouTube channel after teasing it for a couple of months. It portrayed her and several background dancers in various outfits. The clip was shot in October 2016 in San Miguel de Allende, Mexico by Edward Aninaru, and is her second visual filmed in that territory after "Bad Boys" (2016). Aninaru had previously worked with Inna on "Wow" (2012) and "Inndia" (2012). During the filming sessions, the singer was assisted by a Romanian and South American team, with both John Perez and Khaled Mokhtar serving as directors of photography. When interviewed by Mexican newspapers in October 2016, she described the video as "[having] very beautiful girls and guys who will dance around [her] and show the force of love in their lives, especially in [hers]." On the same occasion, she also expressed interest in working with Mexican singer and actress Belinda, and praised the Day of the Dead alongside saying that the music video is planned to emphasis her vocals, image and "beauty of the city". The visual finally saw its premiere on YouTube on 1 February 2017. Inna thanked her crew in an interview, "It is a joy and pleasure to film the video in Mexico, a place in this world where I feel the love and the kindness of the people. Also, I have worked with friends, people that I trust and appreciate, like Edward Aninaru, John Perez and Khaled Mokhtar. I thank them for their professionalism." The clip reached over five million views on YouTube in one week, to which the singer replied, "I didn't expect such a positive feedback in such a short time, thus I want to thank to my fans in the entire world. I hope that 'Gimme Gimme' will make them happy and give them energy every day." Synopsis and reception The clip begins with shots of San Miguel de Allende and a couple standing close to each other. Subsequently, a man is seen transporting balloons in front of Inna, who leans over a Volkswagen Beetle car sporting a yellow wool suit from Max Mara, worth circa 6350 lei. The man in the vehicle was predicted by Celebmix from a teaser video to be her love interest. Next, the singer walks through the city, encountering a banana stand, an old woman in traditional clothing and a piñata, which she eventually breaks. She wears a black skirt designed by Jean Paul Gaultier. Subsequently, the singer and two fellow females with hand fans perform to the track in front of the entrance of a building; Inna has a top with ruffles on designed by Johanna Oritz, worth $850, along with Samurai Earrings from Dsquared24, worth $142. In the last scene of the video, the singer and a crowd of people are shown partying "satisfied" and "[letting] loose" at night. Scenes interspersed through the main plot portray her and background dancers (one of which is Nadd Hu) performing to the song in front of red and blue backdrops, and the singer standing in front of an old door or a ventilator. Some scenes are replayed or played backwards throughout the clip. Romanian website YaBB Music pointed out "romantic" influences in the clip. Currinn from Celebmix described the music video as being "complete with bright primary colours" and wrote that Inna "[looks] as stunning as ever. She brings her usual stage presence to this music video. Bright, beautiful, and definitely hot." For his own website, he further wrote that the clip is "filled with summer sounds and gorgeous visuals that excite [him] for summer" and that "Inna is stylishly sexy". Currinn awarded it four out of five stars, concluding that "this video totally works, although it's a shame there wasn't a romantic element in the visual". Urban.ro said that the music video is "full of colorful frameworks that make us think about summer", while Russian website Zircular pointed out the absence of a plot and stated that Inna "focuses on the male audience". ZU TV wrote that "[the singer] and her dancers warm up the atmosphere and make you want to have fun". The music video received notable airplay on Romanian television, peaking at number eight on Media Forest's TV Airplay Chart in April 2017. Promotion and commercial performance Inna performed stripped-down versions of the song on 16 February 2017 for Romanian radio station Kiss FM, and on 5 April 2017 for Radio ZU. On the latter occasion, she also premiered a previously unreleased track called "Me Gusta". Inna conducted a supportive tour for the song in Chile, Mexico, the Netherlands, Romania, Spain and Turkey. In December 2019, she performed the track on O Ses Türkiye. "Gimme Gimme" debuted at number 94 on Romania's Airplay 100 for the week ending on 12 February 2017, and rose 45 places to number 49 in its second week. It continued ascending on the chart until peaking at number 16 on 9 April 2017. On the French Club 40 chart, "Gimme Gimme" opened at number 25 on 17 March 2017, and reached number 17 on 14 April 2017. It also peaked at number five in Turkey, number 24 on Poland's Dance Top 50 chart, and number three on Music Week Commercial Pop chart. Track listing Charts Weekly charts Year-end charts Release history References Inna songs English-language Romanian songs 2017 songs 2017 singles Songs written by Breyan Isaac Songs written by Inna Song recordings produced by Play & Win
```python A simple way to select a random item from a `list/tuple` data stucture Get the most of `int`s There is more to copying How to count `weakref` callbacks ```
Lake Chaubunagungamaug, also known as Webster Lake, is a lake in the town of Webster, Massachusetts. It is located near the Connecticut border and has a surface area of 1,442 acres. Since 1921, the lake has also been known by a much longer name having 45 letters comprising fourteen syllables: Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg. The lake has become famous beyond Central Massachusetts for having the longest name of any geographic feature in all of the United States. Name The lake's name comes from Loup, an Algonquian language, and is often said to mean, "Fishing Place at the Boundaries—Neutral Meeting Grounds". A more fitting translation is "lake divided by islands", according to anthropologist Ives Goddard. Today, "Webster Lake" may be the name most used, but some (including many residents of Webster) take pride in reeling off the longer versions. This lake has several alternative names. Lake Chaubunagungamaug is the name of the lake as recognized by the U.S. Department of the Interior, and is the name appearing in the earliest local records. Algonquian-speaking peoples had several different names for the lake as recorded on old maps and historical records. However, all of these were similar in part and had almost the same translation. Among other early names were "Chabanaguncamogue" and "Chaubanagogum". Early town records show the name as "Chabunagungamaug Pond", which was also the name of the local Nipmuc town (recorded in 1668 and 1674 with somewhat different spellings). This has been translated as "boundary fishing place", but something close to "fishing place at the boundary" or "that which is a divided island lake" may be more accurate. A 1795 map of Massachusetts indicated the name, using the long-form's first eight syllables, as "Chargoggagoggmanchoggagogg". A survey of the lake done in 1830 lists the name as "Chaubunagungamaugg", the six-syllable older name. The following year, both Dudley and Oxford, which then adjoined the lake, filed maps listing the lake by its eight-syllable form, as "Chargoggagoggmanchoggagogg". Anthropologist Ives Goddard considers that 1831 name to be a cartographer's creation that corrupted the actual name while confusing this lake with nearby Manchaug Pond. Long name The exaggerated name "Lake Char­gogg­a­gogg­man­chaugg­a­gogg­chau­bun­a­gung­a­maugg" () is a 45-letter alternative name for this body of fresh water, often cited as the longest place name in the United States and one of the longest in the world. Many area residents, as well as the official website of the town of Webster, consider the longer version correct. The humorous translation is: "You fish on your side, I'll fish on my side, and no one shall fish in the middle". Its humorous translation was perhaps invented by Laurence J. Daly, editor of The Webster Times. According to Ives Goddard, Curator of Anthropology at the Smithsonian Institution, Daly created this "monstrosity" around 1921, though this is probably not correct, as the name was in use as early as on postcards. Spellings of the long name vary; in 2009, following six years of press reports, the local Chamber of Commerce agreed to have the spelling changed on its signs, but a 45-letter version of the name arrayed in a semicircle is still used. Webster public schools use one long form of the name in various capacities. Geography Webster Lake is a lake with a shoreline in southern Massachusetts, near the Connecticut border. It is the fourth largest fresh body of water in Massachusetts, after slightly larger Long Pond, The Wachusett Reservoir in Clinton, and the much larger Quabbin Reservoir. The average depth is and the maximum depth is . Although the lake is natural in origin, its outlet has a dam that raises the water level by roughly . The dam initially provided water for a mill, and subsequently the water rights to the lake were owned by Cranston Print Works; currently, the dam is owned by Webster Lake Preservation LLC. The lake is commonly divided into three smaller bodies of water: North Pond, Middle Pond, and South Pond. They are connected by narrow channels. Islands Webster Lake has about 7–8 islands. Some have houses and are habitable; a few are extremely small and uninhabitable. They include: Long Island: The largest island in Webster Lake. It has many homes and has electric power lines, underground/underwater municipal water and sewer service, and several fire hydrants. It is in the Middle Pond. Goat Island: The second largest island. It has a few homes and boats. It is in the Middle Pond but isolated from the cluster of islands that include Long Island. Well Island: A smaller island with one house west of Long Island in the Middle Pond. Strip Island: Generally northeast of Long Island and north of Cobble Island with one house, also in the Middle Pond. Cobble Island: East of Long Island, in the Middle Pond. Little Island: In South Pond, right out of the no wake zone from the Middle Pond, one house. Birch Island: Large island on west edge of Middle Pond with Pout Pond on west side and swamp surrounding entire island. It is located roughly between Treasure Island and The Narrows with access by a bridge on Birch Island Road near The Narrows. There are many homes on island and establishment once called Birch Island Pavilion, now called Waterfront Mary's. Small island near east side of Narrows in Middle Pond. May be called either Misery Island or Skunk Island, depending on the map. Marinas Webster lake has two marinas: Lakeview Marine: The only full-service marine store and service shop on Webster Lake. Point Breeze: A restaurant with a small marina. Point Breeze Marina has the only dockside gas pump on the lake. In popular culture In the 1950s, a plan to shorten the official name of the lake inspired a poem of doggerel verse which concludes: Three songs about the lake's name have been written. The first was a regional song from the 1930s. The second, "The Lake Song ()", was recorded by Ethel Merman and Ray Bolger and released in 1954 by Decca and incorporates the tale about the lake's name according to the name's inventor, Laurence J. Daly, editor of The Webster Times. The most recent was released in 2010 by Diane Taraz. The lake is referenced in season 6, episode 6 of Gilmore Girls, "Welcome to the Dollhouse." The character Kirk says, "[It is] an old Nipmuc Indian name. It means you fish on your side of the lake, I'll fish on my side, no one fishes in the middle. Or maybe it means Buffalo." See also List of long place names Longest word in English Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu, the longest place name in New Zealand, and the world Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch, the longest place name in the UK Longest words Chaubunagungamaug Nipmuck Chaubunagungamaug Reservation References External links A history of the lake NY Times - What's the Name of That Lake? It's Hard to Say Listen to the Lake Song Webster Lake Real Estate Boat Tours MassWildlife Map and Info Map of the area watershed Lake Chaubunagungamaugg photos 1 Lake Chaubunagungamaugg photos 2 Chaubunagungamaug Chaubunagungamaug Webster, Massachusetts
```kotlin package kotlinx.coroutines.channels @Suppress("DEPRECATION_ERROR") enum class TestBroadcastChannelKind { ARRAY_1 { override fun <T> create(): BroadcastChannel<T> = BroadcastChannel(1) override fun toString(): String = "BufferedBroadcastChannel(1)" }, ARRAY_10 { override fun <T> create(): BroadcastChannel<T> = BroadcastChannel(10) override fun toString(): String = "BufferedBroadcastChannel(10)" }, CONFLATED { override fun <T> create(): BroadcastChannel<T> = ConflatedBroadcastChannel() override fun toString(): String = "ConflatedBroadcastChannel" override val isConflated: Boolean get() = true } ; abstract fun <T> create(): BroadcastChannel<T> open val isConflated: Boolean get() = false } ```
```makefile PKG_NAME="openssh" PKG_VERSION="9.3p1" PKG_SHA256=your_sha256_hash PKG_LICENSE="OSS" PKG_SITE="path_to_url" PKG_URL="path_to_url{PKG_NAME}-${PKG_VERSION}.tar.gz" PKG_DEPENDS_TARGET="toolchain openssl zlib" PKG_LONGDESC="An open re-implementation of the SSH package." PKG_TOOLCHAIN="autotools" PKG_BUILD_FLAGS="+lto" PKG_CONFIGURE_OPTS_TARGET="ac_cv_header_rpc_types_h=no \ --sysconfdir=/etc/ssh \ --libexecdir=/usr/lib/openssh \ --disable-strip \ --disable-lastlog \ --with-sandbox=no \ --disable-utmp \ --disable-utmpx \ --disable-wtmp \ --disable-wtmpx \ --without-rpath \ --with-ssl-engine \ --with-privsep-user=nobody \ --disable-pututline \ --disable-pututxline \ --disable-etc-default-login \ --with-keydir=/storage/.cache/ssh \ --without-pam" pre_configure_target() { export LD="${CC}" export LDFLAGS="${TARGET_CFLAGS} ${TARGET_LDFLAGS}" } post_makeinstall_target() { rm -rf ${INSTALL}/usr/lib/openssh/ssh-keysign rm -rf ${INSTALL}/usr/lib/openssh/ssh-pkcs11-helper if [ ! ${SFTP_SERVER} = "yes" ]; then rm -rf ${INSTALL}/usr/lib/openssh/sftp-server fi rm -rf ${INSTALL}/usr/bin/ssh-add rm -rf ${INSTALL}/usr/bin/ssh-agent rm -rf ${INSTALL}/usr/bin/ssh-keyscan sed -e "s|^#PermitRootLogin.*|PermitRootLogin yes|g" \ -e "s|^#StrictModes.*|StrictModes no|g" \ -i ${INSTALL}/etc/ssh/sshd_config debug_strip ${INSTALL}/usr } post_install() { enable_service sshd.service } ```
The Elwood Building was built in 1879 for a Rochester lawyer Frank W. Elwood, whose family owned the property. The Elwood Building was the first building to have a mail chute, which was installed in 1884 by James Goold Cutler, the inventor of the mail chute. References - Demolished in 1967. Office buildings in Rochester, New York Buildings and structures completed in 1879 Buildings and structures demolished in 1967 Demolished buildings and structures in New York (state)
Manor Castle ward—which includes the districts of Claywood, Manor, Manor Park, Park Hill, and Wybourn—is one of the 28 electoral wards in City of Sheffield, England. It is located in the eastern part of the city and covers an area of 5.4 km2 (2.08 mi2). The population of this ward in 2001 was 21,000 people in 9,700 households, the population increasing to 21,223 at the 2011 Census. It is one of the wards that make up the Sheffield Central constituency. Districts of Manor Castle ward Manor Manor () is a large low-rise housing estate in eastern Sheffield, Yorkshire, England. It is divided into Manor Park, Upper and Lower Manor, and Manor Top. Until the 1930s, the area was mostly rural, with housing only along the main roads. The estate was started during the 1930s as a garden city type development, to alleviate overcrowding in central Sheffield. However, unlike true garden cities, places of work were not included in the scheme, although nearby Darnall and Attercliffe had some industry. Manor is named for Sheffield Manor and is adjacent to Manor Park. Manor Top is now served by the Sheffield Supertram. Large areas of the estate were demolished, and in some cases rebuilt with private funding, from the late 1990s onwards. Wybourn Wybourn () is a council estate, built in the 1920s, lying north of Manor Park and east of Park Hill. In the north west of the district lies Hyde Park, originally a larger version of Park Hill, but since reduced in scale with the demolition of some blocks and the recladding and alteration of circulation elsewhere. Park Hill Park Hill () is the name of the district in which the Park Hill flats are sited. The name relates to the deer park attached to Sheffield Manor, the remnant of which is now known as Norfolk Park. In popular culture The Reverend and the Makers song "Heavyweight Champion of the World" includes the line "At school he used to dream about being Bruce Lee/But the need for chops in Manor Top ain't all that great you see". References Notes Bibliography External links Sources for the history of Manor Produced by Sheffield City Council's Libraries and Archives Housing estates in Sheffield Wards of Sheffield
The National Agency for Controlled Materials (Spanish: Agencia Nacional de Materiales Controlados), formerly the National Weapons Registry of the Argentine Republic (Spanish: Registro Nacional de Armas de la República Argentina) is the body in charge of registering, supervising and controlling firearms, other regulated materials and their users within the Argentine national territory with the sole exclusion of weapons belonging to the Armed Forces. They are also charged with proposing and implementing policies to promote better compliance with the Ministry of Justice and Human Rights. Functions Register, authorize, control and supervise all activities related to the manufacture, commercialization, acquisition, transfer, possession, carrying, use, delivery, safekeeping, destruction, introduction, exit, import, transit, export, kidnappings, seizures and confiscations; made with firearms, ammunition, gunpowder, explosives and the like, materials for special uses, and other controlled materials, its users, manufacturing, storage, storage and marketing facilities; according to the current classifications of controlled materials, within the national territory, with the sole exclusion of weapons belonging to the armed forces. Manage the National Bank of Controlled Materials and the network of deposits that are part of it. Carry out the destruction, exclusively and exclusively throughout the national territory, of all material controlled within the framework of laws 20,429, 25,938, 26,216. Determine the methods and procedures for the destruction of controlled materials, guaranteeing their effectiveness, efficiency and sustainability in relation to the environment. Carry out awareness and sensitization programs on disarmament and control of the proliferation of firearms in society, which promote a culture of non-violence and the peaceful resolution of conflicts. Carry out campaigns to regularize the registration situation of people who have firearms under their power, controlled materials and related activities. Organize and dictate training courses and seminars for technicians and officials whose performance is linked to the subject. Likewise, train civil society organizations, universities, territorial and neighborhood organizations, national or international press media. Establish citizen control systems for the authorizations granted by the agency, especially considering mechanisms that contribute to the prevention of gender violence. Carry out information exchange policies regarding regulations and processes with foreign organizations within the framework of international cooperation. Carry out research programs on the arms market, its use and its consequences, which may be relevant for the adoption of strategic policies. Evaluate and analyze the effectiveness of technical and legal standards and make proposals for modifications to the corresponding bodies. Directors References Government agencies of Argentina
```go // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. // // path_to_url // // Unless required by applicable law or agreed to in writing, software // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // beam-playground: // name: text-io-gcs-write // description: TextIO GCS write example. // multifile: false // context_line: 30 // categories: // - Quickstart // complexity: MEDIUM // tags: // - hellobeam package main import ( "context" "github.com/apache/beam/sdks/v2/go/pkg/beam" _ "github.com/apache/beam/sdks/v2/go/pkg/beam/io/textio" "github.com/apache/beam/sdks/v2/go/pkg/beam/log" "github.com/apache/beam/sdks/v2/go/pkg/beam/x/beamx" "regexp" "github.com/apache/beam/sdks/v2/go/pkg/beam/x/debug" _ "github.com/apache/beam/sdks/v2/go/pkg/beam/io/filesystem/gcs" _ "github.com/apache/beam/sdks/v2/go/pkg/beam/io/filesystem/local" ) var wordRE = regexp.MustCompile(`[a-zA-Z]+('[a-z])?`) var locationGCS = "gs://mybucket/myfile.txt" func main() { beam.Init() p := beam.NewPipeline() s := p.Root() input := beam.Create(s, "Hello write from playground","First example") // It may be unsupported. Since gcs requires credentials // textio.Write(s, locationGCS, input) debug.Printf(s,"Recorded data:", input) err := beamx.Run(context.Background(), p) if err != nil { log.Exitf(context.Background(), "Failed to execute job: %v", err) } } ```
```smalltalk // <copyright file="Constants.cs" company="App Metrics Contributors"> // </copyright> using System; namespace App.Metrics.Reporting.Socket.Client { internal static class Constants { public static readonly TimeSpan DefaultBackoffPeriod = TimeSpan.FromSeconds(30); public static readonly int DefaultFailuresBeforeBackoff = 3; public static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(30); } } ```
Cardiff Festivals are a series of festivals held in the capital of Wales, Cardiff and nearby areas every summer. The festival started back in the 1980s and are organised by several associations. The festivals include: Velothon Wales Extreme Sailing Series Cardiff Triathlon Tafwyl Cardiff International Food and Drink Festival Welsh Proms Cardiff Carnival Pride Cymru References
```go // Package awserr represents API error interface accessors for the SDK. package awserr // An Error wraps lower level errors with code, message and an original error. // The underlying concrete error type may also satisfy other interfaces which // can be to used to obtain more specific information about the error. // // Calling Error() or String() will always include the full information about // an error based on its underlying type. // // Example: // // output, err := s3manage.Upload(svc, input, opts) // if err != nil { // if awsErr, ok := err.(awserr.Error); ok { // // Get error details // log.Println("Error:", awsErr.Code(), awsErr.Message()) // // // Prints out full error message, including original error if there was one. // log.Println("Error:", awsErr.Error()) // // // Get original error // if origErr := awsErr.OrigErr(); origErr != nil { // // operate on original error. // } // } else { // fmt.Println(err.Error()) // } // } // type Error interface { // Satisfy the generic error interface. error // Returns the short phrase depicting the classification of the error. Code() string // Returns the error details message. Message() string // Returns the original error if one was set. Nil is returned if not set. OrigErr() error } // BatchError is a batch of errors which also wraps lower level errors with // code, message, and original errors. Calling Error() will include all errors // that occurred in the batch. // // Deprecated: Replaced with BatchedErrors. Only defined for backwards // compatibility. type BatchError interface { // Satisfy the generic error interface. error // Returns the short phrase depicting the classification of the error. Code() string // Returns the error details message. Message() string // Returns the original error if one was set. Nil is returned if not set. OrigErrs() []error } // BatchedErrors is a batch of errors which also wraps lower level errors with // code, message, and original errors. Calling Error() will include all errors // that occurred in the batch. // // Replaces BatchError type BatchedErrors interface { // Satisfy the base Error interface. Error // Returns the original error if one was set. Nil is returned if not set. OrigErrs() []error } // New returns an Error object described by the code, message, and origErr. // // If origErr satisfies the Error interface it will not be wrapped within a new // Error object and will instead be returned. func New(code, message string, origErr error) Error { var errs []error if origErr != nil { errs = append(errs, origErr) } return newBaseError(code, message, errs) } // NewBatchError returns an BatchedErrors with a collection of errors as an // array of errors. func NewBatchError(code, message string, errs []error) BatchedErrors { return newBaseError(code, message, errs) } // A RequestFailure is an interface to extract request failure information from // an Error such as the request ID of the failed request returned by a service. // RequestFailures may not always have a requestID value if the request failed // prior to reaching the service such as a connection error. // // Example: // // output, err := s3manage.Upload(svc, input, opts) // if err != nil { // if reqerr, ok := err.(RequestFailure); ok { // log.Println("Request failed", reqerr.Code(), reqerr.Message(), reqerr.RequestID()) // } else { // log.Println("Error:", err.Error()) // } // } // // Combined with awserr.Error: // // output, err := s3manage.Upload(svc, input, opts) // if err != nil { // if awsErr, ok := err.(awserr.Error); ok { // // Generic AWS Error with Code, Message, and original error (if any) // fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) // // if reqErr, ok := err.(awserr.RequestFailure); ok { // // A service error occurred // fmt.Println(reqErr.StatusCode(), reqErr.RequestID()) // } // } else { // fmt.Println(err.Error()) // } // } // type RequestFailure interface { Error // The status code of the HTTP response. StatusCode() int // The request ID returned by the service for a request failure. This will // be empty if no request ID is available such as the request failed due // to a connection error. RequestID() string } // NewRequestFailure returns a wrapped error with additional information for // request status code, and service requestID. // // Should be used to wrap all request which involve service requests. Even if // the request failed without a service response, but had an HTTP status code // that may be meaningful. func NewRequestFailure(err Error, statusCode int, reqID string) RequestFailure { return newRequestError(err, statusCode, reqID) } // UnmarshalError provides the interface for the SDK failing to unmarshal data. type UnmarshalError interface { awsError Bytes() []byte } // NewUnmarshalError returns an initialized UnmarshalError error wrapper adding // the bytes that fail to unmarshal to the error. func NewUnmarshalError(err error, msg string, bytes []byte) UnmarshalError { return &unmarshalError{ awsError: New("UnmarshalError", msg, err), bytes: bytes, } } ```
Thomas Flannigan (25 May 1908 – 23 May 1981) was a Scottish footballer who played in the Scottish League for Dundee, in the English Football League for Stoke City, Hull City and Rochdale, and in the French Division 2 for Saint-Étienne. He was on the books of Darlington without playing for their first team, and played non-league football for Loughborough Corinthians, Stafford Rangers, Buxton and Shrewsbury Town. He played mainly at inside left, but was used anywhere across the forward line. Life and career Flannigan was born in Edinburgh in 1908. He played football for Harp Athletic and Edinburgh Emmet before signing for Dundee in 1926, touted by the Dundee Evening Telegraph along with Jim Meagher and Andy Ramage as "lads who will make a capital inside trio in the near future". Flannigan was backup for Joe Cassidy in the 1926–27 season, and did not make his debut until the last First Division match of the campaign, on 30 April 1927. He played at inside left, alongside Ramage at centre forward, in a 3–0 win against Queen's Park. That proved to be his only appearance, as in early July he signed for English club Stoke City. He spent his first season in the reserves before coming into the league side in December 1928 for a four-game run. On his debut, in a goalless draw away to Southampton, he had "about the best shot of the afternoon, a drive which flashed the ball just over the bar". The following week, the Staffordshire Sentinel suggested that Flannigan lacked stamina, then that his "neat touches were out of place" on Notts County's frozen pitch. During his fourth match, a clash of heads with a team-mate left him concussed. Described as a "clever dribbler" but "rather light of build", Flannigan made 24 appearances for Stoke's reserves in the Central League, but was not retained at the end of the season, and was sold to Hull City for a "considerable" fee, later reported as £500. He made just two Second Division appearances during the 1929–30 season, and was transfer-listed at a fee of £750. There were no takers, so he spent the 1930–31 season in non-league football with Loughborough Corinthians of the Midland League. Eventually, the fee was reduced, and Flannigan attempted a return to the Football League with Darlington of the Third Division North. After a month with no first-team football, his registration was cancelled and he signed for another Northern Section club, Rochdale. He made his debut on 26 September 1931 in a 1–1 draw with Darlington, and played in the next match, but that was his last. He resurfaced in February at Birmingham League club Stafford Rangers and made a debut for Buxton in the Cheshire County League in November, before trying his luck in French football with Saint-Étienne. He played one senior game in the inaugural season of Division 2, a 2–1 defeat at home to SO Biterrois on 31 December 1933. Flannigan's last club was Shrewsbury Town, after which he retired and took up hairdressing. Flannigan died in Darlington, County Durham, in 1981 at the age of 72. Career statistics References 1908 births 1981 deaths Footballers from Edinburgh Scottish men's footballers Men's association football forwards Dundee F.C. players Stoke City F.C. players Hull City A.F.C. players Loughborough Corinthians F.C. players Darlington F.C. players Rochdale A.F.C. players Stafford Rangers F.C. players Buxton F.C. players AS Saint-Étienne players Shrewsbury Town F.C. players Scottish Football League players English Football League players Midland Football League players Ligue 2 players
```smalltalk using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.Linq; using System.Management.Automation.Internal; using System.Management.Automation.Runspaces; using System.Management.Automation.Tracing; using System.Reflection; using System.Threading; using System.Xml; using Microsoft.PowerShell.Commands; using Microsoft.Win32; using Dbg = System.Management.Automation.Diagnostics; namespace System.Management.Automation.Remoting { #region WSMan endpoint configuration /// <summary> /// This struct is used to represent contents from configuration xml. The /// XML is passed to plugins by WSMan API. /// This helper does not validate XML content as it is already validated /// by WSMan. /// </summary> internal class ConfigurationDataFromXML { #region Config XML Constants internal const string INITPARAMETERSTOKEN = "InitializationParameters"; internal const string PARAMTOKEN = "Param"; internal const string NAMETOKEN = "Name"; internal const string VALUETOKEN = "Value"; internal const string APPBASETOKEN = "applicationbase"; internal const string ASSEMBLYTOKEN = "assemblyname"; internal const string SHELLCONFIGTYPETOKEN = "pssessionconfigurationtypename"; internal const string STARTUPSCRIPTTOKEN = "startupscript"; internal const string MAXRCVDOBJSIZETOKEN = "psmaximumreceivedobjectsizemb"; internal const string MAXRCVDOBJSIZETOKEN_CamelCase = "PSMaximumReceivedObjectSizeMB"; internal const string MAXRCVDCMDSIZETOKEN = "psmaximumreceiveddatasizepercommandmb"; internal const string MAXRCVDCMDSIZETOKEN_CamelCase = "PSMaximumReceivedDataSizePerCommandMB"; internal const string THREADOPTIONSTOKEN = "pssessionthreadoptions"; internal const string THREADAPTSTATETOKEN = "pssessionthreadapartmentstate"; internal const string SESSIONCONFIGTOKEN = "sessionconfigurationdata"; internal const string PSVERSIONTOKEN = "PSVersion"; internal const string MAXPSVERSIONTOKEN = "MaxPSVersion"; internal const string MODULESTOIMPORT = "ModulesToImport"; internal const string HOSTMODE = "hostmode"; internal const string CONFIGFILEPATH = "configfilepath"; internal const string CONFIGFILEPATH_CamelCase = "ConfigFilePath"; #endregion #region Fields internal string StartupScript; // this field is used only by an Out-Of-Process (IPC) server process internal string InitializationScriptForOutOfProcessRunspace; internal string ApplicationBase; internal string AssemblyName; internal string EndPointConfigurationTypeName; internal Type EndPointConfigurationType; internal int? MaxReceivedObjectSizeMB; internal int? MaxReceivedCommandSizeMB; // Used to set properties on the RunspacePool created for this shell. internal PSThreadOptions? ShellThreadOptions; internal ApartmentState? ShellThreadApartmentState; internal PSSessionConfigurationData SessionConfigurationData; internal string ConfigFilePath; #endregion #region Methods /// <summary> /// Using optionName and optionValue updates the current object. /// </summary> /// <param name="optionName"></param> /// <param name="optionValue"></param> /// <exception cref="ArgumentException"> /// 1. "optionName" is not valid in "InitializationParameters" section. /// 2. "startupscript" must specify a PowerShell script file that ends with extension ".ps1". /// </exception> private void Update(string optionName, string optionValue) { switch (optionName.ToLowerInvariant()) { case APPBASETOKEN: AssertValueNotAssigned(APPBASETOKEN, ApplicationBase); // this is a folder pointing to application base of the plugin shell // allow the folder path to use environment variables. ApplicationBase = Environment.ExpandEnvironmentVariables(optionValue); break; case ASSEMBLYTOKEN: AssertValueNotAssigned(ASSEMBLYTOKEN, AssemblyName); AssemblyName = optionValue; break; case SHELLCONFIGTYPETOKEN: AssertValueNotAssigned(SHELLCONFIGTYPETOKEN, EndPointConfigurationTypeName); EndPointConfigurationTypeName = optionValue; break; case STARTUPSCRIPTTOKEN: AssertValueNotAssigned(STARTUPSCRIPTTOKEN, StartupScript); if (!optionValue.EndsWith(".ps1", StringComparison.OrdinalIgnoreCase)) { throw PSTraceSource.NewArgumentException(STARTUPSCRIPTTOKEN, RemotingErrorIdStrings.StartupScriptNotCorrect, STARTUPSCRIPTTOKEN); } // allow the script file to exist in any path..and support // environment variable expansion. StartupScript = Environment.ExpandEnvironmentVariables(optionValue); break; case MAXRCVDOBJSIZETOKEN: AssertValueNotAssigned(MAXRCVDOBJSIZETOKEN, MaxReceivedObjectSizeMB); MaxReceivedObjectSizeMB = GetIntValueInBytes(optionValue); break; case MAXRCVDCMDSIZETOKEN: AssertValueNotAssigned(MAXRCVDCMDSIZETOKEN, MaxReceivedCommandSizeMB); MaxReceivedCommandSizeMB = GetIntValueInBytes(optionValue); break; case THREADOPTIONSTOKEN: AssertValueNotAssigned(THREADOPTIONSTOKEN, ShellThreadOptions); ShellThreadOptions = (PSThreadOptions)LanguagePrimitives.ConvertTo( optionValue, typeof(PSThreadOptions), CultureInfo.InvariantCulture); break; case THREADAPTSTATETOKEN: AssertValueNotAssigned(THREADAPTSTATETOKEN, ShellThreadApartmentState); ShellThreadApartmentState = (ApartmentState)LanguagePrimitives.ConvertTo( optionValue, typeof(ApartmentState), CultureInfo.InvariantCulture); break; case SESSIONCONFIGTOKEN: { AssertValueNotAssigned(SESSIONCONFIGTOKEN, SessionConfigurationData); SessionConfigurationData = PSSessionConfigurationData.Create(optionValue); } break; case CONFIGFILEPATH: { AssertValueNotAssigned(CONFIGFILEPATH, ConfigFilePath); ConfigFilePath = optionValue; } break; default: // we dont need to evaluate PSVersion and other custom authz // related tokens break; } } /// <summary> /// Checks if the originalValue is empty. If not throws an exception. /// </summary> /// <param name="optionName"></param> /// <param name="originalValue"></param> /// <exception cref="ArgumentException"> /// 1. "optionName" is already defined /// </exception> private static void AssertValueNotAssigned(string optionName, object originalValue) { if (originalValue != null) { throw PSTraceSource.NewArgumentException(optionName, RemotingErrorIdStrings.DuplicateInitializationParameterFound, optionName, INITPARAMETERSTOKEN); } } /// <summary> /// Converts the value specified by <paramref name="optionValue"/> to int. /// Multiplies the value by 1MB (1024*1024) to get the number in bytes. /// </summary> /// <param name="optionValueInMB"></param> /// <returns> /// If value is specified, specified value as int . otherwise null. /// </returns> private static int? GetIntValueInBytes(string optionValueInMB) { int? result = null; try { double variableValue = (double)LanguagePrimitives.ConvertTo(optionValueInMB, typeof(double), System.Globalization.CultureInfo.InvariantCulture); result = unchecked((int)(variableValue * 1024 * 1024)); // Multiply by 1MB } catch (InvalidCastException) { } if (result < 0) { result = null; } return result; } /// <summary> /// Creates the struct from initialization parameters xml. /// </summary> /// <param name="initializationParameters"> /// Initialization Parameters xml passed by WSMan API. This data is read from the config /// xml and is in the following format: /// </param> /// <returns></returns> /// <exception cref="ArgumentException"> /// 1. "optionName" is already defined /// </exception> /* <InitializationParameters> <Param Name="PSVersion" Value="2.0" /> <Param Name="ApplicationBase" Value="<folder path>" /> ... </InitializationParameters> */ /* The following extensions have been added in V3 providing the user * the ability to pass data to the session configuration for initialization * <Param Name="SessionConfigurationData" Value="<SessionConfigurationData with XML escaping>" /> * * The session configuration data blob can be defined as under <SessionConfigurationData> <Param Name="ModulesToImport" Value="<folder path>" /> <Param Name="PrivateData" /> <PrivateData> ... </PrivateData> </Param> </SessionConfigurationData> */ internal static ConfigurationDataFromXML Create(string initializationParameters) { ConfigurationDataFromXML result = new ConfigurationDataFromXML(); if (string.IsNullOrEmpty(initializationParameters)) { return result; } XmlReaderSettings readerSettings = new XmlReaderSettings(); readerSettings.CheckCharacters = false; readerSettings.IgnoreComments = true; readerSettings.IgnoreProcessingInstructions = true; readerSettings.MaxCharactersInDocument = 10000; readerSettings.ConformanceLevel = ConformanceLevel.Fragment; using (XmlReader reader = XmlReader.Create(new StringReader(initializationParameters), readerSettings)) { // read the header <InitializationParameters> if (reader.ReadToFollowing(INITPARAMETERSTOKEN)) { bool isParamFound = reader.ReadToDescendant(PARAMTOKEN); while (isParamFound) { if (!reader.MoveToAttribute(NAMETOKEN)) { throw PSTraceSource.NewArgumentException(initializationParameters, RemotingErrorIdStrings.NoAttributesFoundForParamElement, NAMETOKEN, VALUETOKEN, PARAMTOKEN); } string optionName = reader.Value; if (!reader.MoveToAttribute(VALUETOKEN)) { throw PSTraceSource.NewArgumentException(initializationParameters, RemotingErrorIdStrings.NoAttributesFoundForParamElement, NAMETOKEN, VALUETOKEN, PARAMTOKEN); } string optionValue = reader.Value; result.Update(optionName, optionValue); // move to next Param token. isParamFound = reader.ReadToFollowing(PARAMTOKEN); } } } // assign defaults after parsing the xml content. result.MaxReceivedObjectSizeMB ??= BaseTransportManager.MaximumReceivedObjectSize; result.MaxReceivedCommandSizeMB ??= BaseTransportManager.MaximumReceivedDataSize; return result; } /// <summary> /// </summary> /// <returns></returns> /// <exception cref="ArgumentException"> /// 1. Unable to load type "{0}" specified in "InitializationParameters" section. /// </exception> internal PSSessionConfiguration CreateEndPointConfigurationInstance() { try { return (PSSessionConfiguration)Activator.CreateInstance(EndPointConfigurationType); } catch (TypeLoadException) { } catch (ArgumentException) { } catch (MissingMethodException) { } catch (InvalidCastException) { } catch (TargetInvocationException) { } // if we are here, that means we are unable to load the type specified // in the config xml.. notify the same. throw PSTraceSource.NewArgumentException("typeToLoad", RemotingErrorIdStrings.UnableToLoadType, EndPointConfigurationTypeName, ConfigurationDataFromXML.INITPARAMETERSTOKEN); } #endregion } /// <summary> /// InitialSessionStateProvider is used by 3rd parties to provide shell configuration /// on the remote server. /// </summary> public abstract class PSSessionConfiguration : IDisposable { #region tracer /// <summary> /// Tracer for Server Remote session. /// </summary> [TraceSourceAttribute("ServerRemoteSession", "ServerRemoteSession")] private static readonly PSTraceSource s_tracer = PSTraceSource.GetTracer("ServerRemoteSession", "ServerRemoteSession"); #endregion tracer #region public interfaces /// <summary> /// Derived classes must override this to supply an InitialSessionState /// to be used to construct a Runspace for the user. /// </summary> /// <param name="senderInfo"> /// User Identity for which this information is requested /// </param> /// <returns></returns> public abstract InitialSessionState GetInitialSessionState(PSSenderInfo senderInfo); /// <summary> /// </summary> /// <param name="sessionConfigurationData"></param> /// <param name="senderInfo"></param> /// <param name="configProviderId"></param> /// <returns></returns> public virtual InitialSessionState GetInitialSessionState(PSSessionConfigurationData sessionConfigurationData, PSSenderInfo senderInfo, string configProviderId) { throw new NotImplementedException(); } /// <summary> /// Maximum size (in bytes) of a deserialized object received from a remote machine. /// If null, then the size is unlimited. Default is 10MB. /// </summary> /// <param name="senderInfo"> /// User Identity for which this information is requested /// </param> /// <returns></returns> public virtual int? GetMaximumReceivedObjectSize(PSSenderInfo senderInfo) { return BaseTransportManager.MaximumReceivedObjectSize; } /// <summary> /// Total data (in bytes) that can be received from a remote machine /// targeted towards a command. If null, then the size is unlimited. /// Default is 50MB. /// </summary> /// <param name="senderInfo"> /// User Identity for which this information is requested /// </param> /// <returns></returns> public virtual int? GetMaximumReceivedDataSizePerCommand(PSSenderInfo senderInfo) { return BaseTransportManager.MaximumReceivedDataSize; } /// <summary> /// Derived classes can override this method to provide application private data /// that is going to be sent to the client and exposed via /// <see cref="System.Management.Automation.Runspaces.PSSession.ApplicationPrivateData"/>, /// <see cref="System.Management.Automation.Runspaces.Runspace.GetApplicationPrivateData"/> and /// <see cref="System.Management.Automation.Runspaces.RunspacePool.GetApplicationPrivateData"/> /// </summary> /// <param name="senderInfo"> /// User Identity for which this information is requested /// </param> /// <returns>Application private data or <see langword="null"/></returns> public virtual PSPrimitiveDictionary GetApplicationPrivateData(PSSenderInfo senderInfo) { return null; } #endregion #region IDisposable Overrides /// <summary> /// Dispose this configuration object. This will be called when a Runspace/RunspacePool /// created using InitialSessionState from this object is Closed. /// </summary> public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } /// <summary> /// </summary> /// <param name="isDisposing"></param> protected virtual void Dispose(bool isDisposing) { } #endregion #region GetInitialSessionState from 3rd party shell ids /// <summary> /// </summary> /// <param name="shellId"></param> /// <param name="initializationParameters"> /// Initialization Parameters xml passed by WSMan API. This data is read from the config /// xml and is in the following format: /// </param> /// <returns></returns> /// <exception cref="InvalidOperationException"> /// 1. Non existent InitialSessionState provider for the shellID /// </exception> /* <InitializationParameters> <Param Name="PSVersion" Value="2.0" /> <Param Name="ApplicationBase" Value="<folder path>" /> ... </InitializationParameters> */ internal static ConfigurationDataFromXML LoadEndPointConfiguration( string shellId, string initializationParameters) { ConfigurationDataFromXML configData = null; if (!s_ssnStateProviders.ContainsKey(initializationParameters)) { LoadRSConfigProvider(shellId, initializationParameters); } lock (s_syncObject) { if (!s_ssnStateProviders.TryGetValue(initializationParameters, out configData)) { throw PSTraceSource.NewInvalidOperationException(RemotingErrorIdStrings.NonExistentInitialSessionStateProvider, shellId); } } return configData; } private static void LoadRSConfigProvider(string shellId, string initializationParameters) { ConfigurationDataFromXML configData = ConfigurationDataFromXML.Create(initializationParameters); Type endPointConfigType = LoadAndAnalyzeAssembly(shellId, configData.ApplicationBase, configData.AssemblyName, configData.EndPointConfigurationTypeName); Dbg.Assert(endPointConfigType != null, "EndPointConfiguration type cannot be null"); configData.EndPointConfigurationType = endPointConfigType; lock (s_syncObject) { if (!s_ssnStateProviders.ContainsKey(initializationParameters)) { s_ssnStateProviders.Add(initializationParameters, configData); } } } /// <summary> /// </summary> /// <param name="shellId"> /// shellId for which the assembly is getting loaded /// </param> /// <param name="applicationBase"></param> /// <param name="assemblyName"></param> /// <param name="typeToLoad"> /// type which is supplying the configuration. /// </param> /// <exception cref="InvalidOperationException"> /// </exception> /// <returns> /// Type instance representing the EndPointConfiguration to load. /// This Type can be instantiated when needed. /// </returns> private static Type LoadAndAnalyzeAssembly(string shellId, string applicationBase, string assemblyName, string typeToLoad) { if ((string.IsNullOrEmpty(assemblyName) && !string.IsNullOrEmpty(typeToLoad)) || (!string.IsNullOrEmpty(assemblyName) && string.IsNullOrEmpty(typeToLoad))) { throw PSTraceSource.NewInvalidOperationException(RemotingErrorIdStrings.TypeNeedsAssembly, ConfigurationDataFromXML.ASSEMBLYTOKEN, ConfigurationDataFromXML.SHELLCONFIGTYPETOKEN, ConfigurationDataFromXML.INITPARAMETERSTOKEN); } Assembly assembly = null; if (!string.IsNullOrEmpty(assemblyName)) { PSEtwLog.LogAnalyticVerbose(PSEventId.LoadingPSCustomShellAssembly, PSOpcode.Connect, PSTask.None, PSKeyword.Transport | PSKeyword.UseAlwaysAnalytic, assemblyName, shellId); assembly = LoadSsnStateProviderAssembly(applicationBase, assemblyName); if (assembly == null) { throw PSTraceSource.NewArgumentException(nameof(assemblyName), RemotingErrorIdStrings.UnableToLoadAssembly, assemblyName, ConfigurationDataFromXML.INITPARAMETERSTOKEN); } } // configuration xml specified an assembly and typetoload. if (assembly != null) { try { PSEtwLog.LogAnalyticVerbose(PSEventId.LoadingPSCustomShellType, PSOpcode.Connect, PSTask.None, PSKeyword.Transport | PSKeyword.UseAlwaysAnalytic, typeToLoad, shellId); Type type = assembly.GetType(typeToLoad, true, true); if (type == null) { throw PSTraceSource.NewArgumentException(nameof(typeToLoad), RemotingErrorIdStrings.UnableToLoadType, typeToLoad, ConfigurationDataFromXML.INITPARAMETERSTOKEN); } return type; } catch (ReflectionTypeLoadException) { } catch (TypeLoadException) { } catch (ArgumentException) { } catch (MissingMethodException) { } catch (InvalidCastException) { } catch (TargetInvocationException) { } // if we are here, that means we are unable to load the type specified // in the config xml.. notify the same. throw PSTraceSource.NewArgumentException(nameof(typeToLoad), RemotingErrorIdStrings.UnableToLoadType, typeToLoad, ConfigurationDataFromXML.INITPARAMETERSTOKEN); } // load the default PowerShell since plugin config // did not specify a typename to load. return typeof(DefaultRemotePowerShellConfiguration); } /// <summary> /// Sets the application's current working directory to <paramref name="applicationBase"/> and /// loads the assembly <paramref name="assemblyName"/>. Once the assembly is loaded, the application's /// current working directory is set back to the original value. /// </summary> /// <param name="applicationBase"></param> /// <param name="assemblyName"></param> /// <returns></returns> // TODO: Send the exception message back to the client. [SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadFrom")] private static Assembly LoadSsnStateProviderAssembly(string applicationBase, string assemblyName) { Dbg.Assert(!string.IsNullOrEmpty(assemblyName), "AssemblyName cannot be null."); string originalDirectory = string.Empty; if (!string.IsNullOrEmpty(applicationBase)) { // changing current working directory allows CLR loader to load dependent assemblies try { originalDirectory = Directory.GetCurrentDirectory(); Directory.SetCurrentDirectory(applicationBase); } catch (ArgumentException e) { s_tracer.TraceWarning("Not able to change current working directory to {0}: {1}", applicationBase, e.Message); } catch (PathTooLongException e) { s_tracer.TraceWarning("Not able to change current working directory to {0}: {1}", applicationBase, e.Message); } catch (FileNotFoundException e) { s_tracer.TraceWarning("Not able to change current working directory to {0}: {1}", applicationBase, e.Message); } catch (IOException e) { s_tracer.TraceWarning("Not able to change current working directory to {0}: {1}", applicationBase, e.Message); } catch (System.Security.SecurityException e) { s_tracer.TraceWarning("Not able to change current working directory to {0}: {1}", applicationBase, e.Message); } catch (UnauthorizedAccessException e) { s_tracer.TraceWarning("Not able to change current working directory to {0}: {1}", applicationBase, e.Message); } } // Even if there is error changing current working directory..try to load the assembly // This is to allow assembly loading from GAC Assembly result = null; try { try { result = Assembly.Load(new AssemblyName(assemblyName)); } catch (FileLoadException e) { s_tracer.TraceWarning("Not able to load assembly {0}: {1}", assemblyName, e.Message); } catch (BadImageFormatException e) { s_tracer.TraceWarning("Not able to load assembly {0}: {1}", assemblyName, e.Message); } catch (FileNotFoundException e) { s_tracer.TraceWarning("Not able to load assembly {0}: {1}", assemblyName, e.Message); } if (result != null) { return result; } s_tracer.WriteLine("Loading assembly from path {0}", applicationBase); try { string assemblyPath; if (!Path.IsPathRooted(assemblyName)) { if (!string.IsNullOrEmpty(applicationBase) && Directory.Exists(applicationBase)) { assemblyPath = Path.Combine(applicationBase, assemblyName); } else { assemblyPath = Path.Combine(Directory.GetCurrentDirectory(), assemblyName); } } else { // Rooted path of dll is provided. assemblyPath = assemblyName; } result = Assembly.LoadFrom(assemblyPath); } catch (FileLoadException e) { s_tracer.TraceWarning("Not able to load assembly {0}: {1}", assemblyName, e.Message); } catch (BadImageFormatException e) { s_tracer.TraceWarning("Not able to load assembly {0}: {1}", assemblyName, e.Message); } catch (FileNotFoundException e) { s_tracer.TraceWarning("Not able to load assembly {0}: {1}", assemblyName, e.Message); } } finally { if (!string.IsNullOrEmpty(applicationBase)) { // set the application's directory back to the original directory Directory.SetCurrentDirectory(originalDirectory); } } return result; } // TODO: I think this should be moved to Utils..this way all versioning related // logic will be in one place. private static RegistryKey GetConfigurationProvidersRegistryKey() { try { RegistryKey monadRootKey = PSSnapInReader.GetMonadRootKey(); RegistryKey versionRoot = PSSnapInReader.GetVersionRootKey(monadRootKey, Utils.GetCurrentMajorVersion()); RegistryKey configProviderKey = versionRoot.OpenSubKey(configProvidersKeyName); return configProviderKey; } catch (ArgumentException) { } catch (System.Security.SecurityException) { } return null; } /// <summary> /// Read value from the property <paramref name="name"/> for registry <paramref name="registryKey"/> /// as string. /// </summary> /// <param name="registryKey"> /// Registry key from which the value is read. /// Caller should make sure this is not null. /// </param> /// <param name="name"> /// Name of the property. /// Caller should make sure this is not null. /// </param> /// <param name="mandatory"> /// True, if the property should exist. /// False, otherwise. /// </param> /// <returns> /// Value of the property. /// </returns> /// <exception cref="ArgumentException"> /// </exception> /// <exception cref="System.Security.SecurityException"> /// </exception> private static string ReadStringValue(RegistryKey registryKey, string name, bool mandatory) { Dbg.Assert(!string.IsNullOrEmpty(name), "caller should validate the name parameter"); Dbg.Assert(registryKey != null, "Caller should validate the registryKey parameter"); object value = registryKey.GetValue(name); if (value == null && mandatory) { s_tracer.TraceError("Mandatory property {0} not specified for registry key {1}", name, registryKey.Name); throw PSTraceSource.NewArgumentException(nameof(name), RemotingErrorIdStrings.MandatoryValueNotPresent, name, registryKey.Name); } string s = value as string; if (string.IsNullOrEmpty(s) && mandatory) { s_tracer.TraceError("Value is null or empty for mandatory property {0} in {1}", name, registryKey.Name); throw PSTraceSource.NewArgumentException(nameof(name), RemotingErrorIdStrings.MandatoryValueNotInCorrectFormat, name, registryKey.Name); } return s; } private const string configProvidersKeyName = "PSConfigurationProviders"; private const string configProviderApplicationBaseKeyName = "ApplicationBase"; private const string configProviderAssemblyNameKeyName = "AssemblyName"; private static readonly Dictionary<string, ConfigurationDataFromXML> s_ssnStateProviders = new Dictionary<string, ConfigurationDataFromXML>(StringComparer.OrdinalIgnoreCase); private static readonly object s_syncObject = new object(); #endregion } /// <summary> /// Provides Default InitialSessionState. /// </summary> internal sealed class DefaultRemotePowerShellConfiguration : PSSessionConfiguration { #region Method overrides /// <summary> /// </summary> /// <param name="senderInfo"></param> /// <returns></returns> public override InitialSessionState GetInitialSessionState(PSSenderInfo senderInfo) { InitialSessionState result = InitialSessionState.CreateDefault2(); // TODO: Remove this after RDS moved to $using if (senderInfo.ConnectionString != null && senderInfo.ConnectionString.Contains("MSP=7a83d074-bb86-4e52-aa3e-6cc73cc066c8")) { PSSessionConfigurationData.IsServerManager = true; } return result; } public override InitialSessionState GetInitialSessionState(PSSessionConfigurationData sessionConfigurationData, PSSenderInfo senderInfo, string configProviderId) { ArgumentNullException.ThrowIfNull(sessionConfigurationData); ArgumentNullException.ThrowIfNull(senderInfo); ArgumentNullException.ThrowIfNull(configProviderId); InitialSessionState sessionState = InitialSessionState.CreateDefault2(); // now get all the modules in the specified path and import the same if (sessionConfigurationData != null && sessionConfigurationData.ModulesToImportInternal != null) { foreach (var module in sessionConfigurationData.ModulesToImportInternal) { var moduleName = module as string; if (moduleName != null) { moduleName = Environment.ExpandEnvironmentVariables(moduleName); sessionState.ImportPSModule(new[] { moduleName }); } else { var moduleSpec = module as ModuleSpecification; if (moduleSpec != null) { var modulesToImport = new Collection<ModuleSpecification> { moduleSpec }; sessionState.ImportPSModule(modulesToImport); } } } } // TODO: Remove this after RDS moved to $using if (senderInfo.ConnectionString != null && senderInfo.ConnectionString.Contains("MSP=7a83d074-bb86-4e52-aa3e-6cc73cc066c8")) { PSSessionConfigurationData.IsServerManager = true; } return sessionState; } #endregion } #endregion #region Declarative InitialSession Configuration #region Supporting types /// <summary> /// Specifies type of initial session state to use. Valid values are Empty and Default. /// </summary> public enum SessionType { /// <summary> /// Empty session state. /// </summary> Empty, /// <summary> /// Restricted remote server. /// </summary> RestrictedRemoteServer, /// <summary> /// Default session state. /// </summary> Default } /// <summary> /// Configuration type entry. /// </summary> internal class ConfigTypeEntry { internal delegate bool TypeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path); internal string Key; internal TypeValidationCallback ValidationCallback; /// <summary> /// </summary> /// <param name="key"></param> /// <param name="callback"></param> internal ConfigTypeEntry(string key, TypeValidationCallback callback) { this.Key = key; this.ValidationCallback = callback; } } #endregion #region ConfigFileConstants /// <summary> /// Configuration file constants. /// </summary> internal static class ConfigFileConstants { internal static readonly string AliasDefinitions = "AliasDefinitions"; internal static readonly string AliasDescriptionToken = "Description"; internal static readonly string AliasNameToken = "Name"; internal static readonly string AliasOptionsToken = "Options"; internal static readonly string AliasValueToken = "Value"; internal static readonly string AssembliesToLoad = "AssembliesToLoad"; internal static readonly string Author = "Author"; internal static readonly string CompanyName = "CompanyName"; internal static readonly string Description = "Description"; internal static readonly string EnforceInputParameterValidation = "EnforceInputParameterValidation"; internal static readonly string EnvironmentVariables = "EnvironmentVariables"; internal static readonly string ExecutionPolicy = "ExecutionPolicy"; internal static readonly string FormatsToProcess = "FormatsToProcess"; internal static readonly string FunctionDefinitions = "FunctionDefinitions"; internal static readonly string FunctionNameToken = "Name"; internal static readonly string FunctionOptionsToken = "Options"; internal static readonly string FunctionValueToken = "ScriptBlock"; internal static readonly string GMSAAccount = "GroupManagedServiceAccount"; internal static readonly string Guid = "GUID"; internal static readonly string LanguageMode = "LanguageMode"; internal static readonly string ModulesToImport = "ModulesToImport"; internal static readonly string MountUserDrive = "MountUserDrive"; internal static readonly string PowerShellVersion = "PowerShellVersion"; internal static readonly string RequiredGroups = "RequiredGroups"; internal static readonly string RoleDefinitions = "RoleDefinitions"; internal static readonly string SchemaVersion = "SchemaVersion"; internal static readonly string ScriptsToProcess = "ScriptsToProcess"; internal static readonly string SessionType = "SessionType"; internal static readonly string RoleCapabilities = "RoleCapabilities"; internal static readonly string RoleCapabilityFiles = "RoleCapabilityFiles"; internal static readonly string RunAsVirtualAccount = "RunAsVirtualAccount"; internal static readonly string RunAsVirtualAccountGroups = "RunAsVirtualAccountGroups"; internal static readonly string TranscriptDirectory = "TranscriptDirectory"; internal static readonly string TypesToProcess = "TypesToProcess"; internal static readonly string UserDriveMaxSize = "UserDriveMaximumSize"; internal static readonly string VariableDefinitions = "VariableDefinitions"; internal static readonly string VariableNameToken = "Name"; internal static readonly string VariableValueToken = "Value"; internal static readonly string VisibleAliases = "VisibleAliases"; internal static readonly string VisibleCmdlets = "VisibleCmdlets"; internal static readonly string VisibleFunctions = "VisibleFunctions"; internal static readonly string VisibleProviders = "VisibleProviders"; internal static readonly string VisibleExternalCommands = "VisibleExternalCommands"; internal static readonly ConfigTypeEntry[] ConfigFileKeys = new ConfigTypeEntry[] { new ConfigTypeEntry(AliasDefinitions, new ConfigTypeEntry.TypeValidationCallback(AliasDefinitionsTypeValidationCallback)), new ConfigTypeEntry(AssembliesToLoad, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(Author, new ConfigTypeEntry.TypeValidationCallback(StringTypeValidationCallback)), new ConfigTypeEntry(CompanyName, new ConfigTypeEntry.TypeValidationCallback(StringTypeValidationCallback)), new ConfigTypeEntry(Description, new ConfigTypeEntry.TypeValidationCallback(StringTypeValidationCallback)), new ConfigTypeEntry(EnforceInputParameterValidation, new ConfigTypeEntry.TypeValidationCallback(BooleanTypeValidationCallback)), new ConfigTypeEntry(EnvironmentVariables, new ConfigTypeEntry.TypeValidationCallback(HashtableTypeValidationCallback)), new ConfigTypeEntry(ExecutionPolicy, new ConfigTypeEntry.TypeValidationCallback(ExecutionPolicyValidationCallback)), new ConfigTypeEntry(FormatsToProcess, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(FunctionDefinitions, new ConfigTypeEntry.TypeValidationCallback(FunctionDefinitionsTypeValidationCallback)), new ConfigTypeEntry(GMSAAccount, new ConfigTypeEntry.TypeValidationCallback(StringTypeValidationCallback)), new ConfigTypeEntry(Guid, new ConfigTypeEntry.TypeValidationCallback(StringTypeValidationCallback)), new ConfigTypeEntry(LanguageMode, new ConfigTypeEntry.TypeValidationCallback(LanguageModeValidationCallback)), new ConfigTypeEntry(ModulesToImport, new ConfigTypeEntry.TypeValidationCallback(StringOrHashtableArrayTypeValidationCallback)), new ConfigTypeEntry(MountUserDrive, new ConfigTypeEntry.TypeValidationCallback(BooleanTypeValidationCallback)), new ConfigTypeEntry(PowerShellVersion, new ConfigTypeEntry.TypeValidationCallback(StringTypeValidationCallback)), new ConfigTypeEntry(RequiredGroups, new ConfigTypeEntry.TypeValidationCallback(HashtableTypeValidationCallback)), new ConfigTypeEntry(RoleCapabilities, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(RoleCapabilityFiles, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(RoleDefinitions, new ConfigTypeEntry.TypeValidationCallback(HashtableTypeValidationCallback)), new ConfigTypeEntry(RunAsVirtualAccount, new ConfigTypeEntry.TypeValidationCallback(BooleanTypeValidationCallback)), new ConfigTypeEntry(RunAsVirtualAccountGroups, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(SchemaVersion, new ConfigTypeEntry.TypeValidationCallback(StringTypeValidationCallback)), new ConfigTypeEntry(ScriptsToProcess, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(SessionType, new ConfigTypeEntry.TypeValidationCallback(ISSValidationCallback)), new ConfigTypeEntry(TranscriptDirectory, new ConfigTypeEntry.TypeValidationCallback(StringTypeValidationCallback)), new ConfigTypeEntry(TypesToProcess, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(UserDriveMaxSize, new ConfigTypeEntry.TypeValidationCallback(IntegerTypeValidationCallback)), new ConfigTypeEntry(VariableDefinitions, new ConfigTypeEntry.TypeValidationCallback(VariableDefinitionsTypeValidationCallback)), new ConfigTypeEntry(VisibleAliases, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(VisibleCmdlets, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(VisibleFunctions, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(VisibleProviders, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), new ConfigTypeEntry(VisibleExternalCommands, new ConfigTypeEntry.TypeValidationCallback(StringArrayTypeValidationCallback)), }; /// <summary> /// Checks if the given key is a valid key. /// </summary> /// <param name="de"></param> /// <param name="cmdlet"></param> /// <param name="path"></param> /// <returns></returns> internal static bool IsValidKey(DictionaryEntry de, PSCmdlet cmdlet, string path) { bool validKey = false; foreach (ConfigTypeEntry configEntry in ConfigFileKeys) { if (string.Equals(configEntry.Key, de.Key.ToString(), StringComparison.OrdinalIgnoreCase)) { validKey = true; if (configEntry.ValidationCallback(de.Key.ToString(), de.Value, cmdlet, path)) { return true; } } } if (!validKey) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCInvalidKey, de.Key.ToString(), path)); } return false; } /// <summary> /// </summary> /// <param name="key"></param> /// <param name="obj"></param> /// <param name="cmdlet"></param> /// <param name="path"></param> /// <returns></returns> private static bool ISSValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { string value = obj as string; if (!string.IsNullOrEmpty(value)) { try { Enum.Parse(typeof(SessionType), value, true); return true; } catch (ArgumentException) { // Do nothing here } } cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeValidEnum, key, typeof(SessionType).FullName, LanguagePrimitives.EnumSingleTypeConverter.EnumValues(typeof(SessionType)), path)); return false; } /// <summary> /// </summary> /// <param name="key"></param> /// <param name="obj"></param> /// <param name="cmdlet"></param> /// <param name="path"></param> /// <returns></returns> private static bool LanguageModeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { string value = obj as string; if (!string.IsNullOrEmpty(value)) { try { Enum.Parse(typeof(PSLanguageMode), value, true); return true; } catch (ArgumentException) { // Do nothing here } } cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeValidEnum, key, typeof(PSLanguageMode).FullName, LanguagePrimitives.EnumSingleTypeConverter.EnumValues(typeof(PSLanguageMode)), path)); return false; } /// <summary> /// </summary> /// <param name="key"></param> /// <param name="obj"></param> /// <param name="cmdlet"></param> /// <param name="path"></param> /// <returns></returns> private static bool ExecutionPolicyValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { string value = obj as string; if (!string.IsNullOrEmpty(value)) { try { Enum.Parse(DISCUtils.ExecutionPolicyType, value, true); return true; } catch (ArgumentException) { // Do nothing here } } cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeValidEnum, key, DISCUtils.ExecutionPolicyType.FullName, LanguagePrimitives.EnumSingleTypeConverter.EnumValues(DISCUtils.ExecutionPolicyType), path)); return false; } /// <summary> /// </summary> /// <param name="key"></param> /// <param name="obj"></param> /// <param name="cmdlet"></param> /// <param name="path"></param> /// <returns></returns> private static bool HashtableTypeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { Hashtable hash = obj as Hashtable; if (hash == null) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeHashtable, key, path)); return false; } return true; } /// <summary> /// </summary> /// <param name="key"></param> /// <param name="obj"></param> /// <param name="cmdlet"></param> /// <param name="path"></param> /// <returns></returns> private static bool AliasDefinitionsTypeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { Hashtable[] hashtables = DISCPowerShellConfiguration.TryGetHashtableArray(obj); if (hashtables == null) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeHashtableArray, key, path)); return false; } foreach (Hashtable hashtable in hashtables) { if (!hashtable.ContainsKey(AliasNameToken)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustContainKey, key, AliasNameToken, path)); return false; } if (!hashtable.ContainsKey(AliasValueToken)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustContainKey, key, AliasValueToken, path)); return false; } foreach (string aliasKey in hashtable.Keys) { if (!string.Equals(aliasKey, AliasNameToken, StringComparison.OrdinalIgnoreCase) && !string.Equals(aliasKey, AliasValueToken, StringComparison.OrdinalIgnoreCase) && !string.Equals(aliasKey, AliasDescriptionToken, StringComparison.OrdinalIgnoreCase) && !string.Equals(aliasKey, AliasOptionsToken, StringComparison.OrdinalIgnoreCase)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeContainsInvalidKey, aliasKey, key, path)); return false; } } } return true; } /// <summary> /// </summary> /// <param name="key"></param> /// <param name="obj"></param> /// <param name="cmdlet"></param> /// <param name="path"></param> /// <returns></returns> private static bool FunctionDefinitionsTypeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { Hashtable[] hashtables = DISCPowerShellConfiguration.TryGetHashtableArray(obj); if (hashtables == null) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeHashtableArray, key, path)); return false; } foreach (Hashtable hashtable in hashtables) { if (!hashtable.ContainsKey(FunctionNameToken)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustContainKey, key, FunctionNameToken, path)); return false; } if (!hashtable.ContainsKey(FunctionValueToken)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustContainKey, key, FunctionValueToken, path)); return false; } if (hashtable[FunctionValueToken] is not ScriptBlock) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCKeyMustBeScriptBlock, FunctionValueToken, key, path)); return false; } foreach (string functionKey in hashtable.Keys) { if (!string.Equals(functionKey, FunctionNameToken, StringComparison.OrdinalIgnoreCase) && !string.Equals(functionKey, FunctionValueToken, StringComparison.OrdinalIgnoreCase) && !string.Equals(functionKey, FunctionOptionsToken, StringComparison.OrdinalIgnoreCase)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeContainsInvalidKey, functionKey, key, path)); return false; } } } return true; } /// <summary> /// </summary> /// <param name="key"></param> /// <param name="obj"></param> /// <param name="cmdlet"></param> /// <param name="path"></param> /// <returns></returns> private static bool VariableDefinitionsTypeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { Hashtable[] hashtables = DISCPowerShellConfiguration.TryGetHashtableArray(obj); if (hashtables == null) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeHashtableArray, key, path)); return false; } foreach (Hashtable hashtable in hashtables) { if (!hashtable.ContainsKey(VariableNameToken)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustContainKey, key, VariableNameToken, path)); return false; } if (!hashtable.ContainsKey(VariableValueToken)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustContainKey, key, VariableValueToken, path)); return false; } foreach (string variableKey in hashtable.Keys) { if (!string.Equals(variableKey, VariableNameToken, StringComparison.OrdinalIgnoreCase) && !string.Equals(variableKey, VariableValueToken, StringComparison.OrdinalIgnoreCase)) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeContainsInvalidKey, variableKey, key, path)); return false; } } } return true; } /// <summary> /// Verifies a string type. /// </summary> /// <param name="obj"></param> /// <param name="cmdlet"></param> /// <param name="key"></param> /// <param name="path"></param> /// <returns></returns> private static bool StringTypeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { if (obj is not string) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeString, key, path)); return false; } return true; } /// <summary> /// Verifies a string array type. /// </summary> /// <param name="obj"></param> /// <param name="cmdlet"></param> /// <param name="key"></param> /// <param name="path"></param> /// <returns></returns> private static bool StringArrayTypeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { if (DISCPowerShellConfiguration.TryGetStringArray(obj) == null) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeStringArray, key, path)); return false; } return true; } private static bool BooleanTypeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { if (obj is not bool) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeBoolean, key, path)); return false; } return true; } private static bool IntegerTypeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { if (obj is not int && obj is not long) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeInteger, key, path)); return false; } return true; } /// <summary> /// Verifies that an array contains only string or hashtable elements. /// </summary> /// <param name="obj"></param> /// <param name="cmdlet"></param> /// <param name="key"></param> /// <param name="path"></param> /// <returns></returns> private static bool StringOrHashtableArrayTypeValidationCallback(string key, object obj, PSCmdlet cmdlet, string path) { if (DISCPowerShellConfiguration.TryGetObjectsOfType<object>(obj, new Type[] { typeof(string), typeof(Hashtable) }) == null) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeStringOrHashtableArrayInFile, key, path)); return false; } return true; } } #endregion #region DISC Utilities /// <summary> /// DISC utilities. /// </summary> internal static class DISCUtils { #region Private data internal static Type ExecutionPolicyType = null; /// <summary> /// !! NOTE that this list MUST be updated when new capability session configuration properties are added. /// </summary> private static readonly HashSet<string> s_allowedRoleCapabilityKeys = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "RoleCapabilities", "RoleCapabilityFiles", "ModulesToImport", "VisibleAliases", "VisibleCmdlets", "VisibleFunctions", "VisibleExternalCommands", "VisibleProviders", "ScriptsToProcess", "AliasDefinitions", "FunctionDefinitions", "VariableDefinitions", "EnvironmentVariables", "TypesToProcess", "FormatsToProcess", "AssembliesToLoad" }; #endregion /// <summary> /// Create an ExternalScriptInfo object from a file path. /// </summary> /// <param name="context">Execution context.</param> /// <param name="fileName">The path to the file.</param> /// <param name="scriptName">The base name of the script.</param> /// <returns>The ExternalScriptInfo object.</returns> internal static ExternalScriptInfo GetScriptInfoForFile(ExecutionContext context, string fileName, out string scriptName) { scriptName = Path.GetFileName(fileName); ExternalScriptInfo scriptInfo = new ExternalScriptInfo(scriptName, fileName, context); // Skip ShouldRun check for .psd1 files. // Use ValidateScriptInfo() for explicitly validating the checkpolicy for psd1 file. // if (!scriptName.EndsWith(".psd1", StringComparison.OrdinalIgnoreCase)) { context.AuthorizationManager.ShouldRunInternal(scriptInfo, CommandOrigin.Internal, context.EngineHostInterface); // Verify that the PSversion is correct... CommandDiscovery.VerifyPSVersion(scriptInfo); // If we got this far, the check succeeded and we don't need to check again. scriptInfo.SignatureChecked = true; } return scriptInfo; } /// <summary> /// Loads the configuration file into a hashtable. /// </summary> /// <param name="context">Execution context.</param> /// <param name="scriptInfo">The ExternalScriptInfo object.</param> /// <returns>Configuration hashtable.</returns> internal static Hashtable LoadConfigFile(ExecutionContext context, ExternalScriptInfo scriptInfo) { object result; object oldPSScriptRoot = context.GetVariableValue(SpecialVariables.PSScriptRootVarPath); object oldPSCommandPath = context.GetVariableValue(SpecialVariables.PSCommandPathVarPath); try { // Set the PSScriptRoot variable in the modules session state context.SetVariable(SpecialVariables.PSScriptRootVarPath, Path.GetDirectoryName(scriptInfo.Definition)); context.SetVariable(SpecialVariables.PSCommandPathVarPath, scriptInfo.Definition); result = PSObject.Base(scriptInfo.ScriptBlock.InvokeReturnAsIs()); } finally { context.SetVariable(SpecialVariables.PSScriptRootVarPath, oldPSScriptRoot); context.SetVariable(SpecialVariables.PSCommandPathVarPath, oldPSCommandPath); } return result as Hashtable; } /// <summary> /// Verifies the configuration hashtable. /// </summary> /// <param name="table">Configuration hashtable.</param> /// <param name="cmdlet"></param> /// <param name="path"></param> /// <returns>True if valid, false otherwise.</returns> internal static bool VerifyConfigTable(Hashtable table, PSCmdlet cmdlet, string path) { bool hasSchemaVersion = false; foreach (DictionaryEntry de in table) { if (!ConfigFileConstants.IsValidKey(de, cmdlet, path)) { return false; } if (de.Key.ToString().Equals(ConfigFileConstants.SchemaVersion, StringComparison.OrdinalIgnoreCase)) { hasSchemaVersion = true; } } if (!hasSchemaVersion) { cmdlet.WriteVerbose(StringUtil.Format(RemotingErrorIdStrings.DISCMissingSchemaVersion, path)); return false; } try { ValidateAbsolutePaths(cmdlet.SessionState, table, path); ValidateExtensions(table, path); } catch (InvalidOperationException e) { cmdlet.WriteVerbose(e.Message); return false; } return true; } /// <summary> /// </summary> private static void ValidatePS1XMLExtension(string key, string[] paths, string filePath) { if (paths == null) { return; } foreach (string path in paths) { try { string ext = System.IO.Path.GetExtension(path); if (!ext.Equals(".ps1xml", StringComparison.OrdinalIgnoreCase)) { throw new InvalidOperationException(StringUtil.Format(RemotingErrorIdStrings.DISCInvalidExtension, key, ext, ".ps1xml")); } } catch (ArgumentException argumentException) { throw new InvalidOperationException(StringUtil.Format(RemotingErrorIdStrings.ErrorParsingTheKeyInPSSessionConfigurationFile, key, filePath), argumentException); } } } /// <summary> /// </summary> private static void ValidatePS1OrPSM1Extension(string key, string[] paths, string filePath) { if (paths == null) { return; } foreach (string path in paths) { try { string ext = System.IO.Path.GetExtension(path); if (!ext.Equals(StringLiterals.PowerShellScriptFileExtension, StringComparison.OrdinalIgnoreCase) && !ext.Equals(StringLiterals.PowerShellModuleFileExtension, StringComparison.OrdinalIgnoreCase)) { throw new InvalidOperationException(StringUtil.Format(RemotingErrorIdStrings.DISCInvalidExtension, key, ext, string.Join(", ", StringLiterals.PowerShellScriptFileExtension, StringLiterals.PowerShellModuleFileExtension))); } } catch (ArgumentException argumentException) { throw new InvalidOperationException(StringUtil.Format(RemotingErrorIdStrings.ErrorParsingTheKeyInPSSessionConfigurationFile, key, filePath), argumentException); } } } /// <summary> /// </summary> /// <param name="table"></param> /// <param name="filePath"></param> internal static void ValidateExtensions(Hashtable table, string filePath) { if (table.ContainsKey(ConfigFileConstants.TypesToProcess)) { ValidatePS1XMLExtension(ConfigFileConstants.TypesToProcess, DISCPowerShellConfiguration.TryGetStringArray(table[ConfigFileConstants.TypesToProcess]), filePath); } if (table.ContainsKey(ConfigFileConstants.FormatsToProcess)) { ValidatePS1XMLExtension(ConfigFileConstants.FormatsToProcess, DISCPowerShellConfiguration.TryGetStringArray(table[ConfigFileConstants.FormatsToProcess]), filePath); } if (table.ContainsKey(ConfigFileConstants.ScriptsToProcess)) { ValidatePS1OrPSM1Extension(ConfigFileConstants.ScriptsToProcess, DISCPowerShellConfiguration.TryGetStringArray(table[ConfigFileConstants.ScriptsToProcess]), filePath); } } /// <summary> /// Checks if all paths are absolute paths. /// </summary> /// <param name="state"></param> /// <param name="table"></param> /// <param name="filePath"></param> internal static void ValidateAbsolutePaths(SessionState state, Hashtable table, string filePath) { if (table.ContainsKey(ConfigFileConstants.TypesToProcess)) { ValidateAbsolutePath(state, ConfigFileConstants.TypesToProcess, DISCPowerShellConfiguration.TryGetStringArray(table[ConfigFileConstants.TypesToProcess]), filePath); } if (table.ContainsKey(ConfigFileConstants.FormatsToProcess)) { ValidateAbsolutePath(state, ConfigFileConstants.FormatsToProcess, DISCPowerShellConfiguration.TryGetStringArray(table[ConfigFileConstants.FormatsToProcess]), filePath); } if (table.ContainsKey(ConfigFileConstants.ScriptsToProcess)) { ValidateAbsolutePath(state, ConfigFileConstants.ScriptsToProcess, DISCPowerShellConfiguration.TryGetStringArray(table[ConfigFileConstants.ScriptsToProcess]), filePath); } } /// <summary> /// Checks if a path is an absolute path. /// </summary> /// <param name="key"></param> /// <param name="state"></param> /// <param name="paths"></param> /// <param name="filePath"></param> internal static void ValidateAbsolutePath(SessionState state, string key, string[] paths, string filePath) { if (paths == null) { return; } string driveName; foreach (string path in paths) { if (!state.Path.IsPSAbsolute(path, out driveName)) { throw new InvalidOperationException(StringUtil.Format(RemotingErrorIdStrings.DISCPathsMustBeAbsolute, key, path, filePath)); } } } /// <summary> /// Validates Role Definition hash entries /// /// RoleDefinitions = @{ /// 'Everyone' = @{ /// 'RoIeCapabilities' = 'Basic' }; /// 'Administrators' = @{ /// 'VisibleCmdlets' = 'Get-Process','Get-Location'; 'VisibleFunctions = 'TabExpansion2' } } /// </summary> /// <param name="roleDefinitions"></param> internal static void ValidateRoleDefinitions(IDictionary roleDefinitions) { foreach (var roleKey in roleDefinitions.Keys) { if (roleKey is not string) { var invalidOperationEx = new PSInvalidOperationException( string.Format(RemotingErrorIdStrings.InvalidRoleKeyType, roleKey.GetType().FullName)); invalidOperationEx.SetErrorId("InvalidRoleKeyType"); throw invalidOperationEx; } // // Each role capability in the role definition item should contain a hash table with allowed role capability key. // IDictionary roleDefinition = roleDefinitions[roleKey] as IDictionary; if (roleDefinition == null) { var invalidOperationEx = new PSInvalidOperationException( StringUtil.Format(RemotingErrorIdStrings.InvalidRoleValue, roleKey)); invalidOperationEx.SetErrorId("InvalidRoleEntryNotHashtable"); throw invalidOperationEx; } foreach (var key in roleDefinition.Keys) { // Ensure each role capability key is valid. string roleCapabilityKey = key as string; if (roleCapabilityKey == null) { var invalidOperationEx = new PSInvalidOperationException( string.Format(RemotingErrorIdStrings.InvalidRoleCapabilityKeyType, key.GetType().FullName)); invalidOperationEx.SetErrorId("InvalidRoleCapabilityKeyType"); throw invalidOperationEx; } if (!s_allowedRoleCapabilityKeys.Contains(roleCapabilityKey)) { var invalidOperationEx = new PSInvalidOperationException( string.Format(RemotingErrorIdStrings.InvalidRoleCapabilityKey, roleCapabilityKey)); invalidOperationEx.SetErrorId("InvalidRoleCapabilityKey"); throw invalidOperationEx; } } } } } #endregion #region DISCPowerShellConfiguration /// <summary> /// Creates an initial session state based on the configuration language for PSSC files. /// </summary> internal sealed class DISCPowerShellConfiguration : PSSessionConfiguration { private readonly string _configFile; private readonly Hashtable _configHash; /// <summary> /// Gets the configuration hashtable that results from parsing the specified configuration file. /// </summary> internal Hashtable ConfigHash { get { return _configHash; } } /// <summary> /// Creates a new instance of a Declarative Initial Session State Configuration. /// </summary> /// <param name="configFile">The path to the .pssc file representing the initial session state.</param> /// <param name="roleVerifier"> /// The verifier that PowerShell should call to determine if groups in the Role entry apply to the /// target session. If you have a WindowsPrincipal for a user, for example, create a Function that /// checks windowsPrincipal.IsInRole(). /// </param> /// <param name="validateFile">Validate file for supported configuration options.</param> internal DISCPowerShellConfiguration( string configFile, Func<string, bool> roleVerifier, bool validateFile = false) { _configFile = configFile; roleVerifier ??= static (role) => false; Runspace backupRunspace = Runspace.DefaultRunspace; try { Runspace.DefaultRunspace = RunspaceFactory.CreateRunspace(); Runspace.DefaultRunspace.Open(); string scriptName; ExternalScriptInfo script = DISCUtils.GetScriptInfoForFile(Runspace.DefaultRunspace.ExecutionContext, configFile, out scriptName); _configHash = DISCUtils.LoadConfigFile(Runspace.DefaultRunspace.ExecutionContext, script); if (validateFile) { DISCFileValidation.ValidateContents(_configHash); } MergeRoleRulesIntoConfigHash(roleVerifier); MergeRoleCapabilitiesIntoConfigHash(); Runspace.DefaultRunspace.Close(); } catch (PSSecurityException e) { string message = StringUtil.Format(RemotingErrorIdStrings.InvalidPSSessionConfigurationFilePath, configFile); PSInvalidOperationException ioe = new PSInvalidOperationException(message, e); ioe.SetErrorId("InvalidPSSessionConfigurationFilePath"); throw ioe; } finally { Runspace.DefaultRunspace = backupRunspace; } } // Takes the "Roles" node in the config hash, and merges all that apply into the base configuration. private void MergeRoleRulesIntoConfigHash(Func<string, bool> roleVerifier) { if (_configHash.ContainsKey(ConfigFileConstants.RoleDefinitions)) { // Extract the 'Roles' hashtable IDictionary roleEntry = _configHash[ConfigFileConstants.RoleDefinitions] as IDictionary; if (roleEntry == null) { string message = StringUtil.Format(RemotingErrorIdStrings.InvalidRoleEntry, _configHash["Roles"].GetType().FullName); PSInvalidOperationException ioe = new PSInvalidOperationException(message); ioe.SetErrorId("InvalidRoleDefinitionNotHashtable"); throw ioe; } // Ensure that role definitions contain valid entries. DISCUtils.ValidateRoleDefinitions(roleEntry); // Go through the Roles hashtable foreach (object role in roleEntry.Keys) { // Check if this role applies to the connected user if (roleVerifier(role.ToString())) { // Extract their specific configuration IDictionary roleCustomizations = roleEntry[role] as IDictionary; if (roleCustomizations == null) { string message = StringUtil.Format(RemotingErrorIdStrings.InvalidRoleValue, role.ToString()); PSInvalidOperationException ioe = new PSInvalidOperationException(message); ioe.SetErrorId("InvalidRoleValueNotHashtable"); throw ioe; } MergeConfigHashIntoConfigHash(roleCustomizations); } } } } // Takes the "RoleCapabilities" node in the config hash, and merges its values into the base configuration. private const string PSRCExtension = ".psrc"; private void MergeRoleCapabilitiesIntoConfigHash() { List<string> psrcFiles = new List<string>(); if (_configHash.ContainsKey(ConfigFileConstants.RoleCapabilities)) { string[] roleCapabilities = TryGetStringArray(_configHash[ConfigFileConstants.RoleCapabilities]); if (roleCapabilities != null) { foreach (string roleCapability in roleCapabilities) { string roleCapabilityPath = GetRoleCapabilityPath(roleCapability); if (string.IsNullOrEmpty(roleCapabilityPath)) { string message = StringUtil.Format(RemotingErrorIdStrings.CouldNotFindRoleCapability, roleCapability, roleCapability + PSRCExtension); PSInvalidOperationException ioe = new PSInvalidOperationException(message); ioe.SetErrorId("CouldNotFindRoleCapability"); throw ioe; } psrcFiles.Add(roleCapabilityPath); } } } if (ConfigHash.ContainsKey(ConfigFileConstants.RoleCapabilityFiles)) { string[] roleCapabilityFiles = TryGetStringArray(ConfigHash[ConfigFileConstants.RoleCapabilityFiles]); if (roleCapabilityFiles != null) { foreach (var roleCapabilityFilePath in roleCapabilityFiles) { if (!Path.GetExtension(roleCapabilityFilePath).Equals(PSRCExtension, StringComparison.OrdinalIgnoreCase)) { string message = StringUtil.Format(RemotingErrorIdStrings.InvalidRoleCapabilityFileExtension, roleCapabilityFilePath); PSInvalidOperationException ioe = new PSInvalidOperationException(message); ioe.SetErrorId("InvalidRoleCapabilityFileExtension"); throw ioe; } if (!File.Exists(roleCapabilityFilePath)) { string message = StringUtil.Format(RemotingErrorIdStrings.CouldNotFindRoleCapabilityFile, roleCapabilityFilePath); PSInvalidOperationException ioe = new PSInvalidOperationException(message); ioe.SetErrorId("CouldNotFindRoleCapabilityFile"); throw ioe; } psrcFiles.Add(roleCapabilityFilePath); } } } foreach (var roleCapabilityFile in psrcFiles) { DISCPowerShellConfiguration roleCapabilityConfiguration = new DISCPowerShellConfiguration(roleCapabilityFile, null); IDictionary roleCapabilityConfigurationItems = roleCapabilityConfiguration.ConfigHash; MergeConfigHashIntoConfigHash(roleCapabilityConfigurationItems); } } // Merge a role / role capability hashtable into the master configuration hashtable private void MergeConfigHashIntoConfigHash(IDictionary childConfigHash) { foreach (object customization in childConfigHash.Keys) { string customizationString = customization.ToString(); var customizationValue = new List<object>(); // First, take all values from the master config table if (_configHash.ContainsKey(customizationString)) { IEnumerable existingValueAsCollection = LanguagePrimitives.GetEnumerable(_configHash[customization]); if (existingValueAsCollection != null) { foreach (object value in existingValueAsCollection) { customizationValue.Add(value); } } else { customizationValue.Add(_configHash[customization]); } } // Then add the current role's values IEnumerable newValueAsCollection = LanguagePrimitives.GetEnumerable(childConfigHash[customization]); if (newValueAsCollection != null) { foreach (object value in newValueAsCollection) { customizationValue.Add(value); } } else { customizationValue.Add(childConfigHash[customization]); } // Now update the config table for this role. _configHash[customization] = customizationValue.ToArray(); } } private static string GetRoleCapabilityPath(string roleCapability) { string moduleName = "*"; if (roleCapability.Contains('\\')) { string[] components = roleCapability.Split('\\', 2); moduleName = components[0]; roleCapability = components[1]; } // Go through each directory in the module path string[] modulePaths = ModuleIntrinsics.GetModulePath().Split(Path.PathSeparator); foreach (string path in modulePaths) { try { // And then each module in that directory foreach (string directory in Directory.EnumerateDirectories(path, moduleName)) { string roleCapabilitiesPath = Path.Combine(directory, "RoleCapabilities"); if (Directory.Exists(roleCapabilitiesPath)) { // If the role capabilities directory exists, look for .psrc files with the role capability name foreach (string roleCapabilityPath in Directory.EnumerateFiles(roleCapabilitiesPath, roleCapability + ".psrc")) { return roleCapabilityPath; } } } } catch (IOException) { // Could not enumerate the directories for a broken module path element. Just try the next. } catch (UnauthorizedAccessException) { // Could not enumerate the directories for a broken module path element. Just try the next. } } return null; } /// <summary> /// Creates an initial session state from a configuration file (DISC) /// </summary> /// <param name="senderInfo"></param> /// <returns></returns> public override InitialSessionState GetInitialSessionState(PSSenderInfo senderInfo) { InitialSessionState iss = null; // Create the initial session state string initialSessionState = TryGetValue(_configHash, ConfigFileConstants.SessionType); SessionType sessionType = SessionType.Default; bool cmdletVisibilityApplied = IsNonDefaultVisibilitySpecified(ConfigFileConstants.VisibleCmdlets); bool functionVisibilityApplied = IsNonDefaultVisibilitySpecified(ConfigFileConstants.VisibleFunctions); bool aliasVisibilityApplied = IsNonDefaultVisibilitySpecified(ConfigFileConstants.VisibleAliases); bool providerVisibilityApplied = IsNonDefaultVisibilitySpecified(ConfigFileConstants.VisibleProviders); bool processDefaultSessionStateVisibility = false; if (!string.IsNullOrEmpty(initialSessionState)) { sessionType = (SessionType)Enum.Parse(typeof(SessionType), initialSessionState, true); if (sessionType == SessionType.Empty) { iss = InitialSessionState.Create(); } else if (sessionType == SessionType.RestrictedRemoteServer) { iss = InitialSessionState.CreateRestricted(SessionCapabilities.RemoteServer); } else { iss = InitialSessionState.CreateDefault2(); processDefaultSessionStateVisibility = true; } } else { iss = InitialSessionState.CreateDefault2(); processDefaultSessionStateVisibility = true; } if (cmdletVisibilityApplied || functionVisibilityApplied || aliasVisibilityApplied || providerVisibilityApplied || IsNonDefaultVisibilitySpecified(ConfigFileConstants.VisibleExternalCommands)) { iss.DefaultCommandVisibility = SessionStateEntryVisibility.Private; // If visibility is applied on a default runspace then set initial ISS // commands visibility to private. if (processDefaultSessionStateVisibility) { foreach (var cmd in iss.Commands) { cmd.Visibility = iss.DefaultCommandVisibility; } } } // Add providers if (providerVisibilityApplied) { string[] providers = TryGetStringArray(_configHash[ConfigFileConstants.VisibleProviders]); if (providers != null) { System.Collections.Generic.HashSet<string> addedProviders = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (string provider in providers) { if (!string.IsNullOrEmpty(provider)) { // Look up providers from provider name including wildcards. var providersFound = iss.Providers.LookUpByName(provider); foreach (var providerFound in providersFound) { if (!addedProviders.Contains(providerFound.Name)) { addedProviders.Add(providerFound.Name); providerFound.Visibility = SessionStateEntryVisibility.Public; } } } } } } // Add assemblies and modules); if (_configHash.ContainsKey(ConfigFileConstants.AssembliesToLoad)) { string[] assemblies = TryGetStringArray(_configHash[ConfigFileConstants.AssembliesToLoad]); if (assemblies != null) { foreach (string assembly in assemblies) { iss.Assemblies.Add(new SessionStateAssemblyEntry(assembly)); } } } if (_configHash.ContainsKey(ConfigFileConstants.ModulesToImport)) { object[] modules = TryGetObjectsOfType<object>(_configHash[ConfigFileConstants.ModulesToImport], new Type[] { typeof(string), typeof(Hashtable) }); if ((_configHash[ConfigFileConstants.ModulesToImport] != null) && (modules == null)) { string message = StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeStringOrHashtableArray, ConfigFileConstants.ModulesToImport); PSInvalidOperationException ioe = new PSInvalidOperationException(message); ioe.SetErrorId("InvalidModulesToImportKeyEntries"); throw ioe; } if (modules != null) { Collection<ModuleSpecification> modulesToImport = new Collection<ModuleSpecification>(); foreach (object module in modules) { ModuleSpecification moduleSpec = null; string moduleName = module as string; if (!string.IsNullOrEmpty(moduleName)) { moduleSpec = new ModuleSpecification(moduleName); } else { Hashtable moduleHash = module as Hashtable; if (moduleHash != null) { moduleSpec = new ModuleSpecification(moduleHash); } } // Now add the moduleSpec to modulesToImport if (moduleSpec != null) { if (string.Equals(InitialSessionState.CoreModule, moduleSpec.Name, StringComparison.OrdinalIgnoreCase)) { if (sessionType == SessionType.Empty) { // Win8: 627752 Cannot load microsoft.powershell.core module as part of DISC // Convert Microsoft.PowerShell.Core module -> Microsoft.PowerShell.Core snapin. // Doing this Import only in SessionType.Empty case, because other cases already do this. // In V3, Microsoft.PowerShell.Core module is not installed externally. iss.ImportCorePSSnapIn(); } // silently ignore Microsoft.PowerShell.Core for other cases ie., SessionType.RestrictedRemoteServer && SessionType.Default } else { modulesToImport.Add(moduleSpec); } } } iss.ImportPSModule(modulesToImport); } } // Define members if (_configHash.ContainsKey(ConfigFileConstants.VisibleCmdlets)) { object[] cmdlets = TryGetObjectsOfType<object>(_configHash[ConfigFileConstants.VisibleCmdlets], new Type[] { typeof(string), typeof(Hashtable) }); if (cmdlets == null) { string message = StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeStringOrHashtableArray, ConfigFileConstants.VisibleCmdlets); PSInvalidOperationException ioe = new PSInvalidOperationException(message); ioe.SetErrorId("InvalidVisibleCmdletsKeyEntries"); throw ioe; } ProcessVisibleCommands(iss, cmdlets); } if (_configHash.ContainsKey(ConfigFileConstants.AliasDefinitions)) { Hashtable[] aliases = TryGetHashtableArray(_configHash[ConfigFileConstants.AliasDefinitions]); if (aliases != null) { foreach (Hashtable alias in aliases) { SessionStateAliasEntry entry = CreateSessionStateAliasEntry(alias, aliasVisibilityApplied); if (entry != null) { // Indexing iss.Commands with a command that does not exist returns 'null', rather // than some sort of KeyNotFound exception. if (iss.Commands[entry.Name] != null) { iss.Commands.Remove(entry.Name, typeof(SessionStateAliasEntry)); } iss.Commands.Add(entry); } } } } if (_configHash.ContainsKey(ConfigFileConstants.VisibleAliases)) { string[] aliases = DISCPowerShellConfiguration.TryGetStringArray(_configHash[ConfigFileConstants.VisibleAliases]); if (aliases != null) { foreach (string alias in aliases) { if (!string.IsNullOrEmpty(alias)) { bool found = false; // Look up aliases using alias name including wildcards. Collection<SessionStateCommandEntry> existingEntries = iss.Commands.LookUpByName(alias); foreach (SessionStateCommandEntry existingEntry in existingEntries) { if (existingEntry.CommandType == CommandTypes.Alias) { existingEntry.Visibility = SessionStateEntryVisibility.Public; found = true; } } if (!found || WildcardPattern.ContainsWildcardCharacters(alias)) { iss.UnresolvedCommandsToExpose.Add(alias); } } } } } if (_configHash.ContainsKey(ConfigFileConstants.FunctionDefinitions)) { Hashtable[] functions = TryGetHashtableArray(_configHash[ConfigFileConstants.FunctionDefinitions]); if (functions != null) { foreach (Hashtable function in functions) { SessionStateFunctionEntry entry = CreateSessionStateFunctionEntry(function, functionVisibilityApplied); if (entry != null) { iss.Commands.Add(entry); } } } } if (_configHash.ContainsKey(ConfigFileConstants.VisibleFunctions)) { object[] functions = TryGetObjectsOfType<object>(_configHash[ConfigFileConstants.VisibleFunctions], new Type[] { typeof(string), typeof(Hashtable) }); if (functions == null) { string message = StringUtil.Format(RemotingErrorIdStrings.DISCTypeMustBeStringOrHashtableArray, ConfigFileConstants.VisibleFunctions); PSInvalidOperationException ioe = new PSInvalidOperationException(message); ioe.SetErrorId("InvalidVisibleFunctionsKeyEntries"); throw ioe; } ProcessVisibleCommands(iss, functions); } if (_configHash.ContainsKey(ConfigFileConstants.VariableDefinitions)) { Hashtable[] variables = TryGetHashtableArray(_configHash[ConfigFileConstants.VariableDefinitions]); if (variables != null) { foreach (Hashtable variable in variables) { if (variable.ContainsKey(ConfigFileConstants.VariableValueToken) && variable[ConfigFileConstants.VariableValueToken] is ScriptBlock) { iss.DynamicVariablesToDefine.Add(variable); continue; } SessionStateVariableEntry entry = CreateSessionStateVariableEntry(variable, iss.LanguageMode); if (entry != null) { iss.Variables.Add(entry); } } } } if (_configHash.ContainsKey(ConfigFileConstants.EnvironmentVariables)) { Hashtable[] variablesList = TryGetHashtableArray(_configHash[ConfigFileConstants.EnvironmentVariables]); if (variablesList != null) { foreach (Hashtable variables in variablesList) { foreach (DictionaryEntry variable in variables) { SessionStateVariableEntry entry = new SessionStateVariableEntry(variable.Key.ToString(), variable.Value.ToString(), null); iss.EnvironmentVariables.Add(entry); } } } } // Update type data if (_configHash.ContainsKey(ConfigFileConstants.TypesToProcess)) { string[] types = DISCPowerShellConfiguration.TryGetStringArray(_configHash[ConfigFileConstants.TypesToProcess]); if (types != null) { foreach (string type in types) { if (!string.IsNullOrEmpty(type)) { iss.Types.Add(new SessionStateTypeEntry(type)); } } } } // Update format data if (_configHash.ContainsKey(ConfigFileConstants.FormatsToProcess)) { string[] formats = DISCPowerShellConfiguration.TryGetStringArray(_configHash[ConfigFileConstants.FormatsToProcess]); if (formats != null) { foreach (string format in formats) { if (!string.IsNullOrEmpty(format)) { iss.Formats.Add(new SessionStateFormatEntry(format)); } } } } // Add external commands if (_configHash.ContainsKey(ConfigFileConstants.VisibleExternalCommands)) { string[] externalCommands = TryGetStringArray(_configHash[ConfigFileConstants.VisibleExternalCommands]); if (externalCommands != null) { foreach (string command in externalCommands) { if (command.EndsWith(".ps1", StringComparison.OrdinalIgnoreCase)) { iss.Commands.Add( new SessionStateScriptEntry(command, SessionStateEntryVisibility.Public)); } else { if (command == "*") { iss.Commands.Add( new SessionStateScriptEntry(command, SessionStateEntryVisibility.Public)); } iss.Commands.Add( new SessionStateApplicationEntry(command, SessionStateEntryVisibility.Public)); } } } } // Register startup scripts if (_configHash.ContainsKey(ConfigFileConstants.ScriptsToProcess)) { string[] startupScripts = DISCPowerShellConfiguration.TryGetStringArray(_configHash[ConfigFileConstants.ScriptsToProcess]); if (startupScripts != null) { foreach (string script in startupScripts) { if (!string.IsNullOrEmpty(script)) { iss.StartupScripts.Add(script); } } } } // Now apply visibility logic if (cmdletVisibilityApplied || functionVisibilityApplied || aliasVisibilityApplied || providerVisibilityApplied) { if (sessionType == SessionType.Default) { // autoloading preference is none, so modules cannot be autoloaded. Since the session type is default, // load PowerShell default modules iss.ImportPSCoreModule(InitialSessionState.EngineModules.ToArray()); } if (cmdletVisibilityApplied) { // Import-Module is needed for internal *required modules* processing, so make visibility private. var importModuleEntry = iss.Commands["Import-Module"]; if (importModuleEntry.Count == 1) { importModuleEntry[0].Visibility = SessionStateEntryVisibility.Private; } } if (aliasVisibilityApplied) { // Import-Module is needed for internal *required modules* processing, so make visibility private. var importModuleAliasEntry = iss.Commands["ipmo"]; if (importModuleAliasEntry.Count == 1) { importModuleAliasEntry[0].Visibility = SessionStateEntryVisibility.Private; } } iss.DefaultCommandVisibility = SessionStateEntryVisibility.Private; iss.Variables.Add(new SessionStateVariableEntry(SpecialVariables.PSModuleAutoLoading, PSModuleAutoLoadingPreference.None, string.Empty, ScopedItemOptions.None)); } // Set the execution policy if (_configHash.ContainsKey(ConfigFileConstants.ExecutionPolicy)) { Microsoft.PowerShell.ExecutionPolicy executionPolicy = (Microsoft.PowerShell.ExecutionPolicy)Enum.Parse( typeof(Microsoft.PowerShell.ExecutionPolicy), _configHash[ConfigFileConstants.ExecutionPolicy].ToString(), true); iss.ExecutionPolicy = executionPolicy; } // Set the language mode if (_configHash.ContainsKey(ConfigFileConstants.LanguageMode)) { System.Management.Automation.PSLanguageMode languageMode = (System.Management.Automation.PSLanguageMode)Enum.Parse( typeof(System.Management.Automation.PSLanguageMode), _configHash[ConfigFileConstants.LanguageMode].ToString(), true); iss.LanguageMode = languageMode; } // Set the transcript directory if (_configHash.ContainsKey(ConfigFileConstants.TranscriptDirectory)) { iss.TranscriptDirectory = _configHash[ConfigFileConstants.TranscriptDirectory].ToString(); } // Process User Drive if (_configHash.ContainsKey(ConfigFileConstants.MountUserDrive)) { if (Convert.ToBoolean(_configHash[ConfigFileConstants.MountUserDrive], CultureInfo.InvariantCulture)) { iss.UserDriveEnabled = true; iss.UserDriveUserName = senderInfo?.UserInfo.Identity.Name; // Set user drive max drive if provided. if (_configHash.ContainsKey(ConfigFileConstants.UserDriveMaxSize)) { long userDriveMaxSize = Convert.ToInt64(_configHash[ConfigFileConstants.UserDriveMaxSize]); if (userDriveMaxSize > 0) { iss.UserDriveMaximumSize = userDriveMaxSize; } } // Input parameter validation enforcement is always true when a User drive is created. iss.EnforceInputParameterValidation = true; // Add function definitions for Copy-Item support. ProcessCopyItemFunctionDefinitions(iss); } } return iss; } // Adds Copy-Item remote session helper functions to the ISS. private static void ProcessCopyItemFunctionDefinitions(InitialSessionState iss) { // Copy file to remote helper functions. foreach (var copyToRemoteFn in CopyFileRemoteUtils.GetAllCopyToRemoteScriptFunctions()) { var functionEntry = new SessionStateFunctionEntry( copyToRemoteFn["Name"] as string, copyToRemoteFn["Definition"] as string); iss.Commands.Add(functionEntry); } // Copy file from remote helper functions. foreach (var copyFromRemoteFn in CopyFileRemoteUtils.GetAllCopyFromRemoteScriptFunctions()) { var functionEntry = new SessionStateFunctionEntry( copyFromRemoteFn["Name"] as string, copyFromRemoteFn["Definition"] as string); iss.Commands.Add(functionEntry); } } private static void ProcessVisibleCommands(InitialSessionState iss, object[] commands) { // A dictionary of: function name -> Parameters // Parameters = A dictionary of parameter names -> Modifications // Modifications = A dictionary of modification types (ValidatePattern, ValidateSet) to the interim value // for that attribute, as a HashSet of strings. For ValidateSet, this will be used as a collection of strings // directly during proxy generation. For ValidatePattern, it will be combined into a regex // like: '^(Pattern1|Pattern2|Pattern3)$' during proxy generation. Dictionary<string, Hashtable> commandModifications = new Dictionary<string, Hashtable>(StringComparer.OrdinalIgnoreCase); // Create a hash set of current modules to import so that fully qualified commands can include their // module if needed. HashSet<string> commandModuleNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (var moduleSpec in iss.ModuleSpecificationsToImport) { commandModuleNames.Add(moduleSpec.Name); } foreach (object commandObject in commands) { if (commandObject == null) { continue; } // If it's just a string, this is a visible command string command = commandObject as string; if (!string.IsNullOrEmpty(command)) { ProcessVisibleCommand(iss, command, commandModuleNames); } else { // If it's a hashtable, it represents a customization to a cmdlet. // (I.e.: Exposed parameter with ValidateSet and / or ValidatePattern) // Collect these so that we can post-process them. IDictionary commandModification = commandObject as IDictionary; if (commandModification != null) { ProcessCommandModification(commandModifications, commandModification); } } } // Now, save the commandModifications table for post-processing during runspace creation, // where we have the command info foreach (var pair in commandModifications) { iss.CommandModifications.Add(pair.Key, pair.Value); } } private static void ProcessCommandModification(Dictionary<string, Hashtable> commandModifications, IDictionary commandModification) { string commandName = commandModification["Name"] as string; Hashtable[] parameters = null; if (commandModification.Contains("Parameters")) { parameters = TryGetHashtableArray(commandModification["Parameters"]); if (parameters != null) { // Validate that the parameter restriction has the right keys foreach (Hashtable parameter in parameters) { if (!parameter.ContainsKey("Name")) { parameters = null; break; } } } } // Validate that we got the Name and Parameters keys if ((commandName == null) || (parameters == null)) { string hashtableKey = commandName; if (string.IsNullOrEmpty(hashtableKey)) { IEnumerator errorKey = commandModification.Keys.GetEnumerator(); errorKey.MoveNext(); hashtableKey = errorKey.Current.ToString(); } string message = StringUtil.Format(RemotingErrorIdStrings.DISCCommandModificationSyntax, hashtableKey); PSInvalidOperationException ioe = new PSInvalidOperationException(message); ioe.SetErrorId("InvalidVisibleCommandKeyEntries"); throw ioe; } // Ensure we have the hashtable representing the current command being modified Hashtable parameterModifications; if (!commandModifications.TryGetValue(commandName, out parameterModifications)) { parameterModifications = new Hashtable(StringComparer.OrdinalIgnoreCase); commandModifications[commandName] = parameterModifications; } foreach (IDictionary parameter in parameters) { // Ensure we have the hashtable representing the current parameter being modified string parameterName = parameter["Name"].ToString(); Hashtable currentParameterModification = parameterModifications[parameterName] as Hashtable; if (currentParameterModification == null) { currentParameterModification = new Hashtable(StringComparer.OrdinalIgnoreCase); parameterModifications[parameterName] = currentParameterModification; } foreach (string parameterModification in parameter.Keys) { if (string.Equals("Name", parameterModification, StringComparison.OrdinalIgnoreCase)) { continue; } // Go through the keys, adding them to the current parameter modification if (!currentParameterModification.Contains(parameterModification)) { currentParameterModification[parameterModification] = new HashSet<string>(StringComparer.OrdinalIgnoreCase); } HashSet<string> currentParameterModificationValue = (HashSet<string>)currentParameterModification[parameterModification]; foreach (string parameterModificationValue in TryGetStringArray(parameter[parameterModification])) { if (!string.IsNullOrEmpty(parameterModificationValue)) { currentParameterModificationValue.Add(parameterModificationValue); } } } } } private static void ProcessVisibleCommand(InitialSessionState iss, string command, HashSet<string> moduleNames) { bool found = false; // Defer module restricted command processing to runspace bind time. // Module restricted command names are fully qualified with the module name: // <ModuleName>\<CommandName>, e.g., PSScheduledJob\*JobTrigger* if (command.IndexOf('\\') < 0) { // Look up commands from command name including wildcards. Collection<SessionStateCommandEntry> existingEntries = iss.Commands.LookUpByName(command); foreach (SessionStateCommandEntry existingEntry in existingEntries) { if ((existingEntry.CommandType == CommandTypes.Cmdlet) || (existingEntry.CommandType == CommandTypes.Function)) { existingEntry.Visibility = SessionStateEntryVisibility.Public; found = true; } } } else { // Extract the module name and ensure it is part of the ISS modules to process list. string moduleName; Utils.ParseCommandName(command, out moduleName); if (!string.IsNullOrEmpty(moduleName) && !moduleNames.Contains(moduleName)) { moduleNames.Add(moduleName); iss.ImportPSModule(new string[] { moduleName }); } } if (!found || WildcardPattern.ContainsWildcardCharacters(command)) { iss.UnresolvedCommandsToExpose.Add(command); } } /// <summary> /// Creates an alias entry. /// </summary> private static SessionStateAliasEntry CreateSessionStateAliasEntry(Hashtable alias, bool isAliasVisibilityDefined) { string name = TryGetValue(alias, ConfigFileConstants.AliasNameToken); if (string.IsNullOrEmpty(name)) { return null; } string value = TryGetValue(alias, ConfigFileConstants.AliasValueToken); if (string.IsNullOrEmpty(value)) { return null; } string description = TryGetValue(alias, ConfigFileConstants.AliasDescriptionToken); ScopedItemOptions options = ScopedItemOptions.None; string optionsString = TryGetValue(alias, ConfigFileConstants.AliasOptionsToken); if (!string.IsNullOrEmpty(optionsString)) { options = (ScopedItemOptions)Enum.Parse(typeof(ScopedItemOptions), optionsString, true); } SessionStateEntryVisibility visibility = SessionStateEntryVisibility.Private; if (!isAliasVisibilityDefined) { visibility = SessionStateEntryVisibility.Public; } return new SessionStateAliasEntry(name, value, description, options, visibility); } /// <summary> /// Creates a function entry. /// </summary> /// <returns></returns> private static SessionStateFunctionEntry CreateSessionStateFunctionEntry(Hashtable function, bool isFunctionVisibilityDefined) { string name = TryGetValue(function, ConfigFileConstants.FunctionNameToken); if (string.IsNullOrEmpty(name)) { return null; } string value = TryGetValue(function, ConfigFileConstants.FunctionValueToken); if (string.IsNullOrEmpty(value)) { return null; } ScopedItemOptions options = ScopedItemOptions.None; string optionsString = TryGetValue(function, ConfigFileConstants.FunctionOptionsToken); if (!string.IsNullOrEmpty(optionsString)) { options = (ScopedItemOptions)Enum.Parse(typeof(ScopedItemOptions), optionsString, true); } ScriptBlock newFunction = ScriptBlock.Create(value); newFunction.LanguageMode = PSLanguageMode.FullLanguage; SessionStateEntryVisibility functionVisibility = SessionStateEntryVisibility.Private; if (!isFunctionVisibilityDefined) { functionVisibility = SessionStateEntryVisibility.Public; } return new SessionStateFunctionEntry(name, value, options, functionVisibility, newFunction, null); } /// <summary> /// Creates a variable entry. /// </summary> private static SessionStateVariableEntry CreateSessionStateVariableEntry(Hashtable variable, PSLanguageMode languageMode) { string name = TryGetValue(variable, ConfigFileConstants.VariableNameToken); if (string.IsNullOrEmpty(name)) { return null; } string value = TryGetValue(variable, ConfigFileConstants.VariableValueToken); if (string.IsNullOrEmpty(value)) { return null; } string description = TryGetValue(variable, ConfigFileConstants.AliasDescriptionToken); ScopedItemOptions options = ScopedItemOptions.None; string optionsString = TryGetValue(variable, ConfigFileConstants.AliasOptionsToken); if (!string.IsNullOrEmpty(optionsString)) { options = (ScopedItemOptions)Enum.Parse(typeof(ScopedItemOptions), optionsString, true); } SessionStateEntryVisibility visibility = SessionStateEntryVisibility.Private; if (languageMode == PSLanguageMode.FullLanguage) { visibility = SessionStateEntryVisibility.Public; } return new SessionStateVariableEntry(name, value, description, options, new Collections.ObjectModel.Collection<Attribute>(), visibility); } /// <summary> /// Applies the command (cmdlet/function/alias) visibility settings to the <paramref name="iss"/> /// </summary> /// <param name="configFileKey"></param> /// <returns></returns> private bool IsNonDefaultVisibilitySpecified(string configFileKey) { if (_configHash.ContainsKey(configFileKey)) { string[] commands = DISCPowerShellConfiguration.TryGetStringArray(_configHash[configFileKey]); if ((commands == null) || (commands.Length == 0)) { return false; } return true; } return false; } /// <summary> /// Attempts to get a value from a hashtable. /// </summary> /// <param name="table"></param> /// <param name="key"></param> /// <returns></returns> internal static string TryGetValue(Hashtable table, string key) { if (table.ContainsKey(key)) { return table[key].ToString(); } return string.Empty; } /// <summary> /// Attempts to get a hashtable array from an object. /// </summary> /// <param name="hashObj"></param> /// <returns></returns> internal static Hashtable[] TryGetHashtableArray(object hashObj) { // Scalar case Hashtable hashtable = hashObj as Hashtable; if (hashtable != null) { return new[] { hashtable }; } // 1. Direct conversion Hashtable[] hashArray = hashObj as Hashtable[]; if (hashArray == null) { // 2. Convert from object array object[] objArray = hashObj as object[]; if (objArray != null) { hashArray = new Hashtable[objArray.Length]; for (int i = 0; i < hashArray.Length; i++) { if (!(objArray[i] is Hashtable hash)) { return null; } hashArray[i] = hash; } } } return hashArray; } /// <summary> /// Attempts to get a string array from a hashtable. /// </summary> /// <param name="hashObj"></param> /// <returns></returns> internal static string[] TryGetStringArray(object hashObj) { object[] objs = hashObj as object[]; if (objs == null) { // Scalar case object obj = hashObj as object; if (obj != null) { return new string[] { obj.ToString() }; } else { return null; } } string[] result = new string[objs.Length]; for (int i = 0; i < objs.Length; i++) { result[i] = objs[i].ToString(); } return result; } internal static T[] TryGetObjectsOfType<T>(object hashObj, IEnumerable<Type> types) where T : class { object[] objs = hashObj as object[]; if (objs == null) { // Scalar case object obj = hashObj; if (obj != null) { foreach (Type type in types) { if (obj.GetType().Equals(type)) { return new T[] { obj as T }; } } } return null; } T[] result = new T[objs.Length]; for (int i = 0; i < objs.Length; i++) { int i1 = i; if (types.Any(type => objs[i1].GetType().Equals(type))) { result[i] = objs[i] as T; } else { return null; } } return result; } } #endregion #region DISCFileValidation internal static class DISCFileValidation { // Set of supported configuration options for a PowerShell InitialSessionState. #if UNIX private static readonly HashSet<string> SupportedConfigOptions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "AliasDefinitions", "AssembliesToLoad", "Author", "CompanyName", "Description", "EnvironmentVariables", "FormatsToProcess", "FunctionDefinitions", "GUID", "LanguageMode", "ModulesToImport", "MountUserDrive", "SchemaVersion", "ScriptsToProcess", "SessionType", "TranscriptDirectory", "TypesToProcess", "UserDriveMaximumSize", "VisibleAliases", "VisibleCmdlets", "VariableDefinitions", "VisibleExternalCommands", "VisibleFunctions", "VisibleProviders" }; #else private static readonly HashSet<string> SupportedConfigOptions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "AliasDefinitions", "AssembliesToLoad", "Author", "CompanyName", "Description", "EnvironmentVariables", "ExecutionPolicy", "FormatsToProcess", "FunctionDefinitions", "GUID", "LanguageMode", "ModulesToImport", "MountUserDrive", "SchemaVersion", "ScriptsToProcess", "SessionType", "TranscriptDirectory", "TypesToProcess", "UserDriveMaximumSize", "VisibleAliases", "VisibleCmdlets", "VariableDefinitions", "VisibleExternalCommands", "VisibleFunctions", "VisibleProviders" }; #endif // These are configuration options for WSMan (WinRM) endpoint configurations, that // appear in .pssc files, but are not part of PowerShell InitialSessionState. private static readonly HashSet<string> UnsupportedConfigOptions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "GroupManagedServiceAccount", "PowerShellVersion", "RequiredGroups", "RoleDefinitions", "RunAsVirtualAccount", "RunAsVirtualAccountGroups" }; internal static void ValidateContents(Hashtable configHash) { foreach (var key in configHash.Keys) { if (key is not string keyName) { throw new PSInvalidOperationException(RemotingErrorIdStrings.DISCInvalidConfigKeyType); } if (UnsupportedConfigOptions.Contains(keyName)) { throw new PSInvalidOperationException( StringUtil.Format(RemotingErrorIdStrings.DISCUnsupportedConfigName, keyName)); } if (!SupportedConfigOptions.Contains(keyName)) { throw new PSInvalidOperationException( StringUtil.Format(RemotingErrorIdStrings.DISCUnknownConfigName, keyName)); } } } } #endregion #endregion } ```
```scss @use "sass:math"; // COMPONENT API: GRID // Used specific path here since, pro loads the grid and 'current path' will be wrong. @import "../../../../../assets/dev/scss/editor/_breakpoints.scss"; // MIXIN: Grid Coll generator $eps-grid-columns: 12; $eps-grid-spacing-keys: (5 8 10 12 16); $grid-spacing-gutter: calc( var(--grid-spacing-gutter) * calc(#{spacing(10)} / 10) ); //defining flex traits @mixin grid-item-auto($size) { .#{$eps-prefix}grid-item-#{$size} { flex-grow: 1; max-width: 100%; flex-basis: 0; } } // defining cols. @mixin grid-col-generator($size, $grid-columns: $eps-grid-columns) { @for $i from 1 through $grid-columns { .#{$eps-prefix}grid-item-#{$size}-#{$i} { flex-grow: 0; max-width: calc( #{$i} / #{$grid-columns} * 100% ); flex-basis: calc( #{$i} / #{$grid-columns} * 100% ); } } } // generating spacing classes and custom properties @mixin grid-spacing-classes($keys, $amp:'&') { @each $key in $keys { #{$amp}-#{$key} { --grid-spacing-gutter: #{spacing($key)}; } } } // exporting custom properties @mixin grid-custom-properties { :root { --grid-spacing-width: calc(100% + var(#{--grid-container-gutters})); --grid-spacing-gutters: calc(2 * var(#{--grid-spacing-gutter})); } } ```
```javascript /** * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format * @oncall draft_js */ 'use strict'; import type {BlockMap} from 'BlockMap'; import type ContentState from 'ContentState'; const BlockMapBuilder = require('BlockMapBuilder'); const ContentBlock = require('ContentBlock'); const ContentBlockNode = require('ContentBlockNode'); const SelectionState = require('SelectionState'); const getSampleStateForTesting = require('getSampleStateForTesting'); const Immutable = require('immutable'); const insertFragmentIntoContentState = require('insertFragmentIntoContentState'); const invariant = require('invariant'); jest.mock('generateRandomKey'); const {contentState, selectionState} = getSampleStateForTesting(); const {List, Map} = Immutable; const DEFAULT_BLOCK_CONFIG = { key: 'j', type: 'unstyled', text: 'xx', data: Map({a: 1}), }; const initialBlock = contentState.getBlockMap().first(); const getInvariantViolation = (msg: string) => { try { /* eslint-disable-next-line */ invariant(false, msg); } catch (e) { return e; } }; const createFragment = ( /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's * LTI update could not be added via codemod */ fragment = {}, experimentalTreeDataSupport: boolean = false, ) => { const ContentBlockNodeRecord = experimentalTreeDataSupport ? ContentBlockNode : ContentBlock; const newFragment = Array.isArray(fragment) ? fragment : [fragment]; return BlockMapBuilder.createFromArray( newFragment.map( config => new ContentBlockNodeRecord({ ...DEFAULT_BLOCK_CONFIG, ...config, }), ), ); }; /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's * LTI update could not be added via codemod */ const createContentBlockNodeFragment = fragment => { return createFragment(fragment, true); }; const assertInsertFragmentIntoContentState = ( fragment: BlockMap, selection: $FlowFixMe | SelectionState = selectionState, content: ContentState = contentState, ) => { expect( insertFragmentIntoContentState(content, selection, fragment) .getBlockMap() .toIndexedSeq() .toJS(), ).toMatchSnapshot(); }; test('must throw if no fragment is provided', () => { const fragment = BlockMapBuilder.createFromArray([]); expect(() => { insertFragmentIntoContentState(contentState, selectionState, fragment); }).toThrow(); }); test('must apply fragment to the start', () => { assertInsertFragmentIntoContentState(createFragment()); }); test('must apply fragment to within block', () => { assertInsertFragmentIntoContentState( createFragment(), selectionState.merge({ focusOffset: 2, anchorOffset: 2, isBackward: false, }), ); }); test('must apply fragment at the end', () => { assertInsertFragmentIntoContentState( createFragment(), selectionState.merge({ focusOffset: initialBlock.getLength(), anchorOffset: initialBlock.getLength(), isBackward: false, }), ); }); test('must apply multiblock fragments', () => { assertInsertFragmentIntoContentState( createFragment([ DEFAULT_BLOCK_CONFIG, { key: 'k', text: 'yy', data: Map({b: 2}), }, ]), ); }); test('must be able to insert a fragment with a single ContentBlockNode', () => { const initialSelection = SelectionState.createEmpty('A'); const initialContent = contentState.setBlockMap( createContentBlockNodeFragment([ { key: 'A', text: '', }, ]), ); assertInsertFragmentIntoContentState( createContentBlockNodeFragment([ { key: 'B', text: 'some text', }, ]), initialSelection, initialContent, ); }); test('must be able to insert fragment of ContentBlockNodes', () => { const initialSelection = SelectionState.createEmpty('first'); const initialContent = contentState.setBlockMap( createContentBlockNodeFragment([ { key: 'first', text: '', nextSibling: 'second', }, { key: 'second', text: '', prevSibling: 'first', }, ]), ); assertInsertFragmentIntoContentState( createContentBlockNodeFragment([ { key: 'B', text: '', children: List(['C']), nextSibling: 'E', }, { key: 'C', parent: 'B', text: '', children: List(['D']), }, { key: 'D', parent: 'C', text: 'Delta', }, { key: 'E', text: 'Elephant', prevSibling: 'B', }, ]), initialSelection, initialContent, ); }); test('must be able to insert fragment of ContentBlockNodes after nested block', () => { const initialSelection = SelectionState.createEmpty('firstChild'); const initialContent = contentState.setBlockMap( createContentBlockNodeFragment([ { key: 'root', text: '', children: List(['firstChild', 'lastChild']), }, { key: 'firstChild', parent: 'root', text: '', nextSibling: 'lastChild', }, { key: 'lastChild', parent: 'root', text: '', prevSibling: 'firstChild', }, ]), ); assertInsertFragmentIntoContentState( createContentBlockNodeFragment([ { key: 'B', text: '', children: List(['C']), nextSibling: 'E', }, { key: 'C', parent: 'B', text: '', children: List(['D']), }, { key: 'D', parent: 'C', text: 'Delta', }, { key: 'E', text: 'Elephant', prevSibling: 'B', }, ]), initialSelection, initialContent, ); }); test('must be able to insert a fragment of ContentBlockNodes while updating the target block with the first fragment block properties', () => { const initialSelection = SelectionState.createEmpty('first'); const initialContent = contentState.setBlockMap( createContentBlockNodeFragment([ { key: 'first', text: '', nextSibling: 'second', }, { key: 'second', text: '', prevSibling: 'first', }, ]), ); assertInsertFragmentIntoContentState( createContentBlockNodeFragment([ { key: 'A', text: 'Alpha', nextSibling: 'B', }, { key: 'B', text: '', children: List(['C']), prevSibling: 'A', }, { key: 'C', parent: 'B', text: '', children: List(['D']), }, { key: 'D', parent: 'C', text: 'Delta', }, ]), initialSelection, initialContent, ); }); test('must be able to insert a fragment of ContentBlockNodes while updating the target block with the first fragment block properties after nested block', () => { const initialSelection = SelectionState.createEmpty('firstChild'); const initialContent = contentState.setBlockMap( createContentBlockNodeFragment([ { key: 'root', text: '', children: List(['firstChild', 'lastChild']), }, { key: 'firstChild', parent: 'root', text: '', nextSibling: 'lastChild', }, { key: 'lastChild', parent: 'root', text: '', prevSibling: 'firstChild', }, ]), ); assertInsertFragmentIntoContentState( createContentBlockNodeFragment([ { key: 'A', text: 'Alpha', nextSibling: 'B', }, { key: 'B', text: '', children: List(['C']), prevSibling: 'A', nextSibling: 'E', }, { key: 'C', parent: 'B', text: '', children: List(['D']), }, { key: 'D', parent: 'C', text: 'Delta', }, { key: 'E', text: 'Elephant', prevSibling: 'B', }, ]), initialSelection, initialContent, ); }); test('must throw an error when trying to apply ContentBlockNode fragments when selection is on a block that has children', () => { const initialSelection = SelectionState.createEmpty('A'); const initialContent = contentState.setBlockMap( createContentBlockNodeFragment([ { key: 'A', text: '', children: List(['B']), }, { key: 'B', text: 'child', parent: 'A', }, ]), ); expect(() => insertFragmentIntoContentState( initialContent, initialSelection, createContentBlockNodeFragment([ { key: 'C', text: 'some text', }, ]), ), ).toThrow( getInvariantViolation( '`insertFragment` should not be called when a container node is selected.', ), ); }); ```
```go package client import ( "bytes" "encoding/json" "io/ioutil" "net/http" "net/url" "github.com/docker/docker/api/types" "golang.org/x/net/context" ) // NetworkInspect returns the information for a specific network configured in the docker host. func (cli *Client) NetworkInspect(ctx context.Context, networkID string, verbose bool) (types.NetworkResource, error) { networkResource, _, err := cli.NetworkInspectWithRaw(ctx, networkID, verbose) return networkResource, err } // NetworkInspectWithRaw returns the information for a specific network configured in the docker host and its raw representation. func (cli *Client) NetworkInspectWithRaw(ctx context.Context, networkID string, verbose bool) (types.NetworkResource, []byte, error) { var ( networkResource types.NetworkResource resp serverResponse err error ) query := url.Values{} if verbose { query.Set("verbose", "true") } resp, err = cli.get(ctx, "/networks/"+networkID, query, nil) if err != nil { if resp.statusCode == http.StatusNotFound { return networkResource, nil, networkNotFoundError{networkID} } return networkResource, nil, err } defer ensureReaderClosed(resp) body, err := ioutil.ReadAll(resp.body) if err != nil { return networkResource, nil, err } rdr := bytes.NewReader(body) err = json.NewDecoder(rdr).Decode(&networkResource) return networkResource, body, err } ```
The 2015–16 season was Coventry City's 132nd season in their history and fourth consecutive season in League One. Along with competing in League One, the club also participated in the FA Cup, the League Cup and the Football League Trophy. The season covered the period from 1 July 2015 to 30 June 2016. Review and events July 8 players were released on 1 July 2015 with Al Bangura, Adam Barton, Frank Nouble, Shaun Miller, Simeon Jackson, Andy Webster, Danny Pugh and Blair Turgott all leaving the club. Five players from the academy signed professional contracts on 1 July 2015 as Cian Harries, Devon Kelly-Evans, Dion Kelly-Evans, Ben Stevenson and George Thomas all signing contracts alongside Chris Stokes, who signed a one-year contract on a free transfer from Forest Green Rovers. On 6 July 2015, Sam Ricketts joined Coventry City on a free transfer signing a one-year deal with the club. Romain Vincelot signed for the Sky Blues on 8 July 2015. On the same date, Coventry City owners Sisu earned the right to appeal against a Court's decision, which ruled that Coventry City Council's £14.4million loan to the Ricoh Arena operators ACL in 2012 was not state aid with the two-day appeal hearing taking place in February 2016. Réda Johnson extended his time at Coventry City on 10 July 2015, signing a new one-year deal. On 24 July 2015, Rúben Lameiras signed a contract at the club after a successful trial. Adam Armstrong signed a 6-month loan deal from Newcastle United on 28 July 2015. On 31 July 2015, the club announced that assistant manager Neil MacFarlane left the club by mutual agreement. August On 1 August 2015, Coventry City ended their pre-season campaign with a 0–0 draw against Oxford United. They played a total of five games, failing to win a single game after three draws and two losses. A Coventry City XI side also drew 0–0 with Leamington during pre-season. Sam Ricketts was named as captain for the season on 3 August 2015. Bryn Morris was signed on season-long youth loan deal from Middlesbrough on 6 August 2015. Norwich City's Jacob Murphy was signed on loan on 15 August 2015 in a deal which will last till the end of the season. On 18 August, Ivor Lawton was loaned out to Nuneaton Town for one month. The club finished the month in fifth place after winning their first three league games but were defeated by Walsall 2–1 and drew at home to Southend United. Coventry were also knocked out the League Cup when they lost on penalties to Rochdale away from home in the first round. Adam Armstrong was awarded with League One's Player of the month award for August. September Transfer deadline day saw Danny Swanson and Kyle Spence leave the club with just one player coming the other way as Lateef Elford-Alliyu signed a four-month contract with the Sky Blues. Marc-Antoine Fortuné signed for Coventry City on a free transfer, signing on 4 September. Ryan Kent became Coventry's fourth loan signing of the season on 10 September, arriving from Liverpool. Adam Jackson signed on loan for the club on 14 September from Middlesbrough. The Sky Blues finished the month in fourth place after two wins and two defeats, beating Burton Albion and Chesterfield but losing to Scunthorpe United and Bury. October Former England-International midfielder Joe Cole was signed by Tony Mowbray on 16 October, signing for 35 days with the club. George Thomas was loaned out to Yeovil Town on 24 October until 21 November. On 24 October, Reice Charles-Cook broke a post-war club record as he went 578 minutes without conceding a goal overtaking Steve Ogrizovic's 572 minutes without conceding. Coventry City were in fourth place by the end of the month without losing a game in the league winning three of the six fixtures. However, they were knocked out the Football League Trophy in the second round by League Two side Yeovil Town on penalties after drawing the game 0–0. November Steve Waggott left his position at the club as chief executive on 5 November. This was followed by the appointment of Chris Anderson as executive vice-chairman and managing director on the next day. Ryan Kent was temporarily recalled back to Liverpool after a change in managers saw Jürgen Klopp take charge and on 18 November, Klopp revealed he was happy for Kent to resume his loan spell after believing he was at the right place. A further two loan signings was made with Newcastle United midfielder Gaël Bigirimana and Cardiff City defender Ben Turner returning to the club until 3 January 2016 after signing on 16 November and 18 November. It was announced on 19 November that Joe Cole will be staying at the Ricoh Arena until 3 January after a loan extension. Yeovil Town extended their loan deal for George Thomas, meaning he will remain at the club till January. On 22 November, Jacob Murphy became only the second-ever player to score a hat-tick at the Ricoh Arena. Coventry had another undefeated month in the league meaning the Sky Blues were unbeaten in their last eleven matches, the best run at the club since 1967. This meant that the club ended the month in first place with three wins and two draws in November. However, Coventry City were defeated when they were knocked out the FA Cup in the first round after a home defeat to Northampton Town on 7 November. Competitions Preseason friendlies On 7 May 2015, Coventry City announced their first pre-season friendly away to Luton Town on 25 July 2015. On 18 May 2015, Coventry City announced a pre-season friendly against Oxford United on 1 August 2015. On 21 May 2015, Coventry City announced their third pre-season friendly against Cambridge United. On 1 June 2015, a friendly against Nuneaton Town was confirmed for 11 July 2015. On 3 July 2015, it was revealed that Coventry City's fixture against Oxford United will be played at Liberty Way as Oxford United want to make sure that their pitch is at the highest quality for the start of the season. A fixture against Portsmouth was announced on 11 July 2015, which will take place at Havant and Waterlooville's West Leigh Park. On 22 July 2015, the Sky Blues announced a XI side will face Leamington on 29 July 2015. League One On 17 June 2015, the fixtures for the forthcoming season were announced. League table Results summary Results by matchday Fixtures FA Cup Coventry City will begin their FA Cup campaign in the first round with ties being played on 6 November 2015 to 9 November 2015. League Cup On 16 June 2015, the first round draw was made, Coventry City were drawn away against Rochdale. On 11 August 2015, the fixture was played at Spotland with Coventry City exiting the competition on penalties. Football League Trophy Coventry City will play in Southern Section of the competition. Their first match of the Football League Trophy will be during the week commencing 5 October after receiving a bye, which means they automatically qualify for the second round, where they will play away at Yeovil Town. Birmingham Senior Cup On the Birmingham FA website the first round details of the Birmingham Senior Cup were announced, with Coventry City to face Stratford Town. Squad information Squad details * Player age and appearances/goals for the club as of beginning of 2015–16 season. Appearances Correct as of match played on 8 May 2016 Goalscorers Correct as of match played on 8 May 2016 Assists Correct as of match played on 8 May 2016 Yellow cards Correct as of match played on 8 May 2016 Red cards Correct as of match played on 8 May 2016 Captains Correct as of match played on 8 May 2016 Penalties awarded Suspensions served Hat-tricks Monthly & weekly awards End-of-season awards Transfers Transfers in Transfers out Loans in Loans out Trials References External links Official Site: 2015–16 BBC Sport – Club Stats Soccerbase – Results | Squad Stats | Transfers Coventry City Coventry City F.C. seasons
Tarnation is used to express exasperation, frustration, or incredulity. Examples of the word being used: "Tarnation! If he had been elected we'd never have come to this!" It can also be used as "In Tarnation". Example Here: "what in tarnation is going on over here?" Tarnation originally came from the word "damnation", but was changed in the late 1800s to "tarnation" References to the word "Tarnation" Minced oath, form of Damnation, everlasting punishment Tarnation (band), a San Francisco-based alt-country-goth band Tarnation (2003 film), a 2003 documentary film by Jonathan Caouette Tarnation (2017 film), a 2017 Australian horror film by Daniel Armstrong
```python #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This program is free software: you can redistribute it and/or modify (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the along with this program. If not, see <path_to_url """ import gi import GUI.Settings.settings as settings from GUI.Settings.hotkeys import Hotkeys # This fixes GTK version mismatch issues and crashes on gnome # See #153 and #159 for more information # This line can be deleted when GTK 4.0 properly runs on all supported systems gi.require_version("Gtk", "3.0") from tr.tr import TranslationConstants as tr from tr.tr import language_list, get_locale from PyQt6.QtGui import ( QIcon, QMovie, QPixmap, QCursor, QKeySequence, QColor, QContextMenuEvent, QBrush, QTextCursor, QShortcut, QColorConstants, QStandardItemModel, QStandardItem, QCloseEvent, QKeyEvent, QMouseEvent, ) from PyQt6.QtWidgets import ( QApplication, QMainWindow, QTableWidgetItem, QMessageBox, QDialog, QWidget, QTabWidget, QMenu, QFileDialog, QAbstractItemView, QTreeWidgetItem, QTreeWidgetItemIterator, QCompleter, QLabel, QLineEdit, QComboBox, QDialogButtonBox, QCheckBox, QHBoxLayout, QPushButton, ) from PyQt6.QtCore import ( Qt, QThread, pyqtSignal, QSize, QByteArray, QSettings, QEvent, QKeyCombination, QTranslator, QItemSelectionModel, QTimer, QStringListModel, QRunnable, QObject, QThreadPool, QLocale, QSignalBlocker, QItemSelection, ) from time import sleep, time import os, sys, traceback, signal, re, copy, io, queue, collections, ast, json, select from libpince import utils, debugcore, typedefs from libpince.libscanmem.scanmem import Scanmem from libpince.libptrscan.ptrscan import PointerScan, FFIRange, FFIParam from GUI.Settings.themes import get_theme from GUI.Settings.themes import theme_list from GUI.Utils import guiutils from GUI.MainWindow import Ui_MainWindow as MainWindow from GUI.SelectProcess import Ui_MainWindow as ProcessWindow from GUI.AddAddressManuallyDialog import Ui_Dialog as ManualAddressDialog from GUI.EditTypeDialog import Ui_Dialog as EditTypeDialog from GUI.TrackSelectorDialog import Ui_Dialog as TrackSelectorDialog from GUI.LoadingDialog import Ui_Dialog as LoadingDialog from GUI.InputDialog import Ui_Dialog as InputDialog from GUI.TextEditDialog import Ui_Dialog as TextEditDialog from GUI.SettingsDialog import Ui_Dialog as SettingsDialog from GUI.HandleSignalsDialog import Ui_Dialog as HandleSignalsDialog from GUI.ConsoleWidget import Ui_Form as ConsoleWidget from GUI.AboutWidget import Ui_TabWidget as AboutWidget # If you are going to change the name "Ui_MainWindow_MemoryView", review GUI/Labels/RegisterLabel.py as well from GUI.MemoryViewerWindow import Ui_MainWindow_MemoryView as MemoryViewWindow from GUI.BookmarkWidget import Ui_Form as BookmarkWidget from GUI.FloatRegisterWidget import Ui_TabWidget as FloatRegisterWidget from GUI.StackTraceInfoWidget import Ui_Form as StackTraceInfoWidget from GUI.BreakpointInfoWidget import Ui_TabWidget as BreakpointInfoWidget from GUI.TrackWatchpointWidget import Ui_Form as TrackWatchpointWidget from GUI.TrackBreakpointWidget import Ui_Form as TrackBreakpointWidget from GUI.TraceInstructionsPromptDialog import Ui_Dialog as TraceInstructionsPromptDialog from GUI.TraceInstructionsWaitWidget import Ui_Form as TraceInstructionsWaitWidget from GUI.TraceInstructionsWindow import Ui_MainWindow as TraceInstructionsWindow from GUI.FunctionsInfoWidget import Ui_Form as FunctionsInfoWidget from GUI.HexEditDialog import Ui_Dialog as HexEditDialog from GUI.EditInstructionDialog import Ui_Dialog as EditInstructionDialog from GUI.LogFileWidget import Ui_Form as LogFileWidget from GUI.SearchOpcodeWidget import Ui_Form as SearchOpcodeWidget from GUI.MemoryRegionsWidget import Ui_Form as MemoryRegionsWidget from GUI.DissectCodeDialog import Ui_Dialog as DissectCodeDialog from GUI.ReferencedStringsWidget import Ui_Form as ReferencedStringsWidget from GUI.ReferencedCallsWidget import Ui_Form as ReferencedCallsWidget from GUI.ExamineReferrersWidget import Ui_Form as ExamineReferrersWidget from GUI.RestoreInstructionsWidget import Ui_Form as RestoreInstructionsWidget from GUI.PointerScanSearchDialog import Ui_Dialog as PointerScanSearchDialog from GUI.PointerScanFilterDialog import Ui_Dialog as PointerScanFilterDialog from GUI.PointerScanWindow import Ui_MainWindow as PointerScanWindow from GUI.ScanRegionsDialog import Ui_Dialog as ScanRegionsDialog from GUI.AbstractTableModels.HexModel import QHexModel from GUI.AbstractTableModels.AsciiModel import QAsciiModel from GUI.Validators.HexValidator import QHexValidator from GUI.ManualAddressDialogUtils.PointerChainOffset import PointerChainOffset from keyboard import KeyboardEvent, _pressed_events from keyboard._nixkeyboard import to_name if __name__ == "__main__": app = QApplication([]) app.setOrganizationName("PINCE") app.setOrganizationDomain("github.com/korcankaraokcu/PINCE") app.setApplicationName("PINCE") QSettings.setPath( QSettings.Format.NativeFormat, QSettings.Scope.UserScope, utils.get_user_path(typedefs.USER_PATHS.CONFIG) ) settings_instance = QSettings() translator = QTranslator() try: locale = settings_instance.value("General/locale", type=str) except SystemError: # We're reading the settings for the first time here # If there's an error due to python objects, clear settings settings_instance.clear() locale = None if not locale: locale = get_locale() locale_file = utils.get_script_directory() + f"/i18n/qm/{locale}.qm" translator.load(locale_file) app.installTranslator(translator) tr.translate() hotkeys = Hotkeys() # Create the instance after translations to ensure hotkeys are translated # represents the index of columns in instructions restore table INSTR_ADDR_COL = 0 INSTR_AOB_COL = 1 INSTR_NAME_COL = 2 # represents the index of columns in breakpoint table BREAK_NUM_COL = 0 BREAK_TYPE_COL = 1 BREAK_DISP_COL = 2 BREAK_ENABLED_COL = 3 BREAK_ADDR_COL = 4 BREAK_SIZE_COL = 5 BREAK_ON_HIT_COL = 6 BREAK_HIT_COUNT_COL = 7 BREAK_COND_COL = 8 # row colors for disassemble qtablewidget PC_COLOR = QColorConstants.Blue BOOKMARK_COLOR = QColorConstants.Cyan BREAKPOINT_COLOR = QColorConstants.Red REF_COLOR = QColorConstants.LightGray # represents the index of columns in address table FROZEN_COL = 0 # Frozen DESC_COL = 1 # Description ADDR_COL = 2 # Address TYPE_COL = 3 # Type VALUE_COL = 4 # Value # represents the index of columns in search results table SEARCH_TABLE_ADDRESS_COL = 0 SEARCH_TABLE_VALUE_COL = 1 SEARCH_TABLE_PREVIOUS_COL = 2 # represents the index of columns in disassemble table DISAS_ADDR_COL = 0 DISAS_BYTES_COL = 1 DISAS_OPCODES_COL = 2 DISAS_COMMENT_COL = 3 # represents the index of columns in floating point table FLOAT_REGISTERS_NAME_COL = 0 FLOAT_REGISTERS_VALUE_COL = 1 # represents the index of columns in stacktrace table STACKTRACE_RETURN_ADDRESS_COL = 0 STACKTRACE_FRAME_ADDRESS_COL = 1 # represents the index of columns in stack table STACK_POINTER_ADDRESS_COL = 0 STACK_VALUE_COL = 1 STACK_POINTS_TO_COL = 2 # represents row and column counts of Hex table HEX_VIEW_COL_COUNT = 16 HEX_VIEW_ROW_COUNT = 42 # J-JUST A COINCIDENCE, I SWEAR! # represents the index of columns in track watchpoint table(what accesses this address thingy) TRACK_WATCHPOINT_COUNT_COL = 0 TRACK_WATCHPOINT_ADDR_COL = 1 # represents the index of columns in track breakpoint table(which addresses this instruction accesses thingy) TRACK_BREAKPOINT_COUNT_COL = 0 TRACK_BREAKPOINT_ADDR_COL = 1 TRACK_BREAKPOINT_VALUE_COL = 2 TRACK_BREAKPOINT_SOURCE_COL = 3 # represents the index of columns in function info table FUNCTIONS_INFO_ADDR_COL = 0 FUNCTIONS_INFO_SYMBOL_COL = 1 # represents the index of columns in libpince reference resources table LIBPINCE_REFERENCE_ITEM_COL = 0 LIBPINCE_REFERENCE_VALUE_COL = 1 # represents the index of columns in search opcode table SEARCH_OPCODE_ADDR_COL = 0 SEARCH_OPCODE_OPCODES_COL = 1 # represents the index of columns in memory regions table MEMORY_REGIONS_ADDR_COL = 0 MEMORY_REGIONS_PERM_COL = 1 MEMORY_REGIONS_OFFSET_COL = 2 MEMORY_REGIONS_PATH_COL = 3 # represents the index of columns in dissect code table DISSECT_CODE_ADDR_COL = 0 DISSECT_CODE_PATH_COL = 1 # represents the index of columns in referenced strings table REF_STR_ADDR_COL = 0 REF_STR_COUNT_COL = 1 REF_STR_VAL_COL = 2 # represents the index of columns in referenced calls table REF_CALL_ADDR_COL = 0 REF_CALL_COUNT_COL = 1 # GDB expression cache # TODO: Try to find a fast and non-gdb way to calculate symbols so we don't need this # This is one of the few tricks we do to minimize examine_expression calls # This solution might bring problems if the symbols are changing frequently # Pressing the refresh button in the address table or attaching to a new process will clear this cache # Currently only used in address_table_loop exp_cache = {} # vars for communication with the non blocking threads exiting = 0 scanmem = Scanmem(os.path.join(utils.get_libpince_directory(), "libscanmem", "libscanmem.so")) ptrscan = PointerScan(os.path.join(utils.get_libpince_directory(), "libptrscan", "libptrscan.so")) ptrscan.set_pointer_offset_symbol("->") threadpool = QThreadPool() # Placeholder number, may have to be changed in the future threadpool.setMaxThreadCount(10) class ProcessSignals(QObject): attach = pyqtSignal() exit = pyqtSignal() process_signals = ProcessSignals() class WorkerSignals(QObject): finished = pyqtSignal() class Worker(QRunnable): def __init__(self, fn, *args, **kwargs): super().__init__() self.fn = fn self.args = args self.kwargs = kwargs self.signals = WorkerSignals() def run(self): self.fn(*self.args, **self.kwargs) self.signals.finished.emit() class InterruptableWorker(QThread): def __init__(self, fn, *args, **kwargs): super().__init__() self.fn = fn self.args = args self.kwargs = kwargs self.signals = WorkerSignals() def run(self): self.fn(*self.args, **self.kwargs) self.signals.finished.emit() def stop(self): self.terminate() def except_hook(exception_type, value, tb): focused_widget = app.focusWidget() if focused_widget and exception_type == typedefs.GDBInitializeException: QMessageBox.information(focused_widget, tr.ERROR, tr.GDB_INIT) traceback.print_exception(exception_type, value, tb) # From version 5.5 and onwards, PyQT calls qFatal() when an exception has been encountered # So, we must override sys.excepthook to avoid calling of qFatal() sys.excepthook = except_hook quit_prompt_active = False def signal_handler(signal, frame): global quit_prompt_active with QSignalBlocker(app): if debugcore.lock_send_command.locked(): print("\nCancelling the last GDB command") debugcore.cancel_last_command() else: if quit_prompt_active: print() # Prints a newline so the terminal looks nicer when we quit debugcore.detach() quit() quit_prompt_active = True print("\nNo GDB command to cancel, quit PINCE? (y/n)", end="", flush=True) while True: # Using select() instead of input() because it causes the bug below # QBackingStore::endPaint() called with active painter rlist, _, _ = select.select([sys.stdin], [], [], 0.1) if rlist: user_input = sys.stdin.readline().strip().lower() break if user_input.startswith("y"): debugcore.detach() quit() else: print("Quit aborted") quit_prompt_active = False signal.signal(signal.SIGINT, signal_handler) # Checks if the inferior has been terminated class AwaitProcessExit(QThread): process_exited = pyqtSignal() def run(self): while True: with debugcore.process_exited_condition: debugcore.process_exited_condition.wait() self.process_exited.emit() # Await async output from gdb class AwaitAsyncOutput(QThread): async_output_ready = pyqtSignal(str) def __init__(self): super().__init__() self.queue_active = True def run(self): async_output_queue = debugcore.gdb_async_output.register_queue() while self.queue_active: try: async_output = async_output_queue.get(timeout=5) except queue.Empty: pass else: self.async_output_ready.emit(async_output) debugcore.gdb_async_output.delete_queue(async_output_queue) def stop(self): self.queue_active = False class CheckInferiorStatus(QThread): process_stopped = pyqtSignal() process_running = pyqtSignal() def run(self): while True: with debugcore.status_changed_condition: debugcore.status_changed_condition.wait() if debugcore.inferior_status == typedefs.INFERIOR_STATUS.STOPPED: self.process_stopped.emit() elif debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING: self.process_running.emit() class MainForm(QMainWindow, MainWindow): table_update_interval: int = 500 freeze_interval: int = 100 update_table: bool = True auto_attach: str = "" auto_attach_regex: bool = False def __init__(self): super().__init__() self.setupUi(self) self.hotkey_to_shortcut = {} hotkey_to_func = { hotkeys.pause_hotkey: self.pause_hotkey_pressed, hotkeys.break_hotkey: self.break_hotkey_pressed, hotkeys.continue_hotkey: self.continue_hotkey_pressed, hotkeys.toggle_attach_hotkey: self.toggle_attach_hotkey_pressed, hotkeys.exact_scan_hotkey: lambda: self.nextscan_hotkey_pressed(typedefs.SCAN_TYPE.EXACT), hotkeys.increased_scan_hotkey: lambda: self.nextscan_hotkey_pressed(typedefs.SCAN_TYPE.INCREASED), hotkeys.decreased_scan_hotkey: lambda: self.nextscan_hotkey_pressed(typedefs.SCAN_TYPE.DECREASED), hotkeys.changed_scan_hotkey: lambda: self.nextscan_hotkey_pressed(typedefs.SCAN_TYPE.CHANGED), hotkeys.unchanged_scan_hotkey: lambda: self.nextscan_hotkey_pressed(typedefs.SCAN_TYPE.UNCHANGED), } for hotkey, func in hotkey_to_func.items(): hotkey.change_func(func) self.treeWidget_AddressTable.setColumnWidth(FROZEN_COL, 50) self.treeWidget_AddressTable.setColumnWidth(DESC_COL, 150) self.treeWidget_AddressTable.setColumnWidth(ADDR_COL, 150) self.treeWidget_AddressTable.setColumnWidth(TYPE_COL, 150) self.tableWidget_valuesearchtable.setColumnWidth(SEARCH_TABLE_ADDRESS_COL, 120) self.tableWidget_valuesearchtable.setColumnWidth(SEARCH_TABLE_VALUE_COL, 80) self.tableWidget_valuesearchtable.horizontalHeader().setSortIndicatorClearable(True) self.settings = QSettings() self.memory_view_window = MemoryViewWindowForm(self) self.await_exit_thread = AwaitProcessExit() self.auto_attach_timer = QTimer(timeout=self.auto_attach_loop) if not os.path.exists(self.settings.fileName()): self.set_default_settings() try: settings_version = self.settings.value("Misc/version", type=str) except Exception as e: print("An exception occurred while reading settings version\n", e) settings_version = None if settings_version != settings.current_settings_version: print("Settings version mismatch, rolling back to the default configuration") self.settings.clear() self.set_default_settings() try: self.apply_settings() except Exception as e: print("An exception occurred while loading settings, rolling back to the default configuration\n", e) self.settings.clear() self.set_default_settings() gdb_path = settings.gdb_path if os.environ.get("APPDIR"): gdb_path = utils.get_default_gdb_path() if debugcore.init_gdb(gdb_path): self.apply_after_init() else: InputDialogForm(self, [(tr.GDB_INIT_ERROR, None)], buttons=[QDialogButtonBox.StandardButton.Ok]).exec() self.await_exit_thread.process_exited.connect(self.on_inferior_exit) self.await_exit_thread.start() self.check_status_thread = CheckInferiorStatus() self.check_status_thread.process_stopped.connect(self.on_status_stopped) self.check_status_thread.process_running.connect(self.on_status_running) self.check_status_thread.process_stopped.connect(self.memory_view_window.process_stopped) self.check_status_thread.process_running.connect(self.memory_view_window.process_running) self.check_status_thread.start() self.address_table_timer = QTimer(timeout=self.address_table_loop, singleShot=True) self.address_table_timer.start() self.search_table_timer = QTimer(timeout=self.search_table_loop, singleShot=True) self.search_table_timer.start() self.freeze_timer = QTimer(timeout=self.freeze_loop, singleShot=True) self.freeze_timer.start() self.shortcut_open_file = QShortcut(QKeySequence("Ctrl+O"), self) self.shortcut_open_file.activated.connect(self.pushButton_Open_clicked) guiutils.append_shortcut_to_tooltip(self.pushButton_Open, self.shortcut_open_file) self.shortcut_save_file = QShortcut(QKeySequence("Ctrl+S"), self) self.shortcut_save_file.activated.connect(self.pushButton_Save_clicked) guiutils.append_shortcut_to_tooltip(self.pushButton_Save, self.shortcut_save_file) # Saving the original function because super() doesn't work when we override functions like this self.treeWidget_AddressTable.mousePressEvent_original = self.treeWidget_AddressTable.mousePressEvent self.treeWidget_AddressTable.mousePressEvent = self.treeWidget_AddressTable_mouse_press_event self.treeWidget_AddressTable.mouseReleaseEvent_original = self.treeWidget_AddressTable.mouseReleaseEvent self.treeWidget_AddressTable.mouseReleaseEvent = self.treeWidget_AddressTable_mouse_release_event self.treeWidget_AddressTable.keyPressEvent_original = self.treeWidget_AddressTable.keyPressEvent self.treeWidget_AddressTable.keyPressEvent = self.treeWidget_AddressTable_key_press_event self.treeWidget_AddressTable.contextMenuEvent = self.treeWidget_AddressTable_context_menu_event self.pushButton_AttachProcess.clicked.connect(self.pushButton_AttachProcess_clicked) self.pushButton_Open.clicked.connect(self.pushButton_Open_clicked) self.pushButton_Save.clicked.connect(self.pushButton_Save_clicked) self.pushButton_NewFirstScan.clicked.connect(self.pushButton_NewFirstScan_clicked) self.pushButton_UndoScan.clicked.connect(self.pushButton_UndoScan_clicked) self.pushButton_NextScan.clicked.connect(self.pushButton_NextScan_clicked) self.pushButton_ScanRegions.clicked.connect(self.pushButton_ScanRegions_clicked) self.scan_mode = typedefs.SCAN_MODE.NEW self.pushButton_NewFirstScan_clicked() self.comboBox_ScanScope_init() self.comboBox_ValueType_init() guiutils.fill_endianness_combobox(self.comboBox_Endianness) self.checkBox_Hex.stateChanged.connect(self.checkBox_Hex_stateChanged) self.comboBox_ValueType.currentIndexChanged.connect(self.comboBox_ValueType_current_index_changed) self.lineEdit_Scan.setValidator(guiutils.validator_map.get("int")) self.lineEdit_Scan2.setValidator(guiutils.validator_map.get("int")) self.lineEdit_Scan.keyPressEvent_original = self.lineEdit_Scan.keyPressEvent self.lineEdit_Scan2.keyPressEvent_original = self.lineEdit_Scan2.keyPressEvent self.lineEdit_Scan.keyPressEvent = self.lineEdit_Scan_on_key_press_event self.lineEdit_Scan2.keyPressEvent = self.lineEdit_Scan2_on_key_press_event self.comboBox_ScanType.currentIndexChanged.connect(self.comboBox_ScanType_current_index_changed) self.comboBox_ScanType_current_index_changed() self.pushButton_Settings.clicked.connect(self.pushButton_Settings_clicked) self.pushButton_Console.clicked.connect(self.pushButton_Console_clicked) self.pushButton_Wiki.clicked.connect(self.pushButton_Wiki_clicked) self.pushButton_About.clicked.connect(self.pushButton_About_clicked) self.pushButton_AddAddressManually.clicked.connect(self.pushButton_AddAddressManually_clicked) self.pushButton_MemoryView.clicked.connect(self.pushButton_MemoryView_clicked) self.pushButton_RefreshAdressTable.clicked.connect(self.pushButton_RefreshAdressTable_clicked) self.pushButton_CopyToAddressTable.clicked.connect(self.copy_to_address_table) self.pushButton_CleanAddressTable.clicked.connect(self.clear_address_table) self.tableWidget_valuesearchtable.cellDoubleClicked.connect( self.tableWidget_valuesearchtable_cell_double_clicked ) self.tableWidget_valuesearchtable.keyPressEvent_original = self.tableWidget_valuesearchtable.keyPressEvent self.tableWidget_valuesearchtable.keyPressEvent = self.tableWidget_valuesearchtable_key_press_event self.tableWidget_valuesearchtable.contextMenuEvent = self.tableWidget_valuesearchtable_context_menu_event self.treeWidget_AddressTable.itemDoubleClicked.connect(self.treeWidget_AddressTable_item_double_clicked) self.treeWidget_AddressTable.expanded.connect(self.resize_address_table) self.treeWidget_AddressTable.collapsed.connect(self.resize_address_table) self.treeWidget_AddressTable.header().setSortIndicatorClearable(True) self.treeWidget_AddressTable.header().setSortIndicator(-1, Qt.SortOrder.AscendingOrder) # Clear sort indicator icons_directory = guiutils.get_icons_directory() self.pushButton_AttachProcess.setIcon(QIcon(QPixmap(icons_directory + "/monitor.png"))) self.pushButton_Open.setIcon(QIcon(QPixmap(icons_directory + "/folder.png"))) self.pushButton_Save.setIcon(QIcon(QPixmap(icons_directory + "/disk.png"))) self.pushButton_Settings.setIcon(QIcon(QPixmap(icons_directory + "/wrench.png"))) self.pushButton_CopyToAddressTable.setIcon(QIcon(QPixmap(icons_directory + "/arrow_down.png"))) self.pushButton_CleanAddressTable.setIcon(QIcon(QPixmap(icons_directory + "/bin_closed.png"))) self.pushButton_RefreshAdressTable.setIcon(QIcon(QPixmap(icons_directory + "/table_refresh.png"))) self.pushButton_Console.setIcon(QIcon(QPixmap(icons_directory + "/application_xp_terminal.png"))) self.pushButton_Wiki.setIcon(QIcon(QPixmap(icons_directory + "/book_open.png"))) self.pushButton_About.setIcon(QIcon(QPixmap(icons_directory + "/information.png"))) self.pushButton_NextScan.setEnabled(False) self.pushButton_UndoScan.setEnabled(False) self.flashAttachButton = True self.flashAttachButtonTimer = QTimer() self.flashAttachButtonTimer.timeout.connect(self.flash_attach_button) self.flashAttachButton_gradiantState = 0 self.flashAttachButtonTimer.start(100) guiutils.center(self) # Please refrain from using python specific objects in settings, use json-compatible ones instead # Using python objects causes issues when filenames change def set_default_settings(self): self.settings.beginGroup("General") self.settings.setValue("auto_update_address_table", MainForm.update_table) self.settings.setValue("address_table_update_interval", MainForm.table_update_interval) self.settings.setValue("freeze_interval", MainForm.freeze_interval) self.settings.setValue("gdb_output_mode", json.dumps([True, True, True])) self.settings.setValue("auto_attach", MainForm.auto_attach) self.settings.setValue("auto_attach_regex", MainForm.auto_attach_regex) self.settings.setValue("locale", get_locale()) self.settings.setValue("logo_path", "ozgurozbek/pince_small_transparent.png") self.settings.setValue("theme", "System Default") self.settings.endGroup() self.settings.beginGroup("Hotkeys") for hotkey in hotkeys.get_hotkeys(): self.settings.setValue(hotkey.name, hotkey.default) self.settings.endGroup() self.settings.beginGroup("CodeInjection") self.settings.setValue("code_injection_method", typedefs.INJECTION_METHOD.DLOPEN) self.settings.endGroup() self.settings.beginGroup("MemoryView") self.settings.setValue("show_memory_view_on_stop", False) self.settings.setValue("instructions_per_scroll", MemoryViewWindowForm.instructions_per_scroll) self.settings.setValue("bytes_per_scroll", MemoryViewWindowForm.bytes_per_scroll) self.settings.endGroup() self.settings.beginGroup("Debug") self.settings.setValue("gdb_path", typedefs.PATHS.GDB) self.settings.setValue("gdb_logging", False) self.settings.setValue("interrupt_signal", "SIGINT") self.settings.setValue("handle_signals", json.dumps(settings.default_signals)) self.settings.endGroup() self.settings.beginGroup("Java") self.settings.setValue("ignore_segfault", True) self.settings.endGroup() self.settings.beginGroup("Misc") self.settings.setValue("version", settings.current_settings_version) self.settings.endGroup() self.apply_settings() def apply_after_init(self): global exp_cache exp_cache.clear() settings.gdb_logging = self.settings.value("Debug/gdb_logging", type=bool) settings.interrupt_signal = self.settings.value("Debug/interrupt_signal", type=str) settings.handle_signals = json.loads(self.settings.value("Debug/handle_signals", type=str)) java_ignore_segfault = self.settings.value("Java/ignore_segfault", type=bool) debugcore.set_logging(settings.gdb_logging) # Don't handle signals if a process isn't present, a small optimization to gain time on launch and detach if debugcore.currentpid != -1: debugcore.handle_signals(settings.handle_signals) # Not a great method but okayish until the implementation of the libpince engine and the java dissector # "jps" command could be used instead if we ever need to install openjdk if java_ignore_segfault and utils.get_process_name(debugcore.currentpid).startswith("java"): debugcore.handle_signal("SIGSEGV", False, True) debugcore.set_interrupt_signal(settings.interrupt_signal) # Needs to be called after handle_signals def apply_settings(self): self.update_table = self.settings.value("General/auto_update_address_table", type=bool) self.table_update_interval = self.settings.value("General/address_table_update_interval", type=int) self.freeze_interval = self.settings.value("General/freeze_interval", type=int) settings.gdb_output_mode = json.loads(self.settings.value("General/gdb_output_mode", type=str)) settings.gdb_output_mode = typedefs.gdb_output_mode(*settings.gdb_output_mode) self.auto_attach = self.settings.value("General/auto_attach", type=str) self.auto_attach_regex = self.settings.value("General/auto_attach_regex", type=bool) if self.auto_attach: self.auto_attach_timer.start(100) else: self.auto_attach_timer.stop() settings.locale = self.settings.value("General/locale", type=str) app.setWindowIcon( QIcon(os.path.join(utils.get_logo_directory(), self.settings.value("General/logo_path", type=str))) ) app.setPalette(get_theme(self.settings.value("General/theme", type=str))) debugcore.set_gdb_output_mode(settings.gdb_output_mode) for hotkey in hotkeys.get_hotkeys(): try: hotkey.change_key(self.settings.value("Hotkeys/" + hotkey.name)) except: # if the hotkey cannot be applied for whatever reason, reset it to the default self.settings.setValue("Hotkeys/" + hotkey.name, hotkey.default) hotkey.change_key(hotkey.default) try: self.memory_view_window.set_dynamic_debug_hotkeys() except AttributeError: pass settings.code_injection_method = self.settings.value("CodeInjection/code_injection_method", type=int) self.memory_view_window.show_memory_view_on_stop = self.settings.value( "MemoryView/show_memory_view_on_stop", type=bool ) self.memory_view_window.instructions_per_scroll = self.settings.value( "MemoryView/instructions_per_scroll", type=int ) self.memory_view_window.bytes_per_scroll = self.settings.value("MemoryView/bytes_per_scroll", type=int) settings.gdb_path = self.settings.value("Debug/gdb_path", type=str) if debugcore.gdb_initialized: self.apply_after_init() # Check if any process should be attached to automatically # Patterns at former positions have higher priority if regex is off def auto_attach_loop(self): if debugcore.currentpid != -1: return if self.auto_attach_regex: try: compiled_re = re.compile(self.auto_attach) except: print(f"Auto-attach failed: {self.auto_attach} isn't a valid regex") return for pid, _, name in utils.get_process_list(): if compiled_re.search(name): self.attach_to_pid(int(pid)) return else: for target in self.auto_attach.split(";"): for pid, _, name in utils.get_process_list(): if name.find(target) != -1: self.attach_to_pid(int(pid)) return # Keyboard package has an issue with exceptions, any trigger function that throws an exception stops the event loop # Writing a custom event loop instead of ignoring exceptions could work as well but honestly, this looks cleaner # Keyboard package does not play well with Qt, do not use anything Qt related with hotkeys # Instead of using Qt functions, try to use their signals to prevent crashes @utils.ignore_exceptions def pause_hotkey_pressed(self): if not debugcore.active_trace: debugcore.interrupt_inferior(typedefs.STOP_REASON.PAUSE) @utils.ignore_exceptions def break_hotkey_pressed(self): if not debugcore.active_trace: debugcore.interrupt_inferior() @utils.ignore_exceptions def continue_hotkey_pressed(self): if not ( debugcore.currentpid == -1 or debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING or debugcore.active_trace ): debugcore.continue_inferior() @utils.ignore_exceptions def toggle_attach_hotkey_pressed(self): result = debugcore.toggle_attach() if not result: print("Unable to toggle attach") elif result == typedefs.TOGGLE_ATTACH.DETACHED: self.on_status_detached() else: # Attaching back doesn't update the status if the process is already stopped before detachment with debugcore.status_changed_condition: debugcore.status_changed_condition.notify_all() @utils.ignore_exceptions def nextscan_hotkey_pressed(self, index): if self.scan_mode == typedefs.SCAN_MODE.NEW: return self.comboBox_ScanType.setCurrentIndex(index) self.pushButton_NextScan.clicked.emit() def treeWidget_AddressTable_context_menu_event(self, event): current_row = guiutils.get_current_item(self.treeWidget_AddressTable) current_address = current_row.text(ADDR_COL) if current_row else None header = self.treeWidget_AddressTable.headerItem() menu = QMenu() delete_record = menu.addAction(f"{tr.DELETE}[Del]") edit_menu = menu.addMenu(tr.EDIT) edit_desc = edit_menu.addAction(f"{header.text(DESC_COL)}[Ctrl+Enter]") edit_address = edit_menu.addAction(f"{header.text(ADDR_COL)}[Ctrl+Alt+Enter]") edit_type = edit_menu.addAction(f"{header.text(TYPE_COL)}[Alt+Enter]") edit_value = edit_menu.addAction(f"{header.text(VALUE_COL)}[Enter]") show_hex = menu.addAction(tr.SHOW_HEX) show_dec = menu.addAction(tr.SHOW_DEC) show_unsigned = menu.addAction(tr.SHOW_UNSIGNED) show_signed = menu.addAction(tr.SHOW_SIGNED) toggle_record = menu.addAction(f"{tr.TOGGLE}[Space]") toggle_children = menu.addAction(f"{tr.TOGGLE_CHILDREN}[Ctrl+Space]") freeze_menu = menu.addMenu(tr.FREEZE) freeze_default = freeze_menu.addAction(tr.DEFAULT) freeze_inc = freeze_menu.addAction(tr.INCREMENTAL) freeze_dec = freeze_menu.addAction(tr.DECREMENTAL) menu.addSeparator() browse_region = menu.addAction(f"{tr.BROWSE_MEMORY_REGION}[Ctrl+B]") disassemble = menu.addAction(f"{tr.DISASSEMBLE_ADDRESS}[Ctrl+D]") menu.addSeparator() pointer_scanner = menu.addAction(tr.POINTER_SCANNER) pointer_scan = menu.addAction(tr.POINTER_SCAN) menu.addSeparator() what_writes = menu.addAction(tr.WHAT_WRITES) what_reads = menu.addAction(tr.WHAT_READS) what_accesses = menu.addAction(tr.WHAT_ACCESSES) menu.addSeparator() cut_record = menu.addAction(f"{tr.CUT}[Ctrl+X]") copy_record = menu.addAction(f"{tr.COPY}[Ctrl+C]") paste_record = menu.addAction(f"{tr.PASTE}[Ctrl+V]") paste_inside = menu.addAction(f"{tr.PASTE_INSIDE}[V]") menu.addSeparator() add_group = menu.addAction(tr.ADD_GROUP) create_group = menu.addAction(tr.CREATE_GROUP) if current_row is None: deletion_list = [ edit_menu.menuAction(), show_hex, show_dec, show_unsigned, show_signed, toggle_record, toggle_children, freeze_menu.menuAction(), browse_region, disassemble, pointer_scan, what_writes, what_reads, what_accesses, cut_record, copy_record, paste_inside, delete_record, add_group, ] guiutils.delete_menu_entries(menu, deletion_list) else: value_type = current_row.data(TYPE_COL, Qt.ItemDataRole.UserRole) if typedefs.VALUE_INDEX.is_integer(value_type.value_index): if value_type.value_repr is typedefs.VALUE_REPR.HEX: guiutils.delete_menu_entries(menu, [show_unsigned, show_signed, show_hex]) elif value_type.value_repr is typedefs.VALUE_REPR.UNSIGNED: guiutils.delete_menu_entries(menu, [show_unsigned, show_dec]) elif value_type.value_repr is typedefs.VALUE_REPR.SIGNED: guiutils.delete_menu_entries(menu, [show_signed, show_dec]) if current_row.checkState(FROZEN_COL) == Qt.CheckState.Unchecked: guiutils.delete_menu_entries(menu, [freeze_menu.menuAction()]) else: guiutils.delete_menu_entries( menu, [show_hex, show_dec, show_unsigned, show_signed, freeze_menu.menuAction()] ) if current_row.childCount() == 0: guiutils.delete_menu_entries(menu, [toggle_children]) guiutils.delete_menu_entries(menu, [pointer_scanner]) if debugcore.currentpid == -1: browse_region.setEnabled(False) disassemble.setEnabled(False) pointer_scan.setEnabled(False) if not debugcore.is_attached(): what_writes.setEnabled(False) what_reads.setEnabled(False) what_accesses.setEnabled(False) font_size = self.treeWidget_AddressTable.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { delete_record: self.delete_records, edit_desc: self.treeWidget_AddressTable_edit_desc, edit_address: self.treeWidget_AddressTable_edit_address, edit_type: self.treeWidget_AddressTable_edit_type, edit_value: self.treeWidget_AddressTable_edit_value, show_hex: lambda: self.treeWidget_AddressTable_change_repr(typedefs.VALUE_REPR.HEX), show_dec: lambda: self.treeWidget_AddressTable_change_repr(typedefs.VALUE_REPR.UNSIGNED), show_unsigned: lambda: self.treeWidget_AddressTable_change_repr(typedefs.VALUE_REPR.UNSIGNED), show_signed: lambda: self.treeWidget_AddressTable_change_repr(typedefs.VALUE_REPR.SIGNED), toggle_record: self.toggle_records, toggle_children: lambda: self.toggle_records(True), freeze_default: lambda: self.change_freeze_type(typedefs.FREEZE_TYPE.DEFAULT), freeze_inc: lambda: self.change_freeze_type(typedefs.FREEZE_TYPE.INCREMENT), freeze_dec: lambda: self.change_freeze_type(typedefs.FREEZE_TYPE.DECREMENT), browse_region: lambda: self.browse_region_for_address(current_address), disassemble: lambda: self.disassemble_for_address(current_address), pointer_scanner: self.exec_pointer_scanner, pointer_scan: self.exec_pointer_scan, what_writes: lambda: self.exec_track_watchpoint_widget(typedefs.WATCHPOINT_TYPE.WRITE_ONLY), what_reads: lambda: self.exec_track_watchpoint_widget(typedefs.WATCHPOINT_TYPE.READ_ONLY), what_accesses: lambda: self.exec_track_watchpoint_widget(typedefs.WATCHPOINT_TYPE.BOTH), cut_record: self.cut_records, copy_record: self.copy_records, paste_record: self.paste_records, paste_inside: lambda: self.paste_records(True), add_group: self.group_records, create_group: self.create_group, } try: actions[action]() except KeyError: pass def exec_pointer_scanner(self): pointer_window = PointerScanWindowForm(self) pointer_window.show() def exec_pointer_scan(self): selected_row = guiutils.get_current_item(self.treeWidget_AddressTable) if not selected_row: return address = selected_row.text(ADDR_COL).strip("P->") pointer_window = PointerScanWindowForm(self) pointer_window.show() dialog = PointerScanSearchDialogForm(pointer_window, address) dialog.exec() def exec_track_watchpoint_widget(self, watchpoint_type): selected_row = guiutils.get_current_item(self.treeWidget_AddressTable) if not selected_row: return address = selected_row.text(ADDR_COL).strip("P->") # @todo Maybe rework address grabbing logic in the future address_data = selected_row.data(ADDR_COL, Qt.ItemDataRole.UserRole) if isinstance(address_data, typedefs.PointerChainRequest): selection_dialog = TrackSelectorDialogForm(self) selection_dialog.exec() if not selection_dialog.selection: return if selection_dialog.selection == "pointer": address = address_data.get_base_address_as_str() value_type = selected_row.data(TYPE_COL, Qt.ItemDataRole.UserRole) if typedefs.VALUE_INDEX.is_string(value_type.value_index): value_text = selected_row.text(VALUE_COL) encoding, option = typedefs.string_index_to_encoding_dict[value_type.value_index] byte_len = len(value_text.encode(encoding, option)) elif value_type.value_index == typedefs.VALUE_INDEX.AOB: byte_len = value_type.length else: byte_len = typedefs.index_to_valuetype_dict[value_type.value_index][0] TrackWatchpointWidgetForm(self, address, byte_len, watchpoint_type) def browse_region_for_address(self, address: str): if address: self.memory_view_window.hex_dump_address(int(address.strip("P->"), 16)) self.memory_view_window.show() self.memory_view_window.activateWindow() def disassemble_for_address(self, address: str): if address and self.memory_view_window.disassemble_expression(address.strip("P->"), append_history=True): self.memory_view_window.show() self.memory_view_window.activateWindow() def change_freeze_type(self, freeze_type: int | None = None, row: QTreeWidgetItem | None = None) -> None: if freeze_type == None: # No type has been specified, iterate through the freeze types # This usually happens if user clicks the freeze type text instead of the checkbox frozen: typedefs.Frozen = row.data(FROZEN_COL, Qt.ItemDataRole.UserRole) if frozen.freeze_type == typedefs.FREEZE_TYPE.DECREMENT: # Decrement is the last freeze type freeze_type = typedefs.FREEZE_TYPE.DEFAULT else: freeze_type = frozen.freeze_type + 1 rows = [row] if row else self.treeWidget_AddressTable.selectedItems() for row in rows: frozen: typedefs.Frozen = row.data(FROZEN_COL, Qt.ItemDataRole.UserRole) if row.checkState(FROZEN_COL) == Qt.CheckState.Checked: frozen.freeze_type = freeze_type if freeze_type == typedefs.FREEZE_TYPE.DEFAULT: row.setText(FROZEN_COL, "") row.setForeground(FROZEN_COL, QBrush()) elif freeze_type == typedefs.FREEZE_TYPE.INCREMENT: row.setText(FROZEN_COL, "") row.setForeground(FROZEN_COL, QBrush(QColor(0, 255, 0))) elif freeze_type == typedefs.FREEZE_TYPE.DECREMENT: row.setText(FROZEN_COL, "") row.setForeground(FROZEN_COL, QBrush(QColor(255, 0, 0))) else: frozen.freeze_type = typedefs.FREEZE_TYPE.DEFAULT row.setText(FROZEN_COL, "") row.setForeground(FROZEN_COL, QBrush()) def toggle_records(self, toggle_children=False): row = guiutils.get_current_item(self.treeWidget_AddressTable) selected_items = self.treeWidget_AddressTable.selectedItems() # If only one item is selected and then clicked while ctrl is being held # There'll be no selected rows even with a current row present if row and selected_items: if not row.isSelected(): row = selected_items[0] check_state = row.checkState(FROZEN_COL) new_state = Qt.CheckState.Checked if check_state == Qt.CheckState.Unchecked else Qt.CheckState.Unchecked for row in selected_items: self.handle_freeze_change(row, new_state) if toggle_children: for index in range(row.childCount()): child = row.child(index) self.handle_freeze_change(child, new_state) def cut_records(self): self.copy_records() self.delete_records() def copy_records(self): # Recursive copy items = self.treeWidget_AddressTable.selectedItems() def index_of(item): """Returns the index used to access the given QTreeWidgetItem as a list of ints.""" result = [] while True: parent = item.parent() if parent: result.append(parent.indexOfChild(item)) item = parent else: result.append(item.treeWidget().indexOfTopLevelItem(item)) return result[::-1] # First, order the items by their indices in the tree widget. # Store the indices for later usage. index_items = [(index_of(item), item) for item in items] index_items.sort(key=lambda x: x[0]) # sort by index # Now filter any selected items that is a descendant of another selected items. items = [] last_index = [-1] # any invalid list of indices are fine for index, item in index_items: if index[: len(last_index)] == last_index: continue # this item is a descendant of the last item items.append(item) last_index = index app.clipboard().setText(repr([self.read_address_table_recursively(item) for item in items])) def insert_records(self, records, parent_row, insert_index): # parent_row should be a QTreeWidgetItem in treeWidget_AddressTable # records should be an iterable of valid output of read_address_table_recursively assert isinstance(parent_row, QTreeWidgetItem) rows = [] for rec in records: row = QTreeWidgetItem() row.setCheckState(FROZEN_COL, Qt.CheckState.Unchecked) frozen = typedefs.Frozen("", typedefs.FREEZE_TYPE.DEFAULT) row.setData(FROZEN_COL, Qt.ItemDataRole.UserRole, frozen) # Deserialize the address_expr & value_type param if type(rec[1]) in [list, tuple]: address_expr = typedefs.PointerChainRequest(*rec[1]) else: address_expr = rec[1] value_type = typedefs.ValueType(*rec[2]) self.change_address_table_entries(row, rec[0], address_expr, value_type) self.insert_records(rec[-1], row, 0) rows.append(row) parent_row.insertChildren(insert_index, rows) parent_row.setExpanded(True) def paste_records(self, insert_inside=False): try: records = ast.literal_eval(app.clipboard().text()) except (SyntaxError, ValueError): QMessageBox.information(self, tr.ERROR, tr.INVALID_CLIPBOARD) return insert_row = guiutils.get_current_item(self.treeWidget_AddressTable) root = self.treeWidget_AddressTable.invisibleRootItem() if not insert_row: # this is common when the treeWidget_AddressTable is empty self.insert_records(records, root, self.treeWidget_AddressTable.topLevelItemCount()) elif insert_inside: self.insert_records(records, insert_row, 0) else: parent = insert_row.parent() or root self.insert_records(records, parent, parent.indexOfChild(insert_row) + 1) self.update_address_table() def group_records(self): selected_items = self.treeWidget_AddressTable.selectedItems() if self.create_group(): item_count = self.treeWidget_AddressTable.topLevelItemCount() last_item = self.treeWidget_AddressTable.topLevelItem(item_count - 1) for item in selected_items: parent = item.parent() if parent: parent.removeChild(item) else: index = self.treeWidget_AddressTable.indexOfTopLevelItem(item) self.treeWidget_AddressTable.takeTopLevelItem(index) last_item.addChild(item) self.treeWidget_AddressTable.setCurrentItem(last_item) last_item.setExpanded(True) def create_group(self): dialog = InputDialogForm(self, [(tr.ENTER_DESCRIPTION, tr.GROUP)]) if dialog.exec(): desc = dialog.get_values() self.add_entry_to_addresstable(desc, "0x0") return True return False def delete_records(self): root = self.treeWidget_AddressTable.invisibleRootItem() for item in self.treeWidget_AddressTable.selectedItems(): (item.parent() or root).removeChild(item) def treeWidget_AddressTable_mouse_press_event(self, event: QMouseEvent) -> None: self.treeWidget_AddressTable.mousePressEvent_original(event) item = self.treeWidget_AddressTable.itemAt(event.pos()) column = self.treeWidget_AddressTable.columnAt(event.pos().x()) # Qt doesn't select rows when checkboxes are clicked # Ensure that the row is selected when frozen col is clicked if item and column == FROZEN_COL: item.setSelected(True) def treeWidget_AddressTable_mouse_release_event(self, event: QMouseEvent) -> None: item = self.treeWidget_AddressTable.itemAt(event.pos()) column = self.treeWidget_AddressTable.columnAt(event.pos().x()) if item and column == FROZEN_COL: old_state = item.checkState(FROZEN_COL) self.treeWidget_AddressTable.mouseReleaseEvent_original(event) new_state = item.checkState(FROZEN_COL) item.setSelected(True) box_clicked = old_state != new_state current_item = self.treeWidget_AddressTable.currentItem() if not box_clicked and new_state == Qt.CheckState.Checked: self.change_freeze_type(row=current_item) frozen: typedefs.Frozen = current_item.data(FROZEN_COL, Qt.ItemDataRole.UserRole) freeze_type = frozen.freeze_type for selected_item in self.treeWidget_AddressTable.selectedItems(): if box_clicked: self.handle_freeze_change(selected_item, new_state) elif new_state == Qt.CheckState.Checked: self.change_freeze_type(freeze_type, selected_item) else: self.treeWidget_AddressTable.mouseReleaseEvent_original(event) def treeWidget_AddressTable_key_press_event(self, event: QKeyEvent): current_row = guiutils.get_current_item(self.treeWidget_AddressTable) current_address = current_row.text(ADDR_COL) if current_row else None actions = typedefs.KeyboardModifiersTupleDict( [ (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_Delete), self.delete_records), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_B), lambda: self.browse_region_for_address(current_address), ), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_D), lambda: self.disassemble_for_address(current_address), ), ( QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_R), self.pushButton_RefreshAdressTable_clicked, ), (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_Space), self.toggle_records), (QKeyCombination(Qt.KeyboardModifier.ShiftModifier, Qt.Key.Key_Space), self.toggle_records), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_Space), lambda: self.toggle_records(True), ), (QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_X), self.cut_records), (QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_C), self.copy_records), (QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_V), self.paste_records), (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_V), lambda: self.paste_records(True)), ( QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_Return), self.treeWidget_AddressTable_edit_value, ), ( QKeyCombination(Qt.KeyboardModifier.KeypadModifier, Qt.Key.Key_Enter), self.treeWidget_AddressTable_edit_value, ), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_Return), self.treeWidget_AddressTable_edit_desc, ), ( QKeyCombination( Qt.KeyboardModifier.ControlModifier | Qt.KeyboardModifier.AltModifier, Qt.Key.Key_Return ), self.treeWidget_AddressTable_edit_address, ), ( QKeyCombination(Qt.KeyboardModifier.AltModifier, Qt.Key.Key_Return), self.treeWidget_AddressTable_edit_type, ), ] ) try: actions[QKeyCombination(event.modifiers(), Qt.Key(event.key()))]() except KeyError: self.treeWidget_AddressTable.keyPressEvent_original(event) def update_address_table(self): global exp_cache if debugcore.currentpid == -1 or self.treeWidget_AddressTable.topLevelItemCount() == 0: return it = QTreeWidgetItemIterator(self.treeWidget_AddressTable) mem_handle = debugcore.memory_handle() basic_math_exp = re.compile(r"^[0-9a-fA-F][/*+\-0-9a-fA-FxX]+$") while True: row = it.value() if not row: break it += 1 address_data = row.data(ADDR_COL, Qt.ItemDataRole.UserRole) if isinstance(address_data, typedefs.PointerChainRequest): expression = address_data.base_address else: expression = address_data parent = row.parent() if parent and expression.startswith(("+", "-")): expression = parent.data(ADDR_COL, Qt.ItemDataRole.UserRole + 1) + expression if expression in exp_cache: address = exp_cache[expression] elif expression.startswith(("+", "-")): # If parent has an empty address address = expression elif basic_math_exp.match(expression.replace(" ", "")): try: address = hex(eval(expression)) except: address = debugcore.examine_expression(expression).address exp_cache[expression] = address else: address = debugcore.examine_expression(expression).address exp_cache[expression] = address vt = row.data(TYPE_COL, Qt.ItemDataRole.UserRole) if isinstance(address_data, typedefs.PointerChainRequest): # The original base could be a symbol so we have to save it # This little hack avoids the unnecessary examine_expression call # TODO: Consider implementing exp_cache inside libpince so we don't need this hack pointer_chain_req = address_data if address: old_base = pointer_chain_req.base_address # save the old base pointer_chain_req.base_address = address pointer_chain_result = debugcore.read_pointer_chain(pointer_chain_req) if pointer_chain_result and pointer_chain_result.get_final_address(): address = pointer_chain_result.get_final_address_as_hex() else: address = None address_data.base_address = old_base # then set it back if address: row.setText(ADDR_COL, f"P->{address}") else: row.setText(ADDR_COL, "P->??") else: row.setText(ADDR_COL, "P->??") else: row.setText(ADDR_COL, address or address_data) address = "" if not address else address row.setData(ADDR_COL, Qt.ItemDataRole.UserRole + 1, address) value = debugcore.read_memory( address, vt.value_index, vt.length, vt.zero_terminate, vt.value_repr, vt.endian, mem_handle=mem_handle ) value = "" if value is None else str(value) row.setText(VALUE_COL, value) def scan_values(self): global threadpool if debugcore.currentpid == -1: return search_for = self.validate_search(self.lineEdit_Scan.text(), self.lineEdit_Scan2.text()) self.QWidget_Toolbox.setEnabled(False) self.progressBar.setValue(0) self.progress_bar_timer = QTimer(timeout=self.update_progress_bar) self.progress_bar_timer.start(100) scan_thread = Worker(scanmem.send_command, search_for) scan_thread.signals.finished.connect(self.scan_callback) threadpool.start(scan_thread) def resize_address_table(self): self.treeWidget_AddressTable.resizeColumnToContents(FROZEN_COL) # gets the information from the dialog then adds it to addresstable def pushButton_AddAddressManually_clicked(self): manual_address_dialog = ManualAddressDialogForm(self) if manual_address_dialog.exec(): desc, address_expr, vt = manual_address_dialog.get_values() self.add_entry_to_addresstable(desc, address_expr, vt) self.update_address_table() def pushButton_RefreshAdressTable_clicked(self): global exp_cache exp_cache.clear() self.update_address_table() def pushButton_MemoryView_clicked(self): self.memory_view_window.showMaximized() self.memory_view_window.activateWindow() def pushButton_Wiki_clicked(self): utils.execute_command_as_user('python3 -m webbrowser "path_to_url"') def pushButton_About_clicked(self): about_widget = AboutWidgetForm(self) about_widget.show() about_widget.activateWindow() def pushButton_Settings_clicked(self): settings_dialog = SettingsDialogForm(self, self.set_default_settings) if settings_dialog.exec(): self.apply_settings() def pushButton_Console_clicked(self): console_widget = ConsoleWidgetForm(self) console_widget.showMaximized() def checkBox_Hex_stateChanged(self, state): if Qt.CheckState(state) == Qt.CheckState.Checked: # allows only things that are hex, can also start with 0x self.lineEdit_Scan.setValidator(guiutils.validator_map.get("int_hex")) self.lineEdit_Scan2.setValidator(guiutils.validator_map.get("int_hex")) else: # sets it back to integers only self.lineEdit_Scan.setValidator(guiutils.validator_map.get("int")) self.lineEdit_Scan2.setValidator(guiutils.validator_map.get("int")) def pushButton_NewFirstScan_clicked(self): if debugcore.currentpid == -1: self.comboBox_ScanType_init() return if self.scan_mode == typedefs.SCAN_MODE.ONGOING: self.reset_scan() else: self.scan_mode = typedefs.SCAN_MODE.ONGOING self.pushButton_NewFirstScan.setText(tr.NEW_SCAN) self.comboBox_ValueType.setEnabled(False) self.pushButton_NextScan.setEnabled(True) search_scope = self.comboBox_ScanScope.currentData(Qt.ItemDataRole.UserRole) endian = self.comboBox_Endianness.currentData(Qt.ItemDataRole.UserRole) scanmem.send_command(f"option region_scan_level {search_scope}") scanmem.send_command(f"option endianness {endian}") scanmem.reset() self.comboBox_ScanScope.setEnabled(False) self.comboBox_Endianness.setEnabled(False) self.scan_values() self.comboBox_ScanType_init() def handle_line_edit_scan_key_press_event(self, event): valid_keys = [Qt.Key.Key_Return, Qt.Key.Key_Enter] if event.key() in valid_keys and Qt.KeyboardModifier.ControlModifier in event.modifiers(): self.pushButton_NewFirstScan_clicked() return if event.key() in valid_keys: if self.scan_mode == typedefs.SCAN_MODE.ONGOING: self.pushButton_NextScan_clicked() else: self.pushButton_NewFirstScan_clicked() return def lineEdit_Scan_on_key_press_event(self, event): self.handle_line_edit_scan_key_press_event(event) self.lineEdit_Scan.keyPressEvent_original(event) def lineEdit_Scan2_on_key_press_event(self, event): self.handle_line_edit_scan_key_press_event(event) self.lineEdit_Scan2.keyPressEvent_original(event) def pushButton_UndoScan_clicked(self): global threadpool if debugcore.currentpid == -1: return undo_thread = Worker(scanmem.undo_scan) undo_thread.signals.finished.connect(self.scan_callback) threadpool.start(undo_thread) self.pushButton_UndoScan.setEnabled(False) # we can undo once so set it to false and re-enable at next scan def comboBox_ScanType_current_index_changed(self): hidden_types = [ typedefs.SCAN_TYPE.INCREASED, typedefs.SCAN_TYPE.DECREASED, typedefs.SCAN_TYPE.CHANGED, typedefs.SCAN_TYPE.UNCHANGED, typedefs.SCAN_TYPE.UNKNOWN, ] if self.comboBox_ScanType.currentData(Qt.ItemDataRole.UserRole) in hidden_types: self.widget_Scan.setEnabled(False) else: self.widget_Scan.setEnabled(True) if self.comboBox_ScanType.currentData(Qt.ItemDataRole.UserRole) == typedefs.SCAN_TYPE.BETWEEN: self.label_Between.setVisible(True) self.lineEdit_Scan2.setVisible(True) else: self.label_Between.setVisible(False) self.lineEdit_Scan2.setVisible(False) def comboBox_ScanType_init(self): scan_type_text = { typedefs.SCAN_TYPE.EXACT: tr.EXACT, typedefs.SCAN_TYPE.NOT: tr.NOT, typedefs.SCAN_TYPE.INCREASED: tr.INCREASED, typedefs.SCAN_TYPE.INCREASED_BY: tr.INCREASED_BY, typedefs.SCAN_TYPE.DECREASED: tr.DECREASED, typedefs.SCAN_TYPE.DECREASED_BY: tr.DECREASED_BY, typedefs.SCAN_TYPE.LESS: tr.LESS_THAN, typedefs.SCAN_TYPE.MORE: tr.MORE_THAN, typedefs.SCAN_TYPE.BETWEEN: tr.BETWEEN, typedefs.SCAN_TYPE.CHANGED: tr.CHANGED, typedefs.SCAN_TYPE.UNCHANGED: tr.UNCHANGED, typedefs.SCAN_TYPE.UNKNOWN: tr.UNKNOWN_VALUE, } current_type = self.comboBox_ScanType.currentData(Qt.ItemDataRole.UserRole) value_type = self.comboBox_ValueType.currentData(Qt.ItemDataRole.UserRole) self.comboBox_ScanType.clear() items = typedefs.SCAN_TYPE.get_list(self.scan_mode, value_type) old_index = 0 for index, type_index in enumerate(items): if current_type == type_index: old_index = index self.comboBox_ScanType.addItem(scan_type_text[type_index], type_index) self.comboBox_ScanType.setCurrentIndex(old_index) def comboBox_ScanScope_init(self): scan_scope_text = [ (typedefs.SCAN_SCOPE.BASIC, tr.BASIC), (typedefs.SCAN_SCOPE.NORMAL, tr.NORMAL), (typedefs.SCAN_SCOPE.FULL_RW, tr.RW), (typedefs.SCAN_SCOPE.FULL, tr.FULL), ] for scope, text in scan_scope_text: self.comboBox_ScanScope.addItem(text, scope) self.comboBox_ScanScope.setCurrentIndex(1) # typedefs.SCAN_SCOPE.NORMAL def comboBox_ValueType_init(self): self.comboBox_ValueType.clear() for value_index, value_text in typedefs.scan_index_to_text_dict.items(): self.comboBox_ValueType.addItem(value_text, value_index) self.comboBox_ValueType.setCurrentIndex(typedefs.SCAN_INDEX.INT32) self.comboBox_ValueType_current_index_changed() # adds things like 0x when searching for etc, basically just makes the line valid for scanmem # this should cover most things, more things might be added later if need be def validate_search(self, search_for: str, search_for2: str): type_index = self.comboBox_ScanType.currentData(Qt.ItemDataRole.UserRole) symbol_map = { typedefs.SCAN_TYPE.INCREASED: "+", typedefs.SCAN_TYPE.DECREASED: "-", typedefs.SCAN_TYPE.CHANGED: "!=", typedefs.SCAN_TYPE.UNCHANGED: "=", typedefs.SCAN_TYPE.UNKNOWN: "snapshot", } if type_index in symbol_map: return symbol_map[type_index] # none of these should be possible to be true at the same time scan_index = self.comboBox_ValueType.currentData(Qt.ItemDataRole.UserRole) if scan_index >= typedefs.SCAN_INDEX.FLOAT_ANY and scan_index <= typedefs.SCAN_INDEX.FLOAT64: # Adjust to locale whatever the input if QLocale.system().decimalPoint() == ".": search_for = search_for.replace(",", ".") search_for2 = search_for2.replace(",", ".") else: search_for = search_for.replace(".", ",") search_for2 = search_for2.replace(".", ",") elif scan_index == typedefs.SCAN_INDEX.STRING: search_for = '" ' + search_for elif self.checkBox_Hex.isChecked(): if not search_for.startswith(("0x", "-0x")): negative_str = "-" if search_for.startswith("-") else "" search_for = negative_str + "0x" + search_for.lstrip("-") if not search_for2.startswith(("0x", "-0x")): negative_str = "-" if search_for.startswith("-") else "" search_for2 = negative_str + "0x" + search_for2.lstrip("-") if type_index == typedefs.SCAN_TYPE.BETWEEN: return search_for + ".." + search_for2 cmp_symbols = { typedefs.SCAN_TYPE.INCREASED_BY: "+", typedefs.SCAN_TYPE.DECREASED_BY: "-", typedefs.SCAN_TYPE.LESS: "<", typedefs.SCAN_TYPE.MORE: ">", } if type_index in cmp_symbols: return cmp_symbols[type_index] + " " + search_for if type_index == typedefs.SCAN_TYPE.NOT: search_for = "!= " + search_for return search_for def pushButton_NextScan_clicked(self): self.scan_values() self.pushButton_UndoScan.setEnabled(True) def pushButton_ScanRegions_clicked(self): scan_regions_dialog = ScanRegionsDialogForm(self) scan_regions_dialog.exec() def scan_callback(self): self.progress_bar_timer.stop() self.progressBar.setValue(100) matches = scanmem.matches() self.update_match_count() self.tableWidget_valuesearchtable.setRowCount(0) current_type = self.comboBox_ValueType.currentData(Qt.ItemDataRole.UserRole) length = self._scan_to_length(current_type) mem_handle = debugcore.memory_handle() row = 0 # go back to using n when unknown issue gets fixed self.tableWidget_valuesearchtable.setSortingEnabled(False) for n, address, offset, region_type, val, result_type in matches: address = "0x" + address result = result_type.split(" ")[0] if result == "unknown": # Ignore unknown entries for now continue value_index = typedefs.scanmem_result_to_index_dict[result] if self.checkBox_Hex.isChecked(): value_repr = typedefs.VALUE_REPR.HEX elif typedefs.VALUE_INDEX.is_integer(value_index) and result.endswith("s"): value_repr = typedefs.VALUE_REPR.SIGNED else: value_repr = typedefs.VALUE_REPR.UNSIGNED endian = self.comboBox_Endianness.currentData(Qt.ItemDataRole.UserRole) current_item = QTableWidgetItem(address) current_item.setData(Qt.ItemDataRole.UserRole, (value_index, value_repr, endian)) value = str(debugcore.read_memory(address, value_index, length, True, value_repr, endian, mem_handle)) self.tableWidget_valuesearchtable.insertRow(row) self.tableWidget_valuesearchtable.setItem(row, SEARCH_TABLE_ADDRESS_COL, current_item) self.tableWidget_valuesearchtable.setItem(row, SEARCH_TABLE_VALUE_COL, QTableWidgetItem(value)) self.tableWidget_valuesearchtable.setItem(row, SEARCH_TABLE_PREVIOUS_COL, QTableWidgetItem(value)) row += 1 if row == 1000: break self.tableWidget_valuesearchtable.resizeColumnsToContents() self.tableWidget_valuesearchtable.setSortingEnabled(True) self.QWidget_Toolbox.setEnabled(True) def _scan_to_length(self, type_index): if type_index == typedefs.SCAN_INDEX.AOB: return self.lineEdit_Scan.text().count(" ") + 1 if type_index == typedefs.SCAN_INDEX.STRING: return len(self.lineEdit_Scan.text()) return 0 def update_match_count(self): match_count = scanmem.get_match_count() if match_count > 1000: self.label_MatchCount.setText(tr.MATCH_COUNT_LIMITED.format(match_count, 1000)) else: self.label_MatchCount.setText(tr.MATCH_COUNT.format(match_count)) def tableWidget_valuesearchtable_cell_double_clicked(self, row, col): current_item = self.tableWidget_valuesearchtable.item(row, SEARCH_TABLE_ADDRESS_COL) value_index, value_repr, endian = current_item.data(Qt.ItemDataRole.UserRole) length = self._scan_to_length(self.comboBox_ValueType.currentData(Qt.ItemDataRole.UserRole)) vt = typedefs.ValueType(value_index, length, True, value_repr, endian) self.add_entry_to_addresstable(tr.NO_DESCRIPTION, current_item.text(), vt) self.update_address_table() def tableWidget_valuesearchtable_key_press_event(self, event: QKeyEvent) -> None: current_item = self.tableWidget_valuesearchtable.currentItem() if debugcore.currentpid == -1 or not current_item: return current_address = self.tableWidget_valuesearchtable.item(current_item.row(), SEARCH_TABLE_ADDRESS_COL).text() actions = typedefs.KeyboardModifiersTupleDict( [ ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_C), self.copy_valuesearchtable_selection, ), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_B), lambda: self.browse_region_for_address(current_address), ), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_D), lambda: self.disassemble_for_address(current_address), ), ( QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_Delete), self.delete_valuesearchtable_selection, ), ] ) try: actions[QKeyCombination(event.modifiers(), Qt.Key(event.key()))]() except KeyError: self.tableWidget_valuesearchtable.keyPressEvent_original(event) def tableWidget_valuesearchtable_context_menu_event(self, event: QContextMenuEvent) -> None: selected_indexes = self.tableWidget_valuesearchtable.selectionModel().selectedRows() if debugcore.currentpid == -1 or not selected_indexes: return current_row = self.tableWidget_valuesearchtable.currentItem().row() address = self.tableWidget_valuesearchtable.item(current_row, SEARCH_TABLE_ADDRESS_COL).text() menu = QMenu() if len(selected_indexes) > 1: copy_selection = menu.addAction(f"{tr.COPY_ADDRESSES}[Ctrl+C]") else: copy_selection = menu.addAction(f"{tr.COPY_ADDRESS}[Ctrl+C]") menu.addSeparator() browse_region = menu.addAction(f"{tr.BROWSE_MEMORY_REGION}[Ctrl+B]") disassemble = menu.addAction(f"{tr.DISASSEMBLE_ADDRESS}[Ctrl+D]") menu.addSeparator() delete_selection = menu.addAction(f"{tr.DELETE_SELECTION}[Del]") font_size = self.tableWidget_valuesearchtable.font().pointSize() menu.setStyleSheet(f"font-size: {font_size}pt;") action = menu.exec(event.globalPos()) actions = { copy_selection: self.copy_valuesearchtable_selection, browse_region: lambda: self.browse_region_for_address(address), disassemble: lambda: self.disassemble_for_address(address), delete_selection: self.delete_valuesearchtable_selection, } try: actions[action]() except KeyError: pass def copy_valuesearchtable_selection(self): selected_indexes = self.tableWidget_valuesearchtable.selectionModel().selectedRows() address_list = [] for index in selected_indexes: row = index.row() address = self.tableWidget_valuesearchtable.item(row, SEARCH_TABLE_ADDRESS_COL).text() address_list.append(address) app.clipboard().setText(" ".join(address_list)) def delete_valuesearchtable_selection(self): selected_rows = self.tableWidget_valuesearchtable.selectedItems() if not selected_rows: return # get the row indexes rows = set() for item in selected_rows: rows.add(item.row()) scanmem.send_command("delete {}".format(",".join([str(row) for row in rows]))) # remove the rows from the table - removing in reverse sorted order to avoid index issues for row in sorted(rows, reverse=True): self.tableWidget_valuesearchtable.removeRow(row) self.update_match_count() def comboBox_ValueType_current_index_changed(self): current_type = self.comboBox_ValueType.currentData(Qt.ItemDataRole.UserRole) scanmem_type = typedefs.scan_index_to_scanmem_dict[current_type] validator_str = scanmem_type # used to get the correct validator # TODO this can probably be made to look nicer, though it doesn't really matter if "int" in validator_str: validator_str = "int" self.checkBox_Hex.setEnabled(True) # keep hex validator if hex is checked if self.checkBox_Hex.isChecked(): validator_str = "int_hex" else: self.checkBox_Hex.setChecked(False) self.checkBox_Hex.setEnabled(False) if "float" in validator_str or validator_str == "number": validator_str = "float" self.comboBox_ScanType_init() self.lineEdit_Scan.setValidator(guiutils.validator_map[validator_str]) self.lineEdit_Scan2.setValidator(guiutils.validator_map[validator_str]) scanmem.send_command("option scan_data_type {}".format(scanmem_type)) # according to scanmem instructions you should always do `reset` after changing type scanmem.reset() def pushButton_AttachProcess_clicked(self): self.processwindow = ProcessForm(self) self.processwindow.show() def pushButton_Open_clicked(self): file_paths, _ = QFileDialog.getOpenFileNames(self, tr.OPEN_PCT_FILE, None, tr.FILE_TYPES_PCT) if not file_paths: return self.clear_address_table() for file_path in file_paths: content = utils.load_file(file_path) if content is None: QMessageBox.information(self, tr.ERROR, tr.FILE_LOAD_ERROR.format(file_path)) break self.insert_records( content, self.treeWidget_AddressTable.invisibleRootItem(), self.treeWidget_AddressTable.topLevelItemCount(), ) def pushButton_Save_clicked(self): file_path, _ = QFileDialog.getSaveFileName(self, tr.SAVE_PCT_FILE, None, tr.FILE_TYPES_PCT) if not file_path: return content = [ self.read_address_table_recursively(self.treeWidget_AddressTable.topLevelItem(i)) for i in range(self.treeWidget_AddressTable.topLevelItemCount()) ] file_path = utils.append_file_extension(file_path, "pct") if not utils.save_file(content, file_path): QMessageBox.information(self, tr.ERROR, tr.FILE_SAVE_ERROR) # Returns: a bool value indicates whether the operation succeeded. def attach_to_pid(self, pid: int): attach_result = debugcore.attach(pid, settings.gdb_path) if attach_result == typedefs.ATTACH_RESULT.SUCCESSFUL: self.apply_after_init() scanmem.pid(pid) ptrscan.set_process(pid) self.on_new_process() process_signals.attach.emit() # TODO: This makes PINCE call on_process_stop twice when attaching # TODO: Signal design might have to change to something like mutexes eventually self.memory_view_window.on_process_stop() debugcore.continue_inferior() return True else: messages = { typedefs.ATTACH_RESULT.ATTACH_SELF: tr.SMARTASS, # easter egg typedefs.ATTACH_RESULT.PROCESS_NOT_VALID: tr.PROCESS_NOT_VALID, typedefs.ATTACH_RESULT.ALREADY_DEBUGGING: tr.ALREADY_DEBUGGING, typedefs.ATTACH_RESULT.ALREADY_TRACED: tr.ALREADY_TRACED.format(utils.is_traced(pid)), typedefs.ATTACH_RESULT.PERM_DENIED: tr.PERM_DENIED, } QMessageBox.information(app.focusWidget(), tr.ERROR, messages[attach_result]) return False # Returns: a bool value indicates whether the operation succeeded. def create_new_process(self, file_path, args, ld_preload_path): if debugcore.create_process(file_path, args, ld_preload_path): self.apply_after_init() self.on_new_process() return True else: QMessageBox.information(app.focusWidget(), tr.ERROR, tr.CREATE_PROCESS_ERROR) self.on_inferior_exit() return False # Changes appearance whenever a new process is created or attached def on_new_process(self): name = utils.get_process_name(debugcore.currentpid) self.label_SelectedProcess.setText(str(debugcore.currentpid) + " - " + name) # enable scan GUI self.lineEdit_Scan.setPlaceholderText(tr.SCAN_FOR) self.QWidget_Toolbox.setEnabled(True) self.pushButton_NextScan.setEnabled(False) self.pushButton_UndoScan.setEnabled(False) self.pushButton_AddAddressManually.setEnabled(True) self.pushButton_MemoryView.setEnabled(True) # stop flashing attach button, timer will stop automatically on false value self.flashAttachButton = False def clear_address_table(self): if self.treeWidget_AddressTable.topLevelItemCount() == 0: return confirm_dialog = InputDialogForm(self, [(tr.CLEAR_TABLE,)]) if confirm_dialog.exec(): self.treeWidget_AddressTable.clear() def copy_to_address_table(self): i = -1 length = self._scan_to_length(self.comboBox_ValueType.currentData(Qt.ItemDataRole.UserRole)) for row in self.tableWidget_valuesearchtable.selectedItems(): i = i + 1 if i % 3 == 0: value_index, value_repr, endian = row.data(Qt.ItemDataRole.UserRole) vt = typedefs.ValueType(value_index, length, True, value_repr, endian) self.add_entry_to_addresstable(tr.NO_DESCRIPTION, row.text(), vt) self.update_address_table() def reset_scan(self): self.scan_mode = typedefs.SCAN_MODE.NEW self.pushButton_NewFirstScan.setText(tr.FIRST_SCAN) scanmem.reset() self.tableWidget_valuesearchtable.setRowCount(0) self.comboBox_ValueType.setEnabled(True) self.comboBox_ScanScope.setEnabled(True) self.comboBox_Endianness.setEnabled(True) self.pushButton_NextScan.setEnabled(False) self.pushButton_UndoScan.setEnabled(False) self.progressBar.setValue(0) self.label_MatchCount.setText(tr.MATCH_COUNT.format(0)) def on_inferior_exit(self): self.pushButton_MemoryView.setEnabled(False) self.pushButton_AddAddressManually.setEnabled(False) self.QWidget_Toolbox.setEnabled(False) self.lineEdit_Scan.setText("") self.reset_scan() self.on_status_running() self.flashAttachButton = True self.flashAttachButtonTimer.start(100) self.label_SelectedProcess.setText(tr.NO_PROCESS_SELECTED) self.memory_view_window.setWindowTitle(tr.NO_PROCESS_SELECTED) gdb_path = settings.gdb_path if os.environ.get("APPDIR"): gdb_path = utils.get_default_gdb_path() debugcore.init_gdb(gdb_path) self.apply_after_init() process_signals.exit.emit() def on_status_detached(self): self.label_SelectedProcess.setStyleSheet("color: blue") self.label_InferiorStatus.setText(tr.STATUS_DETACHED) self.label_InferiorStatus.setVisible(True) self.label_InferiorStatus.setStyleSheet("color: blue") def on_status_stopped(self): self.label_SelectedProcess.setStyleSheet("color: red") self.label_InferiorStatus.setText(tr.STATUS_STOPPED) self.label_InferiorStatus.setVisible(True) self.label_InferiorStatus.setStyleSheet("color: red") def on_status_running(self): self.label_SelectedProcess.setStyleSheet("") self.label_InferiorStatus.setVisible(False) # closes all windows on exit def closeEvent(self, event): debugcore.detach() app.closeAllWindows() # Call update_address_table manually after this def add_entry_to_addresstable(self, description, address_expr, value_type=None): current_row = QTreeWidgetItem() current_row.setCheckState(FROZEN_COL, Qt.CheckState.Unchecked) frozen = typedefs.Frozen("", typedefs.FREEZE_TYPE.DEFAULT) current_row.setData(FROZEN_COL, Qt.ItemDataRole.UserRole, frozen) value_type = typedefs.ValueType() if not value_type else value_type self.treeWidget_AddressTable.addTopLevelItem(current_row) self.change_address_table_entries(current_row, description, address_expr, value_type) self.show() # In case of getting called from elsewhere self.activateWindow() def treeWidget_AddressTable_item_double_clicked(self, row, column): action_for_column = { VALUE_COL: self.treeWidget_AddressTable_edit_value, DESC_COL: self.treeWidget_AddressTable_edit_desc, ADDR_COL: self.treeWidget_AddressTable_edit_address, TYPE_COL: self.treeWidget_AddressTable_edit_type, } action_for_column = collections.defaultdict(lambda *args: lambda: None, action_for_column) action_for_column[column]() # ---------------------------------------------------- # QTimer loops def update_progress_bar(self): value = int(round(scanmem.get_scan_progress() * 100)) self.progressBar.setValue(value) # Loop restarts itself to wait for function execution, same for the functions below def address_table_loop(self): if self.update_table and not exiting: try: self.update_address_table() except: traceback.print_exc() self.address_table_timer.start(self.table_update_interval) def search_table_loop(self): if not exiting: try: self.update_search_table() except: traceback.print_exc() self.search_table_timer.start(500) def freeze_loop(self): if not exiting: try: self.freeze() except: traceback.print_exc() self.freeze_timer.start(self.freeze_interval) # ---------------------------------------------------- def update_search_table(self): if debugcore.currentpid == -1: return row_count = self.tableWidget_valuesearchtable.rowCount() if row_count > 0: length = self._scan_to_length(self.comboBox_ValueType.currentData(Qt.ItemDataRole.UserRole)) mem_handle = debugcore.memory_handle() for row_index in range(row_count): address_item = self.tableWidget_valuesearchtable.item(row_index, SEARCH_TABLE_ADDRESS_COL) value_item = self.tableWidget_valuesearchtable.item(row_index, SEARCH_TABLE_VALUE_COL) previous_text = self.tableWidget_valuesearchtable.item(row_index, SEARCH_TABLE_PREVIOUS_COL).text() value_index, value_repr, endian = address_item.data(Qt.ItemDataRole.UserRole) address = address_item.text() new_value = str( debugcore.read_memory( address, value_index, length, value_repr=value_repr, endian=endian, mem_handle=mem_handle ) ) if new_value != previous_text: value_item.setForeground(QBrush(QColor(255, 0, 0))) value_item.setText(new_value) def freeze(self): if debugcore.currentpid == -1: return it = QTreeWidgetItemIterator(self.treeWidget_AddressTable) while True: row = it.value() if not row: break it += 1 if row.checkState(FROZEN_COL) == Qt.CheckState.Checked: vt: typedefs.ValueType = row.data(TYPE_COL, Qt.ItemDataRole.UserRole) address = row.text(ADDR_COL).strip("P->") frozen: typedefs.Frozen = row.data(FROZEN_COL, Qt.ItemDataRole.UserRole) value = frozen.value freeze_type = frozen.freeze_type if typedefs.VALUE_INDEX.is_number(vt.value_index): new_value = debugcore.read_memory(address, vt.value_index, endian=vt.endian) if new_value == None: continue if ( freeze_type == typedefs.FREEZE_TYPE.INCREMENT and new_value > value or freeze_type == typedefs.FREEZE_TYPE.DECREMENT and new_value < value ): frozen.value = new_value debugcore.write_memory(address, vt.value_index, new_value, endian=vt.endian) continue debugcore.write_memory(address, vt.value_index, value, vt.zero_terminate, vt.endian) def handle_freeze_change(self, row: QTreeWidgetItem, check_state: Qt.CheckState) -> None: frozen: typedefs.Frozen = row.data(FROZEN_COL, Qt.ItemDataRole.UserRole) is_checked = check_state == Qt.CheckState.Checked frozen_state_toggled = (is_checked and not frozen.enabled) or (not is_checked and frozen.enabled) row.setCheckState(FROZEN_COL, check_state) # this helps determine whether the user clicked checkbox or the text # if the user clicked the text, change the freeze type if frozen_state_toggled: if is_checked: frozen.enabled = True # reapply the freeze type, to reflect the current freeze type in the UI # otherwise the UI will show DEFAULT freeze type after enabling instead of the actual type self.change_freeze_type(frozen.freeze_type, row) vt: typedefs.ValueType = row.data(TYPE_COL, Qt.ItemDataRole.UserRole) frozen.value = utils.parse_string(row.text(VALUE_COL), vt.value_index) else: frozen.enabled = False # it has just been toggled off self.change_freeze_type(typedefs.FREEZE_TYPE.DEFAULT, row) def treeWidget_AddressTable_change_repr(self, new_repr): value_type = guiutils.get_current_item(self.treeWidget_AddressTable).data(TYPE_COL, Qt.ItemDataRole.UserRole) value_type.value_repr = new_repr for row in self.treeWidget_AddressTable.selectedItems(): row.setData(TYPE_COL, Qt.ItemDataRole.UserRole, value_type) row.setText(TYPE_COL, value_type.text()) self.update_address_table() def treeWidget_AddressTable_edit_value(self): row = guiutils.get_current_item(self.treeWidget_AddressTable) if not row: return value = row.text(VALUE_COL) value_index = row.data(TYPE_COL, Qt.ItemDataRole.UserRole).value_index dialog = InputDialogForm(self, [(tr.ENTER_VALUE, value)], 0, value_index) if dialog.exec(): new_value = dialog.get_values() for row in self.treeWidget_AddressTable.selectedItems(): address = row.text(ADDR_COL).strip("P->") vt: typedefs.ValueType = row.data(TYPE_COL, Qt.ItemDataRole.UserRole) parsed_value = utils.parse_string(new_value, vt.value_index) if typedefs.VALUE_INDEX.has_length(vt.value_index) and parsed_value != None: vt.length = len(parsed_value) row.setText(TYPE_COL, vt.text()) frozen: typedefs.Frozen = row.data(FROZEN_COL, Qt.ItemDataRole.UserRole) frozen.value = parsed_value debugcore.write_memory(address, vt.value_index, parsed_value, vt.zero_terminate, vt.endian) self.update_address_table() def treeWidget_AddressTable_edit_desc(self): row = guiutils.get_current_item(self.treeWidget_AddressTable) if not row: return description = row.text(DESC_COL) dialog = InputDialogForm(self, [(tr.ENTER_DESCRIPTION, description)]) if dialog.exec(): description_text = dialog.get_values() for row in self.treeWidget_AddressTable.selectedItems(): row.setText(DESC_COL, description_text) def treeWidget_AddressTable_edit_address(self): row = guiutils.get_current_item(self.treeWidget_AddressTable) if not row: return desc, address_expr, vt = self.read_address_table_entries(row) manual_address_dialog = ManualAddressDialogForm(self, desc, address_expr, vt) manual_address_dialog.setWindowTitle(tr.EDIT_ADDRESS) if manual_address_dialog.exec(): desc, address_expr, vt = manual_address_dialog.get_values() self.change_address_table_entries(row, desc, address_expr, vt) self.update_address_table() def treeWidget_AddressTable_edit_type(self): row = guiutils.get_current_item(self.treeWidget_AddressTable) if not row: return vt = row.data(TYPE_COL, Qt.ItemDataRole.UserRole) dialog = EditTypeDialogForm(self, vt) if dialog.exec(): vt = dialog.get_values() for row in self.treeWidget_AddressTable.selectedItems(): row.setData(TYPE_COL, Qt.ItemDataRole.UserRole, vt) row.setText(TYPE_COL, vt.text()) self.update_address_table() # Changes the column values of the given row def change_address_table_entries(self, row, description=tr.NO_DESCRIPTION, address_expr="", vt=None): assert isinstance(row, QTreeWidgetItem) row.setText(DESC_COL, description) row.setData(ADDR_COL, Qt.ItemDataRole.UserRole, address_expr) row.setData(TYPE_COL, Qt.ItemDataRole.UserRole, vt) row.setText(TYPE_COL, vt.text()) # Returns the column values of the given row def read_address_table_entries(self, row, serialize=False): description = row.text(DESC_COL) if serialize: address_data = row.data(ADDR_COL, Qt.ItemDataRole.UserRole) if isinstance(address_data, typedefs.PointerChainRequest): address_expr = address_data.serialize() else: address_expr = address_data value_type = row.data(TYPE_COL, Qt.ItemDataRole.UserRole).serialize() else: address_expr = row.data(ADDR_COL, Qt.ItemDataRole.UserRole) value_type = row.data(TYPE_COL, Qt.ItemDataRole.UserRole) return description, address_expr, value_type # Returns the values inside the given row and all of its descendants. # All values except the last are the same as read_address_table_entries output. # Last value is an iterable of information about its direct children. def read_address_table_recursively(self, row): return self.read_address_table_entries(row, True) + ( [self.read_address_table_recursively(row.child(i)) for i in range(row.childCount())], ) # Flashing Attach Button when the process is not attached def flash_attach_button(self): if not self.flashAttachButton: self.flashAttachButtonTimer.stop() self.pushButton_AttachProcess.setStyleSheet("") return case = self.flashAttachButton_gradiantState % 32 if case < 16: borderstring = "QPushButton {border: 3px solid rgba(0,255,0," + str(case / 16) + ");}" else: borderstring = "QPushButton {border: 3px solid rgba(0,255,0," + str((32 - case) / 16) + ");}" self.pushButton_AttachProcess.setStyleSheet(borderstring) self.flashAttachButton_gradiantState += 1 if self.flashAttachButton_gradiantState > 768: # 32*24 self.flashAttachButton_gradiantState = 0 # process select window class ProcessForm(QMainWindow, ProcessWindow): def __init__(self, parent=None): super().__init__(parent) self.setupUi(self) self.refresh_process_table(self.tableWidget_ProcessTable, utils.get_process_list()) self.pushButton_Close.clicked.connect(self.close) self.pushButton_Open.clicked.connect(self.pushButton_Open_clicked) self.pushButton_CreateProcess.clicked.connect(self.pushButton_CreateProcess_clicked) self.lineEdit_SearchProcess.textChanged.connect(self.generate_new_list) self.tableWidget_ProcessTable.itemDoubleClicked.connect(self.pushButton_Open_clicked) guiutils.center_to_parent(self) # refreshes process list def generate_new_list(self): text = self.lineEdit_SearchProcess.text() processlist = utils.search_processes(text) self.refresh_process_table(self.tableWidget_ProcessTable, processlist) def keyPressEvent(self, event): if event.key() == Qt.Key.Key_Escape: self.close() elif event.key() == Qt.Key.Key_Return or event.key() == Qt.Key.Key_Enter: self.pushButton_Open_clicked() elif event.key() == Qt.Key.Key_F1: self.pushButton_CreateProcess_clicked() else: return super().keyPressEvent(event) # lists currently working processes to table def refresh_process_table(self, tablewidget, processlist): tablewidget.setRowCount(0) for pid, user, name in processlist: current_row = tablewidget.rowCount() tablewidget.insertRow(current_row) tablewidget.setItem(current_row, 0, QTableWidgetItem(pid)) tablewidget.setItem(current_row, 1, QTableWidgetItem(user)) tablewidget.setItem(current_row, 2, QTableWidgetItem(name)) # gets the pid out of the selection to attach def pushButton_Open_clicked(self): index = self.tableWidget_ProcessTable.currentIndex() row_count = self.tableWidget_ProcessTable.rowCount() if index.row() == -1 and row_count == 1: # autoselect first row if there is only one row self.tableWidget_ProcessTable.setCurrentCell(0, 0) current_item = self.tableWidget_ProcessTable.item(self.tableWidget_ProcessTable.currentIndex().row(), 0) if current_item is None: QMessageBox.information(self, tr.ERROR, tr.SELECT_PROCESS) else: pid = int(current_item.text()) self.setCursor(QCursor(Qt.CursorShape.WaitCursor)) if self.parent().attach_to_pid(pid): self.close() self.setCursor(QCursor(Qt.CursorShape.ArrowCursor)) def pushButton_CreateProcess_clicked(self): file_path, _ = QFileDialog.getOpenFileName(self, tr.SELECT_BINARY) if file_path: items = [(tr.ENTER_OPTIONAL_ARGS, ""), (tr.LD_PRELOAD_OPTIONAL, "")] arg_dialog = InputDialogForm(self, items) if arg_dialog.exec(): args, ld_preload_path = arg_dialog.get_values() else: return self.setCursor(QCursor(Qt.CursorShape.WaitCursor)) if self.parent().create_new_process(file_path, args, ld_preload_path): self.close() self.setCursor(QCursor(Qt.CursorShape.ArrowCursor)) # Add Address Manually Dialog class ManualAddressDialogForm(QDialog, ManualAddressDialog): def __init__(self, parent, description=tr.NO_DESCRIPTION, address="0x", value_type=None): super().__init__(parent) self.setupUi(self) self.lineEdit_PtrStartAddress.setFixedWidth(180) self.lineEdit_Address.setFixedWidth(180) vt = typedefs.ValueType() if not value_type else value_type self.lineEdit_Length.setValidator(QHexValidator(99, self)) guiutils.fill_value_combobox(self.comboBox_ValueType, vt.value_index) guiutils.fill_endianness_combobox(self.comboBox_Endianness, vt.endian) self.lineEdit_Description.setText(description) self.lineEdit_Description.setFixedWidth(180) self.offsetsList: list[PointerChainOffset] = [] if not isinstance(address, typedefs.PointerChainRequest): self.lineEdit_Address.setText(address) self.widget_Pointer.hide() else: self.checkBox_IsPointer.setChecked(True) self.lineEdit_Address.setReadOnly(True) self.lineEdit_PtrStartAddress.setText(address.get_base_address_as_str()) self.create_offsets_list(address) self.widget_Pointer.show() if typedefs.VALUE_INDEX.is_string(self.comboBox_ValueType.currentIndex()): self.widget_Length.show() try: length = str(vt.length) except: length = "10" self.lineEdit_Length.setText(length) self.checkBox_ZeroTerminate.show() self.checkBox_ZeroTerminate.setChecked(vt.zero_terminate) elif self.comboBox_ValueType.currentIndex() == typedefs.VALUE_INDEX.AOB: self.widget_Length.show() try: length = str(vt.length) except: length = "10" self.lineEdit_Length.setText(length) self.checkBox_ZeroTerminate.hide() else: self.widget_Length.hide() if vt.value_repr == typedefs.VALUE_REPR.HEX: self.checkBox_Hex.setChecked(True) self.checkBox_Signed.setEnabled(False) elif vt.value_repr == typedefs.VALUE_REPR.SIGNED: self.checkBox_Signed.setChecked(True) else: self.checkBox_Signed.setChecked(False) self.comboBox_ValueType.currentIndexChanged.connect(self.comboBox_ValueType_current_index_changed) self.comboBox_Endianness.currentIndexChanged.connect(self.update_value) self.lineEdit_Length.textChanged.connect(self.update_value) self.checkBox_Hex.stateChanged.connect(self.repr_changed) self.checkBox_Signed.stateChanged.connect(self.repr_changed) self.checkBox_ZeroTerminate.stateChanged.connect(self.update_value) self.checkBox_IsPointer.stateChanged.connect(self.checkBox_IsPointer_state_changed) self.lineEdit_PtrStartAddress.textChanged.connect(self.update_value) self.lineEdit_Address.textChanged.connect(self.update_value) self.pushButton_AddOffset.clicked.connect(lambda: self.addOffsetLayout(True)) self.pushButton_RemoveOffset.clicked.connect(self.removeOffsetLayout) self.label_Value.contextMenuEvent = self.label_Value_context_menu_event self.update_value() guiutils.center_to_parent(self) def label_Value_context_menu_event(self, event): menu = QMenu() refresh = menu.addAction(tr.REFRESH) font_size = self.label_Value.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = {refresh: self.update_value} try: actions[action]() except KeyError: pass def addOffsetLayout(self, should_update=True): offsetFrame = PointerChainOffset(len(self.offsetsList), self.widget_Pointer) self.offsetsList.append(offsetFrame) self.verticalLayout_Pointers.insertWidget(0, self.offsetsList[-1]) offsetFrame.offset_changed_signal.connect(self.update_value) if should_update: self.update_value() def removeOffsetLayout(self): if len(self.offsetsList) == 1: return frame = self.offsetsList[-1] frame.deleteLater() self.verticalLayout_Pointers.removeWidget(frame) del self.offsetsList[-1] self.update_value() def update_deref_labels(self, pointer_chain_result: typedefs.PointerChainResult): if pointer_chain_result != None: base_deref = utils.upper_hex(hex(pointer_chain_result.pointer_chain[0])) self.label_BaseAddressDeref.setText(f" {base_deref}") for index, offsetFrame in enumerate(self.offsetsList): previousDerefText = self.caps_hex_or_error_indicator(pointer_chain_result.pointer_chain[index]) currentDerefText = self.caps_hex_or_error_indicator(pointer_chain_result.pointer_chain[index + 1]) offsetText = utils.upper_hex(offsetFrame.offsetText.text()) operationalSign = "" if offsetText.startswith("-") else "+" calculation = f"{previousDerefText}{operationalSign}{offsetText}" if index != len(self.offsetsList) - 1: offsetFrame.update_deref_label(f" [{calculation}] {currentDerefText}") else: offsetFrame.update_deref_label(f" {calculation} = {currentDerefText}") else: self.label_BaseAddressDeref.setText(" <font color=red>??</font>") for offsetFrame in self.offsetsList: offsetFrame.update_deref_label(" <font color=red>??</font>") def caps_hex_or_error_indicator(self, address: int): if address == 0: return "<font color=red>??</font>" return utils.upper_hex(hex(address)) def update_value(self): if self.checkBox_IsPointer.isChecked(): hex_converted_expr = debugcore.convert_to_hex(self.lineEdit_PtrStartAddress.text()) pointer_chain_req = typedefs.PointerChainRequest(hex_converted_expr, self.get_offsets_int_list()) pointer_chain_result = debugcore.read_pointer_chain(pointer_chain_req) address = None if pointer_chain_result != None: address_text = pointer_chain_result.get_final_address_as_hex() address = pointer_chain_result.get_final_address() else: address_text = "??" self.lineEdit_Address.setText(address_text) self.update_deref_labels(pointer_chain_result) else: hex_converted_expr = debugcore.convert_to_hex(self.lineEdit_Address.text()) address = debugcore.examine_expression(hex_converted_expr).address if self.checkBox_Hex.isChecked(): value_repr = typedefs.VALUE_REPR.HEX elif self.checkBox_Signed.isChecked(): value_repr = typedefs.VALUE_REPR.SIGNED else: value_repr = typedefs.VALUE_REPR.UNSIGNED address_type = self.comboBox_ValueType.currentIndex() length = self.lineEdit_Length.text() zero_terminate = self.checkBox_ZeroTerminate.isChecked() endian = self.comboBox_Endianness.currentData(Qt.ItemDataRole.UserRole) value = debugcore.read_memory(address, address_type, length, zero_terminate, value_repr, endian) self.label_Value.setText("<font color=red>??</font>" if value is None else str(value)) old_width = self.width() app.processEvents() self.adjustSize() self.resize(old_width, self.minimumHeight()) def comboBox_ValueType_current_index_changed(self): if typedefs.VALUE_INDEX.is_string(self.comboBox_ValueType.currentIndex()): self.widget_Length.show() self.checkBox_ZeroTerminate.show() elif self.comboBox_ValueType.currentIndex() == typedefs.VALUE_INDEX.AOB: self.widget_Length.show() self.checkBox_ZeroTerminate.hide() else: self.widget_Length.hide() self.update_value() def repr_changed(self): if self.checkBox_Hex.isChecked(): self.checkBox_Signed.setEnabled(False) else: self.checkBox_Signed.setEnabled(True) self.update_value() def checkBox_IsPointer_state_changed(self): if self.checkBox_IsPointer.isChecked(): self.lineEdit_Address.setReadOnly(True) self.lineEdit_PtrStartAddress.setText(self.lineEdit_Address.text()) if len(self.offsetsList) == 0: self.addOffsetLayout(False) self.widget_Pointer.show() else: self.lineEdit_Address.setText(self.lineEdit_PtrStartAddress.text()) self.lineEdit_PtrStartAddress.setText("") self.lineEdit_Address.setReadOnly(False) self.widget_Pointer.hide() self.update_value() def reject(self): super().reject() def accept(self): if self.label_Length.isVisible(): length = self.lineEdit_Length.text() try: length = int(length, 0) except: QMessageBox.information(self, tr.ERROR, tr.LENGTH_NOT_VALID) return if not length > 0: QMessageBox.information(self, tr.ERROR, tr.LENGTH_GT) return super().accept() def get_values(self): description = self.lineEdit_Description.text() length = self.lineEdit_Length.text() try: length = int(length, 0) except: length = 0 zero_terminate = self.checkBox_ZeroTerminate.isChecked() value_index = self.comboBox_ValueType.currentIndex() if self.checkBox_Hex.isChecked(): value_repr = typedefs.VALUE_REPR.HEX elif self.checkBox_Signed.isChecked(): value_repr = typedefs.VALUE_REPR.SIGNED else: value_repr = typedefs.VALUE_REPR.UNSIGNED endian = self.comboBox_Endianness.currentData(Qt.ItemDataRole.UserRole) vt = typedefs.ValueType(value_index, length, zero_terminate, value_repr, endian) if self.checkBox_IsPointer.isChecked(): base_expression = debugcore.convert_to_hex(self.lineEdit_PtrStartAddress.text()) address = typedefs.PointerChainRequest(base_expression, self.get_offsets_int_list()) else: address = debugcore.convert_to_hex(self.lineEdit_Address.text()) return description, address, vt def get_offsets_int_list(self): offsetsIntList = [] for frame in self.offsetsList: offsetText = frame.layout().itemAt(1).widget().text() try: offsetValue = int(offsetText, 16) except ValueError: offsetValue = 0 offsetsIntList.append(offsetValue) return offsetsIntList def create_offsets_list(self, pointer_chain_req: typedefs.PointerChainRequest): if not isinstance(pointer_chain_req, typedefs.PointerChainRequest): raise TypeError("Passed non-PointerChainRequest type to create_offsets_list!") for offset in pointer_chain_req.offsets_list: self.addOffsetLayout(False) frame = self.offsetsList[-1] frame.layout().itemAt(1).widget().setText(hex(offset)) def on_offset_arrow_clicked(self, offsetTextWidget, operator_func): offsetText = offsetTextWidget.text() try: offsetValue = int(offsetText, 16) except ValueError: offsetValue = 0 sizeVal = typedefs.index_to_valuetype_dict[self.comboBox_ValueType.currentIndex()][0] offsetValue = operator_func(offsetValue, sizeVal) offsetTextWidget.setText(hex(offsetValue)) def get_type_size(self): return typedefs.index_to_valuetype_dict[self.comboBox_ValueType.currentIndex()][0] class EditTypeDialogForm(QDialog, EditTypeDialog): def __init__(self, parent, value_type=None): super().__init__(parent) self.setupUi(self) vt = typedefs.ValueType() if not value_type else value_type self.lineEdit_Length.setValidator(QHexValidator(99, self)) self.lineEdit_Length.setFixedWidth(40) guiutils.fill_value_combobox(self.comboBox_ValueType, vt.value_index) guiutils.fill_endianness_combobox(self.comboBox_Endianness, vt.endian) if typedefs.VALUE_INDEX.is_string(self.comboBox_ValueType.currentIndex()): self.widget_Length.show() try: length = str(vt.length) except: length = "10" self.lineEdit_Length.setText(length) self.checkBox_ZeroTerminate.show() self.checkBox_ZeroTerminate.setChecked(vt.zero_terminate) elif self.comboBox_ValueType.currentIndex() == typedefs.VALUE_INDEX.AOB: self.widget_Length.show() try: length = str(vt.length) except: length = "10" self.lineEdit_Length.setText(length) self.checkBox_ZeroTerminate.hide() else: self.widget_Length.hide() if vt.value_repr == typedefs.VALUE_REPR.HEX: self.checkBox_Hex.setChecked(True) self.checkBox_Signed.setEnabled(False) elif vt.value_repr == typedefs.VALUE_REPR.SIGNED: self.checkBox_Signed.setChecked(True) else: self.checkBox_Signed.setChecked(False) self.comboBox_ValueType.currentIndexChanged.connect(self.comboBox_ValueType_current_index_changed) self.checkBox_Hex.stateChanged.connect(self.repr_changed) app.processEvents() self.adjustSize() guiutils.center_to_parent(self) def comboBox_ValueType_current_index_changed(self): if typedefs.VALUE_INDEX.is_string(self.comboBox_ValueType.currentIndex()): self.widget_Length.show() self.checkBox_ZeroTerminate.show() elif self.comboBox_ValueType.currentIndex() == typedefs.VALUE_INDEX.AOB: self.widget_Length.show() self.checkBox_ZeroTerminate.hide() else: self.widget_Length.hide() app.processEvents() self.adjustSize() def repr_changed(self): if self.checkBox_Hex.isChecked(): self.checkBox_Signed.setEnabled(False) else: self.checkBox_Signed.setEnabled(True) def reject(self): super().reject() def accept(self): if self.label_Length.isVisible(): length = self.lineEdit_Length.text() try: length = int(length, 0) except: QMessageBox.information(self, tr.ERROR, tr.LENGTH_NOT_VALID) return if not length > 0: QMessageBox.information(self, tr.ERROR, tr.LENGTH_GT) return super().accept() def get_values(self): value_index = self.comboBox_ValueType.currentIndex() length = self.lineEdit_Length.text() try: length = int(length, 0) except: length = 0 zero_terminate = self.checkBox_ZeroTerminate.isChecked() if self.checkBox_Hex.isChecked(): value_repr = typedefs.VALUE_REPR.HEX elif self.checkBox_Signed.isChecked(): value_repr = typedefs.VALUE_REPR.SIGNED else: value_repr = typedefs.VALUE_REPR.UNSIGNED endian = self.comboBox_Endianness.currentData(Qt.ItemDataRole.UserRole) return typedefs.ValueType(value_index, length, zero_terminate, value_repr, endian) class TrackSelectorDialogForm(QDialog, TrackSelectorDialog): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.selection = None self.pushButton_Pointer.clicked.connect(lambda: self.change_selection("pointer")) self.pushButton_Pointed.clicked.connect(lambda: self.change_selection("pointed")) guiutils.center_to_parent(self) def change_selection(self, selection): self.selection = selection self.close() class LoadingDialogForm(QDialog, LoadingDialog): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(self.windowFlags()) self.keyPressEvent = QEvent.ignore # Make use of this background_thread when you spawn a LoadingDialogForm # Warning: overrided_func() can only return one value, so if your overridden function returns more than one # value, refactor your overriden function to return only one object(convert tuple to list etc.) # Check refresh_table method of FunctionsInfoWidgetForm for exemplary usage self.background_thread = self.BackgroundThread() self.background_thread.output_ready.connect(self.accept) self.pushButton_Cancel.clicked.connect(self.close) media_directory = utils.get_media_directory() self.movie = QMovie(media_directory + "/LoadingDialog/ajax-loader.gif", QByteArray()) self.label_Animated.setMovie(self.movie) self.movie.setScaledSize(QSize(25, 25)) self.movie.setCacheMode(QMovie.CacheMode.CacheAll) self.movie.setSpeed(100) self.movie.start() guiutils.center_to_parent(self) # TODO: This function only cancels the last command sent, redesign this if it's needed to cancel non-gdb functions def cancel_thread(self): debugcore.cancel_last_command() self.background_thread.wait() def exec(self): self.background_thread.start() super().exec() def closeEvent(self, event: QCloseEvent): self.cancel_thread() super().closeEvent(event) class BackgroundThread(QThread): output_ready = pyqtSignal(object) def __init__(self): super().__init__() # Unhandled exceptions in this thread freezes PINCE def run(self): try: output = self.overrided_func() except: traceback.print_exc() output = None self.output_ready.emit(output) def overrided_func(self): print("Override this function") return 0 class InputDialogForm(QDialog, InputDialog): # Format of item_list->[(label_str, item_data, label_alignment), ...] # If label_str is None, no label will be created # If item_data is None, no input field will be created. If it's str, a QLineEdit containing the str will be created # If it's a list, a QComboBox with the items in the list will be created, last item of the list should be an integer # that points the current index of the QComboBox, for instance: ["0", "1", 1] will create a QCombobox with the items # "0" and "1" then will set current index to 1 (which is the item "1") # label_alignment is optional def __init__( self, parent, item_list=None, parsed_index=-1, value_index=typedefs.VALUE_INDEX.INT32, buttons=(QDialogButtonBox.StandardButton.Ok, QDialogButtonBox.StandardButton.Cancel), ): super().__init__(parent) self.setupUi(self) for button in buttons: self.buttonBox.addButton(button) self.object_list = [] for item in item_list: if item[0] is not None: label = QLabel(self) try: label.setAlignment(item[2]) except IndexError: label.setAlignment(Qt.AlignmentFlag.AlignCenter) label.setText(item[0]) label.setTextInteractionFlags( Qt.TextInteractionFlag.LinksAccessibleByMouse | Qt.TextInteractionFlag.TextSelectableByMouse ) self.verticalLayout.addWidget(label) try: item_data = item[1] except IndexError: pass else: if item_data is not None: if type(item_data) is str: lineedit = QLineEdit(self) lineedit.setText(item_data) self.verticalLayout.addWidget(lineedit) self.object_list.append(lineedit) elif type(item_data) is list: combobox = QComboBox(self) current_index = item_data.pop() combobox.addItems(item_data) combobox.setCurrentIndex(current_index) self.verticalLayout.addWidget(combobox) self.object_list.append(combobox) self.adjustSize() self.verticalLayout.removeWidget(self.buttonBox) # Pushing buttonBox to the end self.verticalLayout.addWidget(self.buttonBox) for widget in guiutils.get_layout_widgets(self.verticalLayout): if isinstance(widget, QLabel): continue widget.setFocus() # Focus to the first input field break self.parsed_index = parsed_index self.value_index = value_index guiutils.center_to_parent(self) def get_text(self, item): try: string = item.text() except AttributeError: string = item.currentText() return string def get_values(self): return ( self.get_text(self.object_list[0]) if len(self.object_list) == 1 else [self.get_text(item) for item in self.object_list] ) def accept(self): if self.parsed_index != -1: item = self.object_list[self.parsed_index] if utils.parse_string(self.get_text(item), self.value_index) is None: QMessageBox.information(self, tr.ERROR, tr.PARSE_ERROR) return super().accept() class TextEditDialogForm(QDialog, TextEditDialog): def __init__(self, parent, text=""): super().__init__(parent) self.setupUi(self) self.textEdit.setPlainText(str(text)) self.accept_shortcut = QShortcut(QKeySequence("Ctrl+Return"), self) self.accept_shortcut.activated.connect(self.accept) guiutils.center_to_parent(self) def get_values(self): return self.textEdit.toPlainText() def keyPressEvent(self, QKeyEvent): if QKeyEvent.key() == Qt.Key.Key_Enter: pass else: super().keyPressEvent(QKeyEvent) class SettingsDialogForm(QDialog, SettingsDialog): def __init__(self, parent, set_default_settings_func): super().__init__(parent) self.setupUi(self) self.settings = QSettings() self.set_default_settings = set_default_settings_func self.hotkey_to_value = {} # Dict[str:str]-->Dict[Hotkey.name:settings_value] self.handle_signals_data = "" icons_directory = guiutils.get_icons_directory() self.pushButton_GDBPath.setIcon(QIcon(QPixmap(icons_directory + "/folder.png"))) locale_model = QStandardItemModel() for loc, name in language_list.items(): item = QStandardItem() item.setData(name, Qt.ItemDataRole.DisplayRole) item.setData(loc, Qt.ItemDataRole.UserRole) locale_model.appendRow(item) self.comboBox_Language.setModel(locale_model) self.comboBox_InterruptSignal.addItem("SIGINT") self.comboBox_InterruptSignal.addItems([f"SIG{x}" for x in range(signal.SIGRTMIN, signal.SIGRTMAX + 1)]) self.comboBox_InterruptSignal.setStyleSheet("combobox-popup: 0;") # maxVisibleItems doesn't work otherwise self.comboBox_Theme.addItems(theme_list) logo_directory = utils.get_logo_directory() logo_list = utils.search_files(logo_directory, r"\.(png|jpg|jpeg|svg)$") for logo in logo_list: self.comboBox_Logo.addItem(QIcon(os.path.join(logo_directory, logo)), logo) for hotkey in hotkeys.get_hotkeys(): self.listWidget_Functions.addItem(hotkey.desc) self.config_gui() self.listWidget_Options.currentRowChanged.connect(self.change_display) self.listWidget_Functions.currentRowChanged.connect(self.listWidget_Functions_current_row_changed) self.pushButton_ClearHotkey.clicked.connect(self.pushButton_ClearHotkey_clicked) self.pushButton_ResetSettings.clicked.connect(self.pushButton_ResetSettings_clicked) self.pushButton_GDBPath.clicked.connect(self.pushButton_GDBPath_clicked) self.checkBox_AutoUpdateAddressTable.stateChanged.connect(self.checkBox_AutoUpdateAddressTable_state_changed) self.checkBox_AutoAttachRegex.stateChanged.connect(self.checkBox_AutoAttachRegex_state_changed) self.comboBox_Logo.currentIndexChanged.connect(self.comboBox_Logo_current_index_changed) self.comboBox_Theme.currentIndexChanged.connect(self.comboBox_Theme_current_index_changed) self.pushButton_HandleSignals.clicked.connect(self.pushButton_HandleSignals_clicked) self.lineEdit_Hotkey.keyPressEvent = self.lineEdit_Hotkey_key_pressed_event guiutils.center_to_parent(self) def accept(self): self.settings.setValue("General/auto_update_address_table", self.checkBox_AutoUpdateAddressTable.isChecked()) if self.checkBox_AutoUpdateAddressTable.isChecked(): self.settings.setValue("General/address_table_update_interval", self.spinBox_UpdateInterval.value()) self.settings.setValue("General/freeze_interval", self.spinBox_FreezeInterval.value()) output_mode = [ self.checkBox_OutputModeAsync.isChecked(), self.checkBox_OutputModeCommand.isChecked(), self.checkBox_OutputModeCommandInfo.isChecked(), ] self.settings.setValue("General/gdb_output_mode", json.dumps(output_mode)) if self.checkBox_AutoAttachRegex.isChecked(): try: re.compile(self.lineEdit_AutoAttach.text()) except: QMessageBox.information(self, tr.ERROR, tr.IS_INVALID_REGEX.format(self.lineEdit_AutoAttach.text())) return self.settings.setValue("General/auto_attach", self.lineEdit_AutoAttach.text()) self.settings.setValue("General/auto_attach_regex", self.checkBox_AutoAttachRegex.isChecked()) new_locale = self.comboBox_Language.currentData(Qt.ItemDataRole.UserRole) if new_locale != settings.locale: QMessageBox.information(self, tr.INFO, tr.LANG_RESET) self.settings.setValue("General/locale", new_locale) self.settings.setValue("General/logo_path", self.comboBox_Logo.currentText()) self.settings.setValue("General/theme", self.comboBox_Theme.currentText()) for hotkey in hotkeys.get_hotkeys(): self.settings.setValue("Hotkeys/" + hotkey.name, self.hotkey_to_value[hotkey.name]) if self.radioButton_SimpleDLopenCall.isChecked(): injection_method = typedefs.INJECTION_METHOD.DLOPEN elif self.radioButton_AdvancedInjection.isChecked(): injection_method = typedefs.INJECTION_METHOD.ADVANCED self.settings.setValue("CodeInjection/code_injection_method", injection_method) self.settings.setValue("MemoryView/show_memory_view_on_stop", self.checkBox_ShowMemoryViewOnStop.isChecked()) self.settings.setValue("MemoryView/instructions_per_scroll", self.spinBox_InstructionsPerScroll.value()) self.settings.setValue("MemoryView/bytes_per_scroll", self.spinBox_BytesPerScroll.value()) if not os.environ.get("APPDIR"): selected_gdb_path = self.lineEdit_GDBPath.text() current_gdb_path = self.settings.value("Debug/gdb_path", type=str) if selected_gdb_path != current_gdb_path: if InputDialogForm(self, [(tr.GDB_RESET,)]).exec(): debugcore.init_gdb(selected_gdb_path) self.settings.setValue("Debug/gdb_path", selected_gdb_path) self.settings.setValue("Debug/gdb_logging", self.checkBox_GDBLogging.isChecked()) self.settings.setValue("Debug/interrupt_signal", self.comboBox_InterruptSignal.currentText()) self.settings.setValue("Java/ignore_segfault", self.checkBox_JavaSegfault.isChecked()) if self.handle_signals_data: self.settings.setValue("Debug/handle_signals", self.handle_signals_data) super().accept() def reject(self): logo_path = self.settings.value("General/logo_path", type=str) app.setWindowIcon(QIcon(os.path.join(utils.get_logo_directory(), logo_path))) theme = self.settings.value("General/theme", type=str) app.setPalette(get_theme(theme)) super().reject() def config_gui(self): self.checkBox_AutoUpdateAddressTable.setChecked( self.settings.value("General/auto_update_address_table", type=bool) ) self.spinBox_UpdateInterval.setValue(self.settings.value("General/address_table_update_interval", type=int)) self.spinBox_FreezeInterval.setValue(self.settings.value("General/freeze_interval", type=int)) output_mode = json.loads(self.settings.value("General/gdb_output_mode", type=str)) output_mode = typedefs.gdb_output_mode(*output_mode) self.checkBox_OutputModeAsync.setChecked(output_mode.async_output) self.checkBox_OutputModeCommand.setChecked(output_mode.command_output) self.checkBox_OutputModeCommandInfo.setChecked(output_mode.command_info) self.lineEdit_AutoAttach.setText(self.settings.value("General/auto_attach", type=str)) self.checkBox_AutoAttachRegex.setChecked(self.settings.value("General/auto_attach_regex", type=bool)) current_locale = self.settings.value("General/locale", type=str) self.comboBox_Language.setCurrentText(language_list.get(current_locale, "en_US")) with QSignalBlocker(self.comboBox_Theme): self.comboBox_Theme.setCurrentText(self.settings.value("General/theme", type=str)) with QSignalBlocker(self.comboBox_Logo): self.comboBox_Logo.setCurrentText(self.settings.value("General/logo_path", type=str)) self.hotkey_to_value.clear() for hotkey in hotkeys.get_hotkeys(): self.hotkey_to_value[hotkey.name] = self.settings.value("Hotkeys/" + hotkey.name) self.listWidget_Functions_current_row_changed(self.listWidget_Functions.currentRow()) code_injection_method = self.settings.value("CodeInjection/code_injection_method", type=int) if code_injection_method == typedefs.INJECTION_METHOD.DLOPEN: self.radioButton_SimpleDLopenCall.setChecked(True) elif code_injection_method == typedefs.INJECTION_METHOD.ADVANCED: self.radioButton_AdvancedInjection.setChecked(True) self.checkBox_ShowMemoryViewOnStop.setChecked( self.settings.value("MemoryView/show_memory_view_on_stop", type=bool) ) self.spinBox_InstructionsPerScroll.setValue(self.settings.value("MemoryView/instructions_per_scroll", type=int)) self.spinBox_BytesPerScroll.setValue(self.settings.value("MemoryView/bytes_per_scroll", type=int)) self.lineEdit_GDBPath.setText(str(self.settings.value("Debug/gdb_path", type=str))) if os.environ.get("APPDIR"): self.label_GDBPath.setDisabled(True) self.label_GDBPath.setToolTip(tr.UNUSED_APPIMAGE_SETTING) self.lineEdit_GDBPath.setDisabled(True) self.lineEdit_GDBPath.setToolTip(tr.UNUSED_APPIMAGE_SETTING) self.pushButton_GDBPath.setDisabled(True) self.pushButton_GDBPath.setToolTip(tr.UNUSED_APPIMAGE_SETTING) self.checkBox_GDBLogging.setChecked(self.settings.value("Debug/gdb_logging", type=bool)) self.comboBox_InterruptSignal.setCurrentText(self.settings.value("Debug/interrupt_signal", type=str)) self.checkBox_JavaSegfault.setChecked(self.settings.value("Java/ignore_segfault", type=bool)) def change_display(self, index): self.stackedWidget.setCurrentIndex(index) def listWidget_Functions_current_row_changed(self, index): if index == -1: self.lineEdit_Hotkey.clear() else: self.lineEdit_Hotkey.setText(self.hotkey_to_value[hotkeys.get_hotkeys()[index].name]) def pushButton_ClearHotkey_clicked(self): self.lineEdit_Hotkey.clear() def pushButton_ResetSettings_clicked(self): confirm_dialog = InputDialogForm(self, [(tr.RESET_DEFAULT_SETTINGS,)]) if confirm_dialog.exec(): self.set_default_settings() self.handle_signals_data = "" self.config_gui() def checkBox_AutoUpdateAddressTable_state_changed(self): if self.checkBox_AutoUpdateAddressTable.isChecked(): self.QWidget_UpdateInterval.setEnabled(True) else: self.QWidget_UpdateInterval.setEnabled(False) def checkBox_AutoAttachRegex_state_changed(self): if self.checkBox_AutoAttachRegex.isChecked(): self.lineEdit_AutoAttach.setPlaceholderText(tr.MOUSE_OVER_EXAMPLES) self.lineEdit_AutoAttach.setToolTip(tr.AUTO_ATTACH_TOOLTIP) else: self.lineEdit_AutoAttach.setPlaceholderText(tr.SEPARATE_PROCESSES_WITH.format(";")) self.lineEdit_AutoAttach.setToolTip("") def comboBox_Logo_current_index_changed(self): logo_path = self.comboBox_Logo.currentText() app.setWindowIcon(QIcon(os.path.join(utils.get_logo_directory(), logo_path))) def comboBox_Theme_current_index_changed(self): app.setPalette(get_theme(self.comboBox_Theme.currentText())) def pushButton_GDBPath_clicked(self): current_path = self.lineEdit_GDBPath.text() file_path, _ = QFileDialog.getOpenFileName(self, tr.SELECT_GDB_BINARY, os.path.dirname(current_path)) if file_path: self.lineEdit_GDBPath.setText(file_path) def pushButton_HandleSignals_clicked(self): if not self.handle_signals_data: self.handle_signals_data = self.settings.value("Debug/handle_signals", type=str) signal_dialog = HandleSignalsDialogForm(self, self.handle_signals_data) if signal_dialog.exec(): self.handle_signals_data = signal_dialog.get_values() def lineEdit_Hotkey_key_pressed_event(self, event: QKeyEvent): """ Instead of relying on the QT Event, we grab input from keyboard lib directly. This reduces the amount of parsing from keys necessary and catches some more edge cases. One final caveat exists: system hotkeys or system wide defined hotkeys (xserver) take precedence over the keyboard lib and are not caught completely. """ pressed_events: list[KeyboardEvent] = list(_pressed_events.values()) if len(pressed_events) == 0: # the keypress time was so short its not recognized by keyboard lib. return hotkey_string = "" for ev in pressed_events: # replacing keys with their respective base key, e.g "!" --> "1" ev.name = to_name[(ev.scan_code, ())][-1] # keyboard does recognize meta key (win key) as alt, setting manually if ev.scan_code == 125 or ev.scan_code == 126: ev.name = "windows" hotkey_string += ev.name + "+" # remove the last plus hotkey_string = hotkey_string[:-1] # moved from old keySequenceChanged event self.lineEdit_Hotkey.setText(hotkey_string) index = self.listWidget_Functions.currentIndex().row() if index == -1: self.lineEdit_Hotkey.clear() else: self.hotkey_to_value[hotkeys.get_hotkeys()[index].name] = self.lineEdit_Hotkey.text() class HandleSignalsDialogForm(QDialog, HandleSignalsDialog): def __init__(self, parent, signal_data): super().__init__(parent) self.setupUi(self) self.signal_data = json.loads(signal_data) self.tableWidget_Signals.setRowCount(len(self.signal_data)) for index, (signal, stop, pass_to_program) in enumerate(self.signal_data): self.tableWidget_Signals.setItem(index, 0, QTableWidgetItem(signal)) widget, checkbox = self.create_checkbox_widget() self.tableWidget_Signals.setCellWidget(index, 1, widget) if stop: checkbox.setCheckState(Qt.CheckState.Checked) else: checkbox.setCheckState(Qt.CheckState.Unchecked) widget, checkbox = self.create_checkbox_widget() self.tableWidget_Signals.setCellWidget(index, 2, widget) if pass_to_program: checkbox.setCheckState(Qt.CheckState.Checked) else: checkbox.setCheckState(Qt.CheckState.Unchecked) self.tableWidget_Signals.resizeColumnsToContents() guiutils.center_to_parent(self) def create_checkbox_widget(self): widget = QWidget() checkbox = QCheckBox() layout = QHBoxLayout(widget) layout.addWidget(checkbox) layout.setAlignment(Qt.AlignmentFlag.AlignCenter) layout.setContentsMargins(0, 0, 0, 0) return widget, checkbox def get_values(self): signal_data = [] for index in range(len(self.signal_data)): current_signal = [] current_signal.append(self.signal_data[index][0]) widget = self.tableWidget_Signals.cellWidget(index, 1) checkbox = widget.findChild(QCheckBox) current_signal.append(True if checkbox.checkState() == Qt.CheckState.Checked else False) widget = self.tableWidget_Signals.cellWidget(index, 2) checkbox = widget.findChild(QCheckBox) current_signal.append(True if checkbox.checkState() == Qt.CheckState.Checked else False) signal_data.append(current_signal) return json.dumps(signal_data) class ConsoleWidgetForm(QWidget, ConsoleWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.completion_model = QStringListModel() self.completer = QCompleter() self.completer.setModel(self.completion_model) self.completer.setCompletionMode(QCompleter.CompletionMode.UnfilteredPopupCompletion) self.completer.setMaxVisibleItems(8) self.lineEdit.setCompleter(self.completer) self.quit_commands = ("q", "quit", "-gdb-exit") self.continue_commands = ("c", "continue", "-exec-continue") self.input_history = [""] self.current_history_index = -1 self.await_async_output_thread = AwaitAsyncOutput() self.await_async_output_thread.async_output_ready.connect(self.on_async_output) self.await_async_output_thread.start() self.pushButton_Send.clicked.connect(self.communicate) self.shortcut_send = QShortcut(QKeySequence("Return"), self) self.shortcut_send.activated.connect(self.communicate) self.shortcut_complete_command = QShortcut(QKeySequence("Tab"), self) self.shortcut_complete_command.activated.connect(self.complete_command) self.shortcut_multiline_mode = QShortcut(QKeySequence("Ctrl+Return"), self) self.shortcut_multiline_mode.activated.connect(self.enter_multiline_mode) self.lineEdit.textEdited.connect(self.finish_completion) # Saving the original function because super() doesn't work when we override functions like this self.lineEdit.keyPressEvent_original = self.lineEdit.keyPressEvent self.lineEdit.keyPressEvent = self.lineEdit_key_press_event self.reset_console_text() guiutils.center_to_parent(self) def communicate(self): self.current_history_index = -1 self.input_history[-1] = "" console_input = self.lineEdit.text() last_input = self.input_history[-2] if len(self.input_history) > 1 else "" if console_input != last_input and console_input != "": self.input_history[-1] = console_input self.input_history.append("") if console_input.lower() == "/clear": self.lineEdit.clear() self.reset_console_text() return self.lineEdit.clear() if console_input.strip().lower() in self.quit_commands: console_output = tr.QUIT_SESSION_CRASH if console_input.strip().lower() in self.continue_commands: console_output = tr.CONT_SESSION_CRASH else: if self.radioButton_CLI.isChecked(): console_output = debugcore.send_command(console_input, cli_output=True) else: console_output = debugcore.send_command(console_input) self.textBrowser.append("-->" + console_input) if console_output: self.textBrowser.append(console_output) self.scroll_to_bottom() def reset_console_text(self): self.textBrowser.clear() self.textBrowser.append(tr.GDB_CONSOLE_INIT) def scroll_to_bottom(self): cursor = self.textBrowser.textCursor() cursor.movePosition(QTextCursor.MoveOperation.End) self.textBrowser.setTextCursor(cursor) self.textBrowser.ensureCursorVisible() def enter_multiline_mode(self): multiline_dialog = TextEditDialogForm(self, self.lineEdit.text()) if multiline_dialog.exec(): self.lineEdit.setText(multiline_dialog.get_values()) self.communicate() def on_async_output(self, async_output): self.textBrowser.append(async_output) self.scroll_to_bottom() def scroll_backwards_history(self): try: new_text = self.input_history[self.current_history_index - 1] except IndexError: return self.input_history[self.current_history_index] = self.lineEdit.text() self.current_history_index -= 1 self.lineEdit.setText(new_text) def scroll_forwards_history(self): if self.current_history_index == -1: return self.input_history[self.current_history_index] = self.lineEdit.text() self.current_history_index += 1 self.lineEdit.setText(self.input_history[self.current_history_index]) def lineEdit_key_press_event(self, event): actions = typedefs.KeyboardModifiersTupleDict( [ (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_Up), self.scroll_backwards_history), (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_Down), self.scroll_forwards_history), ] ) try: actions[QKeyCombination(event.modifiers(), Qt.Key(event.key()))]() except KeyError: self.lineEdit.keyPressEvent_original(event) def finish_completion(self): self.completion_model.setStringList([]) def complete_command(self): if debugcore.gdb_initialized and debugcore.currentpid != -1 and self.lineEdit.text(): self.completion_model.setStringList(debugcore.complete_command(self.lineEdit.text())) self.completer.complete() else: self.finish_completion() def closeEvent(self, event): self.await_async_output_thread.stop() class AboutWidgetForm(QTabWidget, AboutWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) # This section has untranslated text since it's just a placeholder pince_dir = utils.get_script_directory() license_text = open(f"{pince_dir}/COPYING").read() authors_text = open(f"{pince_dir}/AUTHORS").read() thanks_text = open(f"{pince_dir}/THANKS").read() self.textBrowser_Contributors.append( "This is only a placeholder, this section may look different when the project finishes" + "\nIn fact, something like a demo-scene for here would look absolutely fabulous <:" ) self.textBrowser_Contributors.append("\n########") self.textBrowser_Contributors.append("#AUTHORS#") self.textBrowser_Contributors.append("########\n") self.textBrowser_Contributors.append(authors_text) self.textBrowser_Contributors.append("\n#######") self.textBrowser_Contributors.append("#THANKS#") self.textBrowser_Contributors.append("#######\n") self.textBrowser_Contributors.append(thanks_text) guiutils.center_to_parent(self) class MemoryViewWindowForm(QMainWindow, MemoryViewWindow): process_stopped = pyqtSignal() process_running = pyqtSignal() show_memory_view_on_stop: bool = False instructions_per_scroll: int = 3 bytes_per_scroll: int = 0x40 stack_from_base_pointer: bool = False def set_dynamic_debug_hotkeys(self): self.actionBreak.setText(tr.BREAK.format(hotkeys.break_hotkey.get_active_key())) self.actionRun.setText(tr.RUN.format(hotkeys.continue_hotkey.get_active_key())) self.actionToggle_Attach.setText(tr.TOGGLE_ATTACH.format(hotkeys.toggle_attach_hotkey.get_active_key())) def set_debug_menu_shortcuts(self): self.shortcut_step = QShortcut(QKeySequence("F7"), self) self.shortcut_step.activated.connect(self.step_instruction) self.shortcut_step_over = QShortcut(QKeySequence("F8"), self) self.shortcut_step_over.activated.connect(self.step_over_instruction) self.shortcut_execute_till_return = QShortcut(QKeySequence("Shift+F8"), self) self.shortcut_execute_till_return.activated.connect(self.execute_till_return) self.shortcut_toggle_breakpoint = QShortcut(QKeySequence("F5"), self) self.shortcut_toggle_breakpoint.activated.connect(self.toggle_breakpoint) self.shortcut_set_address = QShortcut(QKeySequence("Shift+F4"), self) self.shortcut_set_address.activated.connect(self.set_address) def initialize_file_context_menu(self): self.actionLoad_Trace.triggered.connect(self.show_trace_window) def initialize_debug_context_menu(self): self.actionBreak.triggered.connect(debugcore.interrupt_inferior) self.actionRun.triggered.connect(debugcore.continue_inferior) self.actionToggle_Attach.triggered.connect(lambda: self.parent().toggle_attach_hotkey_pressed()) self.actionStep.triggered.connect(self.step_instruction) self.actionStep_Over.triggered.connect(self.step_over_instruction) self.actionExecute_Till_Return.triggered.connect(self.execute_till_return) # Ignore the "checked" bool param as we don't make use of it self.actionToggle_Breakpoint.triggered.connect(lambda checked: self.toggle_breakpoint()) self.actionSet_Address.triggered.connect(self.set_address) def initialize_view_context_menu(self): self.actionBookmarks.triggered.connect(self.actionBookmarks_triggered) self.actionStackTrace_Info.triggered.connect(self.actionStackTrace_Info_triggered) self.actionBreakpoints.triggered.connect(self.actionBreakpoints_triggered) self.actionFunctions.triggered.connect(self.actionFunctions_triggered) self.actionGDB_Log_File.triggered.connect(self.actionGDB_Log_File_triggered) self.actionMemory_Regions.triggered.connect(self.actionMemory_Regions_triggered) self.actionRestore_Instructions.triggered.connect(self.actionRestore_Instructions_triggered) self.actionReferenced_Strings.triggered.connect(self.actionReferenced_Strings_triggered) self.actionReferenced_Calls.triggered.connect(self.actionReferenced_Calls_triggered) def initialize_tools_context_menu(self): self.actionInject_so_file.triggered.connect(self.actionInject_so_file_triggered) self.actionCall_Function.triggered.connect(self.actionCall_Function_triggered) self.actionSearch_Opcode.triggered.connect(self.actionSearch_Opcode_triggered) self.actionDissect_Code.triggered.connect(self.actionDissect_Code_triggered) def initialize_help_context_menu(self): self.actionlibpince.triggered.connect(self.actionlibpince_triggered) def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.updating_memoryview = False self.stacktrace_info_widget = StackTraceInfoWidgetForm(self) self.float_registers_widget = FloatRegisterWidgetForm(self) self.process_stopped.connect(self.on_process_stop) self.process_running.connect(self.on_process_running) self.set_debug_menu_shortcuts() self.set_dynamic_debug_hotkeys() self.initialize_file_context_menu() self.initialize_view_context_menu() self.initialize_debug_context_menu() self.initialize_tools_context_menu() self.initialize_help_context_menu() self.initialize_disassemble_view() self.initialize_register_view() self.initialize_stack_view() self.initialize_hex_view() self.label_HexView_Information.contextMenuEvent = self.label_HexView_Information_context_menu_event self.splitter_Disassemble_Registers.setStretchFactor(0, 1) self.splitter_MainMiddle.setStretchFactor(1, 1) self.widget_StackView.resize(660, self.widget_StackView.height()) self.widget_Registers.resize(330, self.widget_Registers.height()) guiutils.center(self) def initialize_register_view(self): self.pushButton_ShowFloatRegisters.clicked.connect(self.pushButton_ShowFloatRegisters_clicked) def initialize_stack_view(self): self.stackedWidget_StackScreens.setCurrentWidget(self.StackTrace) self.tableWidget_StackTrace.setColumnWidth(STACKTRACE_RETURN_ADDRESS_COL, 350) self.tableWidget_Stack.contextMenuEvent = self.tableWidget_Stack_context_menu_event self.tableWidget_StackTrace.contextMenuEvent = self.tableWidget_StackTrace_context_menu_event self.tableWidget_Stack.itemDoubleClicked.connect(self.tableWidget_Stack_double_click) self.tableWidget_StackTrace.itemDoubleClicked.connect(self.tableWidget_StackTrace_double_click) # Saving the original function because super() doesn't work when we override functions like this self.tableWidget_Stack.keyPressEvent_original = self.tableWidget_Stack.keyPressEvent self.tableWidget_Stack.keyPressEvent = self.tableWidget_Stack_key_press_event # Saving the original function because super() doesn't work when we override functions like this self.tableWidget_StackTrace.keyPressEvent_original = self.tableWidget_StackTrace.keyPressEvent self.tableWidget_StackTrace.keyPressEvent = self.tableWidget_StackTrace_key_press_event def initialize_disassemble_view(self): self.tableWidget_Disassemble.setColumnWidth(DISAS_ADDR_COL, 300) self.tableWidget_Disassemble.setColumnWidth(DISAS_BYTES_COL, 150) self.tableWidget_Disassemble.setColumnWidth(DISAS_OPCODES_COL, 400) self.disassemble_last_selected_address_int = 0 self.disassemble_currently_displayed_address = "0" self.widget_Disassemble.wheelEvent = self.widget_Disassemble_wheel_event self.bDisassemblyScrolling = False # rejects new scroll requests while scrolling self.tableWidget_Disassemble.wheelEvent = QEvent.ignore self.verticalScrollBar_Disassemble.wheelEvent = QEvent.ignore self.verticalScrollBar_Disassemble.sliderChange = self.disassemble_scrollbar_sliderchanged guiutils.center_scroll_bar(self.verticalScrollBar_Disassemble) # Format: [address1, address2, ...] self.tableWidget_Disassemble.travel_history = [] # Format: {address1:comment1,address2:comment2, ...} self.tableWidget_Disassemble.bookmarks = {} # Saving the original function because super() doesn't work when we override functions like this self.tableWidget_Disassemble.keyPressEvent_original = self.tableWidget_Disassemble.keyPressEvent self.tableWidget_Disassemble.keyPressEvent = self.tableWidget_Disassemble_key_press_event self.tableWidget_Disassemble.contextMenuEvent = self.tableWidget_Disassemble_context_menu_event self.tableWidget_Disassemble.itemDoubleClicked.connect(self.tableWidget_Disassemble_item_double_clicked) self.tableWidget_Disassemble.itemSelectionChanged.connect(self.tableWidget_Disassemble_item_selection_changed) def initialize_hex_view(self): # Determines where selection starts and ends self.hex_selection_start = 0 self.hex_selection_end = 0 # Actual start and end addresses of the selection self.hex_selection_address_begin = 0 self.hex_selection_address_end = 0 self.hex_view_current_region = typedefs.tuple_region_info(0, 0, None, None) self.hex_model = QHexModel(HEX_VIEW_ROW_COUNT, HEX_VIEW_COL_COUNT) self.ascii_model = QAsciiModel(HEX_VIEW_ROW_COUNT, HEX_VIEW_COL_COUNT) self.tableView_HexView_Hex.setModel(self.hex_model) self.tableView_HexView_Ascii.setModel(self.ascii_model) # Adjust cell sizes after setting model to ensure correct size self.tableView_HexView_Hex.adjust_cell_size(2) self.tableView_HexView_Ascii.adjust_cell_size(1) self.widget_HexView.wheelEvent = self.widget_HexView_wheel_event # Saving the original function because super() doesn't work when we override functions like this self.widget_HexView.keyPressEvent_original = self.widget_HexView.keyPressEvent self.widget_HexView.keyPressEvent = self.widget_HexView_key_press_event self.tableView_HexView_Hex.contextMenuEvent = self.widget_HexView_context_menu_event self.tableView_HexView_Ascii.contextMenuEvent = self.widget_HexView_context_menu_event self.bHexViewScrolling = False # rejects new scroll requests while scrolling self.verticalScrollBar_HexView.wheelEvent = QEvent.ignore self.verticalScrollBar_HexView.sliderChange = self.hex_view_scrollbar_sliderchanged guiutils.center_scroll_bar(self.verticalScrollBar_HexView) self.tableWidget_HexView_Address.wheelEvent = QEvent.ignore self.tableWidget_HexView_Address.setAutoScroll(False) self.tableWidget_HexView_Address.setStyleSheet("QTableWidget {background-color: transparent;}") self.tableWidget_HexView_Address.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection) self.tableView_HexView_Hex.selectionModel().selectionChanged.connect(self.hex_view_selection_changed) self.tableView_HexView_Ascii.selectionModel().selectionChanged.connect(self.hex_view_selection_changed) self.scrollArea_Hex.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.scrollArea_Hex.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.tableWidget_HexView_Address.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.tableWidget_HexView_Address.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) self.tableWidget_HexView_Address.verticalHeader().setMinimumSectionSize( self.tableView_HexView_Hex.verticalHeader().minimumSectionSize() ) self.tableWidget_HexView_Address.verticalHeader().setDefaultSectionSize( self.tableView_HexView_Hex.verticalHeader().defaultSectionSize() ) self.tableWidget_HexView_Address.verticalHeader().setMaximumSectionSize( self.tableView_HexView_Hex.verticalHeader().maximumSectionSize() ) self.hex_update_timer = QTimer(timeout=self.hex_update_loop) self.hex_update_timer.start(200) def show_trace_window(self): TraceInstructionsWindowForm(self, prompt_dialog=False) def step_instruction(self): if not ( debugcore.currentpid == -1 or debugcore.active_trace or debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING or self.updating_memoryview ): debugcore.step_instruction() def step_over_instruction(self): if not ( debugcore.currentpid == -1 or debugcore.active_trace or debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING or self.updating_memoryview ): debugcore.step_over_instruction() def execute_till_return(self): if not ( debugcore.currentpid == -1 or debugcore.active_trace or debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING or self.updating_memoryview ): debugcore.execute_till_return() def set_address(self): if debugcore.currentpid == -1 or debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING: return selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = utils.extract_address(current_address_text) debugcore.set_convenience_variable("pc", current_address) self.refresh_disassemble_view() def edit_instruction(self): selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = utils.extract_address(current_address_text) bytes_aob = self.tableWidget_Disassemble.item(selected_row, DISAS_BYTES_COL).text() EditInstructionDialogForm(self, current_address, bytes_aob).exec() def nop_instruction(self): if debugcore.currentpid == -1: return selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = utils.extract_address(current_address_text) current_address_int = int(current_address, 16) array_of_bytes = self.tableWidget_Disassemble.item(selected_row, DISAS_BYTES_COL).text() debugcore.nop_instruction(current_address_int, len(array_of_bytes.split())) self.refresh_disassemble_view() def toggle_breakpoint(self): if debugcore.currentpid == -1: return selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = utils.extract_address(current_address_text) current_address_int = int(current_address, 16) if debugcore.get_breakpoints_in_range(current_address_int): debugcore.delete_breakpoint(current_address) else: if not debugcore.add_breakpoint(current_address): QMessageBox.information(self, tr.ERROR, tr.BREAKPOINT_FAILED.format(current_address)) self.refresh_disassemble_view() def toggle_watchpoint(self, address, length, watchpoint_type=typedefs.WATCHPOINT_TYPE.BOTH): if debugcore.currentpid == -1: return breakpoints = debugcore.get_breakpoints_in_range(address, length) if not breakpoints: if len(debugcore.add_watchpoint(hex(address), length, watchpoint_type)) < 1: QMessageBox.information(self, tr.ERROR, tr.WATCHPOINT_FAILED.format(hex(address))) else: for bp in breakpoints: debugcore.delete_breakpoint(bp.address) self.refresh_hex_view() def label_HexView_Information_context_menu_event(self, event): if debugcore.currentpid == -1: return def copy_to_clipboard(): app.clipboard().setText(self.label_HexView_Information.text()) menu = QMenu() copy_label = menu.addAction(tr.COPY_CLIPBOARD) font_size = self.label_HexView_Information.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = {copy_label: copy_to_clipboard} try: actions[action]() except KeyError: pass def widget_HexView_context_menu_event(self, event): if debugcore.currentpid == -1: return addr = self.hex_selection_address_begin length = self.get_hex_selection_length() menu = QMenu() edit = menu.addAction(tr.EDIT) menu.addSeparator() go_to = menu.addAction(f"{tr.GO_TO_EXPRESSION}[Ctrl+G]") disassemble = menu.addAction(f"{tr.DISASSEMBLE_ADDRESS}[Ctrl+D]") menu.addSeparator() add_address = menu.addAction(f"{tr.ADD_TO_ADDRESS_LIST}[Ctrl+A]") menu.addSeparator() copy_selection = menu.addAction(f"{tr.COPY}[Ctrl+C]") refresh = menu.addAction(f"{tr.REFRESH}[R]") menu.addSeparator() watchpoint_menu = menu.addMenu(tr.SET_WATCHPOINT) watchpoint_write = watchpoint_menu.addAction(tr.WRITE_ONLY) watchpoint_read = watchpoint_menu.addAction(tr.READ_ONLY) watchpoint_both = watchpoint_menu.addAction(tr.BOTH) add_condition = menu.addAction(tr.CHANGE_BREAKPOINT_CONDITION) delete_breakpoint = menu.addAction(tr.DELETE_BREAKPOINT) if not debugcore.get_breakpoints_in_range(addr, length): guiutils.delete_menu_entries(menu, [add_condition, delete_breakpoint]) else: guiutils.delete_menu_entries(menu, [watchpoint_menu.menuAction()]) font_size = self.widget_HexView.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { edit: self.exec_hex_view_edit_dialog, go_to: self.exec_hex_view_go_to_dialog, disassemble: lambda: self.disassemble_expression(hex(addr), append_history=True), add_address: self.exec_hex_view_add_address_dialog, copy_selection: self.copy_hex_view_selection, refresh: self.refresh_hex_view, watchpoint_write: lambda: self.toggle_watchpoint(addr, length, typedefs.WATCHPOINT_TYPE.WRITE_ONLY), watchpoint_read: lambda: self.toggle_watchpoint(addr, length, typedefs.WATCHPOINT_TYPE.READ_ONLY), watchpoint_both: lambda: self.toggle_watchpoint(addr, length, typedefs.WATCHPOINT_TYPE.BOTH), add_condition: lambda: self.add_breakpoint_condition(addr, length), delete_breakpoint: lambda: self.toggle_watchpoint(addr, length), } try: actions[action]() except KeyError: pass def exec_hex_view_edit_dialog(self): if debugcore.currentpid == -1: return HexEditDialogForm(self, self.hex_selection_address_begin, self.get_hex_selection_length()).exec() self.refresh_hex_view() def exec_hex_view_go_to_dialog(self): if debugcore.currentpid == -1: return go_to_dialog = InputDialogForm(self, [(tr.ENTER_EXPRESSION, hex(self.hex_selection_address_begin))]) if go_to_dialog.exec(): expression = go_to_dialog.get_values() dest_address = debugcore.examine_expression(expression).address if not dest_address: QMessageBox.information(self, tr.ERROR, tr.INVALID.format(expression)) return self.hex_dump_address(int(dest_address, 16)) def exec_hex_view_add_address_dialog(self): if debugcore.currentpid == -1: return vt = typedefs.ValueType(typedefs.VALUE_INDEX.AOB, self.get_hex_selection_length()) address_dialog = ManualAddressDialogForm(self, address=hex(self.hex_selection_address_begin), value_type=vt) if address_dialog.exec(): desc, address, vt = address_dialog.get_values() self.parent().add_entry_to_addresstable(desc, address, vt) self.parent().update_address_table() def copy_hex_view_selection(self): data = debugcore.hex_dump(self.hex_selection_address_begin, self.get_hex_selection_length()) if self.focusWidget() == self.tableView_HexView_Ascii: display_text = utils.aob_to_str(data) else: display_text = " ".join(data) app.clipboard().setText(display_text) def hex_view_scroll_up(self): self.verticalScrollBar_HexView.setValue(1) def hex_view_scroll_down(self): self.verticalScrollBar_HexView.setValue(-1) def hex_view_scrollbar_sliderchanged(self, event): if self.bHexViewScrolling: return self.bHexViewScrolling = True maximum = self.verticalScrollBar_HexView.maximum() minimum = self.verticalScrollBar_HexView.minimum() midst = (maximum + minimum) / 2 current_value = self.verticalScrollBar_HexView.value() # if midst - 10 < current_value < midst + 10: # self.bHexViewScrolling = False # return current_address = self.hex_model.current_address if current_value < midst: next_address = current_address - self.bytes_per_scroll else: next_address = current_address + self.bytes_per_scroll self.hex_dump_address(next_address) guiutils.center_scroll_bar(self.verticalScrollBar_HexView) self.bHexViewScrolling = False def disassemble_scroll_up(self): self.verticalScrollBar_Disassemble.setValue(1) def disassemble_scroll_down(self): self.verticalScrollBar_Disassemble.setValue(-1) def disassemble_scrollbar_sliderchanged(self, even): if self.bDisassemblyScrolling: return self.bDisassemblyScrolling = True maximum = self.verticalScrollBar_Disassemble.maximum() minimum = self.verticalScrollBar_Disassemble.minimum() midst = (maximum + minimum) / 2 current_value = self.verticalScrollBar_Disassemble.value() # if midst - 10 < current_value < midst + 10: # self.bDisassemblyScrolling = False # return if current_value < midst: self.tableWidget_Disassemble_scroll("previous", self.instructions_per_scroll) else: self.tableWidget_Disassemble_scroll("next", self.instructions_per_scroll) guiutils.center_scroll_bar(self.verticalScrollBar_Disassemble) self.bDisassemblyScrolling = False def hex_view_selection_changed(self, selected, deselected): sender_selection_model: QItemSelectionModel = self.sender() sender_selection = sorted([(idx.row(), idx.column()) for idx in sender_selection_model.selectedIndexes()]) first_selection = sender_selection[0] last_selection = sender_selection[-1] hex_start = self.address_to_hex_point(self.hex_selection_start) hex_end = self.address_to_hex_point(self.hex_selection_end) hex_start, hex_end = self.fix_selection_at_borders(hex_start, hex_end) if len(sender_selection) == 1: hex_start = first_selection hex_end = first_selection else: # Selection ends in top left if last_selection == hex_start: hex_end = first_selection # Selection ends in top right elif last_selection[0] == hex_start[0]: hex_end = (first_selection[0], last_selection[1]) # Selection ends in bottom left elif last_selection[1] == hex_start[1]: hex_end = (last_selection[0], first_selection[1]) # Selection ends in bottom right else: hex_end = last_selection if hex_start < hex_end: address_begin = hex_start address_end = hex_end else: address_begin = hex_end address_end = hex_start self.hex_selection_start = self.hex_point_to_address(hex_start) self.hex_selection_end = self.hex_point_to_address(hex_end) self.hex_selection_address_begin = self.hex_point_to_address(address_begin) self.hex_selection_address_end = self.hex_point_to_address(address_end) self.handle_hex_selection() def handle_hex_selection(self): hex_selection_model = self.tableView_HexView_Hex.selectionModel() ascii_selection_model = self.tableView_HexView_Ascii.selectionModel() start_point = self.address_to_hex_point(self.hex_selection_address_begin) end_point = self.address_to_hex_point(self.hex_selection_address_end) with QSignalBlocker(hex_selection_model), QSignalBlocker(ascii_selection_model): hex_selection_model.clearSelection() ascii_selection_model.clearSelection() self.tableWidget_HexView_Address.clearSelection() if start_point or end_point: start_point, end_point = self.fix_selection_at_borders(start_point, end_point) if start_point[0] == end_point[0]: start = hex_selection_model.model().index(*start_point) end = hex_selection_model.model().index(*end_point) selection = QItemSelection(start, end) hex_selection_model.select(selection, QItemSelectionModel.SelectionFlag.Select) ascii_selection_model.select(selection, QItemSelectionModel.SelectionFlag.Select) else: # First line start = hex_selection_model.model().index(*start_point) end = hex_selection_model.model().index(start_point[0], HEX_VIEW_COL_COUNT - 1) selection = QItemSelection(start, end) hex_selection_model.select(selection, QItemSelectionModel.SelectionFlag.Select) ascii_selection_model.select(selection, QItemSelectionModel.SelectionFlag.Select) # Middle if end_point[0] - start_point[0] > 1: start = hex_selection_model.model().index(start_point[0] + 1, 0) end = hex_selection_model.model().index(end_point[0] - 1, HEX_VIEW_COL_COUNT - 1) selection = QItemSelection(start, end) hex_selection_model.select(selection, QItemSelectionModel.SelectionFlag.Select) ascii_selection_model.select(selection, QItemSelectionModel.SelectionFlag.Select) # Last line start = hex_selection_model.model().index(end_point[0], 0) end = hex_selection_model.model().index(*end_point) selection = QItemSelection(start, end) hex_selection_model.select(selection, QItemSelectionModel.SelectionFlag.Select) ascii_selection_model.select(selection, QItemSelectionModel.SelectionFlag.Select) self.tableWidget_HexView_Address.setSelectionMode(QAbstractItemView.SelectionMode.MultiSelection) for row in range(start_point[0], end_point[0] + 1): self.tableWidget_HexView_Address.selectRow(row) self.tableWidget_HexView_Address.setSelectionMode(QAbstractItemView.SelectionMode.NoSelection) self.tableView_HexView_Hex.update() self.tableView_HexView_Ascii.update() self.tableWidget_HexView_Address.update() def hex_point_to_address(self, point): address = self.hex_model.current_address + point[0] * HEX_VIEW_COL_COUNT + point[1] return utils.modulo_address(address, debugcore.inferior_arch) def address_to_hex_point(self, address): diff = address - self.hex_model.current_address if 0 <= diff < HEX_VIEW_ROW_COUNT * HEX_VIEW_COL_COUNT: return diff // HEX_VIEW_COL_COUNT, diff % HEX_VIEW_COL_COUNT def get_hex_selection_length(self): return self.hex_selection_address_end - self.hex_selection_address_begin + 1 def fix_selection_at_borders(self, start_point, end_point): if not start_point: start_point = (0, 0) if not end_point: end_point = (HEX_VIEW_ROW_COUNT - 1, HEX_VIEW_COL_COUNT - 1) return start_point, end_point def hex_update_loop(self): offset = HEX_VIEW_ROW_COUNT * HEX_VIEW_COL_COUNT if debugcore.currentpid == -1 or exiting: updated_array = ["??"] * offset else: updated_array = debugcore.hex_dump(self.hex_model.current_address, offset) self.hex_model.update_loop(updated_array) self.ascii_model.update_loop(updated_array) # TODO: Consider merging HexView_Address, HexView_Hex and HexView_Ascii into one UI class # TODO: Move this function to that class if that happens # TODO: Also consider moving shared fields of HexView and HexModel to that class(such as HexModel.current_address) def hex_dump_address(self, int_address, offset=HEX_VIEW_ROW_COUNT * HEX_VIEW_COL_COUNT): if debugcore.currentpid == -1: return int_address = utils.modulo_address(int_address, debugcore.inferior_arch) if not (self.hex_view_current_region.start <= int_address < self.hex_view_current_region.end): info = utils.get_region_info(debugcore.currentpid, int_address) if info: self.hex_view_current_region = info self.label_HexView_Information.setText( tr.REGION_INFO.format(info.perms, hex(info.start), hex(info.end), info.file_name) ) else: self.hex_view_current_region = typedefs.tuple_region_info(0, 0, None, None) self.label_HexView_Information.setText(tr.INVALID_REGION) self.tableWidget_HexView_Address.setRowCount(0) self.tableWidget_HexView_Address.setRowCount(HEX_VIEW_ROW_COUNT * HEX_VIEW_COL_COUNT) for row, current_offset in enumerate(range(HEX_VIEW_ROW_COUNT)): row_address = hex(utils.modulo_address(int_address + current_offset * 16, debugcore.inferior_arch)) self.tableWidget_HexView_Address.setItem(row, 0, QTableWidgetItem(utils.upper_hex(row_address))) tableWidget_HexView_column_size = self.tableWidget_HexView_Address.sizeHintForColumn(0) + 5 self.tableWidget_HexView_Address.setMaximumWidth(tableWidget_HexView_column_size) self.tableWidget_HexView_Address.setMinimumWidth(tableWidget_HexView_column_size) self.tableWidget_HexView_Address.setColumnWidth(0, tableWidget_HexView_column_size) data_array = debugcore.hex_dump(int_address, offset) breakpoint_info = debugcore.get_breakpoint_info() self.hex_model.refresh(int_address, offset, data_array, breakpoint_info) self.ascii_model.refresh(int_address, offset, data_array, breakpoint_info) self.handle_hex_selection() def refresh_hex_view(self): if debugcore.currentpid == -1: return if self.tableWidget_HexView_Address.rowCount() == 0: entry_point = debugcore.find_entry_point() if not entry_point: # **Shrugs** entry_point = "0x00400000" self.hex_dump_address(int(entry_point, 16)) self.tableView_HexView_Hex.resize_to_contents() self.tableView_HexView_Ascii.resize_to_contents() else: self.hex_dump_address(self.hex_model.current_address) # offset can also be an address as hex str # returns True if the given expression is disassembled correctly, False if not def disassemble_expression(self, expression, offset="+200", append_history=False): if debugcore.currentpid == -1: return disas_data = debugcore.disassemble(expression, offset) if not disas_data: QMessageBox.information(app.focusWidget(), tr.ERROR, tr.EXPRESSION_ACCESS_ERROR.format(expression)) return False program_counter = debugcore.examine_expression("$pc").address program_counter_int = int(program_counter, 16) if program_counter else None row_color = {} breakpoint_info = debugcore.get_breakpoint_info() # TODO: Change this nonsense when the huge refactorization happens current_first_address = utils.extract_address(disas_data[0][0]) # address of first list entry try: previous_first_address = utils.extract_address(self.tableWidget_Disassemble.item(0, DISAS_ADDR_COL).text()) except AttributeError: previous_first_address = current_first_address self.tableWidget_Disassemble.setRowCount(0) self.tableWidget_Disassemble.setRowCount(len(disas_data)) jmp_dict, call_dict = debugcore.get_dissect_code_data(False, True, True) for row, (address_info, bytes_aob, opcode) in enumerate(disas_data): comment = "" current_address = int(utils.extract_address(address_info), 16) current_address_str = hex(current_address) jmp_ref_exists = False call_ref_exists = False try: jmp_referrers = jmp_dict[current_address_str] jmp_ref_exists = True except KeyError: pass try: call_referrers = call_dict[current_address_str] call_ref_exists = True except KeyError: pass if jmp_ref_exists or call_ref_exists: tooltip_text = f"{tr.REFERENCED_BY}\n" ref_count = 0 if jmp_ref_exists: for referrer in jmp_referrers: if ref_count > 30: break tooltip_text += "\n" + hex(referrer) + "(" + jmp_referrers[referrer] + ")" ref_count += 1 if call_ref_exists: for referrer in call_referrers: if ref_count > 30: break tooltip_text += "\n" + hex(referrer) + "(call)" ref_count += 1 if ref_count > 30: tooltip_text += "\n..." tooltip_text += f"\n\n{tr.SEE_REFERRERS}" try: row_color[row].append(REF_COLOR) except KeyError: row_color[row] = [REF_COLOR] real_ref_count = 0 if jmp_ref_exists: real_ref_count += len(jmp_referrers) if call_ref_exists: real_ref_count += len(call_referrers) address_info = "{" + str(real_ref_count) + "}" + address_info if current_address == program_counter_int: address_info = ">>>" + address_info try: row_color[row].append(PC_COLOR) except KeyError: row_color[row] = [PC_COLOR] for bookmark_item in self.tableWidget_Disassemble.bookmarks.keys(): if current_address == bookmark_item: try: row_color[row].append(BOOKMARK_COLOR) except KeyError: row_color[row] = [BOOKMARK_COLOR] address_info = "(M)" + address_info comment = self.tableWidget_Disassemble.bookmarks[bookmark_item] break for breakpoint in breakpoint_info: int_breakpoint_address = int(breakpoint.address, 16) if current_address == int_breakpoint_address: try: row_color[row].append(BREAKPOINT_COLOR) except KeyError: row_color[row] = [BREAKPOINT_COLOR] breakpoint_mark = "(B" if breakpoint.enabled == "n": breakpoint_mark += "-disabled" else: if breakpoint.disp != "keep": breakpoint_mark += "-" + breakpoint.disp if breakpoint.enable_count: breakpoint_mark += "-" + breakpoint.enable_count breakpoint_mark += ")" address_info = breakpoint_mark + address_info break if current_address == self.disassemble_last_selected_address_int: self.tableWidget_Disassemble.selectRow(row) addr_item = QTableWidgetItem(address_info) bytes_item = QTableWidgetItem(bytes_aob) opcodes_item = QTableWidgetItem(opcode) comment_item = QTableWidgetItem(comment) if jmp_ref_exists or call_ref_exists: addr_item.setToolTip(tooltip_text) bytes_item.setToolTip(tooltip_text) opcodes_item.setToolTip(tooltip_text) comment_item.setToolTip(tooltip_text) self.tableWidget_Disassemble.setItem(row, DISAS_ADDR_COL, addr_item) self.tableWidget_Disassemble.setItem(row, DISAS_BYTES_COL, bytes_item) self.tableWidget_Disassemble.setItem(row, DISAS_OPCODES_COL, opcodes_item) self.tableWidget_Disassemble.setItem(row, DISAS_COMMENT_COL, comment_item) jmp_dict.close() call_dict.close() self.handle_colors(row_color) # We append the old record to travel history as last action because we wouldn't like to see unnecessary # addresses in travel history if any error occurs while displaying the next location if append_history: self.tableWidget_Disassemble.travel_history.append(previous_first_address) self.disassemble_currently_displayed_address = current_first_address return True def refresh_disassemble_view(self): if debugcore.currentpid == -1: return self.disassemble_expression(self.disassemble_currently_displayed_address) # Set color of a row if a specific address is encountered(e.g $pc, a bookmarked address etc.) def handle_colors(self, row_color): if debugcore.currentpid == -1: return for row in row_color: current_row = row_color[row] if PC_COLOR in current_row: if BREAKPOINT_COLOR in current_row: color = QColorConstants.Green elif BOOKMARK_COLOR in current_row: color = QColorConstants.Yellow else: color = PC_COLOR self.set_row_color(row, color) continue if BREAKPOINT_COLOR in current_row: if BOOKMARK_COLOR in current_row: color = QColorConstants.Magenta else: color = BREAKPOINT_COLOR self.set_row_color(row, color) continue if BOOKMARK_COLOR in current_row: self.set_row_color(row, BOOKMARK_COLOR) continue if REF_COLOR in current_row: self.set_row_color(row, REF_COLOR) def set_row_color(self, row, color): if debugcore.currentpid == -1: return for col in range(self.tableWidget_Disassemble.columnCount()): color = QColor(color) color.setAlpha(96) self.tableWidget_Disassemble.item(row, col).setData(Qt.ItemDataRole.BackgroundRole, color) def on_process_stop(self): if debugcore.stop_reason == typedefs.STOP_REASON.PAUSE: self.setWindowTitle(tr.MV_PAUSED) return self.updating_memoryview = True time0 = time() self.setWindowTitle(tr.MV_DEBUGGING.format(debugcore.get_thread_info())) self.disassemble_expression("$pc") self.update_registers() if self.stackedWidget_StackScreens.currentWidget() == self.StackTrace: self.update_stacktrace() elif self.stackedWidget_StackScreens.currentWidget() == self.Stack: self.update_stack() # These tableWidgets are never emptied but initially both are empty, so this runs only once if self.tableWidget_StackTrace.rowCount() == 0: self.update_stacktrace() if self.tableWidget_Stack.rowCount() == 0: self.update_stack() self.refresh_hex_view() if self.show_memory_view_on_stop: self.showMaximized() self.activateWindow() if self.stacktrace_info_widget.isVisible(): self.stacktrace_info_widget.update_stacktrace() if self.float_registers_widget.isVisible(): self.float_registers_widget.update_registers() app.processEvents() time1 = time() print("UPDATED MEMORYVIEW IN:" + str(time1 - time0)) self.updating_memoryview = False def on_process_running(self): self.setWindowTitle(tr.MV_RUNNING) def add_breakpoint_condition(self, int_address, length=1): if debugcore.currentpid == -1: return breakpoints = debugcore.get_breakpoints_in_range(int_address, length) if breakpoints: condition_line_edit_text = breakpoints[0].condition else: condition_line_edit_text = "" items = [(tr.ENTER_BP_CONDITION, condition_line_edit_text, Qt.AlignmentFlag.AlignLeft)] condition_dialog = InputDialogForm(self, items) if condition_dialog.exec(): condition = condition_dialog.get_values() for bp in breakpoints: addr = bp.address if not debugcore.modify_breakpoint(addr, typedefs.BREAKPOINT_MODIFY.CONDITION, condition): QMessageBox.information(app.focusWidget(), tr.ERROR, tr.BP_CONDITION_FAILED.format(addr)) def update_registers(self): if debugcore.currentpid == -1: return registers = debugcore.read_registers() if debugcore.inferior_arch == typedefs.INFERIOR_ARCH.ARCH_64: self.stackedWidget.setCurrentWidget(self.registers_64) self.RAX.set_value(registers["rax"]) self.RBX.set_value(registers["rbx"]) self.RCX.set_value(registers["rcx"]) self.RDX.set_value(registers["rdx"]) self.RSI.set_value(registers["rsi"]) self.RDI.set_value(registers["rdi"]) self.RBP.set_value(registers["rbp"]) self.RSP.set_value(registers["rsp"]) self.RIP.set_value(registers["rip"]) self.R8.set_value(registers["r8"]) self.R9.set_value(registers["r9"]) self.R10.set_value(registers["r10"]) self.R11.set_value(registers["r11"]) self.R12.set_value(registers["r12"]) self.R13.set_value(registers["r13"]) self.R14.set_value(registers["r14"]) self.R15.set_value(registers["r15"]) elif debugcore.inferior_arch == typedefs.INFERIOR_ARCH.ARCH_32: self.stackedWidget.setCurrentWidget(self.registers_32) self.EAX.set_value(registers["eax"]) self.EBX.set_value(registers["ebx"]) self.ECX.set_value(registers["ecx"]) self.EDX.set_value(registers["edx"]) self.ESI.set_value(registers["esi"]) self.EDI.set_value(registers["edi"]) self.EBP.set_value(registers["ebp"]) self.ESP.set_value(registers["esp"]) self.EIP.set_value(registers["eip"]) self.CF.set_value(registers["cf"]) self.PF.set_value(registers["pf"]) self.AF.set_value(registers["af"]) self.ZF.set_value(registers["zf"]) self.SF.set_value(registers["sf"]) self.TF.set_value(registers["tf"]) self.IF.set_value(registers["if"]) self.DF.set_value(registers["df"]) self.OF.set_value(registers["of"]) self.CS.set_value(registers["cs"]) self.SS.set_value(registers["ss"]) self.DS.set_value(registers["ds"]) self.ES.set_value(registers["es"]) self.GS.set_value(registers["gs"]) self.FS.set_value(registers["fs"]) def update_stacktrace(self): if debugcore.currentpid == -1 or debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING: return stack_trace_info = debugcore.get_stacktrace_info() self.tableWidget_StackTrace.setRowCount(0) self.tableWidget_StackTrace.setRowCount(len(stack_trace_info)) for row, item in enumerate(stack_trace_info): self.tableWidget_StackTrace.setItem(row, STACKTRACE_RETURN_ADDRESS_COL, QTableWidgetItem(item[0])) self.tableWidget_StackTrace.setItem(row, STACKTRACE_FRAME_ADDRESS_COL, QTableWidgetItem(item[1])) def set_stack_widget(self, stack_widget): if debugcore.currentpid == -1: return self.stackedWidget_StackScreens.setCurrentWidget(stack_widget) if stack_widget == self.Stack: self.update_stack() elif stack_widget == self.StackTrace: self.update_stacktrace() def tableWidget_StackTrace_context_menu_event(self, event): def copy_to_clipboard(row, column): app.clipboard().setText(self.tableWidget_StackTrace.item(row, column).text()) selected_row = guiutils.get_current_row(self.tableWidget_StackTrace) menu = QMenu() switch_to_stack = menu.addAction(tr.FULL_STACK) menu.addSeparator() clipboard_menu = menu.addMenu(tr.COPY_CLIPBOARD) copy_return = clipboard_menu.addAction(tr.COPY_RETURN_ADDRESS) copy_frame = clipboard_menu.addAction(tr.COPY_FRAME_ADDRESS) if selected_row == -1: guiutils.delete_menu_entries(menu, [clipboard_menu.menuAction()]) refresh = menu.addAction(f"{tr.REFRESH}[R]") if debugcore.currentpid == -1: menu.clear() menu.addMenu(clipboard_menu) font_size = self.tableWidget_StackTrace.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { switch_to_stack: lambda: self.set_stack_widget(self.Stack), copy_return: lambda: copy_to_clipboard(selected_row, STACKTRACE_RETURN_ADDRESS_COL), copy_frame: lambda: copy_to_clipboard(selected_row, STACKTRACE_FRAME_ADDRESS_COL), refresh: self.update_stacktrace, } try: actions[action]() except KeyError: pass def update_stack(self): if debugcore.currentpid == -1 or debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING: return stack_info: list[str] = debugcore.get_stack_info(from_base_pointer=self.stack_from_base_pointer) self.tableWidget_Stack.setRowCount(0) self.tableWidget_Stack.setRowCount(len(stack_info)) for row, item in enumerate(stack_info): self.tableWidget_Stack.setItem(row, STACK_POINTER_ADDRESS_COL, QTableWidgetItem(item[0])) self.tableWidget_Stack.setItem(row, STACK_VALUE_COL, QTableWidgetItem(item[1])) self.tableWidget_Stack.setItem(row, STACK_POINTS_TO_COL, QTableWidgetItem(item[2])) self.tableWidget_Stack.resizeColumnToContents(STACK_POINTER_ADDRESS_COL) self.tableWidget_Stack.resizeColumnToContents(STACK_VALUE_COL) def toggle_stack_from_sp_bp(self): self.stack_from_base_pointer = not self.stack_from_base_pointer self.update_stack() def tableWidget_Stack_key_press_event(self, event): if debugcore.currentpid == -1: return selected_row = guiutils.get_current_row(self.tableWidget_Stack) if selected_row == -1: actions = typedefs.KeyboardModifiersTupleDict( [(QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_R), self.update_stack)] ) else: current_address_text = self.tableWidget_Stack.item(selected_row, STACK_VALUE_COL).text() current_address = utils.extract_address(current_address_text) actions = typedefs.KeyboardModifiersTupleDict( [ (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_R), self.update_stack), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_D), lambda: self.disassemble_expression(current_address, append_history=True), ), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_H), lambda: self.hex_dump_address(int(current_address, 16)), ), ] ) try: actions[QKeyCombination(event.modifiers(), Qt.Key(event.key()))]() except KeyError: pass self.tableWidget_Stack.keyPressEvent_original(event) def tableWidget_Stack_context_menu_event(self, event): def copy_to_clipboard(row, column): app.clipboard().setText(self.tableWidget_Stack.item(row, column).text()) selected_row = guiutils.get_current_row(self.tableWidget_Stack) if selected_row == -1: current_address = None else: current_address_text = self.tableWidget_Stack.item(selected_row, STACK_VALUE_COL).text() current_address = utils.extract_address(current_address_text) menu = QMenu() switch_to_stacktrace = menu.addAction(tr.STACKTRACE) toggle_stack_pointer = menu.addAction(tr.TOGGLE_STACK_FROM_SP_BP) if debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING: toggle_stack_pointer.setEnabled(False) menu.addSeparator() clipboard_menu = menu.addMenu(tr.COPY_CLIPBOARD) copy_address = clipboard_menu.addAction(tr.COPY_ADDRESS) copy_value = clipboard_menu.addAction(tr.COPY_VALUE) copy_points_to = clipboard_menu.addAction(tr.COPY_POINTS_TO) refresh = menu.addAction(f"{tr.REFRESH}[R]") menu.addSeparator() show_in_disas = menu.addAction(f"{tr.DISASSEMBLE_VALUE_POINTER}[Ctrl+D]") show_in_hex = menu.addAction(f"{tr.HEXVIEW_VALUE_POINTER}[Ctrl+H]") if selected_row == -1: guiutils.delete_menu_entries(menu, [clipboard_menu.menuAction(), show_in_disas, show_in_hex]) if debugcore.currentpid == -1: menu.clear() menu.addMenu(clipboard_menu) font_size = self.tableWidget_Stack.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { switch_to_stacktrace: lambda: self.set_stack_widget(self.StackTrace), toggle_stack_pointer: self.toggle_stack_from_sp_bp, copy_address: lambda: copy_to_clipboard(selected_row, STACK_POINTER_ADDRESS_COL), copy_value: lambda: copy_to_clipboard(selected_row, STACK_VALUE_COL), copy_points_to: lambda: copy_to_clipboard(selected_row, STACK_POINTS_TO_COL), refresh: self.update_stack, show_in_disas: lambda: self.disassemble_expression(current_address, append_history=True), show_in_hex: lambda: self.hex_dump_address(int(current_address, 16)), } try: actions[action]() except KeyError: pass def tableWidget_Stack_double_click(self, index): if debugcore.currentpid == -1: return selected_row = guiutils.get_current_row(self.tableWidget_Stack) if index.column() == STACK_POINTER_ADDRESS_COL: current_address_text = self.tableWidget_Stack.item(selected_row, STACK_POINTER_ADDRESS_COL).text() current_address = utils.extract_address(current_address_text) self.hex_dump_address(int(current_address, 16)) else: points_to_text = self.tableWidget_Stack.item(selected_row, STACK_POINTS_TO_COL).text() current_address_text = self.tableWidget_Stack.item(selected_row, STACK_VALUE_COL).text() current_address = utils.extract_address(current_address_text) if points_to_text.startswith("(str)"): self.hex_dump_address(int(current_address, 16)) else: self.disassemble_expression(current_address, append_history=True) def tableWidget_StackTrace_double_click(self, index): if debugcore.currentpid == -1: return selected_row = guiutils.get_current_row(self.tableWidget_StackTrace) if index.column() == STACKTRACE_RETURN_ADDRESS_COL: current_address_text = self.tableWidget_StackTrace.item(selected_row, STACKTRACE_RETURN_ADDRESS_COL).text() current_address = utils.extract_address(current_address_text) self.disassemble_expression(current_address, append_history=True) if index.column() == STACKTRACE_FRAME_ADDRESS_COL: current_address_text = self.tableWidget_StackTrace.item(selected_row, STACKTRACE_FRAME_ADDRESS_COL).text() current_address = utils.extract_address(current_address_text) self.hex_dump_address(int(current_address, 16)) def tableWidget_StackTrace_key_press_event(self, event): if debugcore.currentpid == -1: return actions = typedefs.KeyboardModifiersTupleDict( [(QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_R), self.update_stacktrace)] ) try: actions[QKeyCombination(event.modifiers(), Qt.Key(event.key()))]() except KeyError: pass self.tableWidget_StackTrace.keyPressEvent_original(event) def widget_Disassemble_wheel_event(self, event): if debugcore.currentpid == -1: return steps = event.angleDelta() if steps.y() > 0: self.tableWidget_Disassemble_scroll("previous", self.instructions_per_scroll) else: self.tableWidget_Disassemble_scroll("next", self.instructions_per_scroll) def disassemble_check_viewport(self, where, instruction_count): if debugcore.currentpid == -1: return current_row = guiutils.get_current_row(self.tableWidget_Disassemble) current_row_height = self.tableWidget_Disassemble.rowViewportPosition(current_row) row_height = self.tableWidget_Disassemble.verticalHeader().defaultSectionSize() max_height = self.tableWidget_Disassemble.maximumViewportSize().height() # visible_height = max_height - row_height height = max_height - row_height * 3 # lets us see the next 2 instructions after the last visible row if current_row_height > max_height: last_visible_row = 0 for row in range(self.tableWidget_Disassemble.rowCount()): if self.tableWidget_Disassemble.rowViewportPosition(row) > height: break last_visible_row += 1 current_address = utils.extract_address( self.tableWidget_Disassemble.item(current_row, DISAS_ADDR_COL).text() ) new_address = debugcore.find_closest_instruction_address(current_address, "previous", last_visible_row) self.disassemble_expression(new_address) elif (where == "previous" and current_row == 0) or (where == "next" and current_row_height > height): self.tableWidget_Disassemble_scroll(where, instruction_count) def tableWidget_Disassemble_scroll(self, where, instruction_count): if debugcore.currentpid == -1: return current_address = self.disassemble_currently_displayed_address new_address = debugcore.find_closest_instruction_address(current_address, where, instruction_count) self.disassemble_expression(new_address) def widget_HexView_wheel_event(self, event): if debugcore.currentpid == -1: return steps = event.angleDelta() current_address = self.hex_model.current_address if steps.y() > 0: next_address = current_address - self.bytes_per_scroll else: next_address = current_address + self.bytes_per_scroll self.hex_dump_address(next_address) def widget_HexView_key_press_event(self, event): if debugcore.currentpid == -1: return actions = typedefs.KeyboardModifiersTupleDict( [ (QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_G), self.exec_hex_view_go_to_dialog), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_D), lambda: self.disassemble_expression(hex(self.hex_selection_address_begin), append_history=True), ), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_A), self.exec_hex_view_add_address_dialog, ), (QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_C), self.copy_hex_view_selection), (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_R), self.refresh_hex_view), (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_PageUp), self.hex_view_scroll_up), (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_PageDown), self.hex_view_scroll_down), ] ) try: actions[QKeyCombination(event.modifiers(), Qt.Key(event.key()))]() except KeyError: pass self.widget_HexView.keyPressEvent_original(event) def tableWidget_Disassemble_key_press_event(self, event): if debugcore.currentpid == -1: return selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) if selected_row == -1: selected_row = 0 current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = utils.extract_address(current_address_text) current_address_int = int(current_address, 16) actions = typedefs.KeyboardModifiersTupleDict( [ ( QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_Space), lambda: self.follow_instruction(selected_row), ), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_E), lambda: self.exec_examine_referrers_widget(current_address_text), ), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_G), self.exec_disassemble_go_to_dialog, ), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_H), lambda: self.hex_dump_address(current_address_int), ), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_B), lambda: self.bookmark_address(current_address_int), ), (QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_D), self.dissect_current_region), ( QKeyCombination(Qt.KeyboardModifier.ControlModifier, Qt.Key.Key_T), self.exec_trace_instructions_dialog, ), (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_R), self.refresh_disassemble_view), ( QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_Down), lambda: self.disassemble_check_viewport("next", 1), ), ( QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_Up), lambda: self.disassemble_check_viewport("previous", 1), ), (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_PageUp), self.disassemble_scroll_up), (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_PageDown), self.disassemble_scroll_down), ] ) try: actions[QKeyCombination(event.modifiers(), Qt.Key(event.key()))]() except KeyError: pass self.tableWidget_Disassemble.keyPressEvent_original(event) def tableWidget_Disassemble_item_double_clicked(self, index): if debugcore.currentpid == -1: return if index.column() == DISAS_COMMENT_COL: selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = int(utils.extract_address(current_address_text), 16) if current_address in self.tableWidget_Disassemble.bookmarks: self.change_bookmark_comment(current_address) else: self.bookmark_address(current_address) def tableWidget_Disassemble_item_selection_changed(self): if debugcore.currentpid == -1: return try: selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) selected_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() self.disassemble_last_selected_address_int = int(utils.extract_address(selected_address_text), 16) except (TypeError, ValueError, AttributeError): pass # Search the item in given row for location changing instructions # Go to the address pointed by that instruction if it contains any def follow_instruction(self, selected_row): if debugcore.currentpid == -1: return address = utils.instruction_follow_address( self.tableWidget_Disassemble.item(selected_row, DISAS_OPCODES_COL).text() ) if address: self.disassemble_expression(address, append_history=True) def disassemble_go_back(self): if debugcore.currentpid == -1: return if self.tableWidget_Disassemble.travel_history: last_location = self.tableWidget_Disassemble.travel_history[-1] self.disassemble_expression(last_location) self.tableWidget_Disassemble.travel_history.pop() def tableWidget_Disassemble_context_menu_event(self, event): def copy_to_clipboard(row, column): app.clipboard().setText(self.tableWidget_Disassemble.item(row, column).text()) def copy_all_columns(row): copied_string = "" for column in range(self.tableWidget_Disassemble.columnCount()): copied_string += self.tableWidget_Disassemble.item(row, column).text() + "\t" app.clipboard().setText(copied_string) selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = utils.extract_address(current_address_text) current_address_int = int(current_address, 16) menu = QMenu() go_to = menu.addAction(f"{tr.GO_TO_EXPRESSION}[Ctrl+G]") back = menu.addAction(tr.BACK) show_in_hex_view = menu.addAction(f"{tr.HEXVIEW_ADDRESS}[Ctrl+H]") menu.addSeparator() followable = utils.instruction_follow_address( self.tableWidget_Disassemble.item(selected_row, DISAS_OPCODES_COL).text() ) follow = menu.addAction(f"{tr.FOLLOW}[Space]") if not followable: guiutils.delete_menu_entries(menu, [follow]) examine_referrers = menu.addAction(f"{tr.EXAMINE_REFERRERS}[Ctrl+E]") if not guiutils.contains_reference_mark(current_address_text): guiutils.delete_menu_entries(menu, [examine_referrers]) bookmark = menu.addAction(f"{tr.BOOKMARK_ADDRESS}[Ctrl+B]") delete_bookmark = menu.addAction(tr.DELETE_BOOKMARK) change_comment = menu.addAction(tr.CHANGE_COMMENT) is_bookmarked = current_address_int in self.tableWidget_Disassemble.bookmarks if not is_bookmarked: guiutils.delete_menu_entries(menu, [delete_bookmark, change_comment]) else: guiutils.delete_menu_entries(menu, [bookmark]) go_to_bookmark = menu.addMenu(tr.GO_TO_BOOKMARK_ADDRESS) address_list = [hex(address) for address in self.tableWidget_Disassemble.bookmarks.keys()] bookmark_actions = [go_to_bookmark.addAction(item.all) for item in debugcore.examine_expressions(address_list)] menu.addSeparator() toggle_breakpoint = menu.addAction(f"{tr.TOGGLE_BREAKPOINT}[F5]") add_condition = menu.addAction(tr.CHANGE_BREAKPOINT_CONDITION) if not debugcore.get_breakpoints_in_range(current_address_int): guiutils.delete_menu_entries(menu, [add_condition]) menu.addSeparator() edit_instruction = menu.addAction(tr.EDIT_INSTRUCTION) nop_instruction = menu.addAction(tr.REPLACE_WITH_NOPS) if self.tableWidget_Disassemble.item(selected_row, DISAS_BYTES_COL).text() == "90": guiutils.delete_menu_entries(menu, [nop_instruction]) menu.addSeparator() track_breakpoint = menu.addAction(tr.WHAT_ACCESSES_INSTRUCTION) trace_instructions = menu.addAction(f"{tr.TRACE_INSTRUCTION}[Ctrl+T]") dissect_region = menu.addAction(f"{tr.DISSECT_REGION}[Ctrl+D]") menu.addSeparator() refresh = menu.addAction(f"{tr.REFRESH}[R]") menu.addSeparator() if debugcore.currentpid == -1: menu.clear() clipboard_menu = menu.addMenu(tr.COPY_CLIPBOARD) copy_address = clipboard_menu.addAction(tr.COPY_ADDRESS) copy_bytes = clipboard_menu.addAction(tr.COPY_BYTES) copy_opcode = clipboard_menu.addAction(tr.COPY_OPCODE) copy_comment = clipboard_menu.addAction(tr.COPY_COMMENT) copy_all = clipboard_menu.addAction(tr.COPY_ALL) font_size = self.tableWidget_Disassemble.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { go_to: self.exec_disassemble_go_to_dialog, back: self.disassemble_go_back, show_in_hex_view: lambda: self.hex_dump_address(current_address_int), follow: lambda: self.follow_instruction(selected_row), examine_referrers: lambda: self.exec_examine_referrers_widget(current_address_text), bookmark: lambda: self.bookmark_address(current_address_int), delete_bookmark: lambda: self.delete_bookmark(current_address_int), change_comment: lambda: self.change_bookmark_comment(current_address_int), toggle_breakpoint: self.toggle_breakpoint, add_condition: lambda: self.add_breakpoint_condition(current_address_int), edit_instruction: self.edit_instruction, nop_instruction: self.nop_instruction, track_breakpoint: self.exec_track_breakpoint_dialog, trace_instructions: self.exec_trace_instructions_dialog, dissect_region: self.dissect_current_region, refresh: self.refresh_disassemble_view, copy_address: lambda: copy_to_clipboard(selected_row, DISAS_ADDR_COL), copy_bytes: lambda: copy_to_clipboard(selected_row, DISAS_BYTES_COL), copy_opcode: lambda: copy_to_clipboard(selected_row, DISAS_OPCODES_COL), copy_comment: lambda: copy_to_clipboard(selected_row, DISAS_COMMENT_COL), copy_all: lambda: copy_all_columns(selected_row), } try: actions[action]() except KeyError: pass if action in bookmark_actions: self.disassemble_expression(utils.extract_address(action.text()), append_history=True) def dissect_current_region(self): if debugcore.currentpid == -1: return selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) if selected_row == -1: selected_row = 0 current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = utils.extract_address(current_address_text) dissect_code_dialog = DissectCodeDialogForm(self, int(current_address, 16)) dissect_code_dialog.scan_finished_signal.connect(dissect_code_dialog.accept) dissect_code_dialog.exec() self.refresh_disassemble_view() def exec_examine_referrers_widget(self, current_address_text): if debugcore.currentpid == -1: return if not guiutils.contains_reference_mark(current_address_text): return current_address = utils.extract_address(current_address_text) current_address_int = int(current_address, 16) examine_referrers_widget = ExamineReferrersWidgetForm(self, current_address_int) examine_referrers_widget.show() def exec_trace_instructions_dialog(self): if debugcore.currentpid == -1: return selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) if selected_row == -1: selected_row = 0 current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = utils.extract_address(current_address_text) TraceInstructionsWindowForm(self, current_address) def exec_track_breakpoint_dialog(self): if debugcore.currentpid == -1: return selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = utils.extract_address(current_address_text) current_instruction = self.tableWidget_Disassemble.item(selected_row, DISAS_OPCODES_COL).text() register_expression_dialog = InputDialogForm(self, [(tr.ENTER_TRACK_BP_EXPRESSION, "")]) if register_expression_dialog.exec(): exp = register_expression_dialog.get_values() TrackBreakpointWidgetForm(self, current_address, current_instruction, exp) def exec_disassemble_go_to_dialog(self): if debugcore.currentpid == -1: return selected_row = guiutils.get_current_row(self.tableWidget_Disassemble) if selected_row == -1: selected_row = 0 current_address_text = self.tableWidget_Disassemble.item(selected_row, DISAS_ADDR_COL).text() current_address = utils.extract_address(current_address_text) go_to_dialog = InputDialogForm(self, [(tr.ENTER_EXPRESSION, current_address)]) if go_to_dialog.exec(): traveled_exp = go_to_dialog.get_values() self.disassemble_expression(traveled_exp, append_history=True) def bookmark_address(self, int_address): if debugcore.currentpid == -1: return if int_address in self.tableWidget_Disassemble.bookmarks: QMessageBox.information(app.focusWidget(), tr.ERROR, tr.ALREADY_BOOKMARKED) return comment_dialog = InputDialogForm(self, [(tr.ENTER_BOOKMARK_COMMENT, "")]) if comment_dialog.exec(): comment = comment_dialog.get_values() else: return self.tableWidget_Disassemble.bookmarks[int_address] = comment self.refresh_disassemble_view() def change_bookmark_comment(self, int_address): if debugcore.currentpid == -1: return current_comment = self.tableWidget_Disassemble.bookmarks[int_address] comment_dialog = InputDialogForm(self, [(tr.ENTER_BOOKMARK_COMMENT, current_comment)]) if comment_dialog.exec(): new_comment = comment_dialog.get_values() else: return self.tableWidget_Disassemble.bookmarks[int_address] = new_comment self.refresh_disassemble_view() def delete_bookmark(self, int_address): if debugcore.currentpid == -1: return if int_address in self.tableWidget_Disassemble.bookmarks: del self.tableWidget_Disassemble.bookmarks[int_address] self.refresh_disassemble_view() def actionBookmarks_triggered(self): bookmark_widget = BookmarkWidgetForm(self) bookmark_widget.show() bookmark_widget.activateWindow() def actionStackTrace_Info_triggered(self): if debugcore.currentpid == -1: return self.stacktrace_info_widget.update_stacktrace() guiutils.center_to_parent(self.stacktrace_info_widget) self.stacktrace_info_widget.show() self.stacktrace_info_widget.activateWindow() def actionBreakpoints_triggered(self): if debugcore.currentpid == -1: return breakpoint_widget = BreakpointInfoWidgetForm(self) breakpoint_widget.show() breakpoint_widget.activateWindow() def actionFunctions_triggered(self): if debugcore.currentpid == -1: return functions_info_widget = FunctionsInfoWidgetForm(self) functions_info_widget.show() def actionGDB_Log_File_triggered(self): log_file_widget = LogFileWidgetForm(self) log_file_widget.showMaximized() def actionMemory_Regions_triggered(self): if debugcore.currentpid == -1: return memory_regions_widget = MemoryRegionsWidgetForm(self) memory_regions_widget.show() def actionRestore_Instructions_triggered(self): if debugcore.currentpid == -1: return restore_instructions_widget = RestoreInstructionsWidgetForm(self) restore_instructions_widget.show() restore_instructions_widget.activateWindow() def actionReferenced_Strings_triggered(self): if debugcore.currentpid == -1: return ref_str_widget = ReferencedStringsWidgetForm(self) ref_str_widget.show() def actionReferenced_Calls_triggered(self): if debugcore.currentpid == -1: return ref_call_widget = ReferencedCallsWidgetForm(self) ref_call_widget.show() def actionInject_so_file_triggered(self): if debugcore.currentpid == -1: return file_path, _ = QFileDialog.getOpenFileName(self, tr.SELECT_SO_FILE, "", tr.SHARED_OBJECT_TYPE) if file_path: if debugcore.inject_with_dlopen_call(file_path): QMessageBox.information(self, tr.SUCCESS, tr.FILE_INJECTED) else: QMessageBox.information(self, tr.ERROR, tr.FILE_INJECT_FAILED) def actionCall_Function_triggered(self): if debugcore.currentpid == -1: return call_dialog = InputDialogForm(self, [(tr.ENTER_CALL_EXPRESSION, "")]) if call_dialog.exec(): result = debugcore.call_function_from_inferior(call_dialog.get_values()) if result[0]: QMessageBox.information(self, tr.SUCCESS, result[0] + " = " + result[1]) else: QMessageBox.information(self, tr.ERROR, tr.CALL_EXPRESSION_FAILED.format(call_dialog.get_values())) def actionSearch_Opcode_triggered(self): if debugcore.currentpid == -1: return start_address = int(self.disassemble_currently_displayed_address, 16) end_address = start_address + 0x30000 search_opcode_widget = SearchOpcodeWidgetForm(self, hex(start_address), hex(end_address)) search_opcode_widget.show() def actionDissect_Code_triggered(self): if debugcore.currentpid == -1: return dissect_code_dialog = DissectCodeDialogForm(self) dissect_code_dialog.exec() self.refresh_disassemble_view() def actionlibpince_triggered(self): utils.execute_command_as_user('python3 -m webbrowser "path_to_url"') def pushButton_ShowFloatRegisters_clicked(self): if debugcore.currentpid == -1 or debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING: return self.float_registers_widget.update_registers() guiutils.center_to_parent(self.float_registers_widget) self.float_registers_widget.show() self.float_registers_widget.activateWindow() class BookmarkWidgetForm(QWidget, BookmarkWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.listWidget.contextMenuEvent = self.listWidget_context_menu_event self.listWidget.currentRowChanged.connect(self.change_display) self.listWidget.itemDoubleClicked.connect(self.listWidget_item_double_clicked) self.shortcut_delete = QShortcut(QKeySequence("Del"), self) self.shortcut_delete.activated.connect(self.delete_record) self.shortcut_refresh = QShortcut(QKeySequence("R"), self) self.shortcut_refresh.activated.connect(self.refresh_table) self.refresh_table() guiutils.center_to_parent(self) def refresh_table(self): self.listWidget.clear() address_list = [hex(address) for address in self.parent().tableWidget_Disassemble.bookmarks.keys()] if debugcore.currentpid == -1: self.listWidget.addItems(address_list) else: self.listWidget.addItems([item.all for item in debugcore.examine_expressions(address_list)]) def change_display(self, row): current_address = utils.extract_address(self.listWidget.item(row).text()) if debugcore.currentpid == -1: self.lineEdit_Info.clear() else: self.lineEdit_Info.setText(debugcore.get_address_info(current_address)) self.lineEdit_Comment.setText(self.parent().tableWidget_Disassemble.bookmarks[int(current_address, 16)]) def listWidget_item_double_clicked(self, item): self.parent().disassemble_expression(utils.extract_address(item.text()), append_history=True) def exec_add_entry_dialog(self): entry_dialog = InputDialogForm(self, [(tr.ENTER_EXPRESSION, "")]) if entry_dialog.exec(): text = entry_dialog.get_values() address = debugcore.examine_expression(text).address if not address: QMessageBox.information(self, tr.ERROR, tr.INVALID_EXPRESSION) return self.parent().bookmark_address(int(address, 16)) self.refresh_table() def exec_change_comment_dialog(self, current_address): self.parent().change_bookmark_comment(current_address) self.refresh_table() def listWidget_context_menu_event(self, event): current_item = guiutils.get_current_item(self.listWidget) if current_item: current_address = int(utils.extract_address(current_item.text()), 16) if current_address not in self.parent().tableWidget_Disassemble.bookmarks: QMessageBox.information(self, tr.ERROR, tr.INVALID_ENTRY) self.refresh_table() return else: current_address = None menu = QMenu() add_entry = menu.addAction(tr.ADD_ENTRY) change_comment = menu.addAction(tr.CHANGE_COMMENT) delete_record = menu.addAction(f"{tr.DELETE}[Del]") if current_item is None: guiutils.delete_menu_entries(menu, [change_comment, delete_record]) menu.addSeparator() refresh = menu.addAction(f"{tr.REFRESH}[R]") font_size = self.listWidget.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { add_entry: self.exec_add_entry_dialog, change_comment: lambda: self.exec_change_comment_dialog(current_address), delete_record: self.delete_record, refresh: self.refresh_table, } try: actions[action]() except KeyError: pass def delete_record(self): current_item = guiutils.get_current_item(self.listWidget) if not current_item: return current_address = int(utils.extract_address(current_item.text()), 16) self.parent().delete_bookmark(current_address) self.refresh_table() class FloatRegisterWidgetForm(QTabWidget, FloatRegisterWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.tableWidget_FPU.itemDoubleClicked.connect(self.set_register) self.tableWidget_XMM.itemDoubleClicked.connect(self.set_register) def update_registers(self): self.tableWidget_FPU.setRowCount(0) self.tableWidget_FPU.setRowCount(8) self.tableWidget_XMM.setRowCount(0) self.tableWidget_XMM.setRowCount(16) float_registers = list(debugcore.read_float_registers().items()) st_registers = float_registers[:8] xmm_registers = float_registers[8:] for row, (name, value) in enumerate(st_registers): self.tableWidget_FPU.setItem(row, FLOAT_REGISTERS_NAME_COL, QTableWidgetItem(name)) self.tableWidget_FPU.setItem(row, FLOAT_REGISTERS_VALUE_COL, QTableWidgetItem(value)) for row, (name, value) in enumerate(xmm_registers): self.tableWidget_XMM.setItem(row, FLOAT_REGISTERS_NAME_COL, QTableWidgetItem(name)) self.tableWidget_XMM.setItem(row, FLOAT_REGISTERS_VALUE_COL, QTableWidgetItem(value)) def set_register(self, index): if debugcore.currentpid == -1 or debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING: return current_row = index.row() if self.currentWidget() == self.FPU: current_table_widget = self.tableWidget_FPU elif self.currentWidget() == self.XMM: current_table_widget = self.tableWidget_XMM else: raise Exception("Current widget is invalid: " + str(self.currentWidget().objectName())) current_register = current_table_widget.item(current_row, FLOAT_REGISTERS_NAME_COL).text() current_value = current_table_widget.item(current_row, FLOAT_REGISTERS_VALUE_COL).text() label_text = tr.ENTER_REGISTER_VALUE.format(current_register.upper()) register_dialog = InputDialogForm(self, [(label_text, current_value)]) if register_dialog.exec(): if debugcore.currentpid == -1 or debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING: return if self.currentWidget() == self.XMM: current_register += ".v4_float" debugcore.set_convenience_variable(current_register, register_dialog.get_values()) self.update_registers() class StackTraceInfoWidgetForm(QWidget, StackTraceInfoWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.listWidget_ReturnAddresses.currentRowChanged.connect(self.update_frame_info) def update_stacktrace(self): self.listWidget_ReturnAddresses.clear() if debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING: return return_addresses = debugcore.get_stack_frame_return_addresses() self.listWidget_ReturnAddresses.addItems(return_addresses) def update_frame_info(self, index): if debugcore.inferior_status == typedefs.INFERIOR_STATUS.RUNNING: self.textBrowser_Info.setText(tr.PROCESS_RUNNING) return frame_info = debugcore.get_stack_frame_info(index) self.textBrowser_Info.setText(frame_info) class RestoreInstructionsWidgetForm(QWidget, RestoreInstructionsWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) # Saving the original function because super() doesn't work when we override functions like this self.tableWidget_Instructions.keyPressEvent_original = self.tableWidget_Instructions.keyPressEvent self.tableWidget_Instructions.keyPressEvent = self.tableWidget_Instructions_key_press_event self.tableWidget_Instructions.contextMenuEvent = self.tableWidget_Instructions_context_menu_event self.tableWidget_Instructions.itemDoubleClicked.connect(self.tableWidget_Instructions_double_clicked) self.refresh() guiutils.center_to_parent(self) def tableWidget_Instructions_context_menu_event(self, event): selected_row = guiutils.get_current_row(self.tableWidget_Instructions) menu = QMenu() restore_instruction = menu.addAction(tr.RESTORE_INSTRUCTION) if selected_row != -1: selected_address_text = self.tableWidget_Instructions.item(selected_row, INSTR_ADDR_COL).text() selected_address = utils.extract_address(selected_address_text) selected_address_int = int(selected_address, 16) else: guiutils.delete_menu_entries(menu, [restore_instruction]) selected_address_int = None menu.addSeparator() refresh = menu.addAction(f"{tr.REFRESH}[R]") font_size = self.tableWidget_Instructions.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = {restore_instruction: lambda: self.restore_instruction(selected_address_int), refresh: self.refresh} try: actions[action]() except KeyError: pass def restore_instruction(self, selected_address_int): debugcore.restore_instruction(selected_address_int) self.refresh_all() def refresh(self): modified_instructions = debugcore.get_modified_instructions() self.tableWidget_Instructions.setRowCount(len(modified_instructions)) for row, (address, aob) in enumerate(modified_instructions.items()): self.tableWidget_Instructions.setItem(row, INSTR_ADDR_COL, QTableWidgetItem(hex(address))) self.tableWidget_Instructions.setItem(row, INSTR_AOB_COL, QTableWidgetItem(aob)) instr_name = utils.get_opcodes(address, aob, debugcore.get_inferior_arch()) if not instr_name: instr_name = "??" self.tableWidget_Instructions.setItem(row, INSTR_NAME_COL, QTableWidgetItem(instr_name)) guiutils.resize_to_contents(self.tableWidget_Instructions) def refresh_all(self): self.parent().refresh_hex_view() self.parent().refresh_disassemble_view() self.refresh() def tableWidget_Instructions_key_press_event(self, event): actions = typedefs.KeyboardModifiersTupleDict( [(QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_R), self.refresh)] ) try: actions[QKeyCombination(event.modifiers(), Qt.Key(event.key()))]() except KeyError: pass self.tableWidget_Instructions.keyPressEvent_original(event) def tableWidget_Instructions_double_clicked(self, index): current_address_text = self.tableWidget_Instructions.item(index.row(), INSTR_ADDR_COL).text() current_address = utils.extract_address(current_address_text) self.parent().disassemble_expression(current_address, append_history=True) class BreakpointInfoWidgetForm(QTabWidget, BreakpointInfoWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.tableWidget_BreakpointInfo.contextMenuEvent = self.tableWidget_BreakpointInfo_context_menu_event # Saving the original function because super() doesn't work when we override functions like this self.tableWidget_BreakpointInfo.keyPressEvent_original = self.tableWidget_BreakpointInfo.keyPressEvent self.tableWidget_BreakpointInfo.keyPressEvent = self.tableWidget_BreakpointInfo_key_press_event self.tableWidget_BreakpointInfo.itemDoubleClicked.connect(self.tableWidget_BreakpointInfo_double_clicked) self.refresh() guiutils.center_to_parent(self) def refresh(self): break_info = debugcore.get_breakpoint_info() self.tableWidget_BreakpointInfo.setRowCount(0) self.tableWidget_BreakpointInfo.setRowCount(len(break_info)) for row, item in enumerate(break_info): self.tableWidget_BreakpointInfo.setItem(row, BREAK_NUM_COL, QTableWidgetItem(item.number)) self.tableWidget_BreakpointInfo.setItem(row, BREAK_TYPE_COL, QTableWidgetItem(item.breakpoint_type)) self.tableWidget_BreakpointInfo.setItem(row, BREAK_DISP_COL, QTableWidgetItem(item.disp)) self.tableWidget_BreakpointInfo.setItem(row, BREAK_ENABLED_COL, QTableWidgetItem(item.enabled)) self.tableWidget_BreakpointInfo.setItem(row, BREAK_ADDR_COL, QTableWidgetItem(item.address)) self.tableWidget_BreakpointInfo.setItem(row, BREAK_SIZE_COL, QTableWidgetItem(str(item.size))) self.tableWidget_BreakpointInfo.setItem(row, BREAK_ON_HIT_COL, QTableWidgetItem(item.on_hit)) self.tableWidget_BreakpointInfo.setItem(row, BREAK_HIT_COUNT_COL, QTableWidgetItem(item.hit_count)) self.tableWidget_BreakpointInfo.setItem(row, BREAK_COND_COL, QTableWidgetItem(item.condition)) guiutils.resize_to_contents(self.tableWidget_BreakpointInfo) self.textBrowser_BreakpointInfo.clear() self.textBrowser_BreakpointInfo.setText(debugcore.send_command("info break", cli_output=True)) def delete_breakpoint(self, address): if address is not None: debugcore.delete_breakpoint(address) self.refresh_all() def tableWidget_BreakpointInfo_key_press_event(self, event): selected_row = guiutils.get_current_row(self.tableWidget_BreakpointInfo) if selected_row != -1: current_address_text = self.tableWidget_BreakpointInfo.item(selected_row, BREAK_ADDR_COL).text() current_address = utils.extract_address(current_address_text) else: current_address = None actions = typedefs.KeyboardModifiersTupleDict( [ ( QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_Delete), lambda: self.delete_breakpoint(current_address), ), (QKeyCombination(Qt.KeyboardModifier.NoModifier, Qt.Key.Key_R), self.refresh), ] ) try: actions[QKeyCombination(event.modifiers(), Qt.Key(event.key()))]() except KeyError: pass self.tableWidget_BreakpointInfo.keyPressEvent_original(event) def exec_enable_count_dialog(self, current_address): hit_count_dialog = InputDialogForm(self, [(tr.ENTER_HIT_COUNT.format(1), "")]) if hit_count_dialog.exec(): count = hit_count_dialog.get_values() try: count = int(count) except ValueError: QMessageBox.information(self, tr.ERROR, tr.HIT_COUNT_ASSERT_INT) else: if count < 1: QMessageBox.information(self, tr.ERROR, tr.HIT_COUNT_ASSERT_LT.format(1)) else: debugcore.modify_breakpoint(current_address, typedefs.BREAKPOINT_MODIFY.ENABLE_COUNT, count=count) def tableWidget_BreakpointInfo_context_menu_event(self, event): selected_row = guiutils.get_current_row(self.tableWidget_BreakpointInfo) if selected_row != -1: current_address_text = self.tableWidget_BreakpointInfo.item(selected_row, BREAK_ADDR_COL).text() current_address = utils.extract_address(current_address_text) current_address_int = int(current_address, 16) else: current_address = None current_address_int = None menu = QMenu() change_condition = menu.addAction(tr.CHANGE_CONDITION) enable = menu.addAction(tr.ENABLE) disable = menu.addAction(tr.DISABLE) enable_once = menu.addAction(tr.DISABLE_AFTER_HIT) enable_count = menu.addAction(tr.DISABLE_AFTER_COUNT) enable_delete = menu.addAction(tr.DELETE_AFTER_HIT) menu.addSeparator() delete_breakpoint = menu.addAction(f"{tr.DELETE}[Del]") menu.addSeparator() if current_address is None: deletion_list = [ change_condition, enable, disable, enable_once, enable_count, enable_delete, delete_breakpoint, ] guiutils.delete_menu_entries(menu, deletion_list) refresh = menu.addAction(f"{tr.REFRESH}[R]") font_size = self.tableWidget_BreakpointInfo.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { change_condition: lambda: self.parent().add_breakpoint_condition(current_address_int), enable: lambda: debugcore.modify_breakpoint(current_address, typedefs.BREAKPOINT_MODIFY.ENABLE), disable: lambda: debugcore.modify_breakpoint(current_address, typedefs.BREAKPOINT_MODIFY.DISABLE), enable_once: lambda: debugcore.modify_breakpoint(current_address, typedefs.BREAKPOINT_MODIFY.ENABLE_ONCE), enable_count: lambda: self.exec_enable_count_dialog(current_address), enable_delete: lambda: debugcore.modify_breakpoint( current_address, typedefs.BREAKPOINT_MODIFY.ENABLE_DELETE ), delete_breakpoint: lambda: debugcore.delete_breakpoint(current_address), refresh: self.refresh, } try: actions[action]() except KeyError: pass if action != -1 and action is not None: self.refresh_all() def refresh_all(self): self.parent().refresh_hex_view() self.parent().refresh_disassemble_view() self.refresh() def tableWidget_BreakpointInfo_double_clicked(self, index): current_address_text = self.tableWidget_BreakpointInfo.item(index.row(), BREAK_ADDR_COL).text() current_address = utils.extract_address(current_address_text) current_address_int = int(current_address, 16) if index.column() == BREAK_COND_COL: self.parent().add_breakpoint_condition(current_address_int) self.refresh_all() else: current_breakpoint_type = self.tableWidget_BreakpointInfo.item(index.row(), BREAK_TYPE_COL).text() if "breakpoint" in current_breakpoint_type: self.parent().disassemble_expression(current_address, append_history=True) else: self.parent().hex_dump_address(current_address_int) class TrackWatchpointWidgetForm(QWidget, TrackWatchpointWidget): def __init__(self, parent, address, length, watchpoint_type): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.update_timer = QTimer(timeout=self.update_list) self.stopped = False self.address = address self.info = {} self.last_selected_row = 0 if watchpoint_type == typedefs.WATCHPOINT_TYPE.WRITE_ONLY: string = tr.OPCODE_WRITING_TO.format(address) elif watchpoint_type == typedefs.WATCHPOINT_TYPE.READ_ONLY: string = tr.OPCODE_READING_FROM.format(address) elif watchpoint_type == typedefs.WATCHPOINT_TYPE.BOTH: string = tr.OPCODE_ACCESSING_TO.format(address) else: raise Exception("Watchpoint type is invalid: " + str(watchpoint_type)) self.setWindowTitle(string) guiutils.center_to_parent(self) # Called before the QMessageBox to center its position properly self.breakpoints = debugcore.track_watchpoint(address, length, watchpoint_type) if not self.breakpoints: QMessageBox.information(self, tr.ERROR, tr.TRACK_WATCHPOINT_FAILED.format(address)) self.close() return self.pushButton_Stop.clicked.connect(self.pushButton_Stop_clicked) self.pushButton_Refresh.clicked.connect(self.update_list) self.tableWidget_Opcodes.itemDoubleClicked.connect(self.tableWidget_Opcodes_item_double_clicked) self.tableWidget_Opcodes.selectionModel().currentChanged.connect(self.tableWidget_Opcodes_current_changed) self.update_timer.start(100) self.show() def update_list(self): info = debugcore.get_track_watchpoint_info(self.breakpoints) if not info or self.info == info: return self.info = info self.tableWidget_Opcodes.setRowCount(0) self.tableWidget_Opcodes.setRowCount(len(info)) for row, key in enumerate(info): self.tableWidget_Opcodes.setItem(row, TRACK_WATCHPOINT_COUNT_COL, QTableWidgetItem(str(info[key][0]))) self.tableWidget_Opcodes.setItem(row, TRACK_WATCHPOINT_ADDR_COL, QTableWidgetItem(info[key][1])) guiutils.resize_to_contents(self.tableWidget_Opcodes) self.tableWidget_Opcodes.selectRow(self.last_selected_row) def tableWidget_Opcodes_current_changed(self, QModelIndex_current): current_row = QModelIndex_current.row() if current_row >= 0: self.last_selected_row = current_row info = self.info key_list = list(info) key = key_list[self.last_selected_row] self.textBrowser_Info.clear() for item in info[key][2]: self.textBrowser_Info.append(item + "=" + info[key][2][item]) self.textBrowser_Info.append(" ") for item in info[key][3]: self.textBrowser_Info.append(item + "=" + info[key][3][item]) self.textBrowser_Info.verticalScrollBar().setValue(self.textBrowser_Info.verticalScrollBar().minimum()) self.textBrowser_Disassemble.setPlainText(info[key][4]) def tableWidget_Opcodes_item_double_clicked(self, index): self.parent().memory_view_window.disassemble_expression( self.tableWidget_Opcodes.item(index.row(), TRACK_WATCHPOINT_ADDR_COL).text(), append_history=True ) self.parent().memory_view_window.show() self.parent().memory_view_window.activateWindow() def pushButton_Stop_clicked(self): if self.stopped: self.close() return if not debugcore.delete_breakpoint(self.address): QMessageBox.information(self, tr.ERROR, tr.DELETE_WATCHPOINT_FAILED.format(self.address)) return self.stopped = True self.pushButton_Stop.setText(tr.CLOSE) def closeEvent(self, event: QCloseEvent): self.update_timer.stop() if self.breakpoints: if not self.stopped: debugcore.delete_breakpoint(self.address) watchpoint_file = utils.get_track_watchpoint_file(debugcore.currentpid, self.breakpoints) if os.path.exists(watchpoint_file): os.remove(watchpoint_file) super().closeEvent(event) class TrackBreakpointWidgetForm(QWidget, TrackBreakpointWidget): def __init__(self, parent, address, instruction, register_expressions): super().__init__(parent) self.setupUi(self) self.update_list_timer = QTimer(timeout=self.update_list) self.update_values_timer = QTimer(timeout=self.update_values) self.stopped = False self.address = address self.info = {} self.last_selected_row = 0 self.setWindowFlags(Qt.WindowType.Window) self.setWindowTitle(tr.ACCESSED_BY_INSTRUCTION.format(instruction)) guiutils.center_to_parent(self) # Called before the QMessageBox to center its position properly self.breakpoint = debugcore.track_breakpoint(address, register_expressions) if not self.breakpoint: QMessageBox.information(self, tr.ERROR, tr.TRACK_BREAKPOINT_FAILED.format(address)) self.close() return guiutils.fill_value_combobox(self.comboBox_ValueType) self.pushButton_Stop.clicked.connect(self.pushButton_Stop_clicked) self.tableWidget_TrackInfo.itemDoubleClicked.connect(self.tableWidget_TrackInfo_item_double_clicked) self.tableWidget_TrackInfo.selectionModel().currentChanged.connect(self.tableWidget_TrackInfo_current_changed) self.comboBox_ValueType.currentIndexChanged.connect(self.update_values) self.update_list_timer.start(100) self.update_values_timer.start(500) self.parent().refresh_disassemble_view() self.show() def update_list(self): info = debugcore.get_track_breakpoint_info(self.breakpoint) if not info: return if info == self.info: return self.info = info self.tableWidget_TrackInfo.setRowCount(0) for register_expression in info: for row, address in enumerate(info[register_expression]): self.tableWidget_TrackInfo.setRowCount(self.tableWidget_TrackInfo.rowCount() + 1) self.tableWidget_TrackInfo.setItem( row, TRACK_BREAKPOINT_COUNT_COL, QTableWidgetItem(str(info[register_expression][address])) ) self.tableWidget_TrackInfo.setItem(row, TRACK_BREAKPOINT_ADDR_COL, QTableWidgetItem(address)) self.tableWidget_TrackInfo.setItem( row, TRACK_BREAKPOINT_SOURCE_COL, QTableWidgetItem("[" + register_expression + "]") ) self.update_values() def update_values(self): mem_handle = debugcore.memory_handle() value_type = self.comboBox_ValueType.currentIndex() for row in range(self.tableWidget_TrackInfo.rowCount()): address = self.tableWidget_TrackInfo.item(row, TRACK_BREAKPOINT_ADDR_COL).text() value = debugcore.read_memory(address, value_type, 10, mem_handle=mem_handle) value = "" if value is None else str(value) self.tableWidget_TrackInfo.setItem(row, TRACK_BREAKPOINT_VALUE_COL, QTableWidgetItem(value)) guiutils.resize_to_contents(self.tableWidget_TrackInfo) self.tableWidget_TrackInfo.selectRow(self.last_selected_row) def tableWidget_TrackInfo_current_changed(self, QModelIndex_current): current_row = QModelIndex_current.row() if current_row >= 0: self.last_selected_row = current_row def tableWidget_TrackInfo_item_double_clicked(self, index): address = self.tableWidget_TrackInfo.item(index.row(), TRACK_BREAKPOINT_ADDR_COL).text() vt = typedefs.ValueType(self.comboBox_ValueType.currentIndex()) self.parent().parent().add_entry_to_addresstable(tr.ACCESSED_BY.format(self.address), address, vt) self.parent().parent().update_address_table() def pushButton_Stop_clicked(self): if self.stopped: self.close() return if not debugcore.delete_breakpoint(self.address): QMessageBox.information(self, tr.ERROR, tr.DELETE_BREAKPOINT_FAILED.format(self.address)) return self.stopped = True self.pushButton_Stop.setText(tr.CLOSE) self.parent().refresh_disassemble_view() def closeEvent(self, event: QCloseEvent): self.update_list_timer.stop() self.update_values_timer.stop() if self.breakpoint: if not self.stopped: debugcore.delete_breakpoint(self.address) breakpoint_file = utils.get_track_breakpoint_file(debugcore.currentpid, self.breakpoint) if os.path.exists(breakpoint_file): os.remove(breakpoint_file) self.parent().refresh_disassemble_view() super().closeEvent(event) class TraceInstructionsPromptDialogForm(QDialog, TraceInstructionsPromptDialog): def __init__(self, parent): super().__init__(parent) self.setupUi(self) guiutils.center_to_parent(self) def get_values(self): max_trace_count = int(self.lineEdit_MaxTraceCount.text()) trigger_condition = self.lineEdit_TriggerCondition.text() stop_condition = self.lineEdit_StopCondition.text() if self.checkBox_StepOver.isChecked(): step_mode = typedefs.STEP_MODE.STEP_OVER else: step_mode = typedefs.STEP_MODE.SINGLE_STEP stop_after_trace = self.checkBox_StopAfterTrace.isChecked() collect_registers = self.checkBox_CollectRegisters.isChecked() return max_trace_count, trigger_condition, stop_condition, step_mode, stop_after_trace, collect_registers def accept(self): if int(self.lineEdit_MaxTraceCount.text()) >= 1: super().accept() else: QMessageBox.information(self, tr.ERROR, tr.MAX_TRACE_COUNT_ASSERT_GT.format(1)) class TraceInstructionsWaitWidgetForm(QWidget, TraceInstructionsWaitWidget): widget_closed = pyqtSignal() def __init__(self, parent, address: str, tracer: debugcore.Tracer): super().__init__(parent) self.setupUi(self) self.status_to_text = { typedefs.TRACE_STATUS.IDLE: tr.WAITING_FOR_BREAKPOINT, typedefs.TRACE_STATUS.FINISHED: tr.TRACING_COMPLETED, } self.setWindowFlags(Qt.WindowType.Window) self.address = address self.tracer = tracer media_directory = utils.get_media_directory() self.movie = QMovie(media_directory + "/TraceInstructionsWaitWidget/ajax-loader.gif", QByteArray()) self.label_Animated.setMovie(self.movie) self.movie.setScaledSize(QSize(215, 100)) self.movie.setCacheMode(QMovie.CacheMode.CacheAll) self.movie.setSpeed(100) self.movie.start() self.pushButton_Cancel.clicked.connect(self.close) tracer_thread = Worker(tracer.tracer_loop) tracer_thread.signals.finished.connect(self.close) threadpool.start(tracer_thread) self.status_timer = QTimer() self.status_timer.setInterval(50) self.status_timer.timeout.connect(self.change_status) self.status_timer.start() guiutils.center_to_parent(self) def change_status(self): if self.tracer.trace_status == typedefs.TRACE_STATUS.TRACING: self.label_StatusText.setText(f"{self.tracer.current_trace_count} / {self.tracer.max_trace_count}") else: self.label_StatusText.setText(self.status_to_text[self.tracer.trace_status]) app.processEvents() def closeEvent(self, event: QCloseEvent): self.status_timer.stop() self.label_StatusText.setText(tr.TRACING_COMPLETED) self.pushButton_Cancel.setVisible(False) self.adjustSize() app.processEvents() if self.tracer.trace_status == typedefs.TRACE_STATUS.TRACING: self.tracer.cancel_trace() while self.tracer.trace_status != typedefs.TRACE_STATUS.FINISHED: sleep(0.1) app.processEvents() self.widget_closed.emit() super().closeEvent(event) class TraceInstructionsWindowForm(QMainWindow, TraceInstructionsWindow): def __init__(self, parent, address="", prompt_dialog=True): super().__init__(parent) self.setupUi(self) self.address = address self.tracer = debugcore.Tracer() self.treeWidget_InstructionInfo.currentItemChanged.connect(self.display_collected_data) self.treeWidget_InstructionInfo.itemDoubleClicked.connect(self.treeWidget_InstructionInfo_item_double_clicked) self.treeWidget_InstructionInfo.contextMenuEvent = self.treeWidget_InstructionInfo_context_menu_event self.actionOpen.triggered.connect(self.load_file) self.actionSave.triggered.connect(self.save_file) self.splitter.setStretchFactor(0, 1) guiutils.center_to_parent(self) if not prompt_dialog: self.showMaximized() return prompt_dialog = TraceInstructionsPromptDialogForm(self) if prompt_dialog.exec(): params = (address,) + prompt_dialog.get_values() breakpoint = self.tracer.set_breakpoint(*params) if not breakpoint: QMessageBox.information(self, tr.ERROR, tr.BREAKPOINT_FAILED.format(address)) self.close() return self.showMaximized() self.wait_dialog = TraceInstructionsWaitWidgetForm(self, address, self.tracer) self.wait_dialog.widget_closed.connect(self.show_trace_info) self.wait_dialog.show() else: self.close() def display_collected_data(self, QTreeWidgetItem_current): self.textBrowser_RegisterInfo.clear() current_dict = QTreeWidgetItem_current.trace_data[1] if current_dict: for key in current_dict: self.textBrowser_RegisterInfo.append(str(key) + " = " + str(current_dict[key])) self.textBrowser_RegisterInfo.verticalScrollBar().setValue( self.textBrowser_RegisterInfo.verticalScrollBar().minimum() ) def show_trace_info(self): self.treeWidget_InstructionInfo.setStyleSheet("QTreeWidget::item{ height: 16px; }") parent = QTreeWidgetItem(self.treeWidget_InstructionInfo) self.treeWidget_InstructionInfo.setRootIndex(self.treeWidget_InstructionInfo.indexFromItem(parent)) trace_tree, current_root_index = copy.deepcopy(self.tracer.trace_data) while current_root_index is not None: try: current_index = trace_tree[current_root_index][2][0] # Get the first child current_item = trace_tree[current_index][0] del trace_tree[current_root_index][2][0] # Delete it except IndexError: # We've depleted the children current_root_index = trace_tree[current_root_index][1] # traverse upwards parent = parent.parent() continue child = QTreeWidgetItem(parent) child.trace_data = current_item child.setText(0, current_item[0]) if trace_tree[current_index][2]: # If current item has children, traverse them current_root_index = current_index # traverse downwards parent = child self.treeWidget_InstructionInfo.expandAll() def save_file(self): file_path, _ = QFileDialog.getSaveFileName(self, tr.SAVE_TRACE_FILE, None, tr.FILE_TYPES_TRACE) if file_path: file_path = utils.append_file_extension(file_path, "trace") if not utils.save_file(self.tracer.trace_data, file_path): QMessageBox.information(self, tr.ERROR, tr.FILE_SAVE_ERROR) def load_file(self): file_path, _ = QFileDialog.getOpenFileName(self, tr.OPEN_TRACE_FILE, None, tr.FILE_TYPES_TRACE) if file_path: content = utils.load_file(file_path) if content is None: QMessageBox.information(self, tr.ERROR, tr.FILE_LOAD_ERROR.format(file_path)) return self.treeWidget_InstructionInfo.clear() self.tracer.trace_data = content self.show_trace_info() def treeWidget_InstructionInfo_context_menu_event(self, event): menu = QMenu() expand_all = menu.addAction(tr.EXPAND_ALL) collapse_all = menu.addAction(tr.COLLAPSE_ALL) font_size = self.treeWidget_InstructionInfo.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { expand_all: self.treeWidget_InstructionInfo.expandAll, collapse_all: self.treeWidget_InstructionInfo.collapseAll, } try: actions[action]() except KeyError: pass def treeWidget_InstructionInfo_item_double_clicked(self, index): current_item = guiutils.get_current_item(self.treeWidget_InstructionInfo) if not current_item: return address = utils.extract_address(current_item.trace_data[0]) if address: self.parent().disassemble_expression(address, append_history=True) class FunctionsInfoWidgetForm(QWidget, FunctionsInfoWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.textBrowser_AddressInfo.setFixedHeight(100) self.pushButton_Search.clicked.connect(self.refresh_table) self.shortcut_search = QShortcut(QKeySequence("Return"), self) self.shortcut_search.activated.connect(self.refresh_table) self.tableWidget_SymbolInfo.selectionModel().currentChanged.connect(self.tableWidget_SymbolInfo_current_changed) self.tableWidget_SymbolInfo.itemDoubleClicked.connect(self.tableWidget_SymbolInfo_item_double_clicked) self.tableWidget_SymbolInfo.contextMenuEvent = self.tableWidget_SymbolInfo_context_menu_event icons_directory = guiutils.get_icons_directory() self.pushButton_Help.setIcon(QIcon(QPixmap(icons_directory + "/help.png"))) self.pushButton_Help.clicked.connect(self.pushButton_Help_clicked) guiutils.center_to_parent(self) def refresh_table(self): input_text = self.lineEdit_SearchInput.text() case_sensitive = self.checkBox_CaseSensitive.isChecked() self.loading_dialog = LoadingDialogForm(self) self.background_thread = self.loading_dialog.background_thread self.background_thread.overrided_func = lambda: self.process_data(input_text, case_sensitive) self.background_thread.output_ready.connect(self.apply_data) self.loading_dialog.exec() def process_data(self, gdb_input, case_sensitive): return debugcore.search_functions(gdb_input, case_sensitive) def apply_data(self, output): self.tableWidget_SymbolInfo.setSortingEnabled(False) self.tableWidget_SymbolInfo.setRowCount(0) self.tableWidget_SymbolInfo.setRowCount(len(output)) defined_color = QColor(QColorConstants.Green) defined_color.setAlpha(96) for row, item in enumerate(output): address = item[0] if address: address_item = QTableWidgetItem(address) else: address_item = QTableWidgetItem(tr.DEFINED) address_item.setBackground(defined_color) self.tableWidget_SymbolInfo.setItem(row, FUNCTIONS_INFO_ADDR_COL, address_item) self.tableWidget_SymbolInfo.setItem(row, FUNCTIONS_INFO_SYMBOL_COL, QTableWidgetItem(item[1])) self.tableWidget_SymbolInfo.setSortingEnabled(True) guiutils.resize_to_contents(self.tableWidget_SymbolInfo) def tableWidget_SymbolInfo_current_changed(self, QModelIndex_current): self.textBrowser_AddressInfo.clear() current_row = QModelIndex_current.row() if current_row < 0: return address = self.tableWidget_SymbolInfo.item(current_row, FUNCTIONS_INFO_ADDR_COL).text() if utils.extract_address(address): symbol = self.tableWidget_SymbolInfo.item(current_row, FUNCTIONS_INFO_SYMBOL_COL).text() for item in utils.split_symbol(symbol): info = debugcore.get_symbol_info(item) self.textBrowser_AddressInfo.append(info) else: self.textBrowser_AddressInfo.append(tr.DEFINED_SYMBOL) def tableWidget_SymbolInfo_context_menu_event(self, event): def copy_to_clipboard(row, column): app.clipboard().setText(self.tableWidget_SymbolInfo.item(row, column).text()) selected_row = guiutils.get_current_row(self.tableWidget_SymbolInfo) menu = QMenu() copy_address = menu.addAction(tr.COPY_ADDRESS) copy_symbol = menu.addAction(tr.COPY_SYMBOL) if selected_row == -1: guiutils.delete_menu_entries(menu, [copy_address, copy_symbol]) font_size = self.tableWidget_SymbolInfo.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { copy_address: lambda: copy_to_clipboard(selected_row, FUNCTIONS_INFO_ADDR_COL), copy_symbol: lambda: copy_to_clipboard(selected_row, FUNCTIONS_INFO_SYMBOL_COL), } try: actions[action]() except KeyError: pass def tableWidget_SymbolInfo_item_double_clicked(self, index): address = self.tableWidget_SymbolInfo.item(index.row(), FUNCTIONS_INFO_ADDR_COL).text() if address == tr.DEFINED: return self.parent().disassemble_expression(address, append_history=True) def pushButton_Help_clicked(self): InputDialogForm( self, [(tr.FUNCTIONS_INFO_HELPER, None, Qt.AlignmentFlag.AlignLeft)], buttons=[QDialogButtonBox.StandardButton.Ok], ).exec() class EditInstructionDialogForm(QDialog, EditInstructionDialog): def __init__(self, parent, address, bytes_aob): super().__init__(parent) self.setupUi(self) self.orig_bytes = bytes_aob self.lineEdit_Address.setText(address) self.lineEdit_Bytes.setText(bytes_aob) self.lineEdit_Bytes_text_edited() self.lineEdit_Bytes.textEdited.connect(self.lineEdit_Bytes_text_edited) self.lineEdit_Instruction.textEdited.connect(self.lineEdit_Instruction_text_edited) guiutils.center_to_parent(self) def set_valid(self, valid): if valid: self.is_valid = True self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(True) else: self.is_valid = False self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) def lineEdit_Bytes_text_edited(self): bytes_aob = self.lineEdit_Bytes.text() if utils.parse_string(bytes_aob, typedefs.VALUE_INDEX.AOB): address = int(self.lineEdit_Address.text(), 0) instruction = utils.get_opcodes(address, bytes_aob, debugcore.inferior_arch) if instruction: self.set_valid(True) self.lineEdit_Instruction.setText(instruction) return self.set_valid(False) self.lineEdit_Instruction.setText("??") def lineEdit_Instruction_text_edited(self): instruction = self.lineEdit_Instruction.text() address = int(self.lineEdit_Address.text(), 0) result = utils.assemble(instruction, address, debugcore.inferior_arch) if result: byte_list = result[0] self.set_valid(True) bytes_str = " ".join([format(num, "02x") for num in byte_list]) self.lineEdit_Bytes.setText(bytes_str) else: self.set_valid(False) self.lineEdit_Bytes.setText("??") def accept(self): if not self.is_valid: return # No need to check for validity since address is not editable and opcode is checked in text_edited address = int(self.lineEdit_Address.text(), 0) bytes_aob = self.lineEdit_Bytes.text() if bytes_aob != self.orig_bytes: new_length = len(bytes_aob.split()) old_length = len(self.orig_bytes.split()) if new_length < old_length: bytes_aob += " 90" * (old_length - new_length) # Append NOPs if we are short on bytes elif new_length > old_length: if not InputDialogForm(self, [(tr.NEW_OPCODE.format(new_length, old_length),)]).exec(): return debugcore.modify_instruction(address, bytes_aob) self.parent().refresh_hex_view() self.parent().refresh_disassemble_view() super().accept() class HexEditDialogForm(QDialog, HexEditDialog): def __init__(self, parent, address, length=20): super().__init__(parent) self.setupUi(self) self.lineEdit_Length.setValidator(QHexValidator(999, self)) self.lineEdit_Address.setText(hex(address)) self.lineEdit_Length.setText(str(length)) self.refresh_view() self.lineEdit_AsciiView.selectionChanged.connect(self.lineEdit_AsciiView_selection_changed) guiutils.center_to_parent(self) # TODO: Implement this # self.lineEdit_HexView.selectionChanged.connect(self.lineEdit_HexView_selection_changed) self.lineEdit_HexView.textEdited.connect(self.lineEdit_HexView_text_edited) self.lineEdit_AsciiView.textEdited.connect(self.lineEdit_AsciiView_text_edited) self.pushButton_Refresh.pressed.connect(self.refresh_view) self.lineEdit_Address.textChanged.connect(self.refresh_view) self.lineEdit_Length.textChanged.connect(self.refresh_view) def lineEdit_AsciiView_selection_changed(self): length = len(utils.str_to_aob(self.lineEdit_AsciiView.selectedText(), "utf-8")) start_index = self.lineEdit_AsciiView.selectionStart() start_index = len(utils.str_to_aob(self.lineEdit_AsciiView.text()[0:start_index], "utf-8")) if start_index > 0: start_index += 1 self.lineEdit_HexView.deselect() self.lineEdit_HexView.setSelection(start_index, length) def lineEdit_HexView_selection_changed(self): # TODO: Implement this print("TODO: Implement selectionChanged signal of lineEdit_HexView") raise NotImplementedError def lineEdit_HexView_text_edited(self): aob_string = self.lineEdit_HexView.text() if not utils.parse_string(aob_string, typedefs.VALUE_INDEX.AOB): self.lineEdit_HexView.setStyleSheet("QLineEdit {background-color: rgba(255, 0, 0, 96);}") return aob_array = aob_string.split() try: self.lineEdit_AsciiView.setText(utils.aob_to_str(aob_array, "utf-8", replace_unprintable=False)) self.lineEdit_HexView.setStyleSheet("") # This should set background color back to QT default except ValueError: self.lineEdit_HexView.setStyleSheet("QLineEdit {background-color: rgba(255, 0, 0, 96);}") def lineEdit_AsciiView_text_edited(self): ascii_str = self.lineEdit_AsciiView.text() try: self.lineEdit_HexView.setText(utils.str_to_aob(ascii_str, "utf-8")) self.lineEdit_AsciiView.setStyleSheet("") except ValueError: self.lineEdit_AsciiView.setStyleSheet("QLineEdit {background-color: rgba(255, 0, 0, 96);}") def refresh_view(self): self.lineEdit_AsciiView.clear() self.lineEdit_HexView.clear() address = debugcore.examine_expression(self.lineEdit_Address.text()).address if not address: return length = self.lineEdit_Length.text() try: length = int(length, 0) address = int(address, 0) except ValueError: return aob_array = debugcore.hex_dump(address, length) ascii_str = utils.aob_to_str(aob_array, "utf-8", replace_unprintable=False) self.lineEdit_AsciiView.setText(ascii_str) self.lineEdit_HexView.setText(" ".join(aob_array)) def accept(self): expression = self.lineEdit_Address.text() address = debugcore.examine_expression(expression).address if not address: QMessageBox.information(self, tr.ERROR, tr.IS_INVALID_EXPRESSION.format(expression)) return value = self.lineEdit_HexView.text() debugcore.write_memory(address, typedefs.VALUE_INDEX.AOB, value) super().accept() class LogFileWidgetForm(QWidget, LogFileWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.contents = "" self.refresh_contents() self.refresh_timer = QTimer() self.refresh_timer.setInterval(500) self.refresh_timer.timeout.connect(self.refresh_contents) self.refresh_timer.start() guiutils.center_to_parent(self) def refresh_contents(self): log_path = utils.get_logging_file(debugcore.currentpid) self.setWindowTitle(tr.LOG_FILE.format(debugcore.currentpid)) self.label_FilePath.setText(tr.LOG_CONTENTS.format(log_path, 20000)) log_status = f"<font color=blue>{tr.ON}</font>" if settings.gdb_logging else f"<font color=red>{tr.OFF}</font>" self.label_LoggingStatus.setText(f"<b>{tr.LOG_STATUS.format(log_status)}</b>") try: log_file = open(log_path) except OSError: self.textBrowser_LogContent.clear() error_message = tr.LOG_READ_ERROR.format(log_path) + "\n" if not settings.gdb_logging: error_message += tr.SETTINGS_ENABLE_LOG self.textBrowser_LogContent.setText(error_message) return log_file.seek(0, io.SEEK_END) end_pos = log_file.tell() if end_pos > 20000: log_file.seek(end_pos - 20000, io.SEEK_SET) else: log_file.seek(0, io.SEEK_SET) contents = log_file.read().split("\n", 1)[-1] if contents != self.contents: self.contents = contents self.textBrowser_LogContent.clear() self.textBrowser_LogContent.setPlainText(contents) # Scrolling to bottom cursor = self.textBrowser_LogContent.textCursor() cursor.movePosition(QTextCursor.MoveOperation.End) self.textBrowser_LogContent.setTextCursor(cursor) self.textBrowser_LogContent.ensureCursorVisible() log_file.close() def closeEvent(self, event: QCloseEvent): self.refresh_timer.stop() super().closeEvent(event) class SearchOpcodeWidgetForm(QWidget, SearchOpcodeWidget): def __init__(self, parent, start="", end=""): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.lineEdit_Start.setText(start) self.lineEdit_End.setText(end) self.tableWidget_Opcodes.setColumnWidth(SEARCH_OPCODE_ADDR_COL, 250) icons_directory = guiutils.get_icons_directory() self.pushButton_Help.setIcon(QIcon(QPixmap(icons_directory + "/help.png"))) self.pushButton_Help.clicked.connect(self.pushButton_Help_clicked) self.pushButton_Search.clicked.connect(self.refresh_table) self.shortcut_search = QShortcut(QKeySequence("Return"), self) self.shortcut_search.activated.connect(self.refresh_table) self.tableWidget_Opcodes.itemDoubleClicked.connect(self.tableWidget_Opcodes_item_double_clicked) self.tableWidget_Opcodes.contextMenuEvent = self.tableWidget_Opcodes_context_menu_event guiutils.center_to_parent(self) def refresh_table(self): start_address = self.lineEdit_Start.text() end_address = self.lineEdit_End.text() regex = self.lineEdit_Regex.text() case_sensitive = self.checkBox_CaseSensitive.isChecked() enable_regex = self.checkBox_Regex.isChecked() self.loading_dialog = LoadingDialogForm(self) self.background_thread = self.loading_dialog.background_thread self.background_thread.overrided_func = lambda: self.process_data( regex, start_address, end_address, case_sensitive, enable_regex ) self.background_thread.output_ready.connect(self.apply_data) self.loading_dialog.exec() def process_data(self, regex, start_address, end_address, case_sensitive, enable_regex): return debugcore.search_opcode(regex, start_address, end_address, case_sensitive, enable_regex) def apply_data(self, disas_data): if disas_data is None: QMessageBox.information(self, tr.ERROR, tr.INVALID_REGEX) return self.tableWidget_Opcodes.setSortingEnabled(False) self.tableWidget_Opcodes.setRowCount(0) self.tableWidget_Opcodes.setRowCount(len(disas_data)) for row, item in enumerate(disas_data): self.tableWidget_Opcodes.setItem(row, SEARCH_OPCODE_ADDR_COL, QTableWidgetItem(item[0])) self.tableWidget_Opcodes.setItem(row, SEARCH_OPCODE_OPCODES_COL, QTableWidgetItem(item[1])) self.tableWidget_Opcodes.setSortingEnabled(True) def pushButton_Help_clicked(self): InputDialogForm( self, [(tr.SEARCH_OPCODE_HELPER, None, Qt.AlignmentFlag.AlignLeft)], buttons=[QDialogButtonBox.StandardButton.Ok], ).exec() def tableWidget_Opcodes_item_double_clicked(self, index): row = index.row() address = self.tableWidget_Opcodes.item(row, SEARCH_OPCODE_ADDR_COL).text() self.parent().disassemble_expression(utils.extract_address(address), append_history=True) def tableWidget_Opcodes_context_menu_event(self, event): def copy_to_clipboard(row, column): app.clipboard().setText(self.tableWidget_Opcodes.item(row, column).text()) selected_row = guiutils.get_current_row(self.tableWidget_Opcodes) menu = QMenu() copy_address = menu.addAction(tr.COPY_ADDRESS) copy_opcode = menu.addAction(tr.COPY_OPCODE) if selected_row == -1: guiutils.delete_menu_entries(menu, [copy_address, copy_opcode]) font_size = self.tableWidget_Opcodes.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { copy_address: lambda: copy_to_clipboard(selected_row, SEARCH_OPCODE_ADDR_COL), copy_opcode: lambda: copy_to_clipboard(selected_row, SEARCH_OPCODE_OPCODES_COL), } try: actions[action]() except KeyError: pass class MemoryRegionsWidgetForm(QWidget, MemoryRegionsWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.refresh_table() self.tableWidget_MemoryRegions.contextMenuEvent = self.tableWidget_MemoryRegions_context_menu_event self.tableWidget_MemoryRegions.itemDoubleClicked.connect(self.tableWidget_MemoryRegions_item_double_clicked) self.shortcut_refresh = QShortcut(QKeySequence("R"), self) self.shortcut_refresh.activated.connect(self.refresh_table) guiutils.center_to_parent(self) def refresh_table(self): memory_regions = utils.get_regions(debugcore.currentpid) self.tableWidget_MemoryRegions.setRowCount(0) self.tableWidget_MemoryRegions.setRowCount(len(memory_regions)) for row, (start, end, perms, offset, _, _, path) in enumerate(memory_regions): address = start + "-" + end self.tableWidget_MemoryRegions.setItem(row, MEMORY_REGIONS_ADDR_COL, QTableWidgetItem(address)) self.tableWidget_MemoryRegions.setItem(row, MEMORY_REGIONS_PERM_COL, QTableWidgetItem(perms)) self.tableWidget_MemoryRegions.setItem(row, MEMORY_REGIONS_OFFSET_COL, QTableWidgetItem(offset)) self.tableWidget_MemoryRegions.setItem(row, MEMORY_REGIONS_PATH_COL, QTableWidgetItem(path)) guiutils.resize_to_contents(self.tableWidget_MemoryRegions) def tableWidget_MemoryRegions_context_menu_event(self, event): def copy_to_clipboard(row, column): app.clipboard().setText(self.tableWidget_MemoryRegions.item(row, column).text()) selected_row = guiutils.get_current_row(self.tableWidget_MemoryRegions) menu = QMenu() refresh = menu.addAction(f"{tr.REFRESH}[R]") menu.addSeparator() copy_addresses = menu.addAction(tr.COPY_ADDRESSES) copy_offset = menu.addAction(tr.COPY_OFFSET) copy_path = menu.addAction(tr.COPY_PATH) if selected_row == -1: guiutils.delete_menu_entries(menu, [copy_addresses, copy_offset, copy_path]) font_size = self.tableWidget_MemoryRegions.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { refresh: self.refresh_table, copy_addresses: lambda: copy_to_clipboard(selected_row, MEMORY_REGIONS_ADDR_COL), copy_offset: lambda: copy_to_clipboard(selected_row, MEMORY_REGIONS_OFFSET_COL), copy_path: lambda: copy_to_clipboard(selected_row, MEMORY_REGIONS_PATH_COL), } try: actions[action]() except KeyError: pass def tableWidget_MemoryRegions_item_double_clicked(self, index): row = index.row() address = self.tableWidget_MemoryRegions.item(row, MEMORY_REGIONS_ADDR_COL).text() address_int = int(address.split("-")[0], 16) self.parent().hex_dump_address(address_int) class DissectCodeDialogForm(QDialog, DissectCodeDialog): scan_finished_signal = pyqtSignal() def __init__(self, parent, int_address=-1): super().__init__(parent) self.setupUi(self) self.init_pre_scan_gui() self.update_dissect_results() self.show_memory_regions() self.splitter.setStretchFactor(0, 1) self.pushButton_StartCancel.clicked.connect(self.pushButton_StartCancel_clicked) self.refresh_timer = QTimer() self.refresh_timer.setInterval(100) self.refresh_timer.timeout.connect(self.refresh_dissect_status) if int_address != -1: for row in range(self.tableWidget_ExecutableMemoryRegions.rowCount()): item = self.tableWidget_ExecutableMemoryRegions.item(row, DISSECT_CODE_ADDR_COL).text() start_addr, end_addr = item.split("-") if int(start_addr, 16) <= int_address <= int(end_addr, 16): self.tableWidget_ExecutableMemoryRegions.clearSelection() self.tableWidget_ExecutableMemoryRegions.selectRow(row) self.pushButton_StartCancel_clicked() break else: QMessageBox.information(self, tr.ERROR, tr.INVALID_REGION) else: if self.tableWidget_ExecutableMemoryRegions.rowCount() > 0: self.tableWidget_ExecutableMemoryRegions.selectRow(0) guiutils.center_to_parent(self) class BackgroundThread(QThread): output_ready = pyqtSignal() is_canceled = False def __init__(self, region_list, discard_invalid_strings): super().__init__() self.region_list = region_list self.discard_invalid_strings = discard_invalid_strings def run(self): debugcore.dissect_code(self.region_list, self.discard_invalid_strings) if not self.is_canceled: self.output_ready.emit() def init_pre_scan_gui(self): self.is_scanning = False self.is_canceled = False self.pushButton_StartCancel.setText(tr.START) def init_after_scan_gui(self): self.is_scanning = True self.label_ScanInfo.setText(tr.CURRENT_SCAN_REGION) self.pushButton_StartCancel.setText(tr.CANCEL) def refresh_dissect_status(self): region, region_count, range, string_count, jump_count, call_count = debugcore.get_dissect_code_status() if not region: return self.label_RegionInfo.setText(region) self.label_RegionCountInfo.setText(region_count) self.label_CurrentRange.setText(range) self.label_StringReferenceCount.setText(str(string_count)) self.label_JumpReferenceCount.setText(str(jump_count)) self.label_CallReferenceCount.setText(str(call_count)) def update_dissect_results(self): try: referenced_strings, referenced_jumps, referenced_calls = debugcore.get_dissect_code_data() except: return self.label_StringReferenceCount.setText(str(len(referenced_strings))) self.label_JumpReferenceCount.setText(str(len(referenced_jumps))) self.label_CallReferenceCount.setText(str(len(referenced_calls))) def show_memory_regions(self): executable_regions = utils.filter_regions(debugcore.currentpid, "permissions", "..x.") self.region_list = [] self.tableWidget_ExecutableMemoryRegions.setRowCount(0) self.tableWidget_ExecutableMemoryRegions.setRowCount(len(executable_regions)) for row, (start, end, _, _, _, _, path) in enumerate(executable_regions): address = start + "-" + end self.region_list.append((start, end)) self.tableWidget_ExecutableMemoryRegions.setItem(row, DISSECT_CODE_ADDR_COL, QTableWidgetItem(address)) self.tableWidget_ExecutableMemoryRegions.setItem(row, DISSECT_CODE_PATH_COL, QTableWidgetItem(path)) guiutils.resize_to_contents(self.tableWidget_ExecutableMemoryRegions) def scan_finished(self): self.init_pre_scan_gui() if not self.is_canceled: self.label_ScanInfo.setText(tr.SCAN_FINISHED) self.is_canceled = False self.refresh_timer.stop() self.refresh_dissect_status() self.update_dissect_results() self.scan_finished_signal.emit() def pushButton_StartCancel_clicked(self): if self.is_scanning: self.is_canceled = True self.background_thread.is_canceled = True debugcore.cancel_dissect_code() self.refresh_timer.stop() self.update_dissect_results() self.label_ScanInfo.setText(tr.SCAN_CANCELED) self.init_pre_scan_gui() else: selected_rows = self.tableWidget_ExecutableMemoryRegions.selectionModel().selectedRows() if not selected_rows: QMessageBox.information(self, tr.ERROR, tr.SELECT_ONE_REGION) return selected_indexes = [selected_row.row() for selected_row in selected_rows] selected_regions = [self.region_list[selected_index] for selected_index in selected_indexes] self.background_thread = self.BackgroundThread( selected_regions, self.checkBox_DiscardInvalidStrings.isChecked() ) self.background_thread.output_ready.connect(self.scan_finished) self.init_after_scan_gui() self.refresh_timer.start() self.background_thread.start() def closeEvent(self, event: QCloseEvent): debugcore.cancel_dissect_code() self.refresh_timer.stop() super().closeEvent(event) class ReferencedStringsWidgetForm(QWidget, ReferencedStringsWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) guiutils.fill_value_combobox(self.comboBox_ValueType, typedefs.VALUE_INDEX.STRING_UTF8) self.setWindowFlags(Qt.WindowType.Window) self.tableWidget_References.setColumnWidth(REF_STR_ADDR_COL, 150) self.tableWidget_References.setColumnWidth(REF_STR_COUNT_COL, 80) self.splitter.setStretchFactor(0, 1) self.listWidget_Referrers.resize(400, self.listWidget_Referrers.height()) guiutils.center_to_parent(self) self.hex_len = 16 if debugcore.inferior_arch == typedefs.INFERIOR_ARCH.ARCH_64 else 8 str_dict, jmp_dict, call_dict = debugcore.get_dissect_code_data() str_dict_len, jmp_dict_len, call_dict_len = len(str_dict), len(jmp_dict), len(call_dict) str_dict.close() jmp_dict.close() call_dict.close() if str_dict_len == 0 and jmp_dict_len == 0 and call_dict_len == 0: confirm_dialog = InputDialogForm(self, [(tr.DISSECT_CODE,)]) if confirm_dialog.exec(): dissect_code_dialog = DissectCodeDialogForm(self) dissect_code_dialog.scan_finished_signal.connect(dissect_code_dialog.accept) dissect_code_dialog.exec() self.refresh_table() self.tableWidget_References.sortByColumn(REF_STR_ADDR_COL, Qt.SortOrder.AscendingOrder) self.tableWidget_References.selectionModel().currentChanged.connect(self.tableWidget_References_current_changed) self.listWidget_Referrers.itemDoubleClicked.connect(self.listWidget_Referrers_item_double_clicked) self.tableWidget_References.itemDoubleClicked.connect(self.tableWidget_References_item_double_clicked) self.tableWidget_References.contextMenuEvent = self.tableWidget_References_context_menu_event self.listWidget_Referrers.contextMenuEvent = self.listWidget_Referrers_context_menu_event self.pushButton_Search.clicked.connect(self.refresh_table) self.comboBox_ValueType.currentIndexChanged.connect(self.refresh_table) self.shortcut_search = QShortcut(QKeySequence("Return"), self) self.shortcut_search.activated.connect(self.refresh_table) def pad_hex(self, hex_str): index = hex_str.find(" ") if index == -1: self_len = 0 else: self_len = len(hex_str) - index return "0x" + hex_str[2:].zfill(self.hex_len + self_len) def refresh_table(self): item_list = debugcore.search_referenced_strings( self.lineEdit_Regex.text(), self.comboBox_ValueType.currentIndex(), self.checkBox_CaseSensitive.isChecked(), self.checkBox_Regex.isChecked(), ) if item_list is None: QMessageBox.information(self, tr.ERROR, tr.INVALID_REGEX) return self.tableWidget_References.setSortingEnabled(False) self.tableWidget_References.setRowCount(0) self.tableWidget_References.setRowCount(len(item_list)) for row, item in enumerate(item_list): self.tableWidget_References.setItem(row, REF_STR_ADDR_COL, QTableWidgetItem(self.pad_hex(item[0]))) table_widget_item = QTableWidgetItem() table_widget_item.setData(Qt.ItemDataRole.EditRole, item[1]) self.tableWidget_References.setItem(row, REF_STR_COUNT_COL, table_widget_item) table_widget_item = QTableWidgetItem() table_widget_item.setData(Qt.ItemDataRole.EditRole, item[2]) self.tableWidget_References.setItem(row, REF_STR_VAL_COL, table_widget_item) self.tableWidget_References.setSortingEnabled(True) def tableWidget_References_current_changed(self, QModelIndex_current): if QModelIndex_current.row() < 0: return self.listWidget_Referrers.clear() str_dict = debugcore.get_dissect_code_data(True, False, False)[0] addr = self.tableWidget_References.item(QModelIndex_current.row(), REF_STR_ADDR_COL).text() referrers = str_dict[hex(int(addr, 16))] addrs = [hex(address) for address in referrers] self.listWidget_Referrers.addItems([self.pad_hex(item.all) for item in debugcore.examine_expressions(addrs)]) self.listWidget_Referrers.sortItems(Qt.SortOrder.AscendingOrder) str_dict.close() def tableWidget_References_item_double_clicked(self, index): row = index.row() address = self.tableWidget_References.item(row, REF_STR_ADDR_COL).text() self.parent().hex_dump_address(int(address, 16)) def listWidget_Referrers_item_double_clicked(self, item): self.parent().disassemble_expression(utils.extract_address(item.text()), append_history=True) def tableWidget_References_context_menu_event(self, event): def copy_to_clipboard(row, column): app.clipboard().setText(self.tableWidget_References.item(row, column).text()) selected_row = guiutils.get_current_row(self.tableWidget_References) menu = QMenu() copy_address = menu.addAction(tr.COPY_ADDRESS) copy_value = menu.addAction(tr.COPY_VALUE) if selected_row == -1: guiutils.delete_menu_entries(menu, [copy_address, copy_value]) font_size = self.tableWidget_References.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = { copy_address: lambda: copy_to_clipboard(selected_row, REF_STR_ADDR_COL), copy_value: lambda: copy_to_clipboard(selected_row, REF_STR_VAL_COL), } try: actions[action]() except KeyError: pass def listWidget_Referrers_context_menu_event(self, event): def copy_to_clipboard(row): app.clipboard().setText(self.listWidget_Referrers.item(row).text()) selected_row = guiutils.get_current_row(self.listWidget_Referrers) menu = QMenu() copy_address = menu.addAction(tr.COPY_ADDRESS) if selected_row == -1: guiutils.delete_menu_entries(menu, [copy_address]) font_size = self.listWidget_Referrers.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = {copy_address: lambda: copy_to_clipboard(selected_row)} try: actions[action]() except KeyError: pass class ReferencedCallsWidgetForm(QWidget, ReferencedCallsWidget): def __init__(self, parent): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.tableWidget_References.setColumnWidth(REF_CALL_ADDR_COL, 480) self.splitter.setStretchFactor(0, 1) self.listWidget_Referrers.resize(400, self.listWidget_Referrers.height()) guiutils.center_to_parent(self) self.hex_len = 16 if debugcore.inferior_arch == typedefs.INFERIOR_ARCH.ARCH_64 else 8 str_dict, jmp_dict, call_dict = debugcore.get_dissect_code_data() str_dict_len, jmp_dict_len, call_dict_len = len(str_dict), len(jmp_dict), len(call_dict) str_dict.close() jmp_dict.close() call_dict.close() if str_dict_len == 0 and jmp_dict_len == 0 and call_dict_len == 0: confirm_dialog = InputDialogForm(self, [(tr.DISSECT_CODE,)]) if confirm_dialog.exec(): dissect_code_dialog = DissectCodeDialogForm(self) dissect_code_dialog.scan_finished_signal.connect(dissect_code_dialog.accept) dissect_code_dialog.exec() self.refresh_table() self.tableWidget_References.sortByColumn(REF_CALL_ADDR_COL, Qt.SortOrder.AscendingOrder) self.tableWidget_References.selectionModel().currentChanged.connect(self.tableWidget_References_current_changed) self.listWidget_Referrers.itemDoubleClicked.connect(self.listWidget_Referrers_item_double_clicked) self.tableWidget_References.itemDoubleClicked.connect(self.tableWidget_References_item_double_clicked) self.tableWidget_References.contextMenuEvent = self.tableWidget_References_context_menu_event self.listWidget_Referrers.contextMenuEvent = self.listWidget_Referrers_context_menu_event self.pushButton_Search.clicked.connect(self.refresh_table) self.shortcut_search = QShortcut(QKeySequence("Return"), self) self.shortcut_search.activated.connect(self.refresh_table) def pad_hex(self, hex_str): index = hex_str.find(" ") if index == -1: self_len = 0 else: self_len = len(hex_str) - index return "0x" + hex_str[2:].zfill(self.hex_len + self_len) def refresh_table(self): item_list = debugcore.search_referenced_calls( self.lineEdit_Regex.text(), self.checkBox_CaseSensitive.isChecked(), self.checkBox_Regex.isChecked() ) if item_list is None: QMessageBox.information(self, tr.ERROR, tr.INVALID_REGEX) return self.tableWidget_References.setSortingEnabled(False) self.tableWidget_References.setRowCount(0) self.tableWidget_References.setRowCount(len(item_list)) for row, item in enumerate(item_list): self.tableWidget_References.setItem(row, REF_CALL_ADDR_COL, QTableWidgetItem(self.pad_hex(item[0]))) table_widget_item = QTableWidgetItem() table_widget_item.setData(Qt.ItemDataRole.EditRole, item[1]) self.tableWidget_References.setItem(row, REF_CALL_COUNT_COL, table_widget_item) self.tableWidget_References.setSortingEnabled(True) def tableWidget_References_current_changed(self, QModelIndex_current): if QModelIndex_current.row() < 0: return self.listWidget_Referrers.clear() call_dict = debugcore.get_dissect_code_data(False, False, True)[0] addr = self.tableWidget_References.item(QModelIndex_current.row(), REF_CALL_ADDR_COL).text() referrers = call_dict[hex(int(utils.extract_address(addr), 16))] addrs = [hex(address) for address in referrers] self.listWidget_Referrers.addItems([self.pad_hex(item.all) for item in debugcore.examine_expressions(addrs)]) self.listWidget_Referrers.sortItems(Qt.SortOrder.AscendingOrder) call_dict.close() def tableWidget_References_item_double_clicked(self, index): row = index.row() address = self.tableWidget_References.item(row, REF_CALL_ADDR_COL).text() self.parent().disassemble_expression(utils.extract_address(address), append_history=True) def listWidget_Referrers_item_double_clicked(self, item): self.parent().disassemble_expression(utils.extract_address(item.text()), append_history=True) def tableWidget_References_context_menu_event(self, event): def copy_to_clipboard(row, column): app.clipboard().setText(self.tableWidget_References.item(row, column).text()) selected_row = guiutils.get_current_row(self.tableWidget_References) menu = QMenu() copy_address = menu.addAction(tr.COPY_ADDRESS) if selected_row == -1: guiutils.delete_menu_entries(menu, [copy_address]) font_size = self.tableWidget_References.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = {copy_address: lambda: copy_to_clipboard(selected_row, REF_CALL_ADDR_COL)} try: actions[action]() except KeyError: pass def listWidget_Referrers_context_menu_event(self, event): def copy_to_clipboard(row): app.clipboard().setText(self.listWidget_Referrers.item(row).text()) selected_row = guiutils.get_current_row(self.listWidget_Referrers) menu = QMenu() copy_address = menu.addAction(tr.COPY_ADDRESS) if selected_row == -1: guiutils.delete_menu_entries(menu, [copy_address]) font_size = self.listWidget_Referrers.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = {copy_address: lambda: copy_to_clipboard(selected_row)} try: actions[action]() except KeyError: pass class ExamineReferrersWidgetForm(QWidget, ExamineReferrersWidget): def __init__(self, parent, int_address): super().__init__(parent) self.setupUi(self) self.setWindowFlags(Qt.WindowType.Window) self.splitter.setStretchFactor(0, 1) self.textBrowser_DisasInfo.resize(600, self.textBrowser_DisasInfo.height()) self.referenced_hex = hex(int_address) self.hex_len = 16 if debugcore.inferior_arch == typedefs.INFERIOR_ARCH.ARCH_64 else 8 self.collect_referrer_data() self.refresh_table() self.listWidget_Referrers.sortItems(Qt.SortOrder.AscendingOrder) self.listWidget_Referrers.selectionModel().currentChanged.connect(self.listWidget_Referrers_current_changed) self.listWidget_Referrers.itemDoubleClicked.connect(self.listWidget_Referrers_item_double_clicked) self.listWidget_Referrers.contextMenuEvent = self.listWidget_Referrers_context_menu_event self.pushButton_Search.clicked.connect(self.refresh_table) self.shortcut_search = QShortcut(QKeySequence("Return"), self) self.shortcut_search.activated.connect(self.refresh_table) guiutils.center_to_parent(self) def pad_hex(self, hex_str): index = hex_str.find(" ") if index == -1: self_len = 0 else: self_len = len(hex_str) - index return "0x" + hex_str[2:].zfill(self.hex_len + self_len) def collect_referrer_data(self): jmp_dict, call_dict = debugcore.get_dissect_code_data(False, True, True) self.referrer_data = [] try: jmp_referrers = jmp_dict[self.referenced_hex] except KeyError: pass else: jmp_referrers = [hex(item) for item in jmp_referrers] self.referrer_data.extend([item.all for item in debugcore.examine_expressions(jmp_referrers)]) try: call_referrers = call_dict[self.referenced_hex] except KeyError: pass else: call_referrers = [hex(item) for item in call_referrers] self.referrer_data.extend([item.all for item in debugcore.examine_expressions(call_referrers)]) jmp_dict.close() call_dict.close() def refresh_table(self): searched_str = self.lineEdit_Regex.text() case_sensitive = self.checkBox_CaseSensitive.isChecked() enable_regex = self.checkBox_Regex.isChecked() if enable_regex: try: if case_sensitive: regex = re.compile(searched_str) else: regex = re.compile(searched_str, re.IGNORECASE) except: QMessageBox.information(self, tr.ERROR, tr.INVALID_REGEX) return self.listWidget_Referrers.setSortingEnabled(False) self.listWidget_Referrers.clear() for row, item in enumerate(self.referrer_data): if enable_regex: if not regex.search(item): continue else: if case_sensitive: if item.find(searched_str) == -1: continue else: if item.lower().find(searched_str.lower()) == -1: continue self.listWidget_Referrers.addItem(item) self.listWidget_Referrers.setSortingEnabled(True) self.listWidget_Referrers.sortItems(Qt.SortOrder.AscendingOrder) def listWidget_Referrers_current_changed(self, QModelIndex_current): if QModelIndex_current.row() < 0: return self.textBrowser_DisasInfo.clear() disas_data = debugcore.disassemble( utils.extract_address(self.listWidget_Referrers.item(QModelIndex_current.row()).text()), "+200" ) for address_info, _, opcode in disas_data: self.textBrowser_DisasInfo.append(address_info + opcode) cursor = self.textBrowser_DisasInfo.textCursor() cursor.movePosition(QTextCursor.MoveOperation.Start) self.textBrowser_DisasInfo.setTextCursor(cursor) self.textBrowser_DisasInfo.ensureCursorVisible() def listWidget_Referrers_item_double_clicked(self, item): self.parent().disassemble_expression(utils.extract_address(item.text()), append_history=True) def listWidget_Referrers_context_menu_event(self, event): def copy_to_clipboard(row): app.clipboard().setText(self.listWidget_Referrers.item(row).text()) selected_row = guiutils.get_current_row(self.listWidget_Referrers) menu = QMenu() copy_address = menu.addAction(tr.COPY_ADDRESS) if selected_row == -1: guiutils.delete_menu_entries(menu, [copy_address]) font_size = self.listWidget_Referrers.font().pointSize() menu.setStyleSheet("font-size: " + str(font_size) + "pt;") action = menu.exec(event.globalPos()) actions = {copy_address: lambda: copy_to_clipboard(selected_row)} try: actions[action]() except KeyError: pass class PointerScanSearchDialogForm(QDialog, PointerScanSearchDialog): def __init__(self, parent, address) -> None: super().__init__(parent) self.setupUi(self) guiutils.center_to_parent(self) self.lineEdit_Address.setText(address) self.lineEdit_Path.setText(os.getcwd() + f"/{utils.get_process_name(debugcore.currentpid)}.scandata") self.pushButton_PathBrowse.clicked.connect(self.pushButton_PathBrowse_clicked) self.scan_button: QPushButton | None = self.buttonBox.addButton(tr.SCAN, QDialogButtonBox.ButtonRole.ActionRole) if self.scan_button: self.scan_button.clicked.connect(self.scan_button_clicked) self.ptrscan_thread: InterruptableWorker | None = None def pushButton_PathBrowse_clicked(self) -> None: file_path, _ = QFileDialog.getSaveFileName(self, tr.SELECT_POINTER_MAP, None, tr.FILE_TYPES_SCANDATA) if file_path != "": file_path = utils.append_file_extension(file_path, "scandata") self.lineEdit_Path.setText(file_path) def reject(self) -> None: if self.ptrscan_thread: self.ptrscan_thread.stop() return super().reject() def scan_button_clicked(self) -> None: if debugcore.currentpid == -1 or self.scan_button == None: return self.scan_button.setText(tr.SCANNING) self.scan_button.setEnabled(False) self.pushButton_PathBrowse.setEnabled(False) params: FFIParam = FFIParam() try: addr_val = int(self.lineEdit_Address.text(), 16) except ValueError: addr_val = 0 params.addr(addr_val) params.depth(self.spinBox_Depth.value()) params.srange(FFIRange(self.spinBox_ScanRangeStart.value(), self.spinBox_ScanRangeEnd.value())) lrange_start: int = self.spinBox_ScanLRangeStart.value() lrange_end: int = self.spinBox_ScanLRangeEnd.value() if lrange_start == 0 and lrange_end == 0: lrange_val = None else: lrange_val = FFIRange(lrange_start, lrange_end) params.lrange(lrange_val) params.node(utils.return_optional_int(self.spinBox_Node.value())) try: last_val = int(self.lineEdit_Last.text(), 16) except ValueError: last_val = None params.last(last_val) params.max(utils.return_optional_int(self.spinBox_Max.value())) params.cycle(self.checkBox_Cycle.isChecked()) ptrscan.set_modules(ptrscan.list_modules_pince()) # TODO: maybe cache this and let user refresh with a button ptrscan.create_pointer_map() # TODO: maybe cache this and let user refresh with a button ptrmap_file_path = self.lineEdit_Path.text() if os.path.isfile(ptrmap_file_path): os.remove(ptrmap_file_path) self.ptrscan_thread = InterruptableWorker(ptrscan.scan_pointer_chain, params, ptrmap_file_path) self.ptrscan_thread.signals.finished.connect(self.ptrscan_callback) self.ptrscan_thread.start() def ptrscan_callback(self) -> None: self.accept() class PointerScanFilterDialogForm(QDialog, PointerScanFilterDialog): def __init__(self, parent) -> None: super().__init__(parent) self.setupUi(self) guiutils.center_to_parent(self) self.pushButton_File1Browse.clicked.connect(self.pushButton_File1Browse_clicked) self.pushButton_File2Browse.clicked.connect(self.pushButton_File2Browse_clicked) self.filter_button: QPushButton | None = self.buttonBox.addButton( tr.FILTER, QDialogButtonBox.ButtonRole.ActionRole ) if self.filter_button: self.filter_button.clicked.connect(self.filter_button_clicked) self.filter_button.setEnabled(False) self.filter_result: list[str] | None = None def browse_scandata_file(self, file_path_field: QLineEdit) -> None: file_path, _ = QFileDialog.getOpenFileName(self, tr.SELECT_POINTER_MAP, None, tr.FILE_TYPES_SCANDATA) if file_path != "": file_path_field.setText(file_path) self.check_filterable_state() def check_filterable_state(self) -> None: if self.lineEdit_File1Path.text() != "" and self.lineEdit_File2Path.text() != "" and self.filter_button: self.filter_button.setEnabled(True) def pushButton_File1Browse_clicked(self) -> None: self.browse_scandata_file(self.lineEdit_File1Path) def pushButton_File2Browse_clicked(self) -> None: self.browse_scandata_file(self.lineEdit_File2Path) def filter_button_clicked(self) -> None: if self.lineEdit_File1Path.text() == "" or self.lineEdit_File2Path.text() == "" or self.filter_button == None: return self.filter_button.setEnabled(False) self.filter_button.setText(tr.FILTERING) lines: list[str] with open(self.lineEdit_File1Path.text()) as file: lines = file.read().split(os.linesep) with open(self.lineEdit_File2Path.text()) as file: lines.extend(file.read().split(os.linesep)) counts = collections.Counter(lines) self.filter_result = list(set([line for line in lines if counts[line] > 1 and line != ""])) self.accept() def get_filter_result(self) -> list[str] | None: return self.filter_result class PointerScanWindowForm(QMainWindow, PointerScanWindow): def __init__(self, parent) -> None: super().__init__(parent) self.setupUi(self) self.tableWidget_ScanResult.hide() process_signals.attach.connect(self.on_process_changed) process_signals.exit.connect(self.on_process_changed) self.pushButton_Clear.pressed.connect(self.pushButton_Clear_pressed) self.pushButton_Sort.pressed.connect(self.pushButton_Sort_pressed) self.actionOpen.triggered.connect(self.actionOpen_triggered) self.actionSaveAs.triggered.connect(self.actionSaveAs_triggered) self.actionScan.triggered.connect(self.scan_triggered) self.actionFilter.triggered.connect(self.filter_triggered) if debugcore.currentpid == -1: self.actionScan.setEnabled(False) guiutils.center_to_parent(self) def on_process_changed(self) -> None: val: bool = False if debugcore.currentpid == -1 else True self.actionScan.setEnabled(val) def pushButton_Clear_pressed(self) -> None: self.textEdit.clear() def pushButton_Sort_pressed(self) -> None: text: str = self.textEdit.toPlainText() if text == "": return text_list: list[str] = text.split(os.linesep) # Sometimes files will have ending newlines. # We want to get rid of them otherwise they'll be at top. if text_list[-1] == "": del text_list[-1] text_list.sort() self.textEdit.setText(os.linesep.join(text_list)) def actionOpen_triggered(self) -> None: file_path, _ = QFileDialog.getOpenFileName(self, tr.SELECT_POINTER_MAP, None, tr.FILE_TYPES_SCANDATA) if file_path != "": self.textEdit.clear() with open(file_path) as file: self.textEdit.setText(file.read()) def actionSaveAs_triggered(self) -> None: file_path, _ = QFileDialog.getSaveFileName(self, tr.SELECT_POINTER_MAP, None, tr.FILE_TYPES_SCANDATA) if file_path != "": file_path = utils.append_file_extension(file_path, "scandata") with open(file_path, "w") as file: file.write(self.textEdit.toPlainText()) def scan_triggered(self) -> None: dialog = PointerScanSearchDialogForm(self, "0x0") dialog.exec() def filter_triggered(self) -> None: dialog = PointerScanFilterDialogForm(self) if dialog.exec(): filter_result: list[str] | None = dialog.get_filter_result() if filter_result == None: return self.textEdit.clear() self.textEdit.setText(os.linesep.join(filter_result)) class ScanRegionsDialogForm(QDialog, ScanRegionsDialog): def __init__(self, parent) -> None: super().__init__(parent) self.setupUi(self) regions_text = scanmem.send_command("lregions", True).decode("utf-8") regex = re.compile(r"\[\s*(\d+)\] (\w+),\s+(\d+) bytes,\s+(\w+),\s+(\w+),\s+([rwx-]+),\s+(.+)") data = regex.findall(regions_text) self.tableWidget_Regions.setRowCount(len(data)) for row, (region_id, start_address, size, region_type, load_address, perms, file) in enumerate(data): id_item = QTableWidgetItem(region_id) id_item.setCheckState(Qt.CheckState.Unchecked) self.tableWidget_Regions.setItem(row, 0, id_item) self.tableWidget_Regions.setItem(row, 1, QTableWidgetItem(start_address)) self.tableWidget_Regions.setItem(row, 2, QTableWidgetItem(size)) self.tableWidget_Regions.setItem(row, 3, QTableWidgetItem(region_type)) self.tableWidget_Regions.setItem(row, 4, QTableWidgetItem(load_address)) self.tableWidget_Regions.setItem(row, 5, QTableWidgetItem(perms)) self.tableWidget_Regions.setItem(row, 6, QTableWidgetItem(file)) self.tableWidget_Regions.resizeColumnsToContents() guiutils.center_to_parent(self) self.tableWidget_Regions.mousePressEvent_original = self.tableWidget_Regions.mousePressEvent self.tableWidget_Regions.mousePressEvent = self.tableWidget_Regions_mouse_press_event self.tableWidget_Regions.mouseReleaseEvent_original = self.tableWidget_Regions.mouseReleaseEvent self.tableWidget_Regions.mouseReleaseEvent = self.tableWidget_Regions_mouse_release_event self.tableWidget_Regions.keyPressEvent_original = self.tableWidget_Regions.keyPressEvent self.tableWidget_Regions.keyPressEvent = self.tableWidget_Regions_key_press_event self.pushButton_Invert.clicked.connect(self.invert_selection) def tableWidget_Regions_mouse_press_event(self, event: QMouseEvent) -> None: self.tableWidget_Regions.mousePressEvent_original(event) item = self.tableWidget_Regions.itemAt(event.pos()) if item and item.column() == 0: row = item.row() self.tableWidget_Regions.selectRow(row) def tableWidget_Regions_mouse_release_event(self, event: QMouseEvent) -> None: self.tableWidget_Regions.mouseReleaseEvent_original(event) item = self.tableWidget_Regions.itemAt(event.pos()) if item and item.column() == 0: new_state = item.checkState() for selected_item in self.tableWidget_Regions.selectedItems(): if selected_item.column() == 0: selected_item.setCheckState(new_state) def tableWidget_Regions_key_press_event(self, event: QKeyEvent) -> None: if event.key() == Qt.Key.Key_Space: current_row = self.tableWidget_Regions.currentRow() if current_row != -1: cur_state = self.tableWidget_Regions.item(current_row, 0).checkState() new_state = Qt.CheckState.Unchecked if cur_state == Qt.CheckState.Checked else Qt.CheckState.Checked for selected_item in self.tableWidget_Regions.selectedItems(): if selected_item.column() == 0: selected_item.setCheckState(new_state) else: self.tableWidget_Regions.keyPressEvent_original(event) def invert_selection(self) -> None: for row in range(self.tableWidget_Regions.rowCount()): item = self.tableWidget_Regions.item(row, 0) cur_state = item.checkState() new_state = Qt.CheckState.Unchecked if cur_state == Qt.CheckState.Checked else Qt.CheckState.Checked item.setCheckState(new_state) def accept(self) -> None: for row in range(self.tableWidget_Regions.rowCount()): item = self.tableWidget_Regions.item(row, 0) if item.checkState() == Qt.CheckState.Checked: region_id = int(item.text()) scanmem.send_command(f"dregion {region_id}") return super().accept() def handle_exit(): global exiting exiting = 1 if __name__ == "__main__": app.aboutToQuit.connect(handle_exit) window = MainForm() window.show() sys.exit(app.exec()) ```
```xml import type { ReactNode } from 'react'; import { useUserSettings } from '@proton/components/hooks'; import { AI_ASSISTANT_ACCESS } from '@proton/shared/lib/interfaces'; import { AssistantContext } from '../hooks/useAssistant'; import useAssistantCommons from '../hooks/useAssistantCommons'; import { useAssistantLocal } from '../hooks/useAssistantLocal'; import { useAssistantServer } from '../hooks/useAssistantServer'; import useOpenedAssistants from '../hooks/useOpenedAssistants'; export interface AssistantProviderProps { children: ReactNode; } const AssistantProvider = ({ children }: AssistantProviderProps) => { const [userSettings] = useUserSettings(); const assistantMode = userSettings.AIAssistantFlags; const isAssistantLocal = assistantMode === AI_ASSISTANT_ACCESS.CLIENT_ONLY; const commonState = useAssistantCommons(); const openedAssistantsState = useOpenedAssistants({ cleanSpecificErrors: commonState.cleanSpecificErrors }); const assistantServerState = useAssistantServer({ commonState, openedAssistantsState }); const assistantLocalState = useAssistantLocal({ commonState, openedAssistantsState, active: isAssistantLocal }); /** * Use the local provider in case setting is CLIENT_ONLY * Else, we are using the server side provider * - SERVER_ONLY: The user wants to use the server mode * - UNSET: Server is the default, so if the user is in UNSET mode, we are using the server mode * - OFF: When assistant is OFF, we still need a context otherwise calling useAssistant will trigger an error * I was also considering to create a new "dummy" provider so that we don't run useless computations, * but it means that we would need to maintain an additional Provider. * In the end we decided to run the server provider that has fewer computations than the local one */ const assistantState = isAssistantLocal ? assistantLocalState : assistantServerState; return ( <AssistantContext.Provider value={{ ...assistantState, // TODO: Temporary fix // Needed to call initAssistant on composer assistant inner modal submit // In this case assistant context is still set to server mode so initAssistant was undefined. // in order to call initAssistant with no side effects i made a duplicate handleSettingChange: assistantLocalState.initAssistant, getIsStickyAssistant: openedAssistantsState.getIsStickyAssistant, handleCheckHardwareCompatibility: commonState.handleCheckHardwareCompatibility, cleanSpecificErrors: commonState.cleanSpecificErrors, addSpecificError: commonState.addSpecificError, }} > {children} </AssistantContext.Provider> ); }; export default AssistantProvider; ```
Donskoye (also Bryusterort or Donskoe) is an air base in Kaliningrad Oblast, Russia, located 1 km east of Donskoye. The base is home to the 72nd Guards Aviation Base. It probably dates back to World War II, and is located nearly at Russia's most extreme western point. The facility contains 25 aircraft pads. Its original length was 2000m, but only 500m remains. Its pads are occupied by a number of helicopters. The base was used by the: 28th Guards Fighter Aviation Regiment between 1945 and 1947. 68th Guards Fighter Aviation Regiment between 1945 and 1947. 72nd Guards Fighter Aviation Regiment during 1945. Units stationed at Donskoye in the early 1990s included 396 OKPLVP (396th Independent Shipborne Anti-submarine Helicopter Regiment) flying 22 Kamov Ka-27 (ASCC: Helix) helicopters; and 745 OPLVP (745th Independent Anti-submarine Helicopter Regiment), which joined in 1958, flying 15 Mil Mi-14 (ASCC: Haze) helicopters and 5 Kamov Ka-25 (ASCC: Hormone) helicopters. References Soviet Naval Aviation bases Russian Navy Airports in Kaliningrad Oblast Installations of the Russian Navy
```go package client // import "github.com/docker/infrakit/pkg/rpc/client" import ( "encoding/json" "net/http" "net/url" "path" "github.com/docker/infrakit/pkg/plugin" "github.com/docker/infrakit/pkg/rpc" "github.com/docker/infrakit/pkg/template" ) // NewPluginInfoClient returns a plugin informer that can give metadata about a plugin func NewPluginInfoClient(address string) (*InfoClient, error) { u, httpC, err := parseAddress(address) if err != nil { return nil, err } return &InfoClient{addr: address, client: httpC, url: u}, nil } // InfoClient is the client for retrieving plugin info type InfoClient struct { client *http.Client addr string url *url.URL } // GetInfo implements the Info interface and returns the metadata about the plugin func (i *InfoClient) GetInfo() (plugin.Info, error) { meta := plugin.Info{} dest := *i.url dest.Path = path.Clean(path.Join(i.url.Path, rpc.URLAPI)) resp, err := i.client.Get(dest.String()) if err != nil { return meta, err } defer resp.Body.Close() err = json.NewDecoder(resp.Body).Decode(&meta) return meta, err } // GetFunctions returns metadata about the plugin's template functions, if the plugin supports templating. func (i *InfoClient) GetFunctions() (map[string][]template.Function, error) { meta := map[string][]template.Function{} dest := *i.url dest.Path = path.Clean(path.Join(i.url.Path, rpc.URLFunctions)) resp, err := i.client.Get(dest.String()) if err != nil { return meta, err } defer resp.Body.Close() err = json.NewDecoder(resp.Body).Decode(&meta) return meta, err } ```
Adrian Dix (born April 20, 1964) is a Canadian politician serving as the current Member of the Legislative Assembly (MLA) for Vancouver-Kingsway in British Columbia. In addition to serving as the current Member of the Legislative Assembly (MLA) for Vancouver-Kingsway in British Columbia, Dix is also serving as the current Minister Responsible for Francophone Affairs in British Columbia and the current Minister of Health in British Columbia. He has also served as the leader of the British Columbia New Democratic Party (BC NDP) from 2011 to 2014. He was first elected to the Legislative Assembly of British Columbia in the 2005 provincial election. Dix's decision in 2013 to be replaced as leader came following the party's disappointing result in the May 2013 provincial election which the BC NDP lost despite a 20-point lead in the polls prior to the election campaign. Personal life Adrian Dix was born in Vancouver, to parents Ken and Hilda, immigrants from Ireland and Britain, respectively. His parents ran the Dix Insurance Agency Ltd. on West 41st Avenue in Vancouver until 2011 when his father retired and sold the business. Growing up in Vancouver, Dix was raised as an Anglican and attended both St. George's School and Point Grey Secondary. He then went on to study history and political science at the University of British Columbia. Dix has two siblings and currently lives in Vancouver with his wife Renée Saklikar, a poet and writer. Dix was diagnosed with Type-1 diabetes in his 20s. Fluently bilingual, Dix lived in France as a young man. Political career Early career Dix's first job in politics was as an aide to federal NDP MP Ian Waddell in Ottawa. In 1991, he returned to BC to become a assistant to Glen Clark in the provincial ministry of finance. After Clark became Premier of British Columbia in 1996, Dix was named his chief of staff. Dix was dismissed in 1999 for back-dating a memo to protect Clark from conflict-of-interest charges. Dix has said of this incident, "It was wrong, it was wrong. I'm out there and I've admitted it and people will judge. But I'm not trying to hide my mistake." This memo would later become a focus of a number of opposition BC Liberal Party ads in the 2013 provincial election. Subsequently, he went on to work as the executive director of Canadian Parents for French in their B.C./Yukon branch. The Vancouver Sun summarized his work in this position as "successfully encouraging more school boards to offer French immersion programs." From 2001 to 2005 Dix was a political commentator in various media, writing a column for the Victoria Times-Colonist and The Source, a prominent intercultural newspaper in Vancouver. He was also a contributor to The Tyee and the CBC. Entry into elective politics In 2005, Dix was elected as the MLA for Vancouver-Kingsway. He first served as the opposition critic for Children and Families and then served as the Health critic. As MLA, he cites among his achievements "bringing insulin pumps to children with Type 1 diabetes and his work on a successful campaign to stop three schools from being closed in Vancouver-Kingsway." Leader of the NDP After NDP leader Carole James announced her resignation, Dix was one of several candidates to run for the leadership. The last candidate to publicly launch his leadership bid, Dix campaigned on a platform of eliminating the HST, rolling back reductions in the corporate tax rate, supporting the redirection of carbon tax revenue to pay for public transit and infrastructure that reduces greenhouse gas emissions, supporting an increase in the minimum wage rate to $10 per hour, creating a provincial child care system, restoring grants to the post-secondary students, reducing interest on student loans, and restoring the corporation capital tax on financial institutions. His candidacy was endorsed by former interim BC NDP leader Joy MacPhail, amongst others. Dix led throughout the voting, narrowly defeating rival Mike Farnworth on the third and final ballot with 51.8% of the vote. Going into the 2013 election, nearly all polls showed the NDP well ahead of the BC Liberals, with at least one showing the NDP ahead by as much as 20 points. Two months prior to the election, The Province newspaper's front page featured a column by pundit Michael Smyth with the banner headline: "If This Man Kicked A Dog He Would Still Win The Election." However, in a result that shocked the party and political pundits, the BC Liberals won a fourth majority government. The BC NDP won 34 seats, one fewer than in 2009. Dix announced on September 18, 2013 that he would resign as party leader once a new leader (John Horgan) would be chosen in 2014. He also announced his intention to run for re-election as an MLA in the next provincial election. Cabinet minister After the NDP formed government as a result of the 2017 election, Dix was appointed Minister of Health. After Horgan stepped down and was succeeded as Premier by David Eby in 2022, Dix retained the portfolio in the new Eby ministry. On August 30, 2021, Dix announced an initiative to bring 4000 housekeepers and food service workers in provincial hospitals back under government employment by March 2022. This was an effort to reverse the fallout of the British Columbia Liberal Party administration passing the Health and Social Services Delivery Improvement Act in January 2002. The act facilitated the contracting of hospital support jobs to private employers, leading to thousands of hospital support workers to be laid off from the public sector and rehired under private contractors for reduced wages and benefits. One employee reported an hourly wage decline from $18.10 with benefits and a pension while under direct provincial employment to $10.15 with neither benefits nor pensions under the private sector. The Hospital Employees' Union had also reported the halving of wages upon being contracted by the private sector. Additionally, Premier John Horgan noted that these wage declines disproportionately affected women. In 2022, a group of 26 medical specialists in British Columbia wrote an open letter to Health Minister Adrian Dix, expressing concern about the province's deteriorating healthcare system. They claimed that patients are suffering and dying while waiting for care due to increasing wait times. The specialists, including cardiologists, pediatricians, and transplant surgeons, called for urgent action to address the crisis and work collaboratively to find solutions to improve patient outcomes and reduce waitlists. Election results References External links Profile from the B.C. Legislature 1964 births Living people British Columbia New Democratic Party MLAs Canadian people of British descent Canadian people of Irish descent Health ministers of British Columbia Leaders of the British Columbia CCF/NDP Members of the Executive Council of British Columbia People with type 1 diabetes Politicians from Vancouver University of British Columbia alumni 21st-century Canadian politicians St. George's School (Vancouver) alumni
Agonglo was a King of the Kingdom of Dahomey, in present-day Benin, from 1789 until 1797. Agonglo took over from his father King Kpengla in 1789 and inherited many of the economic problems that developed during Kpengla's reign. Because of the poor economy, Agonglo was often constrained by domestic opposition. As a response, he reformed many of the economic policies (lowered taxes and removed constrains on the slave trade) and did military expeditions to try to increase the supply for the Atlantic slave trade. Many of these efforts were unsuccessful and European traders became less active in the ports of the kingdom. As a final effort, Agonglo accepted two Portuguese Catholic missionaries which resulted in a large outcry in royal circles and resulted in his assassination on May 1, 1797. Adandozan, his second oldest son, was named the new king. Rise to power Agonglo was the oldest son of King Kpengla (ruled 1774–1789), who had ruled over a long-term economic crisis in Dahomey. The Oyo empire still had suzerainty over the kingdom and in the time of Kpengla this power of Oyo over the kingdom had resulted in decreased slave trading by Dahomey. Kpengla responded in a variety of ways: first trying to defeat common competitors of both Oyo and Dahomey, then when this failed he ended slave trade with Oyo entirely, raised harsh taxes on slave traders through Dahomey, and resumed slave raiding. These policies largely did not work and the slave trade, which had become the primary trade for Dahomey, slowed significantly. Political factions were also developing in Dahomey under Kpengla. When Tegbessou (ruled 1740–1774) became king in a contentious selection, two older sons of King Agaja were passed over for selection. The heirs of these two other brothers had slowly increased their power into a distinct rival claim to the throne at Dahomey. When Kpengla died in 1789, four rival claimants came to the throne: two younger brothers of Kpengla, Fraku or Don Jeronimo (the son of one of the older sons of Agaja), and Agonglo (the oldest son of Kpengla. The Migan and Mehu of Dahomey, who were tasked with selecting the new king, choose Agonglo, but there remained significant political opposition to Agonglo. The selection of Agonglo resulted in such widespread opposition that the political functions of the kingdom largely halted for a year. Agonglo then did a series of conciliatory moves to try to end the opposition: promised to give citizens back some rights, ended constraints on slave traders, reduced taxes, reassigned some of the aggressive tax collectors into the army, and recognized other powerful individuals. Administration As king, Agonglo attempted a variety of efforts to get the Dahomey economy started but was often constrained by domestic opposition and a major smallpox epidemic. The Oyo empire which had exercised power over Dahomey since 1730 had grown significantly weak in the early 1790s. This culminated in the suicide of the king of Oyo in 1796, which provided Agonglo with the ability to end the tributary status of Dahomey to Oyo. However, while Agonglo was able to act independently, domestic dissent prevented him from directly challenging Oyo power. Although he reduced many of the restrictions on slave traders that Kpengla had created, he still followed some of the other policies of Kpengla: including slave raiding and attacking rival ports. However, these were generally not successful with multiple unsuccessful raids against the Mahi people to the north and unsuccessful attacks on Little Popo and Porto-Novo. However, in 1795 he was able to lead a successful slave raid against the Mahi, largely by rewarding soldiers with wives before the war, and allied with Grand-Popo was able to successfully disrupt Little Popo's slave trade. Unfortunately these efforts to improve the domestic supply of slaves were of limited impact because of developments impacting the different European countries involved in the slave trade. The British commander in the port city of Whydah had become very slow and unresponsive to British regional efforts and so the British had slowed their trade in the port. At the same time, the French Revolution resulted in France banning the trade on slaves in 1794 (to be restored in 1802) and began an active effort to stop the trade by other countries. In November 1794, the French seized all Portuguese slave ships in the port of Whydah and would continue this practice for the next few years. The result was that Whydah no longer was a safe harbor for the trade and Portuguese slowed their trade. Agonglo responded by sending three ambassadors to Maria I of Portugal to try to convince her to resume trade with Dahomey. Instead of resuming the trade, Maria sent two Catholic missionaries to Agonglo and encouraged him to convert for continued trade relations. Agonglo accepted the missionaries and expressed a willingness to be converted which caused a significant uproar amongst different factions within the kingdom. It is unknown whether he was sincere in his willingness to be converted or whether it was merely to appease the Portuguese. Agonglo did know about Catholicism, having married the former wife of the commander of the French fort in Whydah, a Dutch-African woman named Sophie who had introduced a Christian shrine into the pantheon of deities worshiped. Regardless, the willingness for conversion resulted in Dogan, a brother of Agonglo, starting serious efforts to remove Agonglo from power. Lengthy debates in the palace followed and when these efforts failed, on May 1, 1797, Dogan and a woman named Na Wanjile assassinated Agonglo in the palace. According to Akingjogbin, she shot and killed Agonglo, but Edna Bay says that the assassination happened through poisoning. Dogan and Na Wanjile were buried alive for the assassination. Succession With the execution of Dogan, the Migan and Mehu of Dahomey named Adandozan, the second oldest son of Agonglo, as the new king. Although Adandozan was quite young, he started his reign by punishing all members of the faction that had killed his father executing hundreds and selling the rest into slavery. Those sold into slavery included the future mother of King Ghezo who would replace Adandozan. References Kings of Dahomey 1766 births 1797 deaths 18th-century monarchs in Africa 18th century in the Kingdom of Dahomey
```objective-c /* * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ #ifndef CALL_RTP_STREAM_RECEIVER_CONTROLLER_INTERFACE_H_ #define CALL_RTP_STREAM_RECEIVER_CONTROLLER_INTERFACE_H_ #include <memory> #include "call/rtp_packet_sink_interface.h" namespace webrtc { // An RtpStreamReceiver is responsible for the rtp-specific but // media-independent state needed for receiving an RTP stream. // TODO(nisse): Currently, only owns the association between ssrc and // the stream's RtpPacketSinkInterface. Ownership of corresponding // objects from modules/rtp_rtcp/ should move to this class (or // rather, the corresponding implementation class). We should add // methods for getting rtp receive stats, and for sending RTCP // messages related to the receive stream. class RtpStreamReceiverInterface { public: virtual ~RtpStreamReceiverInterface() {} }; // This class acts as a factory for RtpStreamReceiver objects. class RtpStreamReceiverControllerInterface { public: virtual ~RtpStreamReceiverControllerInterface() {} virtual std::unique_ptr<RtpStreamReceiverInterface> CreateReceiver( uint32_t ssrc, RtpPacketSinkInterface* sink) = 0; // For registering additional sinks, needed for FlexFEC. virtual bool AddSink(uint32_t ssrc, RtpPacketSinkInterface* sink) = 0; virtual size_t RemoveSink(const RtpPacketSinkInterface* sink) = 0; }; } // namespace webrtc #endif // CALL_RTP_STREAM_RECEIVER_CONTROLLER_INTERFACE_H_ ```
Veliki Kablići is a village in the city of Livno in Canton 10, the Federation of Bosnia and Herzegovina, Bosnia and Herzegovina. Demographics According to the 2013 census, its population was 718. Footnotes Bibliography Populated places in Livno
```c++ * * This program is free software: you can redistribute it and/or modify * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * along with this program. If not, see <path_to_url * * If you would like to incorporate Link into a proprietary software application, * please contact <link-devs@ableton.com>. */ #pragma once #include <ableton/discovery/NetworkByteStreamSerializable.hpp> #include <ableton/platforms/asio/AsioWrapper.hpp> #include <cassert> namespace ableton { namespace link { struct MeasurementEndpointV6 { static const std::int32_t key = 'mep6'; static_assert(key == 0x6d657036, "Unexpected byte order"); // Model the NetworkByteStreamSerializable concept friend std::uint32_t sizeInByteStream(const MeasurementEndpointV6 mep) { if (mep.ep.address().is_v4()) { return 0; } return discovery::sizeInByteStream(mep.ep.address().to_v6().to_bytes()) + discovery::sizeInByteStream(mep.ep.port()); } template <typename It> friend It toNetworkByteStream(const MeasurementEndpointV6 mep, It out) { assert(mep.ep.address().is_v6()); return discovery::toNetworkByteStream( mep.ep.port(), discovery::toNetworkByteStream( mep.ep.address().to_v6().to_bytes(), std::move(out))); } template <typename It> static std::pair<MeasurementEndpointV6, It> fromNetworkByteStream(It begin, It end) { using namespace std; auto addrRes = discovery::Deserialize<discovery::IpAddressV6::bytes_type>::fromNetworkByteStream( std::move(begin), end); auto portRes = discovery::Deserialize<std::uint16_t>::fromNetworkByteStream( std::move(addrRes.second), end); return make_pair( MeasurementEndpointV6{ {discovery::IpAddressV6{std::move(addrRes.first)}, std::move(portRes.first)}}, std::move(portRes.second)); } discovery::UdpEndpoint ep; }; } // namespace link } // namespace ableton ```