diff --git a/.gitignore b/.gitignore deleted file mode 100644 index c5d52d3..0000000 --- a/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -# vendor files -node_modules - -# IDE -.idea - -# build cache -.parcel-cache -dist - -# dumps -*.dump - -# caches -*.cache -.cache diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100644 index 36af219..0000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npx lint-staged diff --git a/compiler.62eb36a8.js b/compiler.62eb36a8.js new file mode 100644 index 0000000..2bc49b1 --- /dev/null +++ b/compiler.62eb36a8.js @@ -0,0 +1,2 @@ +!function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},e={},r={},n=t.parcelRequired6a3;null==n&&((n=function(t){if(t in e)return e[t].exports;if(t in r){var n=r[t];delete r[t];var o={id:t,exports:{}};return e[t]=o,n.call(o.exports,o,o.exports),o.exports}var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(t,e){r[t]=e},t.parcelRequired6a3=n),n.register("aRz3z",(function(t,e){var r=n("9uTXM"),o=n("dNvdM"),i=n("i8N8v"),a=n("3SybD"),s=n("hfC1t"),u=n("4b2mP"),c=n("cVmaJ"),l=n("enVm6"),f=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(s(t)&&(a(t)||"string"==typeof t||"function"==typeof t.splice||u(t)||l(t)||i(t)))return!t.length;var e=o(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(c(t))return!r(t).length;for(var n in t)if(f.call(t,n))return!1;return!0}})),n.register("9uTXM",(function(t,e){var r=n("cVmaJ"),o=n("76Wgk"),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return o(t);var e=[];for(var n in Object(t))i.call(t,n)&&"constructor"!=n&&e.push(n);return e}})),n.register("cVmaJ",(function(t,e){var r=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}})),n.register("76Wgk",(function(t,e){var r=n("rH4tm")(Object.keys,Object);t.exports=r})),n.register("rH4tm",(function(t,e){t.exports=function(t,e){return function(r){return t(e(r))}}})),n.register("dNvdM",(function(t,e){var r=n("jwu9t"),o=n("aBKeu"),i=n("9xewy"),a=n("4zcGm"),s=n("ezqTv"),u=n("k9hdr"),c=n("8ksHv"),l="[object Map]",f="[object Promise]",p="[object Set]",d="[object WeakMap]",h="[object DataView]",v=c(r),y=c(o),m=c(i),g=c(a),E=c(s),T=u;(r&&T(new r(new ArrayBuffer(1)))!=h||o&&T(new o)!=l||i&&T(i.resolve())!=f||a&&T(new a)!=p||s&&T(new s)!=d)&&(T=function(t){var e=u(t),r="[object Object]"==e?t.constructor:void 0,n=r?c(r):"";if(n)switch(n){case v:return h;case y:return l;case m:return f;case g:return p;case E:return d}return e}),t.exports=T})),n.register("jwu9t",(function(t,e){var r=n("at7h6")(n("b6pt9"),"DataView");t.exports=r})),n.register("at7h6",(function(t,e){var r=n("1xC4F"),o=n("2MFKC");t.exports=function(t,e){var n=o(t,e);return r(n)?n:void 0}})),n.register("1xC4F",(function(t,e){var r=n("7kzWE"),o=n("dgWch"),i=n("li2L8"),a=n("8ksHv"),s=/^\[object .+?Constructor\]$/,u=Function.prototype,c=Object.prototype,l=u.toString,f=c.hasOwnProperty,p=RegExp("^"+l.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(r(t)?p:s).test(a(t))}})),n.register("7kzWE",(function(t,e){var r=n("k9hdr"),o=n("li2L8");t.exports=function(t){if(!o(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}})),n.register("k9hdr",(function(t,e){var r=n("hmS77"),o=n("e5gZC"),i=n("1JDvj"),a=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?o(t):i(t)}})),n.register("hmS77",(function(t,e){var r=n("b6pt9").Symbol;t.exports=r})),n.register("b6pt9",(function(t,e){var r=n("2MFNz"),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i})),n.register("2MFNz",(function(e,r){var n="object"==typeof t&&t&&t.Object===Object&&t;e.exports=n})),n.register("e5gZC",(function(t,e){var r=n("hmS77"),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,s=r?r.toStringTag:void 0;t.exports=function(t){var e=i.call(t,s),r=t[s];try{t[s]=void 0;var n=!0}catch(t){}var o=a.call(t);return n&&(e?t[s]=r:delete t[s]),o}})),n.register("1JDvj",(function(t,e){var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}})),n.register("li2L8",(function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}})),n.register("dgWch",(function(t,e){var r,o=n("fKIkd"),i=(r=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!i&&i in t}})),n.register("fKIkd",(function(t,e){var r=n("b6pt9")["__core-js_shared__"];t.exports=r})),n.register("8ksHv",(function(t,e){var r=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return r.call(t)}catch(t){}try{return t+""}catch(t){}}return""}})),n.register("2MFKC",(function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}})),n.register("aBKeu",(function(t,e){var r=n("at7h6")(n("b6pt9"),"Map");t.exports=r})),n.register("9xewy",(function(t,e){var r=n("at7h6")(n("b6pt9"),"Promise");t.exports=r})),n.register("4zcGm",(function(t,e){var r=n("at7h6")(n("b6pt9"),"Set");t.exports=r})),n.register("ezqTv",(function(t,e){var r=n("at7h6")(n("b6pt9"),"WeakMap");t.exports=r})),n.register("i8N8v",(function(t,e){var r=n("8USEL"),o=n("hSqRh"),i=Object.prototype,a=i.hasOwnProperty,s=i.propertyIsEnumerable,u=r(function(){return arguments}())?r:function(t){return o(t)&&a.call(t,"callee")&&!s.call(t,"callee")};t.exports=u})),n.register("8USEL",(function(t,e){var r=n("k9hdr"),o=n("hSqRh");t.exports=function(t){return o(t)&&"[object Arguments]"==r(t)}})),n.register("hSqRh",(function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}})),n.register("3SybD",(function(t,e){var r=Array.isArray;t.exports=r})),n.register("hfC1t",(function(t,e){var r=n("7kzWE"),o=n("9VSV8");t.exports=function(t){return null!=t&&o(t.length)&&!r(t)}})),n.register("9VSV8",(function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}})),n.register("4b2mP",(function(t,e){var r=n("b6pt9"),o=n("iiE7s"),i=e&&!e.nodeType&&e,a=i&&t&&!t.nodeType&&t,s=a&&a.exports===i?r.Buffer:void 0,u=(s?s.isBuffer:void 0)||o;t.exports=u})),n.register("iiE7s",(function(t,e){t.exports=function(){return!1}})),n.register("enVm6",(function(t,e){var r=n("7DFXB"),o=n("1gRpc"),i=n("gs7ZB"),a=i&&i.isTypedArray,s=a?o(a):r;t.exports=s})),n.register("7DFXB",(function(t,e){var r=n("k9hdr"),o=n("9VSV8"),i=n("hSqRh"),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!a[r(t)]}})),n.register("1gRpc",(function(t,e){t.exports=function(t){return function(e){return t(e)}}})),n.register("gs7ZB",(function(t,e){var r=n("2MFNz"),o=e&&!e.nodeType&&e,i=o&&t&&!t.nodeType&&t,a=i&&i.exports===o&&r.process,s=function(){try{var t=i&&i.require&&i.require("util").types;return t||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=s})),n.register("fW6i0",(function(t,e){var r=n("gVbGh"),o=n("cBPFM"),i=n("6waKj"),a=n("3SybD");t.exports=function(t,e){return(a(t)?r:i)(t,o(e,3))}})),n.register("gVbGh",(function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r-1}})),n.register("376ap",(function(t,e){var r=n("03Z0X");t.exports=function(t,e){var n=this.__data__,o=r(n,t);return o<0?(++this.size,n.push([t,e])):n[o][1]=e,this}})),n.register("ddKRd",(function(t,e){var r=n("4ybgw");t.exports=function(){this.__data__=new r,this.size=0}})),n.register("eG5pB",(function(t,e){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}})),n.register("9mPfo",(function(t,e){t.exports=function(t){return this.__data__.get(t)}})),n.register("1GfGO",(function(t,e){t.exports=function(t){return this.__data__.has(t)}})),n.register("5jHqX",(function(t,e){var r=n("4ybgw"),o=n("aBKeu"),i=n("fbsx3");t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var a=n.__data__;if(!o||a.length<199)return a.push([t,e]),this.size=++n.size,this;n=this.__data__=new i(a)}return n.set(t,e),this.size=n.size,this}})),n.register("fbsx3",(function(t,e){var r=n("gRHxZ"),o=n("4lvT0"),i=n("1vsKW"),a=n("49GzS"),s=n("hkwXO");function u(t){var e=-1,r=null==t?0:t.length;for(this.clear();++el))return!1;var p=u.get(t),d=u.get(e);if(p&&d)return p==e&&d==t;var h=-1,v=!0,y=2&n?new r:void 0;for(u.set(t,e),u.set(e,t);++h-1&&t%1==0&&to?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n1?r[i-1]:void 0,s=i>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,s&&o(r[0],r[1],s)&&(a=i<3?void 0:a,i=1),e=Object(e);++n0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}})),n.register("3D33N",(function(t,e){var r=n("2rosp"),o=n("hfC1t"),i=n("5YH1U"),a=n("li2L8");t.exports=function(t,e,n){if(!a(n))return!1;var s=typeof e;return!!("number"==s?o(n)&&i(e,n.length):"string"==s&&e in n)&&r(n[e],t)}})),n.register("4rTPm",(function(t,e){var r=n("8Mgkj"),o=n("cBPFM"),i=n("d0oeL"),a=n("3SybD"),s=n("3D33N");t.exports=function(t,e,n){var u=a(t)?r:i;return n&&s(t,e,n)&&(e=void 0),u(t,o(e,3))}})),n.register("d0oeL",(function(t,e){var r=n("i3OAU");t.exports=function(t,e){var n;return r(t,(function(t,r,o){return!(n=e(t,r,o))})),!!n}})),n.register("a89ul",(function(t,e){var r=n("eN9Mb"),o=n("9FzrZ"),i=n("cBPFM"),a=n("3SybD"),s=n("3D33N");t.exports=function(t,e,n){var u=a(t)?r:o;return n&&s(t,e,n)&&(e=void 0),u(t,i(e,3))}})),n.register("eN9Mb",(function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r-1:!!l&&r(t,e,n)>-1}})),n.register("fUGvY",(function(t,e){var r=n("dlrzi"),o=n("ieoeg"),i=n("akrE4");t.exports=function(t,e,n){return e==e?i(t,e,n):r(t,o,n)}})),n.register("dlrzi",(function(t,e){t.exports=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i0&&i(l)?n>1?t(l,n-1,i,a,s):r(s,l):a||(s[s.length]=l)}return s}})),n.register("jljyE",(function(t,e){var r=n("hmS77"),o=n("i8N8v"),i=n("3SybD"),a=r?r.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(a&&t&&t[a])}})),n.register("iRkuP",(function(t,e){var r=n("6yQEq");t.exports=function(t){return t&&t.length?r(t):[]}})),n.register("6yQEq",(function(t,e){var r=n("ghNts"),o=n("gYKC5"),i=n("7xdDu"),a=n("fpZ84"),s=n("e1zan"),u=n("8JBtI");t.exports=function(t,e,n){var c=-1,l=o,f=t.length,p=!0,d=[],h=d;if(n)p=!1,l=i;else if(f>=200){var v=e?null:s(t);if(v)return u(v);p=!1,l=a,h=new r}else h=e?[]:d;t:for(;++c-1}})),n.register("7xdDu",(function(t,e){t.exports=function(t,e,r){for(var n=-1,o=null==t?0:t.length;++n=200&&(f=u,p=!1,e=new r(e));t:for(;++l-1?s[u?e[c]:c]:void 0}}})),n.register("1360s",(function(t,e){var r=n("dlrzi"),o=n("cBPFM"),i=n("bTSCa"),a=Math.max;t.exports=function(t,e,n){var s=null==t?0:t.length;if(!s)return-1;var u=null==n?0:i(n);return u<0&&(u=a(s+u,0)),r(t,o(e,3),u)}})),n.register("bOO5X",(function(t,e){var r=n("afHc0"),o=n("7MzEZ"),i=n("cBPFM"),a=n("3SybD");t.exports=function(t,e){return(a(t)?r:o)(t,i(e,3))}})),n.register("4Kej7",(function(t,e){var r=n("15AZL"),o=n("2rosp"),i=n("3D33N"),a=n("le8Vh"),s=Object.prototype,u=s.hasOwnProperty,c=r((function(t,e){t=Object(t);var r=-1,n=e.length,c=n>2?e[2]:void 0;for(c&&i(e[0],e[1],c)&&(n=1);++r=o?t:r(t,e,n)}})),n.register("azGz5",(function(t,e){var r=RegExp("[\\u200d\ud800-\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");t.exports=function(t){return r.test(t)}})),n.register("3cfrv",(function(t,e){var r=n("crY65"),o=n("azGz5"),i=n("8c3e2");t.exports=function(t){return o(t)?i(t):r(t)}})),n.register("crY65",(function(t,e){t.exports=function(t){return t.split("")}})),n.register("8c3e2",(function(t,e){var r="[\ud800-\udfff]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",o="\ud83c[\udffb-\udfff]",i="[^\ud800-\udfff]",a="(?:\ud83c[\udde6-\uddff]){2}",s="[\ud800-\udbff][\udc00-\udfff]",u="(?:"+n+"|"+o+")"+"?",c="[\\ufe0e\\ufe0f]?",l=c+u+("(?:\\u200d(?:"+[i,a,s].join("|")+")"+c+u+")*"),f="(?:"+[i+n+"?",n,a,s,r].join("|")+")",p=RegExp(o+"(?="+o+")|"+f+l,"g");t.exports=function(t){return t.match(p)||[]}}));var o,i={},a={};Object.defineProperty(a,"__esModule",{value:!0}),a.Parser=a.createSyntaxDiagramsCode=a.clearCache=a.generateCstDts=a.GAstVisitor=a.serializeProduction=a.serializeGrammar=a.Terminal=a.Rule=a.RepetitionWithSeparator=a.RepetitionMandatoryWithSeparator=a.RepetitionMandatory=a.Repetition=a.Option=a.NonTerminal=a.Alternative=a.Alternation=a.defaultLexerErrorProvider=a.NoViableAltException=a.NotAllInputParsedException=a.MismatchedTokenException=a.isRecognitionException=a.EarlyExitException=a.defaultParserErrorProvider=a.LLkLookaheadStrategy=a.getLookaheadPaths=a.tokenName=a.tokenMatcher=a.tokenLabel=a.EOF=a.createTokenInstance=a.createToken=a.LexerDefinitionErrorType=a.Lexer=a.EMPTY_ALT=a.ParserDefinitionErrorType=a.EmbeddedActionsParser=a.CstParser=a.VERSION=void 0;var s={};Object.defineProperty(s,"__esModule",{value:!0}),s.VERSION=void 0,s.VERSION="10.4.2",Object.defineProperty(a,"VERSION",{enumerable:!0,get:function(){return s.VERSION}});var u,c={},l=c&&c.__extends||(u=function(t,e){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},u(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}u(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),f=c&&c.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(c,"__esModule",{value:!0}),c.EmbeddedActionsParser=c.CstParser=c.Parser=c.EMPTY_ALT=c.ParserDefinitionErrorType=c.DEFAULT_RULE_CONFIG=c.DEFAULT_PARSER_CONFIG=c.END_OF_FILE=void 0;var p=f(n("aRz3z")),d=f(n("fW6i0")),h=f(n("4OAgB")),v=f(n("4eHM6")),y=f(n("6mWlg")),m=f(n("aKVMx")),g={};Object.defineProperty(g,"__esModule",{value:!0}),g.toFastProperties=g.timer=g.PRINT_ERROR=g.PRINT_WARNING=void 0;var E={};Object.defineProperty(E,"__esModule",{value:!0}),E.PRINT_WARNING=E.PRINT_ERROR=void 0,E.PRINT_ERROR=function(t){console&&console.error&&console.error("Error: ".concat(t))},E.PRINT_WARNING=function(t){console&&console.warn&&console.warn("Warning: ".concat(t))},Object.defineProperty(g,"PRINT_WARNING",{enumerable:!0,get:function(){return E.PRINT_WARNING}}),Object.defineProperty(g,"PRINT_ERROR",{enumerable:!0,get:function(){return E.PRINT_ERROR}});var T={};Object.defineProperty(T,"__esModule",{value:!0}),T.timer=void 0,T.timer=function(t){var e=(new Date).getTime(),r=t();return{time:(new Date).getTime()-e,value:r}},Object.defineProperty(g,"timer",{enumerable:!0,get:function(){return T.timer}});var O={};Object.defineProperty(O,"__esModule",{value:!0}),O.toFastProperties=void 0,O.toFastProperties=function(t){function e(){}e.prototype=t;var r=new e;function n(){return typeof r.bar}return n(),n(),t},Object.defineProperty(g,"toFastProperties",{enumerable:!0,get:function(){return O.toFastProperties}});var _={},R=_&&_.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),A=_&&_.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_,"__esModule",{value:!0}),_.buildInProdFollowPrefix=_.buildBetweenProdsFollowPrefix=_.computeAllProdsFollows=_.ResyncFollowsWalker=void 0;var N={},I=N&&N.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(N,"__esModule",{value:!0}),N.RestWalker=void 0;var S=I(n("8eaqo")),b=I(n("4OAgB")),x={};Object.defineProperty(x,"__esModule",{value:!0}),x.isSequenceProd=x.isBranchingProd=x.isOptionalProd=x.getProductionDslName=x.GAstVisitor=x.serializeProduction=x.serializeGrammar=x.Alternative=x.Alternation=x.RepetitionWithSeparator=x.RepetitionMandatoryWithSeparator=x.RepetitionMandatory=x.Repetition=x.Option=x.NonTerminal=x.Terminal=x.Rule=void 0;var P={},L=P&&P.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),k=P&&P.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(P,"__esModule",{value:!0}),P.serializeProduction=P.serializeGrammar=P.Terminal=P.Alternation=P.RepetitionWithSeparator=P.Repetition=P.RepetitionMandatoryWithSeparator=P.RepetitionMandatory=P.Option=P.Alternative=P.Rule=P.NonTerminal=P.AbstractProduction=void 0;var C=k(n("fW6i0")),M=k(n("4OAgB")),w=k(n("ko1vo")),D=k(n("kDhcp")),U=k(n("7kw4i")),F=k(n("hTx0L"));function j(t){return e=t,(0,w.default)(e.LABEL)&&""!==e.LABEL?t.LABEL:t.name;var e}var B=function(){function t(t){this._definition=t}return Object.defineProperty(t.prototype,"definition",{get:function(){return this._definition},set:function(t){this._definition=t},enumerable:!1,configurable:!0}),t.prototype.accept=function(t){t.visit(this),(0,M.default)(this.definition,(function(e){e.accept(t)}))},t}();P.AbstractProduction=B;var G=function(t){function e(e){var r=t.call(this,[])||this;return r.idx=1,(0,F.default)(r,(0,U.default)(e,(function(t){return void 0!==t}))),r}return L(e,t),Object.defineProperty(e.prototype,"definition",{get:function(){return void 0!==this.referencedRule?this.referencedRule.definition:[]},set:function(t){},enumerable:!1,configurable:!0}),e.prototype.accept=function(t){t.visit(this)},e}(B);P.NonTerminal=G;var W=function(t){function e(e){var r=t.call(this,e.definition)||this;return r.orgText="",(0,F.default)(r,(0,U.default)(e,(function(t){return void 0!==t}))),r}return L(e,t),e}(B);P.Rule=W;var z=function(t){function e(e){var r=t.call(this,e.definition)||this;return r.ignoreAmbiguities=!1,(0,F.default)(r,(0,U.default)(e,(function(t){return void 0!==t}))),r}return L(e,t),e}(B);P.Alternative=z;var V=function(t){function e(e){var r=t.call(this,e.definition)||this;return r.idx=1,(0,F.default)(r,(0,U.default)(e,(function(t){return void 0!==t}))),r}return L(e,t),e}(B);P.Option=V;var K=function(t){function e(e){var r=t.call(this,e.definition)||this;return r.idx=1,(0,F.default)(r,(0,U.default)(e,(function(t){return void 0!==t}))),r}return L(e,t),e}(B);P.RepetitionMandatory=K;var Y=function(t){function e(e){var r=t.call(this,e.definition)||this;return r.idx=1,(0,F.default)(r,(0,U.default)(e,(function(t){return void 0!==t}))),r}return L(e,t),e}(B);P.RepetitionMandatoryWithSeparator=Y;var H=function(t){function e(e){var r=t.call(this,e.definition)||this;return r.idx=1,(0,F.default)(r,(0,U.default)(e,(function(t){return void 0!==t}))),r}return L(e,t),e}(B);P.Repetition=H;var X=function(t){function e(e){var r=t.call(this,e.definition)||this;return r.idx=1,(0,F.default)(r,(0,U.default)(e,(function(t){return void 0!==t}))),r}return L(e,t),e}(B);P.RepetitionWithSeparator=X;var q=function(t){function e(e){var r=t.call(this,e.definition)||this;return r.idx=1,r.ignoreAmbiguities=!1,r.hasPredicates=!1,(0,F.default)(r,(0,U.default)(e,(function(t){return void 0!==t}))),r}return L(e,t),Object.defineProperty(e.prototype,"definition",{get:function(){return this._definition},set:function(t){this._definition=t},enumerable:!1,configurable:!0}),e}(B);P.Alternation=q;var J=function(){function t(t){this.idx=1,(0,F.default)(this,(0,U.default)(t,(function(t){return void 0!==t})))}return t.prototype.accept=function(t){t.visit(this)},t}();function Z(t){function e(t){return(0,C.default)(t,Z)}if(t instanceof G){var r={type:"NonTerminal",name:t.nonTerminalName,idx:t.idx};return(0,w.default)(t.label)&&(r.label=t.label),r}if(t instanceof z)return{type:"Alternative",definition:e(t.definition)};if(t instanceof V)return{type:"Option",idx:t.idx,definition:e(t.definition)};if(t instanceof K)return{type:"RepetitionMandatory",idx:t.idx,definition:e(t.definition)};if(t instanceof Y)return{type:"RepetitionMandatoryWithSeparator",idx:t.idx,separator:Z(new J({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof X)return{type:"RepetitionWithSeparator",idx:t.idx,separator:Z(new J({terminalType:t.separator})),definition:e(t.definition)};if(t instanceof H)return{type:"Repetition",idx:t.idx,definition:e(t.definition)};if(t instanceof q)return{type:"Alternation",idx:t.idx,definition:e(t.definition)};if(t instanceof J){var n={type:"Terminal",name:t.terminalType.name,label:j(t.terminalType),idx:t.idx};(0,w.default)(t.label)&&(n.terminalLabel=t.label);var o=t.terminalType.PATTERN;return t.terminalType.PATTERN&&(n.pattern=(0,D.default)(o)?o.source:o),n}if(t instanceof W)return{type:"Rule",name:t.name,orgText:t.orgText,definition:e(t.definition)};throw Error("non exhaustive match")}P.Terminal=J,P.serializeGrammar=function(t){return(0,C.default)(t,Z)},P.serializeProduction=Z,Object.defineProperty(x,"Rule",{enumerable:!0,get:function(){return P.Rule}}),Object.defineProperty(x,"Terminal",{enumerable:!0,get:function(){return P.Terminal}}),Object.defineProperty(x,"NonTerminal",{enumerable:!0,get:function(){return P.NonTerminal}}),Object.defineProperty(x,"Option",{enumerable:!0,get:function(){return P.Option}}),Object.defineProperty(x,"Repetition",{enumerable:!0,get:function(){return P.Repetition}}),Object.defineProperty(x,"RepetitionMandatory",{enumerable:!0,get:function(){return P.RepetitionMandatory}}),Object.defineProperty(x,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return P.RepetitionMandatoryWithSeparator}}),Object.defineProperty(x,"RepetitionWithSeparator",{enumerable:!0,get:function(){return P.RepetitionWithSeparator}}),Object.defineProperty(x,"Alternation",{enumerable:!0,get:function(){return P.Alternation}}),Object.defineProperty(x,"Alternative",{enumerable:!0,get:function(){return P.Alternative}}),Object.defineProperty(x,"serializeGrammar",{enumerable:!0,get:function(){return P.serializeGrammar}}),Object.defineProperty(x,"serializeProduction",{enumerable:!0,get:function(){return P.serializeProduction}});var $={};Object.defineProperty($,"__esModule",{value:!0}),$.GAstVisitor=void 0;var Q=function(){function t(){}return t.prototype.visit=function(t){var e=t;switch(e.constructor){case P.NonTerminal:return this.visitNonTerminal(e);case P.Alternative:return this.visitAlternative(e);case P.Option:return this.visitOption(e);case P.RepetitionMandatory:return this.visitRepetitionMandatory(e);case P.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(e);case P.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(e);case P.Repetition:return this.visitRepetition(e);case P.Alternation:return this.visitAlternation(e);case P.Terminal:return this.visitTerminal(e);case P.Rule:return this.visitRule(e);default:throw Error("non exhaustive match")}},t.prototype.visitNonTerminal=function(t){},t.prototype.visitAlternative=function(t){},t.prototype.visitOption=function(t){},t.prototype.visitRepetition=function(t){},t.prototype.visitRepetitionMandatory=function(t){},t.prototype.visitRepetitionMandatoryWithSeparator=function(t){},t.prototype.visitRepetitionWithSeparator=function(t){},t.prototype.visitAlternation=function(t){},t.prototype.visitTerminal=function(t){},t.prototype.visitRule=function(t){},t}();$.GAstVisitor=Q,Object.defineProperty(x,"GAstVisitor",{enumerable:!0,get:function(){return $.GAstVisitor}});var tt={},et=tt&&tt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tt,"__esModule",{value:!0}),tt.getProductionDslName=tt.isBranchingProd=tt.isOptionalProd=tt.isSequenceProd=void 0;var rt=et(n("4rTPm")),nt=et(n("a89ul")),ot=et(n("3CODa"));tt.isSequenceProd=function(t){return t instanceof P.Alternative||t instanceof P.Option||t instanceof P.Repetition||t instanceof P.RepetitionMandatory||t instanceof P.RepetitionMandatoryWithSeparator||t instanceof P.RepetitionWithSeparator||t instanceof P.Terminal||t instanceof P.Rule},tt.isOptionalProd=function t(e,r){return void 0===r&&(r=[]),!!(e instanceof P.Option||e instanceof P.Repetition||e instanceof P.RepetitionWithSeparator)||(e instanceof P.Alternation?(0,rt.default)(e.definition,(function(e){return t(e,r)})):!(e instanceof P.NonTerminal&&(0,ot.default)(r,e))&&(e instanceof P.AbstractProduction&&(e instanceof P.NonTerminal&&r.push(e),(0,nt.default)(e.definition,(function(e){return t(e,r)})))))},tt.isBranchingProd=function(t){return t instanceof P.Alternation},tt.getProductionDslName=function(t){if(t instanceof P.NonTerminal)return"SUBRULE";if(t instanceof P.Option)return"OPTION";if(t instanceof P.Alternation)return"OR";if(t instanceof P.RepetitionMandatory)return"AT_LEAST_ONE";if(t instanceof P.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(t instanceof P.RepetitionWithSeparator)return"MANY_SEP";if(t instanceof P.Repetition)return"MANY";if(t instanceof P.Terminal)return"CONSUME";throw Error("non exhaustive match")},Object.defineProperty(x,"getProductionDslName",{enumerable:!0,get:function(){return tt.getProductionDslName}}),Object.defineProperty(x,"isOptionalProd",{enumerable:!0,get:function(){return tt.isOptionalProd}}),Object.defineProperty(x,"isBranchingProd",{enumerable:!0,get:function(){return tt.isBranchingProd}}),Object.defineProperty(x,"isSequenceProd",{enumerable:!0,get:function(){return tt.isSequenceProd}});var it=function(){function t(){}return t.prototype.walk=function(t,e){var r=this;void 0===e&&(e=[]),(0,b.default)(t.definition,(function(n,o){var i=(0,S.default)(t.definition,o+1);if(n instanceof x.NonTerminal)r.walkProdRef(n,i,e);else if(n instanceof x.Terminal)r.walkTerminal(n,i,e);else if(n instanceof x.Alternative)r.walkFlat(n,i,e);else if(n instanceof x.Option)r.walkOption(n,i,e);else if(n instanceof x.RepetitionMandatory)r.walkAtLeastOne(n,i,e);else if(n instanceof x.RepetitionMandatoryWithSeparator)r.walkAtLeastOneSep(n,i,e);else if(n instanceof x.RepetitionWithSeparator)r.walkManySep(n,i,e);else if(n instanceof x.Repetition)r.walkMany(n,i,e);else{if(!(n instanceof x.Alternation))throw Error("non exhaustive match");r.walkOr(n,i,e)}}))},t.prototype.walkTerminal=function(t,e,r){},t.prototype.walkProdRef=function(t,e,r){},t.prototype.walkFlat=function(t,e,r){var n=e.concat(r);this.walk(t,n)},t.prototype.walkOption=function(t,e,r){var n=e.concat(r);this.walk(t,n)},t.prototype.walkAtLeastOne=function(t,e,r){var n=[new x.Option({definition:t.definition})].concat(e,r);this.walk(t,n)},t.prototype.walkAtLeastOneSep=function(t,e,r){var n=at(t,e,r);this.walk(t,n)},t.prototype.walkMany=function(t,e,r){var n=[new x.Option({definition:t.definition})].concat(e,r);this.walk(t,n)},t.prototype.walkManySep=function(t,e,r){var n=at(t,e,r);this.walk(t,n)},t.prototype.walkOr=function(t,e,r){var n=this,o=e.concat(r);(0,b.default)(t.definition,(function(t){var e=new x.Alternative({definition:[t]});n.walk(e,o)}))},t}();function at(t,e,r){return[new x.Option({definition:[new x.Terminal({terminalType:t.separator})].concat(t.definition)})].concat(e,r)}N.RestWalker=it;var st={},ut=st&&st.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(st,"__esModule",{value:!0}),st.firstForTerminal=st.firstForBranching=st.firstForSequence=st.first=void 0;var ct=ut(n("eNvXX")),lt=ut(n("iRkuP")),ft=ut(n("fW6i0"));function pt(t){if(t instanceof x.NonTerminal)return pt(t.referencedRule);if(t instanceof x.Terminal)return vt(t);if((0,x.isSequenceProd)(t))return dt(t);if((0,x.isBranchingProd)(t))return ht(t);throw Error("non exhaustive match")}function dt(t){for(var e,r=[],n=t.definition,o=0,i=n.length>o,a=!0;i&&a;)e=n[o],a=(0,x.isOptionalProd)(e),r=r.concat(pt(e)),o+=1,i=n.length>o;return(0,lt.default)(r)}function ht(t){var e=(0,ft.default)(t.definition,(function(t){return pt(t)}));return(0,lt.default)((0,ct.default)(e))}function vt(t){return[t.terminalType]}st.first=pt,st.firstForSequence=dt,st.firstForBranching=ht,st.firstForTerminal=vt;var yt=A(n("4OAgB")),mt=A(n("hTx0L")),gt={};Object.defineProperty(gt,"__esModule",{value:!0}),gt.IN=void 0,gt.IN="_~IN~_";var Et=function(t){function e(e){var r=t.call(this)||this;return r.topProd=e,r.follows={},r}return R(e,t),e.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},e.prototype.walkTerminal=function(t,e,r){},e.prototype.walkProdRef=function(t,e,r){var n=Tt(t.referencedRule,t.idx)+this.topProd.name,o=e.concat(r),i=new x.Alternative({definition:o}),a=(0,st.first)(i);this.follows[n]=a},e}(N.RestWalker);function Tt(t,e){return t.name+e+gt.IN}_.ResyncFollowsWalker=Et,_.computeAllProdsFollows=function(t){var e={};return(0,yt.default)(t,(function(t){var r=new Et(t).startWalking();(0,mt.default)(e,r)})),e},_.buildBetweenProdsFollowPrefix=Tt,_.buildInProdFollowPrefix=function(t){return t.terminalType.name+t.idx+gt.IN};var Ot={},_t=Ot&&Ot.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ot,"__esModule",{value:!0}),Ot.tokenMatcher=Ot.createTokenInstance=Ot.EOF=Ot.createToken=Ot.hasTokenLabel=Ot.tokenName=Ot.tokenLabel=void 0;var Rt=_t(n("ko1vo")),At=_t(n("6mWlg")),Nt=_t(n("iWFaD")),It={},St=It&&It.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(It,"__esModule",{value:!0}),It.Lexer=It.LexerDefinitionErrorType=void 0;var bt={},xt=bt&&bt.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),Pt=bt&&bt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(bt,"__esModule",{value:!0}),bt.charCodeToOptimizedIndex=bt.minOptimizationVal=bt.buildLineBreakIssueMessage=bt.LineTerminatorOptimizedTester=bt.isShortPattern=bt.isCustomPattern=bt.cloneEmptyGroups=bt.performWarningRuntimeChecks=bt.performRuntimeChecks=bt.addStickyFlag=bt.addStartOfInput=bt.findUnreachablePatterns=bt.findModesThatDoNotExist=bt.findInvalidGroupType=bt.findDuplicatePatterns=bt.findUnsupportedFlags=bt.findStartOfInputAnchor=bt.findEmptyMatchRegExps=bt.findEndOfInputAnchor=bt.findInvalidPatterns=bt.findMissingPatterns=bt.validatePatterns=bt.analyzeTokenTypes=bt.enableSticky=bt.disableSticky=bt.SUPPORT_STICKY=bt.MODES=bt.DEFAULT_MODE=void 0;var Lt,kt,Ct={};Lt="undefined"!=typeof self?self:Ct,kt=function(){function t(){}t.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},t.prototype.restoreState=function(t){this.idx=t.idx,this.input=t.input,this.groupIdx=t.groupIdx},t.prototype.pattern=function(t){this.idx=0,this.input=t,this.groupIdx=0,this.consumeChar("/");var e=this.disjunction();this.consumeChar("/");for(var r={type:"Flags",loc:{begin:this.idx,end:t.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":s(r,"global");break;case"i":s(r,"ignoreCase");break;case"m":s(r,"multiLine");break;case"u":s(r,"unicode");break;case"y":s(r,"sticky")}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:e,loc:this.loc(0)}},t.prototype.disjunction=function(){var t=[],e=this.idx;for(t.push(this.alternative());"|"===this.peekChar();)this.consumeChar("|"),t.push(this.alternative());return{type:"Disjunction",value:t,loc:this.loc(e)}},t.prototype.alternative=function(){for(var t=[],e=this.idx;this.isTerm();)t.push(this.term());return{type:"Alternative",value:t,loc:this.loc(e)}},t.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},t.prototype.assertion=function(){var t=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(t)};case"$":return{type:"EndAnchor",loc:this.loc(t)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(t)};case"B":return{type:"NonWordBoundary",loc:this.loc(t)}}throw Error("Invalid Assertion Escape");case"(":var e;switch(this.consumeChar("?"),this.popChar()){case"=":e="Lookahead";break;case"!":e="NegativeLookahead"}u(e);var r=this.disjunction();return this.consumeChar(")"),{type:e,value:r,loc:this.loc(t)}}!function(){throw Error("Internal Error - Should never get here!")}()},t.prototype.quantifier=function(t){var e,r=this.idx;switch(this.popChar()){case"*":e={atLeast:0,atMost:1/0};break;case"+":e={atLeast:1,atMost:1/0};break;case"?":e={atLeast:0,atMost:1};break;case"{":var n=this.integerIncludingZero();switch(this.popChar()){case"}":e={atLeast:n,atMost:n};break;case",":e=this.isDigit()?{atLeast:n,atMost:this.integerIncludingZero()}:{atLeast:n,atMost:1/0},this.consumeChar("}")}if(!0===t&&void 0===e)return;u(e)}if(!0!==t||void 0!==e)return u(e),"?"===this.peekChar(0)?(this.consumeChar("?"),e.greedy=!1):e.greedy=!0,e.type="Quantifier",e.loc=this.loc(r),e},t.prototype.atom=function(){var t,e=this.idx;switch(this.peekChar()){case".":t=this.dotAll();break;case"\\":t=this.atomEscape();break;case"[":t=this.characterClass();break;case"(":t=this.group()}return void 0===t&&this.isPatternCharacter()&&(t=this.patternCharacter()),u(t),t.loc=this.loc(e),this.isQuantifier()&&(t.quantifier=this.quantifier()),t},t.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[i("\n"),i("\r"),i("\u2028"),i("\u2029")]}},t.prototype.atomEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},t.prototype.decimalEscapeAtom=function(){return{type:"GroupBackReference",value:this.positiveInteger()}},t.prototype.characterClassEscape=function(){var t,e=!1;switch(this.popChar()){case"d":t=c;break;case"D":t=c,e=!0;break;case"s":t=f;break;case"S":t=f,e=!0;break;case"w":t=l;break;case"W":t=l,e=!0}return u(t),{type:"Set",value:t,complement:e}},t.prototype.controlEscapeAtom=function(){var t;switch(this.popChar()){case"f":t=i("\f");break;case"n":t=i("\n");break;case"r":t=i("\r");break;case"t":t=i("\t");break;case"v":t=i("\v")}return u(t),{type:"Character",value:t}},t.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var t=this.popChar();if(!1===/[a-zA-Z]/.test(t))throw Error("Invalid ");return{type:"Character",value:t.toUpperCase().charCodeAt(0)-64}},t.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:i("\0")}},t.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},t.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},t.prototype.identityEscapeAtom=function(){return{type:"Character",value:i(this.popChar())}},t.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case"\n":case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:return{type:"Character",value:i(this.popChar())}}},t.prototype.characterClass=function(){var t=[],e=!1;for(this.consumeChar("["),"^"===this.peekChar(0)&&(this.consumeChar("^"),e=!0);this.isClassAtom();){var r=this.classAtom();if("Character"===r.type&&this.isRangeDash()){this.consumeChar("-");var n=this.classAtom();if("Character"===n.type){if(n.value=this.input.length)throw Error("Unexpected end of input");this.idx++},t.prototype.loc=function(t){return{begin:t,end:this.idx}};var e,r=/[0-9a-fA-F]/,n=/[0-9]/,o=/[1-9]/;function i(t){return t.charCodeAt(0)}function a(t,e){void 0!==t.length?t.forEach((function(t){e.push(t)})):e.push(t)}function s(t,e){if(!0===t[e])throw"duplicate flag "+e;t[e]=!0}function u(t){if(void 0===t)throw Error("Internal Error - Should never get here!")}var c=[];for(e=i("0");e<=i("9");e++)c.push(e);var l=[i("_")].concat(c);for(e=i("a");e<=i("z");e++)l.push(e);for(e=i("A");e<=i("Z");e++)l.push(e);var f=[i(" "),i("\f"),i("\n"),i("\r"),i("\t"),i("\v"),i("\t"),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i(" "),i("\u2028"),i("\u2029"),i(" "),i(" "),i(" "),i("\ufeff")];function p(){}return p.prototype.visitChildren=function(t){for(var e in t){var r=t[e];t.hasOwnProperty(e)&&(void 0!==r.type?this.visit(r):Array.isArray(r)&&r.forEach((function(t){this.visit(t)}),this))}},p.prototype.visit=function(t){switch(t.type){case"Pattern":this.visitPattern(t);break;case"Flags":this.visitFlags(t);break;case"Disjunction":this.visitDisjunction(t);break;case"Alternative":this.visitAlternative(t);break;case"StartAnchor":this.visitStartAnchor(t);break;case"EndAnchor":this.visitEndAnchor(t);break;case"WordBoundary":this.visitWordBoundary(t);break;case"NonWordBoundary":this.visitNonWordBoundary(t);break;case"Lookahead":this.visitLookahead(t);break;case"NegativeLookahead":this.visitNegativeLookahead(t);break;case"Character":this.visitCharacter(t);break;case"Set":this.visitSet(t);break;case"Group":this.visitGroup(t);break;case"GroupBackReference":this.visitGroupBackReference(t);break;case"Quantifier":this.visitQuantifier(t)}this.visitChildren(t)},p.prototype.visitPattern=function(t){},p.prototype.visitFlags=function(t){},p.prototype.visitDisjunction=function(t){},p.prototype.visitAlternative=function(t){},p.prototype.visitStartAnchor=function(t){},p.prototype.visitEndAnchor=function(t){},p.prototype.visitWordBoundary=function(t){},p.prototype.visitNonWordBoundary=function(t){},p.prototype.visitLookahead=function(t){},p.prototype.visitNegativeLookahead=function(t){},p.prototype.visitCharacter=function(t){},p.prototype.visitSet=function(t){},p.prototype.visitGroup=function(t){},p.prototype.visitGroupBackReference=function(t){},p.prototype.visitQuantifier=function(t){},{RegExpParser:t,BaseRegExpVisitor:p,VERSION:"0.5.0"}},"function"==typeof define&&define.amd?define([],kt):Ct?Ct=kt():Lt.regexpToAst=kt();var Mt=Pt(n("3TjNg")),wt=Pt(n("aRz3z")),Dt=Pt(n("1LMU5")),Ut=Pt(n("3SybD")),Ft=Pt(n("4eHM6")),jt=Pt(n("eNvXX")),Bt=Pt(n("9cKYI")),Gt=Pt(n("eZZZl")),Wt=Pt(n("8CjqV")),zt=Pt(n("fW6i0")),Vt=Pt(n("4OAgB")),Kt=Pt(n("ko1vo")),Yt=Pt(n("7kzWE")),Ht=Pt(n("iWFaD")),Xt=Pt(n("9kHzu")),qt=Pt(n("6mWlg")),Jt=Pt(n("e2a9e")),Zt=Pt(n("kDhcp")),$t=Pt(n("bOO5X")),Qt=Pt(n("4Kej7")),te=Pt(n("lIKAq")),ee=Pt(n("3CODa")),re={},ne=re&&re.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),oe=re&&re.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(re,"__esModule",{value:!0}),re.canMatchCharCode=re.firstCharOptimizedIndices=re.getOptimizedStartCodesIndices=re.failedOptimizationPrefixMsg=void 0;var ie=oe(n("3SybD")),ae=oe(n("a89ul")),se=oe(n("4OAgB")),ue=oe(n("9kHzu")),ce=oe(n("4eHM6")),le=oe(n("3CODa")),fe={};Object.defineProperty(fe,"__esModule",{value:!0}),fe.clearRegExpParserCache=fe.getRegExpAst=void 0;var pe={},de=new Ct.RegExpParser;fe.getRegExpAst=function(t){var e=t.toString();if(pe.hasOwnProperty(e))return pe[e];var r=de.pattern(e);return pe[e]=r,r},fe.clearRegExpParserCache=function(){pe={}};var he="Complement Sets are not supported for first char optimization";function ve(t,e,r){switch(t.type){case"Disjunction":for(var n=0;n=bt.minOptimizationVal)for(var i=n.from>=bt.minOptimizationVal?n.from:bt.minOptimizationVal,a=n.to,s=(0,bt.charCodeToOptimizedIndex)(i),u=(0,bt.charCodeToOptimizedIndex)(a),c=s;c<=u;c++)e[c]=c}}}));break;case"Group":ve(a.value,e,r);break;default:throw Error("Non Exhaustive Match")}var s=void 0!==a.quantifier&&0===a.quantifier.atLeast;if("Group"===a.type&&!1===ge(a)||"Group"!==a.type&&!1===s)break}break;default:throw Error("non exhaustive match!")}return(0,ce.default)(e)}function ye(t,e,r){var n=(0,bt.charCodeToOptimizedIndex)(t);e[n]=n,!0===r&&function(t,e){var r=String.fromCharCode(t),n=r.toUpperCase();if(n!==r){e[o=(0,bt.charCodeToOptimizedIndex)(n.charCodeAt(0))]=o}else{var o,i=r.toLowerCase();if(i!==r)e[o=(0,bt.charCodeToOptimizedIndex)(i.charCodeAt(0))]=o}}(t,e)}function me(t,e){return(0,ue.default)(t.value,(function(t){if("number"==typeof t)return(0,le.default)(e,t);var r=t;return void 0!==(0,ue.default)(e,(function(t){return r.from<=t&&t<=r.to}))}))}function ge(t){var e=t.quantifier;return!(!e||0!==e.atLeast)||!!t.value&&((0,ie.default)(t.value)?(0,ae.default)(t.value,ge):ge(t.value))}re.failedOptimizationPrefixMsg='Unable to use "first char" lexer optimizations:\n',re.getOptimizedStartCodesIndices=function(t,e){void 0===e&&(e=!1);try{var r=(0,fe.getRegExpAst)(t);return ve(r.value,{},r.flags.ignoreCase)}catch(r){if(r.message===he)e&&(0,g.PRINT_WARNING)("".concat(re.failedOptimizationPrefixMsg)+"\tUnable to optimize: < ".concat(t.toString()," >\n")+"\tComplement Sets cannot be automatically optimized.\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.");else{var n="";e&&(n="\n\tThis will disable the lexer's first char optimizations.\n\tSee: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details."),(0,g.PRINT_ERROR)("".concat(re.failedOptimizationPrefixMsg,"\n")+"\tFailed parsing: < ".concat(t.toString()," >\n")+"\tUsing the regexp-to-ast library version: ".concat(Ct.VERSION,"\n")+"\tPlease open an issue at: https://github.com/bd82/regexp-to-ast/issues"+n)}}return[]},re.firstCharOptimizedIndices=ve;var Ee=function(t){function e(e){var r=t.call(this)||this;return r.targetCharCodes=e,r.found=!1,r}return ne(e,t),e.prototype.visitChildren=function(e){if(!0!==this.found){switch(e.type){case"Lookahead":return void this.visitLookahead(e);case"NegativeLookahead":return void this.visitNegativeLookahead(e)}t.prototype.visitChildren.call(this,e)}},e.prototype.visitCharacter=function(t){(0,le.default)(this.targetCharCodes,t.value)&&(this.found=!0)},e.prototype.visitSet=function(t){t.complement?void 0===me(t,this.targetCharCodes)&&(this.found=!0):void 0!==me(t,this.targetCharCodes)&&(this.found=!0)},e}(Ct.BaseRegExpVisitor);re.canMatchCharCode=function(t,e){if(e instanceof RegExp){var r=(0,fe.getRegExpAst)(e),n=new Ee(t);return n.visit(r),n.found}return void 0!==(0,ue.default)(e,(function(e){return(0,le.default)(t,e.charCodeAt(0))}))};var Te="PATTERN";function Oe(t){var e=(0,$t.default)(t,(function(t){return!(0,qt.default)(t,Te)}));return{errors:(0,zt.default)(e,(function(t){return{message:"Token Type: ->"+t.name+"<- missing static 'PATTERN' property",type:It.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[t]}})),valid:(0,Gt.default)(t,e)}}function _e(t){var e=(0,$t.default)(t,(function(t){var e=t[Te];return!((0,Zt.default)(e)||(0,Yt.default)(e)||(0,qt.default)(e,"exec")||(0,Kt.default)(e))}));return{errors:(0,zt.default)(e,(function(t){return{message:"Token Type: ->"+t.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:It.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[t]}})),valid:(0,Gt.default)(t,e)}}bt.DEFAULT_MODE="defaultMode",bt.MODES="modes",bt.SUPPORT_STICKY="boolean"==typeof new RegExp("(?:)").sticky,bt.disableSticky=function(){bt.SUPPORT_STICKY=!1},bt.enableSticky=function(){bt.SUPPORT_STICKY=!0},bt.analyzeTokenTypes=function(t,e){var r,n=(e=(0,Qt.default)(e,{useSticky:bt.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r","\n"],tracer:function(t,e){return e()}})).tracer;n("initCharCodeToOptimizedIndexMap",(function(){!function(){if((0,wt.default)(Ge)){Ge=new Array(65536);for(var t=0;t<65536;t++)Ge[t]=t>255?255+~~(t/255):t}}()})),n("Reject Lexer.NA",(function(){r=(0,Bt.default)(t,(function(t){return t[Te]===It.Lexer.NA}))}));var o,i,a,s,u,c,l,f,p,d,h,v=!1;n("Transform Patterns",(function(){v=!1,o=(0,zt.default)(r,(function(t){var r=t[Te];if((0,Zt.default)(r)){var n=r.source;return 1!==n.length||"^"===n||"$"===n||"."===n||r.ignoreCase?2!==n.length||"\\"!==n[0]||(0,ee.default)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],n[1])?e.useSticky?Me(r):Ce(r):n[1]:n}if((0,Yt.default)(r))return v=!0,{exec:r};if("object"==typeof r)return v=!0,r;if("string"==typeof r){if(1===r.length)return r;var o=r.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),i=new RegExp(o);return e.useSticky?Me(i):Ce(i)}throw Error("non exhaustive match")}))})),n("misc mapping",(function(){i=(0,zt.default)(r,(function(t){return t.tokenTypeIdx})),a=(0,zt.default)(r,(function(t){var e=t.GROUP;if(e!==It.Lexer.SKIPPED){if((0,Kt.default)(e))return e;if((0,Ht.default)(e))return!1;throw Error("non exhaustive match")}})),s=(0,zt.default)(r,(function(t){var e=t.LONGER_ALT;if(e)return(0,Ut.default)(e)?(0,zt.default)(e,(function(t){return(0,Wt.default)(r,t)})):[(0,Wt.default)(r,e)]})),u=(0,zt.default)(r,(function(t){return t.PUSH_MODE})),c=(0,zt.default)(r,(function(t){return(0,qt.default)(t,"POP_MODE")}))})),n("Line Terminator Handling",(function(){var t=je(e.lineTerminatorCharacters);l=(0,zt.default)(r,(function(t){return!1})),"onlyOffset"!==e.positionTracking&&(l=(0,zt.default)(r,(function(e){return(0,qt.default)(e,"LINE_BREAKS")?!!e.LINE_BREAKS:!1===Ue(e,t)&&(0,re.canMatchCharCode)(t,e.PATTERN)})))})),n("Misc Mapping #2",(function(){f=(0,zt.default)(r,we),p=(0,zt.default)(o,De),d=(0,te.default)(r,(function(t,e){var r=e.GROUP;return(0,Kt.default)(r)&&r!==It.Lexer.SKIPPED&&(t[r]=[]),t}),{}),h=(0,zt.default)(o,(function(t,e){return{pattern:o[e],longerAlt:s[e],canLineTerminator:l[e],isCustom:f[e],short:p[e],group:a[e],push:u[e],pop:c[e],tokenTypeIdx:i[e],tokenType:r[e]}}))}));var y=!0,m=[];return e.safeMode||n("First Char Optimization",(function(){m=(0,te.default)(r,(function(t,r,n){if("string"==typeof r.PATTERN){var o=We(r.PATTERN.charCodeAt(0));Be(t,o,h[n])}else if((0,Ut.default)(r.START_CHARS_HINT)){var i;(0,Vt.default)(r.START_CHARS_HINT,(function(e){var r=We("string"==typeof e?e.charCodeAt(0):e);i!==r&&(i=r,Be(t,r,h[n]))}))}else if((0,Zt.default)(r.PATTERN))if(r.PATTERN.unicode)y=!1,e.ensureOptimizations&&(0,g.PRINT_ERROR)("".concat(re.failedOptimizationPrefixMsg)+"\tUnable to analyze < ".concat(r.PATTERN.toString()," > pattern.\n")+"\tThe regexp unicode flag is not currently supported by the regexp-to-ast library.\n\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE");else{var a=(0,re.getOptimizedStartCodesIndices)(r.PATTERN,e.ensureOptimizations);(0,wt.default)(a)&&(y=!1),(0,Vt.default)(a,(function(e){Be(t,e,h[n])}))}else e.ensureOptimizations&&(0,g.PRINT_ERROR)("".concat(re.failedOptimizationPrefixMsg)+"\tTokenType: <".concat(r.name,"> is using a custom token pattern without providing parameter.\n")+"\tThis will disable the lexer's first char optimizations.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE"),y=!1;return t}),[])})),{emptyGroups:d,patternIdxToConfig:h,charCodeToPatternIdxToConfig:m,hasCustom:v,canBeOptimized:y}},bt.validatePatterns=function(t,e){var r=[],n=Oe(t);r=r.concat(n.errors);var o=_e(n.valid),i=o.valid;return r=(r=(r=(r=(r=r.concat(o.errors)).concat(function(t){var e=[],r=(0,$t.default)(t,(function(t){return(0,Zt.default)(t[Te])}));return e=e.concat(Ae(r)),e=e.concat(Se(r)),e=e.concat(be(r)),e=e.concat(xe(r)),e=e.concat(Ne(r)),e}(i))).concat(Pe(i))).concat(Le(i,e))).concat(ke(i))},bt.findMissingPatterns=Oe,bt.findInvalidPatterns=_e;var Re=/[^\\][$]/;function Ae(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.found=!1,e}return xt(e,t),e.prototype.visitEndAnchor=function(t){this.found=!0},e}(Ct.BaseRegExpVisitor),r=(0,$t.default)(t,(function(t){var r=t.PATTERN;try{var n=(0,fe.getRegExpAst)(r),o=new e;return o.visit(n),o.found}catch(t){return Re.test(r.source)}}));return(0,zt.default)(r,(function(t){return{message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+t.name+"<- static 'PATTERN' cannot contain end of input anchor '$'\n\tSee chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:It.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[t]}}))}function Ne(t){var e=(0,$t.default)(t,(function(t){return t.PATTERN.test("")}));return(0,zt.default)(e,(function(t){return{message:"Token Type: ->"+t.name+"<- static 'PATTERN' must not match an empty string",type:It.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[t]}}))}bt.findEndOfInputAnchor=Ae,bt.findEmptyMatchRegExps=Ne;var Ie=/[^\\[][\^]|^\^/;function Se(t){var e=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.found=!1,e}return xt(e,t),e.prototype.visitStartAnchor=function(t){this.found=!0},e}(Ct.BaseRegExpVisitor),r=(0,$t.default)(t,(function(t){var r=t.PATTERN;try{var n=(0,fe.getRegExpAst)(r),o=new e;return o.visit(n),o.found}catch(t){return Ie.test(r.source)}}));return(0,zt.default)(r,(function(t){return{message:"Unexpected RegExp Anchor Error:\n\tToken Type: ->"+t.name+"<- static 'PATTERN' cannot contain start of input anchor '^'\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS\tfor details.",type:It.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[t]}}))}function be(t){var e=(0,$t.default)(t,(function(t){var e=t[Te];return e instanceof RegExp&&(e.multiline||e.global)}));return(0,zt.default)(e,(function(t){return{message:"Token Type: ->"+t.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:It.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[t]}}))}function xe(t){var e=[],r=(0,zt.default)(t,(function(r){return(0,te.default)(t,(function(t,n){return r.PATTERN.source!==n.PATTERN.source||(0,ee.default)(e,n)||n.PATTERN===It.Lexer.NA||(e.push(n),t.push(n)),t}),[])}));r=(0,Dt.default)(r);var n=(0,$t.default)(r,(function(t){return t.length>1}));return(0,zt.default)(n,(function(t){var e=(0,zt.default)(t,(function(t){return t.name})),r=(0,Mt.default)(t).PATTERN;return{message:"The same RegExp pattern ->".concat(r,"<-")+"has been used in all of the following Token Types: ".concat(e.join(", ")," <-"),type:It.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:t}}))}function Pe(t){var e=(0,$t.default)(t,(function(t){if(!(0,qt.default)(t,"GROUP"))return!1;var e=t.GROUP;return e!==It.Lexer.SKIPPED&&e!==It.Lexer.NA&&!(0,Kt.default)(e)}));return(0,zt.default)(e,(function(t){return{message:"Token Type: ->"+t.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:It.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[t]}}))}function Le(t,e){var r=(0,$t.default)(t,(function(t){return void 0!==t.PUSH_MODE&&!(0,ee.default)(e,t.PUSH_MODE)}));return(0,zt.default)(r,(function(t){return{message:"Token Type: ->".concat(t.name,"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->").concat(t.PUSH_MODE,"<-")+"which does not exist",type:It.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[t]}}))}function ke(t){var e=[],r=(0,te.default)(t,(function(t,e,r){var n,o,i=e.PATTERN;return i===It.Lexer.NA||((0,Kt.default)(i)?t.push({str:i,idx:r,tokenType:e}):(0,Zt.default)(i)&&(n=i,o=[".","\\","[","]","|","^","$","(",")","?","*","+","{"],void 0===(0,Xt.default)(o,(function(t){return-1!==n.source.indexOf(t)})))&&t.push({str:i.source,idx:r,tokenType:e})),t}),[]);return(0,Vt.default)(t,(function(t,n){(0,Vt.default)(r,(function(r){var o=r.str,i=r.idx,a=r.tokenType;if(n".concat(t.name,"<-")+"in the lexer's definition.\nSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE";e.push({message:s,type:It.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[t,a]})}}))})),e}function Ce(t){var e=t.ignoreCase?"i":"";return new RegExp("^(?:".concat(t.source,")"),e)}function Me(t){var e=t.ignoreCase?"iy":"y";return new RegExp("".concat(t.source),e)}function we(t){var e=t.PATTERN;if((0,Zt.default)(e))return!1;if((0,Yt.default)(e))return!0;if((0,qt.default)(e,"exec"))return!0;if((0,Kt.default)(e))return!1;throw Error("non exhaustive match")}function De(t){return!(!(0,Kt.default)(t)||1!==t.length)&&t.charCodeAt(0)}function Ue(t,e){if((0,qt.default)(t,"LINE_BREAKS"))return!1;if((0,Zt.default)(t.PATTERN)){try{(0,re.canMatchCharCode)(e,t.PATTERN)}catch(t){return{issue:It.LexerDefinitionErrorType.IDENTIFY_TERMINATOR,errMsg:t.message}}return!1}if((0,Kt.default)(t.PATTERN))return!1;if(we(t))return{issue:It.LexerDefinitionErrorType.CUSTOM_LINE_BREAK};throw Error("non exhaustive match")}function Fe(t,e){if(e.issue===It.LexerDefinitionErrorType.IDENTIFY_TERMINATOR)return"Warning: unable to identify line terminator usage in pattern.\n"+"\tThe problem is in the <".concat(t.name,"> Token Type\n")+"\t Root cause: ".concat(e.errMsg,".\n")+"\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(e.issue===It.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return"Warning: A Custom Token Pattern should specify the option.\n"+"\tThe problem is in the <".concat(t.name,"> Token Type\n")+"\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}function je(t){return(0,zt.default)(t,(function(t){return(0,Kt.default)(t)?t.charCodeAt(0):t}))}function Be(t,e,r){void 0===t[e]?t[e]=[r]:t[e].push(r)}bt.findStartOfInputAnchor=Se,bt.findUnsupportedFlags=be,bt.findDuplicatePatterns=xe,bt.findInvalidGroupType=Pe,bt.findModesThatDoNotExist=Le,bt.findUnreachablePatterns=ke,bt.addStartOfInput=Ce,bt.addStickyFlag=Me,bt.performRuntimeChecks=function(t,e,r){var n=[];return(0,qt.default)(t,bt.DEFAULT_MODE)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+bt.DEFAULT_MODE+"> property in its definition\n",type:It.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,qt.default)(t,bt.MODES)||n.push({message:"A MultiMode Lexer cannot be initialized without a <"+bt.MODES+"> property in its definition\n",type:It.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,qt.default)(t,bt.MODES)&&(0,qt.default)(t,bt.DEFAULT_MODE)&&!(0,qt.default)(t.modes,t.defaultMode)&&n.push({message:"A MultiMode Lexer cannot be initialized with a ".concat(bt.DEFAULT_MODE,": <").concat(t.defaultMode,">")+"which does not exist\n",type:It.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,qt.default)(t,bt.MODES)&&(0,Vt.default)(t.modes,(function(t,e){(0,Vt.default)(t,(function(r,o){if((0,Ht.default)(r))n.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+"<".concat(e,"> at index: <").concat(o,">\n"),type:It.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED});else if((0,qt.default)(r,"LONGER_ALT")){var i=(0,Ut.default)(r.LONGER_ALT)?r.LONGER_ALT:[r.LONGER_ALT];(0,Vt.default)(i,(function(o){(0,Ht.default)(o)||(0,ee.default)(t,o)||n.push({message:"A MultiMode Lexer cannot be initialized with a longer_alt <".concat(o.name,"> on token <").concat(r.name,"> outside of mode <").concat(e,">\n"),type:It.LexerDefinitionErrorType.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE})}))}}))})),n},bt.performWarningRuntimeChecks=function(t,e,r){var n=[],o=!1,i=(0,Dt.default)((0,jt.default)((0,Ft.default)(t.modes))),a=(0,Bt.default)(i,(function(t){return t[Te]===It.Lexer.NA})),s=je(r);return e&&(0,Vt.default)(a,(function(t){var e=Ue(t,s);if(!1!==e){var r={message:Fe(t,e),type:e.issue,tokenType:t};n.push(r)}else(0,qt.default)(t,"LINE_BREAKS")?!0===t.LINE_BREAKS&&(o=!0):(0,re.canMatchCharCode)(s,t.PATTERN)&&(o=!0)})),e&&!o&&n.push({message:"Warning: No LINE_BREAKS Found.\n\tThis Lexer has been defined to track line and column information,\n\tBut none of the Token Types can be identified as matching a line terminator.\n\tSee https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS \n\tfor details.",type:It.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),n},bt.cloneEmptyGroups=function(t){var e={},r=(0,Jt.default)(t);return(0,Vt.default)(r,(function(r){var n=t[r];if(!(0,Ut.default)(n))throw Error("non exhaustive match");e[r]=[]})),e},bt.isCustomPattern=we,bt.isShortPattern=De,bt.LineTerminatorOptimizedTester={test:function(t){for(var e=t.length,r=this.lastIndex;r0}))},rr.expandCategories=hr,rr.assignTokenDefaultProps=vr,rr.assignCategoriesTokensProp=yr,rr.assignCategoriesMapProp=mr,rr.singleAssignCategoriesToksMap=gr,rr.hasShortKeyProperty=Er,rr.hasCategoriesProperty=Tr,rr.hasExtendingTokensTypesProperty=Or,rr.hasExtendingTokensTypesMapProperty=_r,rr.isTokenType=function(t){return(0,fr.default)(t,"tokenTypeIdx")};var Rr,Ar={};Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.defaultLexerErrorProvider=void 0,Ar.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(t){return"Unable to pop Lexer Mode after encountering Token ->".concat(t.image,"<- The Mode Stack is empty")},buildUnexpectedCharactersMessage:function(t,e,r,n,o){return"unexpected character: ->".concat(t.charAt(e),"<- at offset: ").concat(e,",")+" skipped ".concat(r," characters.")}},(Rr=It.LexerDefinitionErrorType||(It.LexerDefinitionErrorType={}))[Rr.MISSING_PATTERN=0]="MISSING_PATTERN",Rr[Rr.INVALID_PATTERN=1]="INVALID_PATTERN",Rr[Rr.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",Rr[Rr.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",Rr[Rr.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",Rr[Rr.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",Rr[Rr.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",Rr[Rr.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",Rr[Rr.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",Rr[Rr.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",Rr[Rr.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",Rr[Rr.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",Rr[Rr.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",Rr[Rr.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",Rr[Rr.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",Rr[Rr.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",Rr[Rr.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK",Rr[Rr.MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE=17]="MULTI_MODE_LEXER_LONGER_ALT_NOT_IN_CURRENT_MODE";var Nr={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:["\n","\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:Ar.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1,recoveryEnabled:!0};Object.freeze(Nr);var Ir=function(){function t(t,e){void 0===e&&(e=Nr);var r=this;if(this.lexerDefinition=t,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},this.TRACE_INIT=function(t,e){if(!0===r.traceInitPerf){r.traceInitIndent++;var n=new Array(r.traceInitIndent+1).join("\t");r.traceInitIndent"));var o=(0,g.timer)(e),i=o.time,a=o.value,s=i>10?console.warn:console.log;return r.traceInitIndent time: ").concat(i,"ms")),r.traceInitIndent--,a}return e()},"boolean"==typeof e)throw Error("The second argument to the Lexer constructor is now an ILexerConfig Object.\na boolean 2nd argument is no longer supported");this.config=(0,Qe.default)({},Nr,e);var n=this.config.traceInitPerf;!0===n?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):"number"==typeof n&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",(function(){var n,o=!0;r.TRACE_INIT("Lexer Config handling",(function(){if(r.config.lineTerminatorsPattern===Nr.lineTerminatorsPattern)r.config.lineTerminatorsPattern=bt.LineTerminatorOptimizedTester;else if(r.config.lineTerminatorCharacters===Nr.lineTerminatorCharacters)throw Error("Error: Missing property on the Lexer config.\n\tFor details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS");if(e.safeMode&&e.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');r.trackStartLines=/full|onlyStart/i.test(r.config.positionTracking),r.trackEndLines=/full/i.test(r.config.positionTracking),(0,Ke.default)(t)?n={modes:{defaultMode:(0,er.default)(t)},defaultMode:bt.DEFAULT_MODE}:(o=!1,n=(0,er.default)(t))})),!1===r.config.skipValidations&&(r.TRACE_INIT("performRuntimeChecks",(function(){r.lexerDefinitionErrors=r.lexerDefinitionErrors.concat((0,bt.performRuntimeChecks)(n,r.trackStartLines,r.config.lineTerminatorCharacters))})),r.TRACE_INIT("performWarningRuntimeChecks",(function(){r.lexerDefinitionWarning=r.lexerDefinitionWarning.concat((0,bt.performWarningRuntimeChecks)(n,r.trackStartLines,r.config.lineTerminatorCharacters))}))),n.modes=n.modes?n.modes:{},(0,qe.default)(n.modes,(function(t,e){n.modes[e]=(0,He.default)(t,(function(t){return(0,Ze.default)(t)}))}));var i=(0,Je.default)(n.modes);if((0,qe.default)(n.modes,(function(t,n){r.TRACE_INIT("Mode: <".concat(n,"> processing"),(function(){var o;(r.modes.push(n),!1===r.config.skipValidations&&r.TRACE_INIT("validatePatterns",(function(){r.lexerDefinitionErrors=r.lexerDefinitionErrors.concat((0,bt.validatePatterns)(t,i))})),(0,Ve.default)(r.lexerDefinitionErrors))&&((0,rr.augmentTokenTypes)(t),r.TRACE_INIT("analyzeTokenTypes",(function(){o=(0,bt.analyzeTokenTypes)(t,{lineTerminatorCharacters:r.config.lineTerminatorCharacters,positionTracking:e.positionTracking,ensureOptimizations:e.ensureOptimizations,safeMode:e.safeMode,tracer:r.TRACE_INIT})})),r.patternIdxToConfig[n]=o.patternIdxToConfig,r.charCodeToPatternIdxToConfig[n]=o.charCodeToPatternIdxToConfig,r.emptyGroups=(0,Qe.default)({},r.emptyGroups,o.emptyGroups),r.hasCustom=o.hasCustom||r.hasCustom,r.canModeBeOptimized[n]=o.canBeOptimized)}))})),r.defaultMode=n.defaultMode,!(0,Ve.default)(r.lexerDefinitionErrors)&&!r.config.deferDefinitionErrorsHandling){var a=(0,Xe.default)(r.lexerDefinitionErrors,(function(t){return t.message})).join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+a)}(0,qe.default)(r.lexerDefinitionWarning,(function(t){(0,g.PRINT_WARNING)(t.message)})),r.TRACE_INIT("Choosing sub-methods implementations",(function(){if(bt.SUPPORT_STICKY?(r.chopInput=$e.default,r.match=r.matchWithTest):(r.updateLastIndex=ze.default,r.match=r.matchWithExec),o&&(r.handleModes=ze.default),!1===r.trackStartLines&&(r.computeNewColumn=$e.default),!1===r.trackEndLines&&(r.updateTokenEndLineColumnLocation=ze.default),/full/i.test(r.config.positionTracking))r.createTokenInstance=r.createFullToken;else if(/onlyStart/i.test(r.config.positionTracking))r.createTokenInstance=r.createStartOnlyToken;else{if(!/onlyOffset/i.test(r.config.positionTracking))throw Error('Invalid config option: "'.concat(r.config.positionTracking,'"'));r.createTokenInstance=r.createOffsetOnlyToken}r.hasCustom?(r.addToken=r.addTokenUsingPush,r.handlePayload=r.handlePayloadWithCustom):(r.addToken=r.addTokenUsingMemberAccess,r.handlePayload=r.handlePayloadNoCustom)})),r.TRACE_INIT("Failed Optimization Warnings",(function(){var t=(0,tr.default)(r.canModeBeOptimized,(function(t,e,r){return!1===e&&t.push(r),t}),[]);if(e.ensureOptimizations&&!(0,Ve.default)(t))throw Error("Lexer Modes: < ".concat(t.join(", ")," > cannot be optimized.\n")+'\t Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode.\n\t Or inspect the console log for details on how to resolve these issues.')})),r.TRACE_INIT("clearRegExpParserCache",(function(){(0,fe.clearRegExpParserCache)()})),r.TRACE_INIT("toFastProperties",(function(){(0,g.toFastProperties)(r)}))}))}return t.prototype.tokenize=function(t,e){if(void 0===e&&(e=this.defaultMode),!(0,Ve.default)(this.lexerDefinitionErrors)){var r=(0,Xe.default)(this.lexerDefinitionErrors,(function(t){return t.message})).join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+r)}return this.tokenizeInternal(t,e)},t.prototype.tokenizeInternal=function(t,e){var r,n,o,i,a,s,u,c,l,f,p,d,h,v,y,m,g=this,E=t,T=E.length,O=0,_=0,R=this.hasCustom?0:Math.floor(t.length/10),A=new Array(R),N=[],I=this.trackStartLines?1:void 0,S=this.trackStartLines?1:void 0,b=(0,bt.cloneEmptyGroups)(this.emptyGroups),x=this.trackStartLines,P=this.config.lineTerminatorsPattern,L=0,k=[],C=[],M=[],w=[];function D(){return k}function U(t){var e=(0,bt.charCodeToOptimizedIndex)(t),r=C[e];return void 0===r?w:r}Object.freeze(w);var F,j=function(t){if(1===M.length&&void 0===t.tokenType.PUSH_MODE){var e=g.config.errorMessageProvider.buildUnableToPopLexerModeMessage(t);N.push({offset:t.startOffset,line:t.startLine,column:t.startColumn,length:t.image.length,message:e})}else{M.pop();var r=(0,Ye.default)(M);k=g.patternIdxToConfig[r],C=g.charCodeToPatternIdxToConfig[r],L=k.length;var n=g.canModeBeOptimized[r]&&!1===g.config.safeMode;m=C&&n?U:D}};function B(t){M.push(t),C=this.charCodeToPatternIdxToConfig[t],k=this.patternIdxToConfig[t],L=k.length,L=k.length;var e=this.canModeBeOptimized[t]&&!1===this.config.safeMode;m=C&&e?U:D}B.call(this,e);for(var G=this.config.recoveryEnabled;Os.length){s=i,u=c,F=H;break}}}break}}if(null!==s){if(l=s.length,void 0!==(f=F.group)&&(p=F.tokenTypeIdx,d=this.createTokenInstance(s,O,p,F.tokenType,I,S,l),this.handlePayload(d,u),!1===f?_=this.addToken(A,_,d):b[f].push(d)),t=this.chopInput(t,l),O+=l,S=this.computeNewColumn(S,l),!0===x&&!0===F.canLineTerminator){var q=0,J=void 0,Z=void 0;P.lastIndex=0;do{!0===(J=P.test(s))&&(Z=P.lastIndex-1,q++)}while(!0===J);0!==q&&(I+=q,S=l-Z,this.updateTokenEndLineColumnLocation(d,f,Z,q,I,S,l))}this.handleModes(F,j,B,d)}else{for(var $=O,Q=I,tt=S,et=!1===G;!1===et&&O"))+i}},Object.freeze(Fr.defaultParserErrorProvider),Fr.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(t,e){return"Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+"<-\ninside top level rule: ->"+t.name+"<-"}},Fr.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(t,e){var r,n=t.name,o=(0,Br.default)(e),i=o.idx,a=(0,x.getProductionDslName)(o),s=(r=o)instanceof x.Terminal?r.terminalType.name:r instanceof x.NonTerminal?r.nonTerminalName:"",u=i>0,c="->".concat(a).concat(u?i:"","<- ").concat(s?"with argument: ->".concat(s,"<-"):"","\n appears more than once (").concat(e.length," times) in the top level rule: ->").concat(n,"<-. \n For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES \n ");return c=(c=c.replace(/[ \t]+/g," ")).replace(/\s\s+/g,"\n")},buildNamespaceConflictError:function(t){return"Namespace conflict found in grammar.\n"+"The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <".concat(t.name,">.\n")+"To resolve this make sure each Terminal and Non-Terminal names are unique\nThis is easy to accomplish by using the convention that Terminal names start with an uppercase letter\nand Non-Terminal names start with a lower case letter."},buildAlternationPrefixAmbiguityError:function(t){var e=(0,Gr.default)(t.prefixPath,(function(t){return(0,Ot.tokenLabel)(t)})).join(", "),r=0===t.alternation.idx?"":t.alternation.idx;return"Ambiguous alternatives: <".concat(t.ambiguityIndices.join(" ,"),"> due to common lookahead prefix\n")+"in inside <").concat(t.topLevelRule.name,"> Rule,\n")+"<".concat(e,"> may appears as a prefix path in all these alternatives.\n")+"See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX\nFor Further details."},buildAlternationAmbiguityError:function(t){var e=(0,Gr.default)(t.prefixPath,(function(t){return(0,Ot.tokenLabel)(t)})).join(", "),r=0===t.alternation.idx?"":t.alternation.idx,n="Ambiguous Alternatives Detected: <".concat(t.ambiguityIndices.join(" ,"),"> in ")+" inside <".concat(t.topLevelRule.name,"> Rule,\n")+"<".concat(e,"> may appears as a prefix path in all these alternatives.\n");return n+="See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES\nFor Further details."},buildEmptyRepetitionError:function(t){var e=(0,x.getProductionDslName)(t.repetition);return 0!==t.repetition.idx&&(e+=t.repetition.idx),"The repetition <".concat(e,"> within Rule <").concat(t.topLevelRule.name,"> can never consume any tokens.\n")+"This could lead to an infinite loop."},buildTokenNameError:function(t){return"deprecated"},buildEmptyAlternationError:function(t){return"Ambiguous empty alternative: <".concat(t.emptyChoiceIdx+1,">")+" in inside <").concat(t.topLevelRule.name,"> Rule.\n")+"Only the last alternative may be an empty alternative."},buildTooManyAlternativesError:function(t){return"An Alternation cannot have more than 256 alternatives:\n"+" inside <").concat(t.topLevelRule.name,"> Rule.\n has ").concat(t.alternation.definition.length+1," alternatives.")},buildLeftRecursionError:function(t){var e=t.topLevelRule.name,r=(0,Gr.default)(t.leftRecursionPath,(function(t){return t.name})),n="".concat(e," --\x3e ").concat(r.concat([e]).join(" --\x3e "));return"Left Recursion found in grammar.\n"+"rule: <".concat(e,"> can be invoked from itself (directly or indirectly)\n")+"without consuming any Tokens. The grammar path that causes this is: \n ".concat(n,"\n")+" To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_factoring."},buildInvalidRuleNameError:function(t){return"deprecated"},buildDuplicateRuleNameError:function(t){var e;return e=t.topLevelRule instanceof x.Rule?t.topLevelRule.name:t.topLevelRule,"Duplicate definition, rule: ->".concat(e,"<- is already defined in the grammar: ->").concat(t.grammarName,"<-")}};var zr={},Vr=zr&&zr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(zr,"__esModule",{value:!0}),zr.validateGrammar=zr.resolveGrammar=void 0;var Kr=Vr(n("4OAgB")),Yr=Vr(n("4Kej7")),Hr={},Xr=Hr&&Hr.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),qr=Hr&&Hr.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.GastRefResolverVisitor=Hr.resolveGrammar=void 0;var Jr=qr(n("4OAgB")),Zr=qr(n("4eHM6"));Hr.resolveGrammar=function(t,e){var r=new $r(t,e);return r.resolveRefs(),r.errors};var $r=function(t){function e(e,r){var n=t.call(this)||this;return n.nameToTopRule=e,n.errMsgProvider=r,n.errors=[],n}return Xr(e,t),e.prototype.resolveRefs=function(){var t=this;(0,Jr.default)((0,Zr.default)(this.nameToTopRule),(function(e){t.currTopLevel=e,e.accept(t)}))},e.prototype.visitNonTerminal=function(t){var e=this.nameToTopRule[t.nonTerminalName];if(e)t.referencedRule=e;else{var r=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,t);this.errors.push({message:r,type:c.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}},e}(x.GAstVisitor);Hr.GastRefResolverVisitor=$r;var Qr={},tn=Qr&&Qr.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),en=Qr&&Qr.__assign||function(){return en=Object.assign||function(t){for(var e,r=1,n=arguments.length;r=0;S--){var b={idx:h,def:m.definition[S].definition.concat((0,Dn.default)(d)),ruleStack:v,occurrenceStack:y};f.push(b),f.push(a)}else if(m instanceof x.Alternative)f.push({idx:h,def:m.definition.concat((0,Dn.default)(d)),ruleStack:v,occurrenceStack:y});else{if(!(m instanceof x.Rule))throw Error("non exhaustive match");f.push(qn(m,h,v,y))}}}else s&&(0,Un.default)(f).idx<=c&&f.pop()}return l},(Hn=Yn=Tn.PROD_TYPE||(Tn.PROD_TYPE={}))[Hn.OPTION=0]="OPTION",Hn[Hn.REPETITION=1]="REPETITION",Hn[Hn.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",Hn[Hn.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",Hn[Hn.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",Hn[Hn.ALTERNATION=5]="ALTERNATION",Tn.getProdType=Jn,Tn.getLookaheadPaths=function(t){var e=t.occurrence,r=t.rule,n=t.prodType,o=t.maxLookahead,i=Jn(n);return i===Yn.ALTERNATION?no(e,r,o):oo(e,r,i,o)},Tn.buildLookaheadFuncForOr=function(t,e,r,n,o,i){var a=no(t,e,r);return i(a,n,ao(a)?rr.tokenStructuredMatcherNoCategories:rr.tokenStructuredMatcher,o)},Tn.buildLookaheadFuncForOptionalProd=function(t,e,r,n,o,i){var a=oo(t,e,o,r),s=ao(a)?rr.tokenStructuredMatcherNoCategories:rr.tokenStructuredMatcher;return i(a[0],s,n)},Tn.buildAlternativesLookAheadFunc=function(t,e,r,n){var o=t.length,i=(0,Nn.default)(t,(function(t){return(0,Nn.default)(t,(function(t){return 1===t.length}))}));if(e)return function(e){for(var n=(0,In.default)(e,(function(t){return t.GATE})),i=0;i1})),a=(0,fn.default)((0,yn.default)(i),(function(r){var n=(0,nn.default)(r),o=e.buildDuplicateFoundError(t,r),i=(0,x.getProductionDslName)(n),a={message:o,type:c.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:i,occurrence:n.idx},s=lo(n);return s&&(a.parameter=s),a}));return a}(t,r)})),i=function(t,e,r){var n=[],o=(0,fn.default)(e,(function(t){return t.name}));return(0,pn.default)(t,(function(t){var e=t.name;if((0,mn.default)(o,e)){var i=r.buildNamespaceConflictError(t);n.push({message:i,type:c.ParserDefinitionErrorType.CONFLICT_TOKENS_RULES_NAMESPACE,ruleName:e})}})),n}(t,e,r),a=(0,gn.default)(t,(function(t){return mo(t,r)})),s=(0,gn.default)(t,(function(e){return po(e,t,n,r)}));return o.concat(i,a,s)},Qr.identifyProductionForDuplicates=co;var fo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.allProductions=[],e}return tn(e,t),e.prototype.visitNonTerminal=function(t){this.allProductions.push(t)},e.prototype.visitOption=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e.prototype.visitAlternation=function(t){this.allProductions.push(t)},e.prototype.visitTerminal=function(t){this.allProductions.push(t)},e}(x.GAstVisitor);function po(t,e,r,n){var o=[];if((0,hn.default)(e,(function(e,r){return r.name===t.name?e+1:e}),0)>1){var i=n.buildDuplicateRuleNameError({topLevelRule:t,grammarName:r});o.push({message:i,type:c.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:t.name})}return o}function ho(t){var e=[];if((0,on.default)(t))return e;var r=(0,nn.default)(t);if(r instanceof x.NonTerminal)e.push(r.referencedRule);else if(r instanceof x.Alternative||r instanceof x.Option||r instanceof x.RepetitionMandatory||r instanceof x.RepetitionMandatoryWithSeparator||r instanceof x.RepetitionWithSeparator||r instanceof x.Repetition)e=e.concat(ho(r.definition));else if(r instanceof x.Alternation)e=(0,sn.default)((0,fn.default)(r.definition,(function(t){return ho(t.definition)})));else if(!(r instanceof x.Terminal))throw Error("non exhaustive match");var n=(0,x.isOptionalProd)(r),o=t.length>1;if(n&&o){var i=(0,an.default)(t);return e.concat(ho(i))}return e}Qr.OccurrenceValidationCollector=fo,Qr.validateRuleDoesNotAlreadyExist=po,Qr.validateRuleIsOverridden=function(t,e,r){var n,o=[];return(0,mn.default)(e,t)||(n="Invalid rule override, rule: ->".concat(t,"<- cannot be overridden in the grammar: ->").concat(r,"<-")+"as it is not defined in any of the super grammars ",o.push({message:n,type:c.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:t})),o},Qr.validateNoLeftRecursion=function t(e,r,n,o){void 0===o&&(o=[]);var i=[],a=ho(r.definition);if((0,on.default)(a))return[];var s=e.name;(0,mn.default)(a,e)&&i.push({message:n.buildLeftRecursionError({topLevelRule:e,leftRecursionPath:o}),type:c.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:s});var u=(0,ln.default)(a,o.concat([e])),l=(0,gn.default)(u,(function(r){var i=(0,En.default)(o);return i.push(r),t(e,r,n,i)}));return i.concat(l)},Qr.getFirstNoneTerminal=ho;var vo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.alternations=[],e}return tn(e,t),e.prototype.visitAlternation=function(t){this.alternations.push(t)},e}(x.GAstVisitor);Qr.validateEmptyOrAlternative=function(t,e){var r=new vo;t.accept(r);var n=r.alternations;return(0,gn.default)(n,(function(r){var n=(0,so.default)(r.definition);return(0,gn.default)(n,(function(n,o){var i=(0,Pn.nextPossibleTokensAfter)([n],[],rr.tokenStructuredMatcher,1);return(0,on.default)(i)?[{message:e.buildEmptyAlternationError({topLevelRule:t,alternation:r,emptyChoiceIdx:o}),type:c.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:r.idx,alternative:o+1}]:[]}))}))},Qr.validateAmbiguousAlternationAlternatives=function(t,e,r){var n=new vo;t.accept(n);var o=n.alternations;return o=(0,cn.default)(o,(function(t){return!0===t.ignoreAmbiguities})),(0,gn.default)(o,(function(n){var o=n.idx,i=n.maxLookahead||e,a=(0,Tn.getLookaheadPathsForOr)(o,t,i,n),s=function(t,e,r,n){var o=[],i=(0,hn.default)(t,(function(r,n,i){return!0===e.definition[i].ignoreAmbiguities||(0,pn.default)(n,(function(n){var a=[i];(0,pn.default)(t,(function(t,r){i!==r&&(0,Tn.containsPath)(t,n)&&!0!==e.definition[r].ignoreAmbiguities&&a.push(r)})),a.length>1&&!(0,Tn.containsPath)(o,n)&&(o.push(n),r.push({alts:a,path:n}))})),r}),[]),a=(0,fn.default)(i,(function(t){var o=(0,fn.default)(t.alts,(function(t){return t+1}));return{message:n.buildAlternationAmbiguityError({topLevelRule:r,alternation:e,ambiguityIndices:o,prefixPath:t.path}),type:c.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:r.name,occurrence:e.idx,alternatives:t.alts}}));return a}(a,n,t,r),u=go(a,n,t,r);return s.concat(u)}))};var yo=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.allProductions=[],e}return tn(e,t),e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e}(x.GAstVisitor);function mo(t,e){var r=new vo;t.accept(r);var n=r.alternations;return(0,gn.default)(n,(function(r){return r.definition.length>255?[{message:e.buildTooManyAlternativesError({topLevelRule:t,alternation:r}),type:c.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:t.name,occurrence:r.idx}]:[]}))}function go(t,e,r,n){var o=(0,hn.default)(t,(function(t,e,r){var n=(0,fn.default)(e,(function(t){return{idx:r,path:t}}));return t.concat(n)}),[]);return(0,uo.default)((0,gn.default)(o,(function(t){if(!0===e.definition[t.idx].ignoreAmbiguities)return[];var i=t.idx,a=t.path,s=(0,un.default)(o,(function(t){return!0!==e.definition[t.idx].ignoreAmbiguities&&t.idx on ").concat(t.constructor.name," CST Visitor."),type:bi.MISSING_METHOD,methodName:e}}));return(0,Ei.default)(n)}Si.defineNameProp=function(t,e){Object.defineProperty(t,"name",{enumerable:!1,configurable:!0,writable:!1,value:e})},yi.defaultVisit=Pi,yi.createBaseSemanticVisitorConstructor=function(t,e){var r=function(){};return(0,Si.defineNameProp)(r,t+"BaseSemantics"),(r.prototype={visit:function(t,e){if((0,Ti.default)(t)&&(t=t[0]),!(0,Ii.default)(t))return this[t.name](t.children,e)},validateVisitor:function(){var t=Li(this,e);if(!(0,gi.default)(t)){var r=(0,Oi.default)(t,(function(t){return t.msg}));throw Error("Errors Detected in CST Visitor <".concat(this.constructor.name,">:\n\t")+"".concat(r.join("\n\n").replace(/\n/g,"\n\t")))}}}).constructor=r,r._RULE_NAMES=e,r},yi.createBaseVisitorConstructorWithDefaults=function(t,e,r){var n=function(){};(0,Si.defineNameProp)(n,t+"BaseSemanticsWithDefaults");var o=Object.create(r.prototype);return(0,_i.default)(e,(function(t){o[t]=Pi})),(n.prototype=o).constructor=n,n},(xi=bi=yi.CstVisitorDefinitionError||(yi.CstVisitorDefinitionError={}))[xi.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",xi[xi.MISSING_METHOD=1]="MISSING_METHOD",yi.validateVisitor=Li,yi.validateMissingCstMethods=ki;var Ci=function(){function t(){}return t.prototype.initTreeBuilder=function(t){if(this.CST_STACK=[],this.outputCst=t.outputCst,this.nodeLocationTracking=(0,di.default)(t,"nodeLocationTracking")?t.nodeLocationTracking:c.DEFAULT_PARSER_CONFIG.nodeLocationTracking,this.outputCst)if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=fi.setNodeLocationFull,this.setNodeLocationFromNode=fi.setNodeLocationFull,this.cstPostRule=pi.default,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=pi.default,this.setNodeLocationFromNode=pi.default,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=fi.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=fi.setNodeLocationOnlyOffset,this.cstPostRule=pi.default,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=pi.default,this.setNodeLocationFromNode=pi.default,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else{if(!/none/i.test(this.nodeLocationTracking))throw Error('Invalid config option: "'.concat(t.nodeLocationTracking,'"'));this.setNodeLocationFromToken=pi.default,this.setNodeLocationFromNode=pi.default,this.cstPostRule=pi.default,this.setInitialNodeLocation=pi.default}else this.cstInvocationStateUpdate=pi.default,this.cstFinallyStateUpdate=pi.default,this.cstPostTerminal=pi.default,this.cstPostNonTerminal=pi.default,this.cstPostRule=pi.default},t.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(t){t.location={startOffset:NaN,endOffset:NaN}},t.prototype.setInitialNodeLocationOnlyOffsetRegular=function(t){t.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},t.prototype.setInitialNodeLocationFullRecovery=function(t){t.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},t.prototype.setInitialNodeLocationFullRegular=function(t){var e=this.LA(1);t.location={startOffset:e.startOffset,startLine:e.startLine,startColumn:e.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},t.prototype.cstInvocationStateUpdate=function(t){var e={name:t,children:Object.create(null)};this.setInitialNodeLocation(e),this.CST_STACK.push(e)},t.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},t.prototype.cstPostRuleFull=function(t){var e=this.LA(0),r=t.location;r.startOffset<=e.startOffset==!0?(r.endOffset=e.endOffset,r.endLine=e.endLine,r.endColumn=e.endColumn):(r.startOffset=NaN,r.startLine=NaN,r.startColumn=NaN)},t.prototype.cstPostRuleOnlyOffset=function(t){var e=this.LA(0),r=t.location;r.startOffset<=e.startOffset==!0?r.endOffset=e.endOffset:r.startOffset=NaN},t.prototype.cstPostTerminal=function(t,e){var r=this.CST_STACK[this.CST_STACK.length-1];(0,fi.addTerminalToCst)(r,e,t),this.setNodeLocationFromToken(r.location,e)},t.prototype.cstPostNonTerminal=function(t,e){var r=this.CST_STACK[this.CST_STACK.length-1];(0,fi.addNoneTerminalToCst)(r,e,t),this.setNodeLocationFromNode(r.location,t.location)},t.prototype.getBaseCstVisitorConstructor=function(){if((0,vi.default)(this.baseCstVisitorConstructor)){var t=(0,yi.createBaseSemanticVisitorConstructor)(this.className,(0,hi.default)(this.gastProductionsCache));return this.baseCstVisitorConstructor=t,t}return this.baseCstVisitorConstructor},t.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,vi.default)(this.baseCstVisitorWithDefaultsConstructor)){var t=(0,yi.createBaseVisitorConstructorWithDefaults)(this.className,(0,hi.default)(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=t,t}return this.baseCstVisitorWithDefaultsConstructor},t.prototype.getLastExplicitRuleShortName=function(){var t=this.RULE_STACK;return t[t.length-1]},t.prototype.getPreviousExplicitRuleShortName=function(){var t=this.RULE_STACK;return t[t.length-2]},t.prototype.getLastExplicitRuleOccurrenceIndex=function(){var t=this.RULE_OCCURRENCE_STACK;return t[t.length-1]},t}();ci.TreeBuilder=Ci;var Mi={};Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.LexerAdapter=void 0;var wi=function(){function t(){}return t.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(t.prototype,"input",{get:function(){return this.tokVector},set:function(t){if(!0!==this.selfAnalysisDone)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=t,this.tokVectorLength=t.length},enumerable:!1,configurable:!0}),t.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):c.END_OF_FILE},t.prototype.LA=function(t){var e=this.currIdx+t;return e<0||this.tokVectorLength<=e?c.END_OF_FILE:this.tokVector[e]},t.prototype.consumeToken=function(){this.currIdx++},t.prototype.exportLexerState=function(){return this.currIdx},t.prototype.importLexerState=function(t){this.currIdx=t},t.prototype.resetLexerState=function(){this.currIdx=-1},t.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},t.prototype.getLexerPosition=function(){return this.exportLexerState()},t}();Mi.LexerAdapter=wi;var Di={},Ui=Di&&Di.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Di,"__esModule",{value:!0}),Di.RecognizerApi=void 0;var Fi=Ui(n("4eHM6")),ji=Ui(n("3CODa")),Bi=function(){function t(){}return t.prototype.ACTION=function(t){return t.call(this)},t.prototype.consume=function(t,e,r){return this.consumeInternal(e,t,r)},t.prototype.subrule=function(t,e,r){return this.subruleInternal(e,t,r)},t.prototype.option=function(t,e){return this.optionInternal(e,t)},t.prototype.or=function(t,e){return this.orInternal(e,t)},t.prototype.many=function(t,e){return this.manyInternal(t,e)},t.prototype.atLeastOne=function(t,e){return this.atLeastOneInternal(t,e)},t.prototype.CONSUME=function(t,e){return this.consumeInternal(t,0,e)},t.prototype.CONSUME1=function(t,e){return this.consumeInternal(t,1,e)},t.prototype.CONSUME2=function(t,e){return this.consumeInternal(t,2,e)},t.prototype.CONSUME3=function(t,e){return this.consumeInternal(t,3,e)},t.prototype.CONSUME4=function(t,e){return this.consumeInternal(t,4,e)},t.prototype.CONSUME5=function(t,e){return this.consumeInternal(t,5,e)},t.prototype.CONSUME6=function(t,e){return this.consumeInternal(t,6,e)},t.prototype.CONSUME7=function(t,e){return this.consumeInternal(t,7,e)},t.prototype.CONSUME8=function(t,e){return this.consumeInternal(t,8,e)},t.prototype.CONSUME9=function(t,e){return this.consumeInternal(t,9,e)},t.prototype.SUBRULE=function(t,e){return this.subruleInternal(t,0,e)},t.prototype.SUBRULE1=function(t,e){return this.subruleInternal(t,1,e)},t.prototype.SUBRULE2=function(t,e){return this.subruleInternal(t,2,e)},t.prototype.SUBRULE3=function(t,e){return this.subruleInternal(t,3,e)},t.prototype.SUBRULE4=function(t,e){return this.subruleInternal(t,4,e)},t.prototype.SUBRULE5=function(t,e){return this.subruleInternal(t,5,e)},t.prototype.SUBRULE6=function(t,e){return this.subruleInternal(t,6,e)},t.prototype.SUBRULE7=function(t,e){return this.subruleInternal(t,7,e)},t.prototype.SUBRULE8=function(t,e){return this.subruleInternal(t,8,e)},t.prototype.SUBRULE9=function(t,e){return this.subruleInternal(t,9,e)},t.prototype.OPTION=function(t){return this.optionInternal(t,0)},t.prototype.OPTION1=function(t){return this.optionInternal(t,1)},t.prototype.OPTION2=function(t){return this.optionInternal(t,2)},t.prototype.OPTION3=function(t){return this.optionInternal(t,3)},t.prototype.OPTION4=function(t){return this.optionInternal(t,4)},t.prototype.OPTION5=function(t){return this.optionInternal(t,5)},t.prototype.OPTION6=function(t){return this.optionInternal(t,6)},t.prototype.OPTION7=function(t){return this.optionInternal(t,7)},t.prototype.OPTION8=function(t){return this.optionInternal(t,8)},t.prototype.OPTION9=function(t){return this.optionInternal(t,9)},t.prototype.OR=function(t){return this.orInternal(t,0)},t.prototype.OR1=function(t){return this.orInternal(t,1)},t.prototype.OR2=function(t){return this.orInternal(t,2)},t.prototype.OR3=function(t){return this.orInternal(t,3)},t.prototype.OR4=function(t){return this.orInternal(t,4)},t.prototype.OR5=function(t){return this.orInternal(t,5)},t.prototype.OR6=function(t){return this.orInternal(t,6)},t.prototype.OR7=function(t){return this.orInternal(t,7)},t.prototype.OR8=function(t){return this.orInternal(t,8)},t.prototype.OR9=function(t){return this.orInternal(t,9)},t.prototype.MANY=function(t){this.manyInternal(0,t)},t.prototype.MANY1=function(t){this.manyInternal(1,t)},t.prototype.MANY2=function(t){this.manyInternal(2,t)},t.prototype.MANY3=function(t){this.manyInternal(3,t)},t.prototype.MANY4=function(t){this.manyInternal(4,t)},t.prototype.MANY5=function(t){this.manyInternal(5,t)},t.prototype.MANY6=function(t){this.manyInternal(6,t)},t.prototype.MANY7=function(t){this.manyInternal(7,t)},t.prototype.MANY8=function(t){this.manyInternal(8,t)},t.prototype.MANY9=function(t){this.manyInternal(9,t)},t.prototype.MANY_SEP=function(t){this.manySepFirstInternal(0,t)},t.prototype.MANY_SEP1=function(t){this.manySepFirstInternal(1,t)},t.prototype.MANY_SEP2=function(t){this.manySepFirstInternal(2,t)},t.prototype.MANY_SEP3=function(t){this.manySepFirstInternal(3,t)},t.prototype.MANY_SEP4=function(t){this.manySepFirstInternal(4,t)},t.prototype.MANY_SEP5=function(t){this.manySepFirstInternal(5,t)},t.prototype.MANY_SEP6=function(t){this.manySepFirstInternal(6,t)},t.prototype.MANY_SEP7=function(t){this.manySepFirstInternal(7,t)},t.prototype.MANY_SEP8=function(t){this.manySepFirstInternal(8,t)},t.prototype.MANY_SEP9=function(t){this.manySepFirstInternal(9,t)},t.prototype.AT_LEAST_ONE=function(t){this.atLeastOneInternal(0,t)},t.prototype.AT_LEAST_ONE1=function(t){return this.atLeastOneInternal(1,t)},t.prototype.AT_LEAST_ONE2=function(t){this.atLeastOneInternal(2,t)},t.prototype.AT_LEAST_ONE3=function(t){this.atLeastOneInternal(3,t)},t.prototype.AT_LEAST_ONE4=function(t){this.atLeastOneInternal(4,t)},t.prototype.AT_LEAST_ONE5=function(t){this.atLeastOneInternal(5,t)},t.prototype.AT_LEAST_ONE6=function(t){this.atLeastOneInternal(6,t)},t.prototype.AT_LEAST_ONE7=function(t){this.atLeastOneInternal(7,t)},t.prototype.AT_LEAST_ONE8=function(t){this.atLeastOneInternal(8,t)},t.prototype.AT_LEAST_ONE9=function(t){this.atLeastOneInternal(9,t)},t.prototype.AT_LEAST_ONE_SEP=function(t){this.atLeastOneSepFirstInternal(0,t)},t.prototype.AT_LEAST_ONE_SEP1=function(t){this.atLeastOneSepFirstInternal(1,t)},t.prototype.AT_LEAST_ONE_SEP2=function(t){this.atLeastOneSepFirstInternal(2,t)},t.prototype.AT_LEAST_ONE_SEP3=function(t){this.atLeastOneSepFirstInternal(3,t)},t.prototype.AT_LEAST_ONE_SEP4=function(t){this.atLeastOneSepFirstInternal(4,t)},t.prototype.AT_LEAST_ONE_SEP5=function(t){this.atLeastOneSepFirstInternal(5,t)},t.prototype.AT_LEAST_ONE_SEP6=function(t){this.atLeastOneSepFirstInternal(6,t)},t.prototype.AT_LEAST_ONE_SEP7=function(t){this.atLeastOneSepFirstInternal(7,t)},t.prototype.AT_LEAST_ONE_SEP8=function(t){this.atLeastOneSepFirstInternal(8,t)},t.prototype.AT_LEAST_ONE_SEP9=function(t){this.atLeastOneSepFirstInternal(9,t)},t.prototype.RULE=function(t,e,r){if(void 0===r&&(r=c.DEFAULT_RULE_CONFIG),(0,ji.default)(this.definedRulesNames,t)){var n={message:Fr.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:t,grammarName:this.className}),type:c.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:t};this.definitionErrors.push(n)}this.definedRulesNames.push(t);var o=this.defineRule(t,e,r);return this[t]=o,o},t.prototype.OVERRIDE_RULE=function(t,e,r){void 0===r&&(r=c.DEFAULT_RULE_CONFIG);var n=(0,Qr.validateRuleIsOverridden)(t,this.definedRulesNames,this.className);this.definitionErrors=this.definitionErrors.concat(n);var o=this.defineRule(t,e,r);return this[t]=o,o},t.prototype.BACKTRACK=function(t,e){return function(){this.isBackTrackingStack.push(1);var r=this.saveRecogState();try{return t.apply(this,e),!0}catch(t){if((0,Po.isRecognitionException)(t))return!1;throw t}finally{this.reloadRecogState(r),this.isBackTrackingStack.pop()}}},t.prototype.getGAstProductions=function(){return this.gastProductionsCache},t.prototype.getSerializedGastProductions=function(){return(0,x.serializeGrammar)((0,Fi.default)(this.gastProductionsCache))},t}();Di.RecognizerApi=Bi;var Gi={},Wi=Gi&&Gi.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.RecognizerEngine=void 0;var zi=Wi(n("aRz3z")),Vi=Wi(n("3SybD")),Ki=Wi(n("eNvXX")),Yi=Wi(n("a89ul")),Hi=Wi(n("iRkuP")),Xi=Wi(n("li2L8")),qi=Wi(n("6mWlg")),Ji=Wi(n("4eHM6")),Zi=Wi(n("lIKAq")),$i=Wi(n("aKVMx")),Qi=function(){function t(){}return t.prototype.initRecognizerEngine=function(t,e){if(this.className=this.constructor.name,this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=rr.tokenStructuredMatcherNoCategories,this.subruleIdx=0,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,qi.default)(e,"serializedGrammar"))throw Error("The Parser's configuration can no longer contain a property.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0\n\tFor Further details.");if((0,Vi.default)(t)){if((0,zi.default)(t))throw Error("A Token Vocabulary cannot be empty.\n\tNote that the first argument for the parser constructor\n\tis no longer a Token vector (since v4.0).");if("number"==typeof t[0].startOffset)throw Error("The Parser constructor no longer accepts a token vector as the first argument.\n\tSee: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0\n\tFor Further details.")}if((0,Vi.default)(t))this.tokensMap=(0,Zi.default)(t,(function(t,e){return t[e.name]=e,t}),{});else if((0,qi.default)(t,"modes")&&(0,Yi.default)((0,Ki.default)((0,Ji.default)(t.modes)),rr.isTokenType)){var r=(0,Ki.default)((0,Ji.default)(t.modes)),n=(0,Hi.default)(r);this.tokensMap=(0,Zi.default)(n,(function(t,e){return t[e.name]=e,t}),{})}else{if(!(0,Xi.default)(t))throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap=(0,$i.default)(t)}this.tokensMap.EOF=Ot.EOF;var o=(0,qi.default)(t,"modes")?(0,Ki.default)((0,Ji.default)(t.modes)):(0,Ji.default)(t),i=(0,Yi.default)(o,(function(t){return(0,zi.default)(t.categoryMatches)}));this.tokenMatcher=i?rr.tokenStructuredMatcherNoCategories:rr.tokenStructuredMatcher,(0,rr.augmentTokenTypes)((0,Ji.default)(this.tokensMap))},t.prototype.defineRule=function(t,e,r){if(this.selfAnalysisDone)throw Error("Grammar rule <".concat(t,"> may not be defined after the 'performSelfAnalysis' method has been called'\n")+"Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.");var n,o=(0,qi.default)(r,"resyncEnabled")?r.resyncEnabled:c.DEFAULT_RULE_CONFIG.resyncEnabled,i=(0,qi.default)(r,"recoveryValueFunc")?r.recoveryValueFunc:c.DEFAULT_RULE_CONFIG.recoveryValueFunc,a=this.ruleShortNameIdx<<$o.BITS_FOR_METHOD_TYPE+$o.BITS_FOR_OCCURRENCE_IDX;return this.ruleShortNameIdx++,this.shortRuleNameToFull[a]=t,this.fullRuleNameToShort[t]=a,n=!0===this.outputCst?function(){for(var r=[],n=0;ne},t.prototype.orInternal=function(t,e){var r=this.getKeyForAutomaticLookahead($o.OR_IDX,e),n=(0,Vi.default)(t)?t:t.DEF,o=this.getLaFuncFromCache(r).call(this,n);if(void 0!==o)return n[o].ALT.call(this);this.raiseNoAltException(e,t.ERR_MSG)},t.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),0===this.RULE_STACK.length&&!1===this.isAtEndOfInput()){var t=this.LA(1),e=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:t,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new Po.NotAllInputParsedException(e,t))}},t.prototype.subruleInternal=function(t,e,r){var n;try{var o=void 0!==r?r.ARGS:void 0;return this.subruleIdx=e,n=t.apply(this,o),this.cstPostNonTerminal(n,void 0!==r&&void 0!==r.LABEL?r.LABEL:t.ruleName),n}catch(e){throw this.subruleInternalError(e,r,t.ruleName)}},t.prototype.subruleInternalError=function(t,e,r){throw(0,Po.isRecognitionException)(t)&&void 0!==t.partialCstResult&&(this.cstPostNonTerminal(t.partialCstResult,void 0!==e&&void 0!==e.LABEL?e.LABEL:r),delete t.partialCstResult),t},t.prototype.consumeInternal=function(t,e,r){var n;try{var o=this.LA(1);!0===this.tokenMatcher(o,t)?(this.consumeToken(),n=o):this.consumeInternalError(t,o,r)}catch(r){n=this.consumeInternalRecovery(t,e,r)}return this.cstPostTerminal(void 0!==r&&void 0!==r.LABEL?r.LABEL:t.name,n),n},t.prototype.consumeInternalError=function(t,e,r){var n,o=this.LA(0);throw n=void 0!==r&&r.ERR_MSG?r.ERR_MSG:this.errorMessageProvider.buildMismatchTokenMessage({expected:t,actual:e,previous:o,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new Po.MismatchedTokenException(n,e,o))},t.prototype.consumeInternalRecovery=function(t,e,r){if(!this.recoveryEnabled||"MismatchedTokenException"!==r.name||this.isBackTracking())throw r;var n=this.getFollowsForInRuleRecovery(t,e);try{return this.tryInRuleRecovery(t,n)}catch(t){throw t.name===Eo.IN_RULE_RECOVERY_EXCEPTION?r:t}},t.prototype.saveRecogState=function(){var t=this.errors,e=(0,$i.default)(this.RULE_STACK);return{errors:t,lexerState:this.exportLexerState(),RULE_STACK:e,CST_STACK:this.CST_STACK}},t.prototype.reloadRecogState=function(t){this.errors=t.errors,this.importLexerState(t.lexerState),this.RULE_STACK=t.RULE_STACK},t.prototype.ruleInvocationStateUpdate=function(t,e,r){this.RULE_OCCURRENCE_STACK.push(r),this.RULE_STACK.push(t),this.cstInvocationStateUpdate(e)},t.prototype.isBackTracking=function(){return 0!==this.isBackTrackingStack.length},t.prototype.getCurrRuleFullName=function(){var t=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[t]},t.prototype.shortRuleNameToFullName=function(t){return this.shortRuleNameToFull[t]},t.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),Ot.EOF)},t.prototype.reset=function(){this.resetLexerState(),this.subruleIdx=0,this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},t}();Gi.RecognizerEngine=Qi;var ta={},ea=ta&&ta.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ta,"__esModule",{value:!0}),ta.ErrorHandler=void 0;var ra=ea(n("6mWlg")),na=ea(n("aKVMx")),oa=function(){function t(){}return t.prototype.initErrorHandler=function(t){this._errors=[],this.errorMessageProvider=(0,ra.default)(t,"errorMessageProvider")?t.errorMessageProvider:c.DEFAULT_PARSER_CONFIG.errorMessageProvider},t.prototype.SAVE_ERROR=function(t){if((0,Po.isRecognitionException)(t))return t.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,na.default)(this.RULE_OCCURRENCE_STACK)},this._errors.push(t),t;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(t.prototype,"errors",{get:function(){return(0,na.default)(this._errors)},set:function(t){this._errors=t},enumerable:!1,configurable:!0}),t.prototype.raiseEarlyExitException=function(t,e,r){for(var n=this.getCurrRuleFullName(),o=this.getGAstProductions()[n],i=(0,Tn.getLookaheadPathsForOptionalProd)(t,o,e,this.maxLookahead)[0],a=[],s=1;s<=this.maxLookahead;s++)a.push(this.LA(s));var u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:i,actual:a,previous:this.LA(0),customUserDescription:r,ruleName:n});throw this.SAVE_ERROR(new Po.EarlyExitException(u,this.LA(1),this.LA(0)))},t.prototype.raiseNoAltException=function(t,e){for(var r=this.getCurrRuleFullName(),n=this.getGAstProductions()[r],o=(0,Tn.getLookaheadPathsForOr)(t,n,this.maxLookahead),i=[],a=1;a<=this.maxLookahead;a++)i.push(this.LA(a));var s=this.LA(0),u=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:o,actual:i,previous:s,customUserDescription:e,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new Po.NoViableAltException(u,this.LA(1),s))},t}();ta.ErrorHandler=oa;var ia={},aa=ia&&ia.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ia,"__esModule",{value:!0}),ia.ContentAssist=void 0;var sa=aa(n("3TjNg")),ua=aa(n("iWFaD")),ca=function(){function t(){}return t.prototype.initContentAssist=function(){},t.prototype.computeContentAssist=function(t,e){var r=this.gastProductionsCache[t];if((0,ua.default)(r))throw Error("Rule ->".concat(t,"<- does not exist in this grammar."));return(0,Pn.nextPossibleTokensAfter)([r],e,this.tokenMatcher,this.maxLookahead)},t.prototype.getNextPossibleTokenTypes=function(t){var e=(0,sa.default)(t.ruleStack),r=this.getGAstProductions()[e];return new Pn.NextAfterTokenWalker(r,t).startWalking()},t}();ia.ContentAssist=ca;var la={},fa=la&&la.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(la,"__esModule",{value:!0}),la.GastRecorder=void 0;var pa=fa(n("fcJe6")),da=fa(n("3SybD")),ha=fa(n("4rTPm")),va=fa(n("4OAgB")),ya=fa(n("7kzWE")),ma=fa(n("6mWlg")),ga={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(ga);var Ea=Math.pow(2,$o.BITS_FOR_OCCURRENCE_IDX)-1,Ta=(0,Ot.createToken)({name:"RECORDING_PHASE_TOKEN",pattern:It.Lexer.NA});(0,rr.augmentTokenTypes)([Ta]);var Oa=(0,Ot.createTokenInstance)(Ta,"This IToken indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",-1,-1,-1,-1,-1,-1);Object.freeze(Oa);var _a={name:"This CSTNode indicates the Parser is in Recording Phase\n\tSee: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details",children:{}},Ra=function(){function t(){}return t.prototype.initGastRecorder=function(t){this.recordingProdStack=[],this.RECORDING_PHASE=!1},t.prototype.enableRecording=function(){var t=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",(function(){for(var e=function(e){var r=e>0?e:"";t["CONSUME".concat(r)]=function(t,r){return this.consumeInternalRecord(t,e,r)},t["SUBRULE".concat(r)]=function(t,r){return this.subruleInternalRecord(t,e,r)},t["OPTION".concat(r)]=function(t){return this.optionInternalRecord(t,e)},t["OR".concat(r)]=function(t){return this.orInternalRecord(t,e)},t["MANY".concat(r)]=function(t){this.manyInternalRecord(e,t)},t["MANY_SEP".concat(r)]=function(t){this.manySepFirstInternalRecord(e,t)},t["AT_LEAST_ONE".concat(r)]=function(t){this.atLeastOneInternalRecord(e,t)},t["AT_LEAST_ONE_SEP".concat(r)]=function(t){this.atLeastOneSepFirstInternalRecord(e,t)}},r=0;r<10;r++)e(r);t.consume=function(t,e,r){return this.consumeInternalRecord(e,t,r)},t.subrule=function(t,e,r){return this.subruleInternalRecord(e,t,r)},t.option=function(t,e){return this.optionInternalRecord(e,t)},t.or=function(t,e){return this.orInternalRecord(e,t)},t.many=function(t,e){this.manyInternalRecord(t,e)},t.atLeastOne=function(t,e){this.atLeastOneInternalRecord(t,e)},t.ACTION=t.ACTION_RECORD,t.BACKTRACK=t.BACKTRACK_RECORD,t.LA=t.LA_RECORD}))},t.prototype.disableRecording=function(){var t=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",(function(){for(var e=t,r=0;r<10;r++){var n=r>0?r:"";delete e["CONSUME".concat(n)],delete e["SUBRULE".concat(n)],delete e["OPTION".concat(n)],delete e["OR".concat(n)],delete e["MANY".concat(n)],delete e["MANY_SEP".concat(n)],delete e["AT_LEAST_ONE".concat(n)],delete e["AT_LEAST_ONE_SEP".concat(n)]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA}))},t.prototype.ACTION_RECORD=function(t){},t.prototype.BACKTRACK_RECORD=function(t,e){return function(){return!0}},t.prototype.LA_RECORD=function(t){return c.END_OF_FILE},t.prototype.topLevelRuleRecord=function(t,e){try{var r=new x.Rule({definition:[],name:t});return r.name=t,this.recordingProdStack.push(r),e.call(this),this.recordingProdStack.pop(),r}catch(t){if(!0!==t.KNOWN_RECORDER_ERROR)try{t.message=t.message+'\n\t This error was thrown during the "grammar recording phase" For more info see:\n\thttps://chevrotain.io/docs/guide/internals.html#grammar-recording'}catch(e){throw t}throw t}},t.prototype.optionInternalRecord=function(t,e){return Aa.call(this,x.Option,t,e)},t.prototype.atLeastOneInternalRecord=function(t,e){Aa.call(this,x.RepetitionMandatory,e,t)},t.prototype.atLeastOneSepFirstInternalRecord=function(t,e){Aa.call(this,x.RepetitionMandatoryWithSeparator,e,t,true)},t.prototype.manyInternalRecord=function(t,e){Aa.call(this,x.Repetition,e,t)},t.prototype.manySepFirstInternalRecord=function(t,e){Aa.call(this,x.RepetitionWithSeparator,e,t,true)},t.prototype.orInternalRecord=function(t,e){return Na.call(this,t,e)},t.prototype.subruleInternalRecord=function(t,e,r){if(Sa(e),!t||!1===(0,ma.default)(t,"ruleName")){var n=new Error(" argument is invalid")+" expecting a Parser method reference but got: <".concat(JSON.stringify(t),">")+"\n inside top level rule: <".concat(this.recordingProdStack[0].name,">"));throw n.KNOWN_RECORDER_ERROR=!0,n}var o=(0,pa.default)(this.recordingProdStack),i=t.ruleName,a=new x.NonTerminal({idx:e,nonTerminalName:i,label:null==r?void 0:r.LABEL,referencedRule:void 0});return o.definition.push(a),this.outputCst?_a:ga},t.prototype.consumeInternalRecord=function(t,e,r){if(Sa(e),!(0,rr.hasShortKeyProperty)(t)){var n=new Error(" argument is invalid")+" expecting a TokenType reference but got: <".concat(JSON.stringify(t),">")+"\n inside top level rule: <".concat(this.recordingProdStack[0].name,">"));throw n.KNOWN_RECORDER_ERROR=!0,n}var o=(0,pa.default)(this.recordingProdStack),i=new x.Terminal({idx:e,terminalType:t,label:null==r?void 0:r.LABEL});return o.definition.push(i),Oa},t}();function Aa(t,e,r,n){void 0===n&&(n=!1),Sa(r);var o=(0,pa.default)(this.recordingProdStack),i=(0,ya.default)(e)?e:e.DEF,a=new t({definition:[],idx:r});return n&&(a.separator=e.SEP),(0,ma.default)(e,"MAX_LOOKAHEAD")&&(a.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(a),i.call(this),o.definition.push(a),this.recordingProdStack.pop(),ga}function Na(t,e){var r=this;Sa(e);var n=(0,pa.default)(this.recordingProdStack),o=!1===(0,da.default)(t),i=!1===o?t:t.DEF,a=new x.Alternation({definition:[],idx:e,ignoreAmbiguities:o&&!0===t.IGNORE_AMBIGUITIES});(0,ma.default)(t,"MAX_LOOKAHEAD")&&(a.maxLookahead=t.MAX_LOOKAHEAD);var s=(0,ha.default)(i,(function(t){return(0,ya.default)(t.GATE)}));return a.hasPredicates=s,n.definition.push(a),(0,va.default)(i,(function(t){var e=new x.Alternative({definition:[]});a.definition.push(e),(0,ma.default)(t,"IGNORE_AMBIGUITIES")?e.ignoreAmbiguities=t.IGNORE_AMBIGUITIES:(0,ma.default)(t,"GATE")&&(e.ignoreAmbiguities=!0),r.recordingProdStack.push(e),t.ALT.call(r),r.recordingProdStack.pop()})),ga}function Ia(t){return 0===t?"":"".concat(t)}function Sa(t){if(t<0||t>Ea){var e=new Error("Invalid DSL Method idx value: <".concat(t,">\n\t")+"Idx value must be a none negative value smaller than ".concat(Ea+1));throw e.KNOWN_RECORDER_ERROR=!0,e}}la.GastRecorder=Ra;var ba={},xa=ba&&ba.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ba,"__esModule",{value:!0}),ba.PerformanceTracer=void 0;var Pa=xa(n("6mWlg")),La=function(){function t(){}return t.prototype.initPerformanceTracer=function(t){if((0,Pa.default)(t,"traceInitPerf")){var e=t.traceInitPerf,r="number"==typeof e;this.traceInitMaxIdent=r?e:1/0,this.traceInitPerf=r?e>0:e}else this.traceInitMaxIdent=0,this.traceInitPerf=c.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},t.prototype.TRACE_INIT=function(t,e){if(!0===this.traceInitPerf){this.traceInitIndent++;var r=new Array(this.traceInitIndent+1).join("\t");this.traceInitIndent"));var n=(0,g.timer)(e),o=n.time,i=n.value,a=o>10?console.warn:console.log;return this.traceInitIndent time: ").concat(o,"ms")),this.traceInitIndent--,i}return e()},t}();ba.PerformanceTracer=La;var ka,Ca={};Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.applyMixins=void 0,Ca.applyMixins=function(t,e){e.forEach((function(e){var r=e.prototype;Object.getOwnPropertyNames(r).forEach((function(n){if("constructor"!==n){var o=Object.getOwnPropertyDescriptor(r,n);o&&(o.get||o.set)?Object.defineProperty(t.prototype,n,o):t.prototype[n]=e.prototype[n]}}))}))},c.END_OF_FILE=(0,Ot.createTokenInstance)(Ot.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN),Object.freeze(c.END_OF_FILE),c.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:Fr.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1}),c.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0}),(ka=c.ParserDefinitionErrorType||(c.ParserDefinitionErrorType={}))[ka.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",ka[ka.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",ka[ka.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",ka[ka.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",ka[ka.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",ka[ka.LEFT_RECURSION=5]="LEFT_RECURSION",ka[ka.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",ka[ka.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",ka[ka.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",ka[ka.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",ka[ka.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",ka[ka.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",ka[ka.TOO_MANY_ALTS=12]="TOO_MANY_ALTS",ka[ka.CUSTOM_LOOKAHEAD_VALIDATION=13]="CUSTOM_LOOKAHEAD_VALIDATION",c.EMPTY_ALT=function(t){return void 0===t&&(t=void 0),function(){return t}};var Ma=function(){function t(t,e){this.definitionErrors=[],this.selfAnalysisDone=!1;var r=this;if(r.initErrorHandler(e),r.initLexerAdapter(),r.initLooksAhead(e),r.initRecognizerEngine(t,e),r.initRecoverable(e),r.initTreeBuilder(e),r.initContentAssist(),r.initGastRecorder(e),r.initPerformanceTracer(e),(0,y.default)(e,"ignoredIssues"))throw new Error("The IParserConfig property has been deprecated.\n\tPlease use the flag on the relevant DSL method instead.\n\tSee: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES\n\tFor further details.");this.skipValidations=(0,y.default)(e,"skipValidations")?e.skipValidations:c.DEFAULT_PARSER_CONFIG.skipValidations}return t.performSelfAnalysis=function(t){throw Error("The **static** `performSelfAnalysis` method has been deprecated.\t\nUse the **instance** method with the same name instead.")},t.prototype.performSelfAnalysis=function(){var e=this;this.TRACE_INIT("performSelfAnalysis",(function(){var r;e.selfAnalysisDone=!0;var n=e.className;e.TRACE_INIT("toFastProps",(function(){(0,g.toFastProperties)(e)})),e.TRACE_INIT("Grammar Recording",(function(){try{e.enableRecording(),(0,h.default)(e.definedRulesNames,(function(t){var r,n=e[t].originalGrammarAction;e.TRACE_INIT("".concat(t," Rule"),(function(){r=e.topLevelRuleRecord(t,n)})),e.gastProductionsCache[t]=r}))}finally{e.disableRecording()}}));var o=[];if(e.TRACE_INIT("Grammar Resolving",(function(){o=(0,zr.resolveGrammar)({rules:(0,v.default)(e.gastProductionsCache)}),e.definitionErrors=e.definitionErrors.concat(o)})),e.TRACE_INIT("Grammar Validations",(function(){if((0,p.default)(o)&&!1===e.skipValidations){var t=(0,zr.validateGrammar)({rules:(0,v.default)(e.gastProductionsCache),tokenTypes:(0,v.default)(e.tokensMap),errMsgProvider:Fr.defaultGrammarValidatorErrorProvider,grammarName:n}),r=(0,Qr.validateLookahead)({lookaheadStrategy:e.lookaheadStrategy,rules:(0,v.default)(e.gastProductionsCache),tokenTypes:(0,v.default)(e.tokensMap),grammarName:n});e.definitionErrors=e.definitionErrors.concat(t,r)}})),(0,p.default)(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT("computeAllProdsFollows",(function(){var t=(0,_.computeAllProdsFollows)((0,v.default)(e.gastProductionsCache));e.resyncFollows=t})),e.TRACE_INIT("ComputeLookaheadFunctions",(function(){var t,r;null===(r=(t=e.lookaheadStrategy).initialize)||void 0===r||r.call(t,{rules:(0,v.default)(e.gastProductionsCache)}),e.preComputeLookaheadFunctions((0,v.default)(e.gastProductionsCache))}))),!t.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,p.default)(e.definitionErrors))throw r=(0,d.default)(e.definitionErrors,(function(t){return t.message})),new Error("Parser Definition Errors detected:\n ".concat(r.join("\n-------------------------------\n")))}))},t.DEFER_DEFINITION_ERRORS_HANDLING=!1,t}();c.Parser=Ma,(0,Ca.applyMixins)(Ma,[Eo.Recoverable,Ho.LooksAhead,ci.TreeBuilder,Mi.LexerAdapter,Gi.RecognizerEngine,Di.RecognizerApi,ta.ErrorHandler,ia.ContentAssist,la.GastRecorder,ba.PerformanceTracer]);var wa=function(t){function e(e,r){void 0===r&&(r=c.DEFAULT_PARSER_CONFIG);var n=(0,m.default)(r);return n.outputCst=!0,t.call(this,e,n)||this}return l(e,t),e}(Ma);c.CstParser=wa;var Da=function(t){function e(e,r){void 0===r&&(r=c.DEFAULT_PARSER_CONFIG);var n=(0,m.default)(r);return n.outputCst=!1,t.call(this,e,n)||this}return l(e,t),e}(Ma);c.EmbeddedActionsParser=Da,Object.defineProperty(a,"CstParser",{enumerable:!0,get:function(){return c.CstParser}}),Object.defineProperty(a,"EmbeddedActionsParser",{enumerable:!0,get:function(){return c.EmbeddedActionsParser}}),Object.defineProperty(a,"ParserDefinitionErrorType",{enumerable:!0,get:function(){return c.ParserDefinitionErrorType}}),Object.defineProperty(a,"EMPTY_ALT",{enumerable:!0,get:function(){return c.EMPTY_ALT}}),Object.defineProperty(a,"Lexer",{enumerable:!0,get:function(){return It.Lexer}}),Object.defineProperty(a,"LexerDefinitionErrorType",{enumerable:!0,get:function(){return It.LexerDefinitionErrorType}}),Object.defineProperty(a,"createToken",{enumerable:!0,get:function(){return Ot.createToken}}),Object.defineProperty(a,"createTokenInstance",{enumerable:!0,get:function(){return Ot.createTokenInstance}}),Object.defineProperty(a,"EOF",{enumerable:!0,get:function(){return Ot.EOF}}),Object.defineProperty(a,"tokenLabel",{enumerable:!0,get:function(){return Ot.tokenLabel}}),Object.defineProperty(a,"tokenMatcher",{enumerable:!0,get:function(){return Ot.tokenMatcher}}),Object.defineProperty(a,"tokenName",{enumerable:!0,get:function(){return Ot.tokenName}}),Object.defineProperty(a,"getLookaheadPaths",{enumerable:!0,get:function(){return Tn.getLookaheadPaths}}),Object.defineProperty(a,"LLkLookaheadStrategy",{enumerable:!0,get:function(){return Qo.LLkLookaheadStrategy}}),Object.defineProperty(a,"defaultParserErrorProvider",{enumerable:!0,get:function(){return Fr.defaultParserErrorProvider}}),Object.defineProperty(a,"EarlyExitException",{enumerable:!0,get:function(){return Po.EarlyExitException}}),Object.defineProperty(a,"isRecognitionException",{enumerable:!0,get:function(){return Po.isRecognitionException}}),Object.defineProperty(a,"MismatchedTokenException",{enumerable:!0,get:function(){return Po.MismatchedTokenException}}),Object.defineProperty(a,"NotAllInputParsedException",{enumerable:!0,get:function(){return Po.NotAllInputParsedException}}),Object.defineProperty(a,"NoViableAltException",{enumerable:!0,get:function(){return Po.NoViableAltException}}),Object.defineProperty(a,"defaultLexerErrorProvider",{enumerable:!0,get:function(){return Ar.defaultLexerErrorProvider}}),Object.defineProperty(a,"Alternation",{enumerable:!0,get:function(){return x.Alternation}}),Object.defineProperty(a,"Alternative",{enumerable:!0,get:function(){return x.Alternative}}),Object.defineProperty(a,"NonTerminal",{enumerable:!0,get:function(){return x.NonTerminal}}),Object.defineProperty(a,"Option",{enumerable:!0,get:function(){return x.Option}}),Object.defineProperty(a,"Repetition",{enumerable:!0,get:function(){return x.Repetition}}),Object.defineProperty(a,"RepetitionMandatory",{enumerable:!0,get:function(){return x.RepetitionMandatory}}),Object.defineProperty(a,"RepetitionMandatoryWithSeparator",{enumerable:!0,get:function(){return x.RepetitionMandatoryWithSeparator}}),Object.defineProperty(a,"RepetitionWithSeparator",{enumerable:!0,get:function(){return x.RepetitionWithSeparator}}),Object.defineProperty(a,"Rule",{enumerable:!0,get:function(){return x.Rule}}),Object.defineProperty(a,"Terminal",{enumerable:!0,get:function(){return x.Terminal}}),Object.defineProperty(a,"serializeGrammar",{enumerable:!0,get:function(){return x.serializeGrammar}}),Object.defineProperty(a,"serializeProduction",{enumerable:!0,get:function(){return x.serializeProduction}}),Object.defineProperty(a,"GAstVisitor",{enumerable:!0,get:function(){return x.GAstVisitor}});var Ua={},Fa=Ua&&Ua.__assign||function(){return Fa=Object.assign||function(t){for(var e,r=1,n=arguments.length;r1&&(n=(0,Wa.default)(t,(function(t){return t.type}))),{name:e,type:n,optional:r}}));return{name:t.name,properties:n}},e.prototype.visitAlternative=function(t){return this.visitEachAndOverrideWith(t.definition,{canBeNull:!0})},e.prototype.visitOption=function(t){return this.visitEachAndOverrideWith(t.definition,{canBeNull:!0})},e.prototype.visitRepetition=function(t){return this.visitEachAndOverrideWith(t.definition,{canBeNull:!0})},e.prototype.visitRepetitionMandatory=function(t){return this.visitEach(t.definition)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){return this.visitEach(t.definition).concat({propertyName:t.separator.name,canBeNull:!0,type:qa(t.separator)})},e.prototype.visitRepetitionWithSeparator=function(t){return this.visitEachAndOverrideWith(t.definition,{canBeNull:!0}).concat({propertyName:t.separator.name,canBeNull:!0,type:qa(t.separator)})},e.prototype.visitAlternation=function(t){return this.visitEachAndOverrideWith(t.definition,{canBeNull:!0})},e.prototype.visitTerminal=function(t){return[{propertyName:t.label||t.terminalType.name,canBeNull:!1,type:qa(t)}]},e.prototype.visitNonTerminal=function(t){return[{propertyName:t.label||t.nonTerminalName,canBeNull:!1,type:qa(t)}]},e.prototype.visitEachAndOverrideWith=function(t,e){return(0,Wa.default)(this.visitEach(t),(function(t){return(0,Ha.default)({},t,e)}))},e.prototype.visitEach=function(t){var e=this;return(0,za.default)((0,Wa.default)(t,(function(t){return e.visit(t)})))},e}(x.GAstVisitor);function qa(t){return t instanceof x.NonTerminal?{kind:"rule",name:t.referencedRule.name}:{kind:"token"}}var Ja={},Za=Ja&&Ja.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.genDts=void 0;var $a=Za(n("eNvXX")),Qa=Za(n("3SybD")),ts=Za(n("fW6i0")),es=Za(n("lIKAq")),rs=Za(n("iRkuP")),ns=Za(n("hAHQr"));function os(t){return"token"===t.kind?"IToken":is(t.name)}function is(t){return(0,ns.default)(t)+"CstNode"}function as(t){return(0,ns.default)(t)+"CstChildren"}Ja.genDts=function(t,e){var r,n,o=[];return o=(o=o.concat('import type { CstNode, ICstVisitor, IToken } from "chevrotain";')).concat((0,$a.default)((0,ts.default)(t,(function(t){return function(t){var e=function(t){var e=is(t.name),r=as(t.name);return"export interface ".concat(e,' extends CstNode {\n name: "').concat(t.name,'";\n children: ').concat(r,";\n}")}(t),r=function(t){var e=as(t.name);return"export type ".concat(e," = {\n ").concat((0,ts.default)(t.properties,(function(t){return function(t){var e=function(t){if((0,Qa.default)(t)){var e=(0,rs.default)((0,ts.default)(t,(function(t){return os(t)})));return"("+(0,es.default)(e,(function(t,e){return t+" | "+e}))+")"}return os(t)}(t.type);return"".concat(t.name).concat(t.optional?"?":"",": ").concat(e,"[];")}(t)})).join("\n "),"\n};")}(t);return[e,r]}(t)})))),e.includeVisitorInterface&&(o=o.concat((r=e.visitorInterfaceName,n=t,"export interface ".concat(r," extends ICstVisitor {\n ").concat((0,ts.default)(n,(function(t){return function(t){var e=as(t.name);return"".concat(t.name,"(children: ").concat(e,", param?: IN): OUT;")}(t)})).join("\n "),"\n}")))),o.join("\n\n")+"\n"};var ss={includeVisitorInterface:!0,visitorInterfaceName:"ICstNodeVisitor"};Ua.generateCstDts=function(t,e){var r=Fa(Fa({},ss),e),n=(0,ja.buildModel)(t);return(0,Ja.genDts)(n,r)},Object.defineProperty(a,"generateCstDts",{enumerable:!0,get:function(){return Ua.generateCstDts}}),a.clearCache=function(){console.warn("The clearCache function was 'soft' removed from the Chevrotain API.\n\t It performs no action other than printing this message.\n\t Please avoid using it as it will be completely removed in the future")};var us={};Object.defineProperty(us,"__esModule",{value:!0}),us.createSyntaxDiagramsCode=void 0,us.createSyntaxDiagramsCode=function(t,e){var r=void 0===e?{}:e,n=r.resourceBase,o=void 0===n?"https://unpkg.com/chevrotain@".concat(s.VERSION,"/diagrams/"):n,i=r.css,a=void 0===i?"https://unpkg.com/chevrotain@".concat(s.VERSION,"/diagrams/diagrams.css"):i;return'\n\x3c!-- This is a generated file --\x3e\n\n\n\n\n'+"\n\n")+"\n\n\n\n\n"); + var diagramsDiv = '\n
\n'; + var serializedGrammar = "\n\n"); + var initLogic = '\n\n'; + return header + cssHtml + scripts + diagramsDiv + serializedGrammar + initLogic; +} +exports.createSyntaxDiagramsCode = createSyntaxDiagramsCode; + +},{"4a4c7df27ae65c8":"8z9me"}],"l28QN":[function(require,module,exports) { +const { Lexer , createToken } = require("7e6c88b3ba0f8991"); +const tokens = {}; +const addToken = (name, options)=>{ + tokens[name] = createToken({ + name, + ...options + }); +}; +// we want to have labels started with z/c/t or with "add"/"sub"/... prefixes, but "Cond"/"InstructionXXX" tokens +// would be matched first, to prevent that we need to use "longer_alt" option to prefer longer tokens +const labelToken = createToken({ + name: "Label", + pattern: /[a-z]\w*/ +}); +addToken("NewLine", { + pattern: /\r?\n/ +}); +addToken("Colon", { + pattern: ":" +}); +addToken("LBracket", { + pattern: "(" +}); +addToken("RBracket", { + pattern: ")" +}); +addToken("Comma", { + pattern: "," +}); +addToken("Comment", { + pattern: /(?:#|(?:\/\/))[^\n\r]*/, + group: Lexer.SKIPPED +}); +addToken("WhiteSpace", { + pattern: /[^\S\r\n]+/, + group: Lexer.SKIPPED +}); +addToken("KeywordLocationShort", { + pattern: /__location/ +}); +addToken("KeywordRomBank", { + pattern: /__rom_bank/ +}); +const instructions = [ + "nop", + "rdm", + "rd0", + "rd1", + "rd2", + "rd3", + "rdr", + "wrm", + "wr0", + "wr1", + "wr2", + "wr3", + "wrr", + "wmp", + "adm", + "sbm", + "clb", + "clc", + "cmc", + "stc", + "cma", + "iac", + "dac", + "ral", + "rar", + "tcc", + "daa", + "tcs", + "kbp", + "dcl", + "ldm", + "ld", + "xch", + "add", + "sub", + "inc", + "bbl", + "jin", + "src", + "fin", + "jun", + "jms", + "jcn", + "isz", + "fim", + "wpm", + "hlt", + "bbs", + "lcr", + "or4", + "or5", + "an6", + "an7", + "db0", + "db1", + "sb0", + "sb1", + "ein", + "din", + "rpm" +]; +for (const instruction of instructions)addToken(`Instruction${instruction.toUpperCase()}`, { + pattern: new RegExp(instruction), + longer_alt: labelToken +}); +addToken("Register", { + pattern: /rr(?:(?:1[0-5])|(?:0?\d))/ +}); +addToken("RegisterPair", { + pattern: /r[0-7]/ +}); +addToken("Cond", { + pattern: /n?(?:(?:zct)|(?:zc)|(?:zt)|(?:ct)|z|c|t)/, + longer_alt: labelToken +}); +// ROM address format is 00:0xFF, two parts - page number and address inside page +// page number: [0..9] OR [10..15] +// address inside page [100..199] OR [200..249] OR [250..255] OR [0x00..0xFF] OR [00..99] +addToken("ROMAddress", { + pattern: /(?:(?:0?\d)|(?:1[0-5])|(?:0x0?[0-9a-f])):(?:(?:[01]\d\d)|(?:2[0-4]\d)|(?:25[0-5])|(?:0x[0-9a-f]{1,2})|(?:\d{1,2}))/ +}); +// Imm is 12-bit maximum, so it could accept 0x000..0xFFF and 0..4095 ranges +// [1000..3999] OR [4000..4089] OR [4090..4095] OR [0x000..0xFFF] OR [000..999] +addToken("Imm", { + pattern: /(?:[0-3]\d\d\d)|(?:40[0-8]\d)|(?:409[0-5])|(?:0x[0-9a-f]{1,3})|(?:\d{1,3})/ +}); +// important to define label name after keywords, because lexer tries to match first rule from array +// and it could match label first because patterns of instruction names and labels are intersected +tokens.Label = labelToken; +module.exports = { + allTokens: Object.values(tokens), + Tokens: tokens +}; + +},{"7e6c88b3ba0f8991":"jW6vA"}],"huio0":[function(require,module,exports) { +const { EmbeddedActionsParser , MismatchedTokenException } = require("4fa5d48349a25d5"); +const { Tokens , allTokens } = require("6ede4b8ff8845065"); +const { CodeGenerator , AddrType } = require("f4a235fe92387edf"); +class AsmParser extends EmbeddedActionsParser { + throwMismatchError(message, token, previousToken) { + const errToThrow = new MismatchedTokenException(message, token, previousToken); + throw this.SAVE_ERROR(errToThrow); + } + constructor(){ + super(allTokens, { + outputCst: false + }); + const $ = this; + const codeGenerator = new CodeGenerator(); + this.codeGenerator = codeGenerator; + $.RULE("program", ()=>{ + $.AT_LEAST_ONE_SEP({ + SEP: Tokens.NewLine, + DEF: ()=>$.SUBRULE($.instructionWithLabel) + }); + try { + // we expect that program rule should cover whole source code + if (this.isAtEndOfInput()) return codeGenerator.generate(); + } catch (err) { + throw $.SAVE_ERROR(new MismatchedTokenException(err.toString())); + } + return null; + }); + $.RULE("instructionWithLabel", ()=>{ + $.OPTION1(()=>$.SUBRULE($.keyword)); + $.OPTION2(()=>$.SUBRULE($.label)); + $.OPTION3(()=>$.SUBRULE($.instruction)); + }); + $.RULE("keyword", ()=>{ + $.OR([ + { + ALT: ()=>$.SUBRULE($.keywordLocationShort) + }, + { + ALT: ()=>$.SUBRULE($.keywordRomBank) + } + ]); + }); + $.RULE("keywordLocationShort", ()=>{ + $.CONSUME(Tokens.KeywordLocationShort); + $.CONSUME(Tokens.LBracket); + const address = $.CONSUME(Tokens.ROMAddress); + $.CONSUME(Tokens.RBracket); + $.ACTION(()=>{ + codeGenerator.addFixedLocation(address.image); + }); + }); + $.RULE("keywordRomBank", ()=>{ + $.CONSUME(Tokens.KeywordRomBank); + $.CONSUME(Tokens.LBracket); + const bankNo = $.CONSUME(Tokens.Imm); + $.CONSUME(Tokens.RBracket); + $.ACTION(()=>{ + codeGenerator.setBankNumber(bankNo.image); + }); + }); + $.RULE("label", ()=>{ + const labelToken = $.CONSUME(Tokens.Label); + $.CONSUME(Tokens.Colon); + $.ACTION(()=>{ + if (!codeGenerator.addLabel(labelToken.image)) throw $.SAVE_ERROR(new MismatchedTokenException("Duplicated definition for label", labelToken)); + }); + }); + $.RULE("instruction", ()=>{ + $.OR([ + { + ALT: ()=>$.SUBRULE($.instructionWithoutArg) + }, + { + ALT: ()=>$.SUBRULE($.instructionWithReg) + }, + { + ALT: ()=>$.SUBRULE($.instructionWithRegPair) + }, + { + ALT: ()=>$.SUBRULE($.instructionWithImm4) + }, + { + ALT: ()=>$.SUBRULE($.instructionFIM) + }, + { + ALT: ()=>$.SUBRULE($.instructionWithFarAddr) + }, + { + ALT: ()=>$.SUBRULE($.instructionISZ) + }, + { + ALT: ()=>$.SUBRULE($.instructionJCN) + } + ]); + }); + $.RULE("instructionWithoutArg", ()=>{ + const instruction = $.OR([ + { + ALT: ()=>$.CONSUME(Tokens.InstructionNOP) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionRDM) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionRD0) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionRD1) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionRD2) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionRD3) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionRDR) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionWRM) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionWR0) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionWR1) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionWR2) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionWR3) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionWRR) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionWMP) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionWPM) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionADM) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionSBM) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionCLB) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionCLC) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionCMC) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionSTC) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionCMA) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionIAC) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionDAC) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionRAL) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionRAR) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionTCC) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionDAA) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionTCS) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionKBP) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionDCL) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionHLT) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionBBS) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionLCR) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionOR4) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionOR5) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionAN6) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionAN7) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionDB0) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionDB1) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionSB0) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionSB1) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionEIN) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionDIN) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionRPM) + } + ]); + $.ACTION(()=>{ + codeGenerator.pushInstructionWithoutArg(instruction.image, instruction.startLine); + }); + }); + $.RULE("instructionWithReg", ()=>{ + const instruction = $.OR([ + { + ALT: ()=>$.CONSUME(Tokens.InstructionLD) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionXCH) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionADD) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionSUB) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionINC) + } + ]); + const reg = $.CONSUME(Tokens.Register); + $.ACTION(()=>{ + codeGenerator.pushInstructionWithReg(instruction.image, reg.image, instruction.startLine); + }); + }); + $.RULE("instructionWithRegPair", ()=>{ + const instruction = $.OR([ + { + ALT: ()=>$.CONSUME(Tokens.InstructionJIN) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionSRC) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionFIN) + } + ]); + const regPair = $.CONSUME(Tokens.RegisterPair); + $.ACTION(()=>{ + codeGenerator.pushInstructionWithRegPair(instruction.image, regPair.image, instruction.startLine); + }); + }); + $.RULE("instructionWithImm4", ()=>{ + const instruction = $.OR([ + { + ALT: ()=>$.CONSUME(Tokens.InstructionBBL) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionLDM) + } + ]); + const imm = $.CONSUME(Tokens.Imm); + $.ACTION(()=>{ + try { + codeGenerator.pushInstructionWithImm4(instruction.image, imm.image, instruction.startLine); + } catch (err) { + throw $.SAVE_ERROR(new MismatchedTokenException(err.toString(), imm, instruction)); + } + }); + }); + $.RULE("instructionFIM", ()=>{ + const { image: instruction , startLine } = $.CONSUME(Tokens.InstructionFIM); + const { image: regPair } = $.CONSUME(Tokens.RegisterPair); + const prevToken = $.CONSUME(Tokens.Comma); + const { image: imm } = $.CONSUME(Tokens.Imm); + $.ACTION(()=>{ + try { + codeGenerator.pushInstructionWithRegPairAndImm8(instruction, regPair, imm, startLine); + } catch (err) { + throw $.SAVE_ERROR(new MismatchedTokenException(err.toString(), imm, prevToken)); + } + }); + }); + $.RULE("address", ()=>$.OR([ + { + ALT: ()=>({ + token: $.CONSUME(Tokens.Label), + type: AddrType.Label + }) + }, + { + ALT: ()=>({ + token: $.CONSUME(Tokens.Imm), + type: AddrType.FlatAddress + }) + }, + { + ALT: ()=>({ + token: $.CONSUME(Tokens.ROMAddress), + type: AddrType.ROMAddress + }) + } + ])); + $.RULE("instructionWithFarAddr", ()=>{ + const instruction = $.OR([ + { + ALT: ()=>$.CONSUME(Tokens.InstructionJUN) + }, + { + ALT: ()=>$.CONSUME(Tokens.InstructionJMS) + } + ]); + const { token: addr , type } = $.SUBRULE($.address); + $.ACTION(()=>{ + codeGenerator.instructionWithFarAddr(instruction.image, addr.image, type, instruction.startLine); + }); + }); + $.RULE("instructionISZ", ()=>{ + const instruction = $.CONSUME(Tokens.InstructionISZ); + const reg = $.CONSUME(Tokens.Register); + $.CONSUME(Tokens.Comma); + const { token: addr , type } = $.SUBRULE($.address); + $.ACTION(()=>{ + try { + codeGenerator.pushISZInstruction(instruction.image, reg.image, addr.image, type, instruction.startLine); + } catch (err) { + throw $.SAVE_ERROR(new MismatchedTokenException(err.toString(), addr, reg)); + } + }); + }); + $.RULE("instructionJCN", ()=>{ + const instruction = $.CONSUME(Tokens.InstructionJCN); + const cond = $.CONSUME(Tokens.Cond); + $.CONSUME(Tokens.Comma); + const { token: addr , type } = $.SUBRULE($.address); + $.ACTION(()=>{ + try { + codeGenerator.pushJCNInstruction(instruction.image, cond.image, addr.image, type, instruction.startLine); + } catch (err) { + $.throwMismatchError(err.toString(), addr, cond); + } + }); + }); + $.performSelfAnalysis(); + } + parse(input) { + this.input = input; + this.codeGenerator.clear(); + return this.program(); + } +} +module.exports = new AsmParser([]); + +},{"4fa5d48349a25d5":"jW6vA","6ede4b8ff8845065":"l28QN","f4a235fe92387edf":"5znE0"}],"5znE0":[function(require,module,exports) { +const { INSTRUCTION_TYPES } = require("7c69e66c6b968629"); +const { assemblyInstruction } = require("99a678b3b99040f1"); +const AddrType = { + Label: Symbol("Label"), + FlatAddress: Symbol("FlatAddress"), + ROMAddress: Symbol("ROMAddress") +}; +class CodeGenerator { + #instructions = []; + #labelToInstructionMap = new Map(); + #referencesByLabel = []; + #fixedLocations = []; + #fixedRomBanks = []; + // process hex and decimal values + static #immToNumber(imm) { + return imm.startsWith("0x") ? parseInt(imm.substring(2), 16) : Number(imm); + } + // addr could be label name or 12-bit number (0 <= addr <= 4095) or "page:offset" string, + // where "page" is 4-bit page number and "offset" is 8-bit offset for specific page + #getAddrCode = (addr, type, instructionIdx)=>{ + switch(type){ + case AddrType.FlatAddress: + return CodeGenerator.#immToNumber(addr); + case AddrType.ROMAddress: + { + const [page, offset] = addr.split(":").map((numeric)=>CodeGenerator.#immToNumber(numeric)); + return page << 8 | offset; + } + case AddrType.Label: + this.#referencesByLabel.push({ + referencedLabel: addr, + instructionIdx + }); + return 0x0; + default: + return 0x0; + } + }; + setBankNumber(bankNoStr) { + const bankNo = CodeGenerator.#immToNumber(bankNoStr); + if (bankNo !== 0 && bankNo !== 1) throw new Error("Incorrect bank index, should be 0 or 1"); + this.#fixedRomBanks.push({ + instructionIdx: this.#instructions.length, + bankNo + }); + } + addFixedLocation(addressStr) { + const [page, offset] = addressStr.split(":").map((numeric)=>CodeGenerator.#immToNumber(numeric)); + this.#fixedLocations.push({ + instructionIdx: this.#instructions.length, + romPage: page, + romOffset: offset + }); + } + addLabel(label) { + if (this.#labelToInstructionMap.has(label)) return false; + this.#labelToInstructionMap.set(label, this.#instructions.length); + return true; + } + pushInstructionWithoutArg(instruction, line) { + this.#instructions.push({ + opcode: assemblyInstruction(instruction), + type: instruction === "hlt" ? INSTRUCTION_TYPES.Halt : INSTRUCTION_TYPES.Regular, + refInstructionIdx: null, + sourceCodeLine: line + }); + } + // reg is "rrX" string, where 0 <= X <= 15 + pushInstructionWithReg(instruction, reg, line) { + this.#instructions.push({ + opcode: assemblyInstruction(instruction, reg), + type: INSTRUCTION_TYPES.Regular, + refInstructionIdx: null, + sourceCodeLine: line + }); + } + // regPair is "rX" string, where 0 <= X <= 7 + pushInstructionWithRegPair(instruction, regPair, line) { + this.#instructions.push({ + opcode: assemblyInstruction(instruction, regPair), + type: instruction === "jin" ? INSTRUCTION_TYPES.FarJump : INSTRUCTION_TYPES.Regular, + refInstructionIdx: null, + sourceCodeLine: line + }); + } + // imm is 4-bit number, 0 <= imm <= 15 + pushInstructionWithImm4(instruction, imm, line) { + const immValue = CodeGenerator.#immToNumber(imm); + if (immValue > 0xF) throw new Error("Argument is too big, should be 0xF or less"); + this.#instructions.push({ + opcode: assemblyInstruction(instruction, immValue), + type: instruction === "bbl" ? INSTRUCTION_TYPES.Return : INSTRUCTION_TYPES.Regular, + refInstructionIdx: null, + sourceCodeLine: line + }); + } + // imm is 8-bit number, 0 <= imm <= 255, regPair is "rX" string, where 0 <= X <= 7 + pushInstructionWithRegPairAndImm8(instruction, regPair, imm, line) { + const immValue = CodeGenerator.#immToNumber(imm); + if (immValue > 0xFF) throw new Error("Argument is too big, should be 0xFF or less"); + this.#instructions.push({ + opcode: assemblyInstruction(instruction, regPair, immValue), + type: INSTRUCTION_TYPES.Regular, + refInstructionIdx: null, + sourceCodeLine: line + }); + } + instructionWithFarAddr(instruction, addr, type, line) { + const addrValue = this.#getAddrCode(addr, type, this.#instructions.length); + this.#instructions.push({ + opcode: assemblyInstruction(instruction, addrValue), + type: instruction === "jun" ? INSTRUCTION_TYPES.FarJump : INSTRUCTION_TYPES.Call, + refInstructionIdx: null, + sourceCodeLine: line + }); + } + pushISZInstruction(instruction, reg, addr, type, line) { + const addrValue = this.#getAddrCode(addr, type, this.#instructions.length); + if (addrValue > 0xFF) throw new Error("Argument is too big, should be 0xFF or less"); + this.#instructions.push({ + opcode: assemblyInstruction(instruction, reg, addrValue), + type: INSTRUCTION_TYPES.JumpConditional, + refInstructionIdx: null, + sourceCodeLine: line + }); + } + pushJCNInstruction(instruction, cond, addr, type, line) { + const addrValue = this.#getAddrCode(addr, type, this.#instructions.length); + if (addrValue > 0xFF) throw new Error("Argument is too big, should be 0xFF or less"); + this.#instructions.push({ + opcode: assemblyInstruction(instruction, cond, addrValue), + type: INSTRUCTION_TYPES.JumpConditional, + refInstructionIdx: null, + sourceCodeLine: line + }); + } + generate() { + // on this stage we have information about all labels, so we can fill all references to actual instructions + for (const { referencedLabel , instructionIdx } of this.#referencesByLabel){ + const refInstructionIdx = this.#labelToInstructionMap.get(referencedLabel); + if (refInstructionIdx === undefined) throw new Error(`Unknown label ${referencedLabel}`); + this.#instructions[instructionIdx].refInstructionIdx = refInstructionIdx; + } + return { + instructions: this.#instructions, + fixedLocations: this.#fixedLocations, + fixedRomBanks: this.#fixedRomBanks, + symbols: [ + ...this.#labelToInstructionMap.entries() + ].map(([label, instructionIdx])=>({ + label, + instructionIdx + })) + }; + } + clear() { + this.#instructions = []; + this.#labelToInstructionMap = new Map(); + this.#referencesByLabel = []; + this.#fixedLocations = []; + this.#fixedRomBanks = []; + } +} +module.exports = { + CodeGenerator, + AddrType +}; + +},{"7c69e66c6b968629":"4bLIR","99a678b3b99040f1":"hv8D2"}],"4bLIR":[function(require,module,exports) { +const INSTRUCTION_TYPES = Object.freeze({ + Regular: Symbol("INSTRUCTION_TYPES/Regular"), + JumpConditional: Symbol("INSTRUCTION_TYPES/JumpConditional"), + FarJump: Symbol("INSTRUCTION_TYPES/FarJump"), + Call: Symbol("INSTRUCTION_TYPES/Call"), + Return: Symbol("INSTRUCTION_TYPES/Return"), + Halt: Symbol("INSTRUCTION_TYPES/Halt") +}); +module.exports = { + INSTRUCTION_TYPES +}; + +},{}],"hv8D2":[function(require,module,exports) { +const OPERANDS_GROUPS = Object.freeze({ + None: Symbol("OPERANDS_GROUPS/None"), + Register: Symbol("OPERANDS_GROUPS/Register"), + RegisterPair: Symbol("OPERANDS_GROUPS/RegisterPair"), + Immediate4bit: Symbol("OPERANDS_GROUPS/Immediate4bit"), + Immediate12bit: Symbol("OPERANDS_GROUPS/Immediate12bit"), + RegisterPairAndImmediate8bit: Symbol("OPERANDS_GROUPS/RegisterPairAndImmediate8bit"), + RegisterAndImmediate8bit: Symbol("OPERANDS_GROUPS/RegisterAndImmediate8bit"), + CondAndImmediate8bit: Symbol("OPERANDS_GROUPS/CondAndImmediate8bit") +}); +const INSTRUCTIONS = new Map([ + [ + "nop", + { + opcode: 0x00, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "rdm", + { + opcode: 0xE9, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "rd0", + { + opcode: 0xEC, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "rd1", + { + opcode: 0xED, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "rd2", + { + opcode: 0xEE, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "rd3", + { + opcode: 0xEF, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "rdr", + { + opcode: 0xEA, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "wrm", + { + opcode: 0xE0, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "wr0", + { + opcode: 0xE4, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "wr1", + { + opcode: 0xE5, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "wr2", + { + opcode: 0xE6, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "wr3", + { + opcode: 0xE7, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "wrr", + { + opcode: 0xE2, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "wmp", + { + opcode: 0xE1, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "wpm", + { + opcode: 0xE3, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "adm", + { + opcode: 0xEB, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "sbm", + { + opcode: 0xE8, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "clb", + { + opcode: 0xF0, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "clc", + { + opcode: 0xF1, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "cmc", + { + opcode: 0xF3, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "stc", + { + opcode: 0xFA, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "cma", + { + opcode: 0xF4, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "iac", + { + opcode: 0xF2, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "dac", + { + opcode: 0xF8, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "ral", + { + opcode: 0xF5, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "rar", + { + opcode: 0xF6, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "tcc", + { + opcode: 0xF7, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "daa", + { + opcode: 0xFB, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "tcs", + { + opcode: 0xF9, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "kbp", + { + opcode: 0xFC, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "dcl", + { + opcode: 0xFD, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "hlt", + { + opcode: 0x01, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "bbs", + { + opcode: 0x02, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "lcr", + { + opcode: 0x03, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "or4", + { + opcode: 0x04, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "or5", + { + opcode: 0x05, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "an6", + { + opcode: 0x06, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "an7", + { + opcode: 0x07, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "db0", + { + opcode: 0x08, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "db1", + { + opcode: 0x09, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "sb0", + { + opcode: 0x0A, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "sb1", + { + opcode: 0x0B, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "ein", + { + opcode: 0x0C, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "din", + { + opcode: 0x0D, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "rpm", + { + opcode: 0x0E, + operandsGroup: OPERANDS_GROUPS.None + } + ], + [ + "ld", + { + opcode: 0xA0, + operandsGroup: OPERANDS_GROUPS.Register + } + ], + [ + "xch", + { + opcode: 0xB0, + operandsGroup: OPERANDS_GROUPS.Register + } + ], + [ + "add", + { + opcode: 0x80, + operandsGroup: OPERANDS_GROUPS.Register + } + ], + [ + "sub", + { + opcode: 0x90, + operandsGroup: OPERANDS_GROUPS.Register + } + ], + [ + "inc", + { + opcode: 0x60, + operandsGroup: OPERANDS_GROUPS.Register + } + ], + [ + "src", + { + opcode: 0x21, + operandsGroup: OPERANDS_GROUPS.RegisterPair + } + ], + [ + "fin", + { + opcode: 0x30, + operandsGroup: OPERANDS_GROUPS.RegisterPair + } + ], + [ + "jin", + { + opcode: 0x31, + operandsGroup: OPERANDS_GROUPS.RegisterPair + } + ], + [ + "bbl", + { + opcode: 0xC0, + operandsGroup: OPERANDS_GROUPS.Immediate4bit + } + ], + [ + "ldm", + { + opcode: 0xD0, + operandsGroup: OPERANDS_GROUPS.Immediate4bit + } + ], + [ + "fim", + { + opcode: 0x20, + operandsGroup: OPERANDS_GROUPS.RegisterPairAndImmediate8bit + } + ], + [ + "jms", + { + opcode: 0x50, + operandsGroup: OPERANDS_GROUPS.Immediate12bit + } + ], + [ + "jun", + { + opcode: 0x40, + operandsGroup: OPERANDS_GROUPS.Immediate12bit + } + ], + [ + "isz", + { + opcode: 0x70, + operandsGroup: OPERANDS_GROUPS.RegisterAndImmediate8bit + } + ], + [ + "jcn", + { + opcode: 0x10, + operandsGroup: OPERANDS_GROUPS.CondAndImmediate8bit + } + ] +]); +const convertRegistryToOpModifier = (reg)=>Number(reg.substring(2)); +const convertRegistryPairToOpModifier = (regPair)=>Number(regPair.substring(1)) << 1; +const convertConditionToOpModifier = (cond)=>{ + const condParts = cond.split(""); + return (condParts.includes("n") ? 8 : 0) | (condParts.includes("z") ? 4 : 0) | (condParts.includes("c") ? 2 : 0) | (condParts.includes("t") ? 1 : 0); +}; +const assemblyInstruction = (instruction, operand1, operand2)=>{ + const { opcode , operandsGroup } = INSTRUCTIONS.get(instruction); + switch(operandsGroup){ + case OPERANDS_GROUPS.None: + return [ + opcode + ]; + case OPERANDS_GROUPS.Register: + return [ + opcode | convertRegistryToOpModifier(operand1) + ]; + case OPERANDS_GROUPS.RegisterPair: + return [ + opcode | convertRegistryPairToOpModifier(operand1) + ]; + case OPERANDS_GROUPS.Immediate4bit: + return [ + opcode | operand1 + ]; + case OPERANDS_GROUPS.RegisterPairAndImmediate8bit: + return [ + opcode | convertRegistryPairToOpModifier(operand1), + operand2 + ]; + case OPERANDS_GROUPS.Immediate12bit: + return [ + opcode | operand1 >> 8, + operand1 & 0xFF + ]; + case OPERANDS_GROUPS.RegisterAndImmediate8bit: + return [ + opcode | convertRegistryToOpModifier(operand1), + operand2 + ]; + case OPERANDS_GROUPS.CondAndImmediate8bit: + return [ + opcode | convertConditionToOpModifier(operand1), + operand2 + ]; + default: + throw Error("Unknown instruction!"); + } +}; +module.exports = { + assemblyInstruction +}; + +},{}],"brtxb":[function(require,module,exports) { +const { INSTRUCTION_TYPES } = require("2690cd5d29733b40"); +const { assemblyInstruction } = require("6c5f59b23934edcb"); +/* + * Converts references from instruction indexes from flat instructions array to references to block + */ const transformRefsToBlockReferences = (blocks, block, instructionsMap)=>{ + for (const [refIdx, { addressOffset , refInstructionIdx , isShort }] of block.references.entries()){ + if (!instructionsMap[refInstructionIdx]) throw Error("Some references to labels are broken: labeled code has not been processed"); + const { blockId , instructionOffset } = instructionsMap[refInstructionIdx]; + block.references[refIdx] = { + addressOffset, + refBlockId: blockId, + refInstructionOffset: instructionOffset, + isShort + }; + if (isShort && blocks[blockId] !== block) blocks[blockId].isDependant = true; + } +}; +/* + * Extend existing block with more bytecode and references + */ const extendExistingBlock = (blocks, blockInstructionIdx, instructionsMap, bytecode, references, sourceCodeLines)=>{ + const { blockId } = instructionsMap[blockInstructionIdx]; + const block = blocks[blockId]; + block.bytecode.unshift(...bytecode); + for (const existingBlockReference of block.references)existingBlockReference.addressOffset += bytecode.length; + block.references.unshift(...references); + for (const existingBlockSourceCodeLine of block.sourceCodeLines)existingBlockSourceCodeLine.instructionOffset += bytecode.length; + block.sourceCodeLines.unshift(...sourceCodeLines); + let mergingBlockInstructionIdx = blockInstructionIdx - 1; + const mergingBlockId = instructionsMap[mergingBlockInstructionIdx].blockId; + while(instructionsMap[mergingBlockInstructionIdx]?.blockId === mergingBlockId){ + instructionsMap[mergingBlockInstructionIdx].blockId = blockId; + mergingBlockInstructionIdx--; + } + let existingBlockInstructionIdx = blockInstructionIdx; + while(instructionsMap[existingBlockInstructionIdx]?.blockId === blockId){ + instructionsMap[existingBlockInstructionIdx].instructionOffset += bytecode.length; + existingBlockInstructionIdx++; + } + return block; +}; +/* + * Forms code block for routine + */ const createCodeBlock = (blocks, firstInstructionIdx, instructions, instructionsMap, romPage, romOffset)=>{ + const blockId = blocks.length; + const bytecode = []; + const references = []; + const sourceCodeLines = []; + if (instructionsMap[firstInstructionIdx]) return { + isNew: false, + block: blocks[instructionsMap[firstInstructionIdx].blockId] + }; + for(let instructionIdx = firstInstructionIdx; instructionIdx < instructions.length; instructionIdx++){ + if (instructionsMap[instructionIdx]) { + const block = extendExistingBlock(blocks, instructionIdx, instructionsMap, bytecode, references, sourceCodeLines); + return { + isNew: false, + block + }; + } + const { type , opcode , sourceCodeLine , refInstructionIdx } = instructions[instructionIdx]; + const instructionOffset = bytecode.length; + bytecode.push(...opcode); + sourceCodeLines.push({ + instructionOffset, + line: sourceCodeLine + }); + instructionsMap[instructionIdx] = { + blockId, + instructionOffset + }; + if (refInstructionIdx !== undefined && refInstructionIdx !== null) references.push({ + addressOffset: instructionOffset + 1, + refInstructionIdx, + isShort: type === INSTRUCTION_TYPES.JumpConditional + }); + if ([ + INSTRUCTION_TYPES.FarJump, + INSTRUCTION_TYPES.Return, + INSTRUCTION_TYPES.Halt + ].includes(type)) { + const block1 = { + id: blockId, + bytecode, + sourceCodeLines, + references, + ...romPage !== undefined && { + fixedLocation: { + page: romPage, + offset: romOffset + } + } + }; + return { + isNew: true, + block: block1 + }; + } + } + throw Error("Couldn't find final instruction for code block at fixed location."); +}; +/* + * If we don't have entrypoint specified (by marking instruction with fixed location 0x00:0x00), then we need to create + * JUN instruction as entrypoint to instruction #0 from source code. + */ const createEntrypointBlock = (blocks)=>{ + const existingBlock = blocks.find(({ fixedLocation })=>fixedLocation.page === 0 && fixedLocation.offset === 0); + if (existingBlock) return; + const { block } = createCodeBlock(blocks, 0, [ + { + opcode: assemblyInstruction("jun", 0x00), + type: INSTRUCTION_TYPES.FarJump, + refInstructionIdx: 0, + sourceCodeLine: -1 + } + ], {}, 0, 0); + blocks.push(block); +}; +/* + * Return initial list of starting instructions, that could be part of new blocks + */ const getReferencedInstructionsFromFixedBlocks = (fixedBlocks, instructionsMap)=>{ + const instructionIndexes = new Set(); + for (const { references } of fixedBlocks){ + for (const { refInstructionIdx } of references)if (!instructionsMap[refInstructionIdx]) instructionIndexes.add(refInstructionIdx); + } + return [ + ...instructionIndexes + ]; +}; +const formBlocksFromInstructions = (fixedLocations, instructions, symbols, fixedRomBanks)=>{ + const blocks = []; + const instructionsMap = new Array(instructions.length); + for (const { instructionIdx , romPage , romOffset } of fixedLocations){ + const { block: fixedBlock , isNew } = createCodeBlock(blocks, instructionIdx, instructions, instructionsMap, romPage, romOffset); + if (isNew) blocks.push(fixedBlock); + } + createEntrypointBlock(blocks); + const instructionsToFormBlocks = getReferencedInstructionsFromFixedBlocks(blocks, instructionsMap); + while(instructionsToFormBlocks.length){ + const instructionIdx1 = instructionsToFormBlocks.shift(); + const { block , isNew: isNew1 } = createCodeBlock(blocks, instructionIdx1, instructions, instructionsMap); + if (isNew1) blocks.push(block); + // always need to re-scan references, because even already existing blocks could be extended + instructionsToFormBlocks.push(...block.references.map(({ refInstructionIdx })=>refInstructionIdx).filter((refInstructionIdx)=>!instructionsMap[refInstructionIdx])); + } + for (const block1 of blocks)transformRefsToBlockReferences(blocks, block1, instructionsMap); + for (const { instructionIdx: instructionIdx2 , bankNo } of fixedRomBanks)if (instructionsMap[instructionIdx2]) blocks[instructionsMap[instructionIdx2].blockId].fixedBank = bankNo; + return { + blocks, + symbols: symbols.map(({ label , instructionIdx })=>({ + label, + ...instructionsMap[instructionIdx] + })) + }; +}; +module.exports = { + formBlocksFromInstructions +}; + +},{"2690cd5d29733b40":"4bLIR","6c5f59b23934edcb":"hv8D2"}],"get6t":[function(require,module,exports) { +/* eslint-disable no-console, max-classes-per-file */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +/* + * Returns { roms: [{ data, size, sourceMap, symbols }], placementCache } + * + * Expects code blocks in format: + * { + * id, + * bytecode, + * sourceCodeLines: [{ instructionOffset, line }], + * references: [{ addressOffset, refBlockId, refInstructionOffset, isShort }], + * isDependant, + * fixedLocation: { page, offset }, + * fixedBank, + * } + */ parcelHelpers.export(exports, "buildRom", ()=>buildRom); +const MINIMAL_BLOCKS_SET_TO_CACHE = 3; +const ROM_BANK_COUNT = 2; +class RomBankSizeError extends Error { +} +class RomBankOrderError extends Error { +} +const RomBank = class RomBank { + static ROM_PAGES_COUNT = 0x10; + static BYTES_PER_ROM_PAGE = 0x100; + static getAbsoluteAddress(page, offset) { + return page * RomBank.BYTES_PER_ROM_PAGE + offset; + } + static getPageFromAddress(address) { + return Math.trunc(address / RomBank.BYTES_PER_ROM_PAGE); + } + static getPageOffsetFromAddress(address) { + return address % RomBank.BYTES_PER_ROM_PAGE; + } + #currentPage = 0; + #currentPageOffset = 0; + #pages = []; + #blocksRomOffsets = new Map(); + #bankNo; + constructor(bankNo){ + this.#pages = Array.from(new Array(RomBank.ROM_PAGES_COUNT), ()=>new Uint8Array(RomBank.BYTES_PER_ROM_PAGE)); + this.#bankNo = bankNo; + } + goToNextPage() { + this.#currentPage++; + this.#currentPageOffset = 0; + if (this.#currentPage >= RomBank.ROM_PAGES_COUNT) throw new RomBankSizeError(`Couldn't fit all codeblocks into ROM bank ${this.#bankNo}!`); + } + addSingleBytePadding() { + this.#currentPageOffset++; + if (this.#currentPageOffset === RomBank.BYTES_PER_ROM_PAGE) this.goToNextPage(); + } + /* + * Insert block to specific position without updating cursor + */ putBlock(block, page, offset) { + const absoluteAddress = RomBank.getAbsoluteAddress(page, offset); + this.#blocksRomOffsets.set(block.id, absoluteAddress); + block.actualBanksPlacement.add(this.#bankNo); + this.#pages[page].set(block.bytecode, offset); + } + /* + * Append block to ROM and advance cursor + */ appendBlock(block, page, offset) { + if (page !== undefined && offset !== undefined) { + if (page < this.#currentPage) throw new RomBankOrderError("Wrong order of blocks to append to ROM!"); + if (page === this.#currentPage && offset < this.#currentPageOffset) throw new RomBankOrderError("Wrong order of blocks to append to ROM!"); + this.#currentPage = page; + this.#currentPageOffset = offset; + } + const absoluteAddress = RomBank.getAbsoluteAddress(this.#currentPage, this.#currentPageOffset); + this.#blocksRomOffsets.set(block.id, absoluteAddress); + block.actualBanksPlacement.add(this.#bankNo); + const blockSize = block.bytecode.length; + const freeSpaceInCurrentPage = RomBank.BYTES_PER_ROM_PAGE - this.#currentPageOffset; + if (freeSpaceInCurrentPage > blockSize) { + this.#pages[this.#currentPage].set(block.bytecode, this.#currentPageOffset); + this.#currentPageOffset += blockSize; + return; + } + this.#pages[this.#currentPage].set(block.bytecode.slice(0, freeSpaceInCurrentPage), this.#currentPageOffset); + this.goToNextPage(); + let blockOffset = freeSpaceInCurrentPage; + while(blockOffset < blockSize){ + const bytesLeft = blockSize - blockOffset; + if (bytesLeft >= RomBank.BYTES_PER_ROM_PAGE) { + const currentBytecodeChunk = block.bytecode.slice(blockOffset, blockOffset + RomBank.BYTES_PER_ROM_PAGE); + this.#pages[this.#currentPage].set(currentBytecodeChunk, 0); + this.goToNextPage(); + blockOffset += RomBank.BYTES_PER_ROM_PAGE; + continue; + } + this.#pages[this.#currentPage].set(block.bytecode.slice(blockOffset), 0); + this.#currentPageOffset = bytesLeft; + return; + } + } + /* + * Updates encoded address in bytecode + * + * For short jumps, 2nd byte of instruction is updated, for long jumps we also modify 1st byte of instruction to + * include highest 4bit of address. + */ updateEncodedAddress(absoluteAddressOffset, absoluteTargetOffset, isShort) { + const pageWithLowPartOfAddress = this.#pages[RomBank.getPageFromAddress(absoluteAddressOffset)]; + const pageOffsetWithLowPartOfAddress = RomBank.getPageOffsetFromAddress(absoluteAddressOffset); + pageWithLowPartOfAddress[pageOffsetWithLowPartOfAddress] = absoluteTargetOffset & 0xFF; + if (isShort) return; + // to handle cases when instruction placed at XX:0xFF location, we need to re-evaluate page number and offsets + const pageWithHighPartOfAddress = this.#pages[RomBank.getPageFromAddress(absoluteAddressOffset - 1)]; + const pageOffsetWithHighPartOfAddress = RomBank.getPageOffsetFromAddress(absoluteAddressOffset - 1); + const instruction = pageWithHighPartOfAddress[pageOffsetWithHighPartOfAddress]; + pageWithHighPartOfAddress[pageOffsetWithHighPartOfAddress] = instruction | absoluteTargetOffset >> 8; + } + get blockOffsets() { + return this.#blocksRomOffsets; + } + get usedSpaceInPage() { + return this.#currentPageOffset; + } + get rom() { + return Uint8Array.from(Array.prototype.concat(...this.#pages.map((page)=>Array.from(page)))); + } + get romSize() { + return this.#currentPage * RomBank.BYTES_PER_ROM_PAGE + this.#currentPageOffset; + } + get bankNo() { + return this.#bankNo; + } +}; +/* + * Checks if placement variant satisfies short calls limitations: + * - caller instruction should not be at last two words on the ROM page + * - caller instruction and callee block first instruction should be on the same ROM page + */ const checkPlacementVariant = (blocks, blocksRomOffsets, blocksPlacement)=>{ + for (const blockId of blocksPlacement){ + const callerBlockRomOffset = blocksRomOffsets.get(blockId); + for (const { addressOffset , refBlockId , refInstructionOffset , isShort } of blocks[blockId].references){ + if (!isShort) continue; + const absoluteOffset = callerBlockRomOffset + (addressOffset - 1); + if (absoluteOffset % RomBank.BYTES_PER_ROM_PAGE >= RomBank.BYTES_PER_ROM_PAGE - 2) return false; + const callerRomPage = RomBank.getPageFromAddress(absoluteOffset); + const calleeRomPage = RomBank.getPageFromAddress(blocksRomOffsets.get(refBlockId) + refInstructionOffset); + if (callerRomPage !== calleeRomPage) return false; + } + } + return true; +}; +/* + * Returns array with block index and indexes of all dependant blocks + */ const getCoupledBlocksIds = (blocks, firstBlockId)=>{ + const coupledBlocks = new Set(); + const blocksToAdd = [ + firstBlockId + ]; + while(blocksToAdd.length){ + const blockId = blocksToAdd.shift(); + if (coupledBlocks.has(blockId)) continue; + coupledBlocks.add(blockId); + blocksToAdd.push(...blocks[blockId].references.filter((block)=>block.isShort).map((block)=>block.refBlockId)); + } + return [ + ...coupledBlocks + ]; +}; +/* + * Returns placement for set of coupled blocks if it's present in cache + */ const getCachedPlacementForCoupledBlocks = (placementCache, blocks, coupledBlockIds)=>{ + const cacheSection = placementCache[coupledBlockIds.length]; + if (!cacheSection) return null; + for (const cacheEntry of cacheSection){ + const { coupledBlocks , offset: cachedOffset } = cacheEntry; + const placement = new Array(coupledBlockIds.length); + for (const blockId of coupledBlockIds){ + const block = blocks[blockId]; + const similarCacheBlocks = coupledBlocks[`${block.references.length}, ${block.bytecode.length}`]; + const matchingCacheBlock = similarCacheBlocks?.find(({ references: refs , placementPosition })=>block.references.every((ref)=>refs[`${ref.addressOffset}, ${ref.refInstructionOffset}`] === ref.isShort) && placement[placementPosition] === undefined); + if (!matchingCacheBlock) break; + placement[matchingCacheBlock.placementPosition] = blockId; + } + if (placement.includes(undefined)) continue; + cacheEntry.inUse = true; + return { + placement, + offset: cachedOffset + }; + } + return null; +}; +/* + * Update cache by known good placement + */ const insertCachedPlacementForCoupledBlocks = (placementCache, blocks, pageOffset, placement)=>{ + const cacheSection = placementCache[placement.length] || (placementCache[placement.length] = []); + const coupledBlocks = {}; + for (const [placementPosition, blockId] of placement.entries()){ + const { references , bytecode } = blocks[blockId]; + const key = `${references.length}, ${bytecode.length}`; + (coupledBlocks[key] || (coupledBlocks[key] = [])).push({ + placementPosition, + references: Object.fromEntries(references.map((ref)=>[ + `${ref.addressOffset}, ${ref.refInstructionOffset}`, + ref.isShort + ])) + }); + } + cacheSection.push({ + coupledBlocks, + offset: pageOffset, + inUse: true + }); +}; +/* + * Tries to place code block into ROM + * + * Returns true if it was possible to do + * + * Allows to use cache for block sets placements in format: + * { + * [coupledBlocks.length]: [ + * { + * coupledBlocks: { + * [block.references.length, blockSize]: [ + * { placementPosition, references: { [addressOffset, refInstructionOffset]: isShort } }, + * ], + * }, + * offset, + * }, + * ] + * } + */ const placeCodeBlock = (blocks, attemptedBlockId, romBank, placementCache)=>{ + if (romBank.blockOffsets.has(attemptedBlockId)) return true; + const pageOffset = romBank.usedSpaceInPage; + const coupledBlocks = getCoupledBlocksIds(blocks, attemptedBlockId); + if (placementCache && coupledBlocks.length >= MINIMAL_BLOCKS_SET_TO_CACHE) { + const cachedPlacement = getCachedPlacementForCoupledBlocks(placementCache, blocks, coupledBlocks); + if (cachedPlacement?.offset === pageOffset) { + for (const blockId of cachedPlacement.placement)romBank.appendBlock(blocks[blockId]); + return true; + } + } + const queue = [ + { + prefix: [], + suffix: coupledBlocks + } + ]; + while(queue.length){ + const { prefix , suffix } = queue.pop(); + if (!suffix.length) { + const blocksRelativeRomOffsets = new Map(); + const blocksPlacement = prefix; + let offset = pageOffset; + for (const blockId1 of blocksPlacement){ + blocksRelativeRomOffsets.set(blockId1, offset); + offset += blocks[blockId1].bytecode.length; + } + if (!checkPlacementVariant(blocks, blocksRelativeRomOffsets, blocksPlacement)) continue; + if (placementCache && coupledBlocks.length >= MINIMAL_BLOCKS_SET_TO_CACHE) insertCachedPlacementForCoupledBlocks(placementCache, blocks, pageOffset, blocksPlacement); + for (const blockId2 of blocksPlacement)romBank.appendBlock(blocks[blockId2]); + return true; + } + for (const [elementIdx, nextElementForPrefix] of suffix.entries())queue.push({ + prefix: [ + ...prefix, + nextElementForPrefix + ], + suffix: suffix.filter((_, idx)=>elementIdx !== idx) + }); + } + return false; +}; +/* + * Return size of block with all dependant blocks + */ const getFullBlockSize = (blocks, primaryBlockId)=>{ + const blocksChecked = new Set([]); + const blocksQueue = [ + primaryBlockId + ]; + let sum = 0; + while(blocksQueue.length){ + const blockId = blocksQueue.shift(); + if (blocksChecked.has(blockId)) continue; + const { bytecode , references } = blocks[blockId]; + sum += bytecode.length; + blocksQueue.push(...references.filter(({ isShort })=>isShort).map(({ refBlockId })=>refBlockId)); + blocksChecked.add(blockId); + } + return sum; +}; +/* + * Try to place specific set of code blocks into ROM in some kind of optimal manner + */ const fillRomWithBlocksFromSet = (blocksToPlace, blocks, romBank, placementCache)=>{ + while(blocksToPlace.size){ + let hasAnyCodeBlockFit = false; + for (const codeBlock of blocksToPlace)if (placeCodeBlock(blocks, codeBlock.id, romBank, placementCache)) { + blocksToPlace.delete(codeBlock); + hasAnyCodeBlockFit = true; + break; + } + if (!hasAnyCodeBlockFit) romBank.addSingleBytePadding(); + } +}; +/* + * Try to place all code blocks into ROM in some kind of optimal manner + */ const fillRomWithBlocks = (primaryBlocks, blocks, romBank, placementCache)=>{ + fillRomWithBlocksFromSet(primaryBlocks, blocks, romBank, placementCache); + // It could be situation: + // 1. block A has long reference to block B + // 2. block B has short reference to block C + // 3. block C has short reference to block B + // B and C would be marked as dependant, so they would not be included in primary blocks + // but because A has long reference to B, then B would not be part of dependency tree for A + // it means that blocks B and C would not be processed + const unplacedBlocks = blocks.filter((block)=>block.desiredBanksPlacement.has(romBank.bankNo) && !block.actualBanksPlacement.has(romBank.bankNo)); + fillRomWithBlocksFromSet(new Set(unplacedBlocks), blocks, romBank, placementCache); + if (placementCache) for (const sectionName of Object.keys(placementCache)){ + const updatedSection = placementCache[sectionName].filter(({ inUse })=>inUse).map(({ inUse , ...rest })=>rest); + if (!updatedSection.length) { + delete placementCache[sectionName]; + continue; + } + placementCache[sectionName] = updatedSection; + } +}; +/* + * Return Set with primary blocks, sorted by their sizes (including dependant blocks) + */ const getSortedPrimaryBlocks = (romBlocks, blocks)=>{ + const primaryCodeBlocks = romBlocks.map((block)=>({ + ...block, + fullSize: getFullBlockSize(blocks, block.id) + })).filter(({ isDependant , fixedLocation })=>!isDependant && !fixedLocation); + return new Set(primaryCodeBlocks.sort((a, b)=>b.fullSize - a.fullSize)); +}; +const getAbsoluteAddressForFixedBlock = ({ fixedLocation: { page , offset } })=>RomBank.getAbsoluteAddress(page, offset); +/* + * Places all code blocks, for which location is specified, into ROM + */ const fillRomWithFixedBlocks = (fixedBlocks, romBank)=>{ + for (const block of fixedBlocks)romBank.appendBlock(block, block.fixedLocation.page, block.fixedLocation.offset); +}; +/* + * Try to fill gaps between fixed blocks with small routines + */ const fillGapsBetweenFixedBlocks = (fixedBlocks, primaryBlocks, blocks, romBank)=>{ + for (const [idx, fixedBlock] of fixedBlocks.entries()){ + const nextFixedBlock = fixedBlocks[idx + 1]; + if (!nextFixedBlock) break; + const { page , offset } = fixedBlock.fixedLocation; + // in theory, it's possible to put something between blocks from different pages + if (nextFixedBlock.fixedLocation.page !== page) continue; + const gapSize = nextFixedBlock.fixedLocation.offset - offset - fixedBlock.bytecode.length; + for (const primaryBlock of primaryBlocks){ + if (primaryBlock.fullSize > gapSize) continue; + let pageOffset = offset + fixedBlock.bytecode.length; + const coupledBlocks = getCoupledBlocksIds(blocks, primaryBlock.id); + for (const blockId of coupledBlocks){ + const block = blocks[blockId]; + romBank.putBlock(block, page, pageOffset); + pageOffset += block.bytecode.length; + } + primaryBlocks.delete(primaryBlock); + break; + } + } +}; +/* + * Place blocks into single rom bank + */ const placeBlocksIntoRomBank = (romBank, blocks, bankNo, placementCache)=>{ + const romBlocks = blocks.filter(({ desiredBanksPlacement })=>desiredBanksPlacement.has(bankNo)); + const primaryBlocks = getSortedPrimaryBlocks(romBlocks, blocks); + const fixedBlocks = romBlocks.filter(({ fixedLocation })=>!!fixedLocation).sort((a, b)=>getAbsoluteAddressForFixedBlock(a) - getAbsoluteAddressForFixedBlock(b)); + fillRomWithFixedBlocks(fixedBlocks, romBank); + fillGapsBetweenFixedBlocks(fixedBlocks, primaryBlocks, blocks, romBank); + fillRomWithBlocks(primaryBlocks, blocks, romBank, placementCache); +}; +/* + * Set rom bank placement for all blocks, linked via references + */ const assignRomBanks = (blocks, entrypointBlockId)=>{ + const queue = [ + { + blockId: entrypointBlockId, + bankNo: 0 + } + ]; + while(queue.length){ + const { blockId , bankNo } = queue.shift(); + const block = blocks[blockId]; + const bankToUse = block.fixedBank ?? bankNo; + if (block.desiredBanksPlacement.has(bankToUse)) continue; + block.desiredBanksPlacement.add(bankToUse); + queue.push(...block.references.map(({ refBlockId })=>({ + blockId: refBlockId, + bankNo: bankToUse + }))); + if (block.fixedLocation) { + const samePageBlocks = blocks.filter(({ fixedLocation , id })=>fixedLocation?.page === block.fixedLocation.page && id !== entrypointBlockId); + queue.push(...samePageBlocks.map(({ id })=>({ + blockId: id, + bankNo: bankToUse + }))); + } + } +}; +const romAddressStr = (address)=>address.toString(16).toUpperCase().padStart(3, "0"); +const blockSizeStr = (size)=>size.toString().padStart(3, " "); +/* + * Print information about block placement in rom page and non-placed blocks + */ const printBlocksPlacementInfo = (codeBlocks, blockOffsets, symbolsPerBlock, bankNo)=>{ + const gaps = []; + console.log("Current blocks placement:"); + const orderedBlockOffsets = [ + ...blockOffsets.entries() + ].sort(([, a], [, b])=>a - b); + for (const [idx, [blockId, romAddress]] of orderedBlockOffsets.slice(0, -1).entries()){ + const blockLabel = symbolsPerBlock.get(blockId).find(({ instructionOffset })=>!instructionOffset).label; + console.log(` [${romAddressStr(romAddress)}, ${blockSizeStr(codeBlocks[blockId].bytecode.length)}] ${blockLabel}`); + const endOfBlock = romAddress + codeBlocks[blockId].bytecode.length; + if (orderedBlockOffsets[idx + 1] && orderedBlockOffsets[idx + 1][1] !== endOfBlock) { + const gap = orderedBlockOffsets[idx + 1][1] - endOfBlock; + console.log(` [${romAddressStr(endOfBlock)}, ${blockSizeStr(gap)}] FREE`); + gaps.push(gap); + } + } + console.log(); + console.log(`Free space left in ROM: ${gaps.reduce((sum, gap)=>sum + gap, 0)} bytes`); + console.log(`Maximum gap between blocks: ${Math.max(...gaps)} bytes`); + console.log(); + console.log("Non-placed blocks:"); + let totalSizeOfNonPlacedBlocks = 0; + const [lastBlockId] = orderedBlockOffsets.at(-1); + const placedBlocks = new Set(orderedBlockOffsets.map(([blockId])=>blockId).filter((id)=>id !== lastBlockId)); + for (const { desiredBanksPlacement , id , bytecode: { length: blockSize } } of codeBlocks)if (desiredBanksPlacement.has(bankNo) && !placedBlocks.has(id)) { + const blockLabel1 = symbolsPerBlock.get(id).find(({ instructionOffset })=>!instructionOffset).label; + console.log(` [${blockSize}] ${blockLabel1}`); + totalSizeOfNonPlacedBlocks += blockSize; + } + console.log(`Size of non-placed blocks: ${totalSizeOfNonPlacedBlocks} bytes`); + console.log(); +}; +function buildRom(codeBlocks, blockAddressedSymbols, { placementCache } = {}) { + const symbolsPerBlock = new Map(); + for (const { label , blockId , instructionOffset } of blockAddressedSymbols){ + if (!symbolsPerBlock.has(blockId)) symbolsPerBlock.set(blockId, []); + symbolsPerBlock.get(blockId).push({ + label, + instructionOffset + }); + } + for (const block of codeBlocks){ + block.desiredBanksPlacement = new Set(); + block.actualBanksPlacement = new Set(); + } + assignRomBanks(codeBlocks, codeBlocks.find(({ fixedLocation })=>fixedLocation?.page === 0 && fixedLocation?.offset === 0).id); + const romBanks = Array.from(new Array(ROM_BANK_COUNT), (_, idx)=>new RomBank(idx)); + for (const [bankNo, romBank] of romBanks.entries())try { + placeBlocksIntoRomBank(romBank, codeBlocks, bankNo, placementCache); + } catch (err) { + if (err instanceof RomBankSizeError) printBlocksPlacementInfo(codeBlocks, romBank.blockOffsets, symbolsPerBlock, bankNo); + throw err; + } + const roms = romBanks.map((romBank, bankNo)=>{ + const symbols = []; + const sourceMap = []; + for (const [blockId, romAddress] of romBank.blockOffsets.entries()){ + const block = codeBlocks[blockId]; + for (const { instructionOffset , line } of block.sourceCodeLines)sourceMap.push({ + romOffset: romAddress + instructionOffset, + line + }); + for (const { instructionOffset: instructionOffset1 , label } of symbolsPerBlock.get(blockId) || [])symbols.push({ + label, + romAddress: romAddress + instructionOffset1 + }); + for (const { addressOffset , refBlockId , refInstructionOffset , isShort } of block.references){ + const { desiredBanksPlacement } = codeBlocks[refBlockId]; + const refBankNo = desiredBanksPlacement.has(bankNo) ? bankNo : [ + ...desiredBanksPlacement + ][0]; + const targetBlockAddress = romBanks[refBankNo].blockOffsets.get(refBlockId); + if (targetBlockAddress === undefined) throw Error("Broken reference! Something went wrong internally..."); + romBank.updateEncodedAddress(romAddress + addressOffset, targetBlockAddress + refInstructionOffset, isShort); + } + } + return { + symbols, + sourceMap, + data: romBank.rom, + size: romBank.romSize + }; + }); + return { + roms, + placementCache + }; +} + +},{"@parcel/transformer-js/src/esmodule-helpers.js":"fn8Fk"}],"fn8Fk":[function(require,module,exports) { +exports.interopDefault = function(a) { + return a && a.__esModule ? a : { + default: a + }; +}; +exports.defineInteropFlag = function(a) { + Object.defineProperty(a, "__esModule", { + value: true + }); +}; +exports.exportAll = function(source, dest) { + Object.keys(source).forEach(function(key) { + if (key === "default" || key === "__esModule" || dest.hasOwnProperty(key)) return; + Object.defineProperty(dest, key, { + enumerable: true, + get: function() { + return source[key]; + } + }); + }); + return dest; +}; +exports.export = function(dest, destName, get) { + Object.defineProperty(dest, destName, { + enumerable: true, + get: get + }); +}; + +},{}]},["kxa5K","7kqP9"], "7kqP9", "parcelRequired6a3") + +//# sourceMappingURL=compiler.c53983db.js.map diff --git a/emulator.ab26e0f6.js b/emulator.ab26e0f6.js new file mode 100644 index 0000000..1d3b41f --- /dev/null +++ b/emulator.ab26e0f6.js @@ -0,0 +1,1865 @@ +// modules are defined as an array +// [ module function, map of requires ] +// +// map of requires is short require name -> numeric require +// +// anything defined in a previous bundle is accessed via the +// orig method which is the require for previous bundles + +(function (modules, entry, mainEntry, parcelRequireName, globalName) { + /* eslint-disable no-undef */ + var globalObject = + typeof globalThis !== 'undefined' + ? globalThis + : typeof self !== 'undefined' + ? self + : typeof window !== 'undefined' + ? window + : typeof global !== 'undefined' + ? global + : {}; + /* eslint-enable no-undef */ + + // Save the require from previous bundle to this closure if any + var previousRequire = + typeof globalObject[parcelRequireName] === 'function' && + globalObject[parcelRequireName]; + + var cache = previousRequire.cache || {}; + // Do not use `require` to prevent Webpack from trying to bundle this call + var nodeRequire = + typeof module !== 'undefined' && + typeof module.require === 'function' && + module.require.bind(module); + + function newRequire(name, jumped) { + if (!cache[name]) { + if (!modules[name]) { + // if we cannot find the module within our internal map or + // cache jump to the current global require ie. the last bundle + // that was added to the page. + var currentRequire = + typeof globalObject[parcelRequireName] === 'function' && + globalObject[parcelRequireName]; + if (!jumped && currentRequire) { + return currentRequire(name, true); + } + + // If there are other bundles on this page the require from the + // previous one is saved to 'previousRequire'. Repeat this as + // many times as there are bundles until the module is found or + // we exhaust the require chain. + if (previousRequire) { + return previousRequire(name, true); + } + + // Try the node require function if it exists. + if (nodeRequire && typeof name === 'string') { + return nodeRequire(name); + } + + var err = new Error("Cannot find module '" + name + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + } + + localRequire.resolve = resolve; + localRequire.cache = {}; + + var module = (cache[name] = new newRequire.Module(name)); + + modules[name][0].call( + module.exports, + localRequire, + module, + module.exports, + this + ); + } + + return cache[name].exports; + + function localRequire(x) { + var res = localRequire.resolve(x); + return res === false ? {} : newRequire(res); + } + + function resolve(x) { + var id = modules[name][1][x]; + return id != null ? id : x; + } + } + + function Module(moduleName) { + this.id = moduleName; + this.bundle = newRequire; + this.exports = {}; + } + + newRequire.isParcelRequire = true; + newRequire.Module = Module; + newRequire.modules = modules; + newRequire.cache = cache; + newRequire.parent = previousRequire; + newRequire.register = function (id, exports) { + modules[id] = [ + function (require, module) { + module.exports = exports; + }, + {}, + ]; + }; + + Object.defineProperty(newRequire, 'root', { + get: function () { + return globalObject[parcelRequireName]; + }, + }); + + globalObject[parcelRequireName] = newRequire; + + for (var i = 0; i < entry.length; i++) { + newRequire(entry[i]); + } + + if (mainEntry) { + // Expose entry point to Node, AMD or browser globals + // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js + var mainExports = newRequire(mainEntry); + + // CommonJS + if (typeof exports === 'object' && typeof module !== 'undefined') { + module.exports = mainExports; + + // RequireJS + } else if (typeof define === 'function' && define.amd) { + define(function () { + return mainExports; + }); + + // "; // eslint-disable-line + // This is guaranteed to yield a script element. + var firstChild = div.firstChild; + domElement = div.removeChild(firstChild); + } else if (typeof props.is === "string") // $FlowIssue `createElement` should be updated for Web Components + domElement = ownerDocument.createElement(type, { + is: props.is + }); + else { + // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug. + // See discussion in https://github.com/facebook/react/pull/6896 + // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 + domElement = ownerDocument.createElement(type); // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple` and `size` + // attributes on `select`s needs to be added before `option`s are inserted. + // This prevents: + // - a bug where the `select` does not scroll to the correct option because singular + // `select` elements automatically pick the first item #13222 + // - a bug where the `select` set the first item as selected despite the `size` attribute #14239 + // See https://github.com/facebook/react/issues/13222 + // and https://github.com/facebook/react/issues/14239 + if (type === "select") { + var node = domElement; + if (props.multiple) node.multiple = true; + else if (props.size) // Setting a size greater than 1 causes a select to behave like `multiple=true`, where + // it is possible that no option is selected. + // + // This is only necessary when a select in "single selection mode". + node.size = props.size; + } + } + } else domElement = ownerDocument.createElementNS(namespaceURI, type); + if (namespaceURI === HTML_NAMESPACE$1) { + if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === "[object HTMLUnknownElement]" && !Object.prototype.hasOwnProperty.call(warnedUnknownTags, type)) { + warnedUnknownTags[type] = true; + error("The tag <%s> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.", type); + } + } + return domElement; + } + function createTextNode(text, rootContainerElement) { + return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text); + } + function setInitialProperties(domElement, tag, rawProps, rootContainerElement) { + var isCustomComponentTag = isCustomComponent(tag, rawProps); + validatePropertiesInDevelopment(tag, rawProps); + var props; + switch(tag){ + case "dialog": + listenToNonDelegatedEvent("cancel", domElement); + listenToNonDelegatedEvent("close", domElement); + props = rawProps; + break; + case "iframe": + case "object": + case "embed": + // We listen to this event in case to ensure emulated bubble + // listeners still fire for the load event. + listenToNonDelegatedEvent("load", domElement); + props = rawProps; + break; + case "video": + case "audio": + // We listen to these events in case to ensure emulated bubble + // listeners still fire for all the media events. + for(var i = 0; i < mediaEventTypes.length; i++)listenToNonDelegatedEvent(mediaEventTypes[i], domElement); + props = rawProps; + break; + case "source": + // We listen to this event in case to ensure emulated bubble + // listeners still fire for the error event. + listenToNonDelegatedEvent("error", domElement); + props = rawProps; + break; + case "img": + case "image": + case "link": + // We listen to these events in case to ensure emulated bubble + // listeners still fire for error and load events. + listenToNonDelegatedEvent("error", domElement); + listenToNonDelegatedEvent("load", domElement); + props = rawProps; + break; + case "details": + // We listen to this event in case to ensure emulated bubble + // listeners still fire for the toggle event. + listenToNonDelegatedEvent("toggle", domElement); + props = rawProps; + break; + case "input": + initWrapperState(domElement, rawProps); + props = getHostProps(domElement, rawProps); // We listen to this event in case to ensure emulated bubble + // listeners still fire for the invalid event. + listenToNonDelegatedEvent("invalid", domElement); + break; + case "option": + validateProps(domElement, rawProps); + props = getHostProps$1(domElement, rawProps); + break; + case "select": + initWrapperState$1(domElement, rawProps); + props = getHostProps$2(domElement, rawProps); // We listen to this event in case to ensure emulated bubble + // listeners still fire for the invalid event. + listenToNonDelegatedEvent("invalid", domElement); + break; + case "textarea": + initWrapperState$2(domElement, rawProps); + props = getHostProps$3(domElement, rawProps); // We listen to this event in case to ensure emulated bubble + // listeners still fire for the invalid event. + listenToNonDelegatedEvent("invalid", domElement); + break; + default: + props = rawProps; + } + assertValidProps(tag, props); + setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag); + switch(tag){ + case "input": + // TODO: Make sure we check if this is still unmounted or do any clean + // up necessary since we never stop tracking anymore. + track(domElement); + postMountWrapper(domElement, rawProps, false); + break; + case "textarea": + // TODO: Make sure we check if this is still unmounted or do any clean + // up necessary since we never stop tracking anymore. + track(domElement); + postMountWrapper$3(domElement); + break; + case "option": + postMountWrapper$1(domElement, rawProps); + break; + case "select": + postMountWrapper$2(domElement, rawProps); + break; + default: + if (typeof props.onClick === "function") // TODO: This cast may not be sound for SVG, MathML or custom elements. + trapClickOnNonInteractiveElement(domElement); + break; + } + } // Calculate the diff between the two objects. + function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) { + validatePropertiesInDevelopment(tag, nextRawProps); + var updatePayload = null; + var lastProps; + var nextProps; + switch(tag){ + case "input": + lastProps = getHostProps(domElement, lastRawProps); + nextProps = getHostProps(domElement, nextRawProps); + updatePayload = []; + break; + case "option": + lastProps = getHostProps$1(domElement, lastRawProps); + nextProps = getHostProps$1(domElement, nextRawProps); + updatePayload = []; + break; + case "select": + lastProps = getHostProps$2(domElement, lastRawProps); + nextProps = getHostProps$2(domElement, nextRawProps); + updatePayload = []; + break; + case "textarea": + lastProps = getHostProps$3(domElement, lastRawProps); + nextProps = getHostProps$3(domElement, nextRawProps); + updatePayload = []; + break; + default: + lastProps = lastRawProps; + nextProps = nextRawProps; + if (typeof lastProps.onClick !== "function" && typeof nextProps.onClick === "function") // TODO: This cast may not be sound for SVG, MathML or custom elements. + trapClickOnNonInteractiveElement(domElement); + break; + } + assertValidProps(tag, nextProps); + var propKey; + var styleName; + var styleUpdates = null; + for(propKey in lastProps){ + if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) continue; + if (propKey === STYLE) { + var lastStyle = lastProps[propKey]; + for(styleName in lastStyle)if (lastStyle.hasOwnProperty(styleName)) { + if (!styleUpdates) styleUpdates = {}; + styleUpdates[styleName] = ""; + } + } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) ; + else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; + else if (propKey === AUTOFOCUS) ; + else if (registrationNameDependencies.hasOwnProperty(propKey)) // This is a special case. If any listener updates we need to ensure + // that the "current" fiber pointer gets updated so we need a commit + // to update this element. + { + if (!updatePayload) updatePayload = []; + } else // For all other deleted properties we add it to the queue. We use + // the allowed property list in the commit phase instead. + (updatePayload = updatePayload || []).push(propKey, null); + } + for(propKey in nextProps){ + var nextProp = nextProps[propKey]; + var lastProp = lastProps != null ? lastProps[propKey] : undefined; + if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) continue; + if (propKey === STYLE) { + if (nextProp) // Freeze the next style object so that we can assume it won't be + // mutated. We have already warned for this in the past. + Object.freeze(nextProp); + if (lastProp) { + // Unset styles on `lastProp` but not on `nextProp`. + for(styleName in lastProp)if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { + if (!styleUpdates) styleUpdates = {}; + styleUpdates[styleName] = ""; + } + // Update styles that changed since `lastProp`. + for(styleName in nextProp)if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { + if (!styleUpdates) styleUpdates = {}; + styleUpdates[styleName] = nextProp[styleName]; + } + } else { + // Relies on `updateStylesByID` not mutating `styleUpdates`. + if (!styleUpdates) { + if (!updatePayload) updatePayload = []; + updatePayload.push(propKey, styleUpdates); + } + styleUpdates = nextProp; + } + } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { + var nextHtml = nextProp ? nextProp[HTML$1] : undefined; + var lastHtml = lastProp ? lastProp[HTML$1] : undefined; + if (nextHtml != null) { + if (lastHtml !== nextHtml) (updatePayload = updatePayload || []).push(propKey, nextHtml); + } + } else if (propKey === CHILDREN) { + if (typeof nextProp === "string" || typeof nextProp === "number") (updatePayload = updatePayload || []).push(propKey, "" + nextProp); + } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; + else if (registrationNameDependencies.hasOwnProperty(propKey)) { + if (nextProp != null) { + // We eagerly listen to this even though we haven't committed yet. + if (typeof nextProp !== "function") warnForInvalidEventListener(propKey, nextProp); + if (propKey === "onScroll") listenToNonDelegatedEvent("scroll", domElement); + } + if (!updatePayload && lastProp !== nextProp) // This is a special case. If any listener updates we need to ensure + // that the "current" props pointer gets updated so we need a commit + // to update this element. + updatePayload = []; + } else if (typeof nextProp === "object" && nextProp !== null && nextProp.$$typeof === REACT_OPAQUE_ID_TYPE) // If we encounter useOpaqueReference's opaque object, this means we are hydrating. + // In this case, call the opaque object's toString function which generates a new client + // ID so client and server IDs match and throws to rerender. + nextProp.toString(); + else // For any other property we always add it to the queue and then we + // filter it out using the allowed property list during the commit. + (updatePayload = updatePayload || []).push(propKey, nextProp); + } + if (styleUpdates) { + validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE]); + (updatePayload = updatePayload || []).push(STYLE, styleUpdates); + } + return updatePayload; + } // Apply the diff. + function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) { + // Update checked *before* name. + // In the middle of an update, it is possible to have multiple checked. + // When a checked radio tries to change name, browser makes another radio's checked false. + if (tag === "input" && nextRawProps.type === "radio" && nextRawProps.name != null) updateChecked(domElement, nextRawProps); + var wasCustomComponentTag = isCustomComponent(tag, lastRawProps); + var isCustomComponentTag = isCustomComponent(tag, nextRawProps); // Apply the diff. + updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag); // TODO: Ensure that an update gets scheduled if any of the special props + // changed. + switch(tag){ + case "input": + // Update the wrapper around inputs *after* updating props. This has to + // happen after `updateDOMProperties`. Otherwise HTML5 input validations + // raise warnings and prevent the new value from being assigned. + updateWrapper(domElement, nextRawProps); + break; + case "textarea": + updateWrapper$1(domElement, nextRawProps); + break; + case "select": + // + // but + case "option": + return tag === "#text"; + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption + // No special behavior since these rules fall back to "in body" mode for + // all except special table nodes which cause bad parsing behavior anyway. + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr + case "tr": + return tag === "th" || tag === "td" || tag === "style" || tag === "script" || tag === "template"; + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody + case "tbody": + case "thead": + case "tfoot": + return tag === "tr" || tag === "style" || tag === "script" || tag === "template"; + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup + case "colgroup": + return tag === "col" || tag === "template"; + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable + case "table": + return tag === "caption" || tag === "colgroup" || tag === "tbody" || tag === "tfoot" || tag === "thead" || tag === "style" || tag === "script" || tag === "template"; + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead + case "head": + return tag === "base" || tag === "basefont" || tag === "bgsound" || tag === "link" || tag === "meta" || tag === "title" || tag === "noscript" || tag === "noframes" || tag === "style" || tag === "script" || tag === "template"; + // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element + case "html": + return tag === "head" || tag === "body" || tag === "frameset"; + case "frameset": + return tag === "frame"; + case "#document": + return tag === "html"; + } // Probably in the "in body" parsing mode, so we outlaw only tag combos + // where the parsing rules cause implicit opens or closes to be added. + // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody + switch(tag){ + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + return parentTag !== "h1" && parentTag !== "h2" && parentTag !== "h3" && parentTag !== "h4" && parentTag !== "h5" && parentTag !== "h6"; + case "rp": + case "rt": + return impliedEndTags.indexOf(parentTag) === -1; + case "body": + case "caption": + case "col": + case "colgroup": + case "frameset": + case "frame": + case "head": + case "html": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + // These tags are only valid with a few parents that have special child + // parsing rules -- if we're down here, then none of those matched and + // so we allow it only if we don't know what the parent is, as all other + // cases are invalid. + return parentTag == null; + } + return true; + }; + /** + * Returns whether + */ var findInvalidAncestorForTag = function(tag, ancestorInfo) { + switch(tag){ + case "address": + case "article": + case "aside": + case "blockquote": + case "center": + case "details": + case "dialog": + case "dir": + case "div": + case "dl": + case "fieldset": + case "figcaption": + case "figure": + case "footer": + case "header": + case "hgroup": + case "main": + case "menu": + case "nav": + case "ol": + case "p": + case "section": + case "summary": + case "ul": + case "pre": + case "listing": + case "table": + case "hr": + case "xmp": + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + return ancestorInfo.pTagInButtonScope; + case "form": + return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; + case "li": + return ancestorInfo.listItemTagAutoclosing; + case "dd": + case "dt": + return ancestorInfo.dlItemTagAutoclosing; + case "button": + return ancestorInfo.buttonTagInScope; + case "a": + // Spec says something about storing a list of markers, but it sounds + // equivalent to this check. + return ancestorInfo.aTagInScope; + case "nobr": + return ancestorInfo.nobrTagInScope; + } + return null; + }; + var didWarn$1 = {}; + validateDOMNesting = function(childTag, childText, ancestorInfo) { + ancestorInfo = ancestorInfo || emptyAncestorInfo; + var parentInfo = ancestorInfo.current; + var parentTag = parentInfo && parentInfo.tag; + if (childText != null) { + if (childTag != null) error("validateDOMNesting: when childText is passed, childTag should be null"); + childTag = "#text"; + } + var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; + var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); + var invalidParentOrAncestor = invalidParent || invalidAncestor; + if (!invalidParentOrAncestor) return; + var ancestorTag = invalidParentOrAncestor.tag; + var warnKey = !!invalidParent + "|" + childTag + "|" + ancestorTag; + if (didWarn$1[warnKey]) return; + didWarn$1[warnKey] = true; + var tagDisplayName = childTag; + var whitespaceInfo = ""; + if (childTag === "#text") { + if (/\S/.test(childText)) tagDisplayName = "Text nodes"; + else { + tagDisplayName = "Whitespace text nodes"; + whitespaceInfo = " Make sure you don't have any extra whitespace between tags on each line of your source code."; + } + } else tagDisplayName = "<" + childTag + ">"; + if (invalidParent) { + var info = ""; + if (ancestorTag === "table" && childTag === "tr") info += " Add a , or to your code to match the DOM tree generated by the browser."; + error("validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s", tagDisplayName, ancestorTag, whitespaceInfo, info); + } else error("validateDOMNesting(...): %s cannot appear as a descendant of <%s>.", tagDisplayName, ancestorTag); + }; + var SUPPRESS_HYDRATION_WARNING$1; + SUPPRESS_HYDRATION_WARNING$1 = "suppressHydrationWarning"; + var SUSPENSE_START_DATA = "$"; + var SUSPENSE_END_DATA = "/$"; + var SUSPENSE_PENDING_START_DATA = "$?"; + var SUSPENSE_FALLBACK_START_DATA = "$!"; + var STYLE$1 = "style"; + var eventsEnabled = null; + var selectionInformation = null; + function shouldAutoFocusHostComponent(type, props) { + switch(type){ + case "button": + case "input": + case "select": + case "textarea": + return !!props.autoFocus; + } + return false; + } + function getRootHostContext(rootContainerInstance) { + var type; + var namespace; + var nodeType = rootContainerInstance.nodeType; + switch(nodeType){ + case DOCUMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + type = nodeType === DOCUMENT_NODE ? "#document" : "#fragment"; + var root = rootContainerInstance.documentElement; + namespace = root ? root.namespaceURI : getChildNamespace(null, ""); + break; + default: + var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance; + var ownNamespace = container.namespaceURI || null; + type = container.tagName; + namespace = getChildNamespace(ownNamespace, type); + break; + } + var validatedTag = type.toLowerCase(); + var ancestorInfo = updatedAncestorInfo(null, validatedTag); + return { + namespace: namespace, + ancestorInfo: ancestorInfo + }; + } + function getChildHostContext(parentHostContext, type, rootContainerInstance) { + var parentHostContextDev = parentHostContext; + var namespace = getChildNamespace(parentHostContextDev.namespace, type); + var ancestorInfo = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type); + return { + namespace: namespace, + ancestorInfo: ancestorInfo + }; + } + function getPublicInstance(instance) { + return instance; + } + function prepareForCommit(containerInfo) { + eventsEnabled = isEnabled(); + selectionInformation = getSelectionInformation(); + var activeInstance = null; + setEnabled(false); + return activeInstance; + } + function resetAfterCommit(containerInfo) { + restoreSelection(selectionInformation); + setEnabled(eventsEnabled); + eventsEnabled = null; + selectionInformation = null; + } + function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) { + var parentNamespace; + // TODO: take namespace into account when validating. + var hostContextDev = hostContext; + validateDOMNesting(type, null, hostContextDev.ancestorInfo); + if (typeof props.children === "string" || typeof props.children === "number") { + var string = "" + props.children; + var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type); + validateDOMNesting(null, string, ownAncestorInfo); + } + parentNamespace = hostContextDev.namespace; + var domElement = createElement(type, props, rootContainerInstance, parentNamespace); + precacheFiberNode(internalInstanceHandle, domElement); + updateFiberProps(domElement, props); + return domElement; + } + function appendInitialChild(parentInstance, child) { + parentInstance.appendChild(child); + } + function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) { + setInitialProperties(domElement, type, props, rootContainerInstance); + return shouldAutoFocusHostComponent(type, props); + } + function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) { + var hostContextDev = hostContext; + if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === "string" || typeof newProps.children === "number")) { + var string = "" + newProps.children; + var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type); + validateDOMNesting(null, string, ownAncestorInfo); + } + return diffProperties(domElement, type, oldProps, newProps); + } + function shouldSetTextContent(type, props) { + return type === "textarea" || type === "option" || type === "noscript" || typeof props.children === "string" || typeof props.children === "number" || typeof props.dangerouslySetInnerHTML === "object" && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null; + } + function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) { + var hostContextDev = hostContext; + validateDOMNesting(null, text, hostContextDev.ancestorInfo); + var textNode = createTextNode(text, rootContainerInstance); + precacheFiberNode(internalInstanceHandle, textNode); + return textNode; + } + // if a component just imports ReactDOM (e.g. for findDOMNode). + // Some environments might not have setTimeout or clearTimeout. + var scheduleTimeout = typeof setTimeout === "function" ? setTimeout : undefined; + var cancelTimeout = typeof clearTimeout === "function" ? clearTimeout : undefined; + var noTimeout = -1; // ------------------- + function commitMount(domElement, type, newProps, internalInstanceHandle) { + // Despite the naming that might imply otherwise, this method only + // fires if there is an `Update` effect scheduled during mounting. + // This happens if `finalizeInitialChildren` returns `true` (which it + // does to implement the `autoFocus` attribute on the client). But + // there are also other cases when this might happen (such as patching + // up text content during hydration mismatch). So we'll check this again. + if (shouldAutoFocusHostComponent(type, newProps)) domElement.focus(); + } + function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) { + // Update the props handle so that we know which props are the ones with + // with current event handlers. + updateFiberProps(domElement, newProps); // Apply the diff to the DOM node. + updateProperties(domElement, updatePayload, type, oldProps, newProps); + } + function resetTextContent(domElement) { + setTextContent(domElement, ""); + } + function commitTextUpdate(textInstance, oldText, newText) { + textInstance.nodeValue = newText; + } + function appendChild(parentInstance, child) { + parentInstance.appendChild(child); + } + function appendChildToContainer(container, child) { + var parentNode; + if (container.nodeType === COMMENT_NODE) { + parentNode = container.parentNode; + parentNode.insertBefore(child, container); + } else { + parentNode = container; + parentNode.appendChild(child); + } // This container might be used for a portal. + // If something inside a portal is clicked, that click should bubble + // through the React tree. However, on Mobile Safari the click would + // never bubble through the *DOM* tree unless an ancestor with onclick + // event exists. So we wouldn't see it and dispatch it. + // This is why we ensure that non React root containers have inline onclick + // defined. + // https://github.com/facebook/react/issues/11918 + var reactRootContainer = container._reactRootContainer; + if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) // TODO: This cast may not be sound for SVG, MathML or custom elements. + trapClickOnNonInteractiveElement(parentNode); + } + function insertBefore(parentInstance, child, beforeChild) { + parentInstance.insertBefore(child, beforeChild); + } + function insertInContainerBefore(container, child, beforeChild) { + if (container.nodeType === COMMENT_NODE) container.parentNode.insertBefore(child, beforeChild); + else container.insertBefore(child, beforeChild); + } + function removeChild(parentInstance, child) { + parentInstance.removeChild(child); + } + function removeChildFromContainer(container, child) { + if (container.nodeType === COMMENT_NODE) container.parentNode.removeChild(child); + else container.removeChild(child); + } + function hideInstance(instance) { + instance; + var style = instance.style; + if (typeof style.setProperty === "function") style.setProperty("display", "none", "important"); + else style.display = "none"; + } + function hideTextInstance(textInstance) { + textInstance.nodeValue = ""; + } + function unhideInstance(instance, props) { + instance; + var styleProp = props[STYLE$1]; + var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty("display") ? styleProp.display : null; + instance.style.display = dangerousStyleValue("display", display); + } + function unhideTextInstance(textInstance, text) { + textInstance.nodeValue = text; + } + function clearContainer(container) { + if (container.nodeType === ELEMENT_NODE) container.textContent = ""; + else if (container.nodeType === DOCUMENT_NODE) { + var body = container.body; + if (body != null) body.textContent = ""; + } + } // ------------------- + function canHydrateInstance(instance, type, props) { + if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) return null; + // This has now been refined to an element node. + return instance; + } + function canHydrateTextInstance(instance, text) { + if (text === "" || instance.nodeType !== TEXT_NODE) // Empty strings are not parsed by HTML so there won't be a correct match here. + return null; + // This has now been refined to a text node. + return instance; + } + function isSuspenseInstancePending(instance) { + return instance.data === SUSPENSE_PENDING_START_DATA; + } + function isSuspenseInstanceFallback(instance) { + return instance.data === SUSPENSE_FALLBACK_START_DATA; + } + function getNextHydratable(node) { + // Skip non-hydratable nodes. + for(; node != null; node = node.nextSibling){ + var nodeType = node.nodeType; + if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) break; + } + return node; + } + function getNextHydratableSibling(instance) { + return getNextHydratable(instance.nextSibling); + } + function getFirstHydratableChild(parentInstance) { + return getNextHydratable(parentInstance.firstChild); + } + function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle) { + precacheFiberNode(internalInstanceHandle, instance); // TODO: Possibly defer this until the commit phase where all the events + // get attached. + updateFiberProps(instance, props); + var parentNamespace; + var hostContextDev = hostContext; + parentNamespace = hostContextDev.namespace; + return diffHydratedProperties(instance, type, props, parentNamespace); + } + function hydrateTextInstance(textInstance, text, internalInstanceHandle) { + precacheFiberNode(internalInstanceHandle, textInstance); + return diffHydratedText(textInstance, text); + } + function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) { + var node = suspenseInstance.nextSibling; // Skip past all nodes within this suspense boundary. + // There might be nested nodes so we need to keep track of how + // deep we are and only break out when we're back on top. + var depth = 0; + while(node){ + if (node.nodeType === COMMENT_NODE) { + var data = node.data; + if (data === SUSPENSE_END_DATA) { + if (depth === 0) return getNextHydratableSibling(node); + else depth--; + } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) depth++; + } + node = node.nextSibling; + } // TODO: Warn, we didn't find the end comment boundary. + return null; + } // Returns the SuspenseInstance if this node is a direct child of a + // SuspenseInstance. I.e. if its previous sibling is a Comment with + // SUSPENSE_x_START_DATA. Otherwise, null. + function getParentSuspenseInstance(targetInstance) { + var node = targetInstance.previousSibling; // Skip past all nodes within this suspense boundary. + // There might be nested nodes so we need to keep track of how + // deep we are and only break out when we're back on top. + var depth = 0; + while(node){ + if (node.nodeType === COMMENT_NODE) { + var data = node.data; + if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) { + if (depth === 0) return node; + else depth--; + } else if (data === SUSPENSE_END_DATA) depth++; + } + node = node.previousSibling; + } + return null; + } + function commitHydratedContainer(container) { + // Retry if any event replaying was blocked on this. + retryIfBlockedOn(container); + } + function commitHydratedSuspenseInstance(suspenseInstance) { + // Retry if any event replaying was blocked on this. + retryIfBlockedOn(suspenseInstance); + } + function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text) { + warnForUnmatchedText(textInstance, text); + } + function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text) { + if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) warnForUnmatchedText(textInstance, text); + } + function didNotHydrateContainerInstance(parentContainer, instance) { + if (instance.nodeType === ELEMENT_NODE) warnForDeletedHydratableElement(parentContainer, instance); + else if (instance.nodeType === COMMENT_NODE) ; + else warnForDeletedHydratableText(parentContainer, instance); + } + function didNotHydrateInstance(parentType, parentProps, parentInstance, instance) { + if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { + if (instance.nodeType === ELEMENT_NODE) warnForDeletedHydratableElement(parentInstance, instance); + else if (instance.nodeType === COMMENT_NODE) ; + else warnForDeletedHydratableText(parentInstance, instance); + } + } + function didNotFindHydratableContainerInstance(parentContainer, type, props) { + warnForInsertedHydratedElement(parentContainer, type); + } + function didNotFindHydratableContainerTextInstance(parentContainer, text) { + warnForInsertedHydratedText(parentContainer, text); + } + function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props) { + if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) warnForInsertedHydratedElement(parentInstance, type); + } + function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text) { + if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) warnForInsertedHydratedText(parentInstance, text); + } + function didNotFindHydratableSuspenseInstance(parentType, parentProps, parentInstance) { + parentProps[SUPPRESS_HYDRATION_WARNING$1]; + } + var clientId = 0; + function makeClientIdInDEV(warnOnAccessInDEV) { + var id = "r:" + (clientId++).toString(36); + return { + toString: function() { + warnOnAccessInDEV(); + return id; + }, + valueOf: function() { + warnOnAccessInDEV(); + return id; + } + }; + } + function isOpaqueHydratingObject(value) { + return value !== null && typeof value === "object" && value.$$typeof === REACT_OPAQUE_ID_TYPE; + } + function makeOpaqueHydratingObject(attemptToReadValue) { + return { + $$typeof: REACT_OPAQUE_ID_TYPE, + toString: attemptToReadValue, + valueOf: attemptToReadValue + }; + } + function preparePortalMount(portalInstance) { + listenToAllSupportedEvents(portalInstance); + } + var randomKey = Math.random().toString(36).slice(2); + var internalInstanceKey = "__reactFiber$" + randomKey; + var internalPropsKey = "__reactProps$" + randomKey; + var internalContainerInstanceKey = "__reactContainer$" + randomKey; + var internalEventHandlersKey = "__reactEvents$" + randomKey; + function precacheFiberNode(hostInst, node) { + node[internalInstanceKey] = hostInst; + } + function markContainerAsRoot(hostRoot, node) { + node[internalContainerInstanceKey] = hostRoot; + } + function unmarkContainerAsRoot(node) { + node[internalContainerInstanceKey] = null; + } + function isContainerMarkedAsRoot(node) { + return !!node[internalContainerInstanceKey]; + } // Given a DOM node, return the closest HostComponent or HostText fiber ancestor. + // If the target node is part of a hydrated or not yet rendered subtree, then + // this may also return a SuspenseComponent or HostRoot to indicate that. + // Conceptually the HostRoot fiber is a child of the Container node. So if you + // pass the Container node as the targetNode, you will not actually get the + // HostRoot back. To get to the HostRoot, you need to pass a child of it. + // The same thing applies to Suspense boundaries. + function getClosestInstanceFromNode(targetNode) { + var targetInst = targetNode[internalInstanceKey]; + if (targetInst) // Don't return HostRoot or SuspenseComponent here. + return targetInst; + // If the direct event target isn't a React owned DOM node, we need to look + // to see if one of its parents is a React owned DOM node. + var parentNode = targetNode.parentNode; + while(parentNode){ + // We'll check if this is a container root that could include + // React nodes in the future. We need to check this first because + // if we're a child of a dehydrated container, we need to first + // find that inner container before moving on to finding the parent + // instance. Note that we don't check this field on the targetNode + // itself because the fibers are conceptually between the container + // node and the first child. It isn't surrounding the container node. + // If it's not a container, we check if it's an instance. + targetInst = parentNode[internalContainerInstanceKey] || parentNode[internalInstanceKey]; + if (targetInst) { + // Since this wasn't the direct target of the event, we might have + // stepped past dehydrated DOM nodes to get here. However they could + // also have been non-React nodes. We need to answer which one. + // If we the instance doesn't have any children, then there can't be + // a nested suspense boundary within it. So we can use this as a fast + // bailout. Most of the time, when people add non-React children to + // the tree, it is using a ref to a child-less DOM node. + // Normally we'd only need to check one of the fibers because if it + // has ever gone from having children to deleting them or vice versa + // it would have deleted the dehydrated boundary nested inside already. + // However, since the HostRoot starts out with an alternate it might + // have one on the alternate so we need to check in case this was a + // root. + var alternate = targetInst.alternate; + if (targetInst.child !== null || alternate !== null && alternate.child !== null) { + // Next we need to figure out if the node that skipped past is + // nested within a dehydrated boundary and if so, which one. + var suspenseInstance = getParentSuspenseInstance(targetNode); + while(suspenseInstance !== null){ + // We found a suspense instance. That means that we haven't + // hydrated it yet. Even though we leave the comments in the + // DOM after hydrating, and there are boundaries in the DOM + // that could already be hydrated, we wouldn't have found them + // through this pass since if the target is hydrated it would + // have had an internalInstanceKey on it. + // Let's get the fiber associated with the SuspenseComponent + // as the deepest instance. + var targetSuspenseInst = suspenseInstance[internalInstanceKey]; + if (targetSuspenseInst) return targetSuspenseInst; + // If we don't find a Fiber on the comment, it might be because + // we haven't gotten to hydrate it yet. There might still be a + // parent boundary that hasn't above this one so we need to find + // the outer most that is known. + suspenseInstance = getParentSuspenseInstance(suspenseInstance); // If we don't find one, then that should mean that the parent + // host component also hasn't hydrated yet. We can return it + // below since it will bail out on the isMounted check later. + } + } + return targetInst; + } + targetNode = parentNode; + parentNode = targetNode.parentNode; + } + return null; + } + /** + * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent + * instance, or null if the node was not rendered by this React. + */ function getInstanceFromNode(node) { + var inst = node[internalInstanceKey] || node[internalContainerInstanceKey]; + if (inst) { + if (inst.tag === HostComponent || inst.tag === HostText || inst.tag === SuspenseComponent || inst.tag === HostRoot) return inst; + else return null; + } + return null; + } + /** + * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding + * DOM node. + */ function getNodeFromInstance(inst) { + if (inst.tag === HostComponent || inst.tag === HostText) // In Fiber this, is just the state node right now. We assume it will be + // a host component or host text. + return inst.stateNode; + // Without this first invariant, passing a non-DOM-component triggers the next + throw Error("getNodeFromInstance: Invalid argument."); + } + function getFiberCurrentPropsFromNode(node) { + return node[internalPropsKey] || null; + } + function updateFiberProps(node, props) { + node[internalPropsKey] = props; + } + function getEventListenerSet(node) { + var elementListenerSet = node[internalEventHandlersKey]; + if (elementListenerSet === undefined) elementListenerSet = node[internalEventHandlersKey] = new Set(); + return elementListenerSet; + } + var loggedTypeFailures = {}; + var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; + function setCurrentlyValidatingElement(element) { + if (element) { + var owner = element._owner; + var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); + ReactDebugCurrentFrame$1.setExtraStackFrame(stack); + } else ReactDebugCurrentFrame$1.setExtraStackFrame(null); + } + function checkPropTypes(typeSpecs, values, location, componentName, element) { + // $FlowFixMe This is okay but Flow doesn't know it. + var has = Function.call.bind(Object.prototype.hasOwnProperty); + for(var typeSpecName in typeSpecs)if (has(typeSpecs, typeSpecName)) { + var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== "function") { + var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; " + "it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`." + "This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); + err.name = "Invariant Violation"; + throw err; + } + error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); + } catch (ex) { + error$1 = ex; + } + if (error$1 && !(error$1 instanceof Error)) { + setCurrentlyValidatingElement(element); + error("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", componentName || "React class", location, typeSpecName, typeof error$1); + setCurrentlyValidatingElement(null); + } + if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error$1.message] = true; + setCurrentlyValidatingElement(element); + error("Failed %s type: %s", location, error$1.message); + setCurrentlyValidatingElement(null); + } + } + } + var valueStack = []; + var fiberStack; + fiberStack = []; + var index = -1; + function createCursor(defaultValue) { + return { + current: defaultValue + }; + } + function pop(cursor, fiber) { + if (index < 0) { + error("Unexpected pop."); + return; + } + if (fiber !== fiberStack[index]) error("Unexpected Fiber popped."); + cursor.current = valueStack[index]; + valueStack[index] = null; + fiberStack[index] = null; + index--; + } + function push(cursor, value, fiber) { + index++; + valueStack[index] = cursor.current; + fiberStack[index] = fiber; + cursor.current = value; + } + var warnedAboutMissingGetChildContext; + warnedAboutMissingGetChildContext = {}; + var emptyContextObject = {}; + Object.freeze(emptyContextObject); + var contextStackCursor = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. + var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. + // We use this to get access to the parent context after we have already + // pushed the next context provider, and now need to merge their contexts. + var previousContext = emptyContextObject; + function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { + if (didPushOwnContextIfProvider && isContextProvider(Component)) // If the fiber is a context provider itself, when we read its context + // we may have already pushed its own child context on the stack. A context + // provider should not "see" its own child context. Therefore we read the + // previous (parent) context instead for a context provider. + return previousContext; + return contextStackCursor.current; + } + function cacheContext(workInProgress, unmaskedContext, maskedContext) { + var instance = workInProgress.stateNode; + instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; + instance.__reactInternalMemoizedMaskedChildContext = maskedContext; + } + function getMaskedContext(workInProgress, unmaskedContext) { + var type = workInProgress.type; + var contextTypes = type.contextTypes; + if (!contextTypes) return emptyContextObject; + // Avoid recreating masked context unless unmasked context has changed. + // Failing to do this will result in unnecessary calls to componentWillReceiveProps. + // This may trigger infinite loops if componentWillReceiveProps calls setState. + var instance = workInProgress.stateNode; + if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) return instance.__reactInternalMemoizedMaskedChildContext; + var context = {}; + for(var key in contextTypes)context[key] = unmaskedContext[key]; + var name = getComponentName(type) || "Unknown"; + checkPropTypes(contextTypes, context, "context", name); + // Context is created before the class component is instantiated so check for instance. + if (instance) cacheContext(workInProgress, unmaskedContext, context); + return context; + } + function hasContextChanged() { + return didPerformWorkStackCursor.current; + } + function isContextProvider(type) { + var childContextTypes = type.childContextTypes; + return childContextTypes !== null && childContextTypes !== undefined; + } + function popContext(fiber) { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); + } + function popTopLevelContextObject(fiber) { + pop(didPerformWorkStackCursor, fiber); + pop(contextStackCursor, fiber); + } + function pushTopLevelContextObject(fiber, context, didChange) { + if (!(contextStackCursor.current === emptyContextObject)) throw Error("Unexpected context found on stack. This error is likely caused by a bug in React. Please file an issue."); + push(contextStackCursor, context, fiber); + push(didPerformWorkStackCursor, didChange, fiber); + } + function processChildContext(fiber, type, parentContext) { + var instance = fiber.stateNode; + var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. + // It has only been added in Fiber to match the (unintentional) behavior in Stack. + if (typeof instance.getChildContext !== "function") { + var componentName = getComponentName(type) || "Unknown"; + if (!warnedAboutMissingGetChildContext[componentName]) { + warnedAboutMissingGetChildContext[componentName] = true; + error("%s.childContextTypes is specified but there is no getChildContext() method on the instance. You can either define getChildContext() on %s or remove childContextTypes from it.", componentName, componentName); + } + return parentContext; + } + var childContext = instance.getChildContext(); + for(var contextKey in childContext){ + if (!(contextKey in childContextTypes)) throw Error((getComponentName(type) || "Unknown") + '.getChildContext(): key "' + contextKey + '" is not defined in childContextTypes.'); + } + var name = getComponentName(type) || "Unknown"; + checkPropTypes(childContextTypes, childContext, "child context", name); + return _assign({}, parentContext, childContext); + } + function pushContextProvider(workInProgress) { + var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. + // If the instance does not exist yet, we will push null at first, + // and replace it on the stack later when invalidating the context. + var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. + // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. + previousContext = contextStackCursor.current; + push(contextStackCursor, memoizedMergedChildContext, workInProgress); + push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); + return true; + } + function invalidateContextProvider(workInProgress, type, didChange) { + var instance = workInProgress.stateNode; + if (!instance) throw Error("Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue."); + if (didChange) { + // Merge parent and own context. + // Skip this if we're not updating due to sCU. + // This avoids unnecessarily recomputing memoized values. + var mergedContext = processChildContext(workInProgress, type, previousContext); + instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. + // It is important to unwind the context in the reverse order. + pop(didPerformWorkStackCursor, workInProgress); + pop(contextStackCursor, workInProgress); // Now push the new context and mark that it has changed. + push(contextStackCursor, mergedContext, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } else { + pop(didPerformWorkStackCursor, workInProgress); + push(didPerformWorkStackCursor, didChange, workInProgress); + } + } + function findCurrentUnmaskedContext(fiber) { + // Currently this is only used with renderSubtreeIntoContainer; not sure if it + // makes sense elsewhere + if (!(isFiberMounted(fiber) && fiber.tag === ClassComponent)) throw Error("Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue."); + var node = fiber; + do { + switch(node.tag){ + case HostRoot: + return node.stateNode.context; + case ClassComponent: + var Component = node.type; + if (isContextProvider(Component)) return node.stateNode.__reactInternalMemoizedMergedChildContext; + break; + } + node = node.return; + }while (node !== null); + throw Error("Found unexpected detached subtree parent. This error is likely caused by a bug in React. Please file an issue."); + } + var LegacyRoot = 0; + var BlockingRoot = 1; + var ConcurrentRoot = 2; + var rendererID = null; + var injectedHook = null; + var hasLoggedError = false; + var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined"; + function injectInternals(internals) { + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === "undefined") // No DevTools + return false; + var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; + if (hook.isDisabled) // This isn't a real property on the hook, but it can be set to opt out + // of DevTools integration and associated warnings and logs. + // https://github.com/facebook/react/issues/3877 + return true; + if (!hook.supportsFiber) { + error("The installed version of React DevTools is too old and will not work with the current version of React. Please update React DevTools. https://reactjs.org/link/react-devtools"); + return true; + } + try { + rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. + injectedHook = hook; + } catch (err) { + error("React instrumentation encountered an error: %s.", err); + } // DevTools exists + return true; + } + function onScheduleRoot(root, children) { + if (injectedHook && typeof injectedHook.onScheduleFiberRoot === "function") try { + injectedHook.onScheduleFiberRoot(rendererID, root, children); + } catch (err) { + if (!hasLoggedError) { + hasLoggedError = true; + error("React instrumentation encountered an error: %s", err); + } + } + } + function onCommitRoot(root, priorityLevel) { + if (injectedHook && typeof injectedHook.onCommitFiberRoot === "function") try { + var didError = (root.current.flags & DidCapture) === DidCapture; + if (enableProfilerTimer) injectedHook.onCommitFiberRoot(rendererID, root, priorityLevel, didError); + else injectedHook.onCommitFiberRoot(rendererID, root, undefined, didError); + } catch (err) { + if (!hasLoggedError) { + hasLoggedError = true; + error("React instrumentation encountered an error: %s", err); + } + } + } + function onCommitUnmount(fiber) { + if (injectedHook && typeof injectedHook.onCommitFiberUnmount === "function") try { + injectedHook.onCommitFiberUnmount(rendererID, fiber); + } catch (err) { + if (!hasLoggedError) { + hasLoggedError = true; + error("React instrumentation encountered an error: %s", err); + } + } + } + var Scheduler_runWithPriority = Scheduler.unstable_runWithPriority, Scheduler_scheduleCallback = Scheduler.unstable_scheduleCallback, Scheduler_cancelCallback = Scheduler.unstable_cancelCallback, Scheduler_shouldYield = Scheduler.unstable_shouldYield, Scheduler_requestPaint = Scheduler.unstable_requestPaint, Scheduler_now$1 = Scheduler.unstable_now, Scheduler_getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel, Scheduler_ImmediatePriority = Scheduler.unstable_ImmediatePriority, Scheduler_UserBlockingPriority = Scheduler.unstable_UserBlockingPriority, Scheduler_NormalPriority = Scheduler.unstable_NormalPriority, Scheduler_LowPriority = Scheduler.unstable_LowPriority, Scheduler_IdlePriority = Scheduler.unstable_IdlePriority; + // Provide explicit error message when production+profiling bundle of e.g. + // react-dom is used with production (non-profiling) bundle of + // scheduler/tracing + if (!(tracing.__interactionsRef != null && tracing.__interactionsRef.current != null)) throw Error("It is not supported to run the profiling version of a renderer (for example, `react-dom/profiling`) without also replacing the `scheduler/tracing` module with `scheduler/tracing-profiling`. Your bundler might have a setting for aliasing both modules. Learn more at https://reactjs.org/link/profiling"); + var fakeCallbackNode = {}; // Except for NoPriority, these correspond to Scheduler priorities. We use + // ascending numbers so we can compare them like numbers. They start at 90 to + // avoid clashing with Scheduler's priorities. + var ImmediatePriority$1 = 99; + var UserBlockingPriority$2 = 98; + var NormalPriority$1 = 97; + var LowPriority$1 = 96; + var IdlePriority$1 = 95; // NoPriority is the absence of priority. Also React-only. + var NoPriority$1 = 90; + var shouldYield = Scheduler_shouldYield; + var requestPaint = Scheduler_requestPaint !== undefined ? Scheduler_requestPaint : function() {}; + var syncQueue = null; + var immediateQueueCallbackNode = null; + var isFlushingSyncQueue = false; + var initialTimeMs$1 = Scheduler_now$1(); // If the initial timestamp is reasonably small, use Scheduler's `now` directly. + // This will be the case for modern browsers that support `performance.now`. In + // older browsers, Scheduler falls back to `Date.now`, which returns a Unix + // timestamp. In that case, subtract the module initialization time to simulate + // the behavior of performance.now and keep our times small enough to fit + // within 32 bits. + // TODO: Consider lifting this into Scheduler. + var now = initialTimeMs$1 < 10000 ? Scheduler_now$1 : function() { + return Scheduler_now$1() - initialTimeMs$1; + }; + function getCurrentPriorityLevel() { + switch(Scheduler_getCurrentPriorityLevel()){ + case Scheduler_ImmediatePriority: + return ImmediatePriority$1; + case Scheduler_UserBlockingPriority: + return UserBlockingPriority$2; + case Scheduler_NormalPriority: + return NormalPriority$1; + case Scheduler_LowPriority: + return LowPriority$1; + case Scheduler_IdlePriority: + return IdlePriority$1; + default: + throw Error("Unknown priority level."); + } + } + function reactPriorityToSchedulerPriority(reactPriorityLevel) { + switch(reactPriorityLevel){ + case ImmediatePriority$1: + return Scheduler_ImmediatePriority; + case UserBlockingPriority$2: + return Scheduler_UserBlockingPriority; + case NormalPriority$1: + return Scheduler_NormalPriority; + case LowPriority$1: + return Scheduler_LowPriority; + case IdlePriority$1: + return Scheduler_IdlePriority; + default: + throw Error("Unknown priority level."); + } + } + function runWithPriority$1(reactPriorityLevel, fn) { + var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_runWithPriority(priorityLevel, fn); + } + function scheduleCallback(reactPriorityLevel, callback, options) { + var priorityLevel = reactPriorityToSchedulerPriority(reactPriorityLevel); + return Scheduler_scheduleCallback(priorityLevel, callback, options); + } + function scheduleSyncCallback(callback) { + // Push this callback into an internal queue. We'll flush these either in + // the next tick, or earlier if something calls `flushSyncCallbackQueue`. + if (syncQueue === null) { + syncQueue = [ + callback + ]; // Flush the queue in the next tick, at the earliest. + immediateQueueCallbackNode = Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueueImpl); + } else // Push onto existing queue. Don't need to schedule a callback because + // we already scheduled one when we created the queue. + syncQueue.push(callback); + return fakeCallbackNode; + } + function cancelCallback(callbackNode) { + if (callbackNode !== fakeCallbackNode) Scheduler_cancelCallback(callbackNode); + } + function flushSyncCallbackQueue() { + if (immediateQueueCallbackNode !== null) { + var node = immediateQueueCallbackNode; + immediateQueueCallbackNode = null; + Scheduler_cancelCallback(node); + } + flushSyncCallbackQueueImpl(); + } + function flushSyncCallbackQueueImpl() { + if (!isFlushingSyncQueue && syncQueue !== null) { + // Prevent re-entrancy. + isFlushingSyncQueue = true; + var i = 0; + try { + var _isSync2 = true; + var _queue = syncQueue; + runWithPriority$1(ImmediatePriority$1, function() { + for(; i < _queue.length; i++){ + var callback = _queue[i]; + do callback = callback(_isSync2); + while (callback !== null); + } + }); + syncQueue = null; + } catch (error) { + // If something throws, leave the remaining callbacks on the queue. + if (syncQueue !== null) syncQueue = syncQueue.slice(i + 1); + // Resume flushing in the next tick + Scheduler_scheduleCallback(Scheduler_ImmediatePriority, flushSyncCallbackQueue); + throw error; + } finally{ + isFlushingSyncQueue = false; + } + } + } + // TODO: this is special because it gets imported during build. + var ReactVersion = "17.0.2"; + var NoMode = 0; + var StrictMode = 1; // TODO: Remove BlockingMode and ConcurrentMode by reading from the root + // tag instead + var BlockingMode = 2; + var ConcurrentMode = 4; + var ProfileMode = 8; + var DebugTracingMode = 16; + var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; + var NoTransition = 0; + function requestCurrentTransition() { + return ReactCurrentBatchConfig.transition; + } + var ReactStrictModeWarnings = { + recordUnsafeLifecycleWarnings: function(fiber, instance) {}, + flushPendingUnsafeLifecycleWarnings: function() {}, + recordLegacyContextWarning: function(fiber, instance) {}, + flushLegacyContextWarning: function() {}, + discardPendingWarnings: function() {} + }; + var findStrictRoot = function(fiber) { + var maybeStrictRoot = null; + var node = fiber; + while(node !== null){ + if (node.mode & StrictMode) maybeStrictRoot = node; + node = node.return; + } + return maybeStrictRoot; + }; + var setToSortedString = function(set) { + var array = []; + set.forEach(function(value) { + array.push(value); + }); + return array.sort().join(", "); + }; + var pendingComponentWillMountWarnings = []; + var pendingUNSAFE_ComponentWillMountWarnings = []; + var pendingComponentWillReceivePropsWarnings = []; + var pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + var pendingComponentWillUpdateWarnings = []; + var pendingUNSAFE_ComponentWillUpdateWarnings = []; // Tracks components we have already warned about. + var didWarnAboutUnsafeLifecycles = new Set(); + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function(fiber, instance) { + // Dedup strategy: Warn once per component. + if (didWarnAboutUnsafeLifecycles.has(fiber.type)) return; + if (typeof instance.componentWillMount === "function" && // Don't warn about react-lifecycles-compat polyfilled components. + instance.componentWillMount.__suppressDeprecationWarning !== true) pendingComponentWillMountWarnings.push(fiber); + if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillMount === "function") pendingUNSAFE_ComponentWillMountWarnings.push(fiber); + if (typeof instance.componentWillReceiveProps === "function" && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) pendingComponentWillReceivePropsWarnings.push(fiber); + if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillReceiveProps === "function") pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber); + if (typeof instance.componentWillUpdate === "function" && instance.componentWillUpdate.__suppressDeprecationWarning !== true) pendingComponentWillUpdateWarnings.push(fiber); + if (fiber.mode & StrictMode && typeof instance.UNSAFE_componentWillUpdate === "function") pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber); + }; + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function() { + // We do an initial pass to gather component names + var componentWillMountUniqueNames = new Set(); + if (pendingComponentWillMountWarnings.length > 0) { + pendingComponentWillMountWarnings.forEach(function(fiber) { + componentWillMountUniqueNames.add(getComponentName(fiber.type) || "Component"); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingComponentWillMountWarnings = []; + } + var UNSAFE_componentWillMountUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) { + pendingUNSAFE_ComponentWillMountWarnings.forEach(function(fiber) { + UNSAFE_componentWillMountUniqueNames.add(getComponentName(fiber.type) || "Component"); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingUNSAFE_ComponentWillMountWarnings = []; + } + var componentWillReceivePropsUniqueNames = new Set(); + if (pendingComponentWillReceivePropsWarnings.length > 0) { + pendingComponentWillReceivePropsWarnings.forEach(function(fiber) { + componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || "Component"); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingComponentWillReceivePropsWarnings = []; + } + var UNSAFE_componentWillReceivePropsUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) { + pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function(fiber) { + UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentName(fiber.type) || "Component"); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + } + var componentWillUpdateUniqueNames = new Set(); + if (pendingComponentWillUpdateWarnings.length > 0) { + pendingComponentWillUpdateWarnings.forEach(function(fiber) { + componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || "Component"); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingComponentWillUpdateWarnings = []; + } + var UNSAFE_componentWillUpdateUniqueNames = new Set(); + if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) { + pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function(fiber) { + UNSAFE_componentWillUpdateUniqueNames.add(getComponentName(fiber.type) || "Component"); + didWarnAboutUnsafeLifecycles.add(fiber.type); + }); + pendingUNSAFE_ComponentWillUpdateWarnings = []; + } // Finally, we flush all the warnings + // UNSAFE_ ones before the deprecated ones, since they'll be 'louder' + if (UNSAFE_componentWillMountUniqueNames.size > 0) { + var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); + error("Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move code with side effects to componentDidMount, and set initial state in the constructor.\n\nPlease update the following components: %s", sortedNames); + } + if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) { + var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames); + error("Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n\nPlease update the following components: %s", _sortedNames); + } + if (UNSAFE_componentWillUpdateUniqueNames.size > 0) { + var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames); + error("Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n\nPlease update the following components: %s", _sortedNames2); + } + if (componentWillMountUniqueNames.size > 0) { + var _sortedNames3 = setToSortedString(componentWillMountUniqueNames); + warn("componentWillMount has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move code with side effects to componentDidMount, and set initial state in the constructor.\n* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", _sortedNames3); + } + if (componentWillReceivePropsUniqueNames.size > 0) { + var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames); + warn("componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", _sortedNames4); + } + if (componentWillUpdateUniqueNames.size > 0) { + var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames); + warn("componentWillUpdate has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n* Move data fetching code or side effects to componentDidUpdate.\n* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\nPlease update the following components: %s", _sortedNames5); + } + }; + var pendingLegacyContextWarning = new Map(); // Tracks components we have already warned about. + var didWarnAboutLegacyContext = new Set(); + ReactStrictModeWarnings.recordLegacyContextWarning = function(fiber, instance) { + var strictRoot = findStrictRoot(fiber); + if (strictRoot === null) { + error("Expected to find a StrictMode component in a strict mode tree. This error is likely caused by a bug in React. Please file an issue."); + return; + } // Dedup strategy: Warn once per component. + if (didWarnAboutLegacyContext.has(fiber.type)) return; + var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); + if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === "function") { + if (warningsForRoot === undefined) { + warningsForRoot = []; + pendingLegacyContextWarning.set(strictRoot, warningsForRoot); + } + warningsForRoot.push(fiber); + } + }; + ReactStrictModeWarnings.flushLegacyContextWarning = function() { + pendingLegacyContextWarning.forEach(function(fiberArray, strictRoot) { + if (fiberArray.length === 0) return; + var firstFiber = fiberArray[0]; + var uniqueNames = new Set(); + fiberArray.forEach(function(fiber) { + uniqueNames.add(getComponentName(fiber.type) || "Component"); + didWarnAboutLegacyContext.add(fiber.type); + }); + var sortedNames = setToSortedString(uniqueNames); + try { + setCurrentFiber(firstFiber); + error("Legacy context API has been detected within a strict-mode tree.\n\nThe old API will be supported in all 16.x releases, but applications using it should migrate to the new version.\n\nPlease update the following components: %s\n\nLearn more about this warning here: https://reactjs.org/link/legacy-context", sortedNames); + } finally{ + resetCurrentFiber(); + } + }); + }; + ReactStrictModeWarnings.discardPendingWarnings = function() { + pendingComponentWillMountWarnings = []; + pendingUNSAFE_ComponentWillMountWarnings = []; + pendingComponentWillReceivePropsWarnings = []; + pendingUNSAFE_ComponentWillReceivePropsWarnings = []; + pendingComponentWillUpdateWarnings = []; + pendingUNSAFE_ComponentWillUpdateWarnings = []; + pendingLegacyContextWarning = new Map(); + }; + function resolveDefaultProps(Component, baseProps) { + if (Component && Component.defaultProps) { + // Resolve default props. Taken from ReactElement + var props = _assign({}, baseProps); + var defaultProps = Component.defaultProps; + for(var propName in defaultProps)if (props[propName] === undefined) props[propName] = defaultProps[propName]; + return props; + } + return baseProps; + } + // Max 31 bit integer. The max integer size in V8 for 32-bit systems. + // Math.pow(2, 30) - 1 + // 0b111111111111111111111111111111 + var MAX_SIGNED_31_BIT_INT = 1073741823; + var valueCursor = createCursor(null); + var rendererSigil; + // Use this to detect multiple renderers using the same context + rendererSigil = {}; + var currentlyRenderingFiber = null; + var lastContextDependency = null; + var lastContextWithAllBitsObserved = null; + var isDisallowedContextReadInDEV = false; + function resetContextDependencies() { + // This is called right before React yields execution, to ensure `readContext` + // cannot be called outside the render phase. + currentlyRenderingFiber = null; + lastContextDependency = null; + lastContextWithAllBitsObserved = null; + isDisallowedContextReadInDEV = false; + } + function enterDisallowedContextReadInDEV() { + isDisallowedContextReadInDEV = true; + } + function exitDisallowedContextReadInDEV() { + isDisallowedContextReadInDEV = false; + } + function pushProvider(providerFiber, nextValue) { + var context = providerFiber.type._context; + push(valueCursor, context._currentValue, providerFiber); + context._currentValue = nextValue; + if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) error("Detected multiple renderers concurrently rendering the same context provider. This is currently unsupported."); + context._currentRenderer = rendererSigil; + } + function popProvider(providerFiber) { + var currentValue = valueCursor.current; + pop(valueCursor, providerFiber); + var context = providerFiber.type._context; + context._currentValue = currentValue; + } + function calculateChangedBits(context, newValue, oldValue) { + if (objectIs(oldValue, newValue)) // No change + return 0; + else { + var changedBits = typeof context._calculateChangedBits === "function" ? context._calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT; + if ((changedBits & MAX_SIGNED_31_BIT_INT) !== changedBits) error("calculateChangedBits: Expected the return value to be a 31-bit integer. Instead received: %s", changedBits); + return changedBits | 0; + } + } + function scheduleWorkOnParentPath(parent, renderLanes) { + // Update the child lanes of all the ancestors, including the alternates. + var node = parent; + while(node !== null){ + var alternate = node.alternate; + if (!isSubsetOfLanes(node.childLanes, renderLanes)) { + node.childLanes = mergeLanes(node.childLanes, renderLanes); + if (alternate !== null) alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + } else if (alternate !== null && !isSubsetOfLanes(alternate.childLanes, renderLanes)) alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); + else break; + node = node.return; + } + } + function propagateContextChange(workInProgress, context, changedBits, renderLanes) { + var fiber = workInProgress.child; + if (fiber !== null) // Set the return pointer of the child to the work-in-progress fiber. + fiber.return = workInProgress; + while(fiber !== null){ + var nextFiber = void 0; // Visit this fiber. + var list = fiber.dependencies; + if (list !== null) { + nextFiber = fiber.child; + var dependency = list.firstContext; + while(dependency !== null){ + // Check if the context matches. + if (dependency.context === context && (dependency.observedBits & changedBits) !== 0) { + // Match! Schedule an update on this fiber. + if (fiber.tag === ClassComponent) { + // Schedule a force update on the work-in-progress. + var update = createUpdate(NoTimestamp, pickArbitraryLane(renderLanes)); + update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the + // update to the current fiber, too, which means it will persist even if + // this render is thrown away. Since it's a race condition, not sure it's + // worth fixing. + enqueueUpdate(fiber, update); + } + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + if (alternate !== null) alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + scheduleWorkOnParentPath(fiber.return, renderLanes); // Mark the updated lanes on the list, too. + list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the + break; + } + dependency = dependency.next; + } + } else if (fiber.tag === ContextProvider) // Don't scan deeper if this is a matching provider + nextFiber = fiber.type === workInProgress.type ? null : fiber.child; + else // Traverse down. + nextFiber = fiber.child; + if (nextFiber !== null) // Set the return pointer of the child to the work-in-progress fiber. + nextFiber.return = fiber; + else { + // No child. Traverse to next sibling. + nextFiber = fiber; + while(nextFiber !== null){ + if (nextFiber === workInProgress) { + // We're back to the root of this subtree. Exit. + nextFiber = null; + break; + } + var sibling = nextFiber.sibling; + if (sibling !== null) { + // Set the return pointer of the sibling to the work-in-progress fiber. + sibling.return = nextFiber.return; + nextFiber = sibling; + break; + } // No more siblings. Traverse up. + nextFiber = nextFiber.return; + } + } + fiber = nextFiber; + } + } + function prepareToReadContext(workInProgress, renderLanes) { + currentlyRenderingFiber = workInProgress; + lastContextDependency = null; + lastContextWithAllBitsObserved = null; + var dependencies = workInProgress.dependencies; + if (dependencies !== null) { + var firstContext = dependencies.firstContext; + if (firstContext !== null) { + if (includesSomeLane(dependencies.lanes, renderLanes)) // Context list has a pending update. Mark that this fiber performed work. + markWorkInProgressReceivedUpdate(); + // Reset the work-in-progress list + dependencies.firstContext = null; + } + } + } + function readContext(context, observedBits) { + // This warning would fire if you read context inside a Hook like useMemo. + // Unlike the class check below, it's not enforced in production for perf. + if (isDisallowedContextReadInDEV) error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."); + if (lastContextWithAllBitsObserved === context) ; + else if (observedBits === false || observedBits === 0) ; + else { + var resolvedObservedBits; // Avoid deopting on observable arguments or heterogeneous types. + if (typeof observedBits !== "number" || observedBits === MAX_SIGNED_31_BIT_INT) { + // Observe all updates. + lastContextWithAllBitsObserved = context; + resolvedObservedBits = MAX_SIGNED_31_BIT_INT; + } else resolvedObservedBits = observedBits; + var contextItem = { + context: context, + observedBits: resolvedObservedBits, + next: null + }; + if (lastContextDependency === null) { + if (!(currentlyRenderingFiber !== null)) throw Error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."); + // This is the first dependency for this component. Create a new list. + lastContextDependency = contextItem; + currentlyRenderingFiber.dependencies = { + lanes: NoLanes, + firstContext: contextItem, + responders: null + }; + } else // Append a new context item. + lastContextDependency = lastContextDependency.next = contextItem; + } + return context._currentValue; + } + var UpdateState = 0; + var ReplaceState = 1; + var ForceUpdate = 2; + var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. + // It should only be read right after calling `processUpdateQueue`, via + // `checkHasForceUpdateAfterProcessing`. + var hasForceUpdate = false; + var didWarnUpdateInsideUpdate; + var currentlyProcessingQueue; + didWarnUpdateInsideUpdate = false; + currentlyProcessingQueue = null; + function initializeUpdateQueue(fiber) { + var queue = { + baseState: fiber.memoizedState, + firstBaseUpdate: null, + lastBaseUpdate: null, + shared: { + pending: null + }, + effects: null + }; + fiber.updateQueue = queue; + } + function cloneUpdateQueue(current, workInProgress) { + // Clone the update queue from current. Unless it's already a clone. + var queue = workInProgress.updateQueue; + var currentQueue = current.updateQueue; + if (queue === currentQueue) { + var clone = { + baseState: currentQueue.baseState, + firstBaseUpdate: currentQueue.firstBaseUpdate, + lastBaseUpdate: currentQueue.lastBaseUpdate, + shared: currentQueue.shared, + effects: currentQueue.effects + }; + workInProgress.updateQueue = clone; + } + } + function createUpdate(eventTime, lane) { + var update = { + eventTime: eventTime, + lane: lane, + tag: UpdateState, + payload: null, + callback: null, + next: null + }; + return update; + } + function enqueueUpdate(fiber, update) { + var updateQueue = fiber.updateQueue; + if (updateQueue === null) // Only occurs if the fiber has been unmounted. + return; + var sharedQueue = updateQueue.shared; + var pending = sharedQueue.pending; + if (pending === null) // This is the first update. Create a circular list. + update.next = update; + else { + update.next = pending.next; + pending.next = update; + } + sharedQueue.pending = update; + if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) { + error("An update (setState, replaceState, or forceUpdate) was scheduled from inside an update function. Update functions should be pure, with zero side-effects. Consider using componentDidUpdate or a callback."); + didWarnUpdateInsideUpdate = true; + } + } + function enqueueCapturedUpdate(workInProgress, capturedUpdate) { + // Captured updates are updates that are thrown by a child during the render + // phase. They should be discarded if the render is aborted. Therefore, + // we should only put them on the work-in-progress queue, not the current one. + var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. + var current = workInProgress.alternate; + if (current !== null) { + var currentQueue = current.updateQueue; + if (queue === currentQueue) { + // The work-in-progress queue is the same as current. This happens when + // we bail out on a parent fiber that then captures an error thrown by + // a child. Since we want to append the update only to the work-in + // -progress queue, we need to clone the updates. We usually clone during + // processUpdateQueue, but that didn't happen in this case because we + // skipped over the parent when we bailed out. + var newFirst = null; + var newLast = null; + var firstBaseUpdate = queue.firstBaseUpdate; + if (firstBaseUpdate !== null) { + // Loop through the updates and clone them. + var update = firstBaseUpdate; + do { + var clone = { + eventTime: update.eventTime, + lane: update.lane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + if (newLast === null) newFirst = newLast = clone; + else { + newLast.next = clone; + newLast = clone; + } + update = update.next; + }while (update !== null); // Append the captured update the end of the cloned list. + if (newLast === null) newFirst = newLast = capturedUpdate; + else { + newLast.next = capturedUpdate; + newLast = capturedUpdate; + } + } else // There are no base updates. + newFirst = newLast = capturedUpdate; + queue = { + baseState: currentQueue.baseState, + firstBaseUpdate: newFirst, + lastBaseUpdate: newLast, + shared: currentQueue.shared, + effects: currentQueue.effects + }; + workInProgress.updateQueue = queue; + return; + } + } // Append the update to the end of the list. + var lastBaseUpdate = queue.lastBaseUpdate; + if (lastBaseUpdate === null) queue.firstBaseUpdate = capturedUpdate; + else lastBaseUpdate.next = capturedUpdate; + queue.lastBaseUpdate = capturedUpdate; + } + function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) { + switch(update.tag){ + case ReplaceState: + var payload = update.payload; + if (typeof payload === "function") { + enterDisallowedContextReadInDEV(); + var nextState = payload.call(instance, prevState, nextProps); + if (workInProgress.mode & StrictMode) { + disableLogs(); + try { + payload.call(instance, prevState, nextProps); + } finally{ + reenableLogs(); + } + } + exitDisallowedContextReadInDEV(); + return nextState; + } // State object + return payload; + case CaptureUpdate: + workInProgress.flags = workInProgress.flags & ~ShouldCapture | DidCapture; + // Intentional fallthrough + case UpdateState: + var _payload = update.payload; + var partialState; + if (typeof _payload === "function") { + enterDisallowedContextReadInDEV(); + partialState = _payload.call(instance, prevState, nextProps); + if (workInProgress.mode & StrictMode) { + disableLogs(); + try { + _payload.call(instance, prevState, nextProps); + } finally{ + reenableLogs(); + } + } + exitDisallowedContextReadInDEV(); + } else // Partial state object + partialState = _payload; + if (partialState === null || partialState === undefined) // Null and undefined are treated as no-ops. + return prevState; + // Merge the partial state and the previous state. + return _assign({}, prevState, partialState); + case ForceUpdate: + hasForceUpdate = true; + return prevState; + } + return prevState; + } + function processUpdateQueue(workInProgress, props, instance, renderLanes) { + // This is always non-null on a ClassComponent or HostRoot + var queue = workInProgress.updateQueue; + hasForceUpdate = false; + currentlyProcessingQueue = queue.shared; + var firstBaseUpdate = queue.firstBaseUpdate; + var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. + var pendingQueue = queue.shared.pending; + if (pendingQueue !== null) { + queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first + // and last so that it's non-circular. + var lastPendingUpdate = pendingQueue; + var firstPendingUpdate = lastPendingUpdate.next; + lastPendingUpdate.next = null; // Append pending updates to base queue + if (lastBaseUpdate === null) firstBaseUpdate = firstPendingUpdate; + else lastBaseUpdate.next = firstPendingUpdate; + lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then + // we need to transfer the updates to that queue, too. Because the base + // queue is a singly-linked list with no cycles, we can append to both + // lists and take advantage of structural sharing. + // TODO: Pass `current` as argument + var current = workInProgress.alternate; + if (current !== null) { + // This is always non-null on a ClassComponent or HostRoot + var currentQueue = current.updateQueue; + var currentLastBaseUpdate = currentQueue.lastBaseUpdate; + if (currentLastBaseUpdate !== lastBaseUpdate) { + if (currentLastBaseUpdate === null) currentQueue.firstBaseUpdate = firstPendingUpdate; + else currentLastBaseUpdate.next = firstPendingUpdate; + currentQueue.lastBaseUpdate = lastPendingUpdate; + } + } + } // These values may change as we process the queue. + if (firstBaseUpdate !== null) { + // Iterate through the list of updates to compute the result. + var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes + // from the original lanes. + var newLanes = NoLanes; + var newBaseState = null; + var newFirstBaseUpdate = null; + var newLastBaseUpdate = null; + var update = firstBaseUpdate; + do { + var updateLane = update.lane; + var updateEventTime = update.eventTime; + if (!isSubsetOfLanes(renderLanes, updateLane)) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + eventTime: updateEventTime, + lane: updateLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + if (newLastBaseUpdate === null) { + newFirstBaseUpdate = newLastBaseUpdate = clone; + newBaseState = newState; + } else newLastBaseUpdate = newLastBaseUpdate.next = clone; + // Update the remaining priority in the queue. + newLanes = mergeLanes(newLanes, updateLane); + } else { + // This update does have sufficient priority. + if (newLastBaseUpdate !== null) { + var _clone = { + eventTime: updateEventTime, + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + tag: update.tag, + payload: update.payload, + callback: update.callback, + next: null + }; + newLastBaseUpdate = newLastBaseUpdate.next = _clone; + } // Process this update. + newState = getStateFromUpdate(workInProgress, queue, update, newState, props, instance); + var callback = update.callback; + if (callback !== null) { + workInProgress.flags |= Callback; + var effects = queue.effects; + if (effects === null) queue.effects = [ + update + ]; + else effects.push(update); + } + } + update = update.next; + if (update === null) { + pendingQueue = queue.shared.pending; + if (pendingQueue === null) break; + else { + // An update was scheduled from inside a reducer. Add the new + // pending updates to the end of the list and keep processing. + var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we + // unravel them when transferring them to the base queue. + var _firstPendingUpdate = _lastPendingUpdate.next; + _lastPendingUpdate.next = null; + update = _firstPendingUpdate; + queue.lastBaseUpdate = _lastPendingUpdate; + queue.shared.pending = null; + } + } + }while (true); + if (newLastBaseUpdate === null) newBaseState = newState; + queue.baseState = newBaseState; + queue.firstBaseUpdate = newFirstBaseUpdate; + queue.lastBaseUpdate = newLastBaseUpdate; // Set the remaining expiration time to be whatever is remaining in the queue. + // This should be fine because the only two other things that contribute to + // expiration time are props and context. We're already in the middle of the + // begin phase by the time we start processing the queue, so we've already + // dealt with the props. Context in components that specify + // shouldComponentUpdate is tricky; but we'll have to account for + // that regardless. + markSkippedUpdateLanes(newLanes); + workInProgress.lanes = newLanes; + workInProgress.memoizedState = newState; + } + currentlyProcessingQueue = null; + } + function callCallback(callback, context) { + if (!(typeof callback === "function")) throw Error("Invalid argument passed as callback. Expected a function. Instead received: " + callback); + callback.call(context); + } + function resetHasForceUpdateBeforeProcessing() { + hasForceUpdate = false; + } + function checkHasForceUpdateAfterProcessing() { + return hasForceUpdate; + } + function commitUpdateQueue(finishedWork, finishedQueue, instance) { + // Commit the effects + var effects = finishedQueue.effects; + finishedQueue.effects = null; + if (effects !== null) for(var i = 0; i < effects.length; i++){ + var effect = effects[i]; + var callback = effect.callback; + if (callback !== null) { + effect.callback = null; + callCallback(callback, instance); + } + } + } + var fakeInternalInstance = {}; + var isArray = Array.isArray; // React.Component uses a shared frozen object by default. + // We'll use it to determine whether we need to initialize legacy refs. + var emptyRefsObject = new React.Component().refs; + var didWarnAboutStateAssignmentForComponent; + var didWarnAboutUninitializedState; + var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate; + var didWarnAboutLegacyLifecyclesAndDerivedState; + var didWarnAboutUndefinedDerivedState; + var warnOnUndefinedDerivedState; + var warnOnInvalidCallback; + var didWarnAboutDirectlyAssigningPropsToState; + var didWarnAboutContextTypeAndContextTypes; + var didWarnAboutInvalidateContextType; + didWarnAboutStateAssignmentForComponent = new Set(); + didWarnAboutUninitializedState = new Set(); + didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set(); + didWarnAboutLegacyLifecyclesAndDerivedState = new Set(); + didWarnAboutDirectlyAssigningPropsToState = new Set(); + didWarnAboutUndefinedDerivedState = new Set(); + didWarnAboutContextTypeAndContextTypes = new Set(); + didWarnAboutInvalidateContextType = new Set(); + var didWarnOnInvalidCallback = new Set(); + warnOnInvalidCallback = function(callback, callerName) { + if (callback === null || typeof callback === "function") return; + var key = callerName + "_" + callback; + if (!didWarnOnInvalidCallback.has(key)) { + didWarnOnInvalidCallback.add(key); + error("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", callerName, callback); + } + }; + warnOnUndefinedDerivedState = function(type, partialState) { + if (partialState === undefined) { + var componentName = getComponentName(type) || "Component"; + if (!didWarnAboutUndefinedDerivedState.has(componentName)) { + didWarnAboutUndefinedDerivedState.add(componentName); + error("%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. You have returned undefined.", componentName); + } + } + }; // This is so gross but it's at least non-critical and can be removed if + // it causes problems. This is meant to give a nicer error message for + // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component, + // ...)) which otherwise throws a "_processChildContext is not a function" + // exception. + Object.defineProperty(fakeInternalInstance, "_processChildContext", { + enumerable: false, + value: function() { + throw Error("_processChildContext is not available in React 16+. This likely means you have multiple copies of React and are attempting to nest a React 15 tree inside a React 16 tree using unstable_renderSubtreeIntoContainer, which isn't supported. Try to make sure you have only one copy of React (and ideally, switch to ReactDOM.createPortal)."); + } + }); + Object.freeze(fakeInternalInstance); + function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) { + var prevState = workInProgress.memoizedState; + if (workInProgress.mode & StrictMode) { + disableLogs(); + try { + // Invoke the function an extra time to help detect side-effects. + getDerivedStateFromProps(nextProps, prevState); + } finally{ + reenableLogs(); + } + } + var partialState = getDerivedStateFromProps(nextProps, prevState); + warnOnUndefinedDerivedState(ctor, partialState); + var memoizedState = partialState === null || partialState === undefined ? prevState : _assign({}, prevState, partialState); + workInProgress.memoizedState = memoizedState; // Once the update queue is empty, persist the derived state onto the + // base state. + if (workInProgress.lanes === NoLanes) { + // Queue is always non-null for classes + var updateQueue = workInProgress.updateQueue; + updateQueue.baseState = memoizedState; + } + } + var classComponentUpdater = { + isMounted: isMounted, + enqueueSetState: function(inst, payload, callback) { + var fiber = get(inst); + var eventTime = requestEventTime(); + var lane = requestUpdateLane(fiber); + var update = createUpdate(eventTime, lane); + update.payload = payload; + if (callback !== undefined && callback !== null) { + warnOnInvalidCallback(callback, "setState"); + update.callback = callback; + } + enqueueUpdate(fiber, update); + scheduleUpdateOnFiber(fiber, lane, eventTime); + }, + enqueueReplaceState: function(inst, payload, callback) { + var fiber = get(inst); + var eventTime = requestEventTime(); + var lane = requestUpdateLane(fiber); + var update = createUpdate(eventTime, lane); + update.tag = ReplaceState; + update.payload = payload; + if (callback !== undefined && callback !== null) { + warnOnInvalidCallback(callback, "replaceState"); + update.callback = callback; + } + enqueueUpdate(fiber, update); + scheduleUpdateOnFiber(fiber, lane, eventTime); + }, + enqueueForceUpdate: function(inst, callback) { + var fiber = get(inst); + var eventTime = requestEventTime(); + var lane = requestUpdateLane(fiber); + var update = createUpdate(eventTime, lane); + update.tag = ForceUpdate; + if (callback !== undefined && callback !== null) { + warnOnInvalidCallback(callback, "forceUpdate"); + update.callback = callback; + } + enqueueUpdate(fiber, update); + scheduleUpdateOnFiber(fiber, lane, eventTime); + } + }; + function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) { + var instance = workInProgress.stateNode; + if (typeof instance.shouldComponentUpdate === "function") { + if (workInProgress.mode & StrictMode) { + disableLogs(); + try { + // Invoke the function an extra time to help detect side-effects. + instance.shouldComponentUpdate(newProps, newState, nextContext); + } finally{ + reenableLogs(); + } + } + var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext); + if (shouldUpdate === undefined) error("%s.shouldComponentUpdate(): Returned undefined instead of a boolean value. Make sure to return true or false.", getComponentName(ctor) || "Component"); + return shouldUpdate; + } + if (ctor.prototype && ctor.prototype.isPureReactComponent) return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState); + return true; + } + function checkClassInstance(workInProgress, ctor, newProps) { + var instance = workInProgress.stateNode; + var name = getComponentName(ctor) || "Component"; + var renderPresent = instance.render; + if (!renderPresent) { + if (ctor.prototype && typeof ctor.prototype.render === "function") error("%s(...): No `render` method found on the returned component instance: did you accidentally return an object from the constructor?", name); + else error("%s(...): No `render` method found on the returned component instance: you may have forgotten to define `render`.", name); + } + if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) error("getInitialState was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Did you mean to define a state property instead?", name); + if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) error("getDefaultProps was defined on %s, a plain JavaScript class. This is only supported for classes created using React.createClass. Use a static property to define defaultProps instead.", name); + if (instance.propTypes) error("propTypes was defined as an instance property on %s. Use a static property to define propTypes instead.", name); + if (instance.contextType) error("contextType was defined as an instance property on %s. Use a static property to define contextType instead.", name); + if (instance.contextTypes) error("contextTypes was defined as an instance property on %s. Use a static property to define contextTypes instead.", name); + if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) { + didWarnAboutContextTypeAndContextTypes.add(ctor); + error("%s declares both contextTypes and contextType static properties. The legacy contextTypes property will be ignored.", name); + } + if (typeof instance.componentShouldUpdate === "function") error("%s has a method called componentShouldUpdate(). Did you mean shouldComponentUpdate()? The name is phrased as a question because the function is expected to return a value.", name); + if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== "undefined") error("%s has a method called shouldComponentUpdate(). shouldComponentUpdate should not be used when extending React.PureComponent. Please extend React.Component if shouldComponentUpdate is used.", getComponentName(ctor) || "A pure component"); + if (typeof instance.componentDidUnmount === "function") error("%s has a method called componentDidUnmount(). But there is no such lifecycle method. Did you mean componentWillUnmount()?", name); + if (typeof instance.componentDidReceiveProps === "function") error("%s has a method called componentDidReceiveProps(). But there is no such lifecycle method. If you meant to update the state in response to changing props, use componentWillReceiveProps(). If you meant to fetch data or run side-effects or mutations after React has updated the UI, use componentDidUpdate().", name); + if (typeof instance.componentWillRecieveProps === "function") error("%s has a method called componentWillRecieveProps(). Did you mean componentWillReceiveProps()?", name); + if (typeof instance.UNSAFE_componentWillRecieveProps === "function") error("%s has a method called UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?", name); + var hasMutatedProps = instance.props !== newProps; + if (instance.props !== undefined && hasMutatedProps) error("%s(...): When calling super() in `%s`, make sure to pass up the same props that your component's constructor was passed.", name, name); + if (instance.defaultProps) error("Setting defaultProps as an instance property on %s is not supported and will be ignored. Instead, define defaultProps as a static property on %s.", name, name); + if (typeof instance.getSnapshotBeforeUpdate === "function" && typeof instance.componentDidUpdate !== "function" && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) { + didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor); + error("%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). This component defines getSnapshotBeforeUpdate() only.", getComponentName(ctor)); + } + if (typeof instance.getDerivedStateFromProps === "function") error("%s: getDerivedStateFromProps() is defined as an instance method and will be ignored. Instead, declare it as a static method.", name); + if (typeof instance.getDerivedStateFromError === "function") error("%s: getDerivedStateFromError() is defined as an instance method and will be ignored. Instead, declare it as a static method.", name); + if (typeof ctor.getSnapshotBeforeUpdate === "function") error("%s: getSnapshotBeforeUpdate() is defined as a static method and will be ignored. Instead, declare it as an instance method.", name); + var _state = instance.state; + if (_state && (typeof _state !== "object" || isArray(_state))) error("%s.state: must be set to an object or null", name); + if (typeof instance.getChildContext === "function" && typeof ctor.childContextTypes !== "object") error("%s.getChildContext(): childContextTypes must be defined in order to use getChildContext().", name); + } + function adoptClassInstance(workInProgress, instance) { + instance.updater = classComponentUpdater; + workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates + set(instance, workInProgress); + instance._reactInternalInstance = fakeInternalInstance; + } + function constructClassInstance(workInProgress, ctor, props) { + var isLegacyContextConsumer = false; + var unmaskedContext = emptyContextObject; + var context = emptyContextObject; + var contextType = ctor.contextType; + if ("contextType" in ctor) { + var isValid = contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a + if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) { + didWarnAboutInvalidateContextType.add(ctor); + var addendum = ""; + if (contextType === undefined) addendum = " However, it is set to undefined. This can be caused by a typo or by mixing up named and default imports. This can also happen due to a circular dependency, so try moving the createContext() call to a separate file."; + else if (typeof contextType !== "object") addendum = " However, it is set to a " + typeof contextType + "."; + else if (contextType.$$typeof === REACT_PROVIDER_TYPE) addendum = " Did you accidentally pass the Context.Provider instead?"; + else if (contextType._context !== undefined) // + addendum = " Did you accidentally pass the Context.Consumer instead?"; + else addendum = " However, it is set to an object with keys {" + Object.keys(contextType).join(", ") + "}."; + error("%s defines an invalid contextType. contextType should point to the Context object returned by React.createContext().%s", getComponentName(ctor) || "Component", addendum); + } + } + if (typeof contextType === "object" && contextType !== null) context = readContext(contextType); + else { + unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); + var contextTypes = ctor.contextTypes; + isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined; + context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject; + } // Instantiate twice to help detect side-effects. + if (workInProgress.mode & StrictMode) { + disableLogs(); + try { + new ctor(props, context); // eslint-disable-line no-new + } finally{ + reenableLogs(); + } + } + var instance = new ctor(props, context); + var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null; + adoptClassInstance(workInProgress, instance); + if (typeof ctor.getDerivedStateFromProps === "function" && state === null) { + var componentName = getComponentName(ctor) || "Component"; + if (!didWarnAboutUninitializedState.has(componentName)) { + didWarnAboutUninitializedState.add(componentName); + error("`%s` uses `getDerivedStateFromProps` but its initial state is %s. This is not recommended. Instead, define the initial state by assigning an object to `this.state` in the constructor of `%s`. This ensures that `getDerivedStateFromProps` arguments have a consistent shape.", componentName, instance.state === null ? "null" : "undefined", componentName); + } + } // If new component APIs are defined, "unsafe" lifecycles won't be called. + // Warn about these lifecycles if they are present. + // Don't warn about react-lifecycles-compat polyfilled methods though. + if (typeof ctor.getDerivedStateFromProps === "function" || typeof instance.getSnapshotBeforeUpdate === "function") { + var foundWillMountName = null; + var foundWillReceivePropsName = null; + var foundWillUpdateName = null; + if (typeof instance.componentWillMount === "function" && instance.componentWillMount.__suppressDeprecationWarning !== true) foundWillMountName = "componentWillMount"; + else if (typeof instance.UNSAFE_componentWillMount === "function") foundWillMountName = "UNSAFE_componentWillMount"; + if (typeof instance.componentWillReceiveProps === "function" && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) foundWillReceivePropsName = "componentWillReceiveProps"; + else if (typeof instance.UNSAFE_componentWillReceiveProps === "function") foundWillReceivePropsName = "UNSAFE_componentWillReceiveProps"; + if (typeof instance.componentWillUpdate === "function" && instance.componentWillUpdate.__suppressDeprecationWarning !== true) foundWillUpdateName = "componentWillUpdate"; + else if (typeof instance.UNSAFE_componentWillUpdate === "function") foundWillUpdateName = "UNSAFE_componentWillUpdate"; + if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) { + var _componentName = getComponentName(ctor) || "Component"; + var newApiName = typeof ctor.getDerivedStateFromProps === "function" ? "getDerivedStateFromProps()" : "getSnapshotBeforeUpdate()"; + if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) { + didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName); + error("Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\nThe above lifecycles should be removed. Learn more about this warning here:\nhttps://reactjs.org/link/unsafe-component-lifecycles", _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : "", foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : "", foundWillUpdateName !== null ? "\n " + foundWillUpdateName : ""); + } + } + } + // ReactFiberContext usually updates this cache but can't for newly-created instances. + if (isLegacyContextConsumer) cacheContext(workInProgress, unmaskedContext, context); + return instance; + } + function callComponentWillMount(workInProgress, instance) { + var oldState = instance.state; + if (typeof instance.componentWillMount === "function") instance.componentWillMount(); + if (typeof instance.UNSAFE_componentWillMount === "function") instance.UNSAFE_componentWillMount(); + if (oldState !== instance.state) { + error("%s.componentWillMount(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", getComponentName(workInProgress.type) || "Component"); + classComponentUpdater.enqueueReplaceState(instance, instance.state, null); + } + } + function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) { + var oldState = instance.state; + if (typeof instance.componentWillReceiveProps === "function") instance.componentWillReceiveProps(newProps, nextContext); + if (typeof instance.UNSAFE_componentWillReceiveProps === "function") instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); + if (instance.state !== oldState) { + var componentName = getComponentName(workInProgress.type) || "Component"; + if (!didWarnAboutStateAssignmentForComponent.has(componentName)) { + didWarnAboutStateAssignmentForComponent.add(componentName); + error("%s.componentWillReceiveProps(): Assigning directly to this.state is deprecated (except inside a component's constructor). Use setState instead.", componentName); + } + classComponentUpdater.enqueueReplaceState(instance, instance.state, null); + } + } // Invokes the mount life-cycles on a previously never rendered instance. + function mountClassInstance(workInProgress, ctor, newProps, renderLanes) { + checkClassInstance(workInProgress, ctor, newProps); + var instance = workInProgress.stateNode; + instance.props = newProps; + instance.state = workInProgress.memoizedState; + instance.refs = emptyRefsObject; + initializeUpdateQueue(workInProgress); + var contextType = ctor.contextType; + if (typeof contextType === "object" && contextType !== null) instance.context = readContext(contextType); + else { + var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); + instance.context = getMaskedContext(workInProgress, unmaskedContext); + } + if (instance.state === newProps) { + var componentName = getComponentName(ctor) || "Component"; + if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) { + didWarnAboutDirectlyAssigningPropsToState.add(componentName); + error("%s: It is not recommended to assign props directly to state because updates to props won't be reflected in state. In most cases, it is better to use props directly.", componentName); + } + } + if (workInProgress.mode & StrictMode) ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance); + ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance); + processUpdateQueue(workInProgress, newProps, instance, renderLanes); + instance.state = workInProgress.memoizedState; + var getDerivedStateFromProps = ctor.getDerivedStateFromProps; + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); + instance.state = workInProgress.memoizedState; + } // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if (typeof ctor.getDerivedStateFromProps !== "function" && typeof instance.getSnapshotBeforeUpdate !== "function" && (typeof instance.UNSAFE_componentWillMount === "function" || typeof instance.componentWillMount === "function")) { + callComponentWillMount(workInProgress, instance); // If we had additional state updates during this life-cycle, let's + // process them now. + processUpdateQueue(workInProgress, newProps, instance, renderLanes); + instance.state = workInProgress.memoizedState; + } + if (typeof instance.componentDidMount === "function") workInProgress.flags |= Update; + } + function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) { + var instance = workInProgress.stateNode; + var oldProps = workInProgress.memoizedProps; + instance.props = oldProps; + var oldContext = instance.context; + var contextType = ctor.contextType; + var nextContext = emptyContextObject; + if (typeof contextType === "object" && contextType !== null) nextContext = readContext(contextType); + else { + var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); + nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext); + } + var getDerivedStateFromProps = ctor.getDerivedStateFromProps; + var hasNewLifecycles = typeof getDerivedStateFromProps === "function" || typeof instance.getSnapshotBeforeUpdate === "function"; // Note: During these life-cycles, instance.props/instance.state are what + // ever the previously attempted to render - not the "current". However, + // during componentDidUpdate we pass the "current" props. + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === "function" || typeof instance.componentWillReceiveProps === "function")) { + if (oldProps !== newProps || oldContext !== nextContext) callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); + } + resetHasForceUpdateBeforeProcessing(); + var oldState = workInProgress.memoizedState; + var newState = instance.state = oldState; + processUpdateQueue(workInProgress, newProps, instance, renderLanes); + newState = workInProgress.memoizedState; + if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidMount === "function") workInProgress.flags |= Update; + return false; + } + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); + newState = workInProgress.memoizedState; + } + var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); + if (shouldUpdate) { + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === "function" || typeof instance.componentWillMount === "function")) { + if (typeof instance.componentWillMount === "function") instance.componentWillMount(); + if (typeof instance.UNSAFE_componentWillMount === "function") instance.UNSAFE_componentWillMount(); + } + if (typeof instance.componentDidMount === "function") workInProgress.flags |= Update; + } else { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidMount === "function") workInProgress.flags |= Update; + // If shouldComponentUpdate returned false, we should still update the + // memoized state to indicate that this work can be reused. + workInProgress.memoizedProps = newProps; + workInProgress.memoizedState = newState; + } // Update the existing instance's state, props, and context pointers even + // if shouldComponentUpdate returns false. + instance.props = newProps; + instance.state = newState; + instance.context = nextContext; + return shouldUpdate; + } // Invokes the update life-cycles and returns false if it shouldn't rerender. + function updateClassInstance(current, workInProgress, ctor, newProps, renderLanes) { + var instance = workInProgress.stateNode; + cloneUpdateQueue(current, workInProgress); + var unresolvedOldProps = workInProgress.memoizedProps; + var oldProps = workInProgress.type === workInProgress.elementType ? unresolvedOldProps : resolveDefaultProps(workInProgress.type, unresolvedOldProps); + instance.props = oldProps; + var unresolvedNewProps = workInProgress.pendingProps; + var oldContext = instance.context; + var contextType = ctor.contextType; + var nextContext = emptyContextObject; + if (typeof contextType === "object" && contextType !== null) nextContext = readContext(contextType); + else { + var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); + nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); + } + var getDerivedStateFromProps = ctor.getDerivedStateFromProps; + var hasNewLifecycles = typeof getDerivedStateFromProps === "function" || typeof instance.getSnapshotBeforeUpdate === "function"; // Note: During these life-cycles, instance.props/instance.state are what + // ever the previously attempted to render - not the "current". However, + // during componentDidUpdate we pass the "current" props. + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === "function" || typeof instance.componentWillReceiveProps === "function")) { + if (unresolvedOldProps !== unresolvedNewProps || oldContext !== nextContext) callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); + } + resetHasForceUpdateBeforeProcessing(); + var oldState = workInProgress.memoizedState; + var newState = instance.state = oldState; + processUpdateQueue(workInProgress, newProps, instance, renderLanes); + newState = workInProgress.memoizedState; + if (unresolvedOldProps === unresolvedNewProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidUpdate === "function") { + if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) workInProgress.flags |= Update; + } + if (typeof instance.getSnapshotBeforeUpdate === "function") { + if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) workInProgress.flags |= Snapshot; + } + return false; + } + if (typeof getDerivedStateFromProps === "function") { + applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); + newState = workInProgress.memoizedState; + } + var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); + if (shouldUpdate) { + // In order to support react-lifecycles-compat polyfilled components, + // Unsafe lifecycles should not be invoked for components using the new APIs. + if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === "function" || typeof instance.componentWillUpdate === "function")) { + if (typeof instance.componentWillUpdate === "function") instance.componentWillUpdate(newProps, newState, nextContext); + if (typeof instance.UNSAFE_componentWillUpdate === "function") instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext); + } + if (typeof instance.componentDidUpdate === "function") workInProgress.flags |= Update; + if (typeof instance.getSnapshotBeforeUpdate === "function") workInProgress.flags |= Snapshot; + } else { + // If an update was already in progress, we should schedule an Update + // effect even though we're bailing out, so that cWU/cDU are called. + if (typeof instance.componentDidUpdate === "function") { + if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) workInProgress.flags |= Update; + } + if (typeof instance.getSnapshotBeforeUpdate === "function") { + if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) workInProgress.flags |= Snapshot; + } // If shouldComponentUpdate returned false, we should still update the + // memoized props/state to indicate that this work can be reused. + workInProgress.memoizedProps = newProps; + workInProgress.memoizedState = newState; + } // Update the existing instance's state, props, and context pointers even + // if shouldComponentUpdate returns false. + instance.props = newProps; + instance.state = newState; + instance.context = nextContext; + return shouldUpdate; + } + var didWarnAboutMaps; + var didWarnAboutGenerators; + var didWarnAboutStringRefs; + var ownerHasKeyUseWarning; + var ownerHasFunctionTypeWarning; + var warnForMissingKey = function(child, returnFiber) {}; + didWarnAboutMaps = false; + didWarnAboutGenerators = false; + didWarnAboutStringRefs = {}; + /** + * Warn if there's no key explicitly set on dynamic arrays of children or + * object keys are not valid. This allows us to keep track of children between + * updates. + */ ownerHasKeyUseWarning = {}; + ownerHasFunctionTypeWarning = {}; + warnForMissingKey = function(child, returnFiber) { + if (child === null || typeof child !== "object") return; + if (!child._store || child._store.validated || child.key != null) return; + if (!(typeof child._store === "object")) throw Error("React Component in warnForMissingKey should have a _store. This error is likely caused by a bug in React. Please file an issue."); + child._store.validated = true; + var componentName = getComponentName(returnFiber.type) || "Component"; + if (ownerHasKeyUseWarning[componentName]) return; + ownerHasKeyUseWarning[componentName] = true; + error('Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.'); + }; + var isArray$1 = Array.isArray; + function coerceRef(returnFiber, current, element) { + var mixedRef = element.ref; + if (mixedRef !== null && typeof mixedRef !== "function" && typeof mixedRef !== "object") { + // TODO: Clean this up once we turn on the string ref warning for + // everyone, because the strict mode case will no longer be relevant + if ((returnFiber.mode & StrictMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs + // because these cannot be automatically converted to an arrow function + // using a codemod. Therefore, we don't have to warn about string refs again. + !(element._owner && element._self && element._owner.stateNode !== element._self)) { + var componentName = getComponentName(returnFiber.type) || "Component"; + if (!didWarnAboutStringRefs[componentName]) { + error('A string ref, "%s", has been found within a strict mode tree. String refs are a source of potential bugs and should be avoided. We recommend using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', mixedRef); + didWarnAboutStringRefs[componentName] = true; + } + } + if (element._owner) { + var owner = element._owner; + var inst; + if (owner) { + var ownerFiber = owner; + if (!(ownerFiber.tag === ClassComponent)) throw Error("Function components cannot have string refs. We recommend using useRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref"); + inst = ownerFiber.stateNode; + } + if (!inst) throw Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a bug in React. Please file an issue."); + var stringRef = "" + mixedRef; // Check if previous string ref matches new string ref + if (current !== null && current.ref !== null && typeof current.ref === "function" && current.ref._stringRef === stringRef) return current.ref; + var ref = function(value) { + var refs = inst.refs; + if (refs === emptyRefsObject) // This is a lazy pooled frozen object, so we need to initialize. + refs = inst.refs = {}; + if (value === null) delete refs[stringRef]; + else refs[stringRef] = value; + }; + ref._stringRef = stringRef; + return ref; + } else { + if (!(typeof mixedRef === "string")) throw Error("Expected ref to be a function, a string, an object returned by React.createRef(), or null."); + if (!element._owner) throw Error("Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a function component\n2. You may be adding a ref to a component that was not created inside a component's render method\n3. You have multiple copies of React loaded\nSee https://reactjs.org/link/refs-must-have-owner for more information."); + } + } + return mixedRef; + } + function throwOnInvalidObjectType(returnFiber, newChild) { + if (returnFiber.type !== "textarea") throw Error("Objects are not valid as a React child (found: " + (Object.prototype.toString.call(newChild) === "[object Object]" ? "object with keys {" + Object.keys(newChild).join(", ") + "}" : newChild) + "). If you meant to render a collection of children, use an array instead."); + } + function warnOnFunctionType(returnFiber) { + var componentName = getComponentName(returnFiber.type) || "Component"; + if (ownerHasFunctionTypeWarning[componentName]) return; + ownerHasFunctionTypeWarning[componentName] = true; + error("Functions are not valid as a React child. This may happen if you return a Component instead of from render. Or maybe you meant to call this function rather than return it."); + } // We avoid inlining this to avoid potential deopts from using try/catch. + // to be able to optimize each path individually by branching early. This needs + // a compiler or we can do it manually. Helpers that don't need this branching + // live outside of this function. + function ChildReconciler(shouldTrackSideEffects) { + function deleteChild(returnFiber, childToDelete) { + if (!shouldTrackSideEffects) // Noop. + return; + // Deletions are added in reversed order so we add it to the front. + // At this point, the return fiber's effect list is empty except for + // deletions, so we can just append the deletion to the list. The remaining + // effects aren't added until the complete phase. Once we implement + // resuming, this may not be true. + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = childToDelete; + returnFiber.lastEffect = childToDelete; + } else returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; + childToDelete.nextEffect = null; + childToDelete.flags = Deletion; + } + function deleteRemainingChildren(returnFiber, currentFirstChild) { + if (!shouldTrackSideEffects) // Noop. + return null; + // TODO: For the shouldClone case, this could be micro-optimized a bit by + // assuming that after the first child we've already added everything. + var childToDelete = currentFirstChild; + while(childToDelete !== null){ + deleteChild(returnFiber, childToDelete); + childToDelete = childToDelete.sibling; + } + return null; + } + function mapRemainingChildren(returnFiber, currentFirstChild) { + // Add the remaining children to a temporary map so that we can find them by + // keys quickly. Implicit (null) keys get added to this set with their index + // instead. + var existingChildren = new Map(); + var existingChild = currentFirstChild; + while(existingChild !== null){ + if (existingChild.key !== null) existingChildren.set(existingChild.key, existingChild); + else existingChildren.set(existingChild.index, existingChild); + existingChild = existingChild.sibling; + } + return existingChildren; + } + function useFiber(fiber, pendingProps) { + // We currently set sibling to null and index to 0 here because it is easy + // to forget to do before returning it. E.g. for the single child case. + var clone = createWorkInProgress(fiber, pendingProps); + clone.index = 0; + clone.sibling = null; + return clone; + } + function placeChild(newFiber, lastPlacedIndex, newIndex) { + newFiber.index = newIndex; + if (!shouldTrackSideEffects) // Noop. + return lastPlacedIndex; + var current = newFiber.alternate; + if (current !== null) { + var oldIndex = current.index; + if (oldIndex < lastPlacedIndex) { + // This is a move. + newFiber.flags = Placement; + return lastPlacedIndex; + } else // This item can stay in place. + return oldIndex; + } else { + // This is an insertion. + newFiber.flags = Placement; + return lastPlacedIndex; + } + } + function placeSingleChild(newFiber) { + // This is simpler for the single child case. We only need to do a + // placement for inserting new children. + if (shouldTrackSideEffects && newFiber.alternate === null) newFiber.flags = Placement; + return newFiber; + } + function updateTextNode(returnFiber, current, textContent, lanes) { + if (current === null || current.tag !== HostText) { + // Insert + var created = createFiberFromText(textContent, returnFiber.mode, lanes); + created.return = returnFiber; + return created; + } else { + // Update + var existing = useFiber(current, textContent); + existing.return = returnFiber; + return existing; + } + } + function updateElement(returnFiber, current, element, lanes) { + if (current !== null) { + if (current.elementType === element.type || isCompatibleFamilyForHotReloading(current, element)) { + // Move based on index + var existing = useFiber(current, element.props); + existing.ref = coerceRef(returnFiber, current, element); + existing.return = returnFiber; + existing._debugSource = element._source; + existing._debugOwner = element._owner; + return existing; + } + } // Insert + var created = createFiberFromElement(element, returnFiber.mode, lanes); + created.ref = coerceRef(returnFiber, current, element); + created.return = returnFiber; + return created; + } + function updatePortal(returnFiber, current, portal, lanes) { + if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) { + // Insert + var created = createFiberFromPortal(portal, returnFiber.mode, lanes); + created.return = returnFiber; + return created; + } else { + // Update + var existing = useFiber(current, portal.children || []); + existing.return = returnFiber; + return existing; + } + } + function updateFragment(returnFiber, current, fragment, lanes, key) { + if (current === null || current.tag !== Fragment) { + // Insert + var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key); + created.return = returnFiber; + return created; + } else { + // Update + var existing = useFiber(current, fragment); + existing.return = returnFiber; + return existing; + } + } + function createChild(returnFiber, newChild, lanes) { + if (typeof newChild === "string" || typeof newChild === "number") { + // Text nodes don't have keys. If the previous node is implicitly keyed + // we can continue to replace it without aborting even if it is not a text + // node. + var created = createFiberFromText("" + newChild, returnFiber.mode, lanes); + created.return = returnFiber; + return created; + } + if (typeof newChild === "object" && newChild !== null) { + switch(newChild.$$typeof){ + case REACT_ELEMENT_TYPE: + var _created = createFiberFromElement(newChild, returnFiber.mode, lanes); + _created.ref = coerceRef(returnFiber, null, newChild); + _created.return = returnFiber; + return _created; + case REACT_PORTAL_TYPE: + var _created2 = createFiberFromPortal(newChild, returnFiber.mode, lanes); + _created2.return = returnFiber; + return _created2; + } + if (isArray$1(newChild) || getIteratorFn(newChild)) { + var _created3 = createFiberFromFragment(newChild, returnFiber.mode, lanes, null); + _created3.return = returnFiber; + return _created3; + } + throwOnInvalidObjectType(returnFiber, newChild); + } + if (typeof newChild === "function") warnOnFunctionType(returnFiber); + return null; + } + function updateSlot(returnFiber, oldFiber, newChild, lanes) { + // Update the fiber if the keys match, otherwise return null. + var key = oldFiber !== null ? oldFiber.key : null; + if (typeof newChild === "string" || typeof newChild === "number") { + // Text nodes don't have keys. If the previous node is implicitly keyed + // we can continue to replace it without aborting even if it is not a text + // node. + if (key !== null) return null; + return updateTextNode(returnFiber, oldFiber, "" + newChild, lanes); + } + if (typeof newChild === "object" && newChild !== null) { + switch(newChild.$$typeof){ + case REACT_ELEMENT_TYPE: + if (newChild.key === key) { + if (newChild.type === REACT_FRAGMENT_TYPE) return updateFragment(returnFiber, oldFiber, newChild.props.children, lanes, key); + return updateElement(returnFiber, oldFiber, newChild, lanes); + } else return null; + case REACT_PORTAL_TYPE: + if (newChild.key === key) return updatePortal(returnFiber, oldFiber, newChild, lanes); + else return null; + } + if (isArray$1(newChild) || getIteratorFn(newChild)) { + if (key !== null) return null; + return updateFragment(returnFiber, oldFiber, newChild, lanes, null); + } + throwOnInvalidObjectType(returnFiber, newChild); + } + if (typeof newChild === "function") warnOnFunctionType(returnFiber); + return null; + } + function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) { + if (typeof newChild === "string" || typeof newChild === "number") { + // Text nodes don't have keys, so we neither have to check the old nor + // new node for the key. If both are text nodes, they match. + var matchedFiber = existingChildren.get(newIdx) || null; + return updateTextNode(returnFiber, matchedFiber, "" + newChild, lanes); + } + if (typeof newChild === "object" && newChild !== null) { + switch(newChild.$$typeof){ + case REACT_ELEMENT_TYPE: + var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; + if (newChild.type === REACT_FRAGMENT_TYPE) return updateFragment(returnFiber, _matchedFiber, newChild.props.children, lanes, newChild.key); + return updateElement(returnFiber, _matchedFiber, newChild, lanes); + case REACT_PORTAL_TYPE: + var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; + return updatePortal(returnFiber, _matchedFiber2, newChild, lanes); + } + if (isArray$1(newChild) || getIteratorFn(newChild)) { + var _matchedFiber3 = existingChildren.get(newIdx) || null; + return updateFragment(returnFiber, _matchedFiber3, newChild, lanes, null); + } + throwOnInvalidObjectType(returnFiber, newChild); + } + if (typeof newChild === "function") warnOnFunctionType(returnFiber); + return null; + } + /** + * Warns if there is a duplicate or missing key + */ function warnOnInvalidKey(child, knownKeys, returnFiber) { + if (typeof child !== "object" || child === null) return knownKeys; + switch(child.$$typeof){ + case REACT_ELEMENT_TYPE: + case REACT_PORTAL_TYPE: + warnForMissingKey(child, returnFiber); + var key = child.key; + if (typeof key !== "string") break; + if (knownKeys === null) { + knownKeys = new Set(); + knownKeys.add(key); + break; + } + if (!knownKeys.has(key)) { + knownKeys.add(key); + break; + } + error("Encountered two children with the same key, `%s`. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.", key); + break; + } + return knownKeys; + } + function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, lanes) { + // First, validate keys. + var knownKeys = null; + for(var i = 0; i < newChildren.length; i++){ + var child = newChildren[i]; + knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber); + } + var resultingFirstChild = null; + var previousNewFiber = null; + var oldFiber = currentFirstChild; + var lastPlacedIndex = 0; + var newIdx = 0; + var nextOldFiber = null; + for(; oldFiber !== null && newIdx < newChildren.length; newIdx++){ + if (oldFiber.index > newIdx) { + nextOldFiber = oldFiber; + oldFiber = null; + } else nextOldFiber = oldFiber.sibling; + var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], lanes); + if (newFiber === null) { + // TODO: This breaks on empty slots like null children. That's + // unfortunate because it triggers the slow path all the time. We need + // a better way to communicate whether this was a miss or null, + // boolean, undefined, etc. + if (oldFiber === null) oldFiber = nextOldFiber; + break; + } + if (shouldTrackSideEffects) { + if (oldFiber && newFiber.alternate === null) // We matched the slot, but we didn't reuse the existing fiber, so we + // need to delete the existing child. + deleteChild(returnFiber, oldFiber); + } + lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = newFiber; + else // TODO: Defer siblings if we're not at the right index for this slot. + // I.e. if we had null values before, then we want to defer this + // for each null value. However, we also don't want to call updateSlot + // with the previous one. + previousNewFiber.sibling = newFiber; + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (newIdx === newChildren.length) { + // We've reached the end of the new children. We can delete the rest. + deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; + } + if (oldFiber === null) { + // If we don't have any more existing children we can choose a fast path + // since the rest will all be insertions. + for(; newIdx < newChildren.length; newIdx++){ + var _newFiber = createChild(returnFiber, newChildren[newIdx], lanes); + if (_newFiber === null) continue; + lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = _newFiber; + else previousNewFiber.sibling = _newFiber; + previousNewFiber = _newFiber; + } + return resultingFirstChild; + } // Add all children to a key map for quick lookups. + var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. + for(; newIdx < newChildren.length; newIdx++){ + var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], lanes); + if (_newFiber2 !== null) { + if (shouldTrackSideEffects) { + if (_newFiber2.alternate !== null) // The new fiber is a work in progress, but if there exists a + // current, that means that we reused the fiber. We need to delete + // it from the child list so that we don't add it to the deletion + // list. + existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key); + } + lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); + if (previousNewFiber === null) resultingFirstChild = _newFiber2; + else previousNewFiber.sibling = _newFiber2; + previousNewFiber = _newFiber2; + } + } + if (shouldTrackSideEffects) // Any existing children that weren't consumed above were deleted. We need + // to add them to the deletion list. + existingChildren.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + return resultingFirstChild; + } + function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, lanes) { + // This is the same implementation as reconcileChildrenArray(), + // but using the iterator instead. + var iteratorFn = getIteratorFn(newChildrenIterable); + if (!(typeof iteratorFn === "function")) throw Error("An object is not an iterable. This error is likely caused by a bug in React. Please file an issue."); + // We don't support rendering Generators because it's a mutation. + // See https://github.com/facebook/react/issues/12995 + if (typeof Symbol === "function" && // $FlowFixMe Flow doesn't know about toStringTag + newChildrenIterable[Symbol.toStringTag] === "Generator") { + if (!didWarnAboutGenerators) error("Using Generators as children is unsupported and will likely yield unexpected results because enumerating a generator mutates it. You may convert it to an array with `Array.from()` or the `[...spread]` operator before rendering. Keep in mind you might need to polyfill these features for older browsers."); + didWarnAboutGenerators = true; + } // Warn about using Maps as children + if (newChildrenIterable.entries === iteratorFn) { + if (!didWarnAboutMaps) error("Using Maps as children is not supported. Use an array of keyed ReactElements instead."); + didWarnAboutMaps = true; + } // First, validate keys. + // We'll get a different iterator later for the main pass. + var _newChildren = iteratorFn.call(newChildrenIterable); + if (_newChildren) { + var knownKeys = null; + var _step = _newChildren.next(); + for(; !_step.done; _step = _newChildren.next()){ + var child = _step.value; + knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber); + } + } + var newChildren = iteratorFn.call(newChildrenIterable); + if (!(newChildren != null)) throw Error("An iterable object provided no iterator."); + var resultingFirstChild = null; + var previousNewFiber = null; + var oldFiber = currentFirstChild; + var lastPlacedIndex = 0; + var newIdx = 0; + var nextOldFiber = null; + var step = newChildren.next(); + for(; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()){ + if (oldFiber.index > newIdx) { + nextOldFiber = oldFiber; + oldFiber = null; + } else nextOldFiber = oldFiber.sibling; + var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes); + if (newFiber === null) { + // TODO: This breaks on empty slots like null children. That's + // unfortunate because it triggers the slow path all the time. We need + // a better way to communicate whether this was a miss or null, + // boolean, undefined, etc. + if (oldFiber === null) oldFiber = nextOldFiber; + break; + } + if (shouldTrackSideEffects) { + if (oldFiber && newFiber.alternate === null) // We matched the slot, but we didn't reuse the existing fiber, so we + // need to delete the existing child. + deleteChild(returnFiber, oldFiber); + } + lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); + if (previousNewFiber === null) // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = newFiber; + else // TODO: Defer siblings if we're not at the right index for this slot. + // I.e. if we had null values before, then we want to defer this + // for each null value. However, we also don't want to call updateSlot + // with the previous one. + previousNewFiber.sibling = newFiber; + previousNewFiber = newFiber; + oldFiber = nextOldFiber; + } + if (step.done) { + // We've reached the end of the new children. We can delete the rest. + deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; + } + if (oldFiber === null) { + // If we don't have any more existing children we can choose a fast path + // since the rest will all be insertions. + for(; !step.done; newIdx++, step = newChildren.next()){ + var _newFiber3 = createChild(returnFiber, step.value, lanes); + if (_newFiber3 === null) continue; + lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); + if (previousNewFiber === null) // TODO: Move out of the loop. This only happens for the first run. + resultingFirstChild = _newFiber3; + else previousNewFiber.sibling = _newFiber3; + previousNewFiber = _newFiber3; + } + return resultingFirstChild; + } // Add all children to a key map for quick lookups. + var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. + for(; !step.done; newIdx++, step = newChildren.next()){ + var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, lanes); + if (_newFiber4 !== null) { + if (shouldTrackSideEffects) { + if (_newFiber4.alternate !== null) // The new fiber is a work in progress, but if there exists a + // current, that means that we reused the fiber. We need to delete + // it from the child list so that we don't add it to the deletion + // list. + existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key); + } + lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); + if (previousNewFiber === null) resultingFirstChild = _newFiber4; + else previousNewFiber.sibling = _newFiber4; + previousNewFiber = _newFiber4; + } + } + if (shouldTrackSideEffects) // Any existing children that weren't consumed above were deleted. We need + // to add them to the deletion list. + existingChildren.forEach(function(child) { + return deleteChild(returnFiber, child); + }); + return resultingFirstChild; + } + function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, lanes) { + // There's no need to check for keys on text nodes since we don't have a + // way to define them. + if (currentFirstChild !== null && currentFirstChild.tag === HostText) { + // We already have an existing node so let's just update it and delete + // the rest. + deleteRemainingChildren(returnFiber, currentFirstChild.sibling); + var existing = useFiber(currentFirstChild, textContent); + existing.return = returnFiber; + return existing; + } // The existing first child is not a text node so we need to create one + // and delete the existing ones. + deleteRemainingChildren(returnFiber, currentFirstChild); + var created = createFiberFromText(textContent, returnFiber.mode, lanes); + created.return = returnFiber; + return created; + } + function reconcileSingleElement(returnFiber, currentFirstChild, element, lanes) { + var key = element.key; + var child = currentFirstChild; + while(child !== null){ + // TODO: If key === null and child.key === null, then this only applies to + // the first item in the list. + if (child.key === key) { + switch(child.tag){ + case Fragment: + if (element.type === REACT_FRAGMENT_TYPE) { + deleteRemainingChildren(returnFiber, child.sibling); + var existing = useFiber(child, element.props.children); + existing.return = returnFiber; + existing._debugSource = element._source; + existing._debugOwner = element._owner; + return existing; + } + break; + case Block: + // We intentionally fallthrough here if enableBlocksAPI is not on. + // eslint-disable-next-lined no-fallthrough + default: + if (child.elementType === element.type || isCompatibleFamilyForHotReloading(child, element)) { + deleteRemainingChildren(returnFiber, child.sibling); + var _existing3 = useFiber(child, element.props); + _existing3.ref = coerceRef(returnFiber, child, element); + _existing3.return = returnFiber; + _existing3._debugSource = element._source; + _existing3._debugOwner = element._owner; + return _existing3; + } + break; + } // Didn't match. + deleteRemainingChildren(returnFiber, child); + break; + } else deleteChild(returnFiber, child); + child = child.sibling; + } + if (element.type === REACT_FRAGMENT_TYPE) { + var created = createFiberFromFragment(element.props.children, returnFiber.mode, lanes, element.key); + created.return = returnFiber; + return created; + } else { + var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); + _created4.ref = coerceRef(returnFiber, currentFirstChild, element); + _created4.return = returnFiber; + return _created4; + } + } + function reconcileSinglePortal(returnFiber, currentFirstChild, portal, lanes) { + var key = portal.key; + var child = currentFirstChild; + while(child !== null){ + // TODO: If key === null and child.key === null, then this only applies to + // the first item in the list. + if (child.key === key) { + if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) { + deleteRemainingChildren(returnFiber, child.sibling); + var existing = useFiber(child, portal.children || []); + existing.return = returnFiber; + return existing; + } else { + deleteRemainingChildren(returnFiber, child); + break; + } + } else deleteChild(returnFiber, child); + child = child.sibling; + } + var created = createFiberFromPortal(portal, returnFiber.mode, lanes); + created.return = returnFiber; + return created; + } // This API will tag the children with the side-effect of the reconciliation + // itself. They will be added to the side-effect list as we pass through the + // children and the parent. + function reconcileChildFibers(returnFiber, currentFirstChild, newChild, lanes) { + // This function is not recursive. + // If the top level item is an array, we treat it as a set of children, + // not as a fragment. Nested arrays on the other hand will be treated as + // fragment nodes. Recursion happens at the normal flow. + // Handle top level unkeyed fragments as if they were arrays. + // This leads to an ambiguity between <>{[...]} and <>.... + // We treat the ambiguous cases above the same. + var isUnkeyedTopLevelFragment = typeof newChild === "object" && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; + if (isUnkeyedTopLevelFragment) newChild = newChild.props.children; + // Handle object types + var isObject = typeof newChild === "object" && newChild !== null; + if (isObject) switch(newChild.$$typeof){ + case REACT_ELEMENT_TYPE: + return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, lanes)); + case REACT_PORTAL_TYPE: + return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, lanes)); + } + if (typeof newChild === "string" || typeof newChild === "number") return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, "" + newChild, lanes)); + if (isArray$1(newChild)) return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes); + if (getIteratorFn(newChild)) return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, lanes); + if (isObject) throwOnInvalidObjectType(returnFiber, newChild); + if (typeof newChild === "function") warnOnFunctionType(returnFiber); + if (typeof newChild === "undefined" && !isUnkeyedTopLevelFragment) // If the new child is undefined, and the return fiber is a composite + // component, throw an error. If Fiber return types are disabled, + // we already threw above. + switch(returnFiber.tag){ + case ClassComponent: + var instance = returnFiber.stateNode; + if (instance.render._isMockFunction) break; + // Intentionally fall through to the next case, which handles both + // functions and classes + // eslint-disable-next-lined no-fallthrough + case Block: + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: + throw Error((getComponentName(returnFiber.type) || "Component") + "(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null."); + } + // Remaining cases are all treated as empty. + return deleteRemainingChildren(returnFiber, currentFirstChild); + } + return reconcileChildFibers; + } + var reconcileChildFibers = ChildReconciler(true); + var mountChildFibers = ChildReconciler(false); + function cloneChildFibers(current, workInProgress) { + if (!(current === null || workInProgress.child === current.child)) throw Error("Resuming work not yet implemented."); + if (workInProgress.child === null) return; + var currentChild = workInProgress.child; + var newChild = createWorkInProgress(currentChild, currentChild.pendingProps); + workInProgress.child = newChild; + newChild.return = workInProgress; + while(currentChild.sibling !== null){ + currentChild = currentChild.sibling; + newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps); + newChild.return = workInProgress; + } + newChild.sibling = null; + } // Reset a workInProgress child set to prepare it for a second pass. + function resetChildFibers(workInProgress, lanes) { + var child = workInProgress.child; + while(child !== null){ + resetWorkInProgress(child, lanes); + child = child.sibling; + } + } + var NO_CONTEXT = {}; + var contextStackCursor$1 = createCursor(NO_CONTEXT); + var contextFiberStackCursor = createCursor(NO_CONTEXT); + var rootInstanceStackCursor = createCursor(NO_CONTEXT); + function requiredContext(c) { + if (!(c !== NO_CONTEXT)) throw Error("Expected host context to exist. This error is likely caused by a bug in React. Please file an issue."); + return c; + } + function getRootHostContainer() { + var rootInstance = requiredContext(rootInstanceStackCursor.current); + return rootInstance; + } + function pushHostContainer(fiber, nextRootInstance) { + // Push current root instance onto the stack; + // This allows us to reset root when portals are popped. + push(rootInstanceStackCursor, nextRootInstance, fiber); // Track the context and the Fiber that provided it. + // This enables us to pop only Fibers that provide unique contexts. + push(contextFiberStackCursor, fiber, fiber); // Finally, we need to push the host context to the stack. + // However, we can't just call getRootHostContext() and push it because + // we'd have a different number of entries on the stack depending on + // whether getRootHostContext() throws somewhere in renderer code or not. + // So we push an empty value first. This lets us safely unwind on errors. + push(contextStackCursor$1, NO_CONTEXT, fiber); + var nextRootContext = getRootHostContext(nextRootInstance); // Now that we know this function doesn't throw, replace it. + pop(contextStackCursor$1, fiber); + push(contextStackCursor$1, nextRootContext, fiber); + } + function popHostContainer(fiber) { + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); + pop(rootInstanceStackCursor, fiber); + } + function getHostContext() { + var context = requiredContext(contextStackCursor$1.current); + return context; + } + function pushHostContext(fiber) { + var rootInstance = requiredContext(rootInstanceStackCursor.current); + var context = requiredContext(contextStackCursor$1.current); + var nextContext = getChildHostContext(context, fiber.type); // Don't push this Fiber's context unless it's unique. + if (context === nextContext) return; + // Track the context and the Fiber that provided it. + // This enables us to pop only Fibers that provide unique contexts. + push(contextFiberStackCursor, fiber, fiber); + push(contextStackCursor$1, nextContext, fiber); + } + function popHostContext(fiber) { + // Do not pop unless this Fiber provided the current context. + // pushHostContext() only pushes Fibers that provide unique contexts. + if (contextFiberStackCursor.current !== fiber) return; + pop(contextStackCursor$1, fiber); + pop(contextFiberStackCursor, fiber); + } + var DefaultSuspenseContext = 0; // The Suspense Context is split into two parts. The lower bits is + // inherited deeply down the subtree. The upper bits only affect + // this immediate suspense boundary and gets reset each new + // boundary or suspense list. + var SubtreeSuspenseContextMask = 1; // Subtree Flags: + // InvisibleParentSuspenseContext indicates that one of our parent Suspense + // boundaries is not currently showing visible main content. + // Either because it is already showing a fallback or is not mounted at all. + // We can use this to determine if it is desirable to trigger a fallback at + // the parent. If not, then we might need to trigger undesirable boundaries + // and/or suspend the commit to avoid hiding the parent content. + var InvisibleParentSuspenseContext = 1; // Shallow Flags: + // ForceSuspenseFallback can be used by SuspenseList to force newly added + // items into their fallback state during one of the render passes. + var ForceSuspenseFallback = 2; + var suspenseStackCursor = createCursor(DefaultSuspenseContext); + function hasSuspenseContext(parentContext, flag) { + return (parentContext & flag) !== 0; + } + function setDefaultShallowSuspenseContext(parentContext) { + return parentContext & SubtreeSuspenseContextMask; + } + function setShallowSuspenseContext(parentContext, shallowContext) { + return parentContext & SubtreeSuspenseContextMask | shallowContext; + } + function addSubtreeSuspenseContext(parentContext, subtreeContext) { + return parentContext | subtreeContext; + } + function pushSuspenseContext(fiber, newContext) { + push(suspenseStackCursor, newContext, fiber); + } + function popSuspenseContext(fiber) { + pop(suspenseStackCursor, fiber); + } + function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { + // If it was the primary children that just suspended, capture and render the + // fallback. Otherwise, don't capture and bubble to the next boundary. + var nextState = workInProgress.memoizedState; + if (nextState !== null) { + if (nextState.dehydrated !== null) // A dehydrated boundary always captures. + return true; + return false; + } + var props = workInProgress.memoizedProps; // In order to capture, the Suspense component must have a fallback prop. + if (props.fallback === undefined) return false; + // Regular boundaries always capture. + if (props.unstable_avoidThisFallback !== true) return true; + // If it's a boundary we should avoid, then we prefer to bubble up to the + // parent boundary if it is currently invisible. + if (hasInvisibleParent) return false; + // If the parent is not able to handle it, we must handle it. + return true; + } + function findFirstSuspended(row) { + var node = row; + while(node !== null){ + if (node.tag === SuspenseComponent) { + var state = node.memoizedState; + if (state !== null) { + var dehydrated = state.dehydrated; + if (dehydrated === null || isSuspenseInstancePending(dehydrated) || isSuspenseInstanceFallback(dehydrated)) return node; + } + } else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't + // keep track of whether it suspended or not. + node.memoizedProps.revealOrder !== undefined) { + var didSuspend = (node.flags & DidCapture) !== NoFlags; + if (didSuspend) return node; + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === row) return null; + while(node.sibling === null){ + if (node.return === null || node.return === row) return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return null; + } + var NoFlags$1 = /* */ 0; // Represents whether effect should fire. + var HasEffect = /* */ 1; // Represents the phase in which the effect (not the clean-up) fires. + var Layout = /* */ 2; + var Passive$1 = /* */ 4; + // This may have been an insertion or a hydration. + var hydrationParentFiber = null; + var nextHydratableInstance = null; + var isHydrating = false; + function enterHydrationState(fiber) { + var parentInstance = fiber.stateNode.containerInfo; + nextHydratableInstance = getFirstHydratableChild(parentInstance); + hydrationParentFiber = fiber; + isHydrating = true; + return true; + } + function deleteHydratableInstance(returnFiber, instance) { + switch(returnFiber.tag){ + case HostRoot: + didNotHydrateContainerInstance(returnFiber.stateNode.containerInfo, instance); + break; + case HostComponent: + didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance); + break; + } + var childToDelete = createFiberFromHostInstanceForDeletion(); + childToDelete.stateNode = instance; + childToDelete.return = returnFiber; + childToDelete.flags = Deletion; // This might seem like it belongs on progressedFirstDeletion. However, + // these children are not part of the reconciliation list of children. + // Even if we abort and rereconcile the children, that will try to hydrate + // again and the nodes are still in the host tree so these will be + // recreated. + if (returnFiber.lastEffect !== null) { + returnFiber.lastEffect.nextEffect = childToDelete; + returnFiber.lastEffect = childToDelete; + } else returnFiber.firstEffect = returnFiber.lastEffect = childToDelete; + } + function insertNonHydratedInstance(returnFiber, fiber) { + fiber.flags = fiber.flags & ~Hydrating | Placement; + switch(returnFiber.tag){ + case HostRoot: + var parentContainer = returnFiber.stateNode.containerInfo; + switch(fiber.tag){ + case HostComponent: + var type = fiber.type; + var props = fiber.pendingProps; + didNotFindHydratableContainerInstance(parentContainer, type); + break; + case HostText: + var text = fiber.pendingProps; + didNotFindHydratableContainerTextInstance(parentContainer, text); + break; + } + break; + case HostComponent: + var parentType = returnFiber.type; + var parentProps = returnFiber.memoizedProps; + var parentInstance = returnFiber.stateNode; + switch(fiber.tag){ + case HostComponent: + var _type = fiber.type; + var _props = fiber.pendingProps; + didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type); + break; + case HostText: + var _text = fiber.pendingProps; + didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text); + break; + case SuspenseComponent: + didNotFindHydratableSuspenseInstance(parentType, parentProps); + break; + } + break; + default: + return; + } + } + function tryHydrate(fiber, nextInstance) { + switch(fiber.tag){ + case HostComponent: + var type = fiber.type; + var props = fiber.pendingProps; + var instance = canHydrateInstance(nextInstance, type); + if (instance !== null) { + fiber.stateNode = instance; + return true; + } + return false; + case HostText: + var text = fiber.pendingProps; + var textInstance = canHydrateTextInstance(nextInstance, text); + if (textInstance !== null) { + fiber.stateNode = textInstance; + return true; + } + return false; + case SuspenseComponent: + return false; + default: + return false; + } + } + function tryToClaimNextHydratableInstance(fiber) { + if (!isHydrating) return; + var nextInstance = nextHydratableInstance; + if (!nextInstance) { + // Nothing to hydrate. Make it an insertion. + insertNonHydratedInstance(hydrationParentFiber, fiber); + isHydrating = false; + hydrationParentFiber = fiber; + return; + } + var firstAttemptedInstance = nextInstance; + if (!tryHydrate(fiber, nextInstance)) { + // If we can't hydrate this instance let's try the next one. + // We use this as a heuristic. It's based on intuition and not data so it + // might be flawed or unnecessary. + nextInstance = getNextHydratableSibling(firstAttemptedInstance); + if (!nextInstance || !tryHydrate(fiber, nextInstance)) { + // Nothing to hydrate. Make it an insertion. + insertNonHydratedInstance(hydrationParentFiber, fiber); + isHydrating = false; + hydrationParentFiber = fiber; + return; + } // We matched the next one, we'll now assume that the first one was + // superfluous and we'll delete it. Since we can't eagerly delete it + // we'll have to schedule a deletion. To do that, this node needs a dummy + // fiber associated with it. + deleteHydratableInstance(hydrationParentFiber, firstAttemptedInstance); + } + hydrationParentFiber = fiber; + nextHydratableInstance = getFirstHydratableChild(nextInstance); + } + function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) { + var instance = fiber.stateNode; + var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber); // TODO: Type this specific to this type of component. + fiber.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there + // is a new ref we mark this as an update. + if (updatePayload !== null) return true; + return false; + } + function prepareToHydrateHostTextInstance(fiber) { + var textInstance = fiber.stateNode; + var textContent = fiber.memoizedProps; + var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber); + if (shouldUpdate) { + // We assume that prepareToHydrateHostTextInstance is called in a context where the + // hydration parent is the parent host component of this host text. + var returnFiber = hydrationParentFiber; + if (returnFiber !== null) switch(returnFiber.tag){ + case HostRoot: + var parentContainer = returnFiber.stateNode.containerInfo; + didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent); + break; + case HostComponent: + var parentType = returnFiber.type; + var parentProps = returnFiber.memoizedProps; + var parentInstance = returnFiber.stateNode; + didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent); + break; + } + } + return shouldUpdate; + } + function skipPastDehydratedSuspenseInstance(fiber) { + var suspenseState = fiber.memoizedState; + var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null; + if (!suspenseInstance) throw Error("Expected to have a hydrated suspense instance. This error is likely caused by a bug in React. Please file an issue."); + return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance); + } + function popToNextHostParent(fiber) { + var parent = fiber.return; + while(parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent)parent = parent.return; + hydrationParentFiber = parent; + } + function popHydrationState(fiber) { + if (fiber !== hydrationParentFiber) // We're deeper than the current hydration context, inside an inserted + // tree. + return false; + if (!isHydrating) { + // If we're not currently hydrating but we're in a hydration context, then + // we were an insertion and now need to pop up reenter hydration of our + // siblings. + popToNextHostParent(fiber); + isHydrating = true; + return false; + } + var type = fiber.type; // If we have any remaining hydratable nodes, we need to delete them now. + // We only do this deeper than head and body since they tend to have random + // other nodes in them. We also ignore components with pure text content in + // side of them. + // TODO: Better heuristic. + if (fiber.tag !== HostComponent || type !== "head" && type !== "body" && !shouldSetTextContent(type, fiber.memoizedProps)) { + var nextInstance = nextHydratableInstance; + while(nextInstance){ + deleteHydratableInstance(fiber, nextInstance); + nextInstance = getNextHydratableSibling(nextInstance); + } + } + popToNextHostParent(fiber); + if (fiber.tag === SuspenseComponent) nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber); + else nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null; + return true; + } + function resetHydrationState() { + hydrationParentFiber = null; + nextHydratableInstance = null; + isHydrating = false; + } + function getIsHydrating() { + return isHydrating; + } + // and should be reset before starting a new render. + // This tracks which mutable sources need to be reset after a render. + var workInProgressSources = []; + var rendererSigil$1; + // Used to detect multiple renderers using the same mutable source. + rendererSigil$1 = {}; + function markSourceAsDirty(mutableSource) { + workInProgressSources.push(mutableSource); + } + function resetWorkInProgressVersions() { + for(var i = 0; i < workInProgressSources.length; i++){ + var mutableSource = workInProgressSources[i]; + mutableSource._workInProgressVersionPrimary = null; + } + workInProgressSources.length = 0; + } + function getWorkInProgressVersion(mutableSource) { + return mutableSource._workInProgressVersionPrimary; + } + function setWorkInProgressVersion(mutableSource, version) { + mutableSource._workInProgressVersionPrimary = version; + workInProgressSources.push(mutableSource); + } + function warnAboutMultipleRenderersDEV(mutableSource) { + if (mutableSource._currentPrimaryRenderer == null) mutableSource._currentPrimaryRenderer = rendererSigil$1; + else if (mutableSource._currentPrimaryRenderer !== rendererSigil$1) error("Detected multiple renderers concurrently rendering the same mutable source. This is currently unsupported."); + } // Eager reads the version of a mutable source and stores it on the root. + var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; + var didWarnAboutMismatchedHooksForComponent; + var didWarnAboutUseOpaqueIdentifier; + didWarnAboutUseOpaqueIdentifier = {}; + didWarnAboutMismatchedHooksForComponent = new Set(); + // These are set right before calling the component. + var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from + // the work-in-progress hook. + var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The + // current hook list is the list that belongs to the current fiber. The + // work-in-progress hook list is a new list that will be added to the + // work-in-progress fiber. + var currentHook = null; + var workInProgressHook = null; // Whether an update was scheduled at any point during the render phase. This + // does not get reset if we do another render pass; only when we're completely + // finished evaluating this component. This is an optimization so we know + // whether we need to clear render phase updates after a throw. + var didScheduleRenderPhaseUpdate = false; // Where an update was scheduled only during the current render pass. This + // gets reset after each attempt. + // TODO: Maybe there's some way to consolidate this with + // `didScheduleRenderPhaseUpdate`. Or with `numberOfReRenders`. + var didScheduleRenderPhaseUpdateDuringThisPass = false; + var RE_RENDER_LIMIT = 25; // In DEV, this is the name of the currently executing primitive hook + var currentHookNameInDev = null; // In DEV, this list ensures that hooks are called in the same order between renders. + // The list stores the order of hooks used during the initial render (mount). + // Subsequent renders (updates) reference this list. + var hookTypesDev = null; + var hookTypesUpdateIndexDev = -1; // In DEV, this tracks whether currently rendering component needs to ignore + // the dependencies for Hooks that need them (e.g. useEffect or useMemo). + // When true, such Hooks will always be "remounted". Only used during hot reload. + var ignorePreviousDependencies = false; + function mountHookTypesDev() { + var hookName = currentHookNameInDev; + if (hookTypesDev === null) hookTypesDev = [ + hookName + ]; + else hookTypesDev.push(hookName); + } + function updateHookTypesDev() { + var hookName = currentHookNameInDev; + if (hookTypesDev !== null) { + hookTypesUpdateIndexDev++; + if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) warnOnHookMismatchInDev(hookName); + } + } + function checkDepsAreArrayDev(deps) { + if (deps !== undefined && deps !== null && !Array.isArray(deps)) // Verify deps, but only on mount to avoid extra checks. + // It's unlikely their type would change as usually you define them inline. + error("%s received a final argument that is not an array (instead, received `%s`). When specified, the final argument must be an array.", currentHookNameInDev, typeof deps); + } + function warnOnHookMismatchInDev(currentHookName) { + var componentName = getComponentName(currentlyRenderingFiber$1.type); + if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { + didWarnAboutMismatchedHooksForComponent.add(componentName); + if (hookTypesDev !== null) { + var table = ""; + var secondColumnStart = 30; + for(var i = 0; i <= hookTypesUpdateIndexDev; i++){ + var oldHookName = hookTypesDev[i]; + var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName; + var row = i + 1 + ". " + oldHookName; // Extra space so second column lines up + // lol @ IE not supporting String#repeat + while(row.length < secondColumnStart)row += " "; + row += newHookName + "\n"; + table += row; + } + error("React has detected a change in the order of Hooks called by %s. This will lead to bugs and errors if not fixed. For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks\n\n Previous render Next render\n ------------------------------------------------------\n%s ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n", componentName, table); + } + } + } + function throwInvalidHookError() { + throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem."); + } + function areHookInputsEqual(nextDeps, prevDeps) { + if (ignorePreviousDependencies) // Only true when this component is being hot reloaded. + return false; + if (prevDeps === null) { + error("%s received a final argument during this render, but not during the previous render. Even though the final argument is optional, its type cannot change between renders.", currentHookNameInDev); + return false; + } + // Don't bother comparing lengths in prod because these arrays should be + // passed inline. + if (nextDeps.length !== prevDeps.length) error("The final argument passed to %s changed size between renders. The order and size of this array must remain constant.\n\nPrevious: %s\nIncoming: %s", currentHookNameInDev, "[" + prevDeps.join(", ") + "]", "[" + nextDeps.join(", ") + "]"); + for(var i = 0; i < prevDeps.length && i < nextDeps.length; i++){ + if (objectIs(nextDeps[i], prevDeps[i])) continue; + return false; + } + return true; + } + function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderLanes) { + renderLanes = nextRenderLanes; + currentlyRenderingFiber$1 = workInProgress; + hookTypesDev = current !== null ? current._debugHookTypes : null; + hookTypesUpdateIndexDev = -1; // Used for hot reloading: + ignorePreviousDependencies = current !== null && current.type !== workInProgress.type; + workInProgress.memoizedState = null; + workInProgress.updateQueue = null; + workInProgress.lanes = NoLanes; // The following should have already been reset + if (current !== null && current.memoizedState !== null) ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; + else if (hookTypesDev !== null) // This dispatcher handles an edge case where a component is updating, + // but no stateful hooks have been used. + // We want to match the production code behavior (which will use HooksDispatcherOnMount), + // but with the extra DEV validation to ensure hooks ordering hasn't changed. + // This dispatcher does that. + ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV; + else ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; + var children = Component(props, secondArg); // Check if there was a render phase update + if (didScheduleRenderPhaseUpdateDuringThisPass) { + // Keep rendering in a loop for as long as render phase updates continue to + // be scheduled. Use a counter to prevent infinite loops. + var numberOfReRenders = 0; + do { + didScheduleRenderPhaseUpdateDuringThisPass = false; + if (!(numberOfReRenders < RE_RENDER_LIMIT)) throw Error("Too many re-renders. React limits the number of renders to prevent an infinite loop."); + numberOfReRenders += 1; + // Even when hot reloading, allow dependencies to stabilize + // after first render to prevent infinite render phase updates. + ignorePreviousDependencies = false; + currentHook = null; + workInProgressHook = null; + workInProgress.updateQueue = null; + // Also validate hook order for cascading updates. + hookTypesUpdateIndexDev = -1; + ReactCurrentDispatcher$1.current = HooksDispatcherOnRerenderInDEV; + children = Component(props, secondArg); + }while (didScheduleRenderPhaseUpdateDuringThisPass); + } // We can assume the previous dispatcher is always this one, since we set it + // at the beginning of the render phase and there's no re-entrancy. + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + workInProgress._debugHookTypes = hookTypesDev; + // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. + var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; + renderLanes = NoLanes; + currentlyRenderingFiber$1 = null; + currentHook = null; + workInProgressHook = null; + currentHookNameInDev = null; + hookTypesDev = null; + hookTypesUpdateIndexDev = -1; + didScheduleRenderPhaseUpdate = false; + if (!!didRenderTooFewHooks) throw Error("Rendered fewer hooks than expected. This may be caused by an accidental early return statement."); + return children; + } + function bailoutHooks(current, workInProgress, lanes) { + workInProgress.updateQueue = current.updateQueue; + workInProgress.flags &= ~(Passive | Update); + current.lanes = removeLanes(current.lanes, lanes); + } + function resetHooksAfterThrow() { + // We can assume the previous dispatcher is always this one, since we set it + // at the beginning of the render phase and there's no re-entrancy. + ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; + if (didScheduleRenderPhaseUpdate) { + // There were render phase updates. These are only valid for this render + // phase, which we are now aborting. Remove the updates from the queues so + // they do not persist to the next render. Do not remove updates from hooks + // that weren't processed. + // + // Only reset the updates from the queue if it has a clone. If it does + // not have a clone, that means it wasn't processed, and the updates were + // scheduled before we entered the render phase. + var hook = currentlyRenderingFiber$1.memoizedState; + while(hook !== null){ + var queue = hook.queue; + if (queue !== null) queue.pending = null; + hook = hook.next; + } + didScheduleRenderPhaseUpdate = false; + } + renderLanes = NoLanes; + currentlyRenderingFiber$1 = null; + currentHook = null; + workInProgressHook = null; + hookTypesDev = null; + hookTypesUpdateIndexDev = -1; + currentHookNameInDev = null; + isUpdatingOpaqueValueInRenderPhase = false; + didScheduleRenderPhaseUpdateDuringThisPass = false; + } + function mountWorkInProgressHook() { + var hook = { + memoizedState: null, + baseState: null, + baseQueue: null, + queue: null, + next: null + }; + if (workInProgressHook === null) // This is the first hook in the list + currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; + else // Append to the end of the list + workInProgressHook = workInProgressHook.next = hook; + return workInProgressHook; + } + function updateWorkInProgressHook() { + // This function is used both for updates and for re-renders triggered by a + // render phase update. It assumes there is either a current hook we can + // clone, or a work-in-progress hook from a previous render pass that we can + // use as a base. When we reach the end of the base list, we must switch to + // the dispatcher used for mounts. + var nextCurrentHook; + if (currentHook === null) { + var current = currentlyRenderingFiber$1.alternate; + if (current !== null) nextCurrentHook = current.memoizedState; + else nextCurrentHook = null; + } else nextCurrentHook = currentHook.next; + var nextWorkInProgressHook; + if (workInProgressHook === null) nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; + else nextWorkInProgressHook = workInProgressHook.next; + if (nextWorkInProgressHook !== null) { + // There's already a work-in-progress. Reuse it. + workInProgressHook = nextWorkInProgressHook; + nextWorkInProgressHook = workInProgressHook.next; + currentHook = nextCurrentHook; + } else { + // Clone from the current hook. + if (!(nextCurrentHook !== null)) throw Error("Rendered more hooks than during the previous render."); + currentHook = nextCurrentHook; + var newHook = { + memoizedState: currentHook.memoizedState, + baseState: currentHook.baseState, + baseQueue: currentHook.baseQueue, + queue: currentHook.queue, + next: null + }; + if (workInProgressHook === null) // This is the first hook in the list. + currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; + else // Append to the end of the list. + workInProgressHook = workInProgressHook.next = newHook; + } + return workInProgressHook; + } + function createFunctionComponentUpdateQueue() { + return { + lastEffect: null + }; + } + function basicStateReducer(state, action) { + // $FlowFixMe: Flow doesn't like mixed types + return typeof action === "function" ? action(state) : action; + } + function mountReducer(reducer, initialArg, init) { + var hook = mountWorkInProgressHook(); + var initialState; + if (init !== undefined) initialState = init(initialArg); + else initialState = initialArg; + hook.memoizedState = hook.baseState = initialState; + var queue = hook.queue = { + pending: null, + dispatch: null, + lastRenderedReducer: reducer, + lastRenderedState: initialState + }; + var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue); + return [ + hook.memoizedState, + dispatch + ]; + } + function updateReducer(reducer, initialArg, init) { + var hook = updateWorkInProgressHook(); + var queue = hook.queue; + if (!(queue !== null)) throw Error("Should have a queue. This is likely a bug in React. Please file an issue."); + queue.lastRenderedReducer = reducer; + var current = currentHook; // The last rebase update that is NOT part of the base state. + var baseQueue = current.baseQueue; // The last pending update that hasn't been processed yet. + var pendingQueue = queue.pending; + if (pendingQueue !== null) { + // We have new updates that haven't been processed yet. + // We'll add them to the base queue. + if (baseQueue !== null) { + // Merge the pending queue and the base queue. + var baseFirst = baseQueue.next; + var pendingFirst = pendingQueue.next; + baseQueue.next = pendingFirst; + pendingQueue.next = baseFirst; + } + if (current.baseQueue !== baseQueue) // Internal invariant that should never happen, but feasibly could in + // the future if we implement resuming, or some form of that. + error("Internal error: Expected work-in-progress queue to be a clone. This is a bug in React."); + current.baseQueue = baseQueue = pendingQueue; + queue.pending = null; + } + if (baseQueue !== null) { + // We have a queue to process. + var first = baseQueue.next; + var newState = current.baseState; + var newBaseState = null; + var newBaseQueueFirst = null; + var newBaseQueueLast = null; + var update = first; + do { + var updateLane = update.lane; + if (!isSubsetOfLanes(renderLanes, updateLane)) { + // Priority is insufficient. Skip this update. If this is the first + // skipped update, the previous update/state is the new base + // update/state. + var clone = { + lane: updateLane, + action: update.action, + eagerReducer: update.eagerReducer, + eagerState: update.eagerState, + next: null + }; + if (newBaseQueueLast === null) { + newBaseQueueFirst = newBaseQueueLast = clone; + newBaseState = newState; + } else newBaseQueueLast = newBaseQueueLast.next = clone; + // Update the remaining priority in the queue. + // TODO: Don't need to accumulate this. Instead, we can remove + // renderLanes from the original lanes. + currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, updateLane); + markSkippedUpdateLanes(updateLane); + } else { + // This update does have sufficient priority. + if (newBaseQueueLast !== null) { + var _clone = { + // This update is going to be committed so we never want uncommit + // it. Using NoLane works because 0 is a subset of all bitmasks, so + // this will never be skipped by the check above. + lane: NoLane, + action: update.action, + eagerReducer: update.eagerReducer, + eagerState: update.eagerState, + next: null + }; + newBaseQueueLast = newBaseQueueLast.next = _clone; + } // Process this update. + if (update.eagerReducer === reducer) // If this update was processed eagerly, and its reducer matches the + // current reducer, we can use the eagerly computed state. + newState = update.eagerState; + else { + var action = update.action; + newState = reducer(newState, action); + } + } + update = update.next; + }while (update !== null && update !== first); + if (newBaseQueueLast === null) newBaseState = newState; + else newBaseQueueLast.next = newBaseQueueFirst; + // Mark that the fiber performed work, but only if the new state is + // different from the current state. + if (!objectIs(newState, hook.memoizedState)) markWorkInProgressReceivedUpdate(); + hook.memoizedState = newState; + hook.baseState = newBaseState; + hook.baseQueue = newBaseQueueLast; + queue.lastRenderedState = newState; + } + var dispatch = queue.dispatch; + return [ + hook.memoizedState, + dispatch + ]; + } + function rerenderReducer(reducer, initialArg, init) { + var hook = updateWorkInProgressHook(); + var queue = hook.queue; + if (!(queue !== null)) throw Error("Should have a queue. This is likely a bug in React. Please file an issue."); + queue.lastRenderedReducer = reducer; // This is a re-render. Apply the new render phase updates to the previous + // work-in-progress hook. + var dispatch = queue.dispatch; + var lastRenderPhaseUpdate = queue.pending; + var newState = hook.memoizedState; + if (lastRenderPhaseUpdate !== null) { + // The queue doesn't persist past this render pass. + queue.pending = null; + var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next; + var update = firstRenderPhaseUpdate; + do { + // Process this render phase update. We don't have to check the + // priority because it will always be the same as the current + // render's. + var action = update.action; + newState = reducer(newState, action); + update = update.next; + }while (update !== firstRenderPhaseUpdate); // Mark that the fiber performed work, but only if the new state is + // different from the current state. + if (!objectIs(newState, hook.memoizedState)) markWorkInProgressReceivedUpdate(); + hook.memoizedState = newState; // Don't persist the state accumulated from the render phase updates to + // the base state unless the queue is empty. + // TODO: Not sure if this is the desired semantics, but it's what we + // do for gDSFP. I can't remember why. + if (hook.baseQueue === null) hook.baseState = newState; + queue.lastRenderedState = newState; + } + return [ + newState, + dispatch + ]; + } + function readFromUnsubcribedMutableSource(root, source, getSnapshot) { + warnAboutMultipleRenderersDEV(source); + var getVersion = source._getVersion; + var version = getVersion(source._source); // Is it safe for this component to read from this source during the current render? + var isSafeToReadFromSource = false; // Check the version first. + // If this render has already been started with a specific version, + // we can use it alone to determine if we can safely read from the source. + var currentRenderVersion = getWorkInProgressVersion(source); + if (currentRenderVersion !== null) // It's safe to read if the store hasn't been mutated since the last time + // we read something. + isSafeToReadFromSource = currentRenderVersion === version; + else { + // If there's no version, then this is the first time we've read from the + // source during the current render pass, so we need to do a bit more work. + // What we need to determine is if there are any hooks that already + // subscribed to the source, and if so, whether there are any pending + // mutations that haven't been synchronized yet. + // + // If there are no pending mutations, then `root.mutableReadLanes` will be + // empty, and we know we can safely read. + // + // If there *are* pending mutations, we may still be able to safely read + // if the currently rendering lanes are inclusive of the pending mutation + // lanes, since that guarantees that the value we're about to read from + // the source is consistent with the values that we read during the most + // recent mutation. + isSafeToReadFromSource = isSubsetOfLanes(renderLanes, root.mutableReadLanes); + if (isSafeToReadFromSource) // If it's safe to read from this source during the current render, + // store the version in case other components read from it. + // A changed version number will let those components know to throw and restart the render. + setWorkInProgressVersion(source, version); + } + if (isSafeToReadFromSource) { + var snapshot = getSnapshot(source._source); + if (typeof snapshot === "function") error("Mutable source should not return a function as the snapshot value. Functions may close over mutable values and cause tearing."); + return snapshot; + } else { + // This handles the special case of a mutable source being shared between renderers. + // In that case, if the source is mutated between the first and second renderer, + // The second renderer don't know that it needs to reset the WIP version during unwind, + // (because the hook only marks sources as dirty if it's written to their WIP version). + // That would cause this tear check to throw again and eventually be visible to the user. + // We can avoid this infinite loop by explicitly marking the source as dirty. + // + // This can lead to tearing in the first renderer when it resumes, + // but there's nothing we can do about that (short of throwing here and refusing to continue the render). + markSourceAsDirty(source); + throw Error("Cannot read from mutable source during the current render without tearing. This is a bug in React. Please file an issue."); + } + } + function useMutableSource(hook, source, getSnapshot, subscribe) { + var root = getWorkInProgressRoot(); + if (!(root !== null)) throw Error("Expected a work-in-progress root. This is a bug in React. Please file an issue."); + var getVersion = source._getVersion; + var version = getVersion(source._source); + var dispatcher = ReactCurrentDispatcher$1.current; // eslint-disable-next-line prefer-const + var _dispatcher$useState = dispatcher.useState(function() { + return readFromUnsubcribedMutableSource(root, source, getSnapshot); + }), currentSnapshot = _dispatcher$useState[0], setSnapshot = _dispatcher$useState[1]; + var snapshot = currentSnapshot; // Grab a handle to the state hook as well. + // We use it to clear the pending update queue if we have a new source. + var stateHook = workInProgressHook; + var memoizedState = hook.memoizedState; + var refs = memoizedState.refs; + var prevGetSnapshot = refs.getSnapshot; + var prevSource = memoizedState.source; + var prevSubscribe = memoizedState.subscribe; + var fiber = currentlyRenderingFiber$1; + hook.memoizedState = { + refs: refs, + source: source, + subscribe: subscribe + }; // Sync the values needed by our subscription handler after each commit. + dispatcher.useEffect(function() { + refs.getSnapshot = getSnapshot; // Normally the dispatch function for a state hook never changes, + // but this hook recreates the queue in certain cases to avoid updates from stale sources. + // handleChange() below needs to reference the dispatch function without re-subscribing, + // so we use a ref to ensure that it always has the latest version. + refs.setSnapshot = setSnapshot; // Check for a possible change between when we last rendered now. + var maybeNewVersion = getVersion(source._source); + if (!objectIs(version, maybeNewVersion)) { + var maybeNewSnapshot = getSnapshot(source._source); + if (typeof maybeNewSnapshot === "function") error("Mutable source should not return a function as the snapshot value. Functions may close over mutable values and cause tearing."); + if (!objectIs(snapshot, maybeNewSnapshot)) { + setSnapshot(maybeNewSnapshot); + var lane = requestUpdateLane(fiber); + markRootMutableRead(root, lane); + } // If the source mutated between render and now, + // there may be state updates already scheduled from the old source. + // Entangle the updates so that they render in the same batch. + markRootEntangled(root, root.mutableReadLanes); + } + }, [ + getSnapshot, + source, + subscribe + ]); // If we got a new source or subscribe function, re-subscribe in a passive effect. + dispatcher.useEffect(function() { + var handleChange = function() { + var latestGetSnapshot = refs.getSnapshot; + var latestSetSnapshot = refs.setSnapshot; + try { + latestSetSnapshot(latestGetSnapshot(source._source)); // Record a pending mutable source update with the same expiration time. + var lane = requestUpdateLane(fiber); + markRootMutableRead(root, lane); + } catch (error) { + // A selector might throw after a source mutation. + // e.g. it might try to read from a part of the store that no longer exists. + // In this case we should still schedule an update with React. + // Worst case the selector will throw again and then an error boundary will handle it. + latestSetSnapshot(function() { + throw error; + }); + } + }; + var unsubscribe = subscribe(source._source, handleChange); + if (typeof unsubscribe !== "function") error("Mutable source subscribe function must return an unsubscribe function."); + return unsubscribe; + }, [ + source, + subscribe + ]); // If any of the inputs to useMutableSource change, reading is potentially unsafe. + // + // If either the source or the subscription have changed we can't can't trust the update queue. + // Maybe the source changed in a way that the old subscription ignored but the new one depends on. + // + // If the getSnapshot function changed, we also shouldn't rely on the update queue. + // It's possible that the underlying source was mutated between the when the last "change" event fired, + // and when the current render (with the new getSnapshot function) is processed. + // + // In both cases, we need to throw away pending updates (since they are no longer relevant) + // and treat reading from the source as we do in the mount case. + if (!objectIs(prevGetSnapshot, getSnapshot) || !objectIs(prevSource, source) || !objectIs(prevSubscribe, subscribe)) { + // Create a new queue and setState method, + // So if there are interleaved updates, they get pushed to the older queue. + // When this becomes current, the previous queue and dispatch method will be discarded, + // including any interleaving updates that occur. + var newQueue = { + pending: null, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: snapshot + }; + newQueue.dispatch = setSnapshot = dispatchAction.bind(null, currentlyRenderingFiber$1, newQueue); + stateHook.queue = newQueue; + stateHook.baseQueue = null; + snapshot = readFromUnsubcribedMutableSource(root, source, getSnapshot); + stateHook.memoizedState = stateHook.baseState = snapshot; + } + return snapshot; + } + function mountMutableSource(source, getSnapshot, subscribe) { + var hook = mountWorkInProgressHook(); + hook.memoizedState = { + refs: { + getSnapshot: getSnapshot, + setSnapshot: null + }, + source: source, + subscribe: subscribe + }; + return useMutableSource(hook, source, getSnapshot, subscribe); + } + function updateMutableSource(source, getSnapshot, subscribe) { + var hook = updateWorkInProgressHook(); + return useMutableSource(hook, source, getSnapshot, subscribe); + } + function mountState(initialState) { + var hook = mountWorkInProgressHook(); + if (typeof initialState === "function") // $FlowFixMe: Flow doesn't like mixed types + initialState = initialState(); + hook.memoizedState = hook.baseState = initialState; + var queue = hook.queue = { + pending: null, + dispatch: null, + lastRenderedReducer: basicStateReducer, + lastRenderedState: initialState + }; + var dispatch = queue.dispatch = dispatchAction.bind(null, currentlyRenderingFiber$1, queue); + return [ + hook.memoizedState, + dispatch + ]; + } + function updateState(initialState) { + return updateReducer(basicStateReducer); + } + function rerenderState(initialState) { + return rerenderReducer(basicStateReducer); + } + function pushEffect(tag, create, destroy, deps) { + var effect = { + tag: tag, + create: create, + destroy: destroy, + deps: deps, + // Circular + next: null + }; + var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; + if (componentUpdateQueue === null) { + componentUpdateQueue = createFunctionComponentUpdateQueue(); + currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; + componentUpdateQueue.lastEffect = effect.next = effect; + } else { + var lastEffect = componentUpdateQueue.lastEffect; + if (lastEffect === null) componentUpdateQueue.lastEffect = effect.next = effect; + else { + var firstEffect = lastEffect.next; + lastEffect.next = effect; + effect.next = firstEffect; + componentUpdateQueue.lastEffect = effect; + } + } + return effect; + } + function mountRef(initialValue) { + var hook = mountWorkInProgressHook(); + var ref = { + current: initialValue + }; + Object.seal(ref); + hook.memoizedState = ref; + return ref; + } + function updateRef(initialValue) { + var hook = updateWorkInProgressHook(); + return hook.memoizedState; + } + function mountEffectImpl(fiberFlags, hookFlags, create, deps) { + var hook = mountWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + currentlyRenderingFiber$1.flags |= fiberFlags; + hook.memoizedState = pushEffect(HasEffect | hookFlags, create, undefined, nextDeps); + } + function updateEffectImpl(fiberFlags, hookFlags, create, deps) { + var hook = updateWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var destroy = undefined; + if (currentHook !== null) { + var prevEffect = currentHook.memoizedState; + destroy = prevEffect.destroy; + if (nextDeps !== null) { + var prevDeps = prevEffect.deps; + if (areHookInputsEqual(nextDeps, prevDeps)) { + pushEffect(hookFlags, create, destroy, nextDeps); + return; + } + } + } + currentlyRenderingFiber$1.flags |= fiberFlags; + hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps); + } + function mountEffect(create, deps) { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); + return mountEffectImpl(Update | Passive, Passive$1, create, deps); + } + function updateEffect(create, deps) { + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); + return updateEffectImpl(Update | Passive, Passive$1, create, deps); + } + function mountLayoutEffect(create, deps) { + return mountEffectImpl(Update, Layout, create, deps); + } + function updateLayoutEffect(create, deps) { + return updateEffectImpl(Update, Layout, create, deps); + } + function imperativeHandleEffect(create, ref) { + if (typeof ref === "function") { + var refCallback = ref; + var _inst = create(); + refCallback(_inst); + return function() { + refCallback(null); + }; + } else if (ref !== null && ref !== undefined) { + var refObject = ref; + if (!refObject.hasOwnProperty("current")) error("Expected useImperativeHandle() first argument to either be a ref callback or React.createRef() object. Instead received: %s.", "an object with keys {" + Object.keys(refObject).join(", ") + "}"); + var _inst2 = create(); + refObject.current = _inst2; + return function() { + refObject.current = null; + }; + } + } + function mountImperativeHandle(ref, create, deps) { + if (typeof create !== "function") error("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.", create !== null ? typeof create : "null"); + var effectDeps = deps !== null && deps !== undefined ? deps.concat([ + ref + ]) : null; + return mountEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); + } + function updateImperativeHandle(ref, create, deps) { + if (typeof create !== "function") error("Expected useImperativeHandle() second argument to be a function that creates a handle. Instead received: %s.", create !== null ? typeof create : "null"); + var effectDeps = deps !== null && deps !== undefined ? deps.concat([ + ref + ]) : null; + return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); + } + function mountDebugValue(value, formatterFn) { + // The react-debug-hooks package injects its own implementation + // so that e.g. DevTools can display custom hook values. + } + var updateDebugValue = mountDebugValue; + function mountCallback(callback, deps) { + var hook = mountWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + hook.memoizedState = [ + callback, + nextDeps + ]; + return callback; + } + function updateCallback(callback, deps) { + var hook = updateWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var prevState = hook.memoizedState; + if (prevState !== null) { + if (nextDeps !== null) { + var prevDeps = prevState[1]; + if (areHookInputsEqual(nextDeps, prevDeps)) return prevState[0]; + } + } + hook.memoizedState = [ + callback, + nextDeps + ]; + return callback; + } + function mountMemo(nextCreate, deps) { + var hook = mountWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var nextValue = nextCreate(); + hook.memoizedState = [ + nextValue, + nextDeps + ]; + return nextValue; + } + function updateMemo(nextCreate, deps) { + var hook = updateWorkInProgressHook(); + var nextDeps = deps === undefined ? null : deps; + var prevState = hook.memoizedState; + if (prevState !== null) // Assume these are defined. If they're not, areHookInputsEqual will warn. + { + if (nextDeps !== null) { + var prevDeps = prevState[1]; + if (areHookInputsEqual(nextDeps, prevDeps)) return prevState[0]; + } + } + var nextValue = nextCreate(); + hook.memoizedState = [ + nextValue, + nextDeps + ]; + return nextValue; + } + function mountDeferredValue(value) { + var _mountState = mountState(value), prevValue = _mountState[0], setValue = _mountState[1]; + mountEffect(function() { + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = 1; + try { + setValue(value); + } finally{ + ReactCurrentBatchConfig$1.transition = prevTransition; + } + }, [ + value + ]); + return prevValue; + } + function updateDeferredValue(value) { + var _updateState = updateState(), prevValue = _updateState[0], setValue = _updateState[1]; + updateEffect(function() { + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = 1; + try { + setValue(value); + } finally{ + ReactCurrentBatchConfig$1.transition = prevTransition; + } + }, [ + value + ]); + return prevValue; + } + function rerenderDeferredValue(value) { + var _rerenderState = rerenderState(), prevValue = _rerenderState[0], setValue = _rerenderState[1]; + updateEffect(function() { + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = 1; + try { + setValue(value); + } finally{ + ReactCurrentBatchConfig$1.transition = prevTransition; + } + }, [ + value + ]); + return prevValue; + } + function startTransition(setPending, callback) { + var priorityLevel = getCurrentPriorityLevel(); + runWithPriority$1(priorityLevel < UserBlockingPriority$2 ? UserBlockingPriority$2 : priorityLevel, function() { + setPending(true); + }); + runWithPriority$1(priorityLevel > NormalPriority$1 ? NormalPriority$1 : priorityLevel, function() { + var prevTransition = ReactCurrentBatchConfig$1.transition; + ReactCurrentBatchConfig$1.transition = 1; + try { + setPending(false); + callback(); + } finally{ + ReactCurrentBatchConfig$1.transition = prevTransition; + } + }); + } + function mountTransition() { + var _mountState2 = mountState(false), isPending = _mountState2[0], setPending = _mountState2[1]; // The `start` method can be stored on a ref, since `setPending` + // never changes. + var start = startTransition.bind(null, setPending); + mountRef(start); + return [ + start, + isPending + ]; + } + function updateTransition() { + var _updateState2 = updateState(), isPending = _updateState2[0]; + var startRef = updateRef(); + var start = startRef.current; + return [ + start, + isPending + ]; + } + function rerenderTransition() { + var _rerenderState2 = rerenderState(), isPending = _rerenderState2[0]; + var startRef = updateRef(); + var start = startRef.current; + return [ + start, + isPending + ]; + } + var isUpdatingOpaqueValueInRenderPhase = false; + function getIsUpdatingOpaqueValueInRenderPhaseInDEV() { + return isUpdatingOpaqueValueInRenderPhase; + } + function warnOnOpaqueIdentifierAccessInDEV(fiber) { + // TODO: Should warn in effects and callbacks, too + var name = getComponentName(fiber.type) || "Unknown"; + if (getIsRendering() && !didWarnAboutUseOpaqueIdentifier[name]) { + error("The object passed back from useOpaqueIdentifier is meant to be passed through to attributes only. Do not read the value directly."); + didWarnAboutUseOpaqueIdentifier[name] = true; + } + } + function mountOpaqueIdentifier() { + var makeId = makeClientIdInDEV.bind(null, warnOnOpaqueIdentifierAccessInDEV.bind(null, currentlyRenderingFiber$1)); + if (getIsHydrating()) { + var didUpgrade = false; + var fiber = currentlyRenderingFiber$1; + var readValue = function() { + if (!didUpgrade) { + // Only upgrade once. This works even inside the render phase because + // the update is added to a shared queue, which outlasts the + // in-progress render. + didUpgrade = true; + isUpdatingOpaqueValueInRenderPhase = true; + setId(makeId()); + isUpdatingOpaqueValueInRenderPhase = false; + warnOnOpaqueIdentifierAccessInDEV(fiber); + } + throw Error("The object passed back from useOpaqueIdentifier is meant to be passed through to attributes only. Do not read the value directly."); + }; + var id = makeOpaqueHydratingObject(readValue); + var setId = mountState(id)[1]; + if ((currentlyRenderingFiber$1.mode & BlockingMode) === NoMode) { + currentlyRenderingFiber$1.flags |= Update | Passive; + pushEffect(HasEffect | Passive$1, function() { + setId(makeId()); + }, undefined, null); + } + return id; + } else { + var _id = makeId(); + mountState(_id); + return _id; + } + } + function updateOpaqueIdentifier() { + var id = updateState()[0]; + return id; + } + function rerenderOpaqueIdentifier() { + var id = rerenderState()[0]; + return id; + } + function dispatchAction(fiber, queue, action) { + if (typeof arguments[3] === "function") error("State updates from the useState() and useReducer() Hooks don't support the second callback argument. To execute a side effect after rendering, declare it in the component body with useEffect()."); + var eventTime = requestEventTime(); + var lane = requestUpdateLane(fiber); + var update = { + lane: lane, + action: action, + eagerReducer: null, + eagerState: null, + next: null + }; // Append the update to the end of the list. + var pending = queue.pending; + if (pending === null) // This is the first update. Create a circular list. + update.next = update; + else { + update.next = pending.next; + pending.next = update; + } + queue.pending = update; + var alternate = fiber.alternate; + if (fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1) // This is a render phase update. Stash it in a lazily-created map of + // queue -> linked list of updates. After this render pass, we'll restart + // and apply the stashed updates on top of the work-in-progress hook. + didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; + else { + if (fiber.lanes === NoLanes && (alternate === null || alternate.lanes === NoLanes)) { + // The queue is currently empty, which means we can eagerly compute the + // next state before entering the render phase. If the new state is the + // same as the current state, we may be able to bail out entirely. + var lastRenderedReducer = queue.lastRenderedReducer; + if (lastRenderedReducer !== null) { + var prevDispatcher; + prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + var currentState = queue.lastRenderedState; + var eagerState = lastRenderedReducer(currentState, action); // Stash the eagerly computed state, and the reducer used to compute + // it, on the update object. If the reducer hasn't changed by the + // time we enter the render phase, then the eager state can be used + // without calling the reducer again. + update.eagerReducer = lastRenderedReducer; + update.eagerState = eagerState; + if (objectIs(eagerState, currentState)) // Fast path. We can bail out without scheduling React to re-render. + // It's still possible that we'll need to rebase this update later, + // if the component re-renders for a different reason and by that + // time the reducer has changed. + return; + } catch (error1) {} finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + } + } + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfNotScopedWithMatchingAct(fiber); + warnIfNotCurrentlyActingUpdatesInDev(fiber); + } + scheduleUpdateOnFiber(fiber, lane, eventTime); + } + } + var ContextOnlyDispatcher = { + readContext: readContext, + useCallback: throwInvalidHookError, + useContext: throwInvalidHookError, + useEffect: throwInvalidHookError, + useImperativeHandle: throwInvalidHookError, + useLayoutEffect: throwInvalidHookError, + useMemo: throwInvalidHookError, + useReducer: throwInvalidHookError, + useRef: throwInvalidHookError, + useState: throwInvalidHookError, + useDebugValue: throwInvalidHookError, + useDeferredValue: throwInvalidHookError, + useTransition: throwInvalidHookError, + useMutableSource: throwInvalidHookError, + useOpaqueIdentifier: throwInvalidHookError, + unstable_isNewReconciler: enableNewReconciler + }; + var HooksDispatcherOnMountInDEV = null; + var HooksDispatcherOnMountWithHookTypesInDEV = null; + var HooksDispatcherOnUpdateInDEV = null; + var HooksDispatcherOnRerenderInDEV = null; + var InvalidNestedHooksDispatcherOnMountInDEV = null; + var InvalidNestedHooksDispatcherOnUpdateInDEV = null; + var InvalidNestedHooksDispatcherOnRerenderInDEV = null; + var warnInvalidContextAccess = function() { + error("Context can only be read while React is rendering. In classes, you can read it in the render method or getDerivedStateFromProps. In function components, you can read it directly in the function body, but not inside Hooks like useReducer() or useMemo()."); + }; + var warnInvalidHookAccess = function() { + error("Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. You can only call Hooks at the top level of your React function. For more information, see https://reactjs.org/link/rules-of-hooks"); + }; + HooksDispatcherOnMountInDEV = { + readContext: function(context, observedBits) { + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + mountHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + return mountLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + mountHookTypesDev(); + checkDepsAreArrayDev(deps); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountMemo(create, deps); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountReducer(reducer, initialArg, init); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + mountHookTypesDev(); + return mountRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountState(initialState); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + mountHookTypesDev(); + return mountDebugValue(); + }, + useDeferredValue: function(value) { + currentHookNameInDev = "useDeferredValue"; + mountHookTypesDev(); + return mountDeferredValue(value); + }, + useTransition: function() { + currentHookNameInDev = "useTransition"; + mountHookTypesDev(); + return mountTransition(); + }, + useMutableSource: function(source, getSnapshot, subscribe) { + currentHookNameInDev = "useMutableSource"; + mountHookTypesDev(); + return mountMutableSource(source, getSnapshot, subscribe); + }, + useOpaqueIdentifier: function() { + currentHookNameInDev = "useOpaqueIdentifier"; + mountHookTypesDev(); + return mountOpaqueIdentifier(); + }, + unstable_isNewReconciler: enableNewReconciler + }; + HooksDispatcherOnMountWithHookTypesInDEV = { + readContext: function(context, observedBits) { + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + updateHookTypesDev(); + return mountCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + updateHookTypesDev(); + return mountEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + updateHookTypesDev(); + return mountImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + updateHookTypesDev(); + return mountLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountMemo(create, deps); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountReducer(reducer, initialArg, init); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + updateHookTypesDev(); + return mountRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountState(initialState); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + updateHookTypesDev(); + return mountDebugValue(); + }, + useDeferredValue: function(value) { + currentHookNameInDev = "useDeferredValue"; + updateHookTypesDev(); + return mountDeferredValue(value); + }, + useTransition: function() { + currentHookNameInDev = "useTransition"; + updateHookTypesDev(); + return mountTransition(); + }, + useMutableSource: function(source, getSnapshot, subscribe) { + currentHookNameInDev = "useMutableSource"; + updateHookTypesDev(); + return mountMutableSource(source, getSnapshot, subscribe); + }, + useOpaqueIdentifier: function() { + currentHookNameInDev = "useOpaqueIdentifier"; + updateHookTypesDev(); + return mountOpaqueIdentifier(); + }, + unstable_isNewReconciler: enableNewReconciler + }; + HooksDispatcherOnUpdateInDEV = { + readContext: function(context, observedBits) { + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + updateHookTypesDev(); + return updateCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + updateHookTypesDev(); + return updateEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + updateHookTypesDev(); + return updateImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + updateHookTypesDev(); + return updateLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateMemo(create, deps); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateReducer(reducer, initialArg, init); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + updateHookTypesDev(); + return updateRef(); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateState(initialState); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + updateHookTypesDev(); + return updateDebugValue(); + }, + useDeferredValue: function(value) { + currentHookNameInDev = "useDeferredValue"; + updateHookTypesDev(); + return updateDeferredValue(value); + }, + useTransition: function() { + currentHookNameInDev = "useTransition"; + updateHookTypesDev(); + return updateTransition(); + }, + useMutableSource: function(source, getSnapshot, subscribe) { + currentHookNameInDev = "useMutableSource"; + updateHookTypesDev(); + return updateMutableSource(source, getSnapshot, subscribe); + }, + useOpaqueIdentifier: function() { + currentHookNameInDev = "useOpaqueIdentifier"; + updateHookTypesDev(); + return updateOpaqueIdentifier(); + }, + unstable_isNewReconciler: enableNewReconciler + }; + HooksDispatcherOnRerenderInDEV = { + readContext: function(context, observedBits) { + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + updateHookTypesDev(); + return updateCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + updateHookTypesDev(); + return updateEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + updateHookTypesDev(); + return updateImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + updateHookTypesDev(); + return updateLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; + try { + return updateMemo(create, deps); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; + try { + return rerenderReducer(reducer, initialArg, init); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + updateHookTypesDev(); + return updateRef(); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; + try { + return rerenderState(initialState); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + updateHookTypesDev(); + return updateDebugValue(); + }, + useDeferredValue: function(value) { + currentHookNameInDev = "useDeferredValue"; + updateHookTypesDev(); + return rerenderDeferredValue(value); + }, + useTransition: function() { + currentHookNameInDev = "useTransition"; + updateHookTypesDev(); + return rerenderTransition(); + }, + useMutableSource: function(source, getSnapshot, subscribe) { + currentHookNameInDev = "useMutableSource"; + updateHookTypesDev(); + return updateMutableSource(source, getSnapshot, subscribe); + }, + useOpaqueIdentifier: function() { + currentHookNameInDev = "useOpaqueIdentifier"; + updateHookTypesDev(); + return rerenderOpaqueIdentifier(); + }, + unstable_isNewReconciler: enableNewReconciler + }; + InvalidNestedHooksDispatcherOnMountInDEV = { + readContext: function(context, observedBits) { + warnInvalidContextAccess(); + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + warnInvalidHookAccess(); + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountMemo(create, deps); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + warnInvalidHookAccess(); + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountReducer(reducer, initialArg, init); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountRef(initialValue); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + warnInvalidHookAccess(); + mountHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; + try { + return mountState(initialState); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountDebugValue(); + }, + useDeferredValue: function(value) { + currentHookNameInDev = "useDeferredValue"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountDeferredValue(value); + }, + useTransition: function() { + currentHookNameInDev = "useTransition"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountTransition(); + }, + useMutableSource: function(source, getSnapshot, subscribe) { + currentHookNameInDev = "useMutableSource"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountMutableSource(source, getSnapshot, subscribe); + }, + useOpaqueIdentifier: function() { + currentHookNameInDev = "useOpaqueIdentifier"; + warnInvalidHookAccess(); + mountHookTypesDev(); + return mountOpaqueIdentifier(); + }, + unstable_isNewReconciler: enableNewReconciler + }; + InvalidNestedHooksDispatcherOnUpdateInDEV = { + readContext: function(context, observedBits) { + warnInvalidContextAccess(); + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateMemo(create, deps); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateReducer(reducer, initialArg, init); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateRef(); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateState(initialState); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateDebugValue(); + }, + useDeferredValue: function(value) { + currentHookNameInDev = "useDeferredValue"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateDeferredValue(value); + }, + useTransition: function() { + currentHookNameInDev = "useTransition"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateTransition(); + }, + useMutableSource: function(source, getSnapshot, subscribe) { + currentHookNameInDev = "useMutableSource"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateMutableSource(source, getSnapshot, subscribe); + }, + useOpaqueIdentifier: function() { + currentHookNameInDev = "useOpaqueIdentifier"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateOpaqueIdentifier(); + }, + unstable_isNewReconciler: enableNewReconciler + }; + InvalidNestedHooksDispatcherOnRerenderInDEV = { + readContext: function(context, observedBits) { + warnInvalidContextAccess(); + return readContext(context, observedBits); + }, + useCallback: function(callback, deps) { + currentHookNameInDev = "useCallback"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateCallback(callback, deps); + }, + useContext: function(context, observedBits) { + currentHookNameInDev = "useContext"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return readContext(context, observedBits); + }, + useEffect: function(create, deps) { + currentHookNameInDev = "useEffect"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateEffect(create, deps); + }, + useImperativeHandle: function(ref, create, deps) { + currentHookNameInDev = "useImperativeHandle"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateImperativeHandle(ref, create, deps); + }, + useLayoutEffect: function(create, deps) { + currentHookNameInDev = "useLayoutEffect"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateLayoutEffect(create, deps); + }, + useMemo: function(create, deps) { + currentHookNameInDev = "useMemo"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return updateMemo(create, deps); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useReducer: function(reducer, initialArg, init) { + currentHookNameInDev = "useReducer"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return rerenderReducer(reducer, initialArg, init); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useRef: function(initialValue) { + currentHookNameInDev = "useRef"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateRef(); + }, + useState: function(initialState) { + currentHookNameInDev = "useState"; + warnInvalidHookAccess(); + updateHookTypesDev(); + var prevDispatcher = ReactCurrentDispatcher$1.current; + ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; + try { + return rerenderState(initialState); + } finally{ + ReactCurrentDispatcher$1.current = prevDispatcher; + } + }, + useDebugValue: function(value, formatterFn) { + currentHookNameInDev = "useDebugValue"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateDebugValue(); + }, + useDeferredValue: function(value) { + currentHookNameInDev = "useDeferredValue"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return rerenderDeferredValue(value); + }, + useTransition: function() { + currentHookNameInDev = "useTransition"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return rerenderTransition(); + }, + useMutableSource: function(source, getSnapshot, subscribe) { + currentHookNameInDev = "useMutableSource"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return updateMutableSource(source, getSnapshot, subscribe); + }, + useOpaqueIdentifier: function() { + currentHookNameInDev = "useOpaqueIdentifier"; + warnInvalidHookAccess(); + updateHookTypesDev(); + return rerenderOpaqueIdentifier(); + }, + unstable_isNewReconciler: enableNewReconciler + }; + var now$1 = Scheduler.unstable_now; + var commitTime = 0; + var profilerStartTime = -1; + function getCommitTime() { + return commitTime; + } + function recordCommitTime() { + commitTime = now$1(); + } + function startProfilerTimer(fiber) { + profilerStartTime = now$1(); + if (fiber.actualStartTime < 0) fiber.actualStartTime = now$1(); + } + function stopProfilerTimerIfRunning(fiber) { + profilerStartTime = -1; + } + function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) { + if (profilerStartTime >= 0) { + var elapsedTime = now$1() - profilerStartTime; + fiber.actualDuration += elapsedTime; + if (overrideBaseTime) fiber.selfBaseDuration = elapsedTime; + profilerStartTime = -1; + } + } + function transferActualDuration(fiber) { + // Transfer time spent rendering these children so we don't lose it + // after we rerender. This is used as a helper in special cases + // where we should count the work of multiple passes. + var child = fiber.child; + while(child){ + fiber.actualDuration += child.actualDuration; + child = child.sibling; + } + } + var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; + var didReceiveUpdate = false; + var didWarnAboutBadClass; + var didWarnAboutModulePatternComponent; + var didWarnAboutContextTypeOnFunctionComponent; + var didWarnAboutGetDerivedStateOnFunctionComponent; + var didWarnAboutFunctionRefs; + var didWarnAboutReassigningProps; + var didWarnAboutRevealOrder; + var didWarnAboutTailOptions; + didWarnAboutBadClass = {}; + didWarnAboutModulePatternComponent = {}; + didWarnAboutContextTypeOnFunctionComponent = {}; + didWarnAboutGetDerivedStateOnFunctionComponent = {}; + didWarnAboutFunctionRefs = {}; + didWarnAboutReassigningProps = false; + didWarnAboutRevealOrder = {}; + didWarnAboutTailOptions = {}; + function reconcileChildren(current, workInProgress, nextChildren, renderLanes) { + if (current === null) // If this is a fresh new component that hasn't been rendered yet, we + // won't update its child set by applying minimal side-effects. Instead, + // we will add them all to the child before it gets rendered. That means + // we can optimize this reconciliation pass by not tracking side-effects. + workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); + else // If the current child is the same as the work in progress, it means that + // we haven't yet started any work on these children. Therefore, we use + // the clone algorithm to create a copy of all the current children. + // If we had any progressed work already, that is invalid at this point so + // let's throw it out. + workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderLanes); + } + function forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes) { + // This function is fork of reconcileChildren. It's used in cases where we + // want to reconcile without matching against the existing set. This has the + // effect of all current children being unmounted; even if the type and key + // are the same, the old child is unmounted and a new child is created. + // + // To do this, we're going to go through the reconcile algorithm twice. In + // the first pass, we schedule a deletion for all the current children by + // passing null. + workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderLanes); // In the second pass, we mount the new children. The trick here is that we + // pass null in place of where we usually pass the current child set. This has + // the effect of remounting all children regardless of whether their + // identities match. + workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes); + } + function updateForwardRef(current, workInProgress, Component, nextProps, renderLanes) { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var innerPropTypes = Component.propTypes; + if (innerPropTypes) checkPropTypes(innerPropTypes, nextProps, "prop", getComponentName(Component)); + } + var render = Component.render; + var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent + var nextChildren; + prepareToReadContext(workInProgress, renderLanes); + ReactCurrentOwner$1.current = workInProgress; + setIsRendering(true); + nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes); + if (workInProgress.mode & StrictMode) { + disableLogs(); + try { + nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes); + } finally{ + reenableLogs(); + } + } + setIsRendering(false); + if (current !== null && !didReceiveUpdate) { + bailoutHooks(current, workInProgress, renderLanes); + return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } // React DevTools reads this flag. + workInProgress.flags |= PerformedWork; + reconcileChildren(current, workInProgress, nextChildren, renderLanes); + return workInProgress.child; + } + function updateMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) { + if (current === null) { + var type = Component.type; + if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either. + Component.defaultProps === undefined) { + var resolvedType = type; + resolvedType = resolveFunctionForHotReloading(type); + // and with only the default shallow comparison, we upgrade it + // to a SimpleMemoComponent to allow fast path updates. + workInProgress.tag = SimpleMemoComponent; + workInProgress.type = resolvedType; + validateFunctionComponentInDev(workInProgress, type); + return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, updateLanes, renderLanes); + } + var innerPropTypes = type.propTypes; + if (innerPropTypes) // Inner memo component props aren't currently validated in createElement. + // We could move it there, but we'd still need this for lazy code path. + checkPropTypes(innerPropTypes, nextProps, "prop", getComponentName(type)); + var child = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress, workInProgress.mode, renderLanes); + child.ref = workInProgress.ref; + child.return = workInProgress; + workInProgress.child = child; + return child; + } + var _type = Component.type; + var _innerPropTypes = _type.propTypes; + if (_innerPropTypes) // Inner memo component props aren't currently validated in createElement. + // We could move it there, but we'd still need this for lazy code path. + checkPropTypes(_innerPropTypes, nextProps, "prop", getComponentName(_type)); + var currentChild = current.child; // This is always exactly one child + if (!includesSomeLane(updateLanes, renderLanes)) { + // This will be the props with resolved defaultProps, + // unlike current.memoizedProps which will be the unresolved ones. + var prevProps = currentChild.memoizedProps; // Default to shallow comparison + var compare = Component.compare; + compare = compare !== null ? compare : shallowEqual; + if (compare(prevProps, nextProps) && current.ref === workInProgress.ref) return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } // React DevTools reads this flag. + workInProgress.flags |= PerformedWork; + var newChild = createWorkInProgress(currentChild, nextProps); + newChild.ref = workInProgress.ref; + newChild.return = workInProgress; + workInProgress.child = newChild; + return newChild; + } + function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, updateLanes, renderLanes) { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var outerMemoType = workInProgress.elementType; + if (outerMemoType.$$typeof === REACT_LAZY_TYPE) { + // We warn when you define propTypes on lazy() + // so let's just skip over it to find memo() outer wrapper. + // Inner props for memo are validated later. + var lazyComponent = outerMemoType; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + try { + outerMemoType = init(payload); + } catch (x) { + outerMemoType = null; + } // Inner propTypes will be validated in the function component path. + var outerPropTypes = outerMemoType && outerMemoType.propTypes; + if (outerPropTypes) checkPropTypes(outerPropTypes, nextProps, "prop", getComponentName(outerMemoType)); + } + } + if (current !== null) { + var prevProps = current.memoizedProps; + if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && workInProgress.type === current.type) { + didReceiveUpdate = false; + if (!includesSomeLane(renderLanes, updateLanes)) { + // The pending lanes were cleared at the beginning of beginWork. We're + // about to bail out, but there might be other lanes that weren't + // included in the current render. Usually, the priority level of the + // remaining updates is accumlated during the evaluation of the + // component (i.e. when processing the update queue). But since since + // we're bailing out early *without* evaluating the component, we need + // to account for it here, too. Reset to the value of the current fiber. + // NOTE: This only applies to SimpleMemoComponent, not MemoComponent, + // because a MemoComponent fiber does not have hooks or an update queue; + // rather, it wraps around an inner component, which may or may not + // contains hooks. + // TODO: Move the reset at in beginWork out of the common path so that + // this is no longer necessary. + workInProgress.lanes = current.lanes; + return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) // This is a special case that only exists for legacy mode. + // See https://github.com/facebook/react/pull/19216. + didReceiveUpdate = true; + } + } + return updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes); + } + function updateOffscreenComponent(current, workInProgress, renderLanes) { + var nextProps = workInProgress.pendingProps; + var nextChildren = nextProps.children; + var prevState = current !== null ? current.memoizedState : null; + if (nextProps.mode === "hidden" || nextProps.mode === "unstable-defer-without-hiding") { + if ((workInProgress.mode & ConcurrentMode) === NoMode) { + // In legacy sync mode, don't defer the subtree. Render it now. + // TODO: Figure out what we should do in Blocking mode. + var nextState = { + baseLanes: NoLanes + }; + workInProgress.memoizedState = nextState; + pushRenderLanes(workInProgress, renderLanes); + } else if (!includesSomeLane(renderLanes, OffscreenLane)) { + var nextBaseLanes; + if (prevState !== null) { + var prevBaseLanes = prevState.baseLanes; + nextBaseLanes = mergeLanes(prevBaseLanes, renderLanes); + } else nextBaseLanes = renderLanes; + // Schedule this fiber to re-render at offscreen priority. Then bailout. + markSpawnedWork(OffscreenLane); + workInProgress.lanes = workInProgress.childLanes = laneToLanes(OffscreenLane); + var _nextState = { + baseLanes: nextBaseLanes + }; + workInProgress.memoizedState = _nextState; // We're about to bail out, but we need to push this to the stack anyway + // to avoid a push/pop misalignment. + pushRenderLanes(workInProgress, nextBaseLanes); + return null; + } else { + // Rendering at offscreen, so we can clear the base lanes. + var _nextState2 = { + baseLanes: NoLanes + }; + workInProgress.memoizedState = _nextState2; // Push the lanes that were skipped when we bailed out. + var subtreeRenderLanes = prevState !== null ? prevState.baseLanes : renderLanes; + pushRenderLanes(workInProgress, subtreeRenderLanes); + } + } else { + var _subtreeRenderLanes; + if (prevState !== null) { + _subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes); // Since we're not hidden anymore, reset the state + workInProgress.memoizedState = null; + } else // We weren't previously hidden, and we still aren't, so there's nothing + // special to do. Need to push to the stack regardless, though, to avoid + // a push/pop misalignment. + _subtreeRenderLanes = renderLanes; + pushRenderLanes(workInProgress, _subtreeRenderLanes); + } + reconcileChildren(current, workInProgress, nextChildren, renderLanes); + return workInProgress.child; + } // Note: These happen to have identical begin phases, for now. We shouldn't hold + // ourselves to this constraint, though. If the behavior diverges, we should + // fork the function. + var updateLegacyHiddenComponent = updateOffscreenComponent; + function updateFragment(current, workInProgress, renderLanes) { + var nextChildren = workInProgress.pendingProps; + reconcileChildren(current, workInProgress, nextChildren, renderLanes); + return workInProgress.child; + } + function updateMode(current, workInProgress, renderLanes) { + var nextChildren = workInProgress.pendingProps.children; + reconcileChildren(current, workInProgress, nextChildren, renderLanes); + return workInProgress.child; + } + function updateProfiler(current, workInProgress, renderLanes) { + workInProgress.flags |= Update; // Reset effect durations for the next eventual effect phase. + // These are reset during render to allow the DevTools commit hook a chance to read them, + var stateNode = workInProgress.stateNode; + stateNode.effectDuration = 0; + stateNode.passiveEffectDuration = 0; + var nextProps = workInProgress.pendingProps; + var nextChildren = nextProps.children; + reconcileChildren(current, workInProgress, nextChildren, renderLanes); + return workInProgress.child; + } + function markRef(current, workInProgress) { + var ref = workInProgress.ref; + if (current === null && ref !== null || current !== null && current.ref !== ref) // Schedule a Ref effect + workInProgress.flags |= Ref; + } + function updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes) { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var innerPropTypes = Component.propTypes; + if (innerPropTypes) checkPropTypes(innerPropTypes, nextProps, "prop", getComponentName(Component)); + } + var context; + var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); + context = getMaskedContext(workInProgress, unmaskedContext); + var nextChildren; + prepareToReadContext(workInProgress, renderLanes); + ReactCurrentOwner$1.current = workInProgress; + setIsRendering(true); + nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); + if (workInProgress.mode & StrictMode) { + disableLogs(); + try { + nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); + } finally{ + reenableLogs(); + } + } + setIsRendering(false); + if (current !== null && !didReceiveUpdate) { + bailoutHooks(current, workInProgress, renderLanes); + return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } // React DevTools reads this flag. + workInProgress.flags |= PerformedWork; + reconcileChildren(current, workInProgress, nextChildren, renderLanes); + return workInProgress.child; + } + function updateClassComponent(current, workInProgress, Component, nextProps, renderLanes) { + if (workInProgress.type !== workInProgress.elementType) { + // Lazy component props can't be validated in createElement + // because they're only guaranteed to be resolved here. + var innerPropTypes = Component.propTypes; + if (innerPropTypes) checkPropTypes(innerPropTypes, nextProps, "prop", getComponentName(Component)); + } + // During mounting we don't know the child context yet as the instance doesn't exist. + // We will invalidate the child context in finishClassComponent() right after rendering. + var hasContext; + if (isContextProvider(Component)) { + hasContext = true; + pushContextProvider(workInProgress); + } else hasContext = false; + prepareToReadContext(workInProgress, renderLanes); + var instance = workInProgress.stateNode; + var shouldUpdate; + if (instance === null) { + if (current !== null) { + // A class component without an instance only mounts if it suspended + // inside a non-concurrent tree, in an inconsistent state. We want to + // treat it like a new mount, even though an empty version of it already + // committed. Disconnect the alternate pointers. + current.alternate = null; + workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.flags |= Placement; + } // In the initial pass we might need to construct the instance. + constructClassInstance(workInProgress, Component, nextProps); + mountClassInstance(workInProgress, Component, nextProps, renderLanes); + shouldUpdate = true; + } else if (current === null) // In a resume, we'll already have an instance we can reuse. + shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderLanes); + else shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderLanes); + var nextUnitOfWork = finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes); + var inst = workInProgress.stateNode; + if (shouldUpdate && inst.props !== nextProps) { + if (!didWarnAboutReassigningProps) error("It looks like %s is reassigning its own `this.props` while rendering. This is not supported and can lead to confusing bugs.", getComponentName(workInProgress.type) || "a component"); + didWarnAboutReassigningProps = true; + } + return nextUnitOfWork; + } + function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes) { + // Refs should update even if shouldComponentUpdate returns false + markRef(current, workInProgress); + var didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags; + if (!shouldUpdate && !didCaptureError) { + // Context providers should defer to sCU for rendering + if (hasContext) invalidateContextProvider(workInProgress, Component, false); + return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } + var instance = workInProgress.stateNode; // Rerender + ReactCurrentOwner$1.current = workInProgress; + var nextChildren; + if (didCaptureError && typeof Component.getDerivedStateFromError !== "function") { + // If we captured an error, but getDerivedStateFromError is not defined, + // unmount all the children. componentDidCatch will schedule an update to + // re-render a fallback. This is temporary until we migrate everyone to + // the new API. + // TODO: Warn in a future release. + nextChildren = null; + stopProfilerTimerIfRunning(); + } else { + setIsRendering(true); + nextChildren = instance.render(); + if (workInProgress.mode & StrictMode) { + disableLogs(); + try { + instance.render(); + } finally{ + reenableLogs(); + } + } + setIsRendering(false); + } // React DevTools reads this flag. + workInProgress.flags |= PerformedWork; + if (current !== null && didCaptureError) // If we're recovering from an error, reconcile without reusing any of + // the existing children. Conceptually, the normal children and the children + // that are shown on error are two different sets, so we shouldn't reuse + // normal children even if their identities match. + forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes); + else reconcileChildren(current, workInProgress, nextChildren, renderLanes); + // Memoize state using the values we just used to render. + // TODO: Restructure so we never read values from the instance. + workInProgress.memoizedState = instance.state; // The context might have changed so we need to recalculate it. + if (hasContext) invalidateContextProvider(workInProgress, Component, true); + return workInProgress.child; + } + function pushHostRootContext(workInProgress) { + var root = workInProgress.stateNode; + if (root.pendingContext) pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context); + else if (root.context) // Should always be set + pushTopLevelContextObject(workInProgress, root.context, false); + pushHostContainer(workInProgress, root.containerInfo); + } + function updateHostRoot(current, workInProgress, renderLanes) { + pushHostRootContext(workInProgress); + var updateQueue = workInProgress.updateQueue; + if (!(current !== null && updateQueue !== null)) throw Error("If the root does not have an updateQueue, we should have already bailed out. This error is likely caused by a bug in React. Please file an issue."); + var nextProps = workInProgress.pendingProps; + var prevState = workInProgress.memoizedState; + var prevChildren = prevState !== null ? prevState.element : null; + cloneUpdateQueue(current, workInProgress); + processUpdateQueue(workInProgress, nextProps, null, renderLanes); + var nextState = workInProgress.memoizedState; // Caution: React DevTools currently depends on this property + // being called "element". + var nextChildren = nextState.element; + if (nextChildren === prevChildren) { + resetHydrationState(); + return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } + var root = workInProgress.stateNode; + if (root.hydrate && enterHydrationState(workInProgress)) { + var mutableSourceEagerHydrationData = root.mutableSourceEagerHydrationData; + if (mutableSourceEagerHydrationData != null) for(var i = 0; i < mutableSourceEagerHydrationData.length; i += 2){ + var mutableSource = mutableSourceEagerHydrationData[i]; + var version = mutableSourceEagerHydrationData[i + 1]; + setWorkInProgressVersion(mutableSource, version); + } + var child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); + workInProgress.child = child; + var node = child; + while(node){ + // Mark each child as hydrating. This is a fast path to know whether this + // tree is part of a hydrating tree. This is used to determine if a child + // node has fully mounted yet, and for scheduling event replaying. + // Conceptually this is similar to Placement in that a new subtree is + // inserted into the React tree here. It just happens to not need DOM + // mutations because it already exists. + node.flags = node.flags & ~Placement | Hydrating; + node = node.sibling; + } + } else { + // Otherwise reset hydration state in case we aborted and resumed another + // root. + reconcileChildren(current, workInProgress, nextChildren, renderLanes); + resetHydrationState(); + } + return workInProgress.child; + } + function updateHostComponent(current, workInProgress, renderLanes) { + pushHostContext(workInProgress); + if (current === null) tryToClaimNextHydratableInstance(workInProgress); + var type = workInProgress.type; + var nextProps = workInProgress.pendingProps; + var prevProps = current !== null ? current.memoizedProps : null; + var nextChildren = nextProps.children; + var isDirectTextChild = shouldSetTextContent(type, nextProps); + if (isDirectTextChild) // We special case a direct text child of a host node. This is a common + // case. We won't handle it as a reified child. We will instead handle + // this in the host environment that also has access to this prop. That + // avoids allocating another HostText fiber and traversing it. + nextChildren = null; + else if (prevProps !== null && shouldSetTextContent(type, prevProps)) // If we're switching from a direct text child to a normal child, or to + // empty, we need to schedule the text content to be reset. + workInProgress.flags |= ContentReset; + markRef(current, workInProgress); + reconcileChildren(current, workInProgress, nextChildren, renderLanes); + return workInProgress.child; + } + function updateHostText(current, workInProgress) { + if (current === null) tryToClaimNextHydratableInstance(workInProgress); + // Nothing to do here. This is terminal. We'll do the completion step + // immediately after. + return null; + } + function mountLazyComponent(_current, workInProgress, elementType, updateLanes, renderLanes) { + if (_current !== null) { + // A lazy component only mounts if it suspended inside a non- + // concurrent tree, in an inconsistent state. We want to treat it like + // a new mount, even though an empty version of it already committed. + // Disconnect the alternate pointers. + _current.alternate = null; + workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.flags |= Placement; + } + var props = workInProgress.pendingProps; + var lazyComponent = elementType; + var payload = lazyComponent._payload; + var init = lazyComponent._init; + var Component = init(payload); // Store the unwrapped component in the type. + workInProgress.type = Component; + var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component); + var resolvedProps = resolveDefaultProps(Component, props); + var child; + switch(resolvedTag){ + case FunctionComponent: + validateFunctionComponentInDev(workInProgress, Component); + workInProgress.type = Component = resolveFunctionForHotReloading(Component); + child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderLanes); + return child; + case ClassComponent: + workInProgress.type = Component = resolveClassForHotReloading(Component); + child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderLanes); + return child; + case ForwardRef: + workInProgress.type = Component = resolveForwardRefForHotReloading(Component); + child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderLanes); + return child; + case MemoComponent: + if (workInProgress.type !== workInProgress.elementType) { + var outerPropTypes = Component.propTypes; + if (outerPropTypes) checkPropTypes(outerPropTypes, resolvedProps, "prop", getComponentName(Component)); + } + child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), updateLanes, renderLanes); + return child; + } + var hint = ""; + if (Component !== null && typeof Component === "object" && Component.$$typeof === REACT_LAZY_TYPE) hint = " Did you wrap a component in React.lazy() more than once?"; + throw Error("Element type is invalid. Received a promise that resolves to: " + Component + ". Lazy element type must resolve to a class or function." + hint); + } + function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderLanes) { + if (_current !== null) { + // An incomplete component only mounts if it suspended inside a non- + // concurrent tree, in an inconsistent state. We want to treat it like + // a new mount, even though an empty version of it already committed. + // Disconnect the alternate pointers. + _current.alternate = null; + workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.flags |= Placement; + } // Promote the fiber to a class and try rendering again. + workInProgress.tag = ClassComponent; // The rest of this function is a fork of `updateClassComponent` + // Push context providers early to prevent context stack mismatches. + // During mounting we don't know the child context yet as the instance doesn't exist. + // We will invalidate the child context in finishClassComponent() right after rendering. + var hasContext; + if (isContextProvider(Component)) { + hasContext = true; + pushContextProvider(workInProgress); + } else hasContext = false; + prepareToReadContext(workInProgress, renderLanes); + constructClassInstance(workInProgress, Component, nextProps); + mountClassInstance(workInProgress, Component, nextProps, renderLanes); + return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes); + } + function mountIndeterminateComponent(_current, workInProgress, Component, renderLanes) { + if (_current !== null) { + // An indeterminate component only mounts if it suspended inside a non- + // concurrent tree, in an inconsistent state. We want to treat it like + // a new mount, even though an empty version of it already committed. + // Disconnect the alternate pointers. + _current.alternate = null; + workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect + workInProgress.flags |= Placement; + } + var props = workInProgress.pendingProps; + var context; + var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); + context = getMaskedContext(workInProgress, unmaskedContext); + prepareToReadContext(workInProgress, renderLanes); + var value; + if (Component.prototype && typeof Component.prototype.render === "function") { + var componentName = getComponentName(Component) || "Unknown"; + if (!didWarnAboutBadClass[componentName]) { + error("The <%s /> component appears to have a render method, but doesn't extend React.Component. This is likely to cause errors. Change %s to extend React.Component instead.", componentName, componentName); + didWarnAboutBadClass[componentName] = true; + } + } + if (workInProgress.mode & StrictMode) ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null); + setIsRendering(true); + ReactCurrentOwner$1.current = workInProgress; + value = renderWithHooks(null, workInProgress, Component, props, context, renderLanes); + setIsRendering(false); + workInProgress.flags |= PerformedWork; + // Support for module components is deprecated and is removed behind a flag. + // Whether or not it would crash later, we want to show a good message in DEV first. + if (typeof value === "object" && value !== null && typeof value.render === "function" && value.$$typeof === undefined) { + var _componentName = getComponentName(Component) || "Unknown"; + if (!didWarnAboutModulePatternComponent[_componentName]) { + error("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.", _componentName, _componentName, _componentName); + didWarnAboutModulePatternComponent[_componentName] = true; + } + } + if (// Eventually we'll delete this branch altogether. + typeof value === "object" && value !== null && typeof value.render === "function" && value.$$typeof === undefined) { + var _componentName2 = getComponentName(Component) || "Unknown"; + if (!didWarnAboutModulePatternComponent[_componentName2]) { + error("The <%s /> component appears to be a function component that returns a class instance. Change %s to a class that extends React.Component instead. If you can't use a class try assigning the prototype on the function as a workaround. `%s.prototype = React.Component.prototype`. Don't use an arrow function since it cannot be called with `new` by React.", _componentName2, _componentName2, _componentName2); + didWarnAboutModulePatternComponent[_componentName2] = true; + } + workInProgress.tag = ClassComponent; // Throw out any hooks that were used. + workInProgress.memoizedState = null; + workInProgress.updateQueue = null; // Push context providers early to prevent context stack mismatches. + // During mounting we don't know the child context yet as the instance doesn't exist. + // We will invalidate the child context in finishClassComponent() right after rendering. + var hasContext = false; + if (isContextProvider(Component)) { + hasContext = true; + pushContextProvider(workInProgress); + } else hasContext = false; + workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null; + initializeUpdateQueue(workInProgress); + var getDerivedStateFromProps = Component.getDerivedStateFromProps; + if (typeof getDerivedStateFromProps === "function") applyDerivedStateFromProps(workInProgress, Component, getDerivedStateFromProps, props); + adoptClassInstance(workInProgress, value); + mountClassInstance(workInProgress, Component, props, renderLanes); + return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes); + } else { + // Proceed under the assumption that this is a function component + workInProgress.tag = FunctionComponent; + if (workInProgress.mode & StrictMode) { + disableLogs(); + try { + value = renderWithHooks(null, workInProgress, Component, props, context, renderLanes); + } finally{ + reenableLogs(); + } + } + reconcileChildren(null, workInProgress, value, renderLanes); + validateFunctionComponentInDev(workInProgress, Component); + return workInProgress.child; + } + } + function validateFunctionComponentInDev(workInProgress, Component) { + if (Component) { + if (Component.childContextTypes) error("%s(...): childContextTypes cannot be defined on a function component.", Component.displayName || Component.name || "Component"); + } + if (workInProgress.ref !== null) { + var info = ""; + var ownerName = getCurrentFiberOwnerNameInDevOrNull(); + if (ownerName) info += "\n\nCheck the render method of `" + ownerName + "`."; + var warningKey = ownerName || workInProgress._debugID || ""; + var debugSource = workInProgress._debugSource; + if (debugSource) warningKey = debugSource.fileName + ":" + debugSource.lineNumber; + if (!didWarnAboutFunctionRefs[warningKey]) { + didWarnAboutFunctionRefs[warningKey] = true; + error("Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?%s", info); + } + } + if (typeof Component.getDerivedStateFromProps === "function") { + var _componentName3 = getComponentName(Component) || "Unknown"; + if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) { + error("%s: Function components do not support getDerivedStateFromProps.", _componentName3); + didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true; + } + } + if (typeof Component.contextType === "object" && Component.contextType !== null) { + var _componentName4 = getComponentName(Component) || "Unknown"; + if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) { + error("%s: Function components do not support contextType.", _componentName4); + didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true; + } + } + } + var SUSPENDED_MARKER = { + dehydrated: null, + retryLane: NoLane + }; + function mountSuspenseOffscreenState(renderLanes) { + return { + baseLanes: renderLanes + }; + } + function updateSuspenseOffscreenState(prevOffscreenState, renderLanes) { + return { + baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes) + }; + } // TODO: Probably should inline this back + function shouldRemainOnFallback(suspenseContext, current, workInProgress, renderLanes) { + // If we're already showing a fallback, there are cases where we need to + // remain on that fallback regardless of whether the content has resolved. + // For example, SuspenseList coordinates when nested content appears. + if (current !== null) { + var suspenseState = current.memoizedState; + if (suspenseState === null) // Currently showing content. Don't hide it, even if ForceSuspenseFallack + // is true. More precise name might be "ForceRemainSuspenseFallback". + // Note: This is a factoring smell. Can't remain on a fallback if there's + // no fallback to remain on. + return false; + } // Not currently showing content. Consult the Suspense context. + return hasSuspenseContext(suspenseContext, ForceSuspenseFallback); + } + function getRemainingWorkInPrimaryTree(current, renderLanes) { + // TODO: Should not remove render lanes that were pinged during this render + return removeLanes(current.childLanes, renderLanes); + } + function updateSuspenseComponent(current, workInProgress, renderLanes) { + var nextProps = workInProgress.pendingProps; // This is used by DevTools to force a boundary to suspend. + if (shouldSuspend(workInProgress)) workInProgress.flags |= DidCapture; + var suspenseContext = suspenseStackCursor.current; + var showFallback = false; + var didSuspend = (workInProgress.flags & DidCapture) !== NoFlags; + if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) { + // Something in this boundary's subtree already suspended. Switch to + // rendering the fallback children. + showFallback = true; + workInProgress.flags &= ~DidCapture; + } else { + // Attempting the main content + if (current === null || current.memoizedState !== null) // This is a new mount or this boundary is already showing a fallback state. + // Mark this subtree context as having at least one invisible parent that could + // handle the fallback state. + // Boundaries without fallbacks or should be avoided are not considered since + // they cannot handle preferred fallback states. + { + if (nextProps.fallback !== undefined && nextProps.unstable_avoidThisFallback !== true) suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext); + } + } + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + pushSuspenseContext(workInProgress, suspenseContext); // OK, the next part is confusing. We're about to reconcile the Suspense + // boundary's children. This involves some custom reconcilation logic. Two + // main reasons this is so complicated. + // + // First, Legacy Mode has different semantics for backwards compatibility. The + // primary tree will commit in an inconsistent state, so when we do the + // second pass to render the fallback, we do some exceedingly, uh, clever + // hacks to make that not totally break. Like transferring effects and + // deletions from hidden tree. In Concurrent Mode, it's much simpler, + // because we bailout on the primary tree completely and leave it in its old + // state, no effects. Same as what we do for Offscreen (except that + // Offscreen doesn't have the first render pass). + // + // Second is hydration. During hydration, the Suspense fiber has a slightly + // different layout, where the child points to a dehydrated fragment, which + // contains the DOM rendered by the server. + // + // Third, even if you set all that aside, Suspense is like error boundaries in + // that we first we try to render one tree, and if that fails, we render again + // and switch to a different tree. Like a try/catch block. So we have to track + // which branch we're currently rendering. Ideally we would model this using + // a stack. + if (current === null) { + // Initial mount + // If we're currently hydrating, try to hydrate this boundary. + // But only if this has a fallback. + if (nextProps.fallback !== undefined) tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component. + var nextPrimaryChildren = nextProps.children; + var nextFallbackChildren = nextProps.fallback; + if (showFallback) { + var fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes); + var primaryChildFragment = workInProgress.child; + primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + workInProgress.memoizedState = SUSPENDED_MARKER; + return fallbackFragment; + } else if (typeof nextProps.unstable_expectedLoadTime === "number") { + // This is a CPU-bound tree. Skip this tree and show a placeholder to + // unblock the surrounding content. Then immediately retry after the + // initial commit. + var _fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes); + var _primaryChildFragment = workInProgress.child; + _primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); + workInProgress.memoizedState = SUSPENDED_MARKER; // Since nothing actually suspended, there will nothing to ping this to + // get it started back up to attempt the next item. While in terms of + // priority this work has the same priority as this current render, it's + // not part of the same transition once the transition has committed. If + // it's sync, we still want to yield so that it can be painted. + // Conceptually, this is really the same as pinging. We can use any + // RetryLane even if it's the one currently rendering since we're leaving + // it behind on this node. + workInProgress.lanes = SomeRetryLane; + markSpawnedWork(SomeRetryLane); + return _fallbackFragment; + } else return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren, renderLanes); + } else { + // This is an update. + // If the current fiber has a SuspenseState, that means it's already showing + // a fallback. + var prevState = current.memoizedState; + if (prevState !== null) { + if (showFallback) { + var _nextFallbackChildren2 = nextProps.fallback; + var _nextPrimaryChildren2 = nextProps.children; + var _fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren2, _nextFallbackChildren2, renderLanes); + var _primaryChildFragment3 = workInProgress.child; + var prevOffscreenState = current.child.memoizedState; + _primaryChildFragment3.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes); + _primaryChildFragment3.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); + workInProgress.memoizedState = SUSPENDED_MARKER; + return _fallbackChildFragment; + } else { + var _nextPrimaryChildren3 = nextProps.children; + var _primaryChildFragment4 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren3, renderLanes); + workInProgress.memoizedState = null; + return _primaryChildFragment4; + } + } else // The current tree is not already showing a fallback. + if (showFallback) { + // Timed out. + var _nextFallbackChildren3 = nextProps.fallback; + var _nextPrimaryChildren4 = nextProps.children; + var _fallbackChildFragment2 = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren4, _nextFallbackChildren3, renderLanes); + var _primaryChildFragment5 = workInProgress.child; + var _prevOffscreenState = current.child.memoizedState; + _primaryChildFragment5.memoizedState = _prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(_prevOffscreenState, renderLanes); + _primaryChildFragment5.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); // Skip the primary children, and continue working on the + // fallback children. + workInProgress.memoizedState = SUSPENDED_MARKER; + return _fallbackChildFragment2; + } else { + // Still haven't timed out. Continue rendering the children, like we + // normally do. + var _nextPrimaryChildren5 = nextProps.children; + var _primaryChildFragment6 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren5, renderLanes); + workInProgress.memoizedState = null; + return _primaryChildFragment6; + } + } + } + function mountSuspensePrimaryChildren(workInProgress, primaryChildren, renderLanes) { + var mode = workInProgress.mode; + var primaryChildProps = { + mode: "visible", + children: primaryChildren + }; + var primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, renderLanes, null); + primaryChildFragment.return = workInProgress; + workInProgress.child = primaryChildFragment; + return primaryChildFragment; + } + function mountSuspenseFallbackChildren(workInProgress, primaryChildren, fallbackChildren, renderLanes) { + var mode = workInProgress.mode; + var progressedPrimaryFragment = workInProgress.child; + var primaryChildProps = { + mode: "hidden", + children: primaryChildren + }; + var primaryChildFragment; + var fallbackChildFragment; + if ((mode & BlockingMode) === NoMode && progressedPrimaryFragment !== null) { + // In legacy mode, we commit the primary tree as if it successfully + // completed, even though it's in an inconsistent state. + primaryChildFragment = progressedPrimaryFragment; + primaryChildFragment.childLanes = NoLanes; + primaryChildFragment.pendingProps = primaryChildProps; + if (workInProgress.mode & ProfileMode) { + // Reset the durations from the first pass so they aren't included in the + // final amounts. This seems counterintuitive, since we're intentionally + // not measuring part of the render phase, but this makes it match what we + // do in Concurrent Mode. + primaryChildFragment.actualDuration = 0; + primaryChildFragment.actualStartTime = -1; + primaryChildFragment.selfBaseDuration = 0; + primaryChildFragment.treeBaseDuration = 0; + } + fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); + } else { + primaryChildFragment = createFiberFromOffscreen(primaryChildProps, mode, NoLanes, null); + fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); + } + primaryChildFragment.return = workInProgress; + fallbackChildFragment.return = workInProgress; + primaryChildFragment.sibling = fallbackChildFragment; + workInProgress.child = primaryChildFragment; + return fallbackChildFragment; + } + function createWorkInProgressOffscreenFiber(current, offscreenProps) { + // The props argument to `createWorkInProgress` is `any` typed, so we use this + // wrapper function to constrain it. + return createWorkInProgress(current, offscreenProps); + } + function updateSuspensePrimaryChildren(current, workInProgress, primaryChildren, renderLanes) { + var currentPrimaryChildFragment = current.child; + var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; + var primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, { + mode: "visible", + children: primaryChildren + }); + if ((workInProgress.mode & BlockingMode) === NoMode) primaryChildFragment.lanes = renderLanes; + primaryChildFragment.return = workInProgress; + primaryChildFragment.sibling = null; + if (currentFallbackChildFragment !== null) { + // Delete the fallback child fragment + currentFallbackChildFragment.nextEffect = null; + currentFallbackChildFragment.flags = Deletion; + workInProgress.firstEffect = workInProgress.lastEffect = currentFallbackChildFragment; + } + workInProgress.child = primaryChildFragment; + return primaryChildFragment; + } + function updateSuspenseFallbackChildren(current, workInProgress, primaryChildren, fallbackChildren, renderLanes) { + var mode = workInProgress.mode; + var currentPrimaryChildFragment = current.child; + var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; + var primaryChildProps = { + mode: "hidden", + children: primaryChildren + }; + var primaryChildFragment; + if (// completed, even though it's in an inconsistent state. + (mode & BlockingMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was + // already cloned. In legacy mode, the only case where this isn't true is + // when DevTools forces us to display a fallback; we skip the first render + // pass entirely and go straight to rendering the fallback. (In Concurrent + // Mode, SuspenseList can also trigger this scenario, but this is a legacy- + // only codepath.) + workInProgress.child !== currentPrimaryChildFragment) { + var progressedPrimaryFragment = workInProgress.child; + primaryChildFragment = progressedPrimaryFragment; + primaryChildFragment.childLanes = NoLanes; + primaryChildFragment.pendingProps = primaryChildProps; + if (workInProgress.mode & ProfileMode) { + // Reset the durations from the first pass so they aren't included in the + // final amounts. This seems counterintuitive, since we're intentionally + // not measuring part of the render phase, but this makes it match what we + // do in Concurrent Mode. + primaryChildFragment.actualDuration = 0; + primaryChildFragment.actualStartTime = -1; + primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration; + primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration; + } // The fallback fiber was added as a deletion effect during the first pass. + // However, since we're going to remain on the fallback, we no longer want + // to delete it. So we need to remove it from the list. Deletions are stored + // on the same list as effects. We want to keep the effects from the primary + // tree. So we copy the primary child fragment's effect list, which does not + // include the fallback deletion effect. + var progressedLastEffect = primaryChildFragment.lastEffect; + if (progressedLastEffect !== null) { + workInProgress.firstEffect = primaryChildFragment.firstEffect; + workInProgress.lastEffect = progressedLastEffect; + progressedLastEffect.nextEffect = null; + } else // TODO: Reset this somewhere else? Lol legacy mode is so weird. + workInProgress.firstEffect = workInProgress.lastEffect = null; + } else primaryChildFragment = createWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps); + var fallbackChildFragment; + if (currentFallbackChildFragment !== null) fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, fallbackChildren); + else { + fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already + // mounted but this is a new fiber. + fallbackChildFragment.flags |= Placement; + } + fallbackChildFragment.return = workInProgress; + primaryChildFragment.return = workInProgress; + primaryChildFragment.sibling = fallbackChildFragment; + workInProgress.child = primaryChildFragment; + return fallbackChildFragment; + } + function scheduleWorkOnFiber(fiber, renderLanes) { + fiber.lanes = mergeLanes(fiber.lanes, renderLanes); + var alternate = fiber.alternate; + if (alternate !== null) alternate.lanes = mergeLanes(alternate.lanes, renderLanes); + scheduleWorkOnParentPath(fiber.return, renderLanes); + } + function propagateSuspenseContextChange(workInProgress, firstChild, renderLanes) { + // Mark any Suspense boundaries with fallbacks as having work to do. + // If they were previously forced into fallbacks, they may now be able + // to unblock. + var node = firstChild; + while(node !== null){ + if (node.tag === SuspenseComponent) { + var state = node.memoizedState; + if (state !== null) scheduleWorkOnFiber(node, renderLanes); + } else if (node.tag === SuspenseListComponent) // If the tail is hidden there might not be an Suspense boundaries + // to schedule work on. In this case we have to schedule it on the + // list itself. + // We don't have to traverse to the children of the list since + // the list will propagate the change when it rerenders. + scheduleWorkOnFiber(node, renderLanes); + else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) return; + while(node.sibling === null){ + if (node.return === null || node.return === workInProgress) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + function findLastContentRow(firstChild) { + // This is going to find the last row among these children that is already + // showing content on the screen, as opposed to being in fallback state or + // new. If a row has multiple Suspense boundaries, any of them being in the + // fallback state, counts as the whole row being in a fallback state. + // Note that the "rows" will be workInProgress, but any nested children + // will still be current since we haven't rendered them yet. The mounted + // order may not be the same as the new order. We use the new order. + var row = firstChild; + var lastContentRow = null; + while(row !== null){ + var currentRow = row.alternate; // New rows can't be content rows. + if (currentRow !== null && findFirstSuspended(currentRow) === null) lastContentRow = row; + row = row.sibling; + } + return lastContentRow; + } + function validateRevealOrder(revealOrder) { + if (revealOrder !== undefined && revealOrder !== "forwards" && revealOrder !== "backwards" && revealOrder !== "together" && !didWarnAboutRevealOrder[revealOrder]) { + didWarnAboutRevealOrder[revealOrder] = true; + if (typeof revealOrder === "string") switch(revealOrder.toLowerCase()){ + case "together": + case "forwards": + case "backwards": + error('"%s" is not a valid value for revealOrder on . Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase()); + break; + case "forward": + case "backward": + error('"%s" is not a valid value for revealOrder on . React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase()); + break; + default: + error('"%s" is not a supported revealOrder on . Did you mean "together", "forwards" or "backwards"?', revealOrder); + break; + } + else error('%s is not a supported value for revealOrder on . Did you mean "together", "forwards" or "backwards"?', revealOrder); + } + } + function validateTailOptions(tailMode, revealOrder) { + if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) { + if (tailMode !== "collapsed" && tailMode !== "hidden") { + didWarnAboutTailOptions[tailMode] = true; + error('"%s" is not a supported value for tail on . Did you mean "collapsed" or "hidden"?', tailMode); + } else if (revealOrder !== "forwards" && revealOrder !== "backwards") { + didWarnAboutTailOptions[tailMode] = true; + error(' is only valid if revealOrder is "forwards" or "backwards". Did you mean to specify revealOrder="forwards"?', tailMode); + } + } + } + function validateSuspenseListNestedChild(childSlot, index) { + var isArray = Array.isArray(childSlot); + var isIterable = !isArray && typeof getIteratorFn(childSlot) === "function"; + if (isArray || isIterable) { + var type = isArray ? "array" : "iterable"; + error("A nested %s was passed to row #%s in . Wrap it in an additional SuspenseList to configure its revealOrder: ... {%s} ... ", type, index, type); + return false; + } + return true; + } + function validateSuspenseListChildren(children, revealOrder) { + if ((revealOrder === "forwards" || revealOrder === "backwards") && children !== undefined && children !== null && children !== false) { + if (Array.isArray(children)) for(var i = 0; i < children.length; i++){ + if (!validateSuspenseListNestedChild(children[i], i)) return; + } + else { + var iteratorFn = getIteratorFn(children); + if (typeof iteratorFn === "function") { + var childrenIterator = iteratorFn.call(children); + if (childrenIterator) { + var step = childrenIterator.next(); + var _i = 0; + for(; !step.done; step = childrenIterator.next()){ + if (!validateSuspenseListNestedChild(step.value, _i)) return; + _i++; + } + } + } else error('A single row was passed to a . This is not useful since it needs multiple rows. Did you mean to pass multiple children or an array?', revealOrder); + } + } + } + function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode, lastEffectBeforeRendering) { + var renderState = workInProgress.memoizedState; + if (renderState === null) workInProgress.memoizedState = { + isBackwards: isBackwards, + rendering: null, + renderingStartTime: 0, + last: lastContentRow, + tail: tail, + tailMode: tailMode, + lastEffect: lastEffectBeforeRendering + }; + else { + // We can reuse the existing object from previous renders. + renderState.isBackwards = isBackwards; + renderState.rendering = null; + renderState.renderingStartTime = 0; + renderState.last = lastContentRow; + renderState.tail = tail; + renderState.tailMode = tailMode; + renderState.lastEffect = lastEffectBeforeRendering; + } + } // This can end up rendering this component multiple passes. + // The first pass splits the children fibers into two sets. A head and tail. + // We first render the head. If anything is in fallback state, we do another + // pass through beginWork to rerender all children (including the tail) with + // the force suspend context. If the first render didn't have anything in + // in fallback state. Then we render each row in the tail one-by-one. + // That happens in the completeWork phase without going back to beginWork. + function updateSuspenseListComponent(current, workInProgress, renderLanes) { + var nextProps = workInProgress.pendingProps; + var revealOrder = nextProps.revealOrder; + var tailMode = nextProps.tail; + var newChildren = nextProps.children; + validateRevealOrder(revealOrder); + validateTailOptions(tailMode, revealOrder); + validateSuspenseListChildren(newChildren, revealOrder); + reconcileChildren(current, workInProgress, newChildren, renderLanes); + var suspenseContext = suspenseStackCursor.current; + var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback); + if (shouldForceFallback) { + suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); + workInProgress.flags |= DidCapture; + } else { + var didSuspendBefore = current !== null && (current.flags & DidCapture) !== NoFlags; + if (didSuspendBefore) // If we previously forced a fallback, we need to schedule work + // on any nested boundaries to let them know to try to render + // again. This is the same as context updating. + propagateSuspenseContextChange(workInProgress, workInProgress.child, renderLanes); + suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + } + pushSuspenseContext(workInProgress, suspenseContext); + if ((workInProgress.mode & BlockingMode) === NoMode) // In legacy mode, SuspenseList doesn't work so we just + // use make it a noop by treating it as the default revealOrder. + workInProgress.memoizedState = null; + else switch(revealOrder){ + case "forwards": + var lastContentRow = findLastContentRow(workInProgress.child); + var tail; + if (lastContentRow === null) { + // The whole list is part of the tail. + // TODO: We could fast path by just rendering the tail now. + tail = workInProgress.child; + workInProgress.child = null; + } else { + // Disconnect the tail rows after the content row. + // We're going to render them separately later. + tail = lastContentRow.sibling; + lastContentRow.sibling = null; + } + initSuspenseListRenderState(workInProgress, false, tail, lastContentRow, tailMode, workInProgress.lastEffect); + break; + case "backwards": + // We're going to find the first row that has existing content. + // At the same time we're going to reverse the list of everything + // we pass in the meantime. That's going to be our tail in reverse + // order. + var _tail = null; + var row = workInProgress.child; + workInProgress.child = null; + while(row !== null){ + var currentRow = row.alternate; // New rows can't be content rows. + if (currentRow !== null && findFirstSuspended(currentRow) === null) { + // This is the beginning of the main content. + workInProgress.child = row; + break; + } + var nextRow = row.sibling; + row.sibling = _tail; + _tail = row; + row = nextRow; + } // TODO: If workInProgress.child is null, we can continue on the tail immediately. + initSuspenseListRenderState(workInProgress, true, _tail, null, tailMode, workInProgress.lastEffect); + break; + case "together": + initSuspenseListRenderState(workInProgress, false, null, null, undefined, workInProgress.lastEffect); + break; + default: + // The default reveal order is the same as not having + // a boundary. + workInProgress.memoizedState = null; + } + return workInProgress.child; + } + function updatePortalComponent(current, workInProgress, renderLanes) { + pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); + var nextChildren = workInProgress.pendingProps; + if (current === null) // Portals are special because we don't append the children during mount + // but at commit. Therefore we need to track insertions which the normal + // flow doesn't do during mount. This doesn't happen at the root because + // the root always starts with a "current" with a null child. + // TODO: Consider unifying this with how the root works. + workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes); + else reconcileChildren(current, workInProgress, nextChildren, renderLanes); + return workInProgress.child; + } + var hasWarnedAboutUsingNoValuePropOnContextProvider = false; + function updateContextProvider(current, workInProgress, renderLanes) { + var providerType = workInProgress.type; + var context = providerType._context; + var newProps = workInProgress.pendingProps; + var oldProps = workInProgress.memoizedProps; + var newValue = newProps.value; + if (!("value" in newProps)) { + if (!hasWarnedAboutUsingNoValuePropOnContextProvider) { + hasWarnedAboutUsingNoValuePropOnContextProvider = true; + error("The `value` prop is required for the ``. Did you misspell it or forget to pass it?"); + } + } + var providerPropTypes = workInProgress.type.propTypes; + if (providerPropTypes) checkPropTypes(providerPropTypes, newProps, "prop", "Context.Provider"); + pushProvider(workInProgress, newValue); + if (oldProps !== null) { + var oldValue = oldProps.value; + var changedBits = calculateChangedBits(context, newValue, oldValue); + if (changedBits === 0) { + // No change. Bailout early if children are the same. + if (oldProps.children === newProps.children && !hasContextChanged()) return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } else // The context value changed. Search for matching consumers and schedule + // them to update. + propagateContextChange(workInProgress, context, changedBits, renderLanes); + } + var newChildren = newProps.children; + reconcileChildren(current, workInProgress, newChildren, renderLanes); + return workInProgress.child; + } + var hasWarnedAboutUsingContextAsConsumer = false; + function updateContextConsumer(current, workInProgress, renderLanes) { + var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In + if (context._context === undefined) { + // This may be because it's a Context (rather than a Consumer). + // Or it may be because it's older React where they're the same thing. + // We only want to warn if we're sure it's a new React. + if (context !== context.Consumer) { + if (!hasWarnedAboutUsingContextAsConsumer) { + hasWarnedAboutUsingContextAsConsumer = true; + error("Rendering directly is not supported and will be removed in a future major release. Did you mean to render instead?"); + } + } + } else context = context._context; + var newProps = workInProgress.pendingProps; + var render = newProps.children; + if (typeof render !== "function") error("A context consumer was rendered with multiple children, or a child that isn't a function. A context consumer expects a single child that is a function. If you did pass a function, make sure there is no trailing or leading whitespace around it."); + prepareToReadContext(workInProgress, renderLanes); + var newValue = readContext(context, newProps.unstable_observedBits); + var newChildren; + ReactCurrentOwner$1.current = workInProgress; + setIsRendering(true); + newChildren = render(newValue); + setIsRendering(false); + workInProgress.flags |= PerformedWork; + reconcileChildren(current, workInProgress, newChildren, renderLanes); + return workInProgress.child; + } + function markWorkInProgressReceivedUpdate() { + didReceiveUpdate = true; + } + function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) { + if (current !== null) // Reuse previous dependencies + workInProgress.dependencies = current.dependencies; + // Don't update "base" render times for bailouts. + stopProfilerTimerIfRunning(); + markSkippedUpdateLanes(workInProgress.lanes); // Check if the children have any pending work. + if (!includesSomeLane(renderLanes, workInProgress.childLanes)) // The children don't have any work either. We can skip them. + // TODO: Once we add back resuming, we should check if the children are + // a work-in-progress set. If so, we need to transfer their effects. + return null; + else { + // This fiber doesn't have work, but its subtree does. Clone the child + // fibers and continue. + cloneChildFibers(current, workInProgress); + return workInProgress.child; + } + } + function remountFiber(current, oldWorkInProgress, newWorkInProgress) { + var returnFiber = oldWorkInProgress.return; + if (returnFiber === null) throw new Error("Cannot swap the root fiber."); + // Disconnect from the old current. + // It will get deleted. + current.alternate = null; + oldWorkInProgress.alternate = null; // Connect to the new tree. + newWorkInProgress.index = oldWorkInProgress.index; + newWorkInProgress.sibling = oldWorkInProgress.sibling; + newWorkInProgress.return = oldWorkInProgress.return; + newWorkInProgress.ref = oldWorkInProgress.ref; // Replace the child/sibling pointers above it. + if (oldWorkInProgress === returnFiber.child) returnFiber.child = newWorkInProgress; + else { + var prevSibling = returnFiber.child; + if (prevSibling === null) throw new Error("Expected parent to have a child."); + while(prevSibling.sibling !== oldWorkInProgress){ + prevSibling = prevSibling.sibling; + if (prevSibling === null) throw new Error("Expected to find the previous sibling."); + } + prevSibling.sibling = newWorkInProgress; + } // Delete the old fiber and place the new one. + // Since the old fiber is disconnected, we have to schedule it manually. + var last = returnFiber.lastEffect; + if (last !== null) { + last.nextEffect = current; + returnFiber.lastEffect = current; + } else returnFiber.firstEffect = returnFiber.lastEffect = current; + current.nextEffect = null; + current.flags = Deletion; + newWorkInProgress.flags |= Placement; // Restart work from the new fiber. + return newWorkInProgress; + } + function beginWork(current, workInProgress, renderLanes) { + var updateLanes = workInProgress.lanes; + if (workInProgress._debugNeedsRemount && current !== null) // This will restart the begin phase with a new fiber. + return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes)); + if (current !== null) { + var oldProps = current.memoizedProps; + var newProps = workInProgress.pendingProps; + if (oldProps !== newProps || hasContextChanged() || workInProgress.type !== current.type) // If props or context changed, mark the fiber as having performed work. + // This may be unset if the props are determined to be equal later (memo). + didReceiveUpdate = true; + else if (!includesSomeLane(renderLanes, updateLanes)) { + didReceiveUpdate = false; // This fiber does not have any pending work. Bailout without entering + // the begin phase. There's still some bookkeeping we that needs to be done + // in this optimized path, mostly pushing stuff onto the stack. + switch(workInProgress.tag){ + case HostRoot: + pushHostRootContext(workInProgress); + resetHydrationState(); + break; + case HostComponent: + pushHostContext(workInProgress); + break; + case ClassComponent: + var Component = workInProgress.type; + if (isContextProvider(Component)) pushContextProvider(workInProgress); + break; + case HostPortal: + pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); + break; + case ContextProvider: + var newValue = workInProgress.memoizedProps.value; + pushProvider(workInProgress, newValue); + break; + case Profiler: + // Profiler should only call onRender when one of its descendants actually rendered. + var hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); + if (hasChildWork) workInProgress.flags |= Update; + // Reset effect durations for the next eventual effect phase. + // These are reset during render to allow the DevTools commit hook a chance to read them, + var stateNode = workInProgress.stateNode; + stateNode.effectDuration = 0; + stateNode.passiveEffectDuration = 0; + break; + case SuspenseComponent: + var state = workInProgress.memoizedState; + if (state !== null) { + // whether to retry the primary children, or to skip over it and + // go straight to the fallback. Check the priority of the primary + // child fragment. + var primaryChildFragment = workInProgress.child; + var primaryChildLanes = primaryChildFragment.childLanes; + if (includesSomeLane(renderLanes, primaryChildLanes)) // The primary children have pending work. Use the normal path + // to attempt to render the primary children again. + return updateSuspenseComponent(current, workInProgress, renderLanes); + else { + // The primary child fragment does not have pending work marked + // on it + pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // The primary children do not have pending work with sufficient + // priority. Bailout. + var child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + if (child !== null) // The fallback children have pending work. Skip over the + // primary children and work on the fallback. + return child.sibling; + else return null; + } + } else pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); + break; + case SuspenseListComponent: + var didSuspendBefore = (current.flags & DidCapture) !== NoFlags; + var _hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); + if (didSuspendBefore) { + if (_hasChildWork) // If something was in fallback state last time, and we have all the + // same children then we're still in progressive loading state. + // Something might get unblocked by state updates or retries in the + // tree which will affect the tail. So we need to use the normal + // path to compute the correct tail. + return updateSuspenseListComponent(current, workInProgress, renderLanes); + // If none of the children had any work, that means that none of + // them got retried so they'll still be blocked in the same way + // as before. We can fast bail out. + workInProgress.flags |= DidCapture; + } // If nothing suspended before and we're rendering the same children, + // then the tail doesn't matter. Anything new that suspends will work + // in the "together" mode, so we can continue from the state we had. + var renderState = workInProgress.memoizedState; + if (renderState !== null) { + // Reset to the "together" mode in case we've started a different + // update in the past but didn't complete it. + renderState.rendering = null; + renderState.tail = null; + renderState.lastEffect = null; + } + pushSuspenseContext(workInProgress, suspenseStackCursor.current); + if (_hasChildWork) break; + else // If none of the children had any work, that means that none of + // them got retried so they'll still be blocked in the same way + // as before. We can fast bail out. + return null; + case OffscreenComponent: + case LegacyHiddenComponent: + // Need to check if the tree still needs to be deferred. This is + // almost identical to the logic used in the normal update path, + // so we'll just enter that. The only difference is we'll bail out + // at the next level instead of this one, because the child props + // have not changed. Which is fine. + // TODO: Probably should refactor `beginWork` to split the bailout + // path from the normal path. I'm tempted to do a labeled break here + // but I won't :) + workInProgress.lanes = NoLanes; + return updateOffscreenComponent(current, workInProgress, renderLanes); + } + return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); + } else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) // This is a special case that only exists for legacy mode. + // See https://github.com/facebook/react/pull/19216. + didReceiveUpdate = true; + else // An update was scheduled on this fiber, but there are no new props + // nor legacy context. Set this to false. If an update queue or context + // consumer produces a changed value, it will set this to true. Otherwise, + // the component will assume the children have not changed and bail out. + didReceiveUpdate = false; + } else didReceiveUpdate = false; + // Before entering the begin phase, clear pending update priority. + // TODO: This assumes that we're about to evaluate the component and process + // the update queue. However, there's an exception: SimpleMemoComponent + // sometimes bails out later in the begin phase. This indicates that we should + // move this assignment out of the common path and into each branch. + workInProgress.lanes = NoLanes; + switch(workInProgress.tag){ + case IndeterminateComponent: + return mountIndeterminateComponent(current, workInProgress, workInProgress.type, renderLanes); + case LazyComponent: + var elementType = workInProgress.elementType; + return mountLazyComponent(current, workInProgress, elementType, updateLanes, renderLanes); + case FunctionComponent: + var _Component = workInProgress.type; + var unresolvedProps = workInProgress.pendingProps; + var resolvedProps = workInProgress.elementType === _Component ? unresolvedProps : resolveDefaultProps(_Component, unresolvedProps); + return updateFunctionComponent(current, workInProgress, _Component, resolvedProps, renderLanes); + case ClassComponent: + var _Component2 = workInProgress.type; + var _unresolvedProps = workInProgress.pendingProps; + var _resolvedProps = workInProgress.elementType === _Component2 ? _unresolvedProps : resolveDefaultProps(_Component2, _unresolvedProps); + return updateClassComponent(current, workInProgress, _Component2, _resolvedProps, renderLanes); + case HostRoot: + return updateHostRoot(current, workInProgress, renderLanes); + case HostComponent: + return updateHostComponent(current, workInProgress, renderLanes); + case HostText: + return updateHostText(current, workInProgress); + case SuspenseComponent: + return updateSuspenseComponent(current, workInProgress, renderLanes); + case HostPortal: + return updatePortalComponent(current, workInProgress, renderLanes); + case ForwardRef: + var type = workInProgress.type; + var _unresolvedProps2 = workInProgress.pendingProps; + var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2); + return updateForwardRef(current, workInProgress, type, _resolvedProps2, renderLanes); + case Fragment: + return updateFragment(current, workInProgress, renderLanes); + case Mode: + return updateMode(current, workInProgress, renderLanes); + case Profiler: + return updateProfiler(current, workInProgress, renderLanes); + case ContextProvider: + return updateContextProvider(current, workInProgress, renderLanes); + case ContextConsumer: + return updateContextConsumer(current, workInProgress, renderLanes); + case MemoComponent: + var _type2 = workInProgress.type; + var _unresolvedProps3 = workInProgress.pendingProps; // Resolve outer props first, then resolve inner props. + var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3); + if (workInProgress.type !== workInProgress.elementType) { + var outerPropTypes = _type2.propTypes; + if (outerPropTypes) checkPropTypes(outerPropTypes, _resolvedProps3, "prop", getComponentName(_type2)); + } + _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3); + return updateMemoComponent(current, workInProgress, _type2, _resolvedProps3, updateLanes, renderLanes); + case SimpleMemoComponent: + return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, updateLanes, renderLanes); + case IncompleteClassComponent: + var _Component3 = workInProgress.type; + var _unresolvedProps4 = workInProgress.pendingProps; + var _resolvedProps4 = workInProgress.elementType === _Component3 ? _unresolvedProps4 : resolveDefaultProps(_Component3, _unresolvedProps4); + return mountIncompleteClassComponent(current, workInProgress, _Component3, _resolvedProps4, renderLanes); + case SuspenseListComponent: + return updateSuspenseListComponent(current, workInProgress, renderLanes); + case FundamentalComponent: + break; + case ScopeComponent: + break; + case Block: + break; + case OffscreenComponent: + return updateOffscreenComponent(current, workInProgress, renderLanes); + case LegacyHiddenComponent: + return updateLegacyHiddenComponent(current, workInProgress, renderLanes); + } + throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."); + } + function markUpdate(workInProgress) { + // Tag the fiber with an update effect. This turns a Placement into + // a PlacementAndUpdate. + workInProgress.flags |= Update; + } + function markRef$1(workInProgress) { + workInProgress.flags |= Ref; + } + var appendAllChildren; + var updateHostContainer; + var updateHostComponent$1; + var updateHostText$1; + // Mutation mode + appendAllChildren = function(parent, workInProgress, needsVisibilityToggle, isHidden) { + // We only have the top Fiber that was created but we need recurse down its + // children to find all the terminal nodes. + var node = workInProgress.child; + while(node !== null){ + if (node.tag === HostComponent || node.tag === HostText) appendInitialChild(parent, node.stateNode); + else if (node.tag === HostPortal) ; + else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === workInProgress) return; + while(node.sibling === null){ + if (node.return === null || node.return === workInProgress) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + }; + updateHostContainer = function(workInProgress) {}; + updateHostComponent$1 = function(current, workInProgress, type, newProps, rootContainerInstance) { + // If we have an alternate, that means this is an update and we need to + // schedule a side-effect to do the updates. + var oldProps = current.memoizedProps; + if (oldProps === newProps) // In mutation mode, this is sufficient for a bailout because + // we won't touch this node even if children changed. + return; + // If we get updated because one of our children updated, we don't + // have newProps so we'll have to reuse them. + // TODO: Split the update API as separate for the props vs. children. + // Even better would be if children weren't special cased at all tho. + var instance = workInProgress.stateNode; + var currentHostContext = getHostContext(); // TODO: Experiencing an error where oldProps is null. Suggests a host + // component is hitting the resume path. Figure out why. Possibly + // related to `hidden`. + var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext); // TODO: Type this specific to this type of component. + workInProgress.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there + // is a new ref we mark this as an update. All the work is done in commitWork. + if (updatePayload) markUpdate(workInProgress); + }; + updateHostText$1 = function(current, workInProgress, oldText, newText) { + // If the text differs, mark it as an update. All the work in done in commitWork. + if (oldText !== newText) markUpdate(workInProgress); + }; + function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { + if (getIsHydrating()) // If we're hydrating, we should consume as many items as we can + // so we don't leave any behind. + return; + switch(renderState.tailMode){ + case "hidden": + // Any insertions at the end of the tail list after this point + // should be invisible. If there are already mounted boundaries + // anything before them are not considered for collapsing. + // Therefore we need to go through the whole tail to find if + // there are any. + var tailNode = renderState.tail; + var lastTailNode = null; + while(tailNode !== null){ + if (tailNode.alternate !== null) lastTailNode = tailNode; + tailNode = tailNode.sibling; + } // Next we're simply going to delete all insertions after the + // last rendered item. + if (lastTailNode === null) // All remaining items in the tail are insertions. + renderState.tail = null; + else // Detach the insertion after the last node that was already + // inserted. + lastTailNode.sibling = null; + break; + case "collapsed": + // Any insertions at the end of the tail list after this point + // should be invisible. If there are already mounted boundaries + // anything before them are not considered for collapsing. + // Therefore we need to go through the whole tail to find if + // there are any. + var _tailNode = renderState.tail; + var _lastTailNode = null; + while(_tailNode !== null){ + if (_tailNode.alternate !== null) _lastTailNode = _tailNode; + _tailNode = _tailNode.sibling; + } // Next we're simply going to delete all insertions after the + // last rendered item. + if (_lastTailNode === null) { + // All remaining items in the tail are insertions. + if (!hasRenderedATailFallback && renderState.tail !== null) // We suspended during the head. We want to show at least one + // row at the tail. So we'll keep on and cut off the rest. + renderState.tail.sibling = null; + else renderState.tail = null; + } else // Detach the insertion after the last node that was already + // inserted. + _lastTailNode.sibling = null; + break; + } + } + function completeWork(current, workInProgress, renderLanes) { + var newProps = workInProgress.pendingProps; + switch(workInProgress.tag){ + case IndeterminateComponent: + case LazyComponent: + case SimpleMemoComponent: + case FunctionComponent: + case ForwardRef: + case Fragment: + case Mode: + case Profiler: + case ContextConsumer: + case MemoComponent: + return null; + case ClassComponent: + var Component = workInProgress.type; + if (isContextProvider(Component)) popContext(workInProgress); + return null; + case HostRoot: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + resetWorkInProgressVersions(); + var fiberRoot = workInProgress.stateNode; + if (fiberRoot.pendingContext) { + fiberRoot.context = fiberRoot.pendingContext; + fiberRoot.pendingContext = null; + } + if (current === null || current.child === null) { + // If we hydrated, pop so that we can delete any remaining children + // that weren't hydrated. + var wasHydrated = popHydrationState(workInProgress); + if (wasHydrated) // If we hydrated, then we'll need to schedule an update for + // the commit side-effects on the root. + markUpdate(workInProgress); + else if (!fiberRoot.hydrate) // Schedule an effect to clear this container at the start of the next commit. + // This handles the case of React rendering into a container with previous children. + // It's also safe to do for updates too, because current.child would only be null + // if the previous render was null (so the the container would already be empty). + workInProgress.flags |= Snapshot; + } + updateHostContainer(workInProgress); + return null; + case HostComponent: + popHostContext(workInProgress); + var rootContainerInstance = getRootHostContainer(); + var type = workInProgress.type; + if (current !== null && workInProgress.stateNode != null) { + updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance); + if (current.ref !== workInProgress.ref) markRef$1(workInProgress); + } else { + if (!newProps) { + if (!(workInProgress.stateNode !== null)) throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."); + // This can happen when we abort work. + return null; + } + var currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context + // "stack" as the parent. Then append children as we go in beginWork + // or completeWork depending on whether we want to add them top->down or + // bottom->up. Top->down is faster in IE11. + var _wasHydrated = popHydrationState(workInProgress); + if (_wasHydrated) // TODO: Move this and createInstance step into the beginPhase + // to consolidate. + { + if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) // If changes to the hydrated node need to be applied at the + // commit-phase we mark this as such. + markUpdate(workInProgress); + } else { + var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress); + appendAllChildren(instance, workInProgress, false, false); + workInProgress.stateNode = instance; // Certain renderers require commit-time effects for initial mount. + // (eg DOM renderer supports auto-focus for certain elements). + // Make sure such renderers get scheduled for later work. + if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance)) markUpdate(workInProgress); + } + if (workInProgress.ref !== null) // If there is a ref on a host node we need to schedule a callback + markRef$1(workInProgress); + } + return null; + case HostText: + var newText = newProps; + if (current && workInProgress.stateNode != null) { + var oldText = current.memoizedProps; // If we have an alternate, that means this is an update and we need + // to schedule a side-effect to do the updates. + updateHostText$1(current, workInProgress, oldText, newText); + } else { + if (typeof newText !== "string") { + if (!(workInProgress.stateNode !== null)) throw Error("We must have new props for new mounts. This error is likely caused by a bug in React. Please file an issue."); + // This can happen when we abort work. + } + var _rootContainerInstance = getRootHostContainer(); + var _currentHostContext = getHostContext(); + var _wasHydrated2 = popHydrationState(workInProgress); + if (_wasHydrated2) { + if (prepareToHydrateHostTextInstance(workInProgress)) markUpdate(workInProgress); + } else workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress); + } + return null; + case SuspenseComponent: + popSuspenseContext(workInProgress); + var nextState = workInProgress.memoizedState; + if ((workInProgress.flags & DidCapture) !== NoFlags) { + // Something suspended. Re-render with the fallback children. + workInProgress.lanes = renderLanes; // Do not reset the effect list. + if ((workInProgress.mode & ProfileMode) !== NoMode) transferActualDuration(workInProgress); + return workInProgress; + } + var nextDidTimeout = nextState !== null; + var prevDidTimeout = false; + if (current === null) { + if (workInProgress.memoizedProps.fallback !== undefined) popHydrationState(workInProgress); + } else { + var prevState = current.memoizedState; + prevDidTimeout = prevState !== null; + } + if (nextDidTimeout && !prevDidTimeout) // If this subtreee is running in blocking mode we can suspend, + // otherwise we won't suspend. + // TODO: This will still suspend a synchronous tree if anything + // in the concurrent tree already suspended during this render. + // This is a known bug. + { + if ((workInProgress.mode & BlockingMode) !== NoMode) { + // TODO: Move this back to throwException because this is too late + // if this is a large tree which is common for initial loads. We + // don't know if we should restart a render or not until we get + // this marker, and this is too late. + // If this render already had a ping or lower pri updates, + // and this is the first time we know we're going to suspend we + // should be able to immediately restart from within throwException. + var hasInvisibleChildContext = current === null && workInProgress.memoizedProps.unstable_avoidThisFallback !== true; + if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) // If this was in an invisible tree or a new render, then showing + // this boundary is ok. + renderDidSuspend(); + else // Otherwise, we're going to have to hide content so we should + // suspend for longer if possible. + renderDidSuspendDelayIfPossible(); + } + } + // TODO: Only schedule updates if these values are non equal, i.e. it changed. + if (nextDidTimeout || prevDidTimeout) // If this boundary just timed out, schedule an effect to attach a + // retry listener to the promise. This flag is also used to hide the + // primary children. In mutation mode, we also need the flag to + // *unhide* children that were previously hidden, so check if this + // is currently timed out, too. + workInProgress.flags |= Update; + return null; + case HostPortal: + popHostContainer(workInProgress); + updateHostContainer(workInProgress); + if (current === null) preparePortalMount(workInProgress.stateNode.containerInfo); + return null; + case ContextProvider: + // Pop provider fiber + popProvider(workInProgress); + return null; + case IncompleteClassComponent: + // Same as class component case. I put it down here so that the tags are + // sequential to ensure this switch is compiled to a jump table. + var _Component = workInProgress.type; + if (isContextProvider(_Component)) popContext(workInProgress); + return null; + case SuspenseListComponent: + popSuspenseContext(workInProgress); + var renderState = workInProgress.memoizedState; + if (renderState === null) // We're running in the default, "independent" mode. + // We don't do anything in this mode. + return null; + var didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags; + var renderedTail = renderState.rendering; + if (renderedTail === null) { + // We just rendered the head. + if (!didSuspendAlready) { + // This is the first pass. We need to figure out if anything is still + // suspended in the rendered set. + // If new content unsuspended, but there's still some content that + // didn't. Then we need to do a second pass that forces everything + // to keep showing their fallbacks. + // We might be suspended if something in this render pass suspended, or + // something in the previous committed pass suspended. Otherwise, + // there's no chance so we can skip the expensive call to + // findFirstSuspended. + var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.flags & DidCapture) === NoFlags); + if (!cannotBeSuspended) { + var row = workInProgress.child; + while(row !== null){ + var suspended = findFirstSuspended(row); + if (suspended !== null) { + didSuspendAlready = true; + workInProgress.flags |= DidCapture; + cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as + // part of the second pass. In that case nothing will subscribe to + // its thennables. Instead, we'll transfer its thennables to the + // SuspenseList so that it can retry if they resolve. + // There might be multiple of these in the list but since we're + // going to wait for all of them anyway, it doesn't really matter + // which ones gets to ping. In theory we could get clever and keep + // track of how many dependencies remain but it gets tricky because + // in the meantime, we can add/remove/change items and dependencies. + // We might bail out of the loop before finding any but that + // doesn't matter since that means that the other boundaries that + // we did find already has their listeners attached. + var newThennables = suspended.updateQueue; + if (newThennables !== null) { + workInProgress.updateQueue = newThennables; + workInProgress.flags |= Update; + } // Rerender the whole list, but this time, we'll force fallbacks + // to stay in place. + // Reset the effect list before doing the second pass since that's now invalid. + if (renderState.lastEffect === null) workInProgress.firstEffect = null; + workInProgress.lastEffect = renderState.lastEffect; // Reset the child fibers to their original state. + resetChildFibers(workInProgress, renderLanes); // Set up the Suspense Context to force suspense and immediately + // rerender the children. + pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback)); + return workInProgress.child; + } + row = row.sibling; + } + } + if (renderState.tail !== null && now() > getRenderTargetTime()) { + // We have already passed our CPU deadline but we still have rows + // left in the tail. We'll just give up further attempts to render + // the main content and only render fallbacks. + workInProgress.flags |= DidCapture; + didSuspendAlready = true; + cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this + // to get it started back up to attempt the next item. While in terms + // of priority this work has the same priority as this current render, + // it's not part of the same transition once the transition has + // committed. If it's sync, we still want to yield so that it can be + // painted. Conceptually, this is really the same as pinging. + // We can use any RetryLane even if it's the one currently rendering + // since we're leaving it behind on this node. + workInProgress.lanes = SomeRetryLane; + markSpawnedWork(SomeRetryLane); + } + } else cutOffTailIfNeeded(renderState, false); + // Next we're going to render the tail. + } else { + // Append the rendered row to the child list. + if (!didSuspendAlready) { + var _suspended = findFirstSuspended(renderedTail); + if (_suspended !== null) { + workInProgress.flags |= DidCapture; + didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't + // get lost if this row ends up dropped during a second pass. + var _newThennables = _suspended.updateQueue; + if (_newThennables !== null) { + workInProgress.updateQueue = _newThennables; + workInProgress.flags |= Update; + } + cutOffTailIfNeeded(renderState, true); // This might have been modified. + if (renderState.tail === null && renderState.tailMode === "hidden" && !renderedTail.alternate && !getIsHydrating() // We don't cut it if we're hydrating. + ) { + // We need to delete the row we just rendered. + // Reset the effect list to what it was before we rendered this + // child. The nested children have already appended themselves. + var lastEffect = workInProgress.lastEffect = renderState.lastEffect; // Remove any effects that were appended after this point. + if (lastEffect !== null) lastEffect.nextEffect = null; + // We're done. + return null; + } + } else if (// time we have to render. So rendering one more row would likely + // exceed it. + now() * 2 - renderState.renderingStartTime > getRenderTargetTime() && renderLanes !== OffscreenLane) { + // We have now passed our CPU deadline and we'll just give up further + // attempts to render the main content and only render fallbacks. + // The assumption is that this is usually faster. + workInProgress.flags |= DidCapture; + didSuspendAlready = true; + cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this + // to get it started back up to attempt the next item. While in terms + // of priority this work has the same priority as this current render, + // it's not part of the same transition once the transition has + // committed. If it's sync, we still want to yield so that it can be + // painted. Conceptually, this is really the same as pinging. + // We can use any RetryLane even if it's the one currently rendering + // since we're leaving it behind on this node. + workInProgress.lanes = SomeRetryLane; + markSpawnedWork(SomeRetryLane); + } + } + if (renderState.isBackwards) { + // The effect list of the backwards tail will have been added + // to the end. This breaks the guarantee that life-cycles fire in + // sibling order but that isn't a strong guarantee promised by React. + // Especially since these might also just pop in during future commits. + // Append to the beginning of the list. + renderedTail.sibling = workInProgress.child; + workInProgress.child = renderedTail; + } else { + var previousSibling = renderState.last; + if (previousSibling !== null) previousSibling.sibling = renderedTail; + else workInProgress.child = renderedTail; + renderState.last = renderedTail; + } + } + if (renderState.tail !== null) { + // We still have tail rows to render. + // Pop a row. + var next = renderState.tail; + renderState.rendering = next; + renderState.tail = next.sibling; + renderState.lastEffect = workInProgress.lastEffect; + renderState.renderingStartTime = now(); + next.sibling = null; // Restore the context. + // TODO: We can probably just avoid popping it instead and only + // setting it the first time we go from not suspended to suspended. + var suspenseContext = suspenseStackCursor.current; + if (didSuspendAlready) suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); + else suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); + pushSuspenseContext(workInProgress, suspenseContext); // Do a pass over the next row. + return next; + } + return null; + case FundamentalComponent: + break; + case ScopeComponent: + break; + case Block: + break; + case OffscreenComponent: + case LegacyHiddenComponent: + popRenderLanes(workInProgress); + if (current !== null) { + var _nextState = workInProgress.memoizedState; + var _prevState = current.memoizedState; + var prevIsHidden = _prevState !== null; + var nextIsHidden = _nextState !== null; + if (prevIsHidden !== nextIsHidden && newProps.mode !== "unstable-defer-without-hiding") workInProgress.flags |= Update; + } + return null; + } + throw Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in React. Please file an issue."); + } + function unwindWork(workInProgress, renderLanes) { + switch(workInProgress.tag){ + case ClassComponent: + var Component = workInProgress.type; + if (isContextProvider(Component)) popContext(workInProgress); + var flags = workInProgress.flags; + if (flags & ShouldCapture) { + workInProgress.flags = flags & ~ShouldCapture | DidCapture; + if ((workInProgress.mode & ProfileMode) !== NoMode) transferActualDuration(workInProgress); + return workInProgress; + } + return null; + case HostRoot: + popHostContainer(workInProgress); + popTopLevelContextObject(workInProgress); + resetWorkInProgressVersions(); + var _flags = workInProgress.flags; + if (!((_flags & DidCapture) === NoFlags)) throw Error("The root failed to unmount after an error. This is likely a bug in React. Please file an issue."); + workInProgress.flags = _flags & ~ShouldCapture | DidCapture; + return workInProgress; + case HostComponent: + // TODO: popHydrationState + popHostContext(workInProgress); + return null; + case SuspenseComponent: + popSuspenseContext(workInProgress); + var _flags2 = workInProgress.flags; + if (_flags2 & ShouldCapture) { + workInProgress.flags = _flags2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary. + if ((workInProgress.mode & ProfileMode) !== NoMode) transferActualDuration(workInProgress); + return workInProgress; + } + return null; + case SuspenseListComponent: + popSuspenseContext(workInProgress); // SuspenseList doesn't actually catch anything. It should've been + // caught by a nested boundary. If not, it should bubble through. + return null; + case HostPortal: + popHostContainer(workInProgress); + return null; + case ContextProvider: + popProvider(workInProgress); + return null; + case OffscreenComponent: + case LegacyHiddenComponent: + popRenderLanes(workInProgress); + return null; + default: + return null; + } + } + function unwindInterruptedWork(interruptedWork) { + switch(interruptedWork.tag){ + case ClassComponent: + var childContextTypes = interruptedWork.type.childContextTypes; + if (childContextTypes !== null && childContextTypes !== undefined) popContext(interruptedWork); + break; + case HostRoot: + popHostContainer(interruptedWork); + popTopLevelContextObject(interruptedWork); + resetWorkInProgressVersions(); + break; + case HostComponent: + popHostContext(interruptedWork); + break; + case HostPortal: + popHostContainer(interruptedWork); + break; + case SuspenseComponent: + popSuspenseContext(interruptedWork); + break; + case SuspenseListComponent: + popSuspenseContext(interruptedWork); + break; + case ContextProvider: + popProvider(interruptedWork); + break; + case OffscreenComponent: + case LegacyHiddenComponent: + popRenderLanes(interruptedWork); + break; + } + } + function createCapturedValue(value, source) { + // If the value is an error, call this function immediately after it is thrown + // so the stack is accurate. + return { + value: value, + source: source, + stack: getStackByFiberInDevAndProd(source) + }; + } + // This module is forked in different environments. + // By default, return `true` to log errors to the console. + // Forks can return `false` if this isn't desirable. + function showErrorDialog(boundary, errorInfo) { + return true; + } + function logCapturedError(boundary, errorInfo) { + try { + var logError = showErrorDialog(boundary, errorInfo); // Allow injected showErrorDialog() to prevent default console.error logging. + // This enables renderers like ReactNative to better manage redbox behavior. + if (logError === false) return; + var error = errorInfo.value; + var source = errorInfo.source; + var stack = errorInfo.stack; + var componentStack = stack !== null ? stack : ""; // Browsers support silencing uncaught errors by calling + // `preventDefault()` in window `error` handler. + // We record this information as an expando on the error. + if (error != null && error._suppressLogging) { + if (boundary.tag === ClassComponent) // The error is recoverable and was silenced. + // Ignore it and don't print the stack addendum. + // This is handy for testing error boundaries without noise. + return; + // The error is fatal. Since the silencing might have + // been accidental, we'll surface it anyway. + // However, the browser would have silenced the original error + // so we'll print it first, and then print the stack addendum. + console["error"](error); // Don't transform to our wrapper + // For a more detailed description of this block, see: + // https://github.com/facebook/react/pull/13384 + } + var componentName = source ? getComponentName(source.type) : null; + var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : "The above error occurred in one of your React components:"; + var errorBoundaryMessage; + var errorBoundaryName = getComponentName(boundary.type); + if (errorBoundaryName) errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + "."); + else errorBoundaryMessage = "Consider adding an error boundary to your tree to customize error handling behavior.\nVisit https://reactjs.org/link/error-boundaries to learn more about error boundaries."; + var combinedMessage = componentNameMessage + "\n" + componentStack + "\n\n" + ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack. + // We don't include the original error message and JS stack because the browser + // has already printed it. Even if the application swallows the error, it is still + // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. + console["error"](combinedMessage); // Don't transform to our wrapper + } catch (e) { + // This method must not throw, or React internal state will get messed up. + // If console.error is overridden, or logCapturedError() shows a dialog that throws, + // we want to report this error outside of the normal stack as a last resort. + // https://github.com/facebook/react/issues/13188 + setTimeout(function() { + throw e; + }); + } + } + var PossiblyWeakMap$1 = typeof WeakMap === "function" ? WeakMap : Map; + function createRootErrorUpdate(fiber, errorInfo, lane) { + var update = createUpdate(NoTimestamp, lane); // Unmount the root by rendering null. + update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property + // being called "element". + update.payload = { + element: null + }; + var error = errorInfo.value; + update.callback = function() { + onUncaughtError(error); + logCapturedError(fiber, errorInfo); + }; + return update; + } + function createClassErrorUpdate(fiber, errorInfo, lane) { + var update = createUpdate(NoTimestamp, lane); + update.tag = CaptureUpdate; + var getDerivedStateFromError = fiber.type.getDerivedStateFromError; + if (typeof getDerivedStateFromError === "function") { + var error$1 = errorInfo.value; + update.payload = function() { + logCapturedError(fiber, errorInfo); + return getDerivedStateFromError(error$1); + }; + } + var inst = fiber.stateNode; + if (inst !== null && typeof inst.componentDidCatch === "function") update.callback = function callback() { + markFailedErrorBoundaryForHotReloading(fiber); + if (typeof getDerivedStateFromError !== "function") { + // To preserve the preexisting retry behavior of error boundaries, + // we keep track of which ones already failed during this batch. + // This gets reset before we yield back to the browser. + // TODO: Warn in strict mode if getDerivedStateFromError is + // not defined. + markLegacyErrorBoundaryAsFailed(this); // Only log here if componentDidCatch is the only error boundary method defined + logCapturedError(fiber, errorInfo); + } + var error$1 = errorInfo.value; + var stack = errorInfo.stack; + this.componentDidCatch(error$1, { + componentStack: stack !== null ? stack : "" + }); + if (typeof getDerivedStateFromError !== "function") // If componentDidCatch is the only error boundary method defined, + // then it needs to call setState to recover from errors. + // If no state update is scheduled then the boundary will swallow the error. + { + if (!includesSomeLane(fiber.lanes, SyncLane)) error("%s: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.", getComponentName(fiber.type) || "Unknown"); + } + }; + else update.callback = function() { + markFailedErrorBoundaryForHotReloading(fiber); + }; + return update; + } + function attachPingListener(root, wakeable, lanes) { + // Attach a listener to the promise to "ping" the root and retry. But only if + // one does not already exist for the lanes we're currently rendering (which + // acts like a "thread ID" here). + var pingCache = root.pingCache; + var threadIDs; + if (pingCache === null) { + pingCache = root.pingCache = new PossiblyWeakMap$1(); + threadIDs = new Set(); + pingCache.set(wakeable, threadIDs); + } else { + threadIDs = pingCache.get(wakeable); + if (threadIDs === undefined) { + threadIDs = new Set(); + pingCache.set(wakeable, threadIDs); + } + } + if (!threadIDs.has(lanes)) { + // Memoize using the thread ID to prevent redundant listeners. + threadIDs.add(lanes); + var ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); + wakeable.then(ping, ping); + } + } + function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) { + // The source fiber did not complete. + sourceFiber.flags |= Incomplete; // Its effect list is no longer valid. + sourceFiber.firstEffect = sourceFiber.lastEffect = null; + if (value !== null && typeof value === "object" && typeof value.then === "function") { + // This is a wakeable. + var wakeable = value; + if ((sourceFiber.mode & BlockingMode) === NoMode) { + // Reset the memoizedState to what it was before we attempted + // to render it. + var currentSource = sourceFiber.alternate; + if (currentSource) { + sourceFiber.updateQueue = currentSource.updateQueue; + sourceFiber.memoizedState = currentSource.memoizedState; + sourceFiber.lanes = currentSource.lanes; + } else { + sourceFiber.updateQueue = null; + sourceFiber.memoizedState = null; + } + } + var hasInvisibleParentBoundary = hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext); // Schedule the nearest Suspense to re-render the timed out view. + var _workInProgress = returnFiber; + do { + if (_workInProgress.tag === SuspenseComponent && shouldCaptureSuspense(_workInProgress, hasInvisibleParentBoundary)) { + // Found the nearest boundary. + // Stash the promise on the boundary fiber. If the boundary times out, we'll + // attach another listener to flip the boundary back to its normal state. + var wakeables = _workInProgress.updateQueue; + if (wakeables === null) { + var updateQueue = new Set(); + updateQueue.add(wakeable); + _workInProgress.updateQueue = updateQueue; + } else wakeables.add(wakeable); + // If the boundary is outside of blocking mode, we should *not* + // suspend the commit. Pretend as if the suspended component rendered + // null and keep rendering. In the commit phase, we'll schedule a + // subsequent synchronous update to re-render the Suspense. + // + // Note: It doesn't matter whether the component that suspended was + // inside a blocking mode tree. If the Suspense is outside of it, we + // should *not* suspend the commit. + if ((_workInProgress.mode & BlockingMode) === NoMode) { + _workInProgress.flags |= DidCapture; + sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. + // But we shouldn't call any lifecycle methods or callbacks. Remove + // all lifecycle effect tags. + sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete); + if (sourceFiber.tag === ClassComponent) { + var currentSourceFiber = sourceFiber.alternate; + if (currentSourceFiber === null) // This is a new mount. Change the tag so it's not mistaken for a + // completed class component. For example, we should not call + // componentWillUnmount if it is deleted. + sourceFiber.tag = IncompleteClassComponent; + else { + // When we try rendering again, we should not reuse the current fiber, + // since it's known to be in an inconsistent state. Use a force update to + // prevent a bail out. + var update = createUpdate(NoTimestamp, SyncLane); + update.tag = ForceUpdate; + enqueueUpdate(sourceFiber, update); + } + } // The source fiber did not complete. Mark it with Sync priority to + // indicate that it still has pending work. + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); // Exit without suspending. + return; + } // Confirmed that the boundary is in a concurrent mode tree. Continue + // with the normal suspend path. + // + // After this we'll use a set of heuristics to determine whether this + // render pass will run to completion or restart or "suspend" the commit. + // The actual logic for this is spread out in different places. + // + // This first principle is that if we're going to suspend when we complete + // a root, then we should also restart if we get an update or ping that + // might unsuspend it, and vice versa. The only reason to suspend is + // because you think you might want to restart before committing. However, + // it doesn't make sense to restart only while in the period we're suspended. + // + // Restarting too aggressively is also not good because it starves out any + // intermediate loading state. So we use heuristics to determine when. + // Suspense Heuristics + // + // If nothing threw a Promise or all the same fallbacks are already showing, + // then don't suspend/restart. + // + // If this is an initial render of a new tree of Suspense boundaries and + // those trigger a fallback, then don't suspend/restart. We want to ensure + // that we can show the initial loading state as quickly as possible. + // + // If we hit a "Delayed" case, such as when we'd switch from content back into + // a fallback, then we should always suspend/restart. Transitions apply + // to this case. If none is defined, JND is used instead. + // + // If we're already showing a fallback and it gets "retried", allowing us to show + // another level, but there's still an inner boundary that would show a fallback, + // then we suspend/restart for 500ms since the last time we showed a fallback + // anywhere in the tree. This effectively throttles progressive loading into a + // consistent train of commits. This also gives us an opportunity to restart to + // get to the completed state slightly earlier. + // + // If there's ambiguity due to batching it's resolved in preference of: + // 1) "delayed", 2) "initial render", 3) "retry". + // + // We want to ensure that a "busy" state doesn't get force committed. We want to + // ensure that new initial loading states can commit as soon as possible. + attachPingListener(root, wakeable, rootRenderLanes); + _workInProgress.flags |= ShouldCapture; + _workInProgress.lanes = rootRenderLanes; + return; + } // This boundary already captured during this render. Continue to the next + // boundary. + _workInProgress = _workInProgress.return; + }while (_workInProgress !== null); // No boundary was found. Fallthrough to error mode. + // TODO: Use invariant so the message is stripped in prod? + value = new Error((getComponentName(sourceFiber.type) || "A React component") + " suspended while rendering, but no fallback UI was specified.\n" + "\n" + "Add a component higher in the tree to " + "provide a loading indicator or placeholder to display."); + } // We didn't find a boundary that could handle this type of exception. Start + // over and traverse parent path again, this time treating the exception + // as an error. + renderDidError(); + value = createCapturedValue(value, sourceFiber); + var workInProgress = returnFiber; + do { + switch(workInProgress.tag){ + case HostRoot: + var _errorInfo = value; + workInProgress.flags |= ShouldCapture; + var lane = pickArbitraryLane(rootRenderLanes); + workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); + var _update = createRootErrorUpdate(workInProgress, _errorInfo, lane); + enqueueCapturedUpdate(workInProgress, _update); + return; + case ClassComponent: + // Capture and retry + var errorInfo = value; + var ctor = workInProgress.type; + var instance = workInProgress.stateNode; + if ((workInProgress.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === "function" || instance !== null && typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance))) { + workInProgress.flags |= ShouldCapture; + var _lane = pickArbitraryLane(rootRenderLanes); + workInProgress.lanes = mergeLanes(workInProgress.lanes, _lane); // Schedule the error boundary to re-render using updated state + var _update2 = createClassErrorUpdate(workInProgress, errorInfo, _lane); + enqueueCapturedUpdate(workInProgress, _update2); + return; + } + break; + } + workInProgress = workInProgress.return; + }while (workInProgress !== null); + } + var didWarnAboutUndefinedSnapshotBeforeUpdate = null; + didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); + var PossiblyWeakSet = typeof WeakSet === "function" ? WeakSet : Set; + var callComponentWillUnmountWithTimer = function(current, instance) { + instance.props = current.memoizedProps; + instance.state = current.memoizedState; + instance.componentWillUnmount(); + }; // Capture errors so they don't interrupt unmounting. + function safelyCallComponentWillUnmount(current, instance) { + invokeGuardedCallback(null, callComponentWillUnmountWithTimer, null, current, instance); + if (hasCaughtError()) { + var unmountError = clearCaughtError(); + captureCommitPhaseError(current, unmountError); + } + } + function safelyDetachRef(current) { + var ref = current.ref; + if (ref !== null) { + if (typeof ref === "function") { + invokeGuardedCallback(null, ref, null, null); + if (hasCaughtError()) { + var refError = clearCaughtError(); + captureCommitPhaseError(current, refError); + } + } else ref.current = null; + } + } + function safelyCallDestroy(current, destroy) { + invokeGuardedCallback(null, destroy, null); + if (hasCaughtError()) { + var error = clearCaughtError(); + captureCommitPhaseError(current, error); + } + } + function commitBeforeMutationLifeCycles(current, finishedWork) { + switch(finishedWork.tag){ + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: + case Block: + return; + case ClassComponent: + if (finishedWork.flags & Snapshot) { + if (current !== null) { + var prevProps = current.memoizedProps; + var prevState = current.memoizedState; + var instance = finishedWork.stateNode; // We could update instance props and state here, + if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { + if (instance.props !== finishedWork.memoizedProps) error("Expected %s props to match memoized props before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance"); + if (instance.state !== finishedWork.memoizedState) error("Expected %s state to match memoized state before getSnapshotBeforeUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance"); + } + var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState); + var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate; + if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) { + didWarnSet.add(finishedWork.type); + error("%s.getSnapshotBeforeUpdate(): A snapshot value (or null) must be returned. You have returned undefined.", getComponentName(finishedWork.type)); + } + instance.__reactInternalSnapshotBeforeUpdate = snapshot; + } + } + return; + case HostRoot: + if (finishedWork.flags & Snapshot) { + var root = finishedWork.stateNode; + clearContainer(root.containerInfo); + } + return; + case HostComponent: + case HostText: + case HostPortal: + case IncompleteClassComponent: + // Nothing to do for these component types + return; + } + throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."); + } + function commitHookEffectListUnmount(tag, finishedWork) { + var updateQueue = finishedWork.updateQueue; + var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; + if (lastEffect !== null) { + var firstEffect = lastEffect.next; + var effect = firstEffect; + do { + if ((effect.tag & tag) === tag) { + // Unmount + var destroy = effect.destroy; + effect.destroy = undefined; + if (destroy !== undefined) destroy(); + } + effect = effect.next; + }while (effect !== firstEffect); + } + } + function commitHookEffectListMount(tag, finishedWork) { + var updateQueue = finishedWork.updateQueue; + var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; + if (lastEffect !== null) { + var firstEffect = lastEffect.next; + var effect = firstEffect; + do { + if ((effect.tag & tag) === tag) { + // Mount + var create = effect.create; + effect.destroy = create(); + var destroy = effect.destroy; + if (destroy !== undefined && typeof destroy !== "function") { + var addendum = void 0; + if (destroy === null) addendum = " You returned null. If your effect does not require clean up, return undefined (or nothing)."; + else if (typeof destroy.then === "function") addendum = "\n\nIt looks like you wrote useEffect(async () => ...) or returned a Promise. Instead, write the async function inside your effect and call it immediately:\n\nuseEffect(() => {\n async function fetchData() {\n // You can await here\n const response = await MyAPI.getData(someId);\n // ...\n }\n fetchData();\n}, [someId]); // Or [] if effect doesn't need props or state\n\nLearn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching"; + else addendum = " You returned: " + destroy; + error("An effect function must not return anything besides a function, which is used for clean-up.%s", addendum); + } + } + effect = effect.next; + }while (effect !== firstEffect); + } + } + function schedulePassiveEffects(finishedWork) { + var updateQueue = finishedWork.updateQueue; + var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; + if (lastEffect !== null) { + var firstEffect = lastEffect.next; + var effect = firstEffect; + do { + var _effect = effect, next = _effect.next, tag = _effect.tag; + if ((tag & Passive$1) !== NoFlags$1 && (tag & HasEffect) !== NoFlags$1) { + enqueuePendingPassiveHookEffectUnmount(finishedWork, effect); + enqueuePendingPassiveHookEffectMount(finishedWork, effect); + } + effect = next; + }while (effect !== firstEffect); + } + } + function commitLifeCycles(finishedRoot, current, finishedWork, committedLanes) { + switch(finishedWork.tag){ + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: + case Block: + commitHookEffectListMount(Layout | HasEffect, finishedWork); + schedulePassiveEffects(finishedWork); + return; + case ClassComponent: + var instance = finishedWork.stateNode; + if (finishedWork.flags & Update) { + if (current === null) { + if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { + if (instance.props !== finishedWork.memoizedProps) error("Expected %s props to match memoized props before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance"); + if (instance.state !== finishedWork.memoizedState) error("Expected %s state to match memoized state before componentDidMount. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance"); + } + instance.componentDidMount(); + } else { + var prevProps = finishedWork.elementType === finishedWork.type ? current.memoizedProps : resolveDefaultProps(finishedWork.type, current.memoizedProps); + var prevState = current.memoizedState; // We could update instance props and state here, + if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { + if (instance.props !== finishedWork.memoizedProps) error("Expected %s props to match memoized props before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance"); + if (instance.state !== finishedWork.memoizedState) error("Expected %s state to match memoized state before componentDidUpdate. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance"); + } + instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); + } + } // TODO: I think this is now always non-null by the time it reaches the + // commit phase. Consider removing the type check. + var updateQueue = finishedWork.updateQueue; + if (updateQueue !== null) { + if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { + if (instance.props !== finishedWork.memoizedProps) error("Expected %s props to match memoized props before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.props`. Please file an issue.", getComponentName(finishedWork.type) || "instance"); + if (instance.state !== finishedWork.memoizedState) error("Expected %s state to match memoized state before processing the update queue. This might either be because of a bug in React, or because a component reassigns its own `this.state`. Please file an issue.", getComponentName(finishedWork.type) || "instance"); + } + // but instead we rely on them being set during last render. + // TODO: revisit this when we implement resuming. + commitUpdateQueue(finishedWork, updateQueue, instance); + } + return; + case HostRoot: + // TODO: I think this is now always non-null by the time it reaches the + // commit phase. Consider removing the type check. + var _updateQueue = finishedWork.updateQueue; + if (_updateQueue !== null) { + var _instance = null; + if (finishedWork.child !== null) switch(finishedWork.child.tag){ + case HostComponent: + _instance = getPublicInstance(finishedWork.child.stateNode); + break; + case ClassComponent: + _instance = finishedWork.child.stateNode; + break; + } + commitUpdateQueue(finishedWork, _updateQueue, _instance); + } + return; + case HostComponent: + var _instance2 = finishedWork.stateNode; // Renderers may schedule work to be done after host components are mounted + // (eg DOM renderer may schedule auto-focus for inputs and form controls). + // These effects should only be committed when components are first mounted, + // aka when there is no current/alternate. + if (current === null && finishedWork.flags & Update) { + var type = finishedWork.type; + var props = finishedWork.memoizedProps; + commitMount(_instance2, type, props); + } + return; + case HostText: + // We have no life-cycles associated with text. + return; + case HostPortal: + // We have no life-cycles associated with portals. + return; + case Profiler: + var _finishedWork$memoize2 = finishedWork.memoizedProps, onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender; + var effectDuration = finishedWork.stateNode.effectDuration; + var commitTime = getCommitTime(); + if (typeof onRender === "function") onRender(finishedWork.memoizedProps.id, current === null ? "mount" : "update", finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime, finishedRoot.memoizedInteractions); + return; + case SuspenseComponent: + commitSuspenseHydrationCallbacks(finishedRoot, finishedWork); + return; + case SuspenseListComponent: + case IncompleteClassComponent: + case FundamentalComponent: + case ScopeComponent: + case OffscreenComponent: + case LegacyHiddenComponent: + return; + } + throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."); + } + function hideOrUnhideAllChildren(finishedWork, isHidden) { + // We only have the top Fiber that was inserted but we need to recurse down its + // children to find all the terminal nodes. + var node = finishedWork; + while(true){ + if (node.tag === HostComponent) { + var instance = node.stateNode; + if (isHidden) hideInstance(instance); + else unhideInstance(node.stateNode, node.memoizedProps); + } else if (node.tag === HostText) { + var _instance3 = node.stateNode; + if (isHidden) hideTextInstance(_instance3); + else unhideTextInstance(_instance3, node.memoizedProps); + } else if ((node.tag === OffscreenComponent || node.tag === LegacyHiddenComponent) && node.memoizedState !== null && node !== finishedWork) ; + else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === finishedWork) return; + while(node.sibling === null){ + if (node.return === null || node.return === finishedWork) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + function commitAttachRef(finishedWork) { + var ref = finishedWork.ref; + if (ref !== null) { + var instance = finishedWork.stateNode; + var instanceToUse; + switch(finishedWork.tag){ + case HostComponent: + instanceToUse = getPublicInstance(instance); + break; + default: + instanceToUse = instance; + } // Moved outside to ensure DCE works with this flag + if (typeof ref === "function") ref(instanceToUse); + else { + if (!ref.hasOwnProperty("current")) error("Unexpected ref object provided for %s. Use either a ref-setter function or React.createRef().", getComponentName(finishedWork.type)); + ref.current = instanceToUse; + } + } + } + function commitDetachRef(current) { + var currentRef = current.ref; + if (currentRef !== null) { + if (typeof currentRef === "function") currentRef(null); + else currentRef.current = null; + } + } // User-originating errors (lifecycles and refs) should not interrupt + // deletion, so don't let them throw. Host-originating errors should + // interrupt deletion, so it's okay + function commitUnmount(finishedRoot, current, renderPriorityLevel) { + onCommitUnmount(current); + switch(current.tag){ + case FunctionComponent: + case ForwardRef: + case MemoComponent: + case SimpleMemoComponent: + case Block: + var updateQueue = current.updateQueue; + if (updateQueue !== null) { + var lastEffect = updateQueue.lastEffect; + if (lastEffect !== null) { + var firstEffect = lastEffect.next; + var effect = firstEffect; + do { + var _effect2 = effect, destroy = _effect2.destroy, tag = _effect2.tag; + if (destroy !== undefined) { + if ((tag & Passive$1) !== NoFlags$1) enqueuePendingPassiveHookEffectUnmount(current, effect); + else safelyCallDestroy(current, destroy); + } + effect = effect.next; + }while (effect !== firstEffect); + } + } + return; + case ClassComponent: + safelyDetachRef(current); + var instance = current.stateNode; + if (typeof instance.componentWillUnmount === "function") safelyCallComponentWillUnmount(current, instance); + return; + case HostComponent: + safelyDetachRef(current); + return; + case HostPortal: + unmountHostComponents(finishedRoot, current); + return; + case FundamentalComponent: + return; + case DehydratedFragment: + return; + case ScopeComponent: + return; + } + } + function commitNestedUnmounts(finishedRoot, root, renderPriorityLevel) { + // While we're inside a removed host node we don't want to call + // removeChild on the inner nodes because they're removed by the top + // call anyway. We also want to call componentWillUnmount on all + // composites before this host node is removed from the tree. Therefore + // we do an inner loop while we're still inside the host node. + var node = root; + while(true){ + commitUnmount(finishedRoot, node); // Visit children because they may contain more composite or host nodes. + // Skip portals because commitUnmount() currently visits them recursively. + if (node.child !== null && // If we don't use mutation we drill down into portals here instead. + node.tag !== HostPortal) { + node.child.return = node; + node = node.child; + continue; + } + if (node === root) return; + while(node.sibling === null){ + if (node.return === null || node.return === root) return; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + function detachFiberMutation(fiber) { + // Cut off the return pointers to disconnect it from the tree. Ideally, we + // should clear the child pointer of the parent alternate to let this + // get GC:ed but we don't know which for sure which parent is the current + // one so we'll settle for GC:ing the subtree of this child. This child + // itself will be GC:ed when the parent updates the next time. + // Note: we cannot null out sibling here, otherwise it can cause issues + // with findDOMNode and how it requires the sibling field to carry out + // traversal in a later effect. See PR #16820. We now clear the sibling + // field after effects, see: detachFiberAfterEffects. + // + // Don't disconnect stateNode now; it will be detached in detachFiberAfterEffects. + // It may be required if the current component is an error boundary, + // and one of its descendants throws while unmounting a passive effect. + fiber.alternate = null; + fiber.child = null; + fiber.dependencies = null; + fiber.firstEffect = null; + fiber.lastEffect = null; + fiber.memoizedProps = null; + fiber.memoizedState = null; + fiber.pendingProps = null; + fiber.return = null; + fiber.updateQueue = null; + fiber._debugOwner = null; + } + function getHostParentFiber(fiber) { + var parent = fiber.return; + while(parent !== null){ + if (isHostParent(parent)) return parent; + parent = parent.return; + } + throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."); + } + function isHostParent(fiber) { + return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal; + } + function getHostSibling(fiber) { + // We're going to search forward into the tree until we find a sibling host + // node. Unfortunately, if multiple insertions are done in a row we have to + // search past them. This leads to exponential search for the next sibling. + // TODO: Find a more efficient way to do this. + var node = fiber; + siblings: while(true){ + // If we didn't find anything, let's try the next sibling. + while(node.sibling === null){ + if (node.return === null || isHostParent(node.return)) // If we pop out of the root or hit the parent the fiber we are the + // last sibling. + return null; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + while(node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment){ + // If it is not host node and, we might have a host node inside it. + // Try to search down until we find one. + if (node.flags & Placement) continue siblings; + // If we don't have a child, try the siblings instead. + // We also skip portals because they are not part of this host tree. + if (node.child === null || node.tag === HostPortal) continue siblings; + else { + node.child.return = node; + node = node.child; + } + } // Check if this host node is stable or about to be placed. + if (!(node.flags & Placement)) // Found it! + return node.stateNode; + } + } + function commitPlacement(finishedWork) { + var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together. + var parent; + var isContainer; + var parentStateNode = parentFiber.stateNode; + switch(parentFiber.tag){ + case HostComponent: + parent = parentStateNode; + isContainer = false; + break; + case HostRoot: + parent = parentStateNode.containerInfo; + isContainer = true; + break; + case HostPortal: + parent = parentStateNode.containerInfo; + isContainer = true; + break; + case FundamentalComponent: + // eslint-disable-next-line-no-fallthrough + default: + throw Error("Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue."); + } + if (parentFiber.flags & ContentReset) { + // Reset the text content of the parent before doing any insertions + resetTextContent(parent); // Clear ContentReset from the effect tag + parentFiber.flags &= ~ContentReset; + } + var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its + // children to find all the terminal nodes. + if (isContainer) insertOrAppendPlacementNodeIntoContainer(finishedWork, before, parent); + else insertOrAppendPlacementNode(finishedWork, before, parent); + } + function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { + var tag = node.tag; + var isHost = tag === HostComponent || tag === HostText; + if (isHost || enableFundamentalAPI) { + var stateNode = isHost ? node.stateNode : node.stateNode.instance; + if (before) insertInContainerBefore(parent, stateNode, before); + else appendChildToContainer(parent, stateNode); + } else if (tag === HostPortal) ; + else { + var child = node.child; + if (child !== null) { + insertOrAppendPlacementNodeIntoContainer(child, before, parent); + var sibling = child.sibling; + while(sibling !== null){ + insertOrAppendPlacementNodeIntoContainer(sibling, before, parent); + sibling = sibling.sibling; + } + } + } + } + function insertOrAppendPlacementNode(node, before, parent) { + var tag = node.tag; + var isHost = tag === HostComponent || tag === HostText; + if (isHost || enableFundamentalAPI) { + var stateNode = isHost ? node.stateNode : node.stateNode.instance; + if (before) insertBefore(parent, stateNode, before); + else appendChild(parent, stateNode); + } else if (tag === HostPortal) ; + else { + var child = node.child; + if (child !== null) { + insertOrAppendPlacementNode(child, before, parent); + var sibling = child.sibling; + while(sibling !== null){ + insertOrAppendPlacementNode(sibling, before, parent); + sibling = sibling.sibling; + } + } + } + } + function unmountHostComponents(finishedRoot, current, renderPriorityLevel) { + // We only have the top Fiber that was deleted but we need to recurse down its + // children to find all the terminal nodes. + var node = current; // Each iteration, currentParent is populated with node's host parent if not + // currentParentIsValid. + var currentParentIsValid = false; // Note: these two variables *must* always be updated together. + var currentParent; + var currentParentIsContainer; + while(true){ + if (!currentParentIsValid) { + var parent = node.return; + findParent: while(true){ + if (!(parent !== null)) throw Error("Expected to find a host parent. This error is likely caused by a bug in React. Please file an issue."); + var parentStateNode = parent.stateNode; + switch(parent.tag){ + case HostComponent: + currentParent = parentStateNode; + currentParentIsContainer = false; + break findParent; + case HostRoot: + currentParent = parentStateNode.containerInfo; + currentParentIsContainer = true; + break findParent; + case HostPortal: + currentParent = parentStateNode.containerInfo; + currentParentIsContainer = true; + break findParent; + } + parent = parent.return; + } + currentParentIsValid = true; + } + if (node.tag === HostComponent || node.tag === HostText) { + commitNestedUnmounts(finishedRoot, node); // After all the children have unmounted, it is now safe to remove the + // node from the tree. + if (currentParentIsContainer) removeChildFromContainer(currentParent, node.stateNode); + else removeChild(currentParent, node.stateNode); + // Don't visit children because we already visited them. + } else if (node.tag === HostPortal) { + if (node.child !== null) { + // When we go into a portal, it becomes the parent to remove from. + // We will reassign it back when we pop the portal on the way up. + currentParent = node.stateNode.containerInfo; + currentParentIsContainer = true; // Visit children because portals might contain host components. + node.child.return = node; + node = node.child; + continue; + } + } else { + commitUnmount(finishedRoot, node); // Visit children because we may find more host components below. + if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + } + if (node === current) return; + while(node.sibling === null){ + if (node.return === null || node.return === current) return; + node = node.return; + if (node.tag === HostPortal) // When we go out of the portal, we need to restore the parent. + // Since we don't keep a stack of them, we will search for it. + currentParentIsValid = false; + } + node.sibling.return = node.return; + node = node.sibling; + } + } + function commitDeletion(finishedRoot, current, renderPriorityLevel) { + // Recursively delete all host nodes from the parent. + // Detach refs and call componentWillUnmount() on the whole subtree. + unmountHostComponents(finishedRoot, current); + var alternate = current.alternate; + detachFiberMutation(current); + if (alternate !== null) detachFiberMutation(alternate); + } + function commitWork(current, finishedWork) { + switch(finishedWork.tag){ + case FunctionComponent: + case ForwardRef: + case MemoComponent: + case SimpleMemoComponent: + case Block: + commitHookEffectListUnmount(Layout | HasEffect, finishedWork); + return; + case ClassComponent: + return; + case HostComponent: + var instance = finishedWork.stateNode; + if (instance != null) { + // Commit the work prepared earlier. + var newProps = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps + // as the newProps. The updatePayload will contain the real change in + // this case. + var oldProps = current !== null ? current.memoizedProps : newProps; + var type = finishedWork.type; // TODO: Type the updateQueue to be specific to host components. + var updatePayload = finishedWork.updateQueue; + finishedWork.updateQueue = null; + if (updatePayload !== null) commitUpdate(instance, updatePayload, type, oldProps, newProps); + } + return; + case HostText: + if (!(finishedWork.stateNode !== null)) throw Error("This should have a text node initialized. This error is likely caused by a bug in React. Please file an issue."); + var textInstance = finishedWork.stateNode; + var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps + // as the newProps. The updatePayload will contain the real change in + // this case. + var oldText = current !== null ? current.memoizedProps : newText; + commitTextUpdate(textInstance, oldText, newText); + return; + case HostRoot: + var _root = finishedWork.stateNode; + if (_root.hydrate) { + // We've just hydrated. No need to hydrate again. + _root.hydrate = false; + commitHydratedContainer(_root.containerInfo); + } + return; + case Profiler: + return; + case SuspenseComponent: + commitSuspenseComponent(finishedWork); + attachSuspenseRetryListeners(finishedWork); + return; + case SuspenseListComponent: + attachSuspenseRetryListeners(finishedWork); + return; + case IncompleteClassComponent: + return; + case FundamentalComponent: + break; + case ScopeComponent: + break; + case OffscreenComponent: + case LegacyHiddenComponent: + var newState = finishedWork.memoizedState; + var isHidden = newState !== null; + hideOrUnhideAllChildren(finishedWork, isHidden); + return; + } + throw Error("This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."); + } + function commitSuspenseComponent(finishedWork) { + var newState = finishedWork.memoizedState; + if (newState !== null) { + markCommitTimeOfFallback(); + // Hide the Offscreen component that contains the primary children. TODO: + // Ideally, this effect would have been scheduled on the Offscreen fiber + // itself. That's how unhiding works: the Offscreen component schedules an + // effect on itself. However, in this case, the component didn't complete, + // so the fiber was never added to the effect list in the normal path. We + // could have appended it to the effect list in the Suspense component's + // second pass, but doing it this way is less complicated. This would be + // simpler if we got rid of the effect list and traversed the tree, like + // we're planning to do. + var primaryChildParent = finishedWork.child; + hideOrUnhideAllChildren(primaryChildParent, true); + } + } + function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { + var newState = finishedWork.memoizedState; + if (newState === null) { + var current = finishedWork.alternate; + if (current !== null) { + var prevState = current.memoizedState; + if (prevState !== null) { + var suspenseInstance = prevState.dehydrated; + if (suspenseInstance !== null) commitHydratedSuspenseInstance(suspenseInstance); + } + } + } + } + function attachSuspenseRetryListeners(finishedWork) { + // If this boundary just timed out, then it will have a set of wakeables. + // For each wakeable, attach a listener so that when it resolves, React + // attempts to re-render the boundary in the primary (pre-timeout) state. + var wakeables = finishedWork.updateQueue; + if (wakeables !== null) { + finishedWork.updateQueue = null; + var retryCache = finishedWork.stateNode; + if (retryCache === null) retryCache = finishedWork.stateNode = new PossiblyWeakSet(); + wakeables.forEach(function(wakeable) { + // Memoize using the boundary fiber to prevent redundant listeners. + var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); + if (!retryCache.has(wakeable)) { + if (wakeable.__reactDoNotTraceInteractions !== true) retry = tracing.unstable_wrap(retry); + retryCache.add(wakeable); + wakeable.then(retry, retry); + } + }); + } + } // This function detects when a Suspense boundary goes from visible to hidden. + // It returns false if the boundary is already hidden. + // TODO: Use an effect tag. + function isSuspenseBoundaryBeingHidden(current, finishedWork) { + if (current !== null) { + var oldState = current.memoizedState; + if (oldState === null || oldState.dehydrated !== null) { + var newState = finishedWork.memoizedState; + return newState !== null && newState.dehydrated === null; + } + } + return false; + } + function commitResetTextContent(current) { + resetTextContent(current.stateNode); + } + var COMPONENT_TYPE = 0; + var HAS_PSEUDO_CLASS_TYPE = 1; + var ROLE_TYPE = 2; + var TEST_NAME_TYPE = 3; + var TEXT_TYPE = 4; + if (typeof Symbol === "function" && Symbol.for) { + var symbolFor$1 = Symbol.for; + COMPONENT_TYPE = symbolFor$1("selector.component"); + HAS_PSEUDO_CLASS_TYPE = symbolFor$1("selector.has_pseudo_class"); + ROLE_TYPE = symbolFor$1("selector.role"); + TEST_NAME_TYPE = symbolFor$1("selector.test_id"); + TEXT_TYPE = symbolFor$1("selector.text"); + } + var commitHooks = []; + function onCommitRoot$1() { + commitHooks.forEach(function(commitHook) { + return commitHook(); + }); + } + var ceil = Math.ceil; + var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; + var NoContext = /* */ 0; + var BatchedContext = /* */ 1; + var EventContext = /* */ 2; + var DiscreteEventContext = /* */ 4; + var LegacyUnbatchedContext = /* */ 8; + var RenderContext = /* */ 16; + var CommitContext = /* */ 32; + var RetryAfterError = /* */ 64; + var RootIncomplete = 0; + var RootFatalErrored = 1; + var RootErrored = 2; + var RootSuspended = 3; + var RootSuspendedWithDelay = 4; + var RootCompleted = 5; // Describes where we are in the React execution stack + var executionContext = NoContext; // The root we're working on + var workInProgressRoot = null; // The fiber we're working on + var workInProgress = null; // The lanes we're rendering + var workInProgressRootRenderLanes = NoLanes; // Stack that allows components to change the render lanes for its subtree + // This is a superset of the lanes we started working on at the root. The only + // case where it's different from `workInProgressRootRenderLanes` is when we + // enter a subtree that is hidden and needs to be unhidden: Suspense and + // Offscreen component. + // + // Most things in the work loop should deal with workInProgressRootRenderLanes. + // Most things in begin/complete phases should deal with subtreeRenderLanes. + var subtreeRenderLanes = NoLanes; + var subtreeRenderLanesCursor = createCursor(NoLanes); // Whether to root completed, errored, suspended, etc. + var workInProgressRootExitStatus = RootIncomplete; // A fatal error, if one is thrown + var workInProgressRootFatalError = null; // "Included" lanes refer to lanes that were worked on during this render. It's + // slightly different than `renderLanes` because `renderLanes` can change as you + // enter and exit an Offscreen tree. This value is the combination of all render + // lanes for the entire render phase. + var workInProgressRootIncludedLanes = NoLanes; // The work left over by components that were visited during this render. Only + // includes unprocessed updates, not work in bailed out children. + var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. + var workInProgressRootUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render. + var workInProgressRootPingedLanes = NoLanes; + var mostRecentlyUpdatedRoot = null; // The most recent time we committed a fallback. This lets us ensure a train + // model where we don't commit new loading states in too quick succession. + var globalMostRecentFallbackTime = 0; + var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering + // more and prefer CPU suspense heuristics instead. + var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU + // suspense heuristics and opt out of rendering more content. + var RENDER_TIMEOUT_MS = 500; + function resetRenderTimer() { + workInProgressRootRenderTargetTime = now() + RENDER_TIMEOUT_MS; + } + function getRenderTargetTime() { + return workInProgressRootRenderTargetTime; + } + var nextEffect = null; + var hasUncaughtError = false; + var firstUncaughtError = null; + var legacyErrorBoundariesThatAlreadyFailed = null; + var rootDoesHavePassiveEffects = false; + var rootWithPendingPassiveEffects = null; + var pendingPassiveEffectsRenderPriority = NoPriority$1; + var pendingPassiveEffectsLanes = NoLanes; + var pendingPassiveHookEffectsMount = []; + var pendingPassiveHookEffectsUnmount = []; + var rootsWithPendingDiscreteUpdates = null; // Use these to prevent an infinite loop of nested updates + var NESTED_UPDATE_LIMIT = 50; + var nestedUpdateCount = 0; + var rootWithNestedUpdates = null; + var NESTED_PASSIVE_UPDATE_LIMIT = 50; + var nestedPassiveUpdateCount = 0; // Marks the need to reschedule pending interactions at these lanes + // during the commit phase. This enables them to be traced across components + // that spawn new work during render. E.g. hidden boundaries, suspended SSR + // hydration or SuspenseList. + // TODO: Can use a bitmask instead of an array + var spawnedWorkDuringRender = null; // If two updates are scheduled within the same event, we should treat their + // event times as simultaneous, even if the actual clock time has advanced + // between the first and second call. + var currentEventTime = NoTimestamp; + var currentEventWipLanes = NoLanes; + var currentEventPendingLanes = NoLanes; // Dev only flag that tracks if passive effects are currently being flushed. + // We warn about state updates for unmounted components differently in this case. + var isFlushingPassiveEffects = false; + var focusedInstanceHandle = null; + var shouldFireAfterActiveInstanceBlur = false; + function getWorkInProgressRoot() { + return workInProgressRoot; + } + function requestEventTime() { + if ((executionContext & (RenderContext | CommitContext)) !== NoContext) // We're inside React, so it's fine to read the actual time. + return now(); + // We're not inside React, so we may be in the middle of a browser event. + if (currentEventTime !== NoTimestamp) // Use the same start time for all updates until we enter React again. + return currentEventTime; + // This is the first update since React yielded. Compute a new start time. + currentEventTime = now(); + return currentEventTime; + } + function requestUpdateLane(fiber) { + // Special cases + var mode = fiber.mode; + if ((mode & BlockingMode) === NoMode) return SyncLane; + else if ((mode & ConcurrentMode) === NoMode) return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane; + // The algorithm for assigning an update to a lane should be stable for all + // updates at the same priority within the same event. To do this, the inputs + // to the algorithm must be the same. For example, we use the `renderLanes` + // to avoid choosing a lane that is already in the middle of rendering. + // + // However, the "included" lanes could be mutated in between updates in the + // same event, like if you perform an update inside `flushSync`. Or any other + // code path that might call `prepareFreshStack`. + // + // The trick we use is to cache the first of each of these inputs within an + // event. Then reset the cached values once we can be sure the event is over. + // Our heuristic for that is whenever we enter a concurrent work loop. + // + // We'll do the same for `currentEventPendingLanes` below. + if (currentEventWipLanes === NoLanes) currentEventWipLanes = workInProgressRootIncludedLanes; + var isTransition = requestCurrentTransition() !== NoTransition; + if (isTransition) { + if (currentEventPendingLanes !== NoLanes) currentEventPendingLanes = mostRecentlyUpdatedRoot !== null ? mostRecentlyUpdatedRoot.pendingLanes : NoLanes; + return findTransitionLane(currentEventWipLanes, currentEventPendingLanes); + } // TODO: Remove this dependency on the Scheduler priority. + // To do that, we're replacing it with an update lane priority. + var schedulerPriority = getCurrentPriorityLevel(); // The old behavior was using the priority level of the Scheduler. + // This couples React to the Scheduler internals, so we're replacing it + // with the currentUpdateLanePriority above. As an example of how this + // could be problematic, if we're not inside `Scheduler.runWithPriority`, + // then we'll get the priority of the current running Scheduler task, + // which is probably not what we want. + var lane; + if ((executionContext & DiscreteEventContext) !== NoContext && schedulerPriority === UserBlockingPriority$2) lane = findUpdateLane(InputDiscreteLanePriority, currentEventWipLanes); + else { + var schedulerLanePriority = schedulerPriorityToLanePriority(schedulerPriority); + lane = findUpdateLane(schedulerLanePriority, currentEventWipLanes); + } + return lane; + } + function requestRetryLane(fiber) { + // This is a fork of `requestUpdateLane` designed specifically for Suspense + // "retries" — a special update that attempts to flip a Suspense boundary + // from its placeholder state to its primary/resolved state. + // Special cases + var mode = fiber.mode; + if ((mode & BlockingMode) === NoMode) return SyncLane; + else if ((mode & ConcurrentMode) === NoMode) return getCurrentPriorityLevel() === ImmediatePriority$1 ? SyncLane : SyncBatchedLane; + // See `requestUpdateLane` for explanation of `currentEventWipLanes` + if (currentEventWipLanes === NoLanes) currentEventWipLanes = workInProgressRootIncludedLanes; + return findRetryLane(currentEventWipLanes); + } + function scheduleUpdateOnFiber(fiber, lane, eventTime) { + checkForNestedUpdates(); + warnAboutRenderPhaseUpdatesInDEV(fiber); + var root = markUpdateLaneFromFiberToRoot(fiber, lane); + if (root === null) { + warnAboutUpdateOnUnmountedFiberInDEV(fiber); + return null; + } // Mark that the root has a pending update. + markRootUpdated(root, lane, eventTime); + if (root === workInProgressRoot) { + workInProgressRootUpdatedLanes = mergeLanes(workInProgressRootUpdatedLanes, lane); + if (workInProgressRootExitStatus === RootSuspendedWithDelay) // The root already suspended with a delay, which means this render + // definitely won't finish. Since we have a new update, let's mark it as + // suspended now, right before marking the incoming update. This has the + // effect of interrupting the current render and switching to the update. + // TODO: Make sure this doesn't override pings that happen while we've + // already started rendering. + markRootSuspended$1(root, workInProgressRootRenderLanes); + } // TODO: requestUpdateLanePriority also reads the priority. Pass the + // priority as an argument to that function and this one. + var priorityLevel = getCurrentPriorityLevel(); + if (lane === SyncLane) { + if ((executionContext & LegacyUnbatchedContext) !== NoContext && // Check if we're not already rendering + (executionContext & (RenderContext | CommitContext)) === NoContext) { + // Register pending interactions on the root to avoid losing traced interaction data. + schedulePendingInteractions(root, lane); // This is a legacy edge case. The initial mount of a ReactDOM.render-ed + // root inside of batchedUpdates should be synchronous, but layout updates + // should be deferred until the end of the batch. + performSyncWorkOnRoot(root); + } else { + ensureRootIsScheduled(root, eventTime); + schedulePendingInteractions(root, lane); + if (executionContext === NoContext) { + // Flush the synchronous work now, unless we're already working or inside + // a batch. This is intentionally inside scheduleUpdateOnFiber instead of + // scheduleCallbackForFiber to preserve the ability to schedule a callback + // without immediately flushing it. We only do this for user-initiated + // updates, to preserve historical behavior of legacy mode. + resetRenderTimer(); + flushSyncCallbackQueue(); + } + } + } else { + // Schedule a discrete update but only if it's not Sync. + if ((executionContext & DiscreteEventContext) !== NoContext && // discrete, even inside a discrete event. + (priorityLevel === UserBlockingPriority$2 || priorityLevel === ImmediatePriority$1)) { + // This is the result of a discrete event. Track the lowest priority + // discrete update per root so we can flush them early, if needed. + if (rootsWithPendingDiscreteUpdates === null) rootsWithPendingDiscreteUpdates = new Set([ + root + ]); + else rootsWithPendingDiscreteUpdates.add(root); + } // Schedule other updates after in case the callback is sync. + ensureRootIsScheduled(root, eventTime); + schedulePendingInteractions(root, lane); + } // We use this when assigning a lane for a transition inside + // `requestUpdateLane`. We assume it's the same as the root being updated, + // since in the common case of a single root app it probably is. If it's not + // the same root, then it's not a huge deal, we just might batch more stuff + // together more than necessary. + mostRecentlyUpdatedRoot = root; + } // This is split into a separate function so we can mark a fiber with pending + // work without treating it as a typical update that originates from an event; + // e.g. retrying a Suspense boundary isn't an update, but it does schedule work + // on a fiber. + function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { + // Update the source fiber's lanes + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); + var alternate = sourceFiber.alternate; + if (alternate !== null) alternate.lanes = mergeLanes(alternate.lanes, lane); + if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + var node = sourceFiber; + var parent = sourceFiber.return; + while(parent !== null){ + parent.childLanes = mergeLanes(parent.childLanes, lane); + alternate = parent.alternate; + if (alternate !== null) alternate.childLanes = mergeLanes(alternate.childLanes, lane); + else if ((parent.flags & (Placement | Hydrating)) !== NoFlags) warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); + node = parent; + parent = parent.return; + } + if (node.tag === HostRoot) { + var root = node.stateNode; + return root; + } else return null; + } // Use this function to schedule a task for a root. There's only one task per + // root; if a task was already scheduled, we'll check to make sure the priority + // of the existing task is the same as the priority of the next level that the + // root has work on. This function is called on every update, and right before + // exiting a task. + function ensureRootIsScheduled(root, currentTime) { + var existingCallbackNode = root.callbackNode; // Check if any lanes are being starved by other work. If so, mark them as + // expired so we know to work on those next. + markStarvedLanesAsExpired(root, currentTime); // Determine the next lanes to work on, and their priority. + var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); // This returns the priority level computed during the `getNextLanes` call. + var newCallbackPriority = returnNextLanesPriority(); + if (nextLanes === NoLanes) { + // Special case: There's nothing to work on. + if (existingCallbackNode !== null) { + cancelCallback(existingCallbackNode); + root.callbackNode = null; + root.callbackPriority = NoLanePriority; + } + return; + } // Check if there's an existing task. We may be able to reuse it. + if (existingCallbackNode !== null) { + var existingCallbackPriority = root.callbackPriority; + if (existingCallbackPriority === newCallbackPriority) // The priority hasn't changed. We can reuse the existing task. Exit. + return; + // The priority changed. Cancel the existing callback. We'll schedule a new + // one below. + cancelCallback(existingCallbackNode); + } // Schedule a new callback. + var newCallbackNode; + if (newCallbackPriority === SyncLanePriority) // Special case: Sync React callbacks are scheduled on a special + // internal queue + newCallbackNode = scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root)); + else if (newCallbackPriority === SyncBatchedLanePriority) newCallbackNode = scheduleCallback(ImmediatePriority$1, performSyncWorkOnRoot.bind(null, root)); + else { + var schedulerPriorityLevel = lanePriorityToSchedulerPriority(newCallbackPriority); + newCallbackNode = scheduleCallback(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root)); + } + root.callbackPriority = newCallbackPriority; + root.callbackNode = newCallbackNode; + } // This is the entry point for every concurrent task, i.e. anything that + // goes through Scheduler. + function performConcurrentWorkOnRoot(root) { + // Since we know we're in a React event, we can clear the current + // event time. The next update will compute a new event time. + currentEventTime = NoTimestamp; + currentEventWipLanes = NoLanes; + currentEventPendingLanes = NoLanes; + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) throw Error("Should not already be working."); + // Flush any pending passive effects before deciding which lanes to work on, + // in case they schedule additional work. + var originalCallbackNode = root.callbackNode; + var didFlushPassiveEffects = flushPassiveEffects(); + if (didFlushPassiveEffects) { + // Something in the passive effect phase may have canceled the current task. + // Check if the task node for this root was changed. + if (root.callbackNode !== originalCallbackNode) // The current task was canceled. Exit. We don't need to call + // `ensureRootIsScheduled` because the check above implies either that + // there's a new task, or that there's no remaining work on this root. + return null; + } // Determine the next expiration time to work on, using the fields stored + // on the root. + var lanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); + if (lanes === NoLanes) // Defensive coding. This is never expected to happen. + return null; + var exitStatus = renderRootConcurrent(root, lanes); + if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) // The render included lanes that were updated during the render phase. + // For example, when unhiding a hidden tree, we include all the lanes + // that were previously skipped when the tree was hidden. That set of + // lanes is a superset of the lanes we started rendering with. + // + // So we'll throw out the current work and restart. + prepareFreshStack(root, NoLanes); + else if (exitStatus !== RootIncomplete) { + if (exitStatus === RootErrored) { + executionContext |= RetryAfterError; // If an error occurred during hydration, + // discard server response and fall back to client side render. + if (root.hydrate) { + root.hydrate = false; + clearContainer(root.containerInfo); + } // If something threw an error, try rendering one more time. We'll render + // synchronously to block concurrent data mutations, and we'll includes + // all pending updates are included. If it still fails after the second + // attempt, we'll give up and commit the resulting tree. + lanes = getLanesToRetrySynchronouslyOnError(root); + if (lanes !== NoLanes) exitStatus = renderRootSync(root, lanes); + } + if (exitStatus === RootFatalErrored) { + var fatalError = workInProgressRootFatalError; + prepareFreshStack(root, NoLanes); + markRootSuspended$1(root, lanes); + ensureRootIsScheduled(root, now()); + throw fatalError; + } // We now have a consistent tree. The next step is either to commit it, + // or, if something suspended, wait to commit it after a timeout. + var finishedWork = root.current.alternate; + root.finishedWork = finishedWork; + root.finishedLanes = lanes; + finishConcurrentRender(root, exitStatus, lanes); + } + ensureRootIsScheduled(root, now()); + if (root.callbackNode === originalCallbackNode) // The task node scheduled for this root is the same one that's + // currently executed. Need to return a continuation. + return performConcurrentWorkOnRoot.bind(null, root); + return null; + } + function finishConcurrentRender(root, exitStatus, lanes) { + switch(exitStatus){ + case RootIncomplete: + case RootFatalErrored: + throw Error("Root did not complete. This is a bug in React."); + // Flow knows about invariant, so it complains if I add a break + // statement, but eslint doesn't know about invariant, so it complains + // if I do. eslint-disable-next-line no-fallthrough + case RootErrored: + // We should have already attempted to retry this tree. If we reached + // this point, it errored again. Commit it. + commitRoot(root); + break; + case RootSuspended: + markRootSuspended$1(root, lanes); // We have an acceptable loading state. We need to figure out if we + // should immediately commit it or wait a bit. + if (includesOnlyRetries(lanes) && // do not delay if we're inside an act() scope + !shouldForceFlushFallbacksInDEV()) { + // This render only included retries, no updates. Throttle committing + // retries so that we don't show too many loading states too quickly. + var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time. + if (msUntilTimeout > 10) { + var nextLanes = getNextLanes(root, NoLanes); + if (nextLanes !== NoLanes) break; + var suspendedLanes = root.suspendedLanes; + if (!isSubsetOfLanes(suspendedLanes, lanes)) { + // We should prefer to render the fallback of at the last + // suspended level. Ping the last suspended level to try + // rendering it again. + // FIXME: What if the suspended lanes are Idle? Should not restart. + var eventTime = requestEventTime(); + markRootPinged(root, suspendedLanes); + break; + } // The render is suspended, it hasn't timed out, and there's no + // lower priority work to do. Instead of committing the fallback + // immediately, wait for more data to arrive. + root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), msUntilTimeout); + break; + } + } // The work expired. Commit immediately. + commitRoot(root); + break; + case RootSuspendedWithDelay: + markRootSuspended$1(root, lanes); + if (includesOnlyTransitions(lanes)) break; + if (!shouldForceFlushFallbacksInDEV()) { + // This is not a transition, but we did trigger an avoided state. + // Schedule a placeholder to display after a short delay, using the Just + // Noticeable Difference. + // TODO: Is the JND optimization worth the added complexity? If this is + // the only reason we track the event time, then probably not. + // Consider removing. + var mostRecentEventTime = getMostRecentEventTime(root, lanes); + var eventTimeMs = mostRecentEventTime; + var timeElapsedMs = now() - eventTimeMs; + var _msUntilTimeout = jnd(timeElapsedMs) - timeElapsedMs; // Don't bother with a very short suspense time. + if (_msUntilTimeout > 10) { + // Instead of committing the fallback immediately, wait for more data + // to arrive. + root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root), _msUntilTimeout); + break; + } + } // Commit the placeholder. + commitRoot(root); + break; + case RootCompleted: + // The work completed. Ready to commit. + commitRoot(root); + break; + default: + throw Error("Unknown root exit status."); + } + } + function markRootSuspended$1(root, suspendedLanes) { + // When suspending, we should always exclude lanes that were pinged or (more + // rarely, since we try to avoid it) updated during the render phase. + // TODO: Lol maybe there's a better way to factor this besides this + // obnoxiously named function :) + suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes); + suspendedLanes = removeLanes(suspendedLanes, workInProgressRootUpdatedLanes); + markRootSuspended(root, suspendedLanes); + } // This is the entry point for synchronous tasks that don't go + // through Scheduler + function performSyncWorkOnRoot(root) { + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) throw Error("Should not already be working."); + flushPassiveEffects(); + var lanes; + var exitStatus; + if (root === workInProgressRoot && includesSomeLane(root.expiredLanes, workInProgressRootRenderLanes)) { + // There's a partial tree, and at least one of its lanes has expired. Finish + // rendering it before rendering the rest of the expired work. + lanes = workInProgressRootRenderLanes; + exitStatus = renderRootSync(root, lanes); + if (includesSomeLane(workInProgressRootIncludedLanes, workInProgressRootUpdatedLanes)) { + // The render included lanes that were updated during the render phase. + // For example, when unhiding a hidden tree, we include all the lanes + // that were previously skipped when the tree was hidden. That set of + // lanes is a superset of the lanes we started rendering with. + // + // Note that this only happens when part of the tree is rendered + // concurrently. If the whole tree is rendered synchronously, then there + // are no interleaved events. + lanes = getNextLanes(root, lanes); + exitStatus = renderRootSync(root, lanes); + } + } else { + lanes = getNextLanes(root, NoLanes); + exitStatus = renderRootSync(root, lanes); + } + if (root.tag !== LegacyRoot && exitStatus === RootErrored) { + executionContext |= RetryAfterError; // If an error occurred during hydration, + // discard server response and fall back to client side render. + if (root.hydrate) { + root.hydrate = false; + clearContainer(root.containerInfo); + } // If something threw an error, try rendering one more time. We'll render + // synchronously to block concurrent data mutations, and we'll includes + // all pending updates are included. If it still fails after the second + // attempt, we'll give up and commit the resulting tree. + lanes = getLanesToRetrySynchronouslyOnError(root); + if (lanes !== NoLanes) exitStatus = renderRootSync(root, lanes); + } + if (exitStatus === RootFatalErrored) { + var fatalError = workInProgressRootFatalError; + prepareFreshStack(root, NoLanes); + markRootSuspended$1(root, lanes); + ensureRootIsScheduled(root, now()); + throw fatalError; + } // We now have a consistent tree. Because this is a sync render, we + // will commit it even if something suspended. + var finishedWork = root.current.alternate; + root.finishedWork = finishedWork; + root.finishedLanes = lanes; + commitRoot(root); // Before exiting, make sure there's a callback scheduled for the next + // pending level. + ensureRootIsScheduled(root, now()); + return null; + } + function flushDiscreteUpdates() { + // TODO: Should be able to flush inside batchedUpdates, but not inside `act`. + // However, `act` uses `batchedUpdates`, so there's no way to distinguish + // those two cases. Need to fix this before exposing flushDiscreteUpdates + // as a public API. + if ((executionContext & (BatchedContext | RenderContext | CommitContext)) !== NoContext) { + if ((executionContext & RenderContext) !== NoContext) error("unstable_flushDiscreteUpdates: Cannot flush updates when React is already rendering."); + // This is probably a nested event dispatch triggered by a lifecycle/effect, + // like `el.focus()`. Exit. + return; + } + flushPendingDiscreteUpdates(); // If the discrete updates scheduled passive effects, flush them now so that + // they fire before the next serial event. + flushPassiveEffects(); + } + function flushPendingDiscreteUpdates() { + if (rootsWithPendingDiscreteUpdates !== null) { + // For each root with pending discrete updates, schedule a callback to + // immediately flush them. + var roots = rootsWithPendingDiscreteUpdates; + rootsWithPendingDiscreteUpdates = null; + roots.forEach(function(root) { + markDiscreteUpdatesExpired(root); + ensureRootIsScheduled(root, now()); + }); + } // Now flush the immediate queue. + flushSyncCallbackQueue(); + } + function batchedUpdates$1(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= BatchedContext; + try { + return fn(a); + } finally{ + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + resetRenderTimer(); + flushSyncCallbackQueue(); + } + } + } + function batchedEventUpdates$1(fn, a) { + var prevExecutionContext = executionContext; + executionContext |= EventContext; + try { + return fn(a); + } finally{ + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + resetRenderTimer(); + flushSyncCallbackQueue(); + } + } + } + function discreteUpdates$1(fn, a, b, c, d) { + var prevExecutionContext = executionContext; + executionContext |= DiscreteEventContext; + try { + return runWithPriority$1(UserBlockingPriority$2, fn.bind(null, a, b, c, d)); + } finally{ + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + resetRenderTimer(); + flushSyncCallbackQueue(); + } + } + } + function unbatchedUpdates(fn, a) { + var prevExecutionContext = executionContext; + executionContext &= ~BatchedContext; + executionContext |= LegacyUnbatchedContext; + try { + return fn(a); + } finally{ + executionContext = prevExecutionContext; + if (executionContext === NoContext) { + // Flush the immediate callbacks that were scheduled during this batch + resetRenderTimer(); + flushSyncCallbackQueue(); + } + } + } + function flushSync(fn, a) { + var prevExecutionContext = executionContext; + if ((prevExecutionContext & (RenderContext | CommitContext)) !== NoContext) { + error("flushSync was called from inside a lifecycle method. React cannot flush when React is already rendering. Consider moving this call to a scheduler task or micro task."); + return fn(a); + } + executionContext |= BatchedContext; + try { + if (fn) return runWithPriority$1(ImmediatePriority$1, fn.bind(null, a)); + else return undefined; + } finally{ + executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. + // Note that this will happen even if batchedUpdates is higher up + // the stack. + flushSyncCallbackQueue(); + } + } + function pushRenderLanes(fiber, lanes) { + push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber); + subtreeRenderLanes = mergeLanes(subtreeRenderLanes, lanes); + workInProgressRootIncludedLanes = mergeLanes(workInProgressRootIncludedLanes, lanes); + } + function popRenderLanes(fiber) { + subtreeRenderLanes = subtreeRenderLanesCursor.current; + pop(subtreeRenderLanesCursor, fiber); + } + function prepareFreshStack(root, lanes) { + root.finishedWork = null; + root.finishedLanes = NoLanes; + var timeoutHandle = root.timeoutHandle; + if (timeoutHandle !== noTimeout) { + // The root previous suspended and scheduled a timeout to commit a fallback + // state. Now that we have additional work, cancel the timeout. + root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above + cancelTimeout(timeoutHandle); + } + if (workInProgress !== null) { + var interruptedWork = workInProgress.return; + while(interruptedWork !== null){ + unwindInterruptedWork(interruptedWork); + interruptedWork = interruptedWork.return; + } + } + workInProgressRoot = root; + workInProgress = createWorkInProgress(root.current, null); + workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes; + workInProgressRootExitStatus = RootIncomplete; + workInProgressRootFatalError = null; + workInProgressRootSkippedLanes = NoLanes; + workInProgressRootUpdatedLanes = NoLanes; + workInProgressRootPingedLanes = NoLanes; + spawnedWorkDuringRender = null; + ReactStrictModeWarnings.discardPendingWarnings(); + } + function handleError(root, thrownValue) { + do { + var erroredWork = workInProgress; + try { + // Reset module-level state that was set during the render phase. + resetContextDependencies(); + resetHooksAfterThrow(); + resetCurrentFiber(); // TODO: I found and added this missing line while investigating a + // separate issue. Write a regression test using string refs. + ReactCurrentOwner$2.current = null; + if (erroredWork === null || erroredWork.return === null) { + // Expected to be working on a non-root fiber. This is a fatal error + // because there's no ancestor that can handle it; the root is + // supposed to capture all errors that weren't caught by an error + // boundary. + workInProgressRootExitStatus = RootFatalErrored; + workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next + // sibling, or the parent if there are no siblings. But since the root + // has no siblings nor a parent, we set it to null. Usually this is + // handled by `completeUnitOfWork` or `unwindWork`, but since we're + // intentionally not calling those, we need set it here. + // TODO: Consider calling `unwindWork` to pop the contexts. + workInProgress = null; + return; + } + if (enableProfilerTimer && erroredWork.mode & ProfileMode) // Record the time spent rendering before an error was thrown. This + // avoids inaccurate Profiler durations in the case of a + // suspended render. + stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true); + throwException(root, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes); + completeUnitOfWork(erroredWork); + } catch (yetAnotherThrownValue) { + // Something in the return path also threw. + thrownValue = yetAnotherThrownValue; + if (workInProgress === erroredWork && erroredWork !== null) { + // If this boundary has already errored, then we had trouble processing + // the error. Bubble it to the next boundary. + erroredWork = erroredWork.return; + workInProgress = erroredWork; + } else erroredWork = workInProgress; + continue; + } // Return to the normal work loop. + return; + }while (true); + } + function pushDispatcher() { + var prevDispatcher = ReactCurrentDispatcher$2.current; + ReactCurrentDispatcher$2.current = ContextOnlyDispatcher; + if (prevDispatcher === null) // The React isomorphic package does not include a default dispatcher. + // Instead the first renderer will lazily attach one, in order to give + // nicer error messages. + return ContextOnlyDispatcher; + else return prevDispatcher; + } + function popDispatcher(prevDispatcher) { + ReactCurrentDispatcher$2.current = prevDispatcher; + } + function pushInteractions(root) { + var prevInteractions = tracing.__interactionsRef.current; + tracing.__interactionsRef.current = root.memoizedInteractions; + return prevInteractions; + } + function popInteractions(prevInteractions) { + tracing.__interactionsRef.current = prevInteractions; + } + function markCommitTimeOfFallback() { + globalMostRecentFallbackTime = now(); + } + function markSkippedUpdateLanes(lane) { + workInProgressRootSkippedLanes = mergeLanes(lane, workInProgressRootSkippedLanes); + } + function renderDidSuspend() { + if (workInProgressRootExitStatus === RootIncomplete) workInProgressRootExitStatus = RootSuspended; + } + function renderDidSuspendDelayIfPossible() { + if (workInProgressRootExitStatus === RootIncomplete || workInProgressRootExitStatus === RootSuspended) workInProgressRootExitStatus = RootSuspendedWithDelay; + // Check if there are updates that we skipped tree that might have unblocked + // this render. + if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootUpdatedLanes))) // Mark the current render as suspended so that we switch to working on + // the updates that were skipped. Usually we only suspend at the end of + // the render phase. + // TODO: We should probably always mark the root as suspended immediately + // (inside this function), since by suspending at the end of the render + // phase introduces a potential mistake where we suspend lanes that were + // pinged or updated while we were rendering. + markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes); + } + function renderDidError() { + if (workInProgressRootExitStatus !== RootCompleted) workInProgressRootExitStatus = RootErrored; + } // Called during render to determine if anything has suspended. + // Returns false if we're not sure. + function renderHasNotSuspendedYet() { + // If something errored or completed, we can't really be sure, + // so those are false. + return workInProgressRootExitStatus === RootIncomplete; + } + function renderRootSync(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= RenderContext; + var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack + // and prepare a fresh one. Otherwise we'll continue where we left off. + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { + prepareFreshStack(root, lanes); + startWorkOnPendingInteractions(root, lanes); + } + var prevInteractions = pushInteractions(root); + for(;;)try { + workLoopSync(); + break; + } catch (thrownValue) { + handleError(root, thrownValue); + } + resetContextDependencies(); + popInteractions(prevInteractions); + executionContext = prevExecutionContext; + popDispatcher(prevDispatcher); + if (workInProgress !== null) throw Error("Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue."); + workInProgressRoot = null; + workInProgressRootRenderLanes = NoLanes; + return workInProgressRootExitStatus; + } // The work loop is an extremely hot path. Tell Closure not to inline it. + /** @noinline */ function workLoopSync() { + // Already timed out, so perform work without checking if we need to yield. + while(workInProgress !== null)performUnitOfWork(workInProgress); + } + function renderRootConcurrent(root, lanes) { + var prevExecutionContext = executionContext; + executionContext |= RenderContext; + var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack + // and prepare a fresh one. Otherwise we'll continue where we left off. + if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { + resetRenderTimer(); + prepareFreshStack(root, lanes); + startWorkOnPendingInteractions(root, lanes); + } + var prevInteractions = pushInteractions(root); + for(;;)try { + workLoopConcurrent(); + break; + } catch (thrownValue) { + handleError(root, thrownValue); + } + resetContextDependencies(); + popInteractions(prevInteractions); + popDispatcher(prevDispatcher); + executionContext = prevExecutionContext; + if (workInProgress !== null) return RootIncomplete; + else { + workInProgressRoot = null; + workInProgressRootRenderLanes = NoLanes; // Return the final exit status. + return workInProgressRootExitStatus; + } + } + /** @noinline */ function workLoopConcurrent() { + // Perform work until Scheduler asks us to yield + while(workInProgress !== null && !shouldYield())performUnitOfWork(workInProgress); + } + function performUnitOfWork(unitOfWork) { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current = unitOfWork.alternate; + setCurrentFiber(unitOfWork); + var next; + if ((unitOfWork.mode & ProfileMode) !== NoMode) { + startProfilerTimer(unitOfWork); + next = beginWork$1(current, unitOfWork, subtreeRenderLanes); + stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); + } else next = beginWork$1(current, unitOfWork, subtreeRenderLanes); + resetCurrentFiber(); + unitOfWork.memoizedProps = unitOfWork.pendingProps; + if (next === null) // If this doesn't spawn new work, complete the current work. + completeUnitOfWork(unitOfWork); + else workInProgress = next; + ReactCurrentOwner$2.current = null; + } + function completeUnitOfWork(unitOfWork) { + // Attempt to complete the current unit of work, then move to the next + // sibling. If there are no more siblings, return to the parent fiber. + var completedWork = unitOfWork; + do { + // The current, flushed, state of this fiber is the alternate. Ideally + // nothing should rely on this, but relying on it here means that we don't + // need an additional field on the work in progress. + var current = completedWork.alternate; + var returnFiber = completedWork.return; // Check if the work completed or if something threw. + if ((completedWork.flags & Incomplete) === NoFlags) { + setCurrentFiber(completedWork); + var next = void 0; + if ((completedWork.mode & ProfileMode) === NoMode) next = completeWork(current, completedWork, subtreeRenderLanes); + else { + startProfilerTimer(completedWork); + next = completeWork(current, completedWork, subtreeRenderLanes); // Update render duration assuming we didn't error. + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); + } + resetCurrentFiber(); + if (next !== null) { + // Completing this fiber spawned new work. Work on that next. + workInProgress = next; + return; + } + resetChildLanes(completedWork); + if (returnFiber !== null && // Do not append effects to parents if a sibling failed to complete + (returnFiber.flags & Incomplete) === NoFlags) { + // Append all the effects of the subtree and this fiber onto the effect + // list of the parent. The completion order of the children affects the + // side-effect order. + if (returnFiber.firstEffect === null) returnFiber.firstEffect = completedWork.firstEffect; + if (completedWork.lastEffect !== null) { + if (returnFiber.lastEffect !== null) returnFiber.lastEffect.nextEffect = completedWork.firstEffect; + returnFiber.lastEffect = completedWork.lastEffect; + } // If this fiber had side-effects, we append it AFTER the children's + // side-effects. We can perform certain side-effects earlier if needed, + // by doing multiple passes over the effect list. We don't want to + // schedule our own side-effect on our own list because if end up + // reusing children we'll schedule this effect onto itself since we're + // at the end. + var flags = completedWork.flags; // Skip both NoWork and PerformedWork tags when creating the effect + // list. PerformedWork effect is read by React DevTools but shouldn't be + // committed. + if (flags > PerformedWork) { + if (returnFiber.lastEffect !== null) returnFiber.lastEffect.nextEffect = completedWork; + else returnFiber.firstEffect = completedWork; + returnFiber.lastEffect = completedWork; + } + } + } else { + // This fiber did not complete because something threw. Pop values off + // the stack without entering the complete phase. If this is a boundary, + // capture values if possible. + var _next = unwindWork(completedWork); // Because this fiber did not complete, don't reset its expiration time. + if (_next !== null) { + // If completing this work spawned new work, do that next. We'll come + // back here again. + // Since we're restarting, remove anything that is not a host effect + // from the effect tag. + _next.flags &= HostEffectMask; + workInProgress = _next; + return; + } + if ((completedWork.mode & ProfileMode) !== NoMode) { + // Record the render duration for the fiber that errored. + stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. + var actualDuration = completedWork.actualDuration; + var child = completedWork.child; + while(child !== null){ + actualDuration += child.actualDuration; + child = child.sibling; + } + completedWork.actualDuration = actualDuration; + } + if (returnFiber !== null) { + // Mark the parent fiber as incomplete and clear its effect list. + returnFiber.firstEffect = returnFiber.lastEffect = null; + returnFiber.flags |= Incomplete; + } + } + var siblingFiber = completedWork.sibling; + if (siblingFiber !== null) { + // If there is more work to do in this returnFiber, do that next. + workInProgress = siblingFiber; + return; + } // Otherwise, return to the parent + completedWork = returnFiber; // Update the next thing we're working on in case something throws. + workInProgress = completedWork; + }while (completedWork !== null); // We've reached the root. + if (workInProgressRootExitStatus === RootIncomplete) workInProgressRootExitStatus = RootCompleted; + } + function resetChildLanes(completedWork) { + if (// to switch statement in `completeWork`. + (completedWork.tag === LegacyHiddenComponent || completedWork.tag === OffscreenComponent) && completedWork.memoizedState !== null && !includesSomeLane(subtreeRenderLanes, OffscreenLane) && (completedWork.mode & ConcurrentMode) !== NoLanes) // The children of this component are hidden. Don't bubble their + // expiration times. + return; + var newChildLanes = NoLanes; // Bubble up the earliest expiration time. + if ((completedWork.mode & ProfileMode) !== NoMode) { + // In profiling mode, resetChildExpirationTime is also used to reset + // profiler durations. + var actualDuration = completedWork.actualDuration; + var treeBaseDuration = completedWork.selfBaseDuration; // When a fiber is cloned, its actualDuration is reset to 0. This value will + // only be updated if work is done on the fiber (i.e. it doesn't bailout). + // When work is done, it should bubble to the parent's actualDuration. If + // the fiber has not been cloned though, (meaning no work was done), then + // this value will reflect the amount of time spent working on a previous + // render. In that case it should not bubble. We determine whether it was + // cloned by comparing the child pointer. + var shouldBubbleActualDurations = completedWork.alternate === null || completedWork.child !== completedWork.alternate.child; + var child = completedWork.child; + while(child !== null){ + newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes)); + if (shouldBubbleActualDurations) actualDuration += child.actualDuration; + treeBaseDuration += child.treeBaseDuration; + child = child.sibling; + } + var isTimedOutSuspense = completedWork.tag === SuspenseComponent && completedWork.memoizedState !== null; + if (isTimedOutSuspense) { + // Don't count time spent in a timed out Suspense subtree as part of the base duration. + var primaryChildFragment = completedWork.child; + if (primaryChildFragment !== null) treeBaseDuration -= primaryChildFragment.treeBaseDuration; + } + completedWork.actualDuration = actualDuration; + completedWork.treeBaseDuration = treeBaseDuration; + } else { + var _child = completedWork.child; + while(_child !== null){ + newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child.lanes, _child.childLanes)); + _child = _child.sibling; + } + } + completedWork.childLanes = newChildLanes; + } + function commitRoot(root) { + var renderPriorityLevel = getCurrentPriorityLevel(); + runWithPriority$1(ImmediatePriority$1, commitRootImpl.bind(null, root, renderPriorityLevel)); + return null; + } + function commitRootImpl(root, renderPriorityLevel) { + do // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which + // means `flushPassiveEffects` will sometimes result in additional + // passive effects. So we need to keep flushing in a loop until there are + // no more pending effects. + // TODO: Might be better if `flushPassiveEffects` did not automatically + // flush synchronous work at the end, to avoid factoring hazards like this. + flushPassiveEffects(); + while (rootWithPendingPassiveEffects !== null); + flushRenderPhaseStrictModeWarningsInDEV(); + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) throw Error("Should not already be working."); + var finishedWork = root.finishedWork; + var lanes = root.finishedLanes; + if (finishedWork === null) return null; + root.finishedWork = null; + root.finishedLanes = NoLanes; + if (!(finishedWork !== root.current)) throw Error("Cannot commit the same tree as before. This error is likely caused by a bug in React. Please file an issue."); + // commitRoot never returns a continuation; it always finishes synchronously. + // So we can clear these now to allow a new callback to be scheduled. + root.callbackNode = null; // Update the first and last pending times on this root. The new first + // pending time is whatever is left on the root fiber. + var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes); + markRootFinished(root, remainingLanes); // Clear already finished discrete updates in case that a later call of + // `flushDiscreteUpdates` starts a useless render pass which may cancels + // a scheduled timeout. + if (rootsWithPendingDiscreteUpdates !== null) { + if (!hasDiscreteLanes(remainingLanes) && rootsWithPendingDiscreteUpdates.has(root)) rootsWithPendingDiscreteUpdates.delete(root); + } + if (root === workInProgressRoot) { + // We can reset these now that they are finished. + workInProgressRoot = null; + workInProgress = null; + workInProgressRootRenderLanes = NoLanes; + } // Get the list of effects. + var firstEffect; + if (finishedWork.flags > PerformedWork) { + // A fiber's effect list consists only of its children, not itself. So if + // the root has an effect, we need to add it to the end of the list. The + // resulting list is the set that would belong to the root's parent, if it + // had one; that is, all the effects in the tree including the root. + if (finishedWork.lastEffect !== null) { + finishedWork.lastEffect.nextEffect = finishedWork; + firstEffect = finishedWork.firstEffect; + } else firstEffect = finishedWork; + } else // There is no effect on the root. + firstEffect = finishedWork.firstEffect; + if (firstEffect !== null) { + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + var prevInteractions = pushInteractions(root); // Reset this to null before calling lifecycles + ReactCurrentOwner$2.current = null; // The commit phase is broken into several sub-phases. We do a separate pass + // of the effect list for each phase: all mutation effects come before all + // layout effects, and so on. + // The first phase a "before mutation" phase. We use this phase to read the + // state of the host tree right before we mutate it. This is where + // getSnapshotBeforeUpdate is called. + focusedInstanceHandle = prepareForCommit(root.containerInfo); + shouldFireAfterActiveInstanceBlur = false; + nextEffect = firstEffect; + do { + invokeGuardedCallback(null, commitBeforeMutationEffects, null); + if (hasCaughtError()) { + if (!(nextEffect !== null)) throw Error("Should be working on an effect."); + var error = clearCaughtError(); + captureCommitPhaseError(nextEffect, error); + nextEffect = nextEffect.nextEffect; + } + }while (nextEffect !== null); // We no longer need to track the active instance fiber + focusedInstanceHandle = null; + // Mark the current commit time to be shared by all Profilers in this + // batch. This enables them to be grouped later. + recordCommitTime(); + nextEffect = firstEffect; + do { + invokeGuardedCallback(null, commitMutationEffects, null, root, renderPriorityLevel); + if (hasCaughtError()) { + if (!(nextEffect !== null)) throw Error("Should be working on an effect."); + var _error = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error); + nextEffect = nextEffect.nextEffect; + } + }while (nextEffect !== null); + resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after + // the mutation phase, so that the previous tree is still current during + // componentWillUnmount, but before the layout phase, so that the finished + // work is current during componentDidMount/Update. + root.current = finishedWork; // The next phase is the layout phase, where we call effects that read + // the host tree after it's been mutated. The idiomatic use case for this is + // layout, but class component lifecycles also fire here for legacy reasons. + nextEffect = firstEffect; + do { + invokeGuardedCallback(null, commitLayoutEffects, null, root, lanes); + if (hasCaughtError()) { + if (!(nextEffect !== null)) throw Error("Should be working on an effect."); + var _error2 = clearCaughtError(); + captureCommitPhaseError(nextEffect, _error2); + nextEffect = nextEffect.nextEffect; + } + }while (nextEffect !== null); + nextEffect = null; // Tell Scheduler to yield at the end of the frame, so the browser has an + // opportunity to paint. + requestPaint(); + popInteractions(prevInteractions); + executionContext = prevExecutionContext; + } else { + // No effects. + root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were + recordCommitTime(); + } + var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; + if (rootDoesHavePassiveEffects) { + // This commit has passive effects. Stash a reference to them. But don't + // schedule a callback until after flushing layout work. + rootDoesHavePassiveEffects = false; + rootWithPendingPassiveEffects = root; + pendingPassiveEffectsLanes = lanes; + pendingPassiveEffectsRenderPriority = renderPriorityLevel; + } else { + // We are done with the effect chain at this point so let's clear the + // nextEffect pointers to assist with GC. If we have passive effects, we'll + // clear this in flushPassiveEffects. + nextEffect = firstEffect; + while(nextEffect !== null){ + var nextNextEffect = nextEffect.nextEffect; + nextEffect.nextEffect = null; + if (nextEffect.flags & Deletion) detachFiberAfterEffects(nextEffect); + nextEffect = nextNextEffect; + } + } // Read this again, since an effect might have updated it + remainingLanes = root.pendingLanes; // Check if there's remaining work on this root + if (remainingLanes !== NoLanes) { + if (spawnedWorkDuringRender !== null) { + var expirationTimes = spawnedWorkDuringRender; + spawnedWorkDuringRender = null; + for(var i = 0; i < expirationTimes.length; i++)scheduleInteractions(root, expirationTimes[i], root.memoizedInteractions); + } + schedulePendingInteractions(root, remainingLanes); + } else // If there's no remaining work, we can clear the set of already failed + // error boundaries. + legacyErrorBoundariesThatAlreadyFailed = null; + if (!rootDidHavePassiveEffects) // If there are no passive effects, then we can complete the pending interactions. + // Otherwise, we'll wait until after the passive effects are flushed. + // Wait to do this until after remaining work has been scheduled, + // so that we don't prematurely signal complete for interactions when there's e.g. hidden work. + finishPendingInteractions(root, lanes); + if (remainingLanes === SyncLane) { + // Count the number of times the root synchronously re-renders without + // finishing. If there are too many, it indicates an infinite update loop. + if (root === rootWithNestedUpdates) nestedUpdateCount++; + else { + nestedUpdateCount = 0; + rootWithNestedUpdates = root; + } + } else nestedUpdateCount = 0; + onCommitRoot(finishedWork.stateNode, renderPriorityLevel); + onCommitRoot$1(); + // additional work on this root is scheduled. + ensureRootIsScheduled(root, now()); + if (hasUncaughtError) { + hasUncaughtError = false; + var _error3 = firstUncaughtError; + firstUncaughtError = null; + throw _error3; + } + if ((executionContext & LegacyUnbatchedContext) !== NoContext) // a ReactDOM.render-ed root inside of batchedUpdates. The commit fired + // synchronously, but layout updates should be deferred until the end + // of the batch. + return null; + // If layout work was scheduled, flush it now. + flushSyncCallbackQueue(); + return null; + } + function commitBeforeMutationEffects() { + while(nextEffect !== null){ + var current = nextEffect.alternate; + if (!shouldFireAfterActiveInstanceBlur && focusedInstanceHandle !== null) { + if ((nextEffect.flags & Deletion) !== NoFlags) { + if (doesFiberContain(nextEffect, focusedInstanceHandle)) shouldFireAfterActiveInstanceBlur = true; + } else // TODO: Move this out of the hot path using a dedicated effect tag. + if (nextEffect.tag === SuspenseComponent && isSuspenseBoundaryBeingHidden(current, nextEffect) && doesFiberContain(nextEffect, focusedInstanceHandle)) shouldFireAfterActiveInstanceBlur = true; + } + var flags = nextEffect.flags; + if ((flags & Snapshot) !== NoFlags) { + setCurrentFiber(nextEffect); + commitBeforeMutationLifeCycles(current, nextEffect); + resetCurrentFiber(); + } + if ((flags & Passive) !== NoFlags) // If there are passive effects, schedule a callback to flush at + // the earliest opportunity. + { + if (!rootDoesHavePassiveEffects) { + rootDoesHavePassiveEffects = true; + scheduleCallback(NormalPriority$1, function() { + flushPassiveEffects(); + return null; + }); + } + } + nextEffect = nextEffect.nextEffect; + } + } + function commitMutationEffects(root, renderPriorityLevel) { + // TODO: Should probably move the bulk of this function to commitWork. + while(nextEffect !== null){ + setCurrentFiber(nextEffect); + var flags = nextEffect.flags; + if (flags & ContentReset) commitResetTextContent(nextEffect); + if (flags & Ref) { + var current = nextEffect.alternate; + if (current !== null) commitDetachRef(current); + } // The following switch statement is only concerned about placement, + // updates, and deletions. To avoid needing to add a case for every possible + // bitmap value, we remove the secondary effects from the effect tag and + // switch on that value. + var primaryFlags = flags & (Placement | Update | Deletion | Hydrating); + switch(primaryFlags){ + case Placement: + commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is + // inserted, before any life-cycles like componentDidMount gets called. + // TODO: findDOMNode doesn't rely on this any more but isMounted does + // and isMounted is deprecated anyway so we should be able to kill this. + nextEffect.flags &= ~Placement; + break; + case PlacementAndUpdate: + // Placement + commitPlacement(nextEffect); // Clear the "placement" from effect tag so that we know that this is + // inserted, before any life-cycles like componentDidMount gets called. + nextEffect.flags &= ~Placement; // Update + var _current = nextEffect.alternate; + commitWork(_current, nextEffect); + break; + case Hydrating: + nextEffect.flags &= ~Hydrating; + break; + case HydratingAndUpdate: + nextEffect.flags &= ~Hydrating; // Update + var _current2 = nextEffect.alternate; + commitWork(_current2, nextEffect); + break; + case Update: + var _current3 = nextEffect.alternate; + commitWork(_current3, nextEffect); + break; + case Deletion: + commitDeletion(root, nextEffect); + break; + } + resetCurrentFiber(); + nextEffect = nextEffect.nextEffect; + } + } + function commitLayoutEffects(root, committedLanes) { + while(nextEffect !== null){ + setCurrentFiber(nextEffect); + var flags = nextEffect.flags; + if (flags & (Update | Callback)) { + var current = nextEffect.alternate; + commitLifeCycles(root, current, nextEffect); + } + if (flags & Ref) commitAttachRef(nextEffect); + resetCurrentFiber(); + nextEffect = nextEffect.nextEffect; + } + } + function flushPassiveEffects() { + // Returns whether passive effects were flushed. + if (pendingPassiveEffectsRenderPriority !== NoPriority$1) { + var priorityLevel = pendingPassiveEffectsRenderPriority > NormalPriority$1 ? NormalPriority$1 : pendingPassiveEffectsRenderPriority; + pendingPassiveEffectsRenderPriority = NoPriority$1; + return runWithPriority$1(priorityLevel, flushPassiveEffectsImpl); + } + return false; + } + function enqueuePendingPassiveHookEffectMount(fiber, effect) { + pendingPassiveHookEffectsMount.push(effect, fiber); + if (!rootDoesHavePassiveEffects) { + rootDoesHavePassiveEffects = true; + scheduleCallback(NormalPriority$1, function() { + flushPassiveEffects(); + return null; + }); + } + } + function enqueuePendingPassiveHookEffectUnmount(fiber, effect) { + pendingPassiveHookEffectsUnmount.push(effect, fiber); + fiber.flags |= PassiveUnmountPendingDev; + var alternate = fiber.alternate; + if (alternate !== null) alternate.flags |= PassiveUnmountPendingDev; + if (!rootDoesHavePassiveEffects) { + rootDoesHavePassiveEffects = true; + scheduleCallback(NormalPriority$1, function() { + flushPassiveEffects(); + return null; + }); + } + } + function invokePassiveEffectCreate(effect) { + var create = effect.create; + effect.destroy = create(); + } + function flushPassiveEffectsImpl() { + if (rootWithPendingPassiveEffects === null) return false; + var root = rootWithPendingPassiveEffects; + var lanes = pendingPassiveEffectsLanes; + rootWithPendingPassiveEffects = null; + pendingPassiveEffectsLanes = NoLanes; + if (!((executionContext & (RenderContext | CommitContext)) === NoContext)) throw Error("Cannot flush passive effects while already rendering."); + isFlushingPassiveEffects = true; + var prevExecutionContext = executionContext; + executionContext |= CommitContext; + var prevInteractions = pushInteractions(root); // It's important that ALL pending passive effect destroy functions are called + // before ANY passive effect create functions are called. + // Otherwise effects in sibling components might interfere with each other. + // e.g. a destroy function in one component may unintentionally override a ref + // value set by a create function in another component. + // Layout effects have the same constraint. + // First pass: Destroy stale passive effects. + var unmountEffects = pendingPassiveHookEffectsUnmount; + pendingPassiveHookEffectsUnmount = []; + for(var i = 0; i < unmountEffects.length; i += 2){ + var _effect = unmountEffects[i]; + var fiber = unmountEffects[i + 1]; + var destroy = _effect.destroy; + _effect.destroy = undefined; + fiber.flags &= ~PassiveUnmountPendingDev; + var alternate = fiber.alternate; + if (alternate !== null) alternate.flags &= ~PassiveUnmountPendingDev; + if (typeof destroy === "function") { + setCurrentFiber(fiber); + invokeGuardedCallback(null, destroy, null); + if (hasCaughtError()) { + if (!(fiber !== null)) throw Error("Should be working on an effect."); + var error = clearCaughtError(); + captureCommitPhaseError(fiber, error); + } + resetCurrentFiber(); + } + } // Second pass: Create new passive effects. + var mountEffects = pendingPassiveHookEffectsMount; + pendingPassiveHookEffectsMount = []; + for(var _i = 0; _i < mountEffects.length; _i += 2){ + var _effect2 = mountEffects[_i]; + var _fiber = mountEffects[_i + 1]; + setCurrentFiber(_fiber); + invokeGuardedCallback(null, invokePassiveEffectCreate, null, _effect2); + if (hasCaughtError()) { + if (!(_fiber !== null)) throw Error("Should be working on an effect."); + var _error4 = clearCaughtError(); + captureCommitPhaseError(_fiber, _error4); + } + resetCurrentFiber(); + } // Note: This currently assumes there are no passive effects on the root fiber + // because the root is not part of its own effect list. + // This could change in the future. + var effect = root.current.firstEffect; + while(effect !== null){ + var nextNextEffect = effect.nextEffect; // Remove nextEffect pointer to assist GC + effect.nextEffect = null; + if (effect.flags & Deletion) detachFiberAfterEffects(effect); + effect = nextNextEffect; + } + popInteractions(prevInteractions); + finishPendingInteractions(root, lanes); + isFlushingPassiveEffects = false; + executionContext = prevExecutionContext; + flushSyncCallbackQueue(); // If additional passive effects were scheduled, increment a counter. If this + // exceeds the limit, we'll fire a warning. + nestedPassiveUpdateCount = rootWithPendingPassiveEffects === null ? 0 : nestedPassiveUpdateCount + 1; + return true; + } + function isAlreadyFailedLegacyErrorBoundary(instance) { + return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance); + } + function markLegacyErrorBoundaryAsFailed(instance) { + if (legacyErrorBoundariesThatAlreadyFailed === null) legacyErrorBoundariesThatAlreadyFailed = new Set([ + instance + ]); + else legacyErrorBoundariesThatAlreadyFailed.add(instance); + } + function prepareToThrowUncaughtError(error) { + if (!hasUncaughtError) { + hasUncaughtError = true; + firstUncaughtError = error; + } + } + var onUncaughtError = prepareToThrowUncaughtError; + function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { + var errorInfo = createCapturedValue(error, sourceFiber); + var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); + enqueueUpdate(rootFiber, update); + var eventTime = requestEventTime(); + var root = markUpdateLaneFromFiberToRoot(rootFiber, SyncLane); + if (root !== null) { + markRootUpdated(root, SyncLane, eventTime); + ensureRootIsScheduled(root, eventTime); + schedulePendingInteractions(root, SyncLane); + } + } + function captureCommitPhaseError(sourceFiber, error) { + if (sourceFiber.tag === HostRoot) { + // Error was thrown at the root. There is no parent, so the root + // itself should capture it. + captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error); + return; + } + var fiber = sourceFiber.return; + while(fiber !== null){ + if (fiber.tag === HostRoot) { + captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error); + return; + } else if (fiber.tag === ClassComponent) { + var ctor = fiber.type; + var instance = fiber.stateNode; + if (typeof ctor.getDerivedStateFromError === "function" || typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance)) { + var errorInfo = createCapturedValue(error, sourceFiber); + var update = createClassErrorUpdate(fiber, errorInfo, SyncLane); + enqueueUpdate(fiber, update); + var eventTime = requestEventTime(); + var root = markUpdateLaneFromFiberToRoot(fiber, SyncLane); + if (root !== null) { + markRootUpdated(root, SyncLane, eventTime); + ensureRootIsScheduled(root, eventTime); + schedulePendingInteractions(root, SyncLane); + } else { + // This component has already been unmounted. + // We can't schedule any follow up work for the root because the fiber is already unmounted, + // but we can still call the log-only boundary so the error isn't swallowed. + // + // TODO This is only a temporary bandaid for the old reconciler fork. + // We can delete this special case once the new fork is merged. + if (typeof instance.componentDidCatch === "function" && !isAlreadyFailedLegacyErrorBoundary(instance)) try { + instance.componentDidCatch(error, errorInfo); + } catch (errorToIgnore) { + // This is kind of an edge case. + } + } + return; + } + } + fiber = fiber.return; + } + } + function pingSuspendedRoot(root, wakeable, pingedLanes) { + var pingCache = root.pingCache; + if (pingCache !== null) // The wakeable resolved, so we no longer need to memoize, because it will + // never be thrown again. + pingCache.delete(wakeable); + var eventTime = requestEventTime(); + markRootPinged(root, pingedLanes); + if (workInProgressRoot === root && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes)) { + // Received a ping at the same priority level at which we're currently + // rendering. We might want to restart this render. This should mirror + // the logic of whether or not a root suspends once it completes. + // TODO: If we're rendering sync either due to Sync, Batched or expired, + // we should probably never restart. + // If we're suspended with delay, or if it's a retry, we'll always suspend + // so we can always restart. + if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) // Restart from the root. + prepareFreshStack(root, NoLanes); + else // Even though we can't restart right now, we might get an + // opportunity later. So we mark this render as having a ping. + workInProgressRootPingedLanes = mergeLanes(workInProgressRootPingedLanes, pingedLanes); + } + ensureRootIsScheduled(root, eventTime); + schedulePendingInteractions(root, pingedLanes); + } + function retryTimedOutBoundary(boundaryFiber, retryLane) { + // The boundary fiber (a Suspense component or SuspenseList component) + // previously was rendered in its fallback state. One of the promises that + // suspended it has resolved, which means at least part of the tree was + // likely unblocked. Try rendering again, at a new expiration time. + if (retryLane === NoLane) retryLane = requestRetryLane(boundaryFiber); + // TODO: Special case idle priority? + var eventTime = requestEventTime(); + var root = markUpdateLaneFromFiberToRoot(boundaryFiber, retryLane); + if (root !== null) { + markRootUpdated(root, retryLane, eventTime); + ensureRootIsScheduled(root, eventTime); + schedulePendingInteractions(root, retryLane); + } + } + function resolveRetryWakeable(boundaryFiber, wakeable) { + var retryLane = NoLane; // Default + var retryCache; + retryCache = boundaryFiber.stateNode; + if (retryCache !== null) // The wakeable resolved, so we no longer need to memoize, because it will + // never be thrown again. + retryCache.delete(wakeable); + retryTimedOutBoundary(boundaryFiber, retryLane); + } // Computes the next Just Noticeable Difference (JND) boundary. + // The theory is that a person can't tell the difference between small differences in time. + // Therefore, if we wait a bit longer than necessary that won't translate to a noticeable + // difference in the experience. However, waiting for longer might mean that we can avoid + // showing an intermediate loading state. The longer we have already waited, the harder it + // is to tell small differences in time. Therefore, the longer we've already waited, + // the longer we can wait additionally. At some point we have to give up though. + // We pick a train model where the next boundary commits at a consistent schedule. + // These particular numbers are vague estimates. We expect to adjust them based on research. + function jnd(timeElapsed) { + return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960; + } + function checkForNestedUpdates() { + if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { + nestedUpdateCount = 0; + rootWithNestedUpdates = null; + throw Error("Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops."); + } + if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { + nestedPassiveUpdateCount = 0; + error("Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render."); + } + } + function flushRenderPhaseStrictModeWarningsInDEV() { + ReactStrictModeWarnings.flushLegacyContextWarning(); + ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); + } + var didWarnStateUpdateForNotYetMountedComponent = null; + function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { + if ((executionContext & RenderContext) !== NoContext) // We let the other warning about render phase updates deal with this one. + return; + if (!(fiber.mode & (BlockingMode | ConcurrentMode))) return; + var tag = fiber.tag; + if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) // Only warn for user-defined components, not internal ones like Suspense. + return; + // We show the whole stack but dedupe on the top component's name because + // the problematic code almost always lies inside that component. + var componentName = getComponentName(fiber.type) || "ReactComponent"; + if (didWarnStateUpdateForNotYetMountedComponent !== null) { + if (didWarnStateUpdateForNotYetMountedComponent.has(componentName)) return; + didWarnStateUpdateForNotYetMountedComponent.add(componentName); + } else didWarnStateUpdateForNotYetMountedComponent = new Set([ + componentName + ]); + var previousFiber = current; + try { + setCurrentFiber(fiber); + error("Can't perform a React state update on a component that hasn't mounted yet. This indicates that you have a side-effect in your render function that asynchronously later calls tries to update the component. Move this work to useEffect instead."); + } finally{ + if (previousFiber) setCurrentFiber(fiber); + else resetCurrentFiber(); + } + } + var didWarnStateUpdateForUnmountedComponent = null; + function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { + var tag = fiber.tag; + if (tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && tag !== Block) // Only warn for user-defined components, not internal ones like Suspense. + return; + // If there are pending passive effects unmounts for this Fiber, + // we can assume that they would have prevented this update. + if ((fiber.flags & PassiveUnmountPendingDev) !== NoFlags) return; + // We show the whole stack but dedupe on the top component's name because + // the problematic code almost always lies inside that component. + var componentName = getComponentName(fiber.type) || "ReactComponent"; + if (didWarnStateUpdateForUnmountedComponent !== null) { + if (didWarnStateUpdateForUnmountedComponent.has(componentName)) return; + didWarnStateUpdateForUnmountedComponent.add(componentName); + } else didWarnStateUpdateForUnmountedComponent = new Set([ + componentName + ]); + if (isFlushingPassiveEffects) ; + else { + var previousFiber = current; + try { + setCurrentFiber(fiber); + error("Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in %s.", tag === ClassComponent ? "the componentWillUnmount method" : "a useEffect cleanup function"); + } finally{ + if (previousFiber) setCurrentFiber(fiber); + else resetCurrentFiber(); + } + } + } + var beginWork$1; + var dummyFiber = null; + beginWork$1 = function(current, unitOfWork, lanes) { + // If a component throws an error, we replay it again in a synchronously + // dispatched event, so that the debugger will treat it as an uncaught + // error See ReactErrorUtils for more information. + // Before entering the begin phase, copy the work-in-progress onto a dummy + // fiber. If beginWork throws, we'll use this to reset the state. + var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork); + try { + return beginWork(current, unitOfWork, lanes); + } catch (originalError) { + if (originalError !== null && typeof originalError === "object" && typeof originalError.then === "function") // Don't replay promises. Treat everything else like an error. + throw originalError; + // Keep this code in sync with handleError; any changes here must have + // corresponding changes there. + resetContextDependencies(); + resetHooksAfterThrow(); // Don't reset current debug fiber, since we're about to work on the + // same fiber again. + // Unwind the failed stack frame + unwindInterruptedWork(unitOfWork); // Restore the original properties of the fiber. + assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); + if (unitOfWork.mode & ProfileMode) // Reset the profiler timer. + startProfilerTimer(unitOfWork); + // Run beginWork again. + invokeGuardedCallback(null, beginWork, null, current, unitOfWork, lanes); + if (hasCaughtError()) { + var replayError = clearCaughtError(); // `invokeGuardedCallback` sometimes sets an expando `_suppressLogging`. + // Rethrow this error instead of the original one. + throw replayError; + } else // This branch is reachable if the render phase is impure. + throw originalError; + } + }; + var didWarnAboutUpdateInRender = false; + var didWarnAboutUpdateInRenderForAnotherComponent; + didWarnAboutUpdateInRenderForAnotherComponent = new Set(); + function warnAboutRenderPhaseUpdatesInDEV(fiber) { + if (isRendering && (executionContext & RenderContext) !== NoContext && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) switch(fiber.tag){ + case FunctionComponent: + case ForwardRef: + case SimpleMemoComponent: + var renderingComponentName = workInProgress && getComponentName(workInProgress.type) || "Unknown"; // Dedupe by the rendering component because it's the one that needs to be fixed. + var dedupeKey = renderingComponentName; + if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) { + didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey); + var setStateComponentName = getComponentName(fiber.type) || "Unknown"; + error("Cannot update a component (`%s`) while rendering a different component (`%s`). To locate the bad setState() call inside `%s`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render", setStateComponentName, renderingComponentName, renderingComponentName); + } + break; + case ClassComponent: + if (!didWarnAboutUpdateInRender) { + error("Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state."); + didWarnAboutUpdateInRender = true; + } + break; + } + } // a 'shared' variable that changes when act() opens/closes in tests. + var IsThisRendererActing = { + current: false + }; + function warnIfNotScopedWithMatchingAct(fiber) { + if (IsSomeRendererActing.current === true && IsThisRendererActing.current !== true) { + var previousFiber = current; + try { + setCurrentFiber(fiber); + error("It looks like you're using the wrong act() around your test interactions.\nBe sure to use the matching version of act() corresponding to your renderer:\n\n// for react-dom:\nimport {act} from 'react-dom/test-utils';\n// ...\nact(() => ...);\n\n// for react-test-renderer:\nimport TestRenderer from react-test-renderer';\nconst {act} = TestRenderer;\n// ...\nact(() => ...);"); + } finally{ + if (previousFiber) setCurrentFiber(fiber); + else resetCurrentFiber(); + } + } + } + function warnIfNotCurrentlyActingEffectsInDEV(fiber) { + if ((fiber.mode & StrictMode) !== NoMode && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) error("An update to %s ran an effect, but was not wrapped in act(...).\n\nWhen testing, code that causes React state updates should be wrapped into act(...):\n\nact(() => {\n /* fire events that update state */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act", getComponentName(fiber.type)); + } + function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { + if (executionContext === NoContext && IsSomeRendererActing.current === false && IsThisRendererActing.current === false) { + var previousFiber = current; + try { + setCurrentFiber(fiber); + error("An update to %s inside a test was not wrapped in act(...).\n\nWhen testing, code that causes React state updates should be wrapped into act(...):\n\nact(() => {\n /* fire events that update state */\n});\n/* assert on the output */\n\nThis ensures that you're testing the behavior the user would see in the browser. Learn more at https://reactjs.org/link/wrap-tests-with-act", getComponentName(fiber.type)); + } finally{ + if (previousFiber) setCurrentFiber(fiber); + else resetCurrentFiber(); + } + } + } + var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; // In tests, we want to enforce a mocked scheduler. + var didWarnAboutUnmockedScheduler = false; // TODO Before we release concurrent mode, revisit this and decide whether a mocked + // scheduler is the actual recommendation. The alternative could be a testing build, + // a new lib, or whatever; we dunno just yet. This message is for early adopters + // to get their tests right. + function warnIfUnmockedScheduler(fiber) { + if (didWarnAboutUnmockedScheduler === false && Scheduler.unstable_flushAllWithoutAsserting === undefined) { + if (fiber.mode & BlockingMode || fiber.mode & ConcurrentMode) { + didWarnAboutUnmockedScheduler = true; + error("In Concurrent or Sync modes, the \"scheduler\" module needs to be mocked to guarantee consistent behaviour across tests and browsers. For example, with jest: \njest.mock('scheduler', () => require('scheduler/unstable_mock'));\n\nFor more info, visit https://reactjs.org/link/mock-scheduler"); + } + } + } + function computeThreadID(root, lane) { + // Interaction threads are unique per root and expiration time. + // NOTE: Intentionally unsound cast. All that matters is that it's a number + // and it represents a batch of work. Could make a helper function instead, + // but meh this is fine for now. + return lane * 1000 + root.interactionThreadID; + } + function markSpawnedWork(lane) { + if (spawnedWorkDuringRender === null) spawnedWorkDuringRender = [ + lane + ]; + else spawnedWorkDuringRender.push(lane); + } + function scheduleInteractions(root, lane, interactions) { + if (interactions.size > 0) { + var pendingInteractionMap = root.pendingInteractionMap; + var pendingInteractions = pendingInteractionMap.get(lane); + if (pendingInteractions != null) interactions.forEach(function(interaction) { + if (!pendingInteractions.has(interaction)) // Update the pending async work count for previously unscheduled interaction. + interaction.__count++; + pendingInteractions.add(interaction); + }); + else { + pendingInteractionMap.set(lane, new Set(interactions)); // Update the pending async work count for the current interactions. + interactions.forEach(function(interaction) { + interaction.__count++; + }); + } + var subscriber = tracing.__subscriberRef.current; + if (subscriber !== null) { + var threadID = computeThreadID(root, lane); + subscriber.onWorkScheduled(interactions, threadID); + } + } + } + function schedulePendingInteractions(root, lane) { + scheduleInteractions(root, lane, tracing.__interactionsRef.current); + } + function startWorkOnPendingInteractions(root, lanes) { + // we can accurately attribute time spent working on it, And so that cascading + // work triggered during the render phase will be associated with it. + var interactions = new Set(); + root.pendingInteractionMap.forEach(function(scheduledInteractions, scheduledLane) { + if (includesSomeLane(lanes, scheduledLane)) scheduledInteractions.forEach(function(interaction) { + return interactions.add(interaction); + }); + }); // Store the current set of interactions on the FiberRoot for a few reasons: + // We can re-use it in hot functions like performConcurrentWorkOnRoot() + // without having to recalculate it. We will also use it in commitWork() to + // pass to any Profiler onRender() hooks. This also provides DevTools with a + // way to access it when the onCommitRoot() hook is called. + root.memoizedInteractions = interactions; + if (interactions.size > 0) { + var subscriber = tracing.__subscriberRef.current; + if (subscriber !== null) { + var threadID = computeThreadID(root, lanes); + try { + subscriber.onWorkStarted(interactions, threadID); + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority$1, function() { + throw error; + }); + } + } + } + } + function finishPendingInteractions(root, committedLanes) { + var remainingLanesAfterCommit = root.pendingLanes; + var subscriber; + try { + subscriber = tracing.__subscriberRef.current; + if (subscriber !== null && root.memoizedInteractions.size > 0) { + // FIXME: More than one lane can finish in a single commit. + var threadID = computeThreadID(root, committedLanes); + subscriber.onWorkStopped(root.memoizedInteractions, threadID); + } + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority$1, function() { + throw error; + }); + } finally{ + // Clear completed interactions from the pending Map. + // Unless the render was suspended or cascading work was scheduled, + // In which case– leave pending interactions until the subsequent render. + var pendingInteractionMap = root.pendingInteractionMap; + pendingInteractionMap.forEach(function(scheduledInteractions, lane) { + // Only decrement the pending interaction count if we're done. + // If there's still work at the current priority, + // That indicates that we are waiting for suspense data. + if (!includesSomeLane(remainingLanesAfterCommit, lane)) { + pendingInteractionMap.delete(lane); + scheduledInteractions.forEach(function(interaction) { + interaction.__count--; + if (subscriber !== null && interaction.__count === 0) try { + subscriber.onInteractionScheduledWorkCompleted(interaction); + } catch (error) { + // If the subscriber throws, rethrow it in a separate task + scheduleCallback(ImmediatePriority$1, function() { + throw error; + }); + } + }); + } + }); + } + } // `act` testing API + function shouldForceFlushFallbacksInDEV() { + // Never force flush in production. This function should get stripped out. + return actingUpdatesScopeDepth > 0; + } + // so we can tell if any async act() calls try to run in parallel. + var actingUpdatesScopeDepth = 0; + function detachFiberAfterEffects(fiber) { + fiber.sibling = null; + fiber.stateNode = null; + } + var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. + var failedBoundaries = null; + var setRefreshHandler = function(handler) { + resolveFamily = handler; + }; + function resolveFunctionForHotReloading(type) { + if (resolveFamily === null) // Hot reloading is disabled. + return type; + var family = resolveFamily(type); + if (family === undefined) return type; + // Use the latest known implementation. + return family.current; + } + function resolveClassForHotReloading(type) { + // No implementation differences. + return resolveFunctionForHotReloading(type); + } + function resolveForwardRefForHotReloading(type) { + if (resolveFamily === null) // Hot reloading is disabled. + return type; + var family = resolveFamily(type); + if (family === undefined) { + // Check if we're dealing with a real forwardRef. Don't want to crash early. + if (type !== null && type !== undefined && typeof type.render === "function") { + // ForwardRef is special because its resolved .type is an object, + // but it's possible that we only have its inner render function in the map. + // If that inner render function is different, we'll build a new forwardRef type. + var currentRender = resolveFunctionForHotReloading(type.render); + if (type.render !== currentRender) { + var syntheticType = { + $$typeof: REACT_FORWARD_REF_TYPE, + render: currentRender + }; + if (type.displayName !== undefined) syntheticType.displayName = type.displayName; + return syntheticType; + } + } + return type; + } // Use the latest known implementation. + return family.current; + } + function isCompatibleFamilyForHotReloading(fiber, element) { + if (resolveFamily === null) // Hot reloading is disabled. + return false; + var prevType = fiber.elementType; + var nextType = element.type; // If we got here, we know types aren't === equal. + var needsCompareFamilies = false; + var $$typeofNextType = typeof nextType === "object" && nextType !== null ? nextType.$$typeof : null; + switch(fiber.tag){ + case ClassComponent: + if (typeof nextType === "function") needsCompareFamilies = true; + break; + case FunctionComponent: + if (typeof nextType === "function") needsCompareFamilies = true; + else if ($$typeofNextType === REACT_LAZY_TYPE) // We don't know the inner type yet. + // We're going to assume that the lazy inner type is stable, + // and so it is sufficient to avoid reconciling it away. + // We're not going to unwrap or actually use the new lazy type. + needsCompareFamilies = true; + break; + case ForwardRef: + if ($$typeofNextType === REACT_FORWARD_REF_TYPE) needsCompareFamilies = true; + else if ($$typeofNextType === REACT_LAZY_TYPE) needsCompareFamilies = true; + break; + case MemoComponent: + case SimpleMemoComponent: + if ($$typeofNextType === REACT_MEMO_TYPE) // TODO: if it was but can no longer be simple, + // we shouldn't set this. + needsCompareFamilies = true; + else if ($$typeofNextType === REACT_LAZY_TYPE) needsCompareFamilies = true; + break; + default: + return false; + } // Check if both types have a family and it's the same one. + if (needsCompareFamilies) { + // Note: memo() and forwardRef() we'll compare outer rather than inner type. + // This means both of them need to be registered to preserve state. + // If we unwrapped and compared the inner types for wrappers instead, + // then we would risk falsely saying two separate memo(Foo) + // calls are equivalent because they wrap the same Foo function. + var prevFamily = resolveFamily(prevType); + if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) return true; + } + return false; + } + function markFailedErrorBoundaryForHotReloading(fiber) { + if (resolveFamily === null) // Hot reloading is disabled. + return; + if (typeof WeakSet !== "function") return; + if (failedBoundaries === null) failedBoundaries = new WeakSet(); + failedBoundaries.add(fiber); + } + var scheduleRefresh = function(root, update) { + if (resolveFamily === null) // Hot reloading is disabled. + return; + var staleFamilies = update.staleFamilies, updatedFamilies = update.updatedFamilies; + flushPassiveEffects(); + flushSync(function() { + scheduleFibersWithFamiliesRecursively(root.current, updatedFamilies, staleFamilies); + }); + }; + var scheduleRoot = function(root, element) { + if (root.context !== emptyContextObject) // Super edge case: root has a legacy _renderSubtree context + // but we don't know the parentComponent so we can't pass it. + // Just ignore. We'll delete this with _renderSubtree code path later. + return; + flushPassiveEffects(); + flushSync(function() { + updateContainer(element, root, null, null); + }); + }; + function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) { + var alternate = fiber.alternate, child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type; + var candidateType = null; + switch(tag){ + case FunctionComponent: + case SimpleMemoComponent: + case ClassComponent: + candidateType = type; + break; + case ForwardRef: + candidateType = type.render; + break; + } + if (resolveFamily === null) throw new Error("Expected resolveFamily to be set during hot reload."); + var needsRender = false; + var needsRemount = false; + if (candidateType !== null) { + var family = resolveFamily(candidateType); + if (family !== undefined) { + if (staleFamilies.has(family)) needsRemount = true; + else if (updatedFamilies.has(family)) { + if (tag === ClassComponent) needsRemount = true; + else needsRender = true; + } + } + } + if (failedBoundaries !== null) { + if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) needsRemount = true; + } + if (needsRemount) fiber._debugNeedsRemount = true; + if (needsRemount || needsRender) scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + if (child !== null && !needsRemount) scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies); + if (sibling !== null) scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); + } + var findHostInstancesForRefresh = function(root, families) { + var hostInstances = new Set(); + var types = new Set(families.map(function(family) { + return family.current; + })); + findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances); + return hostInstances; + }; + function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) { + var child = fiber.child, sibling = fiber.sibling, tag = fiber.tag, type = fiber.type; + var candidateType = null; + switch(tag){ + case FunctionComponent: + case SimpleMemoComponent: + case ClassComponent: + candidateType = type; + break; + case ForwardRef: + candidateType = type.render; + break; + } + var didMatch = false; + if (candidateType !== null) { + if (types.has(candidateType)) didMatch = true; + } + if (didMatch) // We have a match. This only drills down to the closest host components. + // There's no need to search deeper because for the purpose of giving + // visual feedback, "flashing" outermost parent rectangles is sufficient. + findHostInstancesForFiberShallowly(fiber, hostInstances); + else // If there's no match, maybe there will be one further down in the child tree. + if (child !== null) findHostInstancesForMatchingFibersRecursively(child, types, hostInstances); + if (sibling !== null) findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances); + } + function findHostInstancesForFiberShallowly(fiber, hostInstances) { + var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances); + if (foundHostInstances) return; + // If we didn't find any host children, fallback to closest host parent. + var node = fiber; + while(true){ + switch(node.tag){ + case HostComponent: + hostInstances.add(node.stateNode); + return; + case HostPortal: + hostInstances.add(node.stateNode.containerInfo); + return; + case HostRoot: + hostInstances.add(node.stateNode.containerInfo); + return; + } + if (node.return === null) throw new Error("Expected to reach root first."); + node = node.return; + } + } + function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { + var node = fiber; + var foundHostInstances = false; + while(true){ + if (node.tag === HostComponent) { + // We got a match. + foundHostInstances = true; + hostInstances.add(node.stateNode); // There may still be more, so keep searching. + } else if (node.child !== null) { + node.child.return = node; + node = node.child; + continue; + } + if (node === fiber) return foundHostInstances; + while(node.sibling === null){ + if (node.return === null || node.return === fiber) return foundHostInstances; + node = node.return; + } + node.sibling.return = node.return; + node = node.sibling; + } + return false; + } + var hasBadMapPolyfill; + hasBadMapPolyfill = false; + try { + var nonExtensibleObject = Object.preventExtensions({}); + /* eslint-disable no-new */ new Map([ + [ + nonExtensibleObject, + null + ] + ]); + new Set([ + nonExtensibleObject + ]); + /* eslint-enable no-new */ } catch (e1) { + // TODO: Consider warning about bad polyfills + hasBadMapPolyfill = true; + } + var debugCounter = 1; + function FiberNode(tag, pendingProps, key, mode) { + // Instance + this.tag = tag; + this.key = key; + this.elementType = null; + this.type = null; + this.stateNode = null; // Fiber + this.return = null; + this.child = null; + this.sibling = null; + this.index = 0; + this.ref = null; + this.pendingProps = pendingProps; + this.memoizedProps = null; + this.updateQueue = null; + this.memoizedState = null; + this.dependencies = null; + this.mode = mode; // Effects + this.flags = NoFlags; + this.nextEffect = null; + this.firstEffect = null; + this.lastEffect = null; + this.lanes = NoLanes; + this.childLanes = NoLanes; + this.alternate = null; + // Note: The following is done to avoid a v8 performance cliff. + // + // Initializing the fields below to smis and later updating them with + // double values will cause Fibers to end up having separate shapes. + // This behavior/bug has something to do with Object.preventExtension(). + // Fortunately this only impacts DEV builds. + // Unfortunately it makes React unusably slow for some applications. + // To work around this, initialize the fields below with doubles. + // + // Learn more about this here: + // https://github.com/facebook/react/issues/14365 + // https://bugs.chromium.org/p/v8/issues/detail?id=8538 + this.actualDuration = Number.NaN; + this.actualStartTime = Number.NaN; + this.selfBaseDuration = Number.NaN; + this.treeBaseDuration = Number.NaN; // It's okay to replace the initial doubles with smis after initialization. + // This won't trigger the performance cliff mentioned above, + // and it simplifies other profiler code (including DevTools). + this.actualDuration = 0; + this.actualStartTime = -1; + this.selfBaseDuration = 0; + this.treeBaseDuration = 0; + // This isn't directly used but is handy for debugging internals: + this._debugID = debugCounter++; + this._debugSource = null; + this._debugOwner = null; + this._debugNeedsRemount = false; + this._debugHookTypes = null; + if (!hasBadMapPolyfill && typeof Object.preventExtensions === "function") Object.preventExtensions(this); + } // This is a constructor function, rather than a POJO constructor, still + // please ensure we do the following: + // 1) Nobody should add any instance methods on this. Instance methods can be + // more difficult to predict when they get optimized and they are almost + // never inlined properly in static compilers. + // 2) Nobody should rely on `instanceof Fiber` for type testing. We should + // always know when it is a fiber. + // 3) We might want to experiment with using numeric keys since they are easier + // to optimize in a non-JIT environment. + // 4) We can easily go from a constructor to a createFiber object literal if that + // is faster. + // 5) It should be easy to port this to a C struct and keep a C implementation + // compatible. + var createFiber = function(tag, pendingProps, key, mode) { + // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors + return new FiberNode(tag, pendingProps, key, mode); + }; + function shouldConstruct$1(Component) { + var prototype = Component.prototype; + return !!(prototype && prototype.isReactComponent); + } + function isSimpleFunctionComponent(type) { + return typeof type === "function" && !shouldConstruct$1(type) && type.defaultProps === undefined; + } + function resolveLazyComponentTag(Component) { + if (typeof Component === "function") return shouldConstruct$1(Component) ? ClassComponent : FunctionComponent; + else if (Component !== undefined && Component !== null) { + var $$typeof = Component.$$typeof; + if ($$typeof === REACT_FORWARD_REF_TYPE) return ForwardRef; + if ($$typeof === REACT_MEMO_TYPE) return MemoComponent; + } + return IndeterminateComponent; + } // This is used to create an alternate fiber to do work on. + function createWorkInProgress(current, pendingProps) { + var workInProgress = current.alternate; + if (workInProgress === null) { + // We use a double buffering pooling technique because we know that we'll + // only ever need at most two versions of a tree. We pool the "other" unused + // node that we're free to reuse. This is lazily created to avoid allocating + // extra objects for things that are never updated. It also allow us to + // reclaim the extra memory if needed. + workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode); + workInProgress.elementType = current.elementType; + workInProgress.type = current.type; + workInProgress.stateNode = current.stateNode; + // DEV-only fields + workInProgress._debugID = current._debugID; + workInProgress._debugSource = current._debugSource; + workInProgress._debugOwner = current._debugOwner; + workInProgress._debugHookTypes = current._debugHookTypes; + workInProgress.alternate = current; + current.alternate = workInProgress; + } else { + workInProgress.pendingProps = pendingProps; // Needed because Blocks store data on type. + workInProgress.type = current.type; // We already have an alternate. + // Reset the effect tag. + workInProgress.flags = NoFlags; // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; + // We intentionally reset, rather than copy, actualDuration & actualStartTime. + // This prevents time from endlessly accumulating in new commits. + // This has the downside of resetting values for different priority renders, + // But works for yielding (the common case) and should support resuming. + workInProgress.actualDuration = 0; + workInProgress.actualStartTime = -1; + } + workInProgress.childLanes = current.childLanes; + workInProgress.lanes = current.lanes; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so + // it cannot be shared with the current fiber. + var currentDependencies = current.dependencies; + workInProgress.dependencies = currentDependencies === null ? null : { + lanes: currentDependencies.lanes, + firstContext: currentDependencies.firstContext + }; // These will be overridden during the parent's reconciliation + workInProgress.sibling = current.sibling; + workInProgress.index = current.index; + workInProgress.ref = current.ref; + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + workInProgress._debugNeedsRemount = current._debugNeedsRemount; + switch(workInProgress.tag){ + case IndeterminateComponent: + case FunctionComponent: + case SimpleMemoComponent: + workInProgress.type = resolveFunctionForHotReloading(current.type); + break; + case ClassComponent: + workInProgress.type = resolveClassForHotReloading(current.type); + break; + case ForwardRef: + workInProgress.type = resolveForwardRefForHotReloading(current.type); + break; + } + return workInProgress; + } // Used to reuse a Fiber for a second pass. + function resetWorkInProgress(workInProgress, renderLanes) { + // This resets the Fiber to what createFiber or createWorkInProgress would + // have set the values to before during the first pass. Ideally this wouldn't + // be necessary but unfortunately many code paths reads from the workInProgress + // when they should be reading from current and writing to workInProgress. + // We assume pendingProps, index, key, ref, return are still untouched to + // avoid doing another reconciliation. + // Reset the effect tag but keep any Placement tags, since that's something + // that child fiber is setting, not the reconciliation. + workInProgress.flags &= Placement; // The effect list is no longer valid. + workInProgress.nextEffect = null; + workInProgress.firstEffect = null; + workInProgress.lastEffect = null; + var current = workInProgress.alternate; + if (current === null) { + // Reset to createFiber's initial values. + workInProgress.childLanes = NoLanes; + workInProgress.lanes = renderLanes; + workInProgress.child = null; + workInProgress.memoizedProps = null; + workInProgress.memoizedState = null; + workInProgress.updateQueue = null; + workInProgress.dependencies = null; + workInProgress.stateNode = null; + // Note: We don't reset the actualTime counts. It's useful to accumulate + // actual time across multiple render passes. + workInProgress.selfBaseDuration = 0; + workInProgress.treeBaseDuration = 0; + } else { + // Reset to the cloned values that createWorkInProgress would've. + workInProgress.childLanes = current.childLanes; + workInProgress.lanes = current.lanes; + workInProgress.child = current.child; + workInProgress.memoizedProps = current.memoizedProps; + workInProgress.memoizedState = current.memoizedState; + workInProgress.updateQueue = current.updateQueue; // Needed because Blocks store data on type. + workInProgress.type = current.type; // Clone the dependencies object. This is mutated during the render phase, so + // it cannot be shared with the current fiber. + var currentDependencies = current.dependencies; + workInProgress.dependencies = currentDependencies === null ? null : { + lanes: currentDependencies.lanes, + firstContext: currentDependencies.firstContext + }; + // Note: We don't reset the actualTime counts. It's useful to accumulate + // actual time across multiple render passes. + workInProgress.selfBaseDuration = current.selfBaseDuration; + workInProgress.treeBaseDuration = current.treeBaseDuration; + } + return workInProgress; + } + function createHostRootFiber(tag) { + var mode; + if (tag === ConcurrentRoot) mode = ConcurrentMode | BlockingMode | StrictMode; + else if (tag === BlockingRoot) mode = BlockingMode | StrictMode; + else mode = NoMode; + if (isDevToolsPresent) // Always collect profile timings when DevTools are present. + // This enables DevTools to start capturing timing at any point– + // Without some nodes in the tree having empty base times. + mode |= ProfileMode; + return createFiber(HostRoot, null, null, mode); + } + function createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes) { + var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. + var resolvedType = type; + if (typeof type === "function") { + if (shouldConstruct$1(type)) { + fiberTag = ClassComponent; + resolvedType = resolveClassForHotReloading(resolvedType); + } else resolvedType = resolveFunctionForHotReloading(resolvedType); + } else if (typeof type === "string") fiberTag = HostComponent; + else getTag: switch(type){ + case REACT_FRAGMENT_TYPE: + return createFiberFromFragment(pendingProps.children, mode, lanes, key); + case REACT_DEBUG_TRACING_MODE_TYPE: + fiberTag = Mode; + mode |= DebugTracingMode; + break; + case REACT_STRICT_MODE_TYPE: + fiberTag = Mode; + mode |= StrictMode; + break; + case REACT_PROFILER_TYPE: + return createFiberFromProfiler(pendingProps, mode, lanes, key); + case REACT_SUSPENSE_TYPE: + return createFiberFromSuspense(pendingProps, mode, lanes, key); + case REACT_SUSPENSE_LIST_TYPE: + return createFiberFromSuspenseList(pendingProps, mode, lanes, key); + case REACT_OFFSCREEN_TYPE: + return createFiberFromOffscreen(pendingProps, mode, lanes, key); + case REACT_LEGACY_HIDDEN_TYPE: + return createFiberFromLegacyHidden(pendingProps, mode, lanes, key); + case REACT_SCOPE_TYPE: + // eslint-disable-next-line no-fallthrough + default: + if (typeof type === "object" && type !== null) switch(type.$$typeof){ + case REACT_PROVIDER_TYPE: + fiberTag = ContextProvider; + break getTag; + case REACT_CONTEXT_TYPE: + // This is a consumer + fiberTag = ContextConsumer; + break getTag; + case REACT_FORWARD_REF_TYPE: + fiberTag = ForwardRef; + resolvedType = resolveForwardRefForHotReloading(resolvedType); + break getTag; + case REACT_MEMO_TYPE: + fiberTag = MemoComponent; + break getTag; + case REACT_LAZY_TYPE: + fiberTag = LazyComponent; + resolvedType = null; + break getTag; + case REACT_BLOCK_TYPE: + fiberTag = Block; + break getTag; + } + var info = ""; + if (type === undefined || typeof type === "object" && type !== null && Object.keys(type).length === 0) info += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."; + var ownerName = owner ? getComponentName(owner.type) : null; + if (ownerName) info += "\n\nCheck the render method of `" + ownerName + "`."; + throw Error("Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info); + } + var fiber = createFiber(fiberTag, pendingProps, key, mode); + fiber.elementType = type; + fiber.type = resolvedType; + fiber.lanes = lanes; + fiber._debugOwner = owner; + return fiber; + } + function createFiberFromElement(element, mode, lanes) { + var owner = null; + owner = element._owner; + var type = element.type; + var key = element.key; + var pendingProps = element.props; + var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes); + fiber._debugSource = element._source; + fiber._debugOwner = element._owner; + return fiber; + } + function createFiberFromFragment(elements, mode, lanes, key) { + var fiber = createFiber(Fragment, elements, key, mode); + fiber.lanes = lanes; + return fiber; + } + function createFiberFromProfiler(pendingProps, mode, lanes, key) { + if (typeof pendingProps.id !== "string") error('Profiler must specify an "id" as a prop'); + var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); // TODO: The Profiler fiber shouldn't have a type. It has a tag. + fiber.elementType = REACT_PROFILER_TYPE; + fiber.type = REACT_PROFILER_TYPE; + fiber.lanes = lanes; + fiber.stateNode = { + effectDuration: 0, + passiveEffectDuration: 0 + }; + return fiber; + } + function createFiberFromSuspense(pendingProps, mode, lanes, key) { + var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); // TODO: The SuspenseComponent fiber shouldn't have a type. It has a tag. + // This needs to be fixed in getComponentName so that it relies on the tag + // instead. + fiber.type = REACT_SUSPENSE_TYPE; + fiber.elementType = REACT_SUSPENSE_TYPE; + fiber.lanes = lanes; + return fiber; + } + function createFiberFromSuspenseList(pendingProps, mode, lanes, key) { + var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); + // TODO: The SuspenseListComponent fiber shouldn't have a type. It has a tag. + // This needs to be fixed in getComponentName so that it relies on the tag + // instead. + fiber.type = REACT_SUSPENSE_LIST_TYPE; + fiber.elementType = REACT_SUSPENSE_LIST_TYPE; + fiber.lanes = lanes; + return fiber; + } + function createFiberFromOffscreen(pendingProps, mode, lanes, key) { + var fiber = createFiber(OffscreenComponent, pendingProps, key, mode); // TODO: The OffscreenComponent fiber shouldn't have a type. It has a tag. + fiber.type = REACT_OFFSCREEN_TYPE; + fiber.elementType = REACT_OFFSCREEN_TYPE; + fiber.lanes = lanes; + return fiber; + } + function createFiberFromLegacyHidden(pendingProps, mode, lanes, key) { + var fiber = createFiber(LegacyHiddenComponent, pendingProps, key, mode); // TODO: The LegacyHidden fiber shouldn't have a type. It has a tag. + fiber.type = REACT_LEGACY_HIDDEN_TYPE; + fiber.elementType = REACT_LEGACY_HIDDEN_TYPE; + fiber.lanes = lanes; + return fiber; + } + function createFiberFromText(content, mode, lanes) { + var fiber = createFiber(HostText, content, null, mode); + fiber.lanes = lanes; + return fiber; + } + function createFiberFromHostInstanceForDeletion() { + var fiber = createFiber(HostComponent, null, null, NoMode); // TODO: These should not need a type. + fiber.elementType = "DELETED"; + fiber.type = "DELETED"; + return fiber; + } + function createFiberFromPortal(portal, mode, lanes) { + var pendingProps = portal.children !== null ? portal.children : []; + var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); + fiber.lanes = lanes; + fiber.stateNode = { + containerInfo: portal.containerInfo, + pendingChildren: null, + // Used by persistent updates + implementation: portal.implementation + }; + return fiber; + } // Used for stashing WIP properties to replay failed work in DEV. + function assignFiberPropertiesInDEV(target, source) { + if (target === null) // This Fiber's initial properties will always be overwritten. + // We only use a Fiber to ensure the same hidden class so DEV isn't slow. + target = createFiber(IndeterminateComponent, null, null, NoMode); + // This is intentionally written as a list of all properties. + // We tried to use Object.assign() instead but this is called in + // the hottest path, and Object.assign() was too slow: + // https://github.com/facebook/react/issues/12502 + // This code is DEV-only so size is not a concern. + target.tag = source.tag; + target.key = source.key; + target.elementType = source.elementType; + target.type = source.type; + target.stateNode = source.stateNode; + target.return = source.return; + target.child = source.child; + target.sibling = source.sibling; + target.index = source.index; + target.ref = source.ref; + target.pendingProps = source.pendingProps; + target.memoizedProps = source.memoizedProps; + target.updateQueue = source.updateQueue; + target.memoizedState = source.memoizedState; + target.dependencies = source.dependencies; + target.mode = source.mode; + target.flags = source.flags; + target.nextEffect = source.nextEffect; + target.firstEffect = source.firstEffect; + target.lastEffect = source.lastEffect; + target.lanes = source.lanes; + target.childLanes = source.childLanes; + target.alternate = source.alternate; + target.actualDuration = source.actualDuration; + target.actualStartTime = source.actualStartTime; + target.selfBaseDuration = source.selfBaseDuration; + target.treeBaseDuration = source.treeBaseDuration; + target._debugID = source._debugID; + target._debugSource = source._debugSource; + target._debugOwner = source._debugOwner; + target._debugNeedsRemount = source._debugNeedsRemount; + target._debugHookTypes = source._debugHookTypes; + return target; + } + function FiberRootNode(containerInfo, tag, hydrate) { + this.tag = tag; + this.containerInfo = containerInfo; + this.pendingChildren = null; + this.current = null; + this.pingCache = null; + this.finishedWork = null; + this.timeoutHandle = noTimeout; + this.context = null; + this.pendingContext = null; + this.hydrate = hydrate; + this.callbackNode = null; + this.callbackPriority = NoLanePriority; + this.eventTimes = createLaneMap(NoLanes); + this.expirationTimes = createLaneMap(NoTimestamp); + this.pendingLanes = NoLanes; + this.suspendedLanes = NoLanes; + this.pingedLanes = NoLanes; + this.expiredLanes = NoLanes; + this.mutableReadLanes = NoLanes; + this.finishedLanes = NoLanes; + this.entangledLanes = NoLanes; + this.entanglements = createLaneMap(NoLanes); + this.mutableSourceEagerHydrationData = null; + this.interactionThreadID = tracing.unstable_getThreadID(); + this.memoizedInteractions = new Set(); + this.pendingInteractionMap = new Map(); + switch(tag){ + case BlockingRoot: + this._debugRootType = "createBlockingRoot()"; + break; + case ConcurrentRoot: + this._debugRootType = "createRoot()"; + break; + case LegacyRoot: + this._debugRootType = "createLegacyRoot()"; + break; + } + } + function createFiberRoot(containerInfo, tag, hydrate, hydrationCallbacks) { + var root = new FiberRootNode(containerInfo, tag, hydrate); + // stateNode is any. + var uninitializedFiber = createHostRootFiber(tag); + root.current = uninitializedFiber; + uninitializedFiber.stateNode = root; + initializeUpdateQueue(uninitializedFiber); + return root; + } + // This ensures that the version used for server rendering matches the one + // that is eventually read during hydration. + // If they don't match there's a potential tear and a full deopt render is required. + function registerMutableSourceForHydration(root, mutableSource) { + var getVersion = mutableSource._getVersion; + var version = getVersion(mutableSource._source); // TODO Clear this data once all pending hydration work is finished. + // Retaining it forever may interfere with GC. + if (root.mutableSourceEagerHydrationData == null) root.mutableSourceEagerHydrationData = [ + mutableSource, + version + ]; + else root.mutableSourceEagerHydrationData.push(mutableSource, version); + } + function createPortal(children, containerInfo, implementation) { + var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; + return { + // This tag allow us to uniquely identify this as a React Portal + $$typeof: REACT_PORTAL_TYPE, + key: key == null ? null : "" + key, + children: children, + containerInfo: containerInfo, + implementation: implementation + }; + } + var didWarnAboutNestedUpdates; + var didWarnAboutFindNodeInStrictMode; + didWarnAboutNestedUpdates = false; + didWarnAboutFindNodeInStrictMode = {}; + function getContextForSubtree(parentComponent) { + if (!parentComponent) return emptyContextObject; + var fiber = get(parentComponent); + var parentContext = findCurrentUnmaskedContext(fiber); + if (fiber.tag === ClassComponent) { + var Component = fiber.type; + if (isContextProvider(Component)) return processChildContext(fiber, Component, parentContext); + } + return parentContext; + } + function findHostInstanceWithWarning(component, methodName) { + var fiber = get(component); + if (fiber === undefined) { + if (typeof component.render === "function") throw Error("Unable to find node on an unmounted component."); + else throw Error("Argument appears to not be a ReactComponent. Keys: " + Object.keys(component)); + } + var hostFiber = findCurrentHostFiber(fiber); + if (hostFiber === null) return null; + if (hostFiber.mode & StrictMode) { + var componentName = getComponentName(fiber.type) || "Component"; + if (!didWarnAboutFindNodeInStrictMode[componentName]) { + didWarnAboutFindNodeInStrictMode[componentName] = true; + var previousFiber = current; + try { + setCurrentFiber(hostFiber); + if (fiber.mode & StrictMode) error("%s is deprecated in StrictMode. %s was passed an instance of %s which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node", methodName, methodName, componentName); + else error("%s is deprecated in StrictMode. %s was passed an instance of %s which renders StrictMode children. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-find-node", methodName, methodName, componentName); + } finally{ + // Ideally this should reset to previous but this shouldn't be called in + // render and there's another warning for that anyway. + if (previousFiber) setCurrentFiber(previousFiber); + else resetCurrentFiber(); + } + } + } + return hostFiber.stateNode; + } + function createContainer(containerInfo, tag, hydrate, hydrationCallbacks) { + return createFiberRoot(containerInfo, tag, hydrate); + } + function updateContainer(element, container, parentComponent, callback) { + onScheduleRoot(container, element); + var current$1 = container.current; + var eventTime = requestEventTime(); + // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests + if ("undefined" !== typeof jest) { + warnIfUnmockedScheduler(current$1); + warnIfNotScopedWithMatchingAct(current$1); + } + var lane = requestUpdateLane(current$1); + var context = getContextForSubtree(parentComponent); + if (container.context === null) container.context = context; + else container.pendingContext = context; + if (isRendering && current !== null && !didWarnAboutNestedUpdates) { + didWarnAboutNestedUpdates = true; + error("Render methods should be a pure function of props and state; triggering nested component updates from render is not allowed. If necessary, trigger nested updates in componentDidUpdate.\n\nCheck the render method of %s.", getComponentName(current.type) || "Unknown"); + } + var update = createUpdate(eventTime, lane); // Caution: React DevTools currently depends on this property + // being called "element". + update.payload = { + element: element + }; + callback = callback === undefined ? null : callback; + if (callback !== null) { + if (typeof callback !== "function") error("render(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", callback); + update.callback = callback; + } + enqueueUpdate(current$1, update); + scheduleUpdateOnFiber(current$1, lane, eventTime); + return lane; + } + function getPublicRootInstance(container) { + var containerFiber = container.current; + if (!containerFiber.child) return null; + switch(containerFiber.child.tag){ + case HostComponent: + return getPublicInstance(containerFiber.child.stateNode); + default: + return containerFiber.child.stateNode; + } + } + function markRetryLaneImpl(fiber, retryLane) { + var suspenseState = fiber.memoizedState; + if (suspenseState !== null && suspenseState.dehydrated !== null) suspenseState.retryLane = higherPriorityLane(suspenseState.retryLane, retryLane); + } // Increases the priority of thennables when they resolve within this boundary. + function markRetryLaneIfNotHydrated(fiber, retryLane) { + markRetryLaneImpl(fiber, retryLane); + var alternate = fiber.alternate; + if (alternate) markRetryLaneImpl(alternate, retryLane); + } + function attemptUserBlockingHydration$1(fiber) { + if (fiber.tag !== SuspenseComponent) // We ignore HostRoots here because we can't increase + // their priority and they should not suspend on I/O, + // since you have to wrap anything that might suspend in + // Suspense. + return; + var eventTime = requestEventTime(); + var lane = InputDiscreteHydrationLane; + scheduleUpdateOnFiber(fiber, lane, eventTime); + markRetryLaneIfNotHydrated(fiber, lane); + } + function attemptContinuousHydration$1(fiber) { + if (fiber.tag !== SuspenseComponent) // We ignore HostRoots here because we can't increase + // their priority and they should not suspend on I/O, + // since you have to wrap anything that might suspend in + // Suspense. + return; + var eventTime = requestEventTime(); + var lane = SelectiveHydrationLane; + scheduleUpdateOnFiber(fiber, lane, eventTime); + markRetryLaneIfNotHydrated(fiber, lane); + } + function attemptHydrationAtCurrentPriority$1(fiber) { + if (fiber.tag !== SuspenseComponent) // We ignore HostRoots here because we can't increase + // their priority other than synchronously flush it. + return; + var eventTime = requestEventTime(); + var lane = requestUpdateLane(fiber); + scheduleUpdateOnFiber(fiber, lane, eventTime); + markRetryLaneIfNotHydrated(fiber, lane); + } + function runWithPriority$2(priority, fn) { + setCurrentUpdateLanePriority(priority); + return fn(); + } + function findHostInstanceWithNoPortals(fiber) { + var hostFiber = findCurrentHostFiberWithNoPortals(fiber); + if (hostFiber === null) return null; + if (hostFiber.tag === FundamentalComponent) return hostFiber.stateNode.instance; + return hostFiber.stateNode; + } + var shouldSuspendImpl = function(fiber) { + return false; + }; + function shouldSuspend(fiber) { + return shouldSuspendImpl(fiber); + } + var overrideHookState = null; + var overrideHookStateDeletePath = null; + var overrideHookStateRenamePath = null; + var overrideProps = null; + var overridePropsDeletePath = null; + var overridePropsRenamePath = null; + var scheduleUpdate = null; + var setSuspenseHandler = null; + var copyWithDeleteImpl = function(obj, path, index) { + var key = path[index]; + var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); + if (index + 1 === path.length) { + if (Array.isArray(updated)) updated.splice(key, 1); + else delete updated[key]; + return updated; + } // $FlowFixMe number or string is fine here + updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); + return updated; + }; + var copyWithDelete = function(obj, path) { + return copyWithDeleteImpl(obj, path, 0); + }; + var copyWithRenameImpl = function(obj, oldPath, newPath, index) { + var oldKey = oldPath[index]; + var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); + if (index + 1 === oldPath.length) { + var newKey = newPath[index]; // $FlowFixMe number or string is fine here + updated[newKey] = updated[oldKey]; + if (Array.isArray(updated)) updated.splice(oldKey, 1); + else delete updated[oldKey]; + } else // $FlowFixMe number or string is fine here + updated[oldKey] = copyWithRenameImpl(obj[oldKey], oldPath, newPath, index + 1); + return updated; + }; + var copyWithRename = function(obj, oldPath, newPath) { + if (oldPath.length !== newPath.length) { + warn("copyWithRename() expects paths of the same length"); + return; + } else { + for(var i = 0; i < newPath.length - 1; i++)if (oldPath[i] !== newPath[i]) { + warn("copyWithRename() expects paths to be the same except for the deepest key"); + return; + } + } + return copyWithRenameImpl(obj, oldPath, newPath, 0); + }; + var copyWithSetImpl = function(obj, path, index, value) { + if (index >= path.length) return value; + var key = path[index]; + var updated = Array.isArray(obj) ? obj.slice() : _assign({}, obj); // $FlowFixMe number or string is fine here + updated[key] = copyWithSetImpl(obj[key], path, index + 1, value); + return updated; + }; + var copyWithSet = function(obj, path, value) { + return copyWithSetImpl(obj, path, 0, value); + }; + var findHook = function(fiber, id) { + // For now, the "id" of stateful hooks is just the stateful hook index. + // This may change in the future with e.g. nested hooks. + var currentHook = fiber.memoizedState; + while(currentHook !== null && id > 0){ + currentHook = currentHook.next; + id--; + } + return currentHook; + }; // Support DevTools editable values for useState and useReducer. + overrideHookState = function(fiber, id, path, value) { + var hook = findHook(fiber, id); + if (hook !== null) { + var newState = copyWithSet(hook.memoizedState, path, value); + hook.memoizedState = newState; + hook.baseState = newState; // We aren't actually adding an update to the queue, + // because there is no update we can add for useReducer hooks that won't trigger an error. + // (There's no appropriate action type for DevTools overrides.) + // As a result though, React will see the scheduled update as a noop and bailout. + // Shallow cloning props works as a workaround for now to bypass the bailout check. + fiber.memoizedProps = _assign({}, fiber.memoizedProps); + scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + } + }; + overrideHookStateDeletePath = function(fiber, id, path) { + var hook = findHook(fiber, id); + if (hook !== null) { + var newState = copyWithDelete(hook.memoizedState, path); + hook.memoizedState = newState; + hook.baseState = newState; // We aren't actually adding an update to the queue, + // because there is no update we can add for useReducer hooks that won't trigger an error. + // (There's no appropriate action type for DevTools overrides.) + // As a result though, React will see the scheduled update as a noop and bailout. + // Shallow cloning props works as a workaround for now to bypass the bailout check. + fiber.memoizedProps = _assign({}, fiber.memoizedProps); + scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + } + }; + overrideHookStateRenamePath = function(fiber, id, oldPath, newPath) { + var hook = findHook(fiber, id); + if (hook !== null) { + var newState = copyWithRename(hook.memoizedState, oldPath, newPath); + hook.memoizedState = newState; + hook.baseState = newState; // We aren't actually adding an update to the queue, + // because there is no update we can add for useReducer hooks that won't trigger an error. + // (There's no appropriate action type for DevTools overrides.) + // As a result though, React will see the scheduled update as a noop and bailout. + // Shallow cloning props works as a workaround for now to bypass the bailout check. + fiber.memoizedProps = _assign({}, fiber.memoizedProps); + scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + } + }; // Support DevTools props for function components, forwardRef, memo, host components, etc. + overrideProps = function(fiber, path, value) { + fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); + if (fiber.alternate) fiber.alternate.pendingProps = fiber.pendingProps; + scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + }; + overridePropsDeletePath = function(fiber, path) { + fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path); + if (fiber.alternate) fiber.alternate.pendingProps = fiber.pendingProps; + scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + }; + overridePropsRenamePath = function(fiber, oldPath, newPath) { + fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath); + if (fiber.alternate) fiber.alternate.pendingProps = fiber.pendingProps; + scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + }; + scheduleUpdate = function(fiber) { + scheduleUpdateOnFiber(fiber, SyncLane, NoTimestamp); + }; + setSuspenseHandler = function(newShouldSuspendImpl) { + shouldSuspendImpl = newShouldSuspendImpl; + }; + function findHostInstanceByFiber(fiber) { + var hostFiber = findCurrentHostFiber(fiber); + if (hostFiber === null) return null; + return hostFiber.stateNode; + } + function emptyFindFiberByHostInstance(instance) { + return null; + } + function getCurrentFiberForDevTools() { + return current; + } + function injectIntoDevTools(devToolsConfig) { + var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; + var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; + return injectInternals({ + bundleType: devToolsConfig.bundleType, + version: devToolsConfig.version, + rendererPackageName: devToolsConfig.rendererPackageName, + rendererConfig: devToolsConfig.rendererConfig, + overrideHookState: overrideHookState, + overrideHookStateDeletePath: overrideHookStateDeletePath, + overrideHookStateRenamePath: overrideHookStateRenamePath, + overrideProps: overrideProps, + overridePropsDeletePath: overridePropsDeletePath, + overridePropsRenamePath: overridePropsRenamePath, + setSuspenseHandler: setSuspenseHandler, + scheduleUpdate: scheduleUpdate, + currentDispatcherRef: ReactCurrentDispatcher, + findHostInstanceByFiber: findHostInstanceByFiber, + findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance, + // React Refresh + findHostInstancesForRefresh: findHostInstancesForRefresh, + scheduleRefresh: scheduleRefresh, + scheduleRoot: scheduleRoot, + setRefreshHandler: setRefreshHandler, + // Enables DevTools to append owner stacks to error messages in DEV mode. + getCurrentFiber: getCurrentFiberForDevTools + }); + } + function ReactDOMRoot(container, options) { + this._internalRoot = createRootImpl(container, ConcurrentRoot, options); + } + function ReactDOMBlockingRoot(container, tag, options) { + this._internalRoot = createRootImpl(container, tag, options); + } + ReactDOMRoot.prototype.render = ReactDOMBlockingRoot.prototype.render = function(children) { + var root = this._internalRoot; + if (typeof arguments[1] === "function") error("render(...): does not support the second callback argument. To execute a side effect after rendering, declare it in a component body with useEffect()."); + var container = root.containerInfo; + if (container.nodeType !== COMMENT_NODE) { + var hostInstance = findHostInstanceWithNoPortals(root.current); + if (hostInstance) { + if (hostInstance.parentNode !== container) error("render(...): It looks like the React-rendered content of the root container was removed without using React. This is not supported and will cause errors. Instead, call root.unmount() to empty a root's container."); + } + } + updateContainer(children, root, null, null); + }; + ReactDOMRoot.prototype.unmount = ReactDOMBlockingRoot.prototype.unmount = function() { + if (typeof arguments[0] === "function") error("unmount(...): does not support a callback argument. To execute a side effect after rendering, declare it in a component body with useEffect()."); + var root = this._internalRoot; + var container = root.containerInfo; + updateContainer(null, root, null, function() { + unmarkContainerAsRoot(container); + }); + }; + function createRootImpl(container, tag, options) { + // Tag is either LegacyRoot or Concurrent Root + var hydrate = options != null && options.hydrate === true; + var hydrationCallbacks = options != null && options.hydrationOptions || null; + var mutableSources = options != null && options.hydrationOptions != null && options.hydrationOptions.mutableSources || null; + var root = createContainer(container, tag, hydrate); + markContainerAsRoot(root.current, container); + var containerNodeType = container.nodeType; + var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; + listenToAllSupportedEvents(rootContainerElement); + if (mutableSources) for(var i = 0; i < mutableSources.length; i++){ + var mutableSource = mutableSources[i]; + registerMutableSourceForHydration(root, mutableSource); + } + return root; + } + function createLegacyRoot(container, options) { + return new ReactDOMBlockingRoot(container, LegacyRoot, options); + } + function isValidContainer(node) { + return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === " react-mount-point-unstable ")); + } + var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner; + var topLevelUpdateWarnings; + var warnedAboutHydrateAPI = false; + topLevelUpdateWarnings = function(container) { + if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) { + var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer._internalRoot.current); + if (hostInstance) { + if (hostInstance.parentNode !== container) error("render(...): It looks like the React-rendered content of this container was removed without using React. This is not supported and will cause errors. Instead, call ReactDOM.unmountComponentAtNode to empty a container."); + } + } + var isRootRenderedBySomeReact = !!container._reactRootContainer; + var rootEl = getReactRootElementInContainer(container); + var hasNonRootReactChild = !!(rootEl && getInstanceFromNode(rootEl)); + if (hasNonRootReactChild && !isRootRenderedBySomeReact) error("render(...): Replacing React-rendered children with a new root component. If you intended to update the children of this node, you should instead have the existing children update their state and render the new components instead of calling ReactDOM.render."); + if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === "BODY") error("render(): Rendering components directly into document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try rendering into a container element created for your app."); + }; + function getReactRootElementInContainer(container) { + if (!container) return null; + if (container.nodeType === DOCUMENT_NODE) return container.documentElement; + else return container.firstChild; + } + function shouldHydrateDueToLegacyHeuristic(container) { + var rootElement = getReactRootElementInContainer(container); + return !!(rootElement && rootElement.nodeType === ELEMENT_NODE && rootElement.hasAttribute(ROOT_ATTRIBUTE_NAME)); + } + function legacyCreateRootFromDOMContainer(container, forceHydrate) { + var shouldHydrate = forceHydrate || shouldHydrateDueToLegacyHeuristic(container); // First clear any existing content. + if (!shouldHydrate) { + var warned = false; + var rootSibling; + while(rootSibling = container.lastChild){ + if (!warned && rootSibling.nodeType === ELEMENT_NODE && rootSibling.hasAttribute(ROOT_ATTRIBUTE_NAME)) { + warned = true; + error("render(): Target node has markup rendered by React, but there are unrelated nodes as well. This is most commonly caused by white-space inserted around server-rendered markup."); + } + container.removeChild(rootSibling); + } + } + if (shouldHydrate && !forceHydrate && !warnedAboutHydrateAPI) { + warnedAboutHydrateAPI = true; + warn("render(): Calling ReactDOM.render() to hydrate server-rendered markup will stop working in React v18. Replace the ReactDOM.render() call with ReactDOM.hydrate() if you want React to attach to the server HTML."); + } + return createLegacyRoot(container, shouldHydrate ? { + hydrate: true + } : undefined); + } + function warnOnInvalidCallback$1(callback, callerName) { + if (callback !== null && typeof callback !== "function") error("%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.", callerName, callback); + } + function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) { + topLevelUpdateWarnings(container); + warnOnInvalidCallback$1(callback === undefined ? null : callback, "render"); + // member of intersection type." Whyyyyyy. + var root = container._reactRootContainer; + var fiberRoot; + if (!root) { + // Initial mount + root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate); + fiberRoot = root._internalRoot; + if (typeof callback === "function") { + var originalCallback = callback; + callback = function() { + var instance = getPublicRootInstance(fiberRoot); + originalCallback.call(instance); + }; + } // Initial mount should not be batched. + unbatchedUpdates(function() { + updateContainer(children, fiberRoot, parentComponent, callback); + }); + } else { + fiberRoot = root._internalRoot; + if (typeof callback === "function") { + var _originalCallback = callback; + callback = function() { + var instance = getPublicRootInstance(fiberRoot); + _originalCallback.call(instance); + }; + } // Update + updateContainer(children, fiberRoot, parentComponent, callback); + } + return getPublicRootInstance(fiberRoot); + } + function findDOMNode(componentOrElement) { + var owner = ReactCurrentOwner$3.current; + if (owner !== null && owner.stateNode !== null) { + var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender; + if (!warnedAboutRefsInRender) error("%s is accessing findDOMNode inside its render(). render() should be a pure function of props and state. It should never access something that requires stale data from the previous render, such as refs. Move this logic to componentDidMount and componentDidUpdate instead.", getComponentName(owner.type) || "A component"); + owner.stateNode._warnedAboutRefsInRender = true; + } + if (componentOrElement == null) return null; + if (componentOrElement.nodeType === ELEMENT_NODE) return componentOrElement; + return findHostInstanceWithWarning(componentOrElement, "findDOMNode"); + } + function hydrate(element, container, callback) { + if (!isValidContainer(container)) throw Error("Target container is not a DOM element."); + var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; + if (isModernRoot) error("You are calling ReactDOM.hydrate() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call createRoot(container, {hydrate: true}).render(element)?"); + return legacyRenderSubtreeIntoContainer(null, element, container, true, callback); + } + function render(element, container, callback) { + if (!isValidContainer(container)) throw Error("Target container is not a DOM element."); + var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; + if (isModernRoot) error("You are calling ReactDOM.render() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.render(element)?"); + return legacyRenderSubtreeIntoContainer(null, element, container, false, callback); + } + function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) { + if (!isValidContainer(containerNode)) throw Error("Target container is not a DOM element."); + if (!(parentComponent != null && has(parentComponent))) throw Error("parentComponent must be a valid React Component"); + return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback); + } + function unmountComponentAtNode(container) { + if (!isValidContainer(container)) throw Error("unmountComponentAtNode(...): Target container is not a DOM element."); + var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; + if (isModernRoot) error("You are calling ReactDOM.unmountComponentAtNode() on a container that was previously passed to ReactDOM.createRoot(). This is not supported. Did you mean to call root.unmount()?"); + if (container._reactRootContainer) { + var rootEl = getReactRootElementInContainer(container); + var renderedByDifferentReact = rootEl && !getInstanceFromNode(rootEl); + if (renderedByDifferentReact) error("unmountComponentAtNode(): The node you're attempting to unmount was rendered by another copy of React."); + unbatchedUpdates(function() { + legacyRenderSubtreeIntoContainer(null, null, container, false, function() { + // $FlowFixMe This should probably use `delete container._reactRootContainer` + container._reactRootContainer = null; + unmarkContainerAsRoot(container); + }); + }); // If you call unmountComponentAtNode twice in quick succession, you'll + // get `true` twice. That's probably fine? + return true; + } else { + var _rootEl = getReactRootElementInContainer(container); + var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode(_rootEl)); // Check if the container itself is a React root node. + var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainer(container.parentNode) && !!container.parentNode._reactRootContainer; + if (hasNonRootReactChild) error("unmountComponentAtNode(): The node you're attempting to unmount was rendered by React and is not a top-level container. %s", isContainerReactRoot ? "You may have accidentally passed in a React root node instead of its container." : "Instead, have the parent component update its state and rerender in order to remove this component."); + return false; + } + } + setAttemptUserBlockingHydration(attemptUserBlockingHydration$1); + setAttemptContinuousHydration(attemptContinuousHydration$1); + setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1); + setAttemptHydrationAtPriority(runWithPriority$2); + var didWarnAboutUnstableCreatePortal = false; + if (typeof Map !== "function" || // $FlowIssue Flow incorrectly thinks Map has no prototype + Map.prototype == null || typeof Map.prototype.forEach !== "function" || typeof Set !== "function" || // $FlowIssue Flow incorrectly thinks Set has no prototype + Set.prototype == null || typeof Set.prototype.clear !== "function" || typeof Set.prototype.forEach !== "function") error("React depends on Map and Set built-in types. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"); + setRestoreImplementation(restoreControlledState$3); + setBatchingImplementation(batchedUpdates$1, discreteUpdates$1, flushDiscreteUpdates, batchedEventUpdates$1); + function createPortal$1(children, container) { + var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + if (!isValidContainer(container)) throw Error("Target container is not a DOM element."); + // TODO: pass ReactDOM portal implementation as third argument + // $FlowFixMe The Flow type is opaque but there's no way to actually create it. + return createPortal(children, container, null, key); + } + function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) { + return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback); + } + function unstable_createPortal(children, container) { + var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + if (!didWarnAboutUnstableCreatePortal) { + didWarnAboutUnstableCreatePortal = true; + warn('The ReactDOM.unstable_createPortal() alias has been deprecated, and will be removed in React 18+. Update your code to use ReactDOM.createPortal() instead. It has the exact same API, but without the "unstable_" prefix.'); + } + return createPortal$1(children, container, key); + } + var Internals = { + // Keep in sync with ReactTestUtils.js, and ReactTestUtilsAct.js. + // This is an array for better minification. + Events: [ + getInstanceFromNode, + getNodeFromInstance, + getFiberCurrentPropsFromNode, + enqueueStateRestore, + restoreStateIfNeeded, + flushPassiveEffects, + IsThisRendererActing + ] + }; + var foundDevTools = injectIntoDevTools({ + findFiberByHostInstance: getClosestInstanceFromNode, + bundleType: 1, + version: ReactVersion, + rendererPackageName: "react-dom" + }); + if (!foundDevTools && canUseDOM && window.top === window.self) // If we're in Chrome or Firefox, provide a download link if not installed. + { + if (navigator.userAgent.indexOf("Chrome") > -1 && navigator.userAgent.indexOf("Edge") === -1 || navigator.userAgent.indexOf("Firefox") > -1) { + var protocol = window.location.protocol; // Don't warn in exotic cases like chrome-extension://. + if (/^(https?|file):$/.test(protocol)) // eslint-disable-next-line react-internal/no-production-logging + console.info("%cDownload the React DevTools for a better development experience: https://reactjs.org/link/react-devtools" + (protocol === "file:" ? "\nYou might need to use a local HTTP server (instead of file://): https://reactjs.org/link/react-devtools-faq" : ""), "font-weight:bold"); + } + } + exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; + exports.createPortal = createPortal$1; + exports.findDOMNode = findDOMNode; + exports.flushSync = flushSync; + exports.hydrate = hydrate; + exports.render = render; + exports.unmountComponentAtNode = unmountComponentAtNode; + exports.unstable_batchedUpdates = batchedUpdates$1; + exports.unstable_createPortal = unstable_createPortal; + exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer; + exports.version = ReactVersion; +})(); + +},{"75f469cf177c694a":"21dqq","7cb4324d8316ab2d":"7OXxh","acbc05fa87d8f502":"juvHo","24c753aefe914197":"9ZY7A"}],"juvHo":[function(require,module,exports) { +"use strict"; +module.exports = require("51d44d67786c91b9"); + +},{"51d44d67786c91b9":"RqdIf"}],"RqdIf":[function(require,module,exports) { +/** @license React v0.20.2 + * scheduler.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ "use strict"; +(function() { + "use strict"; + var enableSchedulerDebugging = false; + var enableProfiling = false; + var requestHostCallback; + var requestHostTimeout; + var cancelHostTimeout; + var requestPaint; + var hasPerformanceNow = typeof performance === "object" && typeof performance.now === "function"; + if (hasPerformanceNow) { + var localPerformance = performance; + exports.unstable_now = function() { + return localPerformance.now(); + }; + } else { + var localDate = Date; + var initialTime = localDate.now(); + exports.unstable_now = function() { + return localDate.now() - initialTime; + }; + } + if (// implementation using setTimeout. + typeof window === "undefined" || // Check if MessageChannel is supported, too. + typeof MessageChannel !== "function") { + // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore, + // fallback to a naive implementation. + var _callback = null; + var _timeoutID = null; + var _flushCallback = function() { + if (_callback !== null) try { + var currentTime = exports.unstable_now(); + var hasRemainingTime = true; + _callback(hasRemainingTime, currentTime); + _callback = null; + } catch (e) { + setTimeout(_flushCallback, 0); + throw e; + } + }; + requestHostCallback = function(cb) { + if (_callback !== null) // Protect against re-entrancy. + setTimeout(requestHostCallback, 0, cb); + else { + _callback = cb; + setTimeout(_flushCallback, 0); + } + }; + requestHostTimeout = function(cb, ms) { + _timeoutID = setTimeout(cb, ms); + }; + cancelHostTimeout = function() { + clearTimeout(_timeoutID); + }; + exports.unstable_shouldYield = function() { + return false; + }; + requestPaint = exports.unstable_forceFrameRate = function() {}; + } else { + // Capture local references to native APIs, in case a polyfill overrides them. + var _setTimeout = window.setTimeout; + var _clearTimeout = window.clearTimeout; + if (typeof console !== "undefined") { + // TODO: Scheduler no longer requires these methods to be polyfilled. But + // maybe we want to continue warning if they don't exist, to preserve the + // option to rely on it in the future? + var requestAnimationFrame = window.requestAnimationFrame; + var cancelAnimationFrame = window.cancelAnimationFrame; + if (typeof requestAnimationFrame !== "function") // Using console['error'] to evade Babel and ESLint + console["error"]("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"); + if (typeof cancelAnimationFrame !== "function") // Using console['error'] to evade Babel and ESLint + console["error"]("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"); + } + var isMessageLoopRunning = false; + var scheduledHostCallback = null; + var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main + // thread, like user events. By default, it yields multiple times per frame. + // It does not attempt to align with frame boundaries, since most tasks don't + // need to be frame aligned; for those that do, use requestAnimationFrame. + var yieldInterval = 5; + var deadline = 0; // TODO: Make this configurable + // `isInputPending` is not available. Since we have no way of knowing if + // there's pending input, always yield at the end of the frame. + exports.unstable_shouldYield = function() { + return exports.unstable_now() >= deadline; + }; // Since we yield every frame regardless, `requestPaint` has no effect. + requestPaint = function() {}; + exports.unstable_forceFrameRate = function(fps) { + if (fps < 0 || fps > 125) { + // Using console['error'] to evade Babel and ESLint + console["error"]("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"); + return; + } + if (fps > 0) yieldInterval = Math.floor(1000 / fps); + else // reset the framerate + yieldInterval = 5; + }; + var performWorkUntilDeadline = function() { + if (scheduledHostCallback !== null) { + var currentTime = exports.unstable_now(); // Yield after `yieldInterval` ms, regardless of where we are in the vsync + // cycle. This means there's always time remaining at the beginning of + // the message event. + deadline = currentTime + yieldInterval; + var hasTimeRemaining = true; + try { + var hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); + if (!hasMoreWork) { + isMessageLoopRunning = false; + scheduledHostCallback = null; + } else // If there's more work, schedule the next message event at the end + // of the preceding one. + port.postMessage(null); + } catch (error) { + // If a scheduler task throws, exit the current browser task so the + // error can be observed. + port.postMessage(null); + throw error; + } + } else isMessageLoopRunning = false; + // Yielding to the browser will give it a chance to paint, so we can + }; + var channel = new MessageChannel(); + var port = channel.port2; + channel.port1.onmessage = performWorkUntilDeadline; + requestHostCallback = function(callback) { + scheduledHostCallback = callback; + if (!isMessageLoopRunning) { + isMessageLoopRunning = true; + port.postMessage(null); + } + }; + requestHostTimeout = function(callback, ms) { + taskTimeoutID = _setTimeout(function() { + callback(exports.unstable_now()); + }, ms); + }; + cancelHostTimeout = function() { + _clearTimeout(taskTimeoutID); + taskTimeoutID = -1; + }; + } + function push(heap, node) { + var index = heap.length; + heap.push(node); + siftUp(heap, node, index); + } + function peek(heap) { + var first = heap[0]; + return first === undefined ? null : first; + } + function pop(heap) { + var first = heap[0]; + if (first !== undefined) { + var last = heap.pop(); + if (last !== first) { + heap[0] = last; + siftDown(heap, last, 0); + } + return first; + } else return null; + } + function siftUp(heap, node, i) { + var index = i; + while(true){ + var parentIndex = index - 1 >>> 1; + var parent = heap[parentIndex]; + if (parent !== undefined && compare(parent, node) > 0) { + // The parent is larger. Swap positions. + heap[parentIndex] = node; + heap[index] = parent; + index = parentIndex; + } else // The parent is smaller. Exit. + return; + } + } + function siftDown(heap, node, i) { + var index = i; + var length = heap.length; + while(index < length){ + var leftIndex = (index + 1) * 2 - 1; + var left = heap[leftIndex]; + var rightIndex = leftIndex + 1; + var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. + if (left !== undefined && compare(left, node) < 0) { + if (right !== undefined && compare(right, left) < 0) { + heap[index] = right; + heap[rightIndex] = node; + index = rightIndex; + } else { + heap[index] = left; + heap[leftIndex] = node; + index = leftIndex; + } + } else if (right !== undefined && compare(right, node) < 0) { + heap[index] = right; + heap[rightIndex] = node; + index = rightIndex; + } else // Neither child is smaller. Exit. + return; + } + } + function compare(a, b) { + // Compare sort index first, then task id. + var diff = a.sortIndex - b.sortIndex; + return diff !== 0 ? diff : a.id - b.id; + } + // TODO: Use symbols? + var ImmediatePriority = 1; + var UserBlockingPriority = 2; + var NormalPriority = 3; + var LowPriority = 4; + var IdlePriority = 5; + function markTaskErrored(task, ms) {} + /* eslint-disable no-var */ // Math.pow(2, 30) - 1 + // 0b111111111111111111111111111111 + var maxSigned31BitInt = 1073741823; // Times out immediately + var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out + var USER_BLOCKING_PRIORITY_TIMEOUT = 250; + var NORMAL_PRIORITY_TIMEOUT = 5000; + var LOW_PRIORITY_TIMEOUT = 10000; // Never times out + var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap + var taskQueue = []; + var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. + var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. + var currentTask = null; + var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrancy. + var isPerformingWork = false; + var isHostCallbackScheduled = false; + var isHostTimeoutScheduled = false; + function advanceTimers(currentTime) { + // Check for tasks that are no longer delayed and add them to the queue. + var timer = peek(timerQueue); + while(timer !== null){ + if (timer.callback === null) // Timer was cancelled. + pop(timerQueue); + else if (timer.startTime <= currentTime) { + // Timer fired. Transfer to the task queue. + pop(timerQueue); + timer.sortIndex = timer.expirationTime; + push(taskQueue, timer); + } else // Remaining timers are pending. + return; + timer = peek(timerQueue); + } + } + function handleTimeout(currentTime) { + isHostTimeoutScheduled = false; + advanceTimers(currentTime); + if (!isHostCallbackScheduled) { + if (peek(taskQueue) !== null) { + isHostCallbackScheduled = true; + requestHostCallback(flushWork); + } else { + var firstTimer = peek(timerQueue); + if (firstTimer !== null) requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); + } + } + } + function flushWork(hasTimeRemaining, initialTime) { + isHostCallbackScheduled = false; + if (isHostTimeoutScheduled) { + // We scheduled a timeout but it's no longer needed. Cancel it. + isHostTimeoutScheduled = false; + cancelHostTimeout(); + } + isPerformingWork = true; + var previousPriorityLevel = currentPriorityLevel; + try { + if (enableProfiling) try { + return workLoop(hasTimeRemaining, initialTime); + } catch (error) { + if (currentTask !== null) { + var currentTime = exports.unstable_now(); + markTaskErrored(currentTask, currentTime); + currentTask.isQueued = false; + } + throw error; + } + else // No catch in prod code path. + return workLoop(hasTimeRemaining, initialTime); + } finally{ + currentTask = null; + currentPriorityLevel = previousPriorityLevel; + isPerformingWork = false; + } + } + function workLoop(hasTimeRemaining, initialTime) { + var currentTime = initialTime; + advanceTimers(currentTime); + currentTask = peek(taskQueue); + while(currentTask !== null && !enableSchedulerDebugging){ + if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || exports.unstable_shouldYield())) break; + var callback = currentTask.callback; + if (typeof callback === "function") { + currentTask.callback = null; + currentPriorityLevel = currentTask.priorityLevel; + var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; + var continuationCallback = callback(didUserCallbackTimeout); + currentTime = exports.unstable_now(); + if (typeof continuationCallback === "function") currentTask.callback = continuationCallback; + else if (currentTask === peek(taskQueue)) pop(taskQueue); + advanceTimers(currentTime); + } else pop(taskQueue); + currentTask = peek(taskQueue); + } // Return whether there's additional work + if (currentTask !== null) return true; + else { + var firstTimer = peek(timerQueue); + if (firstTimer !== null) requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); + return false; + } + } + function unstable_runWithPriority(priorityLevel, eventHandler) { + switch(priorityLevel){ + case ImmediatePriority: + case UserBlockingPriority: + case NormalPriority: + case LowPriority: + case IdlePriority: + break; + default: + priorityLevel = NormalPriority; + } + var previousPriorityLevel = currentPriorityLevel; + currentPriorityLevel = priorityLevel; + try { + return eventHandler(); + } finally{ + currentPriorityLevel = previousPriorityLevel; + } + } + function unstable_next(eventHandler) { + var priorityLevel; + switch(currentPriorityLevel){ + case ImmediatePriority: + case UserBlockingPriority: + case NormalPriority: + // Shift down to normal priority + priorityLevel = NormalPriority; + break; + default: + // Anything lower than normal priority should remain at the current level. + priorityLevel = currentPriorityLevel; + break; + } + var previousPriorityLevel = currentPriorityLevel; + currentPriorityLevel = priorityLevel; + try { + return eventHandler(); + } finally{ + currentPriorityLevel = previousPriorityLevel; + } + } + function unstable_wrapCallback(callback) { + var parentPriorityLevel = currentPriorityLevel; + return function() { + // This is a fork of runWithPriority, inlined for performance. + var previousPriorityLevel = currentPriorityLevel; + currentPriorityLevel = parentPriorityLevel; + try { + return callback.apply(this, arguments); + } finally{ + currentPriorityLevel = previousPriorityLevel; + } + }; + } + function unstable_scheduleCallback(priorityLevel, callback, options) { + var currentTime = exports.unstable_now(); + var startTime; + if (typeof options === "object" && options !== null) { + var delay = options.delay; + if (typeof delay === "number" && delay > 0) startTime = currentTime + delay; + else startTime = currentTime; + } else startTime = currentTime; + var timeout; + switch(priorityLevel){ + case ImmediatePriority: + timeout = IMMEDIATE_PRIORITY_TIMEOUT; + break; + case UserBlockingPriority: + timeout = USER_BLOCKING_PRIORITY_TIMEOUT; + break; + case IdlePriority: + timeout = IDLE_PRIORITY_TIMEOUT; + break; + case LowPriority: + timeout = LOW_PRIORITY_TIMEOUT; + break; + case NormalPriority: + default: + timeout = NORMAL_PRIORITY_TIMEOUT; + break; + } + var expirationTime = startTime + timeout; + var newTask = { + id: taskIdCounter++, + callback: callback, + priorityLevel: priorityLevel, + startTime: startTime, + expirationTime: expirationTime, + sortIndex: -1 + }; + if (startTime > currentTime) { + // This is a delayed task. + newTask.sortIndex = startTime; + push(timerQueue, newTask); + if (peek(taskQueue) === null && newTask === peek(timerQueue)) { + // All tasks are delayed, and this is the task with the earliest delay. + if (isHostTimeoutScheduled) // Cancel an existing timeout. + cancelHostTimeout(); + else isHostTimeoutScheduled = true; + // Schedule a timeout. + requestHostTimeout(handleTimeout, startTime - currentTime); + } + } else { + newTask.sortIndex = expirationTime; + push(taskQueue, newTask); + // wait until the next time we yield. + if (!isHostCallbackScheduled && !isPerformingWork) { + isHostCallbackScheduled = true; + requestHostCallback(flushWork); + } + } + return newTask; + } + function unstable_pauseExecution() {} + function unstable_continueExecution() { + if (!isHostCallbackScheduled && !isPerformingWork) { + isHostCallbackScheduled = true; + requestHostCallback(flushWork); + } + } + function unstable_getFirstCallbackNode() { + return peek(taskQueue); + } + function unstable_cancelCallback(task) { + // remove from the queue because you can't remove arbitrary nodes from an + // array based heap, only the first one.) + task.callback = null; + } + function unstable_getCurrentPriorityLevel() { + return currentPriorityLevel; + } + var unstable_requestPaint = requestPaint; + var unstable_Profiling = null; + exports.unstable_IdlePriority = IdlePriority; + exports.unstable_ImmediatePriority = ImmediatePriority; + exports.unstable_LowPriority = LowPriority; + exports.unstable_NormalPriority = NormalPriority; + exports.unstable_Profiling = unstable_Profiling; + exports.unstable_UserBlockingPriority = UserBlockingPriority; + exports.unstable_cancelCallback = unstable_cancelCallback; + exports.unstable_continueExecution = unstable_continueExecution; + exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; + exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; + exports.unstable_next = unstable_next; + exports.unstable_pauseExecution = unstable_pauseExecution; + exports.unstable_requestPaint = unstable_requestPaint; + exports.unstable_runWithPriority = unstable_runWithPriority; + exports.unstable_scheduleCallback = unstable_scheduleCallback; + exports.unstable_wrapCallback = unstable_wrapCallback; +})(); + +},{}],"9ZY7A":[function(require,module,exports) { +"use strict"; +module.exports = require("33ada20512dcaa55"); + +},{"33ada20512dcaa55":"dClkR"}],"dClkR":[function(require,module,exports) { +/** @license React v0.20.2 + * scheduler-tracing.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ "use strict"; +(function() { + "use strict"; + var DEFAULT_THREAD_ID = 0; // Counters used to generate unique IDs. + var interactionIDCounter = 0; + var threadIDCounter = 0; // Set of currently traced interactions. + // Interactions "stack"– + // Meaning that newly traced interactions are appended to the previously active set. + // When an interaction goes out of scope, the previous set (if any) is restored. + exports.__interactionsRef = null; // Listener(s) to notify when interactions begin and end. + exports.__subscriberRef = null; + exports.__interactionsRef = { + current: new Set() + }; + exports.__subscriberRef = { + current: null + }; + function unstable_clear(callback) { + var prevInteractions = exports.__interactionsRef.current; + exports.__interactionsRef.current = new Set(); + try { + return callback(); + } finally{ + exports.__interactionsRef.current = prevInteractions; + } + } + function unstable_getCurrent() { + return exports.__interactionsRef.current; + } + function unstable_getThreadID() { + return ++threadIDCounter; + } + function unstable_trace(name, timestamp, callback) { + var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID; + var interaction = { + __count: 1, + id: interactionIDCounter++, + name: name, + timestamp: timestamp + }; + var prevInteractions = exports.__interactionsRef.current; // Traced interactions should stack/accumulate. + // To do that, clone the current interactions. + // The previous set will be restored upon completion. + var interactions = new Set(prevInteractions); + interactions.add(interaction); + exports.__interactionsRef.current = interactions; + var subscriber = exports.__subscriberRef.current; + var returnValue; + try { + if (subscriber !== null) subscriber.onInteractionTraced(interaction); + } finally{ + try { + if (subscriber !== null) subscriber.onWorkStarted(interactions, threadID); + } finally{ + try { + returnValue = callback(); + } finally{ + exports.__interactionsRef.current = prevInteractions; + try { + if (subscriber !== null) subscriber.onWorkStopped(interactions, threadID); + } finally{ + interaction.__count--; // If no async work was scheduled for this interaction, + // Notify subscribers that it's completed. + if (subscriber !== null && interaction.__count === 0) subscriber.onInteractionScheduledWorkCompleted(interaction); + } + } + } + } + return returnValue; + } + function unstable_wrap(callback) { + var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID; + var wrappedInteractions = exports.__interactionsRef.current; + var subscriber = exports.__subscriberRef.current; + if (subscriber !== null) subscriber.onWorkScheduled(wrappedInteractions, threadID); + // Update the pending async work count for the current interactions. + // Update after calling subscribers in case of error. + wrappedInteractions.forEach(function(interaction) { + interaction.__count++; + }); + var hasRun = false; + function wrapped() { + var prevInteractions = exports.__interactionsRef.current; + exports.__interactionsRef.current = wrappedInteractions; + subscriber = exports.__subscriberRef.current; + try { + var returnValue; + try { + if (subscriber !== null) subscriber.onWorkStarted(wrappedInteractions, threadID); + } finally{ + try { + returnValue = callback.apply(undefined, arguments); + } finally{ + exports.__interactionsRef.current = prevInteractions; + if (subscriber !== null) subscriber.onWorkStopped(wrappedInteractions, threadID); + } + } + return returnValue; + } finally{ + if (!hasRun) { + // We only expect a wrapped function to be executed once, + // But in the event that it's executed more than once– + // Only decrement the outstanding interaction counts once. + hasRun = true; // Update pending async counts for all wrapped interactions. + // If this was the last scheduled async work for any of them, + // Mark them as completed. + wrappedInteractions.forEach(function(interaction) { + interaction.__count--; + if (subscriber !== null && interaction.__count === 0) subscriber.onInteractionScheduledWorkCompleted(interaction); + }); + } + } + } + wrapped.cancel = function cancel() { + subscriber = exports.__subscriberRef.current; + try { + if (subscriber !== null) subscriber.onWorkCanceled(wrappedInteractions, threadID); + } finally{ + // Update pending async counts for all wrapped interactions. + // If this was the last scheduled async work for any of them, + // Mark them as completed. + wrappedInteractions.forEach(function(interaction) { + interaction.__count--; + if (subscriber && interaction.__count === 0) subscriber.onInteractionScheduledWorkCompleted(interaction); + }); + } + }; + return wrapped; + } + var subscribers = null; + subscribers = new Set(); + function unstable_subscribe(subscriber) { + subscribers.add(subscriber); + if (subscribers.size === 1) exports.__subscriberRef.current = { + onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted, + onInteractionTraced: onInteractionTraced, + onWorkCanceled: onWorkCanceled, + onWorkScheduled: onWorkScheduled, + onWorkStarted: onWorkStarted, + onWorkStopped: onWorkStopped + }; + } + function unstable_unsubscribe(subscriber) { + subscribers.delete(subscriber); + if (subscribers.size === 0) exports.__subscriberRef.current = null; + } + function onInteractionTraced(interaction) { + var didCatchError = false; + var caughtError = null; + subscribers.forEach(function(subscriber) { + try { + subscriber.onInteractionTraced(interaction); + } catch (error) { + if (!didCatchError) { + didCatchError = true; + caughtError = error; + } + } + }); + if (didCatchError) throw caughtError; + } + function onInteractionScheduledWorkCompleted(interaction) { + var didCatchError = false; + var caughtError = null; + subscribers.forEach(function(subscriber) { + try { + subscriber.onInteractionScheduledWorkCompleted(interaction); + } catch (error) { + if (!didCatchError) { + didCatchError = true; + caughtError = error; + } + } + }); + if (didCatchError) throw caughtError; + } + function onWorkScheduled(interactions, threadID) { + var didCatchError = false; + var caughtError = null; + subscribers.forEach(function(subscriber) { + try { + subscriber.onWorkScheduled(interactions, threadID); + } catch (error) { + if (!didCatchError) { + didCatchError = true; + caughtError = error; + } + } + }); + if (didCatchError) throw caughtError; + } + function onWorkStarted(interactions, threadID) { + var didCatchError = false; + var caughtError = null; + subscribers.forEach(function(subscriber) { + try { + subscriber.onWorkStarted(interactions, threadID); + } catch (error) { + if (!didCatchError) { + didCatchError = true; + caughtError = error; + } + } + }); + if (didCatchError) throw caughtError; + } + function onWorkStopped(interactions, threadID) { + var didCatchError = false; + var caughtError = null; + subscribers.forEach(function(subscriber) { + try { + subscriber.onWorkStopped(interactions, threadID); + } catch (error) { + if (!didCatchError) { + didCatchError = true; + caughtError = error; + } + } + }); + if (didCatchError) throw caughtError; + } + function onWorkCanceled(interactions, threadID) { + var didCatchError = false; + var caughtError = null; + subscribers.forEach(function(subscriber) { + try { + subscriber.onWorkCanceled(interactions, threadID); + } catch (error) { + if (!didCatchError) { + didCatchError = true; + caughtError = error; + } + } + }); + if (didCatchError) throw caughtError; + } + exports.unstable_clear = unstable_clear; + exports.unstable_getCurrent = unstable_getCurrent; + exports.unstable_getThreadID = unstable_getThreadID; + exports.unstable_subscribe = unstable_subscribe; + exports.unstable_trace = unstable_trace; + exports.unstable_unsubscribe = unstable_unsubscribe; + exports.unstable_wrap = unstable_wrap; +})(); + +},{}],"5OmEi":[function(require,module,exports) { +var $parcel$ReactRefreshHelpers$417f = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js"); +var prevRefreshReg = window.$RefreshReg$; +var prevRefreshSig = window.$RefreshSig$; +$parcel$ReactRefreshHelpers$417f.prelude(module); + +try { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _jsxDevRuntime = require("react/jsx-dev-runtime"); +var _react = require("react"); +var _reactDefault = parcelHelpers.interopDefault(_react); +var _reactBulmaComponents = require("react-bulma-components"); +var _editorJs = require("../components/Editor/Editor.js"); +var _editorJsDefault = parcelHelpers.interopDefault(_editorJs); +var _debuggerJs = require("../components/Debugger/Debugger.js"); +var _debuggerJsDefault = parcelHelpers.interopDefault(_debuggerJs); +var _ioJs = require("../components/Debugger/IO.js"); +var _ioJsDefault = parcelHelpers.interopDefault(_ioJs); +var _memoryJs = require("../components/Debugger/Memory/Memory.js"); +var _memoryJsDefault = parcelHelpers.interopDefault(_memoryJs); +var _footerJs = require("../components/Footer.js"); +var _footerJsDefault = parcelHelpers.interopDefault(_footerJs); +var _compilerInfoJs = require("../components/CompilerInfo.js"); +var _compilerInfoJsDefault = parcelHelpers.interopDefault(_compilerInfoJs); +var _rootScss = require("./Root.scss"); +function Root() { + return /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _jsxDevRuntime.Fragment), { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Section), { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Container), { + breakpoint: "fluid", + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Columns), { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Columns).Column, { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Box), { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _compilerInfoJsDefault.default), {}, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 21, + columnNumber: 17 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _editorJsDefault.default), {}, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 22, + columnNumber: 17 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 20, + columnNumber: 15 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 19, + columnNumber: 13 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Columns).Column, { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Box), { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _debuggerJsDefault.default), {}, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 27, + columnNumber: 17 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 26, + columnNumber: 15 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 25, + columnNumber: 13 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Columns).Column, { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Box), { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _memoryJsDefault.default), {}, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 32, + columnNumber: 17 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 31, + columnNumber: 15 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Box), { + style: { + maxHeight: "300px", + overflow: "auto" + }, + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _ioJsDefault.default), {}, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 35, + columnNumber: 17 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 34, + columnNumber: 15 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 30, + columnNumber: 13 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 18, + columnNumber: 11 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 17, + columnNumber: 9 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 16, + columnNumber: 7 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _footerJsDefault.default), {}, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/screens/Root.js", + lineNumber: 41, + columnNumber: 7 + }, this) + ] + }, void 0, true); +} +_c = Root; +exports.default = Root; +var _c; +$RefreshReg$(_c, "Root"); + + $parcel$ReactRefreshHelpers$417f.postlude(module); +} finally { + window.$RefreshReg$ = prevRefreshReg; + window.$RefreshSig$ = prevRefreshSig; +} +},{"react/jsx-dev-runtime":"iTorj","react":"21dqq","react-bulma-components":"hZ2YC","../components/Editor/Editor.js":"7R39l","../components/Debugger/Debugger.js":"34gdu","../components/Debugger/IO.js":"eyfBa","../components/Debugger/Memory/Memory.js":"kGKoX","../components/Footer.js":"gwJfF","../components/CompilerInfo.js":"fl3NL","./Root.scss":"1d3F3","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"km3Ru"}],"hZ2YC":[function(require,module,exports) { +"use strict"; +function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function _typeof(obj) { + return typeof obj; + }; + else _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + return _typeof(obj); +} +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Box", { + enumerable: true, + get: function get() { + return _box["default"]; + } +}); +Object.defineProperty(exports, "Block", { + enumerable: true, + get: function get() { + return _block["default"]; + } +}); +Object.defineProperty(exports, "Button", { + enumerable: true, + get: function get() { + return _button["default"]; + } +}); +Object.defineProperty(exports, "Breadcrumb", { + enumerable: true, + get: function get() { + return _breadcrumb["default"]; + } +}); +Object.defineProperty(exports, "Card", { + enumerable: true, + get: function get() { + return _card["default"]; + } +}); +Object.defineProperty(exports, "Columns", { + enumerable: true, + get: function get() { + return _columns["default"]; + } +}); +Object.defineProperty(exports, "Container", { + enumerable: true, + get: function get() { + return _container["default"]; + } +}); +Object.defineProperty(exports, "Content", { + enumerable: true, + get: function get() { + return _content["default"]; + } +}); +Object.defineProperty(exports, "Footer", { + enumerable: true, + get: function get() { + return _footer["default"]; + } +}); +Object.defineProperty(exports, "Heading", { + enumerable: true, + get: function get() { + return _heading["default"]; + } +}); +Object.defineProperty(exports, "Hero", { + enumerable: true, + get: function get() { + return _hero["default"]; + } +}); +Object.defineProperty(exports, "Image", { + enumerable: true, + get: function get() { + return _image["default"]; + } +}); +Object.defineProperty(exports, "Level", { + enumerable: true, + get: function get() { + return _level["default"]; + } +}); +Object.defineProperty(exports, "Media", { + enumerable: true, + get: function get() { + return _media["default"]; + } +}); +Object.defineProperty(exports, "Notification", { + enumerable: true, + get: function get() { + return _notification["default"]; + } +}); +Object.defineProperty(exports, "Progress", { + enumerable: true, + get: function get() { + return _progress["default"]; + } +}); +Object.defineProperty(exports, "Section", { + enumerable: true, + get: function get() { + return _section["default"]; + } +}); +Object.defineProperty(exports, "Tabs", { + enumerable: true, + get: function get() { + return _tabs["default"]; + } +}); +Object.defineProperty(exports, "Table", { + enumerable: true, + get: function get() { + return _table["default"]; + } +}); +Object.defineProperty(exports, "Tag", { + enumerable: true, + get: function get() { + return _tag["default"]; + } +}); +Object.defineProperty(exports, "Tile", { + enumerable: true, + get: function get() { + return _tile["default"]; + } +}); +Object.defineProperty(exports, "Modal", { + enumerable: true, + get: function get() { + return _modal["default"]; + } +}); +Object.defineProperty(exports, "Dropdown", { + enumerable: true, + get: function get() { + return _dropdown["default"]; + } +}); +Object.defineProperty(exports, "Icon", { + enumerable: true, + get: function get() { + return _icon["default"]; + } +}); +Object.defineProperty(exports, "Loader", { + enumerable: true, + get: function get() { + return _loader["default"]; + } +}); +Object.defineProperty(exports, "Navbar", { + enumerable: true, + get: function get() { + return _navbar["default"]; + } +}); +Object.defineProperty(exports, "Pagination", { + enumerable: true, + get: function get() { + return _pagination["default"]; + } +}); +Object.defineProperty(exports, "Menu", { + enumerable: true, + get: function get() { + return _menu["default"]; + } +}); +Object.defineProperty(exports, "Message", { + enumerable: true, + get: function get() { + return _message["default"]; + } +}); +Object.defineProperty(exports, "Panel", { + enumerable: true, + get: function get() { + return _panel["default"]; + } +}); +Object.defineProperty(exports, "Element", { + enumerable: true, + get: function get() { + return _element["default"]; + } +}); +exports.Form = void 0; +var Form = _interopRequireWildcard(require("b150c0c61dad6ecf")); +exports.Form = Form; +var _box = _interopRequireDefault(require("b9b483682223eb26")); +var _block = _interopRequireDefault(require("d7173775b32dcf7b")); +var _button = _interopRequireDefault(require("e677deb217dbd64c")); +var _breadcrumb = _interopRequireDefault(require("56151142c3c620b4")); +var _card = _interopRequireDefault(require("96c41bccc40e4c56")); +var _columns = _interopRequireDefault(require("c59cc076c269fd08")); +var _container = _interopRequireDefault(require("c932c67d128e7bd6")); +var _content = _interopRequireDefault(require("122522d849f76076")); +var _footer = _interopRequireDefault(require("6f77699f134477fd")); +var _heading = _interopRequireDefault(require("19110b39d8417c25")); +var _hero = _interopRequireDefault(require("6f94805a36c75eb8")); +var _image = _interopRequireDefault(require("7519040b47b6ae18")); +var _level = _interopRequireDefault(require("664b9d37e36e83f1")); +var _media = _interopRequireDefault(require("1041a118db9227c9")); +var _notification = _interopRequireDefault(require("45fbc3efbf4d69e9")); +var _progress = _interopRequireDefault(require("abc6d653c3b9d99e")); +var _section = _interopRequireDefault(require("dadcf45581305ce1")); +var _tabs = _interopRequireDefault(require("f21604ac510f2ee6")); +var _table = _interopRequireDefault(require("d9cd03b6b6e46463")); +var _tag = _interopRequireDefault(require("d8f8f260c9bea037")); +var _tile = _interopRequireDefault(require("57cbc9c4fcd7d563")); +var _modal = _interopRequireDefault(require("486acef7f519caf7")); +var _dropdown = _interopRequireDefault(require("f408b105d1baf56")); +var _icon = _interopRequireDefault(require("fd918243fc441b33")); +var _loader = _interopRequireDefault(require("614bec74d4d08925")); +var _navbar = _interopRequireDefault(require("aa2b4f15e0f2f4be")); +var _pagination = _interopRequireDefault(require("436793f768e1b733")); +var _menu = _interopRequireDefault(require("35e279b3527a1c60")); +var _message = _interopRequireDefault(require("bf8ecf43539aef38")); +var _panel = _interopRequireDefault(require("5966e3563eca2887")); +var _element = _interopRequireDefault(require("eab273b0d94b95d1")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function _getRequireWildcardCache() { + return cache; + }; + return cache; +} +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) return obj; + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") return { + "default": obj + }; + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) return cache.get(obj); + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + newObj["default"] = obj; + if (cache) cache.set(obj, newObj); + return newObj; +} + +},{"b150c0c61dad6ecf":"29FZf","b9b483682223eb26":"kbdgE","d7173775b32dcf7b":"hr7wK","e677deb217dbd64c":"elCNe","56151142c3c620b4":"3ioo1","96c41bccc40e4c56":"eoDNU","c59cc076c269fd08":"fJGPd","c932c67d128e7bd6":"6T6Qy","122522d849f76076":"1ji1o","6f77699f134477fd":"aqa3C","19110b39d8417c25":"awGb1","6f94805a36c75eb8":"efuZ9","7519040b47b6ae18":"aGfoi","664b9d37e36e83f1":"YRO3f","1041a118db9227c9":"7gl18","45fbc3efbf4d69e9":"4YROs","abc6d653c3b9d99e":"jr1sl","dadcf45581305ce1":"fSgTv","f21604ac510f2ee6":"h8NV1","d9cd03b6b6e46463":"1Yd2w","d8f8f260c9bea037":"h5xW2","57cbc9c4fcd7d563":"bLAfu","486acef7f519caf7":"eiN0t","f408b105d1baf56":"kZqcw","fd918243fc441b33":"2ect1","614bec74d4d08925":"ivtHH","aa2b4f15e0f2f4be":"iKjeP","436793f768e1b733":"ivNbV","35e279b3527a1c60":"cLV0c","bf8ecf43539aef38":"dhuW3","5966e3563eca2887":"cwvGd","eab273b0d94b95d1":"4nSn7"}],"29FZf":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "Field", { + enumerable: true, + get: function get() { + return _field["default"]; + } +}); +Object.defineProperty(exports, "Control", { + enumerable: true, + get: function get() { + return _control["default"]; + } +}); +Object.defineProperty(exports, "Input", { + enumerable: true, + get: function get() { + return _input["default"]; + } +}); +Object.defineProperty(exports, "Label", { + enumerable: true, + get: function get() { + return _label["default"]; + } +}); +Object.defineProperty(exports, "Textarea", { + enumerable: true, + get: function get() { + return _textarea["default"]; + } +}); +Object.defineProperty(exports, "Select", { + enumerable: true, + get: function get() { + return _select["default"]; + } +}); +Object.defineProperty(exports, "Checkbox", { + enumerable: true, + get: function get() { + return _checkbox["default"]; + } +}); +Object.defineProperty(exports, "Radio", { + enumerable: true, + get: function get() { + return _radio["default"]; + } +}); +Object.defineProperty(exports, "Help", { + enumerable: true, + get: function get() { + return _help["default"]; + } +}); +Object.defineProperty(exports, "InputFile", { + enumerable: true, + get: function get() { + return _inputFile["default"]; + } +}); +var _field = _interopRequireDefault(require("b4d3c27e780714d3")); +var _control = _interopRequireDefault(require("f75f95a440818206")); +var _input = _interopRequireDefault(require("20e672248aef797d")); +var _label = _interopRequireDefault(require("8a64b4618b6630f5")); +var _textarea = _interopRequireDefault(require("fcda4d793aea13a6")); +var _select = _interopRequireDefault(require("84ea0155e0f26795")); +var _checkbox = _interopRequireDefault(require("714643c369ea747a")); +var _radio = _interopRequireDefault(require("3aac029dbe553da4")); +var _help = _interopRequireDefault(require("cd426ac6c38f308b")); +var _inputFile = _interopRequireDefault(require("d6781a811e5459cf")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} + +},{"b4d3c27e780714d3":"7N4f8","f75f95a440818206":"8M3j2","20e672248aef797d":"hnGvG","8a64b4618b6630f5":"eQTa9","fcda4d793aea13a6":"hbgM0","84ea0155e0f26795":"fAjvN","714643c369ea747a":"ax048","3aac029dbe553da4":"jOYKl","cd426ac6c38f308b":"c9prQ","d6781a811e5459cf":"fLYTU"}],"7N4f8":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function get() { + return _field["default"]; + } +}); +var _field = _interopRequireDefault(require("9fb65db977c9a599")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} + +},{"9fb65db977c9a599":"8eEW0"}],"8eEW0":[function(require,module,exports) { +"use strict"; +function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function _typeof(obj) { + return typeof obj; + }; + else _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + return _typeof(obj); +} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("902fd2e0df07fc90")); +var _propTypes = _interopRequireDefault(require("74544fc4b0fb11c")); +var _classnames2 = _interopRequireDefault(require("114dff40465a78bb")); +var _fieldLabel = _interopRequireDefault(require("50755bb73787a569")); +var _fieldBody = _interopRequireDefault(require("619235bf803dc8be")); +var _element = _interopRequireDefault(require("ca4ea0bddc06a4f9")); +var _normalizer = require("260ef73702cacd39"); +var _context = _interopRequireWildcard(require("87a6ca198fcf895a")); +function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function _getRequireWildcardCache() { + return cache; + }; + return cache; +} +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) return obj; + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") return { + "default": obj + }; + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) return cache.get(obj); + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + newObj["default"] = obj; + if (cache) cache.set(obj, newObj); + return newObj; +} +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Field = function Field(_ref) { + var _classnames; + var className = _ref.className, align = _ref.align, multiline = _ref.multiline, horizontal = _ref.horizontal, kind = _ref.kind, size = _ref.size, props = _objectWithoutProperties(_ref, [ + "className", + "align", + "multiline", + "horizontal", + "kind", + "size" + ]); + var context = (0, _context["default"])(); + var k = null; + if (kind === "addons") k = "has-addons"; + else if (kind === "group") k = "is-grouped"; + return /*#__PURE__*/ _react["default"].createElement(_context.FieldContext.Provider, { + value: { + size: size || context.size + } + }, /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("field", className, (_classnames = {}, _defineProperty(_classnames, "".concat(k), k), _defineProperty(_classnames, "".concat(k, "-").concat((0, _normalizer.normalizeAlign)(align)), k === "is-grouped" && align), _defineProperty(_classnames, "".concat(k, "-multiline"), k === "is-grouped" && multiline), _defineProperty(_classnames, "is-horizontal", horizontal), _classnames)) + }))); +}; +Field.Label = _fieldLabel["default"]; +Field.Body = _fieldBody["default"]; +Field.defaultProps = {}; +var _default = Field; +exports["default"] = _default; + +},{"902fd2e0df07fc90":"21dqq","74544fc4b0fb11c":"7wKI2","114dff40465a78bb":"aWHjR","50755bb73787a569":"hdSIj","619235bf803dc8be":"3l57V","ca4ea0bddc06a4f9":"4nSn7","260ef73702cacd39":"1hNLM","87a6ca198fcf895a":"kjDej"}],"7wKI2":[function(require,module,exports) { +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ var ReactIs = require("2eadad03a70400f9"); +// By explicitly using `prop-types` you are opting into new development behavior. +// http://fb.me/prop-types-in-prod +var throwOnDirectAccess = true; +module.exports = require("15220c5a5701bab5")(ReactIs.isElement, throwOnDirectAccess); + +},{"2eadad03a70400f9":"7EuwB","15220c5a5701bab5":"bBUgD"}],"7EuwB":[function(require,module,exports) { +"use strict"; +module.exports = require("6ff015adb9ff5ce0"); + +},{"6ff015adb9ff5ce0":"5DsXl"}],"5DsXl":[function(require,module,exports) { +/** @license React v16.13.1 + * react-is.development.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ "use strict"; +(function() { + "use strict"; + // The Symbol used to tag the ReactElement-like types. If there is no native Symbol + // nor polyfill, then a plain number is used for performance. + var hasSymbol = typeof Symbol === "function" && Symbol.for; + var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for("react.element") : 0xeac7; + var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for("react.portal") : 0xeaca; + var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for("react.fragment") : 0xeacb; + var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for("react.strict_mode") : 0xeacc; + var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for("react.profiler") : 0xead2; + var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for("react.provider") : 0xeacd; + var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for("react.context") : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary + // (unstable) APIs that have been removed. Can we remove the symbols? + var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for("react.async_mode") : 0xeacf; + var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for("react.concurrent_mode") : 0xeacf; + var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for("react.forward_ref") : 0xead0; + var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for("react.suspense") : 0xead1; + var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for("react.suspense_list") : 0xead8; + var REACT_MEMO_TYPE = hasSymbol ? Symbol.for("react.memo") : 0xead3; + var REACT_LAZY_TYPE = hasSymbol ? Symbol.for("react.lazy") : 0xead4; + var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for("react.block") : 0xead9; + var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for("react.fundamental") : 0xead5; + var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for("react.responder") : 0xead6; + var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for("react.scope") : 0xead7; + function isValidElementType(type) { + return typeof type === "string" || typeof type === "function" || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. + type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); + } + function typeOf(object) { + if (typeof object === "object" && object !== null) { + var $$typeof = object.$$typeof; + switch($$typeof){ + case REACT_ELEMENT_TYPE: + var type = object.type; + switch(type){ + case REACT_ASYNC_MODE_TYPE: + case REACT_CONCURRENT_MODE_TYPE: + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + return type; + default: + var $$typeofType = type && type.$$typeof; + switch($$typeofType){ + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + default: + return $$typeof; + } + } + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + return undefined; + } // AsyncMode is deprecated along with isAsyncMode + var AsyncMode = REACT_ASYNC_MODE_TYPE; + var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; + var ContextConsumer = REACT_CONTEXT_TYPE; + var ContextProvider = REACT_PROVIDER_TYPE; + var Element = REACT_ELEMENT_TYPE; + var ForwardRef = REACT_FORWARD_REF_TYPE; + var Fragment = REACT_FRAGMENT_TYPE; + var Lazy = REACT_LAZY_TYPE; + var Memo = REACT_MEMO_TYPE; + var Portal = REACT_PORTAL_TYPE; + var Profiler = REACT_PROFILER_TYPE; + var StrictMode = REACT_STRICT_MODE_TYPE; + var Suspense = REACT_SUSPENSE_TYPE; + var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated + function isAsyncMode(object) { + if (!hasWarnedAboutDeprecatedIsAsyncMode) { + hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint + console["warn"]("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API."); + } + return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; + } + function isConcurrentMode(object) { + return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; + } + function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; + } + function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; + } + function isElement(object) { + return typeof object === "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + } + function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; + } + function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; + } + function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; + } + function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; + } + function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; + } + function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; + } + function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; + } + function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; + } + exports.AsyncMode = AsyncMode; + exports.ConcurrentMode = ConcurrentMode; + exports.ContextConsumer = ContextConsumer; + exports.ContextProvider = ContextProvider; + exports.Element = Element; + exports.ForwardRef = ForwardRef; + exports.Fragment = Fragment; + exports.Lazy = Lazy; + exports.Memo = Memo; + exports.Portal = Portal; + exports.Profiler = Profiler; + exports.StrictMode = StrictMode; + exports.Suspense = Suspense; + exports.isAsyncMode = isAsyncMode; + exports.isConcurrentMode = isConcurrentMode; + exports.isContextConsumer = isContextConsumer; + exports.isContextProvider = isContextProvider; + exports.isElement = isElement; + exports.isForwardRef = isForwardRef; + exports.isFragment = isFragment; + exports.isLazy = isLazy; + exports.isMemo = isMemo; + exports.isPortal = isPortal; + exports.isProfiler = isProfiler; + exports.isStrictMode = isStrictMode; + exports.isSuspense = isSuspense; + exports.isValidElementType = isValidElementType; + exports.typeOf = typeOf; +})(); + +},{}],"bBUgD":[function(require,module,exports) { +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ "use strict"; +var ReactIs = require("63a30f1999767f46"); +var assign = require("85f1960b74e60f14"); +var ReactPropTypesSecret = require("b3d50a9286e03b45"); +var has = require("3793fb38396dd080"); +var checkPropTypes = require("a2002651d91a4597"); +var printWarning = function() {}; +printWarning = function(text) { + var message = "Warning: " + text; + if (typeof console !== "undefined") console.error(message); + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} +}; +function emptyFunctionThatReturnsNull() { + return null; +} +module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ var ITERATOR_SYMBOL = typeof Symbol === "function" && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = "@@iterator"; // Before Symbol spec. + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === "function") return iteratorFn; + } + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ var ANONYMOUS = "<>"; + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker("array"), + bigint: createPrimitiveTypeChecker("bigint"), + bool: createPrimitiveTypeChecker("boolean"), + func: createPrimitiveTypeChecker("function"), + number: createPrimitiveTypeChecker("number"), + object: createPrimitiveTypeChecker("object"), + string: createPrimitiveTypeChecker("string"), + symbol: createPrimitiveTypeChecker("symbol"), + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + elementType: createElementTypeTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker, + exact: createStrictShapeTypeChecker + }; + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ /*eslint-disable no-self-compare*/ function is(x, y) { + // SameValue algorithm + if (x === y) // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + else // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + /*eslint-enable no-self-compare*/ /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ function PropTypeError(message, data) { + this.message = message; + this.data = data && typeof data === "object" ? data : {}; + this.stack = ""; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + function createChainableTypeChecker(validate) { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + var err = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types"); + err.name = "Invariant Violation"; + throw err; + } else if (typeof console !== "undefined") { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ":" + propName; + if (!manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3) { + printWarning("You are manually calling a React.PropTypes validation function for the `" + propFullName + "` prop on `" + componentName + "`. This is deprecated " + "and will throw in the standalone `prop-types` package. " + "You may be seeing this warning due to a third-party PropTypes " + "library. See https://fb.me/react-warning-dont-call-proptypes " + "for details."); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required " + ("in `" + componentName + "`, but its value is `null`.")); + return new PropTypeError("The " + location + " `" + propFullName + "` is marked as required in " + ("`" + componentName + "`, but its value is `undefined`.")); + } + return null; + } else return validate(props, propName, componentName, location, propFullName); + } + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + return chainedCheckType; + } + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + preciseType + "` supplied to `" + componentName + "`, expected ") + ("`" + expectedType + "`."), { + expectedType: expectedType + }); + } + return null; + } + return createChainableTypeChecker(validate); + } + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunctionThatReturnsNull); + } + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== "function") return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside arrayOf."); + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an array.")); + } + for(var i = 0; i < propValue.length; i++){ + var error = typeChecker(propValue, i, componentName, location, propFullName + "[" + i + "]", ReactPropTypesSecret); + if (error instanceof Error) return error; + } + return null; + } + return createChainableTypeChecker(validate); + } + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement.")); + } + return null; + } + return createChainableTypeChecker(validate); + } + function createElementTypeTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!ReactIs.isValidElementType(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected a single ReactElement type.")); + } + return null; + } + return createChainableTypeChecker(validate); + } + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + actualClassName + "` supplied to `" + componentName + "`, expected ") + ("instance of `" + expectedClassName + "`.")); + } + return null; + } + return createChainableTypeChecker(validate); + } + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + { + if (arguments.length > 1) printWarning("Invalid arguments supplied to oneOf, expected an array, got " + arguments.length + " arguments. " + "A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."); + else printWarning("Invalid argument supplied to oneOf, expected an array."); + } + return emptyFunctionThatReturnsNull; + } + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for(var i = 0; i < expectedValues.length; i++){ + if (is(propValue, expectedValues[i])) return null; + } + var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { + var type = getPreciseType(value); + if (type === "symbol") return String(value); + return value; + }); + return new PropTypeError("Invalid " + location + " `" + propFullName + "` of value `" + String(propValue) + "` " + ("supplied to `" + componentName + "`, expected one of " + valuesString + ".")); + } + return createChainableTypeChecker(validate); + } + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== "function") return new PropTypeError("Property `" + propFullName + "` of component `" + componentName + "` has invalid PropType notation inside objectOf."); + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type " + ("`" + propType + "` supplied to `" + componentName + "`, expected an object.")); + for(var key in propValue)if (has(propValue, key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret); + if (error instanceof Error) return error; + } + return null; + } + return createChainableTypeChecker(validate); + } + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + printWarning("Invalid argument supplied to oneOfType, expected an instance of array."); + return emptyFunctionThatReturnsNull; + } + for(var i = 0; i < arrayOfTypeCheckers.length; i++){ + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== "function") { + printWarning("Invalid argument supplied to oneOfType. Expected an array of check functions, but received " + getPostfixForTypeWarning(checker) + " at index " + i + "."); + return emptyFunctionThatReturnsNull; + } + } + function validate(props, propName, componentName, location, propFullName) { + var expectedTypes = []; + for(var i = 0; i < arrayOfTypeCheckers.length; i++){ + var checker = arrayOfTypeCheckers[i]; + var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); + if (checkerResult == null) return null; + if (checkerResult.data && has(checkerResult.data, "expectedType")) expectedTypes.push(checkerResult.data.expectedType); + } + var expectedTypesMessage = expectedTypes.length > 0 ? ", expected one of type [" + expectedTypes.join(", ") + "]" : ""; + return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`" + expectedTypesMessage + ".")); + } + return createChainableTypeChecker(validate); + } + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) return new PropTypeError("Invalid " + location + " `" + propFullName + "` supplied to " + ("`" + componentName + "`, expected a ReactNode.")); + return null; + } + return createChainableTypeChecker(validate); + } + function invalidValidatorError(componentName, location, propFullName, key, type) { + return new PropTypeError((componentName || "React class") + ": " + location + " type `" + propFullName + "." + key + "` is invalid; " + "it must be a function, usually from the `prop-types` package, but received `" + type + "`."); + } + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`.")); + for(var key in shapeTypes){ + var checker = shapeTypes[key]; + if (typeof checker !== "function") return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret); + if (error) return error; + } + return null; + } + return createChainableTypeChecker(validate); + } + function createStrictShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== "object") return new PropTypeError("Invalid " + location + " `" + propFullName + "` of type `" + propType + "` " + ("supplied to `" + componentName + "`, expected `object`.")); + // We need to check all keys in case some are required but missing from props. + var allKeys = assign({}, props[propName], shapeTypes); + for(var key in allKeys){ + var checker = shapeTypes[key]; + if (has(shapeTypes, key) && typeof checker !== "function") return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); + if (!checker) return new PropTypeError("Invalid " + location + " `" + propFullName + "` key `" + key + "` supplied to `" + componentName + "`." + "\nBad object: " + JSON.stringify(props[propName], null, " ") + "\nValid keys: " + JSON.stringify(Object.keys(shapeTypes), null, " ")); + var error = checker(propValue, key, componentName, location, propFullName + "." + key, ReactPropTypesSecret); + if (error) return error; + } + return null; + } + return createChainableTypeChecker(validate); + } + function isNode(propValue) { + switch(typeof propValue){ + case "number": + case "string": + case "undefined": + return true; + case "boolean": + return !propValue; + case "object": + if (Array.isArray(propValue)) return propValue.every(isNode); + if (propValue === null || isValidElement(propValue)) return true; + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) while(!(step = iterator.next()).done){ + if (!isNode(step.value)) return false; + } + else // Iterator will provide entry [k,v] tuples rather than values. + while(!(step = iterator.next()).done){ + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) return false; + } + } + } else return false; + return true; + default: + return false; + } + } + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === "symbol") return true; + // falsy value can't be a Symbol + if (!propValue) return false; + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue["@@toStringTag"] === "Symbol") return true; + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === "function" && propValue instanceof Symbol) return true; + return false; + } + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) return "array"; + if (propValue instanceof RegExp) // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return "object"; + if (isSymbol(propType, propValue)) return "symbol"; + return propType; + } + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + if (typeof propValue === "undefined" || propValue === null) return "" + propValue; + var propType = getPropType(propValue); + if (propType === "object") { + if (propValue instanceof Date) return "date"; + else if (propValue instanceof RegExp) return "regexp"; + } + return propType; + } + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch(type){ + case "array": + case "object": + return "an " + type; + case "boolean": + case "date": + case "regexp": + return "a " + type; + default: + return type; + } + } + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) return ANONYMOUS; + return propValue.constructor.name; + } + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; + ReactPropTypes.PropTypes = ReactPropTypes; + return ReactPropTypes; +}; + +},{"63a30f1999767f46":"7EuwB","85f1960b74e60f14":"7OXxh","b3d50a9286e03b45":"jZTZJ","3793fb38396dd080":"fqKuf","a2002651d91a4597":"5VwyJ"}],"jZTZJ":[function(require,module,exports) { +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ "use strict"; +var ReactPropTypesSecret = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"; +module.exports = ReactPropTypesSecret; + +},{}],"fqKuf":[function(require,module,exports) { +module.exports = Function.call.bind(Object.prototype.hasOwnProperty); + +},{}],"5VwyJ":[function(require,module,exports) { +/** + * Copyright (c) 2013-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ "use strict"; +var printWarning = function() {}; +var ReactPropTypesSecret = require("87a94e16cb0a3f89"); +var loggedTypeFailures = {}; +var has = require("a2536d7f032f9f36"); +printWarning = function(text) { + var message = "Warning: " + text; + if (typeof console !== "undefined") console.error(message); + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} +}; +/** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + for(var typeSpecName in typeSpecs)if (has(typeSpecs, typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + if (typeof typeSpecs[typeSpecName] !== "function") { + var err = Error((componentName || "React class") + ": " + location + " type `" + typeSpecName + "` is invalid; " + "it must be a function, usually from the `prop-types` package, but received `" + typeof typeSpecs[typeSpecName] + "`." + "This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); + err.name = "Invariant Violation"; + throw err; + } + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + if (error && !(error instanceof Error)) printWarning((componentName || "React class") + ": type specification of " + location + " `" + typeSpecName + "` is invalid; the type checker " + "function must return `null` or an `Error` but returned a " + typeof error + ". " + "You may have forgotten to pass an argument to the type checker " + "creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and " + "shape all require an argument)."); + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + var stack = getStack ? getStack() : ""; + printWarning("Failed " + location + " type: " + error.message + (stack != null ? stack : "")); + } + } +} +/** + * Resets warning cache when testing. + * + * @private + */ checkPropTypes.resetWarningCache = function() { + loggedTypeFailures = {}; +}; +module.exports = checkPropTypes; + +},{"87a94e16cb0a3f89":"jZTZJ","a2536d7f032f9f36":"fqKuf"}],"aWHjR":[function(require,module,exports) { +/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ /* global define */ (function() { + "use strict"; + var hasOwn = {}.hasOwnProperty; + function classNames() { + var classes = []; + for(var i = 0; i < arguments.length; i++){ + var arg = arguments[i]; + if (!arg) continue; + var argType = typeof arg; + if (argType === "string" || argType === "number") classes.push(arg); + else if (Array.isArray(arg)) { + if (arg.length) { + var inner = classNames.apply(null, arg); + if (inner) classes.push(inner); + } + } else if (argType === "object") { + if (arg.toString === Object.prototype.toString) { + for(var key in arg)if (hasOwn.call(arg, key) && arg[key]) classes.push(key); + } else classes.push(arg.toString()); + } + } + return classes.join(" "); + } + if (0, module.exports) { + classNames.default = classNames; + module.exports = classNames; + } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) // register as 'classnames', consistent with npm package name + define("classnames", [], function() { + return classNames; + }); + else window.classNames = classNames; +})(); + +},{}],"hdSIj":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("f03e5ed82ba9d5d1")); +var _propTypes = _interopRequireDefault(require("a93fa9ffcae06b15")); +var _classnames2 = _interopRequireDefault(require("b28ef7a04ad10f4e")); +var _element = _interopRequireDefault(require("407d061eba54c04b")); +var _context = _interopRequireDefault(require("e986b1ca7eac492b")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var FieldLabel = function FieldLabel(_ref) { + var className = _ref.className, size = _ref.size, props = _objectWithoutProperties(_ref, [ + "className", + "size" + ]); + var context = (0, _context["default"])(); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("field-label", className, _defineProperty({}, "is-".concat(size), size || context.size)) + })); +}; +FieldLabel.defaultProps = {}; +var _default = FieldLabel; +exports["default"] = _default; + +},{"f03e5ed82ba9d5d1":"21dqq","a93fa9ffcae06b15":"7wKI2","b28ef7a04ad10f4e":"aWHjR","407d061eba54c04b":"4nSn7","e986b1ca7eac492b":"kjDej"}],"4nSn7":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _element = _interopRequireDefault(require("145e81d1799114e2")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _element["default"]; +exports["default"] = _default; + +},{"145e81d1799114e2":"dGyAh"}],"dGyAh":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = exports.useElementClassNames = void 0; +var _react = _interopRequireDefault(require("a641910c2f35fea6")); +var _propTypes = _interopRequireDefault(require("53a7ca492999d41c")); +var _classnames3 = _interopRequireDefault(require("d7609bddcd7f6b81")); +var _normalizer = require("c95a1a641f92743a"); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); +} +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; +} +function _iterableToArrayLimit(arr, i) { + var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + var _s, _e; + try { + for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){ + _arr.push(_s.value); + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally{ + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally{ + if (_d) throw _e; + } + } + return _arr; +} +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +var buildResponsiveness = function buildResponsiveness(currentViewport) { + var _classnames; + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, display = _ref.display, textAlign = _ref.textAlign, textSize = _ref.textSize, only = _ref.only, invisible = _ref.invisible; + var suffix = only ? "-only" : ""; + return (0, _classnames3["default"])((_classnames = {}, _defineProperty(_classnames, "is-".concat(display, "-").concat(currentViewport).concat(suffix), display), _defineProperty(_classnames, "has-text-".concat((0, _normalizer.normalizeAlign)(textAlign), "-").concat(currentViewport).concat(suffix), textAlign), _defineProperty(_classnames, "is-size-".concat(textSize, "-").concat(currentViewport).concat(suffix), textSize), _defineProperty(_classnames, "is-invisible-".concat(currentViewport).concat(suffix), invisible), _classnames)); +}; +var useElementClassNames = function useElementClassNames(_ref2) { + var _classnames2; + var textColor = _ref2.textColor, backgroundColor = _ref2.backgroundColor, colorVariant = _ref2.colorVariant, flexDirection = _ref2.flexDirection, flexWrap = _ref2.flexWrap, justifyContent = _ref2.justifyContent, alignContent = _ref2.alignContent, alignItems = _ref2.alignItems, flexGrow = _ref2.flexGrow, ratio = _ref2.ratio, clearfix = _ref2.clearfix, paddingless = _ref2.paddingless, pull = _ref2.pull, marginless = _ref2.marginless, overlay = _ref2.overlay, clipped = _ref2.clipped, radiusless = _ref2.radiusless, shadowless = _ref2.shadowless, unselectable = _ref2.unselectable, invisible = _ref2.invisible, clickable = _ref2.clickable, srOnly = _ref2.srOnly, display = _ref2.display, m = _ref2.m, mt = _ref2.mt, mr = _ref2.mr, mb = _ref2.mb, ml = _ref2.ml, mx = _ref2.mx, my = _ref2.my, p = _ref2.p, pt = _ref2.pt, pr = _ref2.pr, pb = _ref2.pb, pl = _ref2.pl, px = _ref2.px, py = _ref2.py, textWeight = _ref2.textWeight, textTransform = _ref2.textTransform, italic = _ref2.italic, textSize = _ref2.textSize, textAlign = _ref2.textAlign, textFamily = _ref2.textFamily, mobile = _ref2.mobile, tablet = _ref2.tablet, desktop = _ref2.desktop, widescreen = _ref2.widescreen, fullhd = _ref2.fullhd, touch = _ref2.touch, untilWidescreen = _ref2.untilWidescreen, untilFullhd = _ref2.untilFullhd, props = _objectWithoutProperties(_ref2, [ + "textColor", + "backgroundColor", + "colorVariant", + "flexDirection", + "flexWrap", + "justifyContent", + "alignContent", + "alignItems", + "flexGrow", + "ratio", + "clearfix", + "paddingless", + "pull", + "marginless", + "overlay", + "clipped", + "radiusless", + "shadowless", + "unselectable", + "invisible", + "clickable", + "srOnly", + "display", + "m", + "mt", + "mr", + "mb", + "ml", + "mx", + "my", + "p", + "pt", + "pr", + "pb", + "pl", + "px", + "py", + "textWeight", + "textTransform", + "italic", + "textSize", + "textAlign", + "textFamily", + "mobile", + "tablet", + "desktop", + "widescreen", + "fullhd", + "touch", + "untilWidescreen", + "untilFullhd" + ]); + return [ + (0, _classnames3["default"])((_classnames2 = {}, _defineProperty(_classnames2, "has-text-".concat(textColor), textColor), _defineProperty(_classnames2, "has-background-".concat(backgroundColor), backgroundColor), _defineProperty(_classnames2, "is-".concat(colorVariant), colorVariant), _defineProperty(_classnames2, "is-flex-direction-".concat(flexDirection), flexDirection), _defineProperty(_classnames2, "is-flex-wrap-".concat(flexWrap), flexWrap), _defineProperty(_classnames2, "is-justify-content-".concat(justifyContent), justifyContent), _defineProperty(_classnames2, "is-align-content-".concat(alignContent), alignContent), _defineProperty(_classnames2, "is-align-items-".concat(alignItems), alignItems), _defineProperty(_classnames2, "is-flex-grow-".concat(flexGrow), flexGrow), _defineProperty(_classnames2, "is-clearfix", clearfix), _defineProperty(_classnames2, "is-pulled-".concat(pull), pull), _defineProperty(_classnames2, "is-marginless", marginless), _defineProperty(_classnames2, "is-paddingless", paddingless), _defineProperty(_classnames2, "is-overlay", overlay), _defineProperty(_classnames2, "is-clipped", clipped), _defineProperty(_classnames2, "is-radiusless", radiusless), _defineProperty(_classnames2, "is-shadowless", shadowless), _defineProperty(_classnames2, "is-unselectable", unselectable), _defineProperty(_classnames2, "is-".concat(display), display), _defineProperty(_classnames2, "is-invisible", invisible), _defineProperty(_classnames2, "is-sr-only", srOnly), _defineProperty(_classnames2, "is-clickable", clickable), _defineProperty(_classnames2, "m-".concat(m), m), _defineProperty(_classnames2, "mt-".concat(mt), mt), _defineProperty(_classnames2, "mr-".concat(mr), mr), _defineProperty(_classnames2, "mb-".concat(mb), mb), _defineProperty(_classnames2, "ml-".concat(ml), ml), _defineProperty(_classnames2, "mx-".concat(mx), mx), _defineProperty(_classnames2, "my-".concat(my), my), _defineProperty(_classnames2, "p-".concat(p), p), _defineProperty(_classnames2, "pt-".concat(pt), pt), _defineProperty(_classnames2, "pr-".concat(pr), pr), _defineProperty(_classnames2, "pb-".concat(pb), pb), _defineProperty(_classnames2, "pl-".concat(pl), pl), _defineProperty(_classnames2, "px-".concat(px), px), _defineProperty(_classnames2, "py-".concat(py), py), _defineProperty(_classnames2, "has-text-".concat((0, _normalizer.normalizeAlign)(textAlign)), textAlign), _defineProperty(_classnames2, "has-text-weight-".concat(textWeight), textWeight), _defineProperty(_classnames2, "is-size-".concat(textSize), textSize), _defineProperty(_classnames2, "is-".concat(textTransform), textTransform), _defineProperty(_classnames2, "is-family-".concat(textFamily), textFamily), _defineProperty(_classnames2, "is-italic", italic), _classnames2), buildResponsiveness("mobile", mobile), buildResponsiveness("tablet", tablet), buildResponsiveness("desktop", desktop), buildResponsiveness("widescreen", widescreen), buildResponsiveness("fullhd", fullhd), buildResponsiveness("touch", touch), buildResponsiveness("until-widescreen", untilWidescreen), buildResponsiveness("until-fullhd", untilFullhd)), + props + ]; +}; +exports.useElementClassNames = useElementClassNames; +var Element = function Element(_ref3) { + var className = _ref3.className, renderAs = _ref3.renderAs, domRef = _ref3.domRef, children = _ref3.children, allProps = _objectWithoutProperties(_ref3, [ + "className", + "renderAs", + "domRef", + "children" + ]); + var RenderAs = renderAs; + var _useElementClassNames = useElementClassNames(allProps), _useElementClassNames2 = _slicedToArray(_useElementClassNames, 2), classNames = _useElementClassNames2[0], props = _useElementClassNames2[1]; + return /*#__PURE__*/ _react["default"].createElement(RenderAs, _extends({ + ref: domRef, + className: (0, _classnames3["default"])(className, classNames) || undefined + }, props), children); +}; +Element.defaultProps = { + renderAs: "div" +}; +var _default = Element; +exports["default"] = _default; + +},{"a641910c2f35fea6":"21dqq","53a7ca492999d41c":"7wKI2","d7609bddcd7f6b81":"aWHjR","c95a1a641f92743a":"1hNLM"}],"1hNLM":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.normalizeStatus = exports.normalizeAlign = void 0; +var normalizeAlign = function normalizeAlign(align) { + var map = { + justify: "justifyed", + center: "centered" + }; + return map[align] || align; +}; +exports.normalizeAlign = normalizeAlign; +var normalizeStatus = function normalizeStatus(status) { + var map = { + focus: "focused", + hover: "hovered", + active: "active" + }; + return map[status] || status; +}; +exports.normalizeStatus = normalizeStatus; + +},{}],"kjDej":[function(require,module,exports) { +"use strict"; +function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function _typeof(obj) { + return typeof obj; + }; + else _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + return _typeof(obj); +} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = exports.FieldContext = void 0; +var _react = _interopRequireWildcard(require("3825834d194bacb8")); +function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function _getRequireWildcardCache() { + return cache; + }; + return cache; +} +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) return obj; + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") return { + "default": obj + }; + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) return cache.get(obj); + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + newObj["default"] = obj; + if (cache) cache.set(obj, newObj); + return newObj; +} +var FieldContext = /*#__PURE__*/ _react["default"].createContext({ + size: undefined +}); +exports.FieldContext = FieldContext; +var useFieldContext = function useFieldContext() { + return (0, _react.useContext)(FieldContext); +}; +var _default = useFieldContext; +exports["default"] = _default; + +},{"3825834d194bacb8":"21dqq"}],"3l57V":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("c90fffaf68f1d4ca")); +var _classnames = _interopRequireDefault(require("b7723888523d93a0")); +var _element = _interopRequireDefault(require("209439763e829063")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var FieldBody = function FieldBody(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("field-body", className, {}) + }), children); +}; +FieldBody.defaultProps = {}; +var _default = FieldBody; +exports["default"] = _default; + +},{"c90fffaf68f1d4ca":"21dqq","b7723888523d93a0":"aWHjR","209439763e829063":"4nSn7"}],"8M3j2":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("b7e28853e8a58b96")); +var _propTypes = _interopRequireDefault(require("bfc3959e43fd9ae4")); +var _classnames = _interopRequireDefault(require("16cac81edd0fb5cf")); +var _element = _interopRequireDefault(require("657ba12e823c39be")); +var _icon = _interopRequireDefault(require("56d778702aa34ede")); +var _context = _interopRequireDefault(require("ed60abda39a0f8e5")); +var _button = _interopRequireDefault(require("b7859e90f928e51e")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Control = function Control(_ref) { + var children = _ref.children, className = _ref.className, fullwidth = _ref.fullwidth, loading = _ref.loading, iconType = _ref.iconType, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "fullwidth", + "loading", + "iconType" + ]); + var context = (0, _context["default"])(); + var isIcon = function isIcon(child) { + return child.type === (iconType || _icon["default"]) && (child.props.align === "left" || child.props.align === "right"); + }; + var updatedChildren = _react["default"].Children.map(children, function(child) { + if (!child || !isIcon(child) && child.type !== _button["default"]) return child; + return /*#__PURE__*/ _react["default"].cloneElement(child, { + size: child.props.size || context.size + }); + }); + var icons = _react["default"].Children.toArray(updatedChildren).filter(isIcon).reduce(function(acc, icon) { + return { + iconLeft: acc.iconLeft || icon.props.align === "left", + iconRight: acc.iconRight || icon.props.align === "right" + }; + }, { + iconLeft: false, + iconRight: false + }); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("control", className, { + "is-expanded": fullwidth, + "has-icons-left": icons.iconLeft, + "has-icons-right": icons.iconRight, + "is-loading": loading + }) + }), updatedChildren); +}; +Control.defaultProps = {}; +var _default = Control; +exports["default"] = _default; + +},{"b7e28853e8a58b96":"21dqq","bfc3959e43fd9ae4":"7wKI2","16cac81edd0fb5cf":"aWHjR","657ba12e823c39be":"4nSn7","56d778702aa34ede":"2ect1","ed60abda39a0f8e5":"kjDej","b7859e90f928e51e":"elCNe"}],"2ect1":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _icon = _interopRequireDefault(require("8a880c9d9c6e091c")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _icon["default"]; +exports["default"] = _default; + +},{"8a880c9d9c6e091c":"bLVcI"}],"bLVcI":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("18eda76129e4d29d")); +var _propTypes = _interopRequireDefault(require("56665bf64dfcae98")); +var _classnames2 = _interopRequireDefault(require("c71e509a309417b7")); +var _text = _interopRequireDefault(require("73ca2feafa9d07a5")); +var _element = _interopRequireDefault(require("1c45f056222101e7")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Icon = function Icon(_ref) { + var _classnames; + var size = _ref.size, color = _ref.color, className = _ref.className, align = _ref.align, text = _ref.text, props = _objectWithoutProperties(_ref, [ + "size", + "color", + "className", + "align", + "text" + ]); + if (text !== undefined) console.warn("[Deprecation] Text prop for Icon Component its deprecated, please use Icon.Text Component instead"); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])(className, (_classnames = { + icon: !text + }, _defineProperty(_classnames, "is-".concat(size), size), _defineProperty(_classnames, "is-".concat(align), align), _defineProperty(_classnames, "has-text-".concat(color), color), _defineProperty(_classnames, "icon-text", text), _classnames)) + })); +}; +Icon.defaultProps = { + renderAs: "span" +}; +Icon.Text = _text["default"]; +var _default = Icon; +exports["default"] = _default; + +},{"18eda76129e4d29d":"21dqq","56665bf64dfcae98":"7wKI2","c71e509a309417b7":"aWHjR","73ca2feafa9d07a5":"louVS","1c45f056222101e7":"4nSn7"}],"louVS":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _text = _interopRequireDefault(require("94fcb7f59f6add24")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _text["default"]; +exports["default"] = _default; + +},{"94fcb7f59f6add24":"is2bu"}],"is2bu":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("4353b9e68cbf529d")); +var _propTypes = _interopRequireDefault(require("be10adb01d55b6c6")); +var _classnames = _interopRequireDefault(require("16b8e08f403c36ad")); +var _element = _interopRequireDefault(require("f9c371f1d2bc245d")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Text = function Text(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({ + className: (0, _classnames["default"])("icon-text", className) + }, props)); +}; +Text.defaultProps = { + renderAs: "span" +}; +var _default = Text; +exports["default"] = _default; + +},{"4353b9e68cbf529d":"21dqq","be10adb01d55b6c6":"7wKI2","16b8e08f403c36ad":"aWHjR","f9c371f1d2bc245d":"4nSn7"}],"elCNe":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _button = _interopRequireDefault(require("a5b2bee2494c728")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _button["default"]; +exports["default"] = _default; + +},{"a5b2bee2494c728":"dEZve"}],"dEZve":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("4b56fd5f2c2e4c27")); +var _propTypes = _interopRequireDefault(require("2ff40485c4596c09")); +var _classnames2 = _interopRequireDefault(require("c536d4ec254516cb")); +var _buttonGroup = _interopRequireDefault(require("c06b2d78495e7e47")); +var _element = _interopRequireDefault(require("45c03832aeeaf0b5")); +var _normalizer = require("dfd708ad0c59312a"); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Button = function Button(_ref) { + var _classnames; + var children = _ref.children, className = _ref.className, renderAs = _ref.renderAs, color = _ref.color, size = _ref.size, outlined = _ref.outlined, inverted = _ref.inverted, submit = _ref.submit, reset = _ref.reset, fullwidth = _ref.fullwidth, status = _ref.status, loading = _ref.loading, disabled = _ref.disabled, remove = _ref.remove, isSelected = _ref.isSelected, isStatic = _ref.isStatic, rounded = _ref.rounded, onClick = _ref.onClick, text = _ref.text, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "renderAs", + "color", + "size", + "outlined", + "inverted", + "submit", + "reset", + "fullwidth", + "status", + "loading", + "disabled", + "remove", + "isSelected", + "isStatic", + "rounded", + "onClick", + "text" + ]); + var otherProps = {}; + if (submit) otherProps = { + type: "submit", + renderAs: "button" + }; + if (reset) otherProps = { + type: "reset", + renderAs: "button" + }; + if (isStatic) otherProps = { + renderAs: "span" + }; + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({ + tabIndex: disabled ? -1 : 0, + renderAs: renderAs + }, props, otherProps, { + disabled: disabled, + onClick: disabled ? undefined : onClick, + className: (0, _classnames2["default"])(className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(color), color), _defineProperty(_classnames, "is-".concat(size), size), _defineProperty(_classnames, "is-selected", isSelected), _defineProperty(_classnames, "is-static", isStatic), _defineProperty(_classnames, "is-rounded", rounded), _defineProperty(_classnames, "is-outlined", outlined), _defineProperty(_classnames, "is-inverted", inverted), _defineProperty(_classnames, "is-fullwidth", fullwidth), _defineProperty(_classnames, "is-".concat((0, _normalizer.normalizeStatus)(status)), status), _defineProperty(_classnames, "is-loading", loading), _defineProperty(_classnames, "is-text", text), _defineProperty(_classnames, "delete", remove), _defineProperty(_classnames, "button", !remove), _classnames)) + }), children); +}; +Button.Group = _buttonGroup["default"]; +Button.defaultProps = { + renderAs: "button" +}; +var _default = Button; +exports["default"] = _default; + +},{"4b56fd5f2c2e4c27":"21dqq","2ff40485c4596c09":"7wKI2","c536d4ec254516cb":"aWHjR","c06b2d78495e7e47":"15m1t","45c03832aeeaf0b5":"4nSn7","dfd708ad0c59312a":"1hNLM"}],"15m1t":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("8702b78a1da68f20")); +var _propTypes = _interopRequireDefault(require("88f769210de8f620")); +var _classnames2 = _interopRequireDefault(require("9a5f1299e33db9ca")); +var _element = _interopRequireDefault(require("fa57d767f0d8cbc7")); +var _normalizer = require("f2b8296f1ad487d4"); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var ButtonGroup = function ButtonGroup(_ref) { + var _classnames; + var className = _ref.className, hasAddons = _ref.hasAddons, align = _ref.align, size = _ref.size, props = _objectWithoutProperties(_ref, [ + "className", + "hasAddons", + "align", + "size" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("buttons", className, (_classnames = { + "has-addons": hasAddons + }, _defineProperty(_classnames, "is-".concat([ + (0, _normalizer.normalizeAlign)(align) + ]), align), _defineProperty(_classnames, "are-".concat(size), size), _classnames)) + })); +}; +ButtonGroup.defaultProps = { + renderAs: "div" +}; +var _default = ButtonGroup; +exports["default"] = _default; + +},{"8702b78a1da68f20":"21dqq","88f769210de8f620":"7wKI2","9a5f1299e33db9ca":"aWHjR","fa57d767f0d8cbc7":"4nSn7","f2b8296f1ad487d4":"1hNLM"}],"hnGvG":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("e89623ac716d52d5")); +var _propTypes = _interopRequireDefault(require("b7ea50a4aa8a9583")); +var _classnames2 = _interopRequireDefault(require("d4ae40db7e919488")); +var _element = _interopRequireDefault(require("6f6bd4d19ab6bb5e")); +var _context = _interopRequireDefault(require("300ee62450973731")); +var _normalizer = require("78922b28a765f635"); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Input = function Input(_ref) { + var _classnames; + var className = _ref.className, size = _ref.size, color = _ref.color, readOnly = _ref.readOnly, isStatic = _ref.isStatic, status = _ref.status, rounded = _ref.rounded, props = _objectWithoutProperties(_ref, [ + "className", + "size", + "color", + "readOnly", + "isStatic", + "status", + "rounded" + ]); + var context = (0, _context["default"])(); + var calculatedSize = size || context.size; + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + readOnly: readOnly || isStatic, + className: (0, _classnames2["default"])("input", className, (_classnames = { + "is-static": isStatic + }, _defineProperty(_classnames, "is-".concat((0, _normalizer.normalizeStatus)(status)), status), _defineProperty(_classnames, "is-rounded", rounded), _defineProperty(_classnames, "is-".concat(calculatedSize), calculatedSize), _defineProperty(_classnames, "is-".concat(color), color), _classnames)) + })); +}; +Input.defaultProps = { + renderAs: "input" +}; +var _default = Input; +exports["default"] = _default; + +},{"e89623ac716d52d5":"21dqq","b7ea50a4aa8a9583":"7wKI2","d4ae40db7e919488":"aWHjR","6f6bd4d19ab6bb5e":"4nSn7","300ee62450973731":"kjDej","78922b28a765f635":"1hNLM"}],"eQTa9":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("f6cd6ceb72aeb200")); +var _propTypes = _interopRequireDefault(require("3002c8bc2aa76e40")); +var _classnames2 = _interopRequireDefault(require("86875c9466b02c89")); +var _element = _interopRequireDefault(require("9f9454cea10567a5")); +var _context = _interopRequireDefault(require("db4cedca3e456909")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Label = function Label(_ref) { + var children = _ref.children, className = _ref.className, size = _ref.size, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "size" + ]); + var context = (0, _context["default"])(); + var calculatedSize = size || context.size; + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("label", className, _defineProperty({}, "is-".concat(calculatedSize), calculatedSize)) + }), children); +}; +Label.defaultProps = { + renderAs: "label" +}; +var _default = Label; +exports["default"] = _default; + +},{"f6cd6ceb72aeb200":"21dqq","3002c8bc2aa76e40":"7wKI2","86875c9466b02c89":"aWHjR","9f9454cea10567a5":"4nSn7","db4cedca3e456909":"kjDej"}],"hbgM0":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("3736048142da84c9")); +var _propTypes = _interopRequireDefault(require("18bad97c6cdf3077")); +var _classnames2 = _interopRequireDefault(require("dc3efcc557061253")); +var _element = _interopRequireDefault(require("911a303765f29bd2")); +var _context = _interopRequireDefault(require("c718074faf3b9a67")); +var _normalizer = require("8396e05d90d4614e"); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Textarea = function Textarea(_ref) { + var _classnames; + var className = _ref.className, size = _ref.size, color = _ref.color, status = _ref.status, fixedSize = _ref.fixedSize, props = _objectWithoutProperties(_ref, [ + "className", + "size", + "color", + "status", + "fixedSize" + ]); + var context = (0, _context["default"])(); + var calculatedSize = size || context.size; + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("textarea", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat((0, _normalizer.normalizeStatus)(status)), status), _defineProperty(_classnames, "has-fixed-size", fixedSize), _defineProperty(_classnames, "is-".concat(calculatedSize), calculatedSize), _defineProperty(_classnames, "is-".concat(color), color), _classnames)) + })); +}; +Textarea.defaultProps = { + renderAs: "textarea" +}; +var _default = Textarea; +exports["default"] = _default; + +},{"3736048142da84c9":"21dqq","18bad97c6cdf3077":"7wKI2","dc3efcc557061253":"aWHjR","911a303765f29bd2":"4nSn7","c718074faf3b9a67":"kjDej","8396e05d90d4614e":"1hNLM"}],"fAjvN":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("5baf0e0b026d7dda")); +var _propTypes = _interopRequireDefault(require("f87a016cf3c02d57")); +var _classnames3 = _interopRequireDefault(require("e3eb70d07de02fbf")); +var _element = _interopRequireDefault(require("68d15e777cd31a18")); +var _context = _interopRequireDefault(require("2b9c80bfbd58aaa5")); +var _normalizer = require("59926084e6f6348f"); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Select = function Select(_ref) { + var _classnames; + var className = _ref.className, rounded = _ref.rounded, style = _ref.style, size = _ref.size, color = _ref.color, loading = _ref.loading, status = _ref.status, disabled = _ref.disabled, value = _ref.value, multiple = _ref.multiple, children = _ref.children, name = _ref.name, domRef = _ref.domRef, fullwidth = _ref.fullwidth, props = _objectWithoutProperties(_ref, [ + "className", + "rounded", + "style", + "size", + "color", + "loading", + "status", + "disabled", + "value", + "multiple", + "children", + "name", + "domRef", + "fullwidth" + ]); + var context = (0, _context["default"])(); + var calculatedSize = size || context.size; + return /*#__PURE__*/ _react["default"].createElement(_element["default"], { + domRef: domRef, + className: (0, _classnames3["default"])("select", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(calculatedSize), calculatedSize), _defineProperty(_classnames, "is-".concat(color), color), _defineProperty(_classnames, "is-fullwidth", fullwidth), _defineProperty(_classnames, "is-loading", loading), _defineProperty(_classnames, "is-multiple", multiple), _defineProperty(_classnames, "is-rounded", rounded), _classnames)), + style: style + }, /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames3["default"])(_defineProperty({}, "is-".concat((0, _normalizer.normalizeStatus)(status)), status)), + multiple: multiple, + value: value, + disabled: disabled, + name: name + }), children)); +}; +Select.defaultProps = { + renderAs: "select" +}; +var _default = Select; +exports["default"] = _default; + +},{"5baf0e0b026d7dda":"21dqq","f87a016cf3c02d57":"7wKI2","e3eb70d07de02fbf":"aWHjR","68d15e777cd31a18":"4nSn7","2b9c80bfbd58aaa5":"kjDej","59926084e6f6348f":"1hNLM"}],"ax048":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("21f655badb3e3d80")); +var _propTypes = _interopRequireDefault(require("5ef7977b03265d6f")); +var _classnames = _interopRequireDefault(require("5f0bea46a73a27a5")); +var _element = _interopRequireDefault(require("4f7e0b2bde509929")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Checkbox = function Checkbox(_ref) { + var className = _ref.className, style = _ref.style, disabled = _ref.disabled, children = _ref.children, domRef = _ref.domRef, props = _objectWithoutProperties(_ref, [ + "className", + "style", + "disabled", + "children", + "domRef" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], { + renderAs: "label", + domRef: domRef, + disabled: disabled, + className: (0, _classnames["default"])("checkbox", className), + style: style + }, /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({ + type: "checkbox", + disabled: disabled + }, props)), " ", children); +}; +Checkbox.defaultProps = { + renderAs: "input" +}; +var _default = Checkbox; +exports["default"] = _default; + +},{"21f655badb3e3d80":"21dqq","5ef7977b03265d6f":"7wKI2","5f0bea46a73a27a5":"aWHjR","4f7e0b2bde509929":"4nSn7"}],"jOYKl":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("ad9ad7783cf6db27")); +var _propTypes = _interopRequireDefault(require("63b443d41da679f0")); +var _classnames = _interopRequireDefault(require("223b8ad5e1ec2f59")); +var _element = _interopRequireDefault(require("d96497762aa542c4")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Radio = function Radio(_ref) { + var className = _ref.className, style = _ref.style, disabled = _ref.disabled, checked = _ref.checked, value = _ref.value, name = _ref.name, children = _ref.children, domRef = _ref.domRef, props = _objectWithoutProperties(_ref, [ + "className", + "style", + "disabled", + "checked", + "value", + "name", + "children", + "domRef" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], { + renderAs: "label", + domRef: domRef, + disabled: disabled, + className: (0, _classnames["default"])("radio", className), + style: style + }, /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + name: name, + checked: checked, + type: "radio", + value: value, + disabled: disabled + })), " ", children); +}; +Radio.defaultProps = { + renderAs: "input" +}; +var _default = Radio; +exports["default"] = _default; + +},{"ad9ad7783cf6db27":"21dqq","63b443d41da679f0":"7wKI2","223b8ad5e1ec2f59":"aWHjR","d96497762aa542c4":"4nSn7"}],"c9prQ":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("bd7f3de1e438fabb")); +var _propTypes = _interopRequireDefault(require("ee214bf3393be549")); +var _classnames2 = _interopRequireDefault(require("ffd8351273bdae11")); +var _element = _interopRequireDefault(require("c72cbff9a70c85b")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Help = function Help(_ref) { + var className = _ref.className, children = _ref.children, color = _ref.color, props = _objectWithoutProperties(_ref, [ + "className", + "children", + "color" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("help", className, _defineProperty({}, "is-".concat(color), color)) + }), children); +}; +Help.defaultProps = { + renderAs: "p" +}; +var _default = Help; +exports["default"] = _default; + +},{"bd7f3de1e438fabb":"21dqq","ee214bf3393be549":"7wKI2","ffd8351273bdae11":"aWHjR","c72cbff9a70c85b":"4nSn7"}],"fLYTU":[function(require,module,exports) { +"use strict"; +function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function _typeof(obj) { + return typeof obj; + }; + else _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + return _typeof(obj); +} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireWildcard(require("daedfd277218877f")); +var _propTypes = _interopRequireDefault(require("2c24a42a53a56a2")); +var _classnames2 = _interopRequireDefault(require("1ae9298c8b3ce41a")); +var _element = _interopRequireDefault(require("20f70575f2207b11")); +var _context = _interopRequireDefault(require("b6e88a67f1fcc2c2")); +var _normalizer = require("133f8da3867058c9"); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function _getRequireWildcardCache() { + return cache; + }; + return cache; +} +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) return obj; + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") return { + "default": obj + }; + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) return cache.get(obj); + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + newObj["default"] = obj; + if (cache) cache.set(obj, newObj); + return newObj; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var InputFile = function InputFile(_ref) { + var _classnames; + var className = _ref.className, style = _ref.style, onChange = _ref.onChange, color = _ref.color, size = _ref.size, fullwidth = _ref.fullwidth, align = _ref.align, boxed = _ref.boxed, name = _ref.name, label = _ref.label, icon = _ref.icon, inputProps = _ref.inputProps, filename = _ref.filename, value = _ref.value, props = _objectWithoutProperties(_ref, [ + "className", + "style", + "onChange", + "color", + "size", + "fullwidth", + "align", + "boxed", + "name", + "label", + "icon", + "inputProps", + "filename", + "value" + ]); + var ref = (0, _react.useRef)(); + var context = (0, _context["default"])(); + var calculatedSize = size || context.size; + (0, _react.useEffect)(function() { + if (!ref.current) return; + if (value) ref.current.files = value; + else ref.current.value = ""; + }, [ + value + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({ + style: style + }, props, { + className: (0, _classnames2["default"])("file", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(calculatedSize), calculatedSize), _defineProperty(_classnames, "is-".concat(color), color), _defineProperty(_classnames, "is-".concat((0, _normalizer.normalizeAlign)(align)), align), _defineProperty(_classnames, "has-name", !!filename), _defineProperty(_classnames, "is-boxed", boxed), _defineProperty(_classnames, "is-fullwidth", fullwidth), _classnames)) + }), /*#__PURE__*/ _react["default"].createElement("label", { + className: "file-label" + }, /*#__PURE__*/ _react["default"].createElement("input", _extends({}, inputProps, { + name: name, + type: "file", + className: "file-input", + onChange: onChange, + ref: ref + })), /*#__PURE__*/ _react["default"].createElement("span", { + className: "file-cta" + }, icon && /*#__PURE__*/ _react["default"].createElement("span", { + className: "file-icon" + }, icon), /*#__PURE__*/ _react["default"].createElement("span", { + className: "file-label" + }, label)), filename && /*#__PURE__*/ _react["default"].createElement("span", { + className: "file-name" + }, filename))); +}; +InputFile.defaultProps = { + label: "Choose a file...", + inputProps: {} +}; +var _default = InputFile; +exports["default"] = _default; + +},{"daedfd277218877f":"21dqq","2c24a42a53a56a2":"7wKI2","1ae9298c8b3ce41a":"aWHjR","20f70575f2207b11":"4nSn7","b6e88a67f1fcc2c2":"kjDej","133f8da3867058c9":"1hNLM"}],"kbdgE":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _box = _interopRequireDefault(require("40cc5cc0e83ef14f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _box["default"]; +exports["default"] = _default; + +},{"40cc5cc0e83ef14f":"jSNC8"}],"jSNC8":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("449aed8e3cacc311")); +var _classnames = _interopRequireDefault(require("7ece41d99e9168b7")); +var _element = _interopRequireDefault(require("b02dbed8b80f60b1")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Box = function Box(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("box", className) + }), children); +}; +Box.defaultProps = {}; +var _default = Box; +exports["default"] = _default; + +},{"449aed8e3cacc311":"21dqq","7ece41d99e9168b7":"aWHjR","b02dbed8b80f60b1":"4nSn7"}],"hr7wK":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _block = _interopRequireDefault(require("63be22ff68d8b20")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _block["default"]; +exports["default"] = _default; + +},{"63be22ff68d8b20":"53OTL"}],"53OTL":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("3990a1daa8fd62f5")); +var _classnames = _interopRequireDefault(require("49c3e85ff79a64f0")); +var _element = _interopRequireDefault(require("a248381391251e")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Block = function Block(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("block", className) + })); +}; +Block.defaultProps = {}; +var _default = Block; +exports["default"] = _default; + +},{"3990a1daa8fd62f5":"21dqq","49c3e85ff79a64f0":"aWHjR","a248381391251e":"4nSn7"}],"3ioo1":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _breadcrumb = _interopRequireDefault(require("b8e63d5ebff2b07b")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _breadcrumb["default"]; +exports["default"] = _default; + +},{"b8e63d5ebff2b07b":"htPop"}],"htPop":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("9e2cb7b60d5c3714")); +var _propTypes = _interopRequireDefault(require("a83f45b3581cf714")); +var _classnames2 = _interopRequireDefault(require("86a34ea2dc90c021")); +var _element = _interopRequireDefault(require("98c14ea0021e08f")); +var _item = _interopRequireDefault(require("f52cc274ae5c210")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Breadcrumb = function Breadcrumb(_ref) { + var _classnames; + var className = _ref.className, separator = _ref.separator, size = _ref.size, align = _ref.align, children = _ref.children, props = _objectWithoutProperties(_ref, [ + "className", + "separator", + "size", + "align", + "children" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("breadcrumb", className, (_classnames = {}, _defineProperty(_classnames, "has-".concat(separator, "-separator"), separator), _defineProperty(_classnames, "is-".concat(size), size), _defineProperty(_classnames, "is-".concat(align), align), _classnames)) + }), /*#__PURE__*/ _react["default"].createElement("ul", null, children)); +}; +Breadcrumb.Item = _item["default"]; +Breadcrumb.defaultProps = { + separator: undefined, + renderAs: "nav", + size: undefined, + align: undefined +}; +var _default = Breadcrumb; +exports["default"] = _default; + +},{"9e2cb7b60d5c3714":"21dqq","a83f45b3581cf714":"7wKI2","86a34ea2dc90c021":"aWHjR","98c14ea0021e08f":"4nSn7","f52cc274ae5c210":"e67xG"}],"e67xG":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("71a24099cc941ba9")); +var _propTypes = _interopRequireDefault(require("f9af502ee4fe9c87")); +var _classnames = _interopRequireDefault(require("c18add9a1cf7fe09")); +var _element = _interopRequireDefault(require("49e09eab99f0f44d")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var BreadcrumbItem = function BreadcrumbItem(_ref) { + var className = _ref.className, active = _ref.active, children = _ref.children, props = _objectWithoutProperties(_ref, [ + "className", + "active", + "children" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])(className, { + "is-active": active + }) + }), children); +}; +BreadcrumbItem.defaultProps = { + renderAs: "li" +}; +var _default = BreadcrumbItem; +exports["default"] = _default; + +},{"71a24099cc941ba9":"21dqq","f9af502ee4fe9c87":"7wKI2","c18add9a1cf7fe09":"aWHjR","49e09eab99f0f44d":"4nSn7"}],"eoDNU":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _card = _interopRequireDefault(require("793407fad787756c")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _card["default"]; +exports["default"] = _default; + +},{"793407fad787756c":"eWOZ2"}],"eWOZ2":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("72aef844a89f0803")); +var _classnames = _interopRequireDefault(require("ea9532b97f186253")); +var _image = _interopRequireDefault(require("7e36ea36dc56e251")); +var _content = _interopRequireDefault(require("24530db03685410c")); +var _header = _interopRequireDefault(require("b7ba18ce5ad39173")); +var _footer = _interopRequireDefault(require("348c34e52072e607")); +var _element = _interopRequireDefault(require("f0eea9bc9b9cad5")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Card = function Card(_ref) { + var className = _ref.className, children = _ref.children, props = _objectWithoutProperties(_ref, [ + "className", + "children" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({ + className: (0, _classnames["default"])("card", className) + }, props), children); +}; +Card.Image = _image["default"]; +Card.Content = _content["default"]; +Card.Header = _header["default"]; +Card.Footer = _footer["default"]; +Card.defaultProps = {}; +var _default = Card; +exports["default"] = _default; + +},{"72aef844a89f0803":"21dqq","ea9532b97f186253":"aWHjR","7e36ea36dc56e251":"d3HdK","24530db03685410c":"hTON0","b7ba18ce5ad39173":"fuqbK","348c34e52072e607":"iWqS5","f0eea9bc9b9cad5":"4nSn7"}],"d3HdK":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("5f7a7dffa2e226f8")); +var _classnames = _interopRequireDefault(require("70507e3305a8417")); +var _image = _interopRequireDefault(require("dd5cb980efce9618")); +var _element = _interopRequireDefault(require("190716dd0c66701c")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var CardImage = function CardImage(_ref) { + var className = _ref.className, domRef = _ref.domRef, props = _objectWithoutProperties(_ref, [ + "className", + "domRef" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], { + domRef: domRef, + className: (0, _classnames["default"])("card-image", className) + }, /*#__PURE__*/ _react["default"].createElement(_image["default"], props)); +}; +CardImage.defaultProps = {}; +var _default = CardImage; +exports["default"] = _default; + +},{"5f7a7dffa2e226f8":"21dqq","70507e3305a8417":"aWHjR","dd5cb980efce9618":"aGfoi","190716dd0c66701c":"4nSn7"}],"aGfoi":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _image = _interopRequireDefault(require("419a470f8b59507")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _image["default"]; +exports["default"] = _default; + +},{"419a470f8b59507":"ktMZi"}],"ktMZi":[function(require,module,exports) { +"use strict"; +function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function _typeof(obj) { + return typeof obj; + }; + else _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + return _typeof(obj); +} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireWildcard(require("c68647ed62ccbe97")); +var _propTypes = _interopRequireDefault(require("3e99c79ecb1d4d79")); +var _classnames2 = _interopRequireDefault(require("690a0703bff39a26")); +var _element = _interopRequireDefault(require("f291bdf781f36da4")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function _getRequireWildcardCache() { + return cache; + }; + return cache; +} +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) return obj; + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") return { + "default": obj + }; + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) return cache.get(obj); + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + newObj["default"] = obj; + if (cache) cache.set(obj, newObj); + return newObj; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); +} +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; +} +function _iterableToArrayLimit(arr, i) { + var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + var _s, _e; + try { + for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){ + _arr.push(_s.value); + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally{ + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally{ + if (_d) throw _e; + } + } + return _arr; +} +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Image = function Image(_ref) { + var _classnames; + var className = _ref.className, alt = _ref.alt, size = _ref.size, fallback = _ref.fallback, rounded = _ref.rounded, src = _ref.src, fullwidth = _ref.fullwidth, props = _objectWithoutProperties(_ref, [ + "className", + "alt", + "size", + "fallback", + "rounded", + "src", + "fullwidth" + ]); + var _useState = (0, _react.useState)({ + src: src + }), _useState2 = _slicedToArray(_useState, 2), state = _useState2[0], setState = _useState2[1]; + (0, _react.useEffect)(function() { + setState({ + src: src + }); + }, [ + src + ]); + var s = size; + if (typeof size === "number") s = "".concat(s, "x").concat(s); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("image", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(s), s), _defineProperty(_classnames, "is-fullwidth", fullwidth), _classnames)) + }), /*#__PURE__*/ _react["default"].createElement("img", { + className: (0, _classnames2["default"])({ + "is-rounded": rounded + }), + onError: function onError() { + return state.src !== fallback && setState({ + src: fallback + }); + }, + src: state.src, + alt: alt + })); +}; +Image.defaultProps = { + renderAs: "figure" +}; +var _default = Image; +exports["default"] = _default; + +},{"c68647ed62ccbe97":"21dqq","3e99c79ecb1d4d79":"7wKI2","690a0703bff39a26":"aWHjR","f291bdf781f36da4":"4nSn7"}],"hTON0":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("6307712e0589e65")); +var _classnames = _interopRequireDefault(require("f573009cac0eb59f")); +var _element = _interopRequireDefault(require("139c19d633c1595e")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var CardContent = function CardContent(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("card-content", className) + })); +}; +CardContent.defaultProps = {}; +var _default = CardContent; +exports["default"] = _default; + +},{"6307712e0589e65":"21dqq","f573009cac0eb59f":"aWHjR","139c19d633c1595e":"4nSn7"}],"fuqbK":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function get() { + return _header["default"]; + } +}); +var _header = _interopRequireDefault(require("4956707f738549f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} + +},{"4956707f738549f":"cnQ4V"}],"cnQ4V":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("6c16356c84038bd7")); +var _classnames = _interopRequireDefault(require("265955a4ef64739c")); +var _headerTitle = _interopRequireDefault(require("618dc6733021e85d")); +var _headerIcon = _interopRequireDefault(require("84f6493ca57384ba")); +var _element = _interopRequireDefault(require("23bf478c6628cd9a")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var CardHeader = function CardHeader(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("card-header", className) + })); +}; +CardHeader.Title = _headerTitle["default"]; +CardHeader.Icon = _headerIcon["default"]; +CardHeader.defaultProps = {}; +var _default = CardHeader; +exports["default"] = _default; + +},{"6c16356c84038bd7":"21dqq","265955a4ef64739c":"aWHjR","618dc6733021e85d":"96wAx","84f6493ca57384ba":"kaLyi","23bf478c6628cd9a":"4nSn7"}],"96wAx":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("35ce45ce3538fcc5")); +var _classnames = _interopRequireDefault(require("8bafd76222462959")); +var _element = _interopRequireDefault(require("84b4a908e6d15347")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var CardHeaderTitle = function CardHeaderTitle(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("card-header-title", className) + })); +}; +CardHeaderTitle.defaultProps = {}; +var _default = CardHeaderTitle; +exports["default"] = _default; + +},{"35ce45ce3538fcc5":"21dqq","8bafd76222462959":"aWHjR","84b4a908e6d15347":"4nSn7"}],"kaLyi":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("2ba0d4260a59572d")); +var _classnames = _interopRequireDefault(require("1fef280209d2dc0b")); +var _element = _interopRequireDefault(require("755f29e36bdbc401")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var CardHeaderIcon = function CardHeaderIcon(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("card-header-icon", className) + })); +}; +CardHeaderIcon.defaultProps = {}; +var _default = CardHeaderIcon; +exports["default"] = _default; + +},{"2ba0d4260a59572d":"21dqq","1fef280209d2dc0b":"aWHjR","755f29e36bdbc401":"4nSn7"}],"iWqS5":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function get() { + return _footer["default"]; + } +}); +var _footer = _interopRequireDefault(require("18d9288332511d3e")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} + +},{"18d9288332511d3e":"7YPOC"}],"7YPOC":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("7e388f37e765a194")); +var _classnames = _interopRequireDefault(require("a5d5e5e2c2ef88d3")); +var _footerItem = _interopRequireDefault(require("fcd482684f56ae33")); +var _element = _interopRequireDefault(require("9845723869611efc")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var CardFooter = function CardFooter(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("card-footer", className) + })); +}; +CardFooter.Item = _footerItem["default"]; +CardFooter.defaultProps = {}; +var _default = CardFooter; +exports["default"] = _default; + +},{"7e388f37e765a194":"21dqq","a5d5e5e2c2ef88d3":"aWHjR","fcd482684f56ae33":"kx4W4","9845723869611efc":"4nSn7"}],"kx4W4":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("acb0b34271002015")); +var _classnames = _interopRequireDefault(require("1c226693c1c7fa1d")); +var _element = _interopRequireDefault(require("729df98d793432d0")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var CardFooterItem = function CardFooterItem(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("card-footer-item", className) + })); +}; +CardFooterItem.defaultProps = {}; +var _default = CardFooterItem; +exports["default"] = _default; + +},{"acb0b34271002015":"21dqq","1c226693c1c7fa1d":"aWHjR","729df98d793432d0":"4nSn7"}],"fJGPd":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _columns = _interopRequireDefault(require("a4297390ed2b6ed5")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _columns["default"]; +exports["default"] = _default; + +},{"a4297390ed2b6ed5":"gAb4W"}],"gAb4W":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("f2c616ae6d4d1968")); +var _propTypes = _interopRequireDefault(require("a65c053251455f39")); +var _classnames = _interopRequireDefault(require("f2bf4b6c38b50750")); +var _column = _interopRequireDefault(require("d422e81483131e92")); +var _constants = _interopRequireDefault(require("5615d7d69bc5f5f4")); +var _element = _interopRequireDefault(require("648c5830569d9fd2")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Columns = function Columns(_ref) { + var _classNames; + var className = _ref.className, breakpoint = _ref.breakpoint, gap = _ref.gap, multiline = _ref.multiline, centered = _ref.centered, vCentered = _ref.vCentered, variableGap = _ref.variableGap, _ref$mobile = _ref.mobile, mobile = _ref$mobile === void 0 ? {} : _ref$mobile, _ref$tablet = _ref.tablet, tablet = _ref$tablet === void 0 ? {} : _ref$tablet, _ref$desktop = _ref.desktop, desktop = _ref$desktop === void 0 ? {} : _ref$desktop, _ref$widescreen = _ref.widescreen, widescreen = _ref$widescreen === void 0 ? {} : _ref$widescreen, _ref$fullhd = _ref.fullhd, fullhd = _ref$fullhd === void 0 ? {} : _ref$fullhd, _ref$touch = _ref.touch, touch = _ref$touch === void 0 ? {} : _ref$touch, props = _objectWithoutProperties(_ref, [ + "className", + "breakpoint", + "gap", + "multiline", + "centered", + "vCentered", + "variableGap", + "mobile", + "tablet", + "desktop", + "widescreen", + "fullhd", + "touch" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + mobile: mobile, + tablet: tablet, + desktop: desktop, + widescreen: widescreen, + fullhd: fullhd, + touch: touch, + className: (0, _classnames["default"])(className, "columns", (_classNames = {}, _defineProperty(_classNames, "is-".concat(breakpoint), breakpoint), _defineProperty(_classNames, "is-".concat(gap), gap !== undefined), _defineProperty(_classNames, "is-multiline", multiline), _defineProperty(_classNames, "is-centered", centered), _defineProperty(_classNames, "is-vcentered", vCentered), _defineProperty(_classNames, "is-variable", gap !== undefined || [ + touch, + mobile, + tablet, + desktop, + widescreen, + fullhd + ].find(function(b) { + return b.gap !== undefined; + })), _defineProperty(_classNames, "is-".concat(touch.gap, "-touch"), touch.gap !== undefined), _defineProperty(_classNames, "is-".concat(mobile.gap, "-mobile"), mobile.gap !== undefined), _defineProperty(_classNames, "is-".concat(tablet.gap, "-tablet"), tablet.gap !== undefined), _defineProperty(_classNames, "is-".concat(desktop.gap, "-desktop"), desktop.gap !== undefined), _defineProperty(_classNames, "is-".concat(widescreen.gap, "-widescreen"), widescreen.gap !== undefined), _defineProperty(_classNames, "is-".concat(fullhd.gap, "-fullhd"), fullhd.gap !== undefined), _classNames)) + })); +}; +Columns.Column = _column["default"]; +Columns.CONSTANTS = _constants["default"]; +Columns.defaultProps = { + multiline: true +}; +var _default = Columns; +exports["default"] = _default; + +},{"f2c616ae6d4d1968":"21dqq","a65c053251455f39":"7wKI2","f2bf4b6c38b50750":"aWHjR","d422e81483131e92":"7s35v","5615d7d69bc5f5f4":"jhKgS","648c5830569d9fd2":"4nSn7"}],"7s35v":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("6ba8ce2b5265cf7e")); +var _propTypes = _interopRequireDefault(require("ffa6358ba9b5fa3a")); +var _classnames = _interopRequireDefault(require("bf842e4bc170d7c1")); +var _element = _interopRequireDefault(require("7948244c31c834fb")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Column = function Column(_ref) { + var _classNames; + var children = _ref.children, className = _ref.className, size = _ref.size, offset = _ref.offset, narrow = _ref.narrow, _ref$mobile = _ref.mobile, mobile = _ref$mobile === void 0 ? {} : _ref$mobile, _ref$tablet = _ref.tablet, tablet = _ref$tablet === void 0 ? {} : _ref$tablet, _ref$desktop = _ref.desktop, desktop = _ref$desktop === void 0 ? {} : _ref$desktop, _ref$widescreen = _ref.widescreen, widescreen = _ref$widescreen === void 0 ? {} : _ref$widescreen, _ref$fullhd = _ref.fullhd, fullhd = _ref$fullhd === void 0 ? {} : _ref$fullhd, _ref$touch = _ref.touch, touch = _ref$touch === void 0 ? {} : _ref$touch, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "size", + "offset", + "narrow", + "mobile", + "tablet", + "desktop", + "widescreen", + "fullhd", + "touch" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + mobile: mobile, + tablet: tablet, + desktop: desktop, + widescreen: widescreen, + fullhd: fullhd, + touch: touch, + className: (0, _classnames["default"])(className, "column", (_classNames = {}, _defineProperty(_classNames, "is-".concat(size), size), _defineProperty(_classNames, "is-".concat(touch.size, "-mobile"), touch.size), _defineProperty(_classNames, "is-".concat(mobile.size, "-mobile"), mobile.size), _defineProperty(_classNames, "is-".concat(tablet.size, "-tablet"), tablet.size), _defineProperty(_classNames, "is-".concat(desktop.size, "-desktop"), desktop.size), _defineProperty(_classNames, "is-".concat(widescreen.size, "-widescreen"), widescreen.size), _defineProperty(_classNames, "is-".concat(fullhd.size, "-fullhd"), fullhd.size), _defineProperty(_classNames, "is-offset-".concat(touch.offset, "-mobile"), touch.offset), _defineProperty(_classNames, "is-offset-".concat(mobile.offset, "-mobile"), mobile.offset), _defineProperty(_classNames, "is-offset-".concat(tablet.offset, "-tablet"), tablet.offset), _defineProperty(_classNames, "is-offset-".concat(desktop.offset, "-desktop"), desktop.offset), _defineProperty(_classNames, "is-offset-".concat(widescreen.offset, "-widescreen"), widescreen.offset), _defineProperty(_classNames, "is-offset-".concat(fullhd.offset, "-fullhd"), fullhd.offset), _defineProperty(_classNames, "is-offset-".concat(offset), offset), _defineProperty(_classNames, "is-narrow", narrow), _defineProperty(_classNames, "is-narrow-touch", touch.narrow), _defineProperty(_classNames, "is-narrow-mobile", mobile.narrow), _defineProperty(_classNames, "is-narrow-tablet", tablet.narrow), _defineProperty(_classNames, "is-narrow-desktop", desktop.narrow), _defineProperty(_classNames, "is-narrow-widescreen", widescreen.narrow), _defineProperty(_classNames, "is-narrow-fullhd", fullhd.narrow), _classNames)) + }), children); +}; +Column.defaultProps = {}; +var _default = Column; +exports["default"] = _default; + +},{"6ba8ce2b5265cf7e":"21dqq","ffa6358ba9b5fa3a":"7wKI2","bf842e4bc170d7c1":"aWHjR","7948244c31c834fb":"4nSn7"}],"jhKgS":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _default = { + SIZES: { + THREEQUARTERS: "three-quarters", + TWOTHIRDS: "two-thirds", + HALF: "half", + ONETHIRD: "one-third", + ONEQUARTER: "one-quarter", + ONEFIFTH: "one-fifth", + TWOFIFTHS: "two-fifths", + THREEFIFTHS: "three-fifths", + FOURFIFTHS: "four-fifths" + } +}; +exports["default"] = _default; + +},{}],"6T6Qy":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _container = _interopRequireDefault(require("40e8f366d4be9feb")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _container["default"]; +exports["default"] = _default; + +},{"40e8f366d4be9feb":"cBFYL"}],"cBFYL":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("c538be2cbdbe844a")); +var _propTypes = _interopRequireDefault(require("b292ca4ed4306f3d")); +var _classnames2 = _interopRequireDefault(require("b210880bdf51f2b6")); +var _element = _interopRequireDefault(require("25d2b30244aed7f0")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Container = function Container(_ref) { + var children = _ref.children, max = _ref.max, breakpoint = _ref.breakpoint, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "max", + "breakpoint", + "className" + ]); + var canSetMax = [ + "desktop", + "widescreen" + ].includes(breakpoint); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("container", className, _defineProperty({}, "is-".concat(canSetMax && max ? "max-" : "").concat(breakpoint), breakpoint)) + }), children); +}; +Container.defaultProps = {}; +var _default = Container; +exports["default"] = _default; + +},{"c538be2cbdbe844a":"21dqq","b292ca4ed4306f3d":"7wKI2","b210880bdf51f2b6":"aWHjR","25d2b30244aed7f0":"4nSn7"}],"1ji1o":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _content = _interopRequireDefault(require("68abf08674b0a575")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _content["default"]; +exports["default"] = _default; + +},{"68abf08674b0a575":"ilijT"}],"ilijT":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("62aadb62531ed9ee")); +var _propTypes = _interopRequireDefault(require("8aa86732b1a73d6")); +var _classnames2 = _interopRequireDefault(require("a94833b6468dc8e9")); +var _element = _interopRequireDefault(require("87c113e115abe875")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Content = function Content(_ref) { + var children = _ref.children, className = _ref.className, size = _ref.size, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "size" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("content", className, _defineProperty({}, "is-".concat(size), size)) + }), children); +}; +Content.defaultProps = {}; +var _default = Content; +exports["default"] = _default; + +},{"62aadb62531ed9ee":"21dqq","8aa86732b1a73d6":"7wKI2","a94833b6468dc8e9":"aWHjR","87c113e115abe875":"4nSn7"}],"aqa3C":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _footer = _interopRequireDefault(require("6dedd04ccc01c72c")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _footer["default"]; +exports["default"] = _default; + +},{"6dedd04ccc01c72c":"hGcYu"}],"hGcYu":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("c7217756d6459e1e")); +var _propTypes = _interopRequireDefault(require("62062a054bc9c507")); +var _classnames = _interopRequireDefault(require("cf2c890f21e2deff")); +var _element = _interopRequireDefault(require("25a026fd85514198")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Footer = function Footer(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("footer", className) + })); +}; +Footer.defaultProps = { + renderAs: "footer" +}; +var _default = Footer; +exports["default"] = _default; + +},{"c7217756d6459e1e":"21dqq","62062a054bc9c507":"7wKI2","cf2c890f21e2deff":"aWHjR","25a026fd85514198":"4nSn7"}],"awGb1":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _heading = _interopRequireDefault(require("ded315d87b3d650a")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _heading["default"]; +exports["default"] = _default; + +},{"ded315d87b3d650a":"ar6gm"}],"ar6gm":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("57d431315e8fd85e")); +var _propTypes = _interopRequireDefault(require("59967d071208fa97")); +var _classnames2 = _interopRequireDefault(require("36187cb795bded24")); +var _element = _interopRequireDefault(require("113b2a083e8a9060")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Heading = function Heading(_ref) { + var _classnames; + var children = _ref.children, className = _ref.className, size = _ref.size, subtitle = _ref.subtitle, weight = _ref.weight, spaced = _ref.spaced, heading = _ref.heading, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "size", + "subtitle", + "weight", + "spaced", + "heading" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])(className, (_classnames = { + title: !subtitle && !heading, + subtitle: subtitle, + heading: heading + }, _defineProperty(_classnames, "is-".concat(size), size), _defineProperty(_classnames, "has-text-weight-".concat(weight), weight), _defineProperty(_classnames, "is-spaced", spaced && !subtitle), _classnames)) + }), children); +}; +Heading.defaultProps = { + renderAs: "h1" +}; +var _default = Heading; +exports["default"] = _default; + +},{"57d431315e8fd85e":"21dqq","59967d071208fa97":"7wKI2","36187cb795bded24":"aWHjR","113b2a083e8a9060":"4nSn7"}],"efuZ9":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _hero = _interopRequireDefault(require("25648230752e5987")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _hero["default"]; +exports["default"] = _default; + +},{"25648230752e5987":"8UDip"}],"8UDip":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("37387fe6e61bad05")); +var _propTypes = _interopRequireDefault(require("347b9cc7a5f30c18")); +var _classnames2 = _interopRequireDefault(require("a0bafb0b62e6fa0e")); +var _heroHeader = _interopRequireDefault(require("d2a7a6187ee73e6c")); +var _heroBody = _interopRequireDefault(require("c72a991a0872340e")); +var _heroFooter = _interopRequireDefault(require("b4fdaa2a6a76ba8c")); +var _element = _interopRequireDefault(require("4cbaa3695e8f6dd0")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Hero = function Hero(_ref) { + var _classnames; + var children = _ref.children, className = _ref.className, color = _ref.color, gradient = _ref.gradient, size = _ref.size, hasNavbar = _ref.hasNavbar, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "color", + "gradient", + "size", + "hasNavbar" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("hero", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(color), color), _defineProperty(_classnames, "is-".concat(size), size && !hasNavbar), _defineProperty(_classnames, "is-bold", gradient), _defineProperty(_classnames, "is-fullheight-with-navbar", hasNavbar), _classnames)) + }), children); +}; +Hero.Header = _heroHeader["default"]; +Hero.Body = _heroBody["default"]; +Hero.Footer = _heroFooter["default"]; +Hero.defaultProps = { + renderAs: "section" +}; +var _default = Hero; +exports["default"] = _default; + +},{"37387fe6e61bad05":"21dqq","347b9cc7a5f30c18":"7wKI2","a0bafb0b62e6fa0e":"aWHjR","d2a7a6187ee73e6c":"lEpHn","c72a991a0872340e":"50H4s","b4fdaa2a6a76ba8c":"dF8rU","4cbaa3695e8f6dd0":"4nSn7"}],"lEpHn":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("64e52f39a02f9a83")); +var _propTypes = _interopRequireDefault(require("75a95c35c74a3241")); +var _classnames = _interopRequireDefault(require("194a36b3f9e6f52d")); +var _element = _interopRequireDefault(require("15ab3fb8bfcdcb7e")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var HeroHeader = function HeroHeader(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])(className, "hero-head") + })); +}; +HeroHeader.defaultProps = { + renderAs: "header" +}; +var _default = HeroHeader; +exports["default"] = _default; + +},{"64e52f39a02f9a83":"21dqq","75a95c35c74a3241":"7wKI2","194a36b3f9e6f52d":"aWHjR","15ab3fb8bfcdcb7e":"4nSn7"}],"50H4s":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("f3454cdecd4a06d6")); +var _propTypes = _interopRequireDefault(require("b87e8f800056096f")); +var _classnames = _interopRequireDefault(require("adf667f6af8f1e2f")); +var _element = _interopRequireDefault(require("f6d68ed6c0314371")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var HeroBody = function HeroBody(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])(className, "hero-body") + })); +}; +HeroBody.defaultProps = { + renderAs: "div" +}; +var _default = HeroBody; +exports["default"] = _default; + +},{"f3454cdecd4a06d6":"21dqq","b87e8f800056096f":"7wKI2","adf667f6af8f1e2f":"aWHjR","f6d68ed6c0314371":"4nSn7"}],"dF8rU":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("3b6d45906e087309")); +var _propTypes = _interopRequireDefault(require("13d0760acc651af9")); +var _classnames = _interopRequireDefault(require("b282f414ff9c9d45")); +var _element = _interopRequireDefault(require("cf983c68091323c5")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var HeroFooter = function HeroFooter(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])(className, "hero-foot") + })); +}; +HeroFooter.defaultProps = { + renderAs: "footer" +}; +var _default = HeroFooter; +exports["default"] = _default; + +},{"3b6d45906e087309":"21dqq","13d0760acc651af9":"7wKI2","b282f414ff9c9d45":"aWHjR","cf983c68091323c5":"4nSn7"}],"YRO3f":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _level = _interopRequireDefault(require("6541ca3aa6a482f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _level["default"]; +exports["default"] = _default; + +},{"6541ca3aa6a482f":"9mLVm"}],"9mLVm":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("a3edcd2b78d6be7f")); +var _propTypes = _interopRequireDefault(require("cb86e4c1986259ee")); +var _classnames2 = _interopRequireDefault(require("c4dfa715e545ab69")); +var _levelSide = _interopRequireDefault(require("5b5217a495c81169")); +var _levelItem = _interopRequireDefault(require("dd087c250aac3a7a")); +var _element = _interopRequireDefault(require("d1263d55624a6a5d")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Level = function Level(_ref) { + var children = _ref.children, className = _ref.className, breakpoint = _ref.breakpoint, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "breakpoint" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("level", className, _defineProperty({}, "is-".concat(breakpoint), breakpoint)) + }), children); +}; +Level.Side = _levelSide["default"]; +Level.Item = _levelItem["default"]; +Level.defaultProps = { + renderAs: "nav" +}; +var _default = Level; +exports["default"] = _default; + +},{"a3edcd2b78d6be7f":"21dqq","cb86e4c1986259ee":"7wKI2","c4dfa715e545ab69":"aWHjR","5b5217a495c81169":"960FZ","dd087c250aac3a7a":"bOw8M","d1263d55624a6a5d":"4nSn7"}],"960FZ":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("feb0075d656bf08d")); +var _propTypes = _interopRequireDefault(require("e31e9d5cb4ebf296")); +var _classnames2 = _interopRequireDefault(require("4401ee8997e89932")); +var _element = _interopRequireDefault(require("5fa62f199414ffb9")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var LevelSide = function LevelSide(_ref) { + var className = _ref.className, align = _ref.align, props = _objectWithoutProperties(_ref, [ + "className", + "align" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])(className, _defineProperty({}, "level-".concat(align), align)) + })); +}; +LevelSide.defaultProps = { + align: "left" +}; +var _default = LevelSide; +exports["default"] = _default; + +},{"feb0075d656bf08d":"21dqq","e31e9d5cb4ebf296":"7wKI2","4401ee8997e89932":"aWHjR","5fa62f199414ffb9":"4nSn7"}],"bOw8M":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("7d5a784d2ff62302")); +var _classnames = _interopRequireDefault(require("fece2c88978fbc54")); +var _element = _interopRequireDefault(require("412c610fb9c0bd6f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var LevelItem = function LevelItem(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("level-item", className, {}) + }), children); +}; +var _default = LevelItem; +exports["default"] = _default; + +},{"7d5a784d2ff62302":"21dqq","fece2c88978fbc54":"aWHjR","412c610fb9c0bd6f":"4nSn7"}],"7gl18":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _media = _interopRequireDefault(require("b650e3a2cbe882ff")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _media["default"]; +exports["default"] = _default; + +},{"b650e3a2cbe882ff":"fRFGd"}],"fRFGd":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("5ef2f8e484eb4a16")); +var _propTypes = _interopRequireDefault(require("d2f2742aa4a0ccfa")); +var _classnames = _interopRequireDefault(require("c8008d5edd2a60a")); +var _mediaItem = _interopRequireDefault(require("396b180285779767")); +var _element = _interopRequireDefault(require("23e3b5ddca3f209e")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Media = function Media(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("media", className, {}) + }), children); +}; +Media.Item = _mediaItem["default"]; +Media.defaultProps = { + renderAs: "article" +}; +var _default = Media; +exports["default"] = _default; + +},{"5ef2f8e484eb4a16":"21dqq","d2f2742aa4a0ccfa":"7wKI2","c8008d5edd2a60a":"aWHjR","396b180285779767":"eTdi7","23e3b5ddca3f209e":"4nSn7"}],"eTdi7":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("c2e02e6a7428c04f")); +var _propTypes = _interopRequireDefault(require("7e404977e6781ccb")); +var _classnames2 = _interopRequireDefault(require("f8a21dcecbee9421")); +var _element = _interopRequireDefault(require("a2a973fd4c83a746")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var MediaItem = function MediaItem(_ref) { + var children = _ref.children, className = _ref.className, align = _ref.align, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "align" + ]); + var p = align === "center" ? "content" : align; + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])(className, _defineProperty({}, "media-".concat(p), p)) + }), children); +}; +MediaItem.defaultProps = { + align: "center" +}; +var _default = MediaItem; +exports["default"] = _default; + +},{"c2e02e6a7428c04f":"21dqq","7e404977e6781ccb":"7wKI2","f8a21dcecbee9421":"aWHjR","a2a973fd4c83a746":"4nSn7"}],"4YROs":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _notification = _interopRequireDefault(require("ef9746507217ac44")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _notification["default"]; +exports["default"] = _default; + +},{"ef9746507217ac44":"fEfVI"}],"fEfVI":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("9ca9fb7798ecbca5")); +var _propTypes = _interopRequireDefault(require("36e6a0d4479dd60a")); +var _classnames2 = _interopRequireDefault(require("2f6c56d15eff6145")); +var _element = _interopRequireDefault(require("96bfaadc52f45370")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Notification = function Notification(_ref) { + var _classnames; + var className = _ref.className, color = _ref.color, light = _ref.light, props = _objectWithoutProperties(_ref, [ + "className", + "color", + "light" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("notification", (_classnames = {}, _defineProperty(_classnames, "is-".concat(color), color), _defineProperty(_classnames, "is-light", light), _classnames), className) + })); +}; +var _default = Notification; +exports["default"] = _default; + +},{"9ca9fb7798ecbca5":"21dqq","36e6a0d4479dd60a":"7wKI2","2f6c56d15eff6145":"aWHjR","96bfaadc52f45370":"4nSn7"}],"jr1sl":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _progress = _interopRequireDefault(require("5aa5b671c362ec2f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _progress["default"]; +exports["default"] = _default; + +},{"5aa5b671c362ec2f":"ezcmJ"}],"ezcmJ":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("66ab2d77ee9c9d9e")); +var _propTypes = _interopRequireDefault(require("28a9ac519afcc4cd")); +var _classnames2 = _interopRequireDefault(require("d2c1d0d6a7ea7a64")); +var _element = _interopRequireDefault(require("dcb2a01ce0843742")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Progress = function Progress(_ref) { + var _classnames; + var className = _ref.className, value = _ref.value, max = _ref.max, color = _ref.color, size = _ref.size, props = _objectWithoutProperties(_ref, [ + "className", + "value", + "max", + "color", + "size" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + value: value, + max: max, + className: (0, _classnames2["default"])("progress", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(color), color), _defineProperty(_classnames, "is-".concat(size), size), _classnames)) + })); +}; +Progress.defaultProps = { + renderAs: "progress" +}; +var _default = Progress; +exports["default"] = _default; + +},{"66ab2d77ee9c9d9e":"21dqq","28a9ac519afcc4cd":"7wKI2","d2c1d0d6a7ea7a64":"aWHjR","dcb2a01ce0843742":"4nSn7"}],"fSgTv":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _section = _interopRequireDefault(require("740cb6c58b856fba")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _section["default"]; +exports["default"] = _default; + +},{"740cb6c58b856fba":"lS6Rr"}],"lS6Rr":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("1eab50d4c5a405cf")); +var _propTypes = _interopRequireDefault(require("1021838cc43e6f66")); +var _classnames2 = _interopRequireDefault(require("3b65022e750c0f36")); +var _element = _interopRequireDefault(require("90c00a31fc1dd960")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Section = function Section(_ref) { + var children = _ref.children, className = _ref.className, size = _ref.size, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "size" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("section", className, _defineProperty({}, "is-".concat(size), size)) + }), children); +}; +Section.defaultProps = { + renderAs: "section" +}; +var _default = Section; +exports["default"] = _default; + +},{"1eab50d4c5a405cf":"21dqq","1021838cc43e6f66":"7wKI2","3b65022e750c0f36":"aWHjR","90c00a31fc1dd960":"4nSn7"}],"h8NV1":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _tabs = _interopRequireDefault(require("4aa135fb17f9fd3a")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _tabs["default"]; +exports["default"] = _default; + +},{"4aa135fb17f9fd3a":"lD26L"}],"lD26L":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("66e8ce0e307bff32")); +var _propTypes = _interopRequireDefault(require("fec44b3645c59496")); +var _classnames2 = _interopRequireDefault(require("9ac82226ebef6b3c")); +var _tab = _interopRequireDefault(require("ad0876d29bc55af3")); +var _element = _interopRequireDefault(require("b0bd612de05c697a")); +var _normalizer = require("6079970e331d510c"); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Tabs = function Tabs(_ref) { + var _classnames; + var children = _ref.children, className = _ref.className, align = _ref.align, size = _ref.size, type = _ref.type, fullwidth = _ref.fullwidth, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "align", + "size", + "type", + "fullwidth" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("tabs", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat((0, _normalizer.normalizeAlign)(align)), align), _defineProperty(_classnames, "is-".concat(size), size), _defineProperty(_classnames, "is-toggle", type === "toggle-rounded"), _defineProperty(_classnames, "is-".concat(type), type), _defineProperty(_classnames, "is-fullwidth", fullwidth), _classnames)) + }), /*#__PURE__*/ _react["default"].createElement("ul", null, children)); +}; +Tabs.Tab = _tab["default"]; +var _default = Tabs; +exports["default"] = _default; + +},{"66e8ce0e307bff32":"21dqq","fec44b3645c59496":"7wKI2","9ac82226ebef6b3c":"aWHjR","ad0876d29bc55af3":"6cTei","b0bd612de05c697a":"4nSn7","6079970e331d510c":"1hNLM"}],"6cTei":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("7c727bf14e284171")); +var _propTypes = _interopRequireDefault(require("b4b4934237a791b3")); +var _classnames = _interopRequireDefault(require("aa87a77d86ab6347")); +var _element = _interopRequireDefault(require("70993d28d333d55")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Tab = function Tab(_ref) { + var children = _ref.children, className = _ref.className, style = _ref.style, active = _ref.active, domRef = _ref.domRef, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "style", + "active", + "domRef" + ]); + return /*#__PURE__*/ _react["default"].createElement("li", { + ref: domRef, + style: style, + className: (0, _classnames["default"])(className, { + "is-active": active + }) + }, /*#__PURE__*/ _react["default"].createElement(_element["default"], props, children)); +}; +Tab.defaultProps = { + renderAs: "a" +}; +var _default = Tab; +exports["default"] = _default; + +},{"7c727bf14e284171":"21dqq","b4b4934237a791b3":"7wKI2","aa87a77d86ab6347":"aWHjR","70993d28d333d55":"4nSn7"}],"1Yd2w":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _table = _interopRequireDefault(require("2bca273127ee909a")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _table["default"]; +exports["default"] = _default; + +},{"2bca273127ee909a":"9F13X"}],"9F13X":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("4cc5c12cdaa178f")); +var _propTypes = _interopRequireDefault(require("24631e5615eb52f")); +var _classnames2 = _interopRequireDefault(require("6983e3cf608635fa")); +var _element = _interopRequireDefault(require("850d37cad1f56575")); +var _container = _interopRequireDefault(require("d071ce45b538fdb8")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Table = function Table(_ref) { + var _classnames; + var children = _ref.children, className = _ref.className, size = _ref.size, striped = _ref.striped, bordered = _ref.bordered, hoverable = _ref.hoverable, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "size", + "striped", + "bordered", + "hoverable" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + renderAs: "table", + className: (0, _classnames2["default"])("table", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(size), size), _defineProperty(_classnames, "is-bordered", bordered), _defineProperty(_classnames, "is-striped", striped), _defineProperty(_classnames, "is-hoverable", hoverable), _classnames)) + }), children); +}; +Table.defaultProps = {}; +Table.Container = _container["default"]; +var _default = Table; +exports["default"] = _default; + +},{"4cc5c12cdaa178f":"21dqq","24631e5615eb52f":"7wKI2","6983e3cf608635fa":"aWHjR","850d37cad1f56575":"4nSn7","d071ce45b538fdb8":"ahX5b"}],"ahX5b":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("65d415dd2e121753")); +var _classnames = _interopRequireDefault(require("22830323f65d69f1")); +var _element = _interopRequireDefault(require("37aaeeb3f8f9b514")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var TableContainer = function TableContainer(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("table-container", className) + })); +}; +TableContainer.defaultProps = {}; +var _default = TableContainer; +exports["default"] = _default; + +},{"65d415dd2e121753":"21dqq","22830323f65d69f1":"aWHjR","37aaeeb3f8f9b514":"4nSn7"}],"h5xW2":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _tag = _interopRequireDefault(require("55d572133c2e74ac")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _tag["default"]; +exports["default"] = _default; + +},{"55d572133c2e74ac":"j8DEN"}],"j8DEN":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("153f551e9ad1052c")); +var _propTypes = _interopRequireDefault(require("f0d0cd7a2c551a7f")); +var _classnames2 = _interopRequireDefault(require("672260e18820a007")); +var _tagGroup = _interopRequireDefault(require("1b6cfc654960f196")); +var _element = _interopRequireDefault(require("6d22cf70a1665dc2")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Tag = function Tag(_ref) { + var _classnames; + var children = _ref.children, className = _ref.className, color = _ref.color, size = _ref.size, rounded = _ref.rounded, remove = _ref.remove, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "color", + "size", + "rounded", + "remove" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("tag", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(size), size), _defineProperty(_classnames, "is-".concat(color), color), _defineProperty(_classnames, "is-rounded", rounded), _defineProperty(_classnames, "is-delete", remove), _classnames)) + }), !remove && children); +}; +Tag.Group = _tagGroup["default"]; +Tag.defaultProps = { + renderAs: "span" +}; +var _default = Tag; +exports["default"] = _default; + +},{"153f551e9ad1052c":"21dqq","f0d0cd7a2c551a7f":"7wKI2","672260e18820a007":"aWHjR","1b6cfc654960f196":"7LuOW","6d22cf70a1665dc2":"4nSn7"}],"7LuOW":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("712b9301a915b5c6")); +var _propTypes = _interopRequireDefault(require("9230a9db79153f7a")); +var _classnames = _interopRequireDefault(require("bb3f83b02fd96625")); +var _element = _interopRequireDefault(require("6db67bbdd62d6dd1")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var TagGroup = function TagGroup(_ref) { + var children = _ref.children, className = _ref.className, gapless = _ref.gapless, hasAddons = _ref.hasAddons, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "gapless", + "hasAddons" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("tags", className, { + "has-addons": gapless || hasAddons + }) + }), children); +}; +TagGroup.defaultProps = { + renderAs: "span" +}; +var _default = TagGroup; +exports["default"] = _default; + +},{"712b9301a915b5c6":"21dqq","9230a9db79153f7a":"7wKI2","bb3f83b02fd96625":"aWHjR","6db67bbdd62d6dd1":"4nSn7"}],"bLAfu":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _tile = _interopRequireDefault(require("3def50f434f9804f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _tile["default"]; +exports["default"] = _default; + +},{"3def50f434f9804f":"8ikeo"}],"8ikeo":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("66e91779b444ac7f")); +var _propTypes = _interopRequireDefault(require("58b2d65600141c48")); +var _classnames2 = _interopRequireDefault(require("b253847349aa8483")); +var _element = _interopRequireDefault(require("85d8c0ac209328fb")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Tile = function Tile(_ref) { + var _classnames; + var children = _ref.children, className = _ref.className, kind = _ref.kind, vertical = _ref.vertical, size = _ref.size, color = _ref.color, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "kind", + "vertical", + "size", + "color" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("tile", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(kind), kind), _defineProperty(_classnames, "is-".concat(size), size), _defineProperty(_classnames, "is-".concat(color), color), _defineProperty(_classnames, "is-vertical", vertical), _classnames)) + }), children); +}; +var _default = Tile; +exports["default"] = _default; + +},{"66e91779b444ac7f":"21dqq","58b2d65600141c48":"7wKI2","b253847349aa8483":"aWHjR","85d8c0ac209328fb":"4nSn7"}],"eiN0t":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _modal = _interopRequireDefault(require("bcd4ef9edc32b25c")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _modal["default"]; +exports["default"] = _default; + +},{"bcd4ef9edc32b25c":"jG4Pr"}],"jG4Pr":[function(require,module,exports) { +"use strict"; +function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function _typeof(obj) { + return typeof obj; + }; + else _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + return _typeof(obj); +} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireWildcard(require("9d80d1141566912a")); +var _reactDom = _interopRequireDefault(require("7e225603984e9c3b")); +var _propTypes = _interopRequireDefault(require("13d343d573b7348e")); +var _classnames = _interopRequireDefault(require("8ca0c2777b58f20d")); +var _content = _interopRequireDefault(require("30971793b4f7f3dc")); +var _card = _interopRequireDefault(require("86a6bd08594d289")); +var _context = require("237b08de7f8df7cd"); +var _element = _interopRequireDefault(require("e3d2f9d8d8179def")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function _getRequireWildcardCache() { + return cache; + }; + return cache; +} +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) return obj; + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") return { + "default": obj + }; + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) return cache.get(obj); + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + newObj["default"] = obj; + if (cache) cache.set(obj, newObj); + return newObj; +} +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); +} +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; +} +function _iterableToArrayLimit(arr, i) { + var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + var _s, _e; + try { + for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){ + _arr.push(_s.value); + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally{ + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally{ + if (_d) throw _e; + } + } + return _arr; +} +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var KEYCODES = { + ESCAPE: 27 +}; +var Modal = function Modal(_ref) { + var domRef = _ref.domRef, children = _ref.children, className = _ref.className, show = _ref.show, closeOnBlur = _ref.closeOnBlur, showClose = _ref.showClose, onClose = _ref.onClose, closeOnEsc = _ref.closeOnEsc, props = _objectWithoutProperties(_ref, [ + "domRef", + "children", + "className", + "show", + "closeOnBlur", + "showClose", + "onClose", + "closeOnEsc" + ]); + var ref = (0, _react.useRef)(domRef); + var _useState = (0, _react.useState)(), _useState2 = _slicedToArray(_useState, 2), portalContainer = _useState2[0], setPortalContainer = _useState2[1]; + (0, _react.useEffect)(function() { + if (!show) return undefined; + var doc = props.document || document; + var container = doc.createElement("div"); + container.setAttribute("class", "modal-container"); + doc.body.appendChild(container); + setPortalContainer(container); + var handleKeydown = function handleKeydown(evt) { + if (evt.keyCode === KEYCODES.ESCAPE && show) onClose(); + }; + if (closeOnEsc) doc.addEventListener("keydown", handleKeydown); + return function() { + doc.removeEventListener("keydown", handleKeydown); + container.parentNode.removeChild(container); + }; + }, [ + show + ]); + if (!portalContainer) return null; + return /*#__PURE__*/ _reactDom["default"].createPortal(/*#__PURE__*/ _react["default"].createElement(_context.ModalContext.Provider, { + value: { + onClose: onClose + } + }, /*#__PURE__*/ _react["default"].createElement(_element["default"], { + domRef: ref, + className: (0, _classnames["default"])("modal", className, { + "is-active": show + }) + }, /*#__PURE__*/ _react["default"].createElement("div", { + role: "presentation", + className: "modal-background", + onClick: closeOnBlur ? onClose : undefined + }), children, showClose && /*#__PURE__*/ _react["default"].createElement("button", { + type: "button", + onClick: onClose, + className: "modal-close is-large", + "aria-label": "close" + }))), portalContainer); +}; +Modal.Content = _content["default"]; +Modal.Card = _card["default"]; +Modal.defaultProps = { + closeOnEsc: true, + showClose: true, + // Expose mount point for testing + document: undefined +}; +var _default = Modal; +exports["default"] = _default; + +},{"9d80d1141566912a":"21dqq","7e225603984e9c3b":"j6uA9","13d343d573b7348e":"7wKI2","8ca0c2777b58f20d":"aWHjR","30971793b4f7f3dc":"jJuNm","86a6bd08594d289":"1L1cS","237b08de7f8df7cd":"2gxeC","e3d2f9d8d8179def":"4nSn7"}],"jJuNm":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("c12a6bf756e32d23")); +var _classnames = _interopRequireDefault(require("cb13a715c1cb715a")); +var _element = _interopRequireDefault(require("d4d635763f6f6407")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var ModalContent = function ModalContent(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("modal-content", className) + }), children); +}; +var _default = ModalContent; +exports["default"] = _default; + +},{"c12a6bf756e32d23":"21dqq","cb13a715c1cb715a":"aWHjR","d4d635763f6f6407":"4nSn7"}],"1L1cS":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _card = _interopRequireDefault(require("3c518166753e6e3a")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _card["default"]; +exports["default"] = _default; + +},{"3c518166753e6e3a":"aRKWN"}],"aRKWN":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("f6ac7b8f218ab62")); +var _classnames = _interopRequireDefault(require("bac19968ea5331e3")); +var _header = _interopRequireDefault(require("fcb683f12747adde")); +var _body = _interopRequireDefault(require("969e1a55f5fcbfca")); +var _footer = _interopRequireDefault(require("5f24443b130b5294")); +var _title = _interopRequireDefault(require("d59c2deb909bc53e")); +var _element = _interopRequireDefault(require("3e878102f2215164")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var ModalCard = function ModalCard(_ref) { + var className = _ref.className, onClose = _ref.onClose, children = _ref.children, props = _objectWithoutProperties(_ref, [ + "className", + "onClose", + "children" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("modal-card", className) + }), children); +}; +ModalCard.Header = _header["default"]; +ModalCard.Body = _body["default"]; +ModalCard.Footer = _footer["default"]; +ModalCard.Title = _title["default"]; +ModalCard.defaultProps = {}; +var _default = ModalCard; +exports["default"] = _default; + +},{"f6ac7b8f218ab62":"21dqq","bac19968ea5331e3":"aWHjR","fcb683f12747adde":"hAJTL","969e1a55f5fcbfca":"icLwQ","5f24443b130b5294":"h2pXV","d59c2deb909bc53e":"aojvN","3e878102f2215164":"4nSn7"}],"hAJTL":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("f0f16f3c59c70411")); +var _propTypes = _interopRequireDefault(require("85df27aefd9dee56")); +var _classnames = _interopRequireDefault(require("2fddd60bdfd0ae93")); +var _button = _interopRequireDefault(require("26ea27bb62e694c2")); +var _element = _interopRequireDefault(require("4bcc1f0f4f49ab0f")); +var _context = _interopRequireDefault(require("599d17768a9bb352")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var ModalCardHead = function ModalCardHead(_ref) { + var children = _ref.children, className = _ref.className, showClose = _ref.showClose, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "showClose" + ]); + var _useModalContext = (0, _context["default"])(), onClose = _useModalContext.onClose; + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("modal-card-head", className) + }), children, showClose && /*#__PURE__*/ _react["default"].createElement(_button["default"], { + remove: true, + onClick: onClose + })); +}; +ModalCardHead.defaultProps = { + showClose: true, + renderAs: "header" +}; +var _default = ModalCardHead; +exports["default"] = _default; + +},{"f0f16f3c59c70411":"21dqq","85df27aefd9dee56":"7wKI2","2fddd60bdfd0ae93":"aWHjR","26ea27bb62e694c2":"elCNe","4bcc1f0f4f49ab0f":"4nSn7","599d17768a9bb352":"2gxeC"}],"2gxeC":[function(require,module,exports) { +"use strict"; +function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function _typeof(obj) { + return typeof obj; + }; + else _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + return _typeof(obj); +} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = exports.ModalContext = void 0; +var _react = _interopRequireWildcard(require("630cea863d5e2e30")); +function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function _getRequireWildcardCache() { + return cache; + }; + return cache; +} +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) return obj; + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") return { + "default": obj + }; + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) return cache.get(obj); + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + newObj["default"] = obj; + if (cache) cache.set(obj, newObj); + return newObj; +} +var ModalContext = /*#__PURE__*/ _react["default"].createContext({ + onClose: function onClose() {} +}); +exports.ModalContext = ModalContext; +var useModalContext = function useModalContext() { + return (0, _react.useContext)(ModalContext); +}; +var _default = useModalContext; +exports["default"] = _default; + +},{"630cea863d5e2e30":"21dqq"}],"icLwQ":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("2f75b31b10d89b45")); +var _propTypes = _interopRequireDefault(require("af9d2179b37dcd28")); +var _classnames = _interopRequireDefault(require("df5b15b12c715ac0")); +var _element = _interopRequireDefault(require("84d257b6a04f15af")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var ModalCardBody = function ModalCardBody(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("modal-card-body", className) + }), children); +}; +ModalCardBody.defaultProps = { + renderAs: "section" +}; +var _default = ModalCardBody; +exports["default"] = _default; + +},{"2f75b31b10d89b45":"21dqq","af9d2179b37dcd28":"7wKI2","df5b15b12c715ac0":"aWHjR","84d257b6a04f15af":"4nSn7"}],"h2pXV":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("a4d31855fe639195")); +var _propTypes = _interopRequireDefault(require("9d31ee7395c60af9")); +var _classnames = _interopRequireDefault(require("99390d19a9244fe2")); +var _element = _interopRequireDefault(require("23b0d5db5edb5b1e")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var ModalCardFoot = function ModalCardFoot(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("modal-card-foot", className) + }), children); +}; +ModalCardFoot.defaultProps = { + renderAs: "footer" +}; +var _default = ModalCardFoot; +exports["default"] = _default; + +},{"a4d31855fe639195":"21dqq","9d31ee7395c60af9":"7wKI2","99390d19a9244fe2":"aWHjR","23b0d5db5edb5b1e":"4nSn7"}],"aojvN":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("a1b3ce3b3eea23f0")); +var _propTypes = _interopRequireDefault(require("d2fb2644a2c6d091")); +var _classnames = _interopRequireDefault(require("2cf834ec6d4c336b")); +var _element = _interopRequireDefault(require("66954c4a0ebd00a4")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var ModalCardTitle = function ModalCardTitle(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("modal-card-title", className) + }), children); +}; +ModalCardTitle.defaultProps = { + renderAs: "p" +}; +var _default = ModalCardTitle; +exports["default"] = _default; + +},{"a1b3ce3b3eea23f0":"21dqq","d2fb2644a2c6d091":"7wKI2","2cf834ec6d4c336b":"aWHjR","66954c4a0ebd00a4":"4nSn7"}],"kZqcw":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _dropdown = _interopRequireDefault(require("9bdcc92e8802213e")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _dropdown["default"]; +exports["default"] = _default; + +},{"9bdcc92e8802213e":"jZUjg"}],"jZUjg":[function(require,module,exports) { +"use strict"; +function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function _typeof(obj) { + return typeof obj; + }; + else _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + return _typeof(obj); +} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireWildcard(require("3dd14e3cc5914f67")); +var _propTypes = _interopRequireDefault(require("ab62aa4b095178d5")); +var _classnames = _interopRequireDefault(require("329e407e3e47d665")); +var _item = _interopRequireDefault(require("7b31db19b6524d1e")); +var _divider = _interopRequireDefault(require("b8e3f65477084ab4")); +var _button = _interopRequireDefault(require("266c379ebb5b5b1e")); +var _element = _interopRequireDefault(require("aa5a2f11504555c2")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function _getRequireWildcardCache() { + return cache; + }; + return cache; +} +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) return obj; + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") return { + "default": obj + }; + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) return cache.get(obj); + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + newObj["default"] = obj; + if (cache) cache.set(obj, newObj); + return newObj; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _slicedToArray(arr, i) { + return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); +} +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i]; + return arr2; +} +function _iterableToArrayLimit(arr, i) { + var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); + if (_i == null) return; + var _arr = []; + var _n = true; + var _d = false; + var _s, _e; + try { + for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){ + _arr.push(_s.value); + if (i && _arr.length === i) break; + } + } catch (err) { + _d = true; + _e = err; + } finally{ + try { + if (!_n && _i["return"] != null) _i["return"](); + } finally{ + if (_d) throw _e; + } + } + return _arr; +} +function _arrayWithHoles(arr) { + if (Array.isArray(arr)) return arr; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Dropdown = function Dropdown(_ref) { + var className = _ref.className, children = _ref.children, value = _ref.value, color = _ref.color, align = _ref.align, right = _ref.right, up = _ref.up, hoverable = _ref.hoverable, label = _ref.label, onChange = _ref.onChange, closeOnSelect = _ref.closeOnSelect, icon = _ref.icon, domRef = _ref.domRef, disabled = _ref.disabled, props = _objectWithoutProperties(_ref, [ + "className", + "children", + "value", + "color", + "align", + "right", + "up", + "hoverable", + "label", + "onChange", + "closeOnSelect", + "icon", + "domRef", + "disabled" + ]); + var ref = (0, _react.useRef)(domRef); + var _useState = (0, _react.useState)(false), _useState2 = _slicedToArray(_useState, 2), isOpen = _useState2[0], setIsOpen = _useState2[1]; + var close = function close(evt) { + // IDK yet how to test using the ref in enzime + // istanbul ignore if + if (hoverable || evt && ref && ref.current && ref.current.contains(evt.target)) return; + if (ref.current) setIsOpen(false); + }; + var onSelect = function onSelect(selectedValue) { + return function() { + if (onChange) onChange(selectedValue); + if (closeOnSelect) close(); + }; + }; + (0, _react.useEffect)(function() { + window.addEventListener("click", close); + return function() { + window.removeEventListener("click", close); + }; + }, []); + var current = label; + var childrenArray = _react["default"].Children.map(children, function(child, i) { + if (child.type === _item["default"] && (i === 0 && !label || child.props.value === value)) current = child.props.children; + return /*#__PURE__*/ _react["default"].cloneElement(child, child.type === _item["default"] ? { + active: child.props.value === value, + onClick: onSelect(child.props.value) + } : {}); + }); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + domRef: ref, + className: (0, _classnames["default"])("dropdown", className, { + "is-active": isOpen, + "is-up": up, + "is-right": right || align === "right", + "is-hoverable": hoverable + }) + }), /*#__PURE__*/ _react["default"].createElement("div", { + className: "dropdown-trigger", + role: "presentation", + onClick: function onClick() { + if (disabled) return; + setIsOpen(function(open) { + return !open; + }); + } + }, /*#__PURE__*/ _react["default"].createElement(_button["default"], { + disabled: disabled, + color: color + }, /*#__PURE__*/ _react["default"].createElement("span", null, current), icon)), /*#__PURE__*/ _react["default"].createElement("div", { + className: "dropdown-menu", + id: "dropdown-menu", + role: "menu" + }, /*#__PURE__*/ _react["default"].createElement("div", { + className: "dropdown-content" + }, childrenArray))); +}; +Dropdown.Item = _item["default"]; +Dropdown.Divider = _divider["default"]; +Dropdown.defaultProps = { + closeOnSelect: true +}; +var _default = Dropdown; +exports["default"] = _default; + +},{"3dd14e3cc5914f67":"21dqq","ab62aa4b095178d5":"7wKI2","329e407e3e47d665":"aWHjR","7b31db19b6524d1e":"h9Div","b8e3f65477084ab4":"20Uc1","266c379ebb5b5b1e":"elCNe","aa5a2f11504555c2":"4nSn7"}],"h9Div":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("9e4a2a171da48997")); +var _propTypes = _interopRequireDefault(require("cab94a0b737176ba")); +var _classnames = _interopRequireDefault(require("4561a773dbb5dd6c")); +var _element = _interopRequireDefault(require("fdb173a35984bc0f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var DropdownItem = function DropdownItem(_ref) { + var active = _ref.active, children = _ref.children, value = _ref.value, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "active", + "children", + "value", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({ + title: value + }, props, { + role: "presentation", + className: (0, _classnames["default"])(className, "dropdown-item", { + "is-active": active + }) + }), children); +}; +DropdownItem.defaultProps = {}; +var _default = DropdownItem; +exports["default"] = _default; + +},{"9e4a2a171da48997":"21dqq","cab94a0b737176ba":"7wKI2","4561a773dbb5dd6c":"aWHjR","fdb173a35984bc0f":"4nSn7"}],"20Uc1":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("37fb760dfc292c92")); +var _classnames = _interopRequireDefault(require("4a62a81d2c5548ef")); +var _element = _interopRequireDefault(require("f932e86e012559a4")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var DropdownDivider = function DropdownDivider(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("dropdown-divider", className) + })); +}; +DropdownDivider.defaultProps = { + renderAs: "hr" +}; +var _default = DropdownDivider; +exports["default"] = _default; + +},{"37fb760dfc292c92":"21dqq","4a62a81d2c5548ef":"aWHjR","f932e86e012559a4":"4nSn7"}],"ivtHH":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _loader = _interopRequireDefault(require("1570f8331c5664d7")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _loader["default"]; +exports["default"] = _default; + +},{"1570f8331c5664d7":"2Oj0T"}],"2Oj0T":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("6234870a2169cf74")); +var _classnames = _interopRequireDefault(require("10b5c1c9b7e770c4")); +var _element = _interopRequireDefault(require("812c79d04e8b4f8f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Loader = function Loader(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("loader", className) + }), children); +}; +var _default = Loader; +exports["default"] = _default; + +},{"6234870a2169cf74":"21dqq","10b5c1c9b7e770c4":"aWHjR","812c79d04e8b4f8f":"4nSn7"}],"iKjeP":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _navbar = _interopRequireDefault(require("6206283dc330d8e9")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _navbar["default"]; +exports["default"] = _default; + +},{"6206283dc330d8e9":"hOVQm"}],"hOVQm":[function(require,module,exports) { +"use strict"; +function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") _typeof = function _typeof(obj) { + return typeof obj; + }; + else _typeof = function _typeof(obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + return _typeof(obj); +} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireWildcard(require("8635e638cd54707e")); +var _propTypes = _interopRequireDefault(require("1003485ec6ba6ce3")); +var _classnames2 = _interopRequireDefault(require("e7f9e3112f40066")); +var _brand = _interopRequireDefault(require("c408b5ee7eb9afd7")); +var _burger = _interopRequireDefault(require("64bd87c4f9a85f2")); +var _menu = _interopRequireDefault(require("1763b58577de21e")); +var _item = _interopRequireDefault(require("d981c11662b95ab")); +var _dropdown = _interopRequireDefault(require("321c9015570a3f0b")); +var _divider = _interopRequireDefault(require("cdebc3b6242e7e27")); +var _link = _interopRequireDefault(require("570475366b9392c")); +var _container = _interopRequireDefault(require("501702c3f27c552c")); +var _context = require("75180b60ab85c272"); +var _element = _interopRequireDefault(require("42149e5c187a166a")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _getRequireWildcardCache() { + if (typeof WeakMap !== "function") return null; + var cache = new WeakMap(); + _getRequireWildcardCache = function _getRequireWildcardCache() { + return cache; + }; + return cache; +} +function _interopRequireWildcard(obj) { + if (obj && obj.__esModule) return obj; + if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") return { + "default": obj + }; + var cache = _getRequireWildcardCache(); + if (cache && cache.has(obj)) return cache.get(obj); + var newObj = {}; + var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for(var key in obj)if (Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc); + else newObj[key] = obj[key]; + } + newObj["default"] = obj; + if (cache) cache.set(obj, newObj); + return newObj; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Navbar = function Navbar(_ref) { + var _classnames; + var children = _ref.children, className = _ref.className, fixed = _ref.fixed, transparent = _ref.transparent, color = _ref.color, active = _ref.active, size = _ref.size, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "fixed", + "transparent", + "color", + "active", + "size" + ]); + (0, _react.useEffect)(function() { + var html = window.document.querySelector("html"); + if (!html.classList.contains("has-navbar-fixed-".concat(fixed))) { + html.classList.remove("has-navbar-fixed-top"); + html.classList.remove("has-navbar-fixed-bottom"); + } + if (fixed) html.classList.add("has-navbar-fixed-".concat(fixed)); + return function() { + return window.document.querySelector("html").classList.remove("has-navbar-fixed-".concat(fixed)); + }; + }, [ + fixed + ]); + return /*#__PURE__*/ _react["default"].createElement(_context.ShowContext.Provider, { + value: active + }, /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + role: "navigation", + className: (0, _classnames2["default"])("navbar", className, (_classnames = { + "is-transparent": transparent + }, _defineProperty(_classnames, "is-fixed-".concat(fixed), fixed), _defineProperty(_classnames, "is-".concat(color), color), _defineProperty(_classnames, "is-spaced", size === "large"), _classnames)) + }), children)); +}; +Navbar.defaultProps = { + renderAs: "nav" +}; +Navbar.Brand = _brand["default"]; +Navbar.Burger = _burger["default"]; +Navbar.Menu = _menu["default"]; +Navbar.Item = _item["default"]; +Navbar.Dropdown = _dropdown["default"]; +Navbar.Link = _link["default"]; +Navbar.Divider = _divider["default"]; +Navbar.Container = _container["default"]; +var _default = Navbar; +exports["default"] = _default; + +},{"8635e638cd54707e":"21dqq","1003485ec6ba6ce3":"7wKI2","e7f9e3112f40066":"aWHjR","c408b5ee7eb9afd7":"4tkjd","64bd87c4f9a85f2":"dVyhO","1763b58577de21e":"DuHfV","d981c11662b95ab":"8ibm4","321c9015570a3f0b":"7DD2z","cdebc3b6242e7e27":"azj17","570475366b9392c":"gfjXH","501702c3f27c552c":"fzNrA","75180b60ab85c272":"3nDfo","42149e5c187a166a":"4nSn7"}],"4tkjd":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("9d2f83dac1c2a3d4")); +var _classnames = _interopRequireDefault(require("18dc928d60add745")); +var _element = _interopRequireDefault(require("36bcb0926b8ec035")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var NavbarBrand = function NavbarBrand(_ref) { + var className = _ref.className, children = _ref.children, props = _objectWithoutProperties(_ref, [ + "className", + "children" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("navbar-brand", className) + }), children); +}; +NavbarBrand.defaultProps = {}; +var _default = NavbarBrand; +exports["default"] = _default; + +},{"9d2f83dac1c2a3d4":"21dqq","18dc928d60add745":"aWHjR","36bcb0926b8ec035":"4nSn7"}],"dVyhO":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("f51105162187e054")); +var _classnames = _interopRequireDefault(require("9ccbf1b4c890a3a1")); +var _context = require("fc4eab87c321c202"); +var _element = _interopRequireDefault(require("61c2acb7d1820416")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + keys.push.apply(keys, symbols); + } + return keys; +} +function _objectSpread(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) ownKeys(Object(source), true).forEach(function(key) { + _defineProperty(target, key, source[key]); + }); + else if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + else ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + return target; +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var NavbarBurger = function NavbarBurger(_ref) { + var style = _ref.style, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "style", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_context.ShowContext.Consumer, null, function(active) { + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({ + role: "button", + tabIndex: "0", + style: _objectSpread({ + outline: "none" + }, style), + className: (0, _classnames["default"])("navbar-burger", className, { + "is-active": active + }) + }, props), /*#__PURE__*/ _react["default"].createElement("span", null), /*#__PURE__*/ _react["default"].createElement("span", null), /*#__PURE__*/ _react["default"].createElement("span", null)); + }); +}; +NavbarBurger.defaultProps = {}; +var _default = NavbarBurger; +exports["default"] = _default; + +},{"f51105162187e054":"21dqq","9ccbf1b4c890a3a1":"aWHjR","fc4eab87c321c202":"3nDfo","61c2acb7d1820416":"4nSn7"}],"3nDfo":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.ShowContext = void 0; +var _react = _interopRequireDefault(require("4eb2acbd4a148936")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var ShowContext = /*#__PURE__*/ _react["default"].createContext(false); +exports.ShowContext = ShowContext; + +},{"4eb2acbd4a148936":"21dqq"}],"DuHfV":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("2ba05dd4936b8a85")); +var _classnames = _interopRequireDefault(require("77bd8fc8c803f859")); +var _context = require("2a1ef6d683a785d9"); +var _element = _interopRequireDefault(require("7cff2a1fbfc6d378")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var NavbarMenu = function NavbarMenu(_ref) { + var className = _ref.className, children = _ref.children, props = _objectWithoutProperties(_ref, [ + "className", + "children" + ]); + return /*#__PURE__*/ _react["default"].createElement(_context.ShowContext.Consumer, null, function(active) { + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("navbar-menu", className, { + "is-active": active + }) + }), children); + }); +}; +NavbarMenu.defaultProps = {}; +var _default = NavbarMenu; +exports["default"] = _default; + +},{"2ba05dd4936b8a85":"21dqq","77bd8fc8c803f859":"aWHjR","2a1ef6d683a785d9":"3nDfo","7cff2a1fbfc6d378":"4nSn7"}],"8ibm4":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("8d9a4ce7ebb57c22")); +var _propTypes = _interopRequireDefault(require("ccbf014f2b1e2b27")); +var _classnames = _interopRequireDefault(require("28737c6fd9d2e9c8")); +var _dropdown = _interopRequireDefault(require("fe0da5b6bd0f5987")); +var _element = _interopRequireDefault(require("6dbb247f7f378ea")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var NavbarItem = function NavbarItem(_ref) { + var _dropdown$props; + var className = _ref.className, active = _ref.active, children = _ref.children, hoverable = _ref.hoverable, renderAs = _ref.renderAs, arrowless = _ref.arrowless, props = _objectWithoutProperties(_ref, [ + "className", + "active", + "children", + "hoverable", + "renderAs", + "arrowless" + ]); + var as = renderAs; + var dropdown = _react["default"].Children.toArray(children).find(function(child) { + return child.type === _dropdown["default"]; + }); + if (dropdown && renderAs === "a") as = "div"; + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + renderAs: as, + className: (0, _classnames["default"])("navbar-item", className, { + "is-active": active, + "has-dropdown": dropdown, + "is-hoverable": hoverable, + "has-dropdown-up": dropdown && ((_dropdown$props = dropdown.props) === null || _dropdown$props === void 0 ? void 0 : _dropdown$props.up), + "is-arrowless": arrowless + }) + }), children); +}; +NavbarItem.defaultProps = { + renderAs: "a" +}; +var _default = NavbarItem; +exports["default"] = _default; + +},{"8d9a4ce7ebb57c22":"21dqq","ccbf014f2b1e2b27":"7wKI2","28737c6fd9d2e9c8":"aWHjR","fe0da5b6bd0f5987":"7DD2z","6dbb247f7f378ea":"4nSn7"}],"7DD2z":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("f0220506ddd63b49")); +var _propTypes = _interopRequireDefault(require("466eb6a76c4a81fd")); +var _classnames = _interopRequireDefault(require("4b5343f297380c8e")); +var _element = _interopRequireDefault(require("7b107d4f234b")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var NavbarDropdown = function NavbarDropdown(_ref) { + var className = _ref.className, boxed = _ref.boxed, right = _ref.right, children = _ref.children, props = _objectWithoutProperties(_ref, [ + "className", + "boxed", + "right", + "children" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("navbar-dropdown", className, { + "is-boxed": boxed, + "is-right": right + }) + }), children); +}; +NavbarDropdown.defaultProps = { + renderAs: "div" +}; +var _default = NavbarDropdown; +exports["default"] = _default; + +},{"f0220506ddd63b49":"21dqq","466eb6a76c4a81fd":"7wKI2","4b5343f297380c8e":"aWHjR","7b107d4f234b":"4nSn7"}],"azj17":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("4e31720a0b497aa3")); +var _propTypes = _interopRequireDefault(require("cf7b312dd6af5ad7")); +var _classnames = _interopRequireDefault(require("204cd5b4fff67cec")); +var _element = _interopRequireDefault(require("89829d1ebd1ae097")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var NavbarDivider = function NavbarDivider(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("navbar-divider", className) + })); +}; +NavbarDivider.defaultProps = { + renderAs: "hr" +}; +var _default = NavbarDivider; +exports["default"] = _default; + +},{"4e31720a0b497aa3":"21dqq","cf7b312dd6af5ad7":"7wKI2","204cd5b4fff67cec":"aWHjR","89829d1ebd1ae097":"4nSn7"}],"gfjXH":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("2b9aeb422e0e7fca")); +var _propTypes = _interopRequireDefault(require("6bf3a87d0862d368")); +var _classnames = _interopRequireDefault(require("dafd8125eefe47c4")); +var _element = _interopRequireDefault(require("1f8f9acf72e77907")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var NavbarLink = function NavbarLink(_ref) { + var className = _ref.className, children = _ref.children, arrowless = _ref.arrowless, props = _objectWithoutProperties(_ref, [ + "className", + "children", + "arrowless" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("navbar-link", className, { + "is-arrowless": arrowless + }) + }), children); +}; +NavbarLink.defaultProps = { + renderAs: "span" +}; +var _default = NavbarLink; +exports["default"] = _default; + +},{"2b9aeb422e0e7fca":"21dqq","6bf3a87d0862d368":"7wKI2","dafd8125eefe47c4":"aWHjR","1f8f9acf72e77907":"4nSn7"}],"fzNrA":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("dc84751c8c0002db")); +var _propTypes = _interopRequireDefault(require("f132d325279f4da3")); +var _classnames2 = _interopRequireDefault(require("a4b3968d1988e21a")); +var _element = _interopRequireDefault(require("f0699df4b56fa56e")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var alignMapper = { + left: "start", + right: "end" +}; +var NavbarContainer = function NavbarContainer(_ref) { + var className = _ref.className, children = _ref.children, align = _ref.align, props = _objectWithoutProperties(_ref, [ + "className", + "children", + "align" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])(_defineProperty({}, "navbar-".concat(alignMapper[align]), alignMapper[align]), className) + }), children); +}; +NavbarContainer.defaultProps = { + align: "left" +}; +var _default = NavbarContainer; +exports["default"] = _default; + +},{"dc84751c8c0002db":"21dqq","f132d325279f4da3":"7wKI2","a4b3968d1988e21a":"aWHjR","f0699df4b56fa56e":"4nSn7"}],"ivNbV":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _pagination = _interopRequireDefault(require("519573b49c223aa7")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _pagination["default"]; +exports["default"] = _default; + +},{"519573b49c223aa7":"gx6TJ"}],"gx6TJ":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("d9e648e73030d83")); +var _propTypes = _interopRequireDefault(require("d2a3f6b63a4b8adf")); +var _classnames2 = _interopRequireDefault(require("bc58a3fa9d8f8307")); +var _normalizer = require("3637223469bcdef3"); +var _element = _interopRequireDefault(require("996b4599dcf7518b")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var getFirstPage = function getFirstPage(current, last, delta) { + if (current === 1) return 1; + var minPage = last - delta * 2; + var page = Math.min(current - delta, minPage); + return page <= 0 ? 1 : page; +}; +var getLastPage = function getLastPage(current, total, delta) { + if (current === total) return total; + var maxPage = delta * 2 + 1; + var page = Math.max(current + delta, maxPage); + return page > total ? total : page; +}; +var Pagination = function Pagination(_ref) { + var _classnames; + var current = _ref.current, disabled = _ref.disabled, total = _ref.total, next = _ref.next, previous = _ref.previous, showPrevNext = _ref.showPrevNext, showFirstLast = _ref.showFirstLast, delta = _ref.delta, autoHide = _ref.autoHide, className = _ref.className, size = _ref.size, align = _ref.align, rounded = _ref.rounded, onChange = _ref.onChange, props = _objectWithoutProperties(_ref, [ + "current", + "disabled", + "total", + "next", + "previous", + "showPrevNext", + "showFirstLast", + "delta", + "autoHide", + "className", + "size", + "align", + "rounded", + "onChange" + ]); + if (total <= 1 && autoHide || current > total) return null; + var lastPage = getLastPage(current, total, delta); + var firstPage = getFirstPage(current, lastPage, delta); + var prevDisabled = current === 1 || disabled; + var nextDisabled = current === total || disabled; + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("pagination", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(size), size), _defineProperty(_classnames, "is-".concat((0, _normalizer.normalizeAlign)(align)), align), _defineProperty(_classnames, "is-rounded", rounded), _classnames)), + "aria-label": "pagination" + }), showPrevNext && /*#__PURE__*/ _react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/ _react["default"].createElement("a", { + role: "button", + tabIndex: 0, + onClick: prevDisabled ? undefined : function() { + return onChange(current - 1); + }, + className: "pagination-previous", + title: "This is the first page", + disabled: prevDisabled + }, previous), /*#__PURE__*/ _react["default"].createElement("a", { + role: "button", + tabIndex: 0, + onClick: nextDisabled ? undefined : function() { + return onChange(current + 1); + }, + className: "pagination-next", + disabled: nextDisabled + }, next)), delta > 0 && /*#__PURE__*/ _react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/ _react["default"].createElement("ul", { + className: "pagination-list" + }, showFirstLast && current !== 1 && firstPage !== 1 && /*#__PURE__*/ _react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/ _react["default"].createElement("li", { + key: 1 + }, /*#__PURE__*/ _react["default"].createElement("a", { + role: "button", + tabIndex: 0, + className: "pagination-link", + onClick: function onClick() { + return onChange(1); + }, + "aria-label": "Page 1", + "aria-current": "page", + disabled: disabled + }, "1")), /*#__PURE__*/ _react["default"].createElement("li", null, /*#__PURE__*/ _react["default"].createElement("span", { + className: "pagination-ellipsis" + }, "…"))), Array(lastPage - firstPage + 1).fill(0).map(function(_, i) { + return(/*#__PURE__*/ // eslint-disable-next-line react/no-array-index-key + _react["default"].createElement("li", { + key: i + firstPage + }, /*#__PURE__*/ _react["default"].createElement("a", { + role: "button", + tabIndex: 0, + className: (0, _classnames2["default"])("pagination-link", { + "is-current": current === i + firstPage + }), + onClick: current === firstPage + i ? undefined : function() { + return onChange(firstPage + i); + }, + "aria-label": "Page ".concat(i + firstPage), + "aria-current": "page", + disabled: disabled + }, i + firstPage))); + }), showFirstLast && current !== lastPage && total !== lastPage && /*#__PURE__*/ _react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/ _react["default"].createElement("li", { + key: total + }, /*#__PURE__*/ _react["default"].createElement("span", { + className: "pagination-ellipsis" + }, "…")), /*#__PURE__*/ _react["default"].createElement("li", null, /*#__PURE__*/ _react["default"].createElement("a", { + role: "button", + tabIndex: 0, + className: "pagination-link", + onClick: function onClick() { + return onChange(total); + }, + "aria-label": "Page ".concat(total), + "aria-current": "page", + disabled: disabled + }, total)))))); +}; +Pagination.defaultProps = { + total: 1, + current: 1, + delta: 1, + next: "Next", + previous: "Previous", + renderAs: "nav", + showPrevNext: true, + autoHide: true +}; +var _default = Pagination; +exports["default"] = _default; + +},{"d9e648e73030d83":"21dqq","d2a3f6b63a4b8adf":"7wKI2","bc58a3fa9d8f8307":"aWHjR","3637223469bcdef3":"1hNLM","996b4599dcf7518b":"4nSn7"}],"cLV0c":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _menu = _interopRequireDefault(require("ca250fcd0c1d9544")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _menu["default"]; +exports["default"] = _default; + +},{"ca250fcd0c1d9544":"4FBJ2"}],"4FBJ2":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("4f5d10058e6870f1")); +var _propTypes = _interopRequireDefault(require("46db64494ed06ce2")); +var _classnames = _interopRequireDefault(require("4f963be86e0a5625")); +var _list = _interopRequireDefault(require("6f8c2c26dbc21b6b")); +var _element = _interopRequireDefault(require("f76b3ba42b1e5262")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Menu = function Menu(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("menu", className) + })); +}; +Menu.List = _list["default"]; +Menu.defaultProps = { + renderAs: "aside" +}; +var _default = Menu; +exports["default"] = _default; + +},{"4f5d10058e6870f1":"21dqq","46db64494ed06ce2":"7wKI2","4f963be86e0a5625":"aWHjR","6f8c2c26dbc21b6b":"aIB3u","f76b3ba42b1e5262":"4nSn7"}],"aIB3u":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function get() { + return _list["default"]; + } +}); +var _list = _interopRequireDefault(require("b24c25e822cdeb58")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} + +},{"b24c25e822cdeb58":"4W6ZM"}],"4W6ZM":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("309903637cdb0807")); +var _propTypes = _interopRequireDefault(require("fcfc5a9e6be9c8c5")); +var _classnames = _interopRequireDefault(require("4966744172045baf")); +var _item = _interopRequireDefault(require("a5cf88fb759e8061")); +var _element = _interopRequireDefault(require("e0b481525224144f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var MenuList = function MenuList(_ref) { + var className = _ref.className, title = _ref.title, props = _objectWithoutProperties(_ref, [ + "className", + "title" + ]); + return /*#__PURE__*/ _react["default"].createElement(_react["default"].Fragment, null, title && /*#__PURE__*/ _react["default"].createElement("p", { + className: "menu-label" + }, title), /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({ + className: (0, _classnames["default"])("menu-list", className) + }, props))); +}; +MenuList.Item = _item["default"]; +MenuList.defaultProps = { + renderAs: "ul" +}; +var _default = MenuList; +exports["default"] = _default; + +},{"309903637cdb0807":"21dqq","fcfc5a9e6be9c8c5":"7wKI2","4966744172045baf":"aWHjR","a5cf88fb759e8061":"dMlYc","e0b481525224144f":"4nSn7"}],"dMlYc":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("a577dfb79c065a96")); +var _propTypes = _interopRequireDefault(require("7d4e7cdcafba570c")); +var _classnames = _interopRequireDefault(require("2f8eea4c03d152c0")); +var _list = _interopRequireDefault(require("8a1f75a61148221f")); +var _element = _interopRequireDefault(require("8c857a1426611a28")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var MenuListItem = function MenuListItem(_ref) { + var children = _ref.children, active = _ref.active, className = _ref.className, ref = _ref.domRef, props = _objectWithoutProperties(_ref, [ + "children", + "active", + "className", + "domRef" + ]); + if (typeof children !== "string" && _react["default"].Children.toArray(children).length === 1 && _react["default"].Children.only(children).type === _list["default"]) { + var child = _react["default"].Children.only(children); + return /*#__PURE__*/ _react["default"].createElement("li", { + ref: ref + }, /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({ + className: (0, _classnames["default"])(className, { + "is-active": active + }) + }, props), child.props.title), /*#__PURE__*/ _react["default"].cloneElement(child, { + title: undefined + })); + } + return /*#__PURE__*/ _react["default"].createElement("li", { + ref: ref + }, /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({ + className: (0, _classnames["default"])(className, { + "is-active": active + }) + }, props), children)); +}; +MenuListItem.defaultProps = { + renderAs: "a" +}; +var _default = MenuListItem; +exports["default"] = _default; + +},{"a577dfb79c065a96":"21dqq","7d4e7cdcafba570c":"7wKI2","2f8eea4c03d152c0":"aWHjR","8a1f75a61148221f":"4W6ZM","8c857a1426611a28":"4nSn7"}],"dhuW3":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _message = _interopRequireDefault(require("3b0fd941cfc543f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _message["default"]; +exports["default"] = _default; + +},{"3b0fd941cfc543f":"kmYvs"}],"kmYvs":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("c6db32de8da74aa9")); +var _propTypes = _interopRequireDefault(require("72cac285593f3829")); +var _classnames2 = _interopRequireDefault(require("1900eb71756ee418")); +var _body = _interopRequireDefault(require("b3bbe674d378aa68")); +var _header = _interopRequireDefault(require("464a0d363968d629")); +var _element = _interopRequireDefault(require("9b095735f5734b0a")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Message = function Message(_ref) { + var _classnames; + var children = _ref.children, className = _ref.className, color = _ref.color, size = _ref.size, props = _objectWithoutProperties(_ref, [ + "children", + "className", + "color", + "size" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("message", className, (_classnames = {}, _defineProperty(_classnames, "is-".concat(color), color), _defineProperty(_classnames, "is-".concat(size), size), _classnames)) + }), children); +}; +Message.Body = _body["default"]; +Message.Header = _header["default"]; +Message.defaultProps = { + renderAs: "article" +}; +var _default = Message; +exports["default"] = _default; + +},{"c6db32de8da74aa9":"21dqq","72cac285593f3829":"7wKI2","1900eb71756ee418":"aWHjR","b3bbe674d378aa68":"1TFzP","464a0d363968d629":"ezcZs","9b095735f5734b0a":"4nSn7"}],"1TFzP":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("1b3694fe0b176eb1")); +var _classnames = _interopRequireDefault(require("190ba67b684ac1da")); +var _element = _interopRequireDefault(require("693d9fd5982dad86")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var MessageBody = function MessageBody(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("message-body", className) + }), children); +}; +var _default = MessageBody; +exports["default"] = _default; + +},{"1b3694fe0b176eb1":"21dqq","190ba67b684ac1da":"aWHjR","693d9fd5982dad86":"4nSn7"}],"ezcZs":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("7bc18111db10f45")); +var _classnames = _interopRequireDefault(require("ca1f414a2039c91b")); +var _element = _interopRequireDefault(require("fa076ee7afe09a98")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var MessageHeader = function MessageHeader(_ref) { + var children = _ref.children, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "children", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("message-header", className) + }), children); +}; +var _default = MessageHeader; +exports["default"] = _default; + +},{"7bc18111db10f45":"21dqq","ca1f414a2039c91b":"aWHjR","fa076ee7afe09a98":"4nSn7"}],"cwvGd":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _panel = _interopRequireDefault(require("9596ebb7018bdb14")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +var _default = _panel["default"]; +exports["default"] = _default; + +},{"9596ebb7018bdb14":"a8q0X"}],"a8q0X":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("1231efa1840a8f03")); +var _propTypes = _interopRequireDefault(require("94bf4f94c1383a9")); +var _classnames2 = _interopRequireDefault(require("a454e78833cfd80e")); +var _block = _interopRequireDefault(require("50c95ad95bd20115")); +var _header = _interopRequireDefault(require("50790c9976f0f92c")); +var _icon = _interopRequireDefault(require("7f2a359a3676a404")); +var _tabs = _interopRequireDefault(require("9de1514e8419bc94")); +var _element = _interopRequireDefault(require("e12b8d1aff3d8935")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _defineProperty(obj, key, value) { + if (key in obj) Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + else obj[key] = value; + return obj; +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var Panel = function Panel(_ref) { + var color = _ref.color, className = _ref.className, props = _objectWithoutProperties(_ref, [ + "color", + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames2["default"])("panel", className, _defineProperty({}, "is-".concat(color), color)) + })); +}; +Panel.Header = _header["default"]; +Panel.Tabs = _tabs["default"]; +Panel.Block = _block["default"]; +Panel.Icon = _icon["default"]; +Panel.defaultProps = { + renderAs: "nav" +}; +var _default = Panel; +exports["default"] = _default; + +},{"1231efa1840a8f03":"21dqq","94bf4f94c1383a9":"7wKI2","a454e78833cfd80e":"aWHjR","50c95ad95bd20115":"5WqhD","50790c9976f0f92c":"5c2Xf","7f2a359a3676a404":"ixavI","9de1514e8419bc94":"jaknk","e12b8d1aff3d8935":"4nSn7"}],"5WqhD":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("a9a8a62e8092a6d6")); +var _propTypes = _interopRequireDefault(require("3afd38cd6e791661")); +var _classnames = _interopRequireDefault(require("fadaba92c970448c")); +var _element = _interopRequireDefault(require("ee4d006b720b3f25")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var PanelBlock = function PanelBlock(_ref) { + var className = _ref.className, active = _ref.active, props = _objectWithoutProperties(_ref, [ + "className", + "active" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("panel-block", className, { + "is-active": active + }) + })); +}; +var _default = PanelBlock; +exports["default"] = _default; + +},{"a9a8a62e8092a6d6":"21dqq","3afd38cd6e791661":"7wKI2","fadaba92c970448c":"aWHjR","ee4d006b720b3f25":"4nSn7"}],"5c2Xf":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("bce380a6044d139e")); +var _classnames = _interopRequireDefault(require("6c09a7da6a9a26f1")); +var _element = _interopRequireDefault(require("a7be61f643c89616")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var PanelHeader = function PanelHeader(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("panel-heading", className) + })); +}; +var _default = PanelHeader; +exports["default"] = _default; + +},{"bce380a6044d139e":"21dqq","6c09a7da6a9a26f1":"aWHjR","a7be61f643c89616":"4nSn7"}],"ixavI":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("ac26999544e12631")); +var _propTypes = _interopRequireDefault(require("f075837dbf5edb09")); +var _classnames = _interopRequireDefault(require("557ea1a617bfe12f")); +var _element = _interopRequireDefault(require("c10d47c4b853dd6c")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var PanelIcon = function PanelIcon(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("panel-icon", className) + })); +}; +PanelIcon.defaultProps = { + renderAs: "span" +}; +var _default = PanelIcon; +exports["default"] = _default; + +},{"ac26999544e12631":"21dqq","f075837dbf5edb09":"7wKI2","557ea1a617bfe12f":"aWHjR","c10d47c4b853dd6c":"4nSn7"}],"jaknk":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +Object.defineProperty(exports, "default", { + enumerable: true, + get: function get() { + return _tabs["default"]; + } +}); +var _tabs = _interopRequireDefault(require("3ebae22f2adb89d8")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} + +},{"3ebae22f2adb89d8":"8eyXK"}],"8eyXK":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("3f877741a286026a")); +var _classnames = _interopRequireDefault(require("bb078df82f2ae210")); +var _tab = _interopRequireDefault(require("2023a1c3816e46b2")); +var _element = _interopRequireDefault(require("d7f1093a68be7118")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var PanelTabs = function PanelTabs(_ref) { + var className = _ref.className, props = _objectWithoutProperties(_ref, [ + "className" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])("panel-tabs", className) + })); +}; +PanelTabs.Tab = _tab["default"]; +var _default = PanelTabs; +exports["default"] = _default; + +},{"3f877741a286026a":"21dqq","bb078df82f2ae210":"aWHjR","2023a1c3816e46b2":"7AshK","d7f1093a68be7118":"4nSn7"}],"7AshK":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; +var _react = _interopRequireDefault(require("5cb90ebd0abac5f1")); +var _propTypes = _interopRequireDefault(require("96bed6e5cb3e93ef")); +var _classnames = _interopRequireDefault(require("5a6692a08d8c672e")); +var _element = _interopRequireDefault(require("82a54e603e89db0f")); +function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; +} +function _extends() { + _extends = Object.assign || function(target) { + for(var i = 1; i < arguments.length; i++){ + var source = arguments[i]; + for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key]; + } + return target; + }; + return _extends.apply(this, arguments); +} +function _objectWithoutProperties(source, excluded) { + if (source == null) return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for(i = 0; i < sourceSymbolKeys.length; i++){ + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; + target[key] = source[key]; + } + } + return target; +} +function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for(i = 0; i < sourceKeys.length; i++){ + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + return target; +} +var PanelTabsTab = function PanelTabsTab(_ref) { + var className = _ref.className, active = _ref.active, props = _objectWithoutProperties(_ref, [ + "className", + "active" + ]); + return /*#__PURE__*/ _react["default"].createElement(_element["default"], _extends({}, props, { + className: (0, _classnames["default"])(className, { + "is-active": active + }) + })); +}; +PanelTabsTab.defaultProps = { + renderAs: "a" +}; +var _default = PanelTabsTab; +exports["default"] = _default; + +},{"5cb90ebd0abac5f1":"21dqq","96bed6e5cb3e93ef":"7wKI2","5a6692a08d8c672e":"aWHjR","82a54e603e89db0f":"4nSn7"}],"7R39l":[function(require,module,exports) { +var $parcel$ReactRefreshHelpers$b6cb = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js"); +var prevRefreshReg = window.$RefreshReg$; +var prevRefreshSig = window.$RefreshSig$; +$parcel$ReactRefreshHelpers$b6cb.prelude(module); + +try { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _jsxDevRuntime = require("react/jsx-dev-runtime"); +var _react = require("react"); +var _reactAce = require("react-ace"); +var _reactAceDefault = parcelHelpers.interopDefault(_reactAce); +var _modeJavascript = require("ace-builds/src-noconflict/mode-javascript"); +var _themeMonokai = require("ace-builds/src-noconflict/theme-monokai"); +var _extSearchbox = require("ace-builds/src-noconflict/ext-searchbox"); +var _reactBulmaComponents = require("react-bulma-components"); +var _assemblyModeJs = require("./AssemblyMode/AssemblyMode.js"); +var _assemblyModeJsDefault = parcelHelpers.interopDefault(_assemblyModeJs); +var _sampleCodeJs = require("./SampleCode.js"); +var _sampleCodeJsDefault = parcelHelpers.interopDefault(_sampleCodeJs); +var _emulatorJs = require("../../services/emulator.js"); +var _emulatorJsDefault = parcelHelpers.interopDefault(_emulatorJs); +var _editorStoreJs = require("../../stores/editorStore.js"); +var _editorStoreJsDefault = parcelHelpers.interopDefault(_editorStoreJs); +var _emulatorStoreJs = require("../../stores/emulatorStore.js"); +var _emulatorStoreJsDefault = parcelHelpers.interopDefault(_emulatorStoreJs); +var _compilerStoreJs = require("../../stores/compilerStore.js"); +var _compilerStoreJsDefault = parcelHelpers.interopDefault(_compilerStoreJs); +var _editorCss = require("./Editor.css"); +var _s = $RefreshSig$(); +/* + * Handle for save operation + */ const handleSave = (editor)=>editor ? localStorage.setItem("source_code", editor.getValue()) : null; +/* + * Checks if emulator is running and in debug mode + */ const isDebugging = ()=>{ + const { isRunning , runningMode } = (0, _emulatorStoreJsDefault.default).getRawState(); + return isRunning && runningMode === "debug"; +}; +/* + * Configure shortcuts for editor + */ const setupEditorShortcuts = (editor)=>{ + // ACE editor already have Ctrl+D to remove line, but i prefer Ctrl+Y + editor.commands.addCommand({ + bindKey: { + mac: "Command-Y", + win: "Ctrl-Y" + }, + exec: ()=>editor.removeLines(), + multiSelectAction: "forEachLine", + name: "removeline2", + scrollIntoView: "cursor" + }); + editor.commands.addCommand({ + bindKey: { + mac: "F7", + win: "F7" + }, + exec: ()=>isDebugging() && (0, _emulatorJsDefault.default).stepInto(), + multiSelectAction: "forEach", + name: "emulatorStepInto", + readOnly: true, + scrollIntoView: "cursor" + }); + editor.commands.addCommand({ + bindKey: { + mac: "F8", + win: "F8" + }, + exec: ()=>isDebugging() && (0, _emulatorJsDefault.default).stepOver(), + multiSelectAction: "forEach", + name: "emulatorStepOver", + readOnly: true, + scrollIntoView: "cursor" + }); + editor.commands.addCommand({ + bindKey: { + mac: "F9", + win: "F9" + }, + exec: ()=>isDebugging() && (0, _emulatorJsDefault.default).continueExec(), + multiSelectAction: "forEach", + name: "emulatorContinue", + readOnly: true + }); + editor.commands.addCommand({ + bindKey: { + mac: "Cmd-S", + win: "Ctrl-S" + }, + exec: ()=>handleSave(editor), + multiSelectAction: "forEach", + name: "save" + }); +}; +/* + * Creates handler for clicks on gutter (to set/unset breakpoints) + */ const createGutterClickHandler = (session)=>(e)=>{ + const { row } = e.getDocumentPosition(); + if (session.getBreakpoints()[row]) { + (0, _editorStoreJsDefault.default).update((state)=>{ + state.breakpoints.delete(row + 1); + }); + session.clearBreakpoint(row); + } else { + (0, _editorStoreJsDefault.default).update((state)=>{ + state.breakpoints.add(row + 1); + }); + session.setBreakpoint(row); + } + return e.preventDefault(); + }; +/* + * Subscribes to changes, caused by emulator and process them accordingly + * (updates currently executed line, shows errors, etc...) + */ const handleEmulatorUpdates = (editor, session)=>{ + (0, _compilerStoreJsDefault.default).subscribe((state)=>state.errors, (errors)=>session.setAnnotations((errors || []).map((error)=>({ + ...error, + type: "error" + })))); + (0, _emulatorStoreJsDefault.default).subscribe((state)=>state.isRunning, (isRunning, state)=>{ + Object.values(session.getMarkers() || {}).forEach(({ id })=>session.removeMarker(id)); + editor.setReadOnly(isRunning && state.runningMode === "debug"); + }); + (0, _emulatorStoreJsDefault.default).subscribe((state)=>state.registers.pc, (pc, { isRunning , registers , runningMode })=>{ + if (!isRunning || runningMode !== "debug") return; + // remove previous line highlight + Object.values(session.getMarkers() || {}).forEach(({ id })=>session.removeMarker(id)); + const line = (0, _compilerStoreJsDefault.default).getRawState().sourceCodeLineByRomOffsetPerBank[registers.selectedRomBank].get(pc); + if (line === undefined || line === -1) return; + const row = line - 1; + session.highlightLines(row, row); + editor.moveCursorTo(row, 0); + editor.clearSelection(); + if (!editor.isRowFullyVisible(row)) editor.scrollToLine(row); + }); +}; +/* + * Configure settings for ACE editor + */ const setupEditor = (editor)=>{ + const session = editor.getSession(); + session.setMode(new (0, _assemblyModeJsDefault.default)()); + session.setTabSize(2); + editor.renderer.setOptions({ + fixedWidthGutter: true, + showPrintMargin: false + }); + editor.$blockScrolling = Infinity; + editor.on("guttermousedown", createGutterClickHandler(session)); + editor.setValue(localStorage.getItem("source_code") || (0, _sampleCodeJsDefault.default), -1); + setupEditorShortcuts(editor); + handleEmulatorUpdates(editor, session); +}; +function Editor() { + _s(); + const editorRef = (0, _react.useRef)(null); + const setEditorRef = (0, _react.useCallback)((node)=>{ + if (!node) return; + const { editor } = node; + editorRef.current = editor; + (0, _editorStoreJsDefault.default).update((state)=>{ + state.editor = editor; + state.breakpoints = new Set(); + }); + setupEditor(editor); + }, []); + return /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _jsxDevRuntime.Fragment), { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactAceDefault.default), { + ref: setEditorRef, + height: "1024px", + mode: "text", + name: "editor", + theme: "monokai", + width: "auto" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Editor/Editor.js", + lineNumber: 181, + columnNumber: 7 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("div", { + className: "buttons", + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Button), { + color: "success", + onClick: ()=>handleSave(editorRef?.current), + children: "Save" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Editor/Editor.js", + lineNumber: 183, + columnNumber: 9 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Editor/Editor.js", + lineNumber: 182, + columnNumber: 7 + }, this) + ] + }, void 0, true); +} +exports.default = Editor; +_s(Editor, "6UwlcYKwJra1PE1tjOygXqudb4k="); +_c = Editor; +var _c; +$RefreshReg$(_c, "Editor"); + + $parcel$ReactRefreshHelpers$b6cb.postlude(module); +} finally { + window.$RefreshReg$ = prevRefreshReg; + window.$RefreshSig$ = prevRefreshSig; +} +},{"react/jsx-dev-runtime":"iTorj","react":"21dqq","react-ace":"a3gcJ","ace-builds/src-noconflict/mode-javascript":"3ybLa","ace-builds/src-noconflict/theme-monokai":"cfWRh","ace-builds/src-noconflict/ext-searchbox":"45Ax6","react-bulma-components":"hZ2YC","./AssemblyMode/AssemblyMode.js":"ad2mI","./SampleCode.js":"vVMay","../../services/emulator.js":"aWnfx","../../stores/editorStore.js":"egduw","../../stores/emulatorStore.js":"6XWYU","../../stores/compilerStore.js":"cJTIf","./Editor.css":"9o24F","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"km3Ru"}],"a3gcJ":[function(require,module,exports) { +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.diff = exports.split = void 0; +var ace_1 = require("eae9aea38bdc1dce"); +var diff_1 = require("637fc976fc468903"); +exports.diff = diff_1.default; +var split_1 = require("c58bce0e87efe89d"); +exports.split = split_1.default; +exports.default = ace_1.default; + +},{"eae9aea38bdc1dce":"84ISg","637fc976fc468903":"fUVNl","c58bce0e87efe89d":"9GbQS"}],"84ISg":[function(require,module,exports) { +"use strict"; +var __extends = this && this.__extends || function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || ({ + __proto__: [] + }) instanceof Array && function(d, b) { + d.__proto__ = b; + } || function(d, b) { + for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +var __assign = this && this.__assign || function() { + __assign = Object.assign || function(t) { + for(var s, i = 1, n = arguments.length; i < n; i++){ + s = arguments[i]; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { + value: true +}); +var ace_builds_1 = require("4903820a98e3d7f0"); +var PropTypes = require("2f390b422115a017"); +var React = require("6734d1c512acf24d"); +var isEqual = require("1797d6b593055246"); +var editorOptions_1 = require("65bf9d377a606991"); +var ace = (0, editorOptions_1.getAceInstance)(); +var ReactAce = /** @class */ function(_super) { + __extends(ReactAce, _super); + function ReactAce(props) { + var _this = _super.call(this, props) || this; + editorOptions_1.editorEvents.forEach(function(method) { + _this[method] = _this[method].bind(_this); + }); + _this.debounce = editorOptions_1.debounce; + return _this; + } + ReactAce.prototype.isInShadow = function(node) { + var parent = node && node.parentNode; + while(parent){ + if (parent.toString() === "[object ShadowRoot]") return true; + parent = parent.parentNode; + } + return false; + }; + ReactAce.prototype.componentDidMount = function() { + var _this = this; + var _a = this.props, className = _a.className, onBeforeLoad = _a.onBeforeLoad, onValidate = _a.onValidate, mode = _a.mode, focus = _a.focus, theme = _a.theme, fontSize = _a.fontSize, value = _a.value, defaultValue = _a.defaultValue, showGutter = _a.showGutter, wrapEnabled = _a.wrapEnabled, showPrintMargin = _a.showPrintMargin, _b = _a.scrollMargin, scrollMargin = _b === void 0 ? [ + 0, + 0, + 0, + 0 + ] : _b, keyboardHandler = _a.keyboardHandler, onLoad = _a.onLoad, commands = _a.commands, annotations = _a.annotations, markers = _a.markers, placeholder = _a.placeholder; + this.editor = ace.edit(this.refEditor); + if (onBeforeLoad) onBeforeLoad(ace); + var editorProps = Object.keys(this.props.editorProps); + for(var i = 0; i < editorProps.length; i++)this.editor[editorProps[i]] = this.props.editorProps[editorProps[i]]; + if (this.props.debounceChangePeriod) this.onChange = this.debounce(this.onChange, this.props.debounceChangePeriod); + this.editor.renderer.setScrollMargin(scrollMargin[0], scrollMargin[1], scrollMargin[2], scrollMargin[3]); + if (this.isInShadow(this.refEditor)) this.editor.renderer.attachToShadowRoot(); + this.editor.getSession().setMode(typeof mode === "string" ? "ace/mode/" + mode : mode); + if (theme && theme !== "") this.editor.setTheme("ace/theme/" + theme); + this.editor.setFontSize(typeof fontSize === "number" ? fontSize + "px" : fontSize); + this.editor.getSession().setValue(!defaultValue ? value || "" : defaultValue); + if (this.props.navigateToFileEnd) this.editor.navigateFileEnd(); + this.editor.renderer.setShowGutter(showGutter); + this.editor.getSession().setUseWrapMode(wrapEnabled); + this.editor.setShowPrintMargin(showPrintMargin); + this.editor.on("focus", this.onFocus); + this.editor.on("blur", this.onBlur); + this.editor.on("copy", this.onCopy); + this.editor.on("paste", this.onPaste); + this.editor.on("change", this.onChange); + this.editor.on("input", this.onInput); + if (placeholder) this.updatePlaceholder(); + this.editor.getSession().selection.on("changeSelection", this.onSelectionChange); + this.editor.getSession().selection.on("changeCursor", this.onCursorChange); + if (onValidate) // @ts-ignore types don't include + this.editor.getSession().on("changeAnnotation", function() { + // tslint:disable-next-line:no-shadowed-variable + var annotations = _this.editor.getSession().getAnnotations(); + _this.props.onValidate(annotations); + }); + this.editor.session.on("changeScrollTop", this.onScroll); + this.editor.getSession().setAnnotations(annotations || []); + if (markers && markers.length > 0) this.handleMarkers(markers); + // get a list of possible options to avoid 'misspelled option errors' + var availableOptions = this.editor.$options; + editorOptions_1.editorOptions.forEach(function(option) { + if (availableOptions.hasOwnProperty(option)) // @ts-ignore + _this.editor.setOption(option, _this.props[option]); + else if (_this.props[option]) console.warn("ReactAce: editor option " + option + " was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"); + }); + this.handleOptions(this.props); + if (Array.isArray(commands)) commands.forEach(function(command) { + if (typeof command.exec === "string") _this.editor.commands.bindKey(command.bindKey, command.exec); + else _this.editor.commands.addCommand(command); + }); + if (keyboardHandler) this.editor.setKeyboardHandler("ace/keyboard/" + keyboardHandler); + if (className) this.refEditor.className += " " + className; + if (onLoad) onLoad(this.editor); + this.editor.resize(); + if (focus) this.editor.focus(); + }; + ReactAce.prototype.componentDidUpdate = function(prevProps) { + var oldProps = prevProps; + var nextProps = this.props; + for(var i = 0; i < editorOptions_1.editorOptions.length; i++){ + var option = editorOptions_1.editorOptions[i]; + if (nextProps[option] !== oldProps[option]) // @ts-ignore + this.editor.setOption(option, nextProps[option]); + } + if (nextProps.className !== oldProps.className) { + var appliedClasses = this.refEditor.className; + var appliedClassesArray_1 = appliedClasses.trim().split(" "); + var oldClassesArray = oldProps.className.trim().split(" "); + oldClassesArray.forEach(function(oldClass) { + var index = appliedClassesArray_1.indexOf(oldClass); + appliedClassesArray_1.splice(index, 1); + }); + this.refEditor.className = " " + nextProps.className + " " + appliedClassesArray_1.join(" "); + } + // First process editor value, as it may create a new session (see issue #300) + if (this.editor && nextProps.value != null && this.editor.getValue() !== nextProps.value) { + // editor.setValue is a synchronous function call, change event is emitted before setValue return. + this.silent = true; + var pos = this.editor.session.selection.toJSON(); + this.editor.setValue(nextProps.value, nextProps.cursorStart); + this.editor.session.selection.fromJSON(pos); + this.silent = false; + } + if (nextProps.placeholder !== oldProps.placeholder) this.updatePlaceholder(); + if (nextProps.mode !== oldProps.mode) this.editor.getSession().setMode(typeof nextProps.mode === "string" ? "ace/mode/" + nextProps.mode : nextProps.mode); + if (nextProps.theme !== oldProps.theme) this.editor.setTheme("ace/theme/" + nextProps.theme); + if (nextProps.keyboardHandler !== oldProps.keyboardHandler) { + if (nextProps.keyboardHandler) this.editor.setKeyboardHandler("ace/keyboard/" + nextProps.keyboardHandler); + else this.editor.setKeyboardHandler(null); + } + if (nextProps.fontSize !== oldProps.fontSize) this.editor.setFontSize(typeof nextProps.fontSize === "number" ? nextProps.fontSize + "px" : nextProps.fontSize); + if (nextProps.wrapEnabled !== oldProps.wrapEnabled) this.editor.getSession().setUseWrapMode(nextProps.wrapEnabled); + if (nextProps.showPrintMargin !== oldProps.showPrintMargin) this.editor.setShowPrintMargin(nextProps.showPrintMargin); + if (nextProps.showGutter !== oldProps.showGutter) this.editor.renderer.setShowGutter(nextProps.showGutter); + if (!isEqual(nextProps.setOptions, oldProps.setOptions)) this.handleOptions(nextProps); + if (!isEqual(nextProps.annotations, oldProps.annotations)) this.editor.getSession().setAnnotations(nextProps.annotations || []); + if (!isEqual(nextProps.markers, oldProps.markers) && Array.isArray(nextProps.markers)) this.handleMarkers(nextProps.markers); + // this doesn't look like it works at all.... + if (!isEqual(nextProps.scrollMargin, oldProps.scrollMargin)) this.handleScrollMargins(nextProps.scrollMargin); + if (prevProps.height !== this.props.height || prevProps.width !== this.props.width) this.editor.resize(); + if (this.props.focus && !prevProps.focus) this.editor.focus(); + }; + ReactAce.prototype.handleScrollMargins = function(margins) { + if (margins === void 0) margins = [ + 0, + 0, + 0, + 0 + ]; + this.editor.renderer.setScrollMargin(margins[0], margins[1], margins[2], margins[3]); + }; + ReactAce.prototype.componentWillUnmount = function() { + this.editor.destroy(); + this.editor = null; + }; + ReactAce.prototype.onChange = function(event) { + if (this.props.onChange && !this.silent) { + var value = this.editor.getValue(); + this.props.onChange(value, event); + } + }; + ReactAce.prototype.onSelectionChange = function(event) { + if (this.props.onSelectionChange) { + var value = this.editor.getSelection(); + this.props.onSelectionChange(value, event); + } + }; + ReactAce.prototype.onCursorChange = function(event) { + if (this.props.onCursorChange) { + var value = this.editor.getSelection(); + this.props.onCursorChange(value, event); + } + }; + ReactAce.prototype.onInput = function(event) { + if (this.props.onInput) this.props.onInput(event); + if (this.props.placeholder) this.updatePlaceholder(); + }; + ReactAce.prototype.onFocus = function(event) { + if (this.props.onFocus) this.props.onFocus(event, this.editor); + }; + ReactAce.prototype.onBlur = function(event) { + if (this.props.onBlur) this.props.onBlur(event, this.editor); + }; + ReactAce.prototype.onCopy = function(_a) { + var text = _a.text; + if (this.props.onCopy) this.props.onCopy(text); + }; + ReactAce.prototype.onPaste = function(_a) { + var text = _a.text; + if (this.props.onPaste) this.props.onPaste(text); + }; + ReactAce.prototype.onScroll = function() { + if (this.props.onScroll) this.props.onScroll(this.editor); + }; + ReactAce.prototype.handleOptions = function(props) { + var setOptions = Object.keys(props.setOptions); + for(var y = 0; y < setOptions.length; y++)// @ts-ignore + this.editor.setOption(setOptions[y], props.setOptions[setOptions[y]]); + }; + ReactAce.prototype.handleMarkers = function(markers) { + var _this = this; + // remove foreground markers + var currentMarkers = this.editor.getSession().getMarkers(true); + for(var i in currentMarkers)if (currentMarkers.hasOwnProperty(i)) this.editor.getSession().removeMarker(currentMarkers[i].id); + // remove background markers except active line marker and selected word marker + currentMarkers = this.editor.getSession().getMarkers(false); + for(var i in currentMarkers)if (currentMarkers.hasOwnProperty(i) && currentMarkers[i].clazz !== "ace_active-line" && currentMarkers[i].clazz !== "ace_selected-word") this.editor.getSession().removeMarker(currentMarkers[i].id); + // add new markers + markers.forEach(function(_a) { + var startRow = _a.startRow, startCol = _a.startCol, endRow = _a.endRow, endCol = _a.endCol, className = _a.className, type = _a.type, _b = _a.inFront, inFront = _b === void 0 ? false : _b; + var range = new ace_builds_1.Range(startRow, startCol, endRow, endCol); + _this.editor.getSession().addMarker(range, className, type, inFront); + }); + }; + ReactAce.prototype.updatePlaceholder = function() { + // Adapted from https://stackoverflow.com/questions/26695708/how-can-i-add-placeholder-text-when-the-editor-is-empty + var editor = this.editor; + var placeholder = this.props.placeholder; + var showPlaceholder = !editor.session.getValue().length; + var node = editor.renderer.placeholderNode; + if (!showPlaceholder && node) { + editor.renderer.scroller.removeChild(editor.renderer.placeholderNode); + editor.renderer.placeholderNode = null; + } else if (showPlaceholder && !node) { + node = editor.renderer.placeholderNode = document.createElement("div"); + node.textContent = placeholder || ""; + node.className = "ace_comment ace_placeholder"; + node.style.padding = "0 9px"; + node.style.position = "absolute"; + node.style.zIndex = "3"; + editor.renderer.scroller.appendChild(node); + } else if (showPlaceholder && node) node.textContent = placeholder; + }; + ReactAce.prototype.updateRef = function(item) { + this.refEditor = item; + }; + ReactAce.prototype.render = function() { + var _a = this.props, name = _a.name, width = _a.width, height = _a.height, style = _a.style; + var divStyle = __assign({ + width: width, + height: height + }, style); + return React.createElement("div", { + ref: this.updateRef, + id: name, + style: divStyle + }); + }; + ReactAce.propTypes = { + mode: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.object + ]), + focus: PropTypes.bool, + theme: PropTypes.string, + name: PropTypes.string, + className: PropTypes.string, + height: PropTypes.string, + width: PropTypes.string, + fontSize: PropTypes.oneOfType([ + PropTypes.number, + PropTypes.string + ]), + showGutter: PropTypes.bool, + onChange: PropTypes.func, + onCopy: PropTypes.func, + onPaste: PropTypes.func, + onFocus: PropTypes.func, + onInput: PropTypes.func, + onBlur: PropTypes.func, + onScroll: PropTypes.func, + value: PropTypes.string, + defaultValue: PropTypes.string, + onLoad: PropTypes.func, + onSelectionChange: PropTypes.func, + onCursorChange: PropTypes.func, + onBeforeLoad: PropTypes.func, + onValidate: PropTypes.func, + minLines: PropTypes.number, + maxLines: PropTypes.number, + readOnly: PropTypes.bool, + highlightActiveLine: PropTypes.bool, + tabSize: PropTypes.number, + showPrintMargin: PropTypes.bool, + cursorStart: PropTypes.number, + debounceChangePeriod: PropTypes.number, + editorProps: PropTypes.object, + setOptions: PropTypes.object, + style: PropTypes.object, + scrollMargin: PropTypes.array, + annotations: PropTypes.array, + markers: PropTypes.array, + keyboardHandler: PropTypes.string, + wrapEnabled: PropTypes.bool, + enableSnippets: PropTypes.bool, + enableBasicAutocompletion: PropTypes.oneOfType([ + PropTypes.bool, + PropTypes.array + ]), + enableLiveAutocompletion: PropTypes.oneOfType([ + PropTypes.bool, + PropTypes.array + ]), + navigateToFileEnd: PropTypes.bool, + commands: PropTypes.array, + placeholder: PropTypes.string + }; + ReactAce.defaultProps = { + name: "ace-editor", + focus: false, + mode: "", + theme: "", + height: "500px", + width: "500px", + fontSize: 12, + enableSnippets: false, + showGutter: true, + onChange: null, + onPaste: null, + onLoad: null, + onScroll: null, + minLines: null, + maxLines: null, + readOnly: false, + highlightActiveLine: true, + showPrintMargin: true, + tabSize: 4, + cursorStart: 1, + editorProps: {}, + style: {}, + scrollMargin: [ + 0, + 0, + 0, + 0 + ], + setOptions: {}, + wrapEnabled: false, + enableBasicAutocompletion: false, + enableLiveAutocompletion: false, + placeholder: null, + navigateToFileEnd: true + }; + return ReactAce; +}(React.Component); +exports.default = ReactAce; + +},{"4903820a98e3d7f0":"lnKN4","2f390b422115a017":"7wKI2","6734d1c512acf24d":"21dqq","1797d6b593055246":"6emId","65bf9d377a606991":"aBDZN"}],"lnKN4":[function(require,module,exports) { +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2010, Ajax.org B.V. + * 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. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 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 AJAX.ORG B.V. 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. + * + * ***** END LICENSE BLOCK ***** */ /** + * Define a module along with a payload + * @param module a name for the payload + * @param payload a function to call with (require, exports, module) params + */ (function() { + var ACE_NAMESPACE = "ace"; + var global = function() { + return this; + }(); + if (!global && typeof window != "undefined") global = window; // strict mode + if (!ACE_NAMESPACE && typeof requirejs !== "undefined") return; + var define1 = function(module1, deps, payload) { + if (typeof module1 !== "string") { + if (define1.original) define1.original.apply(this, arguments); + else { + console.error("dropping module because define wasn't a string."); + console.trace(); + } + return; + } + if (arguments.length == 2) payload = deps; + if (!define1.modules[module1]) { + define1.payloads[module1] = payload; + define1.modules[module1] = null; + } + }; + define1.modules = {}; + define1.payloads = {}; + /** + * Get at functionality define()ed using the function above + */ var _require = function(parentId, module1, callback) { + if (typeof module1 === "string") { + var payload = lookup(parentId, module1); + if (payload != undefined) { + callback && callback(); + return payload; + } + } else if (Object.prototype.toString.call(module1) === "[object Array]") { + var params = []; + for(var i = 0, l = module1.length; i < l; ++i){ + var dep = lookup(parentId, module1[i]); + if (dep == undefined && require.original) return; + params.push(dep); + } + return callback && callback.apply(null, params) || true; + } + }; + var require = function(module1, callback) { + var packagedModule = _require("", module1, callback); + if (packagedModule == undefined && require.original) return require.original.apply(this, arguments); + return packagedModule; + }; + var normalizeModule = function(parentId, moduleName) { + // normalize plugin requires + if (moduleName.indexOf("!") !== -1) { + var chunks = moduleName.split("!"); + return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]); + } + // normalize relative requires + if (moduleName.charAt(0) == ".") { + var base = parentId.split("/").slice(0, -1).join("/"); + moduleName = base + "/" + moduleName; + while(moduleName.indexOf(".") !== -1 && previous != moduleName){ + var previous = moduleName; + moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, ""); + } + } + return moduleName; + }; + /** + * Internal function to lookup moduleNames and resolve them by calling the + * definition function if needed. + */ var lookup = function(parentId, moduleName) { + moduleName = normalizeModule(parentId, moduleName); + var module1 = define1.modules[moduleName]; + if (!module1) { + module1 = define1.payloads[moduleName]; + if (typeof module1 === "function") { + var exports = {}; + var mod = { + id: moduleName, + uri: "", + exports: exports, + packaged: true + }; + var req = function(module1, callback) { + return _require(moduleName, module1, callback); + }; + var returnValue = module1(req, exports, mod); + exports = returnValue || mod.exports; + define1.modules[moduleName] = exports; + delete define1.payloads[moduleName]; + } + module1 = define1.modules[moduleName] = exports || module1; + } + return module1; + }; + function exportAce(ns) { + var root = global; + if (ns) { + if (!global[ns]) global[ns] = {}; + root = global[ns]; + } + if (!root.define || !root.define.packaged) { + define1.original = root.define; + root.define = define1; + root.define.packaged = true; + } + if (!root.require || !root.require.packaged) { + require.original = root.require; + root.require = require; + root.require.packaged = true; + } + } + exportAce(ACE_NAMESPACE); +})(); +ace.define("ace/lib/es6-shim", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + function defineProp(obj, name, val) { + Object.defineProperty(obj, name, { + value: val, + enumerable: false, + writable: true, + configurable: true + }); + } + if (!String.prototype.startsWith) defineProp(String.prototype, "startsWith", function(searchString, position) { + position = position || 0; + return this.lastIndexOf(searchString, position) === position; + }); + if (!String.prototype.endsWith) defineProp(String.prototype, "endsWith", function(searchString, position) { + var subjectString = this; + if (position === undefined || position > subjectString.length) position = subjectString.length; + position -= searchString.length; + var lastIndex = subjectString.indexOf(searchString, position); + return lastIndex !== -1 && lastIndex === position; + }); + if (!String.prototype.repeat) defineProp(String.prototype, "repeat", function(count) { + var result = ""; + var string = this; + while(count > 0){ + if (count & 1) result += string; + if (count >>= 1) string += string; + } + return result; + }); + if (!String.prototype.includes) defineProp(String.prototype, "includes", function(str, position) { + return this.indexOf(str, position) != -1; + }); + if (!Object.assign) Object.assign = function(target) { + if (target === undefined || target === null) throw new TypeError("Cannot convert undefined or null to object"); + var output = Object(target); + for(var index = 1; index < arguments.length; index++){ + var source = arguments[index]; + if (source !== undefined && source !== null) Object.keys(source).forEach(function(key) { + output[key] = source[key]; + }); + } + return output; + }; + if (!Object.values) Object.values = function(o) { + return Object.keys(o).map(function(k) { + return o[k]; + }); + }; + if (!Array.prototype.find) defineProp(Array.prototype, "find", function(predicate) { + var len = this.length; + var thisArg = arguments[1]; + for(var k = 0; k < len; k++){ + var kValue = this[k]; + if (predicate.call(thisArg, kValue, k, this)) return kValue; + } + }); + if (!Array.prototype.findIndex) defineProp(Array.prototype, "findIndex", function(predicate) { + var len = this.length; + var thisArg = arguments[1]; + for(var k = 0; k < len; k++){ + var kValue = this[k]; + if (predicate.call(thisArg, kValue, k, this)) return k; + } + }); + if (!Array.prototype.includes) defineProp(Array.prototype, "includes", function(item, position) { + return this.indexOf(item, position) != -1; + }); + if (!Array.prototype.fill) defineProp(Array.prototype, "fill", function(value) { + var O = this; + var len = O.length >>> 0; + var start = arguments[1]; + var relativeStart = start >> 0; + var k = relativeStart < 0 ? Math.max(len + relativeStart, 0) : Math.min(relativeStart, len); + var end = arguments[2]; + var relativeEnd = end === undefined ? len : end >> 0; + var final = relativeEnd < 0 ? Math.max(len + relativeEnd, 0) : Math.min(relativeEnd, len); + while(k < final){ + O[k] = value; + k++; + } + return O; + }); + if (!Array.of) defineProp(Array, "of", function() { + return Array.prototype.slice.call(arguments); + }); +}); +ace.define("ace/lib/fixoldbrowsers", [ + "require", + "exports", + "module", + "ace/lib/es6-shim" +], function(require, exports, module1) { + "use strict"; + require("./es6-shim"); +}); +ace.define("ace/lib/lang", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + "use strict"; + exports.last = function(a) { + return a[a.length - 1]; + }; + exports.stringReverse = function(string) { + return string.split("").reverse().join(""); + }; + exports.stringRepeat = function(string, count) { + var result = ""; + while(count > 0){ + if (count & 1) result += string; + if (count >>= 1) string += string; + } + return result; + }; + var trimBeginRegexp = /^\s\s*/; + var trimEndRegexp = /\s\s*$/; + exports.stringTrimLeft = function(string) { + return string.replace(trimBeginRegexp, ""); + }; + exports.stringTrimRight = function(string) { + return string.replace(trimEndRegexp, ""); + }; + exports.copyObject = function(obj) { + var copy = {}; + for(var key in obj)copy[key] = obj[key]; + return copy; + }; + exports.copyArray = function(array) { + var copy = []; + for(var i = 0, l = array.length; i < l; i++)if (array[i] && typeof array[i] == "object") copy[i] = this.copyObject(array[i]); + else copy[i] = array[i]; + return copy; + }; + exports.deepCopy = function deepCopy(obj) { + if (typeof obj !== "object" || !obj) return obj; + var copy; + if (Array.isArray(obj)) { + copy = []; + for(var key = 0; key < obj.length; key++)copy[key] = deepCopy(obj[key]); + return copy; + } + if (Object.prototype.toString.call(obj) !== "[object Object]") return obj; + copy = {}; + for(var key in obj)copy[key] = deepCopy(obj[key]); + return copy; + }; + exports.arrayToMap = function(arr) { + var map = {}; + for(var i = 0; i < arr.length; i++)map[arr[i]] = 1; + return map; + }; + exports.createMap = function(props) { + var map = Object.create(null); + for(var i in props)map[i] = props[i]; + return map; + }; + exports.arrayRemove = function(array, value) { + for(var i = 0; i <= array.length; i++)if (value === array[i]) array.splice(i, 1); + }; + exports.escapeRegExp = function(str) { + return str.replace(/([.*+?^${}()|[\]\/\\])/g, "\\$1"); + }; + exports.escapeHTML = function(str) { + return ("" + str).replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/= 0 ? parseFloat((ua.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/) || [])[1]) : parseFloat((ua.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/) || [])[1]); // for ie + exports.isOldIE = exports.isIE && exports.isIE < 9; + exports.isGecko = exports.isMozilla = ua.match(/ Gecko\/\d+/); + exports.isOpera = typeof opera == "object" && Object.prototype.toString.call(window.opera) == "[object Opera]"; + exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined; + exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined; + exports.isEdge = parseFloat(ua.split(" Edge/")[1]) || undefined; + exports.isAIR = ua.indexOf("AdobeAIR") >= 0; + exports.isAndroid = ua.indexOf("Android") >= 0; + exports.isChromeOS = ua.indexOf(" CrOS ") >= 0; + exports.isIOS = /iPad|iPhone|iPod/.test(ua) && !window.MSStream; + if (exports.isIOS) exports.isMac = true; + exports.isMobile = exports.isIOS || exports.isAndroid; +}); +ace.define("ace/lib/dom", [ + "require", + "exports", + "module", + "ace/lib/useragent" +], function(require, exports, module1) { + "use strict"; + var useragent = require("./useragent"); + var XHTML_NS = "http://www.w3.org/1999/xhtml"; + exports.buildDom = function buildDom(arr, parent, refs) { + if (typeof arr == "string" && arr) { + var txt = document.createTextNode(arr); + if (parent) parent.appendChild(txt); + return txt; + } + if (!Array.isArray(arr)) { + if (arr && arr.appendChild && parent) parent.appendChild(arr); + return arr; + } + if (typeof arr[0] != "string" || !arr[0]) { + var els = []; + for(var i = 0; i < arr.length; i++){ + var ch = buildDom(arr[i], parent, refs); + ch && els.push(ch); + } + return els; + } + var el = document.createElement(arr[0]); + var options = arr[1]; + var childIndex = 1; + if (options && typeof options == "object" && !Array.isArray(options)) childIndex = 2; + for(var i = childIndex; i < arr.length; i++)buildDom(arr[i], el, refs); + if (childIndex == 2) Object.keys(options).forEach(function(n) { + var val = options[n]; + if (n === "class") el.className = Array.isArray(val) ? val.join(" ") : val; + else if (typeof val == "function" || n == "value" || n[0] == "$") el[n] = val; + else if (n === "ref") { + if (refs) refs[val] = el; + } else if (n === "style") { + if (typeof val == "string") el.style.cssText = val; + } else if (val != null) el.setAttribute(n, val); + }); + if (parent) parent.appendChild(el); + return el; + }; + exports.getDocumentHead = function(doc) { + if (!doc) doc = document; + return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement; + }; + exports.createElement = function(tag, ns) { + return document.createElementNS ? document.createElementNS(ns || XHTML_NS, tag) : document.createElement(tag); + }; + exports.removeChildren = function(element) { + element.innerHTML = ""; + }; + exports.createTextNode = function(textContent, element) { + var doc = element ? element.ownerDocument : document; + return doc.createTextNode(textContent); + }; + exports.createFragment = function(element) { + var doc = element ? element.ownerDocument : document; + return doc.createDocumentFragment(); + }; + exports.hasCssClass = function(el, name) { + var classes = (el.className + "").split(/\s+/g); + return classes.indexOf(name) !== -1; + }; + exports.addCssClass = function(el, name) { + if (!exports.hasCssClass(el, name)) el.className += " " + name; + }; + exports.removeCssClass = function(el, name) { + var classes = el.className.split(/\s+/g); + while(true){ + var index = classes.indexOf(name); + if (index == -1) break; + classes.splice(index, 1); + } + el.className = classes.join(" "); + }; + exports.toggleCssClass = function(el, name) { + var classes = el.className.split(/\s+/g), add = true; + while(true){ + var index = classes.indexOf(name); + if (index == -1) break; + add = false; + classes.splice(index, 1); + } + if (add) classes.push(name); + el.className = classes.join(" "); + return add; + }; + exports.setCssClass = function(node, className, include) { + if (include) exports.addCssClass(node, className); + else exports.removeCssClass(node, className); + }; + exports.hasCssString = function(id, doc) { + var index = 0, sheets; + doc = doc || document; + if (sheets = doc.querySelectorAll("style")) while(index < sheets.length){ + if (sheets[index++].id === id) return true; + } + }; + exports.removeElementById = function(id, doc) { + doc = doc || document; + if (doc.getElementById(id)) doc.getElementById(id).remove(); + }; + var strictCSP; + var cssCache = []; + exports.useStrictCSP = function(value) { + strictCSP = value; + if (value == false) insertPendingStyles(); + else if (!cssCache) cssCache = []; + }; + function insertPendingStyles() { + var cache = cssCache; + cssCache = null; + cache && cache.forEach(function(item) { + importCssString(item[0], item[1]); + }); + } + function importCssString(cssText, id, target) { + if (typeof document == "undefined") return; + if (cssCache) { + if (target) insertPendingStyles(); + else if (target === false) return cssCache.push([ + cssText, + id + ]); + } + if (strictCSP) return; + var container = target; + if (!target || !target.getRootNode) container = document; + else { + container = target.getRootNode(); + if (!container || container == target) container = document; + } + var doc = container.ownerDocument || container; + if (id && exports.hasCssString(id, container)) return null; + if (id) cssText += "\n/*# sourceURL=ace/css/" + id + " */"; + var style = exports.createElement("style"); + style.appendChild(doc.createTextNode(cssText)); + if (id) style.id = id; + if (container == doc) container = exports.getDocumentHead(doc); + container.insertBefore(style, container.firstChild); + } + exports.importCssString = importCssString; + exports.importCssStylsheet = function(uri, doc) { + exports.buildDom([ + "link", + { + rel: "stylesheet", + href: uri + } + ], exports.getDocumentHead(doc)); + }; + exports.scrollbarWidth = function(doc) { + var inner = exports.createElement("ace_inner"); + inner.style.width = "100%"; + inner.style.minWidth = "0px"; + inner.style.height = "200px"; + inner.style.display = "block"; + var outer = exports.createElement("ace_outer"); + var style = outer.style; + style.position = "absolute"; + style.left = "-10000px"; + style.overflow = "hidden"; + style.width = "200px"; + style.minWidth = "0px"; + style.height = "150px"; + style.display = "block"; + outer.appendChild(inner); + var body = doc && doc.documentElement || document && document.documentElement; + if (!body) return 0; + body.appendChild(outer); + var noScrollbar = inner.offsetWidth; + style.overflow = "scroll"; + var withScrollbar = inner.offsetWidth; + if (noScrollbar === withScrollbar) withScrollbar = outer.clientWidth; + body.removeChild(outer); + return noScrollbar - withScrollbar; + }; + exports.computedStyle = function(element, style) { + return window.getComputedStyle(element, "") || {}; + }; + exports.setStyle = function(styles, property, value) { + if (styles[property] !== value) styles[property] = value; + }; + exports.HAS_CSS_ANIMATION = false; + exports.HAS_CSS_TRANSFORMS = false; + exports.HI_DPI = useragent.isWin ? typeof window !== "undefined" && window.devicePixelRatio >= 1.5 : true; + if (useragent.isChromeOS) exports.HI_DPI = false; + if (typeof document !== "undefined") { + var div = document.createElement("div"); + if (exports.HI_DPI && div.style.transform !== undefined) exports.HAS_CSS_TRANSFORMS = true; + if (!useragent.isEdge && typeof div.style.animationName !== "undefined") exports.HAS_CSS_ANIMATION = true; + div = null; + } + if (exports.HAS_CSS_TRANSFORMS) exports.translate = function(element, tx, ty) { + element.style.transform = "translate(" + Math.round(tx) + "px, " + Math.round(ty) + "px)"; + }; + else exports.translate = function(element, tx, ty) { + element.style.top = Math.round(ty) + "px"; + element.style.left = Math.round(tx) + "px"; + }; +}); +ace.define("ace/lib/net", [ + "require", + "exports", + "module", + "ace/lib/dom" +], function(require, exports, module1) { + "use strict"; + var dom = require("./dom"); + exports.get = function(url, callback) { + var xhr = new XMLHttpRequest(); + xhr.open("GET", url, true); + xhr.onreadystatechange = function() { + if (xhr.readyState === 4) callback(xhr.responseText); + }; + xhr.send(null); + }; + exports.loadScript = function(path, callback) { + var head = dom.getDocumentHead(); + var s = document.createElement("script"); + s.src = path; + head.appendChild(s); + s.onload = s.onreadystatechange = function(_, isAbort) { + if (isAbort || !s.readyState || s.readyState == "loaded" || s.readyState == "complete") { + s = s.onload = s.onreadystatechange = null; + if (!isAbort) callback(); + } + }; + }; + exports.qualifyURL = function(url) { + var a = document.createElement("a"); + a.href = url; + return a.href; + }; +}); +ace.define("ace/lib/event_emitter", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + "use strict"; + var EventEmitter = {}; + var stopPropagation = function() { + this.propagationStopped = true; + }; + var preventDefault = function() { + this.defaultPrevented = true; + }; + EventEmitter._emit = EventEmitter._dispatchEvent = function(eventName, e) { + this._eventRegistry || (this._eventRegistry = {}); + this._defaultHandlers || (this._defaultHandlers = {}); + var listeners = this._eventRegistry[eventName] || []; + var defaultHandler = this._defaultHandlers[eventName]; + if (!listeners.length && !defaultHandler) return; + if (typeof e != "object" || !e) e = {}; + if (!e.type) e.type = eventName; + if (!e.stopPropagation) e.stopPropagation = stopPropagation; + if (!e.preventDefault) e.preventDefault = preventDefault; + listeners = listeners.slice(); + for(var i = 0; i < listeners.length; i++){ + listeners[i](e, this); + if (e.propagationStopped) break; + } + if (defaultHandler && !e.defaultPrevented) return defaultHandler(e, this); + }; + EventEmitter._signal = function(eventName, e) { + var listeners = (this._eventRegistry || {})[eventName]; + if (!listeners) return; + listeners = listeners.slice(); + for(var i = 0; i < listeners.length; i++)listeners[i](e, this); + }; + EventEmitter.once = function(eventName, callback) { + var _self = this; + this.on(eventName, function newCallback() { + _self.off(eventName, newCallback); + callback.apply(null, arguments); + }); + if (!callback) return new Promise(function(resolve) { + callback = resolve; + }); + }; + EventEmitter.setDefaultHandler = function(eventName, callback) { + var handlers = this._defaultHandlers; + if (!handlers) handlers = this._defaultHandlers = { + _disabled_: {} + }; + if (handlers[eventName]) { + var old = handlers[eventName]; + var disabled = handlers._disabled_[eventName]; + if (!disabled) handlers._disabled_[eventName] = disabled = []; + disabled.push(old); + var i = disabled.indexOf(callback); + if (i != -1) disabled.splice(i, 1); + } + handlers[eventName] = callback; + }; + EventEmitter.removeDefaultHandler = function(eventName, callback) { + var handlers = this._defaultHandlers; + if (!handlers) return; + var disabled = handlers._disabled_[eventName]; + if (handlers[eventName] == callback) { + if (disabled) this.setDefaultHandler(eventName, disabled.pop()); + } else if (disabled) { + var i = disabled.indexOf(callback); + if (i != -1) disabled.splice(i, 1); + } + }; + EventEmitter.on = EventEmitter.addEventListener = function(eventName, callback, capturing) { + this._eventRegistry = this._eventRegistry || {}; + var listeners = this._eventRegistry[eventName]; + if (!listeners) listeners = this._eventRegistry[eventName] = []; + if (listeners.indexOf(callback) == -1) listeners[capturing ? "unshift" : "push"](callback); + return callback; + }; + EventEmitter.off = EventEmitter.removeListener = EventEmitter.removeEventListener = function(eventName, callback) { + this._eventRegistry = this._eventRegistry || {}; + var listeners = this._eventRegistry[eventName]; + if (!listeners) return; + var index = listeners.indexOf(callback); + if (index !== -1) listeners.splice(index, 1); + }; + EventEmitter.removeAllListeners = function(eventName) { + if (!eventName) this._eventRegistry = this._defaultHandlers = undefined; + if (this._eventRegistry) this._eventRegistry[eventName] = undefined; + if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined; + }; + exports.EventEmitter = EventEmitter; +}); +ace.define("ace/lib/app_config", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/lib/event_emitter" +], function(require, exports, module1) { + "no use strict"; + var oop = require("./oop"); + var EventEmitter = require("./event_emitter").EventEmitter; + var optionsProvider = { + setOptions: function(optList) { + Object.keys(optList).forEach(function(key) { + this.setOption(key, optList[key]); + }, this); + }, + getOptions: function(optionNames) { + var result = {}; + if (!optionNames) { + var options = this.$options; + optionNames = Object.keys(options).filter(function(key) { + return !options[key].hidden; + }); + } else if (!Array.isArray(optionNames)) { + result = optionNames; + optionNames = Object.keys(result); + } + optionNames.forEach(function(key) { + result[key] = this.getOption(key); + }, this); + return result; + }, + setOption: function(name, value) { + if (this["$" + name] === value) return; + var opt = this.$options[name]; + if (!opt) return warn('misspelled option "' + name + '"'); + if (opt.forwardTo) return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value); + if (!opt.handlesSet) this["$" + name] = value; + if (opt && opt.set) opt.set.call(this, value); + }, + getOption: function(name) { + var opt = this.$options[name]; + if (!opt) return warn('misspelled option "' + name + '"'); + if (opt.forwardTo) return this[opt.forwardTo] && this[opt.forwardTo].getOption(name); + return opt && opt.get ? opt.get.call(this) : this["$" + name]; + } + }; + function warn(message) { + if (typeof console != "undefined" && console.warn) console.warn.apply(console, arguments); + } + function reportError(msg, data) { + var e = new Error(msg); + e.data = data; + if (typeof console == "object" && console.error) console.error(e); + setTimeout(function() { + throw e; + }); + } + var AppConfig = function() { + this.$defaultOptions = {}; + }; + (function() { + oop.implement(this, EventEmitter); + this.defineOptions = function(obj, path, options) { + if (!obj.$options) this.$defaultOptions[path] = obj.$options = {}; + Object.keys(options).forEach(function(key) { + var opt = options[key]; + if (typeof opt == "string") opt = { + forwardTo: opt + }; + opt.name || (opt.name = key); + obj.$options[opt.name] = opt; + if ("initialValue" in opt) obj["$" + opt.name] = opt.initialValue; + }); + oop.implement(obj, optionsProvider); + return this; + }; + this.resetOptions = function(obj) { + Object.keys(obj.$options).forEach(function(key) { + var opt = obj.$options[key]; + if ("value" in opt) obj.setOption(key, opt.value); + }); + }; + this.setDefaultValue = function(path, name, value) { + if (!path) { + for(path in this.$defaultOptions)if (this.$defaultOptions[path][name]) break; + if (!this.$defaultOptions[path][name]) return false; + } + var opts = this.$defaultOptions[path] || (this.$defaultOptions[path] = {}); + if (opts[name]) { + if (opts.forwardTo) this.setDefaultValue(opts.forwardTo, name, value); + else opts[name].value = value; + } + }; + this.setDefaultValues = function(path, optionHash) { + Object.keys(optionHash).forEach(function(key) { + this.setDefaultValue(path, key, optionHash[key]); + }, this); + }; + this.warn = warn; + this.reportError = reportError; + }).call(AppConfig.prototype); + exports.AppConfig = AppConfig; +}); +ace.define("ace/theme/textmate.css", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + module1.exports = '.ace-tm .ace_gutter {\n background: #f0f0f0;\n color: #333;\n}\n\n.ace-tm .ace_print-margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-tm .ace_fold {\n background-color: #6B72E6;\n}\n\n.ace-tm {\n background-color: #FFFFFF;\n color: black;\n}\n\n.ace-tm .ace_cursor {\n color: black;\n}\n \n.ace-tm .ace_invisible {\n color: rgb(191, 191, 191);\n}\n\n.ace-tm .ace_storage,\n.ace-tm .ace_keyword {\n color: blue;\n}\n\n.ace-tm .ace_constant {\n color: rgb(197, 6, 11);\n}\n\n.ace-tm .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-tm .ace_constant.ace_language {\n color: rgb(88, 92, 246);\n}\n\n.ace-tm .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_invalid {\n background-color: rgba(255, 0, 0, 0.1);\n color: red;\n}\n\n.ace-tm .ace_support.ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-tm .ace_support.ace_constant {\n color: rgb(6, 150, 14);\n}\n\n.ace-tm .ace_support.ace_type,\n.ace-tm .ace_support.ace_class {\n color: rgb(109, 121, 222);\n}\n\n.ace-tm .ace_keyword.ace_operator {\n color: rgb(104, 118, 135);\n}\n\n.ace-tm .ace_string {\n color: rgb(3, 106, 7);\n}\n\n.ace-tm .ace_comment {\n color: rgb(76, 136, 107);\n}\n\n.ace-tm .ace_comment.ace_doc {\n color: rgb(0, 102, 255);\n}\n\n.ace-tm .ace_comment.ace_doc.ace_tag {\n color: rgb(128, 159, 191);\n}\n\n.ace-tm .ace_constant.ace_numeric {\n color: rgb(0, 0, 205);\n}\n\n.ace-tm .ace_variable {\n color: rgb(49, 132, 149);\n}\n\n.ace-tm .ace_xml-pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-tm .ace_entity.ace_name.ace_function {\n color: #0000A2;\n}\n\n\n.ace-tm .ace_heading {\n color: rgb(12, 7, 255);\n}\n\n.ace-tm .ace_list {\n color:rgb(185, 6, 144);\n}\n\n.ace-tm .ace_meta.ace_tag {\n color:rgb(0, 22, 142);\n}\n\n.ace-tm .ace_string.ace_regex {\n color: rgb(255, 0, 0)\n}\n\n.ace-tm .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n.ace-tm.ace_multiselect .ace_selection.ace_start {\n box-shadow: 0 0 3px 0px white;\n}\n.ace-tm .ace_marker-layer .ace_step {\n background: rgb(252, 255, 0);\n}\n\n.ace-tm .ace_marker-layer .ace_stack {\n background: rgb(164, 229, 101);\n}\n\n.ace-tm .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-tm .ace_marker-layer .ace_active-line {\n background: rgba(0, 0, 0, 0.07);\n}\n\n.ace-tm .ace_gutter-active-line {\n background-color : #dcdcdc;\n}\n\n.ace-tm .ace_marker-layer .ace_selected-word {\n background: rgb(250, 250, 255);\n border: 1px solid rgb(200, 200, 250);\n}\n\n.ace-tm .ace_indent-guide {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;\n}\n\n.ace-tm .ace_indent-guide-active {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;\n}\n'; +}); +ace.define("ace/theme/textmate", [ + "require", + "exports", + "module", + "ace/theme/textmate.css", + "ace/lib/dom" +], function(require, exports, module1) { + "use strict"; + exports.isDark = false; + exports.cssClass = "ace-tm"; + exports.cssText = require("./textmate.css"); + exports.$id = "ace/theme/textmate"; + var dom = require("../lib/dom"); + dom.importCssString(exports.cssText, exports.cssClass, false); +}); +ace.define("ace/config", [ + "require", + "exports", + "module", + "ace/lib/lang", + "ace/lib/oop", + "ace/lib/net", + "ace/lib/dom", + "ace/lib/app_config", + "ace/theme/textmate" +], function(require, exports, module1) { + "no use strict"; + var lang = require("./lib/lang"); + var oop = require("./lib/oop"); + var net = require("./lib/net"); + var dom = require("./lib/dom"); + var AppConfig = require("./lib/app_config").AppConfig; + module1.exports = exports = new AppConfig(); + var options = { + packaged: false, + workerPath: null, + modePath: null, + themePath: null, + basePath: "", + suffix: ".js", + $moduleUrls: {}, + loadWorkerFromBlob: true, + sharedPopups: false, + useStrictCSP: null + }; + exports.get = function(key) { + if (!options.hasOwnProperty(key)) throw new Error("Unknown config key: " + key); + return options[key]; + }; + exports.set = function(key, value) { + if (options.hasOwnProperty(key)) options[key] = value; + else if (this.setDefaultValue("", key, value) == false) throw new Error("Unknown config key: " + key); + if (key == "useStrictCSP") dom.useStrictCSP(value); + }; + exports.all = function() { + return lang.copyObject(options); + }; + exports.$modes = {}; + exports.moduleUrl = function(name, component) { + if (options.$moduleUrls[name]) return options.$moduleUrls[name]; + var parts = name.split("/"); + component = component || parts[parts.length - 2] || ""; + var sep = component == "snippets" ? "/" : "-"; + var base = parts[parts.length - 1]; + if (component == "worker" && sep == "-") { + var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g"); + base = base.replace(re, ""); + } + if ((!base || base == component) && parts.length > 1) base = parts[parts.length - 2]; + var path = options[component + "Path"]; + if (path == null) path = options.basePath; + else if (sep == "/") component = sep = ""; + if (path && path.slice(-1) != "/") path += "/"; + return path + component + sep + base + this.get("suffix"); + }; + exports.setModuleUrl = function(name, subst) { + return options.$moduleUrls[name] = subst; + }; + var loader = function(moduleName, cb) { + if (moduleName == "ace/theme/textmate") return cb(null, require("./theme/textmate")); + return console.error("loader is not configured"); + }; + exports.setLoader = function(cb) { + loader = cb; + }; + exports.$loading = {}; + exports.loadModule = function(moduleName, onLoad) { + var module1, moduleType; + if (Array.isArray(moduleName)) { + moduleType = moduleName[0]; + moduleName = moduleName[1]; + } + try { + module1 = require(moduleName); + } catch (e) {} + if (module1 && !exports.$loading[moduleName]) return onLoad && onLoad(module1); + if (!exports.$loading[moduleName]) exports.$loading[moduleName] = []; + exports.$loading[moduleName].push(onLoad); + if (exports.$loading[moduleName].length > 1) return; + var afterLoad = function() { + loader(moduleName, function(err, module1) { + exports._emit("load.module", { + name: moduleName, + module: module1 + }); + var listeners = exports.$loading[moduleName]; + exports.$loading[moduleName] = null; + listeners.forEach(function(onLoad) { + onLoad && onLoad(module1); + }); + }); + }; + if (!exports.get("packaged")) return afterLoad(); + net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad); + reportErrorIfPathIsNotConfigured(); + }; + var reportErrorIfPathIsNotConfigured = function() { + if (!options.basePath && !options.workerPath && !options.modePath && !options.themePath && !Object.keys(options.$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"); + reportErrorIfPathIsNotConfigured = function() {}; + } + }; + exports.version = "1.14.0"; +}); +ace.define("ace/loader_build", [ + "require", + "exports", + "module", + "ace/lib/fixoldbrowsers", + "ace/config" +], function(require, exports, module1) { + "use strict"; + require("./lib/fixoldbrowsers"); + var config = require("./config"); + config.setLoader(function(moduleName, cb) { + require([ + moduleName + ], function(module1) { + cb(null, module1); + }); + }); + var global = function() { + return this || typeof window != "undefined" && window; + }(); + module1.exports = function(ace1) { + config.init = init; + ace1.require = require; + if (typeof define === "function") ace1.define = define; + }; + init(true); + function init(packaged) { + if (!global || !global.document) return; + config.set("packaged", packaged || require.packaged || module1.packaged || global.define && define.packaged); + var scriptOptions = {}; + var scriptUrl = ""; + var currentScript = document.currentScript || document._currentScript; // native or polyfill + var currentDocument = currentScript && currentScript.ownerDocument || document; + var scripts = currentDocument.getElementsByTagName("script"); + for(var i = 0; i < scripts.length; i++){ + var script = scripts[i]; + var src = script.src || script.getAttribute("src"); + if (!src) continue; + var attributes = script.attributes; + for(var j = 0, l = attributes.length; j < l; j++){ + var attr = attributes[j]; + if (attr.name.indexOf("data-ace-") === 0) scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, ""))] = attr.value; + } + var m = src.match(/^(.*)\/ace(\-\w+)?\.js(\?|$)/); + if (m) scriptUrl = m[1]; + } + if (scriptUrl) { + scriptOptions.base = scriptOptions.base || scriptUrl; + scriptOptions.packaged = true; + } + scriptOptions.basePath = scriptOptions.base; + scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base; + scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base; + scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base; + delete scriptOptions.base; + for(var key in scriptOptions)if (typeof scriptOptions[key] !== "undefined") config.set(key, scriptOptions[key]); + } + function deHyphenate(str) { + return str.replace(/-(.)/g, function(m, m1) { + return m1.toUpperCase(); + }); + } +}); +ace.define("ace/lib/keys", [ + "require", + "exports", + "module", + "ace/lib/oop" +], function(require, exports, module1) { + "use strict"; + var oop = require("./oop"); + var Keys = function() { + var ret = { + MODIFIER_KEYS: { + 16: "Shift", + 17: "Ctrl", + 18: "Alt", + 224: "Meta", + 91: "MetaLeft", + 92: "MetaRight", + 93: "ContextMenu" + }, + KEY_MODS: { + "ctrl": 1, + "alt": 2, + "option": 2, + "shift": 4, + "super": 8, + "meta": 8, + "command": 8, + "cmd": 8, + "control": 1 + }, + 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: "*" + } + }; + ret.PRINTABLE_KEYS[173] = "-"; + var name, i; + for(i in ret.FUNCTION_KEYS){ + name = ret.FUNCTION_KEYS[i].toLowerCase(); + ret[name] = parseInt(i, 10); + } + for(i in ret.PRINTABLE_KEYS){ + name = ret.PRINTABLE_KEYS[i].toLowerCase(); + ret[name] = parseInt(i, 10); + } + oop.mixin(ret, ret.MODIFIER_KEYS); + oop.mixin(ret, ret.PRINTABLE_KEYS); + oop.mixin(ret, ret.FUNCTION_KEYS); + ret.enter = ret["return"]; + ret.escape = ret.esc; + ret.del = ret["delete"]; + (function() { + var mods = [ + "cmd", + "ctrl", + "alt", + "shift" + ]; + for(var i = Math.pow(2, mods.length); i--;)ret.KEY_MODS[i] = mods.filter(function(x) { + return i & ret.KEY_MODS[x]; + }).join("-") + "-"; + })(); + ret.KEY_MODS[0] = ""; + ret.KEY_MODS[-1] = "input-"; + return ret; + }(); + oop.mixin(exports, Keys); + exports.keyCodeToString = function(keyCode) { + var keyString = Keys[keyCode]; + if (typeof keyString != "string") keyString = String.fromCharCode(keyCode); + return keyString.toLowerCase(); + }; +}); +ace.define("ace/lib/event", [ + "require", + "exports", + "module", + "ace/lib/keys", + "ace/lib/useragent" +], function(require, exports, module1) { + "use strict"; + var keys = require("./keys"); + var useragent = require("./useragent"); + var pressedKeys = null; + var ts = 0; + var activeListenerOptions; + function detectListenerOptionsSupport() { + activeListenerOptions = false; + try { + document.createComment("").addEventListener("test", function() {}, { + get passive () { + activeListenerOptions = { + passive: false + }; + } + }); + } catch (e) {} + } + function getListenerOptions() { + if (activeListenerOptions == undefined) detectListenerOptionsSupport(); + return activeListenerOptions; + } + function EventListener(elem, type, callback) { + this.elem = elem; + this.type = type; + this.callback = callback; + } + EventListener.prototype.destroy = function() { + removeListener(this.elem, this.type, this.callback); + this.elem = this.type = this.callback = undefined; + }; + var addListener = exports.addListener = function(elem, type, callback, destroyer) { + elem.addEventListener(type, callback, getListenerOptions()); + if (destroyer) destroyer.$toDestroy.push(new EventListener(elem, type, callback)); + }; + var removeListener = exports.removeListener = function(elem, type, callback) { + elem.removeEventListener(type, callback, getListenerOptions()); + }; + exports.stopEvent = function(e) { + exports.stopPropagation(e); + exports.preventDefault(e); + return false; + }; + exports.stopPropagation = function(e) { + if (e.stopPropagation) e.stopPropagation(); + }; + exports.preventDefault = function(e) { + if (e.preventDefault) e.preventDefault(); + }; + exports.getButton = function(e) { + if (e.type == "dblclick") return 0; + if (e.type == "contextmenu" || useragent.isMac && e.ctrlKey && !e.altKey && !e.shiftKey) return 2; + return e.button; + }; + exports.capture = function(el, eventHandler, releaseCaptureHandler) { + var ownerDocument = el && el.ownerDocument || document; + function onMouseUp(e) { + eventHandler && eventHandler(e); + releaseCaptureHandler && releaseCaptureHandler(e); + removeListener(ownerDocument, "mousemove", eventHandler); + removeListener(ownerDocument, "mouseup", onMouseUp); + removeListener(ownerDocument, "dragstart", onMouseUp); + } + addListener(ownerDocument, "mousemove", eventHandler); + addListener(ownerDocument, "mouseup", onMouseUp); + addListener(ownerDocument, "dragstart", onMouseUp); + return onMouseUp; + }; + exports.addMouseWheelListener = function(el, callback, destroyer) { + addListener(el, "wheel", function(e) { + var factor = 0.15; + var deltaX = e.deltaX || 0; + var deltaY = e.deltaY || 0; + switch(e.deltaMode){ + case e.DOM_DELTA_PIXEL: + e.wheelX = deltaX * factor; + e.wheelY = deltaY * factor; + break; + case e.DOM_DELTA_LINE: + var linePixels = 15; + e.wheelX = deltaX * linePixels; + e.wheelY = deltaY * linePixels; + break; + case e.DOM_DELTA_PAGE: + var pagePixels = 150; + e.wheelX = deltaX * pagePixels; + e.wheelY = deltaY * pagePixels; + break; + } + callback(e); + }, destroyer); + }; + exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName, destroyer) { + var clicks = 0; + var startX, startY, timer; + var eventNames = { + 2: "dblclick", + 3: "tripleclick", + 4: "quadclick" + }; + function onMousedown(e) { + if (exports.getButton(e) !== 0) clicks = 0; + else if (e.detail > 1) { + clicks++; + if (clicks > 4) clicks = 1; + } else clicks = 1; + if (useragent.isIE) { + var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5; + if (!timer || isNewClick) clicks = 1; + if (timer) clearTimeout(timer); + timer = setTimeout(function() { + timer = null; + }, timeouts[clicks - 1] || 600); + if (clicks == 1) { + startX = e.clientX; + startY = e.clientY; + } + } + e._clicks = clicks; + eventHandler[callbackName]("mousedown", e); + if (clicks > 4) clicks = 0; + else if (clicks > 1) return eventHandler[callbackName](eventNames[clicks], e); + } + if (!Array.isArray(elements)) elements = [ + elements + ]; + elements.forEach(function(el) { + addListener(el, "mousedown", onMousedown, destroyer); + }); + }; + var getModifierHash = function(e) { + return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0); + }; + exports.getModifierString = function(e) { + return keys.KEY_MODS[getModifierHash(e)]; + }; + function normalizeCommandKeys(callback, e, keyCode) { + var hashId = getModifierHash(e); + if (!useragent.isMac && pressedKeys) { + if (e.getModifierState && (e.getModifierState("OS") || e.getModifierState("Win"))) hashId |= 8; + if (pressedKeys.altGr) { + if ((3 & hashId) != 3) pressedKeys.altGr = 0; + else return; + } + if (keyCode === 18 || keyCode === 17) { + var location = "location" in e ? e.location : e.keyLocation; + if (keyCode === 17 && location === 1) { + if (pressedKeys[keyCode] == 1) ts = e.timeStamp; + } else if (keyCode === 18 && hashId === 3 && location === 2) { + var dt = e.timeStamp - ts; + if (dt < 50) pressedKeys.altGr = true; + } + } + } + if (keyCode in keys.MODIFIER_KEYS) keyCode = -1; + if (!hashId && keyCode === 13) { + var location = "location" in e ? e.location : e.keyLocation; + if (location === 3) { + callback(e, hashId, -keyCode); + if (e.defaultPrevented) return; + } + } + if (useragent.isChromeOS && hashId & 8) { + callback(e, hashId, keyCode); + if (e.defaultPrevented) return; + else hashId &= -9; + } + if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) return false; + return callback(e, hashId, keyCode); + } + exports.addCommandKeyListener = function(el, callback, destroyer) { + if (useragent.isOldGecko || useragent.isOpera && !("KeyboardEvent" in window)) { + var lastKeyDownKeyCode = null; + addListener(el, "keydown", function(e) { + lastKeyDownKeyCode = e.keyCode; + }, destroyer); + addListener(el, "keypress", function(e) { + return normalizeCommandKeys(callback, e, lastKeyDownKeyCode); + }, destroyer); + } else { + var lastDefaultPrevented = null; + addListener(el, "keydown", function(e) { + pressedKeys[e.keyCode] = (pressedKeys[e.keyCode] || 0) + 1; + var result = normalizeCommandKeys(callback, e, e.keyCode); + lastDefaultPrevented = e.defaultPrevented; + return result; + }, destroyer); + addListener(el, "keypress", function(e) { + if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) { + exports.stopEvent(e); + lastDefaultPrevented = null; + } + }, destroyer); + addListener(el, "keyup", function(e) { + pressedKeys[e.keyCode] = null; + }, destroyer); + if (!pressedKeys) { + resetPressedKeys(); + addListener(window, "focus", resetPressedKeys); + } + } + }; + function resetPressedKeys() { + pressedKeys = Object.create(null); + } + if (typeof window == "object" && window.postMessage && !useragent.isOldIE) { + var postMessageId = 1; + exports.nextTick = function(callback, win) { + win = win || window; + var messageName = "zero-timeout-message-" + postMessageId++; + var listener = function(e) { + if (e.data == messageName) { + exports.stopPropagation(e); + removeListener(win, "message", listener); + callback(); + } + }; + addListener(win, "message", listener); + win.postMessage(messageName, "*"); + }; + } + exports.$idleBlocked = false; + exports.onIdle = function(cb, timeout) { + return setTimeout(function handler() { + if (!exports.$idleBlocked) cb(); + else setTimeout(handler, 100); + }, timeout); + }; + exports.$idleBlockId = null; + exports.blockIdle = function(delay) { + if (exports.$idleBlockId) clearTimeout(exports.$idleBlockId); + exports.$idleBlocked = true; + exports.$idleBlockId = setTimeout(function() { + exports.$idleBlocked = false; + }, delay || 100); + }; + exports.nextFrame = typeof window == "object" && (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame); + if (exports.nextFrame) exports.nextFrame = exports.nextFrame.bind(window); + else exports.nextFrame = function(callback) { + setTimeout(callback, 17); + }; +}); +ace.define("ace/range", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + "use strict"; + var comparePoints = function(p1, p2) { + return p1.row - p2.row || p1.column - p2.column; + }; + var Range = function(startRow, startColumn, endRow, endColumn) { + this.start = { + row: startRow, + column: startColumn + }; + this.end = { + row: endRow, + column: endColumn + }; + }; + (function() { + this.isEqual = function(range) { + return this.start.row === range.start.row && this.end.row === range.end.row && this.start.column === range.start.column && this.end.column === range.end.column; + }; + this.toString = function() { + return "Range: [" + this.start.row + "/" + this.start.column + "] -> [" + this.end.row + "/" + this.end.column + "]"; + }; + this.contains = function(row, column) { + return this.compare(row, column) == 0; + }; + this.compareRange = function(range) { + var cmp, end = range.end, start = range.start; + cmp = this.compare(end.row, end.column); + if (cmp == 1) { + cmp = this.compare(start.row, start.column); + if (cmp == 1) return 2; + else if (cmp == 0) return 1; + else return 0; + } else if (cmp == -1) return -2; + else { + cmp = this.compare(start.row, start.column); + if (cmp == -1) return -1; + else if (cmp == 1) return 42; + else return 0; + } + }; + this.comparePoint = function(p) { + return this.compare(p.row, p.column); + }; + this.containsRange = function(range) { + return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0; + }; + this.intersects = function(range) { + var cmp = this.compareRange(range); + return cmp == -1 || cmp == 0 || cmp == 1; + }; + this.isEnd = function(row, column) { + return this.end.row == row && this.end.column == column; + }; + this.isStart = function(row, column) { + return this.start.row == row && this.start.column == column; + }; + this.setStart = function(row, column) { + if (typeof row == "object") { + this.start.column = row.column; + this.start.row = row.row; + } else { + this.start.row = row; + this.start.column = column; + } + }; + this.setEnd = function(row, column) { + if (typeof row == "object") { + this.end.column = row.column; + this.end.row = row.row; + } else { + this.end.row = row; + this.end.column = column; + } + }; + this.inside = function(row, column) { + if (this.compare(row, column) == 0) { + if (this.isEnd(row, column) || this.isStart(row, column)) return false; + else return true; + } + return false; + }; + this.insideStart = function(row, column) { + if (this.compare(row, column) == 0) { + if (this.isEnd(row, column)) return false; + else return true; + } + return false; + }; + this.insideEnd = function(row, column) { + if (this.compare(row, column) == 0) { + if (this.isStart(row, column)) return false; + else return true; + } + return false; + }; + this.compare = function(row, column) { + if (!this.isMultiLine()) { + if (row === this.start.row) return column < this.start.column ? -1 : column > this.end.column ? 1 : 0; + } + if (row < this.start.row) return -1; + if (row > this.end.row) return 1; + if (this.start.row === row) return column >= this.start.column ? 0 : -1; + if (this.end.row === row) return column <= this.end.column ? 0 : 1; + return 0; + }; + this.compareStart = function(row, column) { + if (this.start.row == row && this.start.column == column) return -1; + else return this.compare(row, column); + }; + this.compareEnd = function(row, column) { + if (this.end.row == row && this.end.column == column) return 1; + else return this.compare(row, column); + }; + this.compareInside = function(row, column) { + if (this.end.row == row && this.end.column == column) return 1; + else if (this.start.row == row && this.start.column == column) return -1; + else return this.compare(row, column); + }; + this.clipRows = function(firstRow, lastRow) { + if (this.end.row > lastRow) var end = { + row: lastRow + 1, + column: 0 + }; + else if (this.end.row < firstRow) var end = { + row: firstRow, + column: 0 + }; + if (this.start.row > lastRow) var start = { + row: lastRow + 1, + column: 0 + }; + else if (this.start.row < firstRow) var start = { + row: firstRow, + column: 0 + }; + return Range.fromPoints(start || this.start, end || this.end); + }; + this.extend = function(row, column) { + var cmp = this.compare(row, column); + if (cmp == 0) return this; + else if (cmp == -1) var start = { + row: row, + column: column + }; + else var end = { + row: row, + column: column + }; + return Range.fromPoints(start || this.start, end || 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 Range.fromPoints(this.start, this.end); + }; + this.collapseRows = function() { + if (this.end.column == 0) return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row - 1), 0); + else return new Range(this.start.row, 0, this.end.row, 0); + }; + this.toScreenRange = function(session) { + var screenPosStart = session.documentToScreenPosition(this.start); + var screenPosEnd = session.documentToScreenPosition(this.end); + return new Range(screenPosStart.row, screenPosStart.column, screenPosEnd.row, screenPosEnd.column); + }; + this.moveBy = function(row, column) { + this.start.row += row; + this.start.column += column; + this.end.row += row; + this.end.column += column; + }; + }).call(Range.prototype); + Range.fromPoints = function(start, end) { + return new Range(start.row, start.column, end.row, end.column); + }; + Range.comparePoints = comparePoints; + Range.comparePoints = function(p1, p2) { + return p1.row - p2.row || p1.column - p2.column; + }; + exports.Range = Range; +}); +ace.define("ace/clipboard", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + "use strict"; + var $cancelT; + module1.exports = { + lineMode: false, + pasteCancelled: function() { + if ($cancelT && $cancelT > Date.now() - 50) return true; + return $cancelT = false; + }, + cancel: function() { + $cancelT = Date.now(); + } + }; +}); +ace.define("ace/keyboard/textinput", [ + "require", + "exports", + "module", + "ace/lib/event", + "ace/lib/useragent", + "ace/lib/dom", + "ace/lib/lang", + "ace/clipboard", + "ace/lib/keys" +], function(require, exports, module1) { + "use strict"; + var event = require("../lib/event"); + var useragent = require("../lib/useragent"); + var dom = require("../lib/dom"); + var lang = require("../lib/lang"); + var clipboard = require("../clipboard"); + var BROKEN_SETDATA = useragent.isChrome < 18; + var USE_IE_MIME_TYPE = useragent.isIE; + var HAS_FOCUS_ARGS = useragent.isChrome > 63; + var MAX_LINE_LENGTH = 400; + var KEYS = require("../lib/keys"); + var MODS = KEYS.KEY_MODS; + var isIOS = useragent.isIOS; + var valueResetRegex = isIOS ? /\s/ : /\n/; + var isMobile = useragent.isMobile; + var TextInput = function(parentNode, host) { + var text = dom.createElement("textarea"); + text.className = "ace_text-input"; + text.setAttribute("wrap", "off"); + text.setAttribute("autocorrect", "off"); + text.setAttribute("autocapitalize", "off"); + text.setAttribute("spellcheck", false); + text.style.opacity = "0"; + parentNode.insertBefore(text, parentNode.firstChild); + var copied = false; + var pasted = false; + var inComposition = false; + var sendingText = false; + var tempStyle = ""; + if (!isMobile) text.style.fontSize = "1px"; + var commandMode = false; + var ignoreFocusEvents = false; + var lastValue = ""; + var lastSelectionStart = 0; + var lastSelectionEnd = 0; + var lastRestoreEnd = 0; + try { + var isFocused = document.activeElement === text; + } catch (e) {} + this.setAriaOptions = function(options) { + if (options.activeDescendant) { + text.setAttribute("aria-haspopup", "true"); + text.setAttribute("aria-autocomplete", "list"); + text.setAttribute("aria-activedescendant", options.activeDescendant); + } else { + text.setAttribute("aria-haspopup", "false"); + text.setAttribute("aria-autocomplete", "both"); + text.removeAttribute("aria-activedescendant"); + } + if (options.role) text.setAttribute("role", options.role); + }; + this.setAriaOptions({ + role: "textbox" + }); + event.addListener(text, "blur", function(e) { + if (ignoreFocusEvents) return; + host.onBlur(e); + isFocused = false; + }, host); + event.addListener(text, "focus", function(e) { + if (ignoreFocusEvents) return; + isFocused = true; + if (useragent.isEdge) try { + if (!document.hasFocus()) return; + } catch (e1) {} + host.onFocus(e); + if (useragent.isEdge) setTimeout(resetSelection); + else resetSelection(); + }, host); + this.$focusScroll = false; + this.focus = function() { + if (tempStyle || HAS_FOCUS_ARGS || this.$focusScroll == "browser") return text.focus({ + preventScroll: true + }); + var top = text.style.top; + text.style.position = "fixed"; + text.style.top = "0px"; + try { + var isTransformed = text.getBoundingClientRect().top != 0; + } catch (e) { + return; + } + var ancestors = []; + if (isTransformed) { + var t = text.parentElement; + while(t && t.nodeType == 1){ + ancestors.push(t); + t.setAttribute("ace_nocontext", true); + if (!t.parentElement && t.getRootNode) t = t.getRootNode().host; + else t = t.parentElement; + } + } + text.focus({ + preventScroll: true + }); + if (isTransformed) ancestors.forEach(function(p) { + p.removeAttribute("ace_nocontext"); + }); + setTimeout(function() { + text.style.position = ""; + if (text.style.top == "0px") text.style.top = top; + }, 0); + }; + this.blur = function() { + text.blur(); + }; + this.isFocused = function() { + return isFocused; + }; + host.on("beforeEndOperation", function() { + var curOp = host.curOp; + var commandName = curOp && curOp.command && curOp.command.name; + if (commandName == "insertstring") return; + var isUserAction = commandName && (curOp.docChanged || curOp.selectionChanged); + if (inComposition && isUserAction) { + lastValue = text.value = ""; + onCompositionEnd(); + } + resetSelection(); + }); + var resetSelection = isIOS ? function(value) { + if (!isFocused || copied && !value || sendingText) return; + if (!value) value = ""; + var newValue = "\n ab" + value + "cde fg\n"; + if (newValue != text.value) text.value = lastValue = newValue; + var selectionStart = 4; + var selectionEnd = 4 + (value.length || (host.selection.isEmpty() ? 0 : 1)); + if (lastSelectionStart != selectionStart || lastSelectionEnd != selectionEnd) text.setSelectionRange(selectionStart, selectionEnd); + lastSelectionStart = selectionStart; + lastSelectionEnd = selectionEnd; + } : function() { + if (inComposition || sendingText) return; + if (!isFocused && !afterContextMenu) return; + inComposition = true; + var selectionStart = 0; + var selectionEnd = 0; + var line = ""; + if (host.session) { + var selection = host.selection; + var range = selection.getRange(); + var row = selection.cursor.row; + selectionStart = range.start.column; + selectionEnd = range.end.column; + line = host.session.getLine(row); + if (range.start.row != row) { + var prevLine = host.session.getLine(row - 1); + selectionStart = range.start.row < row - 1 ? 0 : selectionStart; + selectionEnd += prevLine.length + 1; + line = prevLine + "\n" + line; + } else if (range.end.row != row) { + var nextLine = host.session.getLine(row + 1); + selectionEnd = range.end.row > row + 1 ? nextLine.length : selectionEnd; + selectionEnd += line.length + 1; + line = line + "\n" + nextLine; + } else if (isMobile && row > 0) { + line = "\n" + line; + selectionEnd += 1; + selectionStart += 1; + } + if (line.length > MAX_LINE_LENGTH) { + if (selectionStart < MAX_LINE_LENGTH && selectionEnd < MAX_LINE_LENGTH) line = line.slice(0, MAX_LINE_LENGTH); + else { + line = "\n"; + if (selectionStart == selectionEnd) selectionStart = selectionEnd = 0; + else { + selectionStart = 0; + selectionEnd = 1; + } + } + } + } + var newValue = line + "\n\n"; + if (newValue != lastValue) { + text.value = lastValue = newValue; + lastSelectionStart = lastSelectionEnd = newValue.length; + } + if (afterContextMenu) { + lastSelectionStart = text.selectionStart; + lastSelectionEnd = text.selectionEnd; + } + if (lastSelectionEnd != selectionEnd || lastSelectionStart != selectionStart || text.selectionEnd != lastSelectionEnd // on ie edge selectionEnd changes silently after the initialization + ) try { + text.setSelectionRange(selectionStart, selectionEnd); + lastSelectionStart = selectionStart; + lastSelectionEnd = selectionEnd; + } catch (e) {} + inComposition = false; + }; + this.resetSelection = resetSelection; + if (isFocused) host.onFocus(); + var isAllSelected = function(text) { + return text.selectionStart === 0 && text.selectionEnd >= lastValue.length && text.value === lastValue && lastValue && text.selectionEnd !== lastSelectionEnd; + }; + var onSelect = function(e) { + if (inComposition) return; + if (copied) copied = false; + else if (isAllSelected(text)) { + host.selectAll(); + resetSelection(); + } else if (isMobile && text.selectionStart != lastSelectionStart) resetSelection(); + }; + var inputHandler = null; + this.setInputHandler = function(cb) { + inputHandler = cb; + }; + this.getInputHandler = function() { + return inputHandler; + }; + var afterContextMenu = false; + var sendText = function(value, fromInput) { + if (afterContextMenu) afterContextMenu = false; + if (pasted) { + resetSelection(); + if (value) host.onPaste(value); + pasted = false; + return ""; + } else { + var selectionStart = text.selectionStart; + var selectionEnd = text.selectionEnd; + var extendLeft = lastSelectionStart; + var extendRight = lastValue.length - lastSelectionEnd; + var inserted = value; + var restoreStart = value.length - selectionStart; + var restoreEnd = value.length - selectionEnd; + var i = 0; + while(extendLeft > 0 && lastValue[i] == value[i]){ + i++; + extendLeft--; + } + inserted = inserted.slice(i); + i = 1; + while(extendRight > 0 && lastValue.length - i > lastSelectionStart - 1 && lastValue[lastValue.length - i] == value[value.length - i]){ + i++; + extendRight--; + } + restoreStart -= i - 1; + restoreEnd -= i - 1; + var endIndex = inserted.length - i + 1; + if (endIndex < 0) { + extendLeft = -endIndex; + endIndex = 0; + } + inserted = inserted.slice(0, endIndex); + if (!fromInput && !inserted && !restoreStart && !extendLeft && !extendRight && !restoreEnd) return ""; + sendingText = true; + var shouldReset = false; + if (useragent.isAndroid && inserted == ". ") { + inserted = " "; + shouldReset = true; + } + if (inserted && !extendLeft && !extendRight && !restoreStart && !restoreEnd || commandMode) host.onTextInput(inserted); + else host.onTextInput(inserted, { + extendLeft: extendLeft, + extendRight: extendRight, + restoreStart: restoreStart, + restoreEnd: restoreEnd + }); + sendingText = false; + lastValue = value; + lastSelectionStart = selectionStart; + lastSelectionEnd = selectionEnd; + lastRestoreEnd = restoreEnd; + return shouldReset ? "\n" : inserted; + } + }; + var onInput = function(e) { + if (inComposition) return onCompositionUpdate(); + if (e && e.inputType) { + if (e.inputType == "historyUndo") return host.execCommand("undo"); + if (e.inputType == "historyRedo") return host.execCommand("redo"); + } + var data = text.value; + var inserted = sendText(data, true); + if (data.length > MAX_LINE_LENGTH + 100 || valueResetRegex.test(inserted) || isMobile && lastSelectionStart < 1 && lastSelectionStart == lastSelectionEnd) resetSelection(); + }; + var handleClipboardData = function(e, data, forceIEMime) { + var clipboardData = e.clipboardData || window.clipboardData; + if (!clipboardData || BROKEN_SETDATA) return; + var mime = USE_IE_MIME_TYPE || forceIEMime ? "Text" : "text/plain"; + try { + if (data) return clipboardData.setData(mime, data) !== false; + else return clipboardData.getData(mime); + } catch (e1) { + if (!forceIEMime) return handleClipboardData(e1, data, true); + } + }; + var doCopy = function(e, isCut) { + var data = host.getCopyText(); + if (!data) return event.preventDefault(e); + if (handleClipboardData(e, data)) { + if (isIOS) { + resetSelection(data); + copied = data; + setTimeout(function() { + copied = false; + }, 10); + } + isCut ? host.onCut() : host.onCopy(); + event.preventDefault(e); + } else { + copied = true; + text.value = data; + text.select(); + setTimeout(function() { + copied = false; + resetSelection(); + isCut ? host.onCut() : host.onCopy(); + }); + } + }; + var onCut = function(e) { + doCopy(e, true); + }; + var onCopy = function(e) { + doCopy(e, false); + }; + var onPaste = function(e) { + var data = handleClipboardData(e); + if (clipboard.pasteCancelled()) return; + if (typeof data == "string") { + if (data) host.onPaste(data, e); + if (useragent.isIE) setTimeout(resetSelection); + event.preventDefault(e); + } else { + text.value = ""; + pasted = true; + } + }; + event.addCommandKeyListener(text, host.onCommandKey.bind(host), host); + event.addListener(text, "select", onSelect, host); + event.addListener(text, "input", onInput, host); + event.addListener(text, "cut", onCut, host); + event.addListener(text, "copy", onCopy, host); + event.addListener(text, "paste", onPaste, host); + if (!("oncut" in text) || !("oncopy" in text) || !("onpaste" in text)) event.addListener(parentNode, "keydown", function(e) { + if (useragent.isMac && !e.metaKey || !e.ctrlKey) return; + switch(e.keyCode){ + case 67: + onCopy(e); + break; + case 86: + onPaste(e); + break; + case 88: + onCut(e); + break; + } + }, host); + var onCompositionStart = function(e) { + if (inComposition || !host.onCompositionStart || host.$readOnly) return; + inComposition = {}; + if (commandMode) return; + if (e.data) inComposition.useTextareaForIME = false; + setTimeout(onCompositionUpdate, 0); + host._signal("compositionStart"); + host.on("mousedown", cancelComposition); + var range = host.getSelectionRange(); + range.end.row = range.start.row; + range.end.column = range.start.column; + inComposition.markerRange = range; + inComposition.selectionStart = lastSelectionStart; + host.onCompositionStart(inComposition); + if (inComposition.useTextareaForIME) { + lastValue = text.value = ""; + lastSelectionStart = 0; + lastSelectionEnd = 0; + } else { + if (text.msGetInputContext) inComposition.context = text.msGetInputContext(); + if (text.getInputContext) inComposition.context = text.getInputContext(); + } + }; + var onCompositionUpdate = function() { + if (!inComposition || !host.onCompositionUpdate || host.$readOnly) return; + if (commandMode) return cancelComposition(); + if (inComposition.useTextareaForIME) host.onCompositionUpdate(text.value); + else { + var data = text.value; + sendText(data); + if (inComposition.markerRange) { + if (inComposition.context) inComposition.markerRange.start.column = inComposition.selectionStart = inComposition.context.compositionStartOffset; + inComposition.markerRange.end.column = inComposition.markerRange.start.column + lastSelectionEnd - inComposition.selectionStart + lastRestoreEnd; + } + } + }; + var onCompositionEnd = function(e) { + if (!host.onCompositionEnd || host.$readOnly) return; + inComposition = false; + host.onCompositionEnd(); + host.off("mousedown", cancelComposition); + if (e) onInput(); + }; + function cancelComposition() { + ignoreFocusEvents = true; + text.blur(); + text.focus(); + ignoreFocusEvents = false; + } + var syncComposition = lang.delayedCall(onCompositionUpdate, 50).schedule.bind(null, null); + function onKeyup(e) { + if (e.keyCode == 27 && text.value.length < text.selectionStart) { + if (!inComposition) lastValue = text.value; + lastSelectionStart = lastSelectionEnd = -1; + resetSelection(); + } + syncComposition(); + } + event.addListener(text, "compositionstart", onCompositionStart, host); + event.addListener(text, "compositionupdate", onCompositionUpdate, host); + event.addListener(text, "keyup", onKeyup, host); + event.addListener(text, "keydown", syncComposition, host); + event.addListener(text, "compositionend", onCompositionEnd, host); + this.getElement = function() { + return text; + }; + this.setCommandMode = function(value) { + commandMode = value; + text.readOnly = false; + }; + this.setReadOnly = function(readOnly) { + if (!commandMode) text.readOnly = readOnly; + }; + this.setCopyWithEmptySelection = function(value) {}; + this.onContextMenu = function(e) { + afterContextMenu = true; + resetSelection(); + host._emit("nativecontextmenu", { + target: host, + domEvent: e + }); + this.moveToMouse(e, true); + }; + this.moveToMouse = function(e, bringToFront) { + if (!tempStyle) tempStyle = text.style.cssText; + text.style.cssText = (bringToFront ? "z-index:100000;" : "") + (useragent.isIE ? "opacity:0.1;" : "") + "text-indent: -" + (lastSelectionStart + lastSelectionEnd) * host.renderer.characterWidth * 0.5 + "px;"; + var rect = host.container.getBoundingClientRect(); + var style = dom.computedStyle(host.container); + var top = rect.top + (parseInt(style.borderTopWidth) || 0); + var left = rect.left + (parseInt(rect.borderLeftWidth) || 0); + var maxTop = rect.bottom - top - text.clientHeight - 2; + var move = function(e) { + dom.translate(text, e.clientX - left - 2, Math.min(e.clientY - top - 2, maxTop)); + }; + move(e); + if (e.type != "mousedown") return; + host.renderer.$isMousePressed = true; + clearTimeout(closeTimeout); + if (useragent.isWin) event.capture(host.container, move, onContextMenuClose); + }; + this.onContextMenuClose = onContextMenuClose; + var closeTimeout; + function onContextMenuClose() { + clearTimeout(closeTimeout); + closeTimeout = setTimeout(function() { + if (tempStyle) { + text.style.cssText = tempStyle; + tempStyle = ""; + } + host.renderer.$isMousePressed = false; + if (host.renderer.$keepTextAreaAtCursor) host.renderer.$moveTextAreaToCursor(); + }, 0); + } + var onContextMenu = function(e) { + host.textInput.onContextMenu(e); + onContextMenuClose(); + }; + event.addListener(text, "mouseup", onContextMenu, host); + event.addListener(text, "mousedown", function(e) { + e.preventDefault(); + onContextMenuClose(); + }, host); + event.addListener(host.renderer.scroller, "contextmenu", onContextMenu, host); + event.addListener(text, "contextmenu", onContextMenu, host); + if (isIOS) addIosSelectionHandler(parentNode, host, text); + function addIosSelectionHandler(parentNode, host, text) { + var typingResetTimeout = null; + var typing = false; + text.addEventListener("keydown", function(e) { + if (typingResetTimeout) clearTimeout(typingResetTimeout); + typing = true; + }, true); + text.addEventListener("keyup", function(e) { + typingResetTimeout = setTimeout(function() { + typing = false; + }, 100); + }, true); + var detectArrowKeys = function(e) { + if (document.activeElement !== text) return; + if (typing || inComposition || host.$mouseHandler.isMousePressed) return; + if (copied) return; + var selectionStart = text.selectionStart; + var selectionEnd = text.selectionEnd; + var key = null; + var modifier = 0; + if (selectionStart == 0) key = KEYS.up; + else if (selectionStart == 1) key = KEYS.home; + else if (selectionEnd > lastSelectionEnd && lastValue[selectionEnd] == "\n") key = KEYS.end; + else if (selectionStart < lastSelectionStart && lastValue[selectionStart - 1] == " ") { + key = KEYS.left; + modifier = MODS.option; + } else if (selectionStart < lastSelectionStart || selectionStart == lastSelectionStart && lastSelectionEnd != lastSelectionStart && selectionStart == selectionEnd) key = KEYS.left; + else if (selectionEnd > lastSelectionEnd && lastValue.slice(0, selectionEnd).split("\n").length > 2) key = KEYS.down; + else if (selectionEnd > lastSelectionEnd && lastValue[selectionEnd - 1] == " ") { + key = KEYS.right; + modifier = MODS.option; + } else if (selectionEnd > lastSelectionEnd || selectionEnd == lastSelectionEnd && lastSelectionEnd != lastSelectionStart && selectionStart == selectionEnd) key = KEYS.right; + if (selectionStart !== selectionEnd) modifier |= MODS.shift; + if (key) { + var result = host.onCommandKey({}, modifier, key); + if (!result && host.commands) { + key = KEYS.keyCodeToString(key); + var command = host.commands.findKeyCommand(modifier, key); + if (command) host.execCommand(command); + } + lastSelectionStart = selectionStart; + lastSelectionEnd = selectionEnd; + resetSelection(""); + } + }; + document.addEventListener("selectionchange", detectArrowKeys); + host.on("destroy", function() { + document.removeEventListener("selectionchange", detectArrowKeys); + }); + } + this.destroy = function() { + if (text.parentElement) text.parentElement.removeChild(text); + }; + }; + exports.TextInput = TextInput; + exports.$setUserAgentForTests = function(_isMobile, _isIOS) { + isMobile = _isMobile; + isIOS = _isIOS; + }; +}); +ace.define("ace/mouse/default_handlers", [ + "require", + "exports", + "module", + "ace/lib/useragent" +], function(require, exports, module1) { + "use strict"; + var useragent = require("../lib/useragent"); + var DRAG_OFFSET = 0; // pixels + var SCROLL_COOLDOWN_T = 550; // milliseconds + function DefaultHandlers(mouseHandler) { + mouseHandler.$clickSelection = null; + var editor = mouseHandler.editor; + editor.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler)); + editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(mouseHandler)); + editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(mouseHandler)); + editor.setDefaultHandler("quadclick", this.onQuadClick.bind(mouseHandler)); + editor.setDefaultHandler("mousewheel", this.onMouseWheel.bind(mouseHandler)); + var exports = [ + "select", + "startSelect", + "selectEnd", + "selectAllEnd", + "selectByWordsEnd", + "selectByLinesEnd", + "dragWait", + "dragWaitEnd", + "focusWait" + ]; + exports.forEach(function(x) { + mouseHandler[x] = this[x]; + }, this); + mouseHandler.selectByLines = this.extendSelectionBy.bind(mouseHandler, "getLineRange"); + mouseHandler.selectByWords = this.extendSelectionBy.bind(mouseHandler, "getWordRange"); + } + (function() { + this.onMouseDown = function(ev) { + var inSelection = ev.inSelection(); + var pos = ev.getDocumentPosition(); + this.mousedownEvent = ev; + var editor = this.editor; + var button = ev.getButton(); + if (button !== 0) { + var selectionRange = editor.getSelectionRange(); + var selectionEmpty = selectionRange.isEmpty(); + if (selectionEmpty || button == 1) editor.selection.moveToPosition(pos); + if (button == 2) { + editor.textInput.onContextMenu(ev.domEvent); + if (!useragent.isMozilla) ev.preventDefault(); + } + return; + } + this.mousedownEvent.time = Date.now(); + if (inSelection && !editor.isFocused()) { + editor.focus(); + if (this.$focusTimeout && !this.$clickSelection && !editor.inMultiSelectMode) { + this.setState("focusWait"); + this.captureMouse(ev); + return; + } + } + this.captureMouse(ev); + this.startSelect(pos, ev.domEvent._clicks > 1); + return ev.preventDefault(); + }; + this.startSelect = function(pos, waitForClickSelection) { + pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y); + var editor = this.editor; + if (!this.mousedownEvent) return; + if (this.mousedownEvent.getShiftKey()) editor.selection.selectToPosition(pos); + else if (!waitForClickSelection) editor.selection.moveToPosition(pos); + if (!waitForClickSelection) this.select(); + if (editor.renderer.scroller.setCapture) editor.renderer.scroller.setCapture(); + editor.setStyle("ace_selecting"); + this.setState("select"); + }; + this.select = function() { + var anchor, editor = this.editor; + var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y); + if (this.$clickSelection) { + var cmp = this.$clickSelection.comparePoint(cursor); + if (cmp == -1) anchor = this.$clickSelection.end; + else if (cmp == 1) anchor = this.$clickSelection.start; + else { + var orientedRange = calcRangeOrientation(this.$clickSelection, cursor); + cursor = orientedRange.cursor; + anchor = orientedRange.anchor; + } + editor.selection.setSelectionAnchor(anchor.row, anchor.column); + } + editor.selection.selectToPosition(cursor); + editor.renderer.scrollCursorIntoView(); + }; + this.extendSelectionBy = function(unitName) { + var anchor, editor = this.editor; + var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y); + var range = editor.selection[unitName](cursor.row, cursor.column); + if (this.$clickSelection) { + var cmpStart = this.$clickSelection.comparePoint(range.start); + var cmpEnd = this.$clickSelection.comparePoint(range.end); + if (cmpStart == -1 && cmpEnd <= 0) { + anchor = this.$clickSelection.end; + if (range.end.row != cursor.row || range.end.column != cursor.column) cursor = range.start; + } else if (cmpEnd == 1 && cmpStart >= 0) { + anchor = this.$clickSelection.start; + if (range.start.row != cursor.row || range.start.column != cursor.column) cursor = range.end; + } else if (cmpStart == -1 && cmpEnd == 1) { + cursor = range.end; + anchor = range.start; + } else { + var orientedRange = calcRangeOrientation(this.$clickSelection, cursor); + cursor = orientedRange.cursor; + anchor = orientedRange.anchor; + } + editor.selection.setSelectionAnchor(anchor.row, anchor.column); + } + editor.selection.selectToPosition(cursor); + editor.renderer.scrollCursorIntoView(); + }; + this.selectEnd = this.selectAllEnd = this.selectByWordsEnd = this.selectByLinesEnd = function() { + this.$clickSelection = null; + this.editor.unsetStyle("ace_selecting"); + if (this.editor.renderer.scroller.releaseCapture) this.editor.renderer.scroller.releaseCapture(); + }; + this.focusWait = function() { + var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); + var time = Date.now(); + if (distance > DRAG_OFFSET || time - this.mousedownEvent.time > this.$focusTimeout) this.startSelect(this.mousedownEvent.getDocumentPosition()); + }; + this.onDoubleClick = function(ev) { + var pos = ev.getDocumentPosition(); + var editor = this.editor; + var session = editor.session; + var range = session.getBracketRange(pos); + if (range) { + if (range.isEmpty()) { + range.start.column--; + range.end.column++; + } + this.setState("select"); + } else { + range = editor.selection.getWordRange(pos.row, pos.column); + this.setState("selectByWords"); + } + this.$clickSelection = range; + this.select(); + }; + this.onTripleClick = function(ev) { + var pos = ev.getDocumentPosition(); + var editor = this.editor; + this.setState("selectByLines"); + var range = editor.getSelectionRange(); + if (range.isMultiLine() && range.contains(pos.row, pos.column)) { + this.$clickSelection = editor.selection.getLineRange(range.start.row); + this.$clickSelection.end = editor.selection.getLineRange(range.end.row).end; + } else this.$clickSelection = editor.selection.getLineRange(pos.row); + this.select(); + }; + this.onQuadClick = function(ev) { + var editor = this.editor; + editor.selectAll(); + this.$clickSelection = editor.getSelectionRange(); + this.setState("selectAll"); + }; + this.onMouseWheel = function(ev) { + if (ev.getAccelKey()) return; + if (ev.getShiftKey() && ev.wheelY && !ev.wheelX) { + ev.wheelX = ev.wheelY; + ev.wheelY = 0; + } + var editor = this.editor; + if (!this.$lastScroll) this.$lastScroll = { + t: 0, + vx: 0, + vy: 0, + allowed: 0 + }; + var prevScroll = this.$lastScroll; + var t = ev.domEvent.timeStamp; + var dt = t - prevScroll.t; + var vx = dt ? ev.wheelX / dt : prevScroll.vx; + var vy = dt ? ev.wheelY / dt : prevScroll.vy; + if (dt < SCROLL_COOLDOWN_T) { + vx = (vx + prevScroll.vx) / 2; + vy = (vy + prevScroll.vy) / 2; + } + var direction = Math.abs(vx / vy); + var canScroll = false; + if (direction >= 1 && editor.renderer.isScrollableBy(ev.wheelX * ev.speed, 0)) canScroll = true; + if (direction <= 1 && editor.renderer.isScrollableBy(0, ev.wheelY * ev.speed)) canScroll = true; + if (canScroll) prevScroll.allowed = t; + else if (t - prevScroll.allowed < SCROLL_COOLDOWN_T) { + var isSlower = Math.abs(vx) <= 1.5 * Math.abs(prevScroll.vx) && Math.abs(vy) <= 1.5 * Math.abs(prevScroll.vy); + if (isSlower) { + canScroll = true; + prevScroll.allowed = t; + } else prevScroll.allowed = 0; + } + prevScroll.t = t; + prevScroll.vx = vx; + prevScroll.vy = vy; + if (canScroll) { + editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed); + return ev.stop(); + } + }; + }).call(DefaultHandlers.prototype); + exports.DefaultHandlers = DefaultHandlers; + function calcDistance(ax, ay, bx, by) { + return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2)); + } + function calcRangeOrientation(range, cursor) { + if (range.start.row == range.end.row) var cmp = 2 * cursor.column - range.start.column - range.end.column; + else if (range.start.row == range.end.row - 1 && !range.start.column && !range.end.column) var cmp = cursor.column - 4; + else var cmp = 2 * cursor.row - range.start.row - range.end.row; + if (cmp < 0) return { + cursor: range.start, + anchor: range.end + }; + else return { + cursor: range.end, + anchor: range.start + }; + } +}); +ace.define("ace/tooltip", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/lib/dom" +], function(require, exports, module1) { + "use strict"; + var oop = require("./lib/oop"); + var dom = require("./lib/dom"); + var CLASSNAME = "ace_tooltip"; + function Tooltip(parentNode) { + this.isOpen = false; + this.$element = null; + this.$parentNode = parentNode; + } + (function() { + this.$init = function() { + this.$element = dom.createElement("div"); + this.$element.className = CLASSNAME; + this.$element.style.display = "none"; + this.$parentNode.appendChild(this.$element); + return this.$element; + }; + this.getElement = function() { + return this.$element || this.$init(); + }; + this.setText = function(text) { + this.getElement().textContent = text; + }; + this.setHtml = function(html) { + this.getElement().innerHTML = html; + }; + this.setPosition = function(x, y) { + this.getElement().style.left = x + "px"; + this.getElement().style.top = y + "px"; + }; + this.setClassName = function(className) { + dom.addCssClass(this.getElement(), className); + }; + this.show = function(text, x, y) { + if (text != null) this.setText(text); + if (x != null && y != null) this.setPosition(x, y); + if (!this.isOpen) { + this.getElement().style.display = "block"; + this.isOpen = true; + } + }; + this.hide = function() { + if (this.isOpen) { + this.getElement().style.display = "none"; + this.getElement().className = CLASSNAME; + this.isOpen = false; + } + }; + this.getHeight = function() { + return this.getElement().offsetHeight; + }; + this.getWidth = function() { + return this.getElement().offsetWidth; + }; + this.destroy = function() { + this.isOpen = false; + if (this.$element && this.$element.parentNode) this.$element.parentNode.removeChild(this.$element); + }; + }).call(Tooltip.prototype); + exports.Tooltip = Tooltip; +}); +ace.define("ace/mouse/default_gutter_handler", [ + "require", + "exports", + "module", + "ace/lib/dom", + "ace/lib/oop", + "ace/lib/event", + "ace/tooltip" +], function(require, exports, module1) { + "use strict"; + var dom = require("../lib/dom"); + var oop = require("../lib/oop"); + var event = require("../lib/event"); + var Tooltip = require("../tooltip").Tooltip; + function GutterHandler(mouseHandler) { + var editor = mouseHandler.editor; + var gutter = editor.renderer.$gutterLayer; + var tooltip = new GutterTooltip(editor.container); + mouseHandler.editor.setDefaultHandler("guttermousedown", function(e) { + if (!editor.isFocused() || e.getButton() != 0) return; + var gutterRegion = gutter.getRegion(e); + if (gutterRegion == "foldWidgets") return; + var row = e.getDocumentPosition().row; + var selection = editor.session.selection; + if (e.getShiftKey()) selection.selectTo(row, 0); + else { + if (e.domEvent.detail == 2) { + editor.selectAll(); + return e.preventDefault(); + } + mouseHandler.$clickSelection = editor.selection.getLineRange(row); + } + mouseHandler.setState("selectByLines"); + mouseHandler.captureMouse(e); + return e.preventDefault(); + }); + var tooltipTimeout, mouseEvent, tooltipAnnotation; + function showTooltip() { + var row = mouseEvent.getDocumentPosition().row; + var annotation = gutter.$annotations[row]; + if (!annotation) return hideTooltip(); + var maxRow = editor.session.getLength(); + if (row == maxRow) { + var screenRow = editor.renderer.pixelToScreenCoordinates(0, mouseEvent.y).row; + var pos = mouseEvent.$pos; + if (screenRow > editor.session.documentToScreenRow(pos.row, pos.column)) return hideTooltip(); + } + if (tooltipAnnotation == annotation) return; + tooltipAnnotation = annotation.text.join("
"); + tooltip.setHtml(tooltipAnnotation); + var annotationClassName = annotation.className; + if (annotationClassName) tooltip.setClassName(annotationClassName.trim()); + tooltip.show(); + editor._signal("showGutterTooltip", tooltip); + editor.on("mousewheel", hideTooltip); + if (mouseHandler.$tooltipFollowsMouse) moveTooltip(mouseEvent); + else { + var gutterElement = mouseEvent.domEvent.target; + var rect = gutterElement.getBoundingClientRect(); + var style = tooltip.getElement().style; + style.left = rect.right + "px"; + style.top = rect.bottom + "px"; + } + } + function hideTooltip() { + if (tooltipTimeout) tooltipTimeout = clearTimeout(tooltipTimeout); + if (tooltipAnnotation) { + tooltip.hide(); + tooltipAnnotation = null; + editor._signal("hideGutterTooltip", tooltip); + editor.off("mousewheel", hideTooltip); + } + } + function moveTooltip(e) { + tooltip.setPosition(e.x, e.y); + } + mouseHandler.editor.setDefaultHandler("guttermousemove", function(e) { + var target = e.domEvent.target || e.domEvent.srcElement; + if (dom.hasCssClass(target, "ace_fold-widget")) return hideTooltip(); + if (tooltipAnnotation && mouseHandler.$tooltipFollowsMouse) moveTooltip(e); + mouseEvent = e; + if (tooltipTimeout) return; + tooltipTimeout = setTimeout(function() { + tooltipTimeout = null; + if (mouseEvent && !mouseHandler.isMousePressed) showTooltip(); + else hideTooltip(); + }, 50); + }); + event.addListener(editor.renderer.$gutter, "mouseout", function(e) { + mouseEvent = null; + if (!tooltipAnnotation || tooltipTimeout) return; + tooltipTimeout = setTimeout(function() { + tooltipTimeout = null; + hideTooltip(); + }, 50); + }, editor); + editor.on("changeSession", hideTooltip); + } + function GutterTooltip(parentNode) { + Tooltip.call(this, parentNode); + } + oop.inherits(GutterTooltip, Tooltip); + (function() { + this.setPosition = function(x, y) { + var windowWidth = window.innerWidth || document.documentElement.clientWidth; + var windowHeight = window.innerHeight || document.documentElement.clientHeight; + var width = this.getWidth(); + var height = this.getHeight(); + x += 15; + y += 15; + if (x + width > windowWidth) x -= x + width - windowWidth; + if (y + height > windowHeight) y -= 20 + height; + Tooltip.prototype.setPosition.call(this, x, y); + }; + }).call(GutterTooltip.prototype); + exports.GutterHandler = GutterHandler; +}); +ace.define("ace/mouse/mouse_event", [ + "require", + "exports", + "module", + "ace/lib/event", + "ace/lib/useragent" +], function(require, exports, module1) { + "use strict"; + var event = require("../lib/event"); + var useragent = require("../lib/useragent"); + var MouseEvent = exports.MouseEvent = function(domEvent, editor) { + this.domEvent = domEvent; + this.editor = editor; + this.x = this.clientX = domEvent.clientX; + this.y = this.clientY = domEvent.clientY; + this.$pos = null; + this.$inSelection = null; + this.propagationStopped = false; + this.defaultPrevented = false; + }; + (function() { + this.stopPropagation = function() { + event.stopPropagation(this.domEvent); + this.propagationStopped = true; + }; + this.preventDefault = function() { + event.preventDefault(this.domEvent); + this.defaultPrevented = true; + }; + this.stop = function() { + this.stopPropagation(); + this.preventDefault(); + }; + this.getDocumentPosition = function() { + if (this.$pos) return this.$pos; + this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY); + return this.$pos; + }; + this.inSelection = function() { + if (this.$inSelection !== null) return this.$inSelection; + var editor = this.editor; + var selectionRange = editor.getSelectionRange(); + if (selectionRange.isEmpty()) this.$inSelection = false; + else { + var pos = this.getDocumentPosition(); + this.$inSelection = selectionRange.contains(pos.row, pos.column); + } + return this.$inSelection; + }; + this.getButton = function() { + return event.getButton(this.domEvent); + }; + this.getShiftKey = function() { + return this.domEvent.shiftKey; + }; + this.getAccelKey = useragent.isMac ? function() { + return this.domEvent.metaKey; + } : function() { + return this.domEvent.ctrlKey; + }; + }).call(MouseEvent.prototype); +}); +ace.define("ace/mouse/dragdrop_handler", [ + "require", + "exports", + "module", + "ace/lib/dom", + "ace/lib/event", + "ace/lib/useragent" +], function(require, exports, module1) { + "use strict"; + var dom = require("../lib/dom"); + var event = require("../lib/event"); + var useragent = require("../lib/useragent"); + var AUTOSCROLL_DELAY = 200; + var SCROLL_CURSOR_DELAY = 200; + var SCROLL_CURSOR_HYSTERESIS = 5; + function DragdropHandler(mouseHandler) { + var editor = mouseHandler.editor; + var dragImage = dom.createElement("div"); + dragImage.style.cssText = "top:-100px;position:absolute;z-index:2147483647;opacity:0.5"; + dragImage.textContent = "\xa0"; + var exports = [ + "dragWait", + "dragWaitEnd", + "startDrag", + "dragReadyEnd", + "onMouseDrag" + ]; + exports.forEach(function(x) { + mouseHandler[x] = this[x]; + }, this); + editor.on("mousedown", this.onMouseDown.bind(mouseHandler)); + var mouseTarget = editor.container; + var dragSelectionMarker, x, y; + var timerId, range; + var dragCursor, counter = 0; + var dragOperation; + var isInternal; + var autoScrollStartTime; + var cursorMovedTime; + var cursorPointOnCaretMoved; + this.onDragStart = function(e) { + if (this.cancelDrag || !mouseTarget.draggable) { + var self = this; + setTimeout(function() { + self.startSelect(); + self.captureMouse(e); + }, 0); + return e.preventDefault(); + } + range = editor.getSelectionRange(); + var dataTransfer = e.dataTransfer; + dataTransfer.effectAllowed = editor.getReadOnly() ? "copy" : "copyMove"; + editor.container.appendChild(dragImage); + dataTransfer.setDragImage && dataTransfer.setDragImage(dragImage, 0, 0); + setTimeout(function() { + editor.container.removeChild(dragImage); + }); + dataTransfer.clearData(); + dataTransfer.setData("Text", editor.session.getTextRange()); + isInternal = true; + this.setState("drag"); + }; + this.onDragEnd = function(e) { + mouseTarget.draggable = false; + isInternal = false; + this.setState(null); + if (!editor.getReadOnly()) { + var dropEffect = e.dataTransfer.dropEffect; + if (!dragOperation && dropEffect == "move") editor.session.remove(editor.getSelectionRange()); + editor.$resetCursorStyle(); + } + this.editor.unsetStyle("ace_dragging"); + this.editor.renderer.setCursorStyle(""); + }; + this.onDragEnter = function(e) { + if (editor.getReadOnly() || !canAccept(e.dataTransfer)) return; + x = e.clientX; + y = e.clientY; + if (!dragSelectionMarker) addDragMarker(); + counter++; + e.dataTransfer.dropEffect = dragOperation = getDropEffect(e); + return event.preventDefault(e); + }; + this.onDragOver = function(e) { + if (editor.getReadOnly() || !canAccept(e.dataTransfer)) return; + x = e.clientX; + y = e.clientY; + if (!dragSelectionMarker) { + addDragMarker(); + counter++; + } + if (onMouseMoveTimer !== null) onMouseMoveTimer = null; + e.dataTransfer.dropEffect = dragOperation = getDropEffect(e); + return event.preventDefault(e); + }; + this.onDragLeave = function(e) { + counter--; + if (counter <= 0 && dragSelectionMarker) { + clearDragMarker(); + dragOperation = null; + return event.preventDefault(e); + } + }; + this.onDrop = function(e) { + if (!dragCursor) return; + var dataTransfer = e.dataTransfer; + if (isInternal) switch(dragOperation){ + case "move": + if (range.contains(dragCursor.row, dragCursor.column)) range = { + start: dragCursor, + end: dragCursor + }; + else range = editor.moveText(range, dragCursor); + break; + case "copy": + range = editor.moveText(range, dragCursor, true); + break; + } + else { + var dropData = dataTransfer.getData("Text"); + range = { + start: dragCursor, + end: editor.session.insert(dragCursor, dropData) + }; + editor.focus(); + dragOperation = null; + } + clearDragMarker(); + return event.preventDefault(e); + }; + event.addListener(mouseTarget, "dragstart", this.onDragStart.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragend", this.onDragEnd.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragenter", this.onDragEnter.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragover", this.onDragOver.bind(mouseHandler), editor); + event.addListener(mouseTarget, "dragleave", this.onDragLeave.bind(mouseHandler), editor); + event.addListener(mouseTarget, "drop", this.onDrop.bind(mouseHandler), editor); + function scrollCursorIntoView(cursor, prevCursor) { + var now = Date.now(); + var vMovement = !prevCursor || cursor.row != prevCursor.row; + var hMovement = !prevCursor || cursor.column != prevCursor.column; + if (!cursorMovedTime || vMovement || hMovement) { + editor.moveCursorToPosition(cursor); + cursorMovedTime = now; + cursorPointOnCaretMoved = { + x: x, + y: y + }; + } else { + var distance = calcDistance(cursorPointOnCaretMoved.x, cursorPointOnCaretMoved.y, x, y); + if (distance > SCROLL_CURSOR_HYSTERESIS) cursorMovedTime = null; + else if (now - cursorMovedTime >= SCROLL_CURSOR_DELAY) { + editor.renderer.scrollCursorIntoView(); + cursorMovedTime = null; + } + } + } + function autoScroll(cursor, prevCursor) { + var now = Date.now(); + var lineHeight = editor.renderer.layerConfig.lineHeight; + var characterWidth = editor.renderer.layerConfig.characterWidth; + var editorRect = editor.renderer.scroller.getBoundingClientRect(); + var offsets = { + x: { + left: x - editorRect.left, + right: editorRect.right - x + }, + y: { + top: y - editorRect.top, + bottom: editorRect.bottom - y + } + }; + var nearestXOffset = Math.min(offsets.x.left, offsets.x.right); + var nearestYOffset = Math.min(offsets.y.top, offsets.y.bottom); + var scrollCursor = { + row: cursor.row, + column: cursor.column + }; + if (nearestXOffset / characterWidth <= 2) scrollCursor.column += offsets.x.left < offsets.x.right ? -3 : 2; + if (nearestYOffset / lineHeight <= 1) scrollCursor.row += offsets.y.top < offsets.y.bottom ? -1 : 1; + var vScroll = cursor.row != scrollCursor.row; + var hScroll = cursor.column != scrollCursor.column; + var vMovement = !prevCursor || cursor.row != prevCursor.row; + if (vScroll || hScroll && !vMovement) { + if (!autoScrollStartTime) autoScrollStartTime = now; + else if (now - autoScrollStartTime >= AUTOSCROLL_DELAY) editor.renderer.scrollCursorIntoView(scrollCursor); + } else autoScrollStartTime = null; + } + function onDragInterval() { + var prevCursor = dragCursor; + dragCursor = editor.renderer.screenToTextCoordinates(x, y); + scrollCursorIntoView(dragCursor, prevCursor); + autoScroll(dragCursor, prevCursor); + } + function addDragMarker() { + range = editor.selection.toOrientedRange(); + dragSelectionMarker = editor.session.addMarker(range, "ace_selection", editor.getSelectionStyle()); + editor.clearSelection(); + if (editor.isFocused()) editor.renderer.$cursorLayer.setBlinking(false); + clearInterval(timerId); + onDragInterval(); + timerId = setInterval(onDragInterval, 20); + counter = 0; + event.addListener(document, "mousemove", onMouseMove); + } + function clearDragMarker() { + clearInterval(timerId); + editor.session.removeMarker(dragSelectionMarker); + dragSelectionMarker = null; + editor.selection.fromOrientedRange(range); + if (editor.isFocused() && !isInternal) editor.$resetCursorStyle(); + range = null; + dragCursor = null; + counter = 0; + autoScrollStartTime = null; + cursorMovedTime = null; + event.removeListener(document, "mousemove", onMouseMove); + } + var onMouseMoveTimer = null; + function onMouseMove() { + if (onMouseMoveTimer == null) onMouseMoveTimer = setTimeout(function() { + if (onMouseMoveTimer != null && dragSelectionMarker) clearDragMarker(); + }, 20); + } + function canAccept(dataTransfer) { + var types = dataTransfer.types; + return !types || Array.prototype.some.call(types, function(type) { + return type == "text/plain" || type == "Text"; + }); + } + function getDropEffect(e) { + var copyAllowed = [ + "copy", + "copymove", + "all", + "uninitialized" + ]; + var moveAllowed = [ + "move", + "copymove", + "linkmove", + "all", + "uninitialized" + ]; + var copyModifierState = useragent.isMac ? e.altKey : e.ctrlKey; + var effectAllowed = "uninitialized"; + try { + effectAllowed = e.dataTransfer.effectAllowed.toLowerCase(); + } catch (e1) {} + var dropEffect = "none"; + if (copyModifierState && copyAllowed.indexOf(effectAllowed) >= 0) dropEffect = "copy"; + else if (moveAllowed.indexOf(effectAllowed) >= 0) dropEffect = "move"; + else if (copyAllowed.indexOf(effectAllowed) >= 0) dropEffect = "copy"; + return dropEffect; + } + } + (function() { + this.dragWait = function() { + var interval = Date.now() - this.mousedownEvent.time; + if (interval > this.editor.getDragDelay()) this.startDrag(); + }; + this.dragWaitEnd = function() { + var target = this.editor.container; + target.draggable = false; + this.startSelect(this.mousedownEvent.getDocumentPosition()); + this.selectEnd(); + }; + this.dragReadyEnd = function(e) { + this.editor.$resetCursorStyle(); + this.editor.unsetStyle("ace_dragging"); + this.editor.renderer.setCursorStyle(""); + this.dragWaitEnd(); + }; + this.startDrag = function() { + this.cancelDrag = false; + var editor = this.editor; + var target = editor.container; + target.draggable = true; + editor.renderer.$cursorLayer.setBlinking(false); + editor.setStyle("ace_dragging"); + var cursorStyle = useragent.isWin ? "default" : "move"; + editor.renderer.setCursorStyle(cursorStyle); + this.setState("dragReady"); + }; + this.onMouseDrag = function(e) { + var target = this.editor.container; + if (useragent.isIE && this.state == "dragReady") { + var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); + if (distance > 3) target.dragDrop(); + } + if (this.state === "dragWait") { + var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y); + if (distance > 0) { + target.draggable = false; + this.startSelect(this.mousedownEvent.getDocumentPosition()); + } + } + }; + this.onMouseDown = function(e) { + if (!this.$dragEnabled) return; + this.mousedownEvent = e; + var editor = this.editor; + var inSelection = e.inSelection(); + var button = e.getButton(); + var clickCount = e.domEvent.detail || 1; + if (clickCount === 1 && button === 0 && inSelection) { + if (e.editor.inMultiSelectMode && (e.getAccelKey() || e.getShiftKey())) return; + this.mousedownEvent.time = Date.now(); + var eventTarget = e.domEvent.target || e.domEvent.srcElement; + if ("unselectable" in eventTarget) eventTarget.unselectable = "on"; + if (editor.getDragDelay()) { + if (useragent.isWebKit) { + this.cancelDrag = true; + var mouseTarget = editor.container; + mouseTarget.draggable = true; + } + this.setState("dragWait"); + } else this.startDrag(); + this.captureMouse(e, this.onMouseDrag.bind(this)); + e.defaultPrevented = true; + } + }; + }).call(DragdropHandler.prototype); + function calcDistance(ax, ay, bx, by) { + return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2)); + } + exports.DragdropHandler = DragdropHandler; +}); +ace.define("ace/mouse/touch_handler", [ + "require", + "exports", + "module", + "ace/mouse/mouse_event", + "ace/lib/event", + "ace/lib/dom" +], function(require, exports, module1) { + "use strict"; + var MouseEvent = require("./mouse_event").MouseEvent; + var event = require("../lib/event"); + var dom = require("../lib/dom"); + exports.addTouchListeners = function(el, editor) { + var mode = "scroll"; + var startX; + var startY; + var touchStartT; + var lastT; + var longTouchTimer; + var animationTimer; + var animationSteps = 0; + var pos; + var clickCount = 0; + var vX = 0; + var vY = 0; + var pressed; + var contextMenu; + function createContextMenu() { + var clipboard = window.navigator && window.navigator.clipboard; + var isOpen = false; + var updateMenu = function() { + var selected = editor.getCopyText(); + var hasUndo = editor.session.getUndoManager().hasUndo(); + contextMenu.replaceChild(dom.buildDom(isOpen ? [ + "span", + !selected && [ + "span", + { + class: "ace_mobile-button", + action: "selectall" + }, + "Select All" + ], + selected && [ + "span", + { + class: "ace_mobile-button", + action: "copy" + }, + "Copy" + ], + selected && [ + "span", + { + class: "ace_mobile-button", + action: "cut" + }, + "Cut" + ], + clipboard && [ + "span", + { + class: "ace_mobile-button", + action: "paste" + }, + "Paste" + ], + hasUndo && [ + "span", + { + class: "ace_mobile-button", + action: "undo" + }, + "Undo" + ], + [ + "span", + { + class: "ace_mobile-button", + action: "find" + }, + "Find" + ], + [ + "span", + { + class: "ace_mobile-button", + action: "openCommandPallete" + }, + "Palette" + ] + ] : [ + "span" + ]), contextMenu.firstChild); + }; + var handleClick = function(e) { + var action = e.target.getAttribute("action"); + if (action == "more" || !isOpen) { + isOpen = !isOpen; + return updateMenu(); + } + if (action == "paste") clipboard.readText().then(function(text) { + editor.execCommand(action, text); + }); + else if (action) { + if (action == "cut" || action == "copy") { + if (clipboard) clipboard.writeText(editor.getCopyText()); + else document.execCommand("copy"); + } + editor.execCommand(action); + } + contextMenu.firstChild.style.display = "none"; + isOpen = false; + if (action != "openCommandPallete") editor.focus(); + }; + contextMenu = dom.buildDom([ + "div", + { + class: "ace_mobile-menu", + ontouchstart: function(e) { + mode = "menu"; + e.stopPropagation(); + e.preventDefault(); + editor.textInput.focus(); + }, + ontouchend: function(e) { + e.stopPropagation(); + e.preventDefault(); + handleClick(e); + }, + onclick: handleClick + }, + [ + "span" + ], + [ + "span", + { + class: "ace_mobile-button", + action: "more" + }, + "..." + ] + ], editor.container); + } + function showContextMenu() { + if (!contextMenu) createContextMenu(); + var cursor = editor.selection.cursor; + var pagePos = editor.renderer.textToScreenCoordinates(cursor.row, cursor.column); + var leftOffset = editor.renderer.textToScreenCoordinates(0, 0).pageX; + var scrollLeft = editor.renderer.scrollLeft; + var rect = editor.container.getBoundingClientRect(); + contextMenu.style.top = pagePos.pageY - rect.top - 3 + "px"; + if (pagePos.pageX - rect.left < rect.width - 70) { + contextMenu.style.left = ""; + contextMenu.style.right = "10px"; + } else { + contextMenu.style.right = ""; + contextMenu.style.left = leftOffset + scrollLeft - rect.left + "px"; + } + contextMenu.style.display = ""; + contextMenu.firstChild.style.display = "none"; + editor.on("input", hideContextMenu); + } + function hideContextMenu(e) { + if (contextMenu) contextMenu.style.display = "none"; + editor.off("input", hideContextMenu); + } + function handleLongTap() { + longTouchTimer = null; + clearTimeout(longTouchTimer); + var range = editor.selection.getRange(); + var inSelection = range.contains(pos.row, pos.column); + if (range.isEmpty() || !inSelection) { + editor.selection.moveToPosition(pos); + editor.selection.selectWord(); + } + mode = "wait"; + showContextMenu(); + } + function switchToSelectionMode() { + longTouchTimer = null; + clearTimeout(longTouchTimer); + editor.selection.moveToPosition(pos); + var range = clickCount >= 2 ? editor.selection.getLineRange(pos.row) : editor.session.getBracketRange(pos); + if (range && !range.isEmpty()) editor.selection.setRange(range); + else editor.selection.selectWord(); + mode = "wait"; + } + event.addListener(el, "contextmenu", function(e) { + if (!pressed) return; + var textarea = editor.textInput.getElement(); + textarea.focus(); + }, editor); + event.addListener(el, "touchstart", function(e) { + var touches = e.touches; + if (longTouchTimer || touches.length > 1) { + clearTimeout(longTouchTimer); + longTouchTimer = null; + touchStartT = -1; + mode = "zoom"; + return; + } + pressed = editor.$mouseHandler.isMousePressed = true; + var h = editor.renderer.layerConfig.lineHeight; + var w = editor.renderer.layerConfig.lineHeight; + var t = e.timeStamp; + lastT = t; + var touchObj = touches[0]; + var x = touchObj.clientX; + var y = touchObj.clientY; + if (Math.abs(startX - x) + Math.abs(startY - y) > h) touchStartT = -1; + startX = e.clientX = x; + startY = e.clientY = y; + vX = vY = 0; + var ev = new MouseEvent(e, editor); + pos = ev.getDocumentPosition(); + if (t - touchStartT < 500 && touches.length == 1 && !animationSteps) { + clickCount++; + e.preventDefault(); + e.button = 0; + switchToSelectionMode(); + } else { + clickCount = 0; + var cursor = editor.selection.cursor; + var anchor = editor.selection.isEmpty() ? cursor : editor.selection.anchor; + var cursorPos = editor.renderer.$cursorLayer.getPixelPosition(cursor, true); + var anchorPos = editor.renderer.$cursorLayer.getPixelPosition(anchor, true); + var rect = editor.renderer.scroller.getBoundingClientRect(); + var offsetTop = editor.renderer.layerConfig.offset; + var offsetLeft = editor.renderer.scrollLeft; + var weightedDistance = function(x, y) { + x = x / w; + y = y / h - 0.75; + return x * x + y * y; + }; + if (e.clientX < rect.left) { + mode = "zoom"; + return; + } + var diff1 = weightedDistance(e.clientX - rect.left - cursorPos.left + offsetLeft, e.clientY - rect.top - cursorPos.top + offsetTop); + var diff2 = weightedDistance(e.clientX - rect.left - anchorPos.left + offsetLeft, e.clientY - rect.top - anchorPos.top + offsetTop); + if (diff1 < 3.5 && diff2 < 3.5) mode = diff1 > diff2 ? "cursor" : "anchor"; + if (diff2 < 3.5) mode = "anchor"; + else if (diff1 < 3.5) mode = "cursor"; + else mode = "scroll"; + longTouchTimer = setTimeout(handleLongTap, 450); + } + touchStartT = t; + }, editor); + event.addListener(el, "touchend", function(e) { + pressed = editor.$mouseHandler.isMousePressed = false; + if (animationTimer) clearInterval(animationTimer); + if (mode == "zoom") { + mode = ""; + animationSteps = 0; + } else if (longTouchTimer) { + editor.selection.moveToPosition(pos); + animationSteps = 0; + showContextMenu(); + } else if (mode == "scroll") { + animate(); + hideContextMenu(); + } else showContextMenu(); + clearTimeout(longTouchTimer); + longTouchTimer = null; + }, editor); + event.addListener(el, "touchmove", function(e) { + if (longTouchTimer) { + clearTimeout(longTouchTimer); + longTouchTimer = null; + } + var touches = e.touches; + if (touches.length > 1 || mode == "zoom") return; + var touchObj = touches[0]; + var wheelX = startX - touchObj.clientX; + var wheelY = startY - touchObj.clientY; + if (mode == "wait") { + if (wheelX * wheelX + wheelY * wheelY > 4) mode = "cursor"; + else return e.preventDefault(); + } + startX = touchObj.clientX; + startY = touchObj.clientY; + e.clientX = touchObj.clientX; + e.clientY = touchObj.clientY; + var t = e.timeStamp; + var dt = t - lastT; + lastT = t; + if (mode == "scroll") { + var mouseEvent = new MouseEvent(e, editor); + mouseEvent.speed = 1; + mouseEvent.wheelX = wheelX; + mouseEvent.wheelY = wheelY; + if (10 * Math.abs(wheelX) < Math.abs(wheelY)) wheelX = 0; + if (10 * Math.abs(wheelY) < Math.abs(wheelX)) wheelY = 0; + if (dt != 0) { + vX = wheelX / dt; + vY = wheelY / dt; + } + editor._emit("mousewheel", mouseEvent); + if (!mouseEvent.propagationStopped) vX = vY = 0; + } else { + var ev = new MouseEvent(e, editor); + var pos = ev.getDocumentPosition(); + if (mode == "cursor") editor.selection.moveCursorToPosition(pos); + else if (mode == "anchor") editor.selection.setSelectionAnchor(pos.row, pos.column); + editor.renderer.scrollCursorIntoView(pos); + e.preventDefault(); + } + }, editor); + function animate() { + animationSteps += 60; + animationTimer = setInterval(function() { + if (animationSteps-- <= 0) { + clearInterval(animationTimer); + animationTimer = null; + } + if (Math.abs(vX) < 0.01) vX = 0; + if (Math.abs(vY) < 0.01) vY = 0; + if (animationSteps < 20) vX = 0.9 * vX; + if (animationSteps < 20) vY = 0.9 * vY; + var oldScrollTop = editor.session.getScrollTop(); + editor.renderer.scrollBy(10 * vX, 10 * vY); + if (oldScrollTop == editor.session.getScrollTop()) animationSteps = 0; + }, 10); + } + }; +}); +ace.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/mouse/touch_handler", + "ace/config" +], function(require, exports, module1) { + "use strict"; + var event = require("../lib/event"); + var useragent = require("../lib/useragent"); + var DefaultHandlers = require("./default_handlers").DefaultHandlers; + var DefaultGutterHandler = require("./default_gutter_handler").GutterHandler; + var MouseEvent = require("./mouse_event").MouseEvent; + var DragdropHandler = require("./dragdrop_handler").DragdropHandler; + var addTouchListeners = require("./touch_handler").addTouchListeners; + var config = require("../config"); + var MouseHandler = function(editor) { + var _self = this; + this.editor = editor; + new DefaultHandlers(this); + new DefaultGutterHandler(this); + new DragdropHandler(this); + var focusEditor = function(e) { + var windowBlurred = !document.hasFocus || !document.hasFocus() || !editor.isFocused() && document.activeElement == (editor.textInput && editor.textInput.getElement()); + if (windowBlurred) window.focus(); + editor.focus(); + setTimeout(function() { + if (!editor.isFocused()) editor.focus(); + }); + }; + var mouseTarget = editor.renderer.getMouseEventTarget(); + event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"), editor); + event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"), editor); + event.addMultiMouseDownListener([ + mouseTarget, + editor.renderer.scrollBarV && editor.renderer.scrollBarV.inner, + editor.renderer.scrollBarH && editor.renderer.scrollBarH.inner, + editor.textInput && editor.textInput.getElement() + ].filter(Boolean), [ + 400, + 300, + 250 + ], this, "onMouseEvent", editor); + event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"), editor); + addTouchListeners(editor.container, editor); + var gutterEl = editor.renderer.$gutter; + event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"), editor); + event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"), editor); + event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"), editor); + event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"), editor); + event.addListener(mouseTarget, "mousedown", focusEditor, editor); + event.addListener(gutterEl, "mousedown", focusEditor, editor); + if (useragent.isIE && editor.renderer.scrollBarV) { + event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor, editor); + event.addListener(editor.renderer.scrollBarH.element, "mousedown", focusEditor, editor); + } + editor.on("mousemove", function(e) { + if (_self.state || _self.$dragDelay || !_self.$dragEnabled) return; + var character = editor.renderer.screenToTextCoordinates(e.x, e.y); + var range = editor.session.selection.getRange(); + var renderer = editor.renderer; + if (!range.isEmpty() && range.insideStart(character.row, character.column)) renderer.setCursorStyle("default"); + else renderer.setCursorStyle(""); + }, editor); + }; + (function() { + this.onMouseEvent = function(name, e) { + if (!this.editor.session) return; + this.editor._emit(name, new MouseEvent(e, this.editor)); + }; + this.onMouseMove = function(name, e) { + var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove; + if (!listeners || !listeners.length) return; + this.editor._emit(name, new MouseEvent(e, this.editor)); + }; + this.onMouseWheel = function(name, e) { + var mouseEvent = new MouseEvent(e, this.editor); + mouseEvent.speed = this.$scrollSpeed * 2; + mouseEvent.wheelX = e.wheelX; + mouseEvent.wheelY = e.wheelY; + this.editor._emit(name, mouseEvent); + }; + this.setState = function(state) { + this.state = state; + }; + this.captureMouse = function(ev, mouseMoveHandler) { + this.x = ev.x; + this.y = ev.y; + this.isMousePressed = true; + var editor = this.editor; + var renderer = this.editor.renderer; + renderer.$isMousePressed = true; + var self = this; + var onMouseMove = function(e) { + if (!e) return; + if (useragent.isWebKit && !e.which && self.releaseMouse) return self.releaseMouse(); + self.x = e.clientX; + self.y = e.clientY; + mouseMoveHandler && mouseMoveHandler(e); + self.mouseEvent = new MouseEvent(e, self.editor); + self.$mouseMoved = true; + }; + var onCaptureEnd = function(e) { + editor.off("beforeEndOperation", onOperationEnd); + clearInterval(timerId); + if (editor.session) onCaptureInterval(); + self[self.state + "End"] && self[self.state + "End"](e); + self.state = ""; + self.isMousePressed = renderer.$isMousePressed = false; + if (renderer.$keepTextAreaAtCursor) renderer.$moveTextAreaToCursor(); + self.$onCaptureMouseMove = self.releaseMouse = null; + e && self.onMouseEvent("mouseup", e); + editor.endOperation(); + }; + var onCaptureInterval = function() { + self[self.state] && self[self.state](); + self.$mouseMoved = false; + }; + if (useragent.isOldIE && ev.domEvent.type == "dblclick") return setTimeout(function() { + onCaptureEnd(ev); + }); + var onOperationEnd = function(e) { + if (!self.releaseMouse) return; + if (editor.curOp.command.name && editor.curOp.selectionChanged) { + self[self.state + "End"] && self[self.state + "End"](); + self.state = ""; + self.releaseMouse(); + } + }; + editor.on("beforeEndOperation", onOperationEnd); + editor.startOperation({ + command: { + name: "mouse" + } + }); + self.$onCaptureMouseMove = onMouseMove; + self.releaseMouse = event.capture(this.editor.container, onMouseMove, onCaptureEnd); + var timerId = setInterval(onCaptureInterval, 20); + }; + this.releaseMouse = null; + this.cancelContextMenu = function() { + var stop = (function(e) { + if (e && e.domEvent && e.domEvent.type != "contextmenu") return; + this.editor.off("nativecontextmenu", stop); + if (e && e.domEvent) event.stopEvent(e.domEvent); + }).bind(this); + setTimeout(stop, 10); + this.editor.on("nativecontextmenu", stop); + }; + this.destroy = function() { + if (this.releaseMouse) this.releaseMouse(); + }; + }).call(MouseHandler.prototype); + config.defineOptions(MouseHandler.prototype, "mouseHandler", { + scrollSpeed: { + initialValue: 2 + }, + dragDelay: { + initialValue: useragent.isMac ? 150 : 0 + }, + dragEnabled: { + initialValue: true + }, + focusTimeout: { + initialValue: 0 + }, + tooltipFollowsMouse: { + initialValue: true + } + }); + exports.MouseHandler = MouseHandler; +}); +ace.define("ace/mouse/fold_handler", [ + "require", + "exports", + "module", + "ace/lib/dom" +], function(require, exports, module1) { + "use strict"; + var dom = require("../lib/dom"); + function FoldHandler(editor) { + editor.on("click", function(e) { + var position = e.getDocumentPosition(); + var session = editor.session; + var fold = session.getFoldAt(position.row, position.column, 1); + if (fold) { + if (e.getAccelKey()) session.removeFold(fold); + else session.expandFold(fold); + e.stop(); + } + var target = e.domEvent && e.domEvent.target; + if (target && dom.hasCssClass(target, "ace_inline_button")) { + if (dom.hasCssClass(target, "ace_toggle_wrap")) { + session.setOption("wrap", !session.getUseWrapMode()); + editor.renderer.scrollCursorIntoView(); + } + } + }); + editor.on("gutterclick", function(e) { + var gutterRegion = editor.renderer.$gutterLayer.getRegion(e); + if (gutterRegion == "foldWidgets") { + var row = e.getDocumentPosition().row; + var session = editor.session; + if (session.foldWidgets && session.foldWidgets[row]) editor.session.onFoldWidgetClick(row, e); + if (!editor.isFocused()) editor.focus(); + e.stop(); + } + }); + editor.on("gutterdblclick", function(e) { + var gutterRegion = editor.renderer.$gutterLayer.getRegion(e); + if (gutterRegion == "foldWidgets") { + var row = e.getDocumentPosition().row; + var session = editor.session; + var data = session.getParentFoldRangeData(row, true); + var range = data.range || data.firstRange; + if (range) { + row = range.start.row; + var fold = session.getFoldAt(row, session.getLine(row).length, 1); + if (fold) session.removeFold(fold); + else { + session.addFold("...", range); + editor.renderer.scrollCursorIntoView({ + row: range.start.row, + column: 0 + }); + } + } + e.stop(); + } + }); + } + exports.FoldHandler = FoldHandler; +}); +ace.define("ace/keyboard/keybinding", [ + "require", + "exports", + "module", + "ace/lib/keys", + "ace/lib/event" +], function(require, exports, module1) { + "use strict"; + var keyUtil = require("../lib/keys"); + var event = require("../lib/event"); + var KeyBinding = function(editor) { + this.$editor = editor; + this.$data = { + editor: editor + }; + this.$handlers = []; + this.setDefaultHandler(editor.commands); + }; + (function() { + this.setDefaultHandler = function(kb) { + this.removeKeyboardHandler(this.$defaultHandler); + this.$defaultHandler = kb; + this.addKeyboardHandler(kb, 0); + }; + this.setKeyboardHandler = function(kb) { + var h = this.$handlers; + if (h[h.length - 1] == kb) return; + while(h[h.length - 1] && h[h.length - 1] != this.$defaultHandler)this.removeKeyboardHandler(h[h.length - 1]); + this.addKeyboardHandler(kb, 1); + }; + this.addKeyboardHandler = function(kb, pos) { + if (!kb) return; + if (typeof kb == "function" && !kb.handleKeyboard) kb.handleKeyboard = kb; + var i = this.$handlers.indexOf(kb); + if (i != -1) this.$handlers.splice(i, 1); + if (pos == undefined) this.$handlers.push(kb); + else this.$handlers.splice(pos, 0, kb); + if (i == -1 && kb.attach) kb.attach(this.$editor); + }; + this.removeKeyboardHandler = function(kb) { + var i = this.$handlers.indexOf(kb); + if (i == -1) return false; + this.$handlers.splice(i, 1); + kb.detach && kb.detach(this.$editor); + return true; + }; + this.getKeyboardHandler = function() { + return this.$handlers[this.$handlers.length - 1]; + }; + this.getStatusText = function() { + var data = this.$data; + var editor = data.editor; + return this.$handlers.map(function(h) { + return h.getStatusText && h.getStatusText(editor, data) || ""; + }).filter(Boolean).join(" "); + }; + this.$callKeyboardHandlers = function(hashId, keyString, keyCode, e) { + var toExecute; + var success = false; + var commands = this.$editor.commands; + for(var i = this.$handlers.length; i--;){ + toExecute = this.$handlers[i].handleKeyboard(this.$data, hashId, keyString, keyCode, e); + if (!toExecute || !toExecute.command) continue; + if (toExecute.command == "null") success = true; + else success = commands.exec(toExecute.command, this.$editor, toExecute.args, e); + if (success && e && hashId != -1 && toExecute.passEvent != true && toExecute.command.passEvent != true) event.stopEvent(e); + if (success) break; + } + if (!success && hashId == -1) { + toExecute = { + command: "insertstring" + }; + success = commands.exec("insertstring", this.$editor, keyString); + } + if (success && this.$editor._signal) this.$editor._signal("keyboardActivity", toExecute); + return success; + }; + this.onCommandKey = function(e, hashId, keyCode) { + var keyString = keyUtil.keyCodeToString(keyCode); + return this.$callKeyboardHandlers(hashId, keyString, keyCode, e); + }; + this.onTextInput = function(text) { + return this.$callKeyboardHandlers(-1, text); + }; + }).call(KeyBinding.prototype); + exports.KeyBinding = KeyBinding; +}); +ace.define("ace/lib/bidiutil", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + "use strict"; + var ArabicAlefBetIntervalsBegine = [ + "ء", + "ف" + ]; + var ArabicAlefBetIntervalsEnd = [ + "غ", + "ي" + ]; + var dir = 0, hiLevel = 0; + var lastArabic = false, hasUBAT_AL = false, hasUBAT_B = false, hasUBAT_S = false, hasBlockSep = false, hasSegSep = false; + var impTab_LTR = [ + [ + 0, + 3, + 0, + 1, + 0, + 0, + 0 + ], + [ + 0, + 3, + 0, + 1, + 2, + 2, + 0 + ], + [ + 0, + 3, + 0, + 0x11, + 2, + 0, + 1 + ], + [ + 0, + 3, + 5, + 5, + 4, + 1, + 0 + ], + [ + 0, + 3, + 0x15, + 0x15, + 4, + 0, + 1 + ], + [ + 0, + 3, + 5, + 5, + 4, + 2, + 0 + ] + ]; + var impTab_RTL = [ + [ + 2, + 0, + 1, + 1, + 0, + 1, + 0 + ], + [ + 2, + 0, + 1, + 1, + 0, + 2, + 0 + ], + [ + 2, + 0, + 2, + 1, + 3, + 2, + 0 + ], + [ + 2, + 0, + 2, + 0x21, + 3, + 1, + 1 + ] + ]; + var LTR = 0, RTL = 1; + var L = 0; + var R = 1; + var EN = 2; + var AN = 3; + var ON = 4; + var B = 5; + var S = 6; + var AL = 7; + var WS = 8; + var CS = 9; + var ES = 10; + var ET = 11; + var NSM = 12; + var LRE = 13; + var RLE = 14; + var PDF = 15; + var LRO = 16; + var RLO = 17; + var BN = 18; + var UnicodeTBL00 = [ + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + S, + B, + S, + WS, + B, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + B, + B, + B, + S, + WS, + ON, + ON, + ET, + ET, + ET, + ON, + ON, + ON, + ON, + ON, + ES, + CS, + ES, + CS, + CS, + EN, + EN, + EN, + EN, + EN, + EN, + EN, + EN, + EN, + EN, + CS, + ON, + ON, + ON, + ON, + ON, + ON, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + ON, + ON, + ON, + ON, + ON, + ON, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + L, + ON, + ON, + ON, + ON, + BN, + BN, + BN, + BN, + BN, + BN, + B, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + BN, + CS, + ON, + ET, + ET, + ET, + ET, + ON, + ON, + ON, + ON, + L, + ON, + ON, + BN, + ON, + ON, + ET, + ET, + EN, + EN, + ON, + L, + ON, + ON, + ON, + EN, + L, + ON, + ON, + ON, + ON, + ON + ]; + var UnicodeTBL20 = [ + WS, + WS, + WS, + WS, + WS, + WS, + WS, + WS, + WS, + WS, + WS, + BN, + BN, + BN, + L, + R, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + WS, + B, + LRE, + RLE, + PDF, + LRO, + RLO, + CS, + ET, + ET, + ET, + ET, + ET, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + CS, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + ON, + WS + ]; + function _computeLevels(chars, levels, len, charTypes) { + var impTab = dir ? impTab_RTL : impTab_LTR, prevState = null, newClass = null, newLevel = null, newState = 0, action = null, cond = null, condPos = -1, i = null, ix = null, classes = []; + if (!charTypes) for(i = 0, charTypes = []; i < len; i++)charTypes[i] = _getCharacterType(chars[i]); + hiLevel = dir; + lastArabic = false; + hasUBAT_AL = false; + hasUBAT_B = false; + hasUBAT_S = false; + for(ix = 0; ix < len; ix++){ + prevState = newState; + classes[ix] = newClass = _getCharClass(chars, charTypes, classes, ix); + newState = impTab[prevState][newClass]; + action = newState & 0xF0; + newState &= 0x0F; + levels[ix] = newLevel = impTab[newState][5]; + if (action > 0) { + if (action == 0x10) { + for(i = condPos; i < ix; i++)levels[i] = 1; + condPos = -1; + } else condPos = -1; + } + cond = impTab[newState][6]; + if (cond) { + if (condPos == -1) condPos = ix; + } else if (condPos > -1) { + for(i = condPos; i < ix; i++)levels[i] = newLevel; + condPos = -1; + } + if (charTypes[ix] == B) levels[ix] = 0; + hiLevel |= newLevel; + } + if (hasUBAT_S) { + for(i = 0; i < len; i++)if (charTypes[i] == S) { + levels[i] = dir; + for(var j = i - 1; j >= 0; j--){ + if (charTypes[j] == WS) levels[j] = dir; + else break; + } + } + } + } + function _invertLevel(lev, levels, _array) { + if (hiLevel < lev) return; + if (lev == 1 && dir == RTL && !hasUBAT_B) { + _array.reverse(); + return; + } + var len = _array.length, start = 0, end, lo, hi, tmp; + while(start < len){ + if (levels[start] >= lev) { + end = start + 1; + while(end < len && levels[end] >= lev)end++; + for(lo = start, hi = end - 1; lo < hi; lo++, hi--){ + tmp = _array[lo]; + _array[lo] = _array[hi]; + _array[hi] = tmp; + } + start = end; + } + start++; + } + } + function _getCharClass(chars, types, classes, ix) { + var cType = types[ix], wType, nType, len, i; + switch(cType){ + case L: + case R: + lastArabic = false; + case ON: + case AN: + return cType; + case EN: + return lastArabic ? AN : EN; + case AL: + lastArabic = true; + hasUBAT_AL = true; + return R; + case WS: + return ON; + case CS: + if (ix < 1 || ix + 1 >= types.length || (wType = classes[ix - 1]) != EN && wType != AN || (nType = types[ix + 1]) != EN && nType != AN) return ON; + if (lastArabic) nType = AN; + return nType == wType ? nType : ON; + case ES: + wType = ix > 0 ? classes[ix - 1] : B; + if (wType == EN && ix + 1 < types.length && types[ix + 1] == EN) return EN; + return ON; + case ET: + if (ix > 0 && classes[ix - 1] == EN) return EN; + if (lastArabic) return ON; + i = ix + 1; + len = types.length; + while(i < len && types[i] == ET)i++; + if (i < len && types[i] == EN) return EN; + return ON; + case NSM: + len = types.length; + i = ix + 1; + while(i < len && types[i] == NSM)i++; + if (i < len) { + var c = chars[ix], rtlCandidate = c >= 0x0591 && c <= 0x08FF || c == 0xFB1E; + wType = types[i]; + if (rtlCandidate && (wType == R || wType == AL)) return R; + } + if (ix < 1 || (wType = types[ix - 1]) == B) return ON; + return classes[ix - 1]; + case B: + lastArabic = false; + hasUBAT_B = true; + return dir; + case S: + hasUBAT_S = true; + return ON; + case LRE: + case RLE: + case LRO: + case RLO: + case PDF: + lastArabic = false; + case BN: + return ON; + } + } + function _getCharacterType(ch) { + var uc = ch.charCodeAt(0), hi = uc >> 8; + if (hi == 0) return uc > 0x00BF ? L : UnicodeTBL00[uc]; + else if (hi == 5) return /[\u0591-\u05f4]/.test(ch) ? R : L; + else if (hi == 6) { + if (/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(ch)) return NSM; + else if (/[\u0660-\u0669\u066b-\u066c]/.test(ch)) return AN; + else if (uc == 0x066A) return ET; + else if (/[\u06f0-\u06f9]/.test(ch)) return EN; + else return AL; + } else if (hi == 0x20 && uc <= 0x205F) return UnicodeTBL20[uc & 0xFF]; + else if (hi == 0xFE) return uc >= 0xFE70 ? AL : ON; + return ON; + } + function _isArabicDiacritics(ch) { + return ch >= "ً" && ch <= "ٕ"; + } + exports.L = L; + exports.R = R; + exports.EN = EN; + exports.ON_R = 3; + exports.AN = 4; + exports.R_H = 5; + exports.B = 6; + exports.RLE = 7; + exports.DOT = "\xb7"; + exports.doBidiReorder = function(text, textCharTypes, isRtl) { + if (text.length < 2) return {}; + var chars = text.split(""), logicalFromVisual = new Array(chars.length), bidiLevels = new Array(chars.length), levels = []; + dir = isRtl ? RTL : LTR; + _computeLevels(chars, levels, chars.length, textCharTypes); + for(var i = 0; i < logicalFromVisual.length; logicalFromVisual[i] = i, i++); + _invertLevel(2, levels, logicalFromVisual); + _invertLevel(1, levels, logicalFromVisual); + for(var i = 0; i < logicalFromVisual.length - 1; i++){ + if (textCharTypes[i] === AN) levels[i] = exports.AN; + else if (levels[i] === R && (textCharTypes[i] > AL && textCharTypes[i] < LRE || textCharTypes[i] === ON || textCharTypes[i] === BN)) levels[i] = exports.ON_R; + else if (i > 0 && chars[i - 1] === "ل" && /\u0622|\u0623|\u0625|\u0627/.test(chars[i])) { + levels[i - 1] = levels[i] = exports.R_H; + i++; + } + } + if (chars[chars.length - 1] === exports.DOT) levels[chars.length - 1] = exports.B; + if (chars[0] === "‫") levels[0] = exports.RLE; + for(var i = 0; i < logicalFromVisual.length; i++)bidiLevels[i] = levels[logicalFromVisual[i]]; + return { + "logicalFromVisual": logicalFromVisual, + "bidiLevels": bidiLevels + }; + }; + exports.hasBidiCharacters = function(text, textCharTypes) { + var ret = false; + for(var i = 0; i < text.length; i++){ + textCharTypes[i] = _getCharacterType(text.charAt(i)); + if (!ret && (textCharTypes[i] == R || textCharTypes[i] == AL || textCharTypes[i] == AN)) ret = true; + } + return ret; + }; + exports.getVisualFromLogicalIdx = function(logIdx, rowMap) { + for(var i = 0; i < rowMap.logicalFromVisual.length; i++){ + if (rowMap.logicalFromVisual[i] == logIdx) return i; + } + return 0; + }; +}); +ace.define("ace/bidihandler", [ + "require", + "exports", + "module", + "ace/lib/bidiutil", + "ace/lib/lang" +], function(require, exports, module1) { + "use strict"; + var bidiUtil = require("./lib/bidiutil"); + var lang = require("./lib/lang"); + var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/; + var BidiHandler = function(session) { + this.session = session; + this.bidiMap = {}; + this.currentRow = null; + this.bidiUtil = bidiUtil; + this.charWidths = []; + this.EOL = "\xac"; + this.showInvisibles = true; + this.isRtlDir = false; + this.$isRtl = false; + this.line = ""; + this.wrapIndent = 0; + this.EOF = "\xb6"; + this.RLE = "‫"; + this.contentWidth = 0; + this.fontMetrics = null; + this.rtlLineOffset = 0; + this.wrapOffset = 0; + this.isMoveLeftOperation = false; + this.seenBidi = bidiRE.test(session.getValue()); + }; + (function() { + this.isBidiRow = function(screenRow, docRow, splitIndex) { + if (!this.seenBidi) return false; + if (screenRow !== this.currentRow) { + this.currentRow = screenRow; + this.updateRowLine(docRow, splitIndex); + this.updateBidiMap(); + } + return this.bidiMap.bidiLevels; + }; + this.onChange = function(delta) { + if (!this.seenBidi) { + if (delta.action == "insert" && bidiRE.test(delta.lines.join("\n"))) { + this.seenBidi = true; + this.currentRow = null; + } + } else this.currentRow = null; + }; + this.getDocumentRow = function() { + var docRow = 0; + var rowCache = this.session.$screenRowCache; + if (rowCache.length) { + var index = this.session.$getRowCacheIndex(rowCache, this.currentRow); + if (index >= 0) docRow = this.session.$docRowCache[index]; + } + return docRow; + }; + this.getSplitIndex = function() { + var splitIndex = 0; + var rowCache = this.session.$screenRowCache; + if (rowCache.length) { + var currentIndex, prevIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow); + while(this.currentRow - splitIndex > 0){ + currentIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow - splitIndex - 1); + if (currentIndex !== prevIndex) break; + prevIndex = currentIndex; + splitIndex++; + } + } else splitIndex = this.currentRow; + return splitIndex; + }; + this.updateRowLine = function(docRow, splitIndex) { + if (docRow === undefined) docRow = this.getDocumentRow(); + var isLastRow = docRow === this.session.getLength() - 1, endOfLine = isLastRow ? this.EOF : this.EOL; + this.wrapIndent = 0; + this.line = this.session.getLine(docRow); + this.isRtlDir = this.$isRtl || this.line.charAt(0) === this.RLE; + if (this.session.$useWrapMode) { + var splits = this.session.$wrapData[docRow]; + if (splits) { + if (splitIndex === undefined) splitIndex = this.getSplitIndex(); + if (splitIndex > 0 && splits.length) { + this.wrapIndent = splits.indent; + this.wrapOffset = this.wrapIndent * this.charWidths[bidiUtil.L]; + this.line = splitIndex < splits.length ? this.line.substring(splits[splitIndex - 1], splits[splitIndex]) : this.line.substring(splits[splits.length - 1]); + } else this.line = this.line.substring(0, splits[splitIndex]); + if (splitIndex == splits.length) this.line += this.showInvisibles ? endOfLine : bidiUtil.DOT; + } + } else this.line += this.showInvisibles ? endOfLine : bidiUtil.DOT; + var session = this.session, shift = 0, size; + this.line = this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g, function(ch, i) { + if (ch === " " || session.isFullWidth(ch.charCodeAt(0))) { + size = ch === " " ? session.getScreenTabSize(i + shift) : 2; + shift += size - 1; + return lang.stringRepeat(bidiUtil.DOT, size); + } + return ch; + }); + if (this.isRtlDir) { + this.fontMetrics.$main.textContent = this.line.charAt(this.line.length - 1) == bidiUtil.DOT ? this.line.substr(0, this.line.length - 1) : this.line; + this.rtlLineOffset = this.contentWidth - this.fontMetrics.$main.getBoundingClientRect().width; + } + }; + this.updateBidiMap = function() { + var textCharTypes = []; + if (bidiUtil.hasBidiCharacters(this.line, textCharTypes) || this.isRtlDir) this.bidiMap = bidiUtil.doBidiReorder(this.line, textCharTypes, this.isRtlDir); + else this.bidiMap = {}; + }; + this.markAsDirty = function() { + this.currentRow = null; + }; + this.updateCharacterWidths = function(fontMetrics) { + if (this.characterWidth === fontMetrics.$characterSize.width) return; + this.fontMetrics = fontMetrics; + var characterWidth = this.characterWidth = fontMetrics.$characterSize.width; + var bidiCharWidth = fontMetrics.$measureCharWidth("ה"); + this.charWidths[bidiUtil.L] = this.charWidths[bidiUtil.EN] = this.charWidths[bidiUtil.ON_R] = characterWidth; + this.charWidths[bidiUtil.R] = this.charWidths[bidiUtil.AN] = bidiCharWidth; + this.charWidths[bidiUtil.R_H] = bidiCharWidth * 0.45; + this.charWidths[bidiUtil.B] = this.charWidths[bidiUtil.RLE] = 0; + this.currentRow = null; + }; + this.setShowInvisibles = function(showInvisibles) { + this.showInvisibles = showInvisibles; + this.currentRow = null; + }; + this.setEolChar = function(eolChar) { + this.EOL = eolChar; + }; + this.setContentWidth = function(width) { + this.contentWidth = width; + }; + this.isRtlLine = function(row) { + if (this.$isRtl) return true; + if (row != undefined) return this.session.getLine(row).charAt(0) == this.RLE; + else return this.isRtlDir; + }; + this.setRtlDirection = function(editor, isRtlDir) { + var cursor = editor.getCursorPosition(); + for(var row = editor.selection.getSelectionAnchor().row; row <= cursor.row; row++){ + if (!isRtlDir && editor.session.getLine(row).charAt(0) === editor.session.$bidiHandler.RLE) editor.session.doc.removeInLine(row, 0, 1); + else if (isRtlDir && editor.session.getLine(row).charAt(0) !== editor.session.$bidiHandler.RLE) editor.session.doc.insert({ + column: 0, + row: row + }, editor.session.$bidiHandler.RLE); + } + }; + this.getPosLeft = function(col) { + col -= this.wrapIndent; + var leftBoundary = this.line.charAt(0) === this.RLE ? 1 : 0; + var logicalIdx = col > leftBoundary ? this.session.getOverwrite() ? col : col - 1 : leftBoundary; + var visualIdx = bidiUtil.getVisualFromLogicalIdx(logicalIdx, this.bidiMap), levels = this.bidiMap.bidiLevels, left = 0; + if (!this.session.getOverwrite() && col <= leftBoundary && levels[visualIdx] % 2 !== 0) visualIdx++; + for(var i = 0; i < visualIdx; i++)left += this.charWidths[levels[i]]; + if (!this.session.getOverwrite() && col > leftBoundary && levels[visualIdx] % 2 === 0) left += this.charWidths[levels[visualIdx]]; + if (this.wrapIndent) left += this.isRtlDir ? -1 * this.wrapOffset : this.wrapOffset; + if (this.isRtlDir) left += this.rtlLineOffset; + return left; + }; + this.getSelections = function(startCol, endCol) { + var map = this.bidiMap, levels = map.bidiLevels, level, selections = [], offset = 0, selColMin = Math.min(startCol, endCol) - this.wrapIndent, selColMax = Math.max(startCol, endCol) - this.wrapIndent, isSelected = false, isSelectedPrev = false, selectionStart = 0; + if (this.wrapIndent) offset += this.isRtlDir ? -1 * this.wrapOffset : this.wrapOffset; + for(var logIdx, visIdx = 0; visIdx < levels.length; visIdx++){ + logIdx = map.logicalFromVisual[visIdx]; + level = levels[visIdx]; + isSelected = logIdx >= selColMin && logIdx < selColMax; + if (isSelected && !isSelectedPrev) selectionStart = offset; + else if (!isSelected && isSelectedPrev) selections.push({ + left: selectionStart, + width: offset - selectionStart + }); + offset += this.charWidths[level]; + isSelectedPrev = isSelected; + } + if (isSelected && visIdx === levels.length) selections.push({ + left: selectionStart, + width: offset - selectionStart + }); + if (this.isRtlDir) for(var i = 0; i < selections.length; i++)selections[i].left += this.rtlLineOffset; + return selections; + }; + this.offsetToCol = function(posX) { + if (this.isRtlDir) posX -= this.rtlLineOffset; + var logicalIdx = 0, posX = Math.max(posX, 0), offset = 0, visualIdx = 0, levels = this.bidiMap.bidiLevels, charWidth = this.charWidths[levels[visualIdx]]; + if (this.wrapIndent) posX -= this.isRtlDir ? -1 * this.wrapOffset : this.wrapOffset; + while(posX > offset + charWidth / 2){ + offset += charWidth; + if (visualIdx === levels.length - 1) { + charWidth = 0; + break; + } + charWidth = this.charWidths[levels[++visualIdx]]; + } + if (visualIdx > 0 && levels[visualIdx - 1] % 2 !== 0 && levels[visualIdx] % 2 === 0) { + if (posX < offset) visualIdx--; + logicalIdx = this.bidiMap.logicalFromVisual[visualIdx]; + } else if (visualIdx > 0 && levels[visualIdx - 1] % 2 === 0 && levels[visualIdx] % 2 !== 0) logicalIdx = 1 + (posX > offset ? this.bidiMap.logicalFromVisual[visualIdx] : this.bidiMap.logicalFromVisual[visualIdx - 1]); + else if (this.isRtlDir && visualIdx === levels.length - 1 && charWidth === 0 && levels[visualIdx - 1] % 2 === 0 || !this.isRtlDir && visualIdx === 0 && levels[visualIdx] % 2 !== 0) logicalIdx = 1 + this.bidiMap.logicalFromVisual[visualIdx]; + else { + if (visualIdx > 0 && levels[visualIdx - 1] % 2 !== 0 && charWidth !== 0) visualIdx--; + logicalIdx = this.bidiMap.logicalFromVisual[visualIdx]; + } + if (logicalIdx === 0 && this.isRtlDir) logicalIdx++; + return logicalIdx + this.wrapIndent; + }; + }).call(BidiHandler.prototype); + exports.BidiHandler = BidiHandler; +}); +ace.define("ace/selection", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/lib/lang", + "ace/lib/event_emitter", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var oop = require("./lib/oop"); + var lang = require("./lib/lang"); + var EventEmitter = require("./lib/event_emitter").EventEmitter; + var Range = require("./range").Range; + var Selection = function(session) { + this.session = session; + this.doc = session.getDocument(); + this.clearSelection(); + this.cursor = this.lead = this.doc.createAnchor(0, 0); + this.anchor = this.doc.createAnchor(0, 0); + this.$silent = false; + var self = this; + this.cursor.on("change", function(e) { + self.$cursorChanged = true; + if (!self.$silent) self._emit("changeCursor"); + if (!self.$isEmpty && !self.$silent) self._emit("changeSelection"); + if (!self.$keepDesiredColumnOnChange && e.old.column != e.value.column) self.$desiredColumn = null; + }); + this.anchor.on("change", function() { + self.$anchorChanged = true; + if (!self.$isEmpty && !self.$silent) self._emit("changeSelection"); + }); + }; + (function() { + oop.implement(this, EventEmitter); + 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(row, column) { + this.$isEmpty = false; + this.anchor.setPosition(row, column); + }; + this.getAnchor = this.getSelectionAnchor = function() { + if (this.$isEmpty) return this.getSelectionLead(); + return this.anchor.getPosition(); + }; + this.getSelectionLead = function() { + return this.lead.getPosition(); + }; + this.isBackwards = function() { + var anchor = this.anchor; + var lead = this.lead; + return anchor.row > lead.row || anchor.row == lead.row && anchor.column > lead.column; + }; + this.getRange = function() { + var anchor = this.anchor; + var lead = this.lead; + if (this.$isEmpty) return Range.fromPoints(lead, lead); + return this.isBackwards() ? Range.fromPoints(lead, anchor) : Range.fromPoints(anchor, lead); + }; + this.clearSelection = function() { + if (!this.$isEmpty) { + this.$isEmpty = true; + this._emit("changeSelection"); + } + }; + this.selectAll = function() { + this.$setSelection(0, 0, Number.MAX_VALUE, Number.MAX_VALUE); + }; + this.setRange = this.setSelectionRange = function(range, reverse) { + var start = reverse ? range.end : range.start; + var end = reverse ? range.start : range.end; + this.$setSelection(start.row, start.column, end.row, end.column); + }; + this.$setSelection = function(anchorRow, anchorColumn, cursorRow, cursorColumn) { + if (this.$silent) return; + var wasEmpty = this.$isEmpty; + var wasMultiselect = this.inMultiSelectMode; + this.$silent = true; + this.$cursorChanged = this.$anchorChanged = false; + this.anchor.setPosition(anchorRow, anchorColumn); + this.cursor.setPosition(cursorRow, cursorColumn); + this.$isEmpty = !Range.comparePoints(this.anchor, this.cursor); + this.$silent = false; + if (this.$cursorChanged) this._emit("changeCursor"); + if (this.$cursorChanged || this.$anchorChanged || wasEmpty != this.$isEmpty || wasMultiselect) this._emit("changeSelection"); + }; + this.$moveSelection = function(mover) { + var lead = this.lead; + if (this.$isEmpty) this.setSelectionAnchor(lead.row, lead.column); + mover.call(this); + }; + this.selectTo = function(row, column) { + this.$moveSelection(function() { + this.moveCursorTo(row, column); + }); + }; + this.selectToPosition = function(pos) { + this.$moveSelection(function() { + this.moveCursorToPosition(pos); + }); + }; + this.moveTo = function(row, column) { + this.clearSelection(); + this.moveCursorTo(row, column); + }; + this.moveToPosition = function(pos) { + this.clearSelection(); + this.moveCursorToPosition(pos); + }; + 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(row, column) { + if (typeof column == "undefined") { + var cursor = row || this.lead; + row = cursor.row; + column = cursor.column; + } + return this.session.getWordRange(row, column); + }; + this.selectWord = function() { + this.setSelectionRange(this.getWordRange()); + }; + this.selectAWord = function() { + var cursor = this.getCursor(); + var range = this.session.getAWordRange(cursor.row, cursor.column); + this.setSelectionRange(range); + }; + this.getLineRange = function(row, excludeLastChar) { + var rowStart = typeof row == "number" ? row : this.lead.row; + var rowEnd; + var foldLine = this.session.getFoldLine(rowStart); + if (foldLine) { + rowStart = foldLine.start.row; + rowEnd = foldLine.end.row; + } else rowEnd = rowStart; + if (excludeLastChar === true) return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length); + else return new Range(rowStart, 0, rowEnd + 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(cursor, tabSize, direction) { + var start = cursor.column; + var end = cursor.column + tabSize; + if (direction < 0) { + start = cursor.column - tabSize; + end = cursor.column; + } + return this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(start, end).split(" ").length - 1 == tabSize; + }; + this.moveCursorLeft = function() { + var cursor = this.lead.getPosition(), fold; + if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) this.moveCursorTo(fold.start.row, fold.start.column); + else if (cursor.column === 0) { + if (cursor.row > 0) this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length); + } else { + var tabSize = this.session.getTabSize(); + if (this.wouldMoveIntoSoftTab(cursor, tabSize, -1) && !this.session.getNavigateWithinSoftTabs()) this.moveCursorBy(0, -tabSize); + else this.moveCursorBy(0, -1); + } + }; + this.moveCursorRight = function() { + var cursor = this.lead.getPosition(), fold; + if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) this.moveCursorTo(fold.end.row, fold.end.column); + else if (this.lead.column == this.doc.getLine(this.lead.row).length) { + if (this.lead.row < this.doc.getLength() - 1) this.moveCursorTo(this.lead.row + 1, 0); + } else { + var tabSize = this.session.getTabSize(); + var cursor = this.lead; + if (this.wouldMoveIntoSoftTab(cursor, tabSize, 1) && !this.session.getNavigateWithinSoftTabs()) this.moveCursorBy(0, tabSize); + else this.moveCursorBy(0, 1); + } + }; + this.moveCursorLineStart = function() { + var row = this.lead.row; + var column = this.lead.column; + var screenRow = this.session.documentToScreenRow(row, column); + var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0); + var beforeCursor = this.session.getDisplayLine(row, null, firstColumnPosition.row, firstColumnPosition.column); + var leadingSpace = beforeCursor.match(/^\s*/); + if (leadingSpace[0].length != column && !this.session.$useEmacsStyleLineStart) firstColumnPosition.column += leadingSpace[0].length; + this.moveCursorToPosition(firstColumnPosition); + }; + this.moveCursorLineEnd = function() { + var lead = this.lead; + var lineEnd = this.session.getDocumentLastRowColumnPosition(lead.row, lead.column); + if (this.lead.column == lineEnd.column) { + var line = this.session.getLine(lineEnd.row); + if (lineEnd.column == line.length) { + var textEnd = line.search(/\s+$/); + if (textEnd > 0) lineEnd.column = textEnd; + } + } + this.moveCursorTo(lineEnd.row, lineEnd.column); + }; + this.moveCursorFileEnd = function() { + var row = this.doc.getLength() - 1; + var column = this.doc.getLine(row).length; + this.moveCursorTo(row, column); + }; + this.moveCursorFileStart = function() { + this.moveCursorTo(0, 0); + }; + this.moveCursorLongWordRight = function() { + var row = this.lead.row; + var column = this.lead.column; + var line = this.doc.getLine(row); + var rightOfCursor = line.substring(column); + this.session.nonTokenRe.lastIndex = 0; + this.session.tokenRe.lastIndex = 0; + var fold = this.session.getFoldAt(row, column, 1); + if (fold) { + this.moveCursorTo(fold.end.row, fold.end.column); + return; + } + if (this.session.nonTokenRe.exec(rightOfCursor)) { + column += this.session.nonTokenRe.lastIndex; + this.session.nonTokenRe.lastIndex = 0; + rightOfCursor = line.substring(column); + } + if (column >= line.length) { + this.moveCursorTo(row, line.length); + this.moveCursorRight(); + if (row < this.doc.getLength() - 1) this.moveCursorWordRight(); + return; + } + if (this.session.tokenRe.exec(rightOfCursor)) { + column += this.session.tokenRe.lastIndex; + this.session.tokenRe.lastIndex = 0; + } + this.moveCursorTo(row, column); + }; + this.moveCursorLongWordLeft = function() { + var row = this.lead.row; + var column = this.lead.column; + var fold; + if (fold = this.session.getFoldAt(row, column, -1)) { + this.moveCursorTo(fold.start.row, fold.start.column); + return; + } + var str = this.session.getFoldStringAt(row, column, -1); + if (str == null) str = this.doc.getLine(row).substring(0, column); + var leftOfCursor = lang.stringReverse(str); + this.session.nonTokenRe.lastIndex = 0; + this.session.tokenRe.lastIndex = 0; + if (this.session.nonTokenRe.exec(leftOfCursor)) { + column -= this.session.nonTokenRe.lastIndex; + leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex); + this.session.nonTokenRe.lastIndex = 0; + } + if (column <= 0) { + this.moveCursorTo(row, 0); + this.moveCursorLeft(); + if (row > 0) this.moveCursorWordLeft(); + return; + } + if (this.session.tokenRe.exec(leftOfCursor)) { + column -= this.session.tokenRe.lastIndex; + this.session.tokenRe.lastIndex = 0; + } + this.moveCursorTo(row, column); + }; + this.$shortWordEndIndex = function(rightOfCursor) { + var index = 0, ch; + var whitespaceRe = /\s/; + var tokenRe = this.session.tokenRe; + tokenRe.lastIndex = 0; + if (this.session.tokenRe.exec(rightOfCursor)) index = this.session.tokenRe.lastIndex; + else { + while((ch = rightOfCursor[index]) && whitespaceRe.test(ch))index++; + if (index < 1) { + tokenRe.lastIndex = 0; + while((ch = rightOfCursor[index]) && !tokenRe.test(ch)){ + tokenRe.lastIndex = 0; + index++; + if (whitespaceRe.test(ch)) { + if (index > 2) { + index--; + break; + } else { + while((ch = rightOfCursor[index]) && whitespaceRe.test(ch))index++; + if (index > 2) break; + } + } + } + } + } + tokenRe.lastIndex = 0; + return index; + }; + this.moveCursorShortWordRight = function() { + var row = this.lead.row; + var column = this.lead.column; + var line = this.doc.getLine(row); + var rightOfCursor = line.substring(column); + var fold = this.session.getFoldAt(row, column, 1); + if (fold) return this.moveCursorTo(fold.end.row, fold.end.column); + if (column == line.length) { + var l = this.doc.getLength(); + do { + row++; + rightOfCursor = this.doc.getLine(row); + }while (row < l && /^\s*$/.test(rightOfCursor)); + if (!/^\s+/.test(rightOfCursor)) rightOfCursor = ""; + column = 0; + } + var index = this.$shortWordEndIndex(rightOfCursor); + this.moveCursorTo(row, column + index); + }; + this.moveCursorShortWordLeft = function() { + var row = this.lead.row; + var column = this.lead.column; + var fold; + if (fold = this.session.getFoldAt(row, column, -1)) return this.moveCursorTo(fold.start.row, fold.start.column); + var line = this.session.getLine(row).substring(0, column); + if (column === 0) { + do { + row--; + line = this.doc.getLine(row); + }while (row > 0 && /^\s*$/.test(line)); + column = line.length; + if (!/\s+$/.test(line)) line = ""; + } + var leftOfCursor = lang.stringReverse(line); + var index = this.$shortWordEndIndex(leftOfCursor); + return this.moveCursorTo(row, column - index); + }; + this.moveCursorWordRight = function() { + if (this.session.$selectLongWords) this.moveCursorLongWordRight(); + else this.moveCursorShortWordRight(); + }; + this.moveCursorWordLeft = function() { + if (this.session.$selectLongWords) this.moveCursorLongWordLeft(); + else this.moveCursorShortWordLeft(); + }; + this.moveCursorBy = function(rows, chars) { + var screenPos = this.session.documentToScreenPosition(this.lead.row, this.lead.column); + var offsetX; + if (chars === 0) { + if (rows !== 0) { + if (this.session.$bidiHandler.isBidiRow(screenPos.row, this.lead.row)) { + offsetX = this.session.$bidiHandler.getPosLeft(screenPos.column); + screenPos.column = Math.round(offsetX / this.session.$bidiHandler.charWidths[0]); + } else offsetX = screenPos.column * this.session.$bidiHandler.charWidths[0]; + } + if (this.$desiredColumn) screenPos.column = this.$desiredColumn; + else this.$desiredColumn = screenPos.column; + } + if (rows != 0 && this.session.lineWidgets && this.session.lineWidgets[this.lead.row]) { + var widget = this.session.lineWidgets[this.lead.row]; + if (rows < 0) rows -= widget.rowsAbove || 0; + else if (rows > 0) rows += widget.rowCount - (widget.rowsAbove || 0); + } + var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column, offsetX); + rows !== 0 && chars === 0 && docPos.row === this.lead.row && (docPos.column, this.lead.column); + this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0); + }; + this.moveCursorToPosition = function(position) { + this.moveCursorTo(position.row, position.column); + }; + this.moveCursorTo = function(row, column, keepDesiredColumn) { + var fold = this.session.getFoldAt(row, column, 1); + if (fold) { + row = fold.start.row; + column = fold.start.column; + } + this.$keepDesiredColumnOnChange = true; + var line = this.session.getLine(row); + if (/[\uDC00-\uDFFF]/.test(line.charAt(column)) && line.charAt(column - 1)) { + if (this.lead.row == row && this.lead.column == column + 1) column = column - 1; + else column = column + 1; + } + this.lead.setPosition(row, column); + this.$keepDesiredColumnOnChange = false; + if (!keepDesiredColumn) this.$desiredColumn = null; + }; + this.moveCursorToScreen = function(row, column, keepDesiredColumn) { + var pos = this.session.screenToDocumentPosition(row, column); + this.moveCursorTo(pos.row, pos.column, keepDesiredColumn); + }; + this.detach = function() { + this.lead.detach(); + this.anchor.detach(); + }; + this.fromOrientedRange = function(range) { + this.setSelectionRange(range, range.cursor == range.start); + this.$desiredColumn = range.desiredColumn || this.$desiredColumn; + }; + this.toOrientedRange = function(range) { + var r = this.getRange(); + if (range) { + range.start.column = r.start.column; + range.start.row = r.start.row; + range.end.column = r.end.column; + range.end.row = r.end.row; + } else range = r; + range.cursor = this.isBackwards() ? range.start : range.end; + range.desiredColumn = this.$desiredColumn; + return range; + }; + this.getRangeOfMovements = function(func) { + var start = this.getCursor(); + try { + func(this); + var end = this.getCursor(); + return Range.fromPoints(start, end); + } catch (e) { + return Range.fromPoints(start, start); + } finally{ + this.moveCursorToPosition(start); + } + }; + this.toJSON = function() { + if (this.rangeCount) var data = this.ranges.map(function(r) { + var r1 = r.clone(); + r1.isBackwards = r.cursor == r.start; + return r1; + }); + else { + var data = this.getRange(); + data.isBackwards = this.isBackwards(); + } + return data; + }; + this.fromJSON = function(data) { + if (data.start == undefined) { + if (this.rangeList && data.length > 1) { + this.toSingleRange(data[0]); + for(var i = data.length; i--;){ + var r = Range.fromPoints(data[i].start, data[i].end); + if (data[i].isBackwards) r.cursor = r.start; + this.addRange(r, true); + } + return; + } else data = data[0]; + } + if (this.rangeList) this.toSingleRange(data); + this.setSelectionRange(data, data.isBackwards); + }; + this.isEqual = function(data) { + if ((data.length || this.rangeCount) && data.length != this.rangeCount) return false; + if (!data.length || !this.ranges) return this.getRange().isEqual(data); + for(var i = this.ranges.length; i--;){ + if (!this.ranges[i].isEqual(data[i])) return false; + } + return true; + }; + }).call(Selection.prototype); + exports.Selection = Selection; +}); +ace.define("ace/tokenizer", [ + "require", + "exports", + "module", + "ace/config" +], function(require, exports, module1) { + "use strict"; + var config = require("./config"); + var MAX_TOKEN_COUNT = 2000; + var Tokenizer = function(rules) { + this.states = rules; + this.regExps = {}; + this.matchMappings = {}; + for(var key in this.states){ + var state = this.states[key]; + var ruleRegExps = []; + var matchTotal = 0; + var mapping = this.matchMappings[key] = { + defaultToken: "text" + }; + var flag = "g"; + var splitterRurles = []; + for(var i = 0; i < state.length; i++){ + var rule = state[i]; + if (rule.defaultToken) mapping.defaultToken = rule.defaultToken; + if (rule.caseInsensitive && flag.indexOf("i") === -1) flag += "i"; + if (rule.unicode && flag.indexOf("u") === -1) flag += "u"; + if (rule.regex == null) continue; + if (rule.regex instanceof RegExp) rule.regex = rule.regex.toString().slice(1, -1); + var adjustedregex = rule.regex; + var matchcount = new RegExp("(?:(" + adjustedregex + ")|(.))").exec("a").length - 2; + if (Array.isArray(rule.token)) { + if (rule.token.length == 1 || matchcount == 1) rule.token = rule.token[0]; + else if (matchcount - 1 != rule.token.length) { + this.reportError("number of classes and regexp groups doesn't match", { + rule: rule, + groupCount: matchcount - 1 + }); + rule.token = rule.token[0]; + } else { + rule.tokenArray = rule.token; + rule.token = null; + rule.onMatch = this.$arrayTokens; + } + } else if (typeof rule.token == "function" && !rule.onMatch) { + if (matchcount > 1) rule.onMatch = this.$applyToken; + else rule.onMatch = rule.token; + } + if (matchcount > 1) { + if (/\\\d/.test(rule.regex)) adjustedregex = rule.regex.replace(/\\([0-9]+)/g, function(match, digit) { + return "\\" + (parseInt(digit, 10) + matchTotal + 1); + }); + else { + matchcount = 1; + adjustedregex = this.removeCapturingGroups(rule.regex); + } + if (!rule.splitRegex && typeof rule.token != "string") splitterRurles.push(rule); // flag will be known only at the very end + } + mapping[matchTotal] = i; + matchTotal += matchcount; + ruleRegExps.push(adjustedregex); + if (!rule.onMatch) rule.onMatch = null; + } + if (!ruleRegExps.length) { + mapping[0] = 0; + ruleRegExps.push("$"); + } + splitterRurles.forEach(function(rule) { + rule.splitRegex = this.createSplitterRegexp(rule.regex, flag); + }, this); + this.regExps[key] = new RegExp("(" + ruleRegExps.join(")|(") + ")|($)", flag); + } + }; + (function() { + this.$setMaxTokenCount = function(m) { + MAX_TOKEN_COUNT = m | 0; + }; + this.$applyToken = function(str) { + var values = this.splitRegex.exec(str).slice(1); + var types = this.token.apply(this, values); + if (typeof types === "string") return [ + { + type: types, + value: str + } + ]; + var tokens = []; + for(var i = 0, l = types.length; i < l; i++)if (values[i]) tokens[tokens.length] = { + type: types[i], + value: values[i] + }; + return tokens; + }; + this.$arrayTokens = function(str) { + if (!str) return []; + var values = this.splitRegex.exec(str); + if (!values) return "text"; + var tokens = []; + var types = this.tokenArray; + for(var i = 0, l = types.length; i < l; i++)if (values[i + 1]) tokens[tokens.length] = { + type: types[i], + value: values[i + 1] + }; + return tokens; + }; + this.removeCapturingGroups = function(src) { + var r = src.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g, function(x, y) { + return y ? "(?:" : x; + }); + return r; + }; + this.createSplitterRegexp = function(src, flag) { + if (src.indexOf("(?=") != -1) { + var stack = 0; + var inChClass = false; + var lastCapture = {}; + src.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g, function(m, esc, parenOpen, parenClose, square, index) { + if (inChClass) inChClass = square != "]"; + else if (square) inChClass = true; + else if (parenClose) { + if (stack == lastCapture.stack) { + lastCapture.end = index + 1; + lastCapture.stack = -1; + } + stack--; + } else if (parenOpen) { + stack++; + if (parenOpen.length != 1) { + lastCapture.stack = stack; + lastCapture.start = index; + } + } + return m; + }); + if (lastCapture.end != null && /^\)*$/.test(src.substr(lastCapture.end))) src = src.substring(0, lastCapture.start) + src.substr(lastCapture.end); + } + if (src.charAt(0) != "^") src = "^" + src; + if (src.charAt(src.length - 1) != "$") src += "$"; + return new RegExp(src, (flag || "").replace("g", "")); + }; + this.getLineTokens = function(line, startState) { + if (startState && typeof startState != "string") { + var stack = startState.slice(0); + startState = stack[0]; + if (startState === "#tmp") { + stack.shift(); + startState = stack.shift(); + } + } else var stack = []; + var currentState = startState || "start"; + var state = this.states[currentState]; + if (!state) { + currentState = "start"; + state = this.states[currentState]; + } + var mapping = this.matchMappings[currentState]; + var re = this.regExps[currentState]; + re.lastIndex = 0; + var match, tokens = []; + var lastIndex = 0; + var matchAttempts = 0; + var token = { + type: null, + value: "" + }; + while(match = re.exec(line)){ + var type = mapping.defaultToken; + var rule = null; + var value = match[0]; + var index = re.lastIndex; + if (index - value.length > lastIndex) { + var skipped = line.substring(lastIndex, index - value.length); + if (token.type == type) token.value += skipped; + else { + if (token.type) tokens.push(token); + token = { + type: type, + value: skipped + }; + } + } + for(var i = 0; i < match.length - 2; i++){ + if (match[i + 1] === undefined) continue; + rule = state[mapping[i]]; + if (rule.onMatch) type = rule.onMatch(value, currentState, stack, line); + else type = rule.token; + if (rule.next) { + if (typeof rule.next == "string") currentState = rule.next; + else currentState = rule.next(currentState, stack); + state = this.states[currentState]; + if (!state) { + this.reportError("state doesn't exist", currentState); + currentState = "start"; + state = this.states[currentState]; + } + mapping = this.matchMappings[currentState]; + lastIndex = index; + re = this.regExps[currentState]; + re.lastIndex = index; + } + if (rule.consumeLineEnd) lastIndex = index; + break; + } + if (value) { + if (typeof type === "string") { + if ((!rule || rule.merge !== false) && token.type === type) token.value += value; + else { + if (token.type) tokens.push(token); + token = { + type: type, + value: value + }; + } + } else if (type) { + if (token.type) tokens.push(token); + token = { + type: null, + value: "" + }; + for(var i = 0; i < type.length; i++)tokens.push(type[i]); + } + } + if (lastIndex == line.length) break; + lastIndex = index; + if (matchAttempts++ > MAX_TOKEN_COUNT) { + if (matchAttempts > 2 * line.length) this.reportError("infinite loop with in ace tokenizer", { + startState: startState, + line: line + }); + while(lastIndex < line.length){ + if (token.type) tokens.push(token); + token = { + value: line.substring(lastIndex, lastIndex += 500), + type: "overflow" + }; + } + currentState = "start"; + stack = []; + break; + } + } + if (token.type) tokens.push(token); + if (stack.length > 1) { + if (stack[0] !== currentState) stack.unshift("#tmp", currentState); + } + return { + tokens: tokens, + state: stack.length ? stack : currentState + }; + }; + this.reportError = config.reportError; + }).call(Tokenizer.prototype); + exports.Tokenizer = Tokenizer; +}); +ace.define("ace/mode/text_highlight_rules", [ + "require", + "exports", + "module", + "ace/lib/lang" +], function(require, exports, module1) { + "use strict"; + var lang = require("../lib/lang"); + var TextHighlightRules = function() { + this.$rules = { + "start": [ + { + token: "empty_line", + regex: "^$" + }, + { + defaultToken: "text" + } + ] + }; + }; + (function() { + this.addRules = function(rules, prefix) { + if (!prefix) { + for(var key in rules)this.$rules[key] = rules[key]; + return; + } + for(var key in rules){ + var state = rules[key]; + for(var i = 0; i < state.length; i++){ + var rule = state[i]; + if (rule.next || rule.onMatch) { + if (typeof rule.next == "string") { + if (rule.next.indexOf(prefix) !== 0) rule.next = prefix + rule.next; + } + if (rule.nextState && rule.nextState.indexOf(prefix) !== 0) rule.nextState = prefix + rule.nextState; + } + } + this.$rules[prefix + key] = state; + } + }; + this.getRules = function() { + return this.$rules; + }; + this.embedRules = function(HighlightRules, prefix, escapeRules, states, append) { + var embedRules = typeof HighlightRules == "function" ? new HighlightRules().getRules() : HighlightRules; + if (states) for(var i = 0; i < states.length; i++)states[i] = prefix + states[i]; + else { + states = []; + for(var key in embedRules)states.push(prefix + key); + } + this.addRules(embedRules, prefix); + if (escapeRules) { + var addRules = Array.prototype[append ? "push" : "unshift"]; + for(var i = 0; i < states.length; i++)addRules.apply(this.$rules[states[i]], lang.deepCopy(escapeRules)); + } + if (!this.$embeds) this.$embeds = []; + this.$embeds.push(prefix); + }; + this.getEmbeds = function() { + return this.$embeds; + }; + var pushState = function(currentState, stack) { + if (currentState != "start" || stack.length) stack.unshift(this.nextState, currentState); + return this.nextState; + }; + var popState = function(currentState, stack) { + stack.shift(); + return stack.shift() || "start"; + }; + this.normalizeRules = function() { + var id = 0; + var rules = this.$rules; + function processState(key) { + var state = rules[key]; + state.processed = true; + for(var i = 0; i < state.length; i++){ + var rule = state[i]; + var toInsert = null; + if (Array.isArray(rule)) { + toInsert = rule; + rule = {}; + } + if (!rule.regex && rule.start) { + rule.regex = rule.start; + if (!rule.next) rule.next = []; + rule.next.push({ + defaultToken: rule.token + }, { + token: rule.token + ".end", + regex: rule.end || rule.start, + next: "pop" + }); + rule.token = rule.token + ".start"; + rule.push = true; + } + var next = rule.next || rule.push; + if (next && Array.isArray(next)) { + var stateName = rule.stateName; + if (!stateName) { + stateName = rule.token; + if (typeof stateName != "string") stateName = stateName[0] || ""; + if (rules[stateName]) stateName += id++; + } + rules[stateName] = next; + rule.next = stateName; + processState(stateName); + } else if (next == "pop") rule.next = popState; + if (rule.push) { + rule.nextState = rule.next || rule.push; + rule.next = pushState; + delete rule.push; + } + if (rule.rules) for(var r in rule.rules){ + if (rules[r]) { + if (rules[r].push) rules[r].push.apply(rules[r], rule.rules[r]); + } else rules[r] = rule.rules[r]; + } + var includeName = typeof rule == "string" ? rule : rule.include; + if (includeName) { + if (Array.isArray(includeName)) toInsert = includeName.map(function(x) { + return rules[x]; + }); + else toInsert = rules[includeName]; + } + if (toInsert) { + var args = [ + i, + 1 + ].concat(toInsert); + if (rule.noEscape) args = args.filter(function(x) { + return !x.next; + }); + state.splice.apply(state, args); + i--; + } + if (rule.keywordMap) { + rule.token = this.createKeywordMapper(rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive); + delete rule.defaultToken; + } + } + } + Object.keys(rules).forEach(processState, this); + }; + this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) { + var keywords = Object.create(null); + this.$keywordList = []; + Object.keys(map).forEach(function(className) { + var a = map[className]; + var list = a.split(splitChar || "|"); + for(var i = list.length; i--;){ + var word = list[i]; + this.$keywordList.push(word); + if (ignoreCase) word = word.toLowerCase(); + keywords[word] = className; + } + }, this); + map = null; + return ignoreCase ? function(value) { + return keywords[value.toLowerCase()] || defaultToken; + } : function(value) { + return keywords[value] || defaultToken; + }; + }; + this.getKeywords = function() { + return this.$keywords; + }; + }).call(TextHighlightRules.prototype); + exports.TextHighlightRules = TextHighlightRules; +}); +ace.define("ace/mode/behaviour", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + "use strict"; + var Behaviour = function() { + this.$behaviours = {}; + }; + (function() { + this.add = function(name, action, callback) { + switch(undefined){ + case this.$behaviours: + this.$behaviours = {}; + case this.$behaviours[name]: + this.$behaviours[name] = {}; + } + this.$behaviours[name][action] = callback; + }; + this.addBehaviours = function(behaviours) { + for(var key in behaviours)for(var action in behaviours[key])this.add(key, action, behaviours[key][action]); + }; + this.remove = function(name) { + if (this.$behaviours && this.$behaviours[name]) delete this.$behaviours[name]; + }; + this.inherit = function(mode, filter) { + if (typeof mode === "function") var behaviours = new mode().getBehaviours(filter); + else var behaviours = mode.getBehaviours(filter); + this.addBehaviours(behaviours); + }; + this.getBehaviours = function(filter) { + if (!filter) return this.$behaviours; + else { + var ret = {}; + for(var i = 0; i < filter.length; i++)if (this.$behaviours[filter[i]]) ret[filter[i]] = this.$behaviours[filter[i]]; + return ret; + } + }; + }).call(Behaviour.prototype); + exports.Behaviour = Behaviour; +}); +ace.define("ace/token_iterator", [ + "require", + "exports", + "module", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var Range = require("./range").Range; + var TokenIterator = function(session, initialRow, initialColumn) { + this.$session = session; + this.$row = initialRow; + this.$rowTokens = session.getTokens(initialRow); + var token = session.getTokenAt(initialRow, initialColumn); + this.$tokenIndex = token ? token.index : -1; + }; + (function() { + this.stepBackward = function() { + this.$tokenIndex -= 1; + while(this.$tokenIndex < 0){ + this.$row -= 1; + if (this.$row < 0) { + this.$row = 0; + return 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 rowCount; + while(this.$tokenIndex >= this.$rowTokens.length){ + this.$row += 1; + if (!rowCount) rowCount = this.$session.getLength(); + if (this.$row >= rowCount) { + this.$row = rowCount - 1; + return 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 rowTokens = this.$rowTokens; + var tokenIndex = this.$tokenIndex; + var column = rowTokens[tokenIndex].start; + if (column !== undefined) return column; + column = 0; + while(tokenIndex > 0){ + tokenIndex -= 1; + column += rowTokens[tokenIndex].value.length; + } + return column; + }; + this.getCurrentTokenPosition = function() { + return { + row: this.$row, + column: this.getCurrentTokenColumn() + }; + }; + this.getCurrentTokenRange = function() { + var token = this.$rowTokens[this.$tokenIndex]; + var column = this.getCurrentTokenColumn(); + return new Range(this.$row, column, this.$row, column + token.value.length); + }; + }).call(TokenIterator.prototype); + exports.TokenIterator = TokenIterator; +}); +ace.define("ace/mode/behaviour/cstyle", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/mode/behaviour", + "ace/token_iterator", + "ace/lib/lang" +], function(require, exports, module1) { + "use strict"; + var oop = require("../../lib/oop"); + var Behaviour = require("../behaviour").Behaviour; + var TokenIterator = require("../../token_iterator").TokenIterator; + var lang = require("../../lib/lang"); + var SAFE_INSERT_IN_TOKENS = [ + "text", + "paren.rparen", + "rparen", + "paren", + "punctuation.operator" + ]; + var SAFE_INSERT_BEFORE_TOKENS = [ + "text", + "paren.rparen", + "rparen", + "paren", + "punctuation.operator", + "comment" + ]; + var context; + var contextCache = {}; + var defaultQuotes = { + '"': '"', + "'": "'" + }; + var initContext = function(editor) { + var id = -1; + if (editor.multiSelect) { + id = editor.selection.index; + if (contextCache.rangeCount != editor.multiSelect.rangeCount) contextCache = { + rangeCount: editor.multiSelect.rangeCount + }; + } + if (contextCache[id]) return context = contextCache[id]; + context = contextCache[id] = { + autoInsertedBrackets: 0, + autoInsertedRow: -1, + autoInsertedLineEnd: "", + maybeInsertedBrackets: 0, + maybeInsertedRow: -1, + maybeInsertedLineStart: "", + maybeInsertedLineEnd: "" + }; + }; + var getWrapped = function(selection, selected, opening, closing) { + var rowDiff = selection.end.row - selection.start.row; + return { + text: opening + selected + closing, + selection: [ + 0, + selection.start.column + 1, + rowDiff, + selection.end.column + (rowDiff ? 0 : 1) + ] + }; + }; + var CstyleBehaviour = function(options) { + this.add("braces", "insertion", function(state, action, editor, session, text) { + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + if (text == "{") { + initContext(editor); + var selection = editor.getSelectionRange(); + var selected = session.doc.getTextRange(selection); + if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) return getWrapped(selection, selected, "{", "}"); + else if (CstyleBehaviour.isSaneInsertion(editor, session)) { + if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode || options && options.braces) { + CstyleBehaviour.recordAutoInsert(editor, session, "}"); + return { + text: "{}", + selection: [ + 1, + 1 + ] + }; + } else { + CstyleBehaviour.recordMaybeInsert(editor, session, "{"); + return { + text: "{", + selection: [ + 1, + 1 + ] + }; + } + } + } else if (text == "}") { + initContext(editor); + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar == "}") { + var matching = session.$findOpeningBracket("}", { + column: cursor.column + 1, + row: cursor.row + }); + if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { + CstyleBehaviour.popAutoInsertedClosing(); + return { + text: "", + selection: [ + 1, + 1 + ] + }; + } + } + } else if (text == "\n" || text == "\r\n") { + initContext(editor); + var closing = ""; + if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { + closing = lang.stringRepeat("}", context.maybeInsertedBrackets); + CstyleBehaviour.clearMaybeInsertedClosing(); + } + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar === "}") { + var openBracePos = session.findMatchingBracket({ + row: cursor.row, + column: cursor.column + 1 + }, "}"); + if (!openBracePos) return null; + var next_indent = this.$getIndent(session.getLine(openBracePos.row)); + } else if (closing) var next_indent = this.$getIndent(line); + else { + CstyleBehaviour.clearMaybeInsertedClosing(); + return; + } + var indent = next_indent + session.getTabString(); + return { + text: "\n" + indent + "\n" + next_indent + closing, + selection: [ + 1, + indent.length, + 1, + indent.length + ] + }; + } else CstyleBehaviour.clearMaybeInsertedClosing(); + }); + this.add("braces", "deletion", function(state, action, editor, session, range) { + var selected = session.doc.getTextRange(range); + if (!range.isMultiLine() && selected == "{") { + initContext(editor); + var line = session.doc.getLine(range.start.row); + var rightChar = line.substring(range.end.column, range.end.column + 1); + if (rightChar == "}") { + range.end.column++; + return range; + } else context.maybeInsertedBrackets--; + } + }); + this.add("parens", "insertion", function(state, action, editor, session, text) { + if (text == "(") { + initContext(editor); + var selection = editor.getSelectionRange(); + var selected = session.doc.getTextRange(selection); + if (selected !== "" && editor.getWrapBehavioursEnabled()) return getWrapped(selection, selected, "(", ")"); + else if (CstyleBehaviour.isSaneInsertion(editor, session)) { + CstyleBehaviour.recordAutoInsert(editor, session, ")"); + return { + text: "()", + selection: [ + 1, + 1 + ] + }; + } + } else if (text == ")") { + initContext(editor); + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar == ")") { + var matching = session.$findOpeningBracket(")", { + column: cursor.column + 1, + row: cursor.row + }); + if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { + CstyleBehaviour.popAutoInsertedClosing(); + return { + text: "", + selection: [ + 1, + 1 + ] + }; + } + } + } + }); + this.add("parens", "deletion", function(state, action, editor, session, range) { + var selected = session.doc.getTextRange(range); + if (!range.isMultiLine() && selected == "(") { + initContext(editor); + var line = session.doc.getLine(range.start.row); + var rightChar = line.substring(range.start.column + 1, range.start.column + 2); + if (rightChar == ")") { + range.end.column++; + return range; + } + } + }); + this.add("brackets", "insertion", function(state, action, editor, session, text) { + if (text == "[") { + initContext(editor); + var selection = editor.getSelectionRange(); + var selected = session.doc.getTextRange(selection); + if (selected !== "" && editor.getWrapBehavioursEnabled()) return getWrapped(selection, selected, "[", "]"); + else if (CstyleBehaviour.isSaneInsertion(editor, session)) { + CstyleBehaviour.recordAutoInsert(editor, session, "]"); + return { + text: "[]", + selection: [ + 1, + 1 + ] + }; + } + } else if (text == "]") { + initContext(editor); + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + var rightChar = line.substring(cursor.column, cursor.column + 1); + if (rightChar == "]") { + var matching = session.$findOpeningBracket("]", { + column: cursor.column + 1, + row: cursor.row + }); + if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { + CstyleBehaviour.popAutoInsertedClosing(); + return { + text: "", + selection: [ + 1, + 1 + ] + }; + } + } + } + }); + this.add("brackets", "deletion", function(state, action, editor, session, range) { + var selected = session.doc.getTextRange(range); + if (!range.isMultiLine() && selected == "[") { + initContext(editor); + var line = session.doc.getLine(range.start.row); + var rightChar = line.substring(range.start.column + 1, range.start.column + 2); + if (rightChar == "]") { + range.end.column++; + return range; + } + } + }); + this.add("string_dquotes", "insertion", function(state, action, editor, session, text) { + var quotes = session.$mode.$quotes || defaultQuotes; + if (text.length == 1 && quotes[text]) { + if (this.lineCommentStart && this.lineCommentStart.indexOf(text) != -1) return; + initContext(editor); + var quote = text; + var selection = editor.getSelectionRange(); + var selected = session.doc.getTextRange(selection); + if (selected !== "" && (selected.length != 1 || !quotes[selected]) && editor.getWrapBehavioursEnabled()) return getWrapped(selection, selected, quote, quote); + else if (!selected) { + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + var leftChar = line.substring(cursor.column - 1, cursor.column); + var rightChar = line.substring(cursor.column, cursor.column + 1); + var token = session.getTokenAt(cursor.row, cursor.column); + var rightToken = session.getTokenAt(cursor.row, cursor.column + 1); + if (leftChar == "\\" && token && /escape/.test(token.type)) return null; + var stringBefore = token && /string|escape/.test(token.type); + var stringAfter = !rightToken || /string|escape/.test(rightToken.type); + var pair; + if (rightChar == quote) { + pair = stringBefore !== stringAfter; + if (pair && /string\.end/.test(rightToken.type)) pair = false; + } else { + if (stringBefore && !stringAfter) return null; // wrap string with different quote + if (stringBefore && stringAfter) return null; // do not pair quotes inside strings + var wordRe = session.$mode.tokenRe; + wordRe.lastIndex = 0; + var isWordBefore = wordRe.test(leftChar); + wordRe.lastIndex = 0; + var isWordAfter = wordRe.test(leftChar); + if (isWordBefore || isWordAfter) return null; // before or after alphanumeric + if (rightChar && !/[\s;,.})\]\\]/.test(rightChar)) return null; // there is rightChar and it isn't closing + var charBefore = line[cursor.column - 2]; + if (leftChar == quote && (charBefore == quote || wordRe.test(charBefore))) return null; + pair = true; + } + return { + text: pair ? quote + quote : "", + selection: [ + 1, + 1 + ] + }; + } + } + }); + this.add("string_dquotes", "deletion", function(state, action, editor, session, range) { + var quotes = session.$mode.$quotes || defaultQuotes; + var selected = session.doc.getTextRange(range); + if (!range.isMultiLine() && quotes.hasOwnProperty(selected)) { + initContext(editor); + var line = session.doc.getLine(range.start.row); + var rightChar = line.substring(range.start.column + 1, range.start.column + 2); + if (rightChar == selected) { + range.end.column++; + return range; + } + } + }); + }; + CstyleBehaviour.isSaneInsertion = function(editor, session) { + var cursor = editor.getCursorPosition(); + var iterator = new TokenIterator(session, cursor.row, cursor.column); + if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { + if (/[)}\]]/.test(editor.session.getLine(cursor.row)[cursor.column])) return true; + var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); + if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) return false; + } + iterator.stepForward(); + return iterator.getCurrentTokenRow() !== cursor.row || this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); + }; + CstyleBehaviour.$matchTokenType = function(token, types) { + return types.indexOf(token.type || token) > -1; + }; + CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0])) context.autoInsertedBrackets = 0; + context.autoInsertedRow = cursor.row; + context.autoInsertedLineEnd = bracket + line.substr(cursor.column); + context.autoInsertedBrackets++; + }; + CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { + var cursor = editor.getCursorPosition(); + var line = session.doc.getLine(cursor.row); + if (!this.isMaybeInsertedClosing(cursor, line)) context.maybeInsertedBrackets = 0; + context.maybeInsertedRow = cursor.row; + context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; + context.maybeInsertedLineEnd = line.substr(cursor.column); + context.maybeInsertedBrackets++; + }; + CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { + return context.autoInsertedBrackets > 0 && cursor.row === context.autoInsertedRow && bracket === context.autoInsertedLineEnd[0] && line.substr(cursor.column) === context.autoInsertedLineEnd; + }; + CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { + return context.maybeInsertedBrackets > 0 && cursor.row === context.maybeInsertedRow && line.substr(cursor.column) === context.maybeInsertedLineEnd && line.substr(0, cursor.column) == context.maybeInsertedLineStart; + }; + CstyleBehaviour.popAutoInsertedClosing = function() { + context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1); + context.autoInsertedBrackets--; + }; + CstyleBehaviour.clearMaybeInsertedClosing = function() { + if (context) { + context.maybeInsertedBrackets = 0; + context.maybeInsertedRow = -1; + } + }; + oop.inherits(CstyleBehaviour, Behaviour); + exports.CstyleBehaviour = CstyleBehaviour; +}); +ace.define("ace/unicode", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + "use strict"; + var wordChars = [ + 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 + ]; + var code = 0; + var str = []; + for(var i = 0; i < wordChars.length; i += 2){ + str.push(code += wordChars[i]); + if (wordChars[i + 1]) str.push(45, code += wordChars[i + 1]); + } + exports.wordChars = String.fromCharCode.apply(null, str); +}); +ace.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(require, exports, module1) { + "use strict"; + var config = require("../config"); + var Tokenizer = require("../tokenizer").Tokenizer; + var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; + var unicode = require("../unicode"); + var lang = require("../lib/lang"); + var TokenIterator = require("../token_iterator").TokenIterator; + var Range = require("../range").Range; + var Mode = function() { + this.HighlightRules = TextHighlightRules; + }; + (function() { + this.$defaultBehaviour = new CstyleBehaviour(); + this.tokenRe = new RegExp("^[" + unicode.wordChars + "\\$_]+", "g"); + this.nonTokenRe = new RegExp("^(?:[^" + unicode.wordChars + "\\$_]|\\s])+", "g"); + this.getTokenizer = function() { + if (!this.$tokenizer) { + this.$highlightRules = this.$highlightRules || new this.HighlightRules(this.$highlightRuleConfig); + this.$tokenizer = new Tokenizer(this.$highlightRules.getRules()); + } + return this.$tokenizer; + }; + this.lineCommentStart = ""; + this.blockComment = ""; + this.toggleCommentLines = function(state, session, startRow, endRow) { + var doc = session.doc; + var ignoreBlankLines = true; + var shouldRemove = true; + var minIndent = Infinity; + var tabSize = session.getTabSize(); + var insertAtTabStop = false; + if (!this.lineCommentStart) { + if (!this.blockComment) return false; + var lineCommentStart = this.blockComment.start; + var lineCommentEnd = this.blockComment.end; + var regexpStart = new RegExp("^(\\s*)(?:" + lang.escapeRegExp(lineCommentStart) + ")"); + var regexpEnd = new RegExp("(?:" + lang.escapeRegExp(lineCommentEnd) + ")\\s*$"); + var comment = function(line, i) { + if (testRemove(line, i)) return; + if (!ignoreBlankLines || /\S/.test(line)) { + doc.insertInLine({ + row: i, + column: line.length + }, lineCommentEnd); + doc.insertInLine({ + row: i, + column: minIndent + }, lineCommentStart); + } + }; + var uncomment = function(line, i) { + var m; + if (m = line.match(regexpEnd)) doc.removeInLine(i, line.length - m[0].length, line.length); + if (m = line.match(regexpStart)) doc.removeInLine(i, m[1].length, m[0].length); + }; + var testRemove = function(line, row) { + if (regexpStart.test(line)) return true; + var tokens = session.getTokens(row); + for(var i = 0; i < tokens.length; i++){ + if (tokens[i].type === "comment") return true; + } + }; + } else { + if (Array.isArray(this.lineCommentStart)) { + var regexpStart = this.lineCommentStart.map(lang.escapeRegExp).join("|"); + var lineCommentStart = this.lineCommentStart[0]; + } else { + var regexpStart = lang.escapeRegExp(this.lineCommentStart); + var lineCommentStart = this.lineCommentStart; + } + regexpStart = new RegExp("^(\\s*)(?:" + regexpStart + ") ?"); + insertAtTabStop = session.getUseSoftTabs(); + var uncomment = function(line, i) { + var m = line.match(regexpStart); + if (!m) return; + var start = m[1].length, end = m[0].length; + if (!shouldInsertSpace(line, start, end) && m[0][end - 1] == " ") end--; + doc.removeInLine(i, start, end); + }; + var commentWithSpace = lineCommentStart + " "; + var comment = function(line, i) { + if (!ignoreBlankLines || /\S/.test(line)) { + if (shouldInsertSpace(line, minIndent, minIndent)) doc.insertInLine({ + row: i, + column: minIndent + }, commentWithSpace); + else doc.insertInLine({ + row: i, + column: minIndent + }, lineCommentStart); + } + }; + var testRemove = function(line, i) { + return regexpStart.test(line); + }; + var shouldInsertSpace = function(line, before, after) { + var spaces = 0; + while(before-- && line.charAt(before) == " ")spaces++; + if (spaces % tabSize != 0) return false; + var spaces = 0; + while(line.charAt(after++) == " ")spaces++; + if (tabSize > 2) return spaces % tabSize != tabSize - 1; + else return spaces % tabSize == 0; + }; + } + function iter(fun) { + for(var i = startRow; i <= endRow; i++)fun(doc.getLine(i), i); + } + var minEmptyLength = Infinity; + iter(function(line, i) { + var indent = line.search(/\S/); + if (indent !== -1) { + if (indent < minIndent) minIndent = indent; + if (shouldRemove && !testRemove(line, i)) shouldRemove = false; + } else if (minEmptyLength > line.length) minEmptyLength = line.length; + }); + if (minIndent == Infinity) { + minIndent = minEmptyLength; + ignoreBlankLines = false; + shouldRemove = false; + } + if (insertAtTabStop && minIndent % tabSize != 0) minIndent = Math.floor(minIndent / tabSize) * tabSize; + iter(shouldRemove ? uncomment : comment); + }; + this.toggleBlockComment = function(state, session, range, cursor) { + var comment = this.blockComment; + if (!comment) return; + if (!comment.start && comment[0]) comment = comment[0]; + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + var sel = session.selection; + var initialRange = session.selection.toOrientedRange(); + var startRow, colDiff; + if (token && /comment/.test(token.type)) { + var startRange, endRange; + while(token && /comment/.test(token.type)){ + var i = token.value.indexOf(comment.start); + if (i != -1) { + var row = iterator.getCurrentTokenRow(); + var column = iterator.getCurrentTokenColumn() + i; + startRange = new Range(row, column, row, column + comment.start.length); + break; + } + token = iterator.stepBackward(); + } + var iterator = new TokenIterator(session, cursor.row, cursor.column); + var token = iterator.getCurrentToken(); + while(token && /comment/.test(token.type)){ + var i = token.value.indexOf(comment.end); + if (i != -1) { + var row = iterator.getCurrentTokenRow(); + var column = iterator.getCurrentTokenColumn() + i; + endRange = new Range(row, column, row, column + comment.end.length); + break; + } + token = iterator.stepForward(); + } + if (endRange) session.remove(endRange); + if (startRange) { + session.remove(startRange); + startRow = startRange.start.row; + colDiff = -comment.start.length; + } + } else { + colDiff = comment.start.length; + startRow = range.start.row; + session.insert(range.end, comment.end); + session.insert(range.start, comment.start); + } + if (initialRange.start.row == startRow) initialRange.start.column += colDiff; + if (initialRange.end.row == startRow) initialRange.end.column += colDiff; + session.selection.fromOrientedRange(initialRange); + }; + this.getNextLineIndent = function(state, line, tab) { + return this.$getIndent(line); + }; + this.checkOutdent = function(state, line, input) { + return false; + }; + this.autoOutdent = function(state, doc, row) {}; + this.$getIndent = function(line) { + return line.match(/^\s*/)[0]; + }; + this.createWorker = function(session) { + return null; + }; + this.createModeDelegates = function(mapping) { + this.$embeds = []; + this.$modes = {}; + for(var i in mapping)if (mapping[i]) { + var Mode = mapping[i]; + var id = Mode.prototype.$id; + var mode = config.$modes[id]; + if (!mode) config.$modes[id] = mode = new Mode(); + if (!config.$modes[i]) config.$modes[i] = mode; + this.$embeds.push(i); + this.$modes[i] = mode; + } + var delegations = [ + "toggleBlockComment", + "toggleCommentLines", + "getNextLineIndent", + "checkOutdent", + "autoOutdent", + "transformAction", + "getCompletions" + ]; + for(var i = 0; i < delegations.length; i++)(function(scope) { + var functionName = delegations[i]; + var defaultHandler = scope[functionName]; + scope[delegations[i]] = function() { + return this.$delegator(functionName, arguments, defaultHandler); + }; + })(this); + }; + this.$delegator = function(method, args, defaultHandler) { + var state = args[0] || "start"; + if (typeof state != "string") { + if (Array.isArray(state[2])) { + var language = state[2][state[2].length - 1]; + var mode = this.$modes[language]; + if (mode) return mode[method].apply(mode, [ + state[1] + ].concat([].slice.call(args, 1))); + } + state = state[0] || "start"; + } + for(var i = 0; i < this.$embeds.length; i++){ + if (!this.$modes[this.$embeds[i]]) continue; + var split = state.split(this.$embeds[i]); + if (!split[0] && split[1]) { + args[0] = split[1]; + var mode = this.$modes[this.$embeds[i]]; + return mode[method].apply(mode, args); + } + } + var ret = defaultHandler.apply(this, args); + return defaultHandler ? ret : undefined; + }; + this.transformAction = function(state, action, editor, session, param) { + if (this.$behaviour) { + var behaviours = this.$behaviour.getBehaviours(); + for(var key in behaviours)if (behaviours[key][action]) { + var ret = behaviours[key][action].apply(this, arguments); + if (ret) return ret; + } + } + }; + this.getKeywords = function(append) { + if (!this.completionKeywords) { + var rules = this.$tokenizer.rules; + var completionKeywords = []; + for(var rule in rules){ + var ruleItr = rules[rule]; + for(var r = 0, l = ruleItr.length; r < l; r++){ + if (typeof ruleItr[r].token === "string") { + if (/keyword|support|storage/.test(ruleItr[r].token)) completionKeywords.push(ruleItr[r].regex); + } else if (typeof ruleItr[r].token === "object") { + for(var a = 0, aLength = ruleItr[r].token.length; a < aLength; a++)if (/keyword|support|storage/.test(ruleItr[r].token[a])) { + var rule = ruleItr[r].regex.match(/\(.+?\)/g)[a]; + completionKeywords.push(rule.substr(1, rule.length - 2)); + } + } + } + } + this.completionKeywords = completionKeywords; + } + if (!append) return this.$keywordList; + return completionKeywords.concat(this.$keywordList || []); + }; + this.$createKeywordList = function() { + if (!this.$highlightRules) this.getTokenizer(); + return this.$keywordList = this.$highlightRules.$keywordList || []; + }; + this.getCompletions = function(state, session, pos, prefix) { + var keywords = this.$keywordList || this.$createKeywordList(); + return keywords.map(function(word) { + return { + name: word, + value: word, + score: 0, + meta: "keyword" + }; + }); + }; + this.$id = "ace/mode/text"; + }).call(Mode.prototype); + exports.Mode = Mode; +}); +ace.define("ace/apply_delta", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + "use strict"; + function throwDeltaError(delta, errorText) { + console.log("Invalid Delta:", delta); + throw "Invalid Delta: " + errorText; + } + function positionInDocument(docLines, position) { + return position.row >= 0 && position.row < docLines.length && position.column >= 0 && position.column <= docLines[position.row].length; + } + function validateDelta(docLines, delta) { + if (delta.action != "insert" && delta.action != "remove") throwDeltaError(delta, "delta.action must be 'insert' or 'remove'"); + if (!(delta.lines instanceof Array)) throwDeltaError(delta, "delta.lines must be an Array"); + if (!delta.start || !delta.end) throwDeltaError(delta, "delta.start/end must be an present"); + var start = delta.start; + if (!positionInDocument(docLines, delta.start)) throwDeltaError(delta, "delta.start must be contained in document"); + var end = delta.end; + if (delta.action == "remove" && !positionInDocument(docLines, end)) throwDeltaError(delta, "delta.end must contained in document for 'remove' actions"); + var numRangeRows = end.row - start.row; + var numRangeLastLineChars = end.column - (numRangeRows == 0 ? start.column : 0); + if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars) throwDeltaError(delta, "delta.range must match delta lines"); + } + exports.applyDelta = function(docLines, delta, doNotValidate) { + var row = delta.start.row; + var startColumn = delta.start.column; + var line = docLines[row] || ""; + switch(delta.action){ + case "insert": + var lines = delta.lines; + if (lines.length === 1) docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn); + else { + var args = [ + row, + 1 + ].concat(delta.lines); + docLines.splice.apply(docLines, args); + docLines[row] = line.substring(0, startColumn) + docLines[row]; + docLines[row + delta.lines.length - 1] += line.substring(startColumn); + } + break; + case "remove": + var endColumn = delta.end.column; + var endRow = delta.end.row; + if (row === endRow) docLines[row] = line.substring(0, startColumn) + line.substring(endColumn); + else docLines.splice(row, endRow - row + 1, line.substring(0, startColumn) + docLines[endRow].substring(endColumn)); + break; + } + }; +}); +ace.define("ace/anchor", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/lib/event_emitter" +], function(require, exports, module1) { + "use strict"; + var oop = require("./lib/oop"); + var EventEmitter = require("./lib/event_emitter").EventEmitter; + var Anchor = exports.Anchor = function(doc, row, column) { + this.$onChange = this.onChange.bind(this); + this.attach(doc); + if (typeof column == "undefined") this.setPosition(row.row, row.column); + else this.setPosition(row, column); + }; + (function() { + oop.implement(this, EventEmitter); + this.getPosition = function() { + return this.$clipPositionToDocument(this.row, this.column); + }; + this.getDocument = function() { + return this.document; + }; + this.$insertRight = false; + this.onChange = function(delta) { + if (delta.start.row == delta.end.row && delta.start.row != this.row) return; + if (delta.start.row > this.row) return; + var point = $getTransformedPoint(delta, { + row: this.row, + column: this.column + }, this.$insertRight); + this.setPosition(point.row, point.column, true); + }; + function $pointsInOrder(point1, point2, equalPointsInOrder) { + var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column; + return point1.row < point2.row || point1.row == point2.row && bColIsAfter; + } + function $getTransformedPoint(delta, point, moveIfEqual) { + var deltaIsInsert = delta.action == "insert"; + var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row); + var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column); + var deltaStart = delta.start; + var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range. + if ($pointsInOrder(point, deltaStart, moveIfEqual)) return { + row: point.row, + column: point.column + }; + if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) return { + row: point.row + deltaRowShift, + column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0) + }; + return { + row: deltaStart.row, + column: deltaStart.column + }; + } + this.setPosition = function(row, column, noClip) { + var pos; + if (noClip) pos = { + row: row, + column: column + }; + else pos = this.$clipPositionToDocument(row, column); + if (this.row == pos.row && this.column == pos.column) return; + var old = { + row: this.row, + column: this.column + }; + this.row = pos.row; + this.column = pos.column; + this._signal("change", { + old: old, + value: pos + }); + }; + this.detach = function() { + this.document.off("change", this.$onChange); + }; + this.attach = function(doc) { + this.document = doc || this.document; + this.document.on("change", this.$onChange); + }; + this.$clipPositionToDocument = function(row, column) { + var pos = {}; + if (row >= this.document.getLength()) { + pos.row = Math.max(0, this.document.getLength() - 1); + pos.column = this.document.getLine(pos.row).length; + } else if (row < 0) { + pos.row = 0; + pos.column = 0; + } else { + pos.row = row; + pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); + } + if (column < 0) pos.column = 0; + return pos; + }; + }).call(Anchor.prototype); +}); +ace.define("ace/document", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/apply_delta", + "ace/lib/event_emitter", + "ace/range", + "ace/anchor" +], function(require, exports, module1) { + "use strict"; + var oop = require("./lib/oop"); + var applyDelta = require("./apply_delta").applyDelta; + var EventEmitter = require("./lib/event_emitter").EventEmitter; + var Range = require("./range").Range; + var Anchor = require("./anchor").Anchor; + var Document = function(textOrLines) { + this.$lines = [ + "" + ]; + if (textOrLines.length === 0) this.$lines = [ + "" + ]; + else if (Array.isArray(textOrLines)) this.insertMergedLines({ + row: 0, + column: 0 + }, textOrLines); + else this.insert({ + row: 0, + column: 0 + }, textOrLines); + }; + (function() { + oop.implement(this, EventEmitter); + this.setValue = function(text) { + var len = this.getLength() - 1; + this.remove(new Range(0, 0, len, this.getLine(len).length)); + this.insert({ + row: 0, + column: 0 + }, text || ""); + }; + this.getValue = function() { + return this.getAllLines().join(this.getNewLineCharacter()); + }; + this.createAnchor = function(row, column) { + return new Anchor(this, row, column); + }; + if ("aaa".split(/a/).length === 0) this.$split = function(text) { + return text.replace(/\r\n|\r/g, "\n").split("\n"); + }; + else this.$split = function(text) { + return text.split(/\r\n|\r|\n/); + }; + this.$detectNewLine = function(text) { + var match = text.match(/^.*?(\r\n|\r|\n)/m); + this.$autoNewLine = match ? match[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(newLineMode) { + if (this.$newLineMode === newLineMode) return; + this.$newLineMode = newLineMode; + this._signal("changeNewLineMode"); + }; + this.getNewLineMode = function() { + return this.$newLineMode; + }; + this.isNewLine = function(text) { + return text == "\r\n" || text == "\r" || text == "\n"; + }; + this.getLine = function(row) { + return this.$lines[row] || ""; + }; + this.getLines = function(firstRow, lastRow) { + return this.$lines.slice(firstRow, lastRow + 1); + }; + this.getAllLines = function() { + return this.getLines(0, this.getLength()); + }; + this.getLength = function() { + return this.$lines.length; + }; + this.getTextRange = function(range) { + return this.getLinesForRange(range).join(this.getNewLineCharacter()); + }; + this.getLinesForRange = function(range) { + var lines; + if (range.start.row === range.end.row) lines = [ + this.getLine(range.start.row).substring(range.start.column, range.end.column) + ]; + else { + lines = this.getLines(range.start.row, range.end.row); + lines[0] = (lines[0] || "").substring(range.start.column); + var l = lines.length - 1; + if (range.end.row - range.start.row == l) lines[l] = lines[l].substring(0, range.end.column); + } + return lines; + }; + this.insertLines = function(row, lines) { + console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."); + return this.insertFullLines(row, lines); + }; + this.removeLines = function(firstRow, lastRow) { + console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."); + return this.removeFullLines(firstRow, lastRow); + }; + this.insertNewLine = function(position) { + console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."); + return this.insertMergedLines(position, [ + "", + "" + ]); + }; + this.insert = function(position, text) { + if (this.getLength() <= 1) this.$detectNewLine(text); + return this.insertMergedLines(position, this.$split(text)); + }; + this.insertInLine = function(position, text) { + var start = this.clippedPos(position.row, position.column); + var end = this.pos(position.row, position.column + text.length); + this.applyDelta({ + start: start, + end: end, + action: "insert", + lines: [ + text + ] + }, true); + return this.clonePos(end); + }; + this.clippedPos = function(row, column) { + var length = this.getLength(); + if (row === undefined) row = length; + else if (row < 0) row = 0; + else if (row >= length) { + row = length - 1; + column = undefined; + } + var line = this.getLine(row); + if (column == undefined) column = line.length; + column = Math.min(Math.max(column, 0), line.length); + return { + row: row, + column: column + }; + }; + this.clonePos = function(pos) { + return { + row: pos.row, + column: pos.column + }; + }; + this.pos = function(row, column) { + return { + row: row, + column: column + }; + }; + this.$clipPosition = function(position) { + var length = this.getLength(); + if (position.row >= length) { + position.row = Math.max(0, length - 1); + position.column = this.getLine(length - 1).length; + } else { + position.row = Math.max(0, position.row); + position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length); + } + return position; + }; + this.insertFullLines = function(row, lines) { + row = Math.min(Math.max(row, 0), this.getLength()); + var column = 0; + if (row < this.getLength()) { + lines = lines.concat([ + "" + ]); + column = 0; + } else { + lines = [ + "" + ].concat(lines); + row--; + column = this.$lines[row].length; + } + this.insertMergedLines({ + row: row, + column: column + }, lines); + }; + this.insertMergedLines = function(position, lines) { + var start = this.clippedPos(position.row, position.column); + var end = { + row: start.row + lines.length - 1, + column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length + }; + this.applyDelta({ + start: start, + end: end, + action: "insert", + lines: lines + }); + return this.clonePos(end); + }; + this.remove = function(range) { + var start = this.clippedPos(range.start.row, range.start.column); + var end = this.clippedPos(range.end.row, range.end.column); + this.applyDelta({ + start: start, + end: end, + action: "remove", + lines: this.getLinesForRange({ + start: start, + end: end + }) + }); + return this.clonePos(start); + }; + this.removeInLine = function(row, startColumn, endColumn) { + var start = this.clippedPos(row, startColumn); + var end = this.clippedPos(row, endColumn); + this.applyDelta({ + start: start, + end: end, + action: "remove", + lines: this.getLinesForRange({ + start: start, + end: end + }) + }, true); + return this.clonePos(start); + }; + this.removeFullLines = function(firstRow, lastRow) { + firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1); + lastRow = Math.min(Math.max(0, lastRow), this.getLength() - 1); + var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0; + var deleteLastNewLine = lastRow < this.getLength() - 1; + var startRow = deleteFirstNewLine ? firstRow - 1 : firstRow; + var startCol = deleteFirstNewLine ? this.getLine(startRow).length : 0; + var endRow = deleteLastNewLine ? lastRow + 1 : lastRow; + var endCol = deleteLastNewLine ? 0 : this.getLine(endRow).length; + var range = new Range(startRow, startCol, endRow, endCol); + var deletedLines = this.$lines.slice(firstRow, lastRow + 1); + this.applyDelta({ + start: range.start, + end: range.end, + action: "remove", + lines: this.getLinesForRange(range) + }); + return deletedLines; + }; + this.removeNewLine = function(row) { + if (row < this.getLength() - 1 && row >= 0) this.applyDelta({ + start: this.pos(row, this.getLine(row).length), + end: this.pos(row + 1, 0), + action: "remove", + lines: [ + "", + "" + ] + }); + }; + this.replace = function(range, text) { + if (!(range instanceof Range)) range = Range.fromPoints(range.start, range.end); + if (text.length === 0 && range.isEmpty()) return range.start; + if (text == this.getTextRange(range)) return range.end; + this.remove(range); + var end; + if (text) end = this.insert(range.start, text); + else end = range.start; + return end; + }; + this.applyDeltas = function(deltas) { + for(var i = 0; i < deltas.length; i++)this.applyDelta(deltas[i]); + }; + this.revertDeltas = function(deltas) { + for(var i = deltas.length - 1; i >= 0; i--)this.revertDelta(deltas[i]); + }; + this.applyDelta = function(delta, doNotValidate) { + var isInsert = delta.action == "insert"; + if (isInsert ? delta.lines.length <= 1 && !delta.lines[0] : !Range.comparePoints(delta.start, delta.end)) return; + if (isInsert && delta.lines.length > 20000) this.$splitAndapplyLargeDelta(delta, 20000); + else { + applyDelta(this.$lines, delta, doNotValidate); + this._signal("change", delta); + } + }; + this.$safeApplyDelta = function(delta) { + var docLength = this.$lines.length; + if (delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength || delta.action == "insert" && delta.start.row <= docLength) this.applyDelta(delta); + }; + this.$splitAndapplyLargeDelta = function(delta, MAX) { + var lines = delta.lines; + var l = lines.length - MAX + 1; + var row = delta.start.row; + var column = delta.start.column; + for(var from = 0, to = 0; from < l; from = to){ + to += MAX - 1; + var chunk = lines.slice(from, to); + chunk.push(""); + this.applyDelta({ + start: this.pos(row + from, column), + end: this.pos(row + to, column = 0), + action: delta.action, + lines: chunk + }, true); + } + delta.lines = lines.slice(from); + delta.start.row = row + from; + delta.start.column = column; + this.applyDelta(delta, true); + }; + this.revertDelta = function(delta) { + this.$safeApplyDelta({ + start: this.clonePos(delta.start), + end: this.clonePos(delta.end), + action: delta.action == "insert" ? "remove" : "insert", + lines: delta.lines.slice() + }); + }; + this.indexToPosition = function(index, startRow) { + var lines = this.$lines || this.getAllLines(); + var newlineLength = this.getNewLineCharacter().length; + for(var i = startRow || 0, l = lines.length; i < l; i++){ + index -= lines[i].length + newlineLength; + if (index < 0) return { + row: i, + column: index + lines[i].length + newlineLength + }; + } + return { + row: l - 1, + column: index + lines[l - 1].length + newlineLength + }; + }; + this.positionToIndex = function(pos, startRow) { + var lines = this.$lines || this.getAllLines(); + var newlineLength = this.getNewLineCharacter().length; + var index = 0; + var row = Math.min(pos.row, lines.length); + for(var i = startRow || 0; i < row; ++i)index += lines[i].length + newlineLength; + return index + pos.column; + }; + }).call(Document.prototype); + exports.Document = Document; +}); +ace.define("ace/background_tokenizer", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/lib/event_emitter" +], function(require, exports, module1) { + "use strict"; + var oop = require("./lib/oop"); + var EventEmitter = require("./lib/event_emitter").EventEmitter; + var BackgroundTokenizer = function(tokenizer, editor) { + this.running = false; + this.lines = []; + this.states = []; + this.currentLine = 0; + this.tokenizer = tokenizer; + var self = this; + this.$worker = function() { + if (!self.running) return; + var workerStart = new Date(); + var currentLine = self.currentLine; + var endLine = -1; + var doc = self.doc; + var startLine = currentLine; + while(self.lines[currentLine])currentLine++; + var len = doc.getLength(); + var processedLines = 0; + self.running = false; + while(currentLine < len){ + self.$tokenizeRow(currentLine); + endLine = currentLine; + do currentLine++; + while (self.lines[currentLine]); + processedLines++; + if (processedLines % 5 === 0 && new Date() - workerStart > 20) { + self.running = setTimeout(self.$worker, 20); + break; + } + } + self.currentLine = currentLine; + if (endLine == -1) endLine = currentLine; + if (startLine <= endLine) self.fireUpdateEvent(startLine, endLine); + }; + }; + (function() { + oop.implement(this, EventEmitter); + this.setTokenizer = function(tokenizer) { + this.tokenizer = tokenizer; + this.lines = []; + this.states = []; + this.start(0); + }; + this.setDocument = function(doc) { + this.doc = doc; + this.lines = []; + this.states = []; + this.stop(); + }; + this.fireUpdateEvent = function(firstRow, lastRow) { + var data = { + first: firstRow, + last: lastRow + }; + this._signal("update", { + data: data + }); + }; + this.start = function(startRow) { + this.currentLine = Math.min(startRow || 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() { + if (!this.running) this.running = setTimeout(this.$worker, 700); + }; + this.$updateOnChange = function(delta) { + var startRow = delta.start.row; + var len = delta.end.row - startRow; + if (len === 0) this.lines[startRow] = null; + else if (delta.action == "remove") { + this.lines.splice(startRow, len + 1, null); + this.states.splice(startRow, len + 1, null); + } else { + var args = Array(len + 1); + args.unshift(startRow, 1); + this.lines.splice.apply(this.lines, args); + this.states.splice.apply(this.states, args); + } + this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength()); + this.stop(); + }; + this.stop = function() { + if (this.running) clearTimeout(this.running); + this.running = false; + }; + this.getTokens = function(row) { + return this.lines[row] || this.$tokenizeRow(row); + }; + this.getState = function(row) { + if (this.currentLine == row) this.$tokenizeRow(row); + return this.states[row] || "start"; + }; + this.$tokenizeRow = function(row) { + var line = this.doc.getLine(row); + var state = this.states[row - 1]; + var data = this.tokenizer.getLineTokens(line, state, row); + if (this.states[row] + "" !== data.state + "") { + this.states[row] = data.state; + this.lines[row + 1] = null; + if (this.currentLine > row + 1) this.currentLine = row + 1; + } else if (this.currentLine == row) this.currentLine = row + 1; + return this.lines[row] = data.tokens; + }; + this.cleanup = function() { + this.running = false; + this.lines = []; + this.states = []; + this.currentLine = 0; + this.removeAllListeners(); + }; + }).call(BackgroundTokenizer.prototype); + exports.BackgroundTokenizer = BackgroundTokenizer; +}); +ace.define("ace/search_highlight", [ + "require", + "exports", + "module", + "ace/lib/lang", + "ace/lib/oop", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var lang = require("./lib/lang"); + var oop = require("./lib/oop"); + var Range = require("./range").Range; + var SearchHighlight = function(regExp, clazz, type) { + this.setRegexp(regExp); + this.clazz = clazz; + this.type = type || "text"; + }; + (function() { + this.MAX_RANGES = 500; + this.setRegexp = function(regExp) { + if (this.regExp + "" == regExp + "") return; + this.regExp = regExp; + this.cache = []; + }; + this.update = function(html, markerLayer, session, config) { + if (!this.regExp) return; + var start = config.firstRow, end = config.lastRow; + var renderedMarkerRanges = {}; + for(var i = start; i <= end; i++){ + var ranges = this.cache[i]; + if (ranges == null) { + ranges = lang.getMatchOffsets(session.getLine(i), this.regExp); + if (ranges.length > this.MAX_RANGES) ranges = ranges.slice(0, this.MAX_RANGES); + ranges = ranges.map(function(match) { + return new Range(i, match.offset, i, match.offset + match.length); + }); + this.cache[i] = ranges.length ? ranges : ""; + } + for(var j = ranges.length; j--;){ + var rangeToAddMarkerTo = ranges[j].toScreenRange(session); + var rangeAsString = rangeToAddMarkerTo.toString(); + if (renderedMarkerRanges[rangeAsString]) continue; + renderedMarkerRanges[rangeAsString] = true; + markerLayer.drawSingleLineMarker(html, rangeToAddMarkerTo, this.clazz, config); + } + } + }; + }).call(SearchHighlight.prototype); + exports.SearchHighlight = SearchHighlight; +}); +ace.define("ace/edit_session/fold_line", [ + "require", + "exports", + "module", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var Range = require("../range").Range; + function FoldLine(foldData, folds) { + this.foldData = foldData; + if (Array.isArray(folds)) this.folds = folds; + else folds = this.folds = [ + folds + ]; + var last = folds[folds.length - 1]; + this.range = new Range(folds[0].start.row, folds[0].start.column, last.end.row, last.end.column); + this.start = this.range.start; + this.end = this.range.end; + this.folds.forEach(function(fold) { + fold.setFoldLine(this); + }, this); + } + (function() { + this.shiftRow = function(shift) { + this.start.row += shift; + this.end.row += shift; + this.folds.forEach(function(fold) { + fold.start.row += shift; + fold.end.row += shift; + }); + }; + this.addFold = function(fold) { + if (fold.sameRow) { + if (fold.start.row < this.startRow || fold.endRow > this.endRow) throw new Error("Can't add a fold to this FoldLine as it has no connection"); + this.folds.push(fold); + this.folds.sort(function(a, b) { + return -a.range.compareEnd(b.start.row, b.start.column); + }); + if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) { + this.end.row = fold.end.row; + this.end.column = fold.end.column; + } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) { + this.start.row = fold.start.row; + this.start.column = fold.start.column; + } + } else if (fold.start.row == this.end.row) { + this.folds.push(fold); + this.end.row = fold.end.row; + this.end.column = fold.end.column; + } else if (fold.end.row == this.start.row) { + this.folds.unshift(fold); + this.start.row = fold.start.row; + this.start.column = fold.start.column; + } else throw new Error("Trying to add fold to FoldRow that doesn't have a matching row"); + fold.foldLine = this; + }; + this.containsRow = function(row) { + return row >= this.start.row && row <= this.end.row; + }; + this.walk = function(callback, endRow, endColumn) { + var lastEnd = 0, folds = this.folds, fold, cmp, stop, isNewRow = true; + if (endRow == null) { + endRow = this.end.row; + endColumn = this.end.column; + } + for(var i = 0; i < folds.length; i++){ + fold = folds[i]; + cmp = fold.range.compareStart(endRow, endColumn); + if (cmp == -1) { + callback(null, endRow, endColumn, lastEnd, isNewRow); + return; + } + stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow); + stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd); + if (stop || cmp === 0) return; + isNewRow = !fold.sameRow; + lastEnd = fold.end.column; + } + callback(null, endRow, endColumn, lastEnd, isNewRow); + }; + this.getNextFoldTo = function(row, column) { + var fold, cmp; + for(var i = 0; i < this.folds.length; i++){ + fold = this.folds[i]; + cmp = fold.range.compareEnd(row, column); + if (cmp == -1) return { + fold: fold, + kind: "after" + }; + else if (cmp === 0) return { + fold: fold, + kind: "inside" + }; + } + return null; + }; + this.addRemoveChars = function(row, column, len) { + var ret = this.getNextFoldTo(row, column), fold, folds; + if (ret) { + fold = ret.fold; + if (ret.kind == "inside" && fold.start.column != column && fold.start.row != row) window.console && window.console.log(row, column, fold); + else if (fold.start.row == row) { + folds = this.folds; + var i = folds.indexOf(fold); + if (i === 0) this.start.column += len; + for(i; i < folds.length; i++){ + fold = folds[i]; + fold.start.column += len; + if (!fold.sameRow) return; + fold.end.column += len; + } + this.end.column += len; + } + } + }; + this.split = function(row, column) { + var pos = this.getNextFoldTo(row, column); + if (!pos || pos.kind == "inside") return null; + var fold = pos.fold; + var folds = this.folds; + var foldData = this.foldData; + var i = folds.indexOf(fold); + var foldBefore = folds[i - 1]; + this.end.row = foldBefore.end.row; + this.end.column = foldBefore.end.column; + folds = folds.splice(i, folds.length - i); + var newFoldLine = new FoldLine(foldData, folds); + foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine); + return newFoldLine; + }; + this.merge = function(foldLineNext) { + var folds = foldLineNext.folds; + for(var i = 0; i < folds.length; i++)this.addFold(folds[i]); + var foldData = this.foldData; + foldData.splice(foldData.indexOf(foldLineNext), 1); + }; + this.toString = function() { + var ret = [ + this.range.toString() + ": [" + ]; + this.folds.forEach(function(fold) { + ret.push(" " + fold.toString()); + }); + ret.push("]"); + return ret.join("\n"); + }; + this.idxToPosition = function(idx) { + var lastFoldEndColumn = 0; + for(var i = 0; i < this.folds.length; i++){ + var fold = this.folds[i]; + idx -= fold.start.column - lastFoldEndColumn; + if (idx < 0) return { + row: fold.start.row, + column: fold.start.column + idx + }; + idx -= fold.placeholder.length; + if (idx < 0) return fold.start; + lastFoldEndColumn = fold.end.column; + } + return { + row: this.end.row, + column: this.end.column + idx + }; + }; + }).call(FoldLine.prototype); + exports.FoldLine = FoldLine; +}); +ace.define("ace/range_list", [ + "require", + "exports", + "module", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var Range = require("./range").Range; + var comparePoints = Range.comparePoints; + var RangeList = function() { + this.ranges = []; + this.$bias = 1; + }; + (function() { + this.comparePoints = comparePoints; + this.pointIndex = function(pos, excludeEdges, startIndex) { + var list = this.ranges; + for(var i = startIndex || 0; i < list.length; i++){ + var range = list[i]; + var cmpEnd = comparePoints(pos, range.end); + if (cmpEnd > 0) continue; + var cmpStart = comparePoints(pos, range.start); + if (cmpEnd === 0) return excludeEdges && cmpStart !== 0 ? -i - 2 : i; + if (cmpStart > 0 || cmpStart === 0 && !excludeEdges) return i; + return -i - 1; + } + return -i - 1; + }; + this.add = function(range) { + var excludeEdges = !range.isEmpty(); + var startIndex = this.pointIndex(range.start, excludeEdges); + if (startIndex < 0) startIndex = -startIndex - 1; + var endIndex = this.pointIndex(range.end, excludeEdges, startIndex); + if (endIndex < 0) endIndex = -endIndex - 1; + else endIndex++; + return this.ranges.splice(startIndex, endIndex - startIndex, range); + }; + this.addList = function(list) { + var removed = []; + for(var i = list.length; i--;)removed.push.apply(removed, this.add(list[i])); + return removed; + }; + this.substractPoint = function(pos) { + var i = this.pointIndex(pos); + if (i >= 0) return this.ranges.splice(i, 1); + }; + this.merge = function() { + var removed = []; + var list = this.ranges; + list = list.sort(function(a, b) { + return comparePoints(a.start, b.start); + }); + var next = list[0], range; + for(var i = 1; i < list.length; i++){ + range = next; + next = list[i]; + var cmp = comparePoints(range.end, next.start); + if (cmp < 0) continue; + if (cmp == 0 && !range.isEmpty() && !next.isEmpty()) continue; + if (comparePoints(range.end, next.end) < 0) { + range.end.row = next.end.row; + range.end.column = next.end.column; + } + list.splice(i, 1); + removed.push(next); + next = range; + i--; + } + this.ranges = list; + return removed; + }; + this.contains = function(row, column) { + return this.pointIndex({ + row: row, + column: column + }) >= 0; + }; + this.containsPoint = function(pos) { + return this.pointIndex(pos) >= 0; + }; + this.rangeAtPoint = function(pos) { + var i = this.pointIndex(pos); + if (i >= 0) return this.ranges[i]; + }; + this.clipRows = function(startRow, endRow) { + var list = this.ranges; + if (list[0].start.row > endRow || list[list.length - 1].start.row < startRow) return []; + var startIndex = this.pointIndex({ + row: startRow, + column: 0 + }); + if (startIndex < 0) startIndex = -startIndex - 1; + var endIndex = this.pointIndex({ + row: endRow, + column: 0 + }, startIndex); + if (endIndex < 0) endIndex = -endIndex - 1; + var clipped = []; + for(var i = startIndex; i < endIndex; i++)clipped.push(list[i]); + return clipped; + }; + this.removeAll = function() { + return this.ranges.splice(0, this.ranges.length); + }; + this.attach = function(session) { + if (this.session) this.detach(); + this.session = session; + 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(delta) { + var start = delta.start; + var end = delta.end; + var startRow = start.row; + var endRow = end.row; + var ranges = this.ranges; + for(var i = 0, n = ranges.length; i < n; i++){ + var r = ranges[i]; + if (r.end.row >= startRow) break; + } + if (delta.action == "insert") { + var lineDif = endRow - startRow; + var colDiff = -start.column + end.column; + for(; i < n; i++){ + var r = ranges[i]; + if (r.start.row > startRow) break; + if (r.start.row == startRow && r.start.column >= start.column) { + if (r.start.column == start.column && this.$bias <= 0) ; + else { + r.start.column += colDiff; + r.start.row += lineDif; + } + } + if (r.end.row == startRow && r.end.column >= start.column) { + if (r.end.column == start.column && this.$bias < 0) continue; + if (r.end.column == start.column && colDiff > 0 && i < n - 1) { + if (r.end.column > r.start.column && r.end.column == ranges[i + 1].start.column) r.end.column -= colDiff; + } + r.end.column += colDiff; + r.end.row += lineDif; + } + } + } else { + var lineDif = startRow - endRow; + var colDiff = start.column - end.column; + for(; i < n; i++){ + var r = ranges[i]; + if (r.start.row > endRow) break; + if (r.end.row < endRow && (startRow < r.end.row || startRow == r.end.row && start.column < r.end.column)) { + r.end.row = startRow; + r.end.column = start.column; + } else if (r.end.row == endRow) { + if (r.end.column <= end.column) { + if (lineDif || r.end.column > start.column) { + r.end.column = start.column; + r.end.row = start.row; + } + } else { + r.end.column += colDiff; + r.end.row += lineDif; + } + } else if (r.end.row > endRow) r.end.row += lineDif; + if (r.start.row < endRow && (startRow < r.start.row || startRow == r.start.row && start.column < r.start.column)) { + r.start.row = startRow; + r.start.column = start.column; + } else if (r.start.row == endRow) { + if (r.start.column <= end.column) { + if (lineDif || r.start.column > start.column) { + r.start.column = start.column; + r.start.row = start.row; + } + } else { + r.start.column += colDiff; + r.start.row += lineDif; + } + } else if (r.start.row > endRow) r.start.row += lineDif; + } + } + if (lineDif != 0 && i < n) for(; i < n; i++){ + var r = ranges[i]; + r.start.row += lineDif; + r.end.row += lineDif; + } + }; + }).call(RangeList.prototype); + exports.RangeList = RangeList; +}); +ace.define("ace/edit_session/fold", [ + "require", + "exports", + "module", + "ace/range_list", + "ace/lib/oop" +], function(require, exports, module1) { + "use strict"; + var RangeList = require("../range_list").RangeList; + var oop = require("../lib/oop"); + var Fold = exports.Fold = function(range, placeholder) { + this.foldLine = null; + this.placeholder = placeholder; + this.range = range; + this.start = range.start; + this.end = range.end; + this.sameRow = range.start.row == range.end.row; + this.subFolds = this.ranges = []; + }; + oop.inherits(Fold, RangeList); + (function() { + this.toString = function() { + return '"' + this.placeholder + '" ' + this.range.toString(); + }; + this.setFoldLine = function(foldLine) { + this.foldLine = foldLine; + this.subFolds.forEach(function(fold) { + fold.setFoldLine(foldLine); + }); + }; + this.clone = function() { + var range = this.range.clone(); + var fold = new Fold(range, this.placeholder); + this.subFolds.forEach(function(subFold) { + fold.subFolds.push(subFold.clone()); + }); + fold.collapseChildren = this.collapseChildren; + return fold; + }; + this.addSubFold = function(fold) { + if (this.range.isEqual(fold)) return; + consumeRange(fold, this.start); + var row = fold.start.row, column = fold.start.column; + for(var i = 0, cmp = -1; i < this.subFolds.length; i++){ + cmp = this.subFolds[i].range.compare(row, column); + if (cmp != 1) break; + } + var afterStart = this.subFolds[i]; + var firstConsumed = 0; + if (cmp == 0) { + if (afterStart.range.containsRange(fold)) return afterStart.addSubFold(fold); + else firstConsumed = 1; + } + var row = fold.range.end.row, column = fold.range.end.column; + for(var j = i, cmp = -1; j < this.subFolds.length; j++){ + cmp = this.subFolds[j].range.compare(row, column); + if (cmp != 1) break; + } + if (cmp == 0) j++; + var consumedFolds = this.subFolds.splice(i, j - i, fold); + var last = cmp == 0 ? consumedFolds.length - 1 : consumedFolds.length; + for(var k = firstConsumed; k < last; k++)fold.addSubFold(consumedFolds[k]); + fold.setFoldLine(this.foldLine); + return fold; + }; + this.restoreRange = function(range) { + return restoreRange(range, this.start); + }; + }).call(Fold.prototype); + function consumePoint(point, anchor) { + point.row -= anchor.row; + if (point.row == 0) point.column -= anchor.column; + } + function consumeRange(range, anchor) { + consumePoint(range.start, anchor); + consumePoint(range.end, anchor); + } + function restorePoint(point, anchor) { + if (point.row == 0) point.column += anchor.column; + point.row += anchor.row; + } + function restoreRange(range, anchor) { + restorePoint(range.start, anchor); + restorePoint(range.end, anchor); + } +}); +ace.define("ace/edit_session/folding", [ + "require", + "exports", + "module", + "ace/range", + "ace/edit_session/fold_line", + "ace/edit_session/fold", + "ace/token_iterator" +], function(require, exports, module1) { + "use strict"; + var Range = require("../range").Range; + var FoldLine = require("./fold_line").FoldLine; + var Fold = require("./fold").Fold; + var TokenIterator = require("../token_iterator").TokenIterator; + function Folding() { + this.getFoldAt = function(row, column, side) { + var foldLine = this.getFoldLine(row); + if (!foldLine) return null; + var folds = foldLine.folds; + for(var i = 0; i < folds.length; i++){ + var range = folds[i].range; + if (range.contains(row, column)) { + if (side == 1 && range.isEnd(row, column) && !range.isEmpty()) continue; + else if (side == -1 && range.isStart(row, column) && !range.isEmpty()) continue; + return folds[i]; + } + } + }; + this.getFoldsInRange = function(range) { + var start = range.start; + var end = range.end; + var foldLines = this.$foldData; + var foundFolds = []; + start.column += 1; + end.column -= 1; + for(var i = 0; i < foldLines.length; i++){ + var cmp = foldLines[i].range.compareRange(range); + if (cmp == 2) continue; + else if (cmp == -2) break; + var folds = foldLines[i].folds; + for(var j = 0; j < folds.length; j++){ + var fold = folds[j]; + cmp = fold.range.compareRange(range); + if (cmp == -2) break; + else if (cmp == 2) continue; + else if (cmp == 42) break; + foundFolds.push(fold); + } + } + start.column -= 1; + end.column += 1; + return foundFolds; + }; + this.getFoldsInRangeList = function(ranges) { + if (Array.isArray(ranges)) { + var folds = []; + ranges.forEach(function(range) { + folds = folds.concat(this.getFoldsInRange(range)); + }, this); + } else var folds = this.getFoldsInRange(ranges); + return folds; + }; + this.getAllFolds = function() { + var folds = []; + var foldLines = this.$foldData; + for(var i = 0; i < foldLines.length; i++)for(var j = 0; j < foldLines[i].folds.length; j++)folds.push(foldLines[i].folds[j]); + return folds; + }; + this.getFoldStringAt = function(row, column, trim, foldLine) { + foldLine = foldLine || this.getFoldLine(row); + if (!foldLine) return null; + var lastFold = { + end: { + column: 0 + } + }; + var str, fold; + for(var i = 0; i < foldLine.folds.length; i++){ + fold = foldLine.folds[i]; + var cmp = fold.range.compareEnd(row, column); + if (cmp == -1) { + str = this.getLine(fold.start.row).substring(lastFold.end.column, fold.start.column); + break; + } else if (cmp === 0) return null; + lastFold = fold; + } + if (!str) str = this.getLine(fold.start.row).substring(lastFold.end.column); + if (trim == -1) return str.substring(0, column - lastFold.end.column); + else if (trim == 1) return str.substring(column - lastFold.end.column); + else return str; + }; + this.getFoldLine = function(docRow, startFoldLine) { + var foldData = this.$foldData; + var i = 0; + if (startFoldLine) i = foldData.indexOf(startFoldLine); + if (i == -1) i = 0; + for(i; i < foldData.length; i++){ + var foldLine = foldData[i]; + if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) return foldLine; + else if (foldLine.end.row > docRow) return null; + } + return null; + }; + this.getNextFoldLine = function(docRow, startFoldLine) { + var foldData = this.$foldData; + var i = 0; + if (startFoldLine) i = foldData.indexOf(startFoldLine); + if (i == -1) i = 0; + for(i; i < foldData.length; i++){ + var foldLine = foldData[i]; + if (foldLine.end.row >= docRow) return foldLine; + } + return null; + }; + this.getFoldedRowCount = function(first, last) { + var foldData = this.$foldData, rowCount = last - first + 1; + for(var i = 0; i < foldData.length; i++){ + var foldLine = foldData[i], end = foldLine.end.row, start = foldLine.start.row; + if (end >= last) { + if (start < last) { + if (start >= first) rowCount -= last - start; + else rowCount = 0; // in one fold + } + break; + } else if (end >= first) { + if (start >= first) rowCount -= end - start; + else rowCount -= end - first + 1; + } + } + return rowCount; + }; + this.$addFoldLine = function(foldLine) { + this.$foldData.push(foldLine); + this.$foldData.sort(function(a, b) { + return a.start.row - b.start.row; + }); + return foldLine; + }; + this.addFold = function(placeholder, range) { + var foldData = this.$foldData; + var added = false; + var fold; + if (placeholder instanceof Fold) fold = placeholder; + else { + fold = new Fold(range, placeholder); + fold.collapseChildren = range.collapseChildren; + } + this.$clipRangeToDocument(fold.range); + var startRow = fold.start.row; + var startColumn = fold.start.column; + var endRow = fold.end.row; + var endColumn = fold.end.column; + var startFold = this.getFoldAt(startRow, startColumn, 1); + var endFold = this.getFoldAt(endRow, endColumn, -1); + if (startFold && endFold == startFold) return startFold.addSubFold(fold); + if (startFold && !startFold.range.isStart(startRow, startColumn)) this.removeFold(startFold); + if (endFold && !endFold.range.isEnd(endRow, endColumn)) this.removeFold(endFold); + var folds = this.getFoldsInRange(fold.range); + if (folds.length > 0) { + this.removeFolds(folds); + if (!fold.collapseChildren) folds.forEach(function(subFold) { + fold.addSubFold(subFold); + }); + } + for(var i = 0; i < foldData.length; i++){ + var foldLine = foldData[i]; + if (endRow == foldLine.start.row) { + foldLine.addFold(fold); + added = true; + break; + } else if (startRow == foldLine.end.row) { + foldLine.addFold(fold); + added = true; + if (!fold.sameRow) { + var foldLineNext = foldData[i + 1]; + if (foldLineNext && foldLineNext.start.row == endRow) { + foldLine.merge(foldLineNext); + break; + } + } + break; + } else if (endRow <= foldLine.start.row) break; + } + if (!added) foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold)); + if (this.$useWrapMode) this.$updateWrapData(foldLine.start.row, foldLine.start.row); + else this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row); + this.$modified = true; + this._signal("changeFold", { + data: fold, + action: "add" + }); + return fold; + }; + this.addFolds = function(folds) { + folds.forEach(function(fold) { + this.addFold(fold); + }, this); + }; + this.removeFold = function(fold) { + var foldLine = fold.foldLine; + var startRow = foldLine.start.row; + var endRow = foldLine.end.row; + var foldLines = this.$foldData; + var folds = foldLine.folds; + if (folds.length == 1) foldLines.splice(foldLines.indexOf(foldLine), 1); + else if (foldLine.range.isEnd(fold.end.row, fold.end.column)) { + folds.pop(); + foldLine.end.row = folds[folds.length - 1].end.row; + foldLine.end.column = folds[folds.length - 1].end.column; + } else if (foldLine.range.isStart(fold.start.row, fold.start.column)) { + folds.shift(); + foldLine.start.row = folds[0].start.row; + foldLine.start.column = folds[0].start.column; + } else if (fold.sameRow) folds.splice(folds.indexOf(fold), 1); + else { + var newFoldLine = foldLine.split(fold.start.row, fold.start.column); + folds = newFoldLine.folds; + folds.shift(); + newFoldLine.start.row = folds[0].start.row; + newFoldLine.start.column = folds[0].start.column; + } + if (!this.$updating) { + if (this.$useWrapMode) this.$updateWrapData(startRow, endRow); + else this.$updateRowLengthCache(startRow, endRow); + } + this.$modified = true; + this._signal("changeFold", { + data: fold, + action: "remove" + }); + }; + this.removeFolds = function(folds) { + var cloneFolds = []; + for(var i = 0; i < folds.length; i++)cloneFolds.push(folds[i]); + cloneFolds.forEach(function(fold) { + this.removeFold(fold); + }, this); + this.$modified = true; + }; + this.expandFold = function(fold) { + this.removeFold(fold); + fold.subFolds.forEach(function(subFold) { + fold.restoreRange(subFold); + this.addFold(subFold); + }, this); + if (fold.collapseChildren > 0) this.foldAll(fold.start.row + 1, fold.end.row, fold.collapseChildren - 1); + fold.subFolds = []; + }; + this.expandFolds = function(folds) { + folds.forEach(function(fold) { + this.expandFold(fold); + }, this); + }; + this.unfold = function(location, expandInner) { + var range, folds; + if (location == null) { + range = new Range(0, 0, this.getLength(), 0); + if (expandInner == null) expandInner = true; + } else if (typeof location == "number") range = new Range(location, 0, location, this.getLine(location).length); + else if ("row" in location) range = Range.fromPoints(location, location); + else if (Array.isArray(location)) { + folds = []; + location.forEach(function(range) { + folds = folds.concat(this.unfold(range)); + }, this); + return folds; + } else range = location; + folds = this.getFoldsInRangeList(range); + var outermostFolds = folds; + while(folds.length == 1 && Range.comparePoints(folds[0].start, range.start) < 0 && Range.comparePoints(folds[0].end, range.end) > 0){ + this.expandFolds(folds); + folds = this.getFoldsInRangeList(range); + } + if (expandInner != false) this.removeFolds(folds); + else this.expandFolds(folds); + if (outermostFolds.length) return outermostFolds; + }; + this.isRowFolded = function(docRow, startFoldRow) { + return !!this.getFoldLine(docRow, startFoldRow); + }; + this.getRowFoldEnd = function(docRow, startFoldRow) { + var foldLine = this.getFoldLine(docRow, startFoldRow); + return foldLine ? foldLine.end.row : docRow; + }; + this.getRowFoldStart = function(docRow, startFoldRow) { + var foldLine = this.getFoldLine(docRow, startFoldRow); + return foldLine ? foldLine.start.row : docRow; + }; + this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) { + if (startRow == null) startRow = foldLine.start.row; + if (startColumn == null) startColumn = 0; + if (endRow == null) endRow = foldLine.end.row; + if (endColumn == null) endColumn = this.getLine(endRow).length; + var doc = this.doc; + var textLine = ""; + foldLine.walk(function(placeholder, row, column, lastColumn) { + if (row < startRow) return; + if (row == startRow) { + if (column < startColumn) return; + lastColumn = Math.max(startColumn, lastColumn); + } + if (placeholder != null) textLine += placeholder; + else textLine += doc.getLine(row).substring(lastColumn, column); + }, endRow, endColumn); + return textLine; + }; + this.getDisplayLine = function(row, endColumn, startRow, startColumn) { + var foldLine = this.getFoldLine(row); + if (!foldLine) { + var line; + line = this.doc.getLine(row); + return line.substring(startColumn || 0, endColumn || line.length); + } else return this.getFoldDisplayLine(foldLine, row, endColumn, startRow, startColumn); + }; + this.$cloneFoldData = function() { + var fd = []; + fd = this.$foldData.map(function(foldLine) { + var folds = foldLine.folds.map(function(fold) { + return fold.clone(); + }); + return new FoldLine(fd, folds); + }); + return fd; + }; + this.toggleFold = function(tryToUnfold) { + var selection = this.selection; + var range = selection.getRange(); + var fold; + var bracketPos; + if (range.isEmpty()) { + var cursor = range.start; + fold = this.getFoldAt(cursor.row, cursor.column); + if (fold) { + this.expandFold(fold); + return; + } else if (bracketPos = this.findMatchingBracket(cursor)) { + if (range.comparePoint(bracketPos) == 1) range.end = bracketPos; + else { + range.start = bracketPos; + range.start.column++; + range.end.column--; + } + } else if (bracketPos = this.findMatchingBracket({ + row: cursor.row, + column: cursor.column + 1 + })) { + if (range.comparePoint(bracketPos) == 1) range.end = bracketPos; + else range.start = bracketPos; + range.start.column++; + } else range = this.getCommentFoldRange(cursor.row, cursor.column) || range; + } else { + var folds = this.getFoldsInRange(range); + if (tryToUnfold && folds.length) { + this.expandFolds(folds); + return; + } else if (folds.length == 1) fold = folds[0]; + } + if (!fold) fold = this.getFoldAt(range.start.row, range.start.column); + if (fold && fold.range.toString() == range.toString()) { + this.expandFold(fold); + return; + } + var placeholder = "..."; + if (!range.isMultiLine()) { + placeholder = this.getTextRange(range); + if (placeholder.length < 4) return; + placeholder = placeholder.trim().substring(0, 2) + ".."; + } + this.addFold(placeholder, range); + }; + this.getCommentFoldRange = function(row, column, dir) { + var iterator = new TokenIterator(this, row, column); + var token = iterator.getCurrentToken(); + var type = token && token.type; + if (token && /^comment|string/.test(type)) { + type = type.match(/comment|string/)[0]; + if (type == "comment") type += "|doc-start"; + var re = new RegExp(type); + var range = new Range(); + if (dir != 1) { + do token = iterator.stepBackward(); + while (token && re.test(token.type) && !/^comment.end/.test(token.type)); + token = iterator.stepForward(); + } + range.start.row = iterator.getCurrentTokenRow(); + range.start.column = iterator.getCurrentTokenColumn() + (/^comment.start/.test(token.type) ? token.value.length : 2); + iterator = new TokenIterator(this, row, column); + if (dir != -1) { + var lastRow = -1; + do { + token = iterator.stepForward(); + if (lastRow == -1) { + var state = this.getState(iterator.$row); + if (!re.test(state)) lastRow = iterator.$row; + } else if (iterator.$row > lastRow) break; + }while (token && re.test(token.type) && !/^comment.start/.test(token.type)); + token = iterator.stepBackward(); + } else token = iterator.getCurrentToken(); + range.end.row = iterator.getCurrentTokenRow(); + range.end.column = iterator.getCurrentTokenColumn(); + if (!/^comment.end/.test(token.type)) range.end.column += token.value.length - 2; + return range; + } + }; + this.foldAll = function(startRow, endRow, depth, test) { + if (depth == undefined) depth = 100000; // JSON.stringify doesn't hanle Infinity + var foldWidgets = this.foldWidgets; + if (!foldWidgets) return; // mode doesn't support folding + endRow = endRow || this.getLength(); + startRow = startRow || 0; + for(var row = startRow; row < endRow; row++){ + if (foldWidgets[row] == null) foldWidgets[row] = this.getFoldWidget(row); + if (foldWidgets[row] != "start") continue; + if (test && !test(row)) continue; + var range = this.getFoldWidgetRange(row); + if (range && range.isMultiLine() && range.end.row <= endRow && range.start.row >= startRow) { + row = range.end.row; + range.collapseChildren = depth; + this.addFold("...", range); + } + } + }; + this.foldToLevel = function(level) { + this.foldAll(); + while(level-- > 0)this.unfold(null, false); + }; + this.foldAllComments = function() { + var session = this; + this.foldAll(null, null, null, function(row) { + var tokens = session.getTokens(row); + for(var i = 0; i < tokens.length; i++){ + var token = tokens[i]; + if (token.type == "text" && /^\s+$/.test(token.value)) continue; + if (/comment/.test(token.type)) return true; + return false; + } + }); + }; + this.$foldStyles = { + "manual": 1, + "markbegin": 1, + "markbeginend": 1 + }; + this.$foldStyle = "markbegin"; + this.setFoldStyle = function(style) { + if (!this.$foldStyles[style]) throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]"); + if (this.$foldStyle == style) return; + this.$foldStyle = style; + if (style == "manual") this.unfold(); + var mode = this.$foldMode; + this.$setFolding(null); + this.$setFolding(mode); + }; + this.$setFolding = function(foldMode) { + if (this.$foldMode == foldMode) return; + this.$foldMode = foldMode; + this.off("change", this.$updateFoldWidgets); + this.off("tokenizerUpdate", this.$tokenizerUpdateFoldWidgets); + this._signal("changeAnnotation"); + if (!foldMode || this.$foldStyle == "manual") { + this.foldWidgets = null; + return; + } + this.foldWidgets = []; + this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle); + this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, 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(row, ignoreCurrent) { + var fw = this.foldWidgets; + if (!fw || ignoreCurrent && fw[row]) return {}; + var i = row - 1, firstRange; + while(i >= 0){ + var c = fw[i]; + if (c == null) c = fw[i] = this.getFoldWidget(i); + if (c == "start") { + var range = this.getFoldWidgetRange(i); + if (!firstRange) firstRange = range; + if (range && range.end.row >= row) break; + } + i--; + } + return { + range: i !== -1 && range, + firstRange: firstRange + }; + }; + this.onFoldWidgetClick = function(row, e) { + e = e.domEvent; + var options = { + children: e.shiftKey, + all: e.ctrlKey || e.metaKey, + siblings: e.altKey + }; + var range = this.$toggleFoldWidget(row, options); + if (!range) { + var el = e.target || e.srcElement; + if (el && /ace_fold-widget/.test(el.className)) el.className += " ace_invalid"; + } + }; + this.$toggleFoldWidget = function(row, options) { + if (!this.getFoldWidget) return; + var type = this.getFoldWidget(row); + var line = this.getLine(row); + var dir = type === "end" ? -1 : 1; + var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir); + if (fold) { + if (options.children || options.all) this.removeFold(fold); + else this.expandFold(fold); + return fold; + } + var range = this.getFoldWidgetRange(row, true); + if (range && !range.isMultiLine()) { + fold = this.getFoldAt(range.start.row, range.start.column, 1); + if (fold && range.isEqual(fold.range)) { + this.removeFold(fold); + return fold; + } + } + if (options.siblings) { + var data = this.getParentFoldRangeData(row); + if (data.range) { + var startRow = data.range.start.row + 1; + var endRow = data.range.end.row; + } + this.foldAll(startRow, endRow, options.all ? 10000 : 0); + } else if (options.children) { + endRow = range ? range.end.row : this.getLength(); + this.foldAll(row + 1, endRow, options.all ? 10000 : 0); + } else if (range) { + if (options.all) range.collapseChildren = 10000; + this.addFold("...", range); + } + return range; + }; + this.toggleFoldWidget = function(toggleParent) { + var row = this.selection.getCursor().row; + row = this.getRowFoldStart(row); + var range = this.$toggleFoldWidget(row, {}); + if (range) return; + var data = this.getParentFoldRangeData(row, true); + range = data.range || data.firstRange; + if (range) { + row = range.start.row; + var fold = this.getFoldAt(row, this.getLine(row).length, 1); + if (fold) this.removeFold(fold); + else this.addFold("...", range); + } + }; + this.updateFoldWidgets = function(delta) { + var firstRow = delta.start.row; + var len = delta.end.row - firstRow; + if (len === 0) this.foldWidgets[firstRow] = null; + else if (delta.action == "remove") this.foldWidgets.splice(firstRow, len + 1, null); + else { + var args = Array(len + 1); + args.unshift(firstRow, 1); + this.foldWidgets.splice.apply(this.foldWidgets, args); + } + }; + this.tokenizerUpdateFoldWidgets = function(e) { + var rows = e.data; + if (rows.first != rows.last) { + if (this.foldWidgets.length > rows.first) this.foldWidgets.splice(rows.first, this.foldWidgets.length); + } + }; + } + exports.Folding = Folding; +}); +ace.define("ace/edit_session/bracket_match", [ + "require", + "exports", + "module", + "ace/token_iterator", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var TokenIterator = require("../token_iterator").TokenIterator; + var Range = require("../range").Range; + function BracketMatch() { + this.findMatchingBracket = function(position, chr) { + if (position.column == 0) return null; + var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column - 1); + if (charBeforeCursor == "") return null; + var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/); + if (!match) return null; + if (match[1]) return this.$findClosingBracket(match[1], position); + else return this.$findOpeningBracket(match[2], position); + }; + this.getBracketRange = function(pos) { + var line = this.getLine(pos.row); + var before = true, range; + var chr = line.charAt(pos.column - 1); + var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/); + if (!match) { + chr = line.charAt(pos.column); + pos = { + row: pos.row, + column: pos.column + 1 + }; + match = chr && chr.match(/([\(\[\{])|([\)\]\}])/); + before = false; + } + if (!match) return null; + if (match[1]) { + var bracketPos = this.$findClosingBracket(match[1], pos); + if (!bracketPos) return null; + range = Range.fromPoints(pos, bracketPos); + if (!before) { + range.end.column++; + range.start.column--; + } + range.cursor = range.end; + } else { + var bracketPos = this.$findOpeningBracket(match[2], pos); + if (!bracketPos) return null; + range = Range.fromPoints(bracketPos, pos); + if (!before) { + range.start.column++; + range.end.column--; + } + range.cursor = range.start; + } + return range; + }; + this.getMatchingBracketRanges = function(pos, isBackwards) { + var line = this.getLine(pos.row); + var bracketsRegExp = /([\(\[\{])|([\)\]\}])/; + var chr = !isBackwards && line.charAt(pos.column - 1); + var match = chr && chr.match(bracketsRegExp); + if (!match) { + chr = (isBackwards === undefined || isBackwards) && line.charAt(pos.column); + pos = { + row: pos.row, + column: pos.column + 1 + }; + match = chr && chr.match(bracketsRegExp); + } + if (!match) return null; + var startRange = new Range(pos.row, pos.column - 1, pos.row, pos.column); + var bracketPos = match[1] ? this.$findClosingBracket(match[1], pos) : this.$findOpeningBracket(match[2], pos); + if (!bracketPos) return [ + startRange + ]; + var endRange = new Range(bracketPos.row, bracketPos.column, bracketPos.row, bracketPos.column + 1); + return [ + startRange, + endRange + ]; + }; + this.$brackets = { + ")": "(", + "(": ")", + "]": "[", + "[": "]", + "{": "}", + "}": "{", + "<": ">", + ">": "<" + }; + this.$findOpeningBracket = function(bracket, position, typeRe) { + var openBracket = this.$brackets[bracket]; + var depth = 1; + var iterator = new TokenIterator(this, position.row, position.column); + var token = iterator.getCurrentToken(); + if (!token) token = iterator.stepForward(); + if (!token) return; + if (!typeRe) typeRe = new RegExp("(\\.?" + token.type.replace(".", "\\.").replace("rparen", ".paren").replace(/\b(?:end)\b/, "(?:start|begin|end)") + ")+"); + var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2; + var value = token.value; + while(true){ + while(valueIndex >= 0){ + var chr = value.charAt(valueIndex); + if (chr == openBracket) { + depth -= 1; + if (depth == 0) return { + row: iterator.getCurrentTokenRow(), + column: valueIndex + iterator.getCurrentTokenColumn() + }; + } else if (chr == bracket) depth += 1; + valueIndex -= 1; + } + do token = iterator.stepBackward(); + while (token && !typeRe.test(token.type)); + if (token == null) break; + value = token.value; + valueIndex = value.length - 1; + } + return null; + }; + this.$findClosingBracket = function(bracket, position, typeRe) { + var closingBracket = this.$brackets[bracket]; + var depth = 1; + var iterator = new TokenIterator(this, position.row, position.column); + var token = iterator.getCurrentToken(); + if (!token) token = iterator.stepForward(); + if (!token) return; + if (!typeRe) typeRe = new RegExp("(\\.?" + token.type.replace(".", "\\.").replace("lparen", ".paren").replace(/\b(?:start|begin)\b/, "(?:start|begin|end)") + ")+"); + var valueIndex = position.column - iterator.getCurrentTokenColumn(); + while(true){ + var value = token.value; + var valueLength = value.length; + while(valueIndex < valueLength){ + var chr = value.charAt(valueIndex); + if (chr == closingBracket) { + depth -= 1; + if (depth == 0) return { + row: iterator.getCurrentTokenRow(), + column: valueIndex + iterator.getCurrentTokenColumn() + }; + } else if (chr == bracket) depth += 1; + valueIndex += 1; + } + do token = iterator.stepForward(); + while (token && !typeRe.test(token.type)); + if (token == null) break; + valueIndex = 0; + } + return null; + }; + this.getMatchingTags = function(pos) { + var iterator = new TokenIterator(this, pos.row, pos.column); + var token = this.$findTagName(iterator); + if (!token) return; + var prevToken = iterator.stepBackward(); + if (prevToken.value === "<") return this.$findClosingTag(iterator, token); + else return this.$findOpeningTag(iterator, token); + }; + this.$findTagName = function(iterator) { + var token = iterator.getCurrentToken(); + var found = false; + var backward = false; + if (token && token.type.indexOf("tag-name") === -1) do { + if (backward) token = iterator.stepBackward(); + else token = iterator.stepForward(); + if (token) { + if (token.value === "/>") backward = true; + else if (token.type.indexOf("tag-name") !== -1) found = true; + } + }while (token && !found); + return token; + }; + this.$findClosingTag = function(iterator, token) { + var prevToken; + var currentTag = token.value; + var tag = token.value; + var depth = 0; + var openTagStart = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1); + token = iterator.stepForward(); + var openTagName = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + token.value.length); + var foundOpenTagEnd = false; + do { + prevToken = token; + token = iterator.stepForward(); + if (token) { + if (token.value === ">" && !foundOpenTagEnd) { + var openTagEnd = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1); //Range for `>` + foundOpenTagEnd = true; + } + if (token.type.indexOf("tag-name") !== -1) { + currentTag = token.value; + if (tag === currentTag) { + if (prevToken.value === "<") depth++; + else if (prevToken.value === "") var closeTagEnd = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1); //Range for > + else return; + } + } + } + } else if (tag === currentTag && token.value === "/>") { + depth--; + if (depth < 0) { + var closeTagStart = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 2); + var closeTagName = closeTagStart; + var closeTagEnd = closeTagName; + var openTagEnd = new Range(openTagName.end.row, openTagName.end.column, openTagName.end.row, openTagName.end.column + 1); + } + } + } + }while (token && depth >= 0); + if (openTagStart && openTagEnd && closeTagStart && closeTagEnd && openTagName && closeTagName) return { + openTag: new Range(openTagStart.start.row, openTagStart.start.column, openTagEnd.end.row, openTagEnd.end.column), + closeTag: new Range(closeTagStart.start.row, closeTagStart.start.column, closeTagEnd.end.row, closeTagEnd.end.column), + openTagName: openTagName, + closeTagName: closeTagName + }; + }; + this.$findOpeningTag = function(iterator, token) { + var prevToken = iterator.getCurrentToken(); + var tag = token.value; + var depth = 0; + var startRow = iterator.getCurrentTokenRow(); + var startColumn = iterator.getCurrentTokenColumn(); + var endColumn = startColumn + 2; + var closeTagStart = new Range(startRow, startColumn, startRow, endColumn); //Range for ") return; + var closeTagEnd = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1); //Range for > + iterator.stepBackward(); + iterator.stepBackward(); + do { + token = prevToken; + startRow = iterator.getCurrentTokenRow(); + startColumn = iterator.getCurrentTokenColumn(); + endColumn = startColumn + token.value.length; + prevToken = iterator.stepBackward(); + if (token) { + if (token.type.indexOf("tag-name") !== -1) { + if (tag === token.value) { + if (prevToken.value === "<") { + depth++; + if (depth > 0) { + var openTagName = new Range(startRow, startColumn, startRow, endColumn); + var openTagStart = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1); //Range for < + do token = iterator.stepForward(); + while (token && token.value !== ">"); + var openTagEnd = new Range(iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn(), iterator.getCurrentTokenRow(), iterator.getCurrentTokenColumn() + 1); //Range for > + } + } else if (prevToken.value === "") { + var stepCount = 0; + var tmpToken = prevToken; + while(tmpToken){ + if (tmpToken.type.indexOf("tag-name") !== -1 && tmpToken.value === tag) { + depth--; + break; + } else if (tmpToken.value === "<") break; + tmpToken = iterator.stepBackward(); + stepCount++; + } + for(var i = 0; i < stepCount; i++)iterator.stepForward(); + } + } + }while (prevToken && depth <= 0); + if (openTagStart && openTagEnd && closeTagStart && closeTagEnd && openTagName && closeTagName) return { + openTag: new Range(openTagStart.start.row, openTagStart.start.column, openTagEnd.end.row, openTagEnd.end.column), + closeTag: new Range(closeTagStart.start.row, closeTagStart.start.column, closeTagEnd.end.row, closeTagEnd.end.column), + openTagName: openTagName, + closeTagName: closeTagName + }; + }; + } + exports.BracketMatch = BracketMatch; +}); +ace.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(require, exports, module1) { + "use strict"; + var oop = require("./lib/oop"); + var lang = require("./lib/lang"); + var BidiHandler = require("./bidihandler").BidiHandler; + var config = require("./config"); + var EventEmitter = require("./lib/event_emitter").EventEmitter; + var Selection = require("./selection").Selection; + var TextMode = require("./mode/text").Mode; + var Range = require("./range").Range; + var Document = require("./document").Document; + var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer; + var SearchHighlight = require("./search_highlight").SearchHighlight; + var EditSession = function(text, mode) { + this.$breakpoints = []; + this.$decorations = []; + this.$frontMarkers = {}; + this.$backMarkers = {}; + this.$markerId = 1; + this.$undoSelect = true; + this.$foldData = []; + this.id = "session" + ++EditSession.$uid; + this.$foldData.toString = function() { + return this.join("\n"); + }; + this.bgTokenizer = new BackgroundTokenizer(new TextMode().getTokenizer(), this); + var _self = this; + this.bgTokenizer.on("update", function(e) { + _self._signal("tokenizerUpdate", e); + }); + this.on("changeFold", this.onChangeFold.bind(this)); + this.$onChange = this.onChange.bind(this); + if (typeof text != "object" || !text.getLine) text = new Document(text); + this.setDocument(text); + this.selection = new Selection(this); + this.$bidiHandler = new BidiHandler(this); + config.resetOptions(this); + this.setMode(mode); + config._signal("session", this); + this.destroyed = false; + }; + EditSession.$uid = 0; + (function() { + oop.implement(this, EventEmitter); + this.setDocument = function(doc) { + if (this.doc) this.doc.off("change", this.$onChange); + this.doc = doc; + doc.on("change", this.$onChange, true); + this.bgTokenizer.setDocument(this.getDocument()); + this.resetCaches(); + }; + this.getDocument = function() { + return this.doc; + }; + this.$resetRowCache = function(docRow) { + if (!docRow) { + this.$docRowCache = []; + this.$screenRowCache = []; + return; + } + var l = this.$docRowCache.length; + var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1; + if (l > i) { + this.$docRowCache.splice(i, l); + this.$screenRowCache.splice(i, l); + } + }; + this.$getRowCacheIndex = function(cacheArray, val) { + var low = 0; + var hi = cacheArray.length - 1; + while(low <= hi){ + var mid = low + hi >> 1; + var c = cacheArray[mid]; + if (val > c) low = mid + 1; + else if (val < c) hi = mid - 1; + else return mid; + } + return low - 1; + }; + this.resetCaches = function() { + this.$modified = true; + this.$wrapData = []; + this.$rowLengthCache = []; + this.$resetRowCache(0); + if (!this.destroyed) this.bgTokenizer.start(0); + }; + this.onChangeFold = function(e) { + var fold = e.data; + this.$resetRowCache(fold.start.row); + }; + this.onChange = function(delta) { + this.$modified = true; + this.$bidiHandler.onChange(delta); + this.$resetRowCache(delta.start.row); + var removedFolds = this.$updateInternalDataOnChange(delta); + if (!this.$fromUndo && this.$undoManager) { + if (removedFolds && removedFolds.length) { + this.$undoManager.add({ + action: "removeFolds", + folds: removedFolds + }, this.mergeUndoDeltas); + this.mergeUndoDeltas = true; + } + this.$undoManager.add(delta, this.mergeUndoDeltas); + this.mergeUndoDeltas = true; + this.$informUndoManager.schedule(); + } + this.bgTokenizer.$updateOnChange(delta); + this._signal("change", delta); + }; + this.setValue = function(text) { + this.doc.setValue(text); + 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(row) { + return this.bgTokenizer.getState(row); + }; + this.getTokens = function(row) { + return this.bgTokenizer.getTokens(row); + }; + this.getTokenAt = function(row, column) { + var tokens = this.bgTokenizer.getTokens(row); + var token, c = 0; + if (column == null) { + var i = tokens.length - 1; + c = this.getLine(row).length; + } else for(var i = 0; i < tokens.length; i++){ + c += tokens[i].value.length; + if (c >= column) break; + } + token = tokens[i]; + if (!token) return null; + token.index = i; + token.start = c - token.value.length; + return token; + }; + this.setUndoManager = function(undoManager) { + this.$undoManager = undoManager; + if (this.$informUndoManager) this.$informUndoManager.cancel(); + if (undoManager) { + var self = this; + undoManager.addSession(this); + this.$syncInformUndoManager = function() { + self.$informUndoManager.cancel(); + self.mergeUndoDeltas = false; + }; + this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager); + } else this.$syncInformUndoManager = function() {}; + }; + this.markUndoGroup = function() { + if (this.$syncInformUndoManager) this.$syncInformUndoManager(); + }; + this.$defaultUndoManager = { + undo: function() {}, + redo: function() {}, + hasUndo: function() {}, + hasRedo: function() {}, + reset: function() {}, + add: function() {}, + addSelection: function() {}, + startNewGroup: function() {}, + addSession: function() {} + }; + this.getUndoManager = function() { + return this.$undoManager || this.$defaultUndoManager; + }; + this.getTabString = function() { + if (this.getUseSoftTabs()) return lang.stringRepeat(" ", this.getTabSize()); + else return " "; + }; + this.setUseSoftTabs = function(val) { + this.setOption("useSoftTabs", val); + }; + this.getUseSoftTabs = function() { + return this.$useSoftTabs && !this.$mode.$indentWithTabs; + }; + this.setTabSize = function(tabSize) { + this.setOption("tabSize", tabSize); + }; + this.getTabSize = function() { + return this.$tabSize; + }; + this.isTabStop = function(position) { + return this.$useSoftTabs && position.column % this.$tabSize === 0; + }; + this.setNavigateWithinSoftTabs = function(navigateWithinSoftTabs) { + this.setOption("navigateWithinSoftTabs", navigateWithinSoftTabs); + }; + this.getNavigateWithinSoftTabs = function() { + return this.$navigateWithinSoftTabs; + }; + this.$overwrite = false; + this.setOverwrite = function(overwrite) { + this.setOption("overwrite", overwrite); + }; + this.getOverwrite = function() { + return this.$overwrite; + }; + this.toggleOverwrite = function() { + this.setOverwrite(!this.$overwrite); + }; + this.addGutterDecoration = function(row, className) { + if (!this.$decorations[row]) this.$decorations[row] = ""; + this.$decorations[row] += " " + className; + this._signal("changeBreakpoint", {}); + }; + this.removeGutterDecoration = function(row, className) { + this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, ""); + this._signal("changeBreakpoint", {}); + }; + this.getBreakpoints = function() { + return this.$breakpoints; + }; + this.setBreakpoints = function(rows) { + this.$breakpoints = []; + for(var i = 0; i < rows.length; i++)this.$breakpoints[rows[i]] = "ace_breakpoint"; + this._signal("changeBreakpoint", {}); + }; + this.clearBreakpoints = function() { + this.$breakpoints = []; + this._signal("changeBreakpoint", {}); + }; + this.setBreakpoint = function(row, className) { + if (className === undefined) className = "ace_breakpoint"; + if (className) this.$breakpoints[row] = className; + else delete this.$breakpoints[row]; + this._signal("changeBreakpoint", {}); + }; + this.clearBreakpoint = function(row) { + delete this.$breakpoints[row]; + this._signal("changeBreakpoint", {}); + }; + this.addMarker = function(range, clazz, type, inFront) { + var id = this.$markerId++; + var marker = { + range: range, + type: type || "line", + renderer: typeof type == "function" ? type : null, + clazz: clazz, + inFront: !!inFront, + id: id + }; + if (inFront) { + this.$frontMarkers[id] = marker; + this._signal("changeFrontMarker"); + } else { + this.$backMarkers[id] = marker; + this._signal("changeBackMarker"); + } + return id; + }; + this.addDynamicMarker = function(marker, inFront) { + if (!marker.update) return; + var id = this.$markerId++; + marker.id = id; + marker.inFront = !!inFront; + if (inFront) { + this.$frontMarkers[id] = marker; + this._signal("changeFrontMarker"); + } else { + this.$backMarkers[id] = marker; + this._signal("changeBackMarker"); + } + return marker; + }; + this.removeMarker = function(markerId) { + var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId]; + if (!marker) return; + var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers; + delete markers[markerId]; + this._signal(marker.inFront ? "changeFrontMarker" : "changeBackMarker"); + }; + this.getMarkers = function(inFront) { + return inFront ? this.$frontMarkers : this.$backMarkers; + }; + this.highlight = function(re) { + if (!this.$searchHighlight) { + var highlight = new SearchHighlight(null, "ace_selected-word", "text"); + this.$searchHighlight = this.addDynamicMarker(highlight); + } + this.$searchHighlight.setRegexp(re); + }; + this.highlightLines = function(startRow, endRow, clazz, inFront) { + if (typeof endRow != "number") { + clazz = endRow; + endRow = startRow; + } + if (!clazz) clazz = "ace_step"; + var range = new Range(startRow, 0, endRow, Infinity); + range.id = this.addMarker(range, clazz, "fullLine", inFront); + return range; + }; + this.setAnnotations = function(annotations) { + this.$annotations = annotations; + this._signal("changeAnnotation", {}); + }; + this.getAnnotations = function() { + return this.$annotations || []; + }; + this.clearAnnotations = function() { + this.setAnnotations([]); + }; + this.$detectNewLine = function(text) { + var match = text.match(/^.*?(\r?\n)/m); + if (match) this.$autoNewLine = match[1]; + else this.$autoNewLine = "\n"; + }; + this.getWordRange = function(row, column) { + var line = this.getLine(row); + var inToken = false; + if (column > 0) inToken = !!line.charAt(column - 1).match(this.tokenRe); + if (!inToken) inToken = !!line.charAt(column).match(this.tokenRe); + if (inToken) var re = this.tokenRe; + else if (/^\s+$/.test(line.slice(column - 1, column + 1))) var re = /\s/; + else var re = this.nonTokenRe; + var start = column; + if (start > 0) { + do start--; + while (start >= 0 && line.charAt(start).match(re)); + start++; + } + var end = column; + while(end < line.length && line.charAt(end).match(re))end++; + return new Range(row, start, row, end); + }; + this.getAWordRange = function(row, column) { + var wordRange = this.getWordRange(row, column); + var line = this.getLine(wordRange.end.row); + while(line.charAt(wordRange.end.column).match(/[ \t]/))wordRange.end.column += 1; + return wordRange; + }; + this.setNewLineMode = function(newLineMode) { + this.doc.setNewLineMode(newLineMode); + }; + this.getNewLineMode = function() { + return this.doc.getNewLineMode(); + }; + this.setUseWorker = function(useWorker) { + this.setOption("useWorker", useWorker); + }; + this.getUseWorker = function() { + return this.$useWorker; + }; + this.onReloadTokenizer = function(e) { + var rows = e.data; + this.bgTokenizer.start(rows.first); + this._signal("tokenizerUpdate", e); + }; + this.$modes = config.$modes; + this.$mode = null; + this.$modeId = null; + this.setMode = function(mode, cb) { + if (mode && typeof mode === "object") { + if (mode.getTokenizer) return this.$onChangeMode(mode); + var options = mode; + var path = options.path; + } else path = mode || "ace/mode/text"; + if (!this.$modes["ace/mode/text"]) this.$modes["ace/mode/text"] = new TextMode(); + if (this.$modes[path] && !options) { + this.$onChangeMode(this.$modes[path]); + cb && cb(); + return; + } + this.$modeId = path; + config.loadModule([ + "mode", + path + ], (function(m) { + if (this.$modeId !== path) return cb && cb(); + if (this.$modes[path] && !options) this.$onChangeMode(this.$modes[path]); + else if (m && m.Mode) { + m = new m.Mode(options); + if (!options) { + this.$modes[path] = m; + m.$id = path; + } + this.$onChangeMode(m); + } + cb && cb(); + }).bind(this)); + if (!this.$mode) this.$onChangeMode(this.$modes["ace/mode/text"], true); + }; + this.$onChangeMode = function(mode, $isPlaceholder) { + if (!$isPlaceholder) this.$modeId = mode.$id; + if (this.$mode === mode) return; + var oldMode = this.$mode; + this.$mode = mode; + this.$stopWorker(); + if (this.$useWorker) this.$startWorker(); + var tokenizer = mode.getTokenizer(); + if (tokenizer.on !== undefined) { + var onReloadTokenizer = this.onReloadTokenizer.bind(this); + tokenizer.on("update", onReloadTokenizer); + } + this.bgTokenizer.setTokenizer(tokenizer); + this.bgTokenizer.setDocument(this.getDocument()); + this.tokenRe = mode.tokenRe; + this.nonTokenRe = mode.nonTokenRe; + if (!$isPlaceholder) { + if (mode.attachToSession) mode.attachToSession(this); + this.$options.wrapMethod.set.call(this, this.$wrapMethod); + this.$setFolding(mode.foldingRules); + this.bgTokenizer.start(0); + this._emit("changeMode", { + oldMode: oldMode, + mode: mode + }); + } + }; + this.$stopWorker = function() { + if (this.$worker) { + this.$worker.terminate(); + this.$worker = null; + } + }; + this.$startWorker = function() { + try { + this.$worker = this.$mode.createWorker(this); + } catch (e) { + config.warn("Could not load worker", e); + this.$worker = null; + } + }; + this.getMode = function() { + return this.$mode; + }; + this.$scrollTop = 0; + this.setScrollTop = function(scrollTop) { + if (this.$scrollTop === scrollTop || isNaN(scrollTop)) return; + this.$scrollTop = scrollTop; + this._signal("changeScrollTop", scrollTop); + }; + this.getScrollTop = function() { + return this.$scrollTop; + }; + this.$scrollLeft = 0; + this.setScrollLeft = function(scrollLeft) { + if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft)) return; + this.$scrollLeft = scrollLeft; + this._signal("changeScrollLeft", scrollLeft); + }; + this.getScrollLeft = function() { + return this.$scrollLeft; + }; + this.getScreenWidth = function() { + this.$computeWidth(); + if (this.lineWidgets) return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth); + return this.screenWidth; + }; + this.getLineWidgetMaxWidth = function() { + if (this.lineWidgetsWidth != null) return this.lineWidgetsWidth; + var width = 0; + this.lineWidgets.forEach(function(w) { + if (w && w.screenWidth > width) width = w.screenWidth; + }); + return this.lineWidgetWidth = width; + }; + this.$computeWidth = function(force) { + if (this.$modified || force) { + this.$modified = false; + if (this.$useWrapMode) return this.screenWidth = this.$wrapLimit; + var lines = this.doc.getAllLines(); + var cache = this.$rowLengthCache; + var longestScreenLine = 0; + var foldIndex = 0; + var foldLine = this.$foldData[foldIndex]; + var foldStart = foldLine ? foldLine.start.row : Infinity; + var len = lines.length; + for(var i = 0; i < len; i++){ + if (i > foldStart) { + i = foldLine.end.row + 1; + if (i >= len) break; + foldLine = this.$foldData[foldIndex++]; + foldStart = foldLine ? foldLine.start.row : Infinity; + } + if (cache[i] == null) cache[i] = this.$getStringScreenWidth(lines[i])[0]; + if (cache[i] > longestScreenLine) longestScreenLine = cache[i]; + } + this.screenWidth = longestScreenLine; + } + }; + this.getLine = function(row) { + return this.doc.getLine(row); + }; + this.getLines = function(firstRow, lastRow) { + return this.doc.getLines(firstRow, lastRow); + }; + this.getLength = function() { + return this.doc.getLength(); + }; + this.getTextRange = function(range) { + return this.doc.getTextRange(range || this.selection.getRange()); + }; + this.insert = function(position, text) { + return this.doc.insert(position, text); + }; + this.remove = function(range) { + return this.doc.remove(range); + }; + this.removeFullLines = function(firstRow, lastRow) { + return this.doc.removeFullLines(firstRow, lastRow); + }; + this.undoChanges = function(deltas, dontSelect) { + if (!deltas.length) return; + this.$fromUndo = true; + for(var i = deltas.length - 1; i != -1; i--){ + var delta = deltas[i]; + if (delta.action == "insert" || delta.action == "remove") this.doc.revertDelta(delta); + else if (delta.folds) this.addFolds(delta.folds); + } + if (!dontSelect && this.$undoSelect) { + if (deltas.selectionBefore) this.selection.fromJSON(deltas.selectionBefore); + else this.selection.setRange(this.$getUndoSelection(deltas, true)); + } + this.$fromUndo = false; + }; + this.redoChanges = function(deltas, dontSelect) { + if (!deltas.length) return; + this.$fromUndo = true; + for(var i = 0; i < deltas.length; i++){ + var delta = deltas[i]; + if (delta.action == "insert" || delta.action == "remove") this.doc.$safeApplyDelta(delta); + } + if (!dontSelect && this.$undoSelect) { + if (deltas.selectionAfter) this.selection.fromJSON(deltas.selectionAfter); + else this.selection.setRange(this.$getUndoSelection(deltas, false)); + } + this.$fromUndo = false; + }; + this.setUndoSelect = function(enable) { + this.$undoSelect = enable; + }; + this.$getUndoSelection = function(deltas, isUndo) { + function isInsert(delta) { + return isUndo ? delta.action !== "insert" : delta.action === "insert"; + } + var range, point; + for(var i = 0; i < deltas.length; i++){ + var delta = deltas[i]; + if (!delta.start) continue; // skip folds + if (!range) { + if (isInsert(delta)) range = Range.fromPoints(delta.start, delta.end); + else range = Range.fromPoints(delta.start, delta.start); + continue; + } + if (isInsert(delta)) { + point = delta.start; + if (range.compare(point.row, point.column) == -1) range.setStart(point); + point = delta.end; + if (range.compare(point.row, point.column) == 1) range.setEnd(point); + } else { + point = delta.start; + if (range.compare(point.row, point.column) == -1) range = Range.fromPoints(delta.start, delta.start); + } + } + return range; + }; + this.replace = function(range, text) { + return this.doc.replace(range, text); + }; + this.moveText = function(fromRange, toPosition, copy) { + var text = this.getTextRange(fromRange); + var folds = this.getFoldsInRange(fromRange); + var toRange = Range.fromPoints(toPosition, toPosition); + if (!copy) { + this.remove(fromRange); + var rowDiff = fromRange.start.row - fromRange.end.row; + var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column; + if (collDiff) { + if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column) toRange.start.column += collDiff; + if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column) toRange.end.column += collDiff; + } + if (rowDiff && toRange.start.row >= fromRange.end.row) { + toRange.start.row += rowDiff; + toRange.end.row += rowDiff; + } + } + toRange.end = this.insert(toRange.start, text); + if (folds.length) { + var oldStart = fromRange.start; + var newStart = toRange.start; + var rowDiff = newStart.row - oldStart.row; + var collDiff = newStart.column - oldStart.column; + this.addFolds(folds.map(function(x) { + x = x.clone(); + if (x.start.row == oldStart.row) x.start.column += collDiff; + if (x.end.row == oldStart.row) x.end.column += collDiff; + x.start.row += rowDiff; + x.end.row += rowDiff; + return x; + })); + } + return toRange; + }; + this.indentRows = function(startRow, endRow, indentString) { + indentString = indentString.replace(/\t/g, this.getTabString()); + for(var row = startRow; row <= endRow; row++)this.doc.insertInLine({ + row: row, + column: 0 + }, indentString); + }; + this.outdentRows = function(range) { + var rowRange = range.collapseRows(); + var deleteRange = new Range(0, 0, 0, 0); + var size = this.getTabSize(); + for(var i = rowRange.start.row; i <= rowRange.end.row; ++i){ + var line = this.getLine(i); + deleteRange.start.row = i; + deleteRange.end.row = i; + for(var j = 0; j < size; ++j)if (line.charAt(j) != " ") break; + if (j < size && line.charAt(j) == " ") { + deleteRange.start.column = j; + deleteRange.end.column = j + 1; + } else { + deleteRange.start.column = 0; + deleteRange.end.column = j; + } + this.remove(deleteRange); + } + }; + this.$moveLines = function(firstRow, lastRow, dir) { + firstRow = this.getRowFoldStart(firstRow); + lastRow = this.getRowFoldEnd(lastRow); + if (dir < 0) { + var row = this.getRowFoldStart(firstRow + dir); + if (row < 0) return 0; + var diff = row - firstRow; + } else if (dir > 0) { + var row = this.getRowFoldEnd(lastRow + dir); + if (row > this.doc.getLength() - 1) return 0; + var diff = row - lastRow; + } else { + firstRow = this.$clipRowToDocument(firstRow); + lastRow = this.$clipRowToDocument(lastRow); + var diff = lastRow - firstRow + 1; + } + var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE); + var folds = this.getFoldsInRange(range).map(function(x) { + x = x.clone(); + x.start.row += diff; + x.end.row += diff; + return x; + }); + var lines = dir == 0 ? this.doc.getLines(firstRow, lastRow) : this.doc.removeFullLines(firstRow, lastRow); + this.doc.insertFullLines(firstRow + diff, lines); + folds.length && this.addFolds(folds); + return diff; + }; + this.moveLinesUp = function(firstRow, lastRow) { + return this.$moveLines(firstRow, lastRow, -1); + }; + this.moveLinesDown = function(firstRow, lastRow) { + return this.$moveLines(firstRow, lastRow, 1); + }; + this.duplicateLines = function(firstRow, lastRow) { + return this.$moveLines(firstRow, lastRow, 0); + }; + this.$clipRowToDocument = function(row) { + return Math.max(0, Math.min(row, this.doc.getLength() - 1)); + }; + this.$clipColumnToRow = function(row, column) { + if (column < 0) return 0; + return Math.min(this.doc.getLine(row).length, column); + }; + this.$clipPositionToDocument = function(row, column) { + column = Math.max(0, column); + if (row < 0) { + row = 0; + column = 0; + } else { + var len = this.doc.getLength(); + if (row >= len) { + row = len - 1; + column = this.doc.getLine(len - 1).length; + } else column = Math.min(this.doc.getLine(row).length, column); + } + return { + row: row, + column: column + }; + }; + this.$clipRangeToDocument = function(range) { + if (range.start.row < 0) { + range.start.row = 0; + range.start.column = 0; + } else range.start.column = this.$clipColumnToRow(range.start.row, range.start.column); + var len = this.doc.getLength() - 1; + if (range.end.row > len) { + range.end.row = len; + range.end.column = this.doc.getLine(len).length; + } else range.end.column = this.$clipColumnToRow(range.end.row, range.end.column); + return range; + }; + this.$wrapLimit = 80; + this.$useWrapMode = false; + this.$wrapLimitRange = { + min: null, + max: null + }; + this.setUseWrapMode = function(useWrapMode) { + if (useWrapMode != this.$useWrapMode) { + this.$useWrapMode = useWrapMode; + this.$modified = true; + this.$resetRowCache(0); + if (useWrapMode) { + var len = this.getLength(); + this.$wrapData = Array(len); + this.$updateWrapData(0, len - 1); + } + this._signal("changeWrapMode"); + } + }; + this.getUseWrapMode = function() { + return this.$useWrapMode; + }; + this.setWrapLimitRange = function(min, max) { + if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) { + this.$wrapLimitRange = { + min: min, + max: max + }; + this.$modified = true; + this.$bidiHandler.markAsDirty(); + if (this.$useWrapMode) this._signal("changeWrapMode"); + } + }; + this.adjustWrapLimit = function(desiredLimit, $printMargin) { + var limits = this.$wrapLimitRange; + if (limits.max < 0) limits = { + min: $printMargin, + max: $printMargin + }; + var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max); + if (wrapLimit != this.$wrapLimit && wrapLimit > 1) { + this.$wrapLimit = wrapLimit; + this.$modified = true; + if (this.$useWrapMode) { + this.$updateWrapData(0, this.getLength() - 1); + this.$resetRowCache(0); + this._signal("changeWrapLimit"); + } + return true; + } + return false; + }; + this.$constrainWrapLimit = function(wrapLimit, min, max) { + if (min) wrapLimit = Math.max(min, wrapLimit); + if (max) wrapLimit = Math.min(max, wrapLimit); + return wrapLimit; + }; + this.getWrapLimit = function() { + return this.$wrapLimit; + }; + this.setWrapLimit = function(limit) { + this.setWrapLimitRange(limit, limit); + }; + this.getWrapLimitRange = function() { + return { + min: this.$wrapLimitRange.min, + max: this.$wrapLimitRange.max + }; + }; + this.$updateInternalDataOnChange = function(delta) { + var useWrapMode = this.$useWrapMode; + var action = delta.action; + var start = delta.start; + var end = delta.end; + var firstRow = start.row; + var lastRow = end.row; + var len = lastRow - firstRow; + var removedFolds = null; + this.$updating = true; + if (len != 0) { + if (action === "remove") { + this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len); + var foldLines = this.$foldData; + removedFolds = this.getFoldsInRange(delta); + this.removeFolds(removedFolds); + var foldLine = this.getFoldLine(end.row); + var idx = 0; + if (foldLine) { + foldLine.addRemoveChars(end.row, end.column, start.column - end.column); + foldLine.shiftRow(-len); + var foldLineBefore = this.getFoldLine(firstRow); + if (foldLineBefore && foldLineBefore !== foldLine) { + foldLineBefore.merge(foldLine); + foldLine = foldLineBefore; + } + idx = foldLines.indexOf(foldLine) + 1; + } + for(idx; idx < foldLines.length; idx++){ + var foldLine = foldLines[idx]; + if (foldLine.start.row >= end.row) foldLine.shiftRow(-len); + } + lastRow = firstRow; + } else { + var args = Array(len); + args.unshift(firstRow, 0); + var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache; + arr.splice.apply(arr, args); + var foldLines = this.$foldData; + var foldLine = this.getFoldLine(firstRow); + var idx = 0; + if (foldLine) { + var cmp = foldLine.range.compareInside(start.row, start.column); + if (cmp == 0) { + foldLine = foldLine.split(start.row, start.column); + if (foldLine) { + foldLine.shiftRow(len); + foldLine.addRemoveChars(lastRow, 0, end.column - start.column); + } + } else if (cmp == -1) { + foldLine.addRemoveChars(firstRow, 0, end.column - start.column); + foldLine.shiftRow(len); + } + idx = foldLines.indexOf(foldLine) + 1; + } + for(idx; idx < foldLines.length; idx++){ + var foldLine = foldLines[idx]; + if (foldLine.start.row >= firstRow) foldLine.shiftRow(len); + } + } + } else { + len = Math.abs(delta.start.column - delta.end.column); + if (action === "remove") { + removedFolds = this.getFoldsInRange(delta); + this.removeFolds(removedFolds); + len = -len; + } + var foldLine = this.getFoldLine(firstRow); + if (foldLine) foldLine.addRemoveChars(firstRow, start.column, len); + } + if (useWrapMode && this.$wrapData.length != this.doc.getLength()) console.error("doc.getLength() and $wrapData.length have to be the same!"); + this.$updating = false; + if (useWrapMode) this.$updateWrapData(firstRow, lastRow); + else this.$updateRowLengthCache(firstRow, lastRow); + return removedFolds; + }; + this.$updateRowLengthCache = function(firstRow, lastRow, b) { + this.$rowLengthCache[firstRow] = null; + this.$rowLengthCache[lastRow] = null; + }; + this.$updateWrapData = function(firstRow, lastRow) { + var lines = this.doc.getAllLines(); + var tabSize = this.getTabSize(); + var wrapData = this.$wrapData; + var wrapLimit = this.$wrapLimit; + var tokens; + var foldLine; + var row = firstRow; + lastRow = Math.min(lastRow, lines.length - 1); + while(row <= lastRow){ + foldLine = this.getFoldLine(row, foldLine); + if (!foldLine) { + tokens = this.$getDisplayTokens(lines[row]); + wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize); + row++; + } else { + tokens = []; + foldLine.walk((function(placeholder, row, column, lastColumn) { + var walkTokens; + if (placeholder != null) { + walkTokens = this.$getDisplayTokens(placeholder, tokens.length); + walkTokens[0] = PLACEHOLDER_START; + for(var i = 1; i < walkTokens.length; i++)walkTokens[i] = PLACEHOLDER_BODY; + } else walkTokens = this.$getDisplayTokens(lines[row].substring(lastColumn, column), tokens.length); + tokens = tokens.concat(walkTokens); + }).bind(this), foldLine.end.row, lines[foldLine.end.row].length + 1); + wrapData[foldLine.start.row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize); + row = foldLine.end.row + 1; + } + } + }; + var CHAR = 1, CHAR_EXT = 2, PLACEHOLDER_START = 3, PLACEHOLDER_BODY = 4, PUNCTUATION = 9, SPACE = 10, TAB = 11, TAB_SPACE = 12; + this.$computeWrapSplits = function(tokens, wrapLimit, tabSize) { + if (tokens.length == 0) return []; + var splits = []; + var displayLength = tokens.length; + var lastSplit = 0, lastDocSplit = 0; + var isCode = this.$wrapAsCode; + var indentedSoftWrap = this.$indentedSoftWrap; + var maxIndent = wrapLimit <= Math.max(2 * tabSize, 8) || indentedSoftWrap === false ? 0 : Math.floor(wrapLimit / 2); + function getWrapIndent() { + var indentation = 0; + if (maxIndent === 0) return indentation; + if (indentedSoftWrap) for(var i = 0; i < tokens.length; i++){ + var token = tokens[i]; + if (token == SPACE) indentation += 1; + else if (token == TAB) indentation += tabSize; + else if (token == TAB_SPACE) continue; + else break; + } + if (isCode && indentedSoftWrap !== false) indentation += tabSize; + return Math.min(indentation, maxIndent); + } + function addSplit(screenPos) { + var len = screenPos - lastSplit; + for(var i = lastSplit; i < screenPos; i++){ + var ch = tokens[i]; + if (ch === 12 || ch === 2) len -= 1; + } + if (!splits.length) { + indent = getWrapIndent(); + splits.indent = indent; + } + lastDocSplit += len; + splits.push(lastDocSplit); + lastSplit = screenPos; + } + var indent = 0; + while(displayLength - lastSplit > wrapLimit - indent){ + var split = lastSplit + wrapLimit - indent; + if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) { + addSplit(split); + continue; + } + if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) { + for(split; split != lastSplit - 1; split--){ + if (tokens[split] == PLACEHOLDER_START) break; + } + if (split > lastSplit) { + addSplit(split); + continue; + } + split = lastSplit + wrapLimit; + for(split; split < tokens.length; split++){ + if (tokens[split] != PLACEHOLDER_BODY) break; + } + if (split == tokens.length) break; // Breaks the while-loop. + addSplit(split); + continue; + } + var minSplit = Math.max(split - (wrapLimit - (wrapLimit >> 2)), lastSplit - 1); + while(split > minSplit && tokens[split] < PLACEHOLDER_START)split--; + if (isCode) { + while(split > minSplit && tokens[split] < PLACEHOLDER_START)split--; + while(split > minSplit && tokens[split] == PUNCTUATION)split--; + } else while(split > minSplit && tokens[split] < SPACE)split--; + if (split > minSplit) { + addSplit(++split); + continue; + } + split = lastSplit + wrapLimit; + if (tokens[split] == CHAR_EXT) split--; + addSplit(split - indent); + } + return splits; + }; + this.$getDisplayTokens = function(str, offset) { + var arr = []; + var tabSize; + offset = offset || 0; + for(var i = 0; i < str.length; i++){ + var c = str.charCodeAt(i); + if (c == 9) { + tabSize = this.getScreenTabSize(arr.length + offset); + arr.push(TAB); + for(var n = 1; n < tabSize; n++)arr.push(TAB_SPACE); + } else if (c == 32) arr.push(SPACE); + else if (c > 39 && c < 48 || c > 57 && c < 64) arr.push(PUNCTUATION); + else if (c >= 0x1100 && isFullWidth(c)) arr.push(CHAR, CHAR_EXT); + else arr.push(CHAR); + } + return arr; + }; + this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) { + if (maxScreenColumn == 0) return [ + 0, + 0 + ]; + if (maxScreenColumn == null) maxScreenColumn = Infinity; + screenColumn = screenColumn || 0; + var c, column; + for(column = 0; column < str.length; column++){ + c = str.charCodeAt(column); + if (c == 9) screenColumn += this.getScreenTabSize(screenColumn); + else if (c >= 0x1100 && isFullWidth(c)) screenColumn += 2; + else screenColumn += 1; + if (screenColumn > maxScreenColumn) break; + } + return [ + screenColumn, + column + ]; + }; + this.lineWidgets = null; + this.getRowLength = function(row) { + var h = 1; + if (this.lineWidgets) h += this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0; + if (!this.$useWrapMode || !this.$wrapData[row]) return h; + else return this.$wrapData[row].length + h; + }; + this.getRowLineCount = function(row) { + if (!this.$useWrapMode || !this.$wrapData[row]) return 1; + else return this.$wrapData[row].length + 1; + }; + this.getRowWrapIndent = function(screenRow) { + if (this.$useWrapMode) { + var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE); + var splits = this.$wrapData[pos.row]; + return splits.length && splits[0] < pos.column ? splits.indent : 0; + } else return 0; + }; + this.getScreenLastRowColumn = function(screenRow) { + var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE); + return this.documentToScreenColumn(pos.row, pos.column); + }; + this.getDocumentLastRowColumn = function(docRow, docColumn) { + var screenRow = this.documentToScreenRow(docRow, docColumn); + return this.getScreenLastRowColumn(screenRow); + }; + this.getDocumentLastRowColumnPosition = function(docRow, docColumn) { + var screenRow = this.documentToScreenRow(docRow, docColumn); + return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10); + }; + this.getRowSplitData = function(row) { + if (!this.$useWrapMode) return undefined; + else return this.$wrapData[row]; + }; + this.getScreenTabSize = function(screenColumn) { + return this.$tabSize - (screenColumn % this.$tabSize | 0); + }; + this.screenToDocumentRow = function(screenRow, screenColumn) { + return this.screenToDocumentPosition(screenRow, screenColumn).row; + }; + this.screenToDocumentColumn = function(screenRow, screenColumn) { + return this.screenToDocumentPosition(screenRow, screenColumn).column; + }; + this.screenToDocumentPosition = function(screenRow, screenColumn, offsetX) { + if (screenRow < 0) return { + row: 0, + column: 0 + }; + var line; + var docRow = 0; + var docColumn = 0; + var column; + var row = 0; + var rowLength = 0; + var rowCache = this.$screenRowCache; + var i = this.$getRowCacheIndex(rowCache, screenRow); + var l = rowCache.length; + if (l && i >= 0) { + var row = rowCache[i]; + var docRow = this.$docRowCache[i]; + var doCache = screenRow > rowCache[l - 1]; + } else var doCache = !l; + var maxRow = this.getLength() - 1; + var foldLine = this.getNextFoldLine(docRow); + var foldStart = foldLine ? foldLine.start.row : Infinity; + while(row <= screenRow){ + rowLength = this.getRowLength(docRow); + if (row + rowLength > screenRow || docRow >= maxRow) break; + else { + row += rowLength; + docRow++; + if (docRow > foldStart) { + docRow = foldLine.end.row + 1; + foldLine = this.getNextFoldLine(docRow, foldLine); + foldStart = foldLine ? foldLine.start.row : Infinity; + } + } + if (doCache) { + this.$docRowCache.push(docRow); + this.$screenRowCache.push(row); + } + } + if (foldLine && foldLine.start.row <= docRow) { + line = this.getFoldDisplayLine(foldLine); + docRow = foldLine.start.row; + } else if (row + rowLength <= screenRow || docRow > maxRow) return { + row: maxRow, + column: this.getLine(maxRow).length + }; + else { + line = this.getLine(docRow); + foldLine = null; + } + var wrapIndent = 0, splitIndex = Math.floor(screenRow - row); + if (this.$useWrapMode) { + var splits = this.$wrapData[docRow]; + if (splits) { + column = splits[splitIndex]; + if (splitIndex > 0 && splits.length) { + wrapIndent = splits.indent; + docColumn = splits[splitIndex - 1] || splits[splits.length - 1]; + line = line.substring(docColumn); + } + } + } + if (offsetX !== undefined && this.$bidiHandler.isBidiRow(row + splitIndex, docRow, splitIndex)) screenColumn = this.$bidiHandler.offsetToCol(offsetX); + docColumn += this.$getStringScreenWidth(line, screenColumn - wrapIndent)[1]; + if (this.$useWrapMode && docColumn >= column) docColumn = column - 1; + if (foldLine) return foldLine.idxToPosition(docColumn); + return { + row: docRow, + column: docColumn + }; + }; + this.documentToScreenPosition = function(docRow, docColumn) { + if (typeof docColumn === "undefined") var pos = this.$clipPositionToDocument(docRow.row, docRow.column); + else pos = this.$clipPositionToDocument(docRow, docColumn); + docRow = pos.row; + docColumn = pos.column; + var screenRow = 0; + var foldStartRow = null; + var fold = null; + fold = this.getFoldAt(docRow, docColumn, 1); + if (fold) { + docRow = fold.start.row; + docColumn = fold.start.column; + } + var rowEnd, row = 0; + var rowCache = this.$docRowCache; + var i = this.$getRowCacheIndex(rowCache, docRow); + var l = rowCache.length; + if (l && i >= 0) { + var row = rowCache[i]; + var screenRow = this.$screenRowCache[i]; + var doCache = docRow > rowCache[l - 1]; + } else var doCache = !l; + var foldLine = this.getNextFoldLine(row); + var foldStart = foldLine ? foldLine.start.row : Infinity; + while(row < docRow){ + if (row >= foldStart) { + rowEnd = foldLine.end.row + 1; + if (rowEnd > docRow) break; + foldLine = this.getNextFoldLine(rowEnd, foldLine); + foldStart = foldLine ? foldLine.start.row : Infinity; + } else rowEnd = row + 1; + screenRow += this.getRowLength(row); + row = rowEnd; + if (doCache) { + this.$docRowCache.push(row); + this.$screenRowCache.push(screenRow); + } + } + var textLine = ""; + if (foldLine && row >= foldStart) { + textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn); + foldStartRow = foldLine.start.row; + } else { + textLine = this.getLine(docRow).substring(0, docColumn); + foldStartRow = docRow; + } + var wrapIndent = 0; + if (this.$useWrapMode) { + var wrapRow = this.$wrapData[foldStartRow]; + if (wrapRow) { + var screenRowOffset = 0; + while(textLine.length >= wrapRow[screenRowOffset]){ + screenRow++; + screenRowOffset++; + } + textLine = textLine.substring(wrapRow[screenRowOffset - 1] || 0, textLine.length); + wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0; + } + } + if (this.lineWidgets && this.lineWidgets[row] && this.lineWidgets[row].rowsAbove) screenRow += this.lineWidgets[row].rowsAbove; + return { + row: screenRow, + column: wrapIndent + this.$getStringScreenWidth(textLine)[0] + }; + }; + this.documentToScreenColumn = function(row, docColumn) { + return this.documentToScreenPosition(row, docColumn).column; + }; + this.documentToScreenRow = function(docRow, docColumn) { + return this.documentToScreenPosition(docRow, docColumn).row; + }; + this.getScreenLength = function() { + var screenRows = 0; + var fold = null; + if (!this.$useWrapMode) { + screenRows = this.getLength(); + var foldData = this.$foldData; + for(var i = 0; i < foldData.length; i++){ + fold = foldData[i]; + screenRows -= fold.end.row - fold.start.row; + } + } else { + var lastRow = this.$wrapData.length; + var row = 0, i = 0; + var fold = this.$foldData[i++]; + var foldStart = fold ? fold.start.row : Infinity; + while(row < lastRow){ + var splits = this.$wrapData[row]; + screenRows += splits ? splits.length + 1 : 1; + row++; + if (row > foldStart) { + row = fold.end.row + 1; + fold = this.$foldData[i++]; + foldStart = fold ? fold.start.row : Infinity; + } + } + } + if (this.lineWidgets) screenRows += this.$getWidgetScreenLength(); + return screenRows; + }; + this.$setFontMetrics = function(fm) { + if (!this.$enableVarChar) return; + this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) { + if (maxScreenColumn === 0) return [ + 0, + 0 + ]; + if (!maxScreenColumn) maxScreenColumn = Infinity; + screenColumn = screenColumn || 0; + var c, column; + for(column = 0; column < str.length; column++){ + c = str.charAt(column); + if (c === " ") screenColumn += this.getScreenTabSize(screenColumn); + else screenColumn += fm.getCharacterWidth(c); + if (screenColumn > maxScreenColumn) break; + } + return [ + screenColumn, + column + ]; + }; + }; + this.destroy = function() { + if (!this.destroyed) { + this.bgTokenizer.setDocument(null); + this.bgTokenizer.cleanup(); + this.destroyed = true; + } + this.$stopWorker(); + this.removeAllListeners(); + if (this.doc) this.doc.off("change", this.$onChange); + this.selection.detach(); + }; + this.isFullWidth = isFullWidth; + function isFullWidth(c) { + if (c < 0x1100) return false; + return c >= 0x1100 && c <= 0x115F || c >= 0x11A3 && c <= 0x11A7 || c >= 0x11FA && c <= 0x11FF || c >= 0x2329 && c <= 0x232A || c >= 0x2E80 && c <= 0x2E99 || c >= 0x2E9B && c <= 0x2EF3 || c >= 0x2F00 && c <= 0x2FD5 || c >= 0x2FF0 && c <= 0x2FFB || c >= 0x3000 && c <= 0x303E || c >= 0x3041 && c <= 0x3096 || c >= 0x3099 && c <= 0x30FF || c >= 0x3105 && c <= 0x312D || c >= 0x3131 && c <= 0x318E || c >= 0x3190 && c <= 0x31BA || c >= 0x31C0 && c <= 0x31E3 || c >= 0x31F0 && c <= 0x321E || c >= 0x3220 && c <= 0x3247 || c >= 0x3250 && c <= 0x32FE || c >= 0x3300 && c <= 0x4DBF || c >= 0x4E00 && c <= 0xA48C || c >= 0xA490 && c <= 0xA4C6 || c >= 0xA960 && c <= 0xA97C || c >= 0xAC00 && c <= 0xD7A3 || c >= 0xD7B0 && c <= 0xD7C6 || c >= 0xD7CB && c <= 0xD7FB || c >= 0xF900 && c <= 0xFAFF || c >= 0xFE10 && c <= 0xFE19 || c >= 0xFE30 && c <= 0xFE52 || c >= 0xFE54 && c <= 0xFE66 || c >= 0xFE68 && c <= 0xFE6B || c >= 0xFF01 && c <= 0xFF60 || c >= 0xFFE0 && c <= 0xFFE6; + } + }).call(EditSession.prototype); + require("./edit_session/folding").Folding.call(EditSession.prototype); + require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype); + config.defineOptions(EditSession.prototype, "session", { + wrap: { + set: function(value) { + if (!value || value == "off") value = false; + else if (value == "free") value = true; + else if (value == "printMargin") value = -1; + else if (typeof value == "string") value = parseInt(value, 10) || false; + if (this.$wrap == value) return; + this.$wrap = value; + if (!value) this.setUseWrapMode(false); + else { + var col = typeof value == "number" ? value : null; + this.setWrapLimitRange(col, col); + this.setUseWrapMode(true); + } + }, + get: function() { + if (this.getUseWrapMode()) { + if (this.$wrap == -1) return "printMargin"; + if (!this.getWrapLimitRange().min) return "free"; + return this.$wrap; + } + return "off"; + }, + handlesSet: true + }, + wrapMethod: { + set: function(val) { + val = val == "auto" ? this.$mode.type != "text" : val != "text"; + if (val != this.$wrapAsCode) { + this.$wrapAsCode = val; + if (this.$useWrapMode) { + this.$useWrapMode = false; + this.setUseWrapMode(true); + } + } + }, + initialValue: "auto" + }, + indentedSoftWrap: { + set: function() { + if (this.$useWrapMode) { + this.$useWrapMode = false; + this.setUseWrapMode(true); + } + }, + initialValue: true + }, + firstLineNumber: { + set: function() { + this._signal("changeBreakpoint"); + }, + initialValue: 1 + }, + useWorker: { + set: function(useWorker) { + this.$useWorker = useWorker; + this.$stopWorker(); + if (useWorker) this.$startWorker(); + }, + initialValue: true + }, + useSoftTabs: { + initialValue: true + }, + tabSize: { + set: function(tabSize) { + tabSize = parseInt(tabSize); + if (tabSize > 0 && this.$tabSize !== tabSize) { + this.$modified = true; + this.$rowLengthCache = []; + this.$tabSize = tabSize; + this._signal("changeTabSize"); + } + }, + initialValue: 4, + handlesSet: true + }, + navigateWithinSoftTabs: { + initialValue: false + }, + foldStyle: { + set: function(val) { + this.setFoldStyle(val); + }, + handlesSet: true + }, + overwrite: { + set: function(val) { + this._signal("changeOverwrite"); + }, + initialValue: false + }, + newLineMode: { + set: function(val) { + this.doc.setNewLineMode(val); + }, + get: function() { + return this.doc.getNewLineMode(); + }, + handlesSet: true + }, + mode: { + set: function(val) { + this.setMode(val); + }, + get: function() { + return this.$modeId; + }, + handlesSet: true + } + }); + exports.EditSession = EditSession; +}); +ace.define("ace/search", [ + "require", + "exports", + "module", + "ace/lib/lang", + "ace/lib/oop", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var lang = require("./lib/lang"); + var oop = require("./lib/oop"); + var Range = require("./range").Range; + var Search = function() { + this.$options = {}; + }; + (function() { + this.set = function(options) { + oop.mixin(this.$options, options); + return this; + }; + this.getOptions = function() { + return lang.copyObject(this.$options); + }; + this.setOptions = function(options) { + this.$options = options; + }; + this.find = function(session) { + var options = this.$options; + var iterator = this.$matchIterator(session, options); + if (!iterator) return false; + var firstRange = null; + iterator.forEach(function(sr, sc, er, ec) { + firstRange = new Range(sr, sc, er, ec); + if (sc == ec && options.start && options.start.start && options.skipCurrent != false && firstRange.isEqual(options.start)) { + firstRange = null; + return false; + } + return true; + }); + return firstRange; + }; + this.findAll = function(session) { + var options = this.$options; + if (!options.needle) return []; + this.$assembleRegExp(options); + var range = options.range; + var lines = range ? session.getLines(range.start.row, range.end.row) : session.doc.getAllLines(); + var ranges = []; + var re = options.re; + if (options.$isMultiLine) { + var len = re.length; + var maxRow = lines.length - len; + var prevRange; + outer: for(var row = re.offset || 0; row <= maxRow; row++){ + for(var j = 0; j < len; j++)if (lines[row + j].search(re[j]) == -1) continue outer; + var startLine = lines[row]; + var line = lines[row + len - 1]; + var startIndex = startLine.length - startLine.match(re[0])[0].length; + var endIndex = line.match(re[len - 1])[0].length; + if (prevRange && prevRange.end.row === row && prevRange.end.column > startIndex) continue; + ranges.push(prevRange = new Range(row, startIndex, row + len - 1, endIndex)); + if (len > 2) row = row + len - 2; + } + } else for(var i = 0; i < lines.length; i++){ + var matches = lang.getMatchOffsets(lines[i], re); + for(var j = 0; j < matches.length; j++){ + var match = matches[j]; + ranges.push(new Range(i, match.offset, i, match.offset + match.length)); + } + } + if (range) { + var startColumn = range.start.column; + var endColumn = range.end.column; + var i = 0, j = ranges.length - 1; + while(i < j && ranges[i].start.column < startColumn && ranges[i].start.row == 0)i++; + var endRow = range.end.row - range.start.row; + while(i < j && ranges[j].end.column > endColumn && ranges[j].end.row == endRow)j--; + ranges = ranges.slice(i, j + 1); + for(i = 0, j = ranges.length; i < j; i++){ + ranges[i].start.row += range.start.row; + ranges[i].end.row += range.start.row; + } + } + return ranges; + }; + this.replace = function(input, replacement) { + var options = this.$options; + var re = this.$assembleRegExp(options); + if (options.$isMultiLine) return replacement; + if (!re) return; + var match = re.exec(input); + if (!match || match[0].length != input.length) return null; + replacement = input.replace(re, replacement); + if (options.preserveCase) { + replacement = replacement.split(""); + for(var i = Math.min(input.length, input.length); i--;){ + var ch = input[i]; + if (ch && ch.toLowerCase() != ch) replacement[i] = replacement[i].toUpperCase(); + else replacement[i] = replacement[i].toLowerCase(); + } + replacement = replacement.join(""); + } + return replacement; + }; + this.$assembleRegExp = function(options, $disableFakeMultiline) { + if (options.needle instanceof RegExp) return options.re = options.needle; + var needle = options.needle; + if (!options.needle) return options.re = false; + if (!options.regExp) needle = lang.escapeRegExp(needle); + if (options.wholeWord) needle = addWordBoundary(needle, options); + var modifier = options.caseSensitive ? "gm" : "gmi"; + options.$isMultiLine = !$disableFakeMultiline && /[\n\r]/.test(needle); + if (options.$isMultiLine) return options.re = this.$assembleMultilineRegExp(needle, modifier); + try { + var re = new RegExp(needle, modifier); + } catch (e) { + re = false; + } + return options.re = re; + }; + this.$assembleMultilineRegExp = function(needle, modifier) { + var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n"); + var re = []; + for(var i = 0; i < parts.length; i++)try { + re.push(new RegExp(parts[i], modifier)); + } catch (e) { + return false; + } + return re; + }; + this.$matchIterator = function(session, options) { + var re = this.$assembleRegExp(options); + if (!re) return false; + var backwards = options.backwards == true; + var skipCurrent = options.skipCurrent != false; + var range = options.range; + var start = options.start; + if (!start) start = range ? range[backwards ? "end" : "start"] : session.selection.getRange(); + if (start.start) start = start[skipCurrent != backwards ? "end" : "start"]; + var firstRow = range ? range.start.row : 0; + var lastRow = range ? range.end.row : session.getLength() - 1; + if (backwards) var forEach = function(callback) { + var row = start.row; + if (forEachInLine(row, start.column, callback)) return; + for(row--; row >= firstRow; row--)if (forEachInLine(row, Number.MAX_VALUE, callback)) return; + if (options.wrap == false) return; + for(row = lastRow, firstRow = start.row; row >= firstRow; row--)if (forEachInLine(row, Number.MAX_VALUE, callback)) return; + }; + else var forEach = function(callback) { + var row = start.row; + if (forEachInLine(row, start.column, callback)) return; + for(row = row + 1; row <= lastRow; row++)if (forEachInLine(row, 0, callback)) return; + if (options.wrap == false) return; + for(row = firstRow, lastRow = start.row; row <= lastRow; row++)if (forEachInLine(row, 0, callback)) return; + }; + if (options.$isMultiLine) { + var len = re.length; + var forEachInLine = function(row, offset, callback) { + var startRow = backwards ? row - len + 1 : row; + if (startRow < 0 || startRow + len > session.getLength()) return; + var line = session.getLine(startRow); + var startIndex = line.search(re[0]); + if (!backwards && startIndex < offset || startIndex === -1) return; + for(var i = 1; i < len; i++){ + line = session.getLine(startRow + i); + if (line.search(re[i]) == -1) return; + } + var endIndex = line.match(re[len - 1])[0].length; + if (backwards && endIndex > offset) return; + if (callback(startRow, startIndex, startRow + len - 1, endIndex)) return true; + }; + } else if (backwards) var forEachInLine = function(row, endIndex, callback) { + var line = session.getLine(row); + var matches = []; + var m, last = 0; + re.lastIndex = 0; + while(m = re.exec(line)){ + var length = m[0].length; + last = m.index; + if (!length) { + if (last >= line.length) break; + re.lastIndex = last += 1; + } + if (m.index + length > endIndex) break; + matches.push(m.index, length); + } + for(var i = matches.length - 1; i >= 0; i -= 2){ + var column = matches[i - 1]; + var length = matches[i]; + if (callback(row, column, row, column + length)) return true; + } + }; + else var forEachInLine = function(row, startIndex, callback) { + var line = session.getLine(row); + var last; + var m; + re.lastIndex = startIndex; + while(m = re.exec(line)){ + var length = m[0].length; + last = m.index; + if (callback(row, last, row, last + length)) return true; + if (!length) { + re.lastIndex = last += 1; + if (last >= line.length) return false; + } + } + }; + return { + forEach: forEach + }; + }; + }).call(Search.prototype); + function addWordBoundary(needle, options) { + function wordBoundary(c) { + if (/\w/.test(c) || options.regExp) return "\\b"; + return ""; + } + return wordBoundary(needle[0]) + needle + wordBoundary(needle[needle.length - 1]); + } + exports.Search = Search; +}); +ace.define("ace/keyboard/hash_handler", [ + "require", + "exports", + "module", + "ace/lib/keys", + "ace/lib/useragent" +], function(require, exports, module1) { + "use strict"; + var keyUtil = require("../lib/keys"); + var useragent = require("../lib/useragent"); + var KEY_MODS = keyUtil.KEY_MODS; + function HashHandler(config, platform) { + this.platform = platform || (useragent.isMac ? "mac" : "win"); + this.commands = {}; + this.commandKeyBinding = {}; + this.addCommands(config); + this.$singleCommand = true; + } + function MultiHashHandler(config, platform) { + HashHandler.call(this, config, platform); + this.$singleCommand = false; + } + MultiHashHandler.prototype = HashHandler.prototype; + (function() { + this.addCommand = function(command) { + if (this.commands[command.name]) this.removeCommand(command); + this.commands[command.name] = command; + if (command.bindKey) this._buildKeyHash(command); + }; + this.removeCommand = function(command, keepCommand) { + var name = command && (typeof command === "string" ? command : command.name); + command = this.commands[name]; + if (!keepCommand) delete this.commands[name]; + var ckb = this.commandKeyBinding; + for(var keyId in ckb){ + var cmdGroup = ckb[keyId]; + if (cmdGroup == command) delete ckb[keyId]; + else if (Array.isArray(cmdGroup)) { + var i = cmdGroup.indexOf(command); + if (i != -1) { + cmdGroup.splice(i, 1); + if (cmdGroup.length == 1) ckb[keyId] = cmdGroup[0]; + } + } + } + }; + this.bindKey = function(key, command, position) { + if (typeof key == "object" && key) { + if (position == undefined) position = key.position; + key = key[this.platform]; + } + if (!key) return; + if (typeof command == "function") return this.addCommand({ + exec: command, + bindKey: key, + name: command.name || key + }); + key.split("|").forEach(function(keyPart) { + var chain = ""; + if (keyPart.indexOf(" ") != -1) { + var parts = keyPart.split(/\s+/); + keyPart = parts.pop(); + parts.forEach(function(keyPart) { + var binding = this.parseKeys(keyPart); + var id = KEY_MODS[binding.hashId] + binding.key; + chain += (chain ? " " : "") + id; + this._addCommandToBinding(chain, "chainKeys"); + }, this); + chain += " "; + } + var binding = this.parseKeys(keyPart); + var id = KEY_MODS[binding.hashId] + binding.key; + this._addCommandToBinding(chain + id, command, position); + }, this); + }; + function getPosition(command) { + return typeof command == "object" && command.bindKey && command.bindKey.position || (command.isDefault ? -100 : 0); + } + this._addCommandToBinding = function(keyId, command, position) { + var ckb = this.commandKeyBinding, i; + if (!command) delete ckb[keyId]; + else if (!ckb[keyId] || this.$singleCommand) ckb[keyId] = command; + else { + if (!Array.isArray(ckb[keyId])) ckb[keyId] = [ + ckb[keyId] + ]; + else if ((i = ckb[keyId].indexOf(command)) != -1) ckb[keyId].splice(i, 1); + if (typeof position != "number") position = getPosition(command); + var commands = ckb[keyId]; + for(i = 0; i < commands.length; i++){ + var other = commands[i]; + var otherPos = getPosition(other); + if (otherPos > position) break; + } + commands.splice(i, 0, command); + } + }; + this.addCommands = function(commands) { + commands && Object.keys(commands).forEach(function(name) { + var command = commands[name]; + if (!command) return; + if (typeof command === "string") return this.bindKey(command, name); + if (typeof command === "function") command = { + exec: command + }; + if (typeof command !== "object") return; + if (!command.name) command.name = name; + this.addCommand(command); + }, this); + }; + this.removeCommands = function(commands) { + Object.keys(commands).forEach(function(name) { + this.removeCommand(commands[name]); + }, this); + }; + this.bindKeys = function(keyList) { + Object.keys(keyList).forEach(function(key) { + this.bindKey(key, keyList[key]); + }, this); + }; + this._buildKeyHash = function(command) { + this.bindKey(command.bindKey, command); + }; + this.parseKeys = function(keys) { + var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x) { + return x; + }); + var key = parts.pop(); + var keyCode = keyUtil[key]; + if (keyUtil.FUNCTION_KEYS[keyCode]) key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase(); + else if (!parts.length) return { + key: key, + hashId: -1 + }; + else if (parts.length == 1 && parts[0] == "shift") return { + key: key.toUpperCase(), + hashId: -1 + }; + var hashId = 0; + for(var i = parts.length; i--;){ + var modifier = keyUtil.KEY_MODS[parts[i]]; + if (modifier == null) { + if (typeof console != "undefined") console.error("invalid modifier " + parts[i] + " in " + keys); + return false; + } + hashId |= modifier; + } + return { + key: key, + hashId: hashId + }; + }; + this.findKeyCommand = function findKeyCommand(hashId, keyString) { + var key = KEY_MODS[hashId] + keyString; + return this.commandKeyBinding[key]; + }; + this.handleKeyboard = function(data, hashId, keyString, keyCode) { + if (keyCode < 0) return; + var key = KEY_MODS[hashId] + keyString; + var command = this.commandKeyBinding[key]; + if (data.$keyChain) { + data.$keyChain += " " + key; + command = this.commandKeyBinding[data.$keyChain] || command; + } + if (command) { + if (command == "chainKeys" || command[command.length - 1] == "chainKeys") { + data.$keyChain = data.$keyChain || key; + return { + command: "null" + }; + } + } + if (data.$keyChain) { + if ((!hashId || hashId == 4) && keyString.length == 1) data.$keyChain = data.$keyChain.slice(0, -key.length - 1); // wait for input + else if (hashId == -1 || keyCode > 0) data.$keyChain = ""; // reset keyChain + } + return { + command: command + }; + }; + this.getStatusText = function(editor, data) { + return data.$keyChain || ""; + }; + }).call(HashHandler.prototype); + exports.HashHandler = HashHandler; + exports.MultiHashHandler = MultiHashHandler; +}); +ace.define("ace/commands/command_manager", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/keyboard/hash_handler", + "ace/lib/event_emitter" +], function(require, exports, module1) { + "use strict"; + var oop = require("../lib/oop"); + var MultiHashHandler = require("../keyboard/hash_handler").MultiHashHandler; + var EventEmitter = require("../lib/event_emitter").EventEmitter; + var CommandManager = function(platform, commands) { + MultiHashHandler.call(this, commands, platform); + this.byName = this.commands; + this.setDefaultHandler("exec", function(e) { + if (!e.args) return e.command.exec(e.editor, {}, e.event, true); + return e.command.exec(e.editor, e.args, e.event, false); + }); + }; + oop.inherits(CommandManager, MultiHashHandler); + (function() { + oop.implement(this, EventEmitter); + this.exec = function(command, editor, args) { + if (Array.isArray(command)) { + for(var i = command.length; i--;){ + if (this.exec(command[i], editor, args)) return true; + } + return false; + } + if (typeof command === "string") command = this.commands[command]; + if (!command) return false; + if (editor && editor.$readOnly && !command.readOnly) return false; + if (this.$checkCommandState != false && command.isAvailable && !command.isAvailable(editor)) return false; + var e = { + editor: editor, + command: command, + args: args + }; + e.returnValue = this._emit("exec", e); + this._signal("afterExec", e); + return e.returnValue === false ? false : true; + }; + this.toggleRecording = function(editor) { + if (this.$inReplay) return; + editor && editor._emit("changeStatus"); + if (this.recording) { + this.macro.pop(); + this.off("exec", this.$addCommandToMacro); + if (!this.macro.length) this.macro = this.oldMacro; + return this.recording = false; + } + if (!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); + return this.recording = true; + }; + this.replay = function(editor) { + if (this.$inReplay || !this.macro) return; + if (this.recording) return this.toggleRecording(editor); + try { + this.$inReplay = true; + this.macro.forEach(function(x) { + if (typeof x == "string") this.exec(x, editor); + else this.exec(x[0], editor, x[1]); + }, this); + } finally{ + this.$inReplay = false; + } + }; + this.trimMacro = function(m) { + return m.map(function(x) { + if (typeof x[0] != "string") x[0] = x[0].name; + if (!x[1]) x = x[0]; + return x; + }); + }; + }).call(CommandManager.prototype); + exports.CommandManager = CommandManager; +}); +ace.define("ace/commands/default_commands", [ + "require", + "exports", + "module", + "ace/lib/lang", + "ace/config", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var lang = require("../lib/lang"); + var config = require("../config"); + var Range = require("../range").Range; + function bindKey(win, mac) { + return { + win: win, + mac: mac + }; + } + exports.commands = [ + { + name: "showSettingsMenu", + description: "Show settings menu", + bindKey: bindKey("Ctrl-,", "Command-,"), + exec: function(editor) { + config.loadModule("ace/ext/settings_menu", function(module1) { + module1.init(editor); + editor.showSettingsMenu(); + }); + }, + readOnly: true + }, + { + name: "goToNextError", + description: "Go to next error", + bindKey: bindKey("Alt-E", "F4"), + exec: function(editor) { + config.loadModule("./ext/error_marker", function(module1) { + module1.showErrorMarker(editor, 1); + }); + }, + scrollIntoView: "animate", + readOnly: true + }, + { + name: "goToPreviousError", + description: "Go to previous error", + bindKey: bindKey("Alt-Shift-E", "Shift-F4"), + exec: function(editor) { + config.loadModule("./ext/error_marker", function(module1) { + module1.showErrorMarker(editor, -1); + }); + }, + scrollIntoView: "animate", + readOnly: true + }, + { + name: "selectall", + description: "Select all", + bindKey: bindKey("Ctrl-A", "Command-A"), + exec: function(editor) { + editor.selectAll(); + }, + readOnly: true + }, + { + name: "centerselection", + description: "Center selection", + bindKey: bindKey(null, "Ctrl-L"), + exec: function(editor) { + editor.centerSelection(); + }, + readOnly: true + }, + { + name: "gotoline", + description: "Go to line...", + bindKey: bindKey("Ctrl-L", "Command-L"), + exec: function(editor, line) { + if (typeof line === "number" && !isNaN(line)) editor.gotoLine(line); + editor.prompt({ + $type: "gotoLine" + }); + }, + readOnly: true + }, + { + name: "fold", + bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"), + exec: function(editor) { + editor.session.toggleFold(false); + }, + multiSelectAction: "forEach", + scrollIntoView: "center", + readOnly: true + }, + { + name: "unfold", + bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"), + exec: function(editor) { + editor.session.toggleFold(true); + }, + multiSelectAction: "forEach", + scrollIntoView: "center", + readOnly: true + }, + { + name: "toggleFoldWidget", + description: "Toggle fold widget", + bindKey: bindKey("F2", "F2"), + exec: function(editor) { + editor.session.toggleFoldWidget(); + }, + multiSelectAction: "forEach", + scrollIntoView: "center", + readOnly: true + }, + { + name: "toggleParentFoldWidget", + description: "Toggle parent fold widget", + bindKey: bindKey("Alt-F2", "Alt-F2"), + exec: function(editor) { + editor.session.toggleFoldWidget(true); + }, + multiSelectAction: "forEach", + scrollIntoView: "center", + readOnly: true + }, + { + name: "foldall", + description: "Fold all", + bindKey: bindKey(null, "Ctrl-Command-Option-0"), + exec: function(editor) { + editor.session.foldAll(); + }, + scrollIntoView: "center", + readOnly: true + }, + { + name: "foldAllComments", + description: "Fold all comments", + bindKey: bindKey(null, "Ctrl-Command-Option-0"), + exec: function(editor) { + editor.session.foldAllComments(); + }, + scrollIntoView: "center", + readOnly: true + }, + { + name: "foldOther", + description: "Fold other", + bindKey: bindKey("Alt-0", "Command-Option-0"), + exec: function(editor) { + editor.session.foldAll(); + editor.session.unfold(editor.selection.getAllRanges()); + }, + scrollIntoView: "center", + readOnly: true + }, + { + name: "unfoldall", + description: "Unfold all", + bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"), + exec: function(editor) { + editor.session.unfold(); + }, + scrollIntoView: "center", + readOnly: true + }, + { + name: "findnext", + description: "Find next", + bindKey: bindKey("Ctrl-K", "Command-G"), + exec: function(editor) { + editor.findNext(); + }, + multiSelectAction: "forEach", + scrollIntoView: "center", + readOnly: true + }, + { + name: "findprevious", + description: "Find previous", + bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"), + exec: function(editor) { + editor.findPrevious(); + }, + multiSelectAction: "forEach", + scrollIntoView: "center", + readOnly: true + }, + { + name: "selectOrFindNext", + description: "Select or find next", + bindKey: bindKey("Alt-K", "Ctrl-G"), + exec: function(editor) { + if (editor.selection.isEmpty()) editor.selection.selectWord(); + else editor.findNext(); + }, + readOnly: true + }, + { + name: "selectOrFindPrevious", + description: "Select or find previous", + bindKey: bindKey("Alt-Shift-K", "Ctrl-Shift-G"), + exec: function(editor) { + if (editor.selection.isEmpty()) editor.selection.selectWord(); + else editor.findPrevious(); + }, + readOnly: true + }, + { + name: "find", + description: "Find", + bindKey: bindKey("Ctrl-F", "Command-F"), + exec: function(editor) { + config.loadModule("ace/ext/searchbox", function(e) { + e.Search(editor); + }); + }, + readOnly: true + }, + { + name: "overwrite", + description: "Overwrite", + bindKey: "Insert", + exec: function(editor) { + editor.toggleOverwrite(); + }, + readOnly: true + }, + { + name: "selecttostart", + description: "Select to start", + bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Home|Command-Shift-Up"), + exec: function(editor) { + editor.getSelection().selectFileStart(); + }, + multiSelectAction: "forEach", + readOnly: true, + scrollIntoView: "animate", + aceCommandGroup: "fileJump" + }, + { + name: "gotostart", + description: "Go to start", + bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"), + exec: function(editor) { + editor.navigateFileStart(); + }, + multiSelectAction: "forEach", + readOnly: true, + scrollIntoView: "animate", + aceCommandGroup: "fileJump" + }, + { + name: "selectup", + description: "Select up", + bindKey: bindKey("Shift-Up", "Shift-Up|Ctrl-Shift-P"), + exec: function(editor) { + editor.getSelection().selectUp(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "golineup", + description: "Go line up", + bindKey: bindKey("Up", "Up|Ctrl-P"), + exec: function(editor, args) { + editor.navigateUp(args.times); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selecttoend", + description: "Select to end", + bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-End|Command-Shift-Down"), + exec: function(editor) { + editor.getSelection().selectFileEnd(); + }, + multiSelectAction: "forEach", + readOnly: true, + scrollIntoView: "animate", + aceCommandGroup: "fileJump" + }, + { + name: "gotoend", + description: "Go to end", + bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"), + exec: function(editor) { + editor.navigateFileEnd(); + }, + multiSelectAction: "forEach", + readOnly: true, + scrollIntoView: "animate", + aceCommandGroup: "fileJump" + }, + { + name: "selectdown", + description: "Select down", + bindKey: bindKey("Shift-Down", "Shift-Down|Ctrl-Shift-N"), + exec: function(editor) { + editor.getSelection().selectDown(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "golinedown", + description: "Go line down", + bindKey: bindKey("Down", "Down|Ctrl-N"), + exec: function(editor, args) { + editor.navigateDown(args.times); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selectwordleft", + description: "Select word left", + bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"), + exec: function(editor) { + editor.getSelection().selectWordLeft(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "gotowordleft", + description: "Go to word left", + bindKey: bindKey("Ctrl-Left", "Option-Left"), + exec: function(editor) { + editor.navigateWordLeft(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selecttolinestart", + description: "Select to line start", + bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left|Ctrl-Shift-A"), + exec: function(editor) { + editor.getSelection().selectLineStart(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "gotolinestart", + description: "Go to line start", + bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"), + exec: function(editor) { + editor.navigateLineStart(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selectleft", + description: "Select left", + bindKey: bindKey("Shift-Left", "Shift-Left|Ctrl-Shift-B"), + exec: function(editor) { + editor.getSelection().selectLeft(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "gotoleft", + description: "Go to left", + bindKey: bindKey("Left", "Left|Ctrl-B"), + exec: function(editor, args) { + editor.navigateLeft(args.times); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selectwordright", + description: "Select word right", + bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"), + exec: function(editor) { + editor.getSelection().selectWordRight(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "gotowordright", + description: "Go to word right", + bindKey: bindKey("Ctrl-Right", "Option-Right"), + exec: function(editor) { + editor.navigateWordRight(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selecttolineend", + description: "Select to line end", + bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right|Shift-End|Ctrl-Shift-E"), + exec: function(editor) { + editor.getSelection().selectLineEnd(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "gotolineend", + description: "Go to line end", + bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"), + exec: function(editor) { + editor.navigateLineEnd(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selectright", + description: "Select right", + bindKey: bindKey("Shift-Right", "Shift-Right"), + exec: function(editor) { + editor.getSelection().selectRight(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "gotoright", + description: "Go to right", + bindKey: bindKey("Right", "Right|Ctrl-F"), + exec: function(editor, args) { + editor.navigateRight(args.times); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selectpagedown", + description: "Select page down", + bindKey: "Shift-PageDown", + exec: function(editor) { + editor.selectPageDown(); + }, + readOnly: true + }, + { + name: "pagedown", + description: "Page down", + bindKey: bindKey(null, "Option-PageDown"), + exec: function(editor) { + editor.scrollPageDown(); + }, + readOnly: true + }, + { + name: "gotopagedown", + description: "Go to page down", + bindKey: bindKey("PageDown", "PageDown|Ctrl-V"), + exec: function(editor) { + editor.gotoPageDown(); + }, + readOnly: true + }, + { + name: "selectpageup", + description: "Select page up", + bindKey: "Shift-PageUp", + exec: function(editor) { + editor.selectPageUp(); + }, + readOnly: true + }, + { + name: "pageup", + description: "Page up", + bindKey: bindKey(null, "Option-PageUp"), + exec: function(editor) { + editor.scrollPageUp(); + }, + readOnly: true + }, + { + name: "gotopageup", + description: "Go to page up", + bindKey: "PageUp", + exec: function(editor) { + editor.gotoPageUp(); + }, + readOnly: true + }, + { + name: "scrollup", + description: "Scroll up", + bindKey: bindKey("Ctrl-Up", null), + exec: function(e) { + e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); + }, + readOnly: true + }, + { + name: "scrolldown", + description: "Scroll down", + bindKey: bindKey("Ctrl-Down", null), + exec: function(e) { + e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); + }, + readOnly: true + }, + { + name: "selectlinestart", + description: "Select line start", + bindKey: "Shift-Home", + exec: function(editor) { + editor.getSelection().selectLineStart(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selectlineend", + description: "Select line end", + bindKey: "Shift-End", + exec: function(editor) { + editor.getSelection().selectLineEnd(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "togglerecording", + description: "Toggle recording", + bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"), + exec: function(editor) { + editor.commands.toggleRecording(editor); + }, + readOnly: true + }, + { + name: "replaymacro", + description: "Replay macro", + bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"), + exec: function(editor) { + editor.commands.replay(editor); + }, + readOnly: true + }, + { + name: "jumptomatching", + description: "Jump to matching", + bindKey: bindKey("Ctrl-\\|Ctrl-P", "Command-\\"), + exec: function(editor) { + editor.jumpToMatching(); + }, + multiSelectAction: "forEach", + scrollIntoView: "animate", + readOnly: true + }, + { + name: "selecttomatching", + description: "Select to matching", + bindKey: bindKey("Ctrl-Shift-\\|Ctrl-Shift-P", "Command-Shift-\\"), + exec: function(editor) { + editor.jumpToMatching(true); + }, + multiSelectAction: "forEach", + scrollIntoView: "animate", + readOnly: true + }, + { + name: "expandToMatching", + description: "Expand to matching", + bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"), + exec: function(editor) { + editor.jumpToMatching(true, true); + }, + multiSelectAction: "forEach", + scrollIntoView: "animate", + readOnly: true + }, + { + name: "passKeysToBrowser", + description: "Pass keys to browser", + bindKey: bindKey(null, null), + exec: function() {}, + passEvent: true, + readOnly: true + }, + { + name: "copy", + description: "Copy", + exec: function(editor) {}, + readOnly: true + }, + { + name: "cut", + description: "Cut", + exec: function(editor) { + var cutLine = editor.$copyWithEmptySelection && editor.selection.isEmpty(); + var range = cutLine ? editor.selection.getLineRange() : editor.selection.getRange(); + editor._emit("cut", range); + if (!range.isEmpty()) editor.session.remove(range); + editor.clearSelection(); + }, + scrollIntoView: "cursor", + multiSelectAction: "forEach" + }, + { + name: "paste", + description: "Paste", + exec: function(editor, args) { + editor.$handlePaste(args); + }, + scrollIntoView: "cursor" + }, + { + name: "removeline", + description: "Remove line", + bindKey: bindKey("Ctrl-D", "Command-D"), + exec: function(editor) { + editor.removeLines(); + }, + scrollIntoView: "cursor", + multiSelectAction: "forEachLine" + }, + { + name: "duplicateSelection", + description: "Duplicate selection", + bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"), + exec: function(editor) { + editor.duplicateSelection(); + }, + scrollIntoView: "cursor", + multiSelectAction: "forEach" + }, + { + name: "sortlines", + description: "Sort lines", + bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"), + exec: function(editor) { + editor.sortLines(); + }, + scrollIntoView: "selection", + multiSelectAction: "forEachLine" + }, + { + name: "togglecomment", + description: "Toggle comment", + bindKey: bindKey("Ctrl-/", "Command-/"), + exec: function(editor) { + editor.toggleCommentLines(); + }, + multiSelectAction: "forEachLine", + scrollIntoView: "selectionPart" + }, + { + name: "toggleBlockComment", + description: "Toggle block comment", + bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"), + exec: function(editor) { + editor.toggleBlockComment(); + }, + multiSelectAction: "forEach", + scrollIntoView: "selectionPart" + }, + { + name: "modifyNumberUp", + description: "Modify number up", + bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"), + exec: function(editor) { + editor.modifyNumber(1); + }, + scrollIntoView: "cursor", + multiSelectAction: "forEach" + }, + { + name: "modifyNumberDown", + description: "Modify number down", + bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"), + exec: function(editor) { + editor.modifyNumber(-1); + }, + scrollIntoView: "cursor", + multiSelectAction: "forEach" + }, + { + name: "replace", + description: "Replace", + bindKey: bindKey("Ctrl-H", "Command-Option-F"), + exec: function(editor) { + config.loadModule("ace/ext/searchbox", function(e) { + e.Search(editor, true); + }); + } + }, + { + name: "undo", + description: "Undo", + bindKey: bindKey("Ctrl-Z", "Command-Z"), + exec: function(editor) { + editor.undo(); + } + }, + { + name: "redo", + description: "Redo", + bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"), + exec: function(editor) { + editor.redo(); + } + }, + { + name: "copylinesup", + description: "Copy lines up", + bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"), + exec: function(editor) { + editor.copyLinesUp(); + }, + scrollIntoView: "cursor" + }, + { + name: "movelinesup", + description: "Move lines up", + bindKey: bindKey("Alt-Up", "Option-Up"), + exec: function(editor) { + editor.moveLinesUp(); + }, + scrollIntoView: "cursor" + }, + { + name: "copylinesdown", + description: "Copy lines down", + bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"), + exec: function(editor) { + editor.copyLinesDown(); + }, + scrollIntoView: "cursor" + }, + { + name: "movelinesdown", + description: "Move lines down", + bindKey: bindKey("Alt-Down", "Option-Down"), + exec: function(editor) { + editor.moveLinesDown(); + }, + scrollIntoView: "cursor" + }, + { + name: "del", + description: "Delete", + bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"), + exec: function(editor) { + editor.remove("right"); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "backspace", + description: "Backspace", + bindKey: bindKey("Shift-Backspace|Backspace", "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"), + exec: function(editor) { + editor.remove("left"); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "cut_or_delete", + description: "Cut or delete", + bindKey: bindKey("Shift-Delete", null), + exec: function(editor) { + if (editor.selection.isEmpty()) editor.remove("left"); + else return false; + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "removetolinestart", + description: "Remove to line start", + bindKey: bindKey("Alt-Backspace", "Command-Backspace"), + exec: function(editor) { + editor.removeToLineStart(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "removetolineend", + description: "Remove to line end", + bindKey: bindKey("Alt-Delete", "Ctrl-K|Command-Delete"), + exec: function(editor) { + editor.removeToLineEnd(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "removetolinestarthard", + description: "Remove to line start hard", + bindKey: bindKey("Ctrl-Shift-Backspace", null), + exec: function(editor) { + var range = editor.selection.getRange(); + range.start.column = 0; + editor.session.remove(range); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "removetolineendhard", + description: "Remove to line end hard", + bindKey: bindKey("Ctrl-Shift-Delete", null), + exec: function(editor) { + var range = editor.selection.getRange(); + range.end.column = Number.MAX_VALUE; + editor.session.remove(range); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "removewordleft", + description: "Remove word left", + bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"), + exec: function(editor) { + editor.removeWordLeft(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "removewordright", + description: "Remove word right", + bindKey: bindKey("Ctrl-Delete", "Alt-Delete"), + exec: function(editor) { + editor.removeWordRight(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "outdent", + description: "Outdent", + bindKey: bindKey("Shift-Tab", "Shift-Tab"), + exec: function(editor) { + editor.blockOutdent(); + }, + multiSelectAction: "forEach", + scrollIntoView: "selectionPart" + }, + { + name: "indent", + description: "Indent", + bindKey: bindKey("Tab", "Tab"), + exec: function(editor) { + editor.indent(); + }, + multiSelectAction: "forEach", + scrollIntoView: "selectionPart" + }, + { + name: "blockoutdent", + description: "Block outdent", + bindKey: bindKey("Ctrl-[", "Ctrl-["), + exec: function(editor) { + editor.blockOutdent(); + }, + multiSelectAction: "forEachLine", + scrollIntoView: "selectionPart" + }, + { + name: "blockindent", + description: "Block indent", + bindKey: bindKey("Ctrl-]", "Ctrl-]"), + exec: function(editor) { + editor.blockIndent(); + }, + multiSelectAction: "forEachLine", + scrollIntoView: "selectionPart" + }, + { + name: "insertstring", + description: "Insert string", + exec: function(editor, str) { + editor.insert(str); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "inserttext", + description: "Insert text", + exec: function(editor, args) { + editor.insert(lang.stringRepeat(args.text || "", args.times || 1)); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "splitline", + description: "Split line", + bindKey: bindKey(null, "Ctrl-O"), + exec: function(editor) { + editor.splitLine(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "transposeletters", + description: "Transpose letters", + bindKey: bindKey("Alt-Shift-X", "Ctrl-T"), + exec: function(editor) { + editor.transposeLetters(); + }, + multiSelectAction: function(editor) { + editor.transposeSelections(1); + }, + scrollIntoView: "cursor" + }, + { + name: "touppercase", + description: "To uppercase", + bindKey: bindKey("Ctrl-U", "Ctrl-U"), + exec: function(editor) { + editor.toUpperCase(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "tolowercase", + description: "To lowercase", + bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"), + exec: function(editor) { + editor.toLowerCase(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "autoindent", + description: "Auto Indent", + bindKey: bindKey(null, null), + exec: function(editor) { + editor.autoIndent(); + }, + multiSelectAction: "forEachLine", + scrollIntoView: "animate" + }, + { + name: "expandtoline", + description: "Expand to line", + bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"), + exec: function(editor) { + var range = editor.selection.getRange(); + range.start.column = range.end.column = 0; + range.end.row++; + editor.selection.setRange(range, false); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "openlink", + bindKey: bindKey("Ctrl+F3", "F3"), + exec: function(editor) { + editor.openLink(); + } + }, + { + name: "joinlines", + description: "Join lines", + bindKey: bindKey(null, null), + exec: function(editor) { + var isBackwards = editor.selection.isBackwards(); + var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor(); + var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead(); + var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length; + var selectedText = editor.session.doc.getTextRange(editor.selection.getRange()); + var selectedCount = selectedText.replace(/\n\s*/, " ").length; + var insertLine = editor.session.doc.getLine(selectionStart.row); + for(var i = selectionStart.row + 1; i <= selectionEnd.row + 1; i++){ + var curLine = lang.stringTrimLeft(lang.stringTrimRight(editor.session.doc.getLine(i))); + if (curLine.length !== 0) curLine = " " + curLine; + insertLine += curLine; + } + if (selectionEnd.row + 1 < editor.session.doc.getLength() - 1) insertLine += editor.session.doc.getNewLineCharacter(); + editor.clearSelection(); + editor.session.doc.replace(new Range(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine); + if (selectedCount > 0) { + editor.selection.moveCursorTo(selectionStart.row, selectionStart.column); + editor.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount); + } else { + firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? firstLineEndCol + 1 : firstLineEndCol; + editor.selection.moveCursorTo(selectionStart.row, firstLineEndCol); + } + }, + multiSelectAction: "forEach", + readOnly: true + }, + { + name: "invertSelection", + description: "Invert selection", + bindKey: bindKey(null, null), + exec: function(editor) { + var endRow = editor.session.doc.getLength() - 1; + var endCol = editor.session.doc.getLine(endRow).length; + var ranges = editor.selection.rangeList.ranges; + var newRanges = []; + if (ranges.length < 1) ranges = [ + editor.selection.getRange() + ]; + for(var i = 0; i < ranges.length; i++){ + if (i == ranges.length - 1) { + if (!(ranges[i].end.row === endRow && ranges[i].end.column === endCol)) newRanges.push(new Range(ranges[i].end.row, ranges[i].end.column, endRow, endCol)); + } + if (i === 0) { + if (!(ranges[i].start.row === 0 && ranges[i].start.column === 0)) newRanges.push(new Range(0, 0, ranges[i].start.row, ranges[i].start.column)); + } else newRanges.push(new Range(ranges[i - 1].end.row, ranges[i - 1].end.column, ranges[i].start.row, ranges[i].start.column)); + } + editor.exitMultiSelectMode(); + editor.clearSelection(); + for(var i = 0; i < newRanges.length; i++)editor.selection.addRange(newRanges[i], false); + }, + readOnly: true, + scrollIntoView: "none" + }, + { + name: "addLineAfter", + description: "Add new line after the current line", + exec: function(editor) { + editor.selection.clearSelection(); + editor.navigateLineEnd(); + editor.insert("\n"); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "addLineBefore", + description: "Add new line before the current line", + exec: function(editor) { + editor.selection.clearSelection(); + var cursor = editor.getCursorPosition(); + editor.selection.moveTo(cursor.row - 1, Number.MAX_VALUE); + editor.insert("\n"); + if (cursor.row === 0) editor.navigateUp(); + }, + multiSelectAction: "forEach", + scrollIntoView: "cursor" + }, + { + name: "openCommandPallete", + description: "Open command palette", + bindKey: bindKey("F1", "F1"), + exec: function(editor) { + editor.prompt({ + $type: "commands" + }); + }, + readOnly: true + }, + { + name: "modeSelect", + description: "Change language mode...", + bindKey: bindKey(null, null), + exec: function(editor) { + editor.prompt({ + $type: "modes" + }); + }, + readOnly: true + } + ]; + for(var i = 1; i < 9; i++)exports.commands.push({ + name: "foldToLevel" + i, + description: "Fold To Level " + i, + level: i, + exec: function(editor) { + editor.session.foldToLevel(this.level); + }, + scrollIntoView: "center", + readOnly: true + }); +}); +ace.define("ace/editor", [ + "require", + "exports", + "module", + "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(require, exports, module1) { + "use strict"; + var __values = this && this.__values || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function() { + if (o && i >= o.length) o = void 0; + return { + value: o && o[i++], + done: !o + }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + var oop = require("./lib/oop"); + var dom = require("./lib/dom"); + var lang = require("./lib/lang"); + var useragent = require("./lib/useragent"); + var TextInput = require("./keyboard/textinput").TextInput; + var MouseHandler = require("./mouse/mouse_handler").MouseHandler; + var FoldHandler = require("./mouse/fold_handler").FoldHandler; + var KeyBinding = require("./keyboard/keybinding").KeyBinding; + var EditSession = require("./edit_session").EditSession; + var Search = require("./search").Search; + var Range = require("./range").Range; + var EventEmitter = require("./lib/event_emitter").EventEmitter; + var CommandManager = require("./commands/command_manager").CommandManager; + var defaultCommands = require("./commands/default_commands").commands; + var config = require("./config"); + var TokenIterator = require("./token_iterator").TokenIterator; + var clipboard = require("./clipboard"); + var Editor = function(renderer, session, options) { + this.$toDestroy = []; + var container = renderer.getContainerElement(); + this.container = container; + this.renderer = renderer; + this.id = "editor" + ++Editor.$uid; + this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands); + if (typeof document == "object") { + this.textInput = new TextInput(renderer.getTextAreaContainer(), this); + this.renderer.textarea = this.textInput.getElement(); + this.$mouseHandler = new MouseHandler(this); + new FoldHandler(this); + } + this.keyBinding = new KeyBinding(this); + this.$search = new Search().set({ + wrap: true + }); + this.$historyTracker = this.$historyTracker.bind(this); + this.commands.on("exec", this.$historyTracker); + this.$initOperationListeners(); + this._$emitInputEvent = lang.delayedCall((function() { + this._signal("input", {}); + if (this.session && !this.session.destroyed) this.session.bgTokenizer.scheduleStart(); + }).bind(this)); + this.on("change", function(_, _self) { + _self._$emitInputEvent.schedule(31); + }); + this.setSession(session || options && options.session || new EditSession("")); + config.resetOptions(this); + if (options) this.setOptions(options); + config._signal("editor", this); + }; + Editor.$uid = 0; + (function() { + oop.implement(this, EventEmitter); + this.$initOperationListeners = function() { + this.commands.on("exec", this.startOperation.bind(this), true); + this.commands.on("afterExec", this.endOperation.bind(this), true); + this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this, true)); + this.on("change", (function() { + if (!this.curOp) { + this.startOperation(); + this.curOp.selectionBefore = this.$lastSel; + } + this.curOp.docChanged = true; + }).bind(this), true); + this.on("changeSelection", (function() { + if (!this.curOp) { + this.startOperation(); + this.curOp.selectionBefore = this.$lastSel; + } + this.curOp.selectionChanged = true; + }).bind(this), true); + }; + this.curOp = null; + this.prevOp = {}; + this.startOperation = function(commandEvent) { + if (this.curOp) { + if (!commandEvent || this.curOp.command) return; + this.prevOp = this.curOp; + } + if (!commandEvent) { + this.previousCommand = null; + commandEvent = {}; + } + this.$opResetTimer.schedule(); + this.curOp = this.session.curOp = { + command: commandEvent.command || {}, + args: commandEvent.args, + scrollTop: this.renderer.scrollTop + }; + this.curOp.selectionBefore = this.selection.toJSON(); + }; + this.endOperation = function(e) { + if (this.curOp && this.session) { + if (e && e.returnValue === false || !this.session) return this.curOp = null; + if (e == true && this.curOp.command && this.curOp.command.name == "mouse") return; + this._signal("beforeEndOperation"); + if (!this.curOp) return; + var command = this.curOp.command; + var scrollIntoView = command && command.scrollIntoView; + if (scrollIntoView) { + switch(scrollIntoView){ + case "center-animate": + scrollIntoView = "animate"; + case "center": + this.renderer.scrollCursorIntoView(null, 0.5); + break; + case "animate": + case "cursor": + this.renderer.scrollCursorIntoView(); + break; + case "selectionPart": + var range = this.selection.getRange(); + var config = this.renderer.layerConfig; + if (range.start.row >= config.lastRow || range.end.row <= config.firstRow) this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead); + break; + default: + break; + } + if (scrollIntoView == "animate") this.renderer.animateScrolling(this.curOp.scrollTop); + } + var sel = this.selection.toJSON(); + this.curOp.selectionAfter = sel; + this.$lastSel = this.selection.toJSON(); + this.session.getUndoManager().addSelection(sel); + this.prevOp = this.curOp; + this.curOp = null; + } + }; + this.$mergeableCommands = [ + "backspace", + "del", + "insertstring" + ]; + this.$historyTracker = function(e) { + if (!this.$mergeUndoDeltas) return; + var prev = this.prevOp; + var mergeableCommands = this.$mergeableCommands; + var shouldMerge = prev.command && e.command.name == prev.command.name; + if (e.command.name == "insertstring") { + var text = e.args; + if (this.mergeNextCommand === undefined) this.mergeNextCommand = true; + shouldMerge = shouldMerge && this.mergeNextCommand // previous command allows to coalesce with + && (!/\s/.test(text) || /\s/.test(prev.args)); // previous insertion was of same type + this.mergeNextCommand = true; + } else shouldMerge = shouldMerge && mergeableCommands.indexOf(e.command.name) !== -1; // the command is mergeable + if (this.$mergeUndoDeltas != "always" && Date.now() - this.sequenceStartTime > 2000) shouldMerge = false; // the sequence is too long + if (shouldMerge) this.session.mergeUndoDeltas = true; + else if (mergeableCommands.indexOf(e.command.name) !== -1) this.sequenceStartTime = Date.now(); + }; + this.setKeyboardHandler = function(keyboardHandler, cb) { + if (keyboardHandler && typeof keyboardHandler === "string" && keyboardHandler != "ace") { + this.$keybindingId = keyboardHandler; + var _self = this; + config.loadModule([ + "keybinding", + keyboardHandler + ], function(module1) { + if (_self.$keybindingId == keyboardHandler) _self.keyBinding.setKeyboardHandler(module1 && module1.handler); + cb && cb(); + }); + } else { + this.$keybindingId = null; + this.keyBinding.setKeyboardHandler(keyboardHandler); + cb && cb(); + } + }; + this.getKeyboardHandler = function() { + return this.keyBinding.getKeyboardHandler(); + }; + this.setSession = function(session) { + if (this.session == session) return; + if (this.curOp) this.endOperation(); + this.curOp = {}; + var oldSession = this.session; + if (oldSession) { + 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 selection = this.session.getSelection(); + selection.off("changeCursor", this.$onCursorChange); + selection.off("changeSelection", this.$onSelectionChange); + } + this.session = session; + if (session) { + this.$onDocumentChange = this.onDocumentChange.bind(this); + session.on("change", this.$onDocumentChange); + this.renderer.setSession(session); + this.$onChangeMode = this.onChangeMode.bind(this); + session.on("changeMode", this.$onChangeMode); + this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this); + session.on("tokenizerUpdate", this.$onTokenizerUpdate); + this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer); + session.on("changeTabSize", this.$onChangeTabSize); + this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this); + session.on("changeWrapLimit", this.$onChangeWrapLimit); + this.$onChangeWrapMode = this.onChangeWrapMode.bind(this); + session.on("changeWrapMode", this.$onChangeWrapMode); + this.$onChangeFold = this.onChangeFold.bind(this); + session.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 = session.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(); + } else { + this.selection = null; + this.renderer.setSession(session); + } + this._signal("changeSession", { + session: session, + oldSession: oldSession + }); + this.curOp = null; + oldSession && oldSession._signal("changeEditor", { + oldEditor: this + }); + session && session._signal("changeEditor", { + editor: this + }); + if (session && !session.destroyed) session.bgTokenizer.scheduleStart(); + }; + this.getSession = function() { + return this.session; + }; + this.setValue = function(val, cursorPos) { + this.session.doc.setValue(val); + if (!cursorPos) this.selectAll(); + else if (cursorPos == 1) this.navigateFileEnd(); + else if (cursorPos == -1) this.navigateFileStart(); + return val; + }; + this.getValue = function() { + return this.session.getValue(); + }; + this.getSelection = function() { + return this.selection; + }; + this.resize = function(force) { + this.renderer.onResize(force); + }; + this.setTheme = function(theme, cb) { + this.renderer.setTheme(theme, cb); + }; + this.getTheme = function() { + return this.renderer.getTheme(); + }; + this.setStyle = function(style) { + this.renderer.setStyle(style); + }; + this.unsetStyle = function(style) { + this.renderer.unsetStyle(style); + }; + this.getFontSize = function() { + return this.getOption("fontSize") || dom.computedStyle(this.container).fontSize; + }; + this.setFontSize = function(size) { + this.setOption("fontSize", size); + }; + this.$highlightBrackets = function() { + if (this.$highlightPending) return; + var self = this; + this.$highlightPending = true; + setTimeout(function() { + self.$highlightPending = false; + var session = self.session; + if (!session || session.destroyed) return; + if (session.$bracketHighlight) { + session.$bracketHighlight.markerIds.forEach(function(id) { + session.removeMarker(id); + }); + session.$bracketHighlight = null; + } + var pos = self.getCursorPosition(); + var handler = self.getKeyboardHandler(); + var isBackwards = handler && handler.$getDirectionForHighlight && handler.$getDirectionForHighlight(self); + var ranges = session.getMatchingBracketRanges(pos, isBackwards); + if (!ranges) { + var iterator = new TokenIterator(session, pos.row, pos.column); + var token = iterator.getCurrentToken(); + if (token && /\b(?:tag-open|tag-name)/.test(token.type)) { + var tagNamesRanges = session.getMatchingTags(pos); + if (tagNamesRanges) ranges = [ + tagNamesRanges.openTagName, + tagNamesRanges.closeTagName + ]; + } + } + if (!ranges && session.$mode.getMatching) ranges = session.$mode.getMatching(self.session); + if (!ranges) { + if (self.getHighlightIndentGuides()) self.renderer.$textLayer.$highlightIndentGuide(); + return; + } + var markerType = "ace_bracket"; + if (!Array.isArray(ranges)) ranges = [ + ranges + ]; + else if (ranges.length == 1) markerType = "ace_error_bracket"; + if (ranges.length == 2) { + if (Range.comparePoints(ranges[0].end, ranges[1].start) == 0) ranges = [ + Range.fromPoints(ranges[0].start, ranges[1].end) + ]; + else if (Range.comparePoints(ranges[0].start, ranges[1].end) == 0) ranges = [ + Range.fromPoints(ranges[1].start, ranges[0].end) + ]; + } + session.$bracketHighlight = { + ranges: ranges, + markerIds: ranges.map(function(range) { + return session.addMarker(range, markerType, "text"); + }) + }; + if (self.getHighlightIndentGuides()) self.renderer.$textLayer.$highlightIndentGuide(); + }, 50); + }; + this.focus = function() { + 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 = true; + this.renderer.showCursor(); + this.renderer.visualizeFocus(); + this._emit("focus", e); + }; + this.onBlur = function(e) { + if (!this.$isFocused) return; + this.$isFocused = false; + this.renderer.hideCursor(); + this.renderer.visualizeBlur(); + this._emit("blur", e); + }; + this.$cursorChange = function() { + this.renderer.updateCursor(); + this.$highlightBrackets(); + this.$updateHighlightActiveLine(); + }; + this.onDocumentChange = function(delta) { + var wrap = this.session.$useWrapMode; + var lastRow = delta.start.row == delta.end.row ? delta.end.row : Infinity; + this.renderer.updateLines(delta.start.row, lastRow, wrap); + this._signal("change", delta); + this.$cursorChange(); + }; + this.onTokenizerUpdate = function(e) { + var rows = e.data; + this.renderer.updateLines(rows.first, rows.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._signal("changeSelection"); + }; + this.$updateHighlightActiveLine = function() { + var session = this.getSession(); + var highlight; + if (this.$highlightActiveLine) { + if (this.$selectionStyle != "line" || !this.selection.isMultiLine()) highlight = this.getCursorPosition(); + if (this.renderer.theme && this.renderer.theme.$selectionColorConflict && !this.selection.isEmpty()) highlight = false; + if (this.renderer.$maxLines && this.session.getLength() === 1 && !(this.renderer.$minLines > 1)) highlight = false; + } + if (session.$highlightLineMarker && !highlight) { + session.removeMarker(session.$highlightLineMarker.id); + session.$highlightLineMarker = null; + } else if (!session.$highlightLineMarker && highlight) { + var range = new Range(highlight.row, highlight.column, highlight.row, Infinity); + range.id = session.addMarker(range, "ace_active-line", "screenLine"); + session.$highlightLineMarker = range; + } else if (highlight) { + session.$highlightLineMarker.start.row = highlight.row; + session.$highlightLineMarker.end.row = highlight.row; + session.$highlightLineMarker.start.column = highlight.column; + session._signal("changeBackMarker"); + } + }; + this.onSelectionChange = function(e) { + var session = this.session; + if (session.$selectionMarker) session.removeMarker(session.$selectionMarker); + session.$selectionMarker = null; + if (!this.selection.isEmpty()) { + var range = this.selection.getRange(); + var style = this.getSelectionStyle(); + session.$selectionMarker = session.addMarker(range, "ace_selection", style); + } else this.$updateHighlightActiveLine(); + var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp(); + this.session.highlight(re); + this._signal("changeSelection"); + }; + this.$getSelectionHighLightRegexp = function() { + var session = this.session; + var selection = this.getSelectionRange(); + if (selection.isEmpty() || selection.isMultiLine()) return; + var startColumn = selection.start.column; + var endColumn = selection.end.column; + var line = session.getLine(selection.start.row); + var needle = line.substring(startColumn, endColumn); + if (needle.length > 5000 || !/[\w\d]/.test(needle)) return; + var re = this.$search.$assembleRegExp({ + wholeWord: true, + caseSensitive: true, + needle: needle + }); + var wordWithBoundary = line.substring(startColumn - 1, endColumn + 1); + if (!re.test(wordWithBoundary)) return; + return re; + }; + 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(true); + }; + this.onChangeFold = function() { + this.$updateHighlightActiveLine(); + this.renderer.updateFull(); + }; + this.getSelectedText = function() { + return this.session.getTextRange(this.getSelectionRange()); + }; + this.getCopyText = function() { + var text = this.getSelectedText(); + var nl = this.session.doc.getNewLineCharacter(); + var copyLine = false; + if (!text && this.$copyWithEmptySelection) { + copyLine = true; + var ranges = this.selection.getAllRanges(); + for(var i = 0; i < ranges.length; i++){ + var range = ranges[i]; + if (i && ranges[i - 1].start.row == range.start.row) continue; + text += this.session.getLine(range.start.row) + nl; + } + } + var e = { + text: text + }; + this._signal("copy", e); + clipboard.lineMode = copyLine ? e.text : false; + return e.text; + }; + this.onCopy = function() { + this.commands.exec("copy", this); + }; + this.onCut = function() { + this.commands.exec("cut", this); + }; + this.onPaste = function(text, event) { + var e = { + text: text, + event: event + }; + this.commands.exec("paste", this, e); + }; + this.$handlePaste = function(e) { + if (typeof e == "string") e = { + text: e + }; + this._signal("paste", e); + var text = e.text; + var lineMode = text === clipboard.lineMode; + var session = this.session; + if (!this.inMultiSelectMode || this.inVirtualSelectionMode) { + if (lineMode) session.insert({ + row: this.selection.lead.row, + column: 0 + }, text); + else this.insert(text); + } else if (lineMode) this.selection.rangeList.ranges.forEach(function(range) { + session.insert({ + row: range.start.row, + column: 0 + }, text); + }); + else { + var lines = text.split(/\r\n|\r|\n/); + var ranges = this.selection.rangeList.ranges; + var isFullLine = lines.length == 2 && (!lines[0] || !lines[1]); + if (lines.length != ranges.length || isFullLine) return this.commands.exec("insertstring", this, text); + for(var i = ranges.length; i--;){ + var range = ranges[i]; + if (!range.isEmpty()) session.remove(range); + session.insert(range.start, lines[i]); + } + } + }; + this.execCommand = function(command, args) { + return this.commands.exec(command, this, args); + }; + this.insert = function(text, pasted) { + var session = this.session; + var mode = session.getMode(); + var cursor = this.getCursorPosition(); + if (this.getBehavioursEnabled() && !pasted) { + var transform = mode.transformAction(session.getState(cursor.row), "insertion", this, session, text); + if (transform) { + if (text !== transform.text) { + if (!this.inVirtualSelectionMode) { + this.session.mergeUndoDeltas = false; + this.mergeNextCommand = false; + } + } + text = transform.text; + } + } + if (text == " ") text = this.session.getTabString(); + if (!this.selection.isEmpty()) { + var range = this.getSelectionRange(); + cursor = this.session.remove(range); + this.clearSelection(); + } else if (this.session.getOverwrite() && text.indexOf("\n") == -1) { + var range = new Range.fromPoints(cursor, cursor); + range.end.column += text.length; + this.session.remove(range); + } + if (text == "\n" || text == "\r\n") { + var line = session.getLine(cursor.row); + if (cursor.column > line.search(/\S|$/)) { + var d = line.substr(cursor.column).search(/\S|$/); + session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d); + } + } + this.clearSelection(); + var start = cursor.column; + var lineState = session.getState(cursor.row); + var line = session.getLine(cursor.row); + var shouldOutdent = mode.checkOutdent(lineState, line, text); + session.insert(cursor, text); + if (transform && transform.selection) { + if (transform.selection.length == 2) this.selection.setSelectionRange(new Range(cursor.row, start + transform.selection[0], cursor.row, start + transform.selection[1])); + else this.selection.setSelectionRange(new Range(cursor.row + transform.selection[0], transform.selection[1], cursor.row + transform.selection[2], transform.selection[3])); + } + if (this.$enableAutoIndent) { + if (session.getDocument().isNewLine(text)) { + var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString()); + session.insert({ + row: cursor.row + 1, + column: 0 + }, lineIndent); + } + if (shouldOutdent) mode.autoOutdent(lineState, session, cursor.row); + } + }; + this.autoIndent = function() { + var session = this.session; + var mode = session.getMode(); + var startRow, endRow; + if (this.selection.isEmpty()) { + startRow = 0; + endRow = session.doc.getLength() - 1; + } else { + var selectedRange = this.getSelectionRange(); + startRow = selectedRange.start.row; + endRow = selectedRange.end.row; + } + var prevLineState = ""; + var prevLine = ""; + var lineIndent = ""; + var line, currIndent, range; + var tab = session.getTabString(); + for(var row = startRow; row <= endRow; row++){ + if (row > 0) { + prevLineState = session.getState(row - 1); + prevLine = session.getLine(row - 1); + lineIndent = mode.getNextLineIndent(prevLineState, prevLine, tab); + } + line = session.getLine(row); + currIndent = mode.$getIndent(line); + if (lineIndent !== currIndent) { + if (currIndent.length > 0) { + range = new Range(row, 0, row, currIndent.length); + session.remove(range); + } + if (lineIndent.length > 0) session.insert({ + row: row, + column: 0 + }, lineIndent); + } + mode.autoOutdent(prevLineState, session, row); + } + }; + this.onTextInput = function(text, composition) { + if (!composition) return this.keyBinding.onTextInput(text); + this.startOperation({ + command: { + name: "insertstring" + } + }); + var applyComposition = this.applyComposition.bind(this, text, composition); + if (this.selection.rangeCount) this.forEachSelection(applyComposition); + else applyComposition(); + this.endOperation(); + }; + this.applyComposition = function(text, composition) { + if (composition.extendLeft || composition.extendRight) { + var r = this.selection.getRange(); + r.start.column -= composition.extendLeft; + r.end.column += composition.extendRight; + if (r.start.column < 0) { + r.start.row--; + r.start.column += this.session.getLine(r.start.row).length + 1; + } + this.selection.setRange(r); + if (!text && !r.isEmpty()) this.remove(); + } + if (text || !this.selection.isEmpty()) this.insert(text, true); + if (composition.restoreStart || composition.restoreEnd) { + var r = this.selection.getRange(); + r.start.column -= composition.restoreStart; + r.end.column -= composition.restoreEnd; + this.selection.setRange(r); + } + }; + this.onCommandKey = function(e, hashId, keyCode) { + return this.keyBinding.onCommandKey(e, hashId, keyCode); + }; + this.setOverwrite = function(overwrite) { + this.session.setOverwrite(overwrite); + }; + this.getOverwrite = function() { + return this.session.getOverwrite(); + }; + this.toggleOverwrite = function() { + this.session.toggleOverwrite(); + }; + this.setScrollSpeed = function(speed) { + this.setOption("scrollSpeed", speed); + }; + this.getScrollSpeed = function() { + return this.getOption("scrollSpeed"); + }; + this.setDragDelay = function(dragDelay) { + this.setOption("dragDelay", dragDelay); + }; + this.getDragDelay = function() { + return this.getOption("dragDelay"); + }; + this.setSelectionStyle = function(val) { + this.setOption("selectionStyle", val); + }; + this.getSelectionStyle = function() { + return this.getOption("selectionStyle"); + }; + this.setHighlightActiveLine = function(shouldHighlight) { + this.setOption("highlightActiveLine", shouldHighlight); + }; + this.getHighlightActiveLine = function() { + return this.getOption("highlightActiveLine"); + }; + this.setHighlightGutterLine = function(shouldHighlight) { + this.setOption("highlightGutterLine", shouldHighlight); + }; + this.getHighlightGutterLine = function() { + return this.getOption("highlightGutterLine"); + }; + this.setHighlightSelectedWord = function(shouldHighlight) { + this.setOption("highlightSelectedWord", shouldHighlight); + }; + this.getHighlightSelectedWord = function() { + return this.$highlightSelectedWord; + }; + this.setAnimatedScroll = function(shouldAnimate) { + this.renderer.setAnimatedScroll(shouldAnimate); + }; + this.getAnimatedScroll = function() { + return this.renderer.getAnimatedScroll(); + }; + this.setShowInvisibles = function(showInvisibles) { + this.renderer.setShowInvisibles(showInvisibles); + }; + this.getShowInvisibles = function() { + return this.renderer.getShowInvisibles(); + }; + this.setDisplayIndentGuides = function(display) { + this.renderer.setDisplayIndentGuides(display); + }; + this.getDisplayIndentGuides = function() { + return this.renderer.getDisplayIndentGuides(); + }; + this.setHighlightIndentGuides = function(highlight) { + this.renderer.setHighlightIndentGuides(highlight); + }; + this.getHighlightIndentGuides = function() { + return this.renderer.getHighlightIndentGuides(); + }; + this.setShowPrintMargin = function(showPrintMargin) { + this.renderer.setShowPrintMargin(showPrintMargin); + }; + this.getShowPrintMargin = function() { + return this.renderer.getShowPrintMargin(); + }; + this.setPrintMarginColumn = function(showPrintMargin) { + this.renderer.setPrintMarginColumn(showPrintMargin); + }; + this.getPrintMarginColumn = function() { + return this.renderer.getPrintMarginColumn(); + }; + this.setReadOnly = function(readOnly) { + this.setOption("readOnly", readOnly); + }; + this.getReadOnly = function() { + return this.getOption("readOnly"); + }; + this.setBehavioursEnabled = function(enabled) { + this.setOption("behavioursEnabled", enabled); + }; + this.getBehavioursEnabled = function() { + return this.getOption("behavioursEnabled"); + }; + this.setWrapBehavioursEnabled = function(enabled) { + this.setOption("wrapBehavioursEnabled", enabled); + }; + this.getWrapBehavioursEnabled = function() { + return this.getOption("wrapBehavioursEnabled"); + }; + this.setShowFoldWidgets = function(show) { + this.setOption("showFoldWidgets", show); + }; + this.getShowFoldWidgets = function() { + return this.getOption("showFoldWidgets"); + }; + this.setFadeFoldWidgets = function(fade) { + this.setOption("fadeFoldWidgets", fade); + }; + this.getFadeFoldWidgets = function() { + return this.getOption("fadeFoldWidgets"); + }; + this.remove = function(dir) { + if (this.selection.isEmpty()) { + if (dir == "left") this.selection.selectLeft(); + else this.selection.selectRight(); + } + var range = this.getSelectionRange(); + if (this.getBehavioursEnabled()) { + var session = this.session; + var state = session.getState(range.start.row); + var new_range = session.getMode().transformAction(state, "deletion", this, session, range); + if (range.end.column === 0) { + var text = session.getTextRange(range); + if (text[text.length - 1] == "\n") { + var line = session.getLine(range.end.row); + if (/^\s+$/.test(line)) range.end.column = line.length; + } + } + if (new_range) range = new_range; + } + this.session.remove(range); + this.clearSelection(); + }; + this.removeWordRight = function() { + if (this.selection.isEmpty()) this.selection.selectWordRight(); + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + this.removeWordLeft = function() { + if (this.selection.isEmpty()) this.selection.selectWordLeft(); + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + this.removeToLineStart = function() { + if (this.selection.isEmpty()) this.selection.selectLineStart(); + if (this.selection.isEmpty()) this.selection.selectLeft(); + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + }; + this.removeToLineEnd = function() { + if (this.selection.isEmpty()) this.selection.selectLineEnd(); + var range = this.getSelectionRange(); + if (range.start.column == range.end.column && range.start.row == range.end.row) { + range.end.column = 0; + range.end.row++; + } + this.session.remove(range); + this.clearSelection(); + }; + this.splitLine = function() { + if (!this.selection.isEmpty()) { + this.session.remove(this.getSelectionRange()); + this.clearSelection(); + } + var cursor = this.getCursorPosition(); + this.insert("\n"); + this.moveCursorToPosition(cursor); + }; + this.transposeLetters = function() { + if (!this.selection.isEmpty()) return; + var cursor = this.getCursorPosition(); + var column = cursor.column; + if (column === 0) return; + var line = this.session.getLine(cursor.row); + var swap, range; + if (column < line.length) { + swap = line.charAt(column) + line.charAt(column - 1); + range = new Range(cursor.row, column - 1, cursor.row, column + 1); + } else { + swap = line.charAt(column - 1) + line.charAt(column - 2); + range = new Range(cursor.row, column - 2, cursor.row, column); + } + this.session.replace(range, swap); + this.session.selection.moveToPosition(range.end); + }; + this.toLowerCase = function() { + var originalRange = this.getSelectionRange(); + if (this.selection.isEmpty()) this.selection.selectWord(); + var range = this.getSelectionRange(); + var text = this.session.getTextRange(range); + this.session.replace(range, text.toLowerCase()); + this.selection.setSelectionRange(originalRange); + }; + this.toUpperCase = function() { + var originalRange = this.getSelectionRange(); + if (this.selection.isEmpty()) this.selection.selectWord(); + var range = this.getSelectionRange(); + var text = this.session.getTextRange(range); + this.session.replace(range, text.toUpperCase()); + this.selection.setSelectionRange(originalRange); + }; + this.indent = function() { + var session = this.session; + var range = this.getSelectionRange(); + if (range.start.row < range.end.row) { + var rows = this.$getSelectedRows(); + session.indentRows(rows.first, rows.last, " "); + return; + } else if (range.start.column < range.end.column) { + var text = session.getTextRange(range); + if (!/^\s+$/.test(text)) { + var rows = this.$getSelectedRows(); + session.indentRows(rows.first, rows.last, " "); + return; + } + } + var line = session.getLine(range.start.row); + var position = range.start; + var size = session.getTabSize(); + var column = session.documentToScreenColumn(position.row, position.column); + if (this.session.getUseSoftTabs()) { + var count = size - column % size; + var indentString = lang.stringRepeat(" ", count); + } else { + var count = column % size; + while(line[range.start.column - 1] == " " && count){ + range.start.column--; + count--; + } + this.selection.setSelectionRange(range); + indentString = " "; + } + return this.insert(indentString); + }; + this.blockIndent = function() { + var rows = this.$getSelectedRows(); + this.session.indentRows(rows.first, rows.last, " "); + }; + this.blockOutdent = function() { + var selection = this.session.getSelection(); + this.session.outdentRows(selection.getRange()); + }; + this.sortLines = function() { + var rows = this.$getSelectedRows(); + var session = this.session; + var lines = []; + for(var i = rows.first; i <= rows.last; i++)lines.push(session.getLine(i)); + lines.sort(function(a, b) { + if (a.toLowerCase() < b.toLowerCase()) return -1; + if (a.toLowerCase() > b.toLowerCase()) return 1; + return 0; + }); + var deleteRange = new Range(0, 0, 0, 0); + for(var i = rows.first; i <= rows.last; i++){ + var line = session.getLine(i); + deleteRange.start.row = i; + deleteRange.end.row = i; + deleteRange.end.column = line.length; + session.replace(deleteRange, lines[i - rows.first]); + } + }; + this.toggleCommentLines = function() { + var state = this.session.getState(this.getCursorPosition().row); + var rows = this.$getSelectedRows(); + this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last); + }; + this.toggleBlockComment = function() { + var cursor = this.getCursorPosition(); + var state = this.session.getState(cursor.row); + var range = this.getSelectionRange(); + this.session.getMode().toggleBlockComment(state, this.session, range, cursor); + }; + this.getNumberAt = function(row, column) { + var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g; + _numberRx.lastIndex = 0; + var s = this.session.getLine(row); + while(_numberRx.lastIndex < column){ + var m = _numberRx.exec(s); + if (m.index <= column && m.index + m[0].length >= column) { + var number = { + value: m[0], + start: m.index, + end: m.index + m[0].length + }; + return number; + } + } + return null; + }; + this.modifyNumber = function(amount) { + var row = this.selection.getCursor().row; + var column = this.selection.getCursor().column; + var charRange = new Range(row, column - 1, row, column); + var c = this.session.getTextRange(charRange); + if (!isNaN(parseFloat(c)) && isFinite(c)) { + var nr = this.getNumberAt(row, column); + if (nr) { + var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end; + var decimals = nr.start + nr.value.length - fp; + var t = parseFloat(nr.value); + t *= Math.pow(10, decimals); + if (fp !== nr.end && column < fp) amount *= Math.pow(10, nr.end - column - 1); + else amount *= Math.pow(10, nr.end - column); + t += amount; + t /= Math.pow(10, decimals); + var nnr = t.toFixed(decimals); + var replaceRange = new Range(row, nr.start, row, nr.end); + this.session.replace(replaceRange, nnr); + this.moveCursorTo(row, Math.max(nr.start + 1, column + nnr.length - nr.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" + ], + [ + "in", + "out" + ], + [ + "inside", + "outside" + ], + [ + "next", + "previous" + ], + [ + "increase", + "decrease" + ], + [ + "attach", + "detach" + ], + [ + "&&", + "||" + ], + [ + "==", + "!=" + ] + ]; + this.toggleWord = function() { + var row = this.selection.getCursor().row; + var column = this.selection.getCursor().column; + this.selection.selectWord(); + var currentState = this.getSelectedText(); + var currWordStart = this.selection.getWordRange().start.column; + var wordParts = currentState.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g, "$1 ").split(/\s/); + var delta = column - currWordStart - 1; + if (delta < 0) delta = 0; + var curLength = 0, itLength = 0; + var that = this; + if (currentState.match(/[A-Za-z0-9_]+/)) wordParts.forEach(function(item, i) { + itLength = curLength + item.length; + if (delta >= curLength && delta <= itLength) { + currentState = item; + that.selection.clearSelection(); + that.moveCursorTo(row, curLength + currWordStart); + that.selection.selectTo(row, itLength + currWordStart); + } + curLength = itLength; + }); + var wordPairs = this.$toggleWordPairs; + var reg; + for(var i = 0; i < wordPairs.length; i++){ + var item = wordPairs[i]; + for(var j = 0; j <= 1; j++){ + var negate = +!j; + var firstCondition = currentState.match(new RegExp("^\\s?_?(" + lang.escapeRegExp(item[j]) + ")\\s?$", "i")); + if (firstCondition) { + var secondCondition = currentState.match(new RegExp("([_]|^|\\s)(" + lang.escapeRegExp(firstCondition[1]) + ")($|\\s)", "g")); + if (secondCondition) { + reg = currentState.replace(new RegExp(lang.escapeRegExp(item[j]), "i"), function(result) { + var res = item[negate]; + if (result.toUpperCase() == result) res = res.toUpperCase(); + else if (result.charAt(0).toUpperCase() == result.charAt(0)) res = res.substr(0, 0) + item[negate].charAt(0).toUpperCase() + res.substr(1); + return res; + }); + this.insert(reg); + reg = ""; + } + } + } + } + }; + this.findLinkAt = function(row, column) { + var e_1, _a; + var line = this.session.getLine(row); + var wordParts = line.split(/((?:https?|ftp):\/\/[\S]+)/); + var columnPosition = column; + if (columnPosition < 0) columnPosition = 0; + var previousPosition = 0, currentPosition = 0, match; + try { + for(var wordParts_1 = __values(wordParts), wordParts_1_1 = wordParts_1.next(); !wordParts_1_1.done; wordParts_1_1 = wordParts_1.next()){ + var item = wordParts_1_1.value; + currentPosition = previousPosition + item.length; + if (columnPosition >= previousPosition && columnPosition <= currentPosition) { + if (item.match(/((?:https?|ftp):\/\/[\S]+)/)) { + match = item.replace(/[\s:.,'";}\]]+$/, ""); + break; + } + } + previousPosition = currentPosition; + } + } catch (e_1_1) { + e_1 = { + error: e_1_1 + }; + } finally{ + try { + if (wordParts_1_1 && !wordParts_1_1.done && (_a = wordParts_1.return)) _a.call(wordParts_1); + } finally{ + if (e_1) throw e_1.error; + } + } + return match; + }; + this.openLink = function() { + var cursor = this.selection.getCursor(); + var url = this.findLinkAt(cursor.row, cursor.column); + if (url) window.open(url, "_blank"); + return url != null; + }; + this.removeLines = function() { + var rows = this.$getSelectedRows(); + this.session.removeFullLines(rows.first, rows.last); + this.clearSelection(); + }; + this.duplicateSelection = function() { + var sel = this.selection; + var doc = this.session; + var range = sel.getRange(); + var reverse = sel.isBackwards(); + if (range.isEmpty()) { + var row = range.start.row; + doc.duplicateLines(row, row); + } else { + var point = reverse ? range.start : range.end; + var endPoint = doc.insert(point, doc.getTextRange(range), false); + range.start = point; + range.end = endPoint; + sel.setSelectionRange(range, reverse); + } + }; + this.moveLinesDown = function() { + this.$moveLines(1, false); + }; + this.moveLinesUp = function() { + this.$moveLines(-1, false); + }; + this.moveText = function(range, toPosition, copy) { + return this.session.moveText(range, toPosition, copy); + }; + this.copyLinesUp = function() { + this.$moveLines(-1, true); + }; + this.copyLinesDown = function() { + this.$moveLines(1, true); + }; + this.$moveLines = function(dir, copy) { + var rows, moved; + var selection = this.selection; + if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) { + var range = selection.toOrientedRange(); + rows = this.$getSelectedRows(range); + moved = this.session.$moveLines(rows.first, rows.last, copy ? 0 : dir); + if (copy && dir == -1) moved = 0; + range.moveBy(moved, 0); + selection.fromOrientedRange(range); + } else { + var ranges = selection.rangeList.ranges; + selection.rangeList.detach(this.session); + this.inVirtualSelectionMode = true; + var diff = 0; + var totalDiff = 0; + var l = ranges.length; + for(var i = 0; i < l; i++){ + var rangeIndex = i; + ranges[i].moveBy(diff, 0); + rows = this.$getSelectedRows(ranges[i]); + var first = rows.first; + var last = rows.last; + while(++i < l){ + if (totalDiff) ranges[i].moveBy(totalDiff, 0); + var subRows = this.$getSelectedRows(ranges[i]); + if (copy && subRows.first != last) break; + else if (!copy && subRows.first > last + 1) break; + last = subRows.last; + } + i--; + diff = this.session.$moveLines(first, last, copy ? 0 : dir); + if (copy && dir == -1) rangeIndex = i + 1; + while(rangeIndex <= i){ + ranges[rangeIndex].moveBy(diff, 0); + rangeIndex++; + } + if (!copy) diff = 0; + totalDiff += diff; + } + selection.fromOrientedRange(selection.ranges[0]); + selection.rangeList.attach(this.session); + this.inVirtualSelectionMode = false; + } + }; + this.$getSelectedRows = function(range) { + range = (range || this.getSelectionRange()).collapseRows(); + return { + first: this.session.getRowFoldStart(range.start.row), + last: this.session.getRowFoldEnd(range.end.row) + }; + }; + this.onCompositionStart = function(compositionState) { + this.renderer.showComposition(compositionState); + }; + this.onCompositionUpdate = function(text) { + this.renderer.setCompositionText(text); + }; + this.onCompositionEnd = function() { + this.renderer.hideComposition(); + }; + this.getFirstVisibleRow = function() { + return this.renderer.getFirstVisibleRow(); + }; + this.getLastVisibleRow = function() { + return this.renderer.getLastVisibleRow(); + }; + this.isRowVisible = function(row) { + return row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow(); + }; + this.isRowFullyVisible = function(row) { + return row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow(); + }; + this.$getVisibleRowCount = function() { + return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1; + }; + this.$moveByPage = function(dir, select) { + var renderer = this.renderer; + var config = this.renderer.layerConfig; + var rows = dir * Math.floor(config.height / config.lineHeight); + if (select === true) this.selection.$moveSelection(function() { + this.moveCursorBy(rows, 0); + }); + else if (select === false) { + this.selection.moveCursorBy(rows, 0); + this.selection.clearSelection(); + } + var scrollTop = renderer.scrollTop; + renderer.scrollBy(0, rows * config.lineHeight); + if (select != null) renderer.scrollCursorIntoView(null, 0.5); + renderer.animateScrolling(scrollTop); + }; + this.selectPageDown = function() { + this.$moveByPage(1, true); + }; + this.selectPageUp = function() { + this.$moveByPage(-1, true); + }; + this.gotoPageDown = function() { + this.$moveByPage(1, false); + }; + this.gotoPageUp = function() { + this.$moveByPage(-1, false); + }; + this.scrollPageDown = function() { + this.$moveByPage(1); + }; + this.scrollPageUp = function() { + this.$moveByPage(-1); + }; + this.scrollToRow = function(row) { + this.renderer.scrollToRow(row); + }; + this.scrollToLine = function(line, center, animate, callback) { + this.renderer.scrollToLine(line, center, animate, callback); + }; + this.centerSelection = function() { + var range = this.getSelectionRange(); + var pos = { + row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2), + column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2) + }; + this.renderer.alignCursor(pos, 0.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(row, column) { + this.selection.moveCursorTo(row, column); + }; + this.moveCursorToPosition = function(pos) { + this.selection.moveCursorToPosition(pos); + }; + this.jumpToMatching = function(select, expand) { + var cursor = this.getCursorPosition(); + var iterator = new TokenIterator(this.session, cursor.row, cursor.column); + var prevToken = iterator.getCurrentToken(); + var tokenCount = 0; + if (prevToken && prevToken.type.indexOf("tag-name") !== -1) prevToken = iterator.stepBackward(); + var token = prevToken || iterator.stepForward(); + if (!token) return; + var matchType; + var found = false; + var depth = {}; + var i = cursor.column - token.start; + var bracketType; + var brackets = { + ")": "(", + "(": "(", + "]": "[", + "[": "[", + "{": "{", + "}": "{" + }; + do { + if (token.value.match(/[{}()\[\]]/g)) for(; i < token.value.length && !found; i++){ + if (!brackets[token.value[i]]) continue; + bracketType = brackets[token.value[i]] + "." + token.type.replace("rparen", "lparen"); + if (isNaN(depth[bracketType])) depth[bracketType] = 0; + switch(token.value[i]){ + case "(": + case "[": + case "{": + depth[bracketType]++; + break; + case ")": + case "]": + case "}": + depth[bracketType]--; + if (depth[bracketType] === -1) { + matchType = "bracket"; + found = true; + } + break; + } + } + else if (token.type.indexOf("tag-name") !== -1) { + if (isNaN(depth[token.value])) depth[token.value] = 0; + if (prevToken.value === "<" && tokenCount > 1) depth[token.value]++; + else if (prevToken.value === "= 0; --i)if (this.$tryReplace(ranges[i], replacement)) replaced++; + this.selection.setSelectionRange(selection); + return replaced; + }; + this.$tryReplace = function(range, replacement) { + var input = this.session.getTextRange(range); + replacement = this.$search.replace(input, replacement); + if (replacement !== null) { + range.end = this.session.replace(range, replacement); + return range; + } else return null; + }; + this.getLastSearchOptions = function() { + return this.$search.getOptions(); + }; + this.find = function(needle, options, animate) { + if (!options) options = {}; + if (typeof needle == "string" || needle instanceof RegExp) options.needle = needle; + else if (typeof needle == "object") oop.mixin(options, needle); + var range = this.selection.getRange(); + if (options.needle == null) { + needle = this.session.getTextRange(range) || this.$search.$options.needle; + if (!needle) { + range = this.session.getWordRange(range.start.row, range.start.column); + needle = this.session.getTextRange(range); + } + this.$search.set({ + needle: needle + }); + } + this.$search.set(options); + if (!options.start) this.$search.set({ + start: range + }); + var newRange = this.$search.find(this.session); + if (options.preventScroll) return newRange; + if (newRange) { + this.revealRange(newRange, animate); + return newRange; + } + if (options.backwards) range.start = range.end; + else range.end = range.start; + this.selection.setRange(range); + }; + this.findNext = function(options, animate) { + this.find({ + skipCurrent: true, + backwards: false + }, options, animate); + }; + this.findPrevious = function(options, animate) { + this.find(options, { + skipCurrent: true, + backwards: true + }, animate); + }; + this.revealRange = function(range, animate) { + this.session.unfold(range); + this.selection.setSelectionRange(range); + var scrollTop = this.renderer.scrollTop; + this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5); + if (animate !== false) this.renderer.animateScrolling(scrollTop); + }; + this.undo = function() { + this.session.getUndoManager().undo(this.session); + this.renderer.scrollCursorIntoView(null, 0.5); + }; + this.redo = function() { + this.session.getUndoManager().redo(this.session); + this.renderer.scrollCursorIntoView(null, 0.5); + }; + this.destroy = function() { + if (this.$toDestroy) { + this.$toDestroy.forEach(function(el) { + el.destroy(); + }); + this.$toDestroy = null; + } + if (this.$mouseHandler) this.$mouseHandler.destroy(); + this.renderer.destroy(); + this._signal("destroy", this); + if (this.session) this.session.destroy(); + if (this._$emitInputEvent) this._$emitInputEvent.cancel(); + this.removeAllListeners(); + }; + this.setAutoScrollEditorIntoView = function(enable) { + if (!enable) return; + var rect; + var self = this; + var shouldScroll = false; + if (!this.$scrollAnchor) this.$scrollAnchor = document.createElement("div"); + var scrollAnchor = this.$scrollAnchor; + scrollAnchor.style.cssText = "position:absolute"; + this.container.insertBefore(scrollAnchor, this.container.firstChild); + var onChangeSelection = this.on("changeSelection", function() { + shouldScroll = true; + }); + var onBeforeRender = this.renderer.on("beforeRender", function() { + if (shouldScroll) rect = self.renderer.container.getBoundingClientRect(); + }); + var onAfterRender = this.renderer.on("afterRender", function() { + if (shouldScroll && rect && (self.isFocused() || self.searchBox && self.searchBox.isFocused())) { + var renderer = self.renderer; + var pos = renderer.$cursorLayer.$pixelPos; + var config = renderer.layerConfig; + var top = pos.top - config.offset; + if (pos.top >= 0 && top + rect.top < 0) shouldScroll = true; + else if (pos.top < config.height && pos.top + rect.top + config.lineHeight > window.innerHeight) shouldScroll = false; + else shouldScroll = null; + if (shouldScroll != null) { + scrollAnchor.style.top = top + "px"; + scrollAnchor.style.left = pos.left + "px"; + scrollAnchor.style.height = config.lineHeight + "px"; + scrollAnchor.scrollIntoView(shouldScroll); + } + shouldScroll = rect = null; + } + }); + this.setAutoScrollEditorIntoView = function(enable) { + if (enable) return; + delete this.setAutoScrollEditorIntoView; + this.off("changeSelection", onChangeSelection); + this.renderer.off("afterRender", onAfterRender); + this.renderer.off("beforeRender", onBeforeRender); + }; + }; + this.$resetCursorStyle = function() { + var style = this.$cursorStyle || "ace"; + var cursorLayer = this.renderer.$cursorLayer; + if (!cursorLayer) return; + cursorLayer.setSmoothBlinking(/smooth/.test(style)); + cursorLayer.isBlinking = !this.$readOnly && style != "wide"; + dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style)); + }; + this.prompt = function(message, options, callback) { + var editor = this; + config.loadModule("./ext/prompt", function(module1) { + module1.prompt(editor, message, options, callback); + }); + }; + }).call(Editor.prototype); + config.defineOptions(Editor.prototype, "editor", { + selectionStyle: { + set: function(style) { + this.onSelectionChange(); + this._signal("changeSelectionStyle", { + data: style + }); + }, + initialValue: "line" + }, + highlightActiveLine: { + set: function() { + this.$updateHighlightActiveLine(); + }, + initialValue: true + }, + highlightSelectedWord: { + set: function(shouldHighlight) { + this.$onSelectionChange(); + }, + initialValue: true + }, + readOnly: { + set: function(readOnly) { + this.textInput.setReadOnly(readOnly); + this.$resetCursorStyle(); + }, + initialValue: false + }, + copyWithEmptySelection: { + set: function(value) { + this.textInput.setCopyWithEmptySelection(value); + }, + initialValue: false + }, + cursorStyle: { + set: function(val) { + this.$resetCursorStyle(); + }, + values: [ + "ace", + "slim", + "smooth", + "wide" + ], + initialValue: "ace" + }, + mergeUndoDeltas: { + values: [ + false, + true, + "always" + ], + initialValue: true + }, + behavioursEnabled: { + initialValue: true + }, + wrapBehavioursEnabled: { + initialValue: true + }, + enableAutoIndent: { + initialValue: true + }, + autoScrollEditorIntoView: { + set: function(val) { + this.setAutoScrollEditorIntoView(val); + } + }, + keyboardHandler: { + set: function(val) { + this.setKeyboardHandler(val); + }, + get: function() { + return this.$keybindingId; + }, + handlesSet: true + }, + value: { + set: function(val) { + this.session.setValue(val); + }, + get: function() { + return this.getValue(); + }, + handlesSet: true, + hidden: true + }, + session: { + set: function(val) { + this.setSession(val); + }, + get: function() { + return this.session; + }, + handlesSet: true, + hidden: true + }, + showLineNumbers: { + set: function(show) { + this.renderer.$gutterLayer.setShowLineNumbers(show); + this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER); + if (show && this.$relativeLineNumbers) relativeNumberRenderer.attach(this); + else relativeNumberRenderer.detach(this); + }, + initialValue: true + }, + relativeLineNumbers: { + set: function(value) { + if (this.$showLineNumbers && value) relativeNumberRenderer.attach(this); + else relativeNumberRenderer.detach(this); + } + }, + placeholder: { + set: function(message) { + if (!this.$updatePlaceholder) { + this.$updatePlaceholder = (function() { + var value = this.session && (this.renderer.$composition || this.getValue()); + if (value && this.renderer.placeholderNode) { + this.renderer.off("afterRender", this.$updatePlaceholder); + dom.removeCssClass(this.container, "ace_hasPlaceholder"); + this.renderer.placeholderNode.remove(); + this.renderer.placeholderNode = null; + } else if (!value && !this.renderer.placeholderNode) { + this.renderer.on("afterRender", this.$updatePlaceholder); + dom.addCssClass(this.container, "ace_hasPlaceholder"); + var el = dom.createElement("div"); + el.className = "ace_placeholder"; + el.textContent = this.$placeholder || ""; + this.renderer.placeholderNode = el; + this.renderer.content.appendChild(this.renderer.placeholderNode); + } else if (!value && this.renderer.placeholderNode) this.renderer.placeholderNode.textContent = this.$placeholder || ""; + }).bind(this); + this.on("input", this.$updatePlaceholder); + } + this.$updatePlaceholder(); + } + }, + customScrollbar: "renderer", + hScrollBarAlwaysVisible: "renderer", + vScrollBarAlwaysVisible: "renderer", + highlightGutterLine: "renderer", + animatedScroll: "renderer", + showInvisibles: "renderer", + showPrintMargin: "renderer", + printMarginColumn: "renderer", + printMargin: "renderer", + fadeFoldWidgets: "renderer", + showFoldWidgets: "renderer", + displayIndentGuides: "renderer", + highlightIndentGuides: "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 relativeNumberRenderer = { + getText: function(session, row) { + return (Math.abs(session.selection.lead.row - row) || row + 1 + (row < 9 ? "\xb7" : "")) + ""; + }, + getWidth: function(session, lastLineNumber, config) { + return Math.max(lastLineNumber.toString().length, (config.lastRow + 1).toString().length, 2) * config.characterWidth; + }, + update: function(e, editor) { + editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER); + }, + attach: function(editor) { + editor.renderer.$gutterLayer.$renderer = this; + editor.on("changeSelection", this.update); + this.update(null, editor); + }, + detach: function(editor) { + if (editor.renderer.$gutterLayer.$renderer == this) editor.renderer.$gutterLayer.$renderer = null; + editor.off("changeSelection", this.update); + this.update(null, editor); + } + }; + exports.Editor = Editor; +}); +ace.define("ace/undomanager", [ + "require", + "exports", + "module", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var UndoManager = function() { + this.$maxRev = 0; + this.$fromUndo = false; + this.$undoDepth = Infinity; + this.reset(); + }; + (function() { + this.addSession = function(session) { + this.$session = session; + }; + this.add = function(delta, allowMerge, session) { + if (this.$fromUndo) return; + if (delta == this.$lastDelta) return; + if (!this.$keepRedoStack) this.$redoStack.length = 0; + if (allowMerge === false || !this.lastDeltas) { + this.lastDeltas = []; + var undoStackLength = this.$undoStack.length; + if (undoStackLength > this.$undoDepth - 1) this.$undoStack.splice(0, undoStackLength - this.$undoDepth + 1); + this.$undoStack.push(this.lastDeltas); + delta.id = this.$rev = ++this.$maxRev; + } + if (delta.action == "remove" || delta.action == "insert") this.$lastDelta = delta; + this.lastDeltas.push(delta); + }; + this.addSelection = function(selection, rev) { + this.selections.push({ + value: selection, + rev: rev || this.$rev + }); + }; + this.startNewGroup = function() { + this.lastDeltas = null; + return this.$rev; + }; + this.markIgnored = function(from, to) { + if (to == null) to = this.$rev + 1; + var stack = this.$undoStack; + for(var i = stack.length; i--;){ + var delta = stack[i][0]; + if (delta.id <= from) break; + if (delta.id < to) delta.ignore = true; + } + this.lastDeltas = null; + }; + this.getSelection = function(rev, after) { + var stack = this.selections; + for(var i = stack.length; i--;){ + var selection = stack[i]; + if (selection.rev < rev) { + if (after) selection = stack[i + 1]; + return selection; + } + } + }; + this.getRevision = function() { + return this.$rev; + }; + this.getDeltas = function(from, to) { + if (to == null) to = this.$rev + 1; + var stack = this.$undoStack; + var end = null, start = 0; + for(var i = stack.length; i--;){ + var delta = stack[i][0]; + if (delta.id < to && !end) end = i + 1; + if (delta.id <= from) { + start = i + 1; + break; + } + } + return stack.slice(start, end); + }; + this.getChangedRanges = function(from, to) { + if (to == null) to = this.$rev + 1; + }; + this.getChangedLines = function(from, to) { + if (to == null) to = this.$rev + 1; + }; + this.undo = function(session, dontSelect) { + this.lastDeltas = null; + var stack = this.$undoStack; + if (!rearrangeUndoStack(stack, stack.length)) return; + if (!session) session = this.$session; + if (this.$redoStackBaseRev !== this.$rev && this.$redoStack.length) this.$redoStack = []; + this.$fromUndo = true; + var deltaSet = stack.pop(); + var undoSelectionRange = null; + if (deltaSet) { + undoSelectionRange = session.undoChanges(deltaSet, dontSelect); + this.$redoStack.push(deltaSet); + this.$syncRev(); + } + this.$fromUndo = false; + return undoSelectionRange; + }; + this.redo = function(session, dontSelect) { + this.lastDeltas = null; + if (!session) session = this.$session; + this.$fromUndo = true; + if (this.$redoStackBaseRev != this.$rev) { + var diff = this.getDeltas(this.$redoStackBaseRev, this.$rev + 1); + rebaseRedoStack(this.$redoStack, diff); + this.$redoStackBaseRev = this.$rev; + this.$redoStack.forEach(function(x) { + x[0].id = ++this.$maxRev; + }, this); + } + var deltaSet = this.$redoStack.pop(); + var redoSelectionRange = null; + if (deltaSet) { + redoSelectionRange = session.redoChanges(deltaSet, dontSelect); + this.$undoStack.push(deltaSet); + this.$syncRev(); + } + this.$fromUndo = false; + return redoSelectionRange; + }; + this.$syncRev = function() { + var stack = this.$undoStack; + var nextDelta = stack[stack.length - 1]; + var id = nextDelta && nextDelta[0].id || 0; + this.$redoStackBaseRev = id; + this.$rev = id; + }; + 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(rev) { + if (rev == undefined) rev = this.$rev; + this.mark = rev; + }; + 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(delta) { + if (delta) return stringifyDelta(delta); + return stringifyDelta(this.$undoStack) + "\n---\n" + stringifyDelta(this.$redoStack); + }; + }).call(UndoManager.prototype); + function rearrangeUndoStack(stack, pos) { + for(var i = pos; i--;){ + var deltaSet = stack[i]; + if (deltaSet && !deltaSet[0].ignore) { + while(i < pos - 1){ + var swapped = swapGroups(stack[i], stack[i + 1]); + stack[i] = swapped[0]; + stack[i + 1] = swapped[1]; + i++; + } + return true; + } + } + } + var Range = require("./range").Range; + var cmp = Range.comparePoints; + var comparePoints = Range.comparePoints; + function $updateMarkers(delta) { + var isInsert = delta.action == "insert"; + var start = delta.start; + var end = delta.end; + var rowShift = (end.row - start.row) * (isInsert ? 1 : -1); + var colShift = (end.column - start.column) * (isInsert ? 1 : -1); + if (isInsert) end = start; + for(var i in this.marks){ + var point = this.marks[i]; + var cmp = comparePoints(point, start); + if (cmp < 0) continue; // delta starts after the range + if (cmp === 0) { + if (isInsert) { + if (point.bias == 1) cmp = 1; + else { + point.bias; + continue; + } + } + } + var cmp2 = isInsert ? cmp : comparePoints(point, end); + if (cmp2 > 0) { + point.row += rowShift; + point.column += point.row == end.row ? colShift : 0; + continue; + } + if (!isInsert && cmp2 <= 0) { + point.row = start.row; + point.column = start.column; + if (cmp2 === 0) point.bias = 1; + } + } + } + function clonePos(pos) { + return { + row: pos.row, + column: pos.column + }; + } + function cloneDelta(d) { + return { + start: clonePos(d.start), + end: clonePos(d.end), + action: d.action, + lines: d.lines.slice() + }; + } + function stringifyDelta(d) { + d = d || this; + if (Array.isArray(d)) return d.map(stringifyDelta).join("\n"); + var type = ""; + if (d.action) { + type = d.action == "insert" ? "+" : "-"; + type += "[" + d.lines + "]"; + } else if (d.value) { + if (Array.isArray(d.value)) type = d.value.map(stringifyRange).join("\n"); + else type = stringifyRange(d.value); + } + if (d.start) type += stringifyRange(d); + if (d.id || d.rev) type += " (" + (d.id || d.rev) + ")"; + return type; + } + function stringifyRange(r) { + return r.start.row + ":" + r.start.column + "=>" + r.end.row + ":" + r.end.column; + } + function swap(d1, d2) { + var i1 = d1.action == "insert"; + var i2 = d2.action == "insert"; + if (i1 && i2) { + if (cmp(d2.start, d1.end) >= 0) shift(d2, d1, -1); + else if (cmp(d2.start, d1.start) <= 0) shift(d1, d2, 1); + else return null; + } else if (i1 && !i2) { + if (cmp(d2.start, d1.end) >= 0) shift(d2, d1, -1); + else if (cmp(d2.end, d1.start) <= 0) shift(d1, d2, -1); + else return null; + } else if (!i1 && i2) { + if (cmp(d2.start, d1.start) >= 0) shift(d2, d1, 1); + else if (cmp(d2.start, d1.start) <= 0) shift(d1, d2, 1); + else return null; + } else if (!i1 && !i2) { + if (cmp(d2.start, d1.start) >= 0) shift(d2, d1, 1); + else if (cmp(d2.end, d1.start) <= 0) shift(d1, d2, -1); + else return null; + } + return [ + d2, + d1 + ]; + } + function swapGroups(ds1, ds2) { + for(var i = ds1.length; i--;){ + for(var j = 0; j < ds2.length; j++)if (!swap(ds1[i], ds2[j])) { + while(i < ds1.length){ + while(j--)swap(ds2[j], ds1[i]); + j = ds2.length; + i++; + } + return [ + ds1, + ds2 + ]; + } + } + ds1.selectionBefore = ds2.selectionBefore = ds1.selectionAfter = ds2.selectionAfter = null; + return [ + ds2, + ds1 + ]; + } + function xform(d1, c1) { + var i1 = d1.action == "insert"; + var i2 = c1.action == "insert"; + if (i1 && i2) { + if (cmp(d1.start, c1.start) < 0) shift(c1, d1, 1); + else shift(d1, c1, 1); + } else if (i1 && !i2) { + if (cmp(d1.start, c1.end) >= 0) shift(d1, c1, -1); + else if (cmp(d1.start, c1.start) <= 0) shift(c1, d1, 1); + else { + shift(d1, Range.fromPoints(c1.start, d1.start), -1); + shift(c1, d1, 1); + } + } else if (!i1 && i2) { + if (cmp(c1.start, d1.end) >= 0) shift(c1, d1, -1); + else if (cmp(c1.start, d1.start) <= 0) shift(d1, c1, 1); + else { + shift(c1, Range.fromPoints(d1.start, c1.start), -1); + shift(d1, c1, 1); + } + } else if (!i1 && !i2) { + if (cmp(c1.start, d1.end) >= 0) shift(c1, d1, -1); + else if (cmp(c1.end, d1.start) <= 0) shift(d1, c1, -1); + else { + var before, after; + if (cmp(d1.start, c1.start) < 0) { + before = d1; + d1 = splitDelta(d1, c1.start); + } + if (cmp(d1.end, c1.end) > 0) after = splitDelta(d1, c1.end); + shiftPos(c1.end, d1.start, d1.end, -1); + if (after && !before) { + d1.lines = after.lines; + d1.start = after.start; + d1.end = after.end; + after = d1; + } + return [ + c1, + before, + after + ].filter(Boolean); + } + } + return [ + c1, + d1 + ]; + } + function shift(d1, d2, dir) { + shiftPos(d1.start, d2.start, d2.end, dir); + shiftPos(d1.end, d2.start, d2.end, dir); + } + function shiftPos(pos, start, end, dir) { + if (pos.row == (dir == 1 ? start : end).row) pos.column += dir * (end.column - start.column); + pos.row += dir * (end.row - start.row); + } + function splitDelta(c, pos) { + var lines = c.lines; + var end = c.end; + c.end = clonePos(pos); + var rowsBefore = c.end.row - c.start.row; + var otherLines = lines.splice(rowsBefore, lines.length); + var col = rowsBefore ? pos.column : pos.column - c.start.column; + lines.push(otherLines[0].substring(0, col)); + otherLines[0] = otherLines[0].substr(col); + var rest = { + start: clonePos(pos), + end: end, + lines: otherLines, + action: c.action + }; + return rest; + } + function moveDeltasByOne(redoStack, d) { + d = cloneDelta(d); + for(var j = redoStack.length; j--;){ + var deltaSet = redoStack[j]; + for(var i = 0; i < deltaSet.length; i++){ + var x = deltaSet[i]; + var xformed = xform(x, d); + d = xformed[0]; + if (xformed.length != 2) { + if (xformed[2]) { + deltaSet.splice(i + 1, 1, xformed[1], xformed[2]); + i++; + } else if (!xformed[1]) { + deltaSet.splice(i, 1); + i--; + } + } + } + if (!deltaSet.length) redoStack.splice(j, 1); + } + return redoStack; + } + function rebaseRedoStack(redoStack, deltaSets) { + for(var i = 0; i < deltaSets.length; i++){ + var deltas = deltaSets[i]; + for(var j = 0; j < deltas.length; j++)moveDeltasByOne(redoStack, deltas[j]); + } + } + exports.UndoManager = UndoManager; +}); +ace.define("ace/layer/lines", [ + "require", + "exports", + "module", + "ace/lib/dom" +], function(require, exports, module1) { + "use strict"; + var dom = require("../lib/dom"); + var Lines = function(element, canvasHeight) { + this.element = element; + this.canvasHeight = canvasHeight || 500000; + this.element.style.height = this.canvasHeight * 2 + "px"; + this.cells = []; + this.cellCache = []; + this.$offsetCoefficient = 0; + }; + (function() { + this.moveContainer = function(config) { + dom.translate(this.element, 0, -(config.firstRowScreen * config.lineHeight % this.canvasHeight) - config.offset * this.$offsetCoefficient); + }; + this.pageChanged = function(oldConfig, newConfig) { + return Math.floor(oldConfig.firstRowScreen * oldConfig.lineHeight / this.canvasHeight) !== Math.floor(newConfig.firstRowScreen * newConfig.lineHeight / this.canvasHeight); + }; + this.computeLineTop = function(row, config, session) { + var screenTop = config.firstRowScreen * config.lineHeight; + var screenPage = Math.floor(screenTop / this.canvasHeight); + var lineTop = session.documentToScreenRow(row, 0) * config.lineHeight; + return lineTop - screenPage * this.canvasHeight; + }; + this.computeLineHeight = function(row, config, session) { + return config.lineHeight * session.getRowLineCount(row); + }; + this.getLength = function() { + return this.cells.length; + }; + this.get = function(index) { + return this.cells[index]; + }; + this.shift = function() { + this.$cacheCell(this.cells.shift()); + }; + this.pop = function() { + this.$cacheCell(this.cells.pop()); + }; + this.push = function(cell) { + if (Array.isArray(cell)) { + this.cells.push.apply(this.cells, cell); + var fragment = dom.createFragment(this.element); + for(var i = 0; i < cell.length; i++)fragment.appendChild(cell[i].element); + this.element.appendChild(fragment); + } else { + this.cells.push(cell); + this.element.appendChild(cell.element); + } + }; + this.unshift = function(cell) { + if (Array.isArray(cell)) { + this.cells.unshift.apply(this.cells, cell); + var fragment = dom.createFragment(this.element); + for(var i = 0; i < cell.length; i++)fragment.appendChild(cell[i].element); + if (this.element.firstChild) this.element.insertBefore(fragment, this.element.firstChild); + else this.element.appendChild(fragment); + } else { + this.cells.unshift(cell); + this.element.insertAdjacentElement("afterbegin", cell.element); + } + }; + this.last = function() { + if (this.cells.length) return this.cells[this.cells.length - 1]; + else return null; + }; + this.$cacheCell = function(cell) { + if (!cell) return; + cell.element.remove(); + this.cellCache.push(cell); + }; + this.createCell = function(row, config, session, initElement) { + var cell = this.cellCache.pop(); + if (!cell) { + var element = dom.createElement("div"); + if (initElement) initElement(element); + this.element.appendChild(element); + cell = { + element: element, + text: "", + row: row + }; + } + cell.row = row; + return cell; + }; + }).call(Lines.prototype); + exports.Lines = Lines; +}); +ace.define("ace/layer/gutter", [ + "require", + "exports", + "module", + "ace/lib/dom", + "ace/lib/oop", + "ace/lib/lang", + "ace/lib/event_emitter", + "ace/layer/lines" +], function(require, exports, module1) { + "use strict"; + var dom = require("../lib/dom"); + var oop = require("../lib/oop"); + var lang = require("../lib/lang"); + var EventEmitter = require("../lib/event_emitter").EventEmitter; + var Lines = require("./lines").Lines; + var Gutter = function(parentEl) { + this.element = dom.createElement("div"); + this.element.className = "ace_layer ace_gutter-layer"; + parentEl.appendChild(this.element); + this.setShowFoldWidgets(this.$showFoldWidgets); + this.gutterWidth = 0; + this.$annotations = []; + this.$updateAnnotations = this.$updateAnnotations.bind(this); + this.$lines = new Lines(this.element); + this.$lines.$offsetCoefficient = 1; + }; + (function() { + oop.implement(this, EventEmitter); + this.setSession = function(session) { + if (this.session) this.session.off("change", this.$updateAnnotations); + this.session = session; + if (session) session.on("change", this.$updateAnnotations); + }; + this.addGutterDecoration = function(row, className) { + if (window.console) console.warn && console.warn("deprecated use session.addGutterDecoration"); + this.session.addGutterDecoration(row, className); + }; + this.removeGutterDecoration = function(row, className) { + if (window.console) console.warn && console.warn("deprecated use session.removeGutterDecoration"); + this.session.removeGutterDecoration(row, className); + }; + this.setAnnotations = function(annotations) { + this.$annotations = []; + for(var i = 0; i < annotations.length; i++){ + var annotation = annotations[i]; + var row = annotation.row; + var rowInfo = this.$annotations[row]; + if (!rowInfo) rowInfo = this.$annotations[row] = { + text: [] + }; + var annoText = annotation.text; + annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || ""; + if (rowInfo.text.indexOf(annoText) === -1) rowInfo.text.push(annoText); + var type = annotation.type; + var className = annotation.className; + if (className) rowInfo.className = className; + else if (type == "error") rowInfo.className = " ace_error"; + else if (type == "warning" && rowInfo.className != " ace_error") rowInfo.className = " ace_warning"; + else if (type == "info" && !rowInfo.className) rowInfo.className = " ace_info"; + } + }; + this.$updateAnnotations = function(delta) { + if (!this.$annotations.length) return; + var firstRow = delta.start.row; + var len = delta.end.row - firstRow; + if (len === 0) ; + else if (delta.action == "remove") this.$annotations.splice(firstRow, len + 1, null); + else { + var args = new Array(len + 1); + args.unshift(firstRow, 1); + this.$annotations.splice.apply(this.$annotations, args); + } + }; + this.update = function(config) { + this.config = config; + var session = this.session; + var firstRow = config.firstRow; + var lastRow = Math.min(config.lastRow + config.gutterOffset, session.getLength() - 1); + this.oldLastRow = lastRow; + this.config = config; + this.$lines.moveContainer(config); + this.$updateCursorRow(); + var fold = session.getNextFoldLine(firstRow); + var foldStart = fold ? fold.start.row : Infinity; + var cell = null; + var index = -1; + var row = firstRow; + while(true){ + if (row > foldStart) { + row = fold.end.row + 1; + fold = session.getNextFoldLine(row, fold); + foldStart = fold ? fold.start.row : Infinity; + } + if (row > lastRow) { + while(this.$lines.getLength() > index + 1)this.$lines.pop(); + break; + } + cell = this.$lines.get(++index); + if (cell) cell.row = row; + else { + cell = this.$lines.createCell(row, config, this.session, onCreateCell); + this.$lines.push(cell); + } + this.$renderCell(cell, config, fold, row); + row++; + } + this._signal("afterRender"); + this.$updateGutterWidth(config); + }; + this.$updateGutterWidth = function(config) { + var session = this.session; + var gutterRenderer = session.gutterRenderer || this.$renderer; + var firstLineNumber = session.$firstLineNumber; + var lastLineText = this.$lines.last() ? this.$lines.last().text : ""; + if (this.$fixedWidth || session.$useWrapMode) lastLineText = session.getLength() + firstLineNumber - 1; + var gutterWidth = gutterRenderer ? gutterRenderer.getWidth(session, lastLineText, config) : lastLineText.toString().length * config.characterWidth; + var padding = this.$padding || this.$computePadding(); + gutterWidth += padding.left + padding.right; + if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) { + this.gutterWidth = gutterWidth; + this.element.parentNode.style.width = this.element.style.width = Math.ceil(this.gutterWidth) + "px"; + this._signal("changeGutterWidth", gutterWidth); + } + }; + this.$updateCursorRow = function() { + if (!this.$highlightGutterLine) return; + var position = this.session.selection.getCursor(); + if (this.$cursorRow === position.row) return; + this.$cursorRow = position.row; + }; + this.updateLineHighlight = function() { + if (!this.$highlightGutterLine) return; + var row = this.session.selection.cursor.row; + this.$cursorRow = row; + if (this.$cursorCell && this.$cursorCell.row == row) return; + if (this.$cursorCell) this.$cursorCell.element.className = this.$cursorCell.element.className.replace("ace_gutter-active-line ", ""); + var cells = this.$lines.cells; + this.$cursorCell = null; + for(var i = 0; i < cells.length; i++){ + var cell = cells[i]; + if (cell.row >= this.$cursorRow) { + if (cell.row > this.$cursorRow) { + var fold = this.session.getFoldLine(this.$cursorRow); + if (i > 0 && fold && fold.start.row == cells[i - 1].row) cell = cells[i - 1]; + else break; + } + cell.element.className = "ace_gutter-active-line " + cell.element.className; + this.$cursorCell = cell; + break; + } + } + }; + this.scrollLines = function(config) { + var oldConfig = this.config; + this.config = config; + this.$updateCursorRow(); + if (this.$lines.pageChanged(oldConfig, config)) return this.update(config); + this.$lines.moveContainer(config); + var lastRow = Math.min(config.lastRow + config.gutterOffset, this.session.getLength() - 1); + var oldLastRow = this.oldLastRow; + this.oldLastRow = lastRow; + if (!oldConfig || oldLastRow < config.firstRow) return this.update(config); + if (lastRow < oldConfig.firstRow) return this.update(config); + if (oldConfig.firstRow < config.firstRow) for(var row = this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row > 0; row--)this.$lines.shift(); + if (oldLastRow > lastRow) for(var row = this.session.getFoldedRowCount(lastRow + 1, oldLastRow); row > 0; row--)this.$lines.pop(); + if (config.firstRow < oldConfig.firstRow) this.$lines.unshift(this.$renderLines(config, config.firstRow, oldConfig.firstRow - 1)); + if (lastRow > oldLastRow) this.$lines.push(this.$renderLines(config, oldLastRow + 1, lastRow)); + this.updateLineHighlight(); + this._signal("afterRender"); + this.$updateGutterWidth(config); + }; + this.$renderLines = function(config, firstRow, lastRow) { + var fragment = []; + var row = firstRow; + var foldLine = this.session.getNextFoldLine(row); + var foldStart = foldLine ? foldLine.start.row : Infinity; + while(true){ + if (row > foldStart) { + row = foldLine.end.row + 1; + foldLine = this.session.getNextFoldLine(row, foldLine); + foldStart = foldLine ? foldLine.start.row : Infinity; + } + if (row > lastRow) break; + var cell = this.$lines.createCell(row, config, this.session, onCreateCell); + this.$renderCell(cell, config, foldLine, row); + fragment.push(cell); + row++; + } + return fragment; + }; + this.$renderCell = function(cell, config, fold, row) { + var element = cell.element; + var session = this.session; + var textNode = element.childNodes[0]; + var foldWidget = element.childNodes[1]; + var firstLineNumber = session.$firstLineNumber; + var breakpoints = session.$breakpoints; + var decorations = session.$decorations; + var gutterRenderer = session.gutterRenderer || this.$renderer; + var foldWidgets = this.$showFoldWidgets && session.foldWidgets; + var foldStart = fold ? fold.start.row : Number.MAX_VALUE; + var className = "ace_gutter-cell "; + if (this.$highlightGutterLine) { + if (row == this.$cursorRow || fold && row < this.$cursorRow && row >= foldStart && this.$cursorRow <= fold.end.row) { + className += "ace_gutter-active-line "; + if (this.$cursorCell != cell) { + if (this.$cursorCell) this.$cursorCell.element.className = this.$cursorCell.element.className.replace("ace_gutter-active-line ", ""); + this.$cursorCell = cell; + } + } + } + if (breakpoints[row]) className += breakpoints[row]; + if (decorations[row]) className += decorations[row]; + if (this.$annotations[row]) className += this.$annotations[row].className; + if (element.className != className) element.className = className; + if (foldWidgets) { + var c = foldWidgets[row]; + if (c == null) c = foldWidgets[row] = session.getFoldWidget(row); + } + if (c) { + var className = "ace_fold-widget ace_" + c; + if (c == "start" && row == foldStart && row < fold.end.row) className += " ace_closed"; + else className += " ace_open"; + if (foldWidget.className != className) foldWidget.className = className; + var foldHeight = config.lineHeight + "px"; + dom.setStyle(foldWidget.style, "height", foldHeight); + dom.setStyle(foldWidget.style, "display", "inline-block"); + } else if (foldWidget) dom.setStyle(foldWidget.style, "display", "none"); + var text = (gutterRenderer ? gutterRenderer.getText(session, row) : row + firstLineNumber).toString(); + if (text !== textNode.data) textNode.data = text; + dom.setStyle(cell.element.style, "height", this.$lines.computeLineHeight(row, config, session) + "px"); + dom.setStyle(cell.element.style, "top", this.$lines.computeLineTop(row, config, session) + "px"); + cell.text = text; + return cell; + }; + this.$fixedWidth = false; + this.$highlightGutterLine = true; + this.$renderer = ""; + this.setHighlightGutterLine = function(highlightGutterLine) { + this.$highlightGutterLine = highlightGutterLine; + }; + this.$showLineNumbers = true; + this.$renderer = ""; + this.setShowLineNumbers = function(show) { + this.$renderer = !show && { + getWidth: function() { + return 0; + }, + getText: function() { + return ""; + } + }; + }; + this.getShowLineNumbers = function() { + return this.$showLineNumbers; + }; + this.$showFoldWidgets = true; + this.setShowFoldWidgets = function(show) { + if (show) dom.addCssClass(this.element, "ace_folding-enabled"); + else dom.removeCssClass(this.element, "ace_folding-enabled"); + this.$showFoldWidgets = show; + this.$padding = null; + }; + this.getShowFoldWidgets = function() { + return this.$showFoldWidgets; + }; + this.$computePadding = function() { + if (!this.element.firstChild) return { + left: 0, + right: 0 + }; + var style = dom.computedStyle(this.element.firstChild); + this.$padding = {}; + this.$padding.left = (parseInt(style.borderLeftWidth) || 0) + (parseInt(style.paddingLeft) || 0) + 1; + this.$padding.right = (parseInt(style.borderRightWidth) || 0) + (parseInt(style.paddingRight) || 0); + return this.$padding; + }; + this.getRegion = function(point) { + var padding = this.$padding || this.$computePadding(); + var rect = this.element.getBoundingClientRect(); + if (point.x < padding.left + rect.left) return "markers"; + if (this.$showFoldWidgets && point.x > rect.right - padding.right) return "foldWidgets"; + }; + }).call(Gutter.prototype); + function onCreateCell(element) { + var textNode = document.createTextNode(""); + element.appendChild(textNode); + var foldWidget = dom.createElement("span"); + element.appendChild(foldWidget); + return element; + } + exports.Gutter = Gutter; +}); +ace.define("ace/layer/marker", [ + "require", + "exports", + "module", + "ace/range", + "ace/lib/dom" +], function(require, exports, module1) { + "use strict"; + var Range = require("../range").Range; + var dom = require("../lib/dom"); + var Marker = function(parentEl) { + this.element = dom.createElement("div"); + this.element.className = "ace_layer ace_marker-layer"; + parentEl.appendChild(this.element); + }; + (function() { + this.$padding = 0; + this.setPadding = function(padding) { + this.$padding = padding; + }; + this.setSession = function(session) { + this.session = session; + }; + this.setMarkers = function(markers) { + this.markers = markers; + }; + this.elt = function(className, css) { + var x = this.i != -1 && this.element.childNodes[this.i]; + if (!x) { + x = document.createElement("div"); + this.element.appendChild(x); + this.i = -1; + } else this.i++; + x.style.cssText = css; + x.className = className; + }; + this.update = function(config) { + if (!config) return; + this.config = config; + this.i = 0; + var html; + for(var key in this.markers){ + var marker = this.markers[key]; + if (!marker.range) { + marker.update(html, this, this.session, config); + continue; + } + var range = marker.range.clipRows(config.firstRow, config.lastRow); + if (range.isEmpty()) continue; + range = range.toScreenRange(this.session); + if (marker.renderer) { + var top = this.$getTop(range.start.row, config); + var left = this.$padding + range.start.column * config.characterWidth; + marker.renderer(html, range, left, top, config); + } else if (marker.type == "fullLine") this.drawFullLineMarker(html, range, marker.clazz, config); + else if (marker.type == "screenLine") this.drawScreenLineMarker(html, range, marker.clazz, config); + else if (range.isMultiLine()) { + if (marker.type == "text") this.drawTextMarker(html, range, marker.clazz, config); + else this.drawMultiLineMarker(html, range, marker.clazz, config); + } else this.drawSingleLineMarker(html, range, marker.clazz + " ace_start" + " ace_br15", config); + } + if (this.i != -1) while(this.i < this.element.childElementCount)this.element.removeChild(this.element.lastChild); + }; + this.$getTop = function(row, layerConfig) { + return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight; + }; + function getBorderClass(tl, tr, br, bl) { + return (tl ? 1 : 0) | (tr ? 2 : 0) | (br ? 4 : 0) | (bl ? 8 : 0); + } + this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) { + var session = this.session; + var start = range.start.row; + var end = range.end.row; + var row = start; + var prev = 0; + var curr = 0; + var next = session.getScreenLastRowColumn(row); + var lineRange = new Range(row, range.start.column, row, curr); + for(; row <= end; row++){ + lineRange.start.row = lineRange.end.row = row; + lineRange.start.column = row == start ? range.start.column : session.getRowWrapIndent(row); + lineRange.end.column = next; + prev = curr; + curr = next; + next = row + 1 < end ? session.getScreenLastRowColumn(row + 1) : row == end ? 0 : range.end.column; + this.drawSingleLineMarker(stringBuilder, lineRange, clazz + (row == start ? " ace_start" : "") + " ace_br" + getBorderClass(row == start || row == start + 1 && range.start.column, prev < curr, curr > next, row == end), layerConfig, row == end ? 0 : 1, extraStyle); + } + }; + this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { + var padding = this.$padding; + var height = config.lineHeight; + var top = this.$getTop(range.start.row, config); + var left = padding + range.start.column * config.characterWidth; + extraStyle = extraStyle || ""; + if (this.session.$bidiHandler.isBidiRow(range.start.row)) { + var range1 = range.clone(); + range1.end.row = range1.start.row; + range1.end.column = this.session.getLine(range1.start.row).length; + this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + " ace_br1 ace_start", config, null, extraStyle); + } else this.elt(clazz + " ace_br1 ace_start", "height:" + height + "px;" + "right:0;" + "top:" + top + "px;left:" + left + "px;" + (extraStyle || "")); + if (this.session.$bidiHandler.isBidiRow(range.end.row)) { + var range1 = range.clone(); + range1.start.row = range1.end.row; + range1.start.column = 0; + this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + " ace_br12", config, null, extraStyle); + } else { + top = this.$getTop(range.end.row, config); + var width = range.end.column * config.characterWidth; + this.elt(clazz + " ace_br12", "height:" + height + "px;" + "width:" + width + "px;" + "top:" + top + "px;" + "left:" + padding + "px;" + (extraStyle || "")); + } + height = (range.end.row - range.start.row - 1) * config.lineHeight; + if (height <= 0) return; + top = this.$getTop(range.start.row + 1, config); + var radiusClass = (range.start.column ? 1 : 0) | (range.end.column ? 0 : 8); + this.elt(clazz + (radiusClass ? " ace_br" + radiusClass : ""), "height:" + height + "px;" + "right:0;" + "top:" + top + "px;" + "left:" + padding + "px;" + (extraStyle || "")); + }; + this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) { + if (this.session.$bidiHandler.isBidiRow(range.start.row)) return this.drawBidiSingleLineMarker(stringBuilder, range, clazz, config, extraLength, extraStyle); + var height = config.lineHeight; + var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth; + var top = this.$getTop(range.start.row, config); + var left = this.$padding + range.start.column * config.characterWidth; + this.elt(clazz, "height:" + height + "px;" + "width:" + width + "px;" + "top:" + top + "px;" + "left:" + left + "px;" + (extraStyle || "")); + }; + this.drawBidiSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) { + var height = config.lineHeight, top = this.$getTop(range.start.row, config), padding = this.$padding; + var selections = this.session.$bidiHandler.getSelections(range.start.column, range.end.column); + selections.forEach(function(selection) { + this.elt(clazz, "height:" + height + "px;" + "width:" + (selection.width + (extraLength || 0)) + "px;" + "top:" + top + "px;" + "left:" + (padding + selection.left) + "px;" + (extraStyle || "")); + }, this); + }; + this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { + var top = this.$getTop(range.start.row, config); + var height = config.lineHeight; + if (range.start.row != range.end.row) height += this.$getTop(range.end.row, config) - top; + this.elt(clazz, "height:" + height + "px;" + "top:" + top + "px;" + "left:0;right:0;" + (extraStyle || "")); + }; + this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { + var top = this.$getTop(range.start.row, config); + var height = config.lineHeight; + this.elt(clazz, "height:" + height + "px;" + "top:" + top + "px;" + "left:0;right:0;" + (extraStyle || "")); + }; + }).call(Marker.prototype); + exports.Marker = Marker; +}); +ace.define("ace/layer/text", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/lib/dom", + "ace/lib/lang", + "ace/layer/lines", + "ace/lib/event_emitter" +], function(require, exports, module1) { + "use strict"; + var oop = require("../lib/oop"); + var dom = require("../lib/dom"); + var lang = require("../lib/lang"); + var Lines = require("./lines").Lines; + var EventEmitter = require("../lib/event_emitter").EventEmitter; + var Text = function(parentEl) { + this.dom = dom; + this.element = this.dom.createElement("div"); + this.element.className = "ace_layer ace_text-layer"; + parentEl.appendChild(this.element); + this.$updateEolChar = this.$updateEolChar.bind(this); + this.$lines = new Lines(this.element); + }; + (function() { + oop.implement(this, EventEmitter); + this.EOF_CHAR = "\xb6"; + this.EOL_CHAR_LF = "\xac"; + this.EOL_CHAR_CRLF = "\xa4"; + this.EOL_CHAR = this.EOL_CHAR_LF; + this.TAB_CHAR = "—"; //"\u21E5"; + this.SPACE_CHAR = "\xb7"; + this.$padding = 0; + this.MAX_LINE_LENGTH = 10000; + this.MAX_CHUNK_LENGTH = 250; + this.$updateEolChar = function() { + var doc = this.session.doc; + var unixMode = doc.getNewLineCharacter() == "\n" && doc.getNewLineMode() != "windows"; + var EOL_CHAR = unixMode ? this.EOL_CHAR_LF : this.EOL_CHAR_CRLF; + if (this.EOL_CHAR != EOL_CHAR) { + this.EOL_CHAR = EOL_CHAR; + return true; + } + }; + this.setPadding = function(padding) { + this.$padding = padding; + this.element.style.margin = "0 " + padding + "px"; + }; + this.getLineHeight = function() { + return this.$fontMetrics.$characterSize.height || 0; + }; + this.getCharacterWidth = function() { + return this.$fontMetrics.$characterSize.width || 0; + }; + this.$setFontMetrics = function(measure) { + this.$fontMetrics = measure; + 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(session) { + this.session = session; + if (session) this.$computeTabString(); + }; + this.showInvisibles = false; + this.showSpaces = false; + this.showTabs = false; + this.showEOL = false; + this.setShowInvisibles = function(showInvisibles) { + if (this.showInvisibles == showInvisibles) return false; + this.showInvisibles = showInvisibles; + if (typeof showInvisibles == "string") { + this.showSpaces = /tab/i.test(showInvisibles); + this.showTabs = /space/i.test(showInvisibles); + this.showEOL = /eol/i.test(showInvisibles); + } else this.showSpaces = this.showTabs = this.showEOL = showInvisibles; + this.$computeTabString(); + return true; + }; + this.displayIndentGuides = true; + this.setDisplayIndentGuides = function(display) { + if (this.displayIndentGuides == display) return false; + this.displayIndentGuides = display; + this.$computeTabString(); + return true; + }; + this.$highlightIndentGuides = true; + this.setHighlightIndentGuides = function(highlight) { + if (this.$highlightIndentGuides === highlight) return false; + this.$highlightIndentGuides = highlight; + return highlight; + }; + this.$tabStrings = []; + this.onChangeTabSize = this.$computeTabString = function() { + var tabSize = this.session.getTabSize(); + this.tabSize = tabSize; + var tabStr = this.$tabStrings = [ + 0 + ]; + for(var i = 1; i < tabSize + 1; i++)if (this.showTabs) { + var span = this.dom.createElement("span"); + span.className = "ace_invisible ace_invisible_tab"; + span.textContent = lang.stringRepeat(this.TAB_CHAR, i); + tabStr.push(span); + } else tabStr.push(this.dom.createTextNode(lang.stringRepeat(" ", i), this.element)); + if (this.displayIndentGuides) { + this.$indentGuideRe = /\s\S| \t|\t |\s$/; + var className = "ace_indent-guide"; + var spaceClass = this.showSpaces ? " ace_invisible ace_invisible_space" : ""; + var spaceContent = this.showSpaces ? lang.stringRepeat(this.SPACE_CHAR, this.tabSize) : lang.stringRepeat(" ", this.tabSize); + var tabClass = this.showTabs ? " ace_invisible ace_invisible_tab" : ""; + var tabContent = this.showTabs ? lang.stringRepeat(this.TAB_CHAR, this.tabSize) : spaceContent; + var span = this.dom.createElement("span"); + span.className = className + spaceClass; + span.textContent = spaceContent; + this.$tabStrings[" "] = span; + var span = this.dom.createElement("span"); + span.className = className + tabClass; + span.textContent = tabContent; + this.$tabStrings[" "] = span; + } + }; + this.updateLines = function(config, firstRow, lastRow) { + if (this.config.lastRow != config.lastRow || this.config.firstRow != config.firstRow) return this.update(config); + this.config = config; + var first = Math.max(firstRow, config.firstRow); + var last = Math.min(lastRow, config.lastRow); + var lineElements = this.element.childNodes; + var lineElementsIdx = 0; + for(var row = config.firstRow; row < first; row++){ + var foldLine = this.session.getFoldLine(row); + if (foldLine) { + if (foldLine.containsRow(first)) { + first = foldLine.start.row; + break; + } else row = foldLine.end.row; + } + lineElementsIdx++; + } + var heightChanged = false; + var row = first; + var foldLine = this.session.getNextFoldLine(row); + var foldStart = foldLine ? foldLine.start.row : Infinity; + while(true){ + if (row > foldStart) { + row = foldLine.end.row + 1; + foldLine = this.session.getNextFoldLine(row, foldLine); + foldStart = foldLine ? foldLine.start.row : Infinity; + } + if (row > last) break; + var lineElement = lineElements[lineElementsIdx++]; + if (lineElement) { + this.dom.removeChildren(lineElement); + this.$renderLine(lineElement, row, row == foldStart ? foldLine : false); + if (heightChanged) lineElement.style.top = this.$lines.computeLineTop(row, config, this.session) + "px"; + var height = config.lineHeight * this.session.getRowLength(row) + "px"; + if (lineElement.style.height != height) { + heightChanged = true; + lineElement.style.height = height; + } + } + row++; + } + if (heightChanged) while(lineElementsIdx < this.$lines.cells.length){ + var cell = this.$lines.cells[lineElementsIdx++]; + cell.element.style.top = this.$lines.computeLineTop(cell.row, config, this.session) + "px"; + } + }; + this.scrollLines = function(config) { + var oldConfig = this.config; + this.config = config; + if (this.$lines.pageChanged(oldConfig, config)) return this.update(config); + this.$lines.moveContainer(config); + var lastRow = config.lastRow; + var oldLastRow = oldConfig ? oldConfig.lastRow : -1; + if (!oldConfig || oldLastRow < config.firstRow) return this.update(config); + if (lastRow < oldConfig.firstRow) return this.update(config); + if (!oldConfig || oldConfig.lastRow < config.firstRow) return this.update(config); + if (config.lastRow < oldConfig.firstRow) return this.update(config); + if (oldConfig.firstRow < config.firstRow) for(var row = this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row > 0; row--)this.$lines.shift(); + if (oldConfig.lastRow > config.lastRow) for(var row = this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row > 0; row--)this.$lines.pop(); + if (config.firstRow < oldConfig.firstRow) this.$lines.unshift(this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1)); + if (config.lastRow > oldConfig.lastRow) this.$lines.push(this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow)); + this.$highlightIndentGuide(); + }; + this.$renderLinesFragment = function(config, firstRow, lastRow) { + var fragment = []; + var row = firstRow; + var foldLine = this.session.getNextFoldLine(row); + var foldStart = foldLine ? foldLine.start.row : Infinity; + while(true){ + if (row > foldStart) { + row = foldLine.end.row + 1; + foldLine = this.session.getNextFoldLine(row, foldLine); + foldStart = foldLine ? foldLine.start.row : Infinity; + } + if (row > lastRow) break; + var line = this.$lines.createCell(row, config, this.session); + var lineEl = line.element; + this.dom.removeChildren(lineEl); + dom.setStyle(lineEl.style, "height", this.$lines.computeLineHeight(row, config, this.session) + "px"); + dom.setStyle(lineEl.style, "top", this.$lines.computeLineTop(row, config, this.session) + "px"); + this.$renderLine(lineEl, row, row == foldStart ? foldLine : false); + if (this.$useLineGroups()) lineEl.className = "ace_line_group"; + else { + lineEl.className = "ace_line"; + lineEl.setAttribute("role", "option"); + } + fragment.push(line); + row++; + } + return fragment; + }; + this.update = function(config) { + this.$lines.moveContainer(config); + this.config = config; + var firstRow = config.firstRow; + var lastRow = config.lastRow; + var lines = this.$lines; + while(lines.getLength())lines.pop(); + lines.push(this.$renderLinesFragment(config, firstRow, lastRow)); + }; + this.$textToken = { + "text": true, + "rparen": true, + "lparen": true + }; + this.$renderTokenInChunks = function(parent, screenColumn, token, value) { + var newScreenColumn; + for(var i = 0; i < value.length; i += this.MAX_CHUNK_LENGTH){ + var valueChunk = value.substring(i, i + this.MAX_CHUNK_LENGTH); + var tokenChunk = { + type: token.type, + value: valueChunk + }; + newScreenColumn = this.$renderToken(parent, screenColumn + i, tokenChunk, valueChunk); + } + return newScreenColumn; + }; + this.$renderToken = function(parent, screenColumn, token, value) { + var self = this; + var re = /(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069]+)|(\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; + var valueFragment = this.dom.createFragment(this.element); + var m; + var i = 0; + while(m = re.exec(value)){ + var tab = m[1]; + var simpleSpace = m[2]; + var controlCharacter = m[3]; + var cjkSpace = m[4]; + var cjk = m[5]; + if (!self.showSpaces && simpleSpace) continue; + var before = i != m.index ? value.slice(i, m.index) : ""; + i = m.index + m[0].length; + if (before) valueFragment.appendChild(this.dom.createTextNode(before, this.element)); + if (tab) { + var tabSize = self.session.getScreenTabSize(screenColumn + m.index); + valueFragment.appendChild(self.$tabStrings[tabSize].cloneNode(true)); + screenColumn += tabSize - 1; + } else if (simpleSpace) { + if (self.showSpaces) { + var span = this.dom.createElement("span"); + span.className = "ace_invisible ace_invisible_space"; + span.textContent = lang.stringRepeat(self.SPACE_CHAR, simpleSpace.length); + valueFragment.appendChild(span); + } else valueFragment.appendChild(this.com.createTextNode(simpleSpace, this.element)); + } else if (controlCharacter) { + var span = this.dom.createElement("span"); + span.className = "ace_invisible ace_invisible_space ace_invalid"; + span.textContent = lang.stringRepeat(self.SPACE_CHAR, controlCharacter.length); + valueFragment.appendChild(span); + } else if (cjkSpace) { + screenColumn += 1; + var span = this.dom.createElement("span"); + span.style.width = self.config.characterWidth * 2 + "px"; + span.className = self.showSpaces ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk"; + span.textContent = self.showSpaces ? self.SPACE_CHAR : cjkSpace; + valueFragment.appendChild(span); + } else if (cjk) { + screenColumn += 1; + var span = this.dom.createElement("span"); + span.style.width = self.config.characterWidth * 2 + "px"; + span.className = "ace_cjk"; + span.textContent = cjk; + valueFragment.appendChild(span); + } + } + valueFragment.appendChild(this.dom.createTextNode(i ? value.slice(i) : value, this.element)); + var span = this.dom.createElement("span"); + if (!this.$textToken[token.type]) { + var classes = "ace_" + token.type.replace(/\./g, " ace_"); + if (token.type == "fold") span.style.width = token.value.length * this.config.characterWidth + "px"; + span.className = classes; + } + span.appendChild(valueFragment); + parent.appendChild(span); + return screenColumn + value.length; + }; + this.renderIndentGuide = function(parent, value, max) { + var cols = value.search(this.$indentGuideRe); + if (cols <= 0 || cols >= max) return value; + if (value[0] == " ") { + cols -= cols % this.tabSize; + var count = cols / this.tabSize; + for(var i = 0; i < count; i++)parent.appendChild(this.$tabStrings[" "].cloneNode(true)); + this.$highlightIndentGuide(); + return value.substr(cols); + } else if (value[0] == " ") { + for(var i = 0; i < cols; i++)parent.appendChild(this.$tabStrings[" "].cloneNode(true)); + this.$highlightIndentGuide(); + return value.substr(cols); + } + this.$highlightIndentGuide(); + return value; + }; + this.$highlightIndentGuide = function() { + if (!this.$highlightIndentGuides || !this.displayIndentGuides) return; + this.$highlightIndentGuideMarker = { + indentLevel: undefined, + start: undefined, + end: undefined, + dir: undefined + }; + var lines = this.session.doc.$lines; + if (!lines) return; + var cursor = this.session.selection.getCursor(); + var initialIndent = /^\s*/.exec(this.session.doc.getLine(cursor.row))[0].length; + var elementIndentLevel = Math.floor(initialIndent / this.tabSize); + this.$highlightIndentGuideMarker = { + indentLevel: elementIndentLevel, + start: cursor.row + }; + var bracketHighlight = this.session.$bracketHighlight; + if (bracketHighlight) { + var ranges = this.session.$bracketHighlight.ranges; + for(var i = 0; i < ranges.length; i++)if (cursor.row !== ranges[i].start.row) { + this.$highlightIndentGuideMarker.end = ranges[i].start.row; + if (cursor.row > ranges[i].start.row) this.$highlightIndentGuideMarker.dir = -1; + else this.$highlightIndentGuideMarker.dir = 1; + break; + } + } + if (!this.$highlightIndentGuideMarker.end) { + if (lines[cursor.row] !== "" && cursor.column === lines[cursor.row].length) { + this.$highlightIndentGuideMarker.dir = 1; + for(var i = cursor.row + 1; i < lines.length; i++){ + var line = lines[i]; + var currentIndent = /^\s*/.exec(line)[0].length; + if (line !== "") { + this.$highlightIndentGuideMarker.end = i; + if (currentIndent <= initialIndent) break; + } + } + } + } + this.$renderHighlightIndentGuide(); + }; + this.$clearActiveIndentGuide = function() { + var cells = this.$lines.cells; + for(var i = 0; i < cells.length; i++){ + var cell = cells[i]; + var childNodes = cell.element.childNodes; + if (childNodes.length > 0) { + for(var j = 0; j < childNodes.length; j++)if (childNodes[j].classList && childNodes[j].classList.contains("ace_indent-guide-active")) { + childNodes[j].classList.remove("ace_indent-guide-active"); + break; + } + } + } + }; + this.$setIndentGuideActive = function(cell, indentLevel) { + var line = this.session.doc.getLine(cell.row); + if (line !== "") { + var childNodes = cell.element.childNodes; + if (childNodes) { + var node = childNodes[indentLevel - 1]; + if (node && node.classList && node.classList.contains("ace_indent-guide")) node.classList.add("ace_indent-guide-active"); + } + } + }; + this.$renderHighlightIndentGuide = function() { + if (!this.$lines) return; + var cells = this.$lines.cells; + this.$clearActiveIndentGuide(); + var indentLevel = this.$highlightIndentGuideMarker.indentLevel; + if (indentLevel !== 0) { + if (this.$highlightIndentGuideMarker.dir === 1) for(var i = 0; i < cells.length; i++){ + var cell = cells[i]; + if (this.$highlightIndentGuideMarker.end && cell.row >= this.$highlightIndentGuideMarker.start + 1) { + if (cell.row >= this.$highlightIndentGuideMarker.end) break; + this.$setIndentGuideActive(cell, indentLevel); + } + } + else for(var i = cells.length - 1; i >= 0; i--){ + var cell = cells[i]; + if (this.$highlightIndentGuideMarker.end && cell.row < this.$highlightIndentGuideMarker.start) { + if (cell.row <= this.$highlightIndentGuideMarker.end) break; + this.$setIndentGuideActive(cell, indentLevel); + } + } + } + }; + this.$createLineElement = function(parent) { + var lineEl = this.dom.createElement("div"); + lineEl.className = "ace_line"; + lineEl.style.height = this.config.lineHeight + "px"; + return lineEl; + }; + this.$renderWrappedLine = function(parent, tokens, splits) { + var chars = 0; + var split = 0; + var splitChars = splits[0]; + var screenColumn = 0; + var lineEl = this.$createLineElement(); + parent.appendChild(lineEl); + for(var i = 0; i < tokens.length; i++){ + var token = tokens[i]; + var value = token.value; + if (i == 0 && this.displayIndentGuides) { + chars = value.length; + value = this.renderIndentGuide(lineEl, value, splitChars); + if (!value) continue; + chars -= value.length; + } + if (chars + value.length < splitChars) { + screenColumn = this.$renderTokenInChunks(lineEl, screenColumn, token, value); + chars += value.length; + } else { + while(chars + value.length >= splitChars){ + screenColumn = this.$renderTokenInChunks(lineEl, screenColumn, token, value.substring(0, splitChars - chars)); + value = value.substring(splitChars - chars); + chars = splitChars; + lineEl = this.$createLineElement(); + parent.appendChild(lineEl); + lineEl.appendChild(this.dom.createTextNode(lang.stringRepeat("\xa0", splits.indent), this.element)); + split++; + screenColumn = 0; + splitChars = splits[split] || Number.MAX_VALUE; + } + if (value.length != 0) { + chars += value.length; + screenColumn = this.$renderTokenInChunks(lineEl, screenColumn, token, value); + } + } + } + if (splits[splits.length - 1] > this.MAX_LINE_LENGTH) this.$renderOverflowMessage(lineEl, screenColumn, null, "", true); + }; + this.$renderSimpleLine = function(parent, tokens) { + var screenColumn = 0; + for(var i = 0; i < tokens.length; i++){ + var token = tokens[i]; + var value = token.value; + if (i == 0 && this.displayIndentGuides) { + value = this.renderIndentGuide(parent, value); + if (!value) continue; + } + if (screenColumn + value.length > this.MAX_LINE_LENGTH) { + this.$renderOverflowMessage(parent, screenColumn, token, value); + return; + } + screenColumn = this.$renderTokenInChunks(parent, screenColumn, token, value); + } + }; + this.$renderOverflowMessage = function(parent, screenColumn, token, value, hide) { + if (token) this.$renderTokenInChunks(parent, screenColumn, token, value.slice(0, this.MAX_LINE_LENGTH - screenColumn)); + var overflowEl = this.dom.createElement("span"); + overflowEl.className = "ace_inline_button ace_keyword ace_toggle_wrap"; + overflowEl.textContent = hide ? "" : ""; + parent.appendChild(overflowEl); + }; + this.$renderLine = function(parent, row, foldLine) { + if (!foldLine && foldLine != false) foldLine = this.session.getFoldLine(row); + if (foldLine) var tokens = this.$getFoldLineTokens(row, foldLine); + else var tokens = this.session.getTokens(row); + var lastLineEl = parent; + if (tokens.length) { + var splits = this.session.getRowSplitData(row); + if (splits && splits.length) { + this.$renderWrappedLine(parent, tokens, splits); + var lastLineEl = parent.lastChild; + } else { + var lastLineEl = parent; + if (this.$useLineGroups()) { + lastLineEl = this.$createLineElement(); + parent.appendChild(lastLineEl); + } + this.$renderSimpleLine(lastLineEl, tokens); + } + } else if (this.$useLineGroups()) { + lastLineEl = this.$createLineElement(); + parent.appendChild(lastLineEl); + } + if (this.showEOL && lastLineEl) { + if (foldLine) row = foldLine.end.row; + var invisibleEl = this.dom.createElement("span"); + invisibleEl.className = "ace_invisible ace_invisible_eol"; + invisibleEl.textContent = row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR; + lastLineEl.appendChild(invisibleEl); + } + }; + this.$getFoldLineTokens = function(row, foldLine) { + var session = this.session; + var renderTokens = []; + function addTokens(tokens, from, to) { + var idx = 0, col = 0; + while(col + tokens[idx].value.length < from){ + col += tokens[idx].value.length; + idx++; + if (idx == tokens.length) return; + } + if (col != from) { + var value = tokens[idx].value.substring(from - col); + if (value.length > to - from) value = value.substring(0, to - from); + renderTokens.push({ + type: tokens[idx].type, + value: value + }); + col = from + value.length; + idx += 1; + } + while(col < to && idx < tokens.length){ + var value = tokens[idx].value; + if (value.length + col > to) renderTokens.push({ + type: tokens[idx].type, + value: value.substring(0, to - col) + }); + else renderTokens.push(tokens[idx]); + col += value.length; + idx += 1; + } + } + var tokens = session.getTokens(row); + foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) { + if (placeholder != null) renderTokens.push({ + type: "fold", + value: placeholder + }); + else { + if (isNewRow) tokens = session.getTokens(row); + if (tokens.length) addTokens(tokens, lastColumn, column); + } + }, foldLine.end.row, this.session.getLine(foldLine.end.row).length); + return renderTokens; + }; + this.$useLineGroups = function() { + return this.session.getUseWrapMode(); + }; + this.destroy = function() {}; + }).call(Text.prototype); + exports.Text = Text; +}); +ace.define("ace/layer/cursor", [ + "require", + "exports", + "module", + "ace/lib/dom" +], function(require, exports, module1) { + "use strict"; + var dom = require("../lib/dom"); + var Cursor = function(parentEl) { + this.element = dom.createElement("div"); + this.element.className = "ace_layer ace_cursor-layer"; + parentEl.appendChild(this.element); + this.isVisible = false; + this.isBlinking = true; + this.blinkInterval = 1000; + this.smoothBlinking = false; + this.cursors = []; + this.cursor = this.addCursor(); + dom.addCssClass(this.element, "ace_hidden-cursors"); + this.$updateCursors = this.$updateOpacity.bind(this); + }; + (function() { + this.$updateOpacity = function(val) { + var cursors = this.cursors; + for(var i = cursors.length; i--;)dom.setStyle(cursors[i].style, "opacity", val ? "" : "0"); + }; + this.$startCssAnimation = function() { + var cursors = this.cursors; + for(var i = cursors.length; i--;)cursors[i].style.animationDuration = this.blinkInterval + "ms"; + this.$isAnimating = true; + setTimeout((function() { + if (this.$isAnimating) dom.addCssClass(this.element, "ace_animate-blinking"); + }).bind(this)); + }; + this.$stopCssAnimation = function() { + this.$isAnimating = false; + dom.removeCssClass(this.element, "ace_animate-blinking"); + }; + this.$padding = 0; + this.setPadding = function(padding) { + this.$padding = padding; + }; + this.setSession = function(session) { + this.session = session; + }; + this.setBlinking = function(blinking) { + if (blinking != this.isBlinking) { + this.isBlinking = blinking; + this.restartTimer(); + } + }; + this.setBlinkInterval = function(blinkInterval) { + if (blinkInterval != this.blinkInterval) { + this.blinkInterval = blinkInterval; + this.restartTimer(); + } + }; + this.setSmoothBlinking = function(smoothBlinking) { + if (smoothBlinking != this.smoothBlinking) { + this.smoothBlinking = smoothBlinking; + dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking); + this.$updateCursors(true); + this.restartTimer(); + } + }; + this.addCursor = function() { + var el = dom.createElement("div"); + el.className = "ace_cursor"; + this.element.appendChild(el); + this.cursors.push(el); + return el; + }; + this.removeCursor = function() { + if (this.cursors.length > 1) { + var el = this.cursors.pop(); + el.parentNode.removeChild(el); + return el; + } + }; + this.hideCursor = function() { + this.isVisible = false; + dom.addCssClass(this.element, "ace_hidden-cursors"); + this.restartTimer(); + }; + this.showCursor = function() { + this.isVisible = true; + dom.removeCssClass(this.element, "ace_hidden-cursors"); + this.restartTimer(); + }; + this.restartTimer = function() { + var update = this.$updateCursors; + clearInterval(this.intervalId); + clearTimeout(this.timeoutId); + this.$stopCssAnimation(); + if (this.smoothBlinking) { + this.$isSmoothBlinking = false; + dom.removeCssClass(this.element, "ace_smooth-blinking"); + } + update(true); + if (!this.isBlinking || !this.blinkInterval || !this.isVisible) { + this.$stopCssAnimation(); + return; + } + if (this.smoothBlinking) { + this.$isSmoothBlinking = true; + setTimeout((function() { + if (this.$isSmoothBlinking) dom.addCssClass(this.element, "ace_smooth-blinking"); + }).bind(this)); + } + if (dom.HAS_CSS_ANIMATION) this.$startCssAnimation(); + else { + var blink = (function() { + this.timeoutId = setTimeout(function() { + update(false); + }, 0.6 * this.blinkInterval); + }).bind(this); + this.intervalId = setInterval(function() { + update(true); + blink(); + }, this.blinkInterval); + blink(); + } + }; + this.getPixelPosition = function(position, onScreen) { + if (!this.config || !this.session) return { + left: 0, + top: 0 + }; + if (!position) position = this.session.selection.getCursor(); + var pos = this.session.documentToScreenPosition(position); + var cursorLeft = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, position.row) ? this.session.$bidiHandler.getPosLeft(pos.column) : pos.column * this.config.characterWidth); + var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) * this.config.lineHeight; + return { + left: cursorLeft, + top: cursorTop + }; + }; + this.isCursorInView = function(pixelPos, config) { + return pixelPos.top >= 0 && pixelPos.top < config.maxHeight; + }; + this.update = function(config) { + this.config = config; + var selections = this.session.$selectionMarkers; + var i = 0, cursorIndex = 0; + if (selections === undefined || selections.length === 0) selections = [ + { + cursor: null + } + ]; + for(var i = 0, n = selections.length; i < n; i++){ + var pixelPos = this.getPixelPosition(selections[i].cursor, true); + if ((pixelPos.top > config.height + config.offset || pixelPos.top < 0) && i > 1) continue; + var element = this.cursors[cursorIndex++] || this.addCursor(); + var style = element.style; + if (!this.drawCursor) { + if (!this.isCursorInView(pixelPos, config)) dom.setStyle(style, "display", "none"); + else { + dom.setStyle(style, "display", "block"); + dom.translate(element, pixelPos.left, pixelPos.top); + dom.setStyle(style, "width", Math.round(config.characterWidth) + "px"); + dom.setStyle(style, "height", config.lineHeight + "px"); + } + } else this.drawCursor(element, pixelPos, config, selections[i], this.session); + } + while(this.cursors.length > cursorIndex)this.removeCursor(); + var overwrite = this.session.getOverwrite(); + this.$setOverwrite(overwrite); + this.$pixelPos = pixelPos; + this.restartTimer(); + }; + this.drawCursor = null; + this.$setOverwrite = function(overwrite) { + if (overwrite != this.overwrite) { + this.overwrite = overwrite; + if (overwrite) dom.addCssClass(this.element, "ace_overwrite-cursors"); + else dom.removeCssClass(this.element, "ace_overwrite-cursors"); + } + }; + this.destroy = function() { + clearInterval(this.intervalId); + clearTimeout(this.timeoutId); + }; + }).call(Cursor.prototype); + exports.Cursor = Cursor; +}); +ace.define("ace/scrollbar", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/lib/dom", + "ace/lib/event", + "ace/lib/event_emitter" +], function(require, exports, module1) { + "use strict"; + var oop = require("./lib/oop"); + var dom = require("./lib/dom"); + var event = require("./lib/event"); + var EventEmitter = require("./lib/event_emitter").EventEmitter; + var MAX_SCROLL_H = 0x8000; + var ScrollBar = function(parent) { + this.element = dom.createElement("div"); + this.element.className = "ace_scrollbar ace_scrollbar" + this.classSuffix; + this.inner = dom.createElement("div"); + this.inner.className = "ace_scrollbar-inner"; + this.inner.textContent = "\xa0"; + this.element.appendChild(this.inner); + parent.appendChild(this.element); + this.setVisible(false); + this.skipEvent = false; + event.addListener(this.element, "scroll", this.onScroll.bind(this)); + event.addListener(this.element, "mousedown", event.preventDefault); + }; + (function() { + oop.implement(this, EventEmitter); + this.setVisible = function(isVisible) { + this.element.style.display = isVisible ? "" : "none"; + this.isVisible = isVisible; + this.coeff = 1; + }; + }).call(ScrollBar.prototype); + var VScrollBar = function(parent, renderer) { + ScrollBar.call(this, parent); + this.scrollTop = 0; + this.scrollHeight = 0; + renderer.$scrollbarWidth = this.width = dom.scrollbarWidth(parent.ownerDocument); + this.inner.style.width = this.element.style.width = (this.width || 15) + 5 + "px"; + this.$minWidth = 0; + }; + oop.inherits(VScrollBar, ScrollBar); + (function() { + this.classSuffix = "-v"; + this.onScroll = function() { + if (!this.skipEvent) { + this.scrollTop = this.element.scrollTop; + if (this.coeff != 1) { + var h = this.element.clientHeight / this.scrollHeight; + this.scrollTop = this.scrollTop * (1 - h) / (this.coeff - h); + } + this._emit("scroll", { + data: this.scrollTop + }); + } + this.skipEvent = false; + }; + this.getWidth = function() { + return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0); + }; + this.setHeight = function(height) { + this.element.style.height = height + "px"; + }; + this.setInnerHeight = this.setScrollHeight = function(height) { + this.scrollHeight = height; + if (height > MAX_SCROLL_H) { + this.coeff = MAX_SCROLL_H / height; + height = MAX_SCROLL_H; + } else if (this.coeff != 1) this.coeff = 1; + this.inner.style.height = height + "px"; + }; + this.setScrollTop = function(scrollTop) { + if (this.scrollTop != scrollTop) { + this.skipEvent = true; + this.scrollTop = scrollTop; + this.element.scrollTop = scrollTop * this.coeff; + } + }; + }).call(VScrollBar.prototype); + var HScrollBar = function(parent, renderer) { + ScrollBar.call(this, parent); + this.scrollLeft = 0; + this.height = renderer.$scrollbarWidth; + this.inner.style.height = this.element.style.height = (this.height || 15) + 5 + "px"; + }; + oop.inherits(HScrollBar, ScrollBar); + (function() { + this.classSuffix = "-h"; + this.onScroll = function() { + if (!this.skipEvent) { + this.scrollLeft = this.element.scrollLeft; + this._emit("scroll", { + data: this.scrollLeft + }); + } + this.skipEvent = false; + }; + this.getHeight = function() { + return this.isVisible ? this.height : 0; + }; + this.setWidth = function(width) { + this.element.style.width = width + "px"; + }; + this.setInnerWidth = function(width) { + this.inner.style.width = width + "px"; + }; + this.setScrollWidth = function(width) { + this.inner.style.width = width + "px"; + }; + this.setScrollLeft = function(scrollLeft) { + if (this.scrollLeft != scrollLeft) { + this.skipEvent = true; + this.scrollLeft = this.element.scrollLeft = scrollLeft; + } + }; + }).call(HScrollBar.prototype); + exports.ScrollBar = VScrollBar; // backward compatibility + exports.ScrollBarV = VScrollBar; // backward compatibility + exports.ScrollBarH = HScrollBar; // backward compatibility + exports.VScrollBar = VScrollBar; + exports.HScrollBar = HScrollBar; +}); +ace.define("ace/scrollbar_custom", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/lib/dom", + "ace/lib/event", + "ace/lib/event_emitter" +], function(require, exports, module1) { + "use strict"; + var oop = require("./lib/oop"); + var dom = require("./lib/dom"); + var event = require("./lib/event"); + var EventEmitter = require("./lib/event_emitter").EventEmitter; + dom.importCssString(".ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{\n position: absolute;\n background: rgba(128, 128, 128, 0.6);\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid #bbb;\n border-radius: 2px;\n z-index: 8;\n}\n.ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h {\n position: absolute;\n z-index: 6;\n background: none;\n overflow: hidden!important;\n}\n.ace_editor>.ace_sb-v {\n z-index: 6;\n right: 0;\n top: 0;\n width: 12px;\n}\n.ace_editor>.ace_sb-v div {\n z-index: 8;\n right: 0;\n width: 100%;\n}\n.ace_editor>.ace_sb-h {\n bottom: 0;\n left: 0;\n height: 12px;\n}\n.ace_editor>.ace_sb-h div {\n bottom: 0;\n height: 100%;\n}\n.ace_editor>.ace_sb_grabbed {\n z-index: 8;\n background: #000;\n}", "ace_scrollbar.css", false); + var ScrollBar = function(parent) { + this.element = dom.createElement("div"); + this.element.className = "ace_sb" + this.classSuffix; + this.inner = dom.createElement("div"); + this.inner.className = ""; + this.element.appendChild(this.inner); + this.VScrollWidth = 12; + this.HScrollHeight = 12; + parent.appendChild(this.element); + this.setVisible(false); + this.skipEvent = false; + event.addMultiMouseDownListener(this.element, [ + 500, + 300, + 300 + ], this, "onMouseDown"); + }; + (function() { + oop.implement(this, EventEmitter); + this.setVisible = function(isVisible) { + this.element.style.display = isVisible ? "" : "none"; + this.isVisible = isVisible; + this.coeff = 1; + }; + }).call(ScrollBar.prototype); + var VScrollBar = function(parent, renderer) { + ScrollBar.call(this, parent); + this.scrollTop = 0; + this.scrollHeight = 0; + this.parent = parent; + this.width = this.VScrollWidth; + this.renderer = renderer; + this.inner.style.width = this.element.style.width = (this.width || 15) + "px"; + this.$minWidth = 0; + }; + oop.inherits(VScrollBar, ScrollBar); + (function() { + this.classSuffix = "-v"; + oop.implement(this, EventEmitter); + this.onMouseDown = function(eType, e) { + if (eType !== "mousedown") return; + if (event.getButton(e) !== 0 || e.detail === 2) return; + if (e.target === this.inner) { + var self = this; + var mousePageY = e.clientY; + var onMouseMove = function(e) { + mousePageY = e.clientY; + }; + var onMouseUp = function() { + clearInterval(timerId); + }; + var startY = e.clientY; + var startTop = this.thumbTop; + var onScrollInterval = function() { + if (mousePageY === undefined) return; + var scrollTop = self.scrollTopFromThumbTop(startTop + mousePageY - startY); + if (scrollTop === self.scrollTop) return; + self._emit("scroll", { + data: scrollTop + }); + }; + event.capture(this.inner, onMouseMove, onMouseUp); + var timerId = setInterval(onScrollInterval, 20); + return event.preventDefault(e); + } + var top = e.clientY - this.element.getBoundingClientRect().top - this.thumbHeight / 2; + this._emit("scroll", { + data: this.scrollTopFromThumbTop(top) + }); + return event.preventDefault(e); + }; + this.getHeight = function() { + return this.height; + }; + this.scrollTopFromThumbTop = function(thumbTop) { + var scrollTop = thumbTop * (this.pageHeight - this.viewHeight) / (this.slideHeight - this.thumbHeight); + scrollTop = scrollTop >> 0; + if (scrollTop < 0) scrollTop = 0; + else if (scrollTop > this.pageHeight - this.viewHeight) scrollTop = this.pageHeight - this.viewHeight; + return scrollTop; + }; + this.getWidth = function() { + return Math.max(this.isVisible ? this.width : 0, this.$minWidth || 0); + }; + this.setHeight = function(height) { + this.height = Math.max(0, height); + this.slideHeight = this.height; + this.viewHeight = this.height; + this.setScrollHeight(this.pageHeight, true); + }; + this.setInnerHeight = this.setScrollHeight = function(height, force) { + if (this.pageHeight === height && !force) return; + this.pageHeight = height; + this.thumbHeight = this.slideHeight * this.viewHeight / this.pageHeight; + if (this.thumbHeight > this.slideHeight) this.thumbHeight = this.slideHeight; + if (this.thumbHeight < 15) this.thumbHeight = 15; + this.inner.style.height = this.thumbHeight + "px"; + if (this.scrollTop > this.pageHeight - this.viewHeight) { + this.scrollTop = this.pageHeight - this.viewHeight; + if (this.scrollTop < 0) this.scrollTop = 0; + this._emit("scroll", { + data: this.scrollTop + }); + } + }; + this.setScrollTop = function(scrollTop) { + this.scrollTop = scrollTop; + if (scrollTop < 0) scrollTop = 0; + this.thumbTop = scrollTop * (this.slideHeight - this.thumbHeight) / (this.pageHeight - this.viewHeight); + this.inner.style.top = this.thumbTop + "px"; + }; + }).call(VScrollBar.prototype); + var HScrollBar = function(parent, renderer) { + ScrollBar.call(this, parent); + this.scrollLeft = 0; + this.scrollWidth = 0; + this.height = this.HScrollHeight; + this.inner.style.height = this.element.style.height = (this.height || 12) + "px"; + this.renderer = renderer; + }; + oop.inherits(HScrollBar, ScrollBar); + (function() { + this.classSuffix = "-h"; + oop.implement(this, EventEmitter); + this.onMouseDown = function(eType, e) { + if (eType !== "mousedown") return; + if (event.getButton(e) !== 0 || e.detail === 2) return; + if (e.target === this.inner) { + var self = this; + var mousePageX = e.clientX; + var onMouseMove = function(e) { + mousePageX = e.clientX; + }; + var onMouseUp = function() { + clearInterval(timerId); + }; + var startX = e.clientX; + var startLeft = this.thumbLeft; + var onScrollInterval = function() { + if (mousePageX === undefined) return; + var scrollLeft = self.scrollLeftFromThumbLeft(startLeft + mousePageX - startX); + if (scrollLeft === self.scrollLeft) return; + self._emit("scroll", { + data: scrollLeft + }); + }; + event.capture(this.inner, onMouseMove, onMouseUp); + var timerId = setInterval(onScrollInterval, 20); + return event.preventDefault(e); + } + var left = e.clientX - this.element.getBoundingClientRect().left - this.thumbWidth / 2; + this._emit("scroll", { + data: this.scrollLeftFromThumbLeft(left) + }); + return event.preventDefault(e); + }; + this.getHeight = function() { + return this.isVisible ? this.height : 0; + }; + this.scrollLeftFromThumbLeft = function(thumbLeft) { + var scrollLeft = thumbLeft * (this.pageWidth - this.viewWidth) / (this.slideWidth - this.thumbWidth); + scrollLeft = scrollLeft >> 0; + if (scrollLeft < 0) scrollLeft = 0; + else if (scrollLeft > this.pageWidth - this.viewWidth) scrollLeft = this.pageWidth - this.viewWidth; + return scrollLeft; + }; + this.setWidth = function(width) { + this.width = Math.max(0, width); + this.element.style.width = this.width + "px"; + this.slideWidth = this.width; + this.viewWidth = this.width; + this.setScrollWidth(this.pageWidth, true); + }; + this.setInnerWidth = this.setScrollWidth = function(width, force) { + if (this.pageWidth === width && !force) return; + this.pageWidth = width; + this.thumbWidth = this.slideWidth * this.viewWidth / this.pageWidth; + if (this.thumbWidth > this.slideWidth) this.thumbWidth = this.slideWidth; + if (this.thumbWidth < 15) this.thumbWidth = 15; + this.inner.style.width = this.thumbWidth + "px"; + if (this.scrollLeft > this.pageWidth - this.viewWidth) { + this.scrollLeft = this.pageWidth - this.viewWidth; + if (this.scrollLeft < 0) this.scrollLeft = 0; + this._emit("scroll", { + data: this.scrollLeft + }); + } + }; + this.setScrollLeft = function(scrollLeft) { + this.scrollLeft = scrollLeft; + if (scrollLeft < 0) scrollLeft = 0; + this.thumbLeft = scrollLeft * (this.slideWidth - this.thumbWidth) / (this.pageWidth - this.viewWidth); + this.inner.style.left = this.thumbLeft + "px"; + }; + }).call(HScrollBar.prototype); + exports.ScrollBar = VScrollBar; // backward compatibility + exports.ScrollBarV = VScrollBar; // backward compatibility + exports.ScrollBarH = HScrollBar; // backward compatibility + exports.VScrollBar = VScrollBar; + exports.HScrollBar = HScrollBar; +}); +ace.define("ace/renderloop", [ + "require", + "exports", + "module", + "ace/lib/event" +], function(require, exports, module1) { + "use strict"; + var event = require("./lib/event"); + var RenderLoop = function(onRender, win) { + this.onRender = onRender; + this.pending = false; + this.changes = 0; + this.$recursionLimit = 2; + this.window = win || window; + var _self = this; + this._flush = function(ts) { + _self.pending = false; + var changes = _self.changes; + if (changes) { + event.blockIdle(100); + _self.changes = 0; + _self.onRender(changes); + } + if (_self.changes) { + if (_self.$recursionLimit-- < 0) return; + _self.schedule(); + } else _self.$recursionLimit = 2; + }; + }; + (function() { + this.schedule = function(change) { + this.changes = this.changes | change; + if (this.changes && !this.pending) { + event.nextFrame(this._flush); + this.pending = true; + } + }; + this.clear = function(change) { + var changes = this.changes; + this.changes = 0; + return changes; + }; + }).call(RenderLoop.prototype); + exports.RenderLoop = RenderLoop; +}); +ace.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(require, exports, module1) { + var oop = require("../lib/oop"); + var dom = require("../lib/dom"); + var lang = require("../lib/lang"); + var event = require("../lib/event"); + var useragent = require("../lib/useragent"); + var EventEmitter = require("../lib/event_emitter").EventEmitter; + var DEFAULT_CHAR_COUNT = 250; + var USE_OBSERVER = typeof ResizeObserver == "function"; + var L = 200; + var FontMetrics = exports.FontMetrics = function(parentEl, charCount) { + this.charCount = charCount || DEFAULT_CHAR_COUNT; + this.el = dom.createElement("div"); + this.$setMeasureNodeStyles(this.el.style, true); + this.$main = dom.createElement("div"); + this.$setMeasureNodeStyles(this.$main.style); + this.$measureNode = dom.createElement("div"); + this.$setMeasureNodeStyles(this.$measureNode.style); + this.el.appendChild(this.$main); + this.el.appendChild(this.$measureNode); + parentEl.appendChild(this.el); + this.$measureNode.textContent = lang.stringRepeat("X", this.charCount); + this.$characterSize = { + width: 0, + height: 0 + }; + if (USE_OBSERVER) this.$addObserver(); + else this.checkForSizeChanges(); + }; + (function() { + oop.implement(this, EventEmitter); + this.$characterSize = { + width: 0, + height: 0 + }; + this.$setMeasureNodeStyles = function(style, isRoot) { + style.width = style.height = "auto"; + style.left = style.top = "0px"; + style.visibility = "hidden"; + style.position = "absolute"; + style.whiteSpace = "pre"; + if (useragent.isIE < 8) style["font-family"] = "inherit"; + else style.font = "inherit"; + style.overflow = isRoot ? "hidden" : "visible"; + }; + this.checkForSizeChanges = function(size) { + if (size === undefined) size = this.$measureSizes(); + if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) { + this.$measureNode.style.fontWeight = "bold"; + var boldSize = this.$measureSizes(); + this.$measureNode.style.fontWeight = ""; + this.$characterSize = size; + this.charSizes = Object.create(null); + this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height; + this._emit("changeCharacterSize", { + data: size + }); + } + }; + this.$addObserver = function() { + var self = this; + this.$observer = new window.ResizeObserver(function(e) { + self.checkForSizeChanges(); + }); + this.$observer.observe(this.$measureNode); + }; + this.$pollSizeChanges = function() { + if (this.$pollSizeChangesTimer || this.$observer) return this.$pollSizeChangesTimer; + var self = this; + return this.$pollSizeChangesTimer = event.onIdle(function cb() { + self.checkForSizeChanges(); + event.onIdle(cb, 500); + }, 500); + }; + this.setPolling = function(val) { + if (val) this.$pollSizeChanges(); + else if (this.$pollSizeChangesTimer) { + clearInterval(this.$pollSizeChangesTimer); + this.$pollSizeChangesTimer = 0; + } + }; + this.$measureSizes = function(node) { + node = node || this.$measureNode; + var rect = node.getBoundingClientRect(); + var charSize = { + height: rect.height, + width: rect.width / this.charCount + }; + if (charSize.width === 0 || charSize.height === 0) return null; + return charSize; + }; + this.$measureCharWidth = function(ch) { + this.$main.textContent = lang.stringRepeat(ch, this.charCount); + var rect = this.$main.getBoundingClientRect(); + return rect.width / this.charCount; + }; + this.getCharacterWidth = function(ch) { + var w = this.charSizes[ch]; + if (w === undefined) w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width; + return w; + }; + this.destroy = function() { + clearInterval(this.$pollSizeChangesTimer); + if (this.$observer) this.$observer.disconnect(); + if (this.el && this.el.parentNode) this.el.parentNode.removeChild(this.el); + }; + this.$getZoom = function getZoom(element) { + if (!element || !element.parentElement) return 1; + return (window.getComputedStyle(element).zoom || 1) * getZoom(element.parentElement); + }; + this.$initTransformMeasureNodes = function() { + var t = function(t, l) { + return [ + "div", + { + style: "position: absolute;top:" + t + "px;left:" + l + "px;" + } + ]; + }; + this.els = dom.buildDom([ + t(0, 0), + t(L, 0), + t(0, L), + t(L, L) + ], this.el); + }; + this.transformCoordinates = function(clientPos, elPos) { + if (clientPos) { + var zoom = this.$getZoom(this.el); + clientPos = mul(1 / zoom, clientPos); + } + function solve(l1, l2, r) { + var det = l1[1] * l2[0] - l1[0] * l2[1]; + return [ + (-l2[1] * r[0] + l2[0] * r[1]) / det, + (+l1[1] * r[0] - l1[0] * r[1]) / det + ]; + } + function sub(a, b) { + return [ + a[0] - b[0], + a[1] - b[1] + ]; + } + function add(a, b) { + return [ + a[0] + b[0], + a[1] + b[1] + ]; + } + function mul(a, b) { + return [ + a * b[0], + a * b[1] + ]; + } + if (!this.els) this.$initTransformMeasureNodes(); + function p(el) { + var r = el.getBoundingClientRect(); + return [ + r.left, + r.top + ]; + } + var a = p(this.els[0]); + var b = p(this.els[1]); + var c = p(this.els[2]); + var d = p(this.els[3]); + var h = solve(sub(d, b), sub(d, c), sub(add(b, c), add(d, a))); + var m1 = mul(1 + h[0], sub(b, a)); + var m2 = mul(1 + h[1], sub(c, a)); + if (elPos) { + var x = elPos; + var k = h[0] * x[0] / L + h[1] * x[1] / L + 1; + var ut = add(mul(x[0], m1), mul(x[1], m2)); + return add(mul(1 / k / L, ut), a); + } + var u = sub(clientPos, a); + var f = solve(sub(m1, mul(h[0], u)), sub(m2, mul(h[1], u)), u); + return mul(L, f); + }; + }).call(FontMetrics.prototype); +}); +ace.define("ace/css/editor.css", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + module1.exports = '/*\nstyles = []\nfor (var i = 1; i < 16; i++) {\n styles.push(".ace_br" + i + "{" + (\n ["top-left", "top-right", "bottom-right", "bottom-left"]\n ).map(function(x, j) {\n return i & (1< .ace_line, .ace_text-layer > .ace_line_group {\n contain: style size layout;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n}\n\n.ace_hidpi .ace_text-layer,\n.ace_hidpi .ace_gutter-layer,\n.ace_hidpi .ace_content,\n.ace_hidpi .ace_gutter {\n contain: strict;\n will-change: transform;\n}\n.ace_hidpi .ace_text-layer > .ace_line, \n.ace_hidpi .ace_text-layer > .ace_line_group {\n contain: strict;\n}\n\n.ace_cjk {\n display: inline-block;\n text-align: center;\n}\n\n.ace_cursor-layer {\n z-index: 4;\n}\n\n.ace_cursor {\n z-index: 4;\n position: absolute;\n box-sizing: border-box;\n border-left: 2px solid;\n /* workaround for smooth cursor repaintng whole screen in chrome */\n transform: translatez(0);\n}\n\n.ace_multiselect .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_slim-cursors .ace_cursor {\n border-left-width: 1px;\n}\n\n.ace_overwrite-cursors .ace_cursor {\n border-left-width: 0;\n border-bottom: 1px solid;\n}\n\n.ace_hidden-cursors .ace_cursor {\n opacity: 0.2;\n}\n\n.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {\n opacity: 0;\n}\n\n.ace_smooth-blinking .ace_cursor {\n transition: opacity 0.18s;\n}\n\n.ace_animate-blinking .ace_cursor {\n animation-duration: 1000ms;\n animation-timing-function: step-end;\n animation-name: blink-ace-animate;\n animation-iteration-count: infinite;\n}\n\n.ace_animate-blinking.ace_smooth-blinking .ace_cursor {\n animation-duration: 1000ms;\n animation-timing-function: ease-in-out;\n animation-name: blink-ace-animate-smooth;\n}\n \n@keyframes blink-ace-animate {\n from, to { opacity: 1; }\n 60% { opacity: 0; }\n}\n\n@keyframes blink-ace-animate-smooth {\n from, to { opacity: 1; }\n 45% { opacity: 1; }\n 60% { opacity: 0; }\n 85% { opacity: 0; }\n}\n\n.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {\n position: absolute;\n z-index: 3;\n}\n\n.ace_marker-layer .ace_selection {\n position: absolute;\n z-index: 5;\n}\n\n.ace_marker-layer .ace_bracket {\n position: absolute;\n z-index: 6;\n}\n\n.ace_marker-layer .ace_error_bracket {\n position: absolute;\n border-bottom: 1px solid #DE5555;\n border-radius: 0;\n}\n\n.ace_marker-layer .ace_active-line {\n position: absolute;\n z-index: 2;\n}\n\n.ace_marker-layer .ace_selected-word {\n position: absolute;\n z-index: 4;\n box-sizing: border-box;\n}\n\n.ace_line .ace_fold {\n box-sizing: border-box;\n\n display: inline-block;\n height: 11px;\n margin-top: -2px;\n vertical-align: middle;\n\n background-image:\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");\n background-repeat: no-repeat, repeat-x;\n background-position: center center, top left;\n color: transparent;\n\n border: 1px solid black;\n border-radius: 2px;\n\n cursor: pointer;\n pointer-events: auto;\n}\n\n.ace_dark .ace_fold {\n}\n\n.ace_fold:hover{\n background-image:\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),\n url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");\n}\n\n.ace_tooltip {\n background-color: #FFF;\n background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));\n border: 1px solid gray;\n border-radius: 1px;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);\n color: black;\n max-width: 100%;\n padding: 3px 4px;\n position: fixed;\n z-index: 999999;\n box-sizing: border-box;\n cursor: default;\n white-space: pre;\n word-wrap: break-word;\n line-height: normal;\n font-style: normal;\n font-weight: normal;\n letter-spacing: normal;\n pointer-events: none;\n}\n\n.ace_folding-enabled > .ace_gutter-cell {\n padding-right: 13px;\n}\n\n.ace_fold-widget {\n box-sizing: border-box;\n\n margin: 0 -12px 0 1px;\n display: none;\n width: 11px;\n vertical-align: top;\n\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");\n background-repeat: no-repeat;\n background-position: center;\n\n border-radius: 3px;\n \n border: 1px solid transparent;\n cursor: pointer;\n}\n\n.ace_folding-enabled .ace_fold-widget {\n display: inline-block; \n}\n\n.ace_fold-widget.ace_end {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");\n}\n\n.ace_fold-widget.ace_closed {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");\n}\n\n.ace_fold-widget:hover {\n border: 1px solid rgba(0, 0, 0, 0.3);\n background-color: rgba(255, 255, 255, 0.2);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n}\n\n.ace_fold-widget:active {\n border: 1px solid rgba(0, 0, 0, 0.4);\n background-color: rgba(0, 0, 0, 0.05);\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n}\n/**\n * Dark version for fold widgets\n */\n.ace_dark .ace_fold-widget {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");\n}\n.ace_dark .ace_fold-widget.ace_end {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");\n}\n.ace_dark .ace_fold-widget.ace_closed {\n background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");\n}\n.ace_dark .ace_fold-widget:hover {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n background-color: rgba(255, 255, 255, 0.1);\n}\n.ace_dark .ace_fold-widget:active {\n box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);\n}\n\n.ace_inline_button {\n border: 1px solid lightgray;\n display: inline-block;\n margin: -1px 8px;\n padding: 0 5px;\n pointer-events: auto;\n cursor: pointer;\n}\n.ace_inline_button:hover {\n border-color: gray;\n background: rgba(200,200,200,0.2);\n display: inline-block;\n pointer-events: auto;\n}\n\n.ace_fold-widget.ace_invalid {\n background-color: #FFB4B4;\n border-color: #DE5555;\n}\n\n.ace_fade-fold-widgets .ace_fold-widget {\n transition: opacity 0.4s ease 0.05s;\n opacity: 0;\n}\n\n.ace_fade-fold-widgets:hover .ace_fold-widget {\n transition: opacity 0.05s ease 0.05s;\n opacity:1;\n}\n\n.ace_underline {\n text-decoration: underline;\n}\n\n.ace_bold {\n font-weight: bold;\n}\n\n.ace_nobold .ace_bold {\n font-weight: normal;\n}\n\n.ace_italic {\n font-style: italic;\n}\n\n\n.ace_error-marker {\n background-color: rgba(255, 0, 0,0.2);\n position: absolute;\n z-index: 9;\n}\n\n.ace_highlight-marker {\n background-color: rgba(255, 255, 0,0.2);\n position: absolute;\n z-index: 8;\n}\n\n.ace_mobile-menu {\n position: absolute;\n line-height: 1.5;\n border-radius: 4px;\n -ms-user-select: none;\n -moz-user-select: none;\n -webkit-user-select: none;\n user-select: none;\n background: white;\n box-shadow: 1px 3px 2px grey;\n border: 1px solid #dcdcdc;\n color: black;\n}\n.ace_dark > .ace_mobile-menu {\n background: #333;\n color: #ccc;\n box-shadow: 1px 3px 2px grey;\n border: 1px solid #444;\n\n}\n.ace_mobile-button {\n padding: 2px;\n cursor: pointer;\n overflow: hidden;\n}\n.ace_mobile-button:hover {\n background-color: #eee;\n opacity:1;\n}\n.ace_mobile-button:active {\n background-color: #ddd;\n}\n\n.ace_placeholder {\n font-family: arial;\n transform: scale(0.9);\n transform-origin: left;\n white-space: pre;\n opacity: 0.7;\n margin: 0 10px;\n}'; +}); +ace.define("ace/layer/decorators", [ + "require", + "exports", + "module", + "ace/lib/dom", + "ace/lib/oop", + "ace/lib/event_emitter" +], function(require, exports, module1) { + "use strict"; + var dom = require("../lib/dom"); + var oop = require("../lib/oop"); + var EventEmitter = require("../lib/event_emitter").EventEmitter; + var Decorator = function(parent, renderer) { + this.canvas = dom.createElement("canvas"); + this.renderer = renderer; + this.pixelRatio = 1; + this.maxHeight = renderer.layerConfig.maxHeight; + this.lineHeight = renderer.layerConfig.lineHeight; + this.canvasHeight = parent.parent.scrollHeight; + this.heightRatio = this.canvasHeight / this.maxHeight; + this.canvasWidth = parent.width; + this.minDecorationHeight = 2 * this.pixelRatio | 0; + this.halfMinDecorationHeight = this.minDecorationHeight / 2 | 0; + this.canvas.width = this.canvasWidth; + this.canvas.height = this.canvasHeight; + this.canvas.style.top = "0px"; + this.canvas.style.right = "0px"; + this.canvas.style.zIndex = "7px"; + this.canvas.style.position = "absolute"; + this.colors = {}; + this.colors.dark = { + "error": "rgba(255, 18, 18, 1)", + "warning": "rgba(18, 136, 18, 1)", + "info": "rgba(18, 18, 136, 1)" + }; + this.colors.light = { + "error": "rgb(255,51,51)", + "warning": "rgb(32,133,72)", + "info": "rgb(35,68,138)" + }; + parent.element.appendChild(this.canvas); + }; + (function() { + oop.implement(this, EventEmitter); + this.$updateDecorators = function(config) { + var colors = this.renderer.theme.isDark === true ? this.colors.dark : this.colors.light; + if (config) { + this.maxHeight = config.maxHeight; + this.lineHeight = config.lineHeight; + this.canvasHeight = config.height; + var allLineHeight = (config.lastRow + 1) * this.lineHeight; + if (allLineHeight < this.canvasHeight) this.heightRatio = 1; + else this.heightRatio = this.canvasHeight / this.maxHeight; + } + var ctx = this.canvas.getContext("2d"); + function compare(a, b) { + if (a.priority < b.priority) return -1; + if (a.priority > b.priority) return 1; + return 0; + } + var annotations = this.renderer.session.$annotations; + ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); + if (annotations) { + var priorities = { + "info": 1, + "warning": 2, + "error": 3 + }; + annotations.forEach(function(item) { + item.priority = priorities[item.type] || null; + }); + annotations = annotations.sort(compare); + var foldData = this.renderer.session.$foldData; + for(var i = 0; i < annotations.length; i++){ + var row = annotations[i].row; + var compensateFold = this.compensateFoldRows(row, foldData); + var currentY = Math.round((row - compensateFold) * this.lineHeight * this.heightRatio); + var y1 = Math.round((row - compensateFold) * this.lineHeight * this.heightRatio); + var y2 = Math.round(((row - compensateFold) * this.lineHeight + this.lineHeight) * this.heightRatio); + var height = y2 - y1; + if (height < this.minDecorationHeight) { + var yCenter = (y1 + y2) / 2 | 0; + if (yCenter < this.halfMinDecorationHeight) yCenter = this.halfMinDecorationHeight; + else if (yCenter + this.halfMinDecorationHeight > this.canvasHeight) yCenter = this.canvasHeight - this.halfMinDecorationHeight; + y1 = Math.round(yCenter - this.halfMinDecorationHeight); + y2 = Math.round(yCenter + this.halfMinDecorationHeight); + } + ctx.fillStyle = colors[annotations[i].type] || null; + ctx.fillRect(0, currentY, this.canvasWidth, y2 - y1); + } + } + var cursor = this.renderer.session.selection.getCursor(); + if (cursor) { + var compensateFold = this.compensateFoldRows(cursor.row, foldData); + var currentY = Math.round((cursor.row - compensateFold) * this.lineHeight * this.heightRatio); + ctx.fillStyle = "rgba(0, 0, 0, 0.5)"; + ctx.fillRect(0, currentY, this.canvasWidth, 2); + } + }; + this.compensateFoldRows = function(row, foldData) { + var compensateFold = 0; + if (foldData && foldData.length > 0) for(var j = 0; j < foldData.length; j++){ + if (row > foldData[j].start.row && row < foldData[j].end.row) compensateFold += row - foldData[j].start.row; + else if (row >= foldData[j].end.row) compensateFold += foldData[j].end.row - foldData[j].start.row; + } + return compensateFold; + }; + }).call(Decorator.prototype); + exports.Decorator = Decorator; +}); +ace.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/scrollbar_custom", + "ace/scrollbar_custom", + "ace/renderloop", + "ace/layer/font_metrics", + "ace/lib/event_emitter", + "ace/css/editor.css", + "ace/layer/decorators", + "ace/lib/useragent" +], function(require, exports, module1) { + "use strict"; + var oop = require("./lib/oop"); + var dom = require("./lib/dom"); + var config = require("./config"); + var GutterLayer = require("./layer/gutter").Gutter; + var MarkerLayer = require("./layer/marker").Marker; + var TextLayer = require("./layer/text").Text; + var CursorLayer = require("./layer/cursor").Cursor; + var HScrollBar = require("./scrollbar").HScrollBar; + var VScrollBar = require("./scrollbar").VScrollBar; + var HScrollBarCustom = require("./scrollbar_custom").HScrollBar; + var VScrollBarCustom = require("./scrollbar_custom").VScrollBar; + var RenderLoop = require("./renderloop").RenderLoop; + var FontMetrics = require("./layer/font_metrics").FontMetrics; + var EventEmitter = require("./lib/event_emitter").EventEmitter; + var editorCss = require("./css/editor.css"); + var Decorator = require("./layer/decorators").Decorator; + var useragent = require("./lib/useragent"); + var HIDE_TEXTAREA = useragent.isIE; + dom.importCssString(editorCss, "ace_editor.css", false); + var VirtualRenderer = function(container, theme) { + var _self = this; + this.container = container || dom.createElement("div"); + dom.addCssClass(this.container, "ace_editor"); + if (dom.HI_DPI) dom.addCssClass(this.container, "ace_hidpi"); + this.setTheme(theme); + if (config.get("useStrictCSP") == null) config.set("useStrictCSP", false); + this.$gutter = dom.createElement("div"); + this.$gutter.className = "ace_gutter"; + this.container.appendChild(this.$gutter); + this.$gutter.setAttribute("aria-hidden", true); + this.scroller = dom.createElement("div"); + this.scroller.className = "ace_scroller"; + this.container.appendChild(this.scroller); + this.content = dom.createElement("div"); + this.content.className = "ace_content"; + this.scroller.appendChild(this.content); + this.$gutterLayer = new GutterLayer(this.$gutter); + this.$gutterLayer.on("changeGutterWidth", this.onGutterResize.bind(this)); + this.$markerBack = new MarkerLayer(this.content); + var textLayer = this.$textLayer = new TextLayer(this.content); + this.canvas = textLayer.element; + this.$markerFront = new MarkerLayer(this.content); + this.$cursorLayer = new CursorLayer(this.content); + this.$horizScroll = false; + this.$vScroll = false; + this.scrollBar = this.scrollBarV = new VScrollBar(this.container, this); + this.scrollBarH = new HScrollBar(this.container, this); + this.scrollBarV.on("scroll", function(e) { + if (!_self.$scrollAnimation) _self.session.setScrollTop(e.data - _self.scrollMargin.top); + }); + this.scrollBarH.on("scroll", function(e) { + if (!_self.$scrollAnimation) _self.session.setScrollLeft(e.data - _self.scrollMargin.left); + }); + this.scrollTop = 0; + this.scrollLeft = 0; + this.cursorPos = { + row: 0, + column: 0 + }; + this.$fontMetrics = new FontMetrics(this.container, this.$textLayer.MAX_CHUNK_LENGTH); + this.$textLayer.$setFontMetrics(this.$fontMetrics); + this.$textLayer.on("changeCharacterSize", function(e) { + _self.updateCharacterSize(); + _self.onResize(true, _self.gutterWidth, _self.$size.width, _self.$size.height); + _self._signal("changeCharacterSize", e); + }); + this.$size = { + width: 0, + height: 0, + scrollerHeight: 0, + scrollerWidth: 0, + $dirty: true + }; + 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 = !useragent.isIOS; + this.$loop = new RenderLoop(this.$renderChanges.bind(this), this.container.ownerDocument.defaultView); + this.$loop.schedule(this.CHANGE_FULL); + this.updateCharacterSize(); + this.setPadding(4); + config.resetOptions(this); + config._signal("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; + oop.implement(this, EventEmitter); + this.updateCharacterSize = function() { + if (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(); + dom.setStyle(this.scroller.style, "line-height", this.lineHeight + "px"); + }; + this.setSession = function(session) { + if (this.session) this.session.doc.off("changeNewLineMode", this.onChangeNewLineMode); + this.session = session; + if (session && this.scrollMargin.top && session.getScrollTop() <= 0) session.setScrollTop(-this.scrollMargin.top); + this.$cursorLayer.setSession(session); + this.$markerBack.setSession(session); + this.$markerFront.setSession(session); + this.$gutterLayer.setSession(session); + this.$textLayer.setSession(session); + if (!session) 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(firstRow, lastRow, force) { + if (lastRow === undefined) lastRow = Infinity; + if (!this.$changedLines) this.$changedLines = { + firstRow: firstRow, + lastRow: lastRow + }; + else { + if (this.$changedLines.firstRow > firstRow) this.$changedLines.firstRow = firstRow; + if (this.$changedLines.lastRow < lastRow) this.$changedLines.lastRow = lastRow; + } + if (this.$changedLines.lastRow < this.layerConfig.firstRow) { + if (force) this.$changedLines.lastRow = this.layerConfig.lastRow; + else return; + } + 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(force) { + if (force) this.$renderChanges(this.CHANGE_FULL, true); + else this.$loop.schedule(this.CHANGE_FULL); + }; + this.updateFontSize = function() { + this.$textLayer.checkForSizeChanges(); + }; + this.$changes = 0; + this.$updateSizeAsync = function() { + if (this.$loop.pending) this.$size.$dirty = true; + else this.onResize(); + }; + this.onResize = function(force, gutterWidth, width, height) { + if (this.resizing > 2) return; + else if (this.resizing > 0) this.resizing++; + else this.resizing = force ? 1 : 0; + var el = this.container; + if (!height) height = el.clientHeight || el.scrollHeight; + if (!width) width = el.clientWidth || el.scrollWidth; + var changes = this.$updateCachedSize(force, gutterWidth, width, height); + if (!this.$size.scrollerHeight || !width && !height) return this.resizing = 0; + if (force) this.$gutterLayer.$padding = null; + if (force) this.$renderChanges(changes | this.$changes, true); + else this.$loop.schedule(changes | this.$changes); + if (this.resizing) this.resizing = 0; + this.scrollBarH.scrollLeft = this.scrollBarV.scrollTop = null; + if (this.$customScrollbar) this.$updateCustomScrollbar(true); + }; + this.$updateCachedSize = function(force, gutterWidth, width, height) { + height -= this.$extraHeight || 0; + var changes = 0; + var size = this.$size; + var oldSize = { + width: size.width, + height: size.height, + scrollerHeight: size.scrollerHeight, + scrollerWidth: size.scrollerWidth + }; + if (height && (force || size.height != height)) { + size.height = height; + changes |= this.CHANGE_SIZE; + size.scrollerHeight = size.height; + if (this.$horizScroll) size.scrollerHeight -= this.scrollBarH.getHeight(); + this.scrollBarV.setHeight(size.scrollerHeight); + this.scrollBarV.element.style.bottom = this.scrollBarH.getHeight() + "px"; + changes = changes | this.CHANGE_SCROLL; + } + if (width && (force || size.width != width)) { + changes |= this.CHANGE_SIZE; + size.width = width; + if (gutterWidth == null) gutterWidth = this.$showGutter ? this.$gutter.offsetWidth : 0; + this.gutterWidth = gutterWidth; + dom.setStyle(this.scrollBarH.element.style, "left", gutterWidth + "px"); + dom.setStyle(this.scroller.style, "left", gutterWidth + this.margin.left + "px"); + size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBarV.getWidth() - this.margin.h); + dom.setStyle(this.$gutter.style, "left", this.margin.left + "px"); + var right = this.scrollBarV.getWidth() + "px"; + dom.setStyle(this.scrollBarH.element.style, "right", right); + dom.setStyle(this.scroller.style, "right", right); + dom.setStyle(this.scroller.style, "bottom", this.scrollBarH.getHeight()); + this.scrollBarH.setWidth(size.scrollerWidth); + if (this.session && this.session.getUseWrapMode() && this.adjustWrapLimit() || force) changes |= this.CHANGE_FULL; + } + size.$dirty = !width || !height; + if (changes) this._signal("resize", oldSize); + return changes; + }; + this.onGutterResize = function(width) { + var gutterWidth = this.$showGutter ? width : 0; + if (gutterWidth != this.gutterWidth) this.$changes |= this.$updateCachedSize(true, gutterWidth, this.$size.width, this.$size.height); + if (this.session.getUseWrapMode() && this.adjustWrapLimit()) this.$loop.schedule(this.CHANGE_FULL); + else if (this.$size.$dirty) this.$loop.schedule(this.CHANGE_FULL); + else this.$computeLayerConfig(); + }; + this.adjustWrapLimit = function() { + var availableWidth = this.$size.scrollerWidth - this.$padding * 2; + var limit = Math.floor(availableWidth / this.characterWidth); + return this.session.adjustWrapLimit(limit, this.$showPrintMargin && this.$printMarginColumn); + }; + this.setAnimatedScroll = function(shouldAnimate) { + this.setOption("animatedScroll", shouldAnimate); + }; + this.getAnimatedScroll = function() { + return this.$animatedScroll; + }; + this.setShowInvisibles = function(showInvisibles) { + this.setOption("showInvisibles", showInvisibles); + this.session.$bidiHandler.setShowInvisibles(showInvisibles); + }; + this.getShowInvisibles = function() { + return this.getOption("showInvisibles"); + }; + this.getDisplayIndentGuides = function() { + return this.getOption("displayIndentGuides"); + }; + this.setDisplayIndentGuides = function(display) { + this.setOption("displayIndentGuides", display); + }; + this.getHighlightIndentGuides = function() { + return this.getOption("highlightIndentGuides"); + }; + this.setHighlightIndentGuides = function(highlight) { + this.setOption("highlightIndentGuides", highlight); + }; + this.setShowPrintMargin = function(showPrintMargin) { + this.setOption("showPrintMargin", showPrintMargin); + }; + this.getShowPrintMargin = function() { + return this.getOption("showPrintMargin"); + }; + this.setPrintMarginColumn = function(showPrintMargin) { + this.setOption("printMarginColumn", showPrintMargin); + }; + this.getPrintMarginColumn = function() { + return this.getOption("printMarginColumn"); + }; + this.getShowGutter = function() { + return this.getOption("showGutter"); + }; + this.setShowGutter = function(show) { + return this.setOption("showGutter", show); + }; + this.getFadeFoldWidgets = function() { + return this.getOption("fadeFoldWidgets"); + }; + this.setFadeFoldWidgets = function(show) { + this.setOption("fadeFoldWidgets", show); + }; + this.setHighlightGutterLine = function(shouldHighlight) { + this.setOption("highlightGutterLine", shouldHighlight); + }; + this.getHighlightGutterLine = function() { + return this.getOption("highlightGutterLine"); + }; + this.$updatePrintMargin = function() { + if (!this.$showPrintMargin && !this.$printMarginEl) return; + if (!this.$printMarginEl) { + var containerEl = dom.createElement("div"); + containerEl.className = "ace_layer ace_print-margin-layer"; + this.$printMarginEl = dom.createElement("div"); + this.$printMarginEl.className = "ace_print-margin"; + containerEl.appendChild(this.$printMarginEl); + this.content.insertBefore(containerEl, this.content.firstChild); + } + var style = this.$printMarginEl.style; + style.left = Math.round(this.characterWidth * this.$printMarginColumn + this.$padding) + "px"; + style.visibility = this.$showPrintMargin ? "visible" : "hidden"; + if (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() { + if (this.$isMousePressed) return; + var style = this.textarea.style; + var composition = this.$composition; + if (!this.$keepTextAreaAtCursor && !composition) { + dom.translate(this.textarea, -100, 0); + return; + } + var pixelPos = this.$cursorLayer.$pixelPos; + if (!pixelPos) return; + if (composition && composition.markerRange) pixelPos = this.$cursorLayer.getPixelPosition(composition.markerRange.start, true); + var config = this.layerConfig; + var posTop = pixelPos.top; + var posLeft = pixelPos.left; + posTop -= config.offset; + var h = composition && composition.useTextareaForIME ? this.lineHeight : HIDE_TEXTAREA ? 0 : 1; + if (posTop < 0 || posTop > config.height - h) { + dom.translate(this.textarea, 0, 0); + return; + } + var w = 1; + var maxTop = this.$size.height - h; + if (!composition) posTop += this.lineHeight; + else if (composition.useTextareaForIME) { + var val = this.textarea.value; + w = this.characterWidth * this.session.$getStringScreenWidth(val)[0]; + } else posTop += this.lineHeight + 2; + posLeft -= this.scrollLeft; + if (posLeft > this.$size.scrollerWidth - w) posLeft = this.$size.scrollerWidth - w; + posLeft += this.gutterWidth + this.margin.left; + dom.setStyle(style, "height", h + "px"); + dom.setStyle(style, "width", w + "px"); + dom.translate(this.textarea, Math.min(posLeft, this.$size.scrollerWidth - w), Math.min(posTop, maxTop)); + }; + this.getFirstVisibleRow = function() { + return this.layerConfig.firstRow; + }; + this.getFirstFullyVisibleRow = function() { + return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1); + }; + this.getLastFullyVisibleRow = function() { + var config = this.layerConfig; + var lastRow = config.lastRow; + var top = this.session.documentToScreenRow(lastRow, 0) * config.lineHeight; + if (top - this.session.getScrollTop() > config.height - config.lineHeight) return lastRow - 1; + return lastRow; + }; + this.getLastVisibleRow = function() { + return this.layerConfig.lastRow; + }; + this.$padding = null; + this.setPadding = function(padding) { + this.$padding = padding; + this.$textLayer.setPadding(padding); + this.$cursorLayer.setPadding(padding); + this.$markerFront.setPadding(padding); + this.$markerBack.setPadding(padding); + this.$loop.schedule(this.CHANGE_FULL); + this.$updatePrintMargin(); + }; + this.setScrollMargin = function(top, bottom, left, right) { + var sm = this.scrollMargin; + sm.top = top | 0; + sm.bottom = bottom | 0; + sm.right = right | 0; + sm.left = left | 0; + sm.v = sm.top + sm.bottom; + sm.h = sm.left + sm.right; + if (sm.top && this.scrollTop <= 0 && this.session) this.session.setScrollTop(-sm.top); + this.updateFull(); + }; + this.setMargin = function(top, bottom, left, right) { + var sm = this.margin; + sm.top = top | 0; + sm.bottom = bottom | 0; + sm.right = right | 0; + sm.left = left | 0; + sm.v = sm.top + sm.bottom; + sm.h = sm.left + sm.right; + this.$updateCachedSize(true, this.gutterWidth, this.$size.width, this.$size.height); + this.updateFull(); + }; + this.getHScrollBarAlwaysVisible = function() { + return this.$hScrollBarAlwaysVisible; + }; + this.setHScrollBarAlwaysVisible = function(alwaysVisible) { + this.setOption("hScrollBarAlwaysVisible", alwaysVisible); + }; + this.getVScrollBarAlwaysVisible = function() { + return this.$vScrollBarAlwaysVisible; + }; + this.setVScrollBarAlwaysVisible = function(alwaysVisible) { + this.setOption("vScrollBarAlwaysVisible", alwaysVisible); + }; + this.$updateScrollBarV = function() { + var scrollHeight = this.layerConfig.maxHeight; + var scrollerHeight = this.$size.scrollerHeight; + if (!this.$maxLines && this.$scrollPastEnd) { + scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd; + if (this.scrollTop > scrollHeight - scrollerHeight) { + scrollHeight = this.scrollTop + scrollerHeight; + this.scrollBarV.scrollTop = null; + } + } + this.scrollBarV.setScrollHeight(scrollHeight + 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 = false; + this.freeze = function() { + this.$frozen = true; + }; + this.unfreeze = function() { + this.$frozen = false; + }; + this.$renderChanges = function(changes, force) { + if (this.$changes) { + changes |= this.$changes; + this.$changes = 0; + } + if (!this.session || !this.container.offsetWidth || this.$frozen || !changes && !force) { + this.$changes |= changes; + return; + } + if (this.$size.$dirty) { + this.$changes |= changes; + return this.onResize(true); + } + if (!this.lineHeight) this.$textLayer.checkForSizeChanges(); + this._signal("beforeRender", changes); + if (this.session && this.session.$bidiHandler) this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics); + var config = this.layerConfig; + if (changes & this.CHANGE_FULL || changes & this.CHANGE_SIZE || changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES || changes & this.CHANGE_SCROLL || changes & this.CHANGE_H_SCROLL) { + changes |= this.$computeLayerConfig() | this.$loop.clear(); + if (config.firstRow != this.layerConfig.firstRow && config.firstRowScreen == this.layerConfig.firstRowScreen) { + var st = this.scrollTop + (config.firstRow - this.layerConfig.firstRow) * this.lineHeight; + if (st > 0) { + this.scrollTop = st; + changes = changes | this.CHANGE_SCROLL; + changes |= this.$computeLayerConfig() | this.$loop.clear(); + } + } + config = this.layerConfig; + this.$updateScrollBarV(); + if (changes & this.CHANGE_H_SCROLL) this.$updateScrollBarH(); + dom.translate(this.content, -this.scrollLeft, -config.offset); + var width = config.width + 2 * this.$padding + "px"; + var height = config.minHeight + "px"; + dom.setStyle(this.content.style, "width", width); + dom.setStyle(this.content.style, "height", height); + } + if (changes & this.CHANGE_H_SCROLL) { + dom.translate(this.content, -this.scrollLeft, -config.offset); + this.scroller.className = this.scrollLeft <= 0 ? "ace_scroller" : "ace_scroller ace_scroll-left"; + } + if (changes & this.CHANGE_FULL) { + this.$changedLines = null; + this.$textLayer.update(config); + if (this.$showGutter) this.$gutterLayer.update(config); + if (this.$customScrollbar) this.$scrollDecorator.$updateDecorators(config); + this.$markerBack.update(config); + this.$markerFront.update(config); + this.$cursorLayer.update(config); + this.$moveTextAreaToCursor(); + this._signal("afterRender", changes); + return; + } + if (changes & this.CHANGE_SCROLL) { + this.$changedLines = null; + if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES) this.$textLayer.update(config); + else this.$textLayer.scrollLines(config); + if (this.$showGutter) { + if (changes & this.CHANGE_GUTTER || changes & this.CHANGE_LINES) this.$gutterLayer.update(config); + else this.$gutterLayer.scrollLines(config); + } + if (this.$customScrollbar) this.$scrollDecorator.$updateDecorators(config); + this.$markerBack.update(config); + this.$markerFront.update(config); + this.$cursorLayer.update(config); + this.$moveTextAreaToCursor(); + this._signal("afterRender", changes); + return; + } + if (changes & this.CHANGE_TEXT) { + this.$changedLines = null; + this.$textLayer.update(config); + if (this.$showGutter) this.$gutterLayer.update(config); + if (this.$customScrollbar) this.$scrollDecorator.$updateDecorators(config); + } else if (changes & this.CHANGE_LINES) { + if (this.$updateLines() || changes & this.CHANGE_GUTTER && this.$showGutter) this.$gutterLayer.update(config); + if (this.$customScrollbar) this.$scrollDecorator.$updateDecorators(config); + } else if (changes & this.CHANGE_TEXT || changes & this.CHANGE_GUTTER) { + if (this.$showGutter) this.$gutterLayer.update(config); + if (this.$customScrollbar) this.$scrollDecorator.$updateDecorators(config); + } else if (changes & this.CHANGE_CURSOR) { + if (this.$highlightGutterLine) this.$gutterLayer.updateLineHighlight(config); + if (this.$customScrollbar) this.$scrollDecorator.$updateDecorators(config); + } + if (changes & this.CHANGE_CURSOR) { + this.$cursorLayer.update(config); + this.$moveTextAreaToCursor(); + } + if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) this.$markerFront.update(config); + if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) this.$markerBack.update(config); + this._signal("afterRender", changes); + }; + this.$autosize = function() { + var height = this.session.getScreenLength() * this.lineHeight; + var maxHeight = this.$maxLines * this.lineHeight; + var desiredHeight = Math.min(maxHeight, Math.max((this.$minLines || 1) * this.lineHeight, height)) + this.scrollMargin.v + (this.$extraHeight || 0); + if (this.$horizScroll) desiredHeight += this.scrollBarH.getHeight(); + if (this.$maxPixelHeight && desiredHeight > this.$maxPixelHeight) desiredHeight = this.$maxPixelHeight; + var hideScrollbars = desiredHeight <= 2 * this.lineHeight; + var vScroll = !hideScrollbars && height > maxHeight; + if (desiredHeight != this.desiredHeight || this.$size.height != this.desiredHeight || vScroll != this.$vScroll) { + if (vScroll != this.$vScroll) { + this.$vScroll = vScroll; + this.scrollBarV.setVisible(vScroll); + } + var w = this.container.clientWidth; + this.container.style.height = desiredHeight + "px"; + this.$updateCachedSize(true, this.$gutterWidth, w, desiredHeight); + this.desiredHeight = desiredHeight; + this._signal("autosize"); + } + }; + this.$computeLayerConfig = function() { + var session = this.session; + var size = this.$size; + var hideScrollbars = size.height <= 2 * this.lineHeight; + var screenLines = this.session.getScreenLength(); + var maxHeight = screenLines * this.lineHeight; + var longestLine = this.$getLongestLine(); + var horizScroll = !hideScrollbars && (this.$hScrollBarAlwaysVisible || size.scrollerWidth - longestLine - 2 * this.$padding < 0); + var hScrollChanged = this.$horizScroll !== horizScroll; + if (hScrollChanged) { + this.$horizScroll = horizScroll; + this.scrollBarH.setVisible(horizScroll); + } + var vScrollBefore = this.$vScroll; // autosize can change vscroll value in which case we need to update longestLine + if (this.$maxLines && this.lineHeight > 1) this.$autosize(); + var minHeight = size.scrollerHeight + this.lineHeight; + var scrollPastEnd = !this.$maxLines && this.$scrollPastEnd ? (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd : 0; + maxHeight += scrollPastEnd; + var sm = this.scrollMargin; + this.session.setScrollTop(Math.max(-sm.top, Math.min(this.scrollTop, maxHeight - size.scrollerHeight + sm.bottom))); + this.session.setScrollLeft(Math.max(-sm.left, Math.min(this.scrollLeft, longestLine + 2 * this.$padding - size.scrollerWidth + sm.right))); + var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible || size.scrollerHeight - maxHeight + scrollPastEnd < 0 || this.scrollTop > sm.top); + var vScrollChanged = vScrollBefore !== vScroll; + if (vScrollChanged) { + this.$vScroll = vScroll; + this.scrollBarV.setVisible(vScroll); + } + var offset = this.scrollTop % this.lineHeight; + var lineCount = Math.ceil(minHeight / this.lineHeight) - 1; + var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight)); + var lastRow = firstRow + lineCount; + var firstRowScreen, firstRowHeight; + var lineHeight = this.lineHeight; + firstRow = session.screenToDocumentRow(firstRow, 0); + var foldLine = session.getFoldLine(firstRow); + if (foldLine) firstRow = foldLine.start.row; + firstRowScreen = session.documentToScreenRow(firstRow, 0); + firstRowHeight = session.getRowLength(firstRow) * lineHeight; + lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1); + minHeight = size.scrollerHeight + session.getRowLength(lastRow) * lineHeight + firstRowHeight; + offset = this.scrollTop - firstRowScreen * lineHeight; + var changes = 0; + if (this.layerConfig.width != longestLine || hScrollChanged) changes = this.CHANGE_H_SCROLL; + if (hScrollChanged || vScrollChanged) { + changes |= this.$updateCachedSize(true, this.gutterWidth, size.width, size.height); + this._signal("scrollbarVisibilityChanged"); + if (vScrollChanged) longestLine = this.$getLongestLine(); + } + this.layerConfig = { + width: longestLine, + padding: this.$padding, + firstRow: firstRow, + firstRowScreen: firstRowScreen, + lastRow: lastRow, + lineHeight: lineHeight, + characterWidth: this.characterWidth, + minHeight: minHeight, + maxHeight: maxHeight, + offset: offset, + gutterOffset: lineHeight ? Math.max(0, Math.ceil((offset + size.height - size.scrollerHeight) / lineHeight)) : 0, + height: this.$size.scrollerHeight + }; + if (this.session.$bidiHandler) this.session.$bidiHandler.setContentWidth(longestLine - this.$padding); + return changes; + }; + this.$updateLines = function() { + if (!this.$changedLines) return; + var firstRow = this.$changedLines.firstRow; + var lastRow = this.$changedLines.lastRow; + this.$changedLines = null; + var layerConfig = this.layerConfig; + if (firstRow > layerConfig.lastRow + 1) return; + if (lastRow < layerConfig.firstRow) return; + if (lastRow === Infinity) { + if (this.$showGutter) this.$gutterLayer.update(layerConfig); + this.$textLayer.update(layerConfig); + return; + } + this.$textLayer.updateLines(layerConfig, firstRow, lastRow); + return true; + }; + this.$getLongestLine = function() { + var charCount = this.session.getScreenWidth(); + if (this.showInvisibles && !this.session.$useWrapMode) charCount += 1; + if (this.$textLayer && charCount > this.$textLayer.MAX_LINE_LENGTH) charCount = this.$textLayer.MAX_LINE_LENGTH + 30; + return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth)); + }; + this.updateFrontMarkers = function() { + this.$markerFront.setMarkers(this.session.getMarkers(true)); + 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(row, className) { + this.$gutterLayer.addGutterDecoration(row, className); + }; + this.removeGutterDecoration = function(row, className) { + this.$gutterLayer.removeGutterDecoration(row, className); + }; + this.updateBreakpoints = function(rows) { + this.$loop.schedule(this.CHANGE_GUTTER); + }; + this.setAnnotations = function(annotations) { + this.$gutterLayer.setAnnotations(annotations); + 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(anchor, lead, offset) { + this.scrollCursorIntoView(anchor, offset); + this.scrollCursorIntoView(lead, offset); + }; + this.scrollCursorIntoView = function(cursor, offset, $viewMargin) { + if (this.$size.scrollerHeight === 0) return; + var pos = this.$cursorLayer.getPixelPosition(cursor); + var newLeft = pos.left; + var newTop = pos.top; + var topMargin = $viewMargin && $viewMargin.top || 0; + var bottomMargin = $viewMargin && $viewMargin.bottom || 0; + if (this.$scrollAnimation) this.$stopAnimation = true; + var currentTop = this.$scrollAnimation ? this.session.getScrollTop() : this.scrollTop; + if (currentTop + topMargin > newTop) { + if (offset && currentTop + topMargin > newTop + this.lineHeight) newTop -= offset * this.$size.scrollerHeight; + if (newTop === 0) newTop = -this.scrollMargin.top; + this.session.setScrollTop(newTop); + } else if (currentTop + this.$size.scrollerHeight - bottomMargin < newTop + this.lineHeight) { + if (offset && currentTop + this.$size.scrollerHeight - bottomMargin < newTop - this.lineHeight) newTop += offset * this.$size.scrollerHeight; + this.session.setScrollTop(newTop + this.lineHeight + bottomMargin - this.$size.scrollerHeight); + } + var currentLeft = this.scrollLeft; + var twoCharsWidth = 2 * this.layerConfig.characterWidth; + if (newLeft - twoCharsWidth < currentLeft) { + newLeft -= twoCharsWidth; + if (newLeft < this.$padding + twoCharsWidth) newLeft = -this.scrollMargin.left; + this.session.setScrollLeft(newLeft); + } else { + newLeft += twoCharsWidth; + if (currentLeft + this.$size.scrollerWidth < newLeft + this.characterWidth) this.session.setScrollLeft(Math.round(newLeft + this.characterWidth - this.$size.scrollerWidth)); + else if (currentLeft <= this.$padding && newLeft - currentLeft < 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(row) { + this.session.setScrollTop(row * this.lineHeight); + }; + this.alignCursor = function(cursor, alignment) { + if (typeof cursor == "number") cursor = { + row: cursor, + column: 0 + }; + var pos = this.$cursorLayer.getPixelPosition(cursor); + var h = this.$size.scrollerHeight - this.lineHeight; + var offset = pos.top - h * (alignment || 0); + this.session.setScrollTop(offset); + return offset; + }; + this.STEPS = 8; + this.$calcSteps = function(fromValue, toValue) { + var i = 0; + var l = this.STEPS; + var steps = []; + var func = function(t, x_min, dx) { + return dx * (Math.pow(t - 1, 3) + 1) + x_min; + }; + for(i = 0; i < l; ++i)steps.push(func(i / this.STEPS, fromValue, toValue - fromValue)); + return steps; + }; + this.scrollToLine = function(line, center, animate, callback) { + var pos = this.$cursorLayer.getPixelPosition({ + row: line, + column: 0 + }); + var offset = pos.top; + if (center) offset -= this.$size.scrollerHeight / 2; + var initialScroll = this.scrollTop; + this.session.setScrollTop(offset); + if (animate !== false) this.animateScrolling(initialScroll, callback); + }; + this.animateScrolling = function(fromValue, callback) { + var toValue = this.scrollTop; + if (!this.$animatedScroll) return; + var _self = this; + if (fromValue == toValue) return; + if (this.$scrollAnimation) { + var oldSteps = this.$scrollAnimation.steps; + if (oldSteps.length) { + fromValue = oldSteps[0]; + if (fromValue == toValue) return; + } + } + var steps = _self.$calcSteps(fromValue, toValue); + this.$scrollAnimation = { + from: fromValue, + to: toValue, + steps: steps + }; + clearInterval(this.$timer); + _self.session.setScrollTop(steps.shift()); + _self.session.$scrollTop = toValue; + function endAnimation() { + _self.$timer = clearInterval(_self.$timer); + _self.$scrollAnimation = null; + _self.$stopAnimation = false; + callback && callback(); + } + this.$timer = setInterval(function() { + if (_self.$stopAnimation) { + endAnimation(); + return; + } + if (!_self.session) return clearInterval(_self.$timer); + if (steps.length) { + _self.session.setScrollTop(steps.shift()); + _self.session.$scrollTop = toValue; + } else if (toValue != null) { + _self.session.$scrollTop = -1; + _self.session.setScrollTop(toValue); + toValue = null; + } else endAnimation(); + }, 10); + }; + this.scrollToY = function(scrollTop) { + if (this.scrollTop !== scrollTop) { + this.$loop.schedule(this.CHANGE_SCROLL); + this.scrollTop = scrollTop; + } + }; + this.scrollToX = function(scrollLeft) { + if (this.scrollLeft !== scrollLeft) this.scrollLeft = scrollLeft; + this.$loop.schedule(this.CHANGE_H_SCROLL); + }; + this.scrollTo = function(x, y) { + this.session.setScrollTop(y); + this.session.setScrollLeft(x); + }; + this.scrollBy = function(deltaX, deltaY) { + deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY); + deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX); + }; + this.isScrollableBy = function(deltaX, deltaY) { + if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top) return true; + if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight - this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom) return true; + if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left) return true; + if (deltaX > 0 && this.session.getScrollLeft() + this.$size.scrollerWidth - this.layerConfig.width < -1 + this.scrollMargin.right) return true; + }; + this.pixelToScreenCoordinates = function(x, y) { + var canvasPos; + if (this.$hasCssTransforms) { + canvasPos = { + top: 0, + left: 0 + }; + var p = this.$fontMetrics.transformCoordinates([ + x, + y + ]); + x = p[1] - this.gutterWidth - this.margin.left; + y = p[0]; + } else canvasPos = this.scroller.getBoundingClientRect(); + var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding; + var offset = offsetX / this.characterWidth; + var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight); + var col = this.$blockCursor ? Math.floor(offset) : Math.round(offset); + return { + row: row, + column: col, + side: offset - col > 0 ? 1 : -1, + offsetX: offsetX + }; + }; + this.screenToTextCoordinates = function(x, y) { + var canvasPos; + if (this.$hasCssTransforms) { + canvasPos = { + top: 0, + left: 0 + }; + var p = this.$fontMetrics.transformCoordinates([ + x, + y + ]); + x = p[1] - this.gutterWidth - this.margin.left; + y = p[0]; + } else canvasPos = this.scroller.getBoundingClientRect(); + var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding; + var offset = offsetX / this.characterWidth; + var col = this.$blockCursor ? Math.floor(offset) : Math.round(offset); + var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight); + return this.session.screenToDocumentPosition(row, Math.max(col, 0), offsetX); + }; + this.textToScreenCoordinates = function(row, column) { + var canvasPos = this.scroller.getBoundingClientRect(); + var pos = this.session.documentToScreenPosition(row, column); + var x = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, row) ? this.session.$bidiHandler.getPosLeft(pos.column) : Math.round(pos.column * this.characterWidth)); + var y = pos.row * this.lineHeight; + return { + pageX: canvasPos.left + x - this.scrollLeft, + pageY: canvasPos.top + y - this.scrollTop + }; + }; + this.visualizeFocus = function() { + dom.addCssClass(this.container, "ace_focus"); + }; + this.visualizeBlur = function() { + dom.removeCssClass(this.container, "ace_focus"); + }; + this.showComposition = function(composition) { + this.$composition = composition; + if (!composition.cssText) composition.cssText = this.textarea.style.cssText; + if (composition.useTextareaForIME == undefined) composition.useTextareaForIME = this.$useTextareaForIME; + if (this.$useTextareaForIME) { + dom.addCssClass(this.textarea, "ace_composition"); + this.textarea.style.cssText = ""; + this.$moveTextAreaToCursor(); + this.$cursorLayer.element.style.display = "none"; + } else composition.markerId = this.session.addMarker(composition.markerRange, "ace_composition_marker", "text"); + }; + this.setCompositionText = function(text) { + var cursor = this.session.selection.cursor; + this.addToken(text, "composition_placeholder", cursor.row, cursor.column); + this.$moveTextAreaToCursor(); + }; + this.hideComposition = function() { + if (!this.$composition) return; + if (this.$composition.markerId) this.session.removeMarker(this.$composition.markerId); + dom.removeCssClass(this.textarea, "ace_composition"); + this.textarea.style.cssText = this.$composition.cssText; + var cursor = this.session.selection.cursor; + this.removeExtraToken(cursor.row, cursor.column); + this.$composition = null; + this.$cursorLayer.element.style.display = ""; + }; + this.addToken = function(text, type, row, column) { + var session = this.session; + session.bgTokenizer.lines[row] = null; + var newToken = { + type: type, + value: text + }; + var tokens = session.getTokens(row); + if (column == null) tokens.push(newToken); + else { + var l = 0; + for(var i = 0; i < tokens.length; i++){ + var token = tokens[i]; + l += token.value.length; + if (column <= l) { + var diff = token.value.length - (l - column); + var before = token.value.slice(0, diff); + var after = token.value.slice(diff); + tokens.splice(i, 1, { + type: token.type, + value: before + }, newToken, { + type: token.type, + value: after + }); + break; + } + } + } + this.updateLines(row, row); + }; + this.removeExtraToken = function(row, column) { + this.updateLines(row, row); + }; + this.setTheme = function(theme, cb) { + var _self = this; + this.$themeId = theme; + _self._dispatchEvent("themeChange", { + theme: theme + }); + if (!theme || typeof theme == "string") { + var moduleName = theme || this.$options.theme.initialValue; + config.loadModule([ + "theme", + moduleName + ], afterLoad); + } else afterLoad(theme); + function afterLoad(module1) { + if (_self.$themeId != theme) return cb && cb(); + if (!module1 || !module1.cssClass) throw new Error("couldn't load module " + theme + " or it didn't call define"); + if (module1.$id) _self.$themeId = module1.$id; + dom.importCssString(module1.cssText, module1.cssClass, _self.container); + if (_self.theme) dom.removeCssClass(_self.container, _self.theme.cssClass); + var padding = "padding" in module1 ? module1.padding : "padding" in (_self.theme || {}) ? 4 : _self.$padding; + if (_self.$padding && padding != _self.$padding) _self.setPadding(padding); + _self.$theme = module1.cssClass; + _self.theme = module1; + dom.addCssClass(_self.container, module1.cssClass); + dom.setCssClass(_self.container, "ace_dark", module1.isDark); + if (_self.$size) { + _self.$size.width = 0; + _self.$updateSizeAsync(); + } + _self._dispatchEvent("themeLoaded", { + theme: module1 + }); + cb && cb(); + } + }; + this.getTheme = function() { + return this.$themeId; + }; + this.setStyle = function(style, include) { + dom.setCssClass(this.container, style, include !== false); + }; + this.unsetStyle = function(style) { + dom.removeCssClass(this.container, style); + }; + this.setCursorStyle = function(style) { + dom.setStyle(this.scroller.style, "cursor", style); + }; + this.setMouseCursor = function(cursorStyle) { + dom.setStyle(this.scroller.style, "cursor", cursorStyle); + }; + this.attachToShadowRoot = function() { + dom.importCssString(editorCss, "ace_editor.css", this.container); + }; + this.destroy = function() { + this.freeze(); + this.$fontMetrics.destroy(); + this.$cursorLayer.destroy(); + this.removeAllListeners(); + this.container.textContent = ""; + }; + this.$updateCustomScrollbar = function(val) { + var _self = this; + this.$horizScroll = this.$vScroll = null; + this.scrollBarV.element.remove(); + this.scrollBarH.element.remove(); + if (this.$scrollDecorator) delete this.$scrollDecorator; + if (val === true) { + this.scrollBarV = new VScrollBarCustom(this.container, this); + this.scrollBarH = new HScrollBarCustom(this.container, this); + this.scrollBarV.setHeight(this.$size.scrollerHeight); + this.scrollBarH.setWidth(this.$size.scrollerWidth); + this.scrollBarV.addEventListener("scroll", function(e) { + if (!_self.$scrollAnimation) _self.session.setScrollTop(e.data - _self.scrollMargin.top); + }); + this.scrollBarH.addEventListener("scroll", function(e) { + if (!_self.$scrollAnimation) _self.session.setScrollLeft(e.data - _self.scrollMargin.left); + }); + this.$scrollDecorator = new Decorator(this.scrollBarV, this); + this.$scrollDecorator.$updateDecorators(); + } else { + this.scrollBarV = new VScrollBar(this.container, this); + this.scrollBarH = new HScrollBar(this.container, this); + this.scrollBarV.addEventListener("scroll", function(e) { + if (!_self.$scrollAnimation) _self.session.setScrollTop(e.data - _self.scrollMargin.top); + }); + this.scrollBarH.addEventListener("scroll", function(e) { + if (!_self.$scrollAnimation) _self.session.setScrollLeft(e.data - _self.scrollMargin.left); + }); + } + }; + }).call(VirtualRenderer.prototype); + config.defineOptions(VirtualRenderer.prototype, "renderer", { + animatedScroll: { + initialValue: false + }, + showInvisibles: { + set: function(value) { + if (this.$textLayer.setShowInvisibles(value)) this.$loop.schedule(this.CHANGE_TEXT); + }, + initialValue: false + }, + showPrintMargin: { + set: function() { + this.$updatePrintMargin(); + }, + initialValue: true + }, + printMarginColumn: { + set: function() { + this.$updatePrintMargin(); + }, + initialValue: 80 + }, + printMargin: { + set: function(val) { + if (typeof val == "number") this.$printMarginColumn = val; + this.$showPrintMargin = !!val; + this.$updatePrintMargin(); + }, + get: function() { + return this.$showPrintMargin && this.$printMarginColumn; + } + }, + showGutter: { + set: function(show) { + this.$gutter.style.display = show ? "block" : "none"; + this.$loop.schedule(this.CHANGE_FULL); + this.onGutterResize(); + }, + initialValue: true + }, + fadeFoldWidgets: { + set: function(show) { + dom.setCssClass(this.$gutter, "ace_fade-fold-widgets", show); + }, + initialValue: false + }, + showFoldWidgets: { + set: function(show) { + this.$gutterLayer.setShowFoldWidgets(show); + this.$loop.schedule(this.CHANGE_GUTTER); + }, + initialValue: true + }, + displayIndentGuides: { + set: function(show) { + if (this.$textLayer.setDisplayIndentGuides(show)) this.$loop.schedule(this.CHANGE_TEXT); + }, + initialValue: true + }, + highlightIndentGuides: { + set: function(show) { + if (this.$textLayer.setHighlightIndentGuides(show) == true) this.$textLayer.$highlightIndentGuide(); + else this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells); + }, + initialValue: true + }, + highlightGutterLine: { + set: function(shouldHighlight) { + this.$gutterLayer.setHighlightGutterLine(shouldHighlight); + this.$loop.schedule(this.CHANGE_GUTTER); + }, + initialValue: true + }, + hScrollBarAlwaysVisible: { + set: function(val) { + if (!this.$hScrollBarAlwaysVisible || !this.$horizScroll) this.$loop.schedule(this.CHANGE_SCROLL); + }, + initialValue: false + }, + vScrollBarAlwaysVisible: { + set: function(val) { + if (!this.$vScrollBarAlwaysVisible || !this.$vScroll) this.$loop.schedule(this.CHANGE_SCROLL); + }, + initialValue: false + }, + fontSize: { + set: function(size) { + if (typeof size == "number") size = size + "px"; + this.container.style.fontSize = size; + this.updateFontSize(); + }, + initialValue: 12 + }, + fontFamily: { + set: function(name) { + this.container.style.fontFamily = name; + this.updateFontSize(); + } + }, + maxLines: { + set: function(val) { + this.updateFull(); + } + }, + minLines: { + set: function(val) { + if (!(this.$minLines < 0x1ffffffffffff)) this.$minLines = 0; + this.updateFull(); + } + }, + maxPixelHeight: { + set: function(val) { + this.updateFull(); + }, + initialValue: 0 + }, + scrollPastEnd: { + set: function(val) { + val = +val || 0; + if (this.$scrollPastEnd == val) return; + this.$scrollPastEnd = val; + this.$loop.schedule(this.CHANGE_SCROLL); + }, + initialValue: 0, + handlesSet: true + }, + fixedWidthGutter: { + set: function(val) { + this.$gutterLayer.$fixedWidth = !!val; + this.$loop.schedule(this.CHANGE_GUTTER); + } + }, + customScrollbar: { + set: function(val) { + this.$updateCustomScrollbar(val); + }, + initialValue: false + }, + theme: { + set: function(val) { + this.setTheme(val); + }, + get: function() { + return this.$themeId || this.theme; + }, + initialValue: "./theme/textmate", + handlesSet: true + }, + hasCssTransforms: {}, + useTextareaForIME: { + initialValue: !useragent.isMobile && !useragent.isIE + } + }); + exports.VirtualRenderer = VirtualRenderer; +}); +ace.define("ace/worker/worker_client", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/lib/net", + "ace/lib/event_emitter", + "ace/config" +], function(require, exports, module1) { + "use strict"; + var oop = require("../lib/oop"); + var net = require("../lib/net"); + var EventEmitter = require("../lib/event_emitter").EventEmitter; + var config = require("../config"); + function $workerBlob(workerUrl) { + var script = "importScripts('" + net.qualifyURL(workerUrl) + "');"; + try { + return new Blob([ + script + ], { + "type": "application/javascript" + }); + } catch (e) { + var BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder; + var blobBuilder = new BlobBuilder(); + blobBuilder.append(script); + return blobBuilder.getBlob("application/javascript"); + } + } + function createWorker(workerUrl) { + if (typeof Worker == "undefined") return { + postMessage: function() {}, + terminate: function() {} + }; + if (config.get("loadWorkerFromBlob")) { + var blob = $workerBlob(workerUrl); + var URL = window.URL || window.webkitURL; + var blobURL = URL.createObjectURL(blob); + return new Worker(blobURL); + } + return new Worker(workerUrl); + } + var WorkerClient = function(worker) { + if (!worker.postMessage) worker = this.$createWorkerFromOldConfig.apply(this, arguments); + this.$worker = worker; + this.$sendDeltaQueue = this.$sendDeltaQueue.bind(this); + this.changeListener = this.changeListener.bind(this); + this.onMessage = this.onMessage.bind(this); + this.callbackId = 1; + this.callbacks = {}; + this.$worker.onmessage = this.onMessage; + }; + (function() { + oop.implement(this, EventEmitter); + this.$createWorkerFromOldConfig = function(topLevelNamespaces, mod, classname, workerUrl, importScripts) { + if (require.nameToUrl && !require.toUrl) require.toUrl = require.nameToUrl; + if (config.get("packaged") || !require.toUrl) workerUrl = workerUrl || config.moduleUrl(mod, "worker"); + else { + var normalizePath = this.$normalizePath; + workerUrl = workerUrl || normalizePath(require.toUrl("ace/worker/worker.js", null, "_")); + var tlns = {}; + topLevelNamespaces.forEach(function(ns) { + tlns[ns] = normalizePath(require.toUrl(ns, null, "_").replace(/(\.js)?(\?.*)?$/, "")); + }); + } + this.$worker = createWorker(workerUrl); + if (importScripts) this.send("importScripts", importScripts); + this.$worker.postMessage({ + init: true, + tlns: tlns, + module: mod, + classname: classname + }); + return this.$worker; + }; + this.onMessage = function(e) { + var msg = e.data; + switch(msg.type){ + case "event": + this._signal(msg.name, { + data: msg.data + }); + break; + case "call": + var callback = this.callbacks[msg.id]; + if (callback) { + callback(msg.data); + delete this.callbacks[msg.id]; + } + break; + case "error": + this.reportError(msg.data); + break; + case "log": + window.console && console.log && console.log.apply(console, msg.data); + break; + } + }; + this.reportError = function(err) { + window.console && console.error && console.error(err); + }; + this.$normalizePath = function(path) { + return net.qualifyURL(path); + }; + this.terminate = function() { + this._signal("terminate", {}); + this.deltaQueue = null; + this.$worker.terminate(); + this.$worker = null; + if (this.$doc) this.$doc.off("change", this.changeListener); + this.$doc = null; + }; + this.send = function(cmd, args) { + this.$worker.postMessage({ + command: cmd, + args: args + }); + }; + this.call = function(cmd, args, callback) { + if (callback) { + var id = this.callbackId++; + this.callbacks[id] = callback; + args.push(id); + } + this.send(cmd, args); + }; + this.emit = function(event, data) { + try { + if (data.data && data.data.err) data.data.err = { + message: data.data.err.message, + stack: data.data.err.stack, + code: data.data.err.code + }; + this.$worker && this.$worker.postMessage({ + event: event, + data: { + data: data.data + } + }); + } catch (ex) { + console.error(ex.stack); + } + }; + this.attachToDocument = function(doc) { + if (this.$doc) this.terminate(); + this.$doc = doc; + this.call("setValue", [ + doc.getValue() + ]); + doc.on("change", this.changeListener, true); + }; + this.changeListener = function(delta) { + if (!this.deltaQueue) { + this.deltaQueue = []; + setTimeout(this.$sendDeltaQueue, 0); + } + if (delta.action == "insert") this.deltaQueue.push(delta.start, delta.lines); + else this.deltaQueue.push(delta.start, delta.end); + }; + this.$sendDeltaQueue = function() { + var q = this.deltaQueue; + if (!q) return; + this.deltaQueue = null; + if (q.length > 50 && q.length > this.$doc.getLength() >> 1) this.call("setValue", [ + this.$doc.getValue() + ]); + else this.emit("change", { + data: q + }); + }; + }).call(WorkerClient.prototype); + var UIWorkerClient = function(topLevelNamespaces, mod, classname) { + var main = null; + var emitSync = false; + var sender = Object.create(EventEmitter); + var messageBuffer = []; + var workerClient = new WorkerClient({ + messageBuffer: messageBuffer, + terminate: function() {}, + postMessage: function(e) { + messageBuffer.push(e); + if (!main) return; + if (emitSync) setTimeout(processNext); + else processNext(); + } + }); + workerClient.setEmitSync = function(val) { + emitSync = val; + }; + var processNext = function() { + var msg = messageBuffer.shift(); + if (msg.command) main[msg.command].apply(main, msg.args); + else if (msg.event) sender._signal(msg.event, msg.data); + }; + sender.postMessage = function(msg) { + workerClient.onMessage({ + data: msg + }); + }; + sender.callback = function(data, callbackId) { + this.postMessage({ + type: "call", + id: callbackId, + data: data + }); + }; + sender.emit = function(name, data) { + this.postMessage({ + type: "event", + name: name, + data: data + }); + }; + config.loadModule([ + "worker", + mod + ], function(Main) { + main = new Main[classname](sender); + while(messageBuffer.length)processNext(); + }); + return workerClient; + }; + exports.UIWorkerClient = UIWorkerClient; + exports.WorkerClient = WorkerClient; + exports.createWorker = createWorker; +}); +ace.define("ace/placeholder", [ + "require", + "exports", + "module", + "ace/range", + "ace/lib/event_emitter", + "ace/lib/oop" +], function(require, exports, module1) { + "use strict"; + var Range = require("./range").Range; + var EventEmitter = require("./lib/event_emitter").EventEmitter; + var oop = require("./lib/oop"); + var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) { + var _self = this; + this.length = length; + this.session = session; + this.doc = session.getDocument(); + this.mainClass = mainClass; + this.othersClass = othersClass; + this.$onUpdate = this.onUpdate.bind(this); + this.doc.on("change", this.$onUpdate, true); + this.$others = others; + this.$onCursorChange = function() { + setTimeout(function() { + _self.onCursorChange(); + }); + }; + this.$pos = pos; + var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || { + length: -1 + }; + this.$undoStackDepth = undoStack.length; + this.setup(); + session.selection.on("changeCursor", this.$onCursorChange); + }; + (function() { + oop.implement(this, EventEmitter); + this.setup = function() { + var _self = this; + var doc = this.doc; + var session = this.session; + this.selectionBefore = session.selection.toJSON(); + if (session.selection.inMultiSelectMode) session.selection.toSingleRange(); + this.pos = doc.createAnchor(this.$pos.row, this.$pos.column); + var pos = this.pos; + pos.$insertRight = true; + pos.detach(); + pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false); + this.others = []; + this.$others.forEach(function(other) { + var anchor = doc.createAnchor(other.row, other.column); + anchor.$insertRight = true; + anchor.detach(); + _self.others.push(anchor); + }); + session.setUndoSelect(false); + }; + this.showOtherMarkers = function() { + if (this.othersActive) return; + var session = this.session; + var _self = this; + this.othersActive = true; + this.others.forEach(function(anchor) { + anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column + _self.length), _self.othersClass, null, false); + }); + }; + this.hideOtherMarkers = function() { + if (!this.othersActive) return; + this.othersActive = false; + for(var i = 0; i < this.others.length; i++)this.session.removeMarker(this.others[i].markerId); + }; + this.onUpdate = function(delta) { + if (this.$updating) return this.updateAnchors(delta); + var range = delta; + if (range.start.row !== range.end.row) return; + if (range.start.row !== this.pos.row) return; + this.$updating = true; + var lengthDiff = delta.action === "insert" ? range.end.column - range.start.column : range.start.column - range.end.column; + var inMainRange = range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1; + var distanceFromStart = range.start.column - this.pos.column; + this.updateAnchors(delta); + if (inMainRange) this.length += lengthDiff; + if (inMainRange && !this.session.$fromUndo) { + if (delta.action === "insert") for(var i = this.others.length - 1; i >= 0; i--){ + var otherPos = this.others[i]; + var newPos = { + row: otherPos.row, + column: otherPos.column + distanceFromStart + }; + this.doc.insertMergedLines(newPos, delta.lines); + } + else if (delta.action === "remove") for(var i = this.others.length - 1; i >= 0; i--){ + var otherPos = this.others[i]; + var newPos = { + row: otherPos.row, + column: otherPos.column + distanceFromStart + }; + this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff)); + } + } + this.$updating = false; + this.updateMarkers(); + }; + this.updateAnchors = function(delta) { + this.pos.onChange(delta); + for(var i = this.others.length; i--;)this.others[i].onChange(delta); + this.updateMarkers(); + }; + this.updateMarkers = function() { + if (this.$updating) return; + var _self = this; + var session = this.session; + var updateMarker = function(pos, className) { + session.removeMarker(pos.markerId); + pos.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + _self.length), className, null, false); + }; + updateMarker(this.pos, this.mainClass); + for(var i = this.others.length; i--;)updateMarker(this.others[i], this.othersClass); + }; + this.onCursorChange = function(event) { + if (this.$updating || !this.session) return; + var pos = this.session.selection.getCursor(); + if (pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) { + this.showOtherMarkers(); + this._emit("cursorEnter", event); + } else { + this.hideOtherMarkers(); + this._emit("cursorLeave", event); + } + }; + this.detach = function() { + this.session.removeMarker(this.pos && this.pos.markerId); + this.hideOtherMarkers(); + this.doc.off("change", this.$onUpdate); + this.session.selection.off("changeCursor", this.$onCursorChange); + this.session.setUndoSelect(true); + this.session = null; + }; + this.cancel = function() { + if (this.$undoStackDepth === -1) return; + var undoManager = this.session.getUndoManager(); + var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth; + for(var i = 0; i < undosRequired; i++)undoManager.undo(this.session, true); + if (this.selectionBefore) this.session.selection.fromJSON(this.selectionBefore); + }; + }).call(PlaceHolder.prototype); + exports.PlaceHolder = PlaceHolder; +}); +ace.define("ace/mouse/multi_select_handler", [ + "require", + "exports", + "module", + "ace/lib/event", + "ace/lib/useragent" +], function(require, exports, module1) { + var event = require("../lib/event"); + var useragent = require("../lib/useragent"); + function isSamePoint(p1, p2) { + return p1.row == p2.row && p1.column == p2.column; + } + function onMouseDown(e) { + var ev = e.domEvent; + var alt = ev.altKey; + var shift = ev.shiftKey; + var ctrl = ev.ctrlKey; + var accel = e.getAccelKey(); + var button = e.getButton(); + if (ctrl && useragent.isMac) button = ev.button; + if (e.editor.inMultiSelectMode && button == 2) { + e.editor.textInput.onContextMenu(e.domEvent); + return; + } + if (!ctrl && !alt && !accel) { + if (button === 0 && e.editor.inMultiSelectMode) e.editor.exitMultiSelectMode(); + return; + } + if (button !== 0) return; + var editor = e.editor; + var selection = editor.selection; + var isMultiSelect = editor.inMultiSelectMode; + var pos = e.getDocumentPosition(); + var cursor = selection.getCursor(); + var inSelection = e.inSelection() || selection.isEmpty() && isSamePoint(pos, cursor); + var mouseX = e.x, mouseY = e.y; + var onMouseSelection = function(e) { + mouseX = e.clientX; + mouseY = e.clientY; + }; + var session = editor.session; + var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY); + var screenCursor = screenAnchor; + var selectionMode; + if (editor.$mouseHandler.$enableJumpToDef) { + if (ctrl && alt || accel && alt) selectionMode = shift ? "block" : "add"; + else if (alt && editor.$blockSelectEnabled) selectionMode = "block"; + } else { + if (accel && !alt) { + selectionMode = "add"; + if (!isMultiSelect && shift) return; + } else if (alt && editor.$blockSelectEnabled) selectionMode = "block"; + } + if (selectionMode && useragent.isMac && ev.ctrlKey) editor.$mouseHandler.cancelContextMenu(); + if (selectionMode == "add") { + if (!isMultiSelect && inSelection) return; // dragging + if (!isMultiSelect) { + var range = selection.toOrientedRange(); + editor.addSelectionMarker(range); + } + var oldRange = selection.rangeList.rangeAtPoint(pos); + editor.inVirtualSelectionMode = true; + if (shift) { + oldRange = null; + range = selection.ranges[0] || range; + editor.removeSelectionMarker(range); + } + editor.once("mouseup", function() { + var tmpSel = selection.toOrientedRange(); + if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor)) selection.substractPoint(tmpSel.cursor); + else { + if (shift) selection.substractPoint(range.cursor); + else if (range) { + editor.removeSelectionMarker(range); + selection.addRange(range); + } + selection.addRange(tmpSel); + } + editor.inVirtualSelectionMode = false; + }); + } else if (selectionMode == "block") { + e.stop(); + editor.inVirtualSelectionMode = true; + var initialRange; + var rectSel = []; + var blockSelect = function() { + var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY); + var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column, newCursor.offsetX); + if (isSamePoint(screenCursor, newCursor) && isSamePoint(cursor, selection.lead)) return; + screenCursor = newCursor; + editor.selection.moveToPosition(cursor); + editor.renderer.scrollCursorIntoView(); + editor.removeSelectionMarkers(rectSel); + rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor); + if (editor.$mouseHandler.$clickSelection && rectSel.length == 1 && rectSel[0].isEmpty()) rectSel[0] = editor.$mouseHandler.$clickSelection.clone(); + rectSel.forEach(editor.addSelectionMarker, editor); + editor.updateSelectionMarkers(); + }; + if (isMultiSelect && !accel) selection.toSingleRange(); + else if (!isMultiSelect && accel) { + initialRange = selection.toOrientedRange(); + editor.addSelectionMarker(initialRange); + } + if (shift) screenAnchor = session.documentToScreenPosition(selection.lead); + else selection.moveToPosition(pos); + screenCursor = { + row: -1, + column: -1 + }; + var onMouseSelectionEnd = function(e) { + blockSelect(); + clearInterval(timerId); + editor.removeSelectionMarkers(rectSel); + if (!rectSel.length) rectSel = [ + selection.toOrientedRange() + ]; + if (initialRange) { + editor.removeSelectionMarker(initialRange); + selection.toSingleRange(initialRange); + } + for(var i = 0; i < rectSel.length; i++)selection.addRange(rectSel[i]); + editor.inVirtualSelectionMode = false; + editor.$mouseHandler.$clickSelection = null; + }; + var onSelectionInterval = blockSelect; + event.capture(editor.container, onMouseSelection, onMouseSelectionEnd); + var timerId = setInterval(function() { + onSelectionInterval(); + }, 20); + return e.preventDefault(); + } + } + exports.onMouseDown = onMouseDown; +}); +ace.define("ace/commands/multi_select_commands", [ + "require", + "exports", + "module", + "ace/keyboard/hash_handler" +], function(require, exports, module1) { + exports.defaultCommands = [ + { + name: "addCursorAbove", + description: "Add cursor above", + exec: function(editor) { + editor.selectMoreLines(-1); + }, + bindKey: { + win: "Ctrl-Alt-Up", + mac: "Ctrl-Alt-Up" + }, + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "addCursorBelow", + description: "Add cursor below", + exec: function(editor) { + editor.selectMoreLines(1); + }, + bindKey: { + win: "Ctrl-Alt-Down", + mac: "Ctrl-Alt-Down" + }, + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "addCursorAboveSkipCurrent", + description: "Add cursor above (skip current)", + exec: function(editor) { + editor.selectMoreLines(-1, true); + }, + bindKey: { + win: "Ctrl-Alt-Shift-Up", + mac: "Ctrl-Alt-Shift-Up" + }, + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "addCursorBelowSkipCurrent", + description: "Add cursor below (skip current)", + exec: function(editor) { + editor.selectMoreLines(1, true); + }, + bindKey: { + win: "Ctrl-Alt-Shift-Down", + mac: "Ctrl-Alt-Shift-Down" + }, + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selectMoreBefore", + description: "Select more before", + exec: function(editor) { + editor.selectMore(-1); + }, + bindKey: { + win: "Ctrl-Alt-Left", + mac: "Ctrl-Alt-Left" + }, + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selectMoreAfter", + description: "Select more after", + exec: function(editor) { + editor.selectMore(1); + }, + bindKey: { + win: "Ctrl-Alt-Right", + mac: "Ctrl-Alt-Right" + }, + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selectNextBefore", + description: "Select next before", + exec: function(editor) { + editor.selectMore(-1, true); + }, + bindKey: { + win: "Ctrl-Alt-Shift-Left", + mac: "Ctrl-Alt-Shift-Left" + }, + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "selectNextAfter", + description: "Select next after", + exec: function(editor) { + editor.selectMore(1, true); + }, + bindKey: { + win: "Ctrl-Alt-Shift-Right", + mac: "Ctrl-Alt-Shift-Right" + }, + scrollIntoView: "cursor", + readOnly: true + }, + { + name: "toggleSplitSelectionIntoLines", + description: "Split into lines", + exec: function(editor) { + if (editor.multiSelect.rangeCount > 1) editor.multiSelect.joinSelections(); + else editor.multiSelect.splitIntoLines(); + }, + bindKey: { + win: "Ctrl-Alt-L", + mac: "Ctrl-Alt-L" + }, + readOnly: true + }, + { + name: "splitSelectionIntoLines", + description: "Split into lines", + exec: function(editor) { + editor.multiSelect.splitIntoLines(); + }, + readOnly: true + }, + { + name: "alignCursors", + description: "Align cursors", + exec: function(editor) { + editor.alignCursors(); + }, + bindKey: { + win: "Ctrl-Alt-A", + mac: "Ctrl-Alt-A" + }, + scrollIntoView: "cursor" + }, + { + name: "findAll", + description: "Find all", + exec: function(editor) { + editor.findAll(); + }, + bindKey: { + win: "Ctrl-Alt-K", + mac: "Ctrl-Alt-G" + }, + scrollIntoView: "cursor", + readOnly: true + } + ]; + exports.multiSelectCommands = [ + { + name: "singleSelection", + description: "Single selection", + bindKey: "esc", + exec: function(editor) { + editor.exitMultiSelectMode(); + }, + scrollIntoView: "cursor", + readOnly: true, + isAvailable: function(editor) { + return editor && editor.inMultiSelectMode; + } + } + ]; + var HashHandler = require("../keyboard/hash_handler").HashHandler; + exports.keyboardHandler = new HashHandler(exports.multiSelectCommands); +}); +ace.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(require, exports, module1) { + var RangeList = require("./range_list").RangeList; + var Range = require("./range").Range; + var Selection = require("./selection").Selection; + var onMouseDown = require("./mouse/multi_select_handler").onMouseDown; + var event = require("./lib/event"); + var lang = require("./lib/lang"); + var commands = require("./commands/multi_select_commands"); + exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands); + var Search = require("./search").Search; + var search = new Search(); + function find(session, needle, dir) { + search.$options.wrap = true; + search.$options.needle = needle; + search.$options.backwards = dir == -1; + return search.find(session); + } + var EditSession = require("./edit_session").EditSession; + (function() { + this.getSelectionMarkers = function() { + return this.$selectionMarkers; + }; + }).call(EditSession.prototype); + (function() { + this.ranges = null; + this.rangeList = null; + this.addRange = function(range, $blockChangeEvents) { + if (!range) return; + if (!this.inMultiSelectMode && this.rangeCount === 0) { + var oldRange = this.toOrientedRange(); + this.rangeList.add(oldRange); + this.rangeList.add(range); + if (this.rangeList.ranges.length != 2) { + this.rangeList.removeAll(); + return $blockChangeEvents || this.fromOrientedRange(range); + } + this.rangeList.removeAll(); + this.rangeList.add(oldRange); + this.$onAddRange(oldRange); + } + if (!range.cursor) range.cursor = range.end; + var removed = this.rangeList.add(range); + this.$onAddRange(range); + if (removed.length) this.$onRemoveRange(removed); + if (this.rangeCount > 1 && !this.inMultiSelectMode) { + this._signal("multiSelect"); + this.inMultiSelectMode = true; + this.session.$undoSelect = false; + this.rangeList.attach(this.session); + } + return $blockChangeEvents || this.fromOrientedRange(range); + }; + this.toSingleRange = function(range) { + range = range || this.ranges[0]; + var removed = this.rangeList.removeAll(); + if (removed.length) this.$onRemoveRange(removed); + range && this.fromOrientedRange(range); + }; + this.substractPoint = function(pos) { + var removed = this.rangeList.substractPoint(pos); + if (removed) { + this.$onRemoveRange(removed); + return removed[0]; + } + }; + this.mergeOverlappingRanges = function() { + var removed = this.rangeList.merge(); + if (removed.length) this.$onRemoveRange(removed); + }; + this.$onAddRange = function(range) { + this.rangeCount = this.rangeList.ranges.length; + this.ranges.unshift(range); + this._signal("addRange", { + range: range + }); + }; + this.$onRemoveRange = function(removed) { + this.rangeCount = this.rangeList.ranges.length; + if (this.rangeCount == 1 && this.inMultiSelectMode) { + var lastRange = this.rangeList.ranges.pop(); + removed.push(lastRange); + this.rangeCount = 0; + } + for(var i = removed.length; i--;){ + var index = this.ranges.indexOf(removed[i]); + this.ranges.splice(index, 1); + } + this._signal("removeRange", { + ranges: removed + }); + if (this.rangeCount === 0 && this.inMultiSelectMode) { + this.inMultiSelectMode = false; + this._signal("singleSelect"); + this.session.$undoSelect = true; + this.rangeList.detach(this.session); + } + lastRange = lastRange || this.ranges[0]; + if (lastRange && !lastRange.isEqual(this.getRange())) this.fromOrientedRange(lastRange); + }; + this.$initRangeList = function() { + if (this.rangeList) return; + this.rangeList = new RangeList(); + this.ranges = []; + this.rangeCount = 0; + }; + this.getAllRanges = function() { + return this.rangeCount ? this.rangeList.ranges.concat() : [ + this.getRange() + ]; + }; + this.splitIntoLines = function() { + var ranges = this.ranges.length ? this.ranges : [ + this.getRange() + ]; + var newRanges = []; + for(var i = 0; i < ranges.length; i++){ + var range = ranges[i]; + var row = range.start.row; + var endRow = range.end.row; + if (row === endRow) newRanges.push(range.clone()); + else { + newRanges.push(new Range(row, range.start.column, row, this.session.getLine(row).length)); + while(++row < endRow)newRanges.push(this.getLineRange(row, true)); + newRanges.push(new Range(endRow, 0, endRow, range.end.column)); + } + if (i == 0 && !this.isBackwards()) newRanges = newRanges.reverse(); + } + this.toSingleRange(); + for(var i = newRanges.length; i--;)this.addRange(newRanges[i]); + }; + this.joinSelections = function() { + var ranges = this.rangeList.ranges; + var lastRange = ranges[ranges.length - 1]; + var range = Range.fromPoints(ranges[0].start, lastRange.end); + this.toSingleRange(); + this.setSelectionRange(range, lastRange.cursor == lastRange.start); + }; + this.toggleBlockSelection = function() { + if (this.rangeCount > 1) { + var ranges = this.rangeList.ranges; + var lastRange = ranges[ranges.length - 1]; + var range = Range.fromPoints(ranges[0].start, lastRange.end); + this.toSingleRange(); + this.setSelectionRange(range, lastRange.cursor == lastRange.start); + } else { + var cursor = this.session.documentToScreenPosition(this.cursor); + var anchor = this.session.documentToScreenPosition(this.anchor); + var rectSel = this.rectangularRangeBlock(cursor, anchor); + rectSel.forEach(this.addRange, this); + } + }; + this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) { + var rectSel = []; + var xBackwards = screenCursor.column < screenAnchor.column; + if (xBackwards) { + var startColumn = screenCursor.column; + var endColumn = screenAnchor.column; + var startOffsetX = screenCursor.offsetX; + var endOffsetX = screenAnchor.offsetX; + } else { + var startColumn = screenAnchor.column; + var endColumn = screenCursor.column; + var startOffsetX = screenAnchor.offsetX; + var endOffsetX = screenCursor.offsetX; + } + var yBackwards = screenCursor.row < screenAnchor.row; + if (yBackwards) { + var startRow = screenCursor.row; + var endRow = screenAnchor.row; + } else { + var startRow = screenAnchor.row; + var endRow = screenCursor.row; + } + if (startColumn < 0) startColumn = 0; + if (startRow < 0) startRow = 0; + if (startRow == endRow) includeEmptyLines = true; + var docEnd; + for(var row = startRow; row <= endRow; row++){ + var range = Range.fromPoints(this.session.screenToDocumentPosition(row, startColumn, startOffsetX), this.session.screenToDocumentPosition(row, endColumn, endOffsetX)); + if (range.isEmpty()) { + if (docEnd && isSamePoint(range.end, docEnd)) break; + docEnd = range.end; + } + range.cursor = xBackwards ? range.start : range.end; + rectSel.push(range); + } + if (yBackwards) rectSel.reverse(); + if (!includeEmptyLines) { + var end = rectSel.length - 1; + while(rectSel[end].isEmpty() && end > 0)end--; + if (end > 0) { + var start = 0; + while(rectSel[start].isEmpty())start++; + } + for(var i = end; i >= start; i--)if (rectSel[i].isEmpty()) rectSel.splice(i, 1); + } + return rectSel; + }; + }).call(Selection.prototype); + var Editor = require("./editor").Editor; + (function() { + this.updateSelectionMarkers = function() { + this.renderer.updateCursor(); + this.renderer.updateBackMarkers(); + }; + this.addSelectionMarker = function(orientedRange) { + if (!orientedRange.cursor) orientedRange.cursor = orientedRange.end; + var style = this.getSelectionStyle(); + orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style); + this.session.$selectionMarkers.push(orientedRange); + this.session.selectionMarkerCount = this.session.$selectionMarkers.length; + return orientedRange; + }; + this.removeSelectionMarker = function(range) { + if (!range.marker) return; + this.session.removeMarker(range.marker); + var index = this.session.$selectionMarkers.indexOf(range); + if (index != -1) this.session.$selectionMarkers.splice(index, 1); + this.session.selectionMarkerCount = this.session.$selectionMarkers.length; + }; + this.removeSelectionMarkers = function(ranges) { + var markerList = this.session.$selectionMarkers; + for(var i = ranges.length; i--;){ + var range = ranges[i]; + if (!range.marker) continue; + this.session.removeMarker(range.marker); + var index = markerList.indexOf(range); + if (index != -1) markerList.splice(index, 1); + } + this.session.selectionMarkerCount = markerList.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 = true; + this.setStyle("ace_multiselect"); + this.keyBinding.addKeyboardHandler(commands.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 = false; + this.unsetStyle("ace_multiselect"); + this.keyBinding.removeKeyboardHandler(commands.keyboardHandler); + this.commands.removeDefaultHandler("exec", this.$onMultiSelectExec); + this.renderer.updateCursor(); + this.renderer.updateBackMarkers(); + this._emit("changeSelection"); + }; + this.$onMultiSelectExec = function(e) { + var command = e.command; + var editor = e.editor; + if (!editor.multiSelect) return; + if (!command.multiSelectAction) { + var result = command.exec(editor, e.args || {}); + editor.multiSelect.addRange(editor.multiSelect.toOrientedRange()); + editor.multiSelect.mergeOverlappingRanges(); + } else if (command.multiSelectAction == "forEach") result = editor.forEachSelection(command, e.args); + else if (command.multiSelectAction == "forEachLine") result = editor.forEachSelection(command, e.args, true); + else if (command.multiSelectAction == "single") { + editor.exitMultiSelectMode(); + result = command.exec(editor, e.args || {}); + } else result = command.multiSelectAction(editor, e.args || {}); + return result; + }; + this.forEachSelection = function(cmd, args, options) { + if (this.inVirtualSelectionMode) return; + var keepOrder = options && options.keepOrder; + var $byLines = options == true || options && options.$byLines; + var session = this.session; + var selection = this.selection; + var rangeList = selection.rangeList; + var ranges = (keepOrder ? selection : rangeList).ranges; + var result; + if (!ranges.length) return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {}); + var reg = selection._eventRegistry; + selection._eventRegistry = {}; + var tmpSel = new Selection(session); + this.inVirtualSelectionMode = true; + for(var i = ranges.length; i--;){ + if ($byLines) while(i > 0 && ranges[i].start.row == ranges[i - 1].end.row)i--; + tmpSel.fromOrientedRange(ranges[i]); + tmpSel.index = i; + this.selection = session.selection = tmpSel; + var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {}); + if (!result && cmdResult !== undefined) result = cmdResult; + tmpSel.toOrientedRange(ranges[i]); + } + tmpSel.detach(); + this.selection = session.selection = selection; + this.inVirtualSelectionMode = false; + selection._eventRegistry = reg; + selection.mergeOverlappingRanges(); + if (selection.ranges[0]) selection.fromOrientedRange(selection.ranges[0]); + var anim = this.renderer.$scrollAnimation; + this.onCursorChange(); + this.onSelectionChange(); + if (anim && anim.from == anim.to) this.renderer.animateScrolling(anim.from); + return result; + }; + this.exitMultiSelectMode = function() { + if (!this.inMultiSelectMode || this.inVirtualSelectionMode) return; + this.multiSelect.toSingleRange(); + }; + this.getSelectedText = function() { + var text = ""; + if (this.inMultiSelectMode && !this.inVirtualSelectionMode) { + var ranges = this.multiSelect.rangeList.ranges; + var buf = []; + for(var i = 0; i < ranges.length; i++)buf.push(this.session.getTextRange(ranges[i])); + var nl = this.session.getDocument().getNewLineCharacter(); + text = buf.join(nl); + if (text.length == (buf.length - 1) * nl.length) text = ""; + } else if (!this.selection.isEmpty()) text = this.session.getTextRange(this.getSelectionRange()); + return text; + }; + this.$checkMultiselectChange = function(e, anchor) { + if (this.inMultiSelectMode && !this.inVirtualSelectionMode) { + var range = this.multiSelect.ranges[0]; + if (this.multiSelect.isEmpty() && anchor == this.multiSelect.anchor) return; + var pos = anchor == this.multiSelect.anchor ? range.cursor == range.start ? range.end : range.start : range.cursor; + if (pos.row != anchor.row || this.session.$clipPositionToDocument(pos.row, pos.column).column != anchor.column) this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()); + else this.multiSelect.mergeOverlappingRanges(); + } + }; + this.findAll = function(needle, options, additive) { + options = options || {}; + options.needle = needle || options.needle; + if (options.needle == undefined) { + var range = this.selection.isEmpty() ? this.selection.getWordRange() : this.selection.getRange(); + options.needle = this.session.getTextRange(range); + } + this.$search.set(options); + var ranges = this.$search.findAll(this.session); + if (!ranges.length) return 0; + var selection = this.multiSelect; + if (!additive) selection.toSingleRange(ranges[0]); + for(var i = ranges.length; i--;)selection.addRange(ranges[i], true); + if (range && selection.rangeList.rangeAtPoint(range.start)) selection.addRange(range, true); + return ranges.length; + }; + this.selectMoreLines = function(dir, skip) { + var range = this.selection.toOrientedRange(); + var isBackwards = range.cursor == range.end; + var screenLead = this.session.documentToScreenPosition(range.cursor); + if (this.selection.$desiredColumn) screenLead.column = this.selection.$desiredColumn; + var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column); + if (!range.isEmpty()) { + var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start); + var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column); + } else var anchor = lead; + if (isBackwards) { + var newRange = Range.fromPoints(lead, anchor); + newRange.cursor = newRange.start; + } else { + var newRange = Range.fromPoints(anchor, lead); + newRange.cursor = newRange.end; + } + newRange.desiredColumn = screenLead.column; + if (!this.selection.inMultiSelectMode) this.selection.addRange(range); + else if (skip) var toRemove = range.cursor; + this.selection.addRange(newRange); + if (toRemove) this.selection.substractPoint(toRemove); + }; + this.transposeSelections = function(dir) { + var session = this.session; + var sel = session.multiSelect; + var all = sel.ranges; + for(var i = all.length; i--;){ + var range = all[i]; + if (range.isEmpty()) { + var tmp = session.getWordRange(range.start.row, range.start.column); + range.start.row = tmp.start.row; + range.start.column = tmp.start.column; + range.end.row = tmp.end.row; + range.end.column = tmp.end.column; + } + } + sel.mergeOverlappingRanges(); + var words = []; + for(var i = all.length; i--;){ + var range = all[i]; + words.unshift(session.getTextRange(range)); + } + if (dir < 0) words.unshift(words.pop()); + else words.push(words.shift()); + for(var i = all.length; i--;){ + var range = all[i]; + var tmp = range.clone(); + session.replace(range, words[i]); + range.start.row = tmp.start.row; + range.start.column = tmp.start.column; + } + sel.fromOrientedRange(sel.ranges[0]); + }; + this.selectMore = function(dir, skip, stopAtFirst) { + var session = this.session; + var sel = session.multiSelect; + var range = sel.toOrientedRange(); + if (range.isEmpty()) { + range = session.getWordRange(range.start.row, range.start.column); + range.cursor = dir == -1 ? range.start : range.end; + this.multiSelect.addRange(range); + if (stopAtFirst) return; + } + var needle = session.getTextRange(range); + var newRange = find(session, needle, dir); + if (newRange) { + newRange.cursor = dir == -1 ? newRange.start : newRange.end; + this.session.unfold(newRange); + this.multiSelect.addRange(newRange); + this.renderer.scrollCursorIntoView(null, 0.5); + } + if (skip) this.multiSelect.substractPoint(range.cursor); + }; + this.alignCursors = function() { + var session = this.session; + var sel = session.multiSelect; + var ranges = sel.ranges; + var row = -1; + var sameRowRanges = ranges.filter(function(r) { + if (r.cursor.row == row) return true; + row = r.cursor.row; + }); + if (!ranges.length || sameRowRanges.length == ranges.length - 1) { + var range = this.selection.getRange(); + var fr = range.start.row, lr = range.end.row; + var guessRange = fr == lr; + if (guessRange) { + var max = this.session.getLength(); + var line; + do line = this.session.getLine(lr); + while (/[=:]/.test(line) && ++lr < max); + do line = this.session.getLine(fr); + while (/[=:]/.test(line) && --fr > 0); + if (fr < 0) fr = 0; + if (lr >= max) lr = max - 1; + } + var lines = this.session.removeFullLines(fr, lr); + lines = this.$reAlignText(lines, guessRange); + this.session.insert({ + row: fr, + column: 0 + }, lines.join("\n") + "\n"); + if (!guessRange) { + range.start.column = 0; + range.end.column = lines[lines.length - 1].length; + } + this.selection.setRange(range); + } else { + sameRowRanges.forEach(function(r) { + sel.substractPoint(r.cursor); + }); + var maxCol = 0; + var minSpace = Infinity; + var spaceOffsets = ranges.map(function(r) { + var p = r.cursor; + var line = session.getLine(p.row); + var spaceOffset = line.substr(p.column).search(/\S/g); + if (spaceOffset == -1) spaceOffset = 0; + if (p.column > maxCol) maxCol = p.column; + if (spaceOffset < minSpace) minSpace = spaceOffset; + return spaceOffset; + }); + ranges.forEach(function(r, i) { + var p = r.cursor; + var l = maxCol - p.column; + var d = spaceOffsets[i] - minSpace; + if (l > d) session.insert(p, lang.stringRepeat(" ", l - d)); + else session.remove(new Range(p.row, p.column, p.row, p.column - l + d)); + r.start.column = r.end.column = maxCol; + r.start.row = r.end.row = p.row; + r.cursor = r.end; + }); + sel.fromOrientedRange(ranges[0]); + this.renderer.updateCursor(); + this.renderer.updateBackMarkers(); + } + }; + this.$reAlignText = function(lines, forceLeft) { + var isLeftAligned = true, isRightAligned = true; + var startW, textW, endW; + return lines.map(function(line) { + var m = line.match(/(\s*)(.*?)(\s*)([=:].*)/); + if (!m) return [ + line + ]; + if (startW == null) { + startW = m[1].length; + textW = m[2].length; + endW = m[3].length; + return m; + } + if (startW + textW + endW != m[1].length + m[2].length + m[3].length) isRightAligned = false; + if (startW != m[1].length) isLeftAligned = false; + if (startW > m[1].length) startW = m[1].length; + if (textW < m[2].length) textW = m[2].length; + if (endW > m[3].length) endW = m[3].length; + return m; + }).map(forceLeft ? alignLeft : isLeftAligned ? isRightAligned ? alignRight : alignLeft : unAlign); + function spaces(n) { + return lang.stringRepeat(" ", n); + } + function alignLeft(m) { + return !m[2] ? m[0] : spaces(startW) + m[2] + spaces(textW - m[2].length + endW) + m[4].replace(/^([=:])\s+/, "$1 "); + } + function alignRight(m) { + return !m[2] ? m[0] : spaces(startW + textW - m[2].length) + m[2] + spaces(endW) + m[4].replace(/^([=:])\s+/, "$1 "); + } + function unAlign(m) { + return !m[2] ? m[0] : spaces(startW) + m[2] + spaces(endW) + m[4].replace(/^([=:])\s+/, "$1 "); + } + }; + }).call(Editor.prototype); + function isSamePoint(p1, p2) { + return p1.row == p2.row && p1.column == p2.column; + } + exports.onSessionChange = function(e) { + var session = e.session; + if (session && !session.multiSelect) { + session.$selectionMarkers = []; + session.selection.$initRangeList(); + session.multiSelect = session.selection; + } + this.multiSelect = session && session.multiSelect; + var oldSession = e.oldSession; + if (oldSession) { + oldSession.multiSelect.off("addRange", this.$onAddRange); + oldSession.multiSelect.off("removeRange", this.$onRemoveRange); + oldSession.multiSelect.off("multiSelect", this.$onMultiSelect); + oldSession.multiSelect.off("singleSelect", this.$onSingleSelect); + oldSession.multiSelect.lead.off("change", this.$checkMultiselectChange); + oldSession.multiSelect.anchor.off("change", this.$checkMultiselectChange); + } + if (session) { + session.multiSelect.on("addRange", this.$onAddRange); + session.multiSelect.on("removeRange", this.$onRemoveRange); + session.multiSelect.on("multiSelect", this.$onMultiSelect); + session.multiSelect.on("singleSelect", this.$onSingleSelect); + session.multiSelect.lead.on("change", this.$checkMultiselectChange); + session.multiSelect.anchor.on("change", this.$checkMultiselectChange); + } + if (session && this.inMultiSelectMode != session.selection.inMultiSelectMode) { + if (session.selection.inMultiSelectMode) this.$onMultiSelect(); + else this.$onSingleSelect(); + } + }; + function MultiSelect(editor) { + if (editor.$multiselectOnSessionChange) return; + editor.$onAddRange = editor.$onAddRange.bind(editor); + editor.$onRemoveRange = editor.$onRemoveRange.bind(editor); + editor.$onMultiSelect = editor.$onMultiSelect.bind(editor); + editor.$onSingleSelect = editor.$onSingleSelect.bind(editor); + editor.$multiselectOnSessionChange = exports.onSessionChange.bind(editor); + editor.$checkMultiselectChange = editor.$checkMultiselectChange.bind(editor); + editor.$multiselectOnSessionChange(editor); + editor.on("changeSession", editor.$multiselectOnSessionChange); + editor.on("mousedown", onMouseDown); + editor.commands.addCommands(commands.defaultCommands); + addAltCursorListeners(editor); + } + function addAltCursorListeners(editor) { + if (!editor.textInput) return; + var el = editor.textInput.getElement(); + var altCursor = false; + event.addListener(el, "keydown", function(e) { + var altDown = e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey); + if (editor.$blockSelectEnabled && altDown) { + if (!altCursor) { + editor.renderer.setMouseCursor("crosshair"); + altCursor = true; + } + } else if (altCursor) reset(); + }, editor); + event.addListener(el, "keyup", reset, editor); + event.addListener(el, "blur", reset, editor); + function reset(e) { + if (altCursor) { + editor.renderer.setMouseCursor(""); + altCursor = false; + } + } + } + exports.MultiSelect = MultiSelect; + require("./config").defineOptions(Editor.prototype, "editor", { + enableMultiselect: { + set: function(val) { + MultiSelect(this); + if (val) { + this.on("changeSession", this.$multiselectOnSessionChange); + this.on("mousedown", onMouseDown); + } else { + this.off("changeSession", this.$multiselectOnSessionChange); + this.off("mousedown", onMouseDown); + } + }, + value: true + }, + enableBlockSelect: { + set: function(val) { + this.$blockSelectEnabled = val; + }, + value: true + } + }); +}); +ace.define("ace/mode/folding/fold_mode", [ + "require", + "exports", + "module", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var Range = require("../../range").Range; + var FoldMode = exports.FoldMode = function() {}; + (function() { + this.foldingStartMarker = null; + this.foldingStopMarker = null; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + if (this.foldingStartMarker.test(line)) return "start"; + if (foldStyle == "markbeginend" && this.foldingStopMarker && this.foldingStopMarker.test(line)) return "end"; + return ""; + }; + this.getFoldWidgetRange = function(session, foldStyle, row) { + return null; + }; + this.indentationBlock = function(session, row, column) { + var re = /\S/; + var line = session.getLine(row); + var startLevel = line.search(re); + if (startLevel == -1) return; + var startColumn = column || line.length; + var maxRow = session.getLength(); + var startRow = row; + var endRow = row; + while(++row < maxRow){ + var level = session.getLine(row).search(re); + if (level == -1) continue; + if (level <= startLevel) { + var token = session.getTokenAt(row, 0); + if (!token || token.type !== "string") break; + } + endRow = row; + } + if (endRow > startRow) { + var endColumn = session.getLine(endRow).length; + return new Range(startRow, startColumn, endRow, endColumn); + } + }; + this.openingBracketBlock = function(session, bracket, row, column, typeRe) { + var start = { + row: row, + column: column + 1 + }; + var end = session.$findClosingBracket(bracket, start, typeRe); + if (!end) return; + var fw = session.foldWidgets[end.row]; + if (fw == null) fw = session.getFoldWidget(end.row); + if (fw == "start" && end.row > start.row) { + end.row--; + end.column = session.getLine(end.row).length; + } + return Range.fromPoints(start, end); + }; + this.closingBracketBlock = function(session, bracket, row, column, typeRe) { + var end = { + row: row, + column: column + }; + var start = session.$findOpeningBracket(bracket, end); + if (!start) return; + start.column++; + end.column--; + return Range.fromPoints(start, end); + }; + }).call(FoldMode.prototype); +}); +ace.define("ace/line_widgets", [ + "require", + "exports", + "module", + "ace/lib/dom" +], function(require, exports, module1) { + "use strict"; + var dom = require("./lib/dom"); + function LineWidgets(session) { + this.session = session; + 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); + } + (function() { + this.getRowLength = function(row) { + var h; + if (this.lineWidgets) h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0; + else h = 0; + if (!this.$useWrapMode || !this.$wrapData[row]) return 1 + h; + else return this.$wrapData[row].length + 1 + h; + }; + this.$getWidgetScreenLength = function() { + var screenRows = 0; + this.lineWidgets.forEach(function(w) { + if (w && w.rowCount && !w.hidden) screenRows += w.rowCount; + }); + return screenRows; + }; + this.$onChangeEditor = function(e) { + this.attach(e.editor); + }; + this.attach = function(editor) { + if (editor && editor.widgetManager && editor.widgetManager != this) editor.widgetManager.detach(); + if (this.editor == editor) return; + this.detach(); + this.editor = editor; + if (editor) { + editor.widgetManager = this; + editor.renderer.on("beforeRender", this.measureWidgets); + editor.renderer.on("afterRender", this.renderWidgets); + } + }; + this.detach = function(e) { + var editor = this.editor; + if (!editor) return; + this.editor = null; + editor.widgetManager = null; + editor.renderer.off("beforeRender", this.measureWidgets); + editor.renderer.off("afterRender", this.renderWidgets); + var lineWidgets = this.session.lineWidgets; + lineWidgets && lineWidgets.forEach(function(w) { + if (w && w.el && w.el.parentNode) { + w._inDocument = false; + w.el.parentNode.removeChild(w.el); + } + }); + }; + this.updateOnFold = function(e, session) { + var lineWidgets = session.lineWidgets; + if (!lineWidgets || !e.action) return; + var fold = e.data; + var start = fold.start.row; + var end = fold.end.row; + var hide = e.action == "add"; + for(var i = start + 1; i < end; i++)if (lineWidgets[i]) lineWidgets[i].hidden = hide; + if (lineWidgets[end]) { + if (hide) { + if (!lineWidgets[start]) lineWidgets[start] = lineWidgets[end]; + else lineWidgets[end].hidden = hide; + } else { + if (lineWidgets[start] == lineWidgets[end]) lineWidgets[start] = undefined; + lineWidgets[end].hidden = hide; + } + } + }; + this.updateOnChange = function(delta) { + var lineWidgets = this.session.lineWidgets; + if (!lineWidgets) return; + var startRow = delta.start.row; + var len = delta.end.row - startRow; + if (len === 0) ; + else if (delta.action == "remove") { + var removed = lineWidgets.splice(startRow + 1, len); + if (!lineWidgets[startRow] && removed[removed.length - 1]) lineWidgets[startRow] = removed.pop(); + removed.forEach(function(w) { + w && this.removeLineWidget(w); + }, this); + this.$updateRows(); + } else { + var args = new Array(len); + if (lineWidgets[startRow] && lineWidgets[startRow].column != null) { + if (delta.start.column > lineWidgets[startRow].column) startRow++; + } + args.unshift(startRow, 0); + lineWidgets.splice.apply(lineWidgets, args); + this.$updateRows(); + } + }; + this.$updateRows = function() { + var lineWidgets = this.session.lineWidgets; + if (!lineWidgets) return; + var noWidgets = true; + lineWidgets.forEach(function(w, i) { + if (w) { + noWidgets = false; + w.row = i; + while(w.$oldWidget){ + w.$oldWidget.row = i; + w = w.$oldWidget; + } + } + }); + if (noWidgets) this.session.lineWidgets = null; + }; + this.$registerLineWidget = function(w) { + if (!this.session.lineWidgets) this.session.lineWidgets = new Array(this.session.getLength()); + var old = this.session.lineWidgets[w.row]; + if (old) { + w.$oldWidget = old; + if (old.el && old.el.parentNode) { + old.el.parentNode.removeChild(old.el); + old._inDocument = false; + } + } + this.session.lineWidgets[w.row] = w; + return w; + }; + this.addLineWidget = function(w) { + this.$registerLineWidget(w); + w.session = this.session; + if (!this.editor) return w; + var renderer = this.editor.renderer; + if (w.html && !w.el) { + w.el = dom.createElement("div"); + w.el.innerHTML = w.html; + } + if (w.el) { + dom.addCssClass(w.el, "ace_lineWidgetContainer"); + w.el.style.position = "absolute"; + w.el.style.zIndex = 5; + renderer.container.appendChild(w.el); + w._inDocument = true; + if (!w.coverGutter) w.el.style.zIndex = 3; + if (w.pixelHeight == null) w.pixelHeight = w.el.offsetHeight; + } + if (w.rowCount == null) w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight; + var fold = this.session.getFoldAt(w.row, 0); + w.$fold = fold; + if (fold) { + var lineWidgets = this.session.lineWidgets; + if (w.row == fold.end.row && !lineWidgets[fold.start.row]) lineWidgets[fold.start.row] = w; + else w.hidden = true; + } + this.session._emit("changeFold", { + data: { + start: { + row: w.row + } + } + }); + this.$updateRows(); + this.renderWidgets(null, renderer); + this.onWidgetChanged(w); + return w; + }; + this.removeLineWidget = function(w) { + w._inDocument = false; + w.session = null; + if (w.el && w.el.parentNode) w.el.parentNode.removeChild(w.el); + if (w.editor && w.editor.destroy) try { + w.editor.destroy(); + } catch (e) {} + if (this.session.lineWidgets) { + var w1 = this.session.lineWidgets[w.row]; + if (w1 == w) { + this.session.lineWidgets[w.row] = w.$oldWidget; + if (w.$oldWidget) this.onWidgetChanged(w.$oldWidget); + } else while(w1){ + if (w1.$oldWidget == w) { + w1.$oldWidget = w.$oldWidget; + break; + } + w1 = w1.$oldWidget; + } + } + this.session._emit("changeFold", { + data: { + start: { + row: w.row + } + } + }); + this.$updateRows(); + }; + this.getWidgetsAtRow = function(row) { + var lineWidgets = this.session.lineWidgets; + var w = lineWidgets && lineWidgets[row]; + var list = []; + while(w){ + list.push(w); + w = w.$oldWidget; + } + return list; + }; + this.onWidgetChanged = function(w) { + this.session._changedWidgets.push(w); + this.editor && this.editor.renderer.updateFull(); + }; + this.measureWidgets = function(e, renderer) { + var changedWidgets = this.session._changedWidgets; + var config = renderer.layerConfig; + if (!changedWidgets || !changedWidgets.length) return; + var min = Infinity; + for(var i = 0; i < changedWidgets.length; i++){ + var w = changedWidgets[i]; + if (!w || !w.el) continue; + if (w.session != this.session) continue; + if (!w._inDocument) { + if (this.session.lineWidgets[w.row] != w) continue; + w._inDocument = true; + renderer.container.appendChild(w.el); + } + w.h = w.el.offsetHeight; + if (!w.fixedWidth) { + w.w = w.el.offsetWidth; + w.screenWidth = Math.ceil(w.w / config.characterWidth); + } + var rowCount = w.h / config.lineHeight; + if (w.coverLine) { + rowCount -= this.session.getRowLineCount(w.row); + if (rowCount < 0) rowCount = 0; + } + if (w.rowCount != rowCount) { + w.rowCount = rowCount; + if (w.row < min) min = w.row; + } + } + if (min != Infinity) { + this.session._emit("changeFold", { + data: { + start: { + row: min + } + } + }); + this.session.lineWidgetWidth = null; + } + this.session._changedWidgets = []; + }; + this.renderWidgets = function(e, renderer) { + var config = renderer.layerConfig; + var lineWidgets = this.session.lineWidgets; + if (!lineWidgets) return; + var first = Math.min(this.firstRow, config.firstRow); + var last = Math.max(this.lastRow, config.lastRow, lineWidgets.length); + while(first > 0 && !lineWidgets[first])first--; + this.firstRow = config.firstRow; + this.lastRow = config.lastRow; + renderer.$cursorLayer.config = config; + for(var i = first; i <= last; i++){ + var w = lineWidgets[i]; + if (!w || !w.el) continue; + if (w.hidden) { + w.el.style.top = -100 - (w.pixelHeight || 0) + "px"; + continue; + } + if (!w._inDocument) { + w._inDocument = true; + renderer.container.appendChild(w.el); + } + var top = renderer.$cursorLayer.getPixelPosition({ + row: i, + column: 0 + }, true).top; + if (!w.coverLine) top += config.lineHeight * this.session.getRowLineCount(w.row); + w.el.style.top = top - config.offset + "px"; + var left = w.coverGutter ? 0 : renderer.gutterWidth; + if (!w.fixedWidth) left -= renderer.scrollLeft; + w.el.style.left = left + "px"; + if (w.fullWidth && w.screenWidth) w.el.style.minWidth = config.width + 2 * config.padding + "px"; + if (w.fixedWidth) w.el.style.right = renderer.scrollBar.getWidth() + "px"; + else w.el.style.right = ""; + } + }; + }).call(LineWidgets.prototype); + exports.LineWidgets = LineWidgets; +}); +ace.define("ace/ext/error_marker", [ + "require", + "exports", + "module", + "ace/line_widgets", + "ace/lib/dom", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var LineWidgets = require("../line_widgets").LineWidgets; + var dom = require("../lib/dom"); + var Range = require("../range").Range; + function binarySearch(array, needle, comparator) { + var first = 0; + var last = array.length - 1; + while(first <= last){ + var mid = first + last >> 1; + var c = comparator(needle, array[mid]); + if (c > 0) first = mid + 1; + else if (c < 0) last = mid - 1; + else return mid; + } + return -(first + 1); + } + function findAnnotations(session, row, dir) { + var annotations = session.getAnnotations().sort(Range.comparePoints); + if (!annotations.length) return; + var i = binarySearch(annotations, { + row: row, + column: -1 + }, Range.comparePoints); + if (i < 0) i = -i - 1; + if (i >= annotations.length) i = dir > 0 ? 0 : annotations.length - 1; + else if (i === 0 && dir < 0) i = annotations.length - 1; + var annotation = annotations[i]; + if (!annotation || !dir) return; + if (annotation.row === row) { + do annotation = annotations[i += dir]; + while (annotation && annotation.row === row); + if (!annotation) return annotations.slice(); + } + var matched = []; + row = annotation.row; + do { + matched[dir < 0 ? "unshift" : "push"](annotation); + annotation = annotations[i += dir]; + }while (annotation && annotation.row == row); + return matched.length && matched; + } + exports.showErrorMarker = function(editor, dir) { + var session = editor.session; + if (!session.widgetManager) { + session.widgetManager = new LineWidgets(session); + session.widgetManager.attach(editor); + } + var pos = editor.getCursorPosition(); + var row = pos.row; + var oldWidget = session.widgetManager.getWidgetsAtRow(row).filter(function(w) { + return w.type == "errorMarker"; + })[0]; + if (oldWidget) oldWidget.destroy(); + else row -= dir; + var annotations = findAnnotations(session, row, dir); + var gutterAnno; + if (annotations) { + var annotation = annotations[0]; + pos.column = (annotation.pos && typeof annotation.column != "number" ? annotation.pos.sc : annotation.column) || 0; + pos.row = annotation.row; + gutterAnno = editor.renderer.$gutterLayer.$annotations[pos.row]; + } else if (oldWidget) return; + else gutterAnno = { + text: [ + "Looks good!" + ], + className: "ace_ok" + }; + editor.session.unfold(pos.row); + editor.selection.moveToPosition(pos); + var w = { + row: pos.row, + fixedWidth: true, + coverGutter: true, + el: dom.createElement("div"), + type: "errorMarker" + }; + var el = w.el.appendChild(dom.createElement("div")); + var arrow = w.el.appendChild(dom.createElement("div")); + arrow.className = "error_widget_arrow " + gutterAnno.className; + var left = editor.renderer.$cursorLayer.getPixelPosition(pos).left; + arrow.style.left = left + editor.renderer.gutterWidth - 5 + "px"; + w.el.className = "error_widget_wrapper"; + el.className = "error_widget " + gutterAnno.className; + el.innerHTML = gutterAnno.text.join("
"); + el.appendChild(dom.createElement("div")); + var kb = function(_, hashId, keyString) { + if (hashId === 0 && (keyString === "esc" || keyString === "return")) { + w.destroy(); + return { + command: "null" + }; + } + }; + w.destroy = function() { + if (editor.$mouseHandler.isMousePressed) return; + editor.keyBinding.removeKeyboardHandler(kb); + session.widgetManager.removeLineWidget(w); + editor.off("changeSelection", w.destroy); + editor.off("changeSession", w.destroy); + editor.off("mouseup", w.destroy); + editor.off("change", w.destroy); + }; + editor.keyBinding.addKeyboardHandler(kb); + editor.on("changeSelection", w.destroy); + editor.on("changeSession", w.destroy); + editor.on("mouseup", w.destroy); + editor.on("change", w.destroy); + editor.session.widgetManager.addLineWidget(w); + w.el.onmousedown = editor.focus.bind(editor); + editor.renderer.scrollCursorIntoView(null, 0.5, { + bottom: w.el.offsetHeight + }); + }; + dom.importCssString("\n .error_widget_wrapper {\n background: inherit;\n color: inherit;\n border:none\n }\n .error_widget {\n border-top: solid 2px;\n border-bottom: solid 2px;\n margin: 5px 0;\n padding: 10px 40px;\n white-space: pre-wrap;\n }\n .error_widget.ace_error, .error_widget_arrow.ace_error{\n border-color: #ff5a5a\n }\n .error_widget.ace_warning, .error_widget_arrow.ace_warning{\n border-color: #F1D817\n }\n .error_widget.ace_info, .error_widget_arrow.ace_info{\n border-color: #5a5a5a\n }\n .error_widget.ace_ok, .error_widget_arrow.ace_ok{\n border-color: #5aaa5a\n }\n .error_widget_arrow {\n position: absolute;\n border: solid 5px;\n border-top-color: transparent!important;\n border-right-color: transparent!important;\n border-left-color: transparent!important;\n top: -5px;\n }\n", "error_marker.css", false); +}); +ace.define("ace/ace", [ + "require", + "exports", + "module", + "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", + "ace/loader_build" +], function(require, exports, module1) { + "use strict"; + require("./loader_build")(exports); + var dom = require("./lib/dom"); + var event = require("./lib/event"); + var Range = require("./range").Range; + var Editor = require("./editor").Editor; + var EditSession = require("./edit_session").EditSession; + var UndoManager = require("./undomanager").UndoManager; + var Renderer = require("./virtual_renderer").VirtualRenderer; + require("./worker/worker_client"); + require("./keyboard/hash_handler"); + require("./placeholder"); + require("./multi_select"); + require("./mode/folding/fold_mode"); + require("./theme/textmate"); + require("./ext/error_marker"); + exports.config = require("./config"); + exports.edit = function(el, options) { + if (typeof el == "string") { + var _id = el; + el = document.getElementById(_id); + if (!el) throw new Error("ace.edit can't find div #" + _id); + } + if (el && el.env && el.env.editor instanceof Editor) return el.env.editor; + var value = ""; + if (el && /input|textarea/i.test(el.tagName)) { + var oldNode = el; + value = oldNode.value; + el = dom.createElement("pre"); + oldNode.parentNode.replaceChild(el, oldNode); + } else if (el) { + value = el.textContent; + el.innerHTML = ""; + } + var doc = exports.createEditSession(value); + var editor = new Editor(new Renderer(el), doc, options); + var env = { + document: doc, + editor: editor, + onResize: editor.resize.bind(editor, null) + }; + if (oldNode) env.textarea = oldNode; + event.addListener(window, "resize", env.onResize); + editor.on("destroy", function() { + event.removeListener(window, "resize", env.onResize); + env.editor.container.env = null; // prevent memory leak on old ie + }); + editor.container.env = editor.env = env; + return editor; + }; + exports.createEditSession = function(text, mode) { + var doc = new EditSession(text, mode); + doc.setUndoManager(new UndoManager()); + return doc; + }; + exports.Range = Range; + exports.Editor = Editor; + exports.EditSession = EditSession; + exports.UndoManager = UndoManager; + exports.VirtualRenderer = Renderer; + exports.version = exports.config.version; +}); +(function() { + ace.require([ + "ace/ace" + ], function(a) { + if (a) { + a.config.init(true); + a.define = ace.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 (module) module.exports = window.ace; + }); +})(); + +},{}],"6emId":[function(require,module,exports) { +/** + * Lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright JS Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ /** Used as the size to enable large array optimizations. */ var global = arguments[3]; +var LARGE_ARRAY_SIZE = 200; +/** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = "__lodash_hash_undefined__"; +/** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; +/** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; +/** `Object#toString` result references. */ var argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", promiseTag = "[object Promise]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]"; +var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]"; +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; +/** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; +/** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; +/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == "object" && global && global.Object === Object && global; +/** Detect free variable `self`. */ var freeSelf = typeof self == "object" && self && self.Object === Object && self; +/** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function("return this")(); +/** Detect free variable `exports`. */ var freeExports = exports && !exports.nodeType && exports; +/** Detect free variable `module`. */ var freeModule = freeExports && true && module && !module.nodeType && module; +/** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; +/** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; +/** Used to access faster Node.js helpers. */ var nodeUtil = function() { + try { + return freeProcess && freeProcess.binding && freeProcess.binding("util"); + } catch (e) {} +}(); +/* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; +/** + * A specialized version of `_.filter` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {Array} Returns the new filtered array. + */ function arrayFilter(array, predicate) { + var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; + while(++index < length){ + var value = array[index]; + if (predicate(value, index, array)) result[resIndex++] = value; + } + return result; +} +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ function arrayPush(array, values) { + var index = -1, length = values.length, offset = array.length; + while(++index < length)array[offset + index] = values[index]; + return array; +} +/** + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + */ function arraySome(array, predicate) { + var index = -1, length = array == null ? 0 : array.length; + while(++index < length){ + if (predicate(array[index], index, array)) return true; + } + return false; +} +/** + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. + * + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. + */ function baseTimes(n, iteratee) { + var index = -1, result = Array(n); + while(++index < n)result[index] = iteratee(index); + return result; +} +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ function baseUnary(func) { + return function(value) { + return func(value); + }; +} +/** + * Checks if a `cache` value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function cacheHas(cache, key) { + return cache.has(key); +} +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ function getValue(object, key) { + return object == null ? undefined : object[key]; +} +/** + * Converts `map` to its key-value pairs. + * + * @private + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. + */ function mapToArray(map) { + var index = -1, result = Array(map.size); + map.forEach(function(value, key) { + result[++index] = [ + key, + value + ]; + }); + return result; +} +/** + * Creates a unary function that invokes `func` with its argument transformed. + * + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. + */ function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; +} +/** + * Converts `set` to an array of its values. + * + * @private + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. + */ function setToArray(set) { + var index = -1, result = Array(set.size); + set.forEach(function(value) { + result[++index] = value; + }); + return result; +} +/** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; +/** Used to detect overreaching core-js shims. */ var coreJsData = root["__core-js_shared__"]; +/** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; +/** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; +/** Used to detect methods masquerading as native. */ var maskSrcKey = function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; +}(); +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ var nativeObjectToString = objectProto.toString; +/** Used to detect if a method is native. */ var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); +/** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined, Symbol = root.Symbol, Uint8Array = root.Uint8Array, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, symToStringTag = Symbol ? Symbol.toStringTag : undefined; +/* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeKeys = overArg(Object.keys, Object); +/* Built-in method references that are verified to be native. */ var DataView = getNative(root, "DataView"), Map = getNative(root, "Map"), Promise = getNative(root, "Promise"), Set = getNative(root, "Set"), WeakMap = getNative(root, "WeakMap"), nativeCreate = getNative(Object, "create"); +/** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); +/** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function Hash(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; + this.size = 0; +} +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function hashDelete(key) { + var result = this.has(key) && delete this.__data__[key]; + this.size -= result ? 1 : 0; + return result; +} +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ function hashSet(key, value) { + var data = this.__data__; + this.size += this.has(key) ? 0 : 1; + data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value; + return this; +} +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype["delete"] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function ListCache(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ function listCacheClear() { + this.__data__ = []; + this.size = 0; +} +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function listCacheDelete(key) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) return false; + var lastIndex = data.length - 1; + if (index == lastIndex) data.pop(); + else splice.call(data, index, 1); + --this.size; + return true; +} +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function listCacheGet(key) { + var data = this.__data__, index = assocIndexOf(data, key); + return index < 0 ? undefined : data[index][1]; +} +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ function listCacheSet(key, value) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) { + ++this.size; + data.push([ + key, + value + ]); + } else data[index][1] = value; + return this; +} +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype["delete"] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function MapCache(entries) { + var index = -1, length = entries == null ? 0 : entries.length; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ function mapCacheClear() { + this.size = 0; + this.__data__ = { + "hash": new Hash, + "map": new (Map || ListCache), + "string": new Hash + }; +} +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function mapCacheDelete(key) { + var result = getMapData(this, key)["delete"](key); + this.size -= result ? 1 : 0; + return result; +} +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function mapCacheGet(key) { + return getMapData(this, key).get(key); +} +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function mapCacheHas(key) { + return getMapData(this, key).has(key); +} +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ function mapCacheSet(key, value) { + var data = getMapData(this, key), size = data.size; + data.set(key, value); + this.size += data.size == size ? 0 : 1; + return this; +} +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype["delete"] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; +/** + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. + */ function SetCache(values) { + var index = -1, length = values == null ? 0 : values.length; + this.__data__ = new MapCache; + while(++index < length)this.add(values[index]); +} +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; +} +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ function setCacheHas(value) { + return this.__data__.has(value); +} +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function Stack(entries) { + var data = this.__data__ = new ListCache(entries); + this.size = data.size; +} +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ function stackClear() { + this.__data__ = new ListCache; + this.size = 0; +} +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function stackDelete(key) { + var data = this.__data__, result = data["delete"](key); + this.size = data.size; + return result; +} +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function stackGet(key) { + return this.__data__.get(key); +} +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function stackHas(key) { + return this.__data__.has(key); +} +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ function stackSet(key, value) { + var data = this.__data__; + if (data instanceof ListCache) { + var pairs = data.__data__; + if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) { + pairs.push([ + key, + value + ]); + this.size = ++data.size; + return this; + } + data = this.__data__ = new MapCache(pairs); + } + data.set(key, value); + this.size = data.size; + return this; +} +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype["delete"] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; + for(var key in value)if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode. + (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties. + isIndex(key, length)))) result.push(key); + return result; +} +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ function assocIndexOf(array, key) { + var length = array.length; + while(length--){ + if (eq(array[length][0], key)) return length; + } + return -1; +} +/** + * The base implementation of `getAllKeys` and `getAllKeysIn` which uses + * `keysFunc` and `symbolsFunc` to get the enumerable property names and + * symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Function} keysFunc The function to get the keys of `object`. + * @param {Function} symbolsFunc The function to get the symbols of `object`. + * @returns {Array} Returns the array of property names and symbols. + */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { + var result = keysFunc(object); + return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); +} +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ function baseGetTag(value) { + if (value == null) return value === undefined ? undefinedTag : nullTag; + return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); +} +/** + * The base implementation of `_.isArguments`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + */ function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; +} +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {boolean} bitmask The bitmask flags. + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Function} [customizer] The function to customize comparisons. + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ function baseIsEqual(value, other, bitmask, customizer, stack) { + if (value === other) return true; + if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) return value !== value && other !== other; + return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); +} +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { + var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); + objTag = objTag == argsTag ? objectTag : objTag; + othTag = othTag == argsTag ? objectTag : othTag; + var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; + if (isSameTag && isBuffer(object)) { + if (!isBuffer(other)) return false; + objIsArr = true; + objIsObj = false; + } + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); + } + if (!(bitmask & COMPARE_PARTIAL_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__"); + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); + } + } + if (!isSameTag) return false; + stack || (stack = new Stack); + return equalObjects(object, other, bitmask, customizer, equalFunc, stack); +} +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) return false; + var pattern = isFunction(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ function baseIsTypedArray(value) { + return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; +} +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ function baseKeys(object) { + if (!isPrototype(object)) return nativeKeys(object); + var result = []; + for(var key in Object(object))if (hasOwnProperty.call(object, key) && key != "constructor") result.push(key); + return result; +} +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; + if (arrLength != othLength && !(isPartial && othLength > arrLength)) return false; + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked && stack.get(other)) return stacked == other; + var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache : undefined; + stack.set(array, other); + stack.set(other, array); + // Ignore non-index properties. + while(++index < arrLength){ + var arrValue = array[index], othValue = other[index]; + if (customizer) var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); + if (compared !== undefined) { + if (compared) continue; + result = false; + break; + } + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) return seen.push(othIndex); + })) { + result = false; + break; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { + result = false; + break; + } + } + stack["delete"](array); + stack["delete"](other); + return result; +} +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { + switch(tag){ + case dataViewTag: + if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) return false; + object = object.buffer; + other = other.buffer; + case arrayBufferTag: + if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) return false; + return true; + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + case errorTag: + return object.name == other.name && object.message == other.message; + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == other + ""; + case mapTag: + var convert = mapToArray; + case setTag: + var isPartial = bitmask & COMPARE_PARTIAL_FLAG; + convert || (convert = setToArray); + if (object.size != other.size && !isPartial) return false; + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) return stacked == other; + bitmask |= COMPARE_UNORDERED_FLAG; + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); + stack["delete"](object); + return result; + case symbolTag: + if (symbolValueOf) return symbolValueOf.call(object) == symbolValueOf.call(other); + } + return false; +} +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. + * @param {Function} customizer The function to customize comparisons. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { + var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; + if (objLength != othLength && !isPartial) return false; + var index = objLength; + while(index--){ + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked && stack.get(other)) return stacked == other; + var result = true; + stack.set(object, other); + stack.set(other, object); + var skipCtor = isPartial; + while(++index < objLength){ + key = objProps[index]; + var objValue = object[key], othValue = other[key]; + if (customizer) var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) { + result = false; + break; + } + skipCtor || (skipCtor = key == "constructor"); + } + if (result && !skipCtor) { + var objCtor = object.constructor, othCtor = other.constructor; + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && "constructor" in object && "constructor" in other && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) result = false; + } + stack["delete"](object); + stack["delete"](other); + return result; +} +/** + * Creates an array of own enumerable property names and symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names and symbols. + */ function getAllKeys(object) { + return baseGetAllKeys(object, keys, getSymbols); +} +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; +} +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) value[symToStringTag] = tag; + else delete value[symToStringTag]; + } + return result; +} +/** + * Creates an array of the own enumerable symbols of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of symbols. + */ var getSymbols = !nativeGetSymbols ? stubArray : function(object) { + if (object == null) return []; + object = Object(object); + return arrayFilter(nativeGetSymbols(object), function(symbol) { + return propertyIsEnumerable.call(object, symbol); + }); +}; +/** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ var getTag = baseGetTag; +// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. +if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map) != mapTag || Promise && getTag(Promise.resolve()) != promiseTag || Set && getTag(new Set) != setTag || WeakMap && getTag(new WeakMap) != weakMapTag) getTag = function(value) { + var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : ""; + if (ctorString) switch(ctorString){ + case dataViewCtorString: + return dataViewTag; + case mapCtorString: + return mapTag; + case promiseCtorString: + return promiseTag; + case setCtorString: + return setTag; + case weakMapCtorString: + return weakMapTag; + } + return result; +}; +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && (typeof value == "number" || reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length; +} +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ function isKeyable(value) { + var type = typeof value; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; +} +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; +} +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ function isPrototype(value) { + var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto; + return value === proto; +} +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ function objectToString(value) { + return nativeObjectToString.call(value); +} +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to convert. + * @returns {string} Returns the source code. + */ function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return func + ""; + } catch (e1) {} + } + return ""; +} +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ function eq(value, other) { + return value === other || value !== value && other !== other; +} +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ var isArguments = baseIsArguments(function() { + return arguments; +}()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); +}; +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ var isArray = Array.isArray; +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); +} +/** + * Checks if `value` is a buffer. + * + * @static + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. + * @example + * + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false + */ var isBuffer = nativeIsBuffer || stubFalse; +/** + * Performs a deep comparison between two values to determine if they are + * equivalent. + * + * **Note:** This method supports comparing arrays, array buffers, booleans, + * date objects, error objects, maps, numbers, `Object` objects, regexes, + * sets, strings, symbols, and typed arrays. `Object` objects are compared + * by their own, not inherited, enumerable properties. Functions and DOM + * nodes are compared by strict equality, i.e. `===`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.isEqual(object, other); + * // => true + * + * object === other; + * // => false + */ function isEqual(value, other) { + return baseIsEqual(value, other); +} +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ function isFunction(value) { + if (!isObject(value)) return false; + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +} +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ function isLength(value) { + return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ function isObject(value) { + var type = typeof value; + return value != null && (type == "object" || type == "function"); +} +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ function isObjectLike(value) { + return value != null && typeof value == "object"; +} +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +} +/** + * This method returns a new empty array. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {Array} Returns the new empty array. + * @example + * + * var arrays = _.times(2, _.stubArray); + * + * console.log(arrays); + * // => [[], []] + * + * console.log(arrays[0] === arrays[1]); + * // => false + */ function stubArray() { + return []; +} +/** + * This method returns `false`. + * + * @static + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] + */ function stubFalse() { + return false; +} +module.exports = isEqual; + +},{}],"aBDZN":[function(require,module,exports) { +var global = arguments[3]; +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getAceInstance = exports.debounce = exports.editorEvents = exports.editorOptions = void 0; +var editorOptions = [ + "minLines", + "maxLines", + "readOnly", + "highlightActiveLine", + "tabSize", + "enableBasicAutocompletion", + "enableLiveAutocompletion", + "enableSnippets" +]; +exports.editorOptions = editorOptions; +var editorEvents = [ + "onChange", + "onFocus", + "onInput", + "onBlur", + "onCopy", + "onPaste", + "onSelectionChange", + "onCursorChange", + "onScroll", + "handleOptions", + "updateRef" +]; +exports.editorEvents = editorEvents; +var getAceInstance = function() { + var ace; + if (typeof window === "undefined") { + // ace-builds just needs some window object to attach ace to. + // During SSR even just an empty object will work. + global.window = {}; + ace = require("f884ef4190ebfcf7"); + // And it can be discarded immediately afterward to avoid confusing + // other libraries that might detect SSR the same way we did. + delete global.window; + } else if (window.ace) { + // Fallback for ace.require when vanilla ACE is hosted over a CDN + ace = window.ace; + ace.acequire = window.ace.require || window.ace.acequire; + } else ace = require("f884ef4190ebfcf7"); + return ace; +}; +exports.getAceInstance = getAceInstance; +var debounce = function(fn, delay) { + var timer = null; + // tslint:disable-next-line + return function() { + var context = this; + var args = arguments; + clearTimeout(timer); + timer = setTimeout(function() { + fn.apply(context, args); + }, delay); + }; +}; +exports.debounce = debounce; + +},{"f884ef4190ebfcf7":"lnKN4"}],"fUVNl":[function(require,module,exports) { +"use strict"; +var __extends = this && this.__extends || function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || ({ + __proto__: [] + }) instanceof Array && function(d, b) { + d.__proto__ = b; + } || function(d, b) { + for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +Object.defineProperty(exports, "__esModule", { + value: true +}); +var PropTypes = require("2f847055cb7c01e9"); +var React = require("dc3c31bcbbad84e6"); +var split_1 = require("ab8f1b89920048d9"); +var DiffMatchPatch = require("e08a7beb00babd4f"); +var DiffComponent = /** @class */ function(_super) { + __extends(DiffComponent, _super); + function DiffComponent(props) { + var _this = _super.call(this, props) || this; + _this.state = { + value: _this.props.value + }; + _this.onChange = _this.onChange.bind(_this); + _this.diff = _this.diff.bind(_this); + return _this; + } + DiffComponent.prototype.componentDidUpdate = function() { + var value = this.props.value; + if (value !== this.state.value) this.setState({ + value: value + }); + }; + DiffComponent.prototype.onChange = function(value) { + this.setState({ + value: value + }); + if (this.props.onChange) this.props.onChange(value); + }; + DiffComponent.prototype.diff = function() { + var dmp = new DiffMatchPatch(); + var lhString = this.state.value[0]; + var rhString = this.state.value[1]; + if (lhString.length === 0 && rhString.length === 0) return []; + var diff = dmp.diff_main(lhString, rhString); + dmp.diff_cleanupSemantic(diff); + var diffedLines = this.generateDiffedLines(diff); + var codeEditorSettings = this.setCodeMarkers(diffedLines); + return codeEditorSettings; + }; + DiffComponent.prototype.generateDiffedLines = function(diff) { + var C = { + DIFF_EQUAL: 0, + DIFF_DELETE: -1, + DIFF_INSERT: 1 + }; + var diffedLines = { + left: [], + right: [] + }; + var cursor = { + left: 1, + right: 1 + }; + diff.forEach(function(chunk) { + var chunkType = chunk[0]; + var text = chunk[1]; + var lines = text.split("\n").length - 1; + // diff-match-patch sometimes returns empty strings at random + if (text.length === 0) return; + var firstChar = text[0]; + var lastChar = text[text.length - 1]; + var linesToHighlight = 0; + switch(chunkType){ + case C.DIFF_EQUAL: + cursor.left += lines; + cursor.right += lines; + break; + case C.DIFF_DELETE: + // If the deletion starts with a newline, push the cursor down to that line + if (firstChar === "\n") { + cursor.left++; + lines--; + } + linesToHighlight = lines; + // If the deletion does not include a newline, highlight the same line on the right + if (linesToHighlight === 0) diffedLines.right.push({ + startLine: cursor.right, + endLine: cursor.right + }); + // If the last character is a newline, we don't want to highlight that line + if (lastChar === "\n") linesToHighlight -= 1; + diffedLines.left.push({ + startLine: cursor.left, + endLine: cursor.left + linesToHighlight + }); + cursor.left += lines; + break; + case C.DIFF_INSERT: + // If the insertion starts with a newline, push the cursor down to that line + if (firstChar === "\n") { + cursor.right++; + lines--; + } + linesToHighlight = lines; + // If the insertion does not include a newline, highlight the same line on the left + if (linesToHighlight === 0) diffedLines.left.push({ + startLine: cursor.left, + endLine: cursor.left + }); + // If the last character is a newline, we don't want to highlight that line + if (lastChar === "\n") linesToHighlight -= 1; + diffedLines.right.push({ + startLine: cursor.right, + endLine: cursor.right + linesToHighlight + }); + cursor.right += lines; + break; + default: + throw new Error("Diff type was not defined."); + } + }); + return diffedLines; + }; + // Receives a collection of line numbers and iterates through them to highlight appropriately + // Returns an object that tells the render() method how to display the code editors + DiffComponent.prototype.setCodeMarkers = function(diffedLines) { + if (diffedLines === void 0) diffedLines = { + left: [], + right: [] + }; + var codeEditorSettings = []; + var newMarkerSet = { + left: [], + right: [] + }; + for(var i = 0; i < diffedLines.left.length; i++){ + var markerObj = { + startRow: diffedLines.left[i].startLine - 1, + endRow: diffedLines.left[i].endLine, + type: "text", + className: "codeMarker" + }; + newMarkerSet.left.push(markerObj); + } + for(var i = 0; i < diffedLines.right.length; i++){ + var markerObj = { + startRow: diffedLines.right[i].startLine - 1, + endRow: diffedLines.right[i].endLine, + type: "text", + className: "codeMarker" + }; + newMarkerSet.right.push(markerObj); + } + codeEditorSettings[0] = newMarkerSet.left; + codeEditorSettings[1] = newMarkerSet.right; + return codeEditorSettings; + }; + DiffComponent.prototype.render = function() { + var markers = this.diff(); + return React.createElement(split_1.default, { + name: this.props.name, + className: this.props.className, + focus: this.props.focus, + orientation: this.props.orientation, + splits: this.props.splits, + mode: this.props.mode, + theme: this.props.theme, + height: this.props.height, + width: this.props.width, + fontSize: this.props.fontSize, + showGutter: this.props.showGutter, + onChange: this.onChange, + onPaste: this.props.onPaste, + onLoad: this.props.onLoad, + onScroll: this.props.onScroll, + minLines: this.props.minLines, + maxLines: this.props.maxLines, + readOnly: this.props.readOnly, + highlightActiveLine: this.props.highlightActiveLine, + showPrintMargin: this.props.showPrintMargin, + tabSize: this.props.tabSize, + cursorStart: this.props.cursorStart, + editorProps: this.props.editorProps, + style: this.props.style, + scrollMargin: this.props.scrollMargin, + setOptions: this.props.setOptions, + wrapEnabled: this.props.wrapEnabled, + enableBasicAutocompletion: this.props.enableBasicAutocompletion, + enableLiveAutocompletion: this.props.enableLiveAutocompletion, + value: this.state.value, + markers: markers + }); + }; + DiffComponent.propTypes = { + cursorStart: PropTypes.number, + editorProps: PropTypes.object, + enableBasicAutocompletion: PropTypes.bool, + enableLiveAutocompletion: PropTypes.bool, + focus: PropTypes.bool, + fontSize: PropTypes.number, + height: PropTypes.string, + highlightActiveLine: PropTypes.bool, + maxLines: PropTypes.number, + minLines: PropTypes.number, + mode: PropTypes.string, + name: PropTypes.string, + className: PropTypes.string, + onLoad: PropTypes.func, + onPaste: PropTypes.func, + onScroll: PropTypes.func, + onChange: PropTypes.func, + orientation: PropTypes.string, + readOnly: PropTypes.bool, + scrollMargin: PropTypes.array, + setOptions: PropTypes.object, + showGutter: PropTypes.bool, + showPrintMargin: PropTypes.bool, + splits: PropTypes.number, + style: PropTypes.object, + tabSize: PropTypes.number, + theme: PropTypes.string, + value: PropTypes.array, + width: PropTypes.string, + wrapEnabled: PropTypes.bool + }; + DiffComponent.defaultProps = { + cursorStart: 1, + editorProps: {}, + enableBasicAutocompletion: false, + enableLiveAutocompletion: false, + focus: false, + fontSize: 12, + height: "500px", + highlightActiveLine: true, + maxLines: null, + minLines: null, + mode: "", + name: "ace-editor", + onLoad: null, + onScroll: null, + onPaste: null, + onChange: null, + orientation: "beside", + readOnly: false, + scrollMargin: [ + 0, + 0, + 0, + 0 + ], + setOptions: {}, + showGutter: true, + showPrintMargin: true, + splits: 2, + style: {}, + tabSize: 4, + theme: "github", + value: [ + "", + "" + ], + width: "500px", + wrapEnabled: true + }; + return DiffComponent; +}(React.Component); +exports.default = DiffComponent; + +},{"2f847055cb7c01e9":"7wKI2","dc3c31bcbbad84e6":"21dqq","ab8f1b89920048d9":"9GbQS","e08a7beb00babd4f":"cNEdG"}],"9GbQS":[function(require,module,exports) { +"use strict"; +var __extends = this && this.__extends || function() { + var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || ({ + __proto__: [] + }) instanceof Array && function(d, b) { + d.__proto__ = b; + } || function(d, b) { + for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; + }; + return extendStatics(d, b); + }; + return function(d, b) { + if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { + this.constructor = d; + } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +}(); +var __assign = this && this.__assign || function() { + __assign = Object.assign || function(t) { + for(var s, i = 1, n = arguments.length; i < n; i++){ + s = arguments[i]; + for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { + value: true +}); +var editorOptions_1 = require("d8dc882e532787df"); +var ace = (0, editorOptions_1.getAceInstance)(); +var ace_builds_1 = require("2856fbeb75237ae3"); +var ext_split_1 = require("9f1e7e9c87225329"); +var PropTypes = require("a6436e3504458a15"); +var React = require("8751a6a7f7def8c3"); +var isEqual = require("152c7a161aa8cafe"); +var get = require("707e28a34fa4a41c"); +var SplitComponent = /** @class */ function(_super) { + __extends(SplitComponent, _super); + function SplitComponent(props) { + var _this = _super.call(this, props) || this; + editorOptions_1.editorEvents.forEach(function(method) { + _this[method] = _this[method].bind(_this); + }); + _this.debounce = editorOptions_1.debounce; + return _this; + } + SplitComponent.prototype.isInShadow = function(node) { + var parent = node && node.parentNode; + while(parent){ + if (parent.toString() === "[object ShadowRoot]") return true; + parent = parent.parentNode; + } + return false; + }; + SplitComponent.prototype.componentDidMount = function() { + var _this = this; + var _a = this.props, className = _a.className, onBeforeLoad = _a.onBeforeLoad, mode = _a.mode, focus = _a.focus, theme = _a.theme, fontSize = _a.fontSize, value = _a.value, defaultValue = _a.defaultValue, cursorStart = _a.cursorStart, showGutter = _a.showGutter, wrapEnabled = _a.wrapEnabled, showPrintMargin = _a.showPrintMargin, _b = _a.scrollMargin, scrollMargin = _b === void 0 ? [ + 0, + 0, + 0, + 0 + ] : _b, keyboardHandler = _a.keyboardHandler, onLoad = _a.onLoad, commands = _a.commands, annotations = _a.annotations, markers = _a.markers, splits = _a.splits; + this.editor = ace.edit(this.refEditor); + if (this.isInShadow(this.refEditor)) this.editor.renderer.attachToShadowRoot(); + this.editor.setTheme("ace/theme/" + theme); + if (onBeforeLoad) onBeforeLoad(ace); + var editorProps = Object.keys(this.props.editorProps); + var split = new ext_split_1.Split(this.editor.container, "ace/theme/" + theme, splits); + this.editor.env.split = split; + this.splitEditor = split.getEditor(0); + this.split = split; + // in a split scenario we don't want a print margin for the entire application + this.editor.setShowPrintMargin(false); + this.editor.renderer.setShowGutter(false); + // get a list of possible options to avoid 'misspelled option errors' + var availableOptions = this.splitEditor.$options; + if (this.props.debounceChangePeriod) this.onChange = this.debounce(this.onChange, this.props.debounceChangePeriod); + split.forEach(function(editor, index) { + for(var i = 0; i < editorProps.length; i++)editor[editorProps[i]] = _this.props.editorProps[editorProps[i]]; + var defaultValueForEditor = get(defaultValue, index); + var valueForEditor = get(value, index, ""); + editor.session.setUndoManager(new ace.UndoManager()); + editor.setTheme("ace/theme/" + theme); + editor.renderer.setScrollMargin(scrollMargin[0], scrollMargin[1], scrollMargin[2], scrollMargin[3]); + editor.getSession().setMode("ace/mode/" + mode); + editor.setFontSize(fontSize); + editor.renderer.setShowGutter(showGutter); + editor.getSession().setUseWrapMode(wrapEnabled); + editor.setShowPrintMargin(showPrintMargin); + editor.on("focus", _this.onFocus); + editor.on("blur", _this.onBlur); + editor.on("input", _this.onInput); + editor.on("copy", _this.onCopy); + editor.on("paste", _this.onPaste); + editor.on("change", _this.onChange); + editor.getSession().selection.on("changeSelection", _this.onSelectionChange); + editor.getSession().selection.on("changeCursor", _this.onCursorChange); + editor.session.on("changeScrollTop", _this.onScroll); + editor.setValue(defaultValueForEditor === undefined ? valueForEditor : defaultValueForEditor, cursorStart); + var newAnnotations = get(annotations, index, []); + var newMarkers = get(markers, index, []); + editor.getSession().setAnnotations(newAnnotations); + if (newMarkers && newMarkers.length > 0) _this.handleMarkers(newMarkers, editor); + for(var i = 0; i < editorOptions_1.editorOptions.length; i++){ + var option = editorOptions_1.editorOptions[i]; + if (availableOptions.hasOwnProperty(option)) editor.setOption(option, _this.props[option]); + else if (_this.props[option]) console.warn("ReaceAce: editor option " + option + " was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"); + } + _this.handleOptions(_this.props, editor); + if (Array.isArray(commands)) commands.forEach(function(command) { + if (typeof command.exec === "string") editor.commands.bindKey(command.bindKey, command.exec); + else editor.commands.addCommand(command); + }); + if (keyboardHandler) editor.setKeyboardHandler("ace/keyboard/" + keyboardHandler); + }); + if (className) this.refEditor.className += " " + className; + if (focus) this.splitEditor.focus(); + var sp = this.editor.env.split; + sp.setOrientation(this.props.orientation === "below" ? sp.BELOW : sp.BESIDE); + sp.resize(true); + if (onLoad) onLoad(sp); + }; + SplitComponent.prototype.componentDidUpdate = function(prevProps) { + var _this = this; + var oldProps = prevProps; + var nextProps = this.props; + var split = this.editor.env.split; + if (nextProps.splits !== oldProps.splits) split.setSplits(nextProps.splits); + if (nextProps.orientation !== oldProps.orientation) split.setOrientation(nextProps.orientation === "below" ? split.BELOW : split.BESIDE); + split.forEach(function(editor, index) { + if (nextProps.mode !== oldProps.mode) editor.getSession().setMode("ace/mode/" + nextProps.mode); + if (nextProps.keyboardHandler !== oldProps.keyboardHandler) { + if (nextProps.keyboardHandler) editor.setKeyboardHandler("ace/keyboard/" + nextProps.keyboardHandler); + else editor.setKeyboardHandler(null); + } + if (nextProps.fontSize !== oldProps.fontSize) editor.setFontSize(nextProps.fontSize); + if (nextProps.wrapEnabled !== oldProps.wrapEnabled) editor.getSession().setUseWrapMode(nextProps.wrapEnabled); + if (nextProps.showPrintMargin !== oldProps.showPrintMargin) editor.setShowPrintMargin(nextProps.showPrintMargin); + if (nextProps.showGutter !== oldProps.showGutter) editor.renderer.setShowGutter(nextProps.showGutter); + for(var i = 0; i < editorOptions_1.editorOptions.length; i++){ + var option = editorOptions_1.editorOptions[i]; + if (nextProps[option] !== oldProps[option]) editor.setOption(option, nextProps[option]); + } + if (!isEqual(nextProps.setOptions, oldProps.setOptions)) _this.handleOptions(nextProps, editor); + var nextValue = get(nextProps.value, index, ""); + if (editor.getValue() !== nextValue) { + // editor.setValue is a synchronous function call, change event is emitted before setValue return. + _this.silent = true; + var pos = editor.session.selection.toJSON(); + editor.setValue(nextValue, nextProps.cursorStart); + editor.session.selection.fromJSON(pos); + _this.silent = false; + } + var newAnnotations = get(nextProps.annotations, index, []); + var oldAnnotations = get(oldProps.annotations, index, []); + if (!isEqual(newAnnotations, oldAnnotations)) editor.getSession().setAnnotations(newAnnotations); + var newMarkers = get(nextProps.markers, index, []); + var oldMarkers = get(oldProps.markers, index, []); + if (!isEqual(newMarkers, oldMarkers) && Array.isArray(newMarkers)) _this.handleMarkers(newMarkers, editor); + }); + if (nextProps.className !== oldProps.className) { + var appliedClasses = this.refEditor.className; + var appliedClassesArray_1 = appliedClasses.trim().split(" "); + var oldClassesArray = oldProps.className.trim().split(" "); + oldClassesArray.forEach(function(oldClass) { + var index = appliedClassesArray_1.indexOf(oldClass); + appliedClassesArray_1.splice(index, 1); + }); + this.refEditor.className = " " + nextProps.className + " " + appliedClassesArray_1.join(" "); + } + if (nextProps.theme !== oldProps.theme) split.setTheme("ace/theme/" + nextProps.theme); + if (nextProps.focus && !oldProps.focus) this.splitEditor.focus(); + if (nextProps.height !== this.props.height || nextProps.width !== this.props.width) this.editor.resize(); + }; + SplitComponent.prototype.componentWillUnmount = function() { + this.editor.destroy(); + this.editor = null; + }; + SplitComponent.prototype.onChange = function(event) { + if (this.props.onChange && !this.silent) { + var value_1 = []; + this.editor.env.split.forEach(function(editor) { + value_1.push(editor.getValue()); + }); + this.props.onChange(value_1, event); + } + }; + SplitComponent.prototype.onSelectionChange = function(event) { + if (this.props.onSelectionChange) { + var value_2 = []; + this.editor.env.split.forEach(function(editor) { + value_2.push(editor.getSelection()); + }); + this.props.onSelectionChange(value_2, event); + } + }; + SplitComponent.prototype.onCursorChange = function(event) { + if (this.props.onCursorChange) { + var value_3 = []; + this.editor.env.split.forEach(function(editor) { + value_3.push(editor.getSelection()); + }); + this.props.onCursorChange(value_3, event); + } + }; + SplitComponent.prototype.onFocus = function(event) { + if (this.props.onFocus) this.props.onFocus(event); + }; + SplitComponent.prototype.onInput = function(event) { + if (this.props.onInput) this.props.onInput(event); + }; + SplitComponent.prototype.onBlur = function(event) { + if (this.props.onBlur) this.props.onBlur(event); + }; + SplitComponent.prototype.onCopy = function(text) { + if (this.props.onCopy) this.props.onCopy(text); + }; + SplitComponent.prototype.onPaste = function(text) { + if (this.props.onPaste) this.props.onPaste(text); + }; + SplitComponent.prototype.onScroll = function() { + if (this.props.onScroll) this.props.onScroll(this.editor); + }; + SplitComponent.prototype.handleOptions = function(props, editor) { + var setOptions = Object.keys(props.setOptions); + for(var y = 0; y < setOptions.length; y++)editor.setOption(setOptions[y], props.setOptions[setOptions[y]]); + }; + SplitComponent.prototype.handleMarkers = function(markers, editor) { + // remove foreground markers + var currentMarkers = editor.getSession().getMarkers(true); + for(var i in currentMarkers)if (currentMarkers.hasOwnProperty(i)) editor.getSession().removeMarker(currentMarkers[i].id); + // remove background markers + currentMarkers = editor.getSession().getMarkers(false); + for(var i in currentMarkers)if (currentMarkers.hasOwnProperty(i)) editor.getSession().removeMarker(currentMarkers[i].id); + // add new markers + markers.forEach(function(_a) { + var startRow = _a.startRow, startCol = _a.startCol, endRow = _a.endRow, endCol = _a.endCol, className = _a.className, type = _a.type, _b = _a.inFront, inFront = _b === void 0 ? false : _b; + var range = new ace_builds_1.Range(startRow, startCol, endRow, endCol); + editor.getSession().addMarker(range, className, type, inFront); + }); + }; + SplitComponent.prototype.updateRef = function(item) { + this.refEditor = item; + }; + SplitComponent.prototype.render = function() { + var _a = this.props, name = _a.name, width = _a.width, height = _a.height, style = _a.style; + var divStyle = __assign({ + width: width, + height: height + }, style); + return React.createElement("div", { + ref: this.updateRef, + id: name, + style: divStyle + }); + }; + SplitComponent.propTypes = { + className: PropTypes.string, + debounceChangePeriod: PropTypes.number, + defaultValue: PropTypes.arrayOf(PropTypes.string), + focus: PropTypes.bool, + fontSize: PropTypes.oneOfType([ + PropTypes.number, + PropTypes.string + ]), + height: PropTypes.string, + mode: PropTypes.string, + name: PropTypes.string, + onBlur: PropTypes.func, + onChange: PropTypes.func, + onCopy: PropTypes.func, + onFocus: PropTypes.func, + onInput: PropTypes.func, + onLoad: PropTypes.func, + onPaste: PropTypes.func, + onScroll: PropTypes.func, + orientation: PropTypes.string, + showGutter: PropTypes.bool, + splits: PropTypes.number, + theme: PropTypes.string, + value: PropTypes.arrayOf(PropTypes.string), + width: PropTypes.string, + onSelectionChange: PropTypes.func, + onCursorChange: PropTypes.func, + onBeforeLoad: PropTypes.func, + minLines: PropTypes.number, + maxLines: PropTypes.number, + readOnly: PropTypes.bool, + highlightActiveLine: PropTypes.bool, + tabSize: PropTypes.number, + showPrintMargin: PropTypes.bool, + cursorStart: PropTypes.number, + editorProps: PropTypes.object, + setOptions: PropTypes.object, + style: PropTypes.object, + scrollMargin: PropTypes.array, + annotations: PropTypes.array, + markers: PropTypes.array, + keyboardHandler: PropTypes.string, + wrapEnabled: PropTypes.bool, + enableBasicAutocompletion: PropTypes.oneOfType([ + PropTypes.bool, + PropTypes.array + ]), + enableLiveAutocompletion: PropTypes.oneOfType([ + PropTypes.bool, + PropTypes.array + ]), + commands: PropTypes.array + }; + SplitComponent.defaultProps = { + name: "ace-editor", + focus: false, + orientation: "beside", + splits: 2, + mode: "", + theme: "", + height: "500px", + width: "500px", + value: [], + fontSize: 12, + showGutter: true, + onChange: null, + onPaste: null, + onLoad: null, + onScroll: null, + minLines: null, + maxLines: null, + readOnly: false, + highlightActiveLine: true, + showPrintMargin: true, + tabSize: 4, + cursorStart: 1, + editorProps: {}, + style: {}, + scrollMargin: [ + 0, + 0, + 0, + 0 + ], + setOptions: {}, + wrapEnabled: false, + enableBasicAutocompletion: false, + enableLiveAutocompletion: false + }; + return SplitComponent; +}(React.Component); +exports.default = SplitComponent; + +},{"d8dc882e532787df":"aBDZN","2856fbeb75237ae3":"lnKN4","9f1e7e9c87225329":"9IzUu","a6436e3504458a15":"7wKI2","8751a6a7f7def8c3":"21dqq","152c7a161aa8cafe":"6emId","707e28a34fa4a41c":"80Ipq"}],"9IzUu":[function(require,module,exports) { +ace.define("ace/split", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/lib/lang", + "ace/lib/event_emitter", + "ace/editor", + "ace/virtual_renderer", + "ace/edit_session" +], function(require, exports, module1) { + "use strict"; + var oop = require("./lib/oop"); + var lang = require("./lib/lang"); + var EventEmitter = require("./lib/event_emitter").EventEmitter; + var Editor = require("./editor").Editor; + var Renderer = require("./virtual_renderer").VirtualRenderer; + var EditSession = require("./edit_session").EditSession; + var Split = function(container, theme, splits) { + this.BELOW = 1; + this.BESIDE = 0; + this.$container = container; + this.$theme = theme; + this.$splits = 0; + this.$editorCSS = ""; + this.$editors = []; + this.$orientation = this.BESIDE; + this.setSplits(splits || 1); + this.$cEditor = this.$editors[0]; + this.on("focus", (function(editor) { + this.$cEditor = editor; + }).bind(this)); + }; + (function() { + oop.implement(this, EventEmitter); + this.$createEditor = function() { + var el = document.createElement("div"); + el.className = this.$editorCSS; + el.style.cssText = "position: absolute; top:0px; bottom:0px"; + this.$container.appendChild(el); + var editor = new Editor(new Renderer(el, this.$theme)); + editor.on("focus", (function() { + this._emit("focus", editor); + }).bind(this)); + this.$editors.push(editor); + editor.setFontSize(this.$fontSize); + return editor; + }; + this.setSplits = function(splits) { + var editor; + if (splits < 1) throw "The number of splits have to be > 0!"; + if (splits == this.$splits) return; + else if (splits > this.$splits) { + while(this.$splits < this.$editors.length && this.$splits < splits){ + editor = this.$editors[this.$splits]; + this.$container.appendChild(editor.container); + editor.setFontSize(this.$fontSize); + this.$splits++; + } + while(this.$splits < splits){ + this.$createEditor(); + this.$splits++; + } + } else while(this.$splits > splits){ + editor = this.$editors[this.$splits - 1]; + this.$container.removeChild(editor.container); + this.$splits--; + } + this.resize(); + }; + this.getSplits = function() { + return this.$splits; + }; + this.getEditor = function(idx) { + return this.$editors[idx]; + }; + this.getCurrentEditor = function() { + return this.$cEditor; + }; + this.focus = function() { + this.$cEditor.focus(); + }; + this.blur = function() { + this.$cEditor.blur(); + }; + this.setTheme = function(theme) { + this.$editors.forEach(function(editor) { + editor.setTheme(theme); + }); + }; + this.setKeyboardHandler = function(keybinding) { + this.$editors.forEach(function(editor) { + editor.setKeyboardHandler(keybinding); + }); + }; + this.forEach = function(callback, scope) { + this.$editors.forEach(callback, scope); + }; + this.$fontSize = ""; + this.setFontSize = function(size) { + this.$fontSize = size; + this.forEach(function(editor) { + editor.setFontSize(size); + }); + }; + this.$cloneSession = function(session) { + var s = new EditSession(session.getDocument(), session.getMode()); + var undoManager = session.getUndoManager(); + s.setUndoManager(undoManager); + s.setTabSize(session.getTabSize()); + s.setUseSoftTabs(session.getUseSoftTabs()); + s.setOverwrite(session.getOverwrite()); + s.setBreakpoints(session.getBreakpoints()); + s.setUseWrapMode(session.getUseWrapMode()); + s.setUseWorker(session.getUseWorker()); + s.setWrapLimitRange(session.$wrapLimitRange.min, session.$wrapLimitRange.max); + s.$foldData = session.$cloneFoldData(); + return s; + }; + this.setSession = function(session, idx) { + var editor; + if (idx == null) editor = this.$cEditor; + else editor = this.$editors[idx]; + var isUsed = this.$editors.some(function(editor) { + return editor.session === session; + }); + if (isUsed) session = this.$cloneSession(session); + editor.setSession(session); + return session; + }; + this.getOrientation = function() { + return this.$orientation; + }; + this.setOrientation = function(orientation) { + if (this.$orientation == orientation) return; + this.$orientation = orientation; + this.resize(); + }; + this.resize = function() { + var width = this.$container.clientWidth; + var height = this.$container.clientHeight; + var editor; + if (this.$orientation == this.BESIDE) { + var editorWidth = width / this.$splits; + for(var i = 0; i < this.$splits; i++){ + editor = this.$editors[i]; + editor.container.style.width = editorWidth + "px"; + editor.container.style.top = "0px"; + editor.container.style.left = i * editorWidth + "px"; + editor.container.style.height = height + "px"; + editor.resize(); + } + } else { + var editorHeight = height / this.$splits; + for(var i = 0; i < this.$splits; i++){ + editor = this.$editors[i]; + editor.container.style.width = width + "px"; + editor.container.style.top = i * editorHeight + "px"; + editor.container.style.left = "0px"; + editor.container.style.height = editorHeight + "px"; + editor.resize(); + } + } + }; + }).call(Split.prototype); + exports.Split = Split; +}); +ace.define("ace/ext/split", [ + "require", + "exports", + "module", + "ace/split" +], function(require, exports, module1) { + "use strict"; + module1.exports = require("../split"); +}); +(function() { + ace.require([ + "ace/ext/split" + ], function(m) { + if (module) module.exports = m; + }); +})(); + +},{}],"80Ipq":[function(require,module,exports) { +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ /** Used as the `TypeError` message for "Functions" methods. */ var global = arguments[3]; +var FUNC_ERROR_TEXT = "Expected a function"; +/** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = "__lodash_hash_undefined__"; +/** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; +/** `Object#toString` result references. */ var funcTag = "[object Function]", genTag = "[object GeneratorFunction]", symbolTag = "[object Symbol]"; +/** Used to match property names within property paths. */ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, reLeadingDot = /^\./, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; +/** Used to match backslashes in property paths. */ var reEscapeChar = /\\(\\)?/g; +/** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; +/** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == "object" && global && global.Object === Object && global; +/** Detect free variable `self`. */ var freeSelf = typeof self == "object" && self && self.Object === Object && self; +/** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function("return this")(); +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ function getValue(object, key) { + return object == null ? undefined : object[key]; +} +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != "function") try { + result = !!(value + ""); + } catch (e) {} + return result; +} +/** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; +/** Used to detect overreaching core-js shims. */ var coreJsData = root["__core-js_shared__"]; +/** Used to detect methods masquerading as native. */ var maskSrcKey = function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ""); + return uid ? "Symbol(src)_1." + uid : ""; +}(); +/** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; +/** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ var objectToString = objectProto.toString; +/** Used to detect if a method is native. */ var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"); +/** Built-in value references. */ var Symbol = root.Symbol, splice = arrayProto.splice; +/* Built-in method references that are verified to be native. */ var Map = getNative(root, "Map"), nativeCreate = getNative(Object, "create"); +/** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function Hash(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} +/** + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; +} +/** + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); +} +/** + * Sets the hash `key` to `value`. + * + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. + */ function hashSet(key, value) { + var data = this.__data__; + data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value; + return this; +} +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype["delete"] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; +/** + * Creates an list cache object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function ListCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ function listCacheClear() { + this.__data__ = []; +} +/** + * Removes `key` and its value from the list cache. + * + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function listCacheDelete(key) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) return false; + var lastIndex = data.length - 1; + if (index == lastIndex) data.pop(); + else splice.call(data, index, 1); + return true; +} +/** + * Gets the list cache value for `key`. + * + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function listCacheGet(key) { + var data = this.__data__, index = assocIndexOf(data, key); + return index < 0 ? undefined : data[index][1]; +} +/** + * Checks if a list cache value for `key` exists. + * + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} +/** + * Sets the list cache `key` to `value`. + * + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. + */ function listCacheSet(key, value) { + var data = this.__data__, index = assocIndexOf(data, key); + if (index < 0) data.push([ + key, + value + ]); + else data[index][1] = value; + return this; +} +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype["delete"] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; +/** + * Creates a map cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ function MapCache(entries) { + var index = -1, length = entries ? entries.length : 0; + this.clear(); + while(++index < length){ + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} +/** + * Removes all key-value entries from the map. + * + * @private + * @name clear + * @memberOf MapCache + */ function mapCacheClear() { + this.__data__ = { + "hash": new Hash, + "map": new (Map || ListCache), + "string": new Hash + }; +} +/** + * Removes `key` and its value from the map. + * + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ function mapCacheDelete(key) { + return getMapData(this, key)["delete"](key); +} +/** + * Gets the map value for `key`. + * + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ function mapCacheGet(key) { + return getMapData(this, key).get(key); +} +/** + * Checks if a map value for `key` exists. + * + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ function mapCacheHas(key) { + return getMapData(this, key).has(key); +} +/** + * Sets the map `key` to `value`. + * + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. + */ function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; +} +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype["delete"] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ function assocIndexOf(array, key) { + var length = array.length; + while(length--){ + if (eq(array[length][0], key)) return length; + } + return -1; +} +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ function baseGet(object, path) { + path = isKey(path, object) ? [ + path + ] : castPath(path); + var index = 0, length = path.length; + while(object != null && index < length)object = object[toKey(path[index++])]; + return index && index == length ? object : undefined; +} +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) return false; + var pattern = isFunction(value) || isHostObject(value) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); +} +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == "string") return value; + if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : ""; + var result = value + ""; + return result == "0" && 1 / value == -INFINITY ? "-0" : result; +} +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ function castPath(value) { + return isArray(value) ? value : stringToPath(value); +} +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map; +} +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; +} +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ function isKey(value, object) { + if (isArray(value)) return false; + var type = typeof value; + if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true; + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object); +} +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ function isKeyable(value) { + var type = typeof value; + return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null; +} +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ function isMasked(func) { + return !!maskSrcKey && maskSrcKey in func; +} +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ var stringToPath = memoize(function(string) { + string = toString(string); + var result = []; + if (reLeadingDot.test(string)) result.push(""); + string.replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, "$1") : number || match); + }); + return result; +}); +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ function toKey(value) { + if (typeof value == "string" || isSymbol(value)) return value; + var result = value + ""; + return result == "0" && 1 / value == -INFINITY ? "-0" : result; +} +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return func + ""; + } catch (e1) {} + } + return ""; +} +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ function memoize(func, resolver) { + if (typeof func != "function" || resolver && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT); + var memoized = function() { + var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache; + if (cache.has(key)) return cache.get(key); + var result = func.apply(this, args); + memoized.cache = cache.set(key, result); + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; +} +// Assign cache to `_.memoize`. +memoize.Cache = MapCache; +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ function eq(value, other) { + return value === other || value !== value && other !== other; +} +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ var isArray = Array.isArray; +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8-9 which returns 'object' for typed array and other constructors. + var tag = isObject(value) ? objectToString.call(value) : ""; + return tag == funcTag || tag == genTag; +} +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ function isObject(value) { + var type = typeof value; + return !!value && (type == "object" || type == "function"); +} +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ function isObjectLike(value) { + return !!value && typeof value == "object"; +} +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ function isSymbol(value) { + return typeof value == "symbol" || isObjectLike(value) && objectToString.call(value) == symbolTag; +} +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ function toString(value) { + return value == null ? "" : baseToString(value); +} +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; +} +module.exports = get; + +},{}],"cNEdG":[function(require,module,exports) { +/** + * Diff Match and Patch + * Copyright 2018 The diff-match-patch Authors. + * https://github.com/google/diff-match-patch + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /** + * @fileoverview Computes the difference between two texts to create a patch. + * Applies the patch onto another text, allowing for errors. + * @author fraser@google.com (Neil Fraser) + */ /** + * Class containing the diff, match and patch methods. + * @constructor + */ var diff_match_patch = function() { + // Defaults. + // Redefine these in your program to override the defaults. + // Number of seconds to map a diff before giving up (0 for infinity). + this.Diff_Timeout = 1.0; + // Cost of an empty edit operation in terms of edit characters. + this.Diff_EditCost = 4; + // At what point is no match declared (0.0 = perfection, 1.0 = very loose). + this.Match_Threshold = 0.5; + // How far to search for a match (0 = exact location, 1000+ = broad match). + // A match this many characters away from the expected location will add + // 1.0 to the score (0.0 is a perfect match). + this.Match_Distance = 1000; + // When deleting a large block of text (over ~64 characters), how close do + // the contents have to be to match the expected contents. (0.0 = perfection, + // 1.0 = very loose). Note that Match_Threshold controls how closely the + // end points of a delete need to match. + this.Patch_DeleteThreshold = 0.5; + // Chunk size for context length. + this.Patch_Margin = 4; + // The number of bits in an int. + this.Match_MaxBits = 32; +}; +// DIFF FUNCTIONS +/** + * The data structure representing a diff is an array of tuples: + * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] + * which means: delete 'Hello', add 'Goodbye' and keep ' world.' + */ var DIFF_DELETE = -1; +var DIFF_INSERT = 1; +var DIFF_EQUAL = 0; +/** + * Class representing one diff tuple. + * ~Attempts to look like a two-element array (which is what this used to be).~ + * Constructor returns an actual two-element array, to allow destructing @JackuB + * See https://github.com/JackuB/diff-match-patch/issues/14 for details + * @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL. + * @param {string} text Text to be deleted, inserted, or retained. + * @constructor + */ diff_match_patch.Diff = function(op, text) { + return [ + op, + text + ]; +}; +/** + * Find the differences between two texts. Simplifies the problem by stripping + * any common prefix or suffix off the texts before diffing. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {boolean=} opt_checklines Optional speedup flag. If present and false, + * then don't run a line-level diff first to identify the changed areas. + * Defaults to true, which does a faster, slightly less optimal diff. + * @param {number=} opt_deadline Optional time when the diff should be complete + * by. Used internally for recursive calls. Users should set DiffTimeout + * instead. + * @return {!Array.} Array of diff tuples. + */ diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines, opt_deadline) { + // Set a deadline by which time the diff must be complete. + if (typeof opt_deadline == "undefined") { + if (this.Diff_Timeout <= 0) opt_deadline = Number.MAX_VALUE; + else opt_deadline = (new Date).getTime() + this.Diff_Timeout * 1000; + } + var deadline = opt_deadline; + // Check for null inputs. + if (text1 == null || text2 == null) throw new Error("Null input. (diff_main)"); + // Check for equality (speedup). + if (text1 == text2) { + if (text1) return [ + new diff_match_patch.Diff(DIFF_EQUAL, text1) + ]; + return []; + } + if (typeof opt_checklines == "undefined") opt_checklines = true; + var checklines = opt_checklines; + // Trim off common prefix (speedup). + var commonlength = this.diff_commonPrefix(text1, text2); + var commonprefix = text1.substring(0, commonlength); + text1 = text1.substring(commonlength); + text2 = text2.substring(commonlength); + // Trim off common suffix (speedup). + commonlength = this.diff_commonSuffix(text1, text2); + var commonsuffix = text1.substring(text1.length - commonlength); + text1 = text1.substring(0, text1.length - commonlength); + text2 = text2.substring(0, text2.length - commonlength); + // Compute the diff on the middle block. + var diffs = this.diff_compute_(text1, text2, checklines, deadline); + // Restore the prefix and suffix. + if (commonprefix) diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, commonprefix)); + if (commonsuffix) diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, commonsuffix)); + this.diff_cleanupMerge(diffs); + return diffs; +}; +/** + * Find the differences between two texts. Assumes that the texts do not + * have any common prefix or suffix. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {boolean} checklines Speedup flag. If false, then don't run a + * line-level diff first to identify the changed areas. + * If true, then run a faster, slightly less optimal diff. + * @param {number} deadline Time when the diff should be complete by. + * @return {!Array.} Array of diff tuples. + * @private + */ diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines, deadline) { + var diffs; + if (!text1) // Just add some text (speedup). + return [ + new diff_match_patch.Diff(DIFF_INSERT, text2) + ]; + if (!text2) // Just delete some text (speedup). + return [ + new diff_match_patch.Diff(DIFF_DELETE, text1) + ]; + var longtext = text1.length > text2.length ? text1 : text2; + var shorttext = text1.length > text2.length ? text2 : text1; + var i = longtext.indexOf(shorttext); + if (i != -1) { + // Shorter text is inside the longer text (speedup). + diffs = [ + new diff_match_patch.Diff(DIFF_INSERT, longtext.substring(0, i)), + new diff_match_patch.Diff(DIFF_EQUAL, shorttext), + new diff_match_patch.Diff(DIFF_INSERT, longtext.substring(i + shorttext.length)) + ]; + // Swap insertions for deletions if diff is reversed. + if (text1.length > text2.length) diffs[0][0] = diffs[2][0] = DIFF_DELETE; + return diffs; + } + if (shorttext.length == 1) // Single character string. + // After the previous speedup, the character can't be an equality. + return [ + new diff_match_patch.Diff(DIFF_DELETE, text1), + new diff_match_patch.Diff(DIFF_INSERT, text2) + ]; + // Check to see if the problem can be split in two. + var hm = this.diff_halfMatch_(text1, text2); + if (hm) { + // A half-match was found, sort out the return data. + var text1_a = hm[0]; + var text1_b = hm[1]; + var text2_a = hm[2]; + var text2_b = hm[3]; + var mid_common = hm[4]; + // Send both pairs off for separate processing. + var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline); + var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline); + // Merge the results. + return diffs_a.concat([ + new diff_match_patch.Diff(DIFF_EQUAL, mid_common) + ], diffs_b); + } + if (checklines && text1.length > 100 && text2.length > 100) return this.diff_lineMode_(text1, text2, deadline); + return this.diff_bisect_(text1, text2, deadline); +}; +/** + * Do a quick line-level diff on both strings, then rediff the parts for + * greater accuracy. + * This speedup can produce non-minimal diffs. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {number} deadline Time when the diff should be complete by. + * @return {!Array.} Array of diff tuples. + * @private + */ diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) { + // Scan the text on a line-by-line basis first. + var a = this.diff_linesToChars_(text1, text2); + text1 = a.chars1; + text2 = a.chars2; + var linearray = a.lineArray; + var diffs = this.diff_main(text1, text2, false, deadline); + // Convert the diff back to original text. + this.diff_charsToLines_(diffs, linearray); + // Eliminate freak matches (e.g. blank lines) + this.diff_cleanupSemantic(diffs); + // Rediff any replacement blocks, this time character-by-character. + // Add a dummy entry at the end. + diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, "")); + var pointer = 0; + var count_delete = 0; + var count_insert = 0; + var text_delete = ""; + var text_insert = ""; + while(pointer < diffs.length){ + switch(diffs[pointer][0]){ + case DIFF_INSERT: + count_insert++; + text_insert += diffs[pointer][1]; + break; + case DIFF_DELETE: + count_delete++; + text_delete += diffs[pointer][1]; + break; + case DIFF_EQUAL: + // Upon reaching an equality, check for prior redundancies. + if (count_delete >= 1 && count_insert >= 1) { + // Delete the offending records and add the merged ones. + diffs.splice(pointer - count_delete - count_insert, count_delete + count_insert); + pointer = pointer - count_delete - count_insert; + var subDiff = this.diff_main(text_delete, text_insert, false, deadline); + for(var j = subDiff.length - 1; j >= 0; j--)diffs.splice(pointer, 0, subDiff[j]); + pointer = pointer + subDiff.length; + } + count_insert = 0; + count_delete = 0; + text_delete = ""; + text_insert = ""; + break; + } + pointer++; + } + diffs.pop(); // Remove the dummy entry at the end. + return diffs; +}; +/** + * Find the 'middle snake' of a diff, split the problem in two + * and return the recursively constructed diff. + * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {number} deadline Time at which to bail if not yet complete. + * @return {!Array.} Array of diff tuples. + * @private + */ diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) { + // Cache the text lengths to prevent multiple calls. + var text1_length = text1.length; + var text2_length = text2.length; + var max_d = Math.ceil((text1_length + text2_length) / 2); + var v_offset = max_d; + var v_length = 2 * max_d; + var v1 = new Array(v_length); + var v2 = new Array(v_length); + // Setting all elements to -1 is faster in Chrome & Firefox than mixing + // integers and undefined. + for(var x = 0; x < v_length; x++){ + v1[x] = -1; + v2[x] = -1; + } + v1[v_offset + 1] = 0; + v2[v_offset + 1] = 0; + var delta = text1_length - text2_length; + // If the total number of characters is odd, then the front path will collide + // with the reverse path. + var front = delta % 2 != 0; + // Offsets for start and end of k loop. + // Prevents mapping of space beyond the grid. + var k1start = 0; + var k1end = 0; + var k2start = 0; + var k2end = 0; + for(var d = 0; d < max_d; d++){ + // Bail out if deadline is reached. + if (new Date().getTime() > deadline) break; + // Walk the front path one step. + for(var k1 = -d + k1start; k1 <= d - k1end; k1 += 2){ + var k1_offset = v_offset + k1; + var x1; + if (k1 == -d || k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1]) x1 = v1[k1_offset + 1]; + else x1 = v1[k1_offset - 1] + 1; + var y1 = x1 - k1; + while(x1 < text1_length && y1 < text2_length && text1.charAt(x1) == text2.charAt(y1)){ + x1++; + y1++; + } + v1[k1_offset] = x1; + if (x1 > text1_length) // Ran off the right of the graph. + k1end += 2; + else if (y1 > text2_length) // Ran off the bottom of the graph. + k1start += 2; + else if (front) { + var k2_offset = v_offset + delta - k1; + if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) { + // Mirror x2 onto top-left coordinate system. + var x2 = text1_length - v2[k2_offset]; + if (x1 >= x2) // Overlap detected. + return this.diff_bisectSplit_(text1, text2, x1, y1, deadline); + } + } + } + // Walk the reverse path one step. + for(var k2 = -d + k2start; k2 <= d - k2end; k2 += 2){ + var k2_offset = v_offset + k2; + var x2; + if (k2 == -d || k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1]) x2 = v2[k2_offset + 1]; + else x2 = v2[k2_offset - 1] + 1; + var y2 = x2 - k2; + while(x2 < text1_length && y2 < text2_length && text1.charAt(text1_length - x2 - 1) == text2.charAt(text2_length - y2 - 1)){ + x2++; + y2++; + } + v2[k2_offset] = x2; + if (x2 > text1_length) // Ran off the left of the graph. + k2end += 2; + else if (y2 > text2_length) // Ran off the top of the graph. + k2start += 2; + else if (!front) { + var k1_offset = v_offset + delta - k2; + if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) { + var x1 = v1[k1_offset]; + var y1 = v_offset + x1 - k1_offset; + // Mirror x2 onto top-left coordinate system. + x2 = text1_length - x2; + if (x1 >= x2) // Overlap detected. + return this.diff_bisectSplit_(text1, text2, x1, y1, deadline); + } + } + } + } + // Diff took too long and hit the deadline or + // number of diffs equals number of characters, no commonality at all. + return [ + new diff_match_patch.Diff(DIFF_DELETE, text1), + new diff_match_patch.Diff(DIFF_INSERT, text2) + ]; +}; +/** + * Given the location of the 'middle snake', split the diff in two parts + * and recurse. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {number} x Index of split point in text1. + * @param {number} y Index of split point in text2. + * @param {number} deadline Time at which to bail if not yet complete. + * @return {!Array.} Array of diff tuples. + * @private + */ diff_match_patch.prototype.diff_bisectSplit_ = function(text1, text2, x, y, deadline) { + var text1a = text1.substring(0, x); + var text2a = text2.substring(0, y); + var text1b = text1.substring(x); + var text2b = text2.substring(y); + // Compute both diffs serially. + var diffs = this.diff_main(text1a, text2a, false, deadline); + var diffsb = this.diff_main(text1b, text2b, false, deadline); + return diffs.concat(diffsb); +}; +/** + * Split two texts into an array of strings. Reduce the texts to a string of + * hashes where each Unicode character represents one line. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {{chars1: string, chars2: string, lineArray: !Array.}} + * An object containing the encoded text1, the encoded text2 and + * the array of unique strings. + * The zeroth element of the array of unique strings is intentionally blank. + * @private + */ diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) { + var lineArray = []; // e.g. lineArray[4] == 'Hello\n' + var lineHash = {}; // e.g. lineHash['Hello\n'] == 4 + // '\x00' is a valid character, but various debuggers don't like it. + // So we'll insert a junk entry to avoid generating a null character. + lineArray[0] = ""; + /** + * Split a text into an array of strings. Reduce the texts to a string of + * hashes where each Unicode character represents one line. + * Modifies linearray and linehash through being a closure. + * @param {string} text String to encode. + * @return {string} Encoded string. + * @private + */ function diff_linesToCharsMunge_(text) { + var chars = ""; + // Walk the text, pulling out a substring for each line. + // text.split('\n') would would temporarily double our memory footprint. + // Modifying text would create many large strings to garbage collect. + var lineStart = 0; + var lineEnd = -1; + // Keeping our own length variable is faster than looking it up. + var lineArrayLength = lineArray.length; + while(lineEnd < text.length - 1){ + lineEnd = text.indexOf("\n", lineStart); + if (lineEnd == -1) lineEnd = text.length - 1; + var line = text.substring(lineStart, lineEnd + 1); + if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : lineHash[line] !== undefined) chars += String.fromCharCode(lineHash[line]); + else { + if (lineArrayLength == maxLines) { + // Bail out at 65535 because + // String.fromCharCode(65536) == String.fromCharCode(0) + line = text.substring(lineStart); + lineEnd = text.length; + } + chars += String.fromCharCode(lineArrayLength); + lineHash[line] = lineArrayLength; + lineArray[lineArrayLength++] = line; + } + lineStart = lineEnd + 1; + } + return chars; + } + // Allocate 2/3rds of the space for text1, the rest for text2. + var maxLines = 40000; + var chars1 = diff_linesToCharsMunge_(text1); + maxLines = 65535; + var chars2 = diff_linesToCharsMunge_(text2); + return { + chars1: chars1, + chars2: chars2, + lineArray: lineArray + }; +}; +/** + * Rehydrate the text in a diff from a string of line hashes to real lines of + * text. + * @param {!Array.} diffs Array of diff tuples. + * @param {!Array.} lineArray Array of unique strings. + * @private + */ diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) { + for(var i = 0; i < diffs.length; i++){ + var chars = diffs[i][1]; + var text = []; + for(var j = 0; j < chars.length; j++)text[j] = lineArray[chars.charCodeAt(j)]; + diffs[i][1] = text.join(""); + } +}; +/** + * Determine the common prefix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the start of each + * string. + */ diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) { + // Quick check for common null cases. + if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) return 0; + // Binary search. + // Performance analysis: https://neil.fraser.name/news/2007/10/09/ + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerstart = 0; + while(pointermin < pointermid){ + if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) { + pointermin = pointermid; + pointerstart = pointermin; + } else pointermax = pointermid; + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + return pointermid; +}; +/** + * Determine the common suffix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of each string. + */ diff_match_patch.prototype.diff_commonSuffix = function(text1, text2) { + // Quick check for common null cases. + if (!text1 || !text2 || text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) return 0; + // Binary search. + // Performance analysis: https://neil.fraser.name/news/2007/10/09/ + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerend = 0; + while(pointermin < pointermid){ + if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) { + pointermin = pointermid; + pointerend = pointermin; + } else pointermax = pointermid; + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + return pointermid; +}; +/** + * Determine if the suffix of one string is the prefix of another. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of the first + * string and the start of the second string. + * @private + */ diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) { + // Cache the text lengths to prevent multiple calls. + var text1_length = text1.length; + var text2_length = text2.length; + // Eliminate the null case. + if (text1_length == 0 || text2_length == 0) return 0; + // Truncate the longer string. + if (text1_length > text2_length) text1 = text1.substring(text1_length - text2_length); + else if (text1_length < text2_length) text2 = text2.substring(0, text1_length); + var text_length = Math.min(text1_length, text2_length); + // Quick check for the worst case. + if (text1 == text2) return text_length; + // Start by looking for a single character match + // and increase length until no match is found. + // Performance analysis: https://neil.fraser.name/news/2010/11/04/ + var best = 0; + var length = 1; + while(true){ + var pattern = text1.substring(text_length - length); + var found = text2.indexOf(pattern); + if (found == -1) return best; + length += found; + if (found == 0 || text1.substring(text_length - length) == text2.substring(0, length)) { + best = length; + length++; + } + } +}; +/** + * Do the two texts share a substring which is at least half the length of the + * longer text? + * This speedup can produce non-minimal diffs. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {Array.} Five element Array, containing the prefix of + * text1, the suffix of text1, the prefix of text2, the suffix of + * text2 and the common middle. Or null if there was no match. + * @private + */ diff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) { + if (this.Diff_Timeout <= 0) // Don't risk returning a non-optimal diff if we have unlimited time. + return null; + var longtext = text1.length > text2.length ? text1 : text2; + var shorttext = text1.length > text2.length ? text2 : text1; + if (longtext.length < 4 || shorttext.length * 2 < longtext.length) return null; // Pointless. + var dmp = this; // 'this' becomes 'window' in a closure. + /** + * Does a substring of shorttext exist within longtext such that the substring + * is at least half the length of longtext? + * Closure, but does not reference any external variables. + * @param {string} longtext Longer string. + * @param {string} shorttext Shorter string. + * @param {number} i Start index of quarter length substring within longtext. + * @return {Array.} Five element Array, containing the prefix of + * longtext, the suffix of longtext, the prefix of shorttext, the suffix + * of shorttext and the common middle. Or null if there was no match. + * @private + */ function diff_halfMatchI_(longtext, shorttext, i) { + // Start with a 1/4 length substring at position i as a seed. + var seed = longtext.substring(i, i + Math.floor(longtext.length / 4)); + var j = -1; + var best_common = ""; + var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b; + while((j = shorttext.indexOf(seed, j + 1)) != -1){ + var prefixLength = dmp.diff_commonPrefix(longtext.substring(i), shorttext.substring(j)); + var suffixLength = dmp.diff_commonSuffix(longtext.substring(0, i), shorttext.substring(0, j)); + if (best_common.length < suffixLength + prefixLength) { + best_common = shorttext.substring(j - suffixLength, j) + shorttext.substring(j, j + prefixLength); + best_longtext_a = longtext.substring(0, i - suffixLength); + best_longtext_b = longtext.substring(i + prefixLength); + best_shorttext_a = shorttext.substring(0, j - suffixLength); + best_shorttext_b = shorttext.substring(j + prefixLength); + } + } + if (best_common.length * 2 >= longtext.length) return [ + best_longtext_a, + best_longtext_b, + best_shorttext_a, + best_shorttext_b, + best_common + ]; + else return null; + } + // First check if the second quarter is the seed for a half-match. + var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4)); + // Check again based on the third quarter. + var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2)); + var hm; + if (!hm1 && !hm2) return null; + else if (!hm2) hm = hm1; + else if (!hm1) hm = hm2; + else // Both matched. Select the longest. + hm = hm1[4].length > hm2[4].length ? hm1 : hm2; + // A half-match was found, sort out the return data. + var text1_a, text1_b, text2_a, text2_b; + if (text1.length > text2.length) { + text1_a = hm[0]; + text1_b = hm[1]; + text2_a = hm[2]; + text2_b = hm[3]; + } else { + text2_a = hm[0]; + text2_b = hm[1]; + text1_a = hm[2]; + text1_b = hm[3]; + } + var mid_common = hm[4]; + return [ + text1_a, + text1_b, + text2_a, + text2_b, + mid_common + ]; +}; +/** + * Reduce the number of edits by eliminating semantically trivial equalities. + * @param {!Array.} diffs Array of diff tuples. + */ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) { + var changes = false; + var equalities = []; // Stack of indices where equalities are found. + var equalitiesLength = 0; // Keeping our own length var is faster in JS. + /** @type {?string} */ var lastEquality = null; + // Always equal to diffs[equalities[equalitiesLength - 1]][1] + var pointer = 0; // Index of current position. + // Number of characters that changed prior to the equality. + var length_insertions1 = 0; + var length_deletions1 = 0; + // Number of characters that changed after the equality. + var length_insertions2 = 0; + var length_deletions2 = 0; + while(pointer < diffs.length){ + if (diffs[pointer][0] == DIFF_EQUAL) { + equalities[equalitiesLength++] = pointer; + length_insertions1 = length_insertions2; + length_deletions1 = length_deletions2; + length_insertions2 = 0; + length_deletions2 = 0; + lastEquality = diffs[pointer][1]; + } else { + if (diffs[pointer][0] == DIFF_INSERT) length_insertions2 += diffs[pointer][1].length; + else length_deletions2 += diffs[pointer][1].length; + // Eliminate an equality that is smaller or equal to the edits on both + // sides of it. + if (lastEquality && lastEquality.length <= Math.max(length_insertions1, length_deletions1) && lastEquality.length <= Math.max(length_insertions2, length_deletions2)) { + // Duplicate record. + diffs.splice(equalities[equalitiesLength - 1], 0, new diff_match_patch.Diff(DIFF_DELETE, lastEquality)); + // Change second copy to insert. + diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; + // Throw away the equality we just deleted. + equalitiesLength--; + // Throw away the previous equality (it needs to be reevaluated). + equalitiesLength--; + pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; + length_insertions1 = 0; // Reset the counters. + length_deletions1 = 0; + length_insertions2 = 0; + length_deletions2 = 0; + lastEquality = null; + changes = true; + } + } + pointer++; + } + // Normalize the diff. + if (changes) this.diff_cleanupMerge(diffs); + this.diff_cleanupSemanticLossless(diffs); + // Find any overlaps between deletions and insertions. + // e.g: abcxxxxxxdef + // -> abcxxxdef + // e.g: xxxabcdefxxx + // -> defxxxabc + // Only extract an overlap if it is as big as the edit ahead or behind it. + pointer = 1; + while(pointer < diffs.length){ + if (diffs[pointer - 1][0] == DIFF_DELETE && diffs[pointer][0] == DIFF_INSERT) { + var deletion = diffs[pointer - 1][1]; + var insertion = diffs[pointer][1]; + var overlap_length1 = this.diff_commonOverlap_(deletion, insertion); + var overlap_length2 = this.diff_commonOverlap_(insertion, deletion); + if (overlap_length1 >= overlap_length2) { + if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) { + // Overlap found. Insert an equality and trim the surrounding edits. + diffs.splice(pointer, 0, new diff_match_patch.Diff(DIFF_EQUAL, insertion.substring(0, overlap_length1))); + diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1); + diffs[pointer + 1][1] = insertion.substring(overlap_length1); + pointer++; + } + } else if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) { + // Reverse overlap found. + // Insert an equality and swap and trim the surrounding edits. + diffs.splice(pointer, 0, new diff_match_patch.Diff(DIFF_EQUAL, deletion.substring(0, overlap_length2))); + diffs[pointer - 1][0] = DIFF_INSERT; + diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2); + diffs[pointer + 1][0] = DIFF_DELETE; + diffs[pointer + 1][1] = deletion.substring(overlap_length2); + pointer++; + } + pointer++; + } + pointer++; + } +}; +/** + * Look for single edits surrounded on both sides by equalities + * which can be shifted sideways to align the edit to a word boundary. + * e.g: The cat came. -> The cat came. + * @param {!Array.} diffs Array of diff tuples. + */ diff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) { + /** + * Given two strings, compute a score representing whether the internal + * boundary falls on logical boundaries. + * Scores range from 6 (best) to 0 (worst). + * Closure, but does not reference any external variables. + * @param {string} one First string. + * @param {string} two Second string. + * @return {number} The score. + * @private + */ function diff_cleanupSemanticScore_(one, two) { + if (!one || !two) // Edges are the best. + return 6; + // Each port of this function behaves slightly differently due to + // subtle differences in each language's definition of things like + // 'whitespace'. Since this function's purpose is largely cosmetic, + // the choice has been made to use each language's native features + // rather than force total conformity. + var char1 = one.charAt(one.length - 1); + var char2 = two.charAt(0); + var nonAlphaNumeric1 = char1.match(diff_match_patch.nonAlphaNumericRegex_); + var nonAlphaNumeric2 = char2.match(diff_match_patch.nonAlphaNumericRegex_); + var whitespace1 = nonAlphaNumeric1 && char1.match(diff_match_patch.whitespaceRegex_); + var whitespace2 = nonAlphaNumeric2 && char2.match(diff_match_patch.whitespaceRegex_); + var lineBreak1 = whitespace1 && char1.match(diff_match_patch.linebreakRegex_); + var lineBreak2 = whitespace2 && char2.match(diff_match_patch.linebreakRegex_); + var blankLine1 = lineBreak1 && one.match(diff_match_patch.blanklineEndRegex_); + var blankLine2 = lineBreak2 && two.match(diff_match_patch.blanklineStartRegex_); + if (blankLine1 || blankLine2) // Five points for blank lines. + return 5; + else if (lineBreak1 || lineBreak2) // Four points for line breaks. + return 4; + else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) // Three points for end of sentences. + return 3; + else if (whitespace1 || whitespace2) // Two points for whitespace. + return 2; + else if (nonAlphaNumeric1 || nonAlphaNumeric2) // One point for non-alphanumeric. + return 1; + return 0; + } + var pointer = 1; + // Intentionally ignore the first and last element (don't need checking). + while(pointer < diffs.length - 1){ + if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) { + // This is a single edit surrounded by equalities. + var equality1 = diffs[pointer - 1][1]; + var edit = diffs[pointer][1]; + var equality2 = diffs[pointer + 1][1]; + // First, shift the edit as far left as possible. + var commonOffset = this.diff_commonSuffix(equality1, edit); + if (commonOffset) { + var commonString = edit.substring(edit.length - commonOffset); + equality1 = equality1.substring(0, equality1.length - commonOffset); + edit = commonString + edit.substring(0, edit.length - commonOffset); + equality2 = commonString + equality2; + } + // Second, step character by character right, looking for the best fit. + var bestEquality1 = equality1; + var bestEdit = edit; + var bestEquality2 = equality2; + var bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2); + while(edit.charAt(0) === equality2.charAt(0)){ + equality1 += edit.charAt(0); + edit = edit.substring(1) + equality2.charAt(0); + equality2 = equality2.substring(1); + var score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2); + // The >= encourages trailing rather than leading whitespace on edits. + if (score >= bestScore) { + bestScore = score; + bestEquality1 = equality1; + bestEdit = edit; + bestEquality2 = equality2; + } + } + if (diffs[pointer - 1][1] != bestEquality1) { + // We have an improvement, save it back to the diff. + if (bestEquality1) diffs[pointer - 1][1] = bestEquality1; + else { + diffs.splice(pointer - 1, 1); + pointer--; + } + diffs[pointer][1] = bestEdit; + if (bestEquality2) diffs[pointer + 1][1] = bestEquality2; + else { + diffs.splice(pointer + 1, 1); + pointer--; + } + } + } + pointer++; + } +}; +// Define some regex patterns for matching boundaries. +diff_match_patch.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/; +diff_match_patch.whitespaceRegex_ = /\s/; +diff_match_patch.linebreakRegex_ = /[\r\n]/; +diff_match_patch.blanklineEndRegex_ = /\n\r?\n$/; +diff_match_patch.blanklineStartRegex_ = /^\r?\n\r?\n/; +/** + * Reduce the number of edits by eliminating operationally trivial equalities. + * @param {!Array.} diffs Array of diff tuples. + */ diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) { + var changes = false; + var equalities = []; // Stack of indices where equalities are found. + var equalitiesLength = 0; // Keeping our own length var is faster in JS. + /** @type {?string} */ var lastEquality = null; + // Always equal to diffs[equalities[equalitiesLength - 1]][1] + var pointer = 0; // Index of current position. + // Is there an insertion operation before the last equality. + var pre_ins = false; + // Is there a deletion operation before the last equality. + var pre_del = false; + // Is there an insertion operation after the last equality. + var post_ins = false; + // Is there a deletion operation after the last equality. + var post_del = false; + while(pointer < diffs.length){ + if (diffs[pointer][0] == DIFF_EQUAL) { + if (diffs[pointer][1].length < this.Diff_EditCost && (post_ins || post_del)) { + // Candidate found. + equalities[equalitiesLength++] = pointer; + pre_ins = post_ins; + pre_del = post_del; + lastEquality = diffs[pointer][1]; + } else { + // Not a candidate, and can never become one. + equalitiesLength = 0; + lastEquality = null; + } + post_ins = post_del = false; + } else { + if (diffs[pointer][0] == DIFF_DELETE) post_del = true; + else post_ins = true; + /* + * Five types to be split: + * ABXYCD + * AXCD + * ABXC + * AXCD + * ABXC + */ if (lastEquality && (pre_ins && pre_del && post_ins && post_del || lastEquality.length < this.Diff_EditCost / 2 && pre_ins + pre_del + post_ins + post_del == 3)) { + // Duplicate record. + diffs.splice(equalities[equalitiesLength - 1], 0, new diff_match_patch.Diff(DIFF_DELETE, lastEquality)); + // Change second copy to insert. + diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; + equalitiesLength--; // Throw away the equality we just deleted; + lastEquality = null; + if (pre_ins && pre_del) { + // No changes made which could affect previous entry, keep going. + post_ins = post_del = true; + equalitiesLength = 0; + } else { + equalitiesLength--; // Throw away the previous equality. + pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; + post_ins = post_del = false; + } + changes = true; + } + } + pointer++; + } + if (changes) this.diff_cleanupMerge(diffs); +}; +/** + * Reorder and merge like edit sections. Merge equalities. + * Any edit section can move as long as it doesn't cross an equality. + * @param {!Array.} diffs Array of diff tuples. + */ diff_match_patch.prototype.diff_cleanupMerge = function(diffs) { + // Add a dummy entry at the end. + diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, "")); + var pointer = 0; + var count_delete = 0; + var count_insert = 0; + var text_delete = ""; + var text_insert = ""; + var commonlength; + while(pointer < diffs.length)switch(diffs[pointer][0]){ + case DIFF_INSERT: + count_insert++; + text_insert += diffs[pointer][1]; + pointer++; + break; + case DIFF_DELETE: + count_delete++; + text_delete += diffs[pointer][1]; + pointer++; + break; + case DIFF_EQUAL: + // Upon reaching an equality, check for prior redundancies. + if (count_delete + count_insert > 1) { + if (count_delete !== 0 && count_insert !== 0) { + // Factor out any common prefixies. + commonlength = this.diff_commonPrefix(text_insert, text_delete); + if (commonlength !== 0) { + if (pointer - count_delete - count_insert > 0 && diffs[pointer - count_delete - count_insert - 1][0] == DIFF_EQUAL) diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength); + else { + diffs.splice(0, 0, new diff_match_patch.Diff(DIFF_EQUAL, text_insert.substring(0, commonlength))); + pointer++; + } + text_insert = text_insert.substring(commonlength); + text_delete = text_delete.substring(commonlength); + } + // Factor out any common suffixies. + commonlength = this.diff_commonSuffix(text_insert, text_delete); + if (commonlength !== 0) { + diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1]; + text_insert = text_insert.substring(0, text_insert.length - commonlength); + text_delete = text_delete.substring(0, text_delete.length - commonlength); + } + } + // Delete the offending records and add the merged ones. + pointer -= count_delete + count_insert; + diffs.splice(pointer, count_delete + count_insert); + if (text_delete.length) { + diffs.splice(pointer, 0, new diff_match_patch.Diff(DIFF_DELETE, text_delete)); + pointer++; + } + if (text_insert.length) { + diffs.splice(pointer, 0, new diff_match_patch.Diff(DIFF_INSERT, text_insert)); + pointer++; + } + pointer++; + } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) { + // Merge this equality with the previous one. + diffs[pointer - 1][1] += diffs[pointer][1]; + diffs.splice(pointer, 1); + } else pointer++; + count_insert = 0; + count_delete = 0; + text_delete = ""; + text_insert = ""; + break; + } + if (diffs[diffs.length - 1][1] === "") diffs.pop(); // Remove the dummy entry at the end. + // Second pass: look for single edits surrounded on both sides by equalities + // which can be shifted sideways to eliminate an equality. + // e.g: ABAC -> ABAC + var changes = false; + pointer = 1; + // Intentionally ignore the first and last element (don't need checking). + while(pointer < diffs.length - 1){ + if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) { + // This is a single edit surrounded by equalities. + if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) { + // Shift the edit over the previous equality. + diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length); + diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; + diffs.splice(pointer - 1, 1); + changes = true; + } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) { + // Shift the edit over the next equality. + diffs[pointer - 1][1] += diffs[pointer + 1][1]; + diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1]; + diffs.splice(pointer + 1, 1); + changes = true; + } + } + pointer++; + } + // If shifts were made, the diff needs reordering and another shift sweep. + if (changes) this.diff_cleanupMerge(diffs); +}; +/** + * loc is a location in text1, compute and return the equivalent location in + * text2. + * e.g. 'The cat' vs 'The big cat', 1->1, 5->8 + * @param {!Array.} diffs Array of diff tuples. + * @param {number} loc Location within text1. + * @return {number} Location within text2. + */ diff_match_patch.prototype.diff_xIndex = function(diffs, loc) { + var chars1 = 0; + var chars2 = 0; + var last_chars1 = 0; + var last_chars2 = 0; + var x; + for(x = 0; x < diffs.length; x++){ + if (diffs[x][0] !== DIFF_INSERT) chars1 += diffs[x][1].length; + if (diffs[x][0] !== DIFF_DELETE) chars2 += diffs[x][1].length; + if (chars1 > loc) break; + last_chars1 = chars1; + last_chars2 = chars2; + } + // Was the location was deleted? + if (diffs.length != x && diffs[x][0] === DIFF_DELETE) return last_chars2; + // Add the remaining character length. + return last_chars2 + (loc - last_chars1); +}; +/** + * Convert a diff array into a pretty HTML report. + * @param {!Array.} diffs Array of diff tuples. + * @return {string} HTML representation. + */ diff_match_patch.prototype.diff_prettyHtml = function(diffs) { + var html = []; + var pattern_amp = /&/g; + var pattern_lt = //g; + var pattern_para = /\n/g; + for(var x = 0; x < diffs.length; x++){ + var op = diffs[x][0]; // Operation (insert, delete, equal) + var data = diffs[x][1]; // Text of change. + var text = data.replace(pattern_amp, "&").replace(pattern_lt, "<").replace(pattern_gt, ">").replace(pattern_para, "¶
"); + switch(op){ + case DIFF_INSERT: + html[x] = '' + text + ""; + break; + case DIFF_DELETE: + html[x] = '' + text + ""; + break; + case DIFF_EQUAL: + html[x] = "" + text + ""; + break; + } + } + return html.join(""); +}; +/** + * Compute and return the source text (all equalities and deletions). + * @param {!Array.} diffs Array of diff tuples. + * @return {string} Source text. + */ diff_match_patch.prototype.diff_text1 = function(diffs) { + var text = []; + for(var x = 0; x < diffs.length; x++)if (diffs[x][0] !== DIFF_INSERT) text[x] = diffs[x][1]; + return text.join(""); +}; +/** + * Compute and return the destination text (all equalities and insertions). + * @param {!Array.} diffs Array of diff tuples. + * @return {string} Destination text. + */ diff_match_patch.prototype.diff_text2 = function(diffs) { + var text = []; + for(var x = 0; x < diffs.length; x++)if (diffs[x][0] !== DIFF_DELETE) text[x] = diffs[x][1]; + return text.join(""); +}; +/** + * Compute the Levenshtein distance; the number of inserted, deleted or + * substituted characters. + * @param {!Array.} diffs Array of diff tuples. + * @return {number} Number of changes. + */ diff_match_patch.prototype.diff_levenshtein = function(diffs) { + var levenshtein = 0; + var insertions = 0; + var deletions = 0; + for(var x = 0; x < diffs.length; x++){ + var op = diffs[x][0]; + var data = diffs[x][1]; + switch(op){ + case DIFF_INSERT: + insertions += data.length; + break; + case DIFF_DELETE: + deletions += data.length; + break; + case DIFF_EQUAL: + // A deletion and an insertion is one substitution. + levenshtein += Math.max(insertions, deletions); + insertions = 0; + deletions = 0; + break; + } + } + levenshtein += Math.max(insertions, deletions); + return levenshtein; +}; +/** + * Crush the diff into an encoded string which describes the operations + * required to transform text1 into text2. + * E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. + * Operations are tab-separated. Inserted text is escaped using %xx notation. + * @param {!Array.} diffs Array of diff tuples. + * @return {string} Delta text. + */ diff_match_patch.prototype.diff_toDelta = function(diffs) { + var text = []; + for(var x = 0; x < diffs.length; x++)switch(diffs[x][0]){ + case DIFF_INSERT: + text[x] = "+" + encodeURI(diffs[x][1]); + break; + case DIFF_DELETE: + text[x] = "-" + diffs[x][1].length; + break; + case DIFF_EQUAL: + text[x] = "=" + diffs[x][1].length; + break; + } + return text.join(" ").replace(/%20/g, " "); +}; +/** + * Given the original text1, and an encoded string which describes the + * operations required to transform text1 into text2, compute the full diff. + * @param {string} text1 Source string for the diff. + * @param {string} delta Delta text. + * @return {!Array.} Array of diff tuples. + * @throws {!Error} If invalid input. + */ diff_match_patch.prototype.diff_fromDelta = function(text1, delta) { + var diffs = []; + var diffsLength = 0; // Keeping our own length var is faster in JS. + var pointer = 0; // Cursor in text1 + var tokens = delta.split(/\t/g); + for(var x = 0; x < tokens.length; x++){ + // Each token begins with a one character parameter which specifies the + // operation of this token (delete, insert, equality). + var param = tokens[x].substring(1); + switch(tokens[x].charAt(0)){ + case "+": + try { + diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_INSERT, decodeURI(param)); + } catch (ex) { + // Malformed URI sequence. + throw new Error("Illegal escape in diff_fromDelta: " + param); + } + break; + case "-": + // Fall through. + case "=": + var n = parseInt(param, 10); + if (isNaN(n) || n < 0) throw new Error("Invalid number in diff_fromDelta: " + param); + var text = text1.substring(pointer, pointer += n); + if (tokens[x].charAt(0) == "=") diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_EQUAL, text); + else diffs[diffsLength++] = new diff_match_patch.Diff(DIFF_DELETE, text); + break; + default: + // Blank tokens are ok (from a trailing \t). + // Anything else is an error. + if (tokens[x]) throw new Error("Invalid diff operation in diff_fromDelta: " + tokens[x]); + } + } + if (pointer != text1.length) throw new Error("Delta length (" + pointer + ") does not equal source text length (" + text1.length + ")."); + return diffs; +}; +// MATCH FUNCTIONS +/** + * Locate the best instance of 'pattern' in 'text' near 'loc'. + * @param {string} text The text to search. + * @param {string} pattern The pattern to search for. + * @param {number} loc The location to search around. + * @return {number} Best match index or -1. + */ diff_match_patch.prototype.match_main = function(text, pattern, loc) { + // Check for null inputs. + if (text == null || pattern == null || loc == null) throw new Error("Null input. (match_main)"); + loc = Math.max(0, Math.min(loc, text.length)); + if (text == pattern) // Shortcut (potentially not guaranteed by the algorithm) + return 0; + else if (!text.length) // Nothing to match. + return -1; + else if (text.substring(loc, loc + pattern.length) == pattern) // Perfect match at the perfect spot! (Includes case of null pattern) + return loc; + else // Do a fuzzy compare. + return this.match_bitap_(text, pattern, loc); +}; +/** + * Locate the best instance of 'pattern' in 'text' near 'loc' using the + * Bitap algorithm. + * @param {string} text The text to search. + * @param {string} pattern The pattern to search for. + * @param {number} loc The location to search around. + * @return {number} Best match index or -1. + * @private + */ diff_match_patch.prototype.match_bitap_ = function(text, pattern, loc) { + if (pattern.length > this.Match_MaxBits) throw new Error("Pattern too long for this browser."); + // Initialise the alphabet. + var s = this.match_alphabet_(pattern); + var dmp = this; // 'this' becomes 'window' in a closure. + /** + * Compute and return the score for a match with e errors and x location. + * Accesses loc and pattern through being a closure. + * @param {number} e Number of errors in match. + * @param {number} x Location of match. + * @return {number} Overall score for match (0.0 = good, 1.0 = bad). + * @private + */ function match_bitapScore_(e, x) { + var accuracy = e / pattern.length; + var proximity = Math.abs(loc - x); + if (!dmp.Match_Distance) // Dodge divide by zero error. + return proximity ? 1.0 : accuracy; + return accuracy + proximity / dmp.Match_Distance; + } + // Highest score beyond which we give up. + var score_threshold = this.Match_Threshold; + // Is there a nearby exact match? (speedup) + var best_loc = text.indexOf(pattern, loc); + if (best_loc != -1) { + score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold); + // What about in the other direction? (speedup) + best_loc = text.lastIndexOf(pattern, loc + pattern.length); + if (best_loc != -1) score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold); + } + // Initialise the bit arrays. + var matchmask = 1 << pattern.length - 1; + best_loc = -1; + var bin_min, bin_mid; + var bin_max = pattern.length + text.length; + var last_rd; + for(var d = 0; d < pattern.length; d++){ + // Scan for the best match; each iteration allows for one more error. + // Run a binary search to determine how far from 'loc' we can stray at this + // error level. + bin_min = 0; + bin_mid = bin_max; + while(bin_min < bin_mid){ + if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) bin_min = bin_mid; + else bin_max = bin_mid; + bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min); + } + // Use the result from this iteration as the maximum for the next. + bin_max = bin_mid; + var start = Math.max(1, loc - bin_mid + 1); + var finish = Math.min(loc + bin_mid, text.length) + pattern.length; + var rd = Array(finish + 2); + rd[finish + 1] = (1 << d) - 1; + for(var j = finish; j >= start; j--){ + // The alphabet (s) is a sparse hash, so the following line generates + // warnings. + var charMatch = s[text.charAt(j - 1)]; + if (d === 0) rd[j] = (rd[j + 1] << 1 | 1) & charMatch; + else rd[j] = (rd[j + 1] << 1 | 1) & charMatch | ((last_rd[j + 1] | last_rd[j]) << 1 | 1) | last_rd[j + 1]; + if (rd[j] & matchmask) { + var score = match_bitapScore_(d, j - 1); + // This match will almost certainly be better than any existing match. + // But check anyway. + if (score <= score_threshold) { + // Told you so. + score_threshold = score; + best_loc = j - 1; + if (best_loc > loc) // When passing loc, don't exceed our current distance from loc. + start = Math.max(1, 2 * loc - best_loc); + else break; + } + } + } + // No hope for a (better) match at greater error levels. + if (match_bitapScore_(d + 1, loc) > score_threshold) break; + last_rd = rd; + } + return best_loc; +}; +/** + * Initialise the alphabet for the Bitap algorithm. + * @param {string} pattern The text to encode. + * @return {!Object} Hash of character locations. + * @private + */ diff_match_patch.prototype.match_alphabet_ = function(pattern) { + var s = {}; + for(var i = 0; i < pattern.length; i++)s[pattern.charAt(i)] = 0; + for(var i = 0; i < pattern.length; i++)s[pattern.charAt(i)] |= 1 << pattern.length - i - 1; + return s; +}; +// PATCH FUNCTIONS +/** + * Increase the context until it is unique, + * but don't let the pattern expand beyond Match_MaxBits. + * @param {!diff_match_patch.patch_obj} patch The patch to grow. + * @param {string} text Source text. + * @private + */ diff_match_patch.prototype.patch_addContext_ = function(patch, text) { + if (text.length == 0) return; + if (patch.start2 === null) throw Error("patch not initialized"); + var pattern = text.substring(patch.start2, patch.start2 + patch.length1); + var padding = 0; + // Look for the first and last matches of pattern in text. If two different + // matches are found, increase the pattern length. + while(text.indexOf(pattern) != text.lastIndexOf(pattern) && pattern.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin){ + padding += this.Patch_Margin; + pattern = text.substring(patch.start2 - padding, patch.start2 + patch.length1 + padding); + } + // Add one chunk for good luck. + padding += this.Patch_Margin; + // Add the prefix. + var prefix = text.substring(patch.start2 - padding, patch.start2); + if (prefix) patch.diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, prefix)); + // Add the suffix. + var suffix = text.substring(patch.start2 + patch.length1, patch.start2 + patch.length1 + padding); + if (suffix) patch.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, suffix)); + // Roll back the start points. + patch.start1 -= prefix.length; + patch.start2 -= prefix.length; + // Extend the lengths. + patch.length1 += prefix.length + suffix.length; + patch.length2 += prefix.length + suffix.length; +}; +/** + * Compute a list of patches to turn text1 into text2. + * Use diffs if provided, otherwise compute it ourselves. + * There are four ways to call this function, depending on what data is + * available to the caller: + * Method 1: + * a = text1, b = text2 + * Method 2: + * a = diffs + * Method 3 (optimal): + * a = text1, b = diffs + * Method 4 (deprecated, use method 3): + * a = text1, b = text2, c = diffs + * + * @param {string|!Array.} a text1 (methods 1,3,4) or + * Array of diff tuples for text1 to text2 (method 2). + * @param {string|!Array.=} opt_b text2 (methods 1,4) or + * Array of diff tuples for text1 to text2 (method 3) or undefined (method 2). + * @param {string|!Array.=} opt_c Array of diff tuples + * for text1 to text2 (method 4) or undefined (methods 1,2,3). + * @return {!Array.} Array of Patch objects. + */ diff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) { + var text1, diffs; + if (typeof a == "string" && typeof opt_b == "string" && typeof opt_c == "undefined") { + // Method 1: text1, text2 + // Compute diffs from text1 and text2. + text1 = /** @type {string} */ a; + diffs = this.diff_main(text1, /** @type {string} */ opt_b, true); + if (diffs.length > 2) { + this.diff_cleanupSemantic(diffs); + this.diff_cleanupEfficiency(diffs); + } + } else if (a && typeof a == "object" && typeof opt_b == "undefined" && typeof opt_c == "undefined") { + // Method 2: diffs + // Compute text1 from diffs. + diffs = /** @type {!Array.} */ a; + text1 = this.diff_text1(diffs); + } else if (typeof a == "string" && opt_b && typeof opt_b == "object" && typeof opt_c == "undefined") { + // Method 3: text1, diffs + text1 = /** @type {string} */ a; + diffs = /** @type {!Array.} */ opt_b; + } else if (typeof a == "string" && typeof opt_b == "string" && opt_c && typeof opt_c == "object") { + // Method 4: text1, text2, diffs + // text2 is not used. + text1 = /** @type {string} */ a; + diffs = /** @type {!Array.} */ opt_c; + } else throw new Error("Unknown call format to patch_make."); + if (diffs.length === 0) return []; // Get rid of the null case. + var patches = []; + var patch = new diff_match_patch.patch_obj(); + var patchDiffLength = 0; // Keeping our own length var is faster in JS. + var char_count1 = 0; // Number of characters into the text1 string. + var char_count2 = 0; // Number of characters into the text2 string. + // Start with text1 (prepatch_text) and apply the diffs until we arrive at + // text2 (postpatch_text). We recreate the patches one by one to determine + // context info. + var prepatch_text = text1; + var postpatch_text = text1; + for(var x = 0; x < diffs.length; x++){ + var diff_type = diffs[x][0]; + var diff_text = diffs[x][1]; + if (!patchDiffLength && diff_type !== DIFF_EQUAL) { + // A new patch starts here. + patch.start1 = char_count1; + patch.start2 = char_count2; + } + switch(diff_type){ + case DIFF_INSERT: + patch.diffs[patchDiffLength++] = diffs[x]; + patch.length2 += diff_text.length; + postpatch_text = postpatch_text.substring(0, char_count2) + diff_text + postpatch_text.substring(char_count2); + break; + case DIFF_DELETE: + patch.length1 += diff_text.length; + patch.diffs[patchDiffLength++] = diffs[x]; + postpatch_text = postpatch_text.substring(0, char_count2) + postpatch_text.substring(char_count2 + diff_text.length); + break; + case DIFF_EQUAL: + if (diff_text.length <= 2 * this.Patch_Margin && patchDiffLength && diffs.length != x + 1) { + // Small equality inside a patch. + patch.diffs[patchDiffLength++] = diffs[x]; + patch.length1 += diff_text.length; + patch.length2 += diff_text.length; + } else if (diff_text.length >= 2 * this.Patch_Margin) // Time for a new patch. + { + if (patchDiffLength) { + this.patch_addContext_(patch, prepatch_text); + patches.push(patch); + patch = new diff_match_patch.patch_obj(); + patchDiffLength = 0; + // Unlike Unidiff, our patch lists have a rolling context. + // https://github.com/google/diff-match-patch/wiki/Unidiff + // Update prepatch text & pos to reflect the application of the + // just completed patch. + prepatch_text = postpatch_text; + char_count1 = char_count2; + } + } + break; + } + // Update the current character count. + if (diff_type !== DIFF_INSERT) char_count1 += diff_text.length; + if (diff_type !== DIFF_DELETE) char_count2 += diff_text.length; + } + // Pick up the leftover patch if not empty. + if (patchDiffLength) { + this.patch_addContext_(patch, prepatch_text); + patches.push(patch); + } + return patches; +}; +/** + * Given an array of patches, return another array that is identical. + * @param {!Array.} patches Array of Patch objects. + * @return {!Array.} Array of Patch objects. + */ diff_match_patch.prototype.patch_deepCopy = function(patches) { + // Making deep copies is hard in JavaScript. + var patchesCopy = []; + for(var x = 0; x < patches.length; x++){ + var patch = patches[x]; + var patchCopy = new diff_match_patch.patch_obj(); + patchCopy.diffs = []; + for(var y = 0; y < patch.diffs.length; y++)patchCopy.diffs[y] = new diff_match_patch.Diff(patch.diffs[y][0], patch.diffs[y][1]); + patchCopy.start1 = patch.start1; + patchCopy.start2 = patch.start2; + patchCopy.length1 = patch.length1; + patchCopy.length2 = patch.length2; + patchesCopy[x] = patchCopy; + } + return patchesCopy; +}; +/** + * Merge a set of patches onto the text. Return a patched text, as well + * as a list of true/false values indicating which patches were applied. + * @param {!Array.} patches Array of Patch objects. + * @param {string} text Old text. + * @return {!Array.>} Two element Array, containing the + * new text and an array of boolean values. + */ diff_match_patch.prototype.patch_apply = function(patches, text) { + if (patches.length == 0) return [ + text, + [] + ]; + // Deep copy the patches so that no changes are made to originals. + patches = this.patch_deepCopy(patches); + var nullPadding = this.patch_addPadding(patches); + text = nullPadding + text + nullPadding; + this.patch_splitMax(patches); + // delta keeps track of the offset between the expected and actual location + // of the previous patch. If there are patches expected at positions 10 and + // 20, but the first patch was found at 12, delta is 2 and the second patch + // has an effective expected position of 22. + var delta = 0; + var results = []; + for(var x = 0; x < patches.length; x++){ + var expected_loc = patches[x].start2 + delta; + var text1 = this.diff_text1(patches[x].diffs); + var start_loc; + var end_loc = -1; + if (text1.length > this.Match_MaxBits) { + // patch_splitMax will only provide an oversized pattern in the case of + // a monster delete. + start_loc = this.match_main(text, text1.substring(0, this.Match_MaxBits), expected_loc); + if (start_loc != -1) { + end_loc = this.match_main(text, text1.substring(text1.length - this.Match_MaxBits), expected_loc + text1.length - this.Match_MaxBits); + if (end_loc == -1 || start_loc >= end_loc) // Can't find valid trailing context. Drop this patch. + start_loc = -1; + } + } else start_loc = this.match_main(text, text1, expected_loc); + if (start_loc == -1) { + // No match found. :( + results[x] = false; + // Subtract the delta for this failed patch from subsequent patches. + delta -= patches[x].length2 - patches[x].length1; + } else { + // Found a match. :) + results[x] = true; + delta = start_loc - expected_loc; + var text2; + if (end_loc == -1) text2 = text.substring(start_loc, start_loc + text1.length); + else text2 = text.substring(start_loc, end_loc + this.Match_MaxBits); + if (text1 == text2) // Perfect match, just shove the replacement text in. + text = text.substring(0, start_loc) + this.diff_text2(patches[x].diffs) + text.substring(start_loc + text1.length); + else { + // Imperfect match. Run a diff to get a framework of equivalent + // indices. + var diffs = this.diff_main(text1, text2, false); + if (text1.length > this.Match_MaxBits && this.diff_levenshtein(diffs) / text1.length > this.Patch_DeleteThreshold) // The end points match, but the content is unacceptably bad. + results[x] = false; + else { + this.diff_cleanupSemanticLossless(diffs); + var index1 = 0; + var index2; + for(var y = 0; y < patches[x].diffs.length; y++){ + var mod = patches[x].diffs[y]; + if (mod[0] !== DIFF_EQUAL) index2 = this.diff_xIndex(diffs, index1); + if (mod[0] === DIFF_INSERT) text = text.substring(0, start_loc + index2) + mod[1] + text.substring(start_loc + index2); + else if (mod[0] === DIFF_DELETE) text = text.substring(0, start_loc + index2) + text.substring(start_loc + this.diff_xIndex(diffs, index1 + mod[1].length)); + if (mod[0] !== DIFF_DELETE) index1 += mod[1].length; + } + } + } + } + } + // Strip the padding off. + text = text.substring(nullPadding.length, text.length - nullPadding.length); + return [ + text, + results + ]; +}; +/** + * Add some padding on text start and end so that edges can match something. + * Intended to be called only from within patch_apply. + * @param {!Array.} patches Array of Patch objects. + * @return {string} The padding string added to each side. + */ diff_match_patch.prototype.patch_addPadding = function(patches) { + var paddingLength = this.Patch_Margin; + var nullPadding = ""; + for(var x = 1; x <= paddingLength; x++)nullPadding += String.fromCharCode(x); + // Bump all the patches forward. + for(var x = 0; x < patches.length; x++){ + patches[x].start1 += paddingLength; + patches[x].start2 += paddingLength; + } + // Add some padding on start of first diff. + var patch = patches[0]; + var diffs = patch.diffs; + if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) { + // Add nullPadding equality. + diffs.unshift(new diff_match_patch.Diff(DIFF_EQUAL, nullPadding)); + patch.start1 -= paddingLength; // Should be 0. + patch.start2 -= paddingLength; // Should be 0. + patch.length1 += paddingLength; + patch.length2 += paddingLength; + } else if (paddingLength > diffs[0][1].length) { + // Grow first equality. + var extraLength = paddingLength - diffs[0][1].length; + diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1]; + patch.start1 -= extraLength; + patch.start2 -= extraLength; + patch.length1 += extraLength; + patch.length2 += extraLength; + } + // Add some padding on end of last diff. + patch = patches[patches.length - 1]; + diffs = patch.diffs; + if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) { + // Add nullPadding equality. + diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, nullPadding)); + patch.length1 += paddingLength; + patch.length2 += paddingLength; + } else if (paddingLength > diffs[diffs.length - 1][1].length) { + // Grow last equality. + var extraLength = paddingLength - diffs[diffs.length - 1][1].length; + diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength); + patch.length1 += extraLength; + patch.length2 += extraLength; + } + return nullPadding; +}; +/** + * Look through the patches and break up any which are longer than the maximum + * limit of the match algorithm. + * Intended to be called only from within patch_apply. + * @param {!Array.} patches Array of Patch objects. + */ diff_match_patch.prototype.patch_splitMax = function(patches) { + var patch_size = this.Match_MaxBits; + for(var x = 0; x < patches.length; x++){ + if (patches[x].length1 <= patch_size) continue; + var bigpatch = patches[x]; + // Remove the big old patch. + patches.splice(x--, 1); + var start1 = bigpatch.start1; + var start2 = bigpatch.start2; + var precontext = ""; + while(bigpatch.diffs.length !== 0){ + // Create one of several smaller patches. + var patch = new diff_match_patch.patch_obj(); + var empty = true; + patch.start1 = start1 - precontext.length; + patch.start2 = start2 - precontext.length; + if (precontext !== "") { + patch.length1 = patch.length2 = precontext.length; + patch.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, precontext)); + } + while(bigpatch.diffs.length !== 0 && patch.length1 < patch_size - this.Patch_Margin){ + var diff_type = bigpatch.diffs[0][0]; + var diff_text = bigpatch.diffs[0][1]; + if (diff_type === DIFF_INSERT) { + // Insertions are harmless. + patch.length2 += diff_text.length; + start2 += diff_text.length; + patch.diffs.push(bigpatch.diffs.shift()); + empty = false; + } else if (diff_type === DIFF_DELETE && patch.diffs.length == 1 && patch.diffs[0][0] == DIFF_EQUAL && diff_text.length > 2 * patch_size) { + // This is a large deletion. Let it pass in one chunk. + patch.length1 += diff_text.length; + start1 += diff_text.length; + empty = false; + patch.diffs.push(new diff_match_patch.Diff(diff_type, diff_text)); + bigpatch.diffs.shift(); + } else { + // Deletion or equality. Only take as much as we can stomach. + diff_text = diff_text.substring(0, patch_size - patch.length1 - this.Patch_Margin); + patch.length1 += diff_text.length; + start1 += diff_text.length; + if (diff_type === DIFF_EQUAL) { + patch.length2 += diff_text.length; + start2 += diff_text.length; + } else empty = false; + patch.diffs.push(new diff_match_patch.Diff(diff_type, diff_text)); + if (diff_text == bigpatch.diffs[0][1]) bigpatch.diffs.shift(); + else bigpatch.diffs[0][1] = bigpatch.diffs[0][1].substring(diff_text.length); + } + } + // Compute the head context for the next patch. + precontext = this.diff_text2(patch.diffs); + precontext = precontext.substring(precontext.length - this.Patch_Margin); + // Append the end context for this patch. + var postcontext = this.diff_text1(bigpatch.diffs).substring(0, this.Patch_Margin); + if (postcontext !== "") { + patch.length1 += postcontext.length; + patch.length2 += postcontext.length; + if (patch.diffs.length !== 0 && patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL) patch.diffs[patch.diffs.length - 1][1] += postcontext; + else patch.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, postcontext)); + } + if (!empty) patches.splice(++x, 0, patch); + } + } +}; +/** + * Take a list of patches and return a textual representation. + * @param {!Array.} patches Array of Patch objects. + * @return {string} Text representation of patches. + */ diff_match_patch.prototype.patch_toText = function(patches) { + var text = []; + for(var x = 0; x < patches.length; x++)text[x] = patches[x]; + return text.join(""); +}; +/** + * Parse a textual representation of patches and return a list of Patch objects. + * @param {string} textline Text representation of patches. + * @return {!Array.} Array of Patch objects. + * @throws {!Error} If invalid input. + */ diff_match_patch.prototype.patch_fromText = function(textline) { + var patches = []; + if (!textline) return patches; + var text = textline.split("\n"); + var textPointer = 0; + var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/; + while(textPointer < text.length){ + var m = text[textPointer].match(patchHeader); + if (!m) throw new Error("Invalid patch string: " + text[textPointer]); + var patch = new diff_match_patch.patch_obj(); + patches.push(patch); + patch.start1 = parseInt(m[1], 10); + if (m[2] === "") { + patch.start1--; + patch.length1 = 1; + } else if (m[2] == "0") patch.length1 = 0; + else { + patch.start1--; + patch.length1 = parseInt(m[2], 10); + } + patch.start2 = parseInt(m[3], 10); + if (m[4] === "") { + patch.start2--; + patch.length2 = 1; + } else if (m[4] == "0") patch.length2 = 0; + else { + patch.start2--; + patch.length2 = parseInt(m[4], 10); + } + textPointer++; + while(textPointer < text.length){ + var sign = text[textPointer].charAt(0); + try { + var line = decodeURI(text[textPointer].substring(1)); + } catch (ex) { + // Malformed URI sequence. + throw new Error("Illegal escape in patch_fromText: " + line); + } + if (sign == "-") // Deletion. + patch.diffs.push(new diff_match_patch.Diff(DIFF_DELETE, line)); + else if (sign == "+") // Insertion. + patch.diffs.push(new diff_match_patch.Diff(DIFF_INSERT, line)); + else if (sign == " ") // Minor equality. + patch.diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, line)); + else if (sign == "@") break; + else if (sign === "") ; + else // WTF? + throw new Error('Invalid patch mode "' + sign + '" in: ' + line); + textPointer++; + } + } + return patches; +}; +/** + * Class representing one patch operation. + * @constructor + */ diff_match_patch.patch_obj = function() { + /** @type {!Array.} */ this.diffs = []; + /** @type {?number} */ this.start1 = null; + /** @type {?number} */ this.start2 = null; + /** @type {number} */ this.length1 = 0; + /** @type {number} */ this.length2 = 0; +}; +/** + * Emulate GNU diff's format. + * Header: @@ -382,8 +481,9 @@ + * Indices are printed as 1-based, not 0-based. + * @return {string} The GNU diff string. + */ diff_match_patch.patch_obj.prototype.toString = function() { + var coords1, coords2; + if (this.length1 === 0) coords1 = this.start1 + ",0"; + else if (this.length1 == 1) coords1 = this.start1 + 1; + else coords1 = this.start1 + 1 + "," + this.length1; + if (this.length2 === 0) coords2 = this.start2 + ",0"; + else if (this.length2 == 1) coords2 = this.start2 + 1; + else coords2 = this.start2 + 1 + "," + this.length2; + var text = [ + "@@ -" + coords1 + " +" + coords2 + " @@\n" + ]; + var op; + // Escape the body of the patch with %xx notation. + for(var x = 0; x < this.diffs.length; x++){ + switch(this.diffs[x][0]){ + case DIFF_INSERT: + op = "+"; + break; + case DIFF_DELETE: + op = "-"; + break; + case DIFF_EQUAL: + op = " "; + break; + } + text[x + 1] = op + encodeURI(this.diffs[x][1]) + "\n"; + } + return text.join("").replace(/%20/g, " "); +}; +// The following export code was added by @ForbesLindesay +module.exports = diff_match_patch; +module.exports["diff_match_patch"] = diff_match_patch; +module.exports["DIFF_DELETE"] = DIFF_DELETE; +module.exports["DIFF_INSERT"] = DIFF_INSERT; +module.exports["DIFF_EQUAL"] = DIFF_EQUAL; + +},{}],"3ybLa":[function(require,module,exports) { +ace.define("ace/mode/doc_comment_highlight_rules", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/mode/text_highlight_rules" +], function(require, exports, module1) { + "use strict"; + var oop = require("../lib/oop"); + var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + var DocCommentHighlightRules = function() { + this.$rules = { + "start": [ + { + token: "comment.doc.tag", + regex: "@[\\w\\d_]+" // TODO: fix email addresses + }, + DocCommentHighlightRules.getTagRule(), + { + defaultToken: "comment.doc", + caseInsensitive: true + } + ] + }; + }; + oop.inherits(DocCommentHighlightRules, TextHighlightRules); + DocCommentHighlightRules.getTagRule = function(start) { + return { + token: "comment.doc.tag.storage.type", + regex: "\\b(?:TODO|FIXME|XXX|HACK)\\b" + }; + }; + DocCommentHighlightRules.getStartRule = function(start) { + return { + token: "comment.doc", + regex: "\\/\\*(?=\\*)", + next: start + }; + }; + DocCommentHighlightRules.getEndRule = function(start) { + return { + token: "comment.doc", + regex: "\\*\\/", + next: start + }; + }; + exports.DocCommentHighlightRules = DocCommentHighlightRules; +}); +ace.define("ace/mode/javascript_highlight_rules", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/mode/doc_comment_highlight_rules", + "ace/mode/text_highlight_rules" +], function(require, exports, module1) { + "use strict"; + var oop = require("../lib/oop"); + var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; + var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + var identifierRe = "[a-zA-Z\\$_\xa1-￿][a-zA-Z\\d\\$_\xa1-￿]*"; + var JavaScriptHighlightRules = function(options) { + var keywordMapper = this.createKeywordMapper({ + "variable.language": "Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Symbol|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document", + "keyword": "const|yield|import|get|set|async|await|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static|constructor", + "storage.type": "const|let|var|function", + "constant.language": "null|Infinity|NaN|undefined", + "support.function": "alert", + "constant.language.boolean": "true|false" + }, "identifier"); + var kwBeforeRe = "case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void"; + var escapedRe = "\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u{[0-9a-fA-F]{1,6}}|[0-2][0-7]{0,2}|3[0-7][0-7]?|[4-7][0-7]?|.)"; + this.$rules = { + "no_regex": [ + DocCommentHighlightRules.getStartRule("doc-start"), + comments("no_regex"), + { + token: "string", + regex: "'(?=.)", + next: "qstring" + }, + { + token: "string", + regex: '"(?=.)', + next: "qqstring" + }, + { + token: "constant.numeric", + regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/ + }, + { + token: "constant.numeric", + regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/ + }, + { + token: [ + "storage.type", + "punctuation.operator", + "support.function", + "punctuation.operator", + "entity.name.function", + "text", + "keyword.operator" + ], + regex: "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe + ")(\\s*)(=)", + next: "function_arguments" + }, + { + token: [ + "storage.type", + "punctuation.operator", + "entity.name.function", + "text", + "keyword.operator", + "text", + "storage.type", + "text", + "paren.lparen" + ], + regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s*)(\\()", + next: "function_arguments" + }, + { + token: [ + "entity.name.function", + "text", + "keyword.operator", + "text", + "storage.type", + "text", + "paren.lparen" + ], + regex: "(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s*)(\\()", + next: "function_arguments" + }, + { + token: [ + "storage.type", + "punctuation.operator", + "entity.name.function", + "text", + "keyword.operator", + "text", + "storage.type", + "text", + "entity.name.function", + "text", + "paren.lparen" + ], + regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(\\s+)(\\w+)(\\s*)(\\()", + next: "function_arguments" + }, + { + token: [ + "storage.type", + "text", + "entity.name.function", + "text", + "paren.lparen" + ], + regex: "(function\\*?)(\\s+)(" + identifierRe + ")(\\s*)(\\()", + next: "function_arguments" + }, + { + token: [ + "entity.name.function", + "text", + "punctuation.operator", + "text", + "storage.type", + "text", + "paren.lparen" + ], + regex: "(" + identifierRe + ")(\\s*)(:)(\\s*)(function\\*?)(\\s*)(\\()", + next: "function_arguments" + }, + { + token: [ + "text", + "text", + "storage.type", + "text", + "paren.lparen" + ], + regex: "(:)(\\s*)(function\\*?)(\\s*)(\\()", + next: "function_arguments" + }, + { + token: "keyword", + regex: "from(?=\\s*('|\"))" + }, + { + token: "keyword", + regex: "(?:" + kwBeforeRe + ")\\b", + next: "start" + }, + { + token: "support.constant", + regex: /that\b/ + }, + { + token: [ + "storage.type", + "punctuation.operator", + "support.function.firebug" + ], + regex: /(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/ + }, + { + token: keywordMapper, + regex: identifierRe + }, + { + token: "punctuation.operator", + regex: /[.](?![.])/, + next: "property" + }, + { + token: "storage.type", + regex: /=>/, + next: "start" + }, + { + token: "keyword.operator", + regex: /--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/, + next: "start" + }, + { + token: "punctuation.operator", + regex: /[?:,;.]/, + next: "start" + }, + { + token: "paren.lparen", + regex: /[\[({]/, + next: "start" + }, + { + token: "paren.rparen", + regex: /[\])}]/ + }, + { + token: "comment", + regex: /^#!.*$/ + } + ], + property: [ + { + token: "text", + regex: "\\s+" + }, + { + token: [ + "storage.type", + "punctuation.operator", + "entity.name.function", + "text", + "keyword.operator", + "text", + "storage.type", + "text", + "entity.name.function", + "text", + "paren.lparen" + ], + regex: "(" + identifierRe + ")(\\.)(" + identifierRe + ")(\\s*)(=)(\\s*)(function\\*?)(?:(\\s+)(\\w+))?(\\s*)(\\()", + next: "function_arguments" + }, + { + token: "punctuation.operator", + regex: /[.](?![.])/ + }, + { + token: "support.function", + regex: /(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|lter|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward|rEach)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/ + }, + { + token: "support.function.dom", + regex: /(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/ + }, + { + token: "support.constant", + regex: /(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/ + }, + { + token: "identifier", + regex: identifierRe + }, + { + regex: "", + token: "empty", + next: "no_regex" + } + ], + "start": [ + DocCommentHighlightRules.getStartRule("doc-start"), + comments("start"), + { + token: "string.regexp", + regex: "\\/", + next: "regex" + }, + { + token: "text", + regex: "\\s+|^$", + next: "start" + }, + { + token: "empty", + regex: "", + next: "no_regex" + } + ], + "regex": [ + { + token: "regexp.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, + { + token: "string.regexp", + regex: "/[sxngimy]*", + next: "no_regex" + }, + { + token: "invalid", + regex: /\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/ + }, + { + token: "constant.language.escape", + regex: /\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/ + }, + { + token: "constant.language.delimiter", + regex: /\|/ + }, + { + token: "constant.language.escape", + regex: /\[\^?/, + next: "regex_character_class" + }, + { + token: "empty", + regex: "$", + next: "no_regex" + }, + { + defaultToken: "string.regexp" + } + ], + "regex_character_class": [ + { + token: "regexp.charclass.keyword.operator", + regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)" + }, + { + token: "constant.language.escape", + regex: "]", + next: "regex" + }, + { + token: "constant.language.escape", + regex: "-" + }, + { + token: "empty", + regex: "$", + next: "no_regex" + }, + { + defaultToken: "string.regexp.charachterclass" + } + ], + "default_parameter": [ + { + token: "string", + regex: "'(?=.)", + push: [ + { + token: "string", + regex: "'|$", + next: "pop" + }, + { + include: "qstring" + } + ] + }, + { + token: "string", + regex: '"(?=.)', + push: [ + { + token: "string", + regex: '"|$', + next: "pop" + }, + { + include: "qqstring" + } + ] + }, + { + token: "constant.language", + regex: "null|Infinity|NaN|undefined" + }, + { + token: "constant.numeric", + regex: /0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/ + }, + { + token: "constant.numeric", + regex: /(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/ + }, + { + token: "punctuation.operator", + regex: ",", + next: "function_arguments" + }, + { + token: "text", + regex: "\\s+" + }, + { + token: "punctuation.operator", + regex: "$" + }, + { + token: "empty", + regex: "", + next: "no_regex" + } + ], + "function_arguments": [ + comments("function_arguments"), + { + token: "variable.parameter", + regex: identifierRe + }, + { + token: "punctuation.operator", + regex: "," + }, + { + token: "text", + regex: "\\s+" + }, + { + token: "punctuation.operator", + regex: "$" + }, + { + token: "empty", + regex: "", + next: "no_regex" + } + ], + "qqstring": [ + { + token: "constant.language.escape", + regex: escapedRe + }, + { + token: "string", + regex: "\\\\$", + consumeLineEnd: true + }, + { + token: "string", + regex: '"|$', + next: "no_regex" + }, + { + defaultToken: "string" + } + ], + "qstring": [ + { + token: "constant.language.escape", + regex: escapedRe + }, + { + token: "string", + regex: "\\\\$", + consumeLineEnd: true + }, + { + token: "string", + regex: "'|$", + next: "no_regex" + }, + { + defaultToken: "string" + } + ] + }; + if (!options || !options.noES6) { + this.$rules.no_regex.unshift({ + regex: "[{}]", + onMatch: function(val, state, stack) { + this.next = val == "{" ? this.nextState : ""; + if (val == "{" && stack.length) stack.unshift("start", state); + else if (val == "}" && stack.length) { + stack.shift(); + this.next = stack.shift(); + if (this.next.indexOf("string") != -1 || this.next.indexOf("jsx") != -1) return "paren.quasi.end"; + } + return val == "{" ? "paren.lparen" : "paren.rparen"; + }, + nextState: "start" + }, { + token: "string.quasi.start", + regex: /`/, + push: [ + { + token: "constant.language.escape", + regex: escapedRe + }, + { + token: "paren.quasi.start", + regex: /\${/, + push: "start" + }, + { + token: "string.quasi.end", + regex: /`/, + next: "pop" + }, + { + defaultToken: "string.quasi" + } + ] + }, { + token: [ + "variable.parameter", + "text" + ], + regex: "(" + identifierRe + ")(\\s*)(?=\\=>)" + }, { + token: "paren.lparen", + regex: "(\\()(?=.+\\s*=>)", + next: "function_arguments" + }, { + token: "variable.language", + regex: "(?:(?:(?:Weak)?(?:Set|Map))|Promise)\\b" + }); + this.$rules["function_arguments"].unshift({ + token: "keyword.operator", + regex: "=", + next: "default_parameter" + }, { + token: "keyword.operator", + regex: "\\.{3}" + }); + this.$rules["property"].unshift({ + token: "support.function", + regex: "(findIndex|repeat|startsWith|endsWith|includes|isSafeInteger|trunc|cbrt|log2|log10|sign|then|catch|finally|resolve|reject|race|any|all|allSettled|keys|entries|isInteger)\\b(?=\\()" + }, { + token: "constant.language", + regex: "(?:MAX_SAFE_INTEGER|MIN_SAFE_INTEGER|EPSILON)\\b" + }); + if (!options || options.jsx != false) JSX.call(this); + } + this.embedRules(DocCommentHighlightRules, "doc-", [ + DocCommentHighlightRules.getEndRule("no_regex") + ]); + this.normalizeRules(); + }; + oop.inherits(JavaScriptHighlightRules, TextHighlightRules); + function JSX() { + var tagRegex = identifierRe.replace("\\d", "\\d\\-"); + var jsxTag = { + onMatch: function(val, state, stack) { + var offset = val.charAt(1) == "/" ? 2 : 1; + if (offset == 1) { + if (state != this.nextState) stack.unshift(this.next, this.nextState, 0); + else stack.unshift(this.next); + stack[2]++; + } else if (offset == 2) { + if (state == this.nextState) { + stack[1]--; + if (!stack[1] || stack[1] < 0) { + stack.shift(); + stack.shift(); + } + } + } + return [ + { + type: "meta.tag.punctuation." + (offset == 1 ? "" : "end-") + "tag-open.xml", + value: val.slice(0, offset) + }, + { + type: "meta.tag.tag-name.xml", + value: val.substr(offset) + } + ]; + }, + regex: "", + onMatch: function(value, currentState, stack) { + if (currentState == stack[0]) stack.shift(); + if (value.length == 2) { + if (stack[0] == this.nextState) stack[1]--; + if (!stack[1] || stack[1] < 0) stack.splice(0, 2); + } + this.next = stack[0] || "start"; + return [ + { + type: this.token, + value: value + } + ]; + }, + nextState: "jsx" + }, + jsxJsRule, + comments("jsxAttributes"), + { + token: "entity.other.attribute-name.xml", + regex: tagRegex + }, + { + token: "keyword.operator.attribute-equals.xml", + regex: "=" + }, + { + token: "text.tag-whitespace.xml", + regex: "\\s+" + }, + { + token: "string.attribute-value.xml", + regex: "'", + stateName: "jsx_attr_q", + push: [ + { + token: "string.attribute-value.xml", + regex: "'", + next: "pop" + }, + { + include: "reference" + }, + { + defaultToken: "string.attribute-value.xml" + } + ] + }, + { + token: "string.attribute-value.xml", + regex: '"', + stateName: "jsx_attr_qq", + push: [ + { + token: "string.attribute-value.xml", + regex: '"', + next: "pop" + }, + { + include: "reference" + }, + { + defaultToken: "string.attribute-value.xml" + } + ] + }, + jsxTag + ]; + this.$rules.reference = [ + { + token: "constant.language.escape.reference.xml", + regex: "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)" + } + ]; + } + function comments(next) { + return [ + { + token: "comment", + regex: /\/\*/, + next: [ + DocCommentHighlightRules.getTagRule(), + { + token: "comment", + regex: "\\*\\/", + next: next || "pop" + }, + { + defaultToken: "comment", + caseInsensitive: true + } + ] + }, + { + token: "comment", + regex: "\\/\\/", + next: [ + DocCommentHighlightRules.getTagRule(), + { + token: "comment", + regex: "$|^", + next: next || "pop" + }, + { + defaultToken: "comment", + caseInsensitive: true + } + ] + } + ]; + } + exports.JavaScriptHighlightRules = JavaScriptHighlightRules; +}); +ace.define("ace/mode/matching_brace_outdent", [ + "require", + "exports", + "module", + "ace/range" +], function(require, exports, module1) { + "use strict"; + var Range = require("../range").Range; + var MatchingBraceOutdent = function() {}; + (function() { + this.checkOutdent = function(line, input) { + if (!/^\s+$/.test(line)) return false; + return /^\s*\}/.test(input); + }; + this.autoOutdent = function(doc, row) { + var line = doc.getLine(row); + var match = line.match(/^(\s*\})/); + if (!match) return 0; + var column = match[1].length; + var openBracePos = doc.findMatchingBracket({ + row: row, + column: column + }); + if (!openBracePos || openBracePos.row == row) return 0; + var indent = this.$getIndent(doc.getLine(openBracePos.row)); + doc.replace(new Range(row, 0, row, column - 1), indent); + }; + this.$getIndent = function(line) { + return line.match(/^\s*/)[0]; + }; + }).call(MatchingBraceOutdent.prototype); + exports.MatchingBraceOutdent = MatchingBraceOutdent; +}); +ace.define("ace/mode/folding/cstyle", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/range", + "ace/mode/folding/fold_mode" +], function(require, exports, module1) { + "use strict"; + var oop = require("../../lib/oop"); + var Range = require("../../range").Range; + var BaseFoldMode = require("./fold_mode").FoldMode; + var FoldMode = exports.FoldMode = function(commentRegex) { + if (commentRegex) { + this.foldingStartMarker = new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.start)); + this.foldingStopMarker = new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/, "|" + commentRegex.end)); + } + }; + oop.inherits(FoldMode, BaseFoldMode); + (function() { + this.foldingStartMarker = /([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/; + this.foldingStopMarker = /^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/; + this.singleLineBlockCommentRe = /^\s*(\/\*).*\*\/\s*$/; + this.tripleStarBlockCommentRe = /^\s*(\/\*\*\*).*\*\/\s*$/; + this.startRegionRe = /^\s*(\/\*|\/\/)#?region\b/; + this._getFoldWidgetBase = this.getFoldWidget; + this.getFoldWidget = function(session, foldStyle, row) { + var line = session.getLine(row); + if (this.singleLineBlockCommentRe.test(line)) { + if (!this.startRegionRe.test(line) && !this.tripleStarBlockCommentRe.test(line)) return ""; + } + var fw = this._getFoldWidgetBase(session, foldStyle, row); + if (!fw && this.startRegionRe.test(line)) return "start"; // lineCommentRegionStart + return fw; + }; + this.getFoldWidgetRange = function(session, foldStyle, row, forceMultiline) { + var line = session.getLine(row); + if (this.startRegionRe.test(line)) return this.getCommentRegionBlock(session, line, row); + var match = line.match(this.foldingStartMarker); + if (match) { + var i = match.index; + if (match[1]) return this.openingBracketBlock(session, match[1], row, i); + var range = session.getCommentFoldRange(row, i + match[0].length, 1); + if (range && !range.isMultiLine()) { + if (forceMultiline) range = this.getSectionRange(session, row); + else if (foldStyle != "all") range = null; + } + return range; + } + if (foldStyle === "markbegin") return; + var match = line.match(this.foldingStopMarker); + if (match) { + var i = match.index + match[0].length; + if (match[1]) return this.closingBracketBlock(session, match[1], row, i); + return session.getCommentFoldRange(row, i, -1); + } + }; + this.getSectionRange = function(session, row) { + var line = session.getLine(row); + var startIndent = line.search(/\S/); + var startRow = row; + var startColumn = line.length; + row = row + 1; + var endRow = row; + var maxRow = session.getLength(); + while(++row < maxRow){ + line = session.getLine(row); + var indent = line.search(/\S/); + if (indent === -1) continue; + if (startIndent > indent) break; + var subRange = this.getFoldWidgetRange(session, "all", row); + if (subRange) { + if (subRange.start.row <= startRow) break; + else if (subRange.isMultiLine()) row = subRange.end.row; + else if (startIndent == indent) break; + } + endRow = row; + } + return new Range(startRow, startColumn, endRow, session.getLine(endRow).length); + }; + this.getCommentRegionBlock = function(session, line, row) { + var startColumn = line.search(/\s*$/); + var maxRow = session.getLength(); + var startRow = row; + var re = /^\s*(?:\/\*|\/\/|--)#?(end)?region\b/; + var depth = 1; + while(++row < maxRow){ + line = session.getLine(row); + var m = re.exec(line); + if (!m) continue; + if (m[1]) depth--; + else depth++; + if (!depth) break; + } + var endRow = row; + if (endRow > startRow) return new Range(startRow, startColumn, endRow, line.length); + }; + }).call(FoldMode.prototype); +}); +ace.define("ace/mode/javascript", [ + "require", + "exports", + "module", + "ace/lib/oop", + "ace/mode/text", + "ace/mode/javascript_highlight_rules", + "ace/mode/matching_brace_outdent", + "ace/worker/worker_client", + "ace/mode/behaviour/cstyle", + "ace/mode/folding/cstyle" +], function(require, exports, module1) { + "use strict"; + var oop = require("../lib/oop"); + var TextMode = require("./text").Mode; + var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; + var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; + var WorkerClient = require("../worker/worker_client").WorkerClient; + var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; + var CStyleFoldMode = require("./folding/cstyle").FoldMode; + var Mode = function() { + this.HighlightRules = JavaScriptHighlightRules; + this.$outdent = new MatchingBraceOutdent(); + this.$behaviour = new CstyleBehaviour(); + this.foldingRules = new CStyleFoldMode(); + }; + oop.inherits(Mode, TextMode); + (function() { + this.lineCommentStart = "//"; + this.blockComment = { + start: "/*", + end: "*/" + }; + this.$quotes = { + '"': '"', + "'": "'", + "`": "`" + }; + this.getNextLineIndent = function(state, line, tab) { + var indent = this.$getIndent(line); + var tokenizedLine = this.getTokenizer().getLineTokens(line, state); + var tokens = tokenizedLine.tokens; + var endState = tokenizedLine.state; + if (tokens.length && tokens[tokens.length - 1].type == "comment") return indent; + if (state == "start" || state == "no_regex") { + var match = line.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/); + if (match) indent += tab; + } else if (state == "doc-start") { + if (endState == "start" || endState == "no_regex") return ""; + var match = line.match(/^\s*(\/?)\*/); + if (match) { + if (match[1]) indent += " "; + indent += "* "; + } + } + return indent; + }; + this.checkOutdent = function(state, line, input) { + return this.$outdent.checkOutdent(line, input); + }; + this.autoOutdent = function(state, doc, row) { + this.$outdent.autoOutdent(doc, row); + }; + this.createWorker = function(session) { + var worker = new WorkerClient([ + "ace" + ], "ace/mode/javascript_worker", "JavaScriptWorker"); + worker.attachToDocument(session.getDocument()); + worker.on("annotate", function(results) { + session.setAnnotations(results.data); + }); + worker.on("terminate", function() { + session.clearAnnotations(); + }); + return worker; + }; + this.$id = "ace/mode/javascript"; + this.snippetFileId = "ace/snippets/javascript"; + }).call(Mode.prototype); + exports.Mode = Mode; +}); +(function() { + ace.require([ + "ace/mode/javascript" + ], function(m) { + if (module) module.exports = m; + }); +})(); + +},{}],"cfWRh":[function(require,module,exports) { +ace.define("ace/theme/monokai.css", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + module1.exports = '.ace-monokai .ace_gutter {\n background: #2F3129;\n color: #8F908A\n}\n\n.ace-monokai .ace_print-margin {\n width: 1px;\n background: #555651\n}\n\n.ace-monokai {\n background-color: #272822;\n color: #F8F8F2\n}\n\n.ace-monokai .ace_cursor {\n color: #F8F8F0\n}\n\n.ace-monokai .ace_marker-layer .ace_selection {\n background: #49483E\n}\n\n.ace-monokai.ace_multiselect .ace_selection.ace_start {\n box-shadow: 0 0 3px 0px #272822;\n}\n\n.ace-monokai .ace_marker-layer .ace_step {\n background: rgb(102, 82, 0)\n}\n\n.ace-monokai .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #49483E\n}\n\n.ace-monokai .ace_marker-layer .ace_active-line {\n background: #202020\n}\n\n.ace-monokai .ace_gutter-active-line {\n background-color: #272727\n}\n\n.ace-monokai .ace_marker-layer .ace_selected-word {\n border: 1px solid #49483E\n}\n\n.ace-monokai .ace_invisible {\n color: #52524d\n}\n\n.ace-monokai .ace_entity.ace_name.ace_tag,\n.ace-monokai .ace_keyword,\n.ace-monokai .ace_meta.ace_tag,\n.ace-monokai .ace_storage {\n color: #F92672\n}\n\n.ace-monokai .ace_punctuation,\n.ace-monokai .ace_punctuation.ace_tag {\n color: #fff\n}\n\n.ace-monokai .ace_constant.ace_character,\n.ace-monokai .ace_constant.ace_language,\n.ace-monokai .ace_constant.ace_numeric,\n.ace-monokai .ace_constant.ace_other {\n color: #AE81FF\n}\n\n.ace-monokai .ace_invalid {\n color: #F8F8F0;\n background-color: #F92672\n}\n\n.ace-monokai .ace_invalid.ace_deprecated {\n color: #F8F8F0;\n background-color: #AE81FF\n}\n\n.ace-monokai .ace_support.ace_constant,\n.ace-monokai .ace_support.ace_function {\n color: #66D9EF\n}\n\n.ace-monokai .ace_fold {\n background-color: #A6E22E;\n border-color: #F8F8F2\n}\n\n.ace-monokai .ace_storage.ace_type,\n.ace-monokai .ace_support.ace_class,\n.ace-monokai .ace_support.ace_type {\n font-style: italic;\n color: #66D9EF\n}\n\n.ace-monokai .ace_entity.ace_name.ace_function,\n.ace-monokai .ace_entity.ace_other,\n.ace-monokai .ace_entity.ace_other.ace_attribute-name,\n.ace-monokai .ace_variable {\n color: #A6E22E\n}\n\n.ace-monokai .ace_variable.ace_parameter {\n font-style: italic;\n color: #FD971F\n}\n\n.ace-monokai .ace_string {\n color: #E6DB74\n}\n\n.ace-monokai .ace_comment {\n color: #75715E\n}\n\n.ace-monokai .ace_indent-guide {\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y\n}\n\n.ace-monokai .ace_indent-guide-active {\n background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;\n}\n'; +}); +ace.define("ace/theme/monokai", [ + "require", + "exports", + "module", + "ace/theme/monokai.css", + "ace/lib/dom" +], function(require, exports, module1) { + exports.isDark = true; + exports.cssClass = "ace-monokai"; + exports.cssText = require("./monokai.css"); + var dom = require("../lib/dom"); + dom.importCssString(exports.cssText, exports.cssClass, false); +}); +(function() { + ace.require([ + "ace/theme/monokai" + ], function(m) { + if (module) module.exports = m; + }); +})(); + +},{}],"45Ax6":[function(require,module,exports) { +ace.define("ace/ext/searchbox.css", [ + "require", + "exports", + "module" +], function(require, exports, module1) { + module1.exports = '\n\n/* ------------------------------------------------------------------------------------------\n * Editor Search Form\n * --------------------------------------------------------------------------------------- */\n.ace_search {\n background-color: #ddd;\n color: #666;\n border: 1px solid #cbcbcb;\n border-top: 0 none;\n overflow: hidden;\n margin: 0;\n padding: 4px 6px 0 4px;\n position: absolute;\n top: 0;\n z-index: 99;\n white-space: normal;\n}\n.ace_search.left {\n border-left: 0 none;\n border-radius: 0px 0px 5px 0px;\n left: 0;\n}\n.ace_search.right {\n border-radius: 0px 0px 0px 5px;\n border-right: 0 none;\n right: 0;\n}\n\n.ace_search_form, .ace_replace_form {\n margin: 0 20px 4px 0;\n overflow: hidden;\n line-height: 1.9;\n}\n.ace_replace_form {\n margin-right: 0;\n}\n.ace_search_form.ace_nomatch {\n outline: 1px solid red;\n}\n\n.ace_search_field {\n border-radius: 3px 0 0 3px;\n background-color: white;\n color: black;\n border: 1px solid #cbcbcb;\n border-right: 0 none;\n outline: 0;\n padding: 0;\n font-size: inherit;\n margin: 0;\n line-height: inherit;\n padding: 0 6px;\n min-width: 17em;\n vertical-align: top;\n min-height: 1.8em;\n box-sizing: content-box;\n}\n.ace_searchbtn {\n border: 1px solid #cbcbcb;\n line-height: inherit;\n display: inline-block;\n padding: 0 6px;\n background: #fff;\n border-right: 0 none;\n border-left: 1px solid #dcdcdc;\n cursor: pointer;\n margin: 0;\n position: relative;\n color: #666;\n}\n.ace_searchbtn:last-child {\n border-radius: 0 3px 3px 0;\n border-right: 1px solid #cbcbcb;\n}\n.ace_searchbtn:disabled {\n background: none;\n cursor: default;\n}\n.ace_searchbtn:hover {\n background-color: #eef1f6;\n}\n.ace_searchbtn.prev, .ace_searchbtn.next {\n padding: 0px 0.7em\n}\n.ace_searchbtn.prev:after, .ace_searchbtn.next:after {\n content: "";\n border: solid 2px #888;\n width: 0.5em;\n height: 0.5em;\n border-width: 2px 0 0 2px;\n display:inline-block;\n transform: rotate(-45deg);\n}\n.ace_searchbtn.next:after {\n border-width: 0 2px 2px 0 ;\n}\n.ace_searchbtn_close {\n background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;\n border-radius: 50%;\n border: 0 none;\n color: #656565;\n cursor: pointer;\n font: 16px/16px Arial;\n padding: 0;\n height: 14px;\n width: 14px;\n top: 9px;\n right: 7px;\n position: absolute;\n}\n.ace_searchbtn_close:hover {\n background-color: #656565;\n background-position: 50% 100%;\n color: white;\n}\n\n.ace_button {\n margin-left: 2px;\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n -o-user-select: none;\n -ms-user-select: none;\n user-select: none;\n overflow: hidden;\n opacity: 0.7;\n border: 1px solid rgba(100,100,100,0.23);\n padding: 1px;\n box-sizing: border-box!important;\n color: black;\n}\n\n.ace_button:hover {\n background-color: #eee;\n opacity:1;\n}\n.ace_button:active {\n background-color: #ddd;\n}\n\n.ace_button.checked {\n border-color: #3399ff;\n opacity:1;\n}\n\n.ace_search_options{\n margin-bottom: 3px;\n text-align: right;\n -webkit-user-select: none;\n -moz-user-select: none;\n -o-user-select: none;\n -ms-user-select: none;\n user-select: none;\n clear: both;\n}\n\n.ace_search_counter {\n float: left;\n font-family: arial;\n padding: 0 8px;\n}'; +}); +ace.define("ace/ext/searchbox", [ + "require", + "exports", + "module", + "ace/lib/dom", + "ace/lib/lang", + "ace/lib/event", + "ace/ext/searchbox.css", + "ace/keyboard/hash_handler", + "ace/lib/keys" +], function(require, exports, module1) { + "use strict"; + var dom = require("../lib/dom"); + var lang = require("../lib/lang"); + var event = require("../lib/event"); + var searchboxCss = require("./searchbox.css"); + var HashHandler = require("../keyboard/hash_handler").HashHandler; + var keyUtil = require("../lib/keys"); + var MAX_COUNT = 999; + dom.importCssString(searchboxCss, "ace_searchbox", false); + var SearchBox = function(editor, range, showReplaceForm) { + var div = dom.createElement("div"); + dom.buildDom([ + "div", + { + class: "ace_search right" + }, + [ + "span", + { + action: "hide", + class: "ace_searchbtn_close" + } + ], + [ + "div", + { + class: "ace_search_form" + }, + [ + "input", + { + class: "ace_search_field", + placeholder: "Search for", + spellcheck: "false" + } + ], + [ + "span", + { + action: "findPrev", + class: "ace_searchbtn prev" + }, + "​" + ], + [ + "span", + { + action: "findNext", + class: "ace_searchbtn next" + }, + "​" + ], + [ + "span", + { + action: "findAll", + class: "ace_searchbtn", + title: "Alt-Enter" + }, + "All" + ] + ], + [ + "div", + { + class: "ace_replace_form" + }, + [ + "input", + { + class: "ace_search_field", + placeholder: "Replace with", + spellcheck: "false" + } + ], + [ + "span", + { + action: "replaceAndFindNext", + class: "ace_searchbtn" + }, + "Replace" + ], + [ + "span", + { + action: "replaceAll", + class: "ace_searchbtn" + }, + "All" + ] + ], + [ + "div", + { + class: "ace_search_options" + }, + [ + "span", + { + action: "toggleReplace", + class: "ace_button", + title: "Toggle Replace mode", + style: "float:left;margin-top:-2px;padding:0 5px;" + }, + "+" + ], + [ + "span", + { + class: "ace_search_counter" + } + ], + [ + "span", + { + action: "toggleRegexpMode", + class: "ace_button", + title: "RegExp Search" + }, + ".*" + ], + [ + "span", + { + action: "toggleCaseSensitive", + class: "ace_button", + title: "CaseSensitive Search" + }, + "Aa" + ], + [ + "span", + { + action: "toggleWholeWords", + class: "ace_button", + title: "Whole Word Search" + }, + "\\b" + ], + [ + "span", + { + action: "searchInSelection", + class: "ace_button", + title: "Search In Selection" + }, + "S" + ] + ] + ], div); + this.element = div.firstChild; + this.setSession = this.setSession.bind(this); + this.$init(); + this.setEditor(editor); + dom.importCssString(searchboxCss, "ace_searchbox", editor.container); + }; + (function() { + this.setEditor = function(editor) { + editor.searchBox = this; + editor.renderer.scroller.appendChild(this.element); + this.editor = editor; + }; + this.setSession = function(e) { + this.searchRange = null; + this.$syncOptions(true); + }; + this.$initElements = function(sb) { + this.searchBox = sb.querySelector(".ace_search_form"); + this.replaceBox = sb.querySelector(".ace_replace_form"); + this.searchOption = sb.querySelector("[action=searchInSelection]"); + this.replaceOption = sb.querySelector("[action=toggleReplace]"); + this.regExpOption = sb.querySelector("[action=toggleRegexpMode]"); + this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]"); + this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]"); + this.searchInput = this.searchBox.querySelector(".ace_search_field"); + this.replaceInput = this.replaceBox.querySelector(".ace_search_field"); + this.searchCounter = sb.querySelector(".ace_search_counter"); + }; + this.$init = function() { + var sb = this.element; + this.$initElements(sb); + var _this = this; + event.addListener(sb, "mousedown", function(e) { + setTimeout(function() { + _this.activeInput.focus(); + }, 0); + event.stopPropagation(e); + }); + event.addListener(sb, "click", function(e) { + var t = e.target || e.srcElement; + var action = t.getAttribute("action"); + if (action && _this[action]) _this[action](); + else if (_this.$searchBarKb.commands[action]) _this.$searchBarKb.commands[action].exec(_this); + event.stopPropagation(e); + }); + event.addCommandKeyListener(sb, function(e, hashId, keyCode) { + var keyString = keyUtil.keyCodeToString(keyCode); + var command = _this.$searchBarKb.findKeyCommand(hashId, keyString); + if (command && command.exec) { + command.exec(_this); + event.stopEvent(e); + } + }); + this.$onChange = lang.delayedCall(function() { + _this.find(false, false); + }); + event.addListener(this.searchInput, "input", function() { + _this.$onChange.schedule(20); + }); + event.addListener(this.searchInput, "focus", function() { + _this.activeInput = _this.searchInput; + _this.searchInput.value && _this.highlight(); + }); + event.addListener(this.replaceInput, "focus", function() { + _this.activeInput = _this.replaceInput; + _this.searchInput.value && _this.highlight(); + }); + }; + this.$closeSearchBarKb = new HashHandler([ + { + bindKey: "Esc", + name: "closeSearchBar", + exec: function(editor) { + editor.searchBox.hide(); + } + } + ]); + this.$searchBarKb = new HashHandler(); + this.$searchBarKb.bindKeys({ + "Ctrl-f|Command-f": function(sb) { + var isReplace = sb.isReplace = !sb.isReplace; + sb.replaceBox.style.display = isReplace ? "" : "none"; + sb.replaceOption.checked = false; + sb.$syncOptions(); + sb.searchInput.focus(); + }, + "Ctrl-H|Command-Option-F": function(sb) { + if (sb.editor.getReadOnly()) return; + sb.replaceOption.checked = true; + sb.$syncOptions(); + sb.replaceInput.focus(); + }, + "Ctrl-G|Command-G": function(sb) { + sb.findNext(); + }, + "Ctrl-Shift-G|Command-Shift-G": function(sb) { + sb.findPrev(); + }, + "esc": function(sb) { + setTimeout(function() { + sb.hide(); + }); + }, + "Return": function(sb) { + if (sb.activeInput == sb.replaceInput) sb.replace(); + sb.findNext(); + }, + "Shift-Return": function(sb) { + if (sb.activeInput == sb.replaceInput) sb.replace(); + sb.findPrev(); + }, + "Alt-Return": function(sb) { + if (sb.activeInput == sb.replaceInput) sb.replaceAll(); + sb.findAll(); + }, + "Tab": function(sb) { + (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus(); + } + }); + this.$searchBarKb.addCommands([ + { + name: "toggleRegexpMode", + bindKey: { + win: "Alt-R|Alt-/", + mac: "Ctrl-Alt-R|Ctrl-Alt-/" + }, + exec: function(sb) { + sb.regExpOption.checked = !sb.regExpOption.checked; + sb.$syncOptions(); + } + }, + { + name: "toggleCaseSensitive", + bindKey: { + win: "Alt-C|Alt-I", + mac: "Ctrl-Alt-R|Ctrl-Alt-I" + }, + exec: function(sb) { + sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked; + sb.$syncOptions(); + } + }, + { + name: "toggleWholeWords", + bindKey: { + win: "Alt-B|Alt-W", + mac: "Ctrl-Alt-B|Ctrl-Alt-W" + }, + exec: function(sb) { + sb.wholeWordOption.checked = !sb.wholeWordOption.checked; + sb.$syncOptions(); + } + }, + { + name: "toggleReplace", + exec: function(sb) { + sb.replaceOption.checked = !sb.replaceOption.checked; + sb.$syncOptions(); + } + }, + { + name: "searchInSelection", + exec: function(sb) { + sb.searchOption.checked = !sb.searchRange; + sb.setSearchRange(sb.searchOption.checked && sb.editor.getSelectionRange()); + sb.$syncOptions(); + } + } + ]); + this.setSearchRange = function(range) { + this.searchRange = range; + if (range) this.searchRangeMarker = this.editor.session.addMarker(range, "ace_active-line"); + else if (this.searchRangeMarker) { + this.editor.session.removeMarker(this.searchRangeMarker); + this.searchRangeMarker = null; + } + }; + this.$syncOptions = function(preventScroll) { + dom.setCssClass(this.replaceOption, "checked", this.searchRange); + dom.setCssClass(this.searchOption, "checked", this.searchOption.checked); + this.replaceOption.textContent = this.replaceOption.checked ? "-" : "+"; + dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked); + dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked); + dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked); + var readOnly = this.editor.getReadOnly(); + this.replaceOption.style.display = readOnly ? "none" : ""; + this.replaceBox.style.display = this.replaceOption.checked && !readOnly ? "" : "none"; + this.find(false, false, preventScroll); + }; + this.highlight = function(re) { + this.editor.session.highlight(re || this.editor.$search.$options.re); + this.editor.renderer.updateBackMarkers(); + }; + this.find = function(skipCurrent, backwards, preventScroll) { + var range = this.editor.find(this.searchInput.value, { + skipCurrent: skipCurrent, + backwards: backwards, + wrap: true, + regExp: this.regExpOption.checked, + caseSensitive: this.caseSensitiveOption.checked, + wholeWord: this.wholeWordOption.checked, + preventScroll: preventScroll, + range: this.searchRange + }); + var noMatch = !range && this.searchInput.value; + dom.setCssClass(this.searchBox, "ace_nomatch", noMatch); + this.editor._emit("findSearchBox", { + match: !noMatch + }); + this.highlight(); + this.updateCounter(); + }; + this.updateCounter = function() { + var editor = this.editor; + var regex = editor.$search.$options.re; + var all = 0; + var before = 0; + if (regex) { + var value = this.searchRange ? editor.session.getTextRange(this.searchRange) : editor.getValue(); + var offset = editor.session.doc.positionToIndex(editor.selection.anchor); + if (this.searchRange) offset -= editor.session.doc.positionToIndex(this.searchRange.start); + var last = regex.lastIndex = 0; + var m; + while(m = regex.exec(value)){ + all++; + last = m.index; + if (last <= offset) before++; + if (all > MAX_COUNT) break; + if (!m[0]) { + regex.lastIndex = last += 1; + if (last >= value.length) break; + } + } + } + this.searchCounter.textContent = before + " of " + (all > MAX_COUNT ? MAX_COUNT + "+" : all); + }; + this.findNext = function() { + this.find(true, false); + }; + this.findPrev = function() { + this.find(true, true); + }; + this.findAll = function() { + var range = this.editor.findAll(this.searchInput.value, { + regExp: this.regExpOption.checked, + caseSensitive: this.caseSensitiveOption.checked, + wholeWord: this.wholeWordOption.checked + }); + var noMatch = !range && this.searchInput.value; + dom.setCssClass(this.searchBox, "ace_nomatch", noMatch); + this.editor._emit("findSearchBox", { + match: !noMatch + }); + this.highlight(); + this.hide(); + }; + this.replace = function() { + if (!this.editor.getReadOnly()) this.editor.replace(this.replaceInput.value); + }; + this.replaceAndFindNext = function() { + if (!this.editor.getReadOnly()) { + this.editor.replace(this.replaceInput.value); + this.findNext(); + } + }; + this.replaceAll = function() { + if (!this.editor.getReadOnly()) this.editor.replaceAll(this.replaceInput.value); + }; + this.hide = function() { + this.active = false; + this.setSearchRange(null); + this.editor.off("changeSession", this.setSession); + this.element.style.display = "none"; + this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb); + this.editor.focus(); + }; + this.show = function(value, isReplace) { + this.active = true; + this.editor.on("changeSession", this.setSession); + this.element.style.display = ""; + this.replaceOption.checked = isReplace; + if (value) this.searchInput.value = value; + this.searchInput.focus(); + this.searchInput.select(); + this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb); + this.$syncOptions(true); + }; + this.isFocused = function() { + var el = document.activeElement; + return el == this.searchInput || el == this.replaceInput; + }; + }).call(SearchBox.prototype); + exports.SearchBox = SearchBox; + exports.Search = function(editor, isReplace) { + var sb = editor.searchBox || new SearchBox(editor); + sb.show(editor.session.getTextRange(), isReplace); + }; +}); +(function() { + ace.require([ + "ace/ext/searchbox" + ], function(m) { + if (module) module.exports = m; + }); +})(); + +},{}],"ad2mI":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _modeText = require("ace-builds/src-noconflict/mode-text"); +var _highlightRulesJs = require("./HighlightRules.js"); +var _highlightRulesJsDefault = parcelHelpers.interopDefault(_highlightRulesJs); +class AssemblyMode extends window.ace.acequire("ace/mode/text").Mode { + constructor(){ + super(); + // uses by TextMode to implement toggleCommentLines() to comment or un-comment selected lines + this.lineCommentStart = [ + "//", + "#" + ]; + this.HighlightRules = (0, _highlightRulesJsDefault.default); + this.$id = "assembly_i40xx"; + } +} +exports.default = AssemblyMode; + +},{"ace-builds/src-noconflict/mode-text":"gEs8d","./HighlightRules.js":"6oYDi","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"gEs8d":[function(require,module,exports) { +(function() { + ace.require([ + "ace/mode/text" + ], function(m) { + if (module) module.exports = m; + }); +})(); + +},{}],"6oYDi":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +const INTEL_40XX_INSTRUCTIONS = [ + "nop", + "rdm", + "rd0", + "rd1", + "rd2", + "rd3", + "rdr", + "wrm", + "wr0", + "wr1", + "wr2", + "wr3", + "wrr", + "wmp", + "adm", + "sbm", + "clb", + "clc", + "cmc", + "stc", + "cma", + "iac", + "dac", + "ral", + "rar", + "tcc", + "daa", + "tcs", + "kbp", + "dcl", + "ldm", + "ld", + "xch", + "add", + "sub", + "inc", + "bbl", + "jin", + "src", + "fin", + "jun", + "jms", + "jcn", + "isz", + "fim", + "wpm", + "hlt", + "bbs", + "lcr", + "or4", + "or5", + "an6", + "an7", + "db0", + "db1", + "sb0", + "sb1", + "ein", + "din", + "rpm" +]; +class HighlightRules extends window.ace.acequire("ace/mode/text_highlight_rules").TextHighlightRules { + constructor(){ + super(); + this.$rules = { + start: [ + { + regex: "(?://|#).*$", + token: "comment" + }, + { + regex: "^\\w+:", + token: "entity.name.function" + }, + { + caseInsensitive: true, + regex: `\\b(?:${INTEL_40XX_INSTRUCTIONS.join("|")})\\b`, + token: "keyword.control" + }, + { + caseInsensitive: true, + regex: "\\b(?:r\\d|rr\\d{1,2}|n?(?:z|c|t|zc|zt|ct|zct))\\b", + token: "variable" + }, + { + regex: "\\b[0-9]+\\b", + token: "constant.character.decimal" + }, + { + caseInsensitive: true, + regex: "\\b0x[A-F0-9]+\\b", + token: "constant.character.hexadecimal" + } + ] + }; + this.normalizeRules(); + } +} +exports.default = HighlightRules; + +},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"gkKU3":[function(require,module,exports) { +exports.interopDefault = function(a) { + return a && a.__esModule ? a : { + default: a + }; +}; +exports.defineInteropFlag = function(a) { + Object.defineProperty(a, "__esModule", { + value: true + }); +}; +exports.exportAll = function(source, dest) { + Object.keys(source).forEach(function(key) { + if (key === "default" || key === "__esModule" || dest.hasOwnProperty(key)) return; + Object.defineProperty(dest, key, { + enumerable: true, + get: function() { + return source[key]; + } + }); + }); + return dest; +}; +exports.export = function(dest, destName, get) { + Object.defineProperty(dest, destName, { + enumerable: true, + get: get + }); +}; + +},{}],"vVMay":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +exports.default = ` NOP + LDM 2 + DCL // select bank #2 + FIM r1, 0x53 + SRC r1 // select register #5, character #3 + LDM 6 + WRM // write 6 to selected RAM main character + LDM 7 + WR2 // write 7 to selected RAM register and status character #2 + FIM r2, 0x42 + SRC r2 // select register #4, character #2 + LDM 0xA + WRM // write 0xA to selected RAM main character + LDM 2 + SRC r1 // select register #5, character #3 + ADM // expect 6 + 2 = 8 to be at accumulator + XCH rr8 + SRC r2 // select register #4, character #2 + RDM // read 0xA to accumulator + // expected state: + // ACC = 0xA + // rr2 = 0x5 + // rr3 = 0x3 + // rr4 = 0x4 + // rr5 = 0x2 + // rr8 = 0x8 + // [reg#5, main#3] = 0x6 + // [reg#5, status#2] = 0x7 + // [reg#4, main#2] = 0xA +`; + +},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"aWnfx":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _emulatorStoreJs = require("../stores/emulatorStore.js"); +var _emulatorStoreJsDefault = parcelHelpers.interopDefault(_emulatorStoreJs); +var _compilerStoreJs = require("../stores/compilerStore.js"); +var _compilerStoreJsDefault = parcelHelpers.interopDefault(_compilerStoreJs); +var _editorStoreJs = require("../stores/editorStore.js"); +var _editorStoreJsDefault = parcelHelpers.interopDefault(_editorStoreJs); +const worker = new Worker(require("9f9a9ef1116e0888")); +worker.onmessage = ({ data: { command , error , ...rest } })=>{ + if (error) { + (0, _emulatorStoreJsDefault.default).update((state)=>{ + state.error = error; + state.isRunning = false; + }); + return; + } + switch(command){ + case "finish": + (0, _emulatorStoreJsDefault.default).update((state)=>{ + state.isRunning = false; + }); + break; + case "IOOutput": + (0, _emulatorStoreJsDefault.default).update((state)=>{ + state.IOLog.push({ + address: rest.address, + data: rest.data, + type: rest.type + }); + }); + break; + case "state": + (0, _emulatorStoreJsDefault.default).update((state)=>{ + state.ram = rest.ram; + state.registers = rest.registers; + state.selectedRamBank = rest.selectedRamBank; + }); + break; + default: + break; + } +}; +const convertBreakpointsFromLineToOffset = (lineBreakpoints)=>{ + const { romOffsetBySourceCodePerBank } = (0, _compilerStoreJsDefault.default).getRawState(); + const emulatorBreakpoints = new Set(); + for (const line of lineBreakpoints){ + for (const [bankNo, romOffsetBySourceCodeMap] of romOffsetBySourceCodePerBank.entries())if (romOffsetBySourceCodeMap.has(line)) emulatorBreakpoints.add(`${bankNo}:${romOffsetBySourceCodeMap.get(line)}`); + } + return emulatorBreakpoints; +}; +(0, _editorStoreJsDefault.default).subscribe((state)=>state.breakpoints, (breakpoints)=>{ + worker.postMessage({ + breakpoints: convertBreakpointsFromLineToOffset(breakpoints), + command: "breakpoints" + }); +}); +const run = (romDump, mode = "run")=>{ + (0, _emulatorStoreJsDefault.default).update((state)=>{ + state.isRunning = true; + state.runningMode = mode; + state.error = ""; + state.IOLog = []; + }); + worker.postMessage({ + breakpoints: convertBreakpointsFromLineToOffset((0, _editorStoreJsDefault.default).getRawState().breakpoints), + command: "run", + mode, + ramDump: (0, _emulatorStoreJsDefault.default).getRawState().initialRam, + romDump + }); +}; +const stop = ()=>{ + worker.postMessage({ + command: "stop" + }); +}; +const stepInto = ()=>{ + worker.postMessage({ + command: "stepInto" + }); +}; +const stepOver = ()=>{ + worker.postMessage({ + command: "stepOver" + }); +}; +const continueExec = ()=>{ + worker.postMessage({ + command: "continue" + }); +}; +exports.default = { + continueExec, + run, + stepInto, + stepOver, + stop +}; + +},{"../stores/emulatorStore.js":"6XWYU","../stores/compilerStore.js":"cJTIf","../stores/editorStore.js":"egduw","9f9a9ef1116e0888":"efckl","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"6XWYU":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _pullstate = require("pullstate"); +exports.default = new (0, _pullstate.Store)({ + error: "", + initialRam: null, + IOLog: [], + isRunning: false, + ram: [], + registers: {}, + runningMode: null, + selectedRamBank: null +}); + +},{"pullstate":"kvXHz","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"kvXHz":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +parcelHelpers.export(exports, "EAsyncActionInjectType", ()=>EAsyncActionInjectType); +parcelHelpers.export(exports, "EAsyncEndTags", ()=>EAsyncEndTags); +parcelHelpers.export(exports, "EPostActionContext", ()=>EPostActionContext); +parcelHelpers.export(exports, "InjectAsyncAction", ()=>InjectAsyncAction); +parcelHelpers.export(exports, "InjectStoreState", ()=>InjectStoreState); +parcelHelpers.export(exports, "PullstateContext", ()=>PullstateContext); +parcelHelpers.export(exports, "PullstateProvider", ()=>PullstateProvider); +parcelHelpers.export(exports, "Store", ()=>Store); +parcelHelpers.export(exports, "batch", ()=>batch); +parcelHelpers.export(exports, "createAsyncAction", ()=>createAsyncAction); +parcelHelpers.export(exports, "createAsyncActionDirect", ()=>createAsyncActionDirect); +parcelHelpers.export(exports, "createPullstateCore", ()=>createPullstateCore); +parcelHelpers.export(exports, "errorResult", ()=>errorResult); +parcelHelpers.export(exports, "registerInDevtools", ()=>registerInDevtools); +parcelHelpers.export(exports, "setupBatch", ()=>setupBatch); +parcelHelpers.export(exports, "successResult", ()=>successResult); +parcelHelpers.export(exports, "update", ()=>update); +parcelHelpers.export(exports, "useInstance", ()=>useInstance); +parcelHelpers.export(exports, "useLocalStore", ()=>useLocalStore); +parcelHelpers.export(exports, "useStoreState", ()=>useStoreState); +parcelHelpers.export(exports, "useStores", ()=>useStores); +var _es6 = require("fast-deep-equal/es6"); +var _es6Default = parcelHelpers.interopDefault(_es6); +var _react = require("react"); +var _reactDefault = parcelHelpers.interopDefault(_react); +var _immer = require("immer"); +var _immerDefault = parcelHelpers.interopDefault(_immer); +function useStoreState(store, getSubState, deps) { + const updateRef = (0, _react.useRef)({ + state: undefined, + initialized: false + }); + if (!updateRef.current.initialized) { + updateRef.current.state = getSubState ? getSubState(store.getRawState()) : store.getRawState(); + updateRef.current.initialized = true; + } + const [, setUpdateTrigger] = (0, _react.useState)(0); + (0, _react.useEffect)(()=>{ + const effectState = { + shouldUpdate: true + }; + function update() { + if (effectState.shouldUpdate) { + const nextSubState = getSubState ? getSubState(store.getRawState()) : store.getRawState(); + if (!(0, _es6Default.default)(updateRef.current.state, nextSubState)) { + if (effectState.shouldUpdate) { + updateRef.current.state = nextSubState; + setUpdateTrigger((val)=>val + 1); + } + } + } + } + store._addUpdateListener(update); + update(); + return ()=>{ + effectState.shouldUpdate = false; + store._removeUpdateListener(update); + }; + }, deps !== null && deps !== void 0 ? deps : []); + if (deps !== undefined) { + const prevDeps = (0, _react.useRef)(deps); + if (!(0, _es6Default.default)(deps, prevDeps)) updateRef.current.state = getSubState(store.getRawState()); + } + return updateRef.current.state; +} +function useLocalStore(initialState, deps) { + const storeRef = (0, _react.useRef)(); + if (storeRef.current == null) storeRef.current = new Store(initialState); + if (deps !== undefined) { + const prevDeps = (0, _react.useRef)(deps); + if (!(0, _es6Default.default)(deps, prevDeps)) storeRef.current = new Store(initialState); + } + return storeRef.current; +} +const globalClientState = { + storeOrdinal: 0, + batching: false, + flushStores: {} +}; +(0, _immer.enablePatches)(); +function makeSubscriptionFunction(store, watch, listener) { + let lastWatchState = watch(store.getRawState()); + return ()=>{ + const currentState = store.getRawState(); + const nextWatchState = watch(currentState); + if (!(0, _es6Default.default)(nextWatchState, lastWatchState)) { + listener(nextWatchState, currentState, lastWatchState); + lastWatchState = nextWatchState; + } + }; +} +function makeReactionFunctionCreator(watch, reaction) { + return (store)=>{ + let lastWatchState = watch(store.getRawState()); + return (forceRun = false)=>{ + const currentState = store.getRawState(); + const nextWatchState = watch(currentState); + if (forceRun || !(0, _es6Default.default)(nextWatchState, lastWatchState)) { + if (store._optListenerCount > 0) { + const [nextState, patches, inversePatches] = (0, _immer.produceWithPatches)(currentState, (s)=>reaction(nextWatchState, s, currentState, lastWatchState)); + store._updateStateWithoutReaction(nextState); + lastWatchState = nextWatchState; + if (patches.length > 0) { + store._patchListeners.forEach((listener)=>listener(patches, inversePatches)); + return Object.keys(getChangedPathsFromPatches(patches)); + } + } else { + if (store._patchListeners.length > 0) { + const [nextState1, patches1, inversePatches1] = (0, _immer.produceWithPatches)(currentState, (s)=>reaction(nextWatchState, s, currentState, lastWatchState)); + if (patches1.length > 0) store._patchListeners.forEach((listener)=>listener(patches1, inversePatches1)); + store._updateStateWithoutReaction(nextState1); + } else store._updateStateWithoutReaction((0, _immer.produce)(currentState, (s)=>reaction(nextWatchState, s, currentState, lastWatchState))); + lastWatchState = nextWatchState; + } + } + return []; + }; + }; +} +const optPathDivider = "~._.~"; +class Store { + constructor(initialState){ + this.updateListeners = []; + this.ssr = false; + this.reactions = []; + this.clientSubscriptions = []; + this.reactionCreators = []; + this.optimizedUpdateListeners = {}; + this.optimizedUpdateListenerPaths = {}; + this.optimizedListenerPropertyMap = {}; + this._optListenerCount = 0; + this._patchListeners = []; + if (initialState instanceof Function) { + const state = initialState(); + this.currentState = state; + this.initialState = state; + this.createInitialState = initialState; + } else { + this.currentState = initialState; + this.initialState = initialState; + this.createInitialState = ()=>initialState; + } + this.internalOrdId = globalClientState.storeOrdinal++; + } + _setInternalOptions({ ssr , reactionCreators =[] }) { + this.ssr = ssr; + this.reactionCreators = reactionCreators; + this.reactions = reactionCreators.map((rc)=>rc(this)); + } + _getReactionCreators() { + return this.reactionCreators; + } + _instantiateReactions() { + this.reactions = this.reactionCreators.map((rc)=>rc(this)); + } + _getInitialState() { + return this.createInitialState(); + } + _updateStateWithoutReaction(nextState) { + this.currentState = nextState; + } + _updateState(nextState, updateKeyedPaths = []) { + this.currentState = nextState; + this.batchState = undefined; + for (const runReaction of this.reactions)updateKeyedPaths.push(...runReaction()); + if (!this.ssr) { + for (const runSubscription of this.clientSubscriptions)runSubscription(); + if (updateKeyedPaths.length > 0) { + const updateOrds = new Set(); + for (const keyedPath of updateKeyedPaths){ + if (this.optimizedListenerPropertyMap[keyedPath]) for (const ord of this.optimizedListenerPropertyMap[keyedPath])updateOrds.add(ord); + } + for (const ord1 of updateOrds.values())if (this.optimizedUpdateListeners[ord1]) this.optimizedUpdateListeners[ord1](); + } + this.updateListeners.forEach((listener)=>listener()); + } + } + _addUpdateListener(listener) { + this.updateListeners.push(listener); + } + _removeUpdateListener(listener) { + this.updateListeners = this.updateListeners.filter((f)=>f !== listener); + } + _removeUpdateListenerOpt(ordKey) { + const listenerPathsKeyed = this.optimizedUpdateListenerPaths[ordKey]; + for (const keyedPath of listenerPathsKeyed)this.optimizedListenerPropertyMap[keyedPath] = this.optimizedListenerPropertyMap[keyedPath].filter((ord)=>ord !== ordKey); + delete this.optimizedUpdateListenerPaths[ordKey]; + delete this.optimizedUpdateListeners[ordKey]; + this._optListenerCount--; + } + listenToPatches(patchListener) { + this._patchListeners.push(patchListener); + return ()=>{ + this._patchListeners = this._patchListeners.filter((f)=>f !== patchListener); + }; + } + subscribe(watch, listener) { + if (!this.ssr) { + const func = makeSubscriptionFunction(this, watch, listener); + this.clientSubscriptions.push(func); + return ()=>{ + this.clientSubscriptions = this.clientSubscriptions.filter((f)=>f !== func); + }; + } + return ()=>{ + console.warn(`Pullstate: Subscriptions made on the server side are not registered - so therefor this call to unsubscribe does nothing.`); + }; + } + createReaction(watch, reaction, { runNow =false , runNowWithSideEffects =false } = {}) { + const creator = makeReactionFunctionCreator(watch, reaction); + this.reactionCreators.push(creator); + const func = creator(this); + this.reactions.push(func); + if (runNow || runNowWithSideEffects) { + func(true); + if (runNowWithSideEffects && !this.ssr) this._updateState(this.currentState); + } + return ()=>{ + this.reactions = this.reactions.filter((f)=>f !== func); + }; + } + getRawState() { + if (this.batchState !== undefined) return this.batchState; + else return this.currentState; + } + useState(getSubState, deps) { + return useStoreState(this, getSubState, deps); + } + useLocalCopyInitial(deps) { + return useLocalStore(this.createInitialState, deps); + } + useLocalCopySnapshot(deps) { + return useLocalStore(this.currentState, deps); + } + flushBatch(ignoreError = false) { + if (this.batchState !== undefined) { + if (this.batchState !== this.currentState) this._updateState(this.batchState); + } else if (!ignoreError) console.error(`Pullstate: Trying to flush batch state which was never created or updated on`); + this.batchState = undefined; + } + update(updater, patchesCallback) { + if (globalClientState.batching) { + if (this.batchState === undefined) { + this.batchState = this.currentState; + globalClientState.flushStores[this.internalOrdId] = this; + } + const func = typeof updater === "function"; + const [nextState, patches, inversePatches] = runUpdates(this.batchState, updater, func); + if (patches.length > 0 && (this._patchListeners.length > 0 || patchesCallback)) { + if (patchesCallback) patchesCallback(patches, inversePatches); + this._patchListeners.forEach((listener)=>listener(patches, inversePatches)); + } + this.batchState = nextState; + } else { + this.batchState = undefined; + update(this, updater, patchesCallback); + } + } + replace(newState) { + this._updateState(newState); + } + replaceFromCurrent(replacer) { + this._updateState(replacer(this.currentState)); + } + applyPatches(patches) { + applyPatchesToStore(this, patches); + } +} +function applyPatchesToStore(store, patches) { + const currentState = store.getRawState(); + const nextState = (0, _immer.applyPatches)(currentState, patches); + if (nextState !== currentState) store._updateState(nextState, Object.keys(getChangedPathsFromPatches(patches))); +} +function getChangedPathsFromPatches(changePatches, prev = {}) { + for (const patch of changePatches){ + let curKey; + for (const p of patch.path){ + if (curKey) curKey = `${curKey}${optPathDivider}${p}`; + else curKey = p; + prev[curKey] = 1; + } + } + return prev; +} +function runUpdates(currentState, updater, func) { + return func ? (0, _immer.produceWithPatches)(currentState, (s)=>updater(s, currentState)) : updater.reduce(([nextState, patches, inversePatches], currentValue)=>{ + const resp = (0, _immer.produceWithPatches)(nextState, (s)=>currentValue(s, nextState)); + patches.push(...resp[1]); + inversePatches.push(...resp[2]); + return [ + resp[0], + patches, + inversePatches + ]; + }, [ + currentState, + [], + [] + ]); +} +function update(store, updater, patchesCallback) { + const currentState = store.getRawState(); + const func = typeof updater === "function"; + if (store._optListenerCount > 0) { + const [nextState, patches, inversePatches] = runUpdates(currentState, updater, func); + if (patches.length > 0) { + if (patchesCallback) patchesCallback(patches, inversePatches); + store._patchListeners.forEach((listener)=>listener(patches, inversePatches)); + store._updateState(nextState, Object.keys(getChangedPathsFromPatches(patches))); + } + } else { + let nextState1; + if (store._patchListeners.length > 0 || patchesCallback) { + const [ns, patches1, inversePatches1] = runUpdates(currentState, updater, func); + if (patches1.length > 0) { + if (patchesCallback) patchesCallback(patches1, inversePatches1); + store._patchListeners.forEach((listener)=>listener(patches1, inversePatches1)); + } + nextState1 = ns; + } else nextState1 = (0, _immer.produce)(currentState, (s)=>func ? updater(s, currentState) : updater.reduce((previousValue, currentUpdater)=>{ + return (0, _immer.produce)(previousValue, (s)=>currentUpdater(s, previousValue)); + }, currentState)); + if (nextState1 !== currentState) store._updateState(nextState1); + } +} +function InjectStoreState({ store , on =(s)=>s , children }) { + const state = useStoreState(store, on); + return children(state); +} +var EAsyncEndTags; +(function(EAsyncEndTags) { + EAsyncEndTags["THREW_ERROR"] = "THREW_ERROR"; + EAsyncEndTags["RETURNED_ERROR"] = "RETURNED_ERROR"; + EAsyncEndTags["UNFINISHED"] = "UNFINISHED"; + EAsyncEndTags["DORMANT"] = "DORMANT"; +})(EAsyncEndTags || (EAsyncEndTags = {})); +var EPostActionContext; +(function(EPostActionContext) { + EPostActionContext["WATCH_HIT_CACHE"] = "WATCH_HIT_CACHE"; + EPostActionContext["BECKON_HIT_CACHE"] = "BECKON_HIT_CACHE"; + EPostActionContext["RUN_HIT_CACHE"] = "RUN_HIT_CACHE"; + EPostActionContext["READ_HIT_CACHE"] = "READ_HIT_CACHE"; + EPostActionContext["READ_RUN"] = "READ_RUN"; + EPostActionContext["SHORT_CIRCUIT"] = "SHORT_CIRCUIT"; + EPostActionContext["DIRECT_RUN"] = "DIRECT_RUN"; + EPostActionContext["BECKON_RUN"] = "BECKON_RUN"; + EPostActionContext["CACHE_UPDATE"] = "CACHE_UPDATE"; +})(EPostActionContext || (EPostActionContext = {})); +const clientAsyncCache = { + listeners: {}, + results: {}, + actions: {}, + actionOrd: {} +}; +let asyncCreationOrdinal = 0; +function keyFromObject(json) { + if (json === null) return "(n)"; + const typeOf = typeof json; + if (typeOf !== "object") { + if (typeOf === "undefined") return "(u)"; + else if (typeOf === "string") return ":" + json + ";"; + else if (typeOf === "boolean" || typeOf === "number") return "(" + json + ")"; + } + let prefix = "{"; + for (const key of Object.keys(json).sort())prefix += key + keyFromObject(json[key]); + return prefix + "}"; +} +function notifyListeners(key) { + if (clientAsyncCache.listeners.hasOwnProperty(key)) for (const watchId of Object.keys(clientAsyncCache.listeners[key]))clientAsyncCache.listeners[key][watchId](); +} +function clearActionCache(key, clearPending = true, notify = true) { + if (clearPending && clientAsyncCache.actionOrd.hasOwnProperty(key)) clientAsyncCache.actionOrd[key] += 1; + delete clientAsyncCache.results[key]; + if (notify) notifyListeners(key); +} +function actionOrdUpdate(cache, key) { + if (!cache.actionOrd.hasOwnProperty(key)) cache.actionOrd[key] = 0; + else cache.actionOrd[key] += 1; + return cache.actionOrd[key]; +} +function successResult(payload = null, tags = [], message = "") { + return { + payload, + tags, + message, + error: false, + errorPayload: null + }; +} +function errorResult(tags = [], message = "", errorPayload) { + return { + payload: null, + tags: [ + EAsyncEndTags.RETURNED_ERROR, + ...tags + ], + message, + error: true, + errorPayload: errorPayload + }; +} +class PullstateAsyncError extends Error { + constructor(message, tags){ + super(message); + this.tags = tags; + } +} +let storeErrorProxy; +try { + storeErrorProxy = new Proxy({}, { + get: function(obj, prop) { + throw new Error(`Pullstate: Trying to access store (${String(prop)}) inside async actions without the correct usage or setup. +If this error occurred on the server: +* If using run(), make use of your created instance for this request: instance.runAsyncAction() +* If using read(), useWatch(), useBeckon() etc. - make sure you have properly set up your + +If this error occurred on the client: +* Make sure you have created your "pullstateCore" object with all your stores, using createPullstateCore(), and are making use of instantiate() before rendering.`); + } + }); +} catch { + storeErrorProxy = {}; +} +const startedButUnfinishedResult = [ + true, + false, + { + message: "", + tags: [ + EAsyncEndTags.UNFINISHED + ], + error: true, + payload: null, + errorPayload: null + }, + false, + -1 +]; +function createAsyncActionDirect(action, options = {}) { + return createAsyncAction(async (args, stores, customContext)=>{ + return successResult(await action(args, stores, customContext)); + }, options); +} +function convertCustomCacheBreakHook(cacheBreakHook) { + if (cacheBreakHook != null) { + if (typeof cacheBreakHook === "boolean") return ()=>cacheBreakHook; + else if (typeof cacheBreakHook === "number") return ({ timeCached , result })=>{ + if (!result.error) return Date.now() - timeCached > cacheBreakHook; + return true; + }; + return cacheBreakHook; + } + return undefined; +} +function createAsyncAction(action, { forceContext =false , shortCircuitHook , cacheBreakHook , postActionHook , subsetKey , actionId } = {}) { + const ordinal = actionId != null ? `_${actionId}` : asyncCreationOrdinal++; + const onServer = typeof window === "undefined"; + function _createKey(args, customKey) { + if (customKey != null) return `${ordinal}-c-${customKey}`; + if (subsetKey !== undefined) return `${ordinal}-${keyFromObject(subsetKey(args))}`; + return `${ordinal}-${keyFromObject(args)}`; + } + const deferWaitingKey = `def_wait_${_createKey({})}`; + let cacheBreakWatcher = {}; + let watchIdOrd = 0; + const shouldUpdate = {}; + function runPostActionHook(result, args, stores, context) { + if (postActionHook !== undefined) postActionHook({ + args, + result, + stores, + context + }); + } + function getCachedResult({ args , cache , cacheBreakEnabled , context , fromListener , key , postActionEnabled , stores , customCacheBreak }) { + const useCacheBreakHook = customCacheBreak !== null && customCacheBreak !== void 0 ? customCacheBreak : cacheBreakHook; + if (cache.results.hasOwnProperty(key)) { + const cacheBreakLoop = cacheBreakWatcher.hasOwnProperty(key) && cacheBreakWatcher[key] > 2; + if (!onServer && !fromListener && cacheBreakEnabled && useCacheBreakHook != null && cache.results[key][1] && useCacheBreakHook({ + args, + result: cache.results[key][2], + stores, + timeCached: cache.results[key][4] + }) && !cacheBreakLoop) { + if (cacheBreakWatcher.hasOwnProperty(key)) cacheBreakWatcher[key]++; + else cacheBreakWatcher[key] = 1; + const previous = cache.results[key]; + delete cache.results[key]; + return { + cacheBroke: true, + response: undefined, + previous + }; + } else { + if (cacheBreakLoop) console.error(`[${key}] Pullstate detected an infinite loop caused by cacheBreakHook() +returning true too often (breaking cache as soon as your action is resolving - hence +causing beckoned actions to run the action again) in one of your AsyncActions - Pullstate prevented +further looping. Fix in your cacheBreakHook() is needed.`); + else cacheBreakWatcher[key] = 0; + if (postActionEnabled && cache.results[key][1] && !fromListener) runPostActionHook(cache.results[key][2], args, stores, context); + return { + response: cache.results[key], + cacheBroke: false, + previous: undefined + }; + } + } + return { + cacheBroke: false, + response: undefined, + previous: undefined + }; + } + function createInternalAction(key, cache, args, stores, currentActionOrd, postActionEnabled, executionContext, customContext) { + return ()=>action(args, stores, customContext).then((resp)=>{ + if (currentActionOrd === cache.actionOrd[key]) { + if (postActionEnabled) runPostActionHook(resp, args, stores, executionContext); + cache.results[key] = [ + true, + true, + resp, + false, + Date.now() + ]; + } + return resp; + }).catch((e)=>{ + console.error(e); + const result = { + payload: null, + errorPayload: null, + error: true, + tags: [ + EAsyncEndTags.THREW_ERROR + ], + message: e.message + }; + if (currentActionOrd === cache.actionOrd[key]) { + if (postActionEnabled) runPostActionHook(result, args, stores, executionContext); + cache.results[key] = [ + true, + true, + result, + false, + Date.now() + ]; + } + return result; + }).then((resp)=>{ + if (currentActionOrd === cache.actionOrd[key]) { + delete cache.actions[key]; + if (!onServer) notifyListeners(key); + } + return resp; + }); + } + function checkKeyAndReturnResponse({ key , cache , initiate , ssr , args , stores , fromListener =false , postActionEnabled =true , cacheBreakEnabled =true , holdingResult , customContext , customCacheBreak , holdPrevious }) { + const cached = getCachedResult({ + key, + cache, + args, + stores, + context: initiate ? EPostActionContext.BECKON_HIT_CACHE : EPostActionContext.WATCH_HIT_CACHE, + postActionEnabled, + cacheBreakEnabled, + fromListener, + customCacheBreak + }); + if (cached.response) return cached.response; + if (!cache.actions.hasOwnProperty(key)) { + const currentActionOrd = actionOrdUpdate(cache, key); + if (initiate) { + if (shortCircuitHook !== undefined) { + const shortCircuitResponse = shortCircuitHook({ + args, + stores + }); + if (shortCircuitResponse !== false) { + runPostActionHook(shortCircuitResponse, args, stores, EPostActionContext.SHORT_CIRCUIT); + cache.results[key] = [ + true, + true, + shortCircuitResponse, + false, + Date.now() + ]; + return cache.results[key]; + } + } + if (ssr || !onServer) cache.actions[key] = createInternalAction(key, cache, args, stores, currentActionOrd, postActionEnabled, EPostActionContext.BECKON_RUN, customContext); + if (!onServer) { + cache.actions[key](); + cache.results[key] = startedButUnfinishedResult; + } else return startedButUnfinishedResult; + } else { + const resp = [ + false, + false, + { + message: "", + tags: [ + EAsyncEndTags.UNFINISHED + ], + error: true, + payload: null, + errorPayload: null + }, + false, + -1 + ]; + if (!onServer) cache.results[key] = resp; + if (holdPrevious) { + if (holdingResult) { + const response = [ + ...holdingResult + ]; + response[3] = true; + return response; + } + if (cached.previous != null) { + const response1 = [ + ...cached.previous + ]; + response1[3] = true; + return response1; + } + } + return resp; + } + } + if (holdPrevious) { + if (holdingResult) { + const response2 = [ + ...holdingResult + ]; + response2[3] = true; + return response2; + } + if (cached.previous != null) { + const response3 = [ + ...cached.previous + ]; + response3[3] = true; + return response3; + } + } + return startedButUnfinishedResult; + } + const read = (args = {}, { cacheBreakEnabled =true , postActionEnabled =true , key: customKey } = {})=>{ + const key = _createKey(args, customKey); + const cache = onServer ? (0, _react.useContext)(PullstateContext)._asyncCache : clientAsyncCache; + let stores; + let customContext; + if (onServer || forceContext) { + const pullstateContext = (0, _react.useContext)(PullstateContext); + stores = pullstateContext.stores; + customContext = pullstateContext.customContext; + } else if (clientStores.loaded) stores = clientStores.stores; + else stores = storeErrorProxy; + const cached = getCachedResult({ + key, + cache, + args, + stores, + context: EPostActionContext.READ_HIT_CACHE, + postActionEnabled, + cacheBreakEnabled, + fromListener: false + }); + if (cached.response) { + if (!cached.response[2].error) return cached.response[2].payload; + else throw new PullstateAsyncError(cached.response[2].message, cached.response[2].tags); + } + if (!cache.actions.hasOwnProperty(key)) { + if (shortCircuitHook !== undefined) { + const shortCircuitResponse = shortCircuitHook({ + args, + stores + }); + if (shortCircuitResponse !== false) { + runPostActionHook(shortCircuitResponse, args, stores, EPostActionContext.SHORT_CIRCUIT); + cache.results[key] = [ + true, + true, + shortCircuitResponse, + false, + Date.now() + ]; + if (!shortCircuitResponse.error) return shortCircuitResponse.payload; + else throw new PullstateAsyncError(shortCircuitResponse.message, shortCircuitResponse.tags); + } + } + const currentActionOrd = actionOrdUpdate(cache, key); + cache.actions[key] = createInternalAction(key, cache, args, stores, currentActionOrd, postActionEnabled, EPostActionContext.READ_RUN, customContext); + if (onServer) throw new Error(`Pullstate Async Action: action.read() : Resolve all async state for Suspense actions before Server-side render ( make use of instance.runAsyncAction() )`); + throw cache.actions[key](); + } + if (onServer) throw new Error(`Pullstate Async Action: action.read() : Resolve all async state for Suspense actions before Server-side render ( make use of instance.runAsyncAction() )`); + const watchOrd = watchIdOrd++; + throw new Promise((resolve)=>{ + cache.listeners[key][watchOrd] = ()=>{ + delete cache.listeners[key][watchOrd]; + resolve(); + }; + }); + }; + const useWatch = (args = {}, { initiate =false , ssr =true , postActionEnabled =false , cacheBreakEnabled =false , holdPrevious =false , dormant =false , key: customKey , cacheBreak: customCacheBreakIncoming } = {})=>{ + const responseRef = (0, _react.useRef)(); + const prevKeyRef = (0, _react.useRef)("."); + const key = dormant ? "." : _createKey(args, customKey); + let watchId = (0, _react.useRef)(-1); + if (watchId.current === -1) watchId.current = watchIdOrd++; + if (!dormant) { + if (!shouldUpdate.hasOwnProperty(key)) shouldUpdate[key] = { + [watchId.current]: true + }; + else shouldUpdate[key][watchId.current] = true; + } + const cache = onServer ? (0, _react.useContext)(PullstateContext)._asyncCache : clientAsyncCache; + let stores; + let customContext; + if (onServer || forceContext) { + const pullstateContext = (0, _react.useContext)(PullstateContext); + stores = pullstateContext.stores; + customContext = pullstateContext.customContext; + } else if (clientStores.loaded) stores = clientStores.stores; + else stores = storeErrorProxy; + if (!onServer) { + const onAsyncStateChanged = ()=>{ + if (shouldUpdate[key][watchId.current] && !(0, _es6Default.default)(responseRef.current, cache.results[key])) { + const nextResponse = checkKeyAndReturnResponse({ + key, + cache, + initiate, + ssr, + args, + stores, + fromListener: true, + postActionEnabled, + cacheBreakEnabled, + holdingResult: undefined, + customContext, + holdPrevious + }); + if (holdPrevious && !nextResponse[1] && responseRef.current != null && responseRef.current[1]) { + responseRef.current = [ + ...responseRef.current + ]; + responseRef.current[3] = true; + } else responseRef.current = nextResponse; + setWatchUpdate((prev)=>{ + return prev + 1; + }); + } + }; + if (!dormant) { + if (!cache.listeners.hasOwnProperty(key)) cache.listeners[key] = {}; + cache.listeners[key][watchId.current] = onAsyncStateChanged; + shouldUpdate[key][watchId.current] = true; + } + (0, _react.useEffect)(()=>{ + if (!dormant) { + cache.listeners[key][watchId.current] = onAsyncStateChanged; + shouldUpdate[key][watchId.current] = true; + } + return ()=>{ + if (!dormant) { + delete cache.listeners[key][watchId.current]; + shouldUpdate[key][watchId.current] = false; + } + }; + }, [ + key + ]); + } + const [_, setWatchUpdate] = (0, _react.useState)(0); + if (dormant) { + responseRef.current = holdPrevious && responseRef.current && responseRef.current[1] ? responseRef.current : [ + false, + false, + { + message: "", + tags: [ + EAsyncEndTags.DORMANT + ], + error: true, + payload: null + }, + false, + -1 + ]; + prevKeyRef.current = "."; + } else if (prevKeyRef.current !== key) { + if (prevKeyRef.current !== null && shouldUpdate.hasOwnProperty(prevKeyRef.current)) { + delete cache.listeners[prevKeyRef.current][watchId.current]; + shouldUpdate[prevKeyRef.current][watchId.current] = false; + } + prevKeyRef.current = key; + responseRef.current = checkKeyAndReturnResponse({ + key, + cache, + initiate, + ssr, + args, + stores, + fromListener: false, + postActionEnabled, + cacheBreakEnabled, + holdingResult: holdPrevious && responseRef.current && responseRef.current[1] ? responseRef.current : undefined, + customContext, + customCacheBreak: convertCustomCacheBreakHook(customCacheBreakIncoming), + holdPrevious + }); + } + return responseRef.current; + }; + const useBeckon = (args = {}, { ssr =true , postActionEnabled =true , cacheBreakEnabled =true , holdPrevious =false , dormant =false , key } = {})=>{ + const result = useWatch(args, { + initiate: true, + ssr, + postActionEnabled, + cacheBreakEnabled, + holdPrevious, + dormant, + key + }); + return [ + result[1], + result[2], + result[3] + ]; + }; + const run = async (args = {}, inputs = {})=>{ + const { treatAsUpdate =false , ignoreShortCircuit =false , respectCache =false , key: customKey , _asyncCache =clientAsyncCache , _stores =clientStores.loaded ? clientStores.stores : storeErrorProxy , _customContext , cacheBreak: customCacheBreak } = inputs; + const key = _createKey(args, customKey); + if (respectCache) { + const cached = getCachedResult({ + key, + cache: _asyncCache, + args, + stores: _stores, + context: EPostActionContext.RUN_HIT_CACHE, + postActionEnabled: true, + cacheBreakEnabled: true, + fromListener: false, + customCacheBreak: convertCustomCacheBreakHook(customCacheBreak) + }); + if (cached.response && cached.response[0]) { + if (!cached.response[1]) { + const watchOrd = watchIdOrd++; + if (!_asyncCache.listeners.hasOwnProperty(key)) _asyncCache.listeners[key] = {}; + return new Promise((resolve)=>{ + _asyncCache.listeners[key][watchOrd] = ()=>{ + const [, finished, resp] = _asyncCache.results[key]; + if (finished) { + delete _asyncCache.listeners[key][watchOrd]; + resolve(resp); + } + }; + }); + } + return cached.response[2]; + } + } + if (!ignoreShortCircuit && shortCircuitHook !== undefined) { + const shortCircuitResponse = shortCircuitHook({ + args, + stores: _stores + }); + if (shortCircuitResponse !== false) { + _asyncCache.results[key] = [ + true, + true, + shortCircuitResponse, + false, + Date.now() + ]; + runPostActionHook(shortCircuitResponse, args, _stores, EPostActionContext.SHORT_CIRCUIT); + notifyListeners(key); + return shortCircuitResponse; + } + } + const [, prevFinished, prevResp, prevUpdate, prevCacheTime] = _asyncCache.results[key] || [ + false, + false, + { + error: true, + message: "", + payload: null, + tags: [ + EAsyncEndTags.UNFINISHED + ] + }, + false, + -1 + ]; + if (prevFinished && treatAsUpdate) _asyncCache.results[key] = [ + true, + true, + prevResp, + true, + prevCacheTime + ]; + else _asyncCache.results[key] = [ + true, + false, + { + error: true, + message: "", + payload: null, + tags: [ + EAsyncEndTags.UNFINISHED + ] + }, + false, + -1 + ]; + let currentActionOrd = actionOrdUpdate(_asyncCache, key); + _asyncCache.actions[key] = createInternalAction(key, _asyncCache, args, _stores, currentActionOrd, true, EPostActionContext.DIRECT_RUN, _customContext); + notifyListeners(key); + return _asyncCache.actions[key](); + }; + const clearCache = (args = {}, { key: customKey , notify =true } = {})=>{ + const key = _createKey(args, customKey); + clearActionCache(key, true, notify); + }; + const clearAllCache = ({ notify =true } = {})=>{ + for (const key of Object.keys(clientAsyncCache.actionOrd))if (key.startsWith(`${ordinal}-`)) clearActionCache(key, true, notify); + }; + const clearAllUnwatchedCache = ({ notify =true } = {})=>{ + for (const key of Object.keys(shouldUpdate))if (!Object.values(shouldUpdate[key]).some((su)=>su)) { + delete shouldUpdate[key]; + clearActionCache(key, false, notify); + } + }; + const setCached = (args, result, options)=>{ + const { notify =true , key: customKey } = options || {}; + const key = _createKey(args, customKey); + const cache = onServer ? (0, _react.useContext)(PullstateContext)._asyncCache : clientAsyncCache; + cache.results[key] = [ + true, + true, + result, + false, + Date.now() + ]; + if (notify) notifyListeners(key); + }; + const setCachedPayload = (args, payload, options)=>{ + return setCached(args, successResult(payload), options); + }; + const updateCached = (args, updater, options)=>{ + const { notify =true , resetTimeCached =true , runPostActionHook: postAction = false , key: customKey } = options || {}; + const key = _createKey(args, customKey); + const cache = onServer ? (0, _react.useContext)(PullstateContext)._asyncCache : clientAsyncCache; + if (cache.results.hasOwnProperty(key) && !cache.results[key][2].error) { + const currentCached = cache.results[key][2].payload; + const newResult = { + payload: (0, _immerDefault.default)(currentCached, (s)=>updater(s, currentCached)), + error: false, + message: cache.results[key][2].message, + tags: cache.results[key][2].tags + }; + if (postAction) runPostActionHook(newResult, args, clientStores.loaded ? clientStores.stores : storeErrorProxy, EPostActionContext.CACHE_UPDATE); + cache.results[key] = [ + true, + true, + newResult, + cache.results[key][3], + resetTimeCached ? Date.now() : cache.results[key][4] + ]; + if (notify) notifyListeners(key); + } + }; + const getCached = (args = {}, options)=>{ + var _a; + const { checkCacheBreak =false , key: customKey , cacheBreak: incomingCacheBreak } = options || {}; + const key = _createKey(args, customKey); + let cacheBreakable = false; + const cache = clientAsyncCache; + if (cache.results.hasOwnProperty(key)) { + const finalizedCacheBreakHook = (_a = convertCustomCacheBreakHook(incomingCacheBreak)) !== null && _a !== void 0 ? _a : cacheBreakHook; + if (checkCacheBreak && finalizedCacheBreakHook !== undefined) { + const stores = onServer ? (0, _react.useContext)(PullstateContext).stores : clientStores.loaded ? clientStores.stores : storeErrorProxy; + if (finalizedCacheBreakHook({ + args, + result: cache.results[key][2], + stores, + timeCached: cache.results[key][4] + })) cacheBreakable = true; + } + const [started, finished, result, updating, timeCached] = cache.results[key]; + return { + started, + finished, + result: result, + existed: true, + cacheBreakable, + updating, + timeCached + }; + } else return { + started: false, + finished: false, + result: { + message: "", + tags: [ + EAsyncEndTags.UNFINISHED + ], + error: true, + payload: null, + errorPayload: null + }, + updating: false, + existed: false, + cacheBreakable, + timeCached: -1 + }; + }; + let delayedRunActionTimeout; + const delayedRun = (args = {}, { clearOldRun =true , delay , immediateIfCached =true , ...otherRunOptions })=>{ + if (clearOldRun) clearTimeout(delayedRunActionTimeout); + if (immediateIfCached) { + const { finished , cacheBreakable } = getCached(args, { + checkCacheBreak: true + }); + if (finished && !cacheBreakable) { + run(args, otherRunOptions); + return ()=>{}; + } + } + let ref = { + cancelled: false + }; + delayedRunActionTimeout = setTimeout(()=>{ + if (!ref.cancelled) run(args, otherRunOptions); + }, delay); + return ()=>{ + ref.cancelled = true; + }; + }; + const use = (args = {}, { initiate =true , ssr =true , postActionEnabled , cacheBreakEnabled , holdPrevious =false , dormant =false , key , onSuccess , cacheBreak: customCacheBreakHook } = {})=>{ + if (postActionEnabled == null) postActionEnabled = initiate; + if (cacheBreakEnabled == null) cacheBreakEnabled = initiate; + const raw = useWatch(args, { + initiate, + ssr, + postActionEnabled, + cacheBreakEnabled, + holdPrevious, + dormant, + key, + cacheBreak: customCacheBreakHook + }); + const [isStarted, isFinished, result, isUpdating] = raw; + const isSuccess = isFinished && !result.error; + const isFailure = isFinished && result.error; + if (onSuccess) (0, _react.useEffect)(()=>{ + if (isSuccess && !dormant) onSuccess(result.payload, args); + }, [ + isSuccess + ]); + const renderPayload = (func)=>{ + if (!result.error) return func(result.payload); + return (0, _reactDefault.default).Fragment; + }; + return { + isStarted, + isFinished, + isUpdating, + isSuccess, + isFailure, + isLoading: isStarted && (!isFinished || isUpdating), + endTags: result.tags, + error: result.error, + payload: result.payload, + errorPayload: result.errorPayload, + renderPayload, + message: result.message, + raw, + execute: (runOptions)=>run(args, runOptions), + clearCached: ()=>clearCache(args), + setCached: (response, options)=>{ + setCached(args, response, options); + }, + setCachedPayload: (payload, options)=>{ + setCachedPayload(args, payload, options); + }, + updateCached: (updater, options)=>{ + updateCached(args, updater, options); + } + }; + }; + const useDefer = (inputs = {})=>{ + const [argState, setArgState] = (0, _react.useState)(()=>({ + key: inputs.key ? inputs.key : deferWaitingKey, + args: {} + })); + const initialResponse = use({}, { + ...inputs, + key: argState.key, + initiate: false + }); + const hasCached = (args = {}, options = {})=>{ + var _a, _b; + const executionKey = (_a = inputs.key) !== null && _a !== void 0 ? _a : _createKey(args); + const { checkCacheBreak =true , successOnly =false } = options; + const cached = getCached(args, { + key: executionKey, + cacheBreak: (_b = options.cacheBreak) !== null && _b !== void 0 ? _b : inputs.cacheBreak, + checkCacheBreak + }); + if (cached.existed) { + if (!checkCacheBreak || !cached.cacheBreakable) return !successOnly || !cached.result.error; + } + return false; + }; + const unwatchExecuted = ()=>{ + setArgState({ + key: deferWaitingKey, + args: {} + }); + }; + const execute = (args = {}, runOptions)=>{ + var _a; + const executionKey = (_a = inputs.key) !== null && _a !== void 0 ? _a : _createKey(args); + if (executionKey !== argState.key) setArgState({ + key: executionKey, + args + }); + return run(args, { + ...runOptions, + key: executionKey, + cacheBreak: inputs.cacheBreak + }).then((resp)=>{ + if (inputs.clearOnSuccess) clearCache({}, { + key: executionKey + }); + return resp; + }); + }; + return { + ...initialResponse, + clearCached: ()=>{ + clearCache({}, { + key: argState.key + }); + }, + unwatchExecuted, + setCached: (response, options = {})=>{ + options.key = argState.key; + setCached({}, response, options); + }, + setCachedPayload: (payload, options = {})=>{ + options.key = argState.key; + setCachedPayload({}, payload, options); + }, + updateCached: (updater, options = {})=>{ + options.key = argState.key; + updateCached({}, updater, options); + }, + useDebouncedExecution: (args, delay, options = {})=>{ + if (!onServer) { + const stateRef = (0, _react.useRef)({ + update: false + }); + const currentValue = (0, _react.useRef)(undefined); + const executionOrd = (0, _react.useRef)(-1); + const timeout = (0, _react.useRef)(undefined); + (0, _react.useEffect)(()=>{ + stateRef.current.update = true; + return ()=>{ + stateRef.current.update = false; + }; + }, []); + const hasEqualityCheck = options.equality != null; + if (hasEqualityCheck) { + if (typeof options.equality === "function") { + if (currentValue.current === undefined || options.equality(currentValue.current, args)) { + currentValue.current = args; + executionOrd.current += 1; + } + } else if (currentValue.current !== options.equality) { + currentValue.current = options.equality; + executionOrd.current += 1; + } + } else if (!(0, _es6Default.default)(currentValue.current, args)) { + currentValue.current = args; + executionOrd.current += 1; + } + (0, _react.useEffect)(()=>{ + var _a, _b, _c; + clearTimeout(timeout.current); + const executeAction = ()=>{ + var _a; + if (stateRef.current.update) execute(args, (_a = options.executeOptions) !== null && _a !== void 0 ? _a : { + respectCache: true + }); + }; + if ((_b = (_a = options.validInput) === null || _a === void 0 ? void 0 : _a.call(options, args)) !== null && _b !== void 0 ? _b : true) { + if (hasCached(args)) executeAction(); + else timeout.current = setTimeout(executeAction, delay); + } else if (!((_c = options.watchLastValid) !== null && _c !== void 0 ? _c : false)) unwatchExecuted(); + }, [ + executionOrd.current + ]); + } + }, + hasCached, + execute, + args: argState.args, + key: argState.key + }; + }; + return { + use, + useDefer, + read, + useBeckon, + useWatch, + run, + delayedRun, + clearCache, + clearAllCache, + clearAllUnwatchedCache, + getCached, + setCached, + setCachedPayload, + updateCached + }; +} +const PullstateContext = (0, _reactDefault.default).createContext(null); +const PullstateProvider = ({ instance , children })=>{ + return (0, _reactDefault.default).createElement(PullstateContext.Provider, { + value: instance + }, children); +}; +let singleton = null; +const clientStores = { + internalClientStores: true, + loaded: false, + stores: {} +}; +class PullstateSingleton { + constructor(allStores, options = {}){ + this.options = {}; + if (singleton !== null) console.error(`Pullstate: createPullstate() - Should not be creating the core Pullstate class more than once! In order to re-use pull state, you need to call instantiate() on your already created object.`); + singleton = this; + clientStores.stores = allStores; + clientStores.loaded = true; + this.options = options; + } + instantiate({ hydrateSnapshot , ssr =false , customContext } = {}) { + if (!ssr) { + const instantiated = new PullstateInstance(clientStores.stores, false, customContext); + if (hydrateSnapshot != null) instantiated.hydrateFromSnapshot(hydrateSnapshot); + instantiated.instantiateReactions(); + return instantiated; + } + const newStores = {}; + for (const storeName of Object.keys(clientStores.stores)){ + if (hydrateSnapshot == null) newStores[storeName] = new Store(clientStores.stores[storeName]._getInitialState()); + else if (hydrateSnapshot.hasOwnProperty(storeName)) newStores[storeName] = new Store(hydrateSnapshot.allState[storeName]); + else { + newStores[storeName] = new Store(clientStores.stores[storeName]._getInitialState()); + console.warn(`Pullstate (instantiate): store [${storeName}] didn't hydrate any state (data was non-existent on hydration object)`); + } + newStores[storeName]._setInternalOptions({ + ssr, + reactionCreators: clientStores.stores[storeName]._getReactionCreators() + }); + } + return new PullstateInstance(newStores, true, customContext); + } + useStores() { + return useStores(); + } + useInstance() { + return useInstance(); + } + createAsyncActionDirect(action, options = {}) { + return createAsyncActionDirect(action, options); + } + createAsyncAction(action, options = {}) { + var _a; + if (((_a = this.options.asyncActions) === null || _a === void 0 ? void 0 : _a.defaultCachingSeconds) && !options.cacheBreakHook) options.cacheBreakHook = (inputs)=>inputs.timeCached < Date.now() - this.options.asyncActions.defaultCachingSeconds * 1000; + return createAsyncAction(action, options); + } +} +class PullstateInstance { + constructor(allStores, ssr, customContext){ + this._ssr = false; + this._stores = {}; + this._asyncCache = { + listeners: {}, + results: {}, + actions: {}, + actionOrd: {} + }; + this._stores = allStores; + this._ssr = ssr; + this._customContext = customContext; + } + getAllUnresolvedAsyncActions() { + return Object.keys(this._asyncCache.actions).map((key)=>this._asyncCache.actions[key]()); + } + instantiateReactions() { + for (const storeName of Object.keys(this._stores))this._stores[storeName]._instantiateReactions(); + } + getPullstateSnapshot() { + const allState = {}; + for (const storeName of Object.keys(this._stores))allState[storeName] = this._stores[storeName].getRawState(); + return { + allState, + asyncResults: this._asyncCache.results, + asyncActionOrd: this._asyncCache.actionOrd + }; + } + async resolveAsyncState() { + const promises = this.getAllUnresolvedAsyncActions(); + await Promise.all(promises); + } + hasAsyncStateToResolve() { + return Object.keys(this._asyncCache.actions).length > 0; + } + get stores() { + return this._stores; + } + get customContext() { + return this._customContext; + } + async runAsyncAction(asyncAction, args = {}, runOptions = {}) { + if (this._ssr) { + runOptions._asyncCache = this._asyncCache; + runOptions._stores = this._stores; + runOptions._customContext = this._customContext; + } + return await asyncAction.run(args, runOptions); + } + hydrateFromSnapshot(snapshot) { + for (const storeName of Object.keys(this._stores))if (snapshot.allState.hasOwnProperty(storeName)) this._stores[storeName]._updateStateWithoutReaction(snapshot.allState[storeName]); + else console.warn(`${storeName} didn't hydrate any state (data was non-existent on hydration object)`); + clientAsyncCache.results = snapshot.asyncResults || {}; + clientAsyncCache.actionOrd = snapshot.asyncActionOrd || {}; + } +} +function createPullstateCore(allStores = {}, options = {}) { + return new PullstateSingleton(allStores, options); +} +function useStores() { + return (0, _react.useContext)(PullstateContext).stores; +} +function useInstance() { + return (0, _react.useContext)(PullstateContext); +} +var EAsyncActionInjectType; +(function(EAsyncActionInjectType) { + EAsyncActionInjectType["WATCH"] = "watch"; + EAsyncActionInjectType["BECKON"] = "beckon"; +})(EAsyncActionInjectType || (EAsyncActionInjectType = {})); +function InjectAsyncAction(props) { + if (props.type === EAsyncActionInjectType.BECKON) { + const response = props.action.useBeckon(props.args, props.options); + return props.children(response); + } + const response1 = props.action.useWatch(props.args, props.options); + return props.children(response1); +} +function registerInDevtools(stores, { namespace ="" } = {}) { + const devToolsExtension = typeof window !== "undefined" ? window === null || window === void 0 ? void 0 : window.__REDUX_DEVTOOLS_EXTENSION__ : undefined; + if (devToolsExtension) for (const key of Object.keys(stores)){ + const store = stores[key]; + const devTools = devToolsExtension.connect({ + name: `${namespace}${key}` + }); + devTools.init(store.getRawState()); + let ignoreNext = false; + store.subscribe((s)=>s, (watched)=>{ + if (ignoreNext) { + ignoreNext = false; + return; + } + devTools.send("Change", watched); + }); + devTools.subscribe((message)=>{ + if (message.type === "DISPATCH" && message.state) { + ignoreNext = true; + const parsed = JSON.parse(message.state); + store.replace(parsed); + } + }); + } +} +const batchState = {}; +function setupBatch({ uiBatchFunction }) { + batchState.uiBatchFunction = uiBatchFunction; +} +function batch(runUpdates) { + if (globalClientState.batching) throw new Error("Pullstate: Can't enact two batch() update functions at the same time-\nmake sure you are not running a batch() inside of a batch() by mistake."); + globalClientState.batching = true; + try { + runUpdates(); + } finally{ + if (batchState.uiBatchFunction) batchState.uiBatchFunction(()=>{ + Object.values(globalClientState.flushStores).forEach((store)=>store.flushBatch(true)); + }); + else Object.values(globalClientState.flushStores).forEach((store)=>store.flushBatch(true)); + globalClientState.flushStores = {}; + globalClientState.batching = false; + } +} + +},{"fast-deep-equal/es6":"lDnNX","react":"21dqq","immer":"4sfoz","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"lDnNX":[function(require,module,exports) { +"use strict"; +// do not edit .js files directly - edit src/index.jst +var envHasBigInt64Array = typeof BigInt64Array !== "undefined"; +module.exports = function equal(a, b) { + if (a === b) return true; + if (a && b && typeof a == "object" && typeof b == "object") { + if (a.constructor !== b.constructor) return false; + var length, i, keys; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for(i = length; i-- !== 0;)if (!equal(a[i], b[i])) return false; + return true; + } + if (a instanceof Map && b instanceof Map) { + if (a.size !== b.size) return false; + for (i of a.entries())if (!b.has(i[0])) return false; + for (i of a.entries())if (!equal(i[1], b.get(i[0]))) return false; + return true; + } + if (a instanceof Set && b instanceof Set) { + if (a.size !== b.size) return false; + for (i of a.entries())if (!b.has(i[0])) return false; + return true; + } + if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { + length = a.length; + if (length != b.length) return false; + for(i = length; i-- !== 0;)if (a[i] !== b[i]) return false; + return true; + } + if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) return false; + for(i = length; i-- !== 0;)if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + for(i = length; i-- !== 0;){ + var key = keys[i]; + if (!equal(a[key], b[key])) return false; + } + return true; + } + // true if both NaN, false otherwise + return a !== a && b !== b; +}; + +},{}],"4sfoz":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +parcelHelpers.export(exports, "Immer", ()=>un); +parcelHelpers.export(exports, "applyPatches", ()=>pn); +parcelHelpers.export(exports, "castDraft", ()=>K); +parcelHelpers.export(exports, "castImmutable", ()=>$); +parcelHelpers.export(exports, "createDraft", ()=>ln); +parcelHelpers.export(exports, "current", ()=>R); +parcelHelpers.export(exports, "enableAllPlugins", ()=>J); +parcelHelpers.export(exports, "enableES5", ()=>F); +parcelHelpers.export(exports, "enableMapSet", ()=>C); +parcelHelpers.export(exports, "enablePatches", ()=>T); +parcelHelpers.export(exports, "finishDraft", ()=>dn); +parcelHelpers.export(exports, "freeze", ()=>d); +parcelHelpers.export(exports, "immerable", ()=>L); +parcelHelpers.export(exports, "isDraft", ()=>r); +parcelHelpers.export(exports, "isDraftable", ()=>t); +parcelHelpers.export(exports, "nothing", ()=>H); +parcelHelpers.export(exports, "original", ()=>e); +parcelHelpers.export(exports, "produce", ()=>fn); +parcelHelpers.export(exports, "produceWithPatches", ()=>cn); +parcelHelpers.export(exports, "setAutoFreeze", ()=>sn); +parcelHelpers.export(exports, "setUseProxies", ()=>vn); +function n(n) { + for(var r = arguments.length, t = Array(r > 1 ? r - 1 : 0), e = 1; e < r; e++)t[e - 1] = arguments[e]; + var i = Y[n], o = i ? "function" == typeof i ? i.apply(null, t) : i : "unknown error nr: " + n; + throw Error("[Immer] " + o); + throw Error("[Immer] minified error nr: " + n + (t.length ? " " + t.map(function(n) { + return "'" + n + "'"; + }).join(",") : "") + ". Find the full error at: https://bit.ly/3cXEKWf"); +} +function r(n) { + return !!n && !!n[Q]; +} +function t(n) { + var r; + return !!n && (function(n) { + if (!n || "object" != typeof n) return !1; + var r = Object.getPrototypeOf(n); + if (null === r) return !0; + var t = Object.hasOwnProperty.call(r, "constructor") && r.constructor; + return t === Object || "function" == typeof t && Function.toString.call(t) === Z; + }(n) || Array.isArray(n) || !!n[L] || !!(null === (r = n.constructor) || void 0 === r ? void 0 : r[L]) || s(n) || v(n)); +} +function e(t) { + return r(t) || n(23, t), t[Q].t; +} +function i(n, r, t) { + void 0 === t && (t = !1), 0 === o(n) ? (t ? Object.keys : nn)(n).forEach(function(e) { + t && "symbol" == typeof e || r(e, n[e], n); + }) : n.forEach(function(t, e) { + return r(e, t, n); + }); +} +function o(n) { + var r = n[Q]; + return r ? r.i > 3 ? r.i - 4 : r.i : Array.isArray(n) ? 1 : s(n) ? 2 : v(n) ? 3 : 0; +} +function u(n, r) { + return 2 === o(n) ? n.has(r) : Object.prototype.hasOwnProperty.call(n, r); +} +function a(n, r) { + return 2 === o(n) ? n.get(r) : n[r]; +} +function f(n, r, t) { + var e = o(n); + 2 === e ? n.set(r, t) : 3 === e ? n.add(t) : n[r] = t; +} +function c(n, r) { + return n === r ? 0 !== n || 1 / n == 1 / r : n != n && r != r; +} +function s(n) { + return X && n instanceof Map; +} +function v(n) { + return q && n instanceof Set; +} +function p(n) { + return n.o || n.t; +} +function l(n) { + if (Array.isArray(n)) return Array.prototype.slice.call(n); + var r = rn(n); + delete r[Q]; + for(var t = nn(r), e = 0; e < t.length; e++){ + var i = t[e], o = r[i]; + !1 === o.writable && (o.writable = !0, o.configurable = !0), (o.get || o.set) && (r[i] = { + configurable: !0, + writable: !0, + enumerable: o.enumerable, + value: n[i] + }); + } + return Object.create(Object.getPrototypeOf(n), r); +} +function d(n, e) { + return void 0 === e && (e = !1), y(n) || r(n) || !t(n) || (o(n) > 1 && (n.set = n.add = n.clear = n.delete = h), Object.freeze(n), e && i(n, function(n, r) { + return d(r, !0); + }, !0)), n; +} +function h() { + n(2); +} +function y(n) { + return null == n || "object" != typeof n || Object.isFrozen(n); +} +function b(r) { + var t = tn[r]; + return t || n(18, r), t; +} +function m(n, r) { + tn[n] || (tn[n] = r); +} +function _() { + return U || n(0), U; +} +function j(n, r) { + r && (b("Patches"), n.u = [], n.s = [], n.v = r); +} +function O(n) { + g(n), n.p.forEach(S), n.p = null; +} +function g(n) { + n === U && (U = n.l); +} +function w(n) { + return U = { + p: [], + l: U, + h: n, + m: !0, + _: 0 + }; +} +function S(n) { + var r = n[Q]; + 0 === r.i || 1 === r.i ? r.j() : r.O = !0; +} +function P(r, e) { + e._ = e.p.length; + var i = e.p[0], o = void 0 !== r && r !== i; + return e.h.g || b("ES5").S(e, r, o), o ? (i[Q].P && (O(e), n(4)), t(r) && (r = M(e, r), e.l || x(e, r)), e.u && b("Patches").M(i[Q].t, r, e.u, e.s)) : r = M(e, i, []), O(e), e.u && e.v(e.u, e.s), r !== H ? r : void 0; +} +function M(n, r, t) { + if (y(r)) return r; + var e = r[Q]; + if (!e) return i(r, function(i, o) { + return A(n, e, r, i, o, t); + }, !0), r; + if (e.A !== n) return r; + if (!e.P) return x(n, e.t, !0), e.t; + if (!e.I) { + e.I = !0, e.A._--; + var o = 4 === e.i || 5 === e.i ? e.o = l(e.k) : e.o, u = o, a = !1; + 3 === e.i && (u = new Set(o), o.clear(), a = !0), i(u, function(r, i) { + return A(n, e, o, r, i, t, a); + }), x(n, o, !1), t && n.u && b("Patches").N(e, t, n.u, n.s); + } + return e.o; +} +function A(e, i, o, a, c, s, v) { + if (c === o && n(5), r(c)) { + var p = M(e, c, s && i && 3 !== i.i && !u(i.R, a) ? s.concat(a) : void 0); + if (f(o, a, p), !r(p)) return; + e.m = !1; + } else v && o.add(c); + if (t(c) && !y(c)) { + if (!e.h.D && e._ < 1) return; + M(e, c), i && i.A.l || x(e, c); + } +} +function x(n, r, t) { + void 0 === t && (t = !1), !n.l && n.h.D && n.m && d(r, t); +} +function z(n, r) { + var t = n[Q]; + return (t ? p(t) : n)[r]; +} +function I(n, r) { + if (r in n) for(var t = Object.getPrototypeOf(n); t;){ + var e = Object.getOwnPropertyDescriptor(t, r); + if (e) return e; + t = Object.getPrototypeOf(t); + } +} +function k(n) { + n.P || (n.P = !0, n.l && k(n.l)); +} +function E(n) { + n.o || (n.o = l(n.t)); +} +function N(n, r, t) { + var e = s(r) ? b("MapSet").F(r, t) : v(r) ? b("MapSet").T(r, t) : n.g ? function(n, r) { + var t = Array.isArray(n), e = { + i: t ? 1 : 0, + A: r ? r.A : _(), + P: !1, + I: !1, + R: {}, + l: r, + t: n, + k: null, + o: null, + j: null, + C: !1 + }, i = e, o = en; + t && (i = [ + e + ], o = on); + var u = Proxy.revocable(i, o), a = u.revoke, f = u.proxy; + return e.k = f, e.j = a, f; + }(r, t) : b("ES5").J(r, t); + return (t ? t.A : _()).p.push(e), e; +} +function R(e) { + return r(e) || n(22, e), function n(r) { + if (!t(r)) return r; + var e, u = r[Q], c = o(r); + if (u) { + if (!u.P && (u.i < 4 || !b("ES5").K(u))) return u.t; + u.I = !0, e = D(r, c), u.I = !1; + } else e = D(r, c); + return i(e, function(r, t) { + u && a(u.t, r) === t || f(e, r, n(t)); + }), 3 === c ? new Set(e) : e; + }(e); +} +function D(n, r) { + switch(r){ + case 2: + return new Map(n); + case 3: + return Array.from(n); + } + return l(n); +} +function F() { + function t(n, r) { + var t = s[n]; + return t ? t.enumerable = r : s[n] = t = { + configurable: !0, + enumerable: r, + get: function() { + var r = this[Q]; + return f(r), en.get(r, n); + }, + set: function(r) { + var t = this[Q]; + f(t), en.set(t, n, r); + } + }, t; + } + function e(n) { + for(var r = n.length - 1; r >= 0; r--){ + var t = n[r][Q]; + if (!t.P) switch(t.i){ + case 5: + a(t) && k(t); + break; + case 4: + o(t) && k(t); + } + } + } + function o(n) { + for(var r = n.t, t = n.k, e = nn(t), i = e.length - 1; i >= 0; i--){ + var o = e[i]; + if (o !== Q) { + var a = r[o]; + if (void 0 === a && !u(r, o)) return !0; + var f = t[o], s = f && f[Q]; + if (s ? s.t !== a : !c(f, a)) return !0; + } + } + var v = !!r[Q]; + return e.length !== nn(r).length + (v ? 0 : 1); + } + function a(n) { + var r = n.k; + if (r.length !== n.t.length) return !0; + var t = Object.getOwnPropertyDescriptor(r, r.length - 1); + if (t && !t.get) return !0; + for(var e = 0; e < r.length; e++)if (!r.hasOwnProperty(e)) return !0; + return !1; + } + function f(r) { + r.O && n(3, JSON.stringify(p(r))); + } + var s = {}; + m("ES5", { + J: function(n, r) { + var e = Array.isArray(n), i = function(n, r) { + if (n) { + for(var e = Array(r.length), i = 0; i < r.length; i++)Object.defineProperty(e, "" + i, t(i, !0)); + return e; + } + var o = rn(r); + delete o[Q]; + for(var u = nn(o), a = 0; a < u.length; a++){ + var f = u[a]; + o[f] = t(f, n || !!o[f].enumerable); + } + return Object.create(Object.getPrototypeOf(r), o); + }(e, n), o = { + i: e ? 5 : 4, + A: r ? r.A : _(), + P: !1, + I: !1, + R: {}, + l: r, + t: n, + k: i, + o: null, + O: !1, + C: !1 + }; + return Object.defineProperty(i, Q, { + value: o, + writable: !0 + }), i; + }, + S: function(n, t, o) { + o ? r(t) && t[Q].A === n && e(n.p) : (n.u && function n(r) { + if (r && "object" == typeof r) { + var t = r[Q]; + if (t) { + var e = t.t, o = t.k, f = t.R, c = t.i; + if (4 === c) i(o, function(r) { + r !== Q && (void 0 !== e[r] || u(e, r) ? f[r] || n(o[r]) : (f[r] = !0, k(t))); + }), i(e, function(n) { + void 0 !== o[n] || u(o, n) || (f[n] = !1, k(t)); + }); + else if (5 === c) { + if (a(t) && (k(t), f.length = !0), o.length < e.length) for(var s = o.length; s < e.length; s++)f[s] = !1; + else for(var v = e.length; v < o.length; v++)f[v] = !0; + for(var p = Math.min(o.length, e.length), l = 0; l < p; l++)o.hasOwnProperty(l) || (f[l] = !0), void 0 === f[l] && n(o[l]); + } + } + } + }(n.p[0]), e(n.p)); + }, + K: function(n) { + return 4 === n.i ? o(n) : a(n); + } + }); +} +function T() { + function e(n) { + if (!t(n)) return n; + if (Array.isArray(n)) return n.map(e); + if (s(n)) return new Map(Array.from(n.entries()).map(function(n) { + return [ + n[0], + e(n[1]) + ]; + })); + if (v(n)) return new Set(Array.from(n).map(e)); + var r = Object.create(Object.getPrototypeOf(n)); + for(var i in n)r[i] = e(n[i]); + return u(n, L) && (r[L] = n[L]), r; + } + function f(n) { + return r(n) ? e(n) : n; + } + var c = "add"; + m("Patches", { + $: function(r, t) { + return t.forEach(function(t) { + for(var i = t.path, u = t.op, f = r, s = 0; s < i.length - 1; s++){ + var v = o(f), p = "" + i[s]; + 0 !== v && 1 !== v || "__proto__" !== p && "constructor" !== p || n(24), "function" == typeof f && "prototype" === p && n(24), "object" != typeof (f = a(f, p)) && n(15, i.join("/")); + } + var l = o(f), d = e(t.value), h = i[i.length - 1]; + switch(u){ + case "replace": + switch(l){ + case 2: + return f.set(h, d); + case 3: + n(16); + default: + return f[h] = d; + } + case c: + switch(l){ + case 1: + return "-" === h ? f.push(d) : f.splice(h, 0, d); + case 2: + return f.set(h, d); + case 3: + return f.add(d); + default: + return f[h] = d; + } + case "remove": + switch(l){ + case 1: + return f.splice(h, 1); + case 2: + return f.delete(h); + case 3: + return f.delete(t.value); + default: + return delete f[h]; + } + default: + n(17, u); + } + }), r; + }, + N: function(n, r, t, e) { + switch(n.i){ + case 0: + case 4: + case 2: + return function(n, r, t, e) { + var o = n.t, s = n.o; + i(n.R, function(n, i) { + var v = a(o, n), p = a(s, n), l = i ? u(o, n) ? "replace" : c : "remove"; + if (v !== p || "replace" !== l) { + var d = r.concat(n); + t.push("remove" === l ? { + op: l, + path: d + } : { + op: l, + path: d, + value: p + }), e.push(l === c ? { + op: "remove", + path: d + } : "remove" === l ? { + op: c, + path: d, + value: f(v) + } : { + op: "replace", + path: d, + value: f(v) + }); + } + }); + }(n, r, t, e); + case 5: + case 1: + return function(n, r, t, e) { + var i = n.t, o = n.R, u = n.o; + if (u.length < i.length) { + var a = [ + u, + i + ]; + i = a[0], u = a[1]; + var s = [ + e, + t + ]; + t = s[0], e = s[1]; + } + for(var v = 0; v < i.length; v++)if (o[v] && u[v] !== i[v]) { + var p = r.concat([ + v + ]); + t.push({ + op: "replace", + path: p, + value: f(u[v]) + }), e.push({ + op: "replace", + path: p, + value: f(i[v]) + }); + } + for(var l = i.length; l < u.length; l++){ + var d = r.concat([ + l + ]); + t.push({ + op: c, + path: d, + value: f(u[l]) + }); + } + i.length < u.length && e.push({ + op: "replace", + path: r.concat([ + "length" + ]), + value: i.length + }); + }(n, r, t, e); + case 3: + return function(n, r, t, e) { + var i = n.t, o = n.o, u = 0; + i.forEach(function(n) { + if (!o.has(n)) { + var i = r.concat([ + u + ]); + t.push({ + op: "remove", + path: i, + value: n + }), e.unshift({ + op: c, + path: i, + value: n + }); + } + u++; + }), u = 0, o.forEach(function(n) { + if (!i.has(n)) { + var o = r.concat([ + u + ]); + t.push({ + op: c, + path: o, + value: n + }), e.unshift({ + op: "remove", + path: o, + value: n + }); + } + u++; + }); + }(n, r, t, e); + } + }, + M: function(n, r, t, e) { + t.push({ + op: "replace", + path: [], + value: r === H ? void 0 : r + }), e.push({ + op: "replace", + path: [], + value: n + }); + } + }); +} +function C() { + function r(n, r) { + function t() { + this.constructor = n; + } + a(n, r), n.prototype = (t.prototype = r.prototype, new t); + } + function e(n) { + n.o || (n.R = new Map, n.o = new Map(n.t)); + } + function o(n) { + n.o || (n.o = new Set, n.t.forEach(function(r) { + if (t(r)) { + var e = N(n.A.h, r, n); + n.p.set(r, e), n.o.add(e); + } else n.o.add(r); + })); + } + function u(r) { + r.O && n(3, JSON.stringify(p(r))); + } + var a = function(n, r) { + return (a = Object.setPrototypeOf || ({ + __proto__: [] + }) instanceof Array && function(n, r) { + n.__proto__ = r; + } || function(n, r) { + for(var t in r)r.hasOwnProperty(t) && (n[t] = r[t]); + })(n, r); + }, f = function() { + function n(n, r) { + return this[Q] = { + i: 2, + l: r, + A: r ? r.A : _(), + P: !1, + I: !1, + o: void 0, + R: void 0, + t: n, + k: this, + C: !1, + O: !1 + }, this; + } + r(n, Map); + var o = n.prototype; + return Object.defineProperty(o, "size", { + get: function() { + return p(this[Q]).size; + } + }), o.has = function(n) { + return p(this[Q]).has(n); + }, o.set = function(n, r) { + var t = this[Q]; + return u(t), p(t).has(n) && p(t).get(n) === r || (e(t), k(t), t.R.set(n, !0), t.o.set(n, r), t.R.set(n, !0)), this; + }, o.delete = function(n) { + if (!this.has(n)) return !1; + var r = this[Q]; + return u(r), e(r), k(r), r.t.has(n) ? r.R.set(n, !1) : r.R.delete(n), r.o.delete(n), !0; + }, o.clear = function() { + var n = this[Q]; + u(n), p(n).size && (e(n), k(n), n.R = new Map, i(n.t, function(r) { + n.R.set(r, !1); + }), n.o.clear()); + }, o.forEach = function(n, r) { + var t = this; + p(this[Q]).forEach(function(e, i) { + n.call(r, t.get(i), i, t); + }); + }, o.get = function(n) { + var r = this[Q]; + u(r); + var i = p(r).get(n); + if (r.I || !t(i)) return i; + if (i !== r.t.get(n)) return i; + var o = N(r.A.h, i, r); + return e(r), r.o.set(n, o), o; + }, o.keys = function() { + return p(this[Q]).keys(); + }, o.values = function() { + var n, r = this, t = this.keys(); + return (n = {})[V] = function() { + return r.values(); + }, n.next = function() { + var n = t.next(); + return n.done ? n : { + done: !1, + value: r.get(n.value) + }; + }, n; + }, o.entries = function() { + var n, r = this, t = this.keys(); + return (n = {})[V] = function() { + return r.entries(); + }, n.next = function() { + var n = t.next(); + if (n.done) return n; + var e = r.get(n.value); + return { + done: !1, + value: [ + n.value, + e + ] + }; + }, n; + }, o[V] = function() { + return this.entries(); + }, n; + }(), c = function() { + function n(n, r) { + return this[Q] = { + i: 3, + l: r, + A: r ? r.A : _(), + P: !1, + I: !1, + o: void 0, + t: n, + k: this, + p: new Map, + O: !1, + C: !1 + }, this; + } + r(n, Set); + var t = n.prototype; + return Object.defineProperty(t, "size", { + get: function() { + return p(this[Q]).size; + } + }), t.has = function(n) { + var r = this[Q]; + return u(r), r.o ? !!r.o.has(n) || !(!r.p.has(n) || !r.o.has(r.p.get(n))) : r.t.has(n); + }, t.add = function(n) { + var r = this[Q]; + return u(r), this.has(n) || (o(r), k(r), r.o.add(n)), this; + }, t.delete = function(n) { + if (!this.has(n)) return !1; + var r = this[Q]; + return u(r), o(r), k(r), r.o.delete(n) || !!r.p.has(n) && r.o.delete(r.p.get(n)); + }, t.clear = function() { + var n = this[Q]; + u(n), p(n).size && (o(n), k(n), n.o.clear()); + }, t.values = function() { + var n = this[Q]; + return u(n), o(n), n.o.values(); + }, t.entries = function() { + var n = this[Q]; + return u(n), o(n), n.o.entries(); + }, t.keys = function() { + return this.values(); + }, t[V] = function() { + return this.values(); + }, t.forEach = function(n, r) { + for(var t = this.values(), e = t.next(); !e.done;)n.call(r, e.value, e.value, this), e = t.next(); + }, n; + }(); + m("MapSet", { + F: function(n, r) { + return new f(n, r); + }, + T: function(n, r) { + return new c(n, r); + } + }); +} +function J() { + F(), C(), T(); +} +function K(n) { + return n; +} +function $(n) { + return n; +} +var G, U, W = "undefined" != typeof Symbol && "symbol" == typeof Symbol("x"), X = "undefined" != typeof Map, q = "undefined" != typeof Set, B = "undefined" != typeof Proxy && void 0 !== Proxy.revocable && "undefined" != typeof Reflect, H = W ? Symbol.for("immer-nothing") : ((G = {})["immer-nothing"] = !0, G), L = W ? Symbol.for("immer-draftable") : "__$immer_draftable", Q = W ? Symbol.for("immer-state") : "__$immer_state", V = "undefined" != typeof Symbol && Symbol.iterator || "@@iterator", Y = { + 0: "Illegal state", + 1: "Immer drafts cannot have computed properties", + 2: "This object has been frozen and should not be mutated", + 3: function(n) { + return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + n; + }, + 4: "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.", + 5: "Immer forbids circular references", + 6: "The first or second argument to `produce` must be a function", + 7: "The third argument to `produce` must be a function or undefined", + 8: "First argument to `createDraft` must be a plain object, an array, or an immerable object", + 9: "First argument to `finishDraft` must be a draft returned by `createDraft`", + 10: "The given draft is already finalized", + 11: "Object.defineProperty() cannot be used on an Immer draft", + 12: "Object.setPrototypeOf() cannot be used on an Immer draft", + 13: "Immer only supports deleting array indices", + 14: "Immer only supports setting array indices and the 'length' property", + 15: function(n) { + return "Cannot apply patch, path doesn't resolve: " + n; + }, + 16: 'Sets cannot have "replace" patches.', + 17: function(n) { + return "Unsupported patch operation: " + n; + }, + 18: function(n) { + return "The plugin for '" + n + "' has not been loaded into Immer. To enable the plugin, import and call `enable" + n + "()` when initializing your application."; + }, + 20: "Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available", + 21: function(n) { + return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '" + n + "'"; + }, + 22: function(n) { + return "'current' expects a draft, got: " + n; + }, + 23: function(n) { + return "'original' expects a draft, got: " + n; + }, + 24: "Patching reserved attributes like __proto__, prototype and constructor is not allowed" +}, Z = "" + Object.prototype.constructor, nn = "undefined" != typeof Reflect && Reflect.ownKeys ? Reflect.ownKeys : void 0 !== Object.getOwnPropertySymbols ? function(n) { + return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n)); +} : Object.getOwnPropertyNames, rn = Object.getOwnPropertyDescriptors || function(n) { + var r = {}; + return nn(n).forEach(function(t) { + r[t] = Object.getOwnPropertyDescriptor(n, t); + }), r; +}, tn = {}, en = { + get: function(n, r) { + if (r === Q) return n; + var e = p(n); + if (!u(e, r)) return function(n, r, t) { + var e, i = I(r, t); + return i ? "value" in i ? i.value : null === (e = i.get) || void 0 === e ? void 0 : e.call(n.k) : void 0; + }(n, e, r); + var i = e[r]; + return n.I || !t(i) ? i : i === z(n.t, r) ? (E(n), n.o[r] = N(n.A.h, i, n)) : i; + }, + has: function(n, r) { + return r in p(n); + }, + ownKeys: function(n) { + return Reflect.ownKeys(p(n)); + }, + set: function(n, r, t) { + var e = I(p(n), r); + if (null == e ? void 0 : e.set) return e.set.call(n.k, t), !0; + if (!n.P) { + var i = z(p(n), r), o = null == i ? void 0 : i[Q]; + if (o && o.t === t) return n.o[r] = t, n.R[r] = !1, !0; + if (c(t, i) && (void 0 !== t || u(n.t, r))) return !0; + E(n), k(n); + } + return n.o[r] === t && (void 0 !== t || r in n.o) || Number.isNaN(t) && Number.isNaN(n.o[r]) || (n.o[r] = t, n.R[r] = !0), !0; + }, + deleteProperty: function(n, r) { + return void 0 !== z(n.t, r) || r in n.t ? (n.R[r] = !1, E(n), k(n)) : delete n.R[r], n.o && delete n.o[r], !0; + }, + getOwnPropertyDescriptor: function(n, r) { + var t = p(n), e = Reflect.getOwnPropertyDescriptor(t, r); + return e ? { + writable: !0, + configurable: 1 !== n.i || "length" !== r, + enumerable: e.enumerable, + value: t[r] + } : e; + }, + defineProperty: function() { + n(11); + }, + getPrototypeOf: function(n) { + return Object.getPrototypeOf(n.t); + }, + setPrototypeOf: function() { + n(12); + } +}, on = {}; +i(en, function(n, r) { + on[n] = function() { + return arguments[0] = arguments[0][0], r.apply(this, arguments); + }; +}), on.deleteProperty = function(r, t) { + return isNaN(parseInt(t)) && n(13), on.set.call(this, r, t, void 0); +}, on.set = function(r, t, e) { + return "length" !== t && isNaN(parseInt(t)) && n(14), en.set.call(this, r[0], t, e, r[0]); +}; +var un = function() { + function e(r) { + var e = this; + this.g = B, this.D = !0, this.produce = function(r, i, o) { + if ("function" == typeof r && "function" != typeof i) { + var u = i; + i = r; + var a = e; + return function(n) { + var r = this; + void 0 === n && (n = u); + for(var t = arguments.length, e = Array(t > 1 ? t - 1 : 0), o = 1; o < t; o++)e[o - 1] = arguments[o]; + return a.produce(n, function(n) { + var t; + return (t = i).call.apply(t, [ + r, + n + ].concat(e)); + }); + }; + } + var f; + if ("function" != typeof i && n(6), void 0 !== o && "function" != typeof o && n(7), t(r)) { + var c = w(e), s = N(e, r, void 0), v = !0; + try { + f = i(s), v = !1; + } finally{ + v ? O(c) : g(c); + } + return "undefined" != typeof Promise && f instanceof Promise ? f.then(function(n) { + return j(c, o), P(n, c); + }, function(n) { + throw O(c), n; + }) : (j(c, o), P(f, c)); + } + if (!r || "object" != typeof r) { + if (void 0 === (f = i(r)) && (f = r), f === H && (f = void 0), e.D && d(f, !0), o) { + var p = [], l = []; + b("Patches").M(r, f, p, l), o(p, l); + } + return f; + } + n(21, r); + }, this.produceWithPatches = function(n, r) { + if ("function" == typeof n) return function(r) { + for(var t = arguments.length, i = Array(t > 1 ? t - 1 : 0), o = 1; o < t; o++)i[o - 1] = arguments[o]; + return e.produceWithPatches(r, function(r) { + return n.apply(void 0, [ + r + ].concat(i)); + }); + }; + var t, i, o = e.produce(n, r, function(n, r) { + t = n, i = r; + }); + return "undefined" != typeof Promise && o instanceof Promise ? o.then(function(n) { + return [ + n, + t, + i + ]; + }) : [ + o, + t, + i + ]; + }, "boolean" == typeof (null == r ? void 0 : r.useProxies) && this.setUseProxies(r.useProxies), "boolean" == typeof (null == r ? void 0 : r.autoFreeze) && this.setAutoFreeze(r.autoFreeze); + } + var i = e.prototype; + return i.createDraft = function(e) { + t(e) || n(8), r(e) && (e = R(e)); + var i = w(this), o = N(this, e, void 0); + return o[Q].C = !0, g(i), o; + }, i.finishDraft = function(r, t) { + var e = r && r[Q]; + e && e.C || n(9), e.I && n(10); + var i = e.A; + return j(i, t), P(void 0, i); + }, i.setAutoFreeze = function(n) { + this.D = n; + }, i.setUseProxies = function(r) { + r && !B && n(20), this.g = r; + }, i.applyPatches = function(n, t) { + var e; + for(e = t.length - 1; e >= 0; e--){ + var i = t[e]; + if (0 === i.path.length && "replace" === i.op) { + n = i.value; + break; + } + } + e > -1 && (t = t.slice(e + 1)); + var o = b("Patches").$; + return r(n) ? o(n, t) : this.produce(n, function(n) { + return o(n, t); + }); + }, e; +}(), an = new un, fn = an.produce, cn = an.produceWithPatches.bind(an), sn = an.setAutoFreeze.bind(an), vn = an.setUseProxies.bind(an), pn = an.applyPatches.bind(an), ln = an.createDraft.bind(an), dn = an.finishDraft.bind(an); +exports.default = fn; + +},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"cJTIf":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _pullstate = require("pullstate"); +exports.default = new (0, _pullstate.Store)({ + errors: [], + isCompiling: false, + romDump: null, + romOffsetBySourceCodePerBank: [], + sourceCodeLineByRomOffsetPerBank: [] +}); + +},{"pullstate":"kvXHz","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"egduw":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _pullstate = require("pullstate"); +var _immer = require("immer"); +(0, _immer.enableMapSet)(); +exports.default = new (0, _pullstate.Store)({ + breakpoints: new Set(), + editor: null +}); + +},{"pullstate":"kvXHz","immer":"4sfoz","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"efckl":[function(require,module,exports) { +let workerURL = require("30f5f86e0e2207d"); +let bundleURL = require("a60aafb2ef3dc9c2"); +let url = bundleURL.getBundleURL("jhYBH") + "emulator.ab26e0f6.js" + "?" + Date.now(); +module.exports = workerURL(url, bundleURL.getOrigin(url), false); + +},{"30f5f86e0e2207d":"cn2gM","a60aafb2ef3dc9c2":"lgJ39"}],"cn2gM":[function(require,module,exports) { +"use strict"; +module.exports = function(workerUrl, origin, isESM) { + if (origin === self.location.origin) // If the worker bundle's url is on the same origin as the document, + // use the worker bundle's own url. + return workerUrl; + else { + // Otherwise, create a blob URL which loads the worker bundle with `importScripts`. + var source = isESM ? "import " + JSON.stringify(workerUrl) + ";" : "importScripts(" + JSON.stringify(workerUrl) + ");"; + return URL.createObjectURL(new Blob([ + source + ], { + type: "application/javascript" + })); + } +}; + +},{}],"lgJ39":[function(require,module,exports) { +"use strict"; +var bundleURL = {}; +function getBundleURLCached(id) { + var value = bundleURL[id]; + if (!value) { + value = getBundleURL(); + bundleURL[id] = value; + } + return value; +} +function getBundleURL() { + try { + throw new Error(); + } catch (err) { + var matches = ("" + err.stack).match(/(https?|file|ftp|(chrome|moz|safari-web)-extension):\/\/[^)\n]+/g); + if (matches) // The first two stack frames will be this function and getBundleURLCached. + // Use the 3rd one, which will be a runtime in the original bundle. + return getBaseURL(matches[2]); + } + return "/"; +} +function getBaseURL(url) { + return ("" + url).replace(/^((?:https?|file|ftp|(chrome|moz|safari-web)-extension):\/\/.+)\/[^/]+$/, "$1") + "/"; +} // TODO: Replace uses with `new URL(url).origin` when ie11 is no longer supported. +function getOrigin(url) { + var matches = ("" + url).match(/(https?|file|ftp|(chrome|moz|safari-web)-extension):\/\/[^/]+/); + if (!matches) throw new Error("Origin not found"); + return matches[0]; +} +exports.getBundleURL = getBundleURLCached; +exports.getBaseURL = getBaseURL; +exports.getOrigin = getOrigin; + +},{}],"9o24F":[function() {},{}],"km3Ru":[function(require,module,exports) { +"use strict"; +var Refresh = require("63f6881f72dea617"); +function debounce(func, delay) { + var args; + { + let timeout = undefined; + let lastTime = 0; + return function(args) { + // Call immediately if last call was more than the delay ago. + // Otherwise, set a timeout. This means the first call is fast + // (for the common case of a single update), and subsequent updates + // are batched. + let now = Date.now(); + if (now - lastTime > delay) { + lastTime = now; + func.call(null, args); + } else { + clearTimeout(timeout); + timeout = setTimeout(function() { + timeout = undefined; + lastTime = Date.now(); + func.call(null, args); + }, delay); + } + }; + } +} +var enqueueUpdate = debounce(function() { + Refresh.performReactRefresh(); +}, 30); // Everthing below is either adapted or copied from +// https://github.com/facebook/metro/blob/61de16bd1edd7e738dd0311c89555a644023ab2d/packages/metro/src/lib/polyfills/require.js +// MIT License - Copyright (c) Facebook, Inc. and its affiliates. +module.exports.prelude = function(module1) { + window.$RefreshReg$ = function(type, id) { + Refresh.register(type, module1.id + " " + id); + }; + window.$RefreshSig$ = Refresh.createSignatureFunctionForTransform; +}; +module.exports.postlude = function(module1) { + if (isReactRefreshBoundary(module1.exports)) { + registerExportsForReactRefresh(module1); + if (module1.hot) { + module1.hot.dispose(function(data) { + if (Refresh.hasUnrecoverableErrors()) window.location.reload(); + data.prevExports = module1.exports; + }); + module1.hot.accept(function(getParents) { + var prevExports = module1.hot.data.prevExports; + var nextExports = module1.exports; // Since we just executed the code for it, it's possible + // that the new exports make it ineligible for being a boundary. + var isNoLongerABoundary = !isReactRefreshBoundary(nextExports); // It can also become ineligible if its exports are incompatible + // with the previous exports. + // For example, if you add/remove/change exports, we'll want + // to re-execute the importing modules, and force those components + // to re-render. Similarly, if you convert a class component + // to a function, we want to invalidate the boundary. + var didInvalidate = shouldInvalidateReactRefreshBoundary(prevExports, nextExports); + if (isNoLongerABoundary || didInvalidate) { + // We'll be conservative. The only case in which we won't do a full + // reload is if all parent modules are also refresh boundaries. + // In that case we'll add them to the current queue. + var parents = getParents(); + if (parents.length === 0) { + // Looks like we bubbled to the root. Can't recover from that. + window.location.reload(); + return; + } + return parents; + } + enqueueUpdate(); + }); + } + } +}; +function isReactRefreshBoundary(exports) { + if (Refresh.isLikelyComponentType(exports)) return true; + if (exports == null || typeof exports !== "object") // Exit if we can't iterate over exports. + return false; + var hasExports = false; + var areAllExportsComponents = true; + let isESM = "__esModule" in exports; + for(var key in exports){ + hasExports = true; + if (key === "__esModule") continue; + var desc = Object.getOwnPropertyDescriptor(exports, key); + if (desc && desc.get && !isESM) // Don't invoke getters for CJS as they may have side effects. + return false; + var exportValue = exports[key]; + if (!Refresh.isLikelyComponentType(exportValue)) areAllExportsComponents = false; + } + return hasExports && areAllExportsComponents; +} +function shouldInvalidateReactRefreshBoundary(prevExports, nextExports) { + var prevSignature = getRefreshBoundarySignature(prevExports); + var nextSignature = getRefreshBoundarySignature(nextExports); + if (prevSignature.length !== nextSignature.length) return true; + for(var i = 0; i < nextSignature.length; i++){ + if (prevSignature[i] !== nextSignature[i]) return true; + } + return false; +} // When this signature changes, it's unsafe to stop at this refresh boundary. +function getRefreshBoundarySignature(exports) { + var signature = []; + signature.push(Refresh.getFamilyByType(exports)); + if (exports == null || typeof exports !== "object") // Exit if we can't iterate over exports. + // (This is important for legacy environments.) + return signature; + let isESM = "__esModule" in exports; + for(var key in exports){ + if (key === "__esModule") continue; + var desc = Object.getOwnPropertyDescriptor(exports, key); + if (desc && desc.get && !isESM) continue; + var exportValue = exports[key]; + signature.push(key); + signature.push(Refresh.getFamilyByType(exportValue)); + } + return signature; +} +function registerExportsForReactRefresh(module1) { + var exports = module1.exports, id = module1.id; + Refresh.register(exports, id + " %exports%"); + if (exports == null || typeof exports !== "object") // Exit if we can't iterate over exports. + // (This is important for legacy environments.) + return; + let isESM = "__esModule" in exports; + for(var key in exports){ + var desc = Object.getOwnPropertyDescriptor(exports, key); + if (desc && desc.get && !isESM) continue; + var exportValue = exports[key]; + Refresh.register(exportValue, id + " %exports% " + key); + } +} + +},{"63f6881f72dea617":"786KC"}],"34gdu":[function(require,module,exports) { +var $parcel$ReactRefreshHelpers$4ec9 = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js"); +var prevRefreshReg = window.$RefreshReg$; +var prevRefreshSig = window.$RefreshSig$; +$parcel$ReactRefreshHelpers$4ec9.prelude(module); + +try { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _jsxDevRuntime = require("react/jsx-dev-runtime"); +var _reactBulmaComponents = require("react-bulma-components"); +var _stringJs = require("../../utilities/string.js"); +var _framedBoxJs = require("../UI/FramedBox/FramedBox.js"); +var _framedBoxJsDefault = parcelHelpers.interopDefault(_framedBoxJs); +var _watchersJs = require("./Watchers.js"); +var _watchersJsDefault = parcelHelpers.interopDefault(_watchersJs); +var _emulatorJs = require("../../services/emulator.js"); +var _emulatorJsDefault = parcelHelpers.interopDefault(_emulatorJs); +var _compilerJs = require("../../services/compiler.js"); +var _compilerJsDefault = parcelHelpers.interopDefault(_compilerJs); +var _editorStoreJs = require("../../stores/editorStore.js"); +var _editorStoreJsDefault = parcelHelpers.interopDefault(_editorStoreJs); +var _compilerStoreJs = require("../../stores/compilerStore.js"); +var _compilerStoreJsDefault = parcelHelpers.interopDefault(_compilerStoreJs); +var _emulatorStoreJs = require("../../stores/emulatorStore.js"); +var _emulatorStoreJsDefault = parcelHelpers.interopDefault(_emulatorStoreJs); +var _s = $RefreshSig$(); +/* + * Compile source code into ROM image and run this image inside emulator + */ const buildAndRun = (editor, runningMode)=>{ + const unsubscribe = (0, _compilerStoreJsDefault.default).subscribe((state)=>state.isCompiling, (isCompiling, state)=>{ + if (isCompiling) return; + unsubscribe(); + if (!state.errors?.length) { + (0, _emulatorJsDefault.default).run(state.romDump, runningMode); + editor.focus(); + } + }); + (0, _compilerJsDefault.default)(editor.getValue()); +}; +function Debugger() { + _s(); + const editor = (0, _editorStoreJsDefault.default).useState((state)=>state.editor); + const isCompiling = (0, _compilerStoreJsDefault.default).useState((state)=>state.isCompiling); + const { emulatorError , isRunning , registers , runningMode , selectedRamBank } = (0, _emulatorStoreJsDefault.default).useState((state)=>({ + emulatorError: state.error, + isRunning: state.isRunning, + registers: state.registers, + runningMode: state.runningMode, + selectedRamBank: state.selectedRamBank + })); + const stack = registers.stack || []; + const registerPairs = (registers.indexBanks || []).map((indexBank)=>indexBank.reduce((acc, reg, idx, ar)=>idx % 2 ? [ + ...acc, + [ + ar[idx - 1], + reg + ] + ] : acc, [])); + return /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _jsxDevRuntime.Fragment), { + children: [ + emulatorError && /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Notification), { + color: "danger", + children: emulatorError + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 56, + columnNumber: 26 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("div", { + className: "buttons", + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Button), { + color: "success", + disabled: isCompiling || isRunning, + onClick: ()=>buildAndRun(editor, "run"), + children: "Build & Run" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 58, + columnNumber: 9 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Button), { + color: "info", + disabled: isCompiling || isRunning, + onClick: ()=>buildAndRun(editor, "debug"), + children: "Build & Debug" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 61, + columnNumber: 9 + }, this), + isRunning && /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Button), { + color: "danger", + onClick: ()=>(0, _emulatorJsDefault.default).stop(), + children: "Stop" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 64, + columnNumber: 24 + }, this), + isRunning && runningMode === "debug" && /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Button), { + onClick: ()=>(0, _emulatorJsDefault.default).stepOver(), + children: "Step over" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 65, + columnNumber: 53 + }, this), + isRunning && runningMode === "debug" && /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Button), { + onClick: ()=>(0, _emulatorJsDefault.default).stepInto(), + children: "Step into" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 66, + columnNumber: 53 + }, this), + isRunning && runningMode === "debug" && /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Button), { + onClick: ()=>(0, _emulatorJsDefault.default).continueExec(), + children: "Continue" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 67, + columnNumber: 53 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 57, + columnNumber: 7 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Columns), { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Columns).Column, { + size: 3, + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _framedBoxJsDefault.default), { + title: "Miscellaneous", + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Table), { + bordered: false, + size: "narrow", + striped: false, + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tbody", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(registers.acc || 0, 2) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 75, + columnNumber: 19 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: "ACC" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 76, + columnNumber: 23 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 76, + columnNumber: 19 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 74, + columnNumber: 17 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(registers.carry || 0, 2) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 79, + columnNumber: 19 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: "CY" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 80, + columnNumber: 23 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 80, + columnNumber: 19 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 78, + columnNumber: 17 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(selectedRamBank || 0, 2) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 83, + columnNumber: 19 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: "Mem bank" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 84, + columnNumber: 23 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 84, + columnNumber: 19 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 82, + columnNumber: 17 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(registers.selectedRegisterBank || 0, 2) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 87, + columnNumber: 19 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: "Reg bank" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 88, + columnNumber: 23 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 88, + columnNumber: 19 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 86, + columnNumber: 17 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(registers.selectedRomBank || 0, 2) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 91, + columnNumber: 19 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: "ROM bank" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 92, + columnNumber: 23 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 92, + columnNumber: 19 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 90, + columnNumber: 17 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(registers.pc || 0, 3) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 95, + columnNumber: 19 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: "PC" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 96, + columnNumber: 23 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 96, + columnNumber: 19 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 94, + columnNumber: 17 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(registers.sp || 0, 2) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 99, + columnNumber: 19 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: "SP" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 100, + columnNumber: 23 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 100, + columnNumber: 19 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 98, + columnNumber: 17 + }, this), + stack.map((stackValue, idx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(stackValue || 0, 3) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 105, + columnNumber: 23 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: `S${idx}` + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 106, + columnNumber: 27 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 106, + columnNumber: 23 + }, this) + ] + }, `stack-${idx}`, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 104, + columnNumber: 21 + }, this)) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 73, + columnNumber: 15 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 72, + columnNumber: 13 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 71, + columnNumber: 11 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 70, + columnNumber: 9 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Columns).Column, { + size: 6, + children: registerPairs.map((indexBank, bankIdx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _framedBoxJsDefault.default), { + active: bankIdx === registers.selectedRegisterBank, + title: `Registers #${bankIdx}`, + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Table), { + bordered: false, + striped: false, + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tbody", { + children: indexBank.map(([reg1, reg2], idx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(reg1, 2) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 123, + columnNumber: 27 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: `RR${(0, _stringJs.pad)(idx * 2, 2)}` + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 124, + columnNumber: 31 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 124, + columnNumber: 27 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(reg2, 2) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 125, + columnNumber: 27 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: `RR${(0, _stringJs.pad)(idx * 2 + 1, 2)}` + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 126, + columnNumber: 31 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 126, + columnNumber: 27 + }, this) + ] + }, `reg-${bankIdx}-${idx}`, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 122, + columnNumber: 25 + }, this)) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 119, + columnNumber: 19 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 118, + columnNumber: 17 + }, this) + }, `reg-bank-${bankIdx}`, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 117, + columnNumber: 15 + }, this)) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 114, + columnNumber: 9 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Columns).Column, { + size: 3, + children: registerPairs.map((indexBank, bankIdx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _framedBoxJsDefault.default), { + active: bankIdx === registers.selectedRegisterBank, + title: `Register pairs #${bankIdx}`, + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Table), { + bordered: false, + striped: false, + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tbody", { + children: indexBank.map(([reg1, reg2], idx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: (0, _stringJs.padHex)(reg1 << 4 | reg2, 2) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 145, + columnNumber: 27 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Tag), { + children: `R${idx}` + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 146, + columnNumber: 31 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 146, + columnNumber: 27 + }, this) + ] + }, `regPair-${bankIdx}-${idx}`, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 144, + columnNumber: 25 + }, this)) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 141, + columnNumber: 19 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 140, + columnNumber: 17 + }, this) + }, `regPair-bank-${bankIdx}`, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 139, + columnNumber: 15 + }, this)) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 136, + columnNumber: 9 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 69, + columnNumber: 7 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Level), { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _framedBoxJsDefault.default), { + title: "Watchers", + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _watchersJsDefault.default), {}, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 159, + columnNumber: 11 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 158, + columnNumber: 9 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Debugger.js", + lineNumber: 157, + columnNumber: 7 + }, this) + ] + }, void 0, true); +} +exports.default = Debugger; +_s(Debugger, "Ugu4eKUeTyWhxIlZ8PFRw5TcUK4="); +_c = Debugger; +var _c; +$RefreshReg$(_c, "Debugger"); + + $parcel$ReactRefreshHelpers$4ec9.postlude(module); +} finally { + window.$RefreshReg$ = prevRefreshReg; + window.$RefreshSig$ = prevRefreshSig; +} +},{"react/jsx-dev-runtime":"iTorj","react-bulma-components":"hZ2YC","../../utilities/string.js":"31Uj4","../UI/FramedBox/FramedBox.js":"lYeYn","./Watchers.js":"a4jKv","../../services/emulator.js":"aWnfx","../../services/compiler.js":"6eL9i","../../stores/editorStore.js":"egduw","../../stores/compilerStore.js":"cJTIf","../../stores/emulatorStore.js":"6XWYU","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"km3Ru"}],"31Uj4":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +parcelHelpers.export(exports, "toHex", ()=>toHex); +parcelHelpers.export(exports, "pad", ()=>pad); +parcelHelpers.export(exports, "padHex", ()=>padHex); +const toHex = (str)=>(str == null ? "" : str).toString(16).toUpperCase(); +const pad = (str, padSize)=>("0".repeat(padSize) + (str || "").toString()).slice(-padSize); +const padHex = (str, padSize)=>pad(toHex(str), padSize); + +},{"@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"lYeYn":[function(require,module,exports) { +var $parcel$ReactRefreshHelpers$fc10 = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js"); +var prevRefreshReg = window.$RefreshReg$; +var prevRefreshSig = window.$RefreshSig$; +$parcel$ReactRefreshHelpers$fc10.prelude(module); + +try { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _jsxDevRuntime = require("react/jsx-dev-runtime"); +var _react = require("react"); +var _reactDefault = parcelHelpers.interopDefault(_react); +var _classnames = require("classnames"); +var _classnamesDefault = parcelHelpers.interopDefault(_classnames); +var _propTypes = require("prop-types"); +var _propTypesDefault = parcelHelpers.interopDefault(_propTypes); +var _framedBoxCss = require("./FramedBox.css"); +function FramedBox({ active , children , narrow , title }) { + return /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("div", { + className: (0, _classnamesDefault.default)("framedBox", { + active, + "is-inline-block": narrow !== undefined + }), + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("h1", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("span", { + children: title + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/UI/FramedBox/FramedBox.js", + lineNumber: 10, + columnNumber: 11 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/UI/FramedBox/FramedBox.js", + lineNumber: 10, + columnNumber: 7 + }, this), + children + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/UI/FramedBox/FramedBox.js", + lineNumber: 9, + columnNumber: 5 + }, this); +} +_c = FramedBox; +FramedBox.propTypes = { + active: (0, _propTypesDefault.default).bool, + children: (0, _propTypesDefault.default).oneOfType([ + (0, _propTypesDefault.default).arrayOf((0, _propTypesDefault.default).node), + (0, _propTypesDefault.default).node + ]).isRequired, + narrow: (0, _propTypesDefault.default).bool, + title: (0, _propTypesDefault.default).string.isRequired +}; +FramedBox.defaultProps = { + active: false, + narrow: false +}; +exports.default = FramedBox; +var _c; +$RefreshReg$(_c, "FramedBox"); + + $parcel$ReactRefreshHelpers$fc10.postlude(module); +} finally { + window.$RefreshReg$ = prevRefreshReg; + window.$RefreshSig$ = prevRefreshSig; +} +},{"react/jsx-dev-runtime":"iTorj","react":"21dqq","classnames":"jocGM","prop-types":"7wKI2","./FramedBox.css":"40xrE","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"km3Ru"}],"jocGM":[function(require,module,exports) { +/*! + Copyright (c) 2018 Jed Watson. + Licensed under the MIT License (MIT), see + http://jedwatson.github.io/classnames +*/ /* global define */ (function() { + "use strict"; + var hasOwn = {}.hasOwnProperty; + var nativeCodeString = "[native code]"; + function classNames() { + var classes = []; + for(var i = 0; i < arguments.length; i++){ + var arg = arguments[i]; + if (!arg) continue; + var argType = typeof arg; + if (argType === "string" || argType === "number") classes.push(arg); + else if (Array.isArray(arg)) { + if (arg.length) { + var inner = classNames.apply(null, arg); + if (inner) classes.push(inner); + } + } else if (argType === "object") { + if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) { + classes.push(arg.toString()); + continue; + } + for(var key in arg)if (hasOwn.call(arg, key) && arg[key]) classes.push(key); + } + } + return classes.join(" "); + } + if (0, module.exports) { + classNames.default = classNames; + module.exports = classNames; + } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) // register as 'classnames', consistent with npm package name + define("classnames", [], function() { + return classNames; + }); + else window.classNames = classNames; +})(); + +},{}],"40xrE":[function() {},{}],"a4jKv":[function(require,module,exports) { +var $parcel$ReactRefreshHelpers$9bae = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js"); +var prevRefreshReg = window.$RefreshReg$; +var prevRefreshSig = window.$RefreshSig$; +$parcel$ReactRefreshHelpers$9bae.prelude(module); + +try { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _jsxDevRuntime = require("react/jsx-dev-runtime"); +var _react = require("react"); +var _reactBulmaComponents = require("react-bulma-components"); +var _emulatorStoreJs = require("../../stores/emulatorStore.js"); +var _emulatorStoreJsDefault = parcelHelpers.interopDefault(_emulatorStoreJs); +var _stringJs = require("../../utilities/string.js"); +var _s = $RefreshSig$(); +const WATCHERS_STORAGE_KEY = "watchers"; +function Memory() { + _s(); + const [watchName, setWatchName] = (0, _react.useState)(""); + const [watchSpec, setWatchSpec] = (0, _react.useState)(""); + const [watchers, setWatchers] = (0, _react.useState)(()=>JSON.parse(localStorage.getItem(WATCHERS_STORAGE_KEY)) || []); + const { isRunning , memory , registers } = (0, _emulatorStoreJsDefault.default).useState((state)=>({ + isRunning: state.isRunning, + memory: state.ram, + registers: state.registers + })); + (0, _react.useEffect)(()=>localStorage.setItem(WATCHERS_STORAGE_KEY, JSON.stringify(watchers)), [ + watchers + ]); + const handleAddWatcherClick = ()=>{ + setWatchers([ + ...watchers, + { + name: watchName, + spec: watchSpec + } + ]); + setWatchSpec(""); + setWatchName(""); + }; + const renderedWatchers = new Map(); + const renderWatcher = (name, spec)=>{ + if (!spec.includes(",")) { + const [, var1, op, var2] = spec.match(/(\w+)\s*([+\-%*])\s*(\w+)/); + if (!renderedWatchers.has(var1)) renderWatcher(var1, watchers.find((watcher)=>watcher.name === var1).spec); + if (!renderedWatchers.has(var2)) renderWatcher(var2, watchers.find((watcher)=>watcher.name === var2).spec); + const val1 = parseInt(renderedWatchers.get(var1), 16); + const val2 = parseInt(renderedWatchers.get(var2), 16); + let computedValue = 0; + switch(op){ + case "%": + computedValue = val1 % val2; + break; + case "+": + computedValue = val1 + val2; + break; + case "-": + computedValue = val1 - val2; + break; + case "*": + computedValue = val1 * val2; + break; + default: + break; + } + const renderedValue = (0, _stringJs.padHex)(computedValue || 0, 4); + renderedWatchers.set(name, renderedValue); + return; + } + const parts = spec.split(",").map((part)=>part.trim()); + const words = parts.map((part)=>{ + const [, regNo] = part.match(/rr(\d+)/) || []; + if (regNo) return (0, _stringJs.toHex)(registers.indexBanks?.[registers.selectedRegisterBank][regNo]); + // [7F]:s0 or [5A]:F + const [, bankNo, memRegNo, charSpec] = part.match(/\[(\d)([0-9A-F])]:((?:s\d)|(?:[0-9A-F]))/); + if (charSpec[0] === "s") return (0, _stringJs.toHex)(memory[Number(bankNo)]?.registers[parseInt(memRegNo, 16)]?.status[Number(charSpec[1])] || 0); + return (0, _stringJs.toHex)(memory[Number(bankNo)]?.registers[parseInt(memRegNo, 16)]?.main[parseInt(charSpec, 16)] || 0); + }); + const renderedValue1 = words.join(""); + renderedWatchers.set(name, renderedValue1); + }; + for (const { name , spec } of watchers){ + if (renderedWatchers.has(name)) continue; + renderWatcher(name, spec); + } + return /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Table), { + bordered: false, + size: "narrow", + striped: false, + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tbody", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Form).Input, { + onChange: (e)=>setWatchName(e.target.value), + placeholder: "Name", + type: "text", + value: watchName + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 98, + columnNumber: 13 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 97, + columnNumber: 11 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Form).Input, { + onChange: (e)=>setWatchSpec(e.target.value), + placeholder: "Spec", + type: "text", + value: watchSpec + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 101, + columnNumber: 13 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 100, + columnNumber: 11 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", {}, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 103, + columnNumber: 11 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Button), { + color: "success", + onClick: handleAddWatcherClick, + children: "+" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 105, + columnNumber: 13 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 104, + columnNumber: 11 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 96, + columnNumber: 9 + }, this), + watchers.map(({ name , spec }, watcherIdx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("tr", { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: name + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 111, + columnNumber: 15 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: spec + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 112, + columnNumber: 15 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: isRunning && renderedWatchers.get(name) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 113, + columnNumber: 15 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("td", { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Button), { + color: "warning", + onClick: ()=>setWatchers(watchers.filter((_, idx)=>idx !== watcherIdx)), + children: "-" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 115, + columnNumber: 17 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 114, + columnNumber: 15 + }, this) + ] + }, `watcher-${watcherIdx}`, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 110, + columnNumber: 13 + }, this)) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 95, + columnNumber: 7 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Watchers.js", + lineNumber: 94, + columnNumber: 5 + }, this); +} +exports.default = Memory; +_s(Memory, "9In6lx5zFh/yfuHtMIpDyziU26Y="); +_c = Memory; +var _c; +$RefreshReg$(_c, "Memory"); + + $parcel$ReactRefreshHelpers$9bae.postlude(module); +} finally { + window.$RefreshReg$ = prevRefreshReg; + window.$RefreshSig$ = prevRefreshSig; +} +},{"react/jsx-dev-runtime":"iTorj","react":"21dqq","react-bulma-components":"hZ2YC","../../stores/emulatorStore.js":"6XWYU","../../utilities/string.js":"31Uj4","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"km3Ru"}],"6eL9i":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _compilerStoreJs = require("../stores/compilerStore.js"); +var _compilerStoreJsDefault = parcelHelpers.interopDefault(_compilerStoreJs); +const worker = new Worker(require("a38d9b6da67e202f")); +worker.onmessage = ({ data: { errors , roms } })=>{ + const romOffsetBySourceCodePerBank = []; + const sourceCodeLineByRomOffsetPerBank = []; + if (roms) for (const { sourceMap } of roms){ + const romOffsetBySourceCodeMap = new Map(); + const sourceCodeLineByRomOffsetMap = new Map(); + for (const { line , romOffset } of sourceMap){ + romOffsetBySourceCodeMap.set(line, romOffset); + sourceCodeLineByRomOffsetMap.set(romOffset, line); + } + romOffsetBySourceCodePerBank.push(romOffsetBySourceCodeMap); + sourceCodeLineByRomOffsetPerBank.push(sourceCodeLineByRomOffsetMap); + } + (0, _compilerStoreJsDefault.default).update((state)=>{ + state.isCompiling = false; + state.errors = errors; + state.romDump = roms?.map(({ data })=>data); + state.romOffsetBySourceCodePerBank = romOffsetBySourceCodePerBank; + state.sourceCodeLineByRomOffsetPerBank = sourceCodeLineByRomOffsetPerBank; + }); +}; +function compile(sourceCode) { + (0, _compilerStoreJsDefault.default).update((state)=>{ + state.isCompiling = true; + state.errors = []; + state.romDump = null; + state.romOffsetBySourceCodePerBank = []; + state.sourceCodeLineByRomOffsetPerBank = []; + }); + worker.postMessage(sourceCode); +} +exports.default = compile; + +},{"../stores/compilerStore.js":"cJTIf","a38d9b6da67e202f":"7IyY6","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"7IyY6":[function(require,module,exports) { +let workerURL = require("a54d8dd1ff70f966"); +let bundleURL = require("63da8afb13de907b"); +let url = bundleURL.getBundleURL("jhYBH") + "compiler.c53983db.js" + "?" + Date.now(); +module.exports = workerURL(url, bundleURL.getOrigin(url), false); + +},{"a54d8dd1ff70f966":"cn2gM","63da8afb13de907b":"lgJ39"}],"eyfBa":[function(require,module,exports) { +var $parcel$ReactRefreshHelpers$1a8b = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js"); +var prevRefreshReg = window.$RefreshReg$; +var prevRefreshSig = window.$RefreshSig$; +$parcel$ReactRefreshHelpers$1a8b.prelude(module); + +try { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _jsxDevRuntime = require("react/jsx-dev-runtime"); +var _reactBulmaComponents = require("react-bulma-components"); +var _iologEntryFormatterJs = require("../../utilities/IOLogEntryFormatter.js"); +var _iologEntryFormatterJsDefault = parcelHelpers.interopDefault(_iologEntryFormatterJs); +var _emulatorStoreJs = require("../../stores/emulatorStore.js"); +var _emulatorStoreJsDefault = parcelHelpers.interopDefault(_emulatorStoreJs); +var _s = $RefreshSig$(); +function IO() { + _s(); + const IOLog = (0, _emulatorStoreJsDefault.default).useState((state)=>state.IOLog); + return /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Panel), { + children: IOLog.map((entry, idx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Panel).Block, { + children: (0, _iologEntryFormatterJsDefault.default)(entry) + }, `io-log-entry-${idx}`, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/IO.js", + lineNumber: 11, + columnNumber: 34 + }, this)) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/IO.js", + lineNumber: 10, + columnNumber: 5 + }, this); +} +exports.default = IO; +_s(IO, "4OUzdAcfUchWHzY9GNLR6PrZ4hk="); +_c = IO; +var _c; +$RefreshReg$(_c, "IO"); + + $parcel$ReactRefreshHelpers$1a8b.postlude(module); +} finally { + window.$RefreshReg$ = prevRefreshReg; + window.$RefreshSig$ = prevRefreshSig; +} +},{"react/jsx-dev-runtime":"iTorj","react-bulma-components":"hZ2YC","../../utilities/IOLogEntryFormatter.js":"13Q54","../../stores/emulatorStore.js":"6XWYU","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"km3Ru"}],"13Q54":[function(require,module,exports) { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _stringJs = require("./string.js"); +exports.default = ({ address , data , type })=>`[${type}] Output at address ${address} has been set to 0x${(0, _stringJs.toHex)(data)}`; + +},{"./string.js":"31Uj4","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3"}],"kGKoX":[function(require,module,exports) { +var $parcel$ReactRefreshHelpers$057f = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js"); +var prevRefreshReg = window.$RefreshReg$; +var prevRefreshSig = window.$RefreshSig$; +$parcel$ReactRefreshHelpers$057f.prelude(module); + +try { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _jsxDevRuntime = require("react/jsx-dev-runtime"); +var _react = require("react"); +var _reactBulmaComponents = require("react-bulma-components"); +var _emulatorStoreJs = require("../../../stores/emulatorStore.js"); +var _emulatorStoreJsDefault = parcelHelpers.interopDefault(_emulatorStoreJs); +var _registerJs = require("./Register.js"); +var _registerJsDefault = parcelHelpers.interopDefault(_registerJs); +var _framedBoxJs = require("../../UI/FramedBox/FramedBox.js"); +var _framedBoxJsDefault = parcelHelpers.interopDefault(_framedBoxJs); +var _memoryCss = require("./Memory.css"); +var _s = $RefreshSig$(); +function Memory() { + _s(); + const [uploadedRAMDumpName, setUploadedRAMDumpName] = (0, _react.useState)(""); + const { ram , selectedRamBank } = (0, _emulatorStoreJsDefault.default).useState((state)=>({ + ram: state.ram, + selectedRamBank: state.selectedRamBank + })); + const uploadRAMDump = async (file)=>{ + const dump = await file.text(); + (0, _emulatorStoreJsDefault.default).update((state)=>{ + state.initialRam = JSON.parse(dump); + }); + setUploadedRAMDumpName(file.name); + }; + return /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _jsxDevRuntime.Fragment), { + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("div", { + className: "mb-2", + children: [ + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Form).InputFile, { + label: "Initial RAM dump...", + onChange: (e)=>uploadRAMDump(e.target.files[0]) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Memory/Memory.js", + lineNumber: 30, + columnNumber: 9 + }, this), + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("span", { + children: [ + "Loaded dump:", + uploadedRAMDumpName || "none" + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Memory/Memory.js", + lineNumber: 31, + columnNumber: 9 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Memory/Memory.js", + lineNumber: 29, + columnNumber: 7 + }, this), + ram.map(({ registers , selectedCharacter , selectedRegister }, bankIdx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _framedBoxJsDefault.default), { + narrow: true, + active: selectedRamBank === bankIdx, + title: `Bank #${bankIdx}`, + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("div", { + className: "memoryBank", + children: registers.map((reg, regIdx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("div", { + children: [ + regIdx && regIdx % 4 === 0 ? /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("div", { + className: "registerSeparator" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Memory/Memory.js", + lineNumber: 45, + columnNumber: 27 + }, this) : null, + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _registerJsDefault.default), { + data: reg, + selectedCharacter: selectedRegister === regIdx ? selectedCharacter : undefined + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Memory/Memory.js", + lineNumber: 48, + columnNumber: 21 + }, this) + ] + }, `ram-bank-${bankIdx}-reg-${regIdx}`, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Memory/Memory.js", + lineNumber: 42, + columnNumber: 19 + }, this)) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Memory/Memory.js", + lineNumber: 39, + columnNumber: 13 + }, this) + }, `ram-bank-${bankIdx}`, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Memory/Memory.js", + lineNumber: 38, + columnNumber: 11 + }, this)) + ] + }, void 0, true); +} +exports.default = Memory; +_s(Memory, "T8trpDzQ3jxnvp+uGmZai6adAxc="); +_c = Memory; +var _c; +$RefreshReg$(_c, "Memory"); + + $parcel$ReactRefreshHelpers$057f.postlude(module); +} finally { + window.$RefreshReg$ = prevRefreshReg; + window.$RefreshSig$ = prevRefreshSig; +} +},{"react/jsx-dev-runtime":"iTorj","react":"21dqq","react-bulma-components":"hZ2YC","../../../stores/emulatorStore.js":"6XWYU","./Register.js":"fKGqM","../../UI/FramedBox/FramedBox.js":"lYeYn","./Memory.css":"8emjx","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"km3Ru"}],"fKGqM":[function(require,module,exports) { +var $parcel$ReactRefreshHelpers$df8c = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js"); +var prevRefreshReg = window.$RefreshReg$; +var prevRefreshSig = window.$RefreshSig$; +$parcel$ReactRefreshHelpers$df8c.prelude(module); + +try { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _jsxDevRuntime = require("react/jsx-dev-runtime"); +var _propTypes = require("prop-types"); +var _propTypesDefault = parcelHelpers.interopDefault(_propTypes); +var _react = require("react"); +var _reactDefault = parcelHelpers.interopDefault(_react); +var _stringJs = require("../../../utilities/string.js"); +var _registerCss = require("./Register.css"); +const wrapSelectedChar = (val, idx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("span", { + className: "selectedMemoryChar", + children: (0, _stringJs.toHex)(val) + }, `selected-memory-char-${idx}`, false, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Memory/Register.js", + lineNumber: 9, + columnNumber: 3 + }, undefined); +function Register({ data , selectedCharacter }) { + const statusChars = data.status.map((0, _stringJs.toHex)).join(""); + const mainChars = selectedCharacter !== undefined ? data.main.map((val, charIdx)=>charIdx === selectedCharacter ? wrapSelectedChar(val, charIdx) : (0, _stringJs.toHex)(val)) : data.main.map((0, _stringJs.toHex)); + return /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("div", { + children: [ + mainChars, + "|", + statusChars + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Debugger/Memory/Register.js", + lineNumber: 19, + columnNumber: 5 + }, this); +} +_c = Register; +Register.propTypes = { + data: (0, _propTypesDefault.default).shape({ + main: (0, _propTypesDefault.default).arrayOf((0, _propTypesDefault.default).number), + status: (0, _propTypesDefault.default).arrayOf((0, _propTypesDefault.default).number) + }).isRequired, + selectedCharacter: (0, _propTypesDefault.default).number +}; +Register.defaultProps = { + selectedCharacter: undefined +}; +exports.default = Register; +var _c; +$RefreshReg$(_c, "Register"); + + $parcel$ReactRefreshHelpers$df8c.postlude(module); +} finally { + window.$RefreshReg$ = prevRefreshReg; + window.$RefreshSig$ = prevRefreshSig; +} +},{"react/jsx-dev-runtime":"iTorj","prop-types":"7wKI2","react":"21dqq","../../../utilities/string.js":"31Uj4","./Register.css":"2lSY4","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"km3Ru"}],"2lSY4":[function() {},{}],"8emjx":[function() {},{}],"gwJfF":[function(require,module,exports) { +var $parcel$ReactRefreshHelpers$7e70 = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js"); +var prevRefreshReg = window.$RefreshReg$; +var prevRefreshSig = window.$RefreshSig$; +$parcel$ReactRefreshHelpers$7e70.prelude(module); + +try { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _jsxDevRuntime = require("react/jsx-dev-runtime"); +var _react = require("react"); +var _reactDefault = parcelHelpers.interopDefault(_react); +var _reactBulmaComponents = require("react-bulma-components"); +function Footer() { + return /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Footer), { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Container), { + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Content), { + style: { + textAlign: "center" + }, + children: /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("p", { + children: [ + "Mark Ablovatskii,", + " ", + /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("a", { + href: "mailto:mark.ablov@gmail.com", + children: "mark.ablov@gmail.com" + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Footer.js", + lineNumber: 12, + columnNumber: 13 + }, this) + ] + }, void 0, true, { + fileName: "packages/i40xx-emu-ui/src/components/Footer.js", + lineNumber: 9, + columnNumber: 11 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Footer.js", + lineNumber: 8, + columnNumber: 9 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Footer.js", + lineNumber: 7, + columnNumber: 7 + }, this) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/Footer.js", + lineNumber: 6, + columnNumber: 5 + }, this); +} +_c = Footer; +exports.default = Footer; +var _c; +$RefreshReg$(_c, "Footer"); + + $parcel$ReactRefreshHelpers$7e70.postlude(module); +} finally { + window.$RefreshReg$ = prevRefreshReg; + window.$RefreshSig$ = prevRefreshSig; +} +},{"react/jsx-dev-runtime":"iTorj","react":"21dqq","react-bulma-components":"hZ2YC","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"km3Ru"}],"fl3NL":[function(require,module,exports) { +var $parcel$ReactRefreshHelpers$a649 = require("@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js"); +var prevRefreshReg = window.$RefreshReg$; +var prevRefreshSig = window.$RefreshSig$; +$parcel$ReactRefreshHelpers$a649.prelude(module); + +try { +var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); +parcelHelpers.defineInteropFlag(exports); +var _jsxDevRuntime = require("react/jsx-dev-runtime"); +var _reactBulmaComponents = require("react-bulma-components"); +var _compilerStoreJs = require("../stores/compilerStore.js"); +var _compilerStoreJsDefault = parcelHelpers.interopDefault(_compilerStoreJs); +var _s = $RefreshSig$(); +function CompilerInfo() { + _s(); + const compilerErrors = (0, _compilerStoreJsDefault.default).useState((state)=>state.errors); + return compilerErrors?.length ? /*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)((0, _reactBulmaComponents.Notification), { + color: "danger", + children: compilerErrors.map(({ text }, idx)=>/*#__PURE__*/ (0, _jsxDevRuntime.jsxDEV)("div", { + children: text + }, `compiler-error-${idx}`, false, { + fileName: "packages/i40xx-emu-ui/src/components/CompilerInfo.js", + lineNumber: 10, + columnNumber: 48 + }, this)) + }, void 0, false, { + fileName: "packages/i40xx-emu-ui/src/components/CompilerInfo.js", + lineNumber: 9, + columnNumber: 7 + }, this) : null; +} +exports.default = CompilerInfo; +_s(CompilerInfo, "Tgy6R6guSGSdQqjg7Sm08x+KN+0="); +_c = CompilerInfo; +var _c; +$RefreshReg$(_c, "CompilerInfo"); + + $parcel$ReactRefreshHelpers$a649.postlude(module); +} finally { + window.$RefreshReg$ = prevRefreshReg; + window.$RefreshSig$ = prevRefreshSig; +} +},{"react/jsx-dev-runtime":"iTorj","react-bulma-components":"hZ2YC","../stores/compilerStore.js":"cJTIf","@parcel/transformer-js/src/esmodule-helpers.js":"gkKU3","@parcel/transformer-react-refresh-wrap/lib/helpers/helpers.js":"km3Ru"}],"1d3F3":[function() {},{}]},["1xC6H","gBs9R","lTjnB"], "lTjnB", "parcelRequired6a3") + +//# sourceMappingURL=index.95eae892.js.map diff --git a/index.9b3d37c0.css b/index.9b3d37c0.css new file mode 100644 index 0000000..6fedcb0 --- /dev/null +++ b/index.9b3d37c0.css @@ -0,0 +1,2 @@ +.ace_gutter-cell.ace_breakpoint{border-radius:20px 0 0 20px;box-shadow:inset 0 0 1px 1px red}.pagination-previous,.pagination-next,.pagination-link,.pagination-ellipsis,.file-cta,.file-name,.select select,.textarea,.input,.button{-webkit-appearance:none;-moz-appearance:none;box-shadow:none;height:2.5em;vertical-align:top;border:1px solid #0000;border-radius:4px;justify-content:flex-start;align-items:center;padding:calc(.5em - 1px) calc(.75em - 1px);font-size:1rem;line-height:1.5;display:inline-flex;position:relative}.pagination-previous:focus,.pagination-next:focus,.pagination-link:focus,.pagination-ellipsis:focus,.file-cta:focus,.file-name:focus,.select select:focus,.textarea:focus,.input:focus,.button:focus,.is-focused.pagination-previous,.is-focused.pagination-next,.is-focused.pagination-link,.is-focused.pagination-ellipsis,.is-focused.file-cta,.is-focused.file-name,.select select.is-focused,.is-focused.textarea,.is-focused.input,.is-focused.button,.pagination-previous:active,.pagination-next:active,.pagination-link:active,.pagination-ellipsis:active,.file-cta:active,.file-name:active,.select select:active,.textarea:active,.input:active,.button:active,.is-active.pagination-previous,.is-active.pagination-next,.is-active.pagination-link,.is-active.pagination-ellipsis,.is-active.file-cta,.is-active.file-name,.select select.is-active,.is-active.textarea,.is-active.input,.is-active.button{outline:none}[disabled].pagination-previous,[disabled].pagination-next,[disabled].pagination-link,[disabled].pagination-ellipsis,[disabled].file-cta,[disabled].file-name,.select select[disabled],[disabled].textarea,[disabled].input,[disabled].button,fieldset[disabled] .pagination-previous,fieldset[disabled] .pagination-next,fieldset[disabled] .pagination-link,fieldset[disabled] .pagination-ellipsis,fieldset[disabled] .file-cta,fieldset[disabled] .file-name,fieldset[disabled] .select select,.select fieldset[disabled] select,fieldset[disabled] .textarea,fieldset[disabled] .input,fieldset[disabled] .button{cursor:not-allowed}.is-unselectable,.tabs,.pagination-previous,.pagination-next,.pagination-link,.pagination-ellipsis,.breadcrumb,.file,.button{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}.navbar-link:not(.is-arrowless):after,.select:not(.is-multiple):not(.is-loading):after{content:" ";height:.625em;pointer-events:none;transform-origin:50%;width:.625em;border-top:0;border-bottom:3px solid #0000;border-left:3px solid #0000;border-right:0;border-radius:2px;margin-top:-.4375em;display:block;position:absolute;top:50%;transform:rotate(-45deg)}.tabs:not(:last-child),.pagination:not(:last-child),.message:not(:last-child),.level:not(:last-child),.breadcrumb:not(:last-child),.block:not(:last-child),.title:not(:last-child),.subtitle:not(:last-child),.table-container:not(:last-child),.table:not(:last-child),.progress:not(:last-child),.notification:not(:last-child),.content:not(:last-child),.box:not(:last-child){margin-bottom:1.5rem}.modal-close,.delete{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;-webkit-appearance:none;-moz-appearance:none;cursor:pointer;pointer-events:auto;height:20px;max-height:20px;max-width:20px;min-height:20px;min-width:20px;vertical-align:top;width:20px;background-color:#0a0a0a33;border:none;border-radius:9999px;outline:none;flex-grow:0;flex-shrink:0;font-size:0;display:inline-block;position:relative}.modal-close:before,.delete:before,.modal-close:after,.delete:after{content:"";transform-origin:50%;background-color:#fff;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%)translateY(-50%)rotate(45deg)}.modal-close:before,.delete:before{height:2px;width:50%}.modal-close:after,.delete:after{height:50%;width:2px}.modal-close:hover,.delete:hover,.modal-close:focus,.delete:focus{background-color:#0a0a0a4d}.modal-close:active,.delete:active{background-color:#0a0a0a66}.is-small.modal-close,.is-small.delete{height:16px;max-height:16px;max-width:16px;min-height:16px;min-width:16px;width:16px}.is-medium.modal-close,.is-medium.delete{height:24px;max-height:24px;max-width:24px;min-height:24px;min-width:24px;width:24px}.is-large.modal-close,.is-large.delete{height:32px;max-height:32px;max-width:32px;min-height:32px;min-width:32px;width:32px}.control.is-loading:after,.select.is-loading:after,.loader,.button.is-loading:after{content:"";height:1em;width:1em;border:2px solid #0000;border-color:#0000 #0000 #dbdbdb #dbdbdb;border-radius:9999px;animation:.5s linear infinite spinAround;display:block;position:relative}.hero-video,.is-overlay,.modal-background,.modal,.image.is-square img,.image.is-square .has-ratio,.image.is-1by1 img,.image.is-1by1 .has-ratio,.image.is-5by4 img,.image.is-5by4 .has-ratio,.image.is-4by3 img,.image.is-4by3 .has-ratio,.image.is-3by2 img,.image.is-3by2 .has-ratio,.image.is-5by3 img,.image.is-5by3 .has-ratio,.image.is-16by9 img,.image.is-16by9 .has-ratio,.image.is-2by1 img,.image.is-2by1 .has-ratio,.image.is-3by1 img,.image.is-3by1 .has-ratio,.image.is-4by5 img,.image.is-4by5 .has-ratio,.image.is-3by4 img,.image.is-3by4 .has-ratio,.image.is-2by3 img,.image.is-2by3 .has-ratio,.image.is-3by5 img,.image.is-3by5 .has-ratio,.image.is-9by16 img,.image.is-9by16 .has-ratio,.image.is-1by2 img,.image.is-1by2 .has-ratio,.image.is-1by3 img,.image.is-1by3 .has-ratio{position:absolute;inset:0}.navbar-burger{-webkit-appearance:none;appearance:none;color:currentColor;background:0 0;border:none;margin:0;padding:0;font-family:inherit;font-size:1em}html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}ul{list-style:none}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,:before,:after{box-sizing:inherit}img,video{height:auto;max-width:100%}iframe{border:0}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}td:not([align]),th:not([align]){text-align:inherit}html{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;min-width:300px;text-rendering:optimizelegibility;text-size-adjust:100%;background-color:#fff;font-size:16px;overflow-x:hidden;overflow-y:scroll}article,aside,figure,footer,header,hgroup,section{display:block}body,button,input,optgroup,select,textarea{font-family:BlinkMacSystemFont,-apple-system,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,Helvetica,Arial,sans-serif}code,pre{-moz-osx-font-smoothing:auto;-webkit-font-smoothing:auto;font-family:monospace}body{color:#4a4a4a;font-size:1em;font-weight:400;line-height:1.5}a{color:#485fc7;cursor:pointer;text-decoration:none}a strong{color:currentColor}a:hover{color:#363636}code{color:#da1039;background-color:#f5f5f5;padding:.25em .5em;font-size:.875em;font-weight:400}hr{height:2px;background-color:#f5f5f5;border:none;margin:1.5rem 0;display:block}img{height:auto;max-width:100%}input[type=checkbox],input[type=radio]{vertical-align:baseline}small{font-size:.875em}span{font-style:inherit;font-weight:inherit}strong{color:#363636;font-weight:700}fieldset{border:none}pre{-webkit-overflow-scrolling:touch;color:#4a4a4a;white-space:pre;word-wrap:normal;background-color:#f5f5f5;padding:1.25rem 1.5rem;font-size:.875em;overflow-x:auto}pre code{color:currentColor;background-color:#0000;padding:0;font-size:1em}table td,table th{vertical-align:top}table td:not([align]),table th:not([align]){text-align:inherit}table th{color:#363636}@keyframes spinAround{0%{transform:rotate(0)}to{transform:rotate(359deg)}}.box{color:#4a4a4a;background-color:#fff;border-radius:6px;padding:1.25rem;display:block;box-shadow:0 .5em 1em -.125em #0a0a0a1a,0 0 0 1px #0a0a0a05}a.box:hover,a.box:focus{box-shadow:0 .5em 1em -.125em #0a0a0a1a,0 0 0 1px #485fc7}a.box:active{box-shadow:inset 0 1px 2px #0a0a0a33,0 0 0 1px #485fc7}.button{color:#363636;cursor:pointer;text-align:center;white-space:nowrap;background-color:#fff;border-width:1px;border-color:#dbdbdb;justify-content:center;padding:calc(.5em - 1px) 1em}.button strong{color:inherit}.button .icon,.button .icon.is-small,.button .icon.is-medium,.button .icon.is-large{height:1.5em;width:1.5em}.button .icon:first-child:not(:last-child){margin-left:calc(-.5em - 1px);margin-right:.25em}.button .icon:last-child:not(:first-child){margin-left:.25em;margin-right:calc(-.5em - 1px)}.button .icon:first-child:last-child{margin-left:calc(-.5em - 1px);margin-right:calc(-.5em - 1px)}.button:hover,.button.is-hovered{color:#363636;border-color:#b5b5b5}.button:focus,.button.is-focused{color:#363636;border-color:#485fc7}.button:focus:not(:active),.button.is-focused:not(:active){box-shadow:0 0 0 .125em #485fc740}.button:active,.button.is-active{color:#363636;border-color:#4a4a4a}.button.is-text{color:#4a4a4a;background-color:#0000;border-color:#0000;text-decoration:underline}.button.is-text:hover,.button.is-text.is-hovered,.button.is-text:focus,.button.is-text.is-focused{color:#363636;background-color:#f5f5f5}.button.is-text:active,.button.is-text.is-active{color:#363636;background-color:#e8e8e8}.button.is-text[disabled],fieldset[disabled] .button.is-text{box-shadow:none;background-color:#0000;border-color:#0000}.button.is-ghost{color:#485fc7;background:0 0;border-color:#0000;text-decoration:none}.button.is-ghost:hover,.button.is-ghost.is-hovered{color:#485fc7;text-decoration:underline}.button.is-white{color:#0a0a0a;background-color:#fff;border-color:#0000}.button.is-white:hover,.button.is-white.is-hovered{color:#0a0a0a;background-color:#f9f9f9;border-color:#0000}.button.is-white:focus,.button.is-white.is-focused{color:#0a0a0a;border-color:#0000}.button.is-white:focus:not(:active),.button.is-white.is-focused:not(:active){box-shadow:0 0 0 .125em #ffffff40}.button.is-white:active,.button.is-white.is-active{color:#0a0a0a;background-color:#f2f2f2;border-color:#0000}.button.is-white[disabled],fieldset[disabled] .button.is-white{box-shadow:none;background-color:#fff;border-color:#fff}.button.is-white.is-inverted{color:#fff;background-color:#0a0a0a}.button.is-white.is-inverted:hover,.button.is-white.is-inverted.is-hovered{background-color:#000}.button.is-white.is-inverted[disabled],fieldset[disabled] .button.is-white.is-inverted{box-shadow:none;color:#fff;background-color:#0a0a0a;border-color:#0000}.button.is-white.is-loading:after{border-color:#0000 #0000 #0a0a0a #0a0a0a!important}.button.is-white.is-outlined{color:#fff;background-color:#0000;border-color:#fff}.button.is-white.is-outlined:hover,.button.is-white.is-outlined.is-hovered,.button.is-white.is-outlined:focus,.button.is-white.is-outlined.is-focused{color:#0a0a0a;background-color:#fff;border-color:#fff}.button.is-white.is-outlined.is-loading:after{border-color:#0000 #0000 #fff #fff!important}.button.is-white.is-outlined.is-loading:hover:after,.button.is-white.is-outlined.is-loading.is-hovered:after,.button.is-white.is-outlined.is-loading:focus:after,.button.is-white.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #0a0a0a #0a0a0a!important}.button.is-white.is-outlined[disabled],fieldset[disabled] .button.is-white.is-outlined{box-shadow:none;color:#fff;background-color:#0000;border-color:#fff}.button.is-white.is-inverted.is-outlined{color:#0a0a0a;background-color:#0000;border-color:#0a0a0a}.button.is-white.is-inverted.is-outlined:hover,.button.is-white.is-inverted.is-outlined.is-hovered,.button.is-white.is-inverted.is-outlined:focus,.button.is-white.is-inverted.is-outlined.is-focused{color:#fff;background-color:#0a0a0a}.button.is-white.is-inverted.is-outlined.is-loading:hover:after,.button.is-white.is-inverted.is-outlined.is-loading.is-hovered:after,.button.is-white.is-inverted.is-outlined.is-loading:focus:after,.button.is-white.is-inverted.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #fff #fff!important}.button.is-white.is-inverted.is-outlined[disabled],fieldset[disabled] .button.is-white.is-inverted.is-outlined{box-shadow:none;color:#0a0a0a;background-color:#0000;border-color:#0a0a0a}.button.is-black{color:#fff;background-color:#0a0a0a;border-color:#0000}.button.is-black:hover,.button.is-black.is-hovered{color:#fff;background-color:#040404;border-color:#0000}.button.is-black:focus,.button.is-black.is-focused{color:#fff;border-color:#0000}.button.is-black:focus:not(:active),.button.is-black.is-focused:not(:active){box-shadow:0 0 0 .125em #0a0a0a40}.button.is-black:active,.button.is-black.is-active{color:#fff;background-color:#000;border-color:#0000}.button.is-black[disabled],fieldset[disabled] .button.is-black{box-shadow:none;background-color:#0a0a0a;border-color:#0a0a0a}.button.is-black.is-inverted{color:#0a0a0a;background-color:#fff}.button.is-black.is-inverted:hover,.button.is-black.is-inverted.is-hovered{background-color:#f2f2f2}.button.is-black.is-inverted[disabled],fieldset[disabled] .button.is-black.is-inverted{box-shadow:none;color:#0a0a0a;background-color:#fff;border-color:#0000}.button.is-black.is-loading:after{border-color:#0000 #0000 #fff #fff!important}.button.is-black.is-outlined{color:#0a0a0a;background-color:#0000;border-color:#0a0a0a}.button.is-black.is-outlined:hover,.button.is-black.is-outlined.is-hovered,.button.is-black.is-outlined:focus,.button.is-black.is-outlined.is-focused{color:#fff;background-color:#0a0a0a;border-color:#0a0a0a}.button.is-black.is-outlined.is-loading:after{border-color:#0000 #0000 #0a0a0a #0a0a0a!important}.button.is-black.is-outlined.is-loading:hover:after,.button.is-black.is-outlined.is-loading.is-hovered:after,.button.is-black.is-outlined.is-loading:focus:after,.button.is-black.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #fff #fff!important}.button.is-black.is-outlined[disabled],fieldset[disabled] .button.is-black.is-outlined{box-shadow:none;color:#0a0a0a;background-color:#0000;border-color:#0a0a0a}.button.is-black.is-inverted.is-outlined{color:#fff;background-color:#0000;border-color:#fff}.button.is-black.is-inverted.is-outlined:hover,.button.is-black.is-inverted.is-outlined.is-hovered,.button.is-black.is-inverted.is-outlined:focus,.button.is-black.is-inverted.is-outlined.is-focused{color:#0a0a0a;background-color:#fff}.button.is-black.is-inverted.is-outlined.is-loading:hover:after,.button.is-black.is-inverted.is-outlined.is-loading.is-hovered:after,.button.is-black.is-inverted.is-outlined.is-loading:focus:after,.button.is-black.is-inverted.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #0a0a0a #0a0a0a!important}.button.is-black.is-inverted.is-outlined[disabled],fieldset[disabled] .button.is-black.is-inverted.is-outlined{box-shadow:none;color:#fff;background-color:#0000;border-color:#fff}.button.is-light{color:#000000b3;background-color:#f5f5f5;border-color:#0000}.button.is-light:hover,.button.is-light.is-hovered{color:#000000b3;background-color:#eee;border-color:#0000}.button.is-light:focus,.button.is-light.is-focused{color:#000000b3;border-color:#0000}.button.is-light:focus:not(:active),.button.is-light.is-focused:not(:active){box-shadow:0 0 0 .125em #f5f5f540}.button.is-light:active,.button.is-light.is-active{color:#000000b3;background-color:#e8e8e8;border-color:#0000}.button.is-light[disabled],fieldset[disabled] .button.is-light{box-shadow:none;background-color:#f5f5f5;border-color:#f5f5f5}.button.is-light.is-inverted{color:#f5f5f5;background-color:#000000b3}.button.is-light.is-inverted:hover,.button.is-light.is-inverted.is-hovered{background-color:#000000b3}.button.is-light.is-inverted[disabled],fieldset[disabled] .button.is-light.is-inverted{box-shadow:none;color:#f5f5f5;background-color:#000000b3;border-color:#0000}.button.is-light.is-loading:after{border-color:#0000 #0000 #000000b3 #000000b3!important}.button.is-light.is-outlined{color:#f5f5f5;background-color:#0000;border-color:#f5f5f5}.button.is-light.is-outlined:hover,.button.is-light.is-outlined.is-hovered,.button.is-light.is-outlined:focus,.button.is-light.is-outlined.is-focused{color:#000000b3;background-color:#f5f5f5;border-color:#f5f5f5}.button.is-light.is-outlined.is-loading:after{border-color:#0000 #0000 #f5f5f5 #f5f5f5!important}.button.is-light.is-outlined.is-loading:hover:after,.button.is-light.is-outlined.is-loading.is-hovered:after,.button.is-light.is-outlined.is-loading:focus:after,.button.is-light.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #000000b3 #000000b3!important}.button.is-light.is-outlined[disabled],fieldset[disabled] .button.is-light.is-outlined{box-shadow:none;color:#f5f5f5;background-color:#0000;border-color:#f5f5f5}.button.is-light.is-inverted.is-outlined{color:#000000b3;background-color:#0000;border-color:#000000b3}.button.is-light.is-inverted.is-outlined:hover,.button.is-light.is-inverted.is-outlined.is-hovered,.button.is-light.is-inverted.is-outlined:focus,.button.is-light.is-inverted.is-outlined.is-focused{color:#f5f5f5;background-color:#000000b3}.button.is-light.is-inverted.is-outlined.is-loading:hover:after,.button.is-light.is-inverted.is-outlined.is-loading.is-hovered:after,.button.is-light.is-inverted.is-outlined.is-loading:focus:after,.button.is-light.is-inverted.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #f5f5f5 #f5f5f5!important}.button.is-light.is-inverted.is-outlined[disabled],fieldset[disabled] .button.is-light.is-inverted.is-outlined{box-shadow:none;color:#000000b3;background-color:#0000;border-color:#000000b3}.button.is-dark{color:#fff;background-color:#363636;border-color:#0000}.button.is-dark:hover,.button.is-dark.is-hovered{color:#fff;background-color:#2f2f2f;border-color:#0000}.button.is-dark:focus,.button.is-dark.is-focused{color:#fff;border-color:#0000}.button.is-dark:focus:not(:active),.button.is-dark.is-focused:not(:active){box-shadow:0 0 0 .125em #36363640}.button.is-dark:active,.button.is-dark.is-active{color:#fff;background-color:#292929;border-color:#0000}.button.is-dark[disabled],fieldset[disabled] .button.is-dark{box-shadow:none;background-color:#363636;border-color:#363636}.button.is-dark.is-inverted{color:#363636;background-color:#fff}.button.is-dark.is-inverted:hover,.button.is-dark.is-inverted.is-hovered{background-color:#f2f2f2}.button.is-dark.is-inverted[disabled],fieldset[disabled] .button.is-dark.is-inverted{box-shadow:none;color:#363636;background-color:#fff;border-color:#0000}.button.is-dark.is-loading:after{border-color:#0000 #0000 #fff #fff!important}.button.is-dark.is-outlined{color:#363636;background-color:#0000;border-color:#363636}.button.is-dark.is-outlined:hover,.button.is-dark.is-outlined.is-hovered,.button.is-dark.is-outlined:focus,.button.is-dark.is-outlined.is-focused{color:#fff;background-color:#363636;border-color:#363636}.button.is-dark.is-outlined.is-loading:after{border-color:#0000 #0000 #363636 #363636!important}.button.is-dark.is-outlined.is-loading:hover:after,.button.is-dark.is-outlined.is-loading.is-hovered:after,.button.is-dark.is-outlined.is-loading:focus:after,.button.is-dark.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #fff #fff!important}.button.is-dark.is-outlined[disabled],fieldset[disabled] .button.is-dark.is-outlined{box-shadow:none;color:#363636;background-color:#0000;border-color:#363636}.button.is-dark.is-inverted.is-outlined{color:#fff;background-color:#0000;border-color:#fff}.button.is-dark.is-inverted.is-outlined:hover,.button.is-dark.is-inverted.is-outlined.is-hovered,.button.is-dark.is-inverted.is-outlined:focus,.button.is-dark.is-inverted.is-outlined.is-focused{color:#363636;background-color:#fff}.button.is-dark.is-inverted.is-outlined.is-loading:hover:after,.button.is-dark.is-inverted.is-outlined.is-loading.is-hovered:after,.button.is-dark.is-inverted.is-outlined.is-loading:focus:after,.button.is-dark.is-inverted.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #363636 #363636!important}.button.is-dark.is-inverted.is-outlined[disabled],fieldset[disabled] .button.is-dark.is-inverted.is-outlined{box-shadow:none;color:#fff;background-color:#0000;border-color:#fff}.button.is-primary{color:#fff;background-color:#00d1b2;border-color:#0000}.button.is-primary:hover,.button.is-primary.is-hovered{color:#fff;background-color:#00c4a7;border-color:#0000}.button.is-primary:focus,.button.is-primary.is-focused{color:#fff;border-color:#0000}.button.is-primary:focus:not(:active),.button.is-primary.is-focused:not(:active){box-shadow:0 0 0 .125em #00d1b240}.button.is-primary:active,.button.is-primary.is-active{color:#fff;background-color:#00b89c;border-color:#0000}.button.is-primary[disabled],fieldset[disabled] .button.is-primary{box-shadow:none;background-color:#00d1b2;border-color:#00d1b2}.button.is-primary.is-inverted{color:#00d1b2;background-color:#fff}.button.is-primary.is-inverted:hover,.button.is-primary.is-inverted.is-hovered{background-color:#f2f2f2}.button.is-primary.is-inverted[disabled],fieldset[disabled] .button.is-primary.is-inverted{box-shadow:none;color:#00d1b2;background-color:#fff;border-color:#0000}.button.is-primary.is-loading:after{border-color:#0000 #0000 #fff #fff!important}.button.is-primary.is-outlined{color:#00d1b2;background-color:#0000;border-color:#00d1b2}.button.is-primary.is-outlined:hover,.button.is-primary.is-outlined.is-hovered,.button.is-primary.is-outlined:focus,.button.is-primary.is-outlined.is-focused{color:#fff;background-color:#00d1b2;border-color:#00d1b2}.button.is-primary.is-outlined.is-loading:after{border-color:#0000 #0000 #00d1b2 #00d1b2!important}.button.is-primary.is-outlined.is-loading:hover:after,.button.is-primary.is-outlined.is-loading.is-hovered:after,.button.is-primary.is-outlined.is-loading:focus:after,.button.is-primary.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #fff #fff!important}.button.is-primary.is-outlined[disabled],fieldset[disabled] .button.is-primary.is-outlined{box-shadow:none;color:#00d1b2;background-color:#0000;border-color:#00d1b2}.button.is-primary.is-inverted.is-outlined{color:#fff;background-color:#0000;border-color:#fff}.button.is-primary.is-inverted.is-outlined:hover,.button.is-primary.is-inverted.is-outlined.is-hovered,.button.is-primary.is-inverted.is-outlined:focus,.button.is-primary.is-inverted.is-outlined.is-focused{color:#00d1b2;background-color:#fff}.button.is-primary.is-inverted.is-outlined.is-loading:hover:after,.button.is-primary.is-inverted.is-outlined.is-loading.is-hovered:after,.button.is-primary.is-inverted.is-outlined.is-loading:focus:after,.button.is-primary.is-inverted.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #00d1b2 #00d1b2!important}.button.is-primary.is-inverted.is-outlined[disabled],fieldset[disabled] .button.is-primary.is-inverted.is-outlined{box-shadow:none;color:#fff;background-color:#0000;border-color:#fff}.button.is-primary.is-light{color:#00947e;background-color:#ebfffc}.button.is-primary.is-light:hover,.button.is-primary.is-light.is-hovered{color:#00947e;background-color:#defffa;border-color:#0000}.button.is-primary.is-light:active,.button.is-primary.is-light.is-active{color:#00947e;background-color:#d1fff8;border-color:#0000}.button.is-link{color:#fff;background-color:#485fc7;border-color:#0000}.button.is-link:hover,.button.is-link.is-hovered{color:#fff;background-color:#3e56c4;border-color:#0000}.button.is-link:focus,.button.is-link.is-focused{color:#fff;border-color:#0000}.button.is-link:focus:not(:active),.button.is-link.is-focused:not(:active){box-shadow:0 0 0 .125em #485fc740}.button.is-link:active,.button.is-link.is-active{color:#fff;background-color:#3a51bb;border-color:#0000}.button.is-link[disabled],fieldset[disabled] .button.is-link{box-shadow:none;background-color:#485fc7;border-color:#485fc7}.button.is-link.is-inverted{color:#485fc7;background-color:#fff}.button.is-link.is-inverted:hover,.button.is-link.is-inverted.is-hovered{background-color:#f2f2f2}.button.is-link.is-inverted[disabled],fieldset[disabled] .button.is-link.is-inverted{box-shadow:none;color:#485fc7;background-color:#fff;border-color:#0000}.button.is-link.is-loading:after{border-color:#0000 #0000 #fff #fff!important}.button.is-link.is-outlined{color:#485fc7;background-color:#0000;border-color:#485fc7}.button.is-link.is-outlined:hover,.button.is-link.is-outlined.is-hovered,.button.is-link.is-outlined:focus,.button.is-link.is-outlined.is-focused{color:#fff;background-color:#485fc7;border-color:#485fc7}.button.is-link.is-outlined.is-loading:after{border-color:#0000 #0000 #485fc7 #485fc7!important}.button.is-link.is-outlined.is-loading:hover:after,.button.is-link.is-outlined.is-loading.is-hovered:after,.button.is-link.is-outlined.is-loading:focus:after,.button.is-link.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #fff #fff!important}.button.is-link.is-outlined[disabled],fieldset[disabled] .button.is-link.is-outlined{box-shadow:none;color:#485fc7;background-color:#0000;border-color:#485fc7}.button.is-link.is-inverted.is-outlined{color:#fff;background-color:#0000;border-color:#fff}.button.is-link.is-inverted.is-outlined:hover,.button.is-link.is-inverted.is-outlined.is-hovered,.button.is-link.is-inverted.is-outlined:focus,.button.is-link.is-inverted.is-outlined.is-focused{color:#485fc7;background-color:#fff}.button.is-link.is-inverted.is-outlined.is-loading:hover:after,.button.is-link.is-inverted.is-outlined.is-loading.is-hovered:after,.button.is-link.is-inverted.is-outlined.is-loading:focus:after,.button.is-link.is-inverted.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #485fc7 #485fc7!important}.button.is-link.is-inverted.is-outlined[disabled],fieldset[disabled] .button.is-link.is-inverted.is-outlined{box-shadow:none;color:#fff;background-color:#0000;border-color:#fff}.button.is-link.is-light{color:#3850b7;background-color:#eff1fa}.button.is-link.is-light:hover,.button.is-link.is-light.is-hovered{color:#3850b7;background-color:#e6e9f7;border-color:#0000}.button.is-link.is-light:active,.button.is-link.is-light.is-active{color:#3850b7;background-color:#dce0f4;border-color:#0000}.button.is-info{color:#fff;background-color:#3e8ed0;border-color:#0000}.button.is-info:hover,.button.is-info.is-hovered{color:#fff;background-color:#3488ce;border-color:#0000}.button.is-info:focus,.button.is-info.is-focused{color:#fff;border-color:#0000}.button.is-info:focus:not(:active),.button.is-info.is-focused:not(:active){box-shadow:0 0 0 .125em #3e8ed040}.button.is-info:active,.button.is-info.is-active{color:#fff;background-color:#3082c5;border-color:#0000}.button.is-info[disabled],fieldset[disabled] .button.is-info{box-shadow:none;background-color:#3e8ed0;border-color:#3e8ed0}.button.is-info.is-inverted{color:#3e8ed0;background-color:#fff}.button.is-info.is-inverted:hover,.button.is-info.is-inverted.is-hovered{background-color:#f2f2f2}.button.is-info.is-inverted[disabled],fieldset[disabled] .button.is-info.is-inverted{box-shadow:none;color:#3e8ed0;background-color:#fff;border-color:#0000}.button.is-info.is-loading:after{border-color:#0000 #0000 #fff #fff!important}.button.is-info.is-outlined{color:#3e8ed0;background-color:#0000;border-color:#3e8ed0}.button.is-info.is-outlined:hover,.button.is-info.is-outlined.is-hovered,.button.is-info.is-outlined:focus,.button.is-info.is-outlined.is-focused{color:#fff;background-color:#3e8ed0;border-color:#3e8ed0}.button.is-info.is-outlined.is-loading:after{border-color:#0000 #0000 #3e8ed0 #3e8ed0!important}.button.is-info.is-outlined.is-loading:hover:after,.button.is-info.is-outlined.is-loading.is-hovered:after,.button.is-info.is-outlined.is-loading:focus:after,.button.is-info.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #fff #fff!important}.button.is-info.is-outlined[disabled],fieldset[disabled] .button.is-info.is-outlined{box-shadow:none;color:#3e8ed0;background-color:#0000;border-color:#3e8ed0}.button.is-info.is-inverted.is-outlined{color:#fff;background-color:#0000;border-color:#fff}.button.is-info.is-inverted.is-outlined:hover,.button.is-info.is-inverted.is-outlined.is-hovered,.button.is-info.is-inverted.is-outlined:focus,.button.is-info.is-inverted.is-outlined.is-focused{color:#3e8ed0;background-color:#fff}.button.is-info.is-inverted.is-outlined.is-loading:hover:after,.button.is-info.is-inverted.is-outlined.is-loading.is-hovered:after,.button.is-info.is-inverted.is-outlined.is-loading:focus:after,.button.is-info.is-inverted.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #3e8ed0 #3e8ed0!important}.button.is-info.is-inverted.is-outlined[disabled],fieldset[disabled] .button.is-info.is-inverted.is-outlined{box-shadow:none;color:#fff;background-color:#0000;border-color:#fff}.button.is-info.is-light{color:#296fa8;background-color:#eff5fb}.button.is-info.is-light:hover,.button.is-info.is-light.is-hovered{color:#296fa8;background-color:#e4eff9;border-color:#0000}.button.is-info.is-light:active,.button.is-info.is-light.is-active{color:#296fa8;background-color:#dae9f6;border-color:#0000}.button.is-success{color:#fff;background-color:#48c78e;border-color:#0000}.button.is-success:hover,.button.is-success.is-hovered{color:#fff;background-color:#3ec487;border-color:#0000}.button.is-success:focus,.button.is-success.is-focused{color:#fff;border-color:#0000}.button.is-success:focus:not(:active),.button.is-success.is-focused:not(:active){box-shadow:0 0 0 .125em #48c78e40}.button.is-success:active,.button.is-success.is-active{color:#fff;background-color:#3abb81;border-color:#0000}.button.is-success[disabled],fieldset[disabled] .button.is-success{box-shadow:none;background-color:#48c78e;border-color:#48c78e}.button.is-success.is-inverted{color:#48c78e;background-color:#fff}.button.is-success.is-inverted:hover,.button.is-success.is-inverted.is-hovered{background-color:#f2f2f2}.button.is-success.is-inverted[disabled],fieldset[disabled] .button.is-success.is-inverted{box-shadow:none;color:#48c78e;background-color:#fff;border-color:#0000}.button.is-success.is-loading:after{border-color:#0000 #0000 #fff #fff!important}.button.is-success.is-outlined{color:#48c78e;background-color:#0000;border-color:#48c78e}.button.is-success.is-outlined:hover,.button.is-success.is-outlined.is-hovered,.button.is-success.is-outlined:focus,.button.is-success.is-outlined.is-focused{color:#fff;background-color:#48c78e;border-color:#48c78e}.button.is-success.is-outlined.is-loading:after{border-color:#0000 #0000 #48c78e #48c78e!important}.button.is-success.is-outlined.is-loading:hover:after,.button.is-success.is-outlined.is-loading.is-hovered:after,.button.is-success.is-outlined.is-loading:focus:after,.button.is-success.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #fff #fff!important}.button.is-success.is-outlined[disabled],fieldset[disabled] .button.is-success.is-outlined{box-shadow:none;color:#48c78e;background-color:#0000;border-color:#48c78e}.button.is-success.is-inverted.is-outlined{color:#fff;background-color:#0000;border-color:#fff}.button.is-success.is-inverted.is-outlined:hover,.button.is-success.is-inverted.is-outlined.is-hovered,.button.is-success.is-inverted.is-outlined:focus,.button.is-success.is-inverted.is-outlined.is-focused{color:#48c78e;background-color:#fff}.button.is-success.is-inverted.is-outlined.is-loading:hover:after,.button.is-success.is-inverted.is-outlined.is-loading.is-hovered:after,.button.is-success.is-inverted.is-outlined.is-loading:focus:after,.button.is-success.is-inverted.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #48c78e #48c78e!important}.button.is-success.is-inverted.is-outlined[disabled],fieldset[disabled] .button.is-success.is-inverted.is-outlined{box-shadow:none;color:#fff;background-color:#0000;border-color:#fff}.button.is-success.is-light{color:#257953;background-color:#effaf5}.button.is-success.is-light:hover,.button.is-success.is-light.is-hovered{color:#257953;background-color:#e6f7ef;border-color:#0000}.button.is-success.is-light:active,.button.is-success.is-light.is-active{color:#257953;background-color:#dcf4e9;border-color:#0000}.button.is-warning{color:#000000b3;background-color:#ffe08a;border-color:#0000}.button.is-warning:hover,.button.is-warning.is-hovered{color:#000000b3;background-color:#ffdc7d;border-color:#0000}.button.is-warning:focus,.button.is-warning.is-focused{color:#000000b3;border-color:#0000}.button.is-warning:focus:not(:active),.button.is-warning.is-focused:not(:active){box-shadow:0 0 0 .125em #ffe08a40}.button.is-warning:active,.button.is-warning.is-active{color:#000000b3;background-color:#ffd970;border-color:#0000}.button.is-warning[disabled],fieldset[disabled] .button.is-warning{box-shadow:none;background-color:#ffe08a;border-color:#ffe08a}.button.is-warning.is-inverted{color:#ffe08a;background-color:#000000b3}.button.is-warning.is-inverted:hover,.button.is-warning.is-inverted.is-hovered{background-color:#000000b3}.button.is-warning.is-inverted[disabled],fieldset[disabled] .button.is-warning.is-inverted{box-shadow:none;color:#ffe08a;background-color:#000000b3;border-color:#0000}.button.is-warning.is-loading:after{border-color:#0000 #0000 #000000b3 #000000b3!important}.button.is-warning.is-outlined{color:#ffe08a;background-color:#0000;border-color:#ffe08a}.button.is-warning.is-outlined:hover,.button.is-warning.is-outlined.is-hovered,.button.is-warning.is-outlined:focus,.button.is-warning.is-outlined.is-focused{color:#000000b3;background-color:#ffe08a;border-color:#ffe08a}.button.is-warning.is-outlined.is-loading:after{border-color:#0000 #0000 #ffe08a #ffe08a!important}.button.is-warning.is-outlined.is-loading:hover:after,.button.is-warning.is-outlined.is-loading.is-hovered:after,.button.is-warning.is-outlined.is-loading:focus:after,.button.is-warning.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #000000b3 #000000b3!important}.button.is-warning.is-outlined[disabled],fieldset[disabled] .button.is-warning.is-outlined{box-shadow:none;color:#ffe08a;background-color:#0000;border-color:#ffe08a}.button.is-warning.is-inverted.is-outlined{color:#000000b3;background-color:#0000;border-color:#000000b3}.button.is-warning.is-inverted.is-outlined:hover,.button.is-warning.is-inverted.is-outlined.is-hovered,.button.is-warning.is-inverted.is-outlined:focus,.button.is-warning.is-inverted.is-outlined.is-focused{color:#ffe08a;background-color:#000000b3}.button.is-warning.is-inverted.is-outlined.is-loading:hover:after,.button.is-warning.is-inverted.is-outlined.is-loading.is-hovered:after,.button.is-warning.is-inverted.is-outlined.is-loading:focus:after,.button.is-warning.is-inverted.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #ffe08a #ffe08a!important}.button.is-warning.is-inverted.is-outlined[disabled],fieldset[disabled] .button.is-warning.is-inverted.is-outlined{box-shadow:none;color:#000000b3;background-color:#0000;border-color:#000000b3}.button.is-warning.is-light{color:#946c00;background-color:#fffaeb}.button.is-warning.is-light:hover,.button.is-warning.is-light.is-hovered{color:#946c00;background-color:#fff6de;border-color:#0000}.button.is-warning.is-light:active,.button.is-warning.is-light.is-active{color:#946c00;background-color:#fff3d1;border-color:#0000}.button.is-danger{color:#fff;background-color:#f14668;border-color:#0000}.button.is-danger:hover,.button.is-danger.is-hovered{color:#fff;background-color:#f03a5f;border-color:#0000}.button.is-danger:focus,.button.is-danger.is-focused{color:#fff;border-color:#0000}.button.is-danger:focus:not(:active),.button.is-danger.is-focused:not(:active){box-shadow:0 0 0 .125em #f1466840}.button.is-danger:active,.button.is-danger.is-active{color:#fff;background-color:#ef2e55;border-color:#0000}.button.is-danger[disabled],fieldset[disabled] .button.is-danger{box-shadow:none;background-color:#f14668;border-color:#f14668}.button.is-danger.is-inverted{color:#f14668;background-color:#fff}.button.is-danger.is-inverted:hover,.button.is-danger.is-inverted.is-hovered{background-color:#f2f2f2}.button.is-danger.is-inverted[disabled],fieldset[disabled] .button.is-danger.is-inverted{box-shadow:none;color:#f14668;background-color:#fff;border-color:#0000}.button.is-danger.is-loading:after{border-color:#0000 #0000 #fff #fff!important}.button.is-danger.is-outlined{color:#f14668;background-color:#0000;border-color:#f14668}.button.is-danger.is-outlined:hover,.button.is-danger.is-outlined.is-hovered,.button.is-danger.is-outlined:focus,.button.is-danger.is-outlined.is-focused{color:#fff;background-color:#f14668;border-color:#f14668}.button.is-danger.is-outlined.is-loading:after{border-color:#0000 #0000 #f14668 #f14668!important}.button.is-danger.is-outlined.is-loading:hover:after,.button.is-danger.is-outlined.is-loading.is-hovered:after,.button.is-danger.is-outlined.is-loading:focus:after,.button.is-danger.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #fff #fff!important}.button.is-danger.is-outlined[disabled],fieldset[disabled] .button.is-danger.is-outlined{box-shadow:none;color:#f14668;background-color:#0000;border-color:#f14668}.button.is-danger.is-inverted.is-outlined{color:#fff;background-color:#0000;border-color:#fff}.button.is-danger.is-inverted.is-outlined:hover,.button.is-danger.is-inverted.is-outlined.is-hovered,.button.is-danger.is-inverted.is-outlined:focus,.button.is-danger.is-inverted.is-outlined.is-focused{color:#f14668;background-color:#fff}.button.is-danger.is-inverted.is-outlined.is-loading:hover:after,.button.is-danger.is-inverted.is-outlined.is-loading.is-hovered:after,.button.is-danger.is-inverted.is-outlined.is-loading:focus:after,.button.is-danger.is-inverted.is-outlined.is-loading.is-focused:after{border-color:#0000 #0000 #f14668 #f14668!important}.button.is-danger.is-inverted.is-outlined[disabled],fieldset[disabled] .button.is-danger.is-inverted.is-outlined{box-shadow:none;color:#fff;background-color:#0000;border-color:#fff}.button.is-danger.is-light{color:#cc0f35;background-color:#feecf0}.button.is-danger.is-light:hover,.button.is-danger.is-light.is-hovered{color:#cc0f35;background-color:#fde0e6;border-color:#0000}.button.is-danger.is-light:active,.button.is-danger.is-light.is-active{color:#cc0f35;background-color:#fcd4dc;border-color:#0000}.button.is-small{font-size:.75rem}.button.is-small:not(.is-rounded){border-radius:2px}.button.is-normal{font-size:1rem}.button.is-medium{font-size:1.25rem}.button.is-large{font-size:1.5rem}.button[disabled],fieldset[disabled] .button{box-shadow:none;opacity:.5;background-color:#fff;border-color:#dbdbdb}.button.is-fullwidth{width:100%;display:flex}.button.is-loading{pointer-events:none;color:#0000!important}.button.is-loading:after{position:absolute;top:calc(50% - .5em);left:calc(50% - .5em);position:absolute!important}.button.is-static{color:#7a7a7a;box-shadow:none;pointer-events:none;background-color:#f5f5f5;border-color:#dbdbdb}.button.is-rounded{border-radius:9999px;padding-left:1.25em;padding-right:1.25em}.buttons{flex-wrap:wrap;justify-content:flex-start;align-items:center;display:flex}.buttons .button{margin-bottom:.5rem}.buttons .button:not(:last-child):not(.is-fullwidth){margin-right:.5rem}.buttons:last-child{margin-bottom:-.5rem}.buttons:not(:last-child){margin-bottom:1rem}.buttons.are-small .button:not(.is-normal):not(.is-medium):not(.is-large){font-size:.75rem}.buttons.are-small .button:not(.is-normal):not(.is-medium):not(.is-large):not(.is-rounded){border-radius:2px}.buttons.are-medium .button:not(.is-small):not(.is-normal):not(.is-large){font-size:1.25rem}.buttons.are-large .button:not(.is-small):not(.is-normal):not(.is-medium){font-size:1.5rem}.buttons.has-addons .button:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.buttons.has-addons .button:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0;margin-right:-1px}.buttons.has-addons .button:last-child{margin-right:0}.buttons.has-addons .button:hover,.buttons.has-addons .button.is-hovered{z-index:2}.buttons.has-addons .button:focus,.buttons.has-addons .button.is-focused,.buttons.has-addons .button:active,.buttons.has-addons .button.is-active,.buttons.has-addons .button.is-selected{z-index:3}.buttons.has-addons .button:focus:hover,.buttons.has-addons .button.is-focused:hover,.buttons.has-addons .button:active:hover,.buttons.has-addons .button.is-active:hover,.buttons.has-addons .button.is-selected:hover{z-index:4}.buttons.has-addons .button.is-expanded{flex-grow:1;flex-shrink:1}.buttons.is-centered{justify-content:center}.buttons.is-centered:not(.has-addons) .button:not(.is-fullwidth){margin-left:.25rem;margin-right:.25rem}.buttons.is-right{justify-content:flex-end}.buttons.is-right:not(.has-addons) .button:not(.is-fullwidth){margin-left:.25rem;margin-right:.25rem}@media screen and (max-width:768px){.button.is-responsive.is-small{font-size:.5625rem}.button.is-responsive,.button.is-responsive.is-normal{font-size:.65625rem}.button.is-responsive.is-medium{font-size:.75rem}.button.is-responsive.is-large{font-size:1rem}}@media screen and (min-width:769px) and (max-width:1023px){.button.is-responsive.is-small{font-size:.65625rem}.button.is-responsive,.button.is-responsive.is-normal{font-size:.75rem}.button.is-responsive.is-medium{font-size:1rem}.button.is-responsive.is-large{font-size:1.25rem}}.container{width:auto;flex-grow:1;margin:0 auto;position:relative}.container.is-fluid{width:100%;padding-left:32px;padding-right:32px;max-width:none!important}@media screen and (min-width:1024px){.container{max-width:960px}}@media screen and (max-width:1215px){.container.is-widescreen:not(.is-max-desktop){max-width:1152px}}@media screen and (max-width:1407px){.container.is-fullhd:not(.is-max-desktop):not(.is-max-widescreen){max-width:1344px}}@media screen and (min-width:1216px){.container:not(.is-max-desktop){max-width:1152px}}@media screen and (min-width:1408px){.container:not(.is-max-desktop):not(.is-max-widescreen){max-width:1344px}}.content li+li{margin-top:.25em}.content p:not(:last-child),.content dl:not(:last-child),.content ol:not(:last-child),.content ul:not(:last-child),.content blockquote:not(:last-child),.content pre:not(:last-child),.content table:not(:last-child){margin-bottom:1em}.content h1,.content h2,.content h3,.content h4,.content h5,.content h6{color:#363636;font-weight:600;line-height:1.125}.content h1{margin-bottom:.5em;font-size:2em}.content h1:not(:first-child){margin-top:1em}.content h2{margin-bottom:.5714em;font-size:1.75em}.content h2:not(:first-child){margin-top:1.1428em}.content h3{margin-bottom:.6666em;font-size:1.5em}.content h3:not(:first-child){margin-top:1.3333em}.content h4{margin-bottom:.8em;font-size:1.25em}.content h5{margin-bottom:.8888em;font-size:1.125em}.content h6{margin-bottom:1em;font-size:1em}.content blockquote{background-color:#f5f5f5;border-left:5px solid #dbdbdb;padding:1.25em 1.5em}.content ol{margin-top:1em;margin-left:2em;list-style-position:outside}.content ol:not([type]){list-style-type:decimal}.content ol:not([type]).is-lower-alpha{list-style-type:lower-alpha}.content ol:not([type]).is-lower-roman{list-style-type:lower-roman}.content ol:not([type]).is-upper-alpha{list-style-type:upper-alpha}.content ol:not([type]).is-upper-roman{list-style-type:upper-roman}.content ul{margin-top:1em;margin-left:2em;list-style:disc}.content ul ul{margin-top:.5em;list-style-type:circle}.content ul ul ul{list-style-type:square}.content dd{margin-left:2em}.content figure{text-align:center;margin-left:2em;margin-right:2em}.content figure:not(:first-child){margin-top:2em}.content figure:not(:last-child){margin-bottom:2em}.content figure img{display:inline-block}.content figure figcaption{font-style:italic}.content pre{-webkit-overflow-scrolling:touch;white-space:pre;word-wrap:normal;padding:1.25em 1.5em;overflow-x:auto}.content sup,.content sub{font-size:75%}.content table{width:100%}.content table td,.content table th{vertical-align:top;border:0 solid #dbdbdb;border-bottom-width:1px;padding:.5em .75em}.content table th{color:#363636}.content table th:not([align]){text-align:inherit}.content table thead td,.content table thead th{color:#363636;border-width:0 0 2px}.content table tfoot td,.content table tfoot th{color:#363636;border-width:2px 0 0}.content table tbody tr:last-child td,.content table tbody tr:last-child th{border-bottom-width:0}.content .tabs li+li{margin-top:0}.content.is-small{font-size:.75rem}.content.is-normal{font-size:1rem}.content.is-medium{font-size:1.25rem}.content.is-large{font-size:1.5rem}.icon{height:1.5rem;width:1.5rem;justify-content:center;align-items:center;display:inline-flex}.icon.is-small{height:1rem;width:1rem}.icon.is-medium{height:2rem;width:2rem}.icon.is-large{height:3rem;width:3rem}.icon-text{color:inherit;vertical-align:top;flex-wrap:wrap;align-items:flex-start;line-height:1.5rem;display:inline-flex}.icon-text .icon{flex-grow:0;flex-shrink:0}.icon-text .icon:not(:last-child){margin-right:.25em}.icon-text .icon:not(:first-child){margin-left:.25em}div.icon-text{display:flex}.image{display:block;position:relative}.image img{height:auto;width:100%;display:block}.image img.is-rounded{border-radius:9999px}.image.is-fullwidth{width:100%}.image.is-square img,.image.is-square .has-ratio,.image.is-1by1 img,.image.is-1by1 .has-ratio,.image.is-5by4 img,.image.is-5by4 .has-ratio,.image.is-4by3 img,.image.is-4by3 .has-ratio,.image.is-3by2 img,.image.is-3by2 .has-ratio,.image.is-5by3 img,.image.is-5by3 .has-ratio,.image.is-16by9 img,.image.is-16by9 .has-ratio,.image.is-2by1 img,.image.is-2by1 .has-ratio,.image.is-3by1 img,.image.is-3by1 .has-ratio,.image.is-4by5 img,.image.is-4by5 .has-ratio,.image.is-3by4 img,.image.is-3by4 .has-ratio,.image.is-2by3 img,.image.is-2by3 .has-ratio,.image.is-3by5 img,.image.is-3by5 .has-ratio,.image.is-9by16 img,.image.is-9by16 .has-ratio,.image.is-1by2 img,.image.is-1by2 .has-ratio,.image.is-1by3 img,.image.is-1by3 .has-ratio{height:100%;width:100%}.image.is-square,.image.is-1by1{padding-top:100%}.image.is-5by4{padding-top:80%}.image.is-4by3{padding-top:75%}.image.is-3by2{padding-top:66.6666%}.image.is-5by3{padding-top:60%}.image.is-16by9{padding-top:56.25%}.image.is-2by1{padding-top:50%}.image.is-3by1{padding-top:33.3333%}.image.is-4by5{padding-top:125%}.image.is-3by4{padding-top:133.333%}.image.is-2by3{padding-top:150%}.image.is-3by5{padding-top:166.667%}.image.is-9by16{padding-top:177.778%}.image.is-1by2{padding-top:200%}.image.is-1by3{padding-top:300%}.image.is-16x16{height:16px;width:16px}.image.is-24x24{height:24px;width:24px}.image.is-32x32{height:32px;width:32px}.image.is-48x48{height:48px;width:48px}.image.is-64x64{height:64px;width:64px}.image.is-96x96{height:96px;width:96px}.image.is-128x128{height:128px;width:128px}.notification{background-color:#f5f5f5;border-radius:4px;padding:1.25rem 2.5rem 1.25rem 1.5rem;position:relative}.notification a:not(.button):not(.dropdown-item){color:currentColor;text-decoration:underline}.notification strong{color:currentColor}.notification code,.notification pre{background:#fff}.notification pre code{background:0 0}.notification>.delete{position:absolute;top:.5rem;right:.5rem}.notification .title,.notification .subtitle,.notification .content{color:currentColor}.notification.is-white{color:#0a0a0a;background-color:#fff}.notification.is-black{color:#fff;background-color:#0a0a0a}.notification.is-light{color:#000000b3;background-color:#f5f5f5}.notification.is-dark{color:#fff;background-color:#363636}.notification.is-primary{color:#fff;background-color:#00d1b2}.notification.is-primary.is-light{color:#00947e;background-color:#ebfffc}.notification.is-link{color:#fff;background-color:#485fc7}.notification.is-link.is-light{color:#3850b7;background-color:#eff1fa}.notification.is-info{color:#fff;background-color:#3e8ed0}.notification.is-info.is-light{color:#296fa8;background-color:#eff5fb}.notification.is-success{color:#fff;background-color:#48c78e}.notification.is-success.is-light{color:#257953;background-color:#effaf5}.notification.is-warning{color:#000000b3;background-color:#ffe08a}.notification.is-warning.is-light{color:#946c00;background-color:#fffaeb}.notification.is-danger{color:#fff;background-color:#f14668}.notification.is-danger.is-light{color:#cc0f35;background-color:#feecf0}.progress{-webkit-appearance:none;-moz-appearance:none;height:1rem;width:100%;border:none;border-radius:9999px;padding:0;display:block;overflow:hidden}.progress::-webkit-progress-bar{background-color:#ededed}.progress::-webkit-progress-value{background-color:#4a4a4a}.progress::-moz-progress-bar{background-color:#4a4a4a}.progress::-ms-fill{background-color:#4a4a4a;border:none}.progress.is-white::-webkit-progress-value{background-color:#fff}.progress.is-white::-moz-progress-bar{background-color:#fff}.progress.is-white::-ms-fill{background-color:#fff}.progress.is-white:indeterminate{background-image:linear-gradient(90deg,#fff 30%,#ededed 30%)}.progress.is-black::-webkit-progress-value{background-color:#0a0a0a}.progress.is-black::-moz-progress-bar{background-color:#0a0a0a}.progress.is-black::-ms-fill{background-color:#0a0a0a}.progress.is-black:indeterminate{background-image:linear-gradient(90deg,#0a0a0a 30%,#ededed 30%)}.progress.is-light::-webkit-progress-value{background-color:#f5f5f5}.progress.is-light::-moz-progress-bar{background-color:#f5f5f5}.progress.is-light::-ms-fill{background-color:#f5f5f5}.progress.is-light:indeterminate{background-image:linear-gradient(90deg,#f5f5f5 30%,#ededed 30%)}.progress.is-dark::-webkit-progress-value{background-color:#363636}.progress.is-dark::-moz-progress-bar{background-color:#363636}.progress.is-dark::-ms-fill{background-color:#363636}.progress.is-dark:indeterminate{background-image:linear-gradient(90deg,#363636 30%,#ededed 30%)}.progress.is-primary::-webkit-progress-value{background-color:#00d1b2}.progress.is-primary::-moz-progress-bar{background-color:#00d1b2}.progress.is-primary::-ms-fill{background-color:#00d1b2}.progress.is-primary:indeterminate{background-image:linear-gradient(90deg,#00d1b2 30%,#ededed 30%)}.progress.is-link::-webkit-progress-value{background-color:#485fc7}.progress.is-link::-moz-progress-bar{background-color:#485fc7}.progress.is-link::-ms-fill{background-color:#485fc7}.progress.is-link:indeterminate{background-image:linear-gradient(90deg,#485fc7 30%,#ededed 30%)}.progress.is-info::-webkit-progress-value{background-color:#3e8ed0}.progress.is-info::-moz-progress-bar{background-color:#3e8ed0}.progress.is-info::-ms-fill{background-color:#3e8ed0}.progress.is-info:indeterminate{background-image:linear-gradient(90deg,#3e8ed0 30%,#ededed 30%)}.progress.is-success::-webkit-progress-value{background-color:#48c78e}.progress.is-success::-moz-progress-bar{background-color:#48c78e}.progress.is-success::-ms-fill{background-color:#48c78e}.progress.is-success:indeterminate{background-image:linear-gradient(90deg,#48c78e 30%,#ededed 30%)}.progress.is-warning::-webkit-progress-value{background-color:#ffe08a}.progress.is-warning::-moz-progress-bar{background-color:#ffe08a}.progress.is-warning::-ms-fill{background-color:#ffe08a}.progress.is-warning:indeterminate{background-image:linear-gradient(90deg,#ffe08a 30%,#ededed 30%)}.progress.is-danger::-webkit-progress-value{background-color:#f14668}.progress.is-danger::-moz-progress-bar{background-color:#f14668}.progress.is-danger::-ms-fill{background-color:#f14668}.progress.is-danger:indeterminate{background-image:linear-gradient(90deg,#f14668 30%,#ededed 30%)}.progress:indeterminate{background-color:#ededed;background-image:linear-gradient(90deg,#4a4a4a 30%,#ededed 30%);background-position:0 0;background-repeat:no-repeat;background-size:150% 150%;animation-name:moveIndeterminate;animation-duration:1.5s;animation-timing-function:linear;animation-iteration-count:infinite}.progress:indeterminate::-webkit-progress-bar{background-color:#0000}.progress:indeterminate::-moz-progress-bar{background-color:#0000}.progress:indeterminate::-ms-fill{animation-name:none}.progress.is-small{height:.75rem}.progress.is-medium{height:1.25rem}.progress.is-large{height:1.5rem}@keyframes moveIndeterminate{0%{background-position:200% 0}to{background-position:-200% 0}}.table{color:#363636;background-color:#fff}.table td,.table th{vertical-align:top;border:0 solid #dbdbdb;border-bottom-width:1px;padding:.5em .75em}.table td.is-white,.table th.is-white{color:#0a0a0a;background-color:#fff;border-color:#fff}.table td.is-black,.table th.is-black{color:#fff;background-color:#0a0a0a;border-color:#0a0a0a}.table td.is-light,.table th.is-light{color:#000000b3;background-color:#f5f5f5;border-color:#f5f5f5}.table td.is-dark,.table th.is-dark{color:#fff;background-color:#363636;border-color:#363636}.table td.is-primary,.table th.is-primary{color:#fff;background-color:#00d1b2;border-color:#00d1b2}.table td.is-link,.table th.is-link{color:#fff;background-color:#485fc7;border-color:#485fc7}.table td.is-info,.table th.is-info{color:#fff;background-color:#3e8ed0;border-color:#3e8ed0}.table td.is-success,.table th.is-success{color:#fff;background-color:#48c78e;border-color:#48c78e}.table td.is-warning,.table th.is-warning{color:#000000b3;background-color:#ffe08a;border-color:#ffe08a}.table td.is-danger,.table th.is-danger{color:#fff;background-color:#f14668;border-color:#f14668}.table td.is-narrow,.table th.is-narrow{white-space:nowrap;width:1%}.table td.is-selected,.table th.is-selected{color:#fff;background-color:#00d1b2}.table td.is-selected a,.table td.is-selected strong,.table th.is-selected a,.table th.is-selected strong{color:currentColor}.table td.is-vcentered,.table th.is-vcentered{vertical-align:middle}.table th{color:#363636}.table th:not([align]){text-align:left}.table tr.is-selected{color:#fff;background-color:#00d1b2}.table tr.is-selected a,.table tr.is-selected strong{color:currentColor}.table tr.is-selected td,.table tr.is-selected th{color:currentColor;border-color:#fff}.table thead{background-color:#0000}.table thead td,.table thead th{color:#363636;border-width:0 0 2px}.table tfoot{background-color:#0000}.table tfoot td,.table tfoot th{color:#363636;border-width:2px 0 0}.table tbody{background-color:#0000}.table tbody tr:last-child td,.table tbody tr:last-child th{border-bottom-width:0}.table.is-bordered td,.table.is-bordered th{border-width:1px}.table.is-bordered tr:last-child td,.table.is-bordered tr:last-child th{border-bottom-width:1px}.table.is-fullwidth{width:100%}.table.is-hoverable tbody tr:not(.is-selected):hover,.table.is-hoverable.is-striped tbody tr:not(.is-selected):hover{background-color:#fafafa}.table.is-hoverable.is-striped tbody tr:not(.is-selected):hover:nth-child(2n){background-color:#f5f5f5}.table.is-narrow td,.table.is-narrow th{padding:.25em .5em}.table.is-striped tbody tr:not(.is-selected):nth-child(2n){background-color:#fafafa}.table-container{-webkit-overflow-scrolling:touch;max-width:100%;overflow-x:auto;overflow-y:hidden}.tags{flex-wrap:wrap;justify-content:flex-start;align-items:center;display:flex}.tags .tag{margin-bottom:.5rem}.tags .tag:not(:last-child){margin-right:.5rem}.tags:last-child{margin-bottom:-.5rem}.tags:not(:last-child){margin-bottom:1rem}.tags.are-medium .tag:not(.is-normal):not(.is-large){font-size:1rem}.tags.are-large .tag:not(.is-normal):not(.is-medium){font-size:1.25rem}.tags.is-centered{justify-content:center}.tags.is-centered .tag{margin-left:.25rem;margin-right:.25rem}.tags.is-right{justify-content:flex-end}.tags.is-right .tag:not(:first-child){margin-left:.5rem}.tags.is-right .tag:not(:last-child),.tags.has-addons .tag{margin-right:0}.tags.has-addons .tag:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0;margin-left:0}.tags.has-addons .tag:not(:last-child){border-top-right-radius:0;border-bottom-right-radius:0}.tag:not(body){color:#4a4a4a;height:2em;white-space:nowrap;background-color:#f5f5f5;border-radius:4px;justify-content:center;align-items:center;padding-left:.75em;padding-right:.75em;font-size:.75rem;line-height:1.5;display:inline-flex}.tag:not(body) .delete{margin-left:.25rem;margin-right:-.375rem}.tag:not(body).is-white{color:#0a0a0a;background-color:#fff}.tag:not(body).is-black{color:#fff;background-color:#0a0a0a}.tag:not(body).is-light{color:#000000b3;background-color:#f5f5f5}.tag:not(body).is-dark{color:#fff;background-color:#363636}.tag:not(body).is-primary{color:#fff;background-color:#00d1b2}.tag:not(body).is-primary.is-light{color:#00947e;background-color:#ebfffc}.tag:not(body).is-link{color:#fff;background-color:#485fc7}.tag:not(body).is-link.is-light{color:#3850b7;background-color:#eff1fa}.tag:not(body).is-info{color:#fff;background-color:#3e8ed0}.tag:not(body).is-info.is-light{color:#296fa8;background-color:#eff5fb}.tag:not(body).is-success{color:#fff;background-color:#48c78e}.tag:not(body).is-success.is-light{color:#257953;background-color:#effaf5}.tag:not(body).is-warning{color:#000000b3;background-color:#ffe08a}.tag:not(body).is-warning.is-light{color:#946c00;background-color:#fffaeb}.tag:not(body).is-danger{color:#fff;background-color:#f14668}.tag:not(body).is-danger.is-light{color:#cc0f35;background-color:#feecf0}.tag:not(body).is-normal{font-size:.75rem}.tag:not(body).is-medium{font-size:1rem}.tag:not(body).is-large{font-size:1.25rem}.tag:not(body) .icon:first-child:not(:last-child){margin-left:-.375em;margin-right:.1875em}.tag:not(body) .icon:last-child:not(:first-child){margin-left:.1875em;margin-right:-.375em}.tag:not(body) .icon:first-child:last-child{margin-left:-.375em;margin-right:-.375em}.tag:not(body).is-delete{width:2em;margin-left:1px;padding:0;position:relative}.tag:not(body).is-delete:before,.tag:not(body).is-delete:after{content:"";transform-origin:50%;background-color:currentColor;display:block;position:absolute;top:50%;left:50%;transform:translate(-50%)translateY(-50%)rotate(45deg)}.tag:not(body).is-delete:before{height:1px;width:50%}.tag:not(body).is-delete:after{height:50%;width:1px}.tag:not(body).is-delete:hover,.tag:not(body).is-delete:focus{background-color:#e8e8e8}.tag:not(body).is-delete:active{background-color:#dbdbdb}.tag:not(body).is-rounded{border-radius:9999px}a.tag:hover{text-decoration:underline}.title,.subtitle{word-break:break-word}.title em,.title span,.subtitle em,.subtitle span{font-weight:inherit}.title sub,.subtitle sub,.title sup,.subtitle sup{font-size:.75em}.title .tag,.subtitle .tag{vertical-align:middle}.title{color:#363636;font-size:2rem;font-weight:600;line-height:1.125}.title strong{color:inherit;font-weight:inherit}.title:not(.is-spaced)+.subtitle{margin-top:-1.25rem}.title.is-1{font-size:3rem}.title.is-2{font-size:2.5rem}.title.is-3{font-size:2rem}.title.is-4{font-size:1.5rem}.title.is-5{font-size:1.25rem}.title.is-6{font-size:1rem}.title.is-7{font-size:.75rem}.subtitle{color:#4a4a4a;font-size:1.25rem;font-weight:400;line-height:1.25}.subtitle strong{color:#363636;font-weight:600}.subtitle:not(.is-spaced)+.title{margin-top:-1.25rem}.subtitle.is-1{font-size:3rem}.subtitle.is-2{font-size:2.5rem}.subtitle.is-3{font-size:2rem}.subtitle.is-4{font-size:1.5rem}.subtitle.is-5{font-size:1.25rem}.subtitle.is-6{font-size:1rem}.subtitle.is-7{font-size:.75rem}.heading{letter-spacing:1px;text-transform:uppercase;margin-bottom:5px;font-size:11px;display:block}.number{height:2em;min-width:2.5em;text-align:center;vertical-align:top;background-color:#f5f5f5;border-radius:9999px;justify-content:center;align-items:center;margin-right:1.5rem;padding:.25rem .5rem;font-size:1.25rem;display:inline-flex}.select select,.textarea,.input{color:#363636;background-color:#fff;border-color:#dbdbdb;border-radius:4px}.select select::-webkit-input-placeholder,.textarea::-webkit-input-placeholder,.input::-webkit-input-placeholder{color:#3636364d}.select select::-moz-placeholder,.textarea::-moz-placeholder,.input::-moz-placeholder{color:#3636364d}.select select:-moz-placeholder,.textarea:-moz-placeholder,.input:-moz-placeholder{color:#3636364d}.select select:-ms-input-placeholder,.textarea:-ms-input-placeholder,.input:-ms-input-placeholder{color:#3636364d}.select select:hover,.textarea:hover,.input:hover,.select select.is-hovered,.is-hovered.textarea,.is-hovered.input{border-color:#b5b5b5}.select select:focus,.textarea:focus,.input:focus,.select select.is-focused,.is-focused.textarea,.is-focused.input,.select select:active,.textarea:active,.input:active,.select select.is-active,.is-active.textarea,.is-active.input{border-color:#485fc7;box-shadow:0 0 0 .125em #485fc740}.select select[disabled],[disabled].textarea,[disabled].input,fieldset[disabled] .select select,.select fieldset[disabled] select,fieldset[disabled] .textarea,fieldset[disabled] .input{box-shadow:none;color:#7a7a7a;background-color:#f5f5f5;border-color:#f5f5f5}.select select[disabled]::-webkit-input-placeholder,[disabled].textarea::-webkit-input-placeholder,[disabled].input::-webkit-input-placeholder,fieldset[disabled] .select select::-webkit-input-placeholder,.select fieldset[disabled] select::-webkit-input-placeholder,fieldset[disabled] .textarea::-webkit-input-placeholder,fieldset[disabled] .input::-webkit-input-placeholder{color:#7a7a7a4d}.select select[disabled]::-moz-placeholder,[disabled].textarea::-moz-placeholder,[disabled].input::-moz-placeholder,fieldset[disabled] .select select::-moz-placeholder,.select fieldset[disabled] select::-moz-placeholder,fieldset[disabled] .textarea::-moz-placeholder,fieldset[disabled] .input::-moz-placeholder{color:#7a7a7a4d}.select select[disabled]:-moz-placeholder,[disabled].textarea:-moz-placeholder,[disabled].input:-moz-placeholder,fieldset[disabled] .select select:-moz-placeholder,.select fieldset[disabled] select:-moz-placeholder,fieldset[disabled] .textarea:-moz-placeholder,fieldset[disabled] .input:-moz-placeholder{color:#7a7a7a4d}.select select[disabled]:-ms-input-placeholder,[disabled].textarea:-ms-input-placeholder,[disabled].input:-ms-input-placeholder,fieldset[disabled] .select select:-ms-input-placeholder,.select fieldset[disabled] select:-ms-input-placeholder,fieldset[disabled] .textarea:-ms-input-placeholder,fieldset[disabled] .input:-ms-input-placeholder{color:#7a7a7a4d}.textarea,.input{max-width:100%;width:100%;box-shadow:inset 0 .0625em .125em #0a0a0a0d}[readonly].textarea,[readonly].input{box-shadow:none}.is-white.textarea,.is-white.input{border-color:#fff}.is-white.textarea:focus,.is-white.input:focus,.is-white.is-focused.textarea,.is-white.is-focused.input,.is-white.textarea:active,.is-white.input:active,.is-white.is-active.textarea,.is-white.is-active.input{box-shadow:0 0 0 .125em #ffffff40}.is-black.textarea,.is-black.input{border-color:#0a0a0a}.is-black.textarea:focus,.is-black.input:focus,.is-black.is-focused.textarea,.is-black.is-focused.input,.is-black.textarea:active,.is-black.input:active,.is-black.is-active.textarea,.is-black.is-active.input{box-shadow:0 0 0 .125em #0a0a0a40}.is-light.textarea,.is-light.input{border-color:#f5f5f5}.is-light.textarea:focus,.is-light.input:focus,.is-light.is-focused.textarea,.is-light.is-focused.input,.is-light.textarea:active,.is-light.input:active,.is-light.is-active.textarea,.is-light.is-active.input{box-shadow:0 0 0 .125em #f5f5f540}.is-dark.textarea,.is-dark.input{border-color:#363636}.is-dark.textarea:focus,.is-dark.input:focus,.is-dark.is-focused.textarea,.is-dark.is-focused.input,.is-dark.textarea:active,.is-dark.input:active,.is-dark.is-active.textarea,.is-dark.is-active.input{box-shadow:0 0 0 .125em #36363640}.is-primary.textarea,.is-primary.input{border-color:#00d1b2}.is-primary.textarea:focus,.is-primary.input:focus,.is-primary.is-focused.textarea,.is-primary.is-focused.input,.is-primary.textarea:active,.is-primary.input:active,.is-primary.is-active.textarea,.is-primary.is-active.input{box-shadow:0 0 0 .125em #00d1b240}.is-link.textarea,.is-link.input{border-color:#485fc7}.is-link.textarea:focus,.is-link.input:focus,.is-link.is-focused.textarea,.is-link.is-focused.input,.is-link.textarea:active,.is-link.input:active,.is-link.is-active.textarea,.is-link.is-active.input{box-shadow:0 0 0 .125em #485fc740}.is-info.textarea,.is-info.input{border-color:#3e8ed0}.is-info.textarea:focus,.is-info.input:focus,.is-info.is-focused.textarea,.is-info.is-focused.input,.is-info.textarea:active,.is-info.input:active,.is-info.is-active.textarea,.is-info.is-active.input{box-shadow:0 0 0 .125em #3e8ed040}.is-success.textarea,.is-success.input{border-color:#48c78e}.is-success.textarea:focus,.is-success.input:focus,.is-success.is-focused.textarea,.is-success.is-focused.input,.is-success.textarea:active,.is-success.input:active,.is-success.is-active.textarea,.is-success.is-active.input{box-shadow:0 0 0 .125em #48c78e40}.is-warning.textarea,.is-warning.input{border-color:#ffe08a}.is-warning.textarea:focus,.is-warning.input:focus,.is-warning.is-focused.textarea,.is-warning.is-focused.input,.is-warning.textarea:active,.is-warning.input:active,.is-warning.is-active.textarea,.is-warning.is-active.input{box-shadow:0 0 0 .125em #ffe08a40}.is-danger.textarea,.is-danger.input{border-color:#f14668}.is-danger.textarea:focus,.is-danger.input:focus,.is-danger.is-focused.textarea,.is-danger.is-focused.input,.is-danger.textarea:active,.is-danger.input:active,.is-danger.is-active.textarea,.is-danger.is-active.input{box-shadow:0 0 0 .125em #f1466840}.is-small.textarea,.is-small.input{border-radius:2px;font-size:.75rem}.is-medium.textarea,.is-medium.input{font-size:1.25rem}.is-large.textarea,.is-large.input{font-size:1.5rem}.is-fullwidth.textarea,.is-fullwidth.input{width:100%;display:block}.is-inline.textarea,.is-inline.input{width:auto;display:inline}.input.is-rounded{border-radius:9999px;padding-left:calc(1.125em - 1px);padding-right:calc(1.125em - 1px)}.input.is-static{box-shadow:none;background-color:#0000;border-color:#0000;padding-left:0;padding-right:0}.textarea{max-width:100%;min-width:100%;resize:vertical;padding:calc(.75em - 1px);display:block}.textarea:not([rows]){max-height:40em;min-height:8em}.textarea[rows]{height:initial}.textarea.has-fixed-size{resize:none}.radio,.checkbox{cursor:pointer;line-height:1.25;display:inline-block;position:relative}.radio input,.checkbox input{cursor:pointer}.radio:hover,.checkbox:hover{color:#363636}[disabled].radio,[disabled].checkbox,fieldset[disabled] .radio,fieldset[disabled] .checkbox,.radio input[disabled],.checkbox input[disabled]{color:#7a7a7a;cursor:not-allowed}.radio+.radio{margin-left:.5em}.select{max-width:100%;vertical-align:top;display:inline-block;position:relative}.select:not(.is-multiple){height:2.5em}.select:not(.is-multiple):not(.is-loading):after{z-index:4;border-color:#485fc7;right:1.125em}.select.is-rounded select{border-radius:9999px;padding-left:1em}.select select{cursor:pointer;max-width:100%;outline:none;font-size:1em;display:block}.select select::-ms-expand{display:none}.select select[disabled]:hover,fieldset[disabled] .select select:hover{border-color:#f5f5f5}.select select:not([multiple]){padding-right:2.5em}.select select[multiple]{height:auto;padding:0}.select select[multiple] option{padding:.5em 1em}.select:not(.is-multiple):not(.is-loading):hover:after{border-color:#363636}.select.is-white:not(:hover):after,.select.is-white select{border-color:#fff}.select.is-white select:hover,.select.is-white select.is-hovered{border-color:#f2f2f2}.select.is-white select:focus,.select.is-white select.is-focused,.select.is-white select:active,.select.is-white select.is-active{box-shadow:0 0 0 .125em #ffffff40}.select.is-black:not(:hover):after,.select.is-black select{border-color:#0a0a0a}.select.is-black select:hover,.select.is-black select.is-hovered{border-color:#000}.select.is-black select:focus,.select.is-black select.is-focused,.select.is-black select:active,.select.is-black select.is-active{box-shadow:0 0 0 .125em #0a0a0a40}.select.is-light:not(:hover):after,.select.is-light select{border-color:#f5f5f5}.select.is-light select:hover,.select.is-light select.is-hovered{border-color:#e8e8e8}.select.is-light select:focus,.select.is-light select.is-focused,.select.is-light select:active,.select.is-light select.is-active{box-shadow:0 0 0 .125em #f5f5f540}.select.is-dark:not(:hover):after,.select.is-dark select{border-color:#363636}.select.is-dark select:hover,.select.is-dark select.is-hovered{border-color:#292929}.select.is-dark select:focus,.select.is-dark select.is-focused,.select.is-dark select:active,.select.is-dark select.is-active{box-shadow:0 0 0 .125em #36363640}.select.is-primary:not(:hover):after,.select.is-primary select{border-color:#00d1b2}.select.is-primary select:hover,.select.is-primary select.is-hovered{border-color:#00b89c}.select.is-primary select:focus,.select.is-primary select.is-focused,.select.is-primary select:active,.select.is-primary select.is-active{box-shadow:0 0 0 .125em #00d1b240}.select.is-link:not(:hover):after,.select.is-link select{border-color:#485fc7}.select.is-link select:hover,.select.is-link select.is-hovered{border-color:#3a51bb}.select.is-link select:focus,.select.is-link select.is-focused,.select.is-link select:active,.select.is-link select.is-active{box-shadow:0 0 0 .125em #485fc740}.select.is-info:not(:hover):after,.select.is-info select{border-color:#3e8ed0}.select.is-info select:hover,.select.is-info select.is-hovered{border-color:#3082c5}.select.is-info select:focus,.select.is-info select.is-focused,.select.is-info select:active,.select.is-info select.is-active{box-shadow:0 0 0 .125em #3e8ed040}.select.is-success:not(:hover):after,.select.is-success select{border-color:#48c78e}.select.is-success select:hover,.select.is-success select.is-hovered{border-color:#3abb81}.select.is-success select:focus,.select.is-success select.is-focused,.select.is-success select:active,.select.is-success select.is-active{box-shadow:0 0 0 .125em #48c78e40}.select.is-warning:not(:hover):after,.select.is-warning select{border-color:#ffe08a}.select.is-warning select:hover,.select.is-warning select.is-hovered{border-color:#ffd970}.select.is-warning select:focus,.select.is-warning select.is-focused,.select.is-warning select:active,.select.is-warning select.is-active{box-shadow:0 0 0 .125em #ffe08a40}.select.is-danger:not(:hover):after,.select.is-danger select{border-color:#f14668}.select.is-danger select:hover,.select.is-danger select.is-hovered{border-color:#ef2e55}.select.is-danger select:focus,.select.is-danger select.is-focused,.select.is-danger select:active,.select.is-danger select.is-active{box-shadow:0 0 0 .125em #f1466840}.select.is-small{border-radius:2px;font-size:.75rem}.select.is-medium{font-size:1.25rem}.select.is-large{font-size:1.5rem}.select.is-disabled:after{opacity:.5;border-color:#7a7a7a!important}.select.is-fullwidth,.select.is-fullwidth select{width:100%}.select.is-loading:after{margin-top:0;position:absolute;top:.625em;right:.625em;transform:none}.select.is-loading.is-small:after{font-size:.75rem}.select.is-loading.is-medium:after{font-size:1.25rem}.select.is-loading.is-large:after{font-size:1.5rem}.file{justify-content:flex-start;align-items:stretch;display:flex;position:relative}.file.is-white .file-cta{color:#0a0a0a;background-color:#fff;border-color:#0000}.file.is-white:hover .file-cta,.file.is-white.is-hovered .file-cta{color:#0a0a0a;background-color:#f9f9f9;border-color:#0000}.file.is-white:focus .file-cta,.file.is-white.is-focused .file-cta{color:#0a0a0a;border-color:#0000;box-shadow:0 0 .5em #ffffff40}.file.is-white:active .file-cta,.file.is-white.is-active .file-cta{color:#0a0a0a;background-color:#f2f2f2;border-color:#0000}.file.is-black .file-cta{color:#fff;background-color:#0a0a0a;border-color:#0000}.file.is-black:hover .file-cta,.file.is-black.is-hovered .file-cta{color:#fff;background-color:#040404;border-color:#0000}.file.is-black:focus .file-cta,.file.is-black.is-focused .file-cta{color:#fff;border-color:#0000;box-shadow:0 0 .5em #0a0a0a40}.file.is-black:active .file-cta,.file.is-black.is-active .file-cta{color:#fff;background-color:#000;border-color:#0000}.file.is-light .file-cta{color:#000000b3;background-color:#f5f5f5;border-color:#0000}.file.is-light:hover .file-cta,.file.is-light.is-hovered .file-cta{color:#000000b3;background-color:#eee;border-color:#0000}.file.is-light:focus .file-cta,.file.is-light.is-focused .file-cta{color:#000000b3;border-color:#0000;box-shadow:0 0 .5em #f5f5f540}.file.is-light:active .file-cta,.file.is-light.is-active .file-cta{color:#000000b3;background-color:#e8e8e8;border-color:#0000}.file.is-dark .file-cta{color:#fff;background-color:#363636;border-color:#0000}.file.is-dark:hover .file-cta,.file.is-dark.is-hovered .file-cta{color:#fff;background-color:#2f2f2f;border-color:#0000}.file.is-dark:focus .file-cta,.file.is-dark.is-focused .file-cta{color:#fff;border-color:#0000;box-shadow:0 0 .5em #36363640}.file.is-dark:active .file-cta,.file.is-dark.is-active .file-cta{color:#fff;background-color:#292929;border-color:#0000}.file.is-primary .file-cta{color:#fff;background-color:#00d1b2;border-color:#0000}.file.is-primary:hover .file-cta,.file.is-primary.is-hovered .file-cta{color:#fff;background-color:#00c4a7;border-color:#0000}.file.is-primary:focus .file-cta,.file.is-primary.is-focused .file-cta{color:#fff;border-color:#0000;box-shadow:0 0 .5em #00d1b240}.file.is-primary:active .file-cta,.file.is-primary.is-active .file-cta{color:#fff;background-color:#00b89c;border-color:#0000}.file.is-link .file-cta{color:#fff;background-color:#485fc7;border-color:#0000}.file.is-link:hover .file-cta,.file.is-link.is-hovered .file-cta{color:#fff;background-color:#3e56c4;border-color:#0000}.file.is-link:focus .file-cta,.file.is-link.is-focused .file-cta{color:#fff;border-color:#0000;box-shadow:0 0 .5em #485fc740}.file.is-link:active .file-cta,.file.is-link.is-active .file-cta{color:#fff;background-color:#3a51bb;border-color:#0000}.file.is-info .file-cta{color:#fff;background-color:#3e8ed0;border-color:#0000}.file.is-info:hover .file-cta,.file.is-info.is-hovered .file-cta{color:#fff;background-color:#3488ce;border-color:#0000}.file.is-info:focus .file-cta,.file.is-info.is-focused .file-cta{color:#fff;border-color:#0000;box-shadow:0 0 .5em #3e8ed040}.file.is-info:active .file-cta,.file.is-info.is-active .file-cta{color:#fff;background-color:#3082c5;border-color:#0000}.file.is-success .file-cta{color:#fff;background-color:#48c78e;border-color:#0000}.file.is-success:hover .file-cta,.file.is-success.is-hovered .file-cta{color:#fff;background-color:#3ec487;border-color:#0000}.file.is-success:focus .file-cta,.file.is-success.is-focused .file-cta{color:#fff;border-color:#0000;box-shadow:0 0 .5em #48c78e40}.file.is-success:active .file-cta,.file.is-success.is-active .file-cta{color:#fff;background-color:#3abb81;border-color:#0000}.file.is-warning .file-cta{color:#000000b3;background-color:#ffe08a;border-color:#0000}.file.is-warning:hover .file-cta,.file.is-warning.is-hovered .file-cta{color:#000000b3;background-color:#ffdc7d;border-color:#0000}.file.is-warning:focus .file-cta,.file.is-warning.is-focused .file-cta{color:#000000b3;border-color:#0000;box-shadow:0 0 .5em #ffe08a40}.file.is-warning:active .file-cta,.file.is-warning.is-active .file-cta{color:#000000b3;background-color:#ffd970;border-color:#0000}.file.is-danger .file-cta{color:#fff;background-color:#f14668;border-color:#0000}.file.is-danger:hover .file-cta,.file.is-danger.is-hovered .file-cta{color:#fff;background-color:#f03a5f;border-color:#0000}.file.is-danger:focus .file-cta,.file.is-danger.is-focused .file-cta{color:#fff;border-color:#0000;box-shadow:0 0 .5em #f1466840}.file.is-danger:active .file-cta,.file.is-danger.is-active .file-cta{color:#fff;background-color:#ef2e55;border-color:#0000}.file.is-small{font-size:.75rem}.file.is-normal{font-size:1rem}.file.is-medium{font-size:1.25rem}.file.is-medium .file-icon .fa{font-size:21px}.file.is-large{font-size:1.5rem}.file.is-large .file-icon .fa{font-size:28px}.file.has-name .file-cta{border-top-right-radius:0;border-bottom-right-radius:0}.file.has-name .file-name{border-top-left-radius:0;border-bottom-left-radius:0}.file.has-name.is-empty .file-cta{border-radius:4px}.file.has-name.is-empty .file-name{display:none}.file.is-boxed .file-label{flex-direction:column}.file.is-boxed .file-cta{height:auto;flex-direction:column;padding:1em 3em}.file.is-boxed .file-name{border-width:0 1px 1px}.file.is-boxed .file-icon{height:1.5em;width:1.5em}.file.is-boxed .file-icon .fa{font-size:21px}.file.is-boxed.is-small .file-icon .fa{font-size:14px}.file.is-boxed.is-medium .file-icon .fa{font-size:28px}.file.is-boxed.is-large .file-icon .fa{font-size:35px}.file.is-boxed.has-name .file-cta{border-radius:4px 4px 0 0}.file.is-boxed.has-name .file-name{border-width:0 1px 1px;border-radius:0 0 4px 4px}.file.is-centered{justify-content:center}.file.is-fullwidth .file-label{width:100%}.file.is-fullwidth .file-name{max-width:none;flex-grow:1}.file.is-right{justify-content:flex-end}.file.is-right .file-cta{border-radius:0 4px 4px 0}.file.is-right .file-name{border-width:1px 0 1px 1px;border-radius:4px 0 0 4px;order:-1}.file-label{cursor:pointer;justify-content:flex-start;align-items:stretch;display:flex;position:relative;overflow:hidden}.file-label:hover .file-cta{color:#363636;background-color:#eee}.file-label:hover .file-name{border-color:#d5d5d5}.file-label:active .file-cta{color:#363636;background-color:#e8e8e8}.file-label:active .file-name{border-color:#cfcfcf}.file-input{height:100%;opacity:0;width:100%;outline:none;position:absolute;top:0;left:0}.file-cta,.file-name{white-space:nowrap;border-color:#dbdbdb;border-radius:4px;padding-left:1em;padding-right:1em;font-size:1em}.file-cta{color:#4a4a4a;background-color:#f5f5f5}.file-name{max-width:16em;text-align:inherit;text-overflow:ellipsis;border:1px solid #dbdbdb;border-left-width:0;display:block;overflow:hidden}.file-icon{height:1em;width:1em;justify-content:center;align-items:center;margin-right:.5em;display:flex}.file-icon .fa{font-size:14px}.label{color:#363636;font-size:1rem;font-weight:700;display:block}.label:not(:last-child){margin-bottom:.5em}.label.is-small{font-size:.75rem}.label.is-medium{font-size:1.25rem}.label.is-large{font-size:1.5rem}.help{margin-top:.25rem;font-size:.75rem;display:block}.help.is-white{color:#fff}.help.is-black{color:#0a0a0a}.help.is-light{color:#f5f5f5}.help.is-dark{color:#363636}.help.is-primary{color:#00d1b2}.help.is-link{color:#485fc7}.help.is-info{color:#3e8ed0}.help.is-success{color:#48c78e}.help.is-warning{color:#ffe08a}.help.is-danger{color:#f14668}.field:not(:last-child){margin-bottom:.75rem}.field.has-addons{justify-content:flex-start;display:flex}.field.has-addons .control:not(:last-child){margin-right:-1px}.field.has-addons .control:not(:first-child):not(:last-child) .button,.field.has-addons .control:not(:first-child):not(:last-child) .input,.field.has-addons .control:not(:first-child):not(:last-child) .select select{border-radius:0}.field.has-addons .control:first-child:not(:only-child) .button,.field.has-addons .control:first-child:not(:only-child) .input,.field.has-addons .control:first-child:not(:only-child) .select select{border-top-right-radius:0;border-bottom-right-radius:0}.field.has-addons .control:last-child:not(:only-child) .button,.field.has-addons .control:last-child:not(:only-child) .input,.field.has-addons .control:last-child:not(:only-child) .select select{border-top-left-radius:0;border-bottom-left-radius:0}.field.has-addons .control .button:not([disabled]):hover,.field.has-addons .control .button:not([disabled]).is-hovered,.field.has-addons .control .input:not([disabled]):hover,.field.has-addons .control .input:not([disabled]).is-hovered,.field.has-addons .control .select select:not([disabled]):hover,.field.has-addons .control .select select:not([disabled]).is-hovered{z-index:2}.field.has-addons .control .button:not([disabled]):focus,.field.has-addons .control .button:not([disabled]).is-focused,.field.has-addons .control .button:not([disabled]):active,.field.has-addons .control .button:not([disabled]).is-active,.field.has-addons .control .input:not([disabled]):focus,.field.has-addons .control .input:not([disabled]).is-focused,.field.has-addons .control .input:not([disabled]):active,.field.has-addons .control .input:not([disabled]).is-active,.field.has-addons .control .select select:not([disabled]):focus,.field.has-addons .control .select select:not([disabled]).is-focused,.field.has-addons .control .select select:not([disabled]):active,.field.has-addons .control .select select:not([disabled]).is-active{z-index:3}.field.has-addons .control .button:not([disabled]):focus:hover,.field.has-addons .control .button:not([disabled]).is-focused:hover,.field.has-addons .control .button:not([disabled]):active:hover,.field.has-addons .control .button:not([disabled]).is-active:hover,.field.has-addons .control .input:not([disabled]):focus:hover,.field.has-addons .control .input:not([disabled]).is-focused:hover,.field.has-addons .control .input:not([disabled]):active:hover,.field.has-addons .control .input:not([disabled]).is-active:hover,.field.has-addons .control .select select:not([disabled]):focus:hover,.field.has-addons .control .select select:not([disabled]).is-focused:hover,.field.has-addons .control .select select:not([disabled]):active:hover,.field.has-addons .control .select select:not([disabled]).is-active:hover{z-index:4}.field.has-addons .control.is-expanded{flex-grow:1;flex-shrink:1}.field.has-addons.has-addons-centered{justify-content:center}.field.has-addons.has-addons-right{justify-content:flex-end}.field.has-addons.has-addons-fullwidth .control{flex-grow:1;flex-shrink:0}.field.is-grouped{justify-content:flex-start;display:flex}.field.is-grouped>.control{flex-shrink:0}.field.is-grouped>.control:not(:last-child){margin-bottom:0;margin-right:.75rem}.field.is-grouped>.control.is-expanded{flex-grow:1;flex-shrink:1}.field.is-grouped.is-grouped-centered{justify-content:center}.field.is-grouped.is-grouped-right{justify-content:flex-end}.field.is-grouped.is-grouped-multiline{flex-wrap:wrap}.field.is-grouped.is-grouped-multiline>.control:last-child,.field.is-grouped.is-grouped-multiline>.control:not(:last-child){margin-bottom:.75rem}.field.is-grouped.is-grouped-multiline:last-child{margin-bottom:-.75rem}.field.is-grouped.is-grouped-multiline:not(:last-child){margin-bottom:0}@media screen and (min-width:769px),print{.field.is-horizontal{display:flex}}.field-label .label{font-size:inherit}@media screen and (max-width:768px){.field-label{margin-bottom:.5rem}}@media screen and (min-width:769px),print{.field-label{text-align:right;flex:1 0 0;margin-right:1.5rem}.field-label.is-small{padding-top:.375em;font-size:.75rem}.field-label.is-normal{padding-top:.375em}.field-label.is-medium{padding-top:.375em;font-size:1.25rem}.field-label.is-large{padding-top:.375em;font-size:1.5rem}}.field-body .field .field{margin-bottom:0}@media screen and (min-width:769px),print{.field-body{flex:5 1 0;display:flex}.field-body .field{margin-bottom:0}.field-body>.field{flex-shrink:1}.field-body>.field:not(.is-narrow){flex-grow:1}.field-body>.field:not(:last-child){margin-right:.75rem}}.control{box-sizing:border-box;clear:both;text-align:inherit;font-size:1rem;position:relative}.control.has-icons-left .input:focus~.icon,.control.has-icons-left .select:focus~.icon,.control.has-icons-right .input:focus~.icon,.control.has-icons-right .select:focus~.icon{color:#4a4a4a}.control.has-icons-left .input.is-small~.icon,.control.has-icons-left .select.is-small~.icon,.control.has-icons-right .input.is-small~.icon,.control.has-icons-right .select.is-small~.icon{font-size:.75rem}.control.has-icons-left .input.is-medium~.icon,.control.has-icons-left .select.is-medium~.icon,.control.has-icons-right .input.is-medium~.icon,.control.has-icons-right .select.is-medium~.icon{font-size:1.25rem}.control.has-icons-left .input.is-large~.icon,.control.has-icons-left .select.is-large~.icon,.control.has-icons-right .input.is-large~.icon,.control.has-icons-right .select.is-large~.icon{font-size:1.5rem}.control.has-icons-left .icon,.control.has-icons-right .icon{color:#dbdbdb;height:2.5em;pointer-events:none;width:2.5em;z-index:4;position:absolute;top:0}.control.has-icons-left .input,.control.has-icons-left .select select{padding-left:2.5em}.control.has-icons-left .icon.is-left{left:0}.control.has-icons-right .input,.control.has-icons-right .select select{padding-right:2.5em}.control.has-icons-right .icon.is-right{right:0}.control.is-loading:after{z-index:4;top:.625em;right:.625em;position:absolute!important}.control.is-loading.is-small:after{font-size:.75rem}.control.is-loading.is-medium:after{font-size:1.25rem}.control.is-loading.is-large:after{font-size:1.5rem}.breadcrumb{white-space:nowrap;font-size:1rem}.breadcrumb a{color:#485fc7;justify-content:center;align-items:center;padding:0 .75em;display:flex}.breadcrumb a:hover{color:#363636}.breadcrumb li{align-items:center;display:flex}.breadcrumb li:first-child a{padding-left:0}.breadcrumb li.is-active a{color:#363636;cursor:default;pointer-events:none}.breadcrumb li+li:before{color:#b5b5b5;content:"/"}.breadcrumb ul,.breadcrumb ol{flex-wrap:wrap;justify-content:flex-start;align-items:flex-start;display:flex}.breadcrumb .icon:first-child{margin-right:.5em}.breadcrumb .icon:last-child{margin-left:.5em}.breadcrumb.is-centered ol,.breadcrumb.is-centered ul{justify-content:center}.breadcrumb.is-right ol,.breadcrumb.is-right ul{justify-content:flex-end}.breadcrumb.is-small{font-size:.75rem}.breadcrumb.is-medium{font-size:1.25rem}.breadcrumb.is-large{font-size:1.5rem}.breadcrumb.has-arrow-separator li+li:before{content:"→"}.breadcrumb.has-bullet-separator li+li:before{content:"•"}.breadcrumb.has-dot-separator li+li:before{content:"·"}.breadcrumb.has-succeeds-separator li+li:before{content:"≻"}.card{color:#4a4a4a;max-width:100%;background-color:#fff;border-radius:.25rem;position:relative;box-shadow:0 .5em 1em -.125em #0a0a0a1a,0 0 0 1px #0a0a0a05}.card-footer:first-child,.card-content:first-child,.card-header:first-child{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.card-footer:last-child,.card-content:last-child,.card-header:last-child{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.card-header{background-color:#0000;align-items:stretch;display:flex;box-shadow:0 .125em .25em #0a0a0a1a}.card-header-title{color:#363636;flex-grow:1;align-items:center;padding:.75rem 1rem;font-weight:700;display:flex}.card-header-title.is-centered{justify-content:center}.card-header-icon{-webkit-appearance:none;appearance:none;color:currentColor;cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;margin:0;padding:.75rem 1rem;font-family:inherit;font-size:1em;display:flex}.card-image{display:block;position:relative}.card-image:first-child img{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.card-image:last-child img{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.card-content{background-color:#0000;padding:1.5rem}.card-footer{background-color:#0000;border-top:1px solid #ededed;align-items:stretch;display:flex}.card-footer-item{flex:1 0 0;justify-content:center;align-items:center;padding:.75rem;display:flex}.card-footer-item:not(:last-child){border-right:1px solid #ededed}.card .media:not(:last-child){margin-bottom:1.5rem}.dropdown{vertical-align:top;display:inline-flex;position:relative}.dropdown.is-active .dropdown-menu,.dropdown.is-hoverable:hover .dropdown-menu{display:block}.dropdown.is-right .dropdown-menu{left:auto;right:0}.dropdown.is-up .dropdown-menu{padding-bottom:4px;padding-top:initial;top:auto;bottom:100%}.dropdown-menu{min-width:12rem;z-index:20;padding-top:4px;display:none;position:absolute;top:100%;left:0}.dropdown-content{background-color:#fff;border-radius:4px;padding-top:.5rem;padding-bottom:.5rem;box-shadow:0 .5em 1em -.125em #0a0a0a1a,0 0 0 1px #0a0a0a05}.dropdown-item{color:#4a4a4a;padding:.375rem 1rem;font-size:.875rem;line-height:1.5;display:block;position:relative}a.dropdown-item,button.dropdown-item{text-align:inherit;white-space:nowrap;width:100%;padding-right:3rem}a.dropdown-item:hover,button.dropdown-item:hover{color:#0a0a0a;background-color:#f5f5f5}a.dropdown-item.is-active,button.dropdown-item.is-active{color:#fff;background-color:#485fc7}.dropdown-divider{height:1px;background-color:#ededed;border:none;margin:.5rem 0;display:block}.level{justify-content:space-between;align-items:center}.level code{border-radius:4px}.level img{vertical-align:top;display:inline-block}.level.is-mobile,.level.is-mobile .level-left,.level.is-mobile .level-right{display:flex}.level.is-mobile .level-left+.level-right{margin-top:0}.level.is-mobile .level-item:not(:last-child){margin-bottom:0;margin-right:.75rem}.level.is-mobile .level-item:not(.is-narrow){flex-grow:1}@media screen and (min-width:769px),print{.level{display:flex}.level>.level-item:not(.is-narrow){flex-grow:1}}.level-item{flex:none;justify-content:center;align-items:center;display:flex}.level-item .title,.level-item .subtitle{margin-bottom:0}@media screen and (max-width:768px){.level-item:not(:last-child){margin-bottom:.75rem}}.level-left,.level-right{flex:none}.level-left .level-item.is-flexible,.level-right .level-item.is-flexible{flex-grow:1}@media screen and (min-width:769px),print{.level-left .level-item:not(:last-child),.level-right .level-item:not(:last-child){margin-right:.75rem}}.level-left{justify-content:flex-start;align-items:center}@media screen and (max-width:768px){.level-left+.level-right{margin-top:1.5rem}}@media screen and (min-width:769px),print{.level-left{display:flex}}.level-right{justify-content:flex-end;align-items:center}@media screen and (min-width:769px),print{.level-right{display:flex}}.media{text-align:inherit;align-items:flex-start;display:flex}.media .content:not(:last-child){margin-bottom:.75rem}.media .media{border-top:1px solid #dbdbdb80;padding-top:.75rem;display:flex}.media .media .content:not(:last-child),.media .media .control:not(:last-child){margin-bottom:.5rem}.media .media .media{padding-top:.5rem}.media .media .media+.media{margin-top:.5rem}.media+.media{border-top:1px solid #dbdbdb80;margin-top:1rem;padding-top:1rem}.media.is-large+.media{margin-top:1.5rem;padding-top:1.5rem}.media-left,.media-right{flex:none}.media-left{margin-right:1rem}.media-right{margin-left:1rem}.media-content{text-align:inherit;flex:auto}@media screen and (max-width:768px){.media-content{overflow-x:auto}}.menu{font-size:1rem}.menu.is-small{font-size:.75rem}.menu.is-medium{font-size:1.25rem}.menu.is-large{font-size:1.5rem}.menu-list{line-height:1.25}.menu-list a{color:#4a4a4a;border-radius:2px;padding:.5em .75em;display:block}.menu-list a:hover{color:#363636;background-color:#f5f5f5}.menu-list a.is-active{color:#fff;background-color:#485fc7}.menu-list li ul{border-left:1px solid #dbdbdb;margin:.75em;padding-left:.75em}.menu-label{color:#7a7a7a;letter-spacing:.1em;text-transform:uppercase;font-size:.75em}.menu-label:not(:first-child){margin-top:1em}.menu-label:not(:last-child){margin-bottom:1em}.message{background-color:#f5f5f5;border-radius:4px;font-size:1rem}.message strong{color:currentColor}.message a:not(.button):not(.tag):not(.dropdown-item){color:currentColor;text-decoration:underline}.message.is-small{font-size:.75rem}.message.is-medium{font-size:1.25rem}.message.is-large{font-size:1.5rem}.message.is-white{background-color:#fff}.message.is-white .message-header{color:#0a0a0a;background-color:#fff}.message.is-white .message-body{border-color:#fff}.message.is-black{background-color:#fafafa}.message.is-black .message-header{color:#fff;background-color:#0a0a0a}.message.is-black .message-body{border-color:#0a0a0a}.message.is-light{background-color:#fafafa}.message.is-light .message-header{color:#000000b3;background-color:#f5f5f5}.message.is-light .message-body{border-color:#f5f5f5}.message.is-dark{background-color:#fafafa}.message.is-dark .message-header{color:#fff;background-color:#363636}.message.is-dark .message-body{border-color:#363636}.message.is-primary{background-color:#ebfffc}.message.is-primary .message-header{color:#fff;background-color:#00d1b2}.message.is-primary .message-body{color:#00947e;border-color:#00d1b2}.message.is-link{background-color:#eff1fa}.message.is-link .message-header{color:#fff;background-color:#485fc7}.message.is-link .message-body{color:#3850b7;border-color:#485fc7}.message.is-info{background-color:#eff5fb}.message.is-info .message-header{color:#fff;background-color:#3e8ed0}.message.is-info .message-body{color:#296fa8;border-color:#3e8ed0}.message.is-success{background-color:#effaf5}.message.is-success .message-header{color:#fff;background-color:#48c78e}.message.is-success .message-body{color:#257953;border-color:#48c78e}.message.is-warning{background-color:#fffaeb}.message.is-warning .message-header{color:#000000b3;background-color:#ffe08a}.message.is-warning .message-body{color:#946c00;border-color:#ffe08a}.message.is-danger{background-color:#feecf0}.message.is-danger .message-header{color:#fff;background-color:#f14668}.message.is-danger .message-body{color:#cc0f35;border-color:#f14668}.message-header{color:#fff;background-color:#4a4a4a;border-radius:4px 4px 0 0;justify-content:space-between;align-items:center;padding:.75em 1em;font-weight:700;line-height:1.25;display:flex;position:relative}.message-header .delete{flex-grow:0;flex-shrink:0;margin-left:.75em}.message-header+.message-body{border-width:0;border-top-left-radius:0;border-top-right-radius:0}.message-body{color:#4a4a4a;border:0 solid #dbdbdb;border-left-width:4px;border-radius:4px;padding:1.25em 1.5em}.message-body code,.message-body pre{background-color:#fff}.message-body pre code{background-color:#0000}.modal{z-index:40;flex-direction:column;justify-content:center;align-items:center;display:none;position:fixed;overflow:hidden}.modal.is-active{display:flex}.modal-background{background-color:#0a0a0adb}.modal-content,.modal-card{max-height:calc(100vh - 160px);width:100%;margin:0 20px;position:relative;overflow:auto}@media screen and (min-width:769px){.modal-content,.modal-card{max-height:calc(100vh - 40px);width:640px;margin:0 auto}}.modal-close{height:40px;width:40px;background:0 0;position:fixed;top:20px;right:20px}.modal-card{max-height:calc(100vh - 40px);-ms-overflow-y:visible;flex-direction:column;display:flex;overflow:hidden}.modal-card-head,.modal-card-foot{background-color:#f5f5f5;flex-shrink:0;justify-content:flex-start;align-items:center;padding:20px;display:flex;position:relative}.modal-card-head{border-bottom:1px solid #dbdbdb;border-top-left-radius:6px;border-top-right-radius:6px}.modal-card-title{color:#363636;flex-grow:1;flex-shrink:0;font-size:1.5rem;line-height:1}.modal-card-foot{border-top:1px solid #dbdbdb;border-bottom-right-radius:6px;border-bottom-left-radius:6px}.modal-card-foot .button:not(:last-child){margin-right:.5em}.modal-card-body{-webkit-overflow-scrolling:touch;background-color:#fff;flex-grow:1;flex-shrink:1;padding:20px;overflow:auto}.navbar{min-height:3.25rem;z-index:30;background-color:#fff;position:relative}.navbar.is-white{color:#0a0a0a;background-color:#fff}.navbar.is-white .navbar-brand>.navbar-item,.navbar.is-white .navbar-brand .navbar-link{color:#0a0a0a}.navbar.is-white .navbar-brand>a.navbar-item:focus,.navbar.is-white .navbar-brand>a.navbar-item:hover,.navbar.is-white .navbar-brand>a.navbar-item.is-active,.navbar.is-white .navbar-brand .navbar-link:focus,.navbar.is-white .navbar-brand .navbar-link:hover,.navbar.is-white .navbar-brand .navbar-link.is-active{color:#0a0a0a;background-color:#f2f2f2}.navbar.is-white .navbar-brand .navbar-link:after{border-color:#0a0a0a}.navbar.is-white .navbar-burger{color:#0a0a0a}@media screen and (min-width:1024px){.navbar.is-white .navbar-start>.navbar-item,.navbar.is-white .navbar-start .navbar-link,.navbar.is-white .navbar-end>.navbar-item,.navbar.is-white .navbar-end .navbar-link{color:#0a0a0a}.navbar.is-white .navbar-start>a.navbar-item:focus,.navbar.is-white .navbar-start>a.navbar-item:hover,.navbar.is-white .navbar-start>a.navbar-item.is-active,.navbar.is-white .navbar-start .navbar-link:focus,.navbar.is-white .navbar-start .navbar-link:hover,.navbar.is-white .navbar-start .navbar-link.is-active,.navbar.is-white .navbar-end>a.navbar-item:focus,.navbar.is-white .navbar-end>a.navbar-item:hover,.navbar.is-white .navbar-end>a.navbar-item.is-active,.navbar.is-white .navbar-end .navbar-link:focus,.navbar.is-white .navbar-end .navbar-link:hover,.navbar.is-white .navbar-end .navbar-link.is-active{color:#0a0a0a;background-color:#f2f2f2}.navbar.is-white .navbar-start .navbar-link:after,.navbar.is-white .navbar-end .navbar-link:after{border-color:#0a0a0a}.navbar.is-white .navbar-item.has-dropdown:focus .navbar-link,.navbar.is-white .navbar-item.has-dropdown:hover .navbar-link,.navbar.is-white .navbar-item.has-dropdown.is-active .navbar-link{color:#0a0a0a;background-color:#f2f2f2}.navbar.is-white .navbar-dropdown a.navbar-item.is-active{color:#0a0a0a;background-color:#fff}}.navbar.is-black{color:#fff;background-color:#0a0a0a}.navbar.is-black .navbar-brand>.navbar-item,.navbar.is-black .navbar-brand .navbar-link{color:#fff}.navbar.is-black .navbar-brand>a.navbar-item:focus,.navbar.is-black .navbar-brand>a.navbar-item:hover,.navbar.is-black .navbar-brand>a.navbar-item.is-active,.navbar.is-black .navbar-brand .navbar-link:focus,.navbar.is-black .navbar-brand .navbar-link:hover,.navbar.is-black .navbar-brand .navbar-link.is-active{color:#fff;background-color:#000}.navbar.is-black .navbar-brand .navbar-link:after{border-color:#fff}.navbar.is-black .navbar-burger{color:#fff}@media screen and (min-width:1024px){.navbar.is-black .navbar-start>.navbar-item,.navbar.is-black .navbar-start .navbar-link,.navbar.is-black .navbar-end>.navbar-item,.navbar.is-black .navbar-end .navbar-link{color:#fff}.navbar.is-black .navbar-start>a.navbar-item:focus,.navbar.is-black .navbar-start>a.navbar-item:hover,.navbar.is-black .navbar-start>a.navbar-item.is-active,.navbar.is-black .navbar-start .navbar-link:focus,.navbar.is-black .navbar-start .navbar-link:hover,.navbar.is-black .navbar-start .navbar-link.is-active,.navbar.is-black .navbar-end>a.navbar-item:focus,.navbar.is-black .navbar-end>a.navbar-item:hover,.navbar.is-black .navbar-end>a.navbar-item.is-active,.navbar.is-black .navbar-end .navbar-link:focus,.navbar.is-black .navbar-end .navbar-link:hover,.navbar.is-black .navbar-end .navbar-link.is-active{color:#fff;background-color:#000}.navbar.is-black .navbar-start .navbar-link:after,.navbar.is-black .navbar-end .navbar-link:after{border-color:#fff}.navbar.is-black .navbar-item.has-dropdown:focus .navbar-link,.navbar.is-black .navbar-item.has-dropdown:hover .navbar-link,.navbar.is-black .navbar-item.has-dropdown.is-active .navbar-link{color:#fff;background-color:#000}.navbar.is-black .navbar-dropdown a.navbar-item.is-active{color:#fff;background-color:#0a0a0a}}.navbar.is-light{color:#000000b3;background-color:#f5f5f5}.navbar.is-light .navbar-brand>.navbar-item,.navbar.is-light .navbar-brand .navbar-link{color:#000000b3}.navbar.is-light .navbar-brand>a.navbar-item:focus,.navbar.is-light .navbar-brand>a.navbar-item:hover,.navbar.is-light .navbar-brand>a.navbar-item.is-active,.navbar.is-light .navbar-brand .navbar-link:focus,.navbar.is-light .navbar-brand .navbar-link:hover,.navbar.is-light .navbar-brand .navbar-link.is-active{color:#000000b3;background-color:#e8e8e8}.navbar.is-light .navbar-brand .navbar-link:after{border-color:#000000b3}.navbar.is-light .navbar-burger{color:#000000b3}@media screen and (min-width:1024px){.navbar.is-light .navbar-start>.navbar-item,.navbar.is-light .navbar-start .navbar-link,.navbar.is-light .navbar-end>.navbar-item,.navbar.is-light .navbar-end .navbar-link{color:#000000b3}.navbar.is-light .navbar-start>a.navbar-item:focus,.navbar.is-light .navbar-start>a.navbar-item:hover,.navbar.is-light .navbar-start>a.navbar-item.is-active,.navbar.is-light .navbar-start .navbar-link:focus,.navbar.is-light .navbar-start .navbar-link:hover,.navbar.is-light .navbar-start .navbar-link.is-active,.navbar.is-light .navbar-end>a.navbar-item:focus,.navbar.is-light .navbar-end>a.navbar-item:hover,.navbar.is-light .navbar-end>a.navbar-item.is-active,.navbar.is-light .navbar-end .navbar-link:focus,.navbar.is-light .navbar-end .navbar-link:hover,.navbar.is-light .navbar-end .navbar-link.is-active{color:#000000b3;background-color:#e8e8e8}.navbar.is-light .navbar-start .navbar-link:after,.navbar.is-light .navbar-end .navbar-link:after{border-color:#000000b3}.navbar.is-light .navbar-item.has-dropdown:focus .navbar-link,.navbar.is-light .navbar-item.has-dropdown:hover .navbar-link,.navbar.is-light .navbar-item.has-dropdown.is-active .navbar-link{color:#000000b3;background-color:#e8e8e8}.navbar.is-light .navbar-dropdown a.navbar-item.is-active{color:#000000b3;background-color:#f5f5f5}}.navbar.is-dark{color:#fff;background-color:#363636}.navbar.is-dark .navbar-brand>.navbar-item,.navbar.is-dark .navbar-brand .navbar-link{color:#fff}.navbar.is-dark .navbar-brand>a.navbar-item:focus,.navbar.is-dark .navbar-brand>a.navbar-item:hover,.navbar.is-dark .navbar-brand>a.navbar-item.is-active,.navbar.is-dark .navbar-brand .navbar-link:focus,.navbar.is-dark .navbar-brand .navbar-link:hover,.navbar.is-dark .navbar-brand .navbar-link.is-active{color:#fff;background-color:#292929}.navbar.is-dark .navbar-brand .navbar-link:after{border-color:#fff}.navbar.is-dark .navbar-burger{color:#fff}@media screen and (min-width:1024px){.navbar.is-dark .navbar-start>.navbar-item,.navbar.is-dark .navbar-start .navbar-link,.navbar.is-dark .navbar-end>.navbar-item,.navbar.is-dark .navbar-end .navbar-link{color:#fff}.navbar.is-dark .navbar-start>a.navbar-item:focus,.navbar.is-dark .navbar-start>a.navbar-item:hover,.navbar.is-dark .navbar-start>a.navbar-item.is-active,.navbar.is-dark .navbar-start .navbar-link:focus,.navbar.is-dark .navbar-start .navbar-link:hover,.navbar.is-dark .navbar-start .navbar-link.is-active,.navbar.is-dark .navbar-end>a.navbar-item:focus,.navbar.is-dark .navbar-end>a.navbar-item:hover,.navbar.is-dark .navbar-end>a.navbar-item.is-active,.navbar.is-dark .navbar-end .navbar-link:focus,.navbar.is-dark .navbar-end .navbar-link:hover,.navbar.is-dark .navbar-end .navbar-link.is-active{color:#fff;background-color:#292929}.navbar.is-dark .navbar-start .navbar-link:after,.navbar.is-dark .navbar-end .navbar-link:after{border-color:#fff}.navbar.is-dark .navbar-item.has-dropdown:focus .navbar-link,.navbar.is-dark .navbar-item.has-dropdown:hover .navbar-link,.navbar.is-dark .navbar-item.has-dropdown.is-active .navbar-link{color:#fff;background-color:#292929}.navbar.is-dark .navbar-dropdown a.navbar-item.is-active{color:#fff;background-color:#363636}}.navbar.is-primary{color:#fff;background-color:#00d1b2}.navbar.is-primary .navbar-brand>.navbar-item,.navbar.is-primary .navbar-brand .navbar-link{color:#fff}.navbar.is-primary .navbar-brand>a.navbar-item:focus,.navbar.is-primary .navbar-brand>a.navbar-item:hover,.navbar.is-primary .navbar-brand>a.navbar-item.is-active,.navbar.is-primary .navbar-brand .navbar-link:focus,.navbar.is-primary .navbar-brand .navbar-link:hover,.navbar.is-primary .navbar-brand .navbar-link.is-active{color:#fff;background-color:#00b89c}.navbar.is-primary .navbar-brand .navbar-link:after{border-color:#fff}.navbar.is-primary .navbar-burger{color:#fff}@media screen and (min-width:1024px){.navbar.is-primary .navbar-start>.navbar-item,.navbar.is-primary .navbar-start .navbar-link,.navbar.is-primary .navbar-end>.navbar-item,.navbar.is-primary .navbar-end .navbar-link{color:#fff}.navbar.is-primary .navbar-start>a.navbar-item:focus,.navbar.is-primary .navbar-start>a.navbar-item:hover,.navbar.is-primary .navbar-start>a.navbar-item.is-active,.navbar.is-primary .navbar-start .navbar-link:focus,.navbar.is-primary .navbar-start .navbar-link:hover,.navbar.is-primary .navbar-start .navbar-link.is-active,.navbar.is-primary .navbar-end>a.navbar-item:focus,.navbar.is-primary .navbar-end>a.navbar-item:hover,.navbar.is-primary .navbar-end>a.navbar-item.is-active,.navbar.is-primary .navbar-end .navbar-link:focus,.navbar.is-primary .navbar-end .navbar-link:hover,.navbar.is-primary .navbar-end .navbar-link.is-active{color:#fff;background-color:#00b89c}.navbar.is-primary .navbar-start .navbar-link:after,.navbar.is-primary .navbar-end .navbar-link:after{border-color:#fff}.navbar.is-primary .navbar-item.has-dropdown:focus .navbar-link,.navbar.is-primary .navbar-item.has-dropdown:hover .navbar-link,.navbar.is-primary .navbar-item.has-dropdown.is-active .navbar-link{color:#fff;background-color:#00b89c}.navbar.is-primary .navbar-dropdown a.navbar-item.is-active{color:#fff;background-color:#00d1b2}}.navbar.is-link{color:#fff;background-color:#485fc7}.navbar.is-link .navbar-brand>.navbar-item,.navbar.is-link .navbar-brand .navbar-link{color:#fff}.navbar.is-link .navbar-brand>a.navbar-item:focus,.navbar.is-link .navbar-brand>a.navbar-item:hover,.navbar.is-link .navbar-brand>a.navbar-item.is-active,.navbar.is-link .navbar-brand .navbar-link:focus,.navbar.is-link .navbar-brand .navbar-link:hover,.navbar.is-link .navbar-brand .navbar-link.is-active{color:#fff;background-color:#3a51bb}.navbar.is-link .navbar-brand .navbar-link:after{border-color:#fff}.navbar.is-link .navbar-burger{color:#fff}@media screen and (min-width:1024px){.navbar.is-link .navbar-start>.navbar-item,.navbar.is-link .navbar-start .navbar-link,.navbar.is-link .navbar-end>.navbar-item,.navbar.is-link .navbar-end .navbar-link{color:#fff}.navbar.is-link .navbar-start>a.navbar-item:focus,.navbar.is-link .navbar-start>a.navbar-item:hover,.navbar.is-link .navbar-start>a.navbar-item.is-active,.navbar.is-link .navbar-start .navbar-link:focus,.navbar.is-link .navbar-start .navbar-link:hover,.navbar.is-link .navbar-start .navbar-link.is-active,.navbar.is-link .navbar-end>a.navbar-item:focus,.navbar.is-link .navbar-end>a.navbar-item:hover,.navbar.is-link .navbar-end>a.navbar-item.is-active,.navbar.is-link .navbar-end .navbar-link:focus,.navbar.is-link .navbar-end .navbar-link:hover,.navbar.is-link .navbar-end .navbar-link.is-active{color:#fff;background-color:#3a51bb}.navbar.is-link .navbar-start .navbar-link:after,.navbar.is-link .navbar-end .navbar-link:after{border-color:#fff}.navbar.is-link .navbar-item.has-dropdown:focus .navbar-link,.navbar.is-link .navbar-item.has-dropdown:hover .navbar-link,.navbar.is-link .navbar-item.has-dropdown.is-active .navbar-link{color:#fff;background-color:#3a51bb}.navbar.is-link .navbar-dropdown a.navbar-item.is-active{color:#fff;background-color:#485fc7}}.navbar.is-info{color:#fff;background-color:#3e8ed0}.navbar.is-info .navbar-brand>.navbar-item,.navbar.is-info .navbar-brand .navbar-link{color:#fff}.navbar.is-info .navbar-brand>a.navbar-item:focus,.navbar.is-info .navbar-brand>a.navbar-item:hover,.navbar.is-info .navbar-brand>a.navbar-item.is-active,.navbar.is-info .navbar-brand .navbar-link:focus,.navbar.is-info .navbar-brand .navbar-link:hover,.navbar.is-info .navbar-brand .navbar-link.is-active{color:#fff;background-color:#3082c5}.navbar.is-info .navbar-brand .navbar-link:after{border-color:#fff}.navbar.is-info .navbar-burger{color:#fff}@media screen and (min-width:1024px){.navbar.is-info .navbar-start>.navbar-item,.navbar.is-info .navbar-start .navbar-link,.navbar.is-info .navbar-end>.navbar-item,.navbar.is-info .navbar-end .navbar-link{color:#fff}.navbar.is-info .navbar-start>a.navbar-item:focus,.navbar.is-info .navbar-start>a.navbar-item:hover,.navbar.is-info .navbar-start>a.navbar-item.is-active,.navbar.is-info .navbar-start .navbar-link:focus,.navbar.is-info .navbar-start .navbar-link:hover,.navbar.is-info .navbar-start .navbar-link.is-active,.navbar.is-info .navbar-end>a.navbar-item:focus,.navbar.is-info .navbar-end>a.navbar-item:hover,.navbar.is-info .navbar-end>a.navbar-item.is-active,.navbar.is-info .navbar-end .navbar-link:focus,.navbar.is-info .navbar-end .navbar-link:hover,.navbar.is-info .navbar-end .navbar-link.is-active{color:#fff;background-color:#3082c5}.navbar.is-info .navbar-start .navbar-link:after,.navbar.is-info .navbar-end .navbar-link:after{border-color:#fff}.navbar.is-info .navbar-item.has-dropdown:focus .navbar-link,.navbar.is-info .navbar-item.has-dropdown:hover .navbar-link,.navbar.is-info .navbar-item.has-dropdown.is-active .navbar-link{color:#fff;background-color:#3082c5}.navbar.is-info .navbar-dropdown a.navbar-item.is-active{color:#fff;background-color:#3e8ed0}}.navbar.is-success{color:#fff;background-color:#48c78e}.navbar.is-success .navbar-brand>.navbar-item,.navbar.is-success .navbar-brand .navbar-link{color:#fff}.navbar.is-success .navbar-brand>a.navbar-item:focus,.navbar.is-success .navbar-brand>a.navbar-item:hover,.navbar.is-success .navbar-brand>a.navbar-item.is-active,.navbar.is-success .navbar-brand .navbar-link:focus,.navbar.is-success .navbar-brand .navbar-link:hover,.navbar.is-success .navbar-brand .navbar-link.is-active{color:#fff;background-color:#3abb81}.navbar.is-success .navbar-brand .navbar-link:after{border-color:#fff}.navbar.is-success .navbar-burger{color:#fff}@media screen and (min-width:1024px){.navbar.is-success .navbar-start>.navbar-item,.navbar.is-success .navbar-start .navbar-link,.navbar.is-success .navbar-end>.navbar-item,.navbar.is-success .navbar-end .navbar-link{color:#fff}.navbar.is-success .navbar-start>a.navbar-item:focus,.navbar.is-success .navbar-start>a.navbar-item:hover,.navbar.is-success .navbar-start>a.navbar-item.is-active,.navbar.is-success .navbar-start .navbar-link:focus,.navbar.is-success .navbar-start .navbar-link:hover,.navbar.is-success .navbar-start .navbar-link.is-active,.navbar.is-success .navbar-end>a.navbar-item:focus,.navbar.is-success .navbar-end>a.navbar-item:hover,.navbar.is-success .navbar-end>a.navbar-item.is-active,.navbar.is-success .navbar-end .navbar-link:focus,.navbar.is-success .navbar-end .navbar-link:hover,.navbar.is-success .navbar-end .navbar-link.is-active{color:#fff;background-color:#3abb81}.navbar.is-success .navbar-start .navbar-link:after,.navbar.is-success .navbar-end .navbar-link:after{border-color:#fff}.navbar.is-success .navbar-item.has-dropdown:focus .navbar-link,.navbar.is-success .navbar-item.has-dropdown:hover .navbar-link,.navbar.is-success .navbar-item.has-dropdown.is-active .navbar-link{color:#fff;background-color:#3abb81}.navbar.is-success .navbar-dropdown a.navbar-item.is-active{color:#fff;background-color:#48c78e}}.navbar.is-warning{color:#000000b3;background-color:#ffe08a}.navbar.is-warning .navbar-brand>.navbar-item,.navbar.is-warning .navbar-brand .navbar-link{color:#000000b3}.navbar.is-warning .navbar-brand>a.navbar-item:focus,.navbar.is-warning .navbar-brand>a.navbar-item:hover,.navbar.is-warning .navbar-brand>a.navbar-item.is-active,.navbar.is-warning .navbar-brand .navbar-link:focus,.navbar.is-warning .navbar-brand .navbar-link:hover,.navbar.is-warning .navbar-brand .navbar-link.is-active{color:#000000b3;background-color:#ffd970}.navbar.is-warning .navbar-brand .navbar-link:after{border-color:#000000b3}.navbar.is-warning .navbar-burger{color:#000000b3}@media screen and (min-width:1024px){.navbar.is-warning .navbar-start>.navbar-item,.navbar.is-warning .navbar-start .navbar-link,.navbar.is-warning .navbar-end>.navbar-item,.navbar.is-warning .navbar-end .navbar-link{color:#000000b3}.navbar.is-warning .navbar-start>a.navbar-item:focus,.navbar.is-warning .navbar-start>a.navbar-item:hover,.navbar.is-warning .navbar-start>a.navbar-item.is-active,.navbar.is-warning .navbar-start .navbar-link:focus,.navbar.is-warning .navbar-start .navbar-link:hover,.navbar.is-warning .navbar-start .navbar-link.is-active,.navbar.is-warning .navbar-end>a.navbar-item:focus,.navbar.is-warning .navbar-end>a.navbar-item:hover,.navbar.is-warning .navbar-end>a.navbar-item.is-active,.navbar.is-warning .navbar-end .navbar-link:focus,.navbar.is-warning .navbar-end .navbar-link:hover,.navbar.is-warning .navbar-end .navbar-link.is-active{color:#000000b3;background-color:#ffd970}.navbar.is-warning .navbar-start .navbar-link:after,.navbar.is-warning .navbar-end .navbar-link:after{border-color:#000000b3}.navbar.is-warning .navbar-item.has-dropdown:focus .navbar-link,.navbar.is-warning .navbar-item.has-dropdown:hover .navbar-link,.navbar.is-warning .navbar-item.has-dropdown.is-active .navbar-link{color:#000000b3;background-color:#ffd970}.navbar.is-warning .navbar-dropdown a.navbar-item.is-active{color:#000000b3;background-color:#ffe08a}}.navbar.is-danger{color:#fff;background-color:#f14668}.navbar.is-danger .navbar-brand>.navbar-item,.navbar.is-danger .navbar-brand .navbar-link{color:#fff}.navbar.is-danger .navbar-brand>a.navbar-item:focus,.navbar.is-danger .navbar-brand>a.navbar-item:hover,.navbar.is-danger .navbar-brand>a.navbar-item.is-active,.navbar.is-danger .navbar-brand .navbar-link:focus,.navbar.is-danger .navbar-brand .navbar-link:hover,.navbar.is-danger .navbar-brand .navbar-link.is-active{color:#fff;background-color:#ef2e55}.navbar.is-danger .navbar-brand .navbar-link:after{border-color:#fff}.navbar.is-danger .navbar-burger{color:#fff}@media screen and (min-width:1024px){.navbar.is-danger .navbar-start>.navbar-item,.navbar.is-danger .navbar-start .navbar-link,.navbar.is-danger .navbar-end>.navbar-item,.navbar.is-danger .navbar-end .navbar-link{color:#fff}.navbar.is-danger .navbar-start>a.navbar-item:focus,.navbar.is-danger .navbar-start>a.navbar-item:hover,.navbar.is-danger .navbar-start>a.navbar-item.is-active,.navbar.is-danger .navbar-start .navbar-link:focus,.navbar.is-danger .navbar-start .navbar-link:hover,.navbar.is-danger .navbar-start .navbar-link.is-active,.navbar.is-danger .navbar-end>a.navbar-item:focus,.navbar.is-danger .navbar-end>a.navbar-item:hover,.navbar.is-danger .navbar-end>a.navbar-item.is-active,.navbar.is-danger .navbar-end .navbar-link:focus,.navbar.is-danger .navbar-end .navbar-link:hover,.navbar.is-danger .navbar-end .navbar-link.is-active{color:#fff;background-color:#ef2e55}.navbar.is-danger .navbar-start .navbar-link:after,.navbar.is-danger .navbar-end .navbar-link:after{border-color:#fff}.navbar.is-danger .navbar-item.has-dropdown:focus .navbar-link,.navbar.is-danger .navbar-item.has-dropdown:hover .navbar-link,.navbar.is-danger .navbar-item.has-dropdown.is-active .navbar-link{color:#fff;background-color:#ef2e55}.navbar.is-danger .navbar-dropdown a.navbar-item.is-active{color:#fff;background-color:#f14668}}.navbar>.container{min-height:3.25rem;width:100%;align-items:stretch;display:flex}.navbar.has-shadow{box-shadow:0 2px #f5f5f5}.navbar.is-fixed-bottom,.navbar.is-fixed-top{z-index:30;position:fixed;left:0;right:0}.navbar.is-fixed-bottom{bottom:0}.navbar.is-fixed-bottom.has-shadow{box-shadow:0 -2px #f5f5f5}.navbar.is-fixed-top{top:0}html.has-navbar-fixed-top,body.has-navbar-fixed-top{padding-top:3.25rem}html.has-navbar-fixed-bottom,body.has-navbar-fixed-bottom{padding-bottom:3.25rem}.navbar-brand,.navbar-tabs{min-height:3.25rem;flex-shrink:0;align-items:stretch;display:flex}.navbar-brand a.navbar-item:focus,.navbar-brand a.navbar-item:hover{background-color:#0000}.navbar-tabs{-webkit-overflow-scrolling:touch;max-width:100vw;overflow-x:auto;overflow-y:hidden}.navbar-burger{color:#4a4a4a;-webkit-appearance:none;appearance:none;cursor:pointer;height:3.25rem;width:3.25rem;background:0 0;border:none;margin-left:auto;display:block;position:relative}.navbar-burger span{height:1px;transform-origin:50%;width:16px;background-color:currentColor;transition-property:background-color,opacity,transform;transition-duration:86ms;transition-timing-function:ease-out;display:block;position:absolute;left:calc(50% - 8px)}.navbar-burger span:nth-child(1){top:calc(50% - 6px)}.navbar-burger span:nth-child(2){top:calc(50% - 1px)}.navbar-burger span:nth-child(3){top:calc(50% + 4px)}.navbar-burger:hover{background-color:#0000000d}.navbar-burger.is-active span:nth-child(1){transform:translateY(5px)rotate(45deg)}.navbar-burger.is-active span:nth-child(2){opacity:0}.navbar-burger.is-active span:nth-child(3){transform:translateY(-5px)rotate(-45deg)}.navbar-menu{display:none}.navbar-item,.navbar-link{color:#4a4a4a;padding:.5rem .75rem;line-height:1.5;display:block;position:relative}.navbar-item .icon:only-child,.navbar-link .icon:only-child{margin-left:-.25rem;margin-right:-.25rem}a.navbar-item,.navbar-link{cursor:pointer}a.navbar-item:focus,a.navbar-item:focus-within,a.navbar-item:hover,a.navbar-item.is-active,.navbar-link:focus,.navbar-link:focus-within,.navbar-link:hover,.navbar-link.is-active{color:#485fc7;background-color:#fafafa}.navbar-item{flex-grow:0;flex-shrink:0}.navbar-item img{max-height:1.75rem}.navbar-item.has-dropdown{padding:0}.navbar-item.is-expanded{flex-grow:1;flex-shrink:1}.navbar-item.is-tab{min-height:3.25rem;border-bottom:1px solid #0000;padding-bottom:calc(.5rem - 1px)}.navbar-item.is-tab:focus,.navbar-item.is-tab:hover{background-color:#0000;border-bottom-color:#485fc7}.navbar-item.is-tab.is-active{color:#485fc7;background-color:#0000;border-bottom:3px solid #485fc7;padding-bottom:calc(.5rem - 3px)}.navbar-content{flex-grow:1;flex-shrink:1}.navbar-link:not(.is-arrowless){padding-right:2.5em}.navbar-link:not(.is-arrowless):after{border-color:#485fc7;margin-top:-.375em;right:1.125em}.navbar-dropdown{padding-top:.5rem;padding-bottom:.5rem;font-size:.875rem}.navbar-dropdown .navbar-item{padding-left:1.5rem;padding-right:1.5rem}.navbar-divider{height:2px;background-color:#f5f5f5;border:none;margin:.5rem 0;display:none}@media screen and (max-width:1023px){.navbar>.container{display:block}.navbar-brand .navbar-item,.navbar-tabs .navbar-item{align-items:center;display:flex}.navbar-link:after{display:none}.navbar-menu{background-color:#fff;padding:.5rem 0;box-shadow:0 8px 16px #0a0a0a1a}.navbar-menu.is-active{display:block}.navbar.is-fixed-bottom-touch,.navbar.is-fixed-top-touch{z-index:30;position:fixed;left:0;right:0}.navbar.is-fixed-bottom-touch{bottom:0}.navbar.is-fixed-bottom-touch.has-shadow{box-shadow:0 -2px 3px #0a0a0a1a}.navbar.is-fixed-top-touch{top:0}.navbar.is-fixed-top .navbar-menu,.navbar.is-fixed-top-touch .navbar-menu{-webkit-overflow-scrolling:touch;max-height:calc(100vh - 3.25rem);overflow:auto}html.has-navbar-fixed-top-touch,body.has-navbar-fixed-top-touch{padding-top:3.25rem}html.has-navbar-fixed-bottom-touch,body.has-navbar-fixed-bottom-touch{padding-bottom:3.25rem}}@media screen and (min-width:1024px){.navbar,.navbar-menu,.navbar-start,.navbar-end{align-items:stretch;display:flex}.navbar{min-height:3.25rem}.navbar.is-spaced{padding:1rem 2rem}.navbar.is-spaced .navbar-start,.navbar.is-spaced .navbar-end{align-items:center}.navbar.is-spaced a.navbar-item,.navbar.is-spaced .navbar-link{border-radius:4px}.navbar.is-transparent a.navbar-item:focus,.navbar.is-transparent a.navbar-item:hover,.navbar.is-transparent a.navbar-item.is-active,.navbar.is-transparent .navbar-link:focus,.navbar.is-transparent .navbar-link:hover,.navbar.is-transparent .navbar-link.is-active,.navbar.is-transparent .navbar-item.has-dropdown.is-active .navbar-link,.navbar.is-transparent .navbar-item.has-dropdown.is-hoverable:focus .navbar-link,.navbar.is-transparent .navbar-item.has-dropdown.is-hoverable:focus-within .navbar-link,.navbar.is-transparent .navbar-item.has-dropdown.is-hoverable:hover .navbar-link{background-color:#0000!important}.navbar.is-transparent .navbar-dropdown a.navbar-item:focus,.navbar.is-transparent .navbar-dropdown a.navbar-item:hover{color:#0a0a0a;background-color:#f5f5f5}.navbar.is-transparent .navbar-dropdown a.navbar-item.is-active{color:#485fc7;background-color:#f5f5f5}.navbar-burger{display:none}.navbar-item,.navbar-link{align-items:center;display:flex}.navbar-item.has-dropdown{align-items:stretch}.navbar-item.has-dropdown-up .navbar-link:after{transform:rotate(135deg)translate(.25em,-.25em)}.navbar-item.has-dropdown-up .navbar-dropdown{border-top:none;border-bottom:2px solid #dbdbdb;border-radius:6px 6px 0 0;top:auto;bottom:100%;box-shadow:0 -8px 8px #0a0a0a1a}.navbar-item.is-active .navbar-dropdown,.navbar-item.is-hoverable:focus .navbar-dropdown,.navbar-item.is-hoverable:focus-within .navbar-dropdown,.navbar-item.is-hoverable:hover .navbar-dropdown{display:block}.navbar.is-spaced .navbar-item.is-active .navbar-dropdown,.navbar-item.is-active .navbar-dropdown.is-boxed,.navbar.is-spaced .navbar-item.is-hoverable:focus .navbar-dropdown,.navbar-item.is-hoverable:focus .navbar-dropdown.is-boxed,.navbar.is-spaced .navbar-item.is-hoverable:focus-within .navbar-dropdown,.navbar-item.is-hoverable:focus-within .navbar-dropdown.is-boxed,.navbar.is-spaced .navbar-item.is-hoverable:hover .navbar-dropdown,.navbar-item.is-hoverable:hover .navbar-dropdown.is-boxed{opacity:1;pointer-events:auto;transform:translateY(0)}.navbar-menu{flex-grow:1;flex-shrink:0}.navbar-start{justify-content:flex-start;margin-right:auto}.navbar-end{justify-content:flex-end;margin-left:auto}.navbar-dropdown{min-width:100%;z-index:20;background-color:#fff;border-top:2px solid #dbdbdb;border-bottom-right-radius:6px;border-bottom-left-radius:6px;font-size:.875rem;display:none;position:absolute;top:100%;left:0;box-shadow:0 8px 8px #0a0a0a1a}.navbar-dropdown .navbar-item{white-space:nowrap;padding:.375rem 1rem}.navbar-dropdown a.navbar-item{padding-right:3rem}.navbar-dropdown a.navbar-item:focus,.navbar-dropdown a.navbar-item:hover{color:#0a0a0a;background-color:#f5f5f5}.navbar-dropdown a.navbar-item.is-active{color:#485fc7;background-color:#f5f5f5}.navbar.is-spaced .navbar-dropdown,.navbar-dropdown.is-boxed{opacity:0;pointer-events:none;border-top:none;border-radius:6px;transition-property:opacity,transform;transition-duration:86ms;display:block;top:calc(100% - 4px);transform:translateY(-5px);box-shadow:0 8px 8px #0a0a0a1a,0 0 0 1px #0a0a0a1a}.navbar-dropdown.is-right{left:auto;right:0}.navbar-divider{display:block}.navbar>.container .navbar-brand,.container>.navbar .navbar-brand{margin-left:-.75rem}.navbar>.container .navbar-menu,.container>.navbar .navbar-menu{margin-right:-.75rem}.navbar.is-fixed-bottom-desktop,.navbar.is-fixed-top-desktop{z-index:30;position:fixed;left:0;right:0}.navbar.is-fixed-bottom-desktop{bottom:0}.navbar.is-fixed-bottom-desktop.has-shadow{box-shadow:0 -2px 3px #0a0a0a1a}.navbar.is-fixed-top-desktop{top:0}html.has-navbar-fixed-top-desktop,body.has-navbar-fixed-top-desktop{padding-top:3.25rem}html.has-navbar-fixed-bottom-desktop,body.has-navbar-fixed-bottom-desktop{padding-bottom:3.25rem}html.has-spaced-navbar-fixed-top,body.has-spaced-navbar-fixed-top{padding-top:5.25rem}html.has-spaced-navbar-fixed-bottom,body.has-spaced-navbar-fixed-bottom{padding-bottom:5.25rem}a.navbar-item.is-active,.navbar-link.is-active{color:#0a0a0a}a.navbar-item.is-active:not(:focus):not(:hover),.navbar-link.is-active:not(:focus):not(:hover){background-color:#0000}.navbar-item.has-dropdown:focus .navbar-link,.navbar-item.has-dropdown:hover .navbar-link,.navbar-item.has-dropdown.is-active .navbar-link{background-color:#fafafa}}.hero.is-fullheight-with-navbar{min-height:calc(100vh - 3.25rem)}.pagination{margin:-.25rem;font-size:1rem}.pagination.is-small{font-size:.75rem}.pagination.is-medium{font-size:1.25rem}.pagination.is-large{font-size:1.5rem}.pagination.is-rounded .pagination-previous,.pagination.is-rounded .pagination-next{border-radius:9999px;padding-left:1em;padding-right:1em}.pagination.is-rounded .pagination-link{border-radius:9999px}.pagination,.pagination-list{text-align:center;justify-content:center;align-items:center;display:flex}.pagination-previous,.pagination-next,.pagination-link,.pagination-ellipsis{text-align:center;justify-content:center;margin:.25rem;padding-left:.5em;padding-right:.5em;font-size:1em}.pagination-previous,.pagination-next,.pagination-link{color:#363636;min-width:2.5em;border-color:#dbdbdb}.pagination-previous:hover,.pagination-next:hover,.pagination-link:hover{color:#363636;border-color:#b5b5b5}.pagination-previous:focus,.pagination-next:focus,.pagination-link:focus{border-color:#485fc7}.pagination-previous:active,.pagination-next:active,.pagination-link:active{box-shadow:inset 0 1px 2px #0a0a0a33}.pagination-previous[disabled],.pagination-previous.is-disabled,.pagination-next[disabled],.pagination-next.is-disabled,.pagination-link[disabled],.pagination-link.is-disabled{box-shadow:none;color:#7a7a7a;opacity:.5;background-color:#dbdbdb;border-color:#dbdbdb}.pagination-previous,.pagination-next{white-space:nowrap;padding-left:.75em;padding-right:.75em}.pagination-link.is-current{color:#fff;background-color:#485fc7;border-color:#485fc7}.pagination-ellipsis{color:#b5b5b5;pointer-events:none}.pagination-list{flex-wrap:wrap}.pagination-list li{list-style:none}@media screen and (max-width:768px){.pagination{flex-wrap:wrap}.pagination-previous,.pagination-next,.pagination-list li{flex-grow:1;flex-shrink:1}}@media screen and (min-width:769px),print{.pagination-list{flex-grow:1;flex-shrink:1;order:1;justify-content:flex-start}.pagination-previous,.pagination-next,.pagination-link,.pagination-ellipsis{margin-top:0;margin-bottom:0}.pagination-previous{order:2}.pagination-next{order:3}.pagination{justify-content:space-between;margin-top:0;margin-bottom:0}.pagination.is-centered .pagination-previous{order:1}.pagination.is-centered .pagination-list{order:2;justify-content:center}.pagination.is-centered .pagination-next{order:3}.pagination.is-right .pagination-previous{order:1}.pagination.is-right .pagination-next{order:2}.pagination.is-right .pagination-list{order:3;justify-content:flex-end}}.panel{border-radius:6px;font-size:1rem;box-shadow:0 .5em 1em -.125em #0a0a0a1a,0 0 0 1px #0a0a0a05}.panel:not(:last-child){margin-bottom:1.5rem}.panel.is-white .panel-heading{color:#0a0a0a;background-color:#fff}.panel.is-white .panel-tabs a.is-active{border-bottom-color:#fff}.panel.is-white .panel-block.is-active .panel-icon{color:#fff}.panel.is-black .panel-heading{color:#fff;background-color:#0a0a0a}.panel.is-black .panel-tabs a.is-active{border-bottom-color:#0a0a0a}.panel.is-black .panel-block.is-active .panel-icon{color:#0a0a0a}.panel.is-light .panel-heading{color:#000000b3;background-color:#f5f5f5}.panel.is-light .panel-tabs a.is-active{border-bottom-color:#f5f5f5}.panel.is-light .panel-block.is-active .panel-icon{color:#f5f5f5}.panel.is-dark .panel-heading{color:#fff;background-color:#363636}.panel.is-dark .panel-tabs a.is-active{border-bottom-color:#363636}.panel.is-dark .panel-block.is-active .panel-icon{color:#363636}.panel.is-primary .panel-heading{color:#fff;background-color:#00d1b2}.panel.is-primary .panel-tabs a.is-active{border-bottom-color:#00d1b2}.panel.is-primary .panel-block.is-active .panel-icon{color:#00d1b2}.panel.is-link .panel-heading{color:#fff;background-color:#485fc7}.panel.is-link .panel-tabs a.is-active{border-bottom-color:#485fc7}.panel.is-link .panel-block.is-active .panel-icon{color:#485fc7}.panel.is-info .panel-heading{color:#fff;background-color:#3e8ed0}.panel.is-info .panel-tabs a.is-active{border-bottom-color:#3e8ed0}.panel.is-info .panel-block.is-active .panel-icon{color:#3e8ed0}.panel.is-success .panel-heading{color:#fff;background-color:#48c78e}.panel.is-success .panel-tabs a.is-active{border-bottom-color:#48c78e}.panel.is-success .panel-block.is-active .panel-icon{color:#48c78e}.panel.is-warning .panel-heading{color:#000000b3;background-color:#ffe08a}.panel.is-warning .panel-tabs a.is-active{border-bottom-color:#ffe08a}.panel.is-warning .panel-block.is-active .panel-icon{color:#ffe08a}.panel.is-danger .panel-heading{color:#fff;background-color:#f14668}.panel.is-danger .panel-tabs a.is-active{border-bottom-color:#f14668}.panel.is-danger .panel-block.is-active .panel-icon{color:#f14668}.panel-tabs:not(:last-child),.panel-block:not(:last-child){border-bottom:1px solid #ededed}.panel-heading{color:#363636;background-color:#ededed;border-radius:6px 6px 0 0;padding:.75em 1em;font-size:1.25em;font-weight:700;line-height:1.25}.panel-tabs{justify-content:center;align-items:flex-end;font-size:.875em;display:flex}.panel-tabs a{border-bottom:1px solid #dbdbdb;margin-bottom:-1px;padding:.5em}.panel-tabs a.is-active{color:#363636;border-bottom-color:#4a4a4a}.panel-list a{color:#4a4a4a}.panel-list a:hover{color:#485fc7}.panel-block{color:#363636;justify-content:flex-start;align-items:center;padding:.5em .75em;display:flex}.panel-block input[type=checkbox]{margin-right:.75em}.panel-block>.control{width:100%;flex-grow:1;flex-shrink:1}.panel-block.is-wrapped{flex-wrap:wrap}.panel-block.is-active{color:#363636;border-left-color:#485fc7}.panel-block.is-active .panel-icon{color:#485fc7}.panel-block:last-child{border-bottom-right-radius:6px;border-bottom-left-radius:6px}a.panel-block,label.panel-block{cursor:pointer}a.panel-block:hover,label.panel-block:hover{background-color:#f5f5f5}.panel-icon{height:1em;text-align:center;vertical-align:top;width:1em;color:#7a7a7a;margin-right:.75em;font-size:14px;line-height:1em;display:inline-block}.panel-icon .fa{font-size:inherit;line-height:inherit}.tabs{-webkit-overflow-scrolling:touch;white-space:nowrap;justify-content:space-between;align-items:stretch;font-size:1rem;display:flex;overflow-x:auto;overflow-y:hidden}.tabs a{color:#4a4a4a;vertical-align:top;border-bottom:1px solid #dbdbdb;justify-content:center;align-items:center;margin-bottom:-1px;padding:.5em 1em;display:flex}.tabs a:hover{color:#363636;border-bottom-color:#363636}.tabs li{display:block}.tabs li.is-active a{color:#485fc7;border-bottom-color:#485fc7}.tabs ul{border-bottom:1px solid #dbdbdb;flex-grow:1;flex-shrink:0;justify-content:flex-start;align-items:center;display:flex}.tabs ul.is-left{padding-right:.75em}.tabs ul.is-center{flex:none;justify-content:center;padding-left:.75em;padding-right:.75em}.tabs ul.is-right{justify-content:flex-end;padding-left:.75em}.tabs .icon:first-child{margin-right:.5em}.tabs .icon:last-child{margin-left:.5em}.tabs.is-centered ul{justify-content:center}.tabs.is-right ul{justify-content:flex-end}.tabs.is-boxed a{border:1px solid #0000;border-radius:4px 4px 0 0}.tabs.is-boxed a:hover{background-color:#f5f5f5;border-bottom-color:#dbdbdb}.tabs.is-boxed li.is-active a{background-color:#fff;border-color:#dbdbdb;border-bottom-color:#0000!important}.tabs.is-fullwidth li{flex-grow:1;flex-shrink:0}.tabs.is-toggle a{border:1px solid #dbdbdb;margin-bottom:0;position:relative}.tabs.is-toggle a:hover{z-index:2;background-color:#f5f5f5;border-color:#b5b5b5}.tabs.is-toggle li+li{margin-left:-1px}.tabs.is-toggle li:first-child a{border-top-left-radius:4px;border-bottom-left-radius:4px}.tabs.is-toggle li:last-child a{border-top-right-radius:4px;border-bottom-right-radius:4px}.tabs.is-toggle li.is-active a{color:#fff;z-index:1;background-color:#485fc7;border-color:#485fc7}.tabs.is-toggle ul{border-bottom:none}.tabs.is-toggle.is-toggle-rounded li:first-child a{border-top-left-radius:9999px;border-bottom-left-radius:9999px;padding-left:1.25em}.tabs.is-toggle.is-toggle-rounded li:last-child a{border-top-right-radius:9999px;border-bottom-right-radius:9999px;padding-right:1.25em}.tabs.is-small{font-size:.75rem}.tabs.is-medium{font-size:1.25rem}.tabs.is-large{font-size:1.5rem}.column{flex:1 1 0;padding:.75rem;display:block}.columns.is-mobile>.column.is-narrow{width:unset;flex:none}.columns.is-mobile>.column.is-full{width:100%;flex:none}.columns.is-mobile>.column.is-three-quarters{width:75%;flex:none}.columns.is-mobile>.column.is-two-thirds{width:66.6666%;flex:none}.columns.is-mobile>.column.is-half{width:50%;flex:none}.columns.is-mobile>.column.is-one-third{width:33.3333%;flex:none}.columns.is-mobile>.column.is-one-quarter{width:25%;flex:none}.columns.is-mobile>.column.is-one-fifth{width:20%;flex:none}.columns.is-mobile>.column.is-two-fifths{width:40%;flex:none}.columns.is-mobile>.column.is-three-fifths{width:60%;flex:none}.columns.is-mobile>.column.is-four-fifths{width:80%;flex:none}.columns.is-mobile>.column.is-offset-three-quarters{margin-left:75%}.columns.is-mobile>.column.is-offset-two-thirds{margin-left:66.6666%}.columns.is-mobile>.column.is-offset-half{margin-left:50%}.columns.is-mobile>.column.is-offset-one-third{margin-left:33.3333%}.columns.is-mobile>.column.is-offset-one-quarter{margin-left:25%}.columns.is-mobile>.column.is-offset-one-fifth{margin-left:20%}.columns.is-mobile>.column.is-offset-two-fifths{margin-left:40%}.columns.is-mobile>.column.is-offset-three-fifths{margin-left:60%}.columns.is-mobile>.column.is-offset-four-fifths{margin-left:80%}.columns.is-mobile>.column.is-0{width:0%;flex:none}.columns.is-mobile>.column.is-offset-0{margin-left:0%}.columns.is-mobile>.column.is-1{width:8.33333%;flex:none}.columns.is-mobile>.column.is-offset-1{margin-left:8.33333%}.columns.is-mobile>.column.is-2{width:16.6667%;flex:none}.columns.is-mobile>.column.is-offset-2{margin-left:16.6667%}.columns.is-mobile>.column.is-3{width:25%;flex:none}.columns.is-mobile>.column.is-offset-3{margin-left:25%}.columns.is-mobile>.column.is-4{width:33.3333%;flex:none}.columns.is-mobile>.column.is-offset-4{margin-left:33.3333%}.columns.is-mobile>.column.is-5{width:41.6667%;flex:none}.columns.is-mobile>.column.is-offset-5{margin-left:41.6667%}.columns.is-mobile>.column.is-6{width:50%;flex:none}.columns.is-mobile>.column.is-offset-6{margin-left:50%}.columns.is-mobile>.column.is-7{width:58.3333%;flex:none}.columns.is-mobile>.column.is-offset-7{margin-left:58.3333%}.columns.is-mobile>.column.is-8{width:66.6667%;flex:none}.columns.is-mobile>.column.is-offset-8{margin-left:66.6667%}.columns.is-mobile>.column.is-9{width:75%;flex:none}.columns.is-mobile>.column.is-offset-9{margin-left:75%}.columns.is-mobile>.column.is-10{width:83.3333%;flex:none}.columns.is-mobile>.column.is-offset-10{margin-left:83.3333%}.columns.is-mobile>.column.is-11{width:91.6667%;flex:none}.columns.is-mobile>.column.is-offset-11{margin-left:91.6667%}.columns.is-mobile>.column.is-12{width:100%;flex:none}.columns.is-mobile>.column.is-offset-12{margin-left:100%}@media screen and (max-width:768px){.column.is-narrow-mobile{width:unset;flex:none}.column.is-full-mobile{width:100%;flex:none}.column.is-three-quarters-mobile{width:75%;flex:none}.column.is-two-thirds-mobile{width:66.6666%;flex:none}.column.is-half-mobile{width:50%;flex:none}.column.is-one-third-mobile{width:33.3333%;flex:none}.column.is-one-quarter-mobile{width:25%;flex:none}.column.is-one-fifth-mobile{width:20%;flex:none}.column.is-two-fifths-mobile{width:40%;flex:none}.column.is-three-fifths-mobile{width:60%;flex:none}.column.is-four-fifths-mobile{width:80%;flex:none}.column.is-offset-three-quarters-mobile{margin-left:75%}.column.is-offset-two-thirds-mobile{margin-left:66.6666%}.column.is-offset-half-mobile{margin-left:50%}.column.is-offset-one-third-mobile{margin-left:33.3333%}.column.is-offset-one-quarter-mobile{margin-left:25%}.column.is-offset-one-fifth-mobile{margin-left:20%}.column.is-offset-two-fifths-mobile{margin-left:40%}.column.is-offset-three-fifths-mobile{margin-left:60%}.column.is-offset-four-fifths-mobile{margin-left:80%}.column.is-0-mobile{width:0%;flex:none}.column.is-offset-0-mobile{margin-left:0%}.column.is-1-mobile{width:8.33333%;flex:none}.column.is-offset-1-mobile{margin-left:8.33333%}.column.is-2-mobile{width:16.6667%;flex:none}.column.is-offset-2-mobile{margin-left:16.6667%}.column.is-3-mobile{width:25%;flex:none}.column.is-offset-3-mobile{margin-left:25%}.column.is-4-mobile{width:33.3333%;flex:none}.column.is-offset-4-mobile{margin-left:33.3333%}.column.is-5-mobile{width:41.6667%;flex:none}.column.is-offset-5-mobile{margin-left:41.6667%}.column.is-6-mobile{width:50%;flex:none}.column.is-offset-6-mobile{margin-left:50%}.column.is-7-mobile{width:58.3333%;flex:none}.column.is-offset-7-mobile{margin-left:58.3333%}.column.is-8-mobile{width:66.6667%;flex:none}.column.is-offset-8-mobile{margin-left:66.6667%}.column.is-9-mobile{width:75%;flex:none}.column.is-offset-9-mobile{margin-left:75%}.column.is-10-mobile{width:83.3333%;flex:none}.column.is-offset-10-mobile{margin-left:83.3333%}.column.is-11-mobile{width:91.6667%;flex:none}.column.is-offset-11-mobile{margin-left:91.6667%}.column.is-12-mobile{width:100%;flex:none}.column.is-offset-12-mobile{margin-left:100%}}@media screen and (min-width:769px),print{.column.is-narrow,.column.is-narrow-tablet{width:unset;flex:none}.column.is-full,.column.is-full-tablet{width:100%;flex:none}.column.is-three-quarters,.column.is-three-quarters-tablet{width:75%;flex:none}.column.is-two-thirds,.column.is-two-thirds-tablet{width:66.6666%;flex:none}.column.is-half,.column.is-half-tablet{width:50%;flex:none}.column.is-one-third,.column.is-one-third-tablet{width:33.3333%;flex:none}.column.is-one-quarter,.column.is-one-quarter-tablet{width:25%;flex:none}.column.is-one-fifth,.column.is-one-fifth-tablet{width:20%;flex:none}.column.is-two-fifths,.column.is-two-fifths-tablet{width:40%;flex:none}.column.is-three-fifths,.column.is-three-fifths-tablet{width:60%;flex:none}.column.is-four-fifths,.column.is-four-fifths-tablet{width:80%;flex:none}.column.is-offset-three-quarters,.column.is-offset-three-quarters-tablet{margin-left:75%}.column.is-offset-two-thirds,.column.is-offset-two-thirds-tablet{margin-left:66.6666%}.column.is-offset-half,.column.is-offset-half-tablet{margin-left:50%}.column.is-offset-one-third,.column.is-offset-one-third-tablet{margin-left:33.3333%}.column.is-offset-one-quarter,.column.is-offset-one-quarter-tablet{margin-left:25%}.column.is-offset-one-fifth,.column.is-offset-one-fifth-tablet{margin-left:20%}.column.is-offset-two-fifths,.column.is-offset-two-fifths-tablet{margin-left:40%}.column.is-offset-three-fifths,.column.is-offset-three-fifths-tablet{margin-left:60%}.column.is-offset-four-fifths,.column.is-offset-four-fifths-tablet{margin-left:80%}.column.is-0,.column.is-0-tablet{width:0%;flex:none}.column.is-offset-0,.column.is-offset-0-tablet{margin-left:0%}.column.is-1,.column.is-1-tablet{width:8.33333%;flex:none}.column.is-offset-1,.column.is-offset-1-tablet{margin-left:8.33333%}.column.is-2,.column.is-2-tablet{width:16.6667%;flex:none}.column.is-offset-2,.column.is-offset-2-tablet{margin-left:16.6667%}.column.is-3,.column.is-3-tablet{width:25%;flex:none}.column.is-offset-3,.column.is-offset-3-tablet{margin-left:25%}.column.is-4,.column.is-4-tablet{width:33.3333%;flex:none}.column.is-offset-4,.column.is-offset-4-tablet{margin-left:33.3333%}.column.is-5,.column.is-5-tablet{width:41.6667%;flex:none}.column.is-offset-5,.column.is-offset-5-tablet{margin-left:41.6667%}.column.is-6,.column.is-6-tablet{width:50%;flex:none}.column.is-offset-6,.column.is-offset-6-tablet{margin-left:50%}.column.is-7,.column.is-7-tablet{width:58.3333%;flex:none}.column.is-offset-7,.column.is-offset-7-tablet{margin-left:58.3333%}.column.is-8,.column.is-8-tablet{width:66.6667%;flex:none}.column.is-offset-8,.column.is-offset-8-tablet{margin-left:66.6667%}.column.is-9,.column.is-9-tablet{width:75%;flex:none}.column.is-offset-9,.column.is-offset-9-tablet{margin-left:75%}.column.is-10,.column.is-10-tablet{width:83.3333%;flex:none}.column.is-offset-10,.column.is-offset-10-tablet{margin-left:83.3333%}.column.is-11,.column.is-11-tablet{width:91.6667%;flex:none}.column.is-offset-11,.column.is-offset-11-tablet{margin-left:91.6667%}.column.is-12,.column.is-12-tablet{width:100%;flex:none}.column.is-offset-12,.column.is-offset-12-tablet{margin-left:100%}}@media screen and (max-width:1023px){.column.is-narrow-touch{width:unset;flex:none}.column.is-full-touch{width:100%;flex:none}.column.is-three-quarters-touch{width:75%;flex:none}.column.is-two-thirds-touch{width:66.6666%;flex:none}.column.is-half-touch{width:50%;flex:none}.column.is-one-third-touch{width:33.3333%;flex:none}.column.is-one-quarter-touch{width:25%;flex:none}.column.is-one-fifth-touch{width:20%;flex:none}.column.is-two-fifths-touch{width:40%;flex:none}.column.is-three-fifths-touch{width:60%;flex:none}.column.is-four-fifths-touch{width:80%;flex:none}.column.is-offset-three-quarters-touch{margin-left:75%}.column.is-offset-two-thirds-touch{margin-left:66.6666%}.column.is-offset-half-touch{margin-left:50%}.column.is-offset-one-third-touch{margin-left:33.3333%}.column.is-offset-one-quarter-touch{margin-left:25%}.column.is-offset-one-fifth-touch{margin-left:20%}.column.is-offset-two-fifths-touch{margin-left:40%}.column.is-offset-three-fifths-touch{margin-left:60%}.column.is-offset-four-fifths-touch{margin-left:80%}.column.is-0-touch{width:0%;flex:none}.column.is-offset-0-touch{margin-left:0%}.column.is-1-touch{width:8.33333%;flex:none}.column.is-offset-1-touch{margin-left:8.33333%}.column.is-2-touch{width:16.6667%;flex:none}.column.is-offset-2-touch{margin-left:16.6667%}.column.is-3-touch{width:25%;flex:none}.column.is-offset-3-touch{margin-left:25%}.column.is-4-touch{width:33.3333%;flex:none}.column.is-offset-4-touch{margin-left:33.3333%}.column.is-5-touch{width:41.6667%;flex:none}.column.is-offset-5-touch{margin-left:41.6667%}.column.is-6-touch{width:50%;flex:none}.column.is-offset-6-touch{margin-left:50%}.column.is-7-touch{width:58.3333%;flex:none}.column.is-offset-7-touch{margin-left:58.3333%}.column.is-8-touch{width:66.6667%;flex:none}.column.is-offset-8-touch{margin-left:66.6667%}.column.is-9-touch{width:75%;flex:none}.column.is-offset-9-touch{margin-left:75%}.column.is-10-touch{width:83.3333%;flex:none}.column.is-offset-10-touch{margin-left:83.3333%}.column.is-11-touch{width:91.6667%;flex:none}.column.is-offset-11-touch{margin-left:91.6667%}.column.is-12-touch{width:100%;flex:none}.column.is-offset-12-touch{margin-left:100%}}@media screen and (min-width:1024px){.column.is-narrow-desktop{width:unset;flex:none}.column.is-full-desktop{width:100%;flex:none}.column.is-three-quarters-desktop{width:75%;flex:none}.column.is-two-thirds-desktop{width:66.6666%;flex:none}.column.is-half-desktop{width:50%;flex:none}.column.is-one-third-desktop{width:33.3333%;flex:none}.column.is-one-quarter-desktop{width:25%;flex:none}.column.is-one-fifth-desktop{width:20%;flex:none}.column.is-two-fifths-desktop{width:40%;flex:none}.column.is-three-fifths-desktop{width:60%;flex:none}.column.is-four-fifths-desktop{width:80%;flex:none}.column.is-offset-three-quarters-desktop{margin-left:75%}.column.is-offset-two-thirds-desktop{margin-left:66.6666%}.column.is-offset-half-desktop{margin-left:50%}.column.is-offset-one-third-desktop{margin-left:33.3333%}.column.is-offset-one-quarter-desktop{margin-left:25%}.column.is-offset-one-fifth-desktop{margin-left:20%}.column.is-offset-two-fifths-desktop{margin-left:40%}.column.is-offset-three-fifths-desktop{margin-left:60%}.column.is-offset-four-fifths-desktop{margin-left:80%}.column.is-0-desktop{width:0%;flex:none}.column.is-offset-0-desktop{margin-left:0%}.column.is-1-desktop{width:8.33333%;flex:none}.column.is-offset-1-desktop{margin-left:8.33333%}.column.is-2-desktop{width:16.6667%;flex:none}.column.is-offset-2-desktop{margin-left:16.6667%}.column.is-3-desktop{width:25%;flex:none}.column.is-offset-3-desktop{margin-left:25%}.column.is-4-desktop{width:33.3333%;flex:none}.column.is-offset-4-desktop{margin-left:33.3333%}.column.is-5-desktop{width:41.6667%;flex:none}.column.is-offset-5-desktop{margin-left:41.6667%}.column.is-6-desktop{width:50%;flex:none}.column.is-offset-6-desktop{margin-left:50%}.column.is-7-desktop{width:58.3333%;flex:none}.column.is-offset-7-desktop{margin-left:58.3333%}.column.is-8-desktop{width:66.6667%;flex:none}.column.is-offset-8-desktop{margin-left:66.6667%}.column.is-9-desktop{width:75%;flex:none}.column.is-offset-9-desktop{margin-left:75%}.column.is-10-desktop{width:83.3333%;flex:none}.column.is-offset-10-desktop{margin-left:83.3333%}.column.is-11-desktop{width:91.6667%;flex:none}.column.is-offset-11-desktop{margin-left:91.6667%}.column.is-12-desktop{width:100%;flex:none}.column.is-offset-12-desktop{margin-left:100%}}@media screen and (min-width:1216px){.column.is-narrow-widescreen{width:unset;flex:none}.column.is-full-widescreen{width:100%;flex:none}.column.is-three-quarters-widescreen{width:75%;flex:none}.column.is-two-thirds-widescreen{width:66.6666%;flex:none}.column.is-half-widescreen{width:50%;flex:none}.column.is-one-third-widescreen{width:33.3333%;flex:none}.column.is-one-quarter-widescreen{width:25%;flex:none}.column.is-one-fifth-widescreen{width:20%;flex:none}.column.is-two-fifths-widescreen{width:40%;flex:none}.column.is-three-fifths-widescreen{width:60%;flex:none}.column.is-four-fifths-widescreen{width:80%;flex:none}.column.is-offset-three-quarters-widescreen{margin-left:75%}.column.is-offset-two-thirds-widescreen{margin-left:66.6666%}.column.is-offset-half-widescreen{margin-left:50%}.column.is-offset-one-third-widescreen{margin-left:33.3333%}.column.is-offset-one-quarter-widescreen{margin-left:25%}.column.is-offset-one-fifth-widescreen{margin-left:20%}.column.is-offset-two-fifths-widescreen{margin-left:40%}.column.is-offset-three-fifths-widescreen{margin-left:60%}.column.is-offset-four-fifths-widescreen{margin-left:80%}.column.is-0-widescreen{width:0%;flex:none}.column.is-offset-0-widescreen{margin-left:0%}.column.is-1-widescreen{width:8.33333%;flex:none}.column.is-offset-1-widescreen{margin-left:8.33333%}.column.is-2-widescreen{width:16.6667%;flex:none}.column.is-offset-2-widescreen{margin-left:16.6667%}.column.is-3-widescreen{width:25%;flex:none}.column.is-offset-3-widescreen{margin-left:25%}.column.is-4-widescreen{width:33.3333%;flex:none}.column.is-offset-4-widescreen{margin-left:33.3333%}.column.is-5-widescreen{width:41.6667%;flex:none}.column.is-offset-5-widescreen{margin-left:41.6667%}.column.is-6-widescreen{width:50%;flex:none}.column.is-offset-6-widescreen{margin-left:50%}.column.is-7-widescreen{width:58.3333%;flex:none}.column.is-offset-7-widescreen{margin-left:58.3333%}.column.is-8-widescreen{width:66.6667%;flex:none}.column.is-offset-8-widescreen{margin-left:66.6667%}.column.is-9-widescreen{width:75%;flex:none}.column.is-offset-9-widescreen{margin-left:75%}.column.is-10-widescreen{width:83.3333%;flex:none}.column.is-offset-10-widescreen{margin-left:83.3333%}.column.is-11-widescreen{width:91.6667%;flex:none}.column.is-offset-11-widescreen{margin-left:91.6667%}.column.is-12-widescreen{width:100%;flex:none}.column.is-offset-12-widescreen{margin-left:100%}}@media screen and (min-width:1408px){.column.is-narrow-fullhd{width:unset;flex:none}.column.is-full-fullhd{width:100%;flex:none}.column.is-three-quarters-fullhd{width:75%;flex:none}.column.is-two-thirds-fullhd{width:66.6666%;flex:none}.column.is-half-fullhd{width:50%;flex:none}.column.is-one-third-fullhd{width:33.3333%;flex:none}.column.is-one-quarter-fullhd{width:25%;flex:none}.column.is-one-fifth-fullhd{width:20%;flex:none}.column.is-two-fifths-fullhd{width:40%;flex:none}.column.is-three-fifths-fullhd{width:60%;flex:none}.column.is-four-fifths-fullhd{width:80%;flex:none}.column.is-offset-three-quarters-fullhd{margin-left:75%}.column.is-offset-two-thirds-fullhd{margin-left:66.6666%}.column.is-offset-half-fullhd{margin-left:50%}.column.is-offset-one-third-fullhd{margin-left:33.3333%}.column.is-offset-one-quarter-fullhd{margin-left:25%}.column.is-offset-one-fifth-fullhd{margin-left:20%}.column.is-offset-two-fifths-fullhd{margin-left:40%}.column.is-offset-three-fifths-fullhd{margin-left:60%}.column.is-offset-four-fifths-fullhd{margin-left:80%}.column.is-0-fullhd{width:0%;flex:none}.column.is-offset-0-fullhd{margin-left:0%}.column.is-1-fullhd{width:8.33333%;flex:none}.column.is-offset-1-fullhd{margin-left:8.33333%}.column.is-2-fullhd{width:16.6667%;flex:none}.column.is-offset-2-fullhd{margin-left:16.6667%}.column.is-3-fullhd{width:25%;flex:none}.column.is-offset-3-fullhd{margin-left:25%}.column.is-4-fullhd{width:33.3333%;flex:none}.column.is-offset-4-fullhd{margin-left:33.3333%}.column.is-5-fullhd{width:41.6667%;flex:none}.column.is-offset-5-fullhd{margin-left:41.6667%}.column.is-6-fullhd{width:50%;flex:none}.column.is-offset-6-fullhd{margin-left:50%}.column.is-7-fullhd{width:58.3333%;flex:none}.column.is-offset-7-fullhd{margin-left:58.3333%}.column.is-8-fullhd{width:66.6667%;flex:none}.column.is-offset-8-fullhd{margin-left:66.6667%}.column.is-9-fullhd{width:75%;flex:none}.column.is-offset-9-fullhd{margin-left:75%}.column.is-10-fullhd{width:83.3333%;flex:none}.column.is-offset-10-fullhd{margin-left:83.3333%}.column.is-11-fullhd{width:91.6667%;flex:none}.column.is-offset-11-fullhd{margin-left:91.6667%}.column.is-12-fullhd{width:100%;flex:none}.column.is-offset-12-fullhd{margin-left:100%}}.columns{margin-top:-.75rem;margin-left:-.75rem;margin-right:-.75rem}.columns:last-child{margin-bottom:-.75rem}.columns:not(:last-child){margin-bottom:.75rem}.columns.is-centered{justify-content:center}.columns.is-gapless{margin-top:0;margin-left:0;margin-right:0}.columns.is-gapless>.column{margin:0;padding:0!important}.columns.is-gapless:not(:last-child){margin-bottom:1.5rem}.columns.is-gapless:last-child{margin-bottom:0}.columns.is-mobile{display:flex}.columns.is-multiline{flex-wrap:wrap}.columns.is-vcentered{align-items:center}@media screen and (min-width:769px),print{.columns:not(.is-desktop){display:flex}}@media screen and (min-width:1024px){.columns.is-desktop{display:flex}}.columns.is-variable{--columnGap:.75rem;margin-left:calc(-1*var(--columnGap));margin-right:calc(-1*var(--columnGap))}.columns.is-variable>.column{padding-left:var(--columnGap);padding-right:var(--columnGap)}.columns.is-variable.is-0{--columnGap:0rem}@media screen and (max-width:768px){.columns.is-variable.is-0-mobile{--columnGap:0rem}}@media screen and (min-width:769px),print{.columns.is-variable.is-0-tablet{--columnGap:0rem}}@media screen and (min-width:769px) and (max-width:1023px){.columns.is-variable.is-0-tablet-only{--columnGap:0rem}}@media screen and (max-width:1023px){.columns.is-variable.is-0-touch{--columnGap:0rem}}@media screen and (min-width:1024px){.columns.is-variable.is-0-desktop{--columnGap:0rem}}@media screen and (min-width:1024px) and (max-width:1215px){.columns.is-variable.is-0-desktop-only{--columnGap:0rem}}@media screen and (min-width:1216px){.columns.is-variable.is-0-widescreen{--columnGap:0rem}}@media screen and (min-width:1216px) and (max-width:1407px){.columns.is-variable.is-0-widescreen-only{--columnGap:0rem}}@media screen and (min-width:1408px){.columns.is-variable.is-0-fullhd{--columnGap:0rem}}.columns.is-variable.is-1{--columnGap:.25rem}@media screen and (max-width:768px){.columns.is-variable.is-1-mobile{--columnGap:.25rem}}@media screen and (min-width:769px),print{.columns.is-variable.is-1-tablet{--columnGap:.25rem}}@media screen and (min-width:769px) and (max-width:1023px){.columns.is-variable.is-1-tablet-only{--columnGap:.25rem}}@media screen and (max-width:1023px){.columns.is-variable.is-1-touch{--columnGap:.25rem}}@media screen and (min-width:1024px){.columns.is-variable.is-1-desktop{--columnGap:.25rem}}@media screen and (min-width:1024px) and (max-width:1215px){.columns.is-variable.is-1-desktop-only{--columnGap:.25rem}}@media screen and (min-width:1216px){.columns.is-variable.is-1-widescreen{--columnGap:.25rem}}@media screen and (min-width:1216px) and (max-width:1407px){.columns.is-variable.is-1-widescreen-only{--columnGap:.25rem}}@media screen and (min-width:1408px){.columns.is-variable.is-1-fullhd{--columnGap:.25rem}}.columns.is-variable.is-2{--columnGap:.5rem}@media screen and (max-width:768px){.columns.is-variable.is-2-mobile{--columnGap:.5rem}}@media screen and (min-width:769px),print{.columns.is-variable.is-2-tablet{--columnGap:.5rem}}@media screen and (min-width:769px) and (max-width:1023px){.columns.is-variable.is-2-tablet-only{--columnGap:.5rem}}@media screen and (max-width:1023px){.columns.is-variable.is-2-touch{--columnGap:.5rem}}@media screen and (min-width:1024px){.columns.is-variable.is-2-desktop{--columnGap:.5rem}}@media screen and (min-width:1024px) and (max-width:1215px){.columns.is-variable.is-2-desktop-only{--columnGap:.5rem}}@media screen and (min-width:1216px){.columns.is-variable.is-2-widescreen{--columnGap:.5rem}}@media screen and (min-width:1216px) and (max-width:1407px){.columns.is-variable.is-2-widescreen-only{--columnGap:.5rem}}@media screen and (min-width:1408px){.columns.is-variable.is-2-fullhd{--columnGap:.5rem}}.columns.is-variable.is-3{--columnGap:.75rem}@media screen and (max-width:768px){.columns.is-variable.is-3-mobile{--columnGap:.75rem}}@media screen and (min-width:769px),print{.columns.is-variable.is-3-tablet{--columnGap:.75rem}}@media screen and (min-width:769px) and (max-width:1023px){.columns.is-variable.is-3-tablet-only{--columnGap:.75rem}}@media screen and (max-width:1023px){.columns.is-variable.is-3-touch{--columnGap:.75rem}}@media screen and (min-width:1024px){.columns.is-variable.is-3-desktop{--columnGap:.75rem}}@media screen and (min-width:1024px) and (max-width:1215px){.columns.is-variable.is-3-desktop-only{--columnGap:.75rem}}@media screen and (min-width:1216px){.columns.is-variable.is-3-widescreen{--columnGap:.75rem}}@media screen and (min-width:1216px) and (max-width:1407px){.columns.is-variable.is-3-widescreen-only{--columnGap:.75rem}}@media screen and (min-width:1408px){.columns.is-variable.is-3-fullhd{--columnGap:.75rem}}.columns.is-variable.is-4{--columnGap:1rem}@media screen and (max-width:768px){.columns.is-variable.is-4-mobile{--columnGap:1rem}}@media screen and (min-width:769px),print{.columns.is-variable.is-4-tablet{--columnGap:1rem}}@media screen and (min-width:769px) and (max-width:1023px){.columns.is-variable.is-4-tablet-only{--columnGap:1rem}}@media screen and (max-width:1023px){.columns.is-variable.is-4-touch{--columnGap:1rem}}@media screen and (min-width:1024px){.columns.is-variable.is-4-desktop{--columnGap:1rem}}@media screen and (min-width:1024px) and (max-width:1215px){.columns.is-variable.is-4-desktop-only{--columnGap:1rem}}@media screen and (min-width:1216px){.columns.is-variable.is-4-widescreen{--columnGap:1rem}}@media screen and (min-width:1216px) and (max-width:1407px){.columns.is-variable.is-4-widescreen-only{--columnGap:1rem}}@media screen and (min-width:1408px){.columns.is-variable.is-4-fullhd{--columnGap:1rem}}.columns.is-variable.is-5{--columnGap:1.25rem}@media screen and (max-width:768px){.columns.is-variable.is-5-mobile{--columnGap:1.25rem}}@media screen and (min-width:769px),print{.columns.is-variable.is-5-tablet{--columnGap:1.25rem}}@media screen and (min-width:769px) and (max-width:1023px){.columns.is-variable.is-5-tablet-only{--columnGap:1.25rem}}@media screen and (max-width:1023px){.columns.is-variable.is-5-touch{--columnGap:1.25rem}}@media screen and (min-width:1024px){.columns.is-variable.is-5-desktop{--columnGap:1.25rem}}@media screen and (min-width:1024px) and (max-width:1215px){.columns.is-variable.is-5-desktop-only{--columnGap:1.25rem}}@media screen and (min-width:1216px){.columns.is-variable.is-5-widescreen{--columnGap:1.25rem}}@media screen and (min-width:1216px) and (max-width:1407px){.columns.is-variable.is-5-widescreen-only{--columnGap:1.25rem}}@media screen and (min-width:1408px){.columns.is-variable.is-5-fullhd{--columnGap:1.25rem}}.columns.is-variable.is-6{--columnGap:1.5rem}@media screen and (max-width:768px){.columns.is-variable.is-6-mobile{--columnGap:1.5rem}}@media screen and (min-width:769px),print{.columns.is-variable.is-6-tablet{--columnGap:1.5rem}}@media screen and (min-width:769px) and (max-width:1023px){.columns.is-variable.is-6-tablet-only{--columnGap:1.5rem}}@media screen and (max-width:1023px){.columns.is-variable.is-6-touch{--columnGap:1.5rem}}@media screen and (min-width:1024px){.columns.is-variable.is-6-desktop{--columnGap:1.5rem}}@media screen and (min-width:1024px) and (max-width:1215px){.columns.is-variable.is-6-desktop-only{--columnGap:1.5rem}}@media screen and (min-width:1216px){.columns.is-variable.is-6-widescreen{--columnGap:1.5rem}}@media screen and (min-width:1216px) and (max-width:1407px){.columns.is-variable.is-6-widescreen-only{--columnGap:1.5rem}}@media screen and (min-width:1408px){.columns.is-variable.is-6-fullhd{--columnGap:1.5rem}}.columns.is-variable.is-7{--columnGap:1.75rem}@media screen and (max-width:768px){.columns.is-variable.is-7-mobile{--columnGap:1.75rem}}@media screen and (min-width:769px),print{.columns.is-variable.is-7-tablet{--columnGap:1.75rem}}@media screen and (min-width:769px) and (max-width:1023px){.columns.is-variable.is-7-tablet-only{--columnGap:1.75rem}}@media screen and (max-width:1023px){.columns.is-variable.is-7-touch{--columnGap:1.75rem}}@media screen and (min-width:1024px){.columns.is-variable.is-7-desktop{--columnGap:1.75rem}}@media screen and (min-width:1024px) and (max-width:1215px){.columns.is-variable.is-7-desktop-only{--columnGap:1.75rem}}@media screen and (min-width:1216px){.columns.is-variable.is-7-widescreen{--columnGap:1.75rem}}@media screen and (min-width:1216px) and (max-width:1407px){.columns.is-variable.is-7-widescreen-only{--columnGap:1.75rem}}@media screen and (min-width:1408px){.columns.is-variable.is-7-fullhd{--columnGap:1.75rem}}.columns.is-variable.is-8{--columnGap:2rem}@media screen and (max-width:768px){.columns.is-variable.is-8-mobile{--columnGap:2rem}}@media screen and (min-width:769px),print{.columns.is-variable.is-8-tablet{--columnGap:2rem}}@media screen and (min-width:769px) and (max-width:1023px){.columns.is-variable.is-8-tablet-only{--columnGap:2rem}}@media screen and (max-width:1023px){.columns.is-variable.is-8-touch{--columnGap:2rem}}@media screen and (min-width:1024px){.columns.is-variable.is-8-desktop{--columnGap:2rem}}@media screen and (min-width:1024px) and (max-width:1215px){.columns.is-variable.is-8-desktop-only{--columnGap:2rem}}@media screen and (min-width:1216px){.columns.is-variable.is-8-widescreen{--columnGap:2rem}}@media screen and (min-width:1216px) and (max-width:1407px){.columns.is-variable.is-8-widescreen-only{--columnGap:2rem}}@media screen and (min-width:1408px){.columns.is-variable.is-8-fullhd{--columnGap:2rem}}.tile{min-height:min-content;flex:1 1 0;align-items:stretch;display:block}.tile.is-ancestor{margin-top:-.75rem;margin-left:-.75rem;margin-right:-.75rem}.tile.is-ancestor:last-child{margin-bottom:-.75rem}.tile.is-ancestor:not(:last-child){margin-bottom:.75rem}.tile.is-child{margin:0!important}.tile.is-parent{padding:.75rem}.tile.is-vertical{flex-direction:column}.tile.is-vertical>.tile.is-child:not(:last-child){margin-bottom:1.5rem!important}@media screen and (min-width:769px),print{.tile:not(.is-child){display:flex}.tile.is-1{width:8.33333%;flex:none}.tile.is-2{width:16.6667%;flex:none}.tile.is-3{width:25%;flex:none}.tile.is-4{width:33.3333%;flex:none}.tile.is-5{width:41.6667%;flex:none}.tile.is-6{width:50%;flex:none}.tile.is-7{width:58.3333%;flex:none}.tile.is-8{width:66.6667%;flex:none}.tile.is-9{width:75%;flex:none}.tile.is-10{width:83.3333%;flex:none}.tile.is-11{width:91.6667%;flex:none}.tile.is-12{width:100%;flex:none}}.has-text-white{color:#fff!important}a.has-text-white:hover,a.has-text-white:focus{color:#e6e6e6!important}.has-background-white{background-color:#fff!important}.has-text-black{color:#0a0a0a!important}a.has-text-black:hover,a.has-text-black:focus{color:#000!important}.has-background-black{background-color:#0a0a0a!important}.has-text-light{color:#f5f5f5!important}a.has-text-light:hover,a.has-text-light:focus{color:#dbdbdb!important}.has-background-light{background-color:#f5f5f5!important}.has-text-dark{color:#363636!important}a.has-text-dark:hover,a.has-text-dark:focus{color:#1c1c1c!important}.has-background-dark{background-color:#363636!important}.has-text-primary{color:#00d1b2!important}a.has-text-primary:hover,a.has-text-primary:focus{color:#009e86!important}.has-background-primary{background-color:#00d1b2!important}.has-text-primary-light{color:#ebfffc!important}a.has-text-primary-light:hover,a.has-text-primary-light:focus{color:#b8fff4!important}.has-background-primary-light{background-color:#ebfffc!important}.has-text-primary-dark{color:#00947e!important}a.has-text-primary-dark:hover,a.has-text-primary-dark:focus{color:#00c7a9!important}.has-background-primary-dark{background-color:#00947e!important}.has-text-link{color:#485fc7!important}a.has-text-link:hover,a.has-text-link:focus{color:#3449a8!important}.has-background-link{background-color:#485fc7!important}.has-text-link-light{color:#eff1fa!important}a.has-text-link-light:hover,a.has-text-link-light:focus{color:#c8cfee!important}.has-background-link-light{background-color:#eff1fa!important}.has-text-link-dark{color:#3850b7!important}a.has-text-link-dark:hover,a.has-text-link-dark:focus{color:#576dcb!important}.has-background-link-dark{background-color:#3850b7!important}.has-text-info{color:#3e8ed0!important}a.has-text-info:hover,a.has-text-info:focus{color:#2b74b1!important}.has-background-info{background-color:#3e8ed0!important}.has-text-info-light{color:#eff5fb!important}a.has-text-info-light:hover,a.has-text-info-light:focus{color:#c6ddf1!important}.has-background-info-light{background-color:#eff5fb!important}.has-text-info-dark{color:#296fa8!important}a.has-text-info-dark:hover,a.has-text-info-dark:focus{color:#368ace!important}.has-background-info-dark{background-color:#296fa8!important}.has-text-success{color:#48c78e!important}a.has-text-success:hover,a.has-text-success:focus{color:#34a873!important}.has-background-success{background-color:#48c78e!important}.has-text-success-light{color:#effaf5!important}a.has-text-success-light:hover,a.has-text-success-light:focus{color:#c8eedd!important}.has-background-success-light{background-color:#effaf5!important}.has-text-success-dark{color:#257953!important}a.has-text-success-dark:hover,a.has-text-success-dark:focus{color:#31a06e!important}.has-background-success-dark{background-color:#257953!important}.has-text-warning{color:#ffe08a!important}a.has-text-warning:hover,a.has-text-warning:focus{color:#ffd257!important}.has-background-warning{background-color:#ffe08a!important}.has-text-warning-light{color:#fffaeb!important}a.has-text-warning-light:hover,a.has-text-warning-light:focus{color:#ffecb8!important}.has-background-warning-light{background-color:#fffaeb!important}.has-text-warning-dark{color:#946c00!important}a.has-text-warning-dark:hover,a.has-text-warning-dark:focus{color:#c79200!important}.has-background-warning-dark{background-color:#946c00!important}.has-text-danger{color:#f14668!important}a.has-text-danger:hover,a.has-text-danger:focus{color:#ee1742!important}.has-background-danger{background-color:#f14668!important}.has-text-danger-light{color:#feecf0!important}a.has-text-danger-light:hover,a.has-text-danger-light:focus{color:#fabdc9!important}.has-background-danger-light{background-color:#feecf0!important}.has-text-danger-dark{color:#cc0f35!important}a.has-text-danger-dark:hover,a.has-text-danger-dark:focus{color:#ee2049!important}.has-background-danger-dark{background-color:#cc0f35!important}.has-text-black-bis{color:#121212!important}.has-background-black-bis{background-color:#121212!important}.has-text-black-ter{color:#242424!important}.has-background-black-ter{background-color:#242424!important}.has-text-grey-darker{color:#363636!important}.has-background-grey-darker{background-color:#363636!important}.has-text-grey-dark{color:#4a4a4a!important}.has-background-grey-dark{background-color:#4a4a4a!important}.has-text-grey{color:#7a7a7a!important}.has-background-grey{background-color:#7a7a7a!important}.has-text-grey-light{color:#b5b5b5!important}.has-background-grey-light{background-color:#b5b5b5!important}.has-text-grey-lighter{color:#dbdbdb!important}.has-background-grey-lighter{background-color:#dbdbdb!important}.has-text-white-ter{color:#f5f5f5!important}.has-background-white-ter{background-color:#f5f5f5!important}.has-text-white-bis{color:#fafafa!important}.has-background-white-bis{background-color:#fafafa!important}.is-flex-direction-row{flex-direction:row!important}.is-flex-direction-row-reverse{flex-direction:row-reverse!important}.is-flex-direction-column{flex-direction:column!important}.is-flex-direction-column-reverse{flex-direction:column-reverse!important}.is-flex-wrap-nowrap{flex-wrap:nowrap!important}.is-flex-wrap-wrap{flex-wrap:wrap!important}.is-flex-wrap-wrap-reverse{flex-wrap:wrap-reverse!important}.is-justify-content-flex-start{justify-content:flex-start!important}.is-justify-content-flex-end{justify-content:flex-end!important}.is-justify-content-center{justify-content:center!important}.is-justify-content-space-between{justify-content:space-between!important}.is-justify-content-space-around{justify-content:space-around!important}.is-justify-content-space-evenly{justify-content:space-evenly!important}.is-justify-content-start{justify-content:start!important}.is-justify-content-end{justify-content:end!important}.is-justify-content-left{justify-content:left!important}.is-justify-content-right{justify-content:right!important}.is-align-content-flex-start{align-content:flex-start!important}.is-align-content-flex-end{align-content:flex-end!important}.is-align-content-center{align-content:center!important}.is-align-content-space-between{align-content:space-between!important}.is-align-content-space-around{align-content:space-around!important}.is-align-content-space-evenly{align-content:space-evenly!important}.is-align-content-stretch{align-content:stretch!important}.is-align-content-start{align-content:start!important}.is-align-content-end{align-content:end!important}.is-align-content-baseline{align-content:baseline!important}.is-align-items-stretch{align-items:stretch!important}.is-align-items-flex-start{align-items:flex-start!important}.is-align-items-flex-end{align-items:flex-end!important}.is-align-items-center{align-items:center!important}.is-align-items-baseline{align-items:baseline!important}.is-align-items-start{align-items:start!important}.is-align-items-end{align-items:end!important}.is-align-items-self-start{align-items:self-start!important}.is-align-items-self-end{align-items:self-end!important}.is-align-self-auto{align-self:auto!important}.is-align-self-flex-start{align-self:flex-start!important}.is-align-self-flex-end{align-self:flex-end!important}.is-align-self-center{align-self:center!important}.is-align-self-baseline{align-self:baseline!important}.is-align-self-stretch{align-self:stretch!important}.is-flex-grow-0{flex-grow:0!important}.is-flex-grow-1{flex-grow:1!important}.is-flex-grow-2{flex-grow:2!important}.is-flex-grow-3{flex-grow:3!important}.is-flex-grow-4{flex-grow:4!important}.is-flex-grow-5{flex-grow:5!important}.is-flex-shrink-0{flex-shrink:0!important}.is-flex-shrink-1{flex-shrink:1!important}.is-flex-shrink-2{flex-shrink:2!important}.is-flex-shrink-3{flex-shrink:3!important}.is-flex-shrink-4{flex-shrink:4!important}.is-flex-shrink-5{flex-shrink:5!important}.is-clearfix:after{clear:both;content:" ";display:table}.is-pulled-left{float:left!important}.is-pulled-right{float:right!important}.is-radiusless{border-radius:0!important}.is-shadowless{box-shadow:none!important}.is-clickable{cursor:pointer!important;pointer-events:all!important}.is-clipped{overflow:hidden!important}.is-relative{position:relative!important}.is-marginless{margin:0!important}.is-paddingless{padding:0!important}.m-0{margin:0!important}.mt-0{margin-top:0!important}.mr-0{margin-right:0!important}.mb-0{margin-bottom:0!important}.ml-0{margin-left:0!important}.mx-0{margin-left:0!important;margin-right:0!important}.my-0{margin-top:0!important;margin-bottom:0!important}.m-1{margin:.25rem!important}.mt-1{margin-top:.25rem!important}.mr-1{margin-right:.25rem!important}.mb-1{margin-bottom:.25rem!important}.ml-1{margin-left:.25rem!important}.mx-1{margin-left:.25rem!important;margin-right:.25rem!important}.my-1{margin-top:.25rem!important;margin-bottom:.25rem!important}.m-2{margin:.5rem!important}.mt-2{margin-top:.5rem!important}.mr-2{margin-right:.5rem!important}.mb-2{margin-bottom:.5rem!important}.ml-2{margin-left:.5rem!important}.mx-2{margin-left:.5rem!important;margin-right:.5rem!important}.my-2{margin-top:.5rem!important;margin-bottom:.5rem!important}.m-3{margin:.75rem!important}.mt-3{margin-top:.75rem!important}.mr-3{margin-right:.75rem!important}.mb-3{margin-bottom:.75rem!important}.ml-3{margin-left:.75rem!important}.mx-3{margin-left:.75rem!important;margin-right:.75rem!important}.my-3{margin-top:.75rem!important;margin-bottom:.75rem!important}.m-4{margin:1rem!important}.mt-4{margin-top:1rem!important}.mr-4{margin-right:1rem!important}.mb-4{margin-bottom:1rem!important}.ml-4{margin-left:1rem!important}.mx-4{margin-left:1rem!important;margin-right:1rem!important}.my-4{margin-top:1rem!important;margin-bottom:1rem!important}.m-5{margin:1.5rem!important}.mt-5{margin-top:1.5rem!important}.mr-5{margin-right:1.5rem!important}.mb-5{margin-bottom:1.5rem!important}.ml-5{margin-left:1.5rem!important}.mx-5{margin-left:1.5rem!important;margin-right:1.5rem!important}.my-5{margin-top:1.5rem!important;margin-bottom:1.5rem!important}.m-6{margin:3rem!important}.mt-6{margin-top:3rem!important}.mr-6{margin-right:3rem!important}.mb-6{margin-bottom:3rem!important}.ml-6{margin-left:3rem!important}.mx-6{margin-left:3rem!important;margin-right:3rem!important}.my-6{margin-top:3rem!important;margin-bottom:3rem!important}.m-auto{margin:auto!important}.mt-auto{margin-top:auto!important}.mr-auto{margin-right:auto!important}.mb-auto{margin-bottom:auto!important}.ml-auto{margin-left:auto!important}.mx-auto{margin-left:auto!important;margin-right:auto!important}.my-auto{margin-top:auto!important;margin-bottom:auto!important}.p-0{padding:0!important}.pt-0{padding-top:0!important}.pr-0{padding-right:0!important}.pb-0{padding-bottom:0!important}.pl-0{padding-left:0!important}.px-0{padding-left:0!important;padding-right:0!important}.py-0{padding-top:0!important;padding-bottom:0!important}.p-1{padding:.25rem!important}.pt-1{padding-top:.25rem!important}.pr-1{padding-right:.25rem!important}.pb-1{padding-bottom:.25rem!important}.pl-1{padding-left:.25rem!important}.px-1{padding-left:.25rem!important;padding-right:.25rem!important}.py-1{padding-top:.25rem!important;padding-bottom:.25rem!important}.p-2{padding:.5rem!important}.pt-2{padding-top:.5rem!important}.pr-2{padding-right:.5rem!important}.pb-2{padding-bottom:.5rem!important}.pl-2{padding-left:.5rem!important}.px-2{padding-left:.5rem!important;padding-right:.5rem!important}.py-2{padding-top:.5rem!important;padding-bottom:.5rem!important}.p-3{padding:.75rem!important}.pt-3{padding-top:.75rem!important}.pr-3{padding-right:.75rem!important}.pb-3{padding-bottom:.75rem!important}.pl-3{padding-left:.75rem!important}.px-3{padding-left:.75rem!important;padding-right:.75rem!important}.py-3{padding-top:.75rem!important;padding-bottom:.75rem!important}.p-4{padding:1rem!important}.pt-4{padding-top:1rem!important}.pr-4{padding-right:1rem!important}.pb-4{padding-bottom:1rem!important}.pl-4{padding-left:1rem!important}.px-4{padding-left:1rem!important;padding-right:1rem!important}.py-4{padding-top:1rem!important;padding-bottom:1rem!important}.p-5{padding:1.5rem!important}.pt-5{padding-top:1.5rem!important}.pr-5{padding-right:1.5rem!important}.pb-5{padding-bottom:1.5rem!important}.pl-5{padding-left:1.5rem!important}.px-5{padding-left:1.5rem!important;padding-right:1.5rem!important}.py-5{padding-top:1.5rem!important;padding-bottom:1.5rem!important}.p-6{padding:3rem!important}.pt-6{padding-top:3rem!important}.pr-6{padding-right:3rem!important}.pb-6{padding-bottom:3rem!important}.pl-6{padding-left:3rem!important}.px-6{padding-left:3rem!important;padding-right:3rem!important}.py-6{padding-top:3rem!important;padding-bottom:3rem!important}.p-auto{padding:auto!important}.pt-auto{padding-top:auto!important}.pr-auto{padding-right:auto!important}.pb-auto{padding-bottom:auto!important}.pl-auto{padding-left:auto!important}.px-auto{padding-left:auto!important;padding-right:auto!important}.py-auto{padding-top:auto!important;padding-bottom:auto!important}.is-size-1{font-size:3rem!important}.is-size-2{font-size:2.5rem!important}.is-size-3{font-size:2rem!important}.is-size-4{font-size:1.5rem!important}.is-size-5{font-size:1.25rem!important}.is-size-6{font-size:1rem!important}.is-size-7{font-size:.75rem!important}@media screen and (max-width:768px){.is-size-1-mobile{font-size:3rem!important}.is-size-2-mobile{font-size:2.5rem!important}.is-size-3-mobile{font-size:2rem!important}.is-size-4-mobile{font-size:1.5rem!important}.is-size-5-mobile{font-size:1.25rem!important}.is-size-6-mobile{font-size:1rem!important}.is-size-7-mobile{font-size:.75rem!important}}@media screen and (min-width:769px),print{.is-size-1-tablet{font-size:3rem!important}.is-size-2-tablet{font-size:2.5rem!important}.is-size-3-tablet{font-size:2rem!important}.is-size-4-tablet{font-size:1.5rem!important}.is-size-5-tablet{font-size:1.25rem!important}.is-size-6-tablet{font-size:1rem!important}.is-size-7-tablet{font-size:.75rem!important}}@media screen and (max-width:1023px){.is-size-1-touch{font-size:3rem!important}.is-size-2-touch{font-size:2.5rem!important}.is-size-3-touch{font-size:2rem!important}.is-size-4-touch{font-size:1.5rem!important}.is-size-5-touch{font-size:1.25rem!important}.is-size-6-touch{font-size:1rem!important}.is-size-7-touch{font-size:.75rem!important}}@media screen and (min-width:1024px){.is-size-1-desktop{font-size:3rem!important}.is-size-2-desktop{font-size:2.5rem!important}.is-size-3-desktop{font-size:2rem!important}.is-size-4-desktop{font-size:1.5rem!important}.is-size-5-desktop{font-size:1.25rem!important}.is-size-6-desktop{font-size:1rem!important}.is-size-7-desktop{font-size:.75rem!important}}@media screen and (min-width:1216px){.is-size-1-widescreen{font-size:3rem!important}.is-size-2-widescreen{font-size:2.5rem!important}.is-size-3-widescreen{font-size:2rem!important}.is-size-4-widescreen{font-size:1.5rem!important}.is-size-5-widescreen{font-size:1.25rem!important}.is-size-6-widescreen{font-size:1rem!important}.is-size-7-widescreen{font-size:.75rem!important}}@media screen and (min-width:1408px){.is-size-1-fullhd{font-size:3rem!important}.is-size-2-fullhd{font-size:2.5rem!important}.is-size-3-fullhd{font-size:2rem!important}.is-size-4-fullhd{font-size:1.5rem!important}.is-size-5-fullhd{font-size:1.25rem!important}.is-size-6-fullhd{font-size:1rem!important}.is-size-7-fullhd{font-size:.75rem!important}}.has-text-centered{text-align:center!important}.has-text-justified{text-align:justify!important}.has-text-left{text-align:left!important}.has-text-right{text-align:right!important}@media screen and (max-width:768px){.has-text-centered-mobile{text-align:center!important}}@media screen and (min-width:769px),print{.has-text-centered-tablet{text-align:center!important}}@media screen and (min-width:769px) and (max-width:1023px){.has-text-centered-tablet-only{text-align:center!important}}@media screen and (max-width:1023px){.has-text-centered-touch{text-align:center!important}}@media screen and (min-width:1024px){.has-text-centered-desktop{text-align:center!important}}@media screen and (min-width:1024px) and (max-width:1215px){.has-text-centered-desktop-only{text-align:center!important}}@media screen and (min-width:1216px){.has-text-centered-widescreen{text-align:center!important}}@media screen and (min-width:1216px) and (max-width:1407px){.has-text-centered-widescreen-only{text-align:center!important}}@media screen and (min-width:1408px){.has-text-centered-fullhd{text-align:center!important}}@media screen and (max-width:768px){.has-text-justified-mobile{text-align:justify!important}}@media screen and (min-width:769px),print{.has-text-justified-tablet{text-align:justify!important}}@media screen and (min-width:769px) and (max-width:1023px){.has-text-justified-tablet-only{text-align:justify!important}}@media screen and (max-width:1023px){.has-text-justified-touch{text-align:justify!important}}@media screen and (min-width:1024px){.has-text-justified-desktop{text-align:justify!important}}@media screen and (min-width:1024px) and (max-width:1215px){.has-text-justified-desktop-only{text-align:justify!important}}@media screen and (min-width:1216px){.has-text-justified-widescreen{text-align:justify!important}}@media screen and (min-width:1216px) and (max-width:1407px){.has-text-justified-widescreen-only{text-align:justify!important}}@media screen and (min-width:1408px){.has-text-justified-fullhd{text-align:justify!important}}@media screen and (max-width:768px){.has-text-left-mobile{text-align:left!important}}@media screen and (min-width:769px),print{.has-text-left-tablet{text-align:left!important}}@media screen and (min-width:769px) and (max-width:1023px){.has-text-left-tablet-only{text-align:left!important}}@media screen and (max-width:1023px){.has-text-left-touch{text-align:left!important}}@media screen and (min-width:1024px){.has-text-left-desktop{text-align:left!important}}@media screen and (min-width:1024px) and (max-width:1215px){.has-text-left-desktop-only{text-align:left!important}}@media screen and (min-width:1216px){.has-text-left-widescreen{text-align:left!important}}@media screen and (min-width:1216px) and (max-width:1407px){.has-text-left-widescreen-only{text-align:left!important}}@media screen and (min-width:1408px){.has-text-left-fullhd{text-align:left!important}}@media screen and (max-width:768px){.has-text-right-mobile{text-align:right!important}}@media screen and (min-width:769px),print{.has-text-right-tablet{text-align:right!important}}@media screen and (min-width:769px) and (max-width:1023px){.has-text-right-tablet-only{text-align:right!important}}@media screen and (max-width:1023px){.has-text-right-touch{text-align:right!important}}@media screen and (min-width:1024px){.has-text-right-desktop{text-align:right!important}}@media screen and (min-width:1024px) and (max-width:1215px){.has-text-right-desktop-only{text-align:right!important}}@media screen and (min-width:1216px){.has-text-right-widescreen{text-align:right!important}}@media screen and (min-width:1216px) and (max-width:1407px){.has-text-right-widescreen-only{text-align:right!important}}@media screen and (min-width:1408px){.has-text-right-fullhd{text-align:right!important}}.is-capitalized{text-transform:capitalize!important}.is-lowercase{text-transform:lowercase!important}.is-uppercase{text-transform:uppercase!important}.is-italic{font-style:italic!important}.is-underlined{text-decoration:underline!important}.has-text-weight-light{font-weight:300!important}.has-text-weight-normal{font-weight:400!important}.has-text-weight-medium{font-weight:500!important}.has-text-weight-semibold{font-weight:600!important}.has-text-weight-bold{font-weight:700!important}.is-family-primary,.is-family-secondary,.is-family-sans-serif{font-family:BlinkMacSystemFont,-apple-system,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,Helvetica,Arial,sans-serif!important}.is-family-monospace,.is-family-code{font-family:monospace!important}.is-block{display:block!important}@media screen and (max-width:768px){.is-block-mobile{display:block!important}}@media screen and (min-width:769px),print{.is-block-tablet{display:block!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-block-tablet-only{display:block!important}}@media screen and (max-width:1023px){.is-block-touch{display:block!important}}@media screen and (min-width:1024px){.is-block-desktop{display:block!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-block-desktop-only{display:block!important}}@media screen and (min-width:1216px){.is-block-widescreen{display:block!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-block-widescreen-only{display:block!important}}@media screen and (min-width:1408px){.is-block-fullhd{display:block!important}}.is-flex{display:flex!important}@media screen and (max-width:768px){.is-flex-mobile{display:flex!important}}@media screen and (min-width:769px),print{.is-flex-tablet{display:flex!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-flex-tablet-only{display:flex!important}}@media screen and (max-width:1023px){.is-flex-touch{display:flex!important}}@media screen and (min-width:1024px){.is-flex-desktop{display:flex!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-flex-desktop-only{display:flex!important}}@media screen and (min-width:1216px){.is-flex-widescreen{display:flex!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-flex-widescreen-only{display:flex!important}}@media screen and (min-width:1408px){.is-flex-fullhd{display:flex!important}}.is-inline{display:inline!important}@media screen and (max-width:768px){.is-inline-mobile{display:inline!important}}@media screen and (min-width:769px),print{.is-inline-tablet{display:inline!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-inline-tablet-only{display:inline!important}}@media screen and (max-width:1023px){.is-inline-touch{display:inline!important}}@media screen and (min-width:1024px){.is-inline-desktop{display:inline!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-inline-desktop-only{display:inline!important}}@media screen and (min-width:1216px){.is-inline-widescreen{display:inline!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-inline-widescreen-only{display:inline!important}}@media screen and (min-width:1408px){.is-inline-fullhd{display:inline!important}}.is-inline-block{display:inline-block!important}@media screen and (max-width:768px){.is-inline-block-mobile{display:inline-block!important}}@media screen and (min-width:769px),print{.is-inline-block-tablet{display:inline-block!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-inline-block-tablet-only{display:inline-block!important}}@media screen and (max-width:1023px){.is-inline-block-touch{display:inline-block!important}}@media screen and (min-width:1024px){.is-inline-block-desktop{display:inline-block!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-inline-block-desktop-only{display:inline-block!important}}@media screen and (min-width:1216px){.is-inline-block-widescreen{display:inline-block!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-inline-block-widescreen-only{display:inline-block!important}}@media screen and (min-width:1408px){.is-inline-block-fullhd{display:inline-block!important}}.is-inline-flex{display:inline-flex!important}@media screen and (max-width:768px){.is-inline-flex-mobile{display:inline-flex!important}}@media screen and (min-width:769px),print{.is-inline-flex-tablet{display:inline-flex!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-inline-flex-tablet-only{display:inline-flex!important}}@media screen and (max-width:1023px){.is-inline-flex-touch{display:inline-flex!important}}@media screen and (min-width:1024px){.is-inline-flex-desktop{display:inline-flex!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-inline-flex-desktop-only{display:inline-flex!important}}@media screen and (min-width:1216px){.is-inline-flex-widescreen{display:inline-flex!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-inline-flex-widescreen-only{display:inline-flex!important}}@media screen and (min-width:1408px){.is-inline-flex-fullhd{display:inline-flex!important}}.is-hidden{display:none!important}.is-sr-only{clip:rect(0,0,0,0)!important;height:.01em!important;white-space:nowrap!important;width:.01em!important;border:none!important;padding:0!important;position:absolute!important;overflow:hidden!important}@media screen and (max-width:768px){.is-hidden-mobile{display:none!important}}@media screen and (min-width:769px),print{.is-hidden-tablet{display:none!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-hidden-tablet-only{display:none!important}}@media screen and (max-width:1023px){.is-hidden-touch{display:none!important}}@media screen and (min-width:1024px){.is-hidden-desktop{display:none!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-hidden-desktop-only{display:none!important}}@media screen and (min-width:1216px){.is-hidden-widescreen{display:none!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-hidden-widescreen-only{display:none!important}}@media screen and (min-width:1408px){.is-hidden-fullhd{display:none!important}}.is-invisible{visibility:hidden!important}@media screen and (max-width:768px){.is-invisible-mobile{visibility:hidden!important}}@media screen and (min-width:769px),print{.is-invisible-tablet{visibility:hidden!important}}@media screen and (min-width:769px) and (max-width:1023px){.is-invisible-tablet-only{visibility:hidden!important}}@media screen and (max-width:1023px){.is-invisible-touch{visibility:hidden!important}}@media screen and (min-width:1024px){.is-invisible-desktop{visibility:hidden!important}}@media screen and (min-width:1024px) and (max-width:1215px){.is-invisible-desktop-only{visibility:hidden!important}}@media screen and (min-width:1216px){.is-invisible-widescreen{visibility:hidden!important}}@media screen and (min-width:1216px) and (max-width:1407px){.is-invisible-widescreen-only{visibility:hidden!important}}@media screen and (min-width:1408px){.is-invisible-fullhd{visibility:hidden!important}}.hero{flex-direction:column;justify-content:space-between;align-items:stretch;display:flex}.hero .navbar{background:0 0}.hero .tabs ul{border-bottom:none}.hero.is-white{color:#0a0a0a;background-color:#fff}.hero.is-white a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),.hero.is-white strong{color:inherit}.hero.is-white .title{color:#0a0a0a}.hero.is-white .subtitle{color:#0a0a0ae6}.hero.is-white .subtitle a:not(.button),.hero.is-white .subtitle strong{color:#0a0a0a}@media screen and (max-width:1023px){.hero.is-white .navbar-menu{background-color:#fff}}.hero.is-white .navbar-item,.hero.is-white .navbar-link{color:#0a0a0ab3}.hero.is-white a.navbar-item:hover,.hero.is-white a.navbar-item.is-active,.hero.is-white .navbar-link:hover,.hero.is-white .navbar-link.is-active{color:#0a0a0a;background-color:#f2f2f2}.hero.is-white .tabs a{color:#0a0a0a;opacity:.9}.hero.is-white .tabs a:hover{opacity:1}.hero.is-white .tabs li.is-active a{opacity:1;color:#fff!important}.hero.is-white .tabs.is-boxed a,.hero.is-white .tabs.is-toggle a{color:#0a0a0a}.hero.is-white .tabs.is-boxed a:hover,.hero.is-white .tabs.is-toggle a:hover{background-color:#0a0a0a1a}.hero.is-white .tabs.is-boxed li.is-active a,.hero.is-white .tabs.is-boxed li.is-active a:hover,.hero.is-white .tabs.is-toggle li.is-active a,.hero.is-white .tabs.is-toggle li.is-active a:hover{color:#fff;background-color:#0a0a0a;border-color:#0a0a0a}.hero.is-white.is-bold{background-image:linear-gradient(141deg,#e8e3e4 0%,#fff 71% 100%)}@media screen and (max-width:768px){.hero.is-white.is-bold .navbar-menu{background-image:linear-gradient(141deg,#e8e3e4 0%,#fff 71% 100%)}}.hero.is-black{color:#fff;background-color:#0a0a0a}.hero.is-black a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),.hero.is-black strong{color:inherit}.hero.is-black .title{color:#fff}.hero.is-black .subtitle{color:#ffffffe6}.hero.is-black .subtitle a:not(.button),.hero.is-black .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-black .navbar-menu{background-color:#0a0a0a}}.hero.is-black .navbar-item,.hero.is-black .navbar-link{color:#ffffffb3}.hero.is-black a.navbar-item:hover,.hero.is-black a.navbar-item.is-active,.hero.is-black .navbar-link:hover,.hero.is-black .navbar-link.is-active{color:#fff;background-color:#000}.hero.is-black .tabs a{color:#fff;opacity:.9}.hero.is-black .tabs a:hover{opacity:1}.hero.is-black .tabs li.is-active a{opacity:1;color:#0a0a0a!important}.hero.is-black .tabs.is-boxed a,.hero.is-black .tabs.is-toggle a{color:#fff}.hero.is-black .tabs.is-boxed a:hover,.hero.is-black .tabs.is-toggle a:hover{background-color:#0a0a0a1a}.hero.is-black .tabs.is-boxed li.is-active a,.hero.is-black .tabs.is-boxed li.is-active a:hover,.hero.is-black .tabs.is-toggle li.is-active a,.hero.is-black .tabs.is-toggle li.is-active a:hover{color:#0a0a0a;background-color:#fff;border-color:#fff}.hero.is-black.is-bold{background-image:linear-gradient(141deg,#000 0%,#0a0a0a 71%,#181616 100%)}@media screen and (max-width:768px){.hero.is-black.is-bold .navbar-menu{background-image:linear-gradient(141deg,#000 0%,#0a0a0a 71%,#181616 100%)}}.hero.is-light{color:#000000b3;background-color:#f5f5f5}.hero.is-light a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),.hero.is-light strong{color:inherit}.hero.is-light .title{color:#000000b3}.hero.is-light .subtitle{color:#000000e6}.hero.is-light .subtitle a:not(.button),.hero.is-light .subtitle strong{color:#000000b3}@media screen and (max-width:1023px){.hero.is-light .navbar-menu{background-color:#f5f5f5}}.hero.is-light .navbar-item,.hero.is-light .navbar-link{color:#000000b3}.hero.is-light a.navbar-item:hover,.hero.is-light a.navbar-item.is-active,.hero.is-light .navbar-link:hover,.hero.is-light .navbar-link.is-active{color:#000000b3;background-color:#e8e8e8}.hero.is-light .tabs a{color:#000000b3;opacity:.9}.hero.is-light .tabs a:hover{opacity:1}.hero.is-light .tabs li.is-active a{opacity:1;color:#f5f5f5!important}.hero.is-light .tabs.is-boxed a,.hero.is-light .tabs.is-toggle a{color:#000000b3}.hero.is-light .tabs.is-boxed a:hover,.hero.is-light .tabs.is-toggle a:hover{background-color:#0a0a0a1a}.hero.is-light .tabs.is-boxed li.is-active a,.hero.is-light .tabs.is-boxed li.is-active a:hover,.hero.is-light .tabs.is-toggle li.is-active a,.hero.is-light .tabs.is-toggle li.is-active a:hover{color:#f5f5f5;background-color:#000000b3;border-color:#000000b3}.hero.is-light.is-bold{background-image:linear-gradient(141deg,#dfd8d9 0%,#f5f5f5 71%,#fff 100%)}@media screen and (max-width:768px){.hero.is-light.is-bold .navbar-menu{background-image:linear-gradient(141deg,#dfd8d9 0%,#f5f5f5 71%,#fff 100%)}}.hero.is-dark{color:#fff;background-color:#363636}.hero.is-dark a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),.hero.is-dark strong{color:inherit}.hero.is-dark .title{color:#fff}.hero.is-dark .subtitle{color:#ffffffe6}.hero.is-dark .subtitle a:not(.button),.hero.is-dark .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-dark .navbar-menu{background-color:#363636}}.hero.is-dark .navbar-item,.hero.is-dark .navbar-link{color:#ffffffb3}.hero.is-dark a.navbar-item:hover,.hero.is-dark a.navbar-item.is-active,.hero.is-dark .navbar-link:hover,.hero.is-dark .navbar-link.is-active{color:#fff;background-color:#292929}.hero.is-dark .tabs a{color:#fff;opacity:.9}.hero.is-dark .tabs a:hover{opacity:1}.hero.is-dark .tabs li.is-active a{opacity:1;color:#363636!important}.hero.is-dark .tabs.is-boxed a,.hero.is-dark .tabs.is-toggle a{color:#fff}.hero.is-dark .tabs.is-boxed a:hover,.hero.is-dark .tabs.is-toggle a:hover{background-color:#0a0a0a1a}.hero.is-dark .tabs.is-boxed li.is-active a,.hero.is-dark .tabs.is-boxed li.is-active a:hover,.hero.is-dark .tabs.is-toggle li.is-active a,.hero.is-dark .tabs.is-toggle li.is-active a:hover{color:#363636;background-color:#fff;border-color:#fff}.hero.is-dark.is-bold{background-image:linear-gradient(141deg,#1f191a 0%,#363636 71%,#46403f 100%)}@media screen and (max-width:768px){.hero.is-dark.is-bold .navbar-menu{background-image:linear-gradient(141deg,#1f191a 0%,#363636 71%,#46403f 100%)}}.hero.is-primary{color:#fff;background-color:#00d1b2}.hero.is-primary a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),.hero.is-primary strong{color:inherit}.hero.is-primary .title{color:#fff}.hero.is-primary .subtitle{color:#ffffffe6}.hero.is-primary .subtitle a:not(.button),.hero.is-primary .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-primary .navbar-menu{background-color:#00d1b2}}.hero.is-primary .navbar-item,.hero.is-primary .navbar-link{color:#ffffffb3}.hero.is-primary a.navbar-item:hover,.hero.is-primary a.navbar-item.is-active,.hero.is-primary .navbar-link:hover,.hero.is-primary .navbar-link.is-active{color:#fff;background-color:#00b89c}.hero.is-primary .tabs a{color:#fff;opacity:.9}.hero.is-primary .tabs a:hover{opacity:1}.hero.is-primary .tabs li.is-active a{opacity:1;color:#00d1b2!important}.hero.is-primary .tabs.is-boxed a,.hero.is-primary .tabs.is-toggle a{color:#fff}.hero.is-primary .tabs.is-boxed a:hover,.hero.is-primary .tabs.is-toggle a:hover{background-color:#0a0a0a1a}.hero.is-primary .tabs.is-boxed li.is-active a,.hero.is-primary .tabs.is-boxed li.is-active a:hover,.hero.is-primary .tabs.is-toggle li.is-active a,.hero.is-primary .tabs.is-toggle li.is-active a:hover{color:#00d1b2;background-color:#fff;border-color:#fff}.hero.is-primary.is-bold{background-image:linear-gradient(141deg,#009e6c 0%,#00d1b2 71%,#00e7eb 100%)}@media screen and (max-width:768px){.hero.is-primary.is-bold .navbar-menu{background-image:linear-gradient(141deg,#009e6c 0%,#00d1b2 71%,#00e7eb 100%)}}.hero.is-link{color:#fff;background-color:#485fc7}.hero.is-link a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),.hero.is-link strong{color:inherit}.hero.is-link .title{color:#fff}.hero.is-link .subtitle{color:#ffffffe6}.hero.is-link .subtitle a:not(.button),.hero.is-link .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-link .navbar-menu{background-color:#485fc7}}.hero.is-link .navbar-item,.hero.is-link .navbar-link{color:#ffffffb3}.hero.is-link a.navbar-item:hover,.hero.is-link a.navbar-item.is-active,.hero.is-link .navbar-link:hover,.hero.is-link .navbar-link.is-active{color:#fff;background-color:#3a51bb}.hero.is-link .tabs a{color:#fff;opacity:.9}.hero.is-link .tabs a:hover{opacity:1}.hero.is-link .tabs li.is-active a{opacity:1;color:#485fc7!important}.hero.is-link .tabs.is-boxed a,.hero.is-link .tabs.is-toggle a{color:#fff}.hero.is-link .tabs.is-boxed a:hover,.hero.is-link .tabs.is-toggle a:hover{background-color:#0a0a0a1a}.hero.is-link .tabs.is-boxed li.is-active a,.hero.is-link .tabs.is-boxed li.is-active a:hover,.hero.is-link .tabs.is-toggle li.is-active a,.hero.is-link .tabs.is-toggle li.is-active a:hover{color:#485fc7;background-color:#fff;border-color:#fff}.hero.is-link.is-bold{background-image:linear-gradient(141deg,#2959b3 0%,#485fc7 71%,#5658d2 100%)}@media screen and (max-width:768px){.hero.is-link.is-bold .navbar-menu{background-image:linear-gradient(141deg,#2959b3 0%,#485fc7 71%,#5658d2 100%)}}.hero.is-info{color:#fff;background-color:#3e8ed0}.hero.is-info a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),.hero.is-info strong{color:inherit}.hero.is-info .title{color:#fff}.hero.is-info .subtitle{color:#ffffffe6}.hero.is-info .subtitle a:not(.button),.hero.is-info .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-info .navbar-menu{background-color:#3e8ed0}}.hero.is-info .navbar-item,.hero.is-info .navbar-link{color:#ffffffb3}.hero.is-info a.navbar-item:hover,.hero.is-info a.navbar-item.is-active,.hero.is-info .navbar-link:hover,.hero.is-info .navbar-link.is-active{color:#fff;background-color:#3082c5}.hero.is-info .tabs a{color:#fff;opacity:.9}.hero.is-info .tabs a:hover{opacity:1}.hero.is-info .tabs li.is-active a{opacity:1;color:#3e8ed0!important}.hero.is-info .tabs.is-boxed a,.hero.is-info .tabs.is-toggle a{color:#fff}.hero.is-info .tabs.is-boxed a:hover,.hero.is-info .tabs.is-toggle a:hover{background-color:#0a0a0a1a}.hero.is-info .tabs.is-boxed li.is-active a,.hero.is-info .tabs.is-boxed li.is-active a:hover,.hero.is-info .tabs.is-toggle li.is-active a,.hero.is-info .tabs.is-toggle li.is-active a:hover{color:#3e8ed0;background-color:#fff;border-color:#fff}.hero.is-info.is-bold{background-image:linear-gradient(141deg,#208fbc 0%,#3e8ed0 71%,#4d83db 100%)}@media screen and (max-width:768px){.hero.is-info.is-bold .navbar-menu{background-image:linear-gradient(141deg,#208fbc 0%,#3e8ed0 71%,#4d83db 100%)}}.hero.is-success{color:#fff;background-color:#48c78e}.hero.is-success a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),.hero.is-success strong{color:inherit}.hero.is-success .title{color:#fff}.hero.is-success .subtitle{color:#ffffffe6}.hero.is-success .subtitle a:not(.button),.hero.is-success .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-success .navbar-menu{background-color:#48c78e}}.hero.is-success .navbar-item,.hero.is-success .navbar-link{color:#ffffffb3}.hero.is-success a.navbar-item:hover,.hero.is-success a.navbar-item.is-active,.hero.is-success .navbar-link:hover,.hero.is-success .navbar-link.is-active{color:#fff;background-color:#3abb81}.hero.is-success .tabs a{color:#fff;opacity:.9}.hero.is-success .tabs a:hover{opacity:1}.hero.is-success .tabs li.is-active a{opacity:1;color:#48c78e!important}.hero.is-success .tabs.is-boxed a,.hero.is-success .tabs.is-toggle a{color:#fff}.hero.is-success .tabs.is-boxed a:hover,.hero.is-success .tabs.is-toggle a:hover{background-color:#0a0a0a1a}.hero.is-success .tabs.is-boxed li.is-active a,.hero.is-success .tabs.is-boxed li.is-active a:hover,.hero.is-success .tabs.is-toggle li.is-active a,.hero.is-success .tabs.is-toggle li.is-active a:hover{color:#48c78e;background-color:#fff;border-color:#fff}.hero.is-success.is-bold{background-image:linear-gradient(141deg,#29b35e 0%,#48c78e 71%,#56d2af 100%)}@media screen and (max-width:768px){.hero.is-success.is-bold .navbar-menu{background-image:linear-gradient(141deg,#29b35e 0%,#48c78e 71%,#56d2af 100%)}}.hero.is-warning{color:#000000b3;background-color:#ffe08a}.hero.is-warning a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),.hero.is-warning strong{color:inherit}.hero.is-warning .title{color:#000000b3}.hero.is-warning .subtitle{color:#000000e6}.hero.is-warning .subtitle a:not(.button),.hero.is-warning .subtitle strong{color:#000000b3}@media screen and (max-width:1023px){.hero.is-warning .navbar-menu{background-color:#ffe08a}}.hero.is-warning .navbar-item,.hero.is-warning .navbar-link{color:#000000b3}.hero.is-warning a.navbar-item:hover,.hero.is-warning a.navbar-item.is-active,.hero.is-warning .navbar-link:hover,.hero.is-warning .navbar-link.is-active{color:#000000b3;background-color:#ffd970}.hero.is-warning .tabs a{color:#000000b3;opacity:.9}.hero.is-warning .tabs a:hover{opacity:1}.hero.is-warning .tabs li.is-active a{opacity:1;color:#ffe08a!important}.hero.is-warning .tabs.is-boxed a,.hero.is-warning .tabs.is-toggle a{color:#000000b3}.hero.is-warning .tabs.is-boxed a:hover,.hero.is-warning .tabs.is-toggle a:hover{background-color:#0a0a0a1a}.hero.is-warning .tabs.is-boxed li.is-active a,.hero.is-warning .tabs.is-boxed li.is-active a:hover,.hero.is-warning .tabs.is-toggle li.is-active a,.hero.is-warning .tabs.is-toggle li.is-active a:hover{color:#ffe08a;background-color:#000000b3;border-color:#000000b3}.hero.is-warning.is-bold{background-image:linear-gradient(141deg,#ffb657 0%,#ffe08a 71%,#fff6a3 100%)}@media screen and (max-width:768px){.hero.is-warning.is-bold .navbar-menu{background-image:linear-gradient(141deg,#ffb657 0%,#ffe08a 71%,#fff6a3 100%)}}.hero.is-danger{color:#fff;background-color:#f14668}.hero.is-danger a:not(.button):not(.dropdown-item):not(.tag):not(.pagination-link.is-current),.hero.is-danger strong{color:inherit}.hero.is-danger .title{color:#fff}.hero.is-danger .subtitle{color:#ffffffe6}.hero.is-danger .subtitle a:not(.button),.hero.is-danger .subtitle strong{color:#fff}@media screen and (max-width:1023px){.hero.is-danger .navbar-menu{background-color:#f14668}}.hero.is-danger .navbar-item,.hero.is-danger .navbar-link{color:#ffffffb3}.hero.is-danger a.navbar-item:hover,.hero.is-danger a.navbar-item.is-active,.hero.is-danger .navbar-link:hover,.hero.is-danger .navbar-link.is-active{color:#fff;background-color:#ef2e55}.hero.is-danger .tabs a{color:#fff;opacity:.9}.hero.is-danger .tabs a:hover{opacity:1}.hero.is-danger .tabs li.is-active a{opacity:1;color:#f14668!important}.hero.is-danger .tabs.is-boxed a,.hero.is-danger .tabs.is-toggle a{color:#fff}.hero.is-danger .tabs.is-boxed a:hover,.hero.is-danger .tabs.is-toggle a:hover{background-color:#0a0a0a1a}.hero.is-danger .tabs.is-boxed li.is-active a,.hero.is-danger .tabs.is-boxed li.is-active a:hover,.hero.is-danger .tabs.is-toggle li.is-active a,.hero.is-danger .tabs.is-toggle li.is-active a:hover{color:#f14668;background-color:#fff;border-color:#fff}.hero.is-danger.is-bold{background-image:linear-gradient(141deg,#fa0a62 0%,#f14668 71%,#f7595f 100%)}@media screen and (max-width:768px){.hero.is-danger.is-bold .navbar-menu{background-image:linear-gradient(141deg,#fa0a62 0%,#f14668 71%,#f7595f 100%)}}.hero.is-small .hero-body{padding:1.5rem}@media screen and (min-width:769px),print{.hero.is-medium .hero-body{padding:9rem 4.5rem}.hero.is-large .hero-body{padding:18rem 6rem}}.hero.is-halfheight .hero-body,.hero.is-fullheight .hero-body,.hero.is-fullheight-with-navbar .hero-body{align-items:center;display:flex}.hero.is-halfheight .hero-body>.container,.hero.is-fullheight .hero-body>.container,.hero.is-fullheight-with-navbar .hero-body>.container{flex-grow:1;flex-shrink:1}.hero.is-halfheight{min-height:50vh}.hero.is-fullheight{min-height:100vh}.hero-video{overflow:hidden}.hero-video video{min-height:100%;min-width:100%;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.hero-video.is-transparent{opacity:.3}@media screen and (max-width:768px){.hero-video{display:none}}.hero-buttons{margin-top:1.5rem}@media screen and (max-width:768px){.hero-buttons .button{display:flex}.hero-buttons .button:not(:last-child){margin-bottom:.75rem}}@media screen and (min-width:769px),print{.hero-buttons{justify-content:center;display:flex}.hero-buttons .button:not(:last-child){margin-right:1.5rem}}.hero-head,.hero-foot{flex-grow:0;flex-shrink:0}.hero-body{flex-grow:1;flex-shrink:0;padding:3rem 1.5rem}@media screen and (min-width:769px),print{.hero-body{padding:3rem}}.section{padding:3rem 1.5rem}@media screen and (min-width:1024px){.section{padding:3rem}.section.is-medium{padding:9rem 4.5rem}.section.is-large{padding:18rem 6rem}}.footer{background-color:#fafafa;padding:3rem 1.5rem 6rem}ul{margin:0;padding:0}body{box-sizing:border-box;background:#dbebe9}*{box-sizing:inherit}.memoryBank{padding-left:8px;padding-right:8px;font-size:12px}.registerSeparator{height:2px;width:100%;background-color:#a1a1a1}.selectedMemoryChar{background:#bfd4f6}.framedBox{border:2px groove threedface;border-color:#000;border-top-style:none;border-radius:6px;margin:1em 2px;padding:.25em;font-family:Lucida Console,Monaco,monospace}.framedBox.active{border-color:red}.framedBox.is-inline-block{display:inline-block}.framedBox>h1{margin:-.75em -.5em 0;font:1em normal}.framedBox>h1>span{float:left}.framedBox>h1:before{border-top:2px groove threedface;content:" ";float:left;width:.5em;margin:.5em 2px 0 6px}.framedBox>h1:after{border-top:2px groove threedface;content:" ";height:1.5em;margin:0 8px 0 0;display:block;position:relative;top:.5em;left:2px;overflow:hidden} +/*# sourceMappingURL=index.9b3d37c0.css.map */ diff --git a/index.efd5c7de.js b/index.efd5c7de.js new file mode 100644 index 0000000..43466d6 --- /dev/null +++ b/index.efd5c7de.js @@ -0,0 +1,48 @@ +function e(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{};function n(e){return e&&e.__esModule?e.default:e}var r={},i={},o=t.parcelRequired6a3;null==o&&((o=function(e){if(e in r)return r[e].exports;if(e in i){var t=i[e];delete i[e];var n={id:e,exports:{}};return r[e]=n,t.call(n.exports,n,n.exports),n.exports}var o=new Error("Cannot find module '"+e+"'");throw o.code="MODULE_NOT_FOUND",o}).register=function(e,t){i[e]=t},t.parcelRequired6a3=o),o.register("kyEFX",(function(t,n){var r,i;e(t.exports,"register",(function(){return r}),(function(e){return r=e})),e(t.exports,"resolve",(function(){return i}),(function(e){return i=e}));var o={};r=function(e){for(var t=Object.keys(e),n=0;n